@palantir/pack.document-schema.type-gen 0.7.0 → 0.8.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 (106) hide show
  1. package/build/esm/cli.js +2 -0
  2. package/build/esm/cli.js.map +1 -1
  3. package/build/esm/commands/asset/assetDeployHandler.js +60 -0
  4. package/build/esm/commands/asset/assetDeployHandler.js.map +1 -0
  5. package/build/esm/commands/asset/registerAssetCommands.js +22 -0
  6. package/build/esm/commands/asset/registerAssetCommands.js.map +1 -0
  7. package/build/esm/commands/ir/irDeployHandler.js +5 -4
  8. package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
  9. package/build/esm/commands/ir/irGenAssetHandler.js +19 -13
  10. package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
  11. package/build/esm/commands/steps/stepsGenIrHandler.js +6 -1
  12. package/build/esm/commands/steps/stepsGenIrHandler.js.map +1 -1
  13. package/build/esm/commands/types.js +2 -0
  14. package/build/esm/commands/types.js.map +1 -0
  15. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldDef.js.map +1 -1
  16. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.js.map +1 -1
  17. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.js.map +1 -1
  18. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.js.map +1 -1
  19. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/recordDef.js.map +1 -1
  20. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.js.map +1 -1
  21. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/unionDef.js.map +1 -1
  22. package/build/esm/utils/generatedFileHeader.js +1 -0
  23. package/build/esm/utils/generatedFileHeader.js.map +1 -1
  24. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
  25. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
  26. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
  27. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
  28. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
  29. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
  30. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
  31. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
  32. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
  33. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
  34. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
  35. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
  36. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
  37. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
  38. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
  39. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
  40. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
  41. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
  42. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
  43. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
  44. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
  45. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
  46. package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js +335 -0
  47. package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js.map +1 -0
  48. package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js +49 -49
  49. package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js.map +1 -1
  50. package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js +83 -83
  51. package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js.map +1 -1
  52. package/build/esm/utils/ir/convertIrToWireSchema.js +199 -0
  53. package/build/esm/utils/ir/convertIrToWireSchema.js.map +1 -0
  54. package/build/esm/utils/ir/generateModelsFromIr.js +2 -2
  55. package/build/esm/utils/ir/generateModelsFromIr.js.map +1 -1
  56. package/build/esm/utils/ir/generateZodSchemasFromIr.js +1 -1
  57. package/build/esm/utils/ir/generateZodSchemasFromIr.js.map +1 -1
  58. package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
  59. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
  60. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
  61. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
  62. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
  63. package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
  64. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
  65. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
  66. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
  67. package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js +81 -8
  68. package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js.map +1 -1
  69. package/build/esm/utils/steps/convertStepsToIr.js +8 -10
  70. package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
  71. package/build/esm/utils/steps/parseMigrationSteps.js +4 -2
  72. package/build/esm/utils/steps/parseMigrationSteps.js.map +1 -1
  73. package/build/types/cli.d.ts.map +1 -1
  74. package/build/types/commands/asset/assetDeployHandler.d.ts +10 -0
  75. package/build/types/commands/asset/assetDeployHandler.d.ts.map +1 -0
  76. package/build/types/commands/asset/registerAssetCommands.d.ts +3 -0
  77. package/build/types/commands/asset/registerAssetCommands.d.ts.map +1 -0
  78. package/build/types/commands/ir/irDeployHandler.d.ts +1 -1
  79. package/build/types/commands/ir/irDeployHandler.d.ts.map +1 -1
  80. package/build/types/commands/ir/irGenAssetHandler.d.ts +1 -1
  81. package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
  82. package/build/types/commands/steps/stepsGenIrHandler.d.ts.map +1 -1
  83. package/build/types/commands/types.d.ts +12 -0
  84. package/build/types/commands/types.d.ts.map +1 -0
  85. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldDef.d.ts +2 -2
  86. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldDef.d.ts.map +1 -1
  87. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.d.ts +1 -0
  88. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.d.ts.map +1 -1
  89. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.d.ts +1 -0
  90. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.d.ts.map +1 -1
  91. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.d.ts +3 -0
  92. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.d.ts.map +1 -1
  93. package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts +1 -1
  94. package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts.map +1 -1
  95. package/build/types/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.d.ts +2 -2
  96. package/build/types/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.d.ts.map +1 -1
  97. package/build/types/lib/pack-docschema-api/pack-docschema-ir/unionDef.d.ts +1 -1
  98. package/build/types/lib/pack-docschema-api/pack-docschema-ir/unionDef.d.ts.map +1 -1
  99. package/build/types/utils/generatedFileHeader.d.ts +1 -0
  100. package/build/types/utils/generatedFileHeader.d.ts.map +1 -1
  101. package/build/types/utils/ir/__tests__/convertIrToWireSchema.test.d.ts +2 -0
  102. package/build/types/utils/ir/__tests__/convertIrToWireSchema.test.d.ts.map +1 -0
  103. package/build/types/utils/ir/convertIrToWireSchema.d.ts +17 -0
  104. package/build/types/utils/ir/convertIrToWireSchema.d.ts.map +1 -0
  105. package/build/types/utils/steps/parseMigrationSteps.d.ts.map +1 -1
  106. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"custom-discriminant.js","names":["z","CatSchema","object","meow","string","DogSchema","bark","AnimalCatSchema","extend","kind","literal","AnimalDogSchema","AnimalSchema","discriminatedUnion"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */\n\nimport { z } from 'zod';\n\nexport const CatSchema = z.object({\n meow: z.string(),\n});\n\nexport const DogSchema = z.object({\n bark: z.string(),\n});\n\nexport const AnimalCatSchema = CatSchema.extend({\n kind: z.literal('cat'),\n});\n\nexport const AnimalDogSchema = DogSchema.extend({\n kind: z.literal('dog'),\n});\n\nexport const AnimalSchema = z.discriminatedUnion('kind', [\n AnimalCatSchema,\n AnimalDogSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,IAAI,EAAEN,CAAC,CAACI,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMG,eAAe,GAAGN,SAAS,CAACO,MAAM,CAAC;EAC9CC,IAAI,EAAET,CAAC,CAACU,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGN,SAAS,CAACG,MAAM,CAAC;EAC9CC,IAAI,EAAET,CAAC,CAACU,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGZ,CAAC,CAACa,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"custom-discriminant.js","names":["z","CatSchema","object","meow","string","DogSchema","bark","AnimalCatSchema","extend","kind","literal","AnimalDogSchema","AnimalSchema","discriminatedUnion"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport { z } from 'zod';\n\nexport const CatSchema = z.object({\n meow: z.string(),\n});\n\nexport const DogSchema = z.object({\n bark: z.string(),\n});\n\nexport const AnimalCatSchema = CatSchema.extend({\n kind: z.literal('cat'),\n});\n\nexport const AnimalDogSchema = DogSchema.extend({\n kind: z.literal('dog'),\n});\n\nexport const AnimalSchema = z.discriminatedUnion('kind', [\n AnimalCatSchema,\n AnimalDogSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,IAAI,EAAEN,CAAC,CAACI,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMG,eAAe,GAAGN,SAAS,CAACO,MAAM,CAAC;EAC9CC,IAAI,EAAET,CAAC,CAACU,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGN,SAAS,CAACG,MAAM,CAAC;EAC9CC,IAAI,EAAET,CAAC,CAACU,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGZ,CAAC,CAACa,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const EventSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */\n\nimport { z } from 'zod';\n\nexport const EventSchema = z.object({\n timestamp: z.string().datetime(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,WAAW,GAAGD,CAAC,CAACE,MAAM,CAAC;EAClCC,SAAS,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACjC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport { z } from 'zod';\n\nexport const EventSchema = z.object({\n timestamp: z.string().datetime(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,WAAW,GAAGD,CAAC,CAACE,MAAM,CAAC;EAClCC,SAAS,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACjC,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const PersonSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"simple-records.js","names":["z","PersonSchema","object","name","string","min","max","age","number","int","email","optional"],"sources":["simple-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */\n\nimport { z } from 'zod';\n\nexport const PersonSchema = z.object({\n name: z.string().min(2).max(50),\n age: z.number().int().min(0).max(150),\n email: z.string().optional(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,YAAY,GAAGD,CAAC,CAACE,MAAM,CAAC;EACnCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,EAAE,CAAC;EAC/BC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACJ,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC;EACrCI,KAAK,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;AAC7B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"simple-records.js","names":["z","PersonSchema","object","name","string","min","max","age","number","int","email","optional"],"sources":["simple-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport { z } from 'zod';\n\nexport const PersonSchema = z.object({\n name: z.string().min(2).max(50),\n age: z.number().int().min(0).max(150),\n email: z.string().optional(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,YAAY,GAAGD,CAAC,CAACE,MAAM,CAAC;EACnCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,EAAE,CAAC;EAC/BC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACJ,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC;EACrCI,KAAK,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;AAC7B,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const FooSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"union-before-records.js","names":["z","FooSchema","object","value","string","BarSchema","count","number","int","FooBarFooSchema","extend","type","literal","FooBarBarSchema","FooBarSchema","discriminatedUnion"],"sources":["union-before-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */\n\nimport { z } from 'zod';\n\nexport const FooSchema = z.object({\n value: z.string(),\n});\n\nexport const BarSchema = z.object({\n count: z.number().int(),\n});\n\nexport const FooBarFooSchema = FooSchema.extend({\n type: z.literal('foo'),\n});\n\nexport const FooBarBarSchema = BarSchema.extend({\n type: z.literal('bar'),\n});\n\nexport const FooBarSchema = z.discriminatedUnion('type', [\n FooBarFooSchema,\n FooBarBarSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACS,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACK,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGd,CAAC,CAACe,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"union-before-records.js","names":["z","FooSchema","object","value","string","BarSchema","count","number","int","FooBarFooSchema","extend","type","literal","FooBarBarSchema","FooBarSchema","discriminatedUnion"],"sources":["union-before-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport { z } from 'zod';\n\nexport const FooSchema = z.object({\n value: z.string(),\n});\n\nexport const BarSchema = z.object({\n count: z.number().int(),\n});\n\nexport const FooBarFooSchema = FooSchema.extend({\n type: z.literal('foo'),\n});\n\nexport const FooBarBarSchema = BarSchema.extend({\n type: z.literal('bar'),\n});\n\nexport const FooBarSchema = z.discriminatedUnion('type', [\n FooBarFooSchema,\n FooBarBarSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACS,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACK,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGd,CAAC,CAACe,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const ObjectNodeSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"union-types.js","names":["z","ObjectNodeSchema","object","x","number","y","label","string","optional","TextBoxSchema","text","NodeObjectSchema","extend","type","literal","NodeTextBoxSchema","NodeSchema","discriminatedUnion"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.7.0 */\n\nimport { z } from 'zod';\n\nexport const ObjectNodeSchema = z.object({\n x: z.number(),\n y: z.number(),\n label: z.string().optional(),\n});\n\nexport const TextBoxSchema = z.object({\n x: z.number(),\n y: z.number(),\n text: z.string(),\n});\n\nexport const NodeObjectSchema = ObjectNodeSchema.extend({\n type: z.literal('object'),\n});\n\nexport const NodeTextBoxSchema = TextBoxSchema.extend({\n type: z.literal('text-box'),\n});\n\nexport const NodeSchema = z.discriminatedUnion('type', [\n NodeObjectSchema,\n NodeTextBoxSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,gBAAgB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbE,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAEF,OAAO,MAAMC,aAAa,GAAGT,CAAC,CAACE,MAAM,CAAC;EACpCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbM,IAAI,EAAEV,CAAC,CAACO,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMI,gBAAgB,GAAGV,gBAAgB,CAACW,MAAM,CAAC;EACtDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,QAAQ;AAC1B,CAAC,CAAC;AAEF,OAAO,MAAMC,iBAAiB,GAAGN,aAAa,CAACG,MAAM,CAAC;EACpDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,UAAU;AAC5B,CAAC,CAAC;AAEF,OAAO,MAAME,UAAU,GAAGhB,CAAC,CAACiB,kBAAkB,CAAC,MAAM,EAAE,CACrDN,gBAAgB,EAChBI,iBAAiB,CAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"union-types.js","names":["z","ObjectNodeSchema","object","x","number","y","label","string","optional","TextBoxSchema","text","NodeObjectSchema","extend","type","literal","NodeTextBoxSchema","NodeSchema","discriminatedUnion"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport { z } from 'zod';\n\nexport const ObjectNodeSchema = z.object({\n x: z.number(),\n y: z.number(),\n label: z.string().optional(),\n});\n\nexport const TextBoxSchema = z.object({\n x: z.number(),\n y: z.number(),\n text: z.string(),\n});\n\nexport const NodeObjectSchema = ObjectNodeSchema.extend({\n type: z.literal('object'),\n});\n\nexport const NodeTextBoxSchema = TextBoxSchema.extend({\n type: z.literal('text-box'),\n});\n\nexport const NodeSchema = z.discriminatedUnion('type', [\n NodeObjectSchema,\n NodeTextBoxSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,gBAAgB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbE,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAEF,OAAO,MAAMC,aAAa,GAAGT,CAAC,CAACE,MAAM,CAAC;EACpCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbM,IAAI,EAAEV,CAAC,CAACO,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMI,gBAAgB,GAAGV,gBAAgB,CAACW,MAAM,CAAC;EACtDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,QAAQ;AAC1B,CAAC,CAAC;AAEF,OAAO,MAAMC,iBAAiB,GAAGN,aAAa,CAACG,MAAM,CAAC;EACpDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,UAAU;AAC5B,CAAC,CAAC;AAEF,OAAO,MAAME,UAAU,GAAGhB,CAAC,CAACiB,kBAAkB,CAAC,MAAM,EAAE,CACrDN,gBAAgB,EAChBI,iBAAiB,CAClB,CAAC","ignoreList":[]}
@@ -0,0 +1,335 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { describe, expect, it } from "vitest";
18
+ import { IFieldValueUnion } from "../../../lib/pack-docschema-api/pack-docschema-ir/index.js";
19
+ import { convertIrToWireSchema } from "../convertIrToWireSchema.js";
20
+ describe("convertIrToWireSchema", () => {
21
+ it("should flatten record model and rename fields correctly", () => {
22
+ const record = {
23
+ key: "Person",
24
+ name: "Person",
25
+ description: "A person",
26
+ fields: [{
27
+ key: "name",
28
+ name: "Name",
29
+ fieldType: {
30
+ type: "value",
31
+ value: IFieldValueUnion.string({})
32
+ },
33
+ metadata: {
34
+ addedInVersion: 1
35
+ }
36
+ }],
37
+ metadata: {
38
+ addedInVersion: 1
39
+ }
40
+ };
41
+ const wire = convertIrToWireSchema({
42
+ name: "Test",
43
+ description: "Test schema",
44
+ version: 1,
45
+ primaryModelKeys: ["Person"],
46
+ models: {
47
+ Person: {
48
+ type: "record",
49
+ record
50
+ }
51
+ }
52
+ });
53
+
54
+ // Top-level structure
55
+ expect(wire.primaryModelKeys).toEqual(["Person"]);
56
+ expect(wire.models).toBeDefined();
57
+
58
+ // Model is flattened (no .record wrapper)
59
+ const personModel = wire.models["Person"];
60
+ expect(personModel).toBeDefined();
61
+ expect(personModel.type).toBe("record");
62
+ const person = personModel;
63
+ expect(person.key).toBe("Person");
64
+ expect(person.name).toBe("Person");
65
+ expect("record" in person).toBe(false); // no conjure nesting
66
+
67
+ // Field uses wire field names
68
+ const nameField = person.fields[0];
69
+ expect(nameField.key).toBe("name");
70
+ expect(nameField.fieldType).toBeDefined();
71
+ expect(nameField.metadata).toEqual({
72
+ addedInVersion: 1
73
+ });
74
+ });
75
+ it("should flatten union model", () => {
76
+ const wire = convertIrToWireSchema({
77
+ name: "Test",
78
+ description: "Test",
79
+ version: 1,
80
+ primaryModelKeys: ["Shape"],
81
+ models: {
82
+ Shape: {
83
+ type: "union",
84
+ union: {
85
+ key: "Shape",
86
+ discriminant: "shapeType",
87
+ name: "Shape",
88
+ variants: {
89
+ circle: "Circle",
90
+ square: "Square"
91
+ },
92
+ metadata: {
93
+ addedInVersion: 1
94
+ }
95
+ }
96
+ }
97
+ }
98
+ });
99
+ const shapeModel = wire.models["Shape"];
100
+ expect(shapeModel).toBeDefined();
101
+ expect(shapeModel.type).toBe("union");
102
+ const shape = shapeModel;
103
+ expect(shape.key).toBe("Shape");
104
+ expect(shape.discriminant).toBe("shapeType");
105
+ expect(shape.variants).toEqual({
106
+ circle: "Circle",
107
+ square: "Square"
108
+ });
109
+ expect("union" in shape).toBe(false); // no conjure nesting
110
+ });
111
+ it("should convert value field type with FieldValueType wrapper", () => {
112
+ const record = {
113
+ key: "R",
114
+ name: "R",
115
+ fields: [{
116
+ key: "f",
117
+ name: "f",
118
+ fieldType: {
119
+ type: "value",
120
+ value: IFieldValueUnion.string({
121
+ defaultValue: "abc"
122
+ })
123
+ },
124
+ metadata: {
125
+ addedInVersion: 1
126
+ }
127
+ }],
128
+ metadata: {
129
+ addedInVersion: 1
130
+ }
131
+ };
132
+ const wire = convertIrToWireSchema({
133
+ name: "Test",
134
+ description: "Test",
135
+ version: 1,
136
+ primaryModelKeys: ["R"],
137
+ models: {
138
+ R: {
139
+ type: "record",
140
+ record
141
+ }
142
+ }
143
+ });
144
+ expect(wire.models["R"]).toBeDefined();
145
+ expect(wire.models["R"].type).toBe("record");
146
+ const recordModel = wire.models["R"];
147
+ const field = recordModel.fields[0];
148
+
149
+ // Wire format wraps in { valueType: { type: "string", defaultValue: "abc" } }
150
+ expect(field.fieldType).toEqual({
151
+ type: "value",
152
+ valueType: {
153
+ type: "string",
154
+ defaultValue: "abc"
155
+ }
156
+ });
157
+ });
158
+ it("should convert array field type with FieldValueType wrapper on elements", () => {
159
+ const record = {
160
+ key: "R",
161
+ name: "R",
162
+ fields: [{
163
+ key: "tags",
164
+ name: "Tags",
165
+ fieldType: {
166
+ type: "array",
167
+ array: {
168
+ allowNullValue: false,
169
+ value: IFieldValueUnion.string({})
170
+ }
171
+ },
172
+ metadata: {
173
+ addedInVersion: 1
174
+ }
175
+ }],
176
+ metadata: {
177
+ addedInVersion: 1
178
+ }
179
+ };
180
+ const wire = convertIrToWireSchema({
181
+ name: "Test",
182
+ description: "Test",
183
+ version: 1,
184
+ primaryModelKeys: ["R"],
185
+ models: {
186
+ R: {
187
+ type: "record",
188
+ record
189
+ }
190
+ }
191
+ });
192
+ expect(wire.models["R"]).toBeDefined();
193
+ expect(wire.models["R"].type).toBe("record");
194
+ const recordModel = wire.models["R"];
195
+ const field = recordModel.fields[0];
196
+ expect(field.fieldType).toEqual({
197
+ type: "array",
198
+ allowNullValue: false,
199
+ value: {
200
+ valueType: {
201
+ type: "string"
202
+ }
203
+ }
204
+ });
205
+ });
206
+ it("should flatten all field value union variants", () => {
207
+ const variants = [{
208
+ fn: IFieldValueUnion.boolean,
209
+ type: "boolean",
210
+ payload: {}
211
+ }, {
212
+ fn: IFieldValueUnion.datetime,
213
+ type: "datetime",
214
+ payload: {}
215
+ }, {
216
+ fn: IFieldValueUnion.docRef,
217
+ type: "docRef",
218
+ payload: {
219
+ documentTypeRids: ["rid1"]
220
+ }
221
+ }, {
222
+ fn: IFieldValueUnion.double,
223
+ type: "double",
224
+ payload: {
225
+ minValue: 0,
226
+ maxValue: 100
227
+ }
228
+ }, {
229
+ fn: IFieldValueUnion.integer,
230
+ type: "integer",
231
+ payload: {
232
+ defaultValue: 42
233
+ }
234
+ }, {
235
+ fn: IFieldValueUnion.mediaRef,
236
+ type: "mediaRef",
237
+ payload: {}
238
+ }, {
239
+ fn: IFieldValueUnion.modelRef,
240
+ type: "modelRef",
241
+ payload: {
242
+ modelTypes: ["Foo"]
243
+ }
244
+ }, {
245
+ fn: IFieldValueUnion.object,
246
+ type: "object",
247
+ payload: {
248
+ interfaceTypeRids: [],
249
+ objectTypeRids: ["rid2"]
250
+ }
251
+ }, {
252
+ fn: IFieldValueUnion.string,
253
+ type: "string",
254
+ payload: {
255
+ maxLength: 255
256
+ }
257
+ }, {
258
+ fn: IFieldValueUnion.text,
259
+ type: "text",
260
+ payload: {}
261
+ }, {
262
+ fn: IFieldValueUnion.unmanagedJson,
263
+ type: "unmanagedJson",
264
+ payload: {}
265
+ }, {
266
+ fn: IFieldValueUnion.userRef,
267
+ type: "userRef",
268
+ payload: {}
269
+ }];
270
+ for (const {
271
+ fn,
272
+ type,
273
+ payload
274
+ } of variants) {
275
+ const record = {
276
+ key: "R",
277
+ name: "R",
278
+ fields: [{
279
+ key: "f",
280
+ name: "f",
281
+ fieldType: {
282
+ type: "value",
283
+ value: fn(payload)
284
+ },
285
+ metadata: {
286
+ addedInVersion: 1
287
+ }
288
+ }],
289
+ metadata: {
290
+ addedInVersion: 1
291
+ }
292
+ };
293
+ const wire = convertIrToWireSchema({
294
+ name: "Test",
295
+ description: "Test",
296
+ version: 1,
297
+ primaryModelKeys: ["R"],
298
+ models: {
299
+ R: {
300
+ type: "record",
301
+ record
302
+ }
303
+ }
304
+ });
305
+ expect(wire.models["R"]).toBeDefined();
306
+ expect(wire.models["R"].type).toBe("record");
307
+ const recordModel = wire.models["R"];
308
+ const fieldType = recordModel.fields[0].fieldType;
309
+ expect(fieldType.type).toBe("value");
310
+ const wireValue = fieldType.valueType;
311
+ expect(wireValue.type).toBe(type);
312
+ // no conjure nesting key
313
+ expect(wireValue[type]).toBeUndefined();
314
+ // Payload fields should be at top level
315
+ for (const [key, val] of Object.entries(payload)) {
316
+ expect(wireValue[key]).toEqual(val);
317
+ }
318
+ }
319
+ });
320
+ it("should strip name, description, version from output", () => {
321
+ const wire = convertIrToWireSchema({
322
+ name: "My Schema",
323
+ description: "My description",
324
+ version: 5,
325
+ primaryModelKeys: [],
326
+ models: {}
327
+ });
328
+ expect("name" in wire).toBe(false);
329
+ expect("description" in wire).toBe(false);
330
+ expect("version" in wire).toBe(false);
331
+ expect(wire.primaryModelKeys).toEqual([]);
332
+ expect(wire.models).toEqual({});
333
+ });
334
+ });
335
+ //# sourceMappingURL=convertIrToWireSchema.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertIrToWireSchema.test.js","names":["describe","expect","it","IFieldValueUnion","convertIrToWireSchema","record","key","name","description","fields","fieldType","type","value","string","metadata","addedInVersion","wire","version","primaryModelKeys","models","Person","toEqual","toBeDefined","personModel","toBe","person","nameField","Shape","union","discriminant","variants","circle","square","shapeModel","shape","defaultValue","R","recordModel","field","valueType","array","allowNullValue","fn","boolean","payload","datetime","docRef","documentTypeRids","double","minValue","maxValue","integer","mediaRef","modelRef","modelTypes","object","interfaceTypeRids","objectTypeRids","maxLength","text","unmanagedJson","userRef","wireValue","toBeUndefined","val","Object","entries"],"sources":["convertIrToWireSchema.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { FieldValueType, RecordDef, UnionDef } from \"@osdk/foundry.pack\";\nimport { describe, expect, it } from \"vitest\";\nimport type {\n IModelDef,\n IRealTimeDocumentSchema,\n IRecordDef,\n IUnionDef,\n} from \"../../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { IFieldValueUnion } from \"../../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { convertIrToWireSchema } from \"../convertIrToWireSchema.js\";\n\ndescribe(\"convertIrToWireSchema\", () => {\n it(\"should flatten record model and rename fields correctly\", () => {\n const record: IRecordDef = {\n key: \"Person\",\n name: \"Person\",\n description: \"A person\",\n fields: [\n {\n key: \"name\",\n name: \"Name\",\n fieldType: {\n type: \"value\",\n value: IFieldValueUnion.string({}),\n },\n metadata: { addedInVersion: 1 },\n },\n ],\n metadata: { addedInVersion: 1 },\n };\n\n const ir: IRealTimeDocumentSchema = {\n name: \"Test\",\n description: \"Test schema\",\n version: 1,\n primaryModelKeys: [\"Person\"],\n models: {\n Person: { type: \"record\", record } as IModelDef,\n },\n };\n\n const wire = convertIrToWireSchema(ir);\n\n // Top-level structure\n expect(wire.primaryModelKeys).toEqual([\"Person\"]);\n expect(wire.models).toBeDefined();\n\n // Model is flattened (no .record wrapper)\n const personModel = wire.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel!.type).toBe(\"record\");\n const person = personModel as { type: \"record\" } & RecordDef;\n expect(person.key).toBe(\"Person\");\n expect(person.name).toBe(\"Person\");\n expect(\"record\" in person).toBe(false); // no conjure nesting\n\n // Field uses wire field names\n const nameField = person.fields[0]!;\n expect(nameField.key).toBe(\"name\");\n expect(nameField.fieldType).toBeDefined();\n expect(nameField.metadata).toEqual({ addedInVersion: 1 });\n });\n\n it(\"should flatten union model\", () => {\n const union: IUnionDef = {\n key: \"Shape\",\n discriminant: \"shapeType\",\n name: \"Shape\",\n variants: { circle: \"Circle\", square: \"Square\" },\n metadata: { addedInVersion: 1 },\n };\n\n const ir: IRealTimeDocumentSchema = {\n name: \"Test\",\n description: \"Test\",\n version: 1,\n primaryModelKeys: [\"Shape\"],\n models: {\n Shape: { type: \"union\", union } as IModelDef,\n },\n };\n\n const wire = convertIrToWireSchema(ir);\n const shapeModel = wire.models[\"Shape\"];\n expect(shapeModel).toBeDefined();\n expect(shapeModel!.type).toBe(\"union\");\n const shape = shapeModel as { type: \"union\" } & UnionDef;\n\n expect(shape.key).toBe(\"Shape\");\n expect(shape.discriminant).toBe(\"shapeType\");\n expect(shape.variants).toEqual({ circle: \"Circle\", square: \"Square\" });\n expect(\"union\" in shape).toBe(false); // no conjure nesting\n });\n\n it(\"should convert value field type with FieldValueType wrapper\", () => {\n const record: IRecordDef = {\n key: \"R\",\n name: \"R\",\n fields: [\n {\n key: \"f\",\n name: \"f\",\n fieldType: {\n type: \"value\",\n value: IFieldValueUnion.string({ defaultValue: \"abc\" }),\n },\n metadata: { addedInVersion: 1 },\n },\n ],\n metadata: { addedInVersion: 1 },\n };\n\n const ir: IRealTimeDocumentSchema = {\n name: \"Test\",\n description: \"Test\",\n version: 1,\n primaryModelKeys: [\"R\"],\n models: { R: { type: \"record\", record } as IModelDef },\n };\n\n const wire = convertIrToWireSchema(ir);\n expect(wire.models[\"R\"]).toBeDefined();\n expect(wire.models[\"R\"]!.type).toBe(\"record\");\n const recordModel = wire.models[\"R\"] as { type: \"record\" } & RecordDef;\n const field = recordModel.fields[0]!;\n\n // Wire format wraps in { valueType: { type: \"string\", defaultValue: \"abc\" } }\n expect(field.fieldType).toEqual({\n type: \"value\",\n valueType: {\n type: \"string\",\n defaultValue: \"abc\",\n },\n });\n });\n\n it(\"should convert array field type with FieldValueType wrapper on elements\", () => {\n const record: IRecordDef = {\n key: \"R\",\n name: \"R\",\n fields: [\n {\n key: \"tags\",\n name: \"Tags\",\n fieldType: {\n type: \"array\",\n array: {\n allowNullValue: false,\n value: IFieldValueUnion.string({}),\n },\n },\n metadata: { addedInVersion: 1 },\n },\n ],\n metadata: { addedInVersion: 1 },\n };\n\n const ir: IRealTimeDocumentSchema = {\n name: \"Test\",\n description: \"Test\",\n version: 1,\n primaryModelKeys: [\"R\"],\n models: { R: { type: \"record\", record } as IModelDef },\n };\n\n const wire = convertIrToWireSchema(ir);\n expect(wire.models[\"R\"]).toBeDefined();\n expect(wire.models[\"R\"]!.type).toBe(\"record\");\n const recordModel = wire.models[\"R\"] as { type: \"record\" } & RecordDef;\n const field = recordModel.fields[0]!;\n\n expect(field.fieldType).toEqual({\n type: \"array\",\n allowNullValue: false,\n value: {\n valueType: {\n type: \"string\",\n },\n },\n });\n });\n\n it(\"should flatten all field value union variants\", () => {\n const variants: Array<{\n fn: (payload: never) => IFieldValueUnion;\n type: string;\n payload: Record<string, unknown>;\n }> = [\n { fn: IFieldValueUnion.boolean, type: \"boolean\", payload: {} },\n { fn: IFieldValueUnion.datetime, type: \"datetime\", payload: {} },\n { fn: IFieldValueUnion.docRef, type: \"docRef\", payload: { documentTypeRids: [\"rid1\"] } },\n { fn: IFieldValueUnion.double, type: \"double\", payload: { minValue: 0, maxValue: 100 } },\n { fn: IFieldValueUnion.integer, type: \"integer\", payload: { defaultValue: 42 } },\n { fn: IFieldValueUnion.mediaRef, type: \"mediaRef\", payload: {} },\n { fn: IFieldValueUnion.modelRef, type: \"modelRef\", payload: { modelTypes: [\"Foo\"] } },\n {\n fn: IFieldValueUnion.object,\n type: \"object\",\n payload: { interfaceTypeRids: [], objectTypeRids: [\"rid2\"] },\n },\n { fn: IFieldValueUnion.string, type: \"string\", payload: { maxLength: 255 } },\n { fn: IFieldValueUnion.text, type: \"text\", payload: {} },\n { fn: IFieldValueUnion.unmanagedJson, type: \"unmanagedJson\", payload: {} },\n { fn: IFieldValueUnion.userRef, type: \"userRef\", payload: {} },\n ];\n\n for (const { fn, type, payload } of variants) {\n const record: IRecordDef = {\n key: \"R\",\n name: \"R\",\n fields: [\n {\n key: \"f\",\n name: \"f\",\n fieldType: {\n type: \"value\",\n value: fn(payload as never),\n },\n metadata: { addedInVersion: 1 },\n },\n ],\n metadata: { addedInVersion: 1 },\n };\n\n const ir: IRealTimeDocumentSchema = {\n name: \"Test\",\n description: \"Test\",\n version: 1,\n primaryModelKeys: [\"R\"],\n models: { R: { type: \"record\", record } as IModelDef },\n };\n\n const wire = convertIrToWireSchema(ir);\n expect(wire.models[\"R\"]).toBeDefined();\n expect(wire.models[\"R\"]!.type).toBe(\"record\");\n const recordModel = wire.models[\"R\"] as { type: \"record\" } & RecordDef;\n const fieldType = recordModel.fields[0]!.fieldType;\n expect(fieldType.type).toBe(\"value\");\n const wireValue = (fieldType as { type: \"value\" } & FieldValueType).valueType;\n expect(wireValue.type).toBe(type);\n // no conjure nesting key\n expect((wireValue as unknown as Record<string, unknown>)[type]).toBeUndefined();\n // Payload fields should be at top level\n for (const [key, val] of Object.entries(payload)) {\n expect((wireValue as unknown as Record<string, unknown>)[key]).toEqual(val);\n }\n }\n });\n\n it(\"should strip name, description, version from output\", () => {\n const ir: IRealTimeDocumentSchema = {\n name: \"My Schema\",\n description: \"My description\",\n version: 5,\n primaryModelKeys: [],\n models: {},\n };\n\n const wire = convertIrToWireSchema(ir);\n\n expect(\"name\" in wire).toBe(false);\n expect(\"description\" in wire).toBe(false);\n expect(\"version\" in wire).toBe(false);\n expect(wire.primaryModelKeys).toEqual([]);\n expect(wire.models).toEqual({});\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAO7C,SAASC,gBAAgB,QAAQ,4DAA4D;AAC7F,SAASC,qBAAqB,QAAQ,6BAA6B;AAEnEJ,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACtCE,EAAE,CAAC,yDAAyD,EAAE,MAAM;IAClE,MAAMG,MAAkB,GAAG;MACzBC,GAAG,EAAE,QAAQ;MACbC,IAAI,EAAE,QAAQ;MACdC,WAAW,EAAE,UAAU;MACvBC,MAAM,EAAE,CACN;QACEH,GAAG,EAAE,MAAM;QACXC,IAAI,EAAE,MAAM;QACZG,SAAS,EAAE;UACTC,IAAI,EAAE,OAAO;UACbC,KAAK,EAAET,gBAAgB,CAACU,MAAM,CAAC,CAAC,CAAC;QACnC,CAAC;QACDC,QAAQ,EAAE;UAAEC,cAAc,EAAE;QAAE;MAChC,CAAC,CACF;MACDD,QAAQ,EAAE;QAAEC,cAAc,EAAE;MAAE;IAChC,CAAC;IAYD,MAAMC,IAAI,GAAGZ,qBAAqB,CAVE;MAClCG,IAAI,EAAE,MAAM;MACZC,WAAW,EAAE,aAAa;MAC1BS,OAAO,EAAE,CAAC;MACVC,gBAAgB,EAAE,CAAC,QAAQ,CAAC;MAC5BC,MAAM,EAAE;QACNC,MAAM,EAAE;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