All files / backend/src/services/scaffold-model types.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84                            3x                                                                                                                                          
/**
 * Scaffold Model Types
 *
 * Type definitions for the scaffold model service.
 */
 
/**
 * Supported data types for scaffolding
 */
export type ScaffoldDataType = 'single' | 'collection';
 
/**
 * Supported file extensions for scaffolding
 */
export const SCAFFOLD_SUPPORTED_EXTENSIONS = [
  'yaml',
  'yml',
  'toml',
  'json',
  'md',
  'markdown',
  'qmd',
] as const;
 
export type ScaffoldSupportedExtension = (typeof SCAFFOLD_SUPPORTED_EXTENSIONS)[number];
 
/**
 * Field definition inferred from data
 */
export interface InferredField {
  key: string;
  type: string;
  fields?: InferredField[];
  groupdata?: boolean;
  /** Child field definition for leaf-array type */
  field?: {
    key: string;
    type: string;
    title?: string;
  };
}
 
/**
 * Model configuration for a single
 */
export interface SingleModelConfig {
  key: string;
  title: string;
  file: string;
  dataformat: string;
  fields: InferredField[];
}
 
/**
 * Model configuration for a collection
 */
export interface CollectionModelConfig {
  key: string;
  title: string;
  folder: string;
  extension: string;
  dataformat: string;
  itemtitle: string;
  fields: InferredField[];
}
 
/**
 * Result of a scaffold operation
 */
export interface ScaffoldResult {
  success: boolean;
  modelKey?: string;
  modelPath?: string;
  error?: string;
}
 
/**
 * Dependencies for ScaffoldModelService
 */
export interface ScaffoldModelServiceDependencies {
  dialogAdapter: import('../../adapters/types.js').DialogAdapter;
  formatResolver: import('../../utils/format-provider-resolver.js').FormatProviderResolver;
}