@famgia/omnify-typescript 0.0.26 → 0.0.28

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.
@@ -314,11 +314,18 @@ function parseEnumValue(value, options = {}) {
314
314
  // No label or extra - will fallback to value
315
315
  };
316
316
  }
317
- const resolvedLabel = resolveDisplayName2(value.label, options);
317
+ let label;
318
+ if (value.label !== void 0) {
319
+ if (options.multiLocale && typeof value.label === "object") {
320
+ label = value.label;
321
+ } else {
322
+ label = resolveDisplayName2(value.label, options);
323
+ }
324
+ }
318
325
  return {
319
326
  name: toEnumMemberName(value.value),
320
327
  value: value.value,
321
- label: resolvedLabel,
328
+ label,
322
329
  extra: value.extra
323
330
  };
324
331
  }
@@ -348,6 +355,9 @@ function generateEnums(schemas, options = {}) {
348
355
  }
349
356
  return enums;
350
357
  }
358
+ function isMultiLocaleLabel(label) {
359
+ return label !== void 0 && typeof label === "object";
360
+ }
351
361
  function formatEnum(enumDef) {
352
362
  const { name, values, comment } = enumDef;
353
363
  const parts = [];
@@ -378,28 +388,64 @@ ${enumValues}
378
388
 
379
389
  `);
380
390
  const hasLabels = values.some((v) => v.label !== void 0);
391
+ const hasMultiLocale = values.some((v) => isMultiLocaleLabel(v.label));
381
392
  if (hasLabels) {
382
- const labelEntries = values.filter((v) => v.label !== void 0).map((v) => ` [${name}.${v.name}]: '${v.label}',`).join("\n");
383
- parts.push(`const ${lowerFirst(name)}Labels: Partial<Record<${name}, string>> = {
393
+ if (hasMultiLocale) {
394
+ const labelEntries = values.filter((v) => v.label !== void 0).map((v) => {
395
+ if (isMultiLocaleLabel(v.label)) {
396
+ const locales = Object.entries(v.label).map(([locale, text]) => `${locale}: '${text}'`).join(", ");
397
+ return ` [${name}.${v.name}]: { ${locales} },`;
398
+ }
399
+ return ` [${name}.${v.name}]: { default: '${v.label}' },`;
400
+ }).join("\n");
401
+ parts.push(`const ${lowerFirst(name)}Labels: Partial<Record<${name}, Record<string, string>>> = {
384
402
  ${labelEntries}
385
403
  };
386
404
 
387
405
  `);
388
- }
389
- parts.push(`/** Get label for ${name} value (fallback to value if no label) */
406
+ parts.push(`/** Get label for ${name} value with locale support */
390
407
  `);
391
- parts.push(`export function get${name}Label(value: ${name}): string {
408
+ parts.push(`export function get${name}Label(value: ${name}, locale?: string): string {
392
409
  `);
393
- if (hasLabels) {
394
- parts.push(` return ${lowerFirst(name)}Labels[value] ?? value;
410
+ parts.push(` const labels = ${lowerFirst(name)}Labels[value];
411
+ `);
412
+ parts.push(` if (!labels) return value;
413
+ `);
414
+ parts.push(` if (locale && labels[locale]) return labels[locale];
415
+ `);
416
+ parts.push(` return Object.values(labels)[0] ?? value;
417
+ `);
418
+ parts.push(`}
419
+
420
+ `);
421
+ } else {
422
+ const labelEntries = values.filter((v) => v.label !== void 0).map((v) => ` [${name}.${v.name}]: '${v.label}',`).join("\n");
423
+ parts.push(`const ${lowerFirst(name)}Labels: Partial<Record<${name}, string>> = {
424
+ ${labelEntries}
425
+ };
426
+
395
427
  `);
428
+ parts.push(`/** Get label for ${name} value (fallback to value if no label) */
429
+ `);
430
+ parts.push(`export function get${name}Label(value: ${name}): string {
431
+ `);
432
+ parts.push(` return ${lowerFirst(name)}Labels[value] ?? value;
433
+ `);
434
+ parts.push(`}
435
+
436
+ `);
437
+ }
396
438
  } else {
439
+ parts.push(`/** Get label for ${name} value (returns value as-is) */
440
+ `);
441
+ parts.push(`export function get${name}Label(value: ${name}): string {
442
+ `);
397
443
  parts.push(` return value;
398
444
  `);
399
- }
400
- parts.push(`}
445
+ parts.push(`}
401
446
 
402
447
  `);
448
+ }
403
449
  const hasExtra = values.some((v) => v.extra !== void 0);
404
450
  if (hasExtra) {
405
451
  const extraEntries = values.filter((v) => v.extra !== void 0).map((v) => ` [${name}.${v.name}]: ${JSON.stringify(v.extra)},`).join("\n");
@@ -521,6 +567,347 @@ function extractInlineEnums(schemas, options = {}) {
521
567
  return typeAliases;
522
568
  }
523
569
 
570
+ // src/validation-templates.ts
571
+ var DEFAULT_VALIDATION_TEMPLATES = {
572
+ required: {
573
+ ja: "${displayName}\u306F\u5FC5\u9808\u3067\u3059",
574
+ en: "${displayName} is required",
575
+ vi: "${displayName} l\xE0 b\u1EAFt bu\u1ED9c",
576
+ ko: "${displayName}\uC740(\uB294) \uD544\uC218\uC785\uB2C8\uB2E4",
577
+ zh: "${displayName}\u4E3A\u5FC5\u586B\u9879"
578
+ },
579
+ minLength: {
580
+ ja: "${displayName}\u306F${min}\u6587\u5B57\u4EE5\u4E0A\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
581
+ en: "${displayName} must be at least ${min} characters",
582
+ vi: "${displayName} ph\u1EA3i c\xF3 \xEDt nh\u1EA5t ${min} k\xFD t\u1EF1",
583
+ ko: "${displayName}\uC740(\uB294) ${min}\uC790 \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4",
584
+ zh: "${displayName}\u81F3\u5C11\u9700\u8981${min}\u4E2A\u5B57\u7B26"
585
+ },
586
+ maxLength: {
587
+ ja: "${displayName}\u306F${max}\u6587\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
588
+ en: "${displayName} must be at most ${max} characters",
589
+ vi: "${displayName} t\u1ED1i \u0111a ${max} k\xFD t\u1EF1",
590
+ ko: "${displayName}\uC740(\uB294) ${max}\uC790 \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4",
591
+ zh: "${displayName}\u4E0D\u80FD\u8D85\u8FC7${max}\u4E2A\u5B57\u7B26"
592
+ },
593
+ min: {
594
+ ja: "${displayName}\u306F${min}\u4EE5\u4E0A\u306E\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
595
+ en: "${displayName} must be at least ${min}",
596
+ vi: "${displayName} ph\u1EA3i l\u1EDBn h\u01A1n ho\u1EB7c b\u1EB1ng ${min}",
597
+ ko: "${displayName}\uC740(\uB294) ${min} \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4",
598
+ zh: "${displayName}\u4E0D\u80FD\u5C0F\u4E8E${min}"
599
+ },
600
+ max: {
601
+ ja: "${displayName}\u306F${max}\u4EE5\u4E0B\u306E\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
602
+ en: "${displayName} must be at most ${max}",
603
+ vi: "${displayName} ph\u1EA3i nh\u1ECF h\u01A1n ho\u1EB7c b\u1EB1ng ${max}",
604
+ ko: "${displayName}\uC740(\uB294) ${max} \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4",
605
+ zh: "${displayName}\u4E0D\u80FD\u5927\u4E8E${max}"
606
+ },
607
+ email: {
608
+ ja: "${displayName}\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093",
609
+ en: "${displayName} is not a valid email address",
610
+ vi: "${displayName} kh\xF4ng ph\u1EA3i l\xE0 \u0111\u1ECBa ch\u1EC9 email h\u1EE3p l\u1EC7",
611
+ ko: "${displayName} \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4",
612
+ zh: "${displayName}\u4E0D\u662F\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740"
613
+ },
614
+ url: {
615
+ ja: "${displayName}\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093",
616
+ en: "${displayName} is not a valid URL",
617
+ vi: "${displayName} kh\xF4ng ph\u1EA3i l\xE0 URL h\u1EE3p l\u1EC7",
618
+ ko: "${displayName}\uC740(\uB294) \uC720\uD6A8\uD55C URL\uC774 \uC544\uB2D9\uB2C8\uB2E4",
619
+ zh: "${displayName}\u4E0D\u662F\u6709\u6548\u7684URL"
620
+ },
621
+ pattern: {
622
+ ja: "${displayName}\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093",
623
+ en: "${displayName} format is invalid",
624
+ vi: "${displayName} kh\xF4ng \u0111\xFAng \u0111\u1ECBnh d\u1EA1ng",
625
+ ko: "${displayName} \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4",
626
+ zh: "${displayName}\u683C\u5F0F\u4E0D\u6B63\u786E"
627
+ },
628
+ enum: {
629
+ ja: "${displayName}\u306E\u5024\u304C\u7121\u52B9\u3067\u3059",
630
+ en: "${displayName} has an invalid value",
631
+ vi: "${displayName} c\xF3 gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7",
632
+ ko: "${displayName} \uAC12\uC774 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4",
633
+ zh: "${displayName}\u7684\u503C\u65E0\u6548"
634
+ }
635
+ };
636
+ function mergeValidationTemplates(userTemplates) {
637
+ if (!userTemplates) {
638
+ return DEFAULT_VALIDATION_TEMPLATES;
639
+ }
640
+ const merged = {
641
+ required: { ...DEFAULT_VALIDATION_TEMPLATES.required },
642
+ minLength: { ...DEFAULT_VALIDATION_TEMPLATES.minLength },
643
+ maxLength: { ...DEFAULT_VALIDATION_TEMPLATES.maxLength },
644
+ min: { ...DEFAULT_VALIDATION_TEMPLATES.min },
645
+ max: { ...DEFAULT_VALIDATION_TEMPLATES.max },
646
+ email: { ...DEFAULT_VALIDATION_TEMPLATES.email },
647
+ url: { ...DEFAULT_VALIDATION_TEMPLATES.url },
648
+ pattern: { ...DEFAULT_VALIDATION_TEMPLATES.pattern },
649
+ enum: { ...DEFAULT_VALIDATION_TEMPLATES.enum }
650
+ };
651
+ for (const [key, value] of Object.entries(userTemplates)) {
652
+ if (value && key in merged) {
653
+ merged[key] = {
654
+ ...merged[key],
655
+ ...value
656
+ };
657
+ }
658
+ }
659
+ return merged;
660
+ }
661
+ function formatValidationMessage(template, vars) {
662
+ let result = template;
663
+ for (const [key, value] of Object.entries(vars)) {
664
+ result = result.replace(new RegExp(`\\$\\{${key}\\}`, "g"), String(value));
665
+ }
666
+ return result;
667
+ }
668
+ function getValidationMessages(templates, ruleType, locales, vars, fallbackLocale) {
669
+ const ruleTemplates = templates[ruleType];
670
+ const messages = {};
671
+ for (const locale of locales) {
672
+ const template = ruleTemplates[locale] ?? (fallbackLocale ? ruleTemplates[fallbackLocale] : void 0) ?? ruleTemplates["en"] ?? "";
673
+ messages[locale] = formatValidationMessage(template, vars);
674
+ }
675
+ return messages;
676
+ }
677
+
678
+ // src/rules-generator.ts
679
+ function getMultiLocaleDisplayName(value, locales, fallbackLocale, defaultValue) {
680
+ if (!value) {
681
+ const result2 = {};
682
+ for (const locale of locales) {
683
+ result2[locale] = defaultValue;
684
+ }
685
+ return result2;
686
+ }
687
+ if (typeof value === "string") {
688
+ const result2 = {};
689
+ for (const locale of locales) {
690
+ result2[locale] = value;
691
+ }
692
+ return result2;
693
+ }
694
+ const result = {};
695
+ for (const locale of locales) {
696
+ result[locale] = value[locale] ?? value[fallbackLocale] ?? value["en"] ?? defaultValue;
697
+ }
698
+ return result;
699
+ }
700
+ function generatePropertyRules(propName, property, displayName, locales, fallbackLocale, templates) {
701
+ const rules = [];
702
+ const propDef = property;
703
+ if (!propDef.nullable) {
704
+ rules.push({
705
+ required: true,
706
+ message: getValidationMessages(templates, "required", locales, { displayName: "${displayName}" }, fallbackLocale)
707
+ });
708
+ }
709
+ if (property.type === "Email") {
710
+ rules.push({
711
+ type: "email",
712
+ message: getValidationMessages(templates, "email", locales, { displayName: "${displayName}" }, fallbackLocale)
713
+ });
714
+ }
715
+ if (property.type === "String" || property.type === "Text" || property.type === "LongText") {
716
+ if (propDef.minLength) {
717
+ rules.push({
718
+ min: propDef.minLength,
719
+ message: getValidationMessages(templates, "minLength", locales, { displayName: "${displayName}", min: propDef.minLength }, fallbackLocale)
720
+ });
721
+ }
722
+ if (propDef.maxLength || propDef.length) {
723
+ const max = propDef.maxLength ?? propDef.length;
724
+ rules.push({
725
+ max,
726
+ message: getValidationMessages(templates, "maxLength", locales, { displayName: "${displayName}", max }, fallbackLocale)
727
+ });
728
+ }
729
+ }
730
+ if (property.type === "Int" || property.type === "BigInt" || property.type === "Float") {
731
+ if (propDef.min !== void 0) {
732
+ rules.push({
733
+ type: property.type === "Float" ? "number" : "integer",
734
+ min: propDef.min,
735
+ message: getValidationMessages(templates, "min", locales, { displayName: "${displayName}", min: propDef.min }, fallbackLocale)
736
+ });
737
+ }
738
+ if (propDef.max !== void 0) {
739
+ rules.push({
740
+ type: property.type === "Float" ? "number" : "integer",
741
+ max: propDef.max,
742
+ message: getValidationMessages(templates, "max", locales, { displayName: "${displayName}", max: propDef.max }, fallbackLocale)
743
+ });
744
+ }
745
+ }
746
+ if (propDef.pattern) {
747
+ rules.push({
748
+ pattern: propDef.pattern,
749
+ message: getValidationMessages(templates, "pattern", locales, { displayName: "${displayName}" }, fallbackLocale)
750
+ });
751
+ }
752
+ for (const rule of rules) {
753
+ const newMessage = {};
754
+ for (const locale of locales) {
755
+ const msg = rule.message[locale];
756
+ if (msg) {
757
+ newMessage[locale] = msg.replace(/\$\{displayName\}/g, displayName[locale] ?? propName);
758
+ }
759
+ }
760
+ rule.message = newMessage;
761
+ }
762
+ return rules;
763
+ }
764
+ function generateModelRules(schema, locales, fallbackLocale, templates) {
765
+ const modelDisplayName = getMultiLocaleDisplayName(
766
+ schema.displayName,
767
+ locales,
768
+ fallbackLocale,
769
+ schema.name
770
+ );
771
+ const properties = {};
772
+ if (schema.properties) {
773
+ for (const [propName, property] of Object.entries(schema.properties)) {
774
+ const propDef = property;
775
+ const displayName = getMultiLocaleDisplayName(
776
+ propDef.displayName,
777
+ locales,
778
+ fallbackLocale,
779
+ propName
780
+ );
781
+ properties[propName] = {
782
+ displayName,
783
+ rules: generatePropertyRules(propName, property, displayName, locales, fallbackLocale, templates)
784
+ };
785
+ }
786
+ }
787
+ return {
788
+ displayName: modelDisplayName,
789
+ properties
790
+ };
791
+ }
792
+ function formatRulesFile(schemaName, rules) {
793
+ const parts = [];
794
+ parts.push(`/**
795
+ * Auto-generated validation rules and metadata for ${schemaName}.
796
+ * DO NOT EDIT - This file is automatically generated and will be overwritten.
797
+ */
798
+
799
+ `);
800
+ parts.push(`export interface LocaleMap { [locale: string]: string; }
801
+
802
+ `);
803
+ parts.push(`export interface ValidationRule {
804
+ required?: boolean;
805
+ type?: 'string' | 'number' | 'email' | 'url' | 'integer';
806
+ min?: number;
807
+ max?: number;
808
+ len?: number;
809
+ pattern?: RegExp;
810
+ message: LocaleMap;
811
+ }
812
+
813
+ `);
814
+ parts.push(`/** Display name for ${schemaName} */
815
+ `);
816
+ parts.push(`export const ${schemaName}DisplayName: LocaleMap = ${JSON.stringify(rules.displayName, null, 2)};
817
+
818
+ `);
819
+ parts.push(`/** Property display names for ${schemaName} */
820
+ `);
821
+ parts.push(`export const ${schemaName}PropertyDisplayNames: Record<string, LocaleMap> = {
822
+ `);
823
+ for (const [propName, propRules] of Object.entries(rules.properties)) {
824
+ parts.push(` ${propName}: ${JSON.stringify(propRules.displayName)},
825
+ `);
826
+ }
827
+ parts.push(`};
828
+
829
+ `);
830
+ parts.push(`/** Validation rules for ${schemaName} (Ant Design compatible) */
831
+ `);
832
+ parts.push(`export const ${schemaName}Rules: Record<string, ValidationRule[]> = {
833
+ `);
834
+ for (const [propName, propRules] of Object.entries(rules.properties)) {
835
+ if (propRules.rules.length > 0) {
836
+ parts.push(` ${propName}: [
837
+ `);
838
+ for (const rule of propRules.rules) {
839
+ const ruleObj = {};
840
+ if (rule.required) ruleObj.required = true;
841
+ if (rule.type) ruleObj.type = `'${rule.type}'`;
842
+ if (rule.min !== void 0) ruleObj.min = rule.min;
843
+ if (rule.max !== void 0) ruleObj.max = rule.max;
844
+ if (rule.pattern) ruleObj.pattern = `/${rule.pattern}/`;
845
+ ruleObj.message = rule.message;
846
+ const ruleStr = Object.entries(ruleObj).map(([k, v]) => {
847
+ if (k === "type") return `${k}: ${v}`;
848
+ if (k === "pattern") return `${k}: ${v}`;
849
+ return `${k}: ${JSON.stringify(v)}`;
850
+ }).join(", ");
851
+ parts.push(` { ${ruleStr} },
852
+ `);
853
+ }
854
+ parts.push(` ],
855
+ `);
856
+ }
857
+ }
858
+ parts.push(`};
859
+
860
+ `);
861
+ parts.push(`/** Get validation rules with messages for a specific locale */
862
+ `);
863
+ parts.push(`export function get${schemaName}Rules(locale: string): Record<string, Array<{ required?: boolean; type?: string; min?: number; max?: number; pattern?: RegExp; message: string }>> {
864
+ const result: Record<string, Array<{ required?: boolean; type?: string; min?: number; max?: number; pattern?: RegExp; message: string }>> = {};
865
+ for (const [prop, rules] of Object.entries(${schemaName}Rules)) {
866
+ result[prop] = rules.map(rule => ({
867
+ ...rule,
868
+ message: rule.message[locale] ?? rule.message['en'] ?? '',
869
+ }));
870
+ }
871
+ return result;
872
+ }
873
+
874
+ `);
875
+ parts.push(`/** Get display name for a specific locale */
876
+ `);
877
+ parts.push(`export function get${schemaName}DisplayName(locale: string): string {
878
+ return ${schemaName}DisplayName[locale] ?? ${schemaName}DisplayName['en'] ?? '${schemaName}';
879
+ }
880
+
881
+ `);
882
+ parts.push(`/** Get property display name for a specific locale */
883
+ `);
884
+ parts.push(`export function get${schemaName}PropertyDisplayName(property: string, locale: string): string {
885
+ const names = ${schemaName}PropertyDisplayNames[property];
886
+ return names?.[locale] ?? names?.['en'] ?? property;
887
+ }
888
+ `);
889
+ return parts.join("");
890
+ }
891
+ function generateRulesFiles(schemas, options = {}) {
892
+ const files = [];
893
+ const localeConfig = options.localeConfig;
894
+ const locales = [...localeConfig?.locales ?? ["en"]];
895
+ const fallbackLocale = localeConfig?.fallbackLocale ?? "en";
896
+ const templates = mergeValidationTemplates(options.validationTemplates);
897
+ for (const schema of Object.values(schemas)) {
898
+ if (schema.kind === "enum") continue;
899
+ const rules = generateModelRules(schema, locales, fallbackLocale, templates);
900
+ const content = formatRulesFile(schema.name, rules);
901
+ files.push({
902
+ filePath: `rules/${schema.name}.rules.ts`,
903
+ content,
904
+ types: [`${schema.name}Rules`, `${schema.name}DisplayName`],
905
+ overwrite: true
906
+ });
907
+ }
908
+ return files;
909
+ }
910
+
524
911
  // src/generator.ts
525
912
  var DEFAULT_OPTIONS = {
526
913
  readonly: true,
@@ -675,11 +1062,11 @@ function generateIndexFile(schemas, enums, typeAliases) {
675
1062
  function generateTypeScript(schemas, options = {}) {
676
1063
  const opts = { ...DEFAULT_OPTIONS, ...options };
677
1064
  const files = [];
678
- const enums = generateEnums(schemas);
1065
+ const enums = generateEnums(schemas, opts);
679
1066
  for (const enumDef of enums) {
680
1067
  files.push(generateEnumFile(enumDef));
681
1068
  }
682
- const typeAliases = extractInlineEnums(schemas);
1069
+ const typeAliases = extractInlineEnums(schemas, opts);
683
1070
  for (const alias of typeAliases) {
684
1071
  files.push(generateTypeAliasFile(alias));
685
1072
  }
@@ -691,6 +1078,10 @@ function generateTypeScript(schemas, options = {}) {
691
1078
  if (schema.kind === "enum") continue;
692
1079
  files.push(generateModelFile(schema.name));
693
1080
  }
1081
+ if (opts.generateRules) {
1082
+ const rulesFiles = generateRulesFiles(schemas, opts);
1083
+ files.push(...rulesFiles);
1084
+ }
694
1085
  files.push(generateIndexFile(schemas, enums, typeAliases));
695
1086
  return files;
696
1087
  }
@@ -712,6 +1103,12 @@ export {
712
1103
  enumToUnionType,
713
1104
  formatTypeAlias,
714
1105
  extractInlineEnums,
1106
+ DEFAULT_VALIDATION_TEMPLATES,
1107
+ mergeValidationTemplates,
1108
+ formatValidationMessage,
1109
+ getValidationMessages,
1110
+ generateModelRules,
1111
+ generateRulesFiles,
715
1112
  generateTypeScript
716
1113
  };
717
- //# sourceMappingURL=chunk-SQD3KCIT.js.map
1114
+ //# sourceMappingURL=chunk-HPORV62S.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interface-generator.ts","../src/enum-generator.ts","../src/validation-templates.ts","../src/rules-generator.ts","../src/generator.ts"],"sourcesContent":["/**\n * @famgia/omnify-laravel - TypeScript Interface Generator\n *\n * Generates TypeScript interfaces from schemas.\n */\n\nimport type { LoadedSchema, PropertyDefinition, SchemaCollection, LocalizedString } from '@famgia/omnify-types';\nimport { resolveLocalizedString } from '@famgia/omnify-types';\nimport type { TSInterface, TSProperty, TypeScriptOptions } from './types.js';\n\n/**\n * Convert a string to snake_case.\n */\nfunction toSnakeCase(str: string): string {\n return str\n .replace(/([A-Z])/g, '_$1')\n .replace(/^_/, '')\n .toLowerCase();\n}\n\n/**\n * Maps Omnify property types to TypeScript types.\n */\nconst TYPE_MAP: Record<string, string> = {\n String: 'string',\n Int: 'number',\n BigInt: 'number',\n Float: 'number',\n Boolean: 'boolean',\n Text: 'string',\n LongText: 'string',\n Date: 'string',\n Time: 'string',\n DateTime: 'string',\n Timestamp: 'string',\n Json: 'unknown',\n Email: 'string',\n Password: 'string',\n Enum: 'string',\n Select: 'string',\n Lookup: 'number',\n};\n\n/**\n * File interface name (references the File.yaml schema).\n * The File schema is auto-generated by ensureFileSchema() when File type is used.\n */\nexport const FILE_INTERFACE_NAME = 'File';\n\n/**\n * Maps primary key types to TypeScript types.\n */\nconst PK_TYPE_MAP: Record<string, string> = {\n Int: 'number',\n BigInt: 'number',\n Uuid: 'string',\n String: 'string',\n};\n\n/**\n * Resolves a localized string using the given options.\n * Returns undefined if the value is undefined or cannot be resolved.\n */\nfunction resolveDisplayName(\n value: LocalizedString | undefined,\n options: TypeScriptOptions = {}\n): string | undefined {\n if (value === undefined) {\n return undefined;\n }\n return resolveLocalizedString(value, {\n locale: options.locale,\n config: options.localeConfig,\n });\n}\n\n/**\n * Converts property name to TypeScript property name.\n * Preserves camelCase.\n */\nexport function toPropertyName(name: string): string {\n return name;\n}\n\n/**\n * Converts schema name to TypeScript interface name.\n * Preserves PascalCase.\n */\nexport function toInterfaceName(schemaName: string): string {\n return schemaName;\n}\n\n/**\n * Gets TypeScript type for a property.\n */\nexport function getPropertyType(\n property: PropertyDefinition,\n _allSchemas: SchemaCollection\n): string {\n // Handle File type specially (polymorphic relation to files table)\n // References the File interface generated from File.yaml schema\n if (property.type === 'File') {\n const fileProp = property as { multiple?: boolean };\n if (fileProp.multiple) {\n return `${FILE_INTERFACE_NAME}[]`;\n }\n return `${FILE_INTERFACE_NAME} | null`;\n }\n\n // Handle associations\n if (property.type === 'Association') {\n const assocProp = property as {\n relation?: string;\n target?: string;\n targets?: readonly string[];\n };\n\n const targetName = assocProp.target ?? 'unknown';\n\n switch (assocProp.relation) {\n // Standard relations\n case 'OneToOne':\n case 'ManyToOne':\n return targetName;\n case 'OneToMany':\n case 'ManyToMany':\n return `${targetName}[]`;\n\n // Polymorphic relations\n case 'MorphTo':\n // Union type of all possible targets\n if (assocProp.targets && assocProp.targets.length > 0) {\n return assocProp.targets.join(' | ');\n }\n return 'unknown';\n case 'MorphOne':\n return targetName;\n case 'MorphMany':\n case 'MorphToMany':\n case 'MorphedByMany':\n return `${targetName}[]`;\n\n default:\n return 'unknown';\n }\n }\n\n // Handle enum types\n if (property.type === 'Enum') {\n const enumProp = property as { enum?: string | readonly string[] };\n if (typeof enumProp.enum === 'string') {\n // Reference to a named enum\n return enumProp.enum;\n }\n if (Array.isArray(enumProp.enum)) {\n // Inline enum - create union type\n return enumProp.enum.map(v => `'${v}'`).join(' | ');\n }\n }\n\n // Handle Select with options\n if (property.type === 'Select') {\n const selectProp = property as { options?: readonly string[] };\n if (selectProp.options && selectProp.options.length > 0) {\n return selectProp.options.map(v => `'${v}'`).join(' | ');\n }\n }\n\n // Standard type mapping\n return TYPE_MAP[property.type] ?? 'unknown';\n}\n\n/**\n * Converts a property to TypeScript property definition.\n * For MorphTo, returns multiple properties (_type, _id, and relation).\n * For compound custom types, expands to multiple properties.\n */\nexport function propertyToTSProperties(\n propertyName: string,\n property: PropertyDefinition,\n allSchemas: SchemaCollection,\n options: TypeScriptOptions = {}\n): TSProperty[] {\n const baseProp = property as { nullable?: boolean; displayName?: LocalizedString; fields?: Record<string, { nullable?: boolean }> };\n const isReadonly = options.readonly ?? true;\n // Resolve displayName using locale config\n const displayName = resolveDisplayName(baseProp.displayName, options);\n\n // Handle custom compound types from plugins (e.g., JapaneseName, JapaneseAddress)\n if (options.customTypes) {\n const customType = options.customTypes.get(property.type);\n if (customType?.compound && customType.expand) {\n const expandedProps: TSProperty[] = [];\n for (const field of customType.expand) {\n const fieldName = `${propertyName}_${toSnakeCase(field.suffix)}`;\n const fieldOverride = baseProp.fields?.[field.suffix];\n const isNullable = fieldOverride?.nullable ?? baseProp.nullable ?? false;\n const tsType = field.typescript?.type ?? 'string';\n\n expandedProps.push({\n name: fieldName,\n type: tsType,\n optional: isNullable,\n readonly: isReadonly,\n comment: `${displayName ?? propertyName} (${field.suffix})`,\n });\n }\n\n // Add accessor properties (computed properties like full_name)\n if (customType.accessors) {\n for (const accessor of customType.accessors) {\n const accessorName = `${propertyName}_${toSnakeCase(accessor.name)}`;\n expandedProps.push({\n name: accessorName,\n type: 'string | null',\n optional: true,\n readonly: isReadonly,\n comment: `${displayName ?? propertyName} (computed)`,\n });\n }\n }\n\n return expandedProps;\n }\n // Handle simple custom types (non-compound)\n if (customType && !customType.compound) {\n const tsType = customType.typescript?.type ?? 'string';\n return [{\n name: toPropertyName(propertyName),\n type: tsType,\n optional: baseProp.nullable ?? false,\n readonly: isReadonly,\n comment: displayName,\n }];\n }\n }\n\n // Handle MorphTo specially - it creates _type and _id columns\n if (property.type === 'Association') {\n const assocProp = property as {\n relation?: string;\n targets?: readonly string[];\n };\n\n if (assocProp.relation === 'MorphTo' && assocProp.targets && assocProp.targets.length > 0) {\n const propBaseName = toPropertyName(propertyName);\n const targetUnion = assocProp.targets.map(t => `'${t}'`).join(' | ');\n const relationUnion = assocProp.targets.join(' | ');\n\n return [\n {\n name: `${propBaseName}Type`,\n type: targetUnion,\n optional: true, // Polymorphic columns are nullable\n readonly: isReadonly,\n comment: `Polymorphic type for ${propertyName}`,\n },\n {\n name: `${propBaseName}Id`,\n type: 'number',\n optional: true,\n readonly: isReadonly,\n comment: `Polymorphic ID for ${propertyName}`,\n },\n {\n name: propBaseName,\n type: `${relationUnion} | null`,\n optional: true,\n readonly: isReadonly,\n comment: displayName ?? `Polymorphic relation to ${assocProp.targets.join(', ')}`,\n },\n ];\n }\n }\n\n // Default: single property\n const type = getPropertyType(property, allSchemas);\n\n return [{\n name: toPropertyName(propertyName),\n type,\n optional: baseProp.nullable ?? false,\n readonly: isReadonly,\n comment: displayName,\n }];\n}\n\n/**\n * Converts a property to TypeScript property definition (legacy - returns single property).\n */\nexport function propertyToTSProperty(\n propertyName: string,\n property: PropertyDefinition,\n allSchemas: SchemaCollection,\n options: TypeScriptOptions = {}\n): TSProperty {\n return propertyToTSProperties(propertyName, property, allSchemas, options)[0]!;\n}\n\n/**\n * Extracts referenced interface names from a TypeScript type string.\n * Returns only interface names (not primitives like string, number, boolean, unknown).\n */\nfunction extractTypeReferences(type: string, allSchemaNames: Set<string>): string[] {\n const primitives = new Set(['string', 'number', 'boolean', 'unknown', 'null', 'undefined', 'void', 'never', 'any']);\n const refs: string[] = [];\n\n // Remove array notation and split by | for union types\n const cleanType = type.replace(/\\[\\]/g, '').replace(/\\s*\\|\\s*null/g, '');\n const parts = cleanType.split(/\\s*\\|\\s*/);\n\n for (const part of parts) {\n // Remove quotes (for string literal types like 'Post')\n const trimmed = part.trim().replace(/^['\"]|['\"]$/g, '');\n if (!primitives.has(trimmed) && allSchemaNames.has(trimmed)) {\n refs.push(trimmed);\n }\n }\n\n return refs;\n}\n\n/**\n * Generates TypeScript interface from schema.\n */\nexport function schemaToInterface(\n schema: LoadedSchema,\n allSchemas: SchemaCollection,\n options: TypeScriptOptions = {}\n): TSInterface {\n const properties: TSProperty[] = [];\n const allSchemaNames = new Set(Object.keys(allSchemas).filter(name => allSchemas[name]!.kind !== 'enum'));\n\n // ID property (only if id is not disabled)\n if (schema.options?.id !== false) {\n const pkType = (schema.options?.idType ?? 'BigInt') as keyof typeof PK_TYPE_MAP;\n properties.push({\n name: 'id',\n type: PK_TYPE_MAP[pkType] ?? 'number',\n optional: false,\n readonly: options.readonly ?? true,\n comment: 'Primary key',\n });\n }\n\n // Schema properties\n if (schema.properties) {\n for (const [propName, property] of Object.entries(schema.properties)) {\n // Use propertyToTSProperties which handles MorphTo returning multiple properties\n properties.push(...propertyToTSProperties(propName, property, allSchemas, options));\n }\n }\n\n // Timestamps (snake_case to match database columns)\n if (schema.options?.timestamps !== false) {\n properties.push(\n {\n name: 'created_at',\n type: 'string',\n optional: true,\n readonly: options.readonly ?? true,\n comment: 'Creation timestamp',\n },\n {\n name: 'updated_at',\n type: 'string',\n optional: true,\n readonly: options.readonly ?? true,\n comment: 'Last update timestamp',\n }\n );\n }\n\n // Soft delete (snake_case to match database columns)\n if (schema.options?.softDelete) {\n properties.push({\n name: 'deleted_at',\n type: 'string',\n optional: true,\n readonly: options.readonly ?? true,\n comment: 'Soft delete timestamp',\n });\n }\n\n // Collect dependencies from property types\n const dependencySet = new Set<string>();\n for (const prop of properties) {\n for (const ref of extractTypeReferences(prop.type, allSchemaNames)) {\n if (ref !== schema.name) { // Don't include self-references\n dependencySet.add(ref);\n }\n }\n }\n\n // Resolve schema displayName using locale config\n const schemaDisplayName = resolveDisplayName(schema.displayName, options);\n\n return {\n name: toInterfaceName(schema.name),\n properties,\n comment: schemaDisplayName ?? schema.name,\n dependencies: dependencySet.size > 0 ? Array.from(dependencySet).sort() : undefined,\n };\n}\n\n/**\n * Formats a TypeScript property.\n */\nexport function formatProperty(property: TSProperty): string {\n const readonly = property.readonly ? 'readonly ' : '';\n const optional = property.optional ? '?' : '';\n const comment = property.comment ? ` /** ${property.comment} */\\n` : '';\n return `${comment} ${readonly}${property.name}${optional}: ${property.type};`;\n}\n\n/**\n * Formats a TypeScript interface.\n */\nexport function formatInterface(iface: TSInterface): string {\n const comment = iface.comment ? `/**\\n * ${iface.comment}\\n */\\n` : '';\n const extendsClause = iface.extends && iface.extends.length > 0\n ? ` extends ${iface.extends.join(', ')}`\n : '';\n const properties = iface.properties.map(formatProperty).join('\\n');\n\n return `${comment}export interface ${iface.name}${extendsClause} {\\n${properties}\\n}`;\n}\n\n/**\n * Generates interfaces for all schemas.\n * Note: File interface is now generated from File.yaml schema (use ensureFileSchema() to auto-create it).\n */\nexport function generateInterfaces(\n schemas: SchemaCollection,\n options: TypeScriptOptions = {}\n): TSInterface[] {\n const interfaces: TSInterface[] = [];\n\n for (const schema of Object.values(schemas)) {\n // Skip enum schemas\n if (schema.kind === 'enum') {\n continue;\n }\n\n interfaces.push(schemaToInterface(schema, schemas, options));\n }\n\n return interfaces;\n}\n","/**\n * @famgia/omnify-typescript - TypeScript Enum Generator\n *\n * Generates TypeScript enums with helper methods from schema enum definitions.\n */\n\nimport type { LoadedSchema, SchemaCollection, LocalizedString } from '@famgia/omnify-types';\nimport { resolveLocalizedString } from '@famgia/omnify-types';\nimport type { TSEnum, TSEnumValue, TSTypeAlias, TypeScriptOptions } from './types.js';\n\n/**\n * Resolves a localized string using the given options.\n */\nfunction resolveDisplayName(\n value: LocalizedString | undefined,\n options: TypeScriptOptions = {}\n): string | undefined {\n if (value === undefined) {\n return undefined;\n }\n return resolveLocalizedString(value, {\n locale: options.locale,\n config: options.localeConfig,\n });\n}\n\n/**\n * Inline enum value from schema (can be string or object with value/label/extra).\n */\ninterface InlineEnumValue {\n readonly value: string;\n /** Display label - supports multi-language (string or locale map) */\n readonly label?: LocalizedString;\n readonly extra?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Converts enum value to valid TypeScript enum member name.\n */\nexport function toEnumMemberName(value: string): string {\n // Convert to PascalCase and remove invalid characters\n return value\n .split(/[-_\\s]+/)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '');\n}\n\n/**\n * Converts schema name to TypeScript enum name.\n */\nexport function toEnumName(schemaName: string): string {\n return schemaName;\n}\n\n/**\n * Parses enum value from schema (can be string or object).\n * If multiLocale is true, keeps all locales. Otherwise resolves to single locale.\n */\nfunction parseEnumValue(\n value: string | InlineEnumValue,\n options: TypeScriptOptions = {}\n): TSEnumValue {\n if (typeof value === 'string') {\n return {\n name: toEnumMemberName(value),\n value,\n // No label or extra - will fallback to value\n };\n }\n\n // Handle label - either multi-locale or resolved single locale\n let label: string | Record<string, string> | undefined;\n if (value.label !== undefined) {\n if (options.multiLocale && typeof value.label === 'object') {\n // Keep all locales as object\n label = value.label as Record<string, string>;\n } else {\n // Resolve to single locale\n label = resolveDisplayName(value.label, options);\n }\n }\n\n return {\n name: toEnumMemberName(value.value),\n value: value.value,\n label,\n extra: value.extra,\n };\n}\n\n/**\n * Generates TypeScript enum from schema enum.\n */\nexport function schemaToEnum(schema: LoadedSchema, options: TypeScriptOptions = {}): TSEnum | null {\n if (schema.kind !== 'enum' || !schema.values) {\n return null;\n }\n\n const values: TSEnumValue[] = schema.values.map(value =>\n parseEnumValue(value as string | InlineEnumValue, options)\n );\n const displayName = resolveDisplayName(schema.displayName, options);\n\n return {\n name: toEnumName(schema.name),\n values,\n comment: displayName ?? schema.name,\n };\n}\n\n/**\n * Generates enums for all enum schemas.\n */\nexport function generateEnums(schemas: SchemaCollection, options: TypeScriptOptions = {}): TSEnum[] {\n const enums: TSEnum[] = [];\n\n for (const schema of Object.values(schemas)) {\n if (schema.kind === 'enum') {\n const enumDef = schemaToEnum(schema, options);\n if (enumDef) {\n enums.push(enumDef);\n }\n }\n }\n\n return enums;\n}\n\n/**\n * Check if label is multi-locale (object) or single string.\n */\nfunction isMultiLocaleLabel(label: string | Record<string, string> | undefined): label is Record<string, string> {\n return label !== undefined && typeof label === 'object';\n}\n\n/**\n * Formats a TypeScript enum with helper methods.\n */\nexport function formatEnum(enumDef: TSEnum): string {\n const { name, values, comment } = enumDef;\n const parts: string[] = [];\n\n // JSDoc comment\n if (comment) {\n parts.push(`/**\\n * ${comment}\\n */\\n`);\n }\n\n // Enum definition\n const enumValues = values\n .map(v => ` ${v.name} = '${v.value}',`)\n .join('\\n');\n parts.push(`export enum ${name} {\\n${enumValues}\\n}\\n\\n`);\n\n // Values array\n parts.push(`/** All ${name} values */\\n`);\n parts.push(`export const ${name}Values = Object.values(${name});\\n\\n`);\n\n // Type guard\n parts.push(`/** Type guard for ${name} */\\n`);\n parts.push(`export function is${name}(value: unknown): value is ${name} {\\n`);\n parts.push(` return ${name}Values.includes(value as ${name});\\n`);\n parts.push(`}\\n\\n`);\n\n // Check if we have multi-locale labels or single-locale labels\n const hasLabels = values.some(v => v.label !== undefined);\n const hasMultiLocale = values.some(v => isMultiLocaleLabel(v.label));\n\n if (hasLabels) {\n if (hasMultiLocale) {\n // Multi-locale labels: Record<Enum, Record<string, string>>\n const labelEntries = values\n .filter(v => v.label !== undefined)\n .map(v => {\n if (isMultiLocaleLabel(v.label)) {\n const locales = Object.entries(v.label)\n .map(([locale, text]) => `${locale}: '${text}'`)\n .join(', ');\n return ` [${name}.${v.name}]: { ${locales} },`;\n }\n return ` [${name}.${v.name}]: { default: '${v.label}' },`;\n })\n .join('\\n');\n parts.push(`const ${lowerFirst(name)}Labels: Partial<Record<${name}, Record<string, string>>> = {\\n${labelEntries}\\n};\\n\\n`);\n\n parts.push(`/** Get label for ${name} value with locale support */\\n`);\n parts.push(`export function get${name}Label(value: ${name}, locale?: string): string {\\n`);\n parts.push(` const labels = ${lowerFirst(name)}Labels[value];\\n`);\n parts.push(` if (!labels) return value;\\n`);\n parts.push(` if (locale && labels[locale]) return labels[locale];\\n`);\n parts.push(` return Object.values(labels)[0] ?? value;\\n`);\n parts.push(`}\\n\\n`);\n } else {\n // Single-locale labels: Record<Enum, string>\n const labelEntries = values\n .filter(v => v.label !== undefined)\n .map(v => ` [${name}.${v.name}]: '${v.label}',`)\n .join('\\n');\n parts.push(`const ${lowerFirst(name)}Labels: Partial<Record<${name}, string>> = {\\n${labelEntries}\\n};\\n\\n`);\n\n parts.push(`/** Get label for ${name} value (fallback to value if no label) */\\n`);\n parts.push(`export function get${name}Label(value: ${name}): string {\\n`);\n parts.push(` return ${lowerFirst(name)}Labels[value] ?? value;\\n`);\n parts.push(`}\\n\\n`);\n }\n } else {\n parts.push(`/** Get label for ${name} value (returns value as-is) */\\n`);\n parts.push(`export function get${name}Label(value: ${name}): string {\\n`);\n parts.push(` return value;\\n`);\n parts.push(`}\\n\\n`);\n }\n\n // Extra - only generate if at least one value has extra\n const hasExtra = values.some(v => v.extra !== undefined);\n if (hasExtra) {\n const extraEntries = values\n .filter(v => v.extra !== undefined)\n .map(v => ` [${name}.${v.name}]: ${JSON.stringify(v.extra)},`)\n .join('\\n');\n parts.push(`const ${lowerFirst(name)}Extra: Partial<Record<${name}, Record<string, unknown>>> = {\\n${extraEntries}\\n};\\n\\n`);\n\n parts.push(`/** Get extra metadata for ${name} value (undefined if not defined) */\\n`);\n parts.push(`export function get${name}Extra(value: ${name}): Record<string, unknown> | undefined {\\n`);\n parts.push(` return ${lowerFirst(name)}Extra[value];\\n`);\n parts.push(`}`);\n } else {\n parts.push(`/** Get extra metadata for ${name} value (undefined if not defined) */\\n`);\n parts.push(`export function get${name}Extra(_value: ${name}): Record<string, unknown> | undefined {\\n`);\n parts.push(` return undefined;\\n`);\n parts.push(`}`);\n }\n\n return parts.join('');\n}\n\n/**\n * Convert first character to lowercase.\n */\nfunction lowerFirst(str: string): string {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\n\n/**\n * Generates a union type alias as an alternative to enum.\n */\nexport function enumToUnionType(enumDef: TSEnum): TSTypeAlias {\n const type = enumDef.values\n .map(v => `'${v.value}'`)\n .join(' | ');\n\n return {\n name: enumDef.name,\n type,\n comment: enumDef.comment,\n };\n}\n\n/**\n * Formats a TypeScript type alias with helper methods.\n */\nexport function formatTypeAlias(alias: TSTypeAlias): string {\n const { name, type, comment } = alias;\n const parts: string[] = [];\n\n // JSDoc comment\n if (comment) {\n parts.push(`/**\\n * ${comment}\\n */\\n`);\n }\n\n // Type alias\n parts.push(`export type ${name} = ${type};\\n\\n`);\n\n // Values array\n const values = type.split(' | ').map(v => v.trim());\n parts.push(`/** All ${name} values */\\n`);\n parts.push(`export const ${name}Values: ${name}[] = [${values.join(', ')}];\\n\\n`);\n\n // Type guard\n parts.push(`/** Type guard for ${name} */\\n`);\n parts.push(`export function is${name}(value: unknown): value is ${name} {\\n`);\n parts.push(` return ${name}Values.includes(value as ${name});\\n`);\n parts.push(`}\\n\\n`);\n\n // Label getter (fallback to value for type aliases - no labels)\n parts.push(`/** Get label for ${name} value (returns value as-is) */\\n`);\n parts.push(`export function get${name}Label(value: ${name}): string {\\n`);\n parts.push(` return value;\\n`);\n parts.push(`}\\n\\n`);\n\n // Extra getter (always undefined for type aliases)\n parts.push(`/** Get extra metadata for ${name} value (always undefined for type aliases) */\\n`);\n parts.push(`export function get${name}Extra(_value: ${name}): Record<string, unknown> | undefined {\\n`);\n parts.push(` return undefined;\\n`);\n parts.push(`}`);\n\n return parts.join('');\n}\n\n/**\n * Extracts inline enums from properties for type generation.\n */\nexport function extractInlineEnums(schemas: SchemaCollection, options: TypeScriptOptions = {}): TSTypeAlias[] {\n const typeAliases: TSTypeAlias[] = [];\n\n for (const schema of Object.values(schemas)) {\n if (schema.kind === 'enum' || !schema.properties) {\n continue;\n }\n\n for (const [propName, property] of Object.entries(schema.properties)) {\n if (property.type === 'Enum') {\n const enumProp = property as { enum?: readonly (string | InlineEnumValue)[]; displayName?: LocalizedString };\n\n // Only handle inline array enums (not references to named enums)\n if (Array.isArray(enumProp.enum) && enumProp.enum.length > 0) {\n const typeName = `${schema.name}${propName.charAt(0).toUpperCase() + propName.slice(1)}`;\n const values = enumProp.enum.map(v =>\n typeof v === 'string' ? v : v.value\n );\n const displayName = resolveDisplayName(enumProp.displayName, options);\n typeAliases.push({\n name: typeName,\n type: values.map(v => `'${v}'`).join(' | '),\n comment: displayName ?? `${schema.name} ${propName} enum`,\n });\n }\n }\n\n if (property.type === 'Select') {\n const selectProp = property as { options?: readonly string[]; displayName?: LocalizedString };\n\n if (selectProp.options && selectProp.options.length > 0) {\n const typeName = `${schema.name}${propName.charAt(0).toUpperCase() + propName.slice(1)}`;\n const displayName = resolveDisplayName(selectProp.displayName, options);\n typeAliases.push({\n name: typeName,\n type: selectProp.options.map(v => `'${v}'`).join(' | '),\n comment: displayName ?? `${schema.name} ${propName} options`,\n });\n }\n }\n }\n }\n\n return typeAliases;\n}\n","/**\n * Built-in validation message templates for common languages.\n * Templates use ${displayName}, ${min}, ${max}, ${pattern} placeholders.\n */\n\nexport interface ValidationTemplates {\n readonly required: Record<string, string>;\n readonly minLength: Record<string, string>;\n readonly maxLength: Record<string, string>;\n readonly min: Record<string, string>;\n readonly max: Record<string, string>;\n readonly email: Record<string, string>;\n readonly url: Record<string, string>;\n readonly pattern: Record<string, string>;\n readonly enum: Record<string, string>;\n}\n\n/**\n * Default validation message templates.\n * Supports: ja (Japanese), en (English), vi (Vietnamese), ko (Korean), zh (Chinese)\n */\nexport const DEFAULT_VALIDATION_TEMPLATES: ValidationTemplates = {\n required: {\n ja: '${displayName}は必須です',\n en: '${displayName} is required',\n vi: '${displayName} là bắt buộc',\n ko: '${displayName}은(는) 필수입니다',\n zh: '${displayName}为必填项',\n },\n minLength: {\n ja: '${displayName}は${min}文字以上で入力してください',\n en: '${displayName} must be at least ${min} characters',\n vi: '${displayName} phải có ít nhất ${min} ký tự',\n ko: '${displayName}은(는) ${min}자 이상이어야 합니다',\n zh: '${displayName}至少需要${min}个字符',\n },\n maxLength: {\n ja: '${displayName}は${max}文字以内で入力してください',\n en: '${displayName} must be at most ${max} characters',\n vi: '${displayName} tối đa ${max} ký tự',\n ko: '${displayName}은(는) ${max}자 이하여야 합니다',\n zh: '${displayName}不能超过${max}个字符',\n },\n min: {\n ja: '${displayName}は${min}以上の値を入力してください',\n en: '${displayName} must be at least ${min}',\n vi: '${displayName} phải lớn hơn hoặc bằng ${min}',\n ko: '${displayName}은(는) ${min} 이상이어야 합니다',\n zh: '${displayName}不能小于${min}',\n },\n max: {\n ja: '${displayName}は${max}以下の値を入力してください',\n en: '${displayName} must be at most ${max}',\n vi: '${displayName} phải nhỏ hơn hoặc bằng ${max}',\n ko: '${displayName}은(는) ${max} 이하여야 합니다',\n zh: '${displayName}不能大于${max}',\n },\n email: {\n ja: '${displayName}の形式が正しくありません',\n en: '${displayName} is not a valid email address',\n vi: '${displayName} không phải là địa chỉ email hợp lệ',\n ko: '${displayName} 형식이 올바르지 않습니다',\n zh: '${displayName}不是有效的邮箱地址',\n },\n url: {\n ja: '${displayName}は有効なURLではありません',\n en: '${displayName} is not a valid URL',\n vi: '${displayName} không phải là URL hợp lệ',\n ko: '${displayName}은(는) 유효한 URL이 아닙니다',\n zh: '${displayName}不是有效的URL',\n },\n pattern: {\n ja: '${displayName}の形式が正しくありません',\n en: '${displayName} format is invalid',\n vi: '${displayName} không đúng định dạng',\n ko: '${displayName} 형식이 올바르지 않습니다',\n zh: '${displayName}格式不正确',\n },\n enum: {\n ja: '${displayName}の値が無効です',\n en: '${displayName} has an invalid value',\n vi: '${displayName} có giá trị không hợp lệ',\n ko: '${displayName} 값이 유효하지 않습니다',\n zh: '${displayName}的值无效',\n },\n};\n\n/**\n * Merge user templates with default templates.\n */\nexport function mergeValidationTemplates(\n userTemplates?: Partial<ValidationTemplates>\n): ValidationTemplates {\n if (!userTemplates) {\n return DEFAULT_VALIDATION_TEMPLATES;\n }\n\n // Create mutable copies of each template category\n const merged: Record<keyof ValidationTemplates, Record<string, string>> = {\n required: { ...DEFAULT_VALIDATION_TEMPLATES.required },\n minLength: { ...DEFAULT_VALIDATION_TEMPLATES.minLength },\n maxLength: { ...DEFAULT_VALIDATION_TEMPLATES.maxLength },\n min: { ...DEFAULT_VALIDATION_TEMPLATES.min },\n max: { ...DEFAULT_VALIDATION_TEMPLATES.max },\n email: { ...DEFAULT_VALIDATION_TEMPLATES.email },\n url: { ...DEFAULT_VALIDATION_TEMPLATES.url },\n pattern: { ...DEFAULT_VALIDATION_TEMPLATES.pattern },\n enum: { ...DEFAULT_VALIDATION_TEMPLATES.enum },\n };\n\n // Merge user templates\n for (const [key, value] of Object.entries(userTemplates)) {\n if (value && key in merged) {\n merged[key as keyof ValidationTemplates] = {\n ...merged[key as keyof ValidationTemplates],\n ...value,\n };\n }\n }\n\n return merged as ValidationTemplates;\n}\n\n/**\n * Format a validation message with placeholders.\n */\nexport function formatValidationMessage(\n template: string,\n vars: Record<string, string | number>\n): string {\n let result = template;\n for (const [key, value] of Object.entries(vars)) {\n result = result.replace(new RegExp(`\\\\$\\\\{${key}\\\\}`, 'g'), String(value));\n }\n return result;\n}\n\n/**\n * Get validation messages for all configured locales.\n * Fallback order: locale -> fallbackLocale -> 'en'\n */\nexport function getValidationMessages(\n templates: ValidationTemplates,\n ruleType: keyof ValidationTemplates,\n locales: string[],\n vars: Record<string, string | number>,\n fallbackLocale?: string\n): Record<string, string> {\n const ruleTemplates = templates[ruleType];\n const messages: Record<string, string> = {};\n\n for (const locale of locales) {\n // Try: locale -> fallbackLocale -> 'en'\n const template = ruleTemplates[locale]\n ?? (fallbackLocale ? ruleTemplates[fallbackLocale] : undefined)\n ?? ruleTemplates['en']\n ?? '';\n messages[locale] = formatValidationMessage(template, vars);\n }\n\n return messages;\n}\n","/**\n * Generates Ant Design compatible validation rules from schemas.\n */\n\nimport type { LoadedSchema, SchemaCollection, PropertyDefinition, LocalizedString, LocaleConfig } from '@famgia/omnify-types';\nimport type { TypeScriptFile, TypeScriptOptions, LocaleMap } from './types.js';\nimport {\n DEFAULT_VALIDATION_TEMPLATES,\n mergeValidationTemplates,\n getValidationMessages,\n type ValidationTemplates,\n} from './validation-templates.js';\n\n/**\n * Ant Design rule structure with multi-locale message.\n */\ninterface AntdRule {\n required?: boolean;\n type?: 'string' | 'number' | 'email' | 'url' | 'integer';\n min?: number;\n max?: number;\n len?: number;\n pattern?: string;\n message: LocaleMap;\n}\n\n/**\n * Property rules for a model.\n */\ninterface PropertyRules {\n displayName: LocaleMap;\n rules: AntdRule[];\n}\n\n/**\n * Model rules structure.\n */\ninterface ModelRules {\n displayName: LocaleMap;\n properties: Record<string, PropertyRules>;\n}\n\n/**\n * Get localized display name as object with all locales.\n */\nfunction getMultiLocaleDisplayName(\n value: LocalizedString | undefined,\n locales: string[],\n fallbackLocale: string,\n defaultValue: string\n): LocaleMap {\n if (!value) {\n // Return default value for all locales\n const result: Record<string, string> = {};\n for (const locale of locales) {\n result[locale] = defaultValue;\n }\n return result;\n }\n\n if (typeof value === 'string') {\n const result: Record<string, string> = {};\n for (const locale of locales) {\n result[locale] = value;\n }\n return result;\n }\n\n // It's a locale map\n const result: Record<string, string> = {};\n for (const locale of locales) {\n result[locale] = value[locale] ?? value[fallbackLocale] ?? value['en'] ?? defaultValue;\n }\n return result;\n}\n\n/**\n * Generate validation rules for a property.\n */\nfunction generatePropertyRules(\n propName: string,\n property: PropertyDefinition,\n displayName: LocaleMap,\n locales: string[],\n fallbackLocale: string,\n templates: ValidationTemplates\n): AntdRule[] {\n const rules: AntdRule[] = [];\n const propDef = property as {\n nullable?: boolean;\n length?: number;\n minLength?: number;\n maxLength?: number;\n min?: number;\n max?: number;\n pattern?: string;\n };\n\n // Required rule (if not nullable)\n if (!propDef.nullable) {\n rules.push({\n required: true,\n message: getValidationMessages(templates, 'required', locales, { displayName: '${displayName}' }, fallbackLocale),\n });\n }\n\n // Type-specific rules\n if (property.type === 'Email') {\n rules.push({\n type: 'email',\n message: getValidationMessages(templates, 'email', locales, { displayName: '${displayName}' }, fallbackLocale),\n });\n }\n\n // Length rules for strings\n if (property.type === 'String' || property.type === 'Text' || property.type === 'LongText') {\n if (propDef.minLength) {\n rules.push({\n min: propDef.minLength,\n message: getValidationMessages(templates, 'minLength', locales, { displayName: '${displayName}', min: propDef.minLength }, fallbackLocale),\n });\n }\n if (propDef.maxLength || propDef.length) {\n const max = propDef.maxLength ?? propDef.length!;\n rules.push({\n max,\n message: getValidationMessages(templates, 'maxLength', locales, { displayName: '${displayName}', max }, fallbackLocale),\n });\n }\n }\n\n // Numeric range rules\n if (property.type === 'Int' || property.type === 'BigInt' || property.type === 'Float') {\n if (propDef.min !== undefined) {\n rules.push({\n type: property.type === 'Float' ? 'number' : 'integer',\n min: propDef.min,\n message: getValidationMessages(templates, 'min', locales, { displayName: '${displayName}', min: propDef.min }, fallbackLocale),\n });\n }\n if (propDef.max !== undefined) {\n rules.push({\n type: property.type === 'Float' ? 'number' : 'integer',\n max: propDef.max,\n message: getValidationMessages(templates, 'max', locales, { displayName: '${displayName}', max: propDef.max }, fallbackLocale),\n });\n }\n }\n\n // Pattern rule\n if (propDef.pattern) {\n rules.push({\n pattern: propDef.pattern,\n message: getValidationMessages(templates, 'pattern', locales, { displayName: '${displayName}' }, fallbackLocale),\n });\n }\n\n // Replace ${displayName} placeholder with actual display name per locale\n for (const rule of rules) {\n const newMessage: Record<string, string> = {};\n for (const locale of locales) {\n const msg = rule.message[locale];\n if (msg) {\n newMessage[locale] = msg.replace(/\\$\\{displayName\\}/g, displayName[locale] ?? propName);\n }\n }\n (rule as { message: Record<string, string> }).message = newMessage;\n }\n\n return rules;\n}\n\n/**\n * Generate rules for a schema.\n */\nexport function generateModelRules(\n schema: LoadedSchema,\n locales: string[],\n fallbackLocale: string,\n templates: ValidationTemplates\n): ModelRules {\n const modelDisplayName = getMultiLocaleDisplayName(\n schema.displayName,\n locales,\n fallbackLocale,\n schema.name\n );\n\n const properties: Record<string, PropertyRules> = {};\n\n if (schema.properties) {\n for (const [propName, property] of Object.entries(schema.properties)) {\n const propDef = property as { displayName?: LocalizedString };\n const displayName = getMultiLocaleDisplayName(\n propDef.displayName,\n locales,\n fallbackLocale,\n propName\n );\n\n properties[propName] = {\n displayName,\n rules: generatePropertyRules(propName, property, displayName, locales, fallbackLocale, templates),\n };\n }\n }\n\n return {\n displayName: modelDisplayName,\n properties,\n };\n}\n\n/**\n * Format rules as TypeScript code.\n */\nfunction formatRulesFile(\n schemaName: string,\n rules: ModelRules\n): string {\n const parts: string[] = [];\n\n parts.push(`/**\n * Auto-generated validation rules and metadata for ${schemaName}.\n * DO NOT EDIT - This file is automatically generated and will be overwritten.\n */\n\n`);\n\n // Type definitions\n parts.push(`export interface LocaleMap { [locale: string]: string; }\\n\\n`);\n parts.push(`export interface ValidationRule {\n required?: boolean;\n type?: 'string' | 'number' | 'email' | 'url' | 'integer';\n min?: number;\n max?: number;\n len?: number;\n pattern?: RegExp;\n message: LocaleMap;\n}\\n\\n`);\n\n // Model display name\n parts.push(`/** Display name for ${schemaName} */\\n`);\n parts.push(`export const ${schemaName}DisplayName: LocaleMap = ${JSON.stringify(rules.displayName, null, 2)};\\n\\n`);\n\n // Property metadata and rules\n parts.push(`/** Property display names for ${schemaName} */\\n`);\n parts.push(`export const ${schemaName}PropertyDisplayNames: Record<string, LocaleMap> = {\\n`);\n for (const [propName, propRules] of Object.entries(rules.properties)) {\n parts.push(` ${propName}: ${JSON.stringify(propRules.displayName)},\\n`);\n }\n parts.push(`};\\n\\n`);\n\n // Validation rules\n parts.push(`/** Validation rules for ${schemaName} (Ant Design compatible) */\\n`);\n parts.push(`export const ${schemaName}Rules: Record<string, ValidationRule[]> = {\\n`);\n for (const [propName, propRules] of Object.entries(rules.properties)) {\n if (propRules.rules.length > 0) {\n parts.push(` ${propName}: [\\n`);\n for (const rule of propRules.rules) {\n const ruleObj: Record<string, unknown> = {};\n if (rule.required) ruleObj.required = true;\n if (rule.type) ruleObj.type = `'${rule.type}'`;\n if (rule.min !== undefined) ruleObj.min = rule.min;\n if (rule.max !== undefined) ruleObj.max = rule.max;\n if (rule.pattern) ruleObj.pattern = `/${rule.pattern}/`;\n ruleObj.message = rule.message;\n\n // Format as JS object\n const ruleStr = Object.entries(ruleObj)\n .map(([k, v]) => {\n if (k === 'type') return `${k}: ${v}`;\n if (k === 'pattern') return `${k}: ${v}`;\n return `${k}: ${JSON.stringify(v)}`;\n })\n .join(', ');\n parts.push(` { ${ruleStr} },\\n`);\n }\n parts.push(` ],\\n`);\n }\n }\n parts.push(`};\\n\\n`);\n\n // Helper function to get rules with locale-specific messages\n parts.push(`/** Get validation rules with messages for a specific locale */\\n`);\n parts.push(`export function get${schemaName}Rules(locale: string): Record<string, Array<{ required?: boolean; type?: string; min?: number; max?: number; pattern?: RegExp; message: string }>> {\n const result: Record<string, Array<{ required?: boolean; type?: string; min?: number; max?: number; pattern?: RegExp; message: string }>> = {};\n for (const [prop, rules] of Object.entries(${schemaName}Rules)) {\n result[prop] = rules.map(rule => ({\n ...rule,\n message: rule.message[locale] ?? rule.message['en'] ?? '',\n }));\n }\n return result;\n}\\n\\n`);\n\n // Helper function to get display name\n parts.push(`/** Get display name for a specific locale */\\n`);\n parts.push(`export function get${schemaName}DisplayName(locale: string): string {\n return ${schemaName}DisplayName[locale] ?? ${schemaName}DisplayName['en'] ?? '${schemaName}';\n}\\n\\n`);\n\n parts.push(`/** Get property display name for a specific locale */\\n`);\n parts.push(`export function get${schemaName}PropertyDisplayName(property: string, locale: string): string {\n const names = ${schemaName}PropertyDisplayNames[property];\n return names?.[locale] ?? names?.['en'] ?? property;\n}\\n`);\n\n return parts.join('');\n}\n\n/**\n * Generate rules files for all schemas.\n */\nexport function generateRulesFiles(\n schemas: SchemaCollection,\n options: TypeScriptOptions = {}\n): TypeScriptFile[] {\n const files: TypeScriptFile[] = [];\n const localeConfig = options.localeConfig;\n const locales = [...(localeConfig?.locales ?? ['en'])]; // Convert readonly to mutable\n const fallbackLocale = localeConfig?.fallbackLocale ?? 'en';\n\n // Merge user templates with defaults\n const templates = mergeValidationTemplates(options.validationTemplates as Partial<ValidationTemplates> | undefined);\n\n for (const schema of Object.values(schemas)) {\n if (schema.kind === 'enum') continue;\n\n const rules = generateModelRules(schema, locales, fallbackLocale, templates);\n const content = formatRulesFile(schema.name, rules);\n\n files.push({\n filePath: `rules/${schema.name}.rules.ts`,\n content,\n types: [`${schema.name}Rules`, `${schema.name}DisplayName`],\n overwrite: true,\n });\n }\n\n return files;\n}\n","/**\n * @famgia/omnify-typescript - TypeScript Generator\n *\n * Generates TypeScript models with base/model pattern:\n * - models/base/[SchemaName].ts - Auto-generated base interfaces, DO NOT EDIT\n * - models/enum/[EnumName].ts - Auto-generated enums/type aliases, DO NOT EDIT\n * - models/[SchemaName].ts - Extends base, user can customize\n * - models/index.ts - Re-exports all\n */\n\nimport type { SchemaCollection } from '@famgia/omnify-types';\nimport type { TypeScriptFile, TypeScriptOptions, TSEnum, TSTypeAlias } from './types.js';\nimport { generateInterfaces, formatInterface } from './interface-generator.js';\nimport { generateEnums, formatEnum, formatTypeAlias, extractInlineEnums } from './enum-generator.js';\nimport { generateRulesFiles } from './rules-generator.js';\n\n/**\n * Default options for TypeScript generation.\n */\nconst DEFAULT_OPTIONS: TypeScriptOptions = {\n readonly: true,\n strictNullChecks: true,\n};\n\n/**\n * Generates the base file header comment (DO NOT EDIT).\n */\nfunction generateBaseHeader(): string {\n return `/**\n * Auto-generated TypeScript types from Omnify schemas.\n * DO NOT EDIT - This file is automatically generated and will be overwritten.\n */\n\n`;\n}\n\n/**\n * Generates the model file header comment (user can edit).\n */\nfunction generateModelHeader(schemaName: string): string {\n return `/**\n * ${schemaName} Model\n *\n * This file extends the auto-generated base interface.\n * You can add custom methods, computed properties, or override types here.\n * This file will NOT be overwritten by the generator.\n */\n\n`;\n}\n\n/**\n * Generates a single base interface file.\n */\nfunction generateBaseInterfaceFile(\n schemaName: string,\n schemas: SchemaCollection,\n options: TypeScriptOptions\n): TypeScriptFile {\n const interfaces = generateInterfaces(schemas, options);\n const iface = interfaces.find(i => i.name === schemaName);\n\n if (!iface) {\n throw new Error(`Interface not found for schema: ${schemaName}`);\n }\n\n const parts: string[] = [generateBaseHeader()];\n\n // Add imports for dependencies\n if (iface.dependencies && iface.dependencies.length > 0) {\n for (const dep of iface.dependencies) {\n parts.push(`import type { ${dep} } from './${dep}.js';\\n`);\n }\n parts.push('\\n');\n }\n\n parts.push(formatInterface(iface));\n parts.push('\\n');\n\n return {\n filePath: `base/${schemaName}.ts`,\n content: parts.join(''),\n types: [schemaName],\n overwrite: true,\n };\n}\n\n/**\n * Generates a single enum file.\n */\nfunction generateEnumFile(enumDef: TSEnum): TypeScriptFile {\n const parts: string[] = [generateBaseHeader()];\n parts.push(formatEnum(enumDef));\n parts.push('\\n');\n\n return {\n filePath: `enum/${enumDef.name}.ts`,\n content: parts.join(''),\n types: [enumDef.name],\n overwrite: true,\n };\n}\n\n/**\n * Generates a single type alias file.\n */\nfunction generateTypeAliasFile(alias: TSTypeAlias): TypeScriptFile {\n const parts: string[] = [generateBaseHeader()];\n parts.push(formatTypeAlias(alias));\n parts.push('\\n');\n\n return {\n filePath: `enum/${alias.name}.ts`,\n content: parts.join(''),\n types: [alias.name],\n overwrite: true,\n };\n}\n\n/**\n * Generates model file content that extends base.\n */\nfunction generateModelFile(schemaName: string): TypeScriptFile {\n const parts: string[] = [generateModelHeader(schemaName)];\n\n // Import base interface\n parts.push(`import type { ${schemaName} as ${schemaName}Base } from './base/${schemaName}.js';\\n\\n`);\n\n // Export interface that extends base\n parts.push(`/**\\n * ${schemaName} model interface.\\n * Add custom properties or methods here.\\n */\\n`);\n parts.push(`export interface ${schemaName} extends ${schemaName}Base {\\n`);\n parts.push(` // Add custom properties here\\n`);\n parts.push(`}\\n\\n`);\n\n // Re-export base for convenience\n parts.push(`// Re-export base type for internal use\\n`);\n parts.push(`export type { ${schemaName}Base };\\n`);\n\n return {\n filePath: `${schemaName}.ts`,\n content: parts.join(''),\n types: [schemaName],\n overwrite: false, // Never overwrite user models\n };\n}\n\n/**\n * Generates index file for re-exports.\n */\nfunction generateIndexFile(\n schemas: SchemaCollection,\n enums: TSEnum[],\n typeAliases: TSTypeAlias[]\n): TypeScriptFile {\n const parts: string[] = [generateBaseHeader()];\n\n // Export enums (enum + Values + isX + getXLabel + getXExtra)\n if (enums.length > 0 || typeAliases.length > 0) {\n parts.push(`// Enums\\n`);\n for (const enumDef of enums) {\n parts.push(`export {\\n`);\n parts.push(` ${enumDef.name},\\n`);\n parts.push(` ${enumDef.name}Values,\\n`);\n parts.push(` is${enumDef.name},\\n`);\n parts.push(` get${enumDef.name}Label,\\n`);\n parts.push(` get${enumDef.name}Extra,\\n`);\n parts.push(`} from './enum/${enumDef.name}.js';\\n`);\n }\n for (const alias of typeAliases) {\n parts.push(`export {\\n`);\n parts.push(` type ${alias.name},\\n`);\n parts.push(` ${alias.name}Values,\\n`);\n parts.push(` is${alias.name},\\n`);\n parts.push(` get${alias.name}Label,\\n`);\n parts.push(` get${alias.name}Extra,\\n`);\n parts.push(`} from './enum/${alias.name}.js';\\n`);\n }\n parts.push('\\n');\n }\n\n // Export all models\n parts.push(`// Models\\n`);\n for (const schema of Object.values(schemas)) {\n if (schema.kind === 'enum') continue;\n parts.push(`export type { ${schema.name} } from './${schema.name}.js';\\n`);\n }\n\n return {\n filePath: 'index.ts',\n content: parts.join(''),\n types: [],\n overwrite: true,\n };\n}\n\n/**\n * Generates TypeScript files with base/model pattern.\n *\n * Output structure:\n * - models/base/[SchemaName].ts - Auto-generated base interfaces (always overwritten)\n * - models/enum/[EnumName].ts - Auto-generated enums/type aliases (always overwritten)\n * - models/[SchemaName].ts - User-editable models that extend base (created once, never overwritten)\n * - models/index.ts - Re-exports (always overwritten)\n */\nexport function generateTypeScript(\n schemas: SchemaCollection,\n options: TypeScriptOptions = {}\n): TypeScriptFile[] {\n const opts = { ...DEFAULT_OPTIONS, ...options };\n const files: TypeScriptFile[] = [];\n\n // Generate enum files\n const enums = generateEnums(schemas, opts);\n for (const enumDef of enums) {\n files.push(generateEnumFile(enumDef));\n }\n\n // Generate type alias files\n const typeAliases = extractInlineEnums(schemas, opts);\n for (const alias of typeAliases) {\n files.push(generateTypeAliasFile(alias));\n }\n\n // Generate base interface files\n for (const schema of Object.values(schemas)) {\n if (schema.kind === 'enum') continue;\n files.push(generateBaseInterfaceFile(schema.name, schemas, opts));\n }\n\n // Generate model files (only created if not exists)\n for (const schema of Object.values(schemas)) {\n if (schema.kind === 'enum') continue;\n files.push(generateModelFile(schema.name));\n }\n\n // Generate validation rules files (if enabled)\n if (opts.generateRules) {\n const rulesFiles = generateRulesFiles(schemas, opts);\n files.push(...rulesFiles);\n }\n\n // Generate index file\n files.push(generateIndexFile(schemas, enums, typeAliases));\n\n return files;\n}\n\n// Legacy exports for compatibility\nexport { generateTypeScript as generateTypeScriptFiles };\n"],"mappings":";AAOA,SAAS,8BAA8B;AAMvC,SAAS,YAAY,KAAqB;AACxC,SAAO,IACJ,QAAQ,YAAY,KAAK,EACzB,QAAQ,MAAM,EAAE,EAChB,YAAY;AACjB;AAKA,IAAM,WAAmC;AAAA,EACvC,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACV;AAMO,IAAM,sBAAsB;AAKnC,IAAM,cAAsC;AAAA,EAC1C,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AACV;AAMA,SAAS,mBACP,OACA,UAA6B,CAAC,GACV;AACpB,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AACA,SAAO,uBAAuB,OAAO;AAAA,IACnC,QAAQ,QAAQ;AAAA,IAChB,QAAQ,QAAQ;AAAA,EAClB,CAAC;AACH;AAMO,SAAS,eAAe,MAAsB;AACnD,SAAO;AACT;AAMO,SAAS,gBAAgB,YAA4B;AAC1D,SAAO;AACT;AAKO,SAAS,gBACd,UACA,aACQ;AAGR,MAAI,SAAS,SAAS,QAAQ;AAC5B,UAAM,WAAW;AACjB,QAAI,SAAS,UAAU;AACrB,aAAO,GAAG,mBAAmB;AAAA,IAC/B;AACA,WAAO,GAAG,mBAAmB;AAAA,EAC/B;AAGA,MAAI,SAAS,SAAS,eAAe;AACnC,UAAM,YAAY;AAMlB,UAAM,aAAa,UAAU,UAAU;AAEvC,YAAQ,UAAU,UAAU;AAAA;AA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