@stonecrop/schema 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/package.json +14 -9
  2. package/dist/cli.cjs +0 -41
  3. package/dist/cli.cjs.map +0 -1
  4. package/dist/converter/heuristics.js +0 -258
  5. package/dist/converter/index.js +0 -181
  6. package/dist/converter/scalars.js +0 -86
  7. package/dist/converter/types.js +0 -5
  8. package/dist/converter-CYNFRwPg.js +0 -512
  9. package/dist/converter-CYNFRwPg.js.map +0 -1
  10. package/dist/converter-DNwpowpq.js +0 -459
  11. package/dist/converter-DNwpowpq.js.map +0 -1
  12. package/dist/doctype.js +0 -152
  13. package/dist/field.js +0 -110
  14. package/dist/fieldtype.js +0 -97
  15. package/dist/index--rNo7Kel.js +0 -494
  16. package/dist/index--rNo7Kel.js.map +0 -1
  17. package/dist/index-0qWNlDQ5.js +0 -450
  18. package/dist/index-0qWNlDQ5.js.map +0 -1
  19. package/dist/index-2UVTfbcY.js +0 -448
  20. package/dist/index-2UVTfbcY.js.map +0 -1
  21. package/dist/index-9QjWZ_PC.js +0 -449
  22. package/dist/index-9QjWZ_PC.js.map +0 -1
  23. package/dist/index-BCADNO5M.js +0 -449
  24. package/dist/index-BCADNO5M.js.map +0 -1
  25. package/dist/index-BJjSlCSo.js +0 -496
  26. package/dist/index-BJjSlCSo.js.map +0 -1
  27. package/dist/index-BRQJGVFR.js +0 -453
  28. package/dist/index-BRQJGVFR.js.map +0 -1
  29. package/dist/index-BatnoC-J.js +0 -429
  30. package/dist/index-BatnoC-J.js.map +0 -1
  31. package/dist/index-BbG7Mzvg.js +0 -495
  32. package/dist/index-BbG7Mzvg.js.map +0 -1
  33. package/dist/index-BdCmYHg0.js +0 -493
  34. package/dist/index-BdCmYHg0.js.map +0 -1
  35. package/dist/index-BhMd2_xl.js +0 -454
  36. package/dist/index-BhMd2_xl.js.map +0 -1
  37. package/dist/index-BzhZpuzA.js +0 -556
  38. package/dist/index-BzhZpuzA.js.map +0 -1
  39. package/dist/index-C1oC7Xwz.js +0 -552
  40. package/dist/index-C1oC7Xwz.js.map +0 -1
  41. package/dist/index-C5ANE_rn.js +0 -501
  42. package/dist/index-C5ANE_rn.js.map +0 -1
  43. package/dist/index-C8F23K8c.js +0 -555
  44. package/dist/index-C8F23K8c.js.map +0 -1
  45. package/dist/index-CD5wQNH-.js +0 -516
  46. package/dist/index-CD5wQNH-.js.map +0 -1
  47. package/dist/index-CLc5mUMQ.js +0 -478
  48. package/dist/index-CLc5mUMQ.js.map +0 -1
  49. package/dist/index-CMeexvC6.js +0 -459
  50. package/dist/index-CMeexvC6.js.map +0 -1
  51. package/dist/index-COrltkHl.js +0 -401
  52. package/dist/index-COrltkHl.js.map +0 -1
  53. package/dist/index-CX662Zb2.js +0 -551
  54. package/dist/index-CX662Zb2.js.map +0 -1
  55. package/dist/index-Cq_yfoqI.js +0 -553
  56. package/dist/index-Cq_yfoqI.js.map +0 -1
  57. package/dist/index-Cu-6609R.js +0 -493
  58. package/dist/index-Cu-6609R.js.map +0 -1
  59. package/dist/index-CvN9xK1B.js +0 -453
  60. package/dist/index-CvN9xK1B.js.map +0 -1
  61. package/dist/index-CzoRIy1-.js +0 -408
  62. package/dist/index-CzoRIy1-.js.map +0 -1
  63. package/dist/index-D66L9JNw.js +0 -506
  64. package/dist/index-D66L9JNw.js.map +0 -1
  65. package/dist/index-D68mWfHm.js +0 -510
  66. package/dist/index-D68mWfHm.js.map +0 -1
  67. package/dist/index-D6Up-BP5.js +0 -435
  68. package/dist/index-D6Up-BP5.js.map +0 -1
  69. package/dist/index-D8R5ppAg.js +0 -529
  70. package/dist/index-D8R5ppAg.js.map +0 -1
  71. package/dist/index-D9qPYlSk.js +0 -491
  72. package/dist/index-D9qPYlSk.js.map +0 -1
  73. package/dist/index-DCjAX4l-.js +0 -516
  74. package/dist/index-DCjAX4l-.js.map +0 -1
  75. package/dist/index-DE0b6fs6.js +0 -515
  76. package/dist/index-DE0b6fs6.js.map +0 -1
  77. package/dist/index-DEkR-1RC.js +0 -496
  78. package/dist/index-DEkR-1RC.js.map +0 -1
  79. package/dist/index-DIY_FLR2.js +0 -516
  80. package/dist/index-DIY_FLR2.js.map +0 -1
  81. package/dist/index-DIb_Z0wI.js +0 -476
  82. package/dist/index-DIb_Z0wI.js.map +0 -1
  83. package/dist/index-DNROIEMe.js +0 -449
  84. package/dist/index-DNROIEMe.js.map +0 -1
  85. package/dist/index-DT-NJBvW.js +0 -510
  86. package/dist/index-DT-NJBvW.js.map +0 -1
  87. package/dist/index-DUFcQC-H.js +0 -449
  88. package/dist/index-DUFcQC-H.js.map +0 -1
  89. package/dist/index-DVVTsJNb.js +0 -495
  90. package/dist/index-DVVTsJNb.js.map +0 -1
  91. package/dist/index-DYy5E1cU.js +0 -508
  92. package/dist/index-DYy5E1cU.js.map +0 -1
  93. package/dist/index-DdC5tpt-.js +0 -488
  94. package/dist/index-DdC5tpt-.js.map +0 -1
  95. package/dist/index-Dk593rMz.js +0 -512
  96. package/dist/index-Dk593rMz.js.map +0 -1
  97. package/dist/index-DmD8vmuB.js +0 -449
  98. package/dist/index-DmD8vmuB.js.map +0 -1
  99. package/dist/index-DpCFgELB.js +0 -514
  100. package/dist/index-DpCFgELB.js.map +0 -1
  101. package/dist/index-DqxTn6jG.js +0 -488
  102. package/dist/index-DqxTn6jG.js.map +0 -1
  103. package/dist/index-DyK5-0kh.js +0 -514
  104. package/dist/index-DyK5-0kh.js.map +0 -1
  105. package/dist/index-Vd0_gZjr.js +0 -451
  106. package/dist/index-Vd0_gZjr.js.map +0 -1
  107. package/dist/index-XSSAHj8g.js +0 -495
  108. package/dist/index-XSSAHj8g.js.map +0 -1
  109. package/dist/index-XZZbfFxT.js +0 -434
  110. package/dist/index-XZZbfFxT.js.map +0 -1
  111. package/dist/index-YP0m26Y5.js +0 -555
  112. package/dist/index-YP0m26Y5.js.map +0 -1
  113. package/dist/index-_3q9Bzka.js +0 -512
  114. package/dist/index-_3q9Bzka.js.map +0 -1
  115. package/dist/index-aeXXzPET.cjs +0 -2
  116. package/dist/index-aeXXzPET.cjs.map +0 -1
  117. package/dist/index-glU_Uw7z.js +0 -543
  118. package/dist/index-glU_Uw7z.js.map +0 -1
  119. package/dist/index-i0Uz8G2K.js +0 -554
  120. package/dist/index-i0Uz8G2K.js.map +0 -1
  121. package/dist/index-neVkjlgB.js +0 -446
  122. package/dist/index-neVkjlgB.js.map +0 -1
  123. package/dist/index-xdlVWldg.js +0 -408
  124. package/dist/index-xdlVWldg.js.map +0 -1
  125. package/dist/index.cjs +0 -2
  126. package/dist/index.cjs.map +0 -1
  127. package/dist/jsonschema.js +0 -225
  128. package/dist/naming.js +0 -106
  129. package/dist/src/fieldtype.d.ts +0 -63
  130. package/dist/src/fieldtype.d.ts.map +0 -1
  131. package/dist/src/fieldtype.js +0 -106
  132. package/dist/src/jsonschema.d.ts +0 -95
  133. package/dist/src/jsonschema.d.ts.map +0 -1
  134. package/dist/src/schema-field.d.ts +0 -66
  135. package/dist/src/schema-field.d.ts.map +0 -1
  136. package/dist/src/schema-field.js +0 -0
  137. package/dist/src/tsdoc-metadata.json +0 -11
  138. package/dist/validation.js +0 -60
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-xdlVWldg.js","sources":["../src/fieldtype.ts","../src/field.ts","../src/doctype.ts","../src/validation.ts","../src/naming.ts","../src/converter/scalars.ts","../src/converter/heuristics.ts","../src/converter/index.ts"],"sourcesContent":["import { z } from 'zod'\n\n/**\n * Stonecrop field types - the semantic type of the field.\n * These are consistent across forms and tables.\n * @public\n */\nexport const StonecropFieldType = z.enum([\n\t'Data', // Short text, varchar\n\t'Text', // Long text\n\t'Int', // Integer\n\t'Float', // Floating point (IEEE 754)\n\t'Decimal', // Arbitrary precision decimal\n\t'Check', // Boolean/checkbox\n\t'Date', // Date only\n\t'Time', // Time only\n\t'Datetime', // Date and time\n\t'Duration', // Time interval\n\t'DateRange', // Date range\n\t'JSON', // JSON data\n\t'Code', // Code/source (with syntax highlighting)\n\t'Link', // Reference to another doctype\n\t'Doctype', // Child doctype (renders as table)\n\t'Attach', // File attachment\n\t'Currency', // Currency value\n\t'Quantity', // Quantity with unit\n\t'Select', // Dropdown selection\n])\n\n/**\n * Stonecrop field type enum inferred from Zod schema\n * @public\n */\nexport type StonecropFieldType = z.infer<typeof StonecropFieldType>\n\n/**\n * Field template for TYPE_MAP entries.\n * Defines the default component and semantic field type for a field.\n * @public\n */\nexport interface FieldTemplate {\n\t/**\n\t * The Vue component name to render this field (e.g., 'ATextInput', 'ADropdown')\n\t */\n\tcomponent: string\n\t/**\n\t * The semantic field type (e.g., 'Data', 'Int', 'Select')\n\t */\n\tfieldtype: StonecropFieldType\n}\n\n/**\n * Mapping from StonecropFieldType to default Vue component.\n * Components can be overridden in the field definition.\n * @public\n */\nexport const TYPE_MAP: Record<StonecropFieldType, FieldTemplate> = {\n\t// Text\n\tData: { component: 'ATextInput', fieldtype: 'Data' },\n\tText: { component: 'ATextInput', fieldtype: 'Text' },\n\n\t// Numeric\n\tInt: { component: 'ANumericInput', fieldtype: 'Int' },\n\tFloat: { component: 'ANumericInput', fieldtype: 'Float' },\n\tDecimal: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\n\t// Boolean\n\tCheck: { component: 'ACheckbox', fieldtype: 'Check' },\n\n\t// Date/Time\n\tDate: { component: 'ADate', fieldtype: 'Date' },\n\tTime: { component: 'ATimeInput', fieldtype: 'Time' },\n\tDatetime: { component: 'ADatetimePicker', fieldtype: 'Datetime' },\n\tDuration: { component: 'ADurationInput', fieldtype: 'Duration' },\n\tDateRange: { component: 'ADateRangePicker', fieldtype: 'DateRange' },\n\n\t// Structured\n\tJSON: { component: 'ACodeEditor', fieldtype: 'JSON' },\n\tCode: { component: 'ACodeEditor', fieldtype: 'Code' },\n\n\t// Relational\n\tLink: { component: 'ALink', fieldtype: 'Link' },\n\tDoctype: { component: 'ATable', fieldtype: 'Doctype' },\n\n\t// Files\n\tAttach: { component: 'AFileAttach', fieldtype: 'Attach' },\n\n\t// Specialized\n\tCurrency: { component: 'ACurrencyInput', fieldtype: 'Currency' },\n\tQuantity: { component: 'AQuantityInput', fieldtype: 'Quantity' },\n\tSelect: { component: 'ADropdown', fieldtype: 'Select' },\n}\n\n/**\n * Get the default component for a field type\n * @param fieldtype - The semantic field type\n * @returns The default component name\n * @public\n */\nexport function getDefaultComponent(fieldtype: StonecropFieldType): string {\n\treturn TYPE_MAP[fieldtype]?.component ?? 'ATextInput'\n}\n","import { z } from 'zod'\n\nimport { StonecropFieldType } from './fieldtype'\n\n/**\n * Field options - flexible bag for type-specific configuration.\n *\n * Usage by fieldtype:\n * - Link/Doctype: target doctype slug as string (\"customer\", \"sales-order-item\")\n * - Select: array of choices ([\"Draft\", \"Submitted\", \"Cancelled\"])\n * - Decimal: config object (\\{ precision: 10, scale: 2 \\})\n * - Code: config object (\\{ language: \"python\" \\})\n *\n * @public\n */\nexport const FieldOptions = z.union([\n\tz.string(), // Link/Doctype target: \"customer\"\n\tz.array(z.string()), // Select choices: [\"A\", \"B\", \"C\"]\n\tz.record(z.string(), z.unknown()), // Config: \\{ precision: 10, scale: 2 \\}\n])\n\n/**\n * Field options type inferred from Zod schema\n * @public\n */\nexport type FieldOptions = z.infer<typeof FieldOptions>\n\n/**\n * Validation configuration for form fields\n * @public\n */\nexport const FieldValidation = z.looseObject({\n\t/** Error message to display when validation fails */\n\terrorMessage: z.string(),\n})\n\n/**\n * Field validation type inferred from Zod schema\n * @public\n */\nexport type FieldValidation = z.infer<typeof FieldValidation>\n\n/**\n * Unified field metadata - the single source of truth for field definitions.\n * Works for both forms (AForm) and tables (ATable).\n *\n * Core principle: \"Text\" is \"Text\" regardless of rendering context.\n *\n * @public\n */\nexport const FieldMeta = z.object({\n\t// === CORE (required) ===\n\n\t/** Unique identifier for the field within its doctype */\n\tfieldname: z.string().min(1),\n\n\t/** Semantic field type - determines behavior and default component */\n\tfieldtype: StonecropFieldType,\n\n\t// === COMPONENT (optional - derived from fieldtype when not specified) ===\n\n\t/** Vue component to render this field. If not specified, derived from TYPE_MAP */\n\tcomponent: z.string().optional(),\n\n\t// === DISPLAY ===\n\n\t/** Human-readable label for the field */\n\tlabel: z.string().optional(),\n\n\t/** Width of the field (CSS value, e.g., \"40ch\", \"200px\") */\n\twidth: z.string().optional(),\n\n\t/** Text alignment within the field */\n\talign: z.enum(['left', 'center', 'right', 'start', 'end']).optional(),\n\n\t// === BEHAVIOR ===\n\n\t/** Whether the field is required */\n\trequired: z.boolean().optional(),\n\n\t/** Whether the field is read-only */\n\treadOnly: z.boolean().optional(),\n\n\t/** Whether the field is editable (for table cells) */\n\tedit: z.boolean().optional(),\n\n\t/** Whether the field is hidden from the UI */\n\thidden: z.boolean().optional(),\n\n\t// === VALUE ===\n\n\t/** Current value of the field */\n\tvalue: z.unknown().optional(),\n\n\t/** Default value for new records */\n\tdefault: z.unknown().optional(),\n\n\t// === TYPE-SPECIFIC ===\n\n\t/**\n\t * Type-specific options:\n\t * - Link: target doctype slug (\"customer\")\n\t * - Doctype: child doctype slug (\"sales-order-item\")\n\t * - Select: choices array ([\"Draft\", \"Submitted\"])\n\t * - Decimal: \\{ precision, scale \\}\n\t * - Code: \\{ language \\}\n\t */\n\toptions: FieldOptions.optional(),\n\n\t/**\n\t * Input mask pattern. Accepts either a plain mask string or a stringified\n\t * arrow function that receives `locale` and returns a mask string.\n\t *\n\t * Plain pattern: `\"##/##/####\"`\n\t *\n\t * Function pattern: `\"(locale) => locale === 'en-US' ? '(###) ###-####' : '####-######'\"`\n\t */\n\tmask: z.string().optional(),\n\n\t// === VALIDATION ===\n\n\t/** Validation configuration */\n\tvalidation: FieldValidation.optional(),\n})\n\n/**\n * Field metadata type inferred from Zod schema\n * @public\n */\nexport type FieldMeta = z.infer<typeof FieldMeta>\n","import { z } from 'zod'\n\nimport { FieldMeta } from './field'\n\n/**\n * Action definition within a workflow\n * @public\n */\nexport const ActionDefinition = z.object({\n\t/** Display label for the action */\n\tlabel: z.string().min(1),\n\n\t/** Handler function name or path */\n\thandler: z.string().min(1),\n\n\t/** Fields that must have values before action can execute */\n\trequiredFields: z.array(z.string()).optional(),\n\n\t/** Workflow states where this action is available */\n\tallowedStates: z.array(z.string()).optional(),\n\n\t/** Whether to show a confirmation dialog */\n\tconfirm: z.boolean().optional(),\n\n\t/** Additional arguments for the action */\n\targs: z.record(z.string(), z.unknown()).optional(),\n})\n\n/**\n * Action definition type inferred from Zod schema\n * @public\n */\nexport type ActionDefinition = z.infer<typeof ActionDefinition>\n\n/**\n * Workflow metadata - states and actions for a doctype\n * @public\n */\nexport const WorkflowMeta = z.object({\n\t/** List of workflow states */\n\tstates: z.array(z.string()).optional(),\n\n\t/** Actions available in this workflow */\n\tactions: z.record(z.string(), ActionDefinition).optional(),\n})\n\n/**\n * Workflow metadata type inferred from Zod schema\n * @public\n */\nexport type WorkflowMeta = z.infer<typeof WorkflowMeta>\n\n/**\n * Doctype metadata - complete definition of a doctype\n * @public\n */\nexport const DoctypeMeta = z.object({\n\t/** Display name of the doctype */\n\tname: z.string().min(1),\n\n\t/** URL-friendly slug (kebab-case) */\n\tslug: z.string().min(1).optional(),\n\n\t/** Database table name */\n\ttableName: z.string().optional(),\n\n\t/** Field definitions */\n\tfields: z.array(FieldMeta),\n\n\t/** Workflow configuration */\n\tworkflow: WorkflowMeta.optional(),\n\n\t/** Parent doctype for inheritance */\n\tinherits: z.string().optional(),\n\n\t/** Doctype to use for list views */\n\tlistDoctype: z.string().optional(),\n\n\t/** Parent doctype for child tables */\n\tparentDoctype: z.string().optional(),\n})\n\n/**\n * Doctype metadata type inferred from Zod schema\n * @public\n */\nexport type DoctypeMeta = z.infer<typeof DoctypeMeta>\n\n/**\n * Context for identifying what doctype/record we're working with.\n * Used by graphql-middleware and graphql-client to resolve schema metadata.\n * @public\n */\nexport interface DoctypeContext {\n\t/** Doctype name (e.g., 'Task', 'Customer') */\n\tdoctype: string\n\t/** Optional record ID for viewing/editing a specific record */\n\trecordId?: string\n\t/** Additional context properties */\n\t[key: string]: unknown\n}\n\n/**\n * Base interface for doctype metadata passed to DataClient methods.\n * Only requires properties needed for record fetching.\n * @public\n */\nexport interface DoctypeRef {\n\t/** Doctype name (e.g., 'Task', 'Customer') */\n\tname: string\n\t/** URL-friendly slug (e.g., 'task', 'customer') */\n\tslug?: string\n}\n\n/**\n * Interface for data clients that fetch doctype metadata and records.\n * Implemented by \\@stonecrop/graphql-client's StonecropClient.\n * Custom implementations can use any backend (REST, local storage, etc.).\n *\n * @typeParam T - Doctype reference type for record operations (defaults to DoctypeRef)\n * @typeParam M - Doctype metadata return type for getMeta (defaults to DoctypeMeta)\n * @public\n */\nexport interface DataClient<T extends DoctypeRef = DoctypeRef, M = DoctypeMeta> {\n\t/**\n\t * Fetch doctype metadata\n\t * @param context - Doctype context identifying the doctype\n\t * @returns Doctype metadata or null if not found\n\t */\n\tgetMeta(context: DoctypeContext): Promise<M | null>\n\n\t/**\n\t * Fetch a single record by ID\n\t * @param doctype - Doctype reference (name and optional slug)\n\t * @param recordId - Record ID to fetch\n\t * @returns Record data or null if not found\n\t */\n\tgetRecord(doctype: T, recordId: string): Promise<Record<string, unknown> | null>\n\n\t/**\n\t * Fetch multiple records\n\t * @param doctype - Doctype reference (name and optional slug)\n\t * @param options - Optional filters, pagination, sorting\n\t * @returns Array of record data\n\t */\n\tgetRecords(\n\t\tdoctype: T,\n\t\toptions?: {\n\t\t\tfilters?: Record<string, unknown>\n\t\t\torderBy?: string\n\t\t\tlimit?: number\n\t\t\toffset?: number\n\t\t}\n\t): Promise<Record<string, unknown>[]>\n\n\t/**\n\t * Execute a doctype action (e.g., SUBMIT, APPROVE, save).\n\t * All state changes flow through this single mutation endpoint.\n\t *\n\t * @param doctype - Doctype reference (name and optional slug)\n\t * @param action - Action name to execute (e.g., 'SUBMIT', 'APPROVE', 'save')\n\t * @param args - Action arguments (typically record ID and/or form data)\n\t * @returns Action result with success status, response data, and any error\n\t */\n\trunAction(\n\t\tdoctype: T,\n\t\taction: string,\n\t\targs?: unknown[]\n\t): Promise<{ success: boolean; data: unknown; error: string | null }>\n}\n","import { FieldMeta } from './field'\nimport { DoctypeMeta } from './doctype'\n\n/**\n * Validation error with path information\n * @public\n */\nexport interface ValidationError {\n\t/** Path to the invalid property */\n\tpath: PropertyKey[]\n\n\t/** Error message */\n\tmessage: string\n}\n\n/**\n * Result of a validation operation\n * @public\n */\nexport interface ValidationResult {\n\t/** Whether validation passed */\n\tsuccess: boolean\n\n\t/** List of validation errors (empty if success) */\n\terrors: ValidationError[]\n}\n\n/**\n * Validate a field definition\n * @param data - Data to validate\n * @returns Validation result\n * @public\n */\nexport function validateField(data: unknown): ValidationResult {\n\tconst result = FieldMeta.safeParse(data)\n\n\tif (result.success) {\n\t\treturn { success: true, errors: [] }\n\t}\n\n\treturn {\n\t\tsuccess: false,\n\t\terrors: result.error.issues.map(issue => ({\n\t\t\tpath: issue.path,\n\t\t\tmessage: issue.message,\n\t\t})),\n\t}\n}\n\n/**\n * Validate a doctype definition\n * @param data - Data to validate\n * @returns Validation result\n * @public\n */\nexport function validateDoctype(data: unknown): ValidationResult {\n\tconst result = DoctypeMeta.safeParse(data)\n\n\tif (result.success) {\n\t\treturn { success: true, errors: [] }\n\t}\n\n\treturn {\n\t\tsuccess: false,\n\t\terrors: result.error.issues.map(issue => ({\n\t\t\tpath: issue.path,\n\t\t\tmessage: issue.message,\n\t\t})),\n\t}\n}\n\n/**\n * Parse and validate a field, throwing on failure\n * @param data - Data to parse\n * @returns Validated FieldMeta\n * @throws ZodError if validation fails\n * @public\n */\nexport function parseField(data: unknown): FieldMeta {\n\treturn FieldMeta.parse(data)\n}\n\n/**\n * Parse and validate a doctype, throwing on failure\n * @param data - Data to parse\n * @returns Validated DoctypeMeta\n * @throws ZodError if validation fails\n * @public\n */\nexport function parseDoctype(data: unknown): DoctypeMeta {\n\treturn DoctypeMeta.parse(data)\n}\n\n// Re-export types for convenience\nexport type { FieldMeta } from './field'\nexport type { DoctypeMeta } from './doctype'\n","/**\n * Naming Convention Utilities\n * Converts between various naming conventions (snake_case, camelCase, PascalCase, kebab-case)\n * @packageDocumentation\n */\n\n/**\n * Converts snake_case to camelCase\n * @param snakeCase - Snake case string\n * @returns Camel case string\n * @public\n * @example\n * ```typescript\n * snakeToCamel('user_email') // 'userEmail'\n * snakeToCamel('created_at') // 'createdAt'\n * ```\n */\nexport function snakeToCamel(snakeCase: string): string {\n\treturn snakeCase.replace(/_([a-z])/g, (_: string, letter: string) => letter.toUpperCase())\n}\n\n/**\n * Converts camelCase to snake_case\n * @param camelCase - Camel case string\n * @returns Snake case string\n * @public\n * @example\n * ```typescript\n * camelToSnake('userEmail') // 'user_email'\n * camelToSnake('createdAt') // 'created_at'\n * ```\n */\nexport function camelToSnake(camelCase: string): string {\n\treturn camelCase.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)\n}\n\n/**\n * Converts snake_case to Title Case label\n * @param snakeCase - Snake case string\n * @returns Title case label\n * @public\n * @example\n * ```typescript\n * snakeToLabel('user_email') // 'User Email'\n * snakeToLabel('first_name') // 'First Name'\n * ```\n */\nexport function snakeToLabel(snakeCase: string): string {\n\treturn snakeCase\n\t\t.split('_')\n\t\t.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join(' ')\n}\n\n/**\n * Converts camelCase to Title Case label\n * @param camelCase - Camel case string\n * @returns Title case label\n * @public\n * @example\n * ```typescript\n * camelToLabel('userEmail') // 'User Email'\n * camelToLabel('firstName') // 'First Name'\n * ```\n */\nexport function camelToLabel(camelCase: string): string {\n\tconst withSpaces = camelCase.replace(/([A-Z])/g, ' $1').trim()\n\treturn withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1)\n}\n\n/**\n * Convert table name to PascalCase doctype name\n * @param tableName - SQL table name (snake_case)\n * @returns PascalCase name\n * @public\n */\nexport function toPascalCase(tableName: string): string {\n\treturn tableName\n\t\t.split(/[-_\\s]+/)\n\t\t.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join('')\n}\n\n/**\n * Convert to kebab-case slug\n * @param name - Name to convert\n * @returns kebab-case slug\n * @public\n */\nexport function toSlug(name: string): string {\n\treturn name\n\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t.replace(/[\\s_]+/g, '-')\n\t\t.toLowerCase()\n}\n\n/**\n * Convert PascalCase to snake_case (e.g., for deriving table names from type names)\n * @param pascal - PascalCase string\n * @returns snake_case string\n * @public\n * @example\n * ```typescript\n * pascalToSnake('SalesOrder') // 'sales_order'\n * pascalToSnake('SalesOrderItem') // 'sales_order_item'\n * ```\n */\nexport function pascalToSnake(pascal: string): string {\n\treturn pascal\n\t\t.replace(/([a-z])([A-Z])/g, '$1_$2')\n\t\t.replace(/[\\s-]+/g, '_')\n\t\t.toLowerCase()\n}\n","/**\n * GraphQL Scalar Type Mappings\n *\n * Maps standard GraphQL scalars and well-known custom scalars to Stonecrop field types.\n * Source-agnostic — covers scalars commonly emitted by PostGraphile, Hasura, Apollo, etc.\n *\n * Users can extend these via the `customScalars` option in `GraphQLConversionOptions`.\n *\n * @packageDocumentation\n */\n\nimport type { FieldTemplate } from '../fieldtype'\n\n/**\n * Mapping from standard GraphQL scalar types to Stonecrop field types.\n * These are defined by the GraphQL specification and are always available.\n *\n * @public\n */\nexport const GQL_SCALAR_MAP: Record<string, FieldTemplate> = {\n\tString: { component: 'ATextInput', fieldtype: 'Data' },\n\tInt: { component: 'ANumericInput', fieldtype: 'Int' },\n\tFloat: { component: 'ANumericInput', fieldtype: 'Float' },\n\tBoolean: { component: 'ACheckbox', fieldtype: 'Check' },\n\tID: { component: 'ATextInput', fieldtype: 'Data' },\n}\n\n/**\n * Mapping from well-known custom GraphQL scalars to Stonecrop field types.\n * These cover scalars commonly used across GraphQL servers (PostGraphile, Hasura, etc.)\n * without baking in knowledge of any specific server.\n *\n * Entries here have lower precedence than `customScalars` from options, but higher\n * precedence than unknown/unmapped scalars.\n *\n * @public\n */\nexport const WELL_KNOWN_SCALARS: Record<string, FieldTemplate> = {\n\t// Arbitrary precision / large numbers\n\tBigFloat: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\tBigDecimal: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\tDecimal: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\tBigInt: { component: 'ANumericInput', fieldtype: 'Int' },\n\tLong: { component: 'ANumericInput', fieldtype: 'Int' },\n\n\t// Identifiers\n\tUUID: { component: 'ATextInput', fieldtype: 'Data' },\n\n\t// Date / Time\n\tDateTime: { component: 'ADatetimePicker', fieldtype: 'Datetime' },\n\tDatetime: { component: 'ADatetimePicker', fieldtype: 'Datetime' },\n\tDate: { component: 'ADate', fieldtype: 'Date' },\n\tTime: { component: 'ATimeInput', fieldtype: 'Time' },\n\tInterval: { component: 'ADurationInput', fieldtype: 'Duration' },\n\tDuration: { component: 'ADurationInput', fieldtype: 'Duration' },\n\n\t// Structured data\n\tJSON: { component: 'ACodeEditor', fieldtype: 'JSON' },\n\tJSONObject: { component: 'ACodeEditor', fieldtype: 'JSON' },\n\tJsonNode: { component: 'ACodeEditor', fieldtype: 'JSON' },\n}\n\n/**\n * Set of scalar type names that are internal to GraphQL servers and should be skipped\n * during field conversion (they don't represent meaningful data fields).\n *\n * @public\n */\nexport const INTERNAL_SCALARS = new Set(['Cursor'])\n\n/**\n * Build a merged scalar map from the built-in maps and user-provided custom scalars.\n * Precedence (highest to lowest): customScalars → GQL_SCALAR_MAP → WELL_KNOWN_SCALARS\n *\n * @param customScalars - User-provided scalar overrides\n * @returns Merged scalar map\n * @public\n */\nexport function buildScalarMap(customScalars?: Record<string, Partial<FieldTemplate>>): Record<string, FieldTemplate> {\n\tconst merged: Record<string, FieldTemplate> = { ...WELL_KNOWN_SCALARS }\n\n\t// Standard scalars override well-known\n\tfor (const [key, value] of Object.entries(GQL_SCALAR_MAP)) {\n\t\tmerged[key] = value\n\t}\n\n\t// Custom scalars override everything\n\tif (customScalars) {\n\t\tfor (const [key, value] of Object.entries(customScalars)) {\n\t\t\tmerged[key] = {\n\t\t\t\tcomponent: value.component ?? 'ATextInput',\n\t\t\t\tfieldtype: value.fieldtype ?? 'Data',\n\t\t\t}\n\t\t}\n\t}\n\n\treturn merged\n}\n","/**\n * Default heuristics for identifying entity types and fields in a GraphQL schema.\n *\n * These heuristics work across common GraphQL servers (PostGraphile, Hasura, Apollo, etc.)\n * by detecting widely-adopted conventions like the Relay connection pattern.\n *\n * All heuristics can be overridden via the `isEntityType`, `isEntityField`, and\n * `classifyField` options in `GraphQLConversionOptions`.\n *\n * @packageDocumentation\n */\n\nimport {\n\tisScalarType,\n\tisEnumType,\n\tisObjectType,\n\tisListType,\n\tisNonNullType,\n\ttype GraphQLObjectType,\n\ttype GraphQLField,\n\ttype GraphQLOutputType,\n\ttype GraphQLNamedType,\n} from 'graphql'\n\nimport type { FieldTemplate } from '../fieldtype'\nimport type { GraphQLConversionFieldMeta, GraphQLConversionOptions } from './types'\nimport { buildScalarMap, INTERNAL_SCALARS } from './scalars'\nimport { toSlug, camelToLabel } from '../naming'\n\n/**\n * Suffixes that identify synthetic/framework types generated by GraphQL servers.\n * Types ending with these suffixes are typically not entities.\n */\nconst SYNTHETIC_SUFFIXES = [\n\t'Connection',\n\t'Edge',\n\t'Input',\n\t'Patch',\n\t'Payload',\n\t'Condition',\n\t'Filter',\n\t'OrderBy',\n\t'Aggregate',\n\t'AggregateResult',\n\t'AggregateFilter',\n\t'DeleteResponse',\n\t'InsertResponse',\n\t'UpdateResponse',\n\t'MutationResponse',\n]\n\n/**\n * Root operation type names that are never entities.\n */\nconst ROOT_TYPE_NAMES = new Set(['Query', 'Mutation', 'Subscription'])\n\n/**\n * Default heuristic to determine if a GraphQL object type represents an entity.\n * An entity type becomes a Stonecrop doctype.\n *\n * This heuristic excludes:\n * - Introspection types (`__*`)\n * - Root operation types (`Query`, `Mutation`, `Subscription`)\n * - Types with synthetic suffixes (e.g., `*Connection`, `*Edge`, `*Input`)\n * - Types starting with `Node` interface marker (exact match only)\n *\n * @param typeName - The GraphQL type name\n * @param type - The GraphQL object type definition\n * @returns `true` if this type should become a Stonecrop doctype\n * @public\n */\nexport function defaultIsEntityType(typeName: string, type: GraphQLObjectType): boolean {\n\t// Exclude introspection types\n\tif (typeName.startsWith('__')) {\n\t\treturn false\n\t}\n\n\t// Exclude root operation types\n\tif (ROOT_TYPE_NAMES.has(typeName)) {\n\t\treturn false\n\t}\n\n\t// Exclude the Node interface marker type\n\tif (typeName === 'Node') {\n\t\treturn false\n\t}\n\n\t// Exclude types matching synthetic suffixes\n\tfor (const suffix of SYNTHETIC_SUFFIXES) {\n\t\tif (typeName.endsWith(suffix)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Must have at least one field\n\tconst fields = type.getFields()\n\tif (Object.keys(fields).length === 0) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n/**\n * Fields to skip by default on entity types.\n * These are internal to GraphQL servers and don't represent semantic data.\n */\nconst SKIP_FIELDS = new Set(['nodeId', '__typename', 'clientMutationId'])\n\n/**\n * Default heuristic to filter fields on entity types.\n * Skips internal fields that don't represent meaningful data.\n *\n * @param fieldName - The GraphQL field name\n * @param _field - The GraphQL field definition (unused in default implementation)\n * @param _parentType - The parent entity type (unused in default implementation)\n * @returns `true` if this field should be included\n * @public\n */\nexport function defaultIsEntityField(\n\tfieldName: string,\n\t_field: GraphQLField<unknown, unknown>,\n\t_parentType: GraphQLObjectType\n): boolean {\n\treturn !SKIP_FIELDS.has(fieldName)\n}\n\n/**\n * Unwrap NonNull and List wrappers from a GraphQL type, tracking nullability.\n *\n * @param type - The GraphQL output type\n * @returns The unwrapped named type, whether it's required, and whether it's a list\n * @internal\n */\nfunction unwrapType(type: GraphQLOutputType): {\n\tnamedType: GraphQLNamedType\n\trequired: boolean\n\tisList: boolean\n} {\n\tlet required = false\n\tlet isList = false\n\tlet current: GraphQLOutputType = type\n\n\t// Unwrap outer NonNull\n\tif (isNonNullType(current)) {\n\t\trequired = true\n\t\tcurrent = current.ofType\n\t}\n\n\t// Unwrap List\n\tif (isListType(current)) {\n\t\tisList = true\n\t\tcurrent = current.ofType\n\n\t\t// Unwrap inner NonNull (e.g., [Type!])\n\t\tif (isNonNullType(current)) {\n\t\t\tcurrent = current.ofType\n\t\t}\n\t}\n\n\t// At this point, current should be a named type\n\treturn { namedType: current as GraphQLNamedType, required, isList }\n}\n\n/**\n * Check if a GraphQL object type looks like a Relay Connection type.\n * A connection type has an `edges` field returning a list of edge types,\n * where each edge has a `node` field.\n *\n * @param type - The GraphQL object type to check\n * @returns The node type name if this is a connection, or `undefined`\n * @internal\n */\nfunction getConnectionNodeType(type: GraphQLObjectType): string | undefined {\n\tconst fields = type.getFields()\n\n\t// Must have an 'edges' field\n\tconst edgesField = fields['edges']\n\tif (!edgesField) return undefined\n\n\t// edges must be a list\n\tconst { namedType: edgesType, isList: edgesIsList } = unwrapType(edgesField.type)\n\tif (!edgesIsList || !isObjectType(edgesType)) return undefined\n\n\t// Each edge must have a 'node' field\n\tconst edgeFields = edgesType.getFields()\n\tconst nodeField = edgeFields['node']\n\tif (!nodeField) return undefined\n\n\tconst { namedType: nodeType } = unwrapType(nodeField.type)\n\tif (!isObjectType(nodeType)) return undefined\n\n\treturn nodeType.name\n}\n\n/**\n * Classify a single GraphQL field into a Stonecrop field definition.\n *\n * Classification rules (in order):\n * 1. Scalar types → look up in merged scalar map\n * 2. Enum types → `Select` with enum values as options\n * 3. Object types that are entities → `Link` with slug as options\n * 4. Object types that are Connections → `Doctype` with node type slug as options\n * 5. List of entity type → `Doctype` with item type slug as options\n * 6. Anything else → `Data` with `_unmapped: true`\n *\n * @param fieldName - The GraphQL field name\n * @param field - The GraphQL field definition\n * @param entityTypes - Set of type names classified as entities\n * @param options - Conversion options (for custom scalars, unmapped meta, etc.)\n * @returns The Stonecrop field definition\n * @public\n */\nexport function classifyFieldType(\n\tfieldName: string,\n\tfield: GraphQLField<unknown, unknown>,\n\tentityTypes: Set<string>,\n\toptions: GraphQLConversionOptions = {}\n): GraphQLConversionFieldMeta {\n\tconst { namedType, required, isList } = unwrapType(field.type)\n\tconst scalarMap = buildScalarMap(options.customScalars)\n\n\tconst base: GraphQLConversionFieldMeta = {\n\t\tfieldname: fieldName,\n\t\tlabel: camelToLabel(fieldName),\n\t\tcomponent: 'ATextInput',\n\t\tfieldtype: 'Data',\n\t}\n\n\tif (required) {\n\t\tbase.required = true\n\t}\n\n\t// 1. Scalar types\n\tif (isScalarType(namedType)) {\n\t\t// Skip internal scalars (e.g., Cursor)\n\t\tif (INTERNAL_SCALARS.has(namedType.name)) {\n\t\t\tbase._unmapped = true\n\t\t\tif (options.includeUnmappedMeta) {\n\t\t\t\tbase._graphqlType = namedType.name\n\t\t\t}\n\t\t\treturn base\n\t\t}\n\n\t\tconst template: FieldTemplate | undefined = scalarMap[namedType.name]\n\t\tif (template) {\n\t\t\tbase.component = template.component\n\t\t\tbase.fieldtype = template.fieldtype\n\t\t} else {\n\t\t\t// Unknown scalar — default to Data with unmapped marker\n\t\t\tbase._unmapped = true\n\t\t\tif (options.includeUnmappedMeta) {\n\t\t\t\tbase._graphqlType = namedType.name\n\t\t\t}\n\t\t}\n\t\treturn base\n\t}\n\n\t// 2. Enum types → Select\n\tif (isEnumType(namedType)) {\n\t\tbase.component = 'ADropdown'\n\t\tbase.fieldtype = 'Select'\n\t\tbase.options = namedType.getValues().map(v => v.name)\n\t\treturn base\n\t}\n\n\t// 3–5. Object types\n\tif (isObjectType(namedType)) {\n\t\t// 3. Direct reference to an entity type → Link\n\t\tif (!isList && entityTypes.has(namedType.name)) {\n\t\t\tbase.component = 'ALink'\n\t\t\tbase.fieldtype = 'Link'\n\t\t\tbase.options = toSlug(namedType.name)\n\t\t\treturn base\n\t\t}\n\n\t\t// 4. Connection type → Doctype (child table)\n\t\tconst connectionNodeTypeName = getConnectionNodeType(namedType)\n\t\tif (connectionNodeTypeName && entityTypes.has(connectionNodeTypeName)) {\n\t\t\tbase.component = 'ATable'\n\t\t\tbase.fieldtype = 'Doctype'\n\t\t\tbase.options = toSlug(connectionNodeTypeName)\n\t\t\treturn base\n\t\t}\n\n\t\t// 5. List of entity type → Doctype\n\t\tif (isList && entityTypes.has(namedType.name)) {\n\t\t\tbase.component = 'ATable'\n\t\t\tbase.fieldtype = 'Doctype'\n\t\t\tbase.options = toSlug(namedType.name)\n\t\t\treturn base\n\t\t}\n\n\t\t// Unknown object type — mark as unmapped\n\t\tbase._unmapped = true\n\t\tif (options.includeUnmappedMeta) {\n\t\t\tbase._graphqlType = namedType.name\n\t\t}\n\t\treturn base\n\t}\n\n\t// Fallback — shouldn't normally be reached\n\tbase._unmapped = true\n\tif (options.includeUnmappedMeta) {\n\t\tbase._graphqlType = namedType.name\n\t}\n\treturn base\n}\n","/**\n * GraphQL Introspection to Stonecrop Schema Converter\n *\n * Converts a standard GraphQL introspection result (or SDL string) into\n * Stonecrop doctype schemas. Source-agnostic — works with any GraphQL server.\n *\n * @packageDocumentation\n */\n\nimport { buildClientSchema, buildSchema, isObjectType, type GraphQLSchema } from 'graphql'\n\nimport { toSlug, pascalToSnake } from '../naming'\nimport type { IntrospectionSource, GraphQLConversionOptions, ConvertedGraphQLDoctype } from './types'\nimport { defaultIsEntityType, defaultIsEntityField, classifyFieldType } from './heuristics'\n\n/**\n * Convert a GraphQL schema to Stonecrop doctype schemas.\n *\n * Accepts either an `IntrospectionQuery` result object or an SDL string.\n * Entity types are identified using heuristics (or a custom `isEntityType` function)\n * and converted to `DoctypeMeta`-compatible JSON objects.\n *\n * @param source - GraphQL introspection result or SDL string\n * @param options - Conversion options for controlling output format and behavior\n * @returns Array of converted Stonecrop doctype definitions\n *\n * @example\n * ```typescript\n * // From introspection result (fetched from any GraphQL server)\n * const introspection = await fetchIntrospection('http://localhost:5000/graphql')\n * const doctypes = convertGraphQLSchema(introspection)\n *\n * // From SDL string\n * const sdl = fs.readFileSync('schema.graphql', 'utf-8')\n * const doctypes = convertGraphQLSchema(sdl)\n *\n * // With PostGraphile custom scalars\n * const doctypes = convertGraphQLSchema(introspection, {\n * customScalars: {\n * BigFloat: { component: 'ADecimalInput', fieldtype: 'Decimal' }\n * }\n * })\n * ```\n *\n * @public\n */\nexport function convertGraphQLSchema(\n\tsource: IntrospectionSource,\n\toptions: GraphQLConversionOptions = {}\n): ConvertedGraphQLDoctype[] {\n\tconst schema = buildGraphQLSchema(source)\n\tconst typeMap = schema.getTypeMap()\n\n\t// Determine the root operation type names to exclude\n\tconst rootTypeNames = new Set<string>()\n\tconst queryType = schema.getQueryType()\n\tconst mutationType = schema.getMutationType()\n\tconst subscriptionType = schema.getSubscriptionType()\n\tif (queryType) rootTypeNames.add(queryType.name)\n\tif (mutationType) rootTypeNames.add(mutationType.name)\n\tif (subscriptionType) rootTypeNames.add(subscriptionType.name)\n\n\t// Use custom or default entity type detector\n\tconst isEntityType = options.isEntityType ?? defaultIsEntityType\n\n\t// Phase 1: Identify all entity types\n\tconst entityTypes = new Set<string>()\n\tfor (const [typeName, type] of Object.entries(typeMap)) {\n\t\tif (!isObjectType(type)) continue\n\n\t\t// Always skip root operation types (even if custom isEntityType doesn't)\n\t\tif (rootTypeNames.has(typeName)) continue\n\n\t\tif (isEntityType(typeName, type)) {\n\t\t\tentityTypes.add(typeName)\n\t\t}\n\t}\n\n\t// Phase 2: Apply include/exclude filters\n\tlet filteredEntityTypes = entityTypes\n\n\tif (options.include) {\n\t\tconst includeSet = new Set(options.include)\n\t\tfilteredEntityTypes = new Set([...entityTypes].filter(t => includeSet.has(t)))\n\t}\n\n\tif (options.exclude) {\n\t\tconst excludeSet = new Set(options.exclude)\n\t\tfilteredEntityTypes = new Set([...filteredEntityTypes].filter(t => !excludeSet.has(t)))\n\t}\n\n\t// Phase 3: Convert each entity type to a doctype\n\tconst isEntityField = options.isEntityField ?? defaultIsEntityField\n\tconst deriveTableName = options.deriveTableName ?? ((typeName: string) => pascalToSnake(typeName))\n\n\tconst doctypes: ConvertedGraphQLDoctype[] = []\n\n\tfor (const typeName of filteredEntityTypes) {\n\t\tconst type = typeMap[typeName]\n\t\tif (!isObjectType(type)) continue\n\n\t\tconst fields = type.getFields()\n\t\tconst typeOverrides = options.typeOverrides?.[typeName]\n\n\t\tconst convertedFields = Object.entries(fields)\n\t\t\t.filter(([fieldName, field]) => isEntityField(fieldName, field, type))\n\t\t\t.map(([fieldName, field]) => {\n\t\t\t\t// Check for full custom classification first\n\t\t\t\tif (options.classifyField) {\n\t\t\t\t\tconst custom = options.classifyField(fieldName, field, type)\n\t\t\t\t\tif (custom !== null && custom !== undefined) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfieldname: fieldName,\n\t\t\t\t\t\t\tlabel: custom.label ?? fieldName,\n\t\t\t\t\t\t\tcomponent: custom.component ?? 'ATextInput',\n\t\t\t\t\t\t\tfieldtype: custom.fieldtype ?? 'Data',\n\t\t\t\t\t\t\t...custom,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Default classification\n\t\t\t\tconst classified = classifyFieldType(fieldName, field, entityTypes, options)\n\n\t\t\t\t// Apply per-field overrides\n\t\t\t\tif (typeOverrides?.[fieldName]) {\n\t\t\t\t\treturn { ...classified, ...typeOverrides[fieldName] }\n\t\t\t\t}\n\n\t\t\t\treturn classified\n\t\t\t})\n\t\t\t// Clean up internal metadata unless requested\n\t\t\t.map(field => {\n\t\t\t\tif (!options.includeUnmappedMeta) {\n\t\t\t\t\tconst { _graphqlType, _unmapped, ...clean } = field\n\t\t\t\t\treturn clean\n\t\t\t\t}\n\t\t\t\treturn field\n\t\t\t})\n\n\t\tconst doctype: ConvertedGraphQLDoctype = {\n\t\t\tname: typeName,\n\t\t\tslug: toSlug(typeName),\n\t\t\tfields: convertedFields,\n\t\t}\n\n\t\tconst tableName = deriveTableName(typeName)\n\t\tif (tableName) {\n\t\t\tdoctype.tableName = tableName\n\t\t}\n\n\t\tif (options.includeUnmappedMeta) {\n\t\t\tdoctype._graphqlTypeName = typeName\n\t\t}\n\n\t\tdoctypes.push(doctype)\n\t}\n\n\treturn doctypes\n}\n\n/**\n * Build a GraphQLSchema from either an introspection result or SDL string.\n *\n * @param source - IntrospectionQuery object or SDL string\n * @returns A complete GraphQLSchema\n * @internal\n */\nfunction buildGraphQLSchema(source: IntrospectionSource): GraphQLSchema {\n\tif (typeof source === 'string') {\n\t\t// SDL string\n\t\treturn buildSchema(source)\n\t}\n\n\t// IntrospectionQuery result\n\treturn buildClientSchema(source)\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Re-exports\n// ═══════════════════════════════════════════════════════════════\n\n// Main converter (this file)\nexport { convertGraphQLSchema as default }\n\n// Types\nexport type {\n\tIntrospectionSource,\n\tGraphQLConversionOptions,\n\tGraphQLConversionFieldMeta,\n\tConvertedGraphQLDoctype,\n} from './types'\n\n// Scalar maps\nexport { GQL_SCALAR_MAP, WELL_KNOWN_SCALARS, INTERNAL_SCALARS, buildScalarMap } from './scalars'\n\n// Heuristics\nexport { defaultIsEntityType, defaultIsEntityField, classifyFieldType } from './heuristics'\n\n// Naming utilities\nexport { toSlug, toPascalCase, pascalToSnake, snakeToCamel, camelToSnake, snakeToLabel, camelToLabel } from '../naming'\n"],"names":["StonecropFieldType","z","TYPE_MAP","getDefaultComponent","fieldtype","FieldOptions","FieldValidation","FieldMeta","ActionDefinition","WorkflowMeta","DoctypeMeta","validateField","data","result","issue","validateDoctype","parseField","parseDoctype","snakeToCamel","snakeCase","_","letter","camelToSnake","camelCase","snakeToLabel","word","camelToLabel","withSpaces","toPascalCase","tableName","toSlug","name","pascalToSnake","pascal","GQL_SCALAR_MAP","WELL_KNOWN_SCALARS","INTERNAL_SCALARS","buildScalarMap","customScalars","merged","key","value","SYNTHETIC_SUFFIXES","ROOT_TYPE_NAMES","defaultIsEntityType","typeName","type","suffix","fields","SKIP_FIELDS","defaultIsEntityField","fieldName","_field","_parentType","unwrapType","required","isList","current","isNonNullType","isListType","getConnectionNodeType","edgesField","edgesType","edgesIsList","isObjectType","nodeField","nodeType","classifyFieldType","field","entityTypes","options","namedType","scalarMap","base","isScalarType","template","isEnumType","v","connectionNodeTypeName","convertGraphQLSchema","source","schema","buildGraphQLSchema","typeMap","rootTypeNames","queryType","mutationType","subscriptionType","isEntityType","filteredEntityTypes","includeSet","t","excludeSet","isEntityField","deriveTableName","doctypes","typeOverrides","convertedFields","custom","classified","_graphqlType","_unmapped","clean","doctype","buildSchema","buildClientSchema"],"mappings":";;AAOO,MAAMA,IAAqBC,EAAE,KAAK;AAAA,EACxC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACD,CAAC,GA6BYC,IAAsD;AAAA;AAAA,EAElE,MAAM,EAAE,WAAW,cAAc,WAAW,OAAA;AAAA,EAC5C,MAAM,EAAE,WAAW,cAAc,WAAW,OAAA;AAAA;AAAA,EAG5C,KAAK,EAAE,WAAW,iBAAiB,WAAW,MAAA;AAAA,EAC9C,OAAO,EAAE,WAAW,iBAAiB,WAAW,QAAA;AAAA,EAChD,SAAS,EAAE,WAAW,iBAAiB,WAAW,UAAA;AAAA;AAAA,EAGlD,OAAO,EAAE,WAAW,aAAa,WAAW,QAAA;AAAA;AAAA,EAG5C,MAAM,EAAE,WAAW,SAAS,WAAW,OAAA;AAAA,EACvC,MAAM,EAAE,WAAW,cAAc,WAAW,OAAA;AAAA,EAC5C,UAAU,EAAE,WAAW,mBAAmB,WAAW,WAAA;AAAA,EACrD,UAAU,EAAE,WAAW,kBAAkB,WAAW,WAAA;AAAA,EACpD,WAAW,EAAE,WAAW,oBAAoB,WAAW,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AAM,IAInByB,EAAkBzB,CAAM;AAChC;"}
package/dist/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-aeXXzPET.cjs");exports.ActionDefinition=e.ActionDefinition;exports.DoctypeMeta=e.DoctypeMeta;exports.FieldMeta=e.FieldMeta;exports.FieldOptions=e.FieldOptions;exports.FieldValidation=e.FieldValidation;exports.GQL_SCALAR_MAP=e.GQL_SCALAR_MAP;exports.INTERNAL_SCALARS=e.INTERNAL_SCALARS;exports.StonecropFieldType=e.StonecropFieldType;exports.TYPE_MAP=e.TYPE_MAP;exports.WELL_KNOWN_SCALARS=e.WELL_KNOWN_SCALARS;exports.WorkflowMeta=e.WorkflowMeta;exports.buildScalarMap=e.buildScalarMap;exports.camelToLabel=e.camelToLabel;exports.camelToSnake=e.camelToSnake;exports.classifyFieldType=e.classifyFieldType;exports.convertGraphQLSchema=e.convertGraphQLSchema;exports.defaultIsEntityField=e.defaultIsEntityField;exports.defaultIsEntityType=e.defaultIsEntityType;exports.getDefaultComponent=e.getDefaultComponent;exports.parseDoctype=e.parseDoctype;exports.parseField=e.parseField;exports.pascalToSnake=e.pascalToSnake;exports.snakeToCamel=e.snakeToCamel;exports.snakeToLabel=e.snakeToLabel;exports.toPascalCase=e.toPascalCase;exports.toSlug=e.toSlug;exports.validateDoctype=e.validateDoctype;exports.validateField=e.validateField;
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,225 +0,0 @@
1
- /**
2
- * Map StonecropFieldType to JSON Schema type
3
- */
4
- function fieldtypeToJSONSchema(fieldtype) {
5
- const typeMap = {
6
- Data: { type: 'string' },
7
- Text: { type: 'string' },
8
- Int: { type: 'integer' },
9
- Float: { type: 'number' },
10
- Decimal: { type: 'number' },
11
- Check: { type: 'boolean' },
12
- Date: { type: 'string', format: 'date' },
13
- Time: { type: 'string', format: 'time' },
14
- Datetime: { type: 'string', format: 'date-time' },
15
- Duration: { type: 'string' },
16
- DateRange: { type: 'object', properties: { start: { type: 'string', format: 'date' }, end: { type: 'string', format: 'date' } } },
17
- JSON: { type: 'object', additionalProperties: true },
18
- Code: { type: 'string' },
19
- Link: { type: 'string', description: 'Reference to another doctype' },
20
- Doctype: { type: 'array', items: { type: 'object' }, description: 'Child doctype records' },
21
- Attach: { type: 'string', format: 'uri', description: 'File attachment URL' },
22
- Currency: { type: 'number', description: 'Currency value' },
23
- Quantity: { type: 'number', description: 'Quantity with unit' },
24
- Select: { type: 'string' },
25
- };
26
- return typeMap[fieldtype] ?? { type: 'string' };
27
- }
28
- /**
29
- * Convert FieldOptions to JSON Schema additions
30
- */
31
- function fieldOptionsToJSONSchema(options, fieldtype) {
32
- const schema = {};
33
- if (fieldtype === 'Select' && Array.isArray(options)) {
34
- schema.enum = options;
35
- }
36
- if (fieldtype === 'Link' && typeof options === 'string') {
37
- schema.description = `Reference to ${options} doctype`;
38
- }
39
- if (fieldtype === 'Doctype' && typeof options === 'string') {
40
- schema.description = `Child records from ${options} doctype`;
41
- schema.items = { type: 'object', description: `${options} record` };
42
- }
43
- if (typeof options === 'object' && !Array.isArray(options)) {
44
- if (fieldtype === 'Decimal' && 'precision' in options && 'scale' in options) {
45
- const precision = options.precision;
46
- const scale = options.scale;
47
- schema.description = `Decimal(${precision}, ${scale})`;
48
- }
49
- if (fieldtype === 'Code' && 'language' in options) {
50
- schema.description = `Code snippet (${options.language})`;
51
- }
52
- }
53
- return schema;
54
- }
55
- /**
56
- * Convert a FieldMeta to JSON Schema
57
- */
58
- function fieldToJSONSchema(field) {
59
- const baseSchema = fieldtypeToJSONSchema(field.fieldtype);
60
- const optionsSchema = field.options ? fieldOptionsToJSONSchema(field.options, field.fieldtype) : {};
61
- const schema = {
62
- ...baseSchema,
63
- ...optionsSchema,
64
- };
65
- if (field.label) {
66
- schema.title = field.label;
67
- }
68
- if (field.default !== undefined) {
69
- schema.default = field.default;
70
- }
71
- if (field.hidden) {
72
- schema['x-hidden'] = true;
73
- }
74
- if (field.readOnly) {
75
- schema.readOnly = true;
76
- }
77
- if (field.width) {
78
- schema['x-width'] = field.width;
79
- }
80
- if (field.align) {
81
- schema['x-align'] = field.align;
82
- }
83
- return schema;
84
- }
85
- /**
86
- * Convert a DoctypeMeta to JSON Schema
87
- *
88
- * @param doctype - The doctype definition to convert
89
- * @returns JSON Schema representation of the doctype
90
- *
91
- * @example
92
- * ```typescript
93
- * import { DoctypeMeta, toJSONSchema } from '@stonecrop/schema'
94
- *
95
- * const taskDoctype = DoctypeMeta.parse({
96
- * name: 'Task',
97
- * fields: [
98
- * { fieldname: 'title', fieldtype: 'Data', required: true },
99
- * { fieldname: 'status', fieldtype: 'Select', options: ['Open', 'Closed'] }
100
- * ]
101
- * })
102
- *
103
- * const jsonSchema = toJSONSchema(taskDoctype)
104
- * // => {
105
- * // schema: { type: 'object', properties: { title: {...}, status: {...} }, required: ['title'] },
106
- * // meta: { name: 'Task' }
107
- * // }
108
- * ```
109
- *
110
- * @public
111
- */
112
- export function toJSONSchema(doctype) {
113
- const properties = {};
114
- const required = [];
115
- for (const field of doctype.fields) {
116
- properties[field.fieldname] = fieldToJSONSchema(field);
117
- if (field.required) {
118
- required.push(field.fieldname);
119
- }
120
- }
121
- const schema = {
122
- $schema: 'https://json-schema.org/draft/2020-12/schema',
123
- type: 'object',
124
- properties,
125
- title: doctype.name,
126
- };
127
- if (required.length > 0) {
128
- schema.required = required;
129
- }
130
- if (doctype.slug) {
131
- schema['x-slug'] = doctype.slug;
132
- }
133
- if (doctype.tableName) {
134
- schema['x-tableName'] = doctype.tableName;
135
- }
136
- const result = {
137
- schema,
138
- meta: {
139
- name: doctype.name,
140
- slug: doctype.slug,
141
- tableName: doctype.tableName,
142
- inherits: doctype.inherits,
143
- listDoctype: doctype.listDoctype,
144
- parentDoctype: doctype.parentDoctype,
145
- },
146
- };
147
- if (doctype.workflow) {
148
- result.workflow = {
149
- states: doctype.workflow.states,
150
- actions: doctype.workflow.actions ? workflowActionsToJSON(doctype.workflow.actions) : undefined,
151
- };
152
- }
153
- return result;
154
- }
155
- /**
156
- * Convert workflow actions to JSON Schema friendly format
157
- */
158
- function workflowActionsToJSON(actions) {
159
- const result = {};
160
- for (const [name, action] of Object.entries(actions)) {
161
- result[name] = {
162
- label: action.label,
163
- handler: action.handler,
164
- requiredFields: action.requiredFields,
165
- allowedStates: action.allowedStates,
166
- confirm: action.confirm,
167
- args: action.args,
168
- };
169
- }
170
- return result;
171
- }
172
- /**
173
- * Generate a collection of JSON Schemas from multiple doctypes
174
- *
175
- * @param doctypes - Array of doctype definitions
176
- * @returns Map of doctype name to JSON Schema
177
- *
178
- * @example
179
- * ```typescript
180
- * import { DoctypeMeta, toSchemasCollection } from '@stonecrop/schema'
181
- *
182
- * const doctypes = [
183
- * DoctypeMeta.parse({ name: 'Task', fields: [...] }),
184
- * DoctypeMeta.parse({ name: 'Customer', fields: [...] }),
185
- * ]
186
- *
187
- * const collection = toSchemasCollection(doctypes)
188
- * // => { Task: {...}, Customer: {...} }
189
- * ```
190
- *
191
- * @public
192
- */
193
- export function toSchemasCollection(doctypes) {
194
- const collection = {};
195
- for (const doctype of doctypes) {
196
- collection[doctype.name] = toJSONSchema(doctype);
197
- }
198
- return collection;
199
- }
200
- /**
201
- * Generate OpenAPI schema components from doctypes
202
- *
203
- * @param doctypes - Array of doctype definitions
204
- * @returns OpenAPI 3.1 compatible components object
205
- *
206
- * @example
207
- * ```typescript
208
- * import { DoctypeMeta, toOpenAPIComponents } from '@stonecrop/schema'
209
- *
210
- * const doctypes = [DoctypeMeta.parse({ name: 'Task', fields: [...] })]
211
- *
212
- * const components = toOpenAPIComponents(doctypes)
213
- * // => { schemas: { Task: {...} } }
214
- * ```
215
- *
216
- * @public
217
- */
218
- export function toOpenAPIComponents(doctypes) {
219
- const schemas = {};
220
- for (const doctype of doctypes) {
221
- const { schema } = toJSONSchema(doctype);
222
- schemas[doctype.name] = schema;
223
- }
224
- return { schemas };
225
- }
package/dist/naming.js DELETED
@@ -1,106 +0,0 @@
1
- /**
2
- * Naming Convention Utilities
3
- * Converts between various naming conventions (snake_case, camelCase, PascalCase, kebab-case)
4
- * @packageDocumentation
5
- */
6
- /**
7
- * Converts snake_case to camelCase
8
- * @param snakeCase - Snake case string
9
- * @returns Camel case string
10
- * @public
11
- * @example
12
- * ```typescript
13
- * snakeToCamel('user_email') // 'userEmail'
14
- * snakeToCamel('created_at') // 'createdAt'
15
- * ```
16
- */
17
- export function snakeToCamel(snakeCase) {
18
- return snakeCase.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
19
- }
20
- /**
21
- * Converts camelCase to snake_case
22
- * @param camelCase - Camel case string
23
- * @returns Snake case string
24
- * @public
25
- * @example
26
- * ```typescript
27
- * camelToSnake('userEmail') // 'user_email'
28
- * camelToSnake('createdAt') // 'created_at'
29
- * ```
30
- */
31
- export function camelToSnake(camelCase) {
32
- return camelCase.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
33
- }
34
- /**
35
- * Converts snake_case to Title Case label
36
- * @param snakeCase - Snake case string
37
- * @returns Title case label
38
- * @public
39
- * @example
40
- * ```typescript
41
- * snakeToLabel('user_email') // 'User Email'
42
- * snakeToLabel('first_name') // 'First Name'
43
- * ```
44
- */
45
- export function snakeToLabel(snakeCase) {
46
- return snakeCase
47
- .split('_')
48
- .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
49
- .join(' ');
50
- }
51
- /**
52
- * Converts camelCase to Title Case label
53
- * @param camelCase - Camel case string
54
- * @returns Title case label
55
- * @public
56
- * @example
57
- * ```typescript
58
- * camelToLabel('userEmail') // 'User Email'
59
- * camelToLabel('firstName') // 'First Name'
60
- * ```
61
- */
62
- export function camelToLabel(camelCase) {
63
- const withSpaces = camelCase.replace(/([A-Z])/g, ' $1').trim();
64
- return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1);
65
- }
66
- /**
67
- * Convert table name to PascalCase doctype name
68
- * @param tableName - SQL table name (snake_case)
69
- * @returns PascalCase name
70
- * @public
71
- */
72
- export function toPascalCase(tableName) {
73
- return tableName
74
- .split(/[-_\s]+/)
75
- .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
76
- .join('');
77
- }
78
- /**
79
- * Convert to kebab-case slug
80
- * @param name - Name to convert
81
- * @returns kebab-case slug
82
- * @public
83
- */
84
- export function toSlug(name) {
85
- return name
86
- .replace(/([a-z])([A-Z])/g, '$1-$2')
87
- .replace(/[\s_]+/g, '-')
88
- .toLowerCase();
89
- }
90
- /**
91
- * Convert PascalCase to snake_case (e.g., for deriving table names from type names)
92
- * @param pascal - PascalCase string
93
- * @returns snake_case string
94
- * @public
95
- * @example
96
- * ```typescript
97
- * pascalToSnake('SalesOrder') // 'sales_order'
98
- * pascalToSnake('SalesOrderItem') // 'sales_order_item'
99
- * ```
100
- */
101
- export function pascalToSnake(pascal) {
102
- return pascal
103
- .replace(/([a-z])([A-Z])/g, '$1_$2')
104
- .replace(/[\s-]+/g, '_')
105
- .toLowerCase();
106
- }
@@ -1,63 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * The complete list of field types built into Stonecrop.
4
- * User apps can use any string as a fieldtype; this const is the exhaustive set of types
5
- * that Stonecrop provides default components for.
6
- * @public
7
- */
8
- export declare const BUILTIN_FIELD_TYPES: readonly ["Data", "Text", "Int", "Float", "Decimal", "Check", "Date", "Time", "Datetime", "Duration", "DateRange", "JSON", "Code", "Link", "Attach", "Currency", "Quantity", "Select", "PrimaryKey", "Fieldset", "Display"];
9
- /**
10
- * Union of all builtin fieldtype string literals.
11
- * @public
12
- */
13
- export type BuiltinFieldType = (typeof BUILTIN_FIELD_TYPES)[number];
14
- /**
15
- * Stonecrop field type — any non-empty string is valid; Stonecrop provides default components
16
- * for the builtin types listed in {@link BUILTIN_FIELD_TYPES}. Custom fieldtypes are supported
17
- * by supplying an explicit `component` on the field definition.
18
- * @public
19
- */
20
- export declare const StonecropFieldType: z.ZodString;
21
- /**
22
- * Returns `true` when `fieldtype` is one of the builtin types Stonecrop ships with.
23
- * @public
24
- */
25
- export declare function isBuiltinFieldType(fieldtype: string): fieldtype is BuiltinFieldType;
26
- /**
27
- * Field template for TYPE_MAP entries.
28
- * Defines the default component and semantic field type for a field.
29
- * @public
30
- */
31
- export interface FieldTemplate {
32
- /**
33
- * The Vue component name to render this field (e.g., 'ATextInput', 'ADropdown')
34
- */
35
- component: string;
36
- /**
37
- * The semantic field type (e.g., 'Data', 'Int', 'Select')
38
- */
39
- fieldtype: BuiltinFieldType;
40
- }
41
- /**
42
- * Mapping from builtin fieldtypes to their default Vue component.
43
- * Components can be overridden in the field definition.
44
- * @public
45
- */
46
- export declare const TYPE_MAP: Record<BuiltinFieldType, FieldTemplate>;
47
- /**
48
- * Get the default component for a builtin field type.
49
- * For an open-string fieldtype that may be custom, use {@link resolveComponent} instead.
50
- * @param fieldtype - A builtin field type
51
- * @returns The default component name
52
- * @public
53
- */
54
- export declare function getDefaultComponent(fieldtype: BuiltinFieldType): string;
55
- /**
56
- * Resolve the component name for any fieldtype string, falling back to `'ATextInput'`
57
- * for unknown custom types.
58
- * @param fieldtype - Any fieldtype string (builtin or custom)
59
- * @returns The component name to use for rendering
60
- * @public
61
- */
62
- export declare function resolveComponent(fieldtype: string): string;
63
- //# sourceMappingURL=fieldtype.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fieldtype.d.ts","sourceRoot":"","sources":["../../src/fieldtype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,6NAsBtB,CAAA;AAEV;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,aAG7B,CAAA;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,IAAI,gBAAgB,CAEnF;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,gBAAgB,CAAA;CAC3B;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,gBAAgB,EAAE,aAAa,CA0C5D,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAEvE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -1,106 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * The complete list of field types built into Stonecrop.
4
- * User apps can use any string as a fieldtype; this const is the exhaustive set of types
5
- * that Stonecrop provides default components for.
6
- * @public
7
- */
8
- export const BUILTIN_FIELD_TYPES = [
9
- 'Data', // Short text, varchar
10
- 'Text', // Long text
11
- 'Int', // Integer
12
- 'Float', // Floating point (IEEE 754)
13
- 'Decimal', // Arbitrary precision decimal
14
- 'Check', // Boolean/checkbox
15
- 'Date', // Date only
16
- 'Time', // Time only
17
- 'Datetime', // Date and time
18
- 'Duration', // Time interval
19
- 'DateRange', // Date range
20
- 'JSON', // JSON data
21
- 'Code', // Code/source (with syntax highlighting)
22
- 'Link', // Reference to another doctype
23
- 'Attach', // File attachment
24
- 'Currency', // Currency value
25
- 'Quantity', // Quantity with unit
26
- 'Select', // Dropdown selection
27
- 'PrimaryKey', // Primary key field — used by the middleware to identify the record's PK column
28
- 'Fieldset', // UI grouping container — no DB column; children are flat columns
29
- 'Display', // Computed/read-only field — no DB column; excluded from SQL SELECT
30
- ];
31
- /**
32
- * Stonecrop field type — any non-empty string is valid; Stonecrop provides default components
33
- * for the builtin types listed in {@link BUILTIN_FIELD_TYPES}. Custom fieldtypes are supported
34
- * by supplying an explicit `component` on the field definition.
35
- * @public
36
- */
37
- export const StonecropFieldType = z.string().min(1).meta({
38
- title: 'StonecropFieldType',
39
- description: 'Semantic field types for Stonecrop doctypes, consistent across forms and tables',
40
- });
41
- /**
42
- * Returns `true` when `fieldtype` is one of the builtin types Stonecrop ships with.
43
- * @public
44
- */
45
- export function isBuiltinFieldType(fieldtype) {
46
- return BUILTIN_FIELD_TYPES.includes(fieldtype);
47
- }
48
- /**
49
- * Mapping from builtin fieldtypes to their default Vue component.
50
- * Components can be overridden in the field definition.
51
- * @public
52
- */
53
- export const TYPE_MAP = {
54
- // Text
55
- Data: { component: 'ATextInput', fieldtype: 'Data' },
56
- Text: { component: 'ATextarea', fieldtype: 'Text' },
57
- // Numeric — all numeric variants render with ANumericInput; display differences (currency,
58
- // precision, unit) are carried by `format`/`mask`, not a distinct component.
59
- Int: { component: 'ANumericInput', fieldtype: 'Int' },
60
- Float: { component: 'ANumericInput', fieldtype: 'Float' },
61
- Decimal: { component: 'ANumericInput', fieldtype: 'Decimal' },
62
- // Boolean
63
- Check: { component: 'ACheckbox', fieldtype: 'Check' },
64
- // Date/Time — no dedicated Time SFC exists; Time falls back to a plain text input.
65
- Date: { component: 'ADate', fieldtype: 'Date' },
66
- Time: { component: 'ATextInput', fieldtype: 'Time' },
67
- Datetime: { component: 'ADateTime', fieldtype: 'Datetime' },
68
- Duration: { component: 'ADuration', fieldtype: 'Duration' },
69
- DateRange: { component: 'ADateRange', fieldtype: 'DateRange' },
70
- // Structured — JSON vs Code is disambiguated by the field's `language`, not the component.
71
- JSON: { component: 'ACodeEditor', fieldtype: 'JSON' },
72
- Code: { component: 'ACodeEditor', fieldtype: 'Code' },
73
- // Relational
74
- Link: { component: 'AFormLink', fieldtype: 'Link' },
75
- // Files
76
- Attach: { component: 'AFileAttach', fieldtype: 'Attach' },
77
- // Specialized — Currency/Quantity are numeric with a display format.
78
- Currency: { component: 'ANumericInput', fieldtype: 'Currency' },
79
- Quantity: { component: 'ANumericInput', fieldtype: 'Quantity' },
80
- Select: { component: 'ADropdown', fieldtype: 'Select' },
81
- // Identity — PK fields are typically hidden; no interactive component is needed
82
- PrimaryKey: { component: 'ATextInput', fieldtype: 'PrimaryKey' },
83
- // Layout — UI grouping containers and computed fields with no backing DB column
84
- Fieldset: { component: 'AFieldset', fieldtype: 'Fieldset' },
85
- Display: { component: 'ATextInput', fieldtype: 'Display' },
86
- };
87
- /**
88
- * Get the default component for a builtin field type.
89
- * For an open-string fieldtype that may be custom, use {@link resolveComponent} instead.
90
- * @param fieldtype - A builtin field type
91
- * @returns The default component name
92
- * @public
93
- */
94
- export function getDefaultComponent(fieldtype) {
95
- return TYPE_MAP[fieldtype]?.component ?? 'ATextInput';
96
- }
97
- /**
98
- * Resolve the component name for any fieldtype string, falling back to `'ATextInput'`
99
- * for unknown custom types.
100
- * @param fieldtype - Any fieldtype string (builtin or custom)
101
- * @returns The component name to use for rendering
102
- * @public
103
- */
104
- export function resolveComponent(fieldtype) {
105
- return isBuiltinFieldType(fieldtype) ? getDefaultComponent(fieldtype) : 'ATextInput';
106
- }