@palantir/pack.document-schema.type-gen 0.1.0 → 0.2.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 (84) hide show
  1. package/build/esm/commands/ir/irDeployHandler.js +3 -1
  2. package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
  3. package/build/esm/commands/schema/__tests__/schemaToYaml.integration.test.js +4 -2
  4. package/build/esm/commands/schema/__tests__/schemaToYaml.integration.test.js.map +1 -1
  5. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.js +2 -0
  6. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.js.map +1 -0
  7. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.js +14 -0
  8. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.js.map +1 -1
  9. package/build/esm/utils/generatedFileHeader.js +40 -0
  10. package/build/esm/utils/generatedFileHeader.js.map +1 -0
  11. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +53 -0
  12. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -0
  13. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +2 -0
  14. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
  15. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +2 -0
  16. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
  17. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +5 -0
  18. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
  19. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +2 -0
  20. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
  21. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +9 -0
  22. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -0
  23. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +17 -0
  24. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -0
  25. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +2 -0
  26. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
  27. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +2 -0
  28. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
  29. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +2 -0
  30. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
  31. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +2 -0
  32. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
  33. package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js +84 -0
  34. package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js.map +1 -1
  35. package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js +153 -0
  36. package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js.map +1 -1
  37. package/build/esm/utils/ir/generateModelsFromIr.js +17 -11
  38. package/build/esm/utils/ir/generateModelsFromIr.js.map +1 -1
  39. package/build/esm/utils/ir/generateZodSchemasFromIr.js +4 -1
  40. package/build/esm/utils/ir/generateZodSchemasFromIr.js.map +1 -1
  41. package/build/esm/utils/schema/__tests__/convertSchemaToSteps.test.js +5 -2
  42. package/build/esm/utils/schema/__tests__/convertSchemaToSteps.test.js.map +1 -1
  43. package/build/esm/utils/schema/convertSchemaToSteps.js +10 -2
  44. package/build/esm/utils/schema/convertSchemaToSteps.js.map +1 -1
  45. package/build/esm/utils/schema/generateTypesFromSchema.js +6 -4
  46. package/build/esm/utils/schema/generateTypesFromSchema.js.map +1 -1
  47. package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/customDiscriminant.js +47 -0
  48. package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/customDiscriminant.js.map +1 -0
  49. package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/simpleSteps.js +3 -3
  50. package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/simpleSteps.js.map +1 -1
  51. package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
  52. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +17 -0
  53. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -0
  54. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
  55. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
  56. package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
  57. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
  58. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
  59. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
  60. package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js +4 -2
  61. package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js.map +1 -1
  62. package/build/esm/utils/steps/__tests__/fixtures/stepSchemas/customDiscriminant.js +47 -0
  63. package/build/esm/utils/steps/__tests__/fixtures/stepSchemas/customDiscriminant.js.map +1 -0
  64. package/build/esm/utils/steps/convertStepsToIr.js +3 -0
  65. package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
  66. package/build/esm/utils/steps/convertStepsToSchema.js +6 -7
  67. package/build/esm/utils/steps/convertStepsToSchema.js.map +1 -1
  68. package/build/esm/utils/steps/parseMigrationSteps.js +5 -5
  69. package/build/esm/utils/steps/parseMigrationSteps.js.map +1 -1
  70. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.d.ts +4 -0
  71. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.d.ts.map +1 -0
  72. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.d.ts +11 -1
  73. package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.d.ts.map +1 -1
  74. package/build/types/utils/generatedFileHeader.d.ts +2 -0
  75. package/build/types/utils/generatedFileHeader.d.ts.map +1 -0
  76. package/build/types/utils/ir/generateModelsFromIr.d.ts.map +1 -1
  77. package/build/types/utils/ir/generateZodSchemasFromIr.d.ts.map +1 -1
  78. package/build/types/utils/schema/convertSchemaToSteps.d.ts.map +1 -1
  79. package/build/types/utils/schema/generateTypesFromSchema.d.ts.map +1 -1
  80. package/build/types/utils/steps/convertStepsToIr.d.ts.map +1 -1
  81. package/build/types/utils/steps/parseMigrationSteps.d.ts +6 -2
  82. package/build/types/utils/steps/parseMigrationSteps.d.ts.map +1 -1
  83. package/package.json +12 -13
  84. package/bin/cli.ts +0 -6
@@ -36,7 +36,9 @@ export async function irDeployHandler(options) {
36
36
 
37
37
  // PACK BE does not yet support storing schemas...
38
38
  consola.warn("Creating document type without schema information", request);
39
- await DocumentTypes.create(osdkClient, request);
39
+ await DocumentTypes.create(osdkClient, request, {
40
+ preview: true
41
+ });
40
42
  } catch (error) {
41
43
  consola.error("❌ Error during Deploy:", error);
42
44
  throw new CommanderError(1, "ERRIRMDEPLOY", "Error deploying IR document schema");
@@ -1 +1 @@
1
- {"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","irDeployHandler","options","irPath","ir","info","irContent","JSON","parse","osdkClient","baseUrl","Promise","auth","request","name","parentFolderRid","parentFolder","warn","create","error"],"sources":["irDeployHandler.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 { createPlatformClient } from \"@osdk/client\";\nimport type { CreateDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport type { IRealTimeDocumentSchema } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\n\ninterface DeployOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly parentFolder: string;\n}\n\nexport async function irDeployHandler(options: DeployOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n\n consola.info(`Reading schema from: ${irPath}`);\n\n const irContent = readFileSync(irPath, \"utf8\");\n\n // TODO: conjureToZod based validation that IR content matches the conjure IR shape\n const ir = JSON.parse(irContent) as IRealTimeDocumentSchema;\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n );\n\n const request: CreateDocumentTypeRequest = {\n name: ir.name,\n parentFolderRid: options.parentFolder,\n };\n\n // PACK BE does not yet support storing schemas...\n consola.warn(\"Creating document type without schema information\", request);\n\n await DocumentTypes.create(osdkClient, request);\n } catch (error) {\n consola.error(\"❌ Error during Deploy:\", error);\n throw new CommanderError(1, \"ERRIRMDEPLOY\", \"Error deploying IR document schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,QAAQ,cAAc;AAEnD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAU9B,OAAO,eAAeC,eAAeA,CAACC,OAAsB,EAAiB;EAC3E,IAAI;IACF,MAAMC,MAAM,GAAGH,OAAO,CAACE,OAAO,CAACE,EAAE,CAAC;IAElCN,OAAO,CAACO,IAAI,CAAC,wBAAwBF,MAAM,EAAE,CAAC;IAE9C,MAAMG,SAAS,GAAGP,YAAY,CAACI,MAAM,EAAE,MAAM,CAAC;;IAE9C;IACA,MAAMC,EAAE,GAAGG,IAAI,CAACC,KAAK,CAACF,SAAS,CAA4B;IAE3D,MAAMG,UAAU,GAAGd,oBAAoB,CACrCO,OAAO,CAACQ,OAAO,EACf,MAAMC,OAAO,CAACX,OAAO,CAACE,OAAO,CAACU,IAAI,CACpC,CAAC;IAED,MAAMC,OAAkC,GAAG;MACzCC,IAAI,EAAEV,EAAE,CAACU,IAAI;MACbC,eAAe,EAAEb,OAAO,CAACc;IAC3B,CAAC;;IAED;IACAlB,OAAO,CAACmB,IAAI,CAAC,mDAAmD,EAAEJ,OAAO,CAAC;IAE1E,MAAMjB,aAAa,CAACsB,MAAM,CAACT,UAAU,EAAEI,OAAO,CAAC;EACjD,CAAC,CAAC,OAAOM,KAAK,EAAE;IACdrB,OAAO,CAACqB,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;IAC9C,MAAM,IAAItB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,oCAAoC,CAAC;EACnF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","irDeployHandler","options","irPath","ir","info","irContent","JSON","parse","osdkClient","baseUrl","Promise","auth","request","name","parentFolderRid","parentFolder","warn","create","preview","error"],"sources":["irDeployHandler.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 { createPlatformClient } from \"@osdk/client\";\nimport type { CreateDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport type { IRealTimeDocumentSchema } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\n\ninterface DeployOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly parentFolder: string;\n}\n\nexport async function irDeployHandler(options: DeployOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n\n consola.info(`Reading schema from: ${irPath}`);\n\n const irContent = readFileSync(irPath, \"utf8\");\n\n // TODO: conjureToZod based validation that IR content matches the conjure IR shape\n const ir = JSON.parse(irContent) as IRealTimeDocumentSchema;\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n );\n\n const request: CreateDocumentTypeRequest = {\n name: ir.name,\n parentFolderRid: options.parentFolder,\n };\n\n // PACK BE does not yet support storing schemas...\n consola.warn(\"Creating document type without schema information\", request);\n\n await DocumentTypes.create(osdkClient, request, { preview: true });\n } catch (error) {\n consola.error(\"❌ Error during Deploy:\", error);\n throw new CommanderError(1, \"ERRIRMDEPLOY\", \"Error deploying IR document schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,QAAQ,cAAc;AAEnD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAU9B,OAAO,eAAeC,eAAeA,CAACC,OAAsB,EAAiB;EAC3E,IAAI;IACF,MAAMC,MAAM,GAAGH,OAAO,CAACE,OAAO,CAACE,EAAE,CAAC;IAElCN,OAAO,CAACO,IAAI,CAAC,wBAAwBF,MAAM,EAAE,CAAC;IAE9C,MAAMG,SAAS,GAAGP,YAAY,CAACI,MAAM,EAAE,MAAM,CAAC;;IAE9C;IACA,MAAMC,EAAE,GAAGG,IAAI,CAACC,KAAK,CAACF,SAAS,CAA4B;IAE3D,MAAMG,UAAU,GAAGd,oBAAoB,CACrCO,OAAO,CAACQ,OAAO,EACf,MAAMC,OAAO,CAACX,OAAO,CAACE,OAAO,CAACU,IAAI,CACpC,CAAC;IAED,MAAMC,OAAkC,GAAG;MACzCC,IAAI,EAAEV,EAAE,CAACU,IAAI;MACbC,eAAe,EAAEb,OAAO,CAACc;IAC3B,CAAC;;IAED;IACAlB,OAAO,CAACmB,IAAI,CAAC,mDAAmD,EAAEJ,OAAO,CAAC;IAE1E,MAAMjB,aAAa,CAACsB,MAAM,CAACT,UAAU,EAAEI,OAAO,EAAE;MAAEM,OAAO,EAAE;IAAK,CAAC,CAAC;EACpE,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdtB,OAAO,CAACsB,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;IAC9C,MAAM,IAAIvB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,oCAAoC,CAAC;EACnF;AACF","ignoreList":[]}
@@ -93,8 +93,10 @@ describe("Schema to YAML Integration", () => {
93
93
  expect(unionStep).toBeDefined();
94
94
  expect(unionStep?.["add-union"]).toMatchObject({
95
95
  Node: {
96
- object: "ObjectNode",
97
- textBox: "TextBox"
96
+ variants: {
97
+ object: "ObjectNode",
98
+ textBox: "TextBox"
99
+ }
98
100
  }
99
101
  });
100
102
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schemaToYaml.integration.test.js","names":["P","describe","expect","it","yaml","convertSchemaToSteps","convertStepsToYamlString","schema","defineMigration","position","x","Double","y","ObjectNode","defineRecord","docs","fields","label","Optional","String","TextBox","text","Edge","source","target","Node","defineUnion","variants","object","textBox","steps","yamlString","parsedSteps","parse","toBeInstanceOf","Array","length","toBeGreaterThan","recordsStep","find","step","toBeDefined","toMatchObject","unionStep"],"sources":["schemaToYaml.integration.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 * as P from \"@palantir/pack.schema\";\nimport { describe, expect, it } from \"vitest\";\nimport yaml from \"yaml\";\nimport {\n convertSchemaToSteps,\n convertStepsToYamlString,\n} from \"../../../utils/schema/convertSchemaToSteps.js\";\n\ndescribe(\"Schema to YAML Integration\", () => {\n it(\"should convert schema to valid YAML format\", () => {\n const schema = P.defineMigration({}, () => {\n const position = {\n x: P.Double,\n y: P.Double,\n };\n\n const ObjectNode = P.defineRecord(\"ObjectNode\", {\n docs: \"A node in the graph\",\n fields: {\n ...position,\n label: P.Optional(P.String),\n },\n });\n\n const TextBox = P.defineRecord(\"TextBox\", {\n docs: \"A text box\",\n fields: {\n ...position,\n text: P.String,\n },\n });\n\n const Edge = P.defineRecord(\"Edge\", {\n docs: \"An edge between nodes\",\n fields: {\n source: () => ObjectNode,\n target: () => ObjectNode,\n },\n });\n\n const Node = P.defineUnion(\"Node\", {\n docs: \"Any node type\",\n variants: {\n object: ObjectNode,\n textBox: TextBox,\n },\n });\n\n return { ObjectNode, TextBox, Edge, Node };\n });\n\n const steps = convertSchemaToSteps(schema);\n const yamlString = convertStepsToYamlString(steps);\n const parsedSteps = yaml.parse(yamlString) as Array<Record<string, unknown>>;\n\n expect(parsedSteps).toBeInstanceOf(Array);\n expect(parsedSteps.length).toBeGreaterThan(0);\n\n const recordsStep = parsedSteps.find(step => \"add-records\" in step);\n expect(recordsStep).toBeDefined();\n expect(recordsStep?.[\"add-records\"]).toMatchObject({\n ObjectNode: {\n fields: {\n x: \"double\",\n y: \"double\",\n label: \"optional<string>\",\n },\n },\n TextBox: {\n fields: {\n x: \"double\",\n y: \"double\",\n text: \"string\",\n },\n },\n Edge: {\n fields: {\n source: \"ObjectNode\",\n target: \"ObjectNode\",\n },\n },\n });\n\n const unionStep = parsedSteps.find(step => \"add-union\" in step);\n expect(unionStep).toBeDefined();\n expect(unionStep?.[\"add-union\"]).toMatchObject({\n Node: {\n object: \"ObjectNode\",\n textBox: \"TextBox\",\n },\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,CAAC,MAAM,uBAAuB;AAC1C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,OAAOC,IAAI,MAAM,MAAM;AACvB,SACEC,oBAAoB,EACpBC,wBAAwB,QACnB,+CAA+C;AAEtDL,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CE,EAAE,CAAC,4CAA4C,EAAE,MAAM;IACrD,MAAMI,M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7B,MAAM,CAAC8B,WAAW,CAAC,CAACE,cAAc,CAACC,KAAK,CAAC;IACzCjC,MAAM,CAAC8B,WAAW,CAACI,MAAM,CAAC,CAACC,eAAe,CAAC,CAAC,CAAC;IAE7C,MAAMC,WAAW,GAAGN,WAAW,CAACO,IAAI,CAACC,IAAI,IAAI,aAAa,IAAIA,IAAI,CAAC;IACnEtC,MAAM,CAACoC,WAAW,CAAC,CAACG,WAAW,CAAC,CAAC;IACjCvC,MAAM,CAACoC,WAAW,GAAG,aAAa,CAAC,CAAC,CAACI,aAAa,CAAC;MACjD7B,UAAU,EAAE;QACVG,MAAM,EAAE;UACNN,CAAC,EAAE,QAAQ;UACXE,CAAC,EAAE,QAAQ;UACXK,KAAK,EAAE;QACT;MACF,CAAC;MACDG,OAAO,EAAE;QACPJ,MAAM,EAAE;UACNN,CAAC,EAAE,QAAQ;UACXE,CAAC,EAAE,QAAQ;UACXS,IAAI,EAAE;QACR;MACF,CAAC;MACDC,IAAI,EAAE;QACJN,MAAM,EAAE;UACNO,MAAM,EAAE,YAAY;UACpBC,MAAM,EAAE;QACV;MACF;IACF,CAAC,CAAC;IAEF,MAAMmB,SAAS,GAAGX,WAAW,CAACO,IAAI,CAACC,IAAI,IAAI,WAAW,IAAIA,IAAI,CAAC;IAC/DtC,MAAM,CAACyC,SAAS,CAAC,CAACF,WAAW,CAAC,CAAC;IAC/BvC,MAAM,CAACyC,SAAS,GAAG,WAAW,CAAC,CAAC,CAACD,aAAa,CAAC;MAC7CjB,IAAI,EAAE;QACJG,MAAM,EAAE,YAAY;QACpBC,OAAO,EAAE;MACX;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"schemaToYaml.integration.test.js","names":["P","describe","expect","it","yaml","convertSchemaToSteps","convertStepsToYamlString","schema","defineMigration","position","x","Double","y","ObjectNode","defineRecord","docs","fields","label","Optional","String","TextBox","text","Edge","source","target","Node","defineUnion","variants","object","textBox","steps","yamlString","parsedSteps","parse","toBeInstanceOf","Array","length","toBeGreaterThan","recordsStep","find","step","toBeDefined","toMatchObject","unionStep"],"sources":["schemaToYaml.integration.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 * as P from \"@palantir/pack.schema\";\nimport { describe, expect, it } from \"vitest\";\nimport yaml from \"yaml\";\nimport {\n convertSchemaToSteps,\n convertStepsToYamlString,\n} from \"../../../utils/schema/convertSchemaToSteps.js\";\n\ndescribe(\"Schema to YAML Integration\", () => {\n it(\"should convert schema to valid YAML format\", () => {\n const schema = P.defineMigration({}, () => {\n const position = {\n x: P.Double,\n y: P.Double,\n };\n\n const ObjectNode = P.defineRecord(\"ObjectNode\", {\n docs: \"A node in the graph\",\n fields: {\n ...position,\n label: P.Optional(P.String),\n },\n });\n\n const TextBox = P.defineRecord(\"TextBox\", {\n docs: \"A text box\",\n fields: {\n ...position,\n text: P.String,\n },\n });\n\n const Edge = P.defineRecord(\"Edge\", {\n docs: \"An edge between nodes\",\n fields: {\n source: () => ObjectNode,\n target: () => ObjectNode,\n },\n });\n\n const Node = P.defineUnion(\"Node\", {\n docs: \"Any node type\",\n variants: {\n object: ObjectNode,\n textBox: TextBox,\n },\n });\n\n return { ObjectNode, TextBox, Edge, Node };\n });\n\n const steps = convertSchemaToSteps(schema);\n const yamlString = convertStepsToYamlString(steps);\n const parsedSteps = yaml.parse(yamlString) as Array<Record<string, unknown>>;\n\n expect(parsedSteps).toBeInstanceOf(Array);\n expect(parsedSteps.length).toBeGreaterThan(0);\n\n const recordsStep = parsedSteps.find(step => \"add-records\" in step);\n expect(recordsStep).toBeDefined();\n expect(recordsStep?.[\"add-records\"]).toMatchObject({\n ObjectNode: {\n fields: {\n x: \"double\",\n y: \"double\",\n label: \"optional<string>\",\n },\n },\n TextBox: {\n fields: {\n x: \"double\",\n y: \"double\",\n text: \"string\",\n },\n },\n Edge: {\n fields: {\n source: \"ObjectNode\",\n target: \"ObjectNode\",\n },\n },\n });\n\n const unionStep = parsedSteps.find(step => \"add-union\" in step);\n expect(unionStep).toBeDefined();\n expect(unionStep?.[\"add-union\"]).toMatchObject({\n Node: {\n variants: {\n object: \"ObjectNode\",\n textBox: \"TextBox\",\n },\n },\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,CAAC,MAAM,uBAAuB;AAC1C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,OAAOC,IAAI,MAAM,MAAM;AACvB,SACEC,oBAAoB,EACpBC,wBAAwB,QACnB,+CAA+C;AAEtDL,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CE,EAAE,CAAC,4CAA4C,EAAE,MAAM;IACrD,MAAMI,MAAM,GAAGP,CAAC,CAACQ,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM;MACzC,MAAMC,QAAQ,GAAG;QACfC,CAAC,EAAEV,CAAC,CAACW,MAAM;QACXC,CAAC,EAAEZ,CAAC,CAACW;MACP,CAAC;MAED,MAAME,UAAU,GAAGb,CAAC,CAACc,YAAY,CAAC,YAAY,EAAE;QAC9CC,IAAI,EAAE,qBAAqB;QAC3BC,MAAM,EAAE;UACN,GAAGP,QAAQ;UACXQ,KAAK,EAAEjB,CAAC,CAACkB,QAAQ,CAAClB,CAAC,CAACmB,MAAM;QAC5B;MACF,CAAC,CAAC;MAEF,MAAMC,OAAO,GAAGpB,CAAC,CAACc,YAA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E,QAAQ;UACXK,KAAK,EAAE;QACT;MACF,CAAC;MACDG,OAAO,EAAE;QACPJ,MAAM,EAAE;UACNN,CAAC,EAAE,QAAQ;UACXE,CAAC,EAAE,QAAQ;UACXS,IAAI,EAAE;QACR;MACF,CAAC;MACDC,IAAI,EAAE;QACJN,MAAM,EAAE;UACNO,MAAM,EAAE,YAAY;UACpBC,MAAM,EAAE;QACV;MACF;IACF,CAAC,CAAC;IAEF,MAAMmB,SAAS,GAAGX,WAAW,CAACO,IAAI,CAACC,IAAI,IAAI,WAAW,IAAIA,IAAI,CAAC;IAC/DtC,MAAM,CAACyC,SAAS,CAAC,CAACF,WAAW,CAAC,CAAC;IAC/BvC,MAAM,CAACyC,SAAS,GAAG,WAAW,CAAC,CAAC,CAACD,aAAa,CAAC;MAC7CjB,IAAI,EAAE;QACJE,QAAQ,EAAE;UACRC,MAAM,EAAE,YAAY;UACpBC,OAAO,EAAE;QACX;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fieldValueBoolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldValueBoolean.js","names":[],"sources":["fieldValueBoolean.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\nexport interface IFieldValueBoolean {\n readonly \"defaultValue\"?: boolean | null;\n}\n"],"mappings":"","ignoreList":[]}
@@ -14,6 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ function isBoolean(obj) {
18
+ return obj.type === "boolean";
19
+ }
20
+ function boolean(obj) {
21
+ return {
22
+ boolean: obj,
23
+ type: "boolean"
24
+ };
25
+ }
17
26
  function isDatetime(obj) {
18
27
  return obj.type === "datetime";
19
28
  }
@@ -114,6 +123,9 @@ function userRef(obj) {
114
123
  };
115
124
  }
116
125
  function visit(obj, visitor) {
126
+ if (isBoolean(obj)) {
127
+ return visitor.boolean(obj.boolean);
128
+ }
117
129
  if (isDatetime(obj)) {
118
130
  return visitor.datetime(obj.datetime);
119
131
  }
@@ -150,6 +162,8 @@ function visit(obj, visitor) {
150
162
  return visitor.unknown(obj);
151
163
  }
152
164
  export const IFieldValueUnion = {
165
+ isBoolean: isBoolean,
166
+ boolean: boolean,
153
167
  isDatetime: isDatetime,
154
168
  datetime: datetime,
155
169
  isDocRef: isDocRef,
@@ -1 +1 @@
1
- {"version":3,"file":"fieldValueUnion.js","names":["isDatetime","obj","type","datetime","isDocRef","docRef","isDouble","double","isInteger","integer","isMediaRef","mediaRef","isModelRef","modelRef","isObject","object","isString","string","isText","text","isUnmanagedJson","unmanagedJson","isUserRef","userRef","visit","visitor","unknown","IFieldValueUnion"],"sources":["fieldValueUnion.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 { IFieldValueDatetime } from \"./fieldValueDatetime.js\";\nimport type { IFieldValueDocumentRef } from \"./fieldValueDocumentRef.js\";\nimport type { IFieldValueDouble } from \"./fieldValueDouble.js\";\nimport type { IFieldValueInteger } from \"./fieldValueInteger.js\";\nimport type { IFieldValueMediaRef } from \"./fieldValueMediaRef.js\";\nimport type { IFieldValueModelRef } from \"./fieldValueModelRef.js\";\nimport type { IFieldValueObjectRef } from \"./fieldValueObjectRef.js\";\nimport type { IFieldValueString } from \"./fieldValueString.js\";\nimport type { IFieldValueText } from \"./fieldValueText.js\";\nimport type { IFieldValueUnmanagedJson } from \"./fieldValueUnmanagedJson.js\";\nimport type { IFieldValueUserRef } from \"./fieldValueUserRef.js\";\n\nexport interface IFieldValueUnion_Datetime {\n readonly \"datetime\": IFieldValueDatetime;\n readonly \"type\": \"datetime\";\n}\n\nexport interface IFieldValueUnion_DocRef {\n readonly \"docRef\": IFieldValueDocumentRef;\n readonly \"type\": \"docRef\";\n}\n\nexport interface IFieldValueUnion_Double {\n readonly \"double\": IFieldValueDouble;\n readonly \"type\": \"double\";\n}\n\nexport interface IFieldValueUnion_Integer {\n readonly \"integer\": IFieldValueInteger;\n readonly \"type\": \"integer\";\n}\n\nexport interface IFieldValueUnion_MediaRef {\n readonly \"mediaRef\": IFieldValueMediaRef;\n readonly \"type\": \"mediaRef\";\n}\n\nexport interface IFieldValueUnion_ModelRef {\n readonly \"modelRef\": IFieldValueModelRef;\n readonly \"type\": \"modelRef\";\n}\n\nexport interface IFieldValueUnion_Object {\n readonly \"object\": IFieldValueObjectRef;\n readonly \"type\": \"object\";\n}\n\nexport interface IFieldValueUnion_String {\n readonly \"string\": IFieldValueString;\n readonly \"type\": \"string\";\n}\n\nexport interface IFieldValueUnion_Text {\n readonly \"text\": IFieldValueText;\n readonly \"type\": \"text\";\n}\n\nexport interface IFieldValueUnion_UnmanagedJson {\n readonly \"unmanagedJson\": IFieldValueUnmanagedJson;\n readonly \"type\": \"unmanagedJson\";\n}\n\nexport interface IFieldValueUnion_UserRef {\n readonly \"userRef\": IFieldValueUserRef;\n readonly \"type\": \"userRef\";\n}\n\nexport type IFieldValueUnion =\n | IFieldValueUnion_Datetime\n | IFieldValueUnion_DocRef\n | IFieldValueUnion_Double\n | IFieldValueUnion_Integer\n | IFieldValueUnion_MediaRef\n | IFieldValueUnion_ModelRef\n | IFieldValueUnion_Object\n | IFieldValueUnion_String\n | IFieldValueUnion_Text\n | IFieldValueUnion_UnmanagedJson\n | IFieldValueUnion_UserRef;\n\nexport interface IFieldValueUnionVisitor<T> {\n readonly \"datetime\": (obj: IFieldValueDatetime) => T;\n readonly \"docRef\": (obj: IFieldValueDocumentRef) => T;\n readonly \"double\": (obj: IFieldValueDouble) => T;\n readonly \"integer\": (obj: IFieldValueInteger) => T;\n readonly \"mediaRef\": (obj: IFieldValueMediaRef) => T;\n readonly \"modelRef\": (obj: IFieldValueModelRef) => T;\n readonly \"object\": (obj: IFieldValueObjectRef) => T;\n readonly \"string\": (obj: IFieldValueString) => T;\n readonly \"text\": (obj: IFieldValueText) => T;\n readonly \"unmanagedJson\": (obj: IFieldValueUnmanagedJson) => T;\n readonly \"userRef\": (obj: IFieldValueUserRef) => T;\n readonly \"unknown\": (obj: IFieldValueUnion) => T;\n}\n\nfunction isDatetime(obj: IFieldValueUnion): obj is IFieldValueUnion_Datetime {\n return (obj.type === \"datetime\");\n}\n\nfunction datetime(obj: IFieldValueDatetime): IFieldValueUnion_Datetime {\n return {\n datetime: obj,\n type: \"datetime\",\n };\n}\n\nfunction isDocRef(obj: IFieldValueUnion): obj is IFieldValueUnion_DocRef {\n return (obj.type === \"docRef\");\n}\n\nfunction docRef(obj: IFieldValueDocumentRef): IFieldValueUnion_DocRef {\n return {\n docRef: obj,\n type: \"docRef\",\n };\n}\n\nfunction isDouble(obj: IFieldValueUnion): obj is IFieldValueUnion_Double {\n return (obj.type === \"double\");\n}\n\nfunction double(obj: IFieldValueDouble): IFieldValueUnion_Double {\n return {\n double: obj,\n type: \"double\",\n };\n}\n\nfunction isInteger(obj: IFieldValueUnion): obj is IFieldValueUnion_Integer {\n return (obj.type === \"integer\");\n}\n\nfunction integer(obj: IFieldValueInteger): IFieldValueUnion_Integer {\n return {\n integer: obj,\n type: \"integer\",\n };\n}\n\nfunction isMediaRef(obj: IFieldValueUnion): obj is IFieldValueUnion_MediaRef {\n return (obj.type === \"mediaRef\");\n}\n\nfunction mediaRef(obj: IFieldValueMediaRef): IFieldValueUnion_MediaRef {\n return {\n mediaRef: obj,\n type: \"mediaRef\",\n };\n}\n\nfunction isModelRef(obj: IFieldValueUnion): obj is IFieldValueUnion_ModelRef {\n return (obj.type === \"modelRef\");\n}\n\nfunction modelRef(obj: IFieldValueModelRef): IFieldValueUnion_ModelRef {\n return {\n modelRef: obj,\n type: \"modelRef\",\n };\n}\n\nfunction isObject(obj: IFieldValueUnion): obj is IFieldValueUnion_Object {\n return (obj.type === \"object\");\n}\n\nfunction object(obj: IFieldValueObjectRef): IFieldValueUnion_Object {\n return {\n object: obj,\n type: \"object\",\n };\n}\n\nfunction isString(obj: IFieldValueUnion): obj is IFieldValueUnion_String {\n return (obj.type === \"string\");\n}\n\nfunction string(obj: IFieldValueString): IFieldValueUnion_String {\n return {\n string: obj,\n type: \"string\",\n };\n}\n\nfunction isText(obj: IFieldValueUnion): obj is IFieldValueUnion_Text {\n return (obj.type === \"text\");\n}\n\nfunction text(obj: IFieldValueText): IFieldValueUnion_Text {\n return {\n text: obj,\n type: \"text\",\n };\n}\n\nfunction isUnmanagedJson(obj: IFieldValueUnion): obj is IFieldValueUnion_UnmanagedJson {\n return (obj.type === \"unmanagedJson\");\n}\n\nfunction unmanagedJson(obj: IFieldValueUnmanagedJson): IFieldValueUnion_UnmanagedJson {\n return {\n unmanagedJson: obj,\n type: \"unmanagedJson\",\n };\n}\n\nfunction isUserRef(obj: IFieldValueUnion): obj is IFieldValueUnion_UserRef {\n return (obj.type === \"userRef\");\n}\n\nfunction userRef(obj: IFieldValueUserRef): IFieldValueUnion_UserRef {\n return {\n userRef: obj,\n type: \"userRef\",\n };\n}\n\nfunction visit<T>(obj: IFieldValueUnion, visitor: IFieldValueUnionVisitor<T>): T {\n if (isDatetime(obj)) {\n return visitor.datetime(obj.datetime);\n }\n if (isDocRef(obj)) {\n return visitor.docRef(obj.docRef);\n }\n if (isDouble(obj)) {\n return visitor.double(obj.double);\n }\n if (isInteger(obj)) {\n return visitor.integer(obj.integer);\n }\n if (isMediaRef(obj)) {\n return visitor.mediaRef(obj.mediaRef);\n }\n if (isModelRef(obj)) {\n return visitor.modelRef(obj.modelRef);\n }\n if (isObject(obj)) {\n return visitor.object(obj.object);\n }\n if (isString(obj)) {\n return visitor.string(obj.string);\n }\n if (isText(obj)) {\n return visitor.text(obj.text);\n }\n if (isUnmanagedJson(obj)) {\n return visitor.unmanagedJson(obj.unmanagedJson);\n }\n if (isUserRef(obj)) {\n return visitor.userRef(obj.userRef);\n }\n return visitor.unknown(obj);\n}\n\nexport const IFieldValueUnion: {\n isDatetime: typeof isDatetime;\n datetime: typeof datetime;\n isDocRef: typeof isDocRef;\n docRef: typeof docRef;\n isDouble: typeof isDouble;\n double: typeof double;\n isInteger: typeof isInteger;\n integer: typeof integer;\n isMediaRef: typeof isMediaRef;\n mediaRef: typeof mediaRef;\n isModelRef: typeof isModelRef;\n modelRef: typeof modelRef;\n isObject: typeof isObject;\n object: typeof object;\n isString: typeof isString;\n string: typeof string;\n isText: typeof isText;\n text: typeof text;\n isUnmanagedJson: typeof isUnmanagedJson;\n unmanagedJson: typeof unmanagedJson;\n isUserRef: typeof isUserRef;\n userRef: typeof userRef;\n visit: typeof visit;\n} = {\n isDatetime: isDatetime,\n datetime: datetime,\n isDocRef: isDocRef,\n docRef: docRef,\n isDouble: isDouble,\n double: double,\n isInteger: isInteger,\n integer: integer,\n isMediaRef: isMediaRef,\n mediaRef: mediaRef,\n isModelRef: isModelRef,\n modelRef: modelRef,\n isObject: isObject,\n object: object,\n isString: isString,\n string: string,\n isText: isText,\n text: text,\n isUnmanagedJson: isUnmanagedJson,\n unmanagedJson: unmanagedJson,\n isUserRef: isUserRef,\n userRef: userRef,\n visit: visit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,UAAU;EACtBG,QAAQ,EAAEA,QAAQ;EAClBC,QAAQ,EAAEA,QAAQ;EAClBC,MAAM,EAAEA,MAAM;EACdC,QAAQ,EAAEA,QAAQ;EAClBC,MAAM,EAAEA,MAAM;EACdC,SAAS,EAAEA,SAAS;EACpBC,OAAO,EAAEA,OAAO;EAChBC,UAAU,EAAEA,UAAU;EACtBC,QAAQ,EAAEA,QAAQ;EAClBC,UAAU,EAAEA,UAAU;EACtBC,QAAQ,EAAEA,QAAQ;EAClBC,QAAQ,EAAEA,QAAQ;EAClBC,MAAM,EAAEA,MAAM;EACdC,QAAQ,EAAEA,QAAQ;EAClBC,MAAM,EAAEA,MAAM;EACdC,MAAM,EAAEA,MAAM;EACdC,IAAI,EAAEA,IAAI;EACVC,eAAe,EAAEA,eAAe;EAChCC,aAAa,EAAEA,aAAa;EAC5BC,SAAS,EAAEA,SAAS;EACpBC,OAAO,EAAEA,OAAO;EAChBC,KAAK,EAAEA;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"fieldValueUnion.js","names":["isBoolean","obj","type","boolean","isDatetime","datetime","isDocRef","docRef","isDouble","double","isInteger","integer","isMediaRef","mediaRef","isModelRef","modelRef","isObject","object","isString","string","isText","text","isUnmanagedJson","unmanagedJson","isUserRef","userRef","visit","visitor","unknown","IFieldValueUnion"],"sources":["fieldValueUnion.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 { IFieldValueBoolean } from \"./fieldValueBoolean.js\";\nimport type { IFieldValueDatetime } from \"./fieldValueDatetime.js\";\nimport type { IFieldValueDocumentRef } from \"./fieldValueDocumentRef.js\";\nimport type { IFieldValueDouble } from \"./fieldValueDouble.js\";\nimport type { IFieldValueInteger } from \"./fieldValueInteger.js\";\nimport type { IFieldValueMediaRef } from \"./fieldValueMediaRef.js\";\nimport type { IFieldValueModelRef } from \"./fieldValueModelRef.js\";\nimport type { IFieldValueObjectRef } from \"./fieldValueObjectRef.js\";\nimport type { IFieldValueString } from \"./fieldValueString.js\";\nimport type { IFieldValueText } from \"./fieldValueText.js\";\nimport type { IFieldValueUnmanagedJson } from \"./fieldValueUnmanagedJson.js\";\nimport type { IFieldValueUserRef } from \"./fieldValueUserRef.js\";\n\nexport interface IFieldValueUnion_Boolean {\n readonly \"boolean\": IFieldValueBoolean;\n readonly \"type\": \"boolean\";\n}\n\nexport interface IFieldValueUnion_Datetime {\n readonly \"datetime\": IFieldValueDatetime;\n readonly \"type\": \"datetime\";\n}\n\nexport interface IFieldValueUnion_DocRef {\n readonly \"docRef\": IFieldValueDocumentRef;\n readonly \"type\": \"docRef\";\n}\n\nexport interface IFieldValueUnion_Double {\n readonly \"double\": IFieldValueDouble;\n readonly \"type\": \"double\";\n}\n\nexport interface IFieldValueUnion_Integer {\n readonly \"integer\": IFieldValueInteger;\n readonly \"type\": \"integer\";\n}\n\nexport interface IFieldValueUnion_MediaRef {\n readonly \"mediaRef\": IFieldValueMediaRef;\n readonly \"type\": \"mediaRef\";\n}\n\nexport interface IFieldValueUnion_ModelRef {\n readonly \"modelRef\": IFieldValueModelRef;\n readonly \"type\": \"modelRef\";\n}\n\nexport interface IFieldValueUnion_Object {\n readonly \"object\": IFieldValueObjectRef;\n readonly \"type\": \"object\";\n}\n\nexport interface IFieldValueUnion_String {\n readonly \"string\": IFieldValueString;\n readonly \"type\": \"string\";\n}\n\nexport interface IFieldValueUnion_Text {\n readonly \"text\": IFieldValueText;\n readonly \"type\": \"text\";\n}\n\nexport interface IFieldValueUnion_UnmanagedJson {\n readonly \"unmanagedJson\": IFieldValueUnmanagedJson;\n readonly \"type\": \"unmanagedJson\";\n}\n\nexport interface IFieldValueUnion_UserRef {\n readonly \"userRef\": IFieldValueUserRef;\n readonly \"type\": \"userRef\";\n}\n\nexport type IFieldValueUnion =\n | IFieldValueUnion_Boolean\n | IFieldValueUnion_Datetime\n | IFieldValueUnion_DocRef\n | IFieldValueUnion_Double\n | IFieldValueUnion_Integer\n | IFieldValueUnion_MediaRef\n | IFieldValueUnion_ModelRef\n | IFieldValueUnion_Object\n | IFieldValueUnion_String\n | IFieldValueUnion_Text\n | IFieldValueUnion_UnmanagedJson\n | IFieldValueUnion_UserRef;\n\nexport interface IFieldValueUnionVisitor<T> {\n readonly \"boolean\": (obj: IFieldValueBoolean) => T;\n readonly \"datetime\": (obj: IFieldValueDatetime) => T;\n readonly \"docRef\": (obj: IFieldValueDocumentRef) => T;\n readonly \"double\": (obj: IFieldValueDouble) => T;\n readonly \"integer\": (obj: IFieldValueInteger) => T;\n readonly \"mediaRef\": (obj: IFieldValueMediaRef) => T;\n readonly \"modelRef\": (obj: IFieldValueModelRef) => T;\n readonly \"object\": (obj: IFieldValueObjectRef) => T;\n readonly \"string\": (obj: IFieldValueString) => T;\n readonly \"text\": (obj: IFieldValueText) => T;\n readonly \"unmanagedJson\": (obj: IFieldValueUnmanagedJson) => T;\n readonly \"userRef\": (obj: IFieldValueUserRef) => T;\n readonly \"unknown\": (obj: IFieldValueUnion) => T;\n}\n\nfunction isBoolean(obj: IFieldValueUnion): obj is IFieldValueUnion_Boolean {\n return (obj.type === \"boolean\");\n}\n\nfunction boolean(obj: IFieldValueBoolean): IFieldValueUnion_Boolean {\n return {\n boolean: obj,\n type: \"boolean\",\n };\n}\n\nfunction isDatetime(obj: IFieldValueUnion): obj is IFieldValueUnion_Datetime {\n return (obj.type === \"datetime\");\n}\n\nfunction datetime(obj: IFieldValueDatetime): IFieldValueUnion_Datetime {\n return {\n datetime: obj,\n type: \"datetime\",\n };\n}\n\nfunction isDocRef(obj: IFieldValueUnion): obj is IFieldValueUnion_DocRef {\n return (obj.type === \"docRef\");\n}\n\nfunction docRef(obj: IFieldValueDocumentRef): IFieldValueUnion_DocRef {\n return {\n docRef: obj,\n type: \"docRef\",\n };\n}\n\nfunction isDouble(obj: IFieldValueUnion): obj is IFieldValueUnion_Double {\n return (obj.type === \"double\");\n}\n\nfunction double(obj: IFieldValueDouble): IFieldValueUnion_Double {\n return {\n double: obj,\n type: \"double\",\n };\n}\n\nfunction isInteger(obj: IFieldValueUnion): obj is IFieldValueUnion_Integer {\n return (obj.type === \"integer\");\n}\n\nfunction integer(obj: IFieldValueInteger): IFieldValueUnion_Integer {\n return {\n integer: obj,\n type: \"integer\",\n };\n}\n\nfunction isMediaRef(obj: IFieldValueUnion): obj is IFieldValueUnion_MediaRef {\n return (obj.type === \"mediaRef\");\n}\n\nfunction mediaRef(obj: IFieldValueMediaRef): IFieldValueUnion_MediaRef {\n return {\n mediaRef: obj,\n type: \"mediaRef\",\n };\n}\n\nfunction isModelRef(obj: IFieldValueUnion): obj is IFieldValueUnion_ModelRef {\n return (obj.type === \"modelRef\");\n}\n\nfunction modelRef(obj: IFieldValueModelRef): IFieldValueUnion_ModelRef {\n return {\n modelRef: obj,\n type: \"modelRef\",\n };\n}\n\nfunction isObject(obj: IFieldValueUnion): obj is IFieldValueUnion_Object {\n return (obj.type === \"object\");\n}\n\nfunction object(obj: IFieldValueObjectRef): IFieldValueUnion_Object {\n return {\n object: obj,\n type: \"object\",\n };\n}\n\nfunction isString(obj: IFieldValueUnion): obj is IFieldValueUnion_String {\n return (obj.type === \"string\");\n}\n\nfunction string(obj: IFieldValueString): IFieldValueUnion_String {\n return {\n string: obj,\n type: \"string\",\n };\n}\n\nfunction isText(obj: IFieldValueUnion): obj is IFieldValueUnion_Text {\n return (obj.type === \"text\");\n}\n\nfunction text(obj: IFieldValueText): IFieldValueUnion_Text {\n return {\n text: obj,\n type: \"text\",\n };\n}\n\nfunction isUnmanagedJson(obj: IFieldValueUnion): obj is IFieldValueUnion_UnmanagedJson {\n return (obj.type === \"unmanagedJson\");\n}\n\nfunction unmanagedJson(obj: IFieldValueUnmanagedJson): IFieldValueUnion_UnmanagedJson {\n return {\n unmanagedJson: obj,\n type: \"unmanagedJson\",\n };\n}\n\nfunction isUserRef(obj: IFieldValueUnion): obj is IFieldValueUnion_UserRef {\n return (obj.type === \"userRef\");\n}\n\nfunction userRef(obj: IFieldValueUserRef): IFieldValueUnion_UserRef {\n return {\n userRef: obj,\n type: \"userRef\",\n };\n}\n\nfunction visit<T>(obj: IFieldValueUnion, visitor: IFieldValueUnionVisitor<T>): T {\n if (isBoolean(obj)) {\n return visitor.boolean(obj.boolean);\n }\n if (isDatetime(obj)) {\n return visitor.datetime(obj.datetime);\n }\n if (isDocRef(obj)) {\n return visitor.docRef(obj.docRef);\n }\n if (isDouble(obj)) {\n return visitor.double(obj.double);\n }\n if (isInteger(obj)) {\n return visitor.integer(obj.integer);\n }\n if (isMediaRef(obj)) {\n return visitor.mediaRef(obj.mediaRef);\n }\n if (isModelRef(obj)) {\n return visitor.modelRef(obj.modelRef);\n }\n if (isObject(obj)) {\n return visitor.object(obj.object);\n }\n if (isString(obj)) {\n return visitor.string(obj.string);\n }\n if (isText(obj)) {\n return visitor.text(obj.text);\n }\n if (isUnmanagedJson(obj)) {\n return visitor.unmanagedJson(obj.unmanagedJson);\n }\n if (isUserRef(obj)) {\n return visitor.userRef(obj.userRef);\n }\n return visitor.unknown(obj);\n}\n\nexport const IFieldValueUnion: {\n isBoolean: typeof isBoolean;\n boolean: typeof boolean;\n isDatetime: typeof isDatetime;\n datetime: typeof datetime;\n isDocRef: typeof isDocRef;\n docRef: typeof docRef;\n isDouble: typeof isDouble;\n double: typeof double;\n isInteger: typeof isInteger;\n integer: typeof integer;\n isMediaRef: typeof isMediaRef;\n mediaRef: typeof mediaRef;\n isModelRef: typeof isModelRef;\n modelRef: typeof modelRef;\n isObject: typeof isObject;\n object: typeof object;\n isString: typeof isString;\n string: typeof string;\n isText: typeof isText;\n text: typeof text;\n isUnmanagedJson: typeof isUnmanagedJson;\n unmanagedJson: typeof unmanagedJson;\n isUserRef: typeof isUserRef;\n userRef: typeof userRef;\n visit: typeof visit;\n} = {\n isBoolean: isBoolean,\n boolean: boolean,\n isDatetime: isDatetime,\n datetime: datetime,\n isDocRef: isDocRef,\n docRef: docRef,\n isDouble: isDouble,\n double: double,\n isInteger: isInteger,\n integer: integer,\n isMediaRef: isMediaRef,\n mediaRef: mediaRef,\n isModelRef: isModelRef,\n modelRef: modelRef,\n isObject: isObject,\n object: object,\n isString: isString,\n string: string,\n isText: isText,\n text: text,\n isUnmanagedJson: isUnmanagedJson,\n unmanagedJson: unmanagedJson,\n isUserRef: isUserRef,\n userRef: userRef,\n visit: visit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyGA,SAASA,SAASA,CAACC,GAAqB,EAAmC;EACzE,OAAQA,GAAG,CAACC,IAAI,KAAK,SAAS;AAChC;AAEA,SAASC,OAAOA,CAACF,GAAuB,EAA4B;EAClE,OAAO;IACLE,OAAO,EAAEF,GAAG;IACZC,IAAI,EAAE;EACR,CAAC;AACH;AAEA,SAASE,UAAUA,CAACH,GAAqB,EAAoC;EAC3E,OAAQA,GAAG,CAACC,IAAI,KAAK,UAAU;AACjC;AAEA,SAASG,QAAQA,CAACJ,GAAwB,EAA6B;EACrE,OAAO;IACLI,QAAQ,EAAEJ,GAAG;IACbC,IAAI,EAAE;EACR,CAAC;AACH;AAEA,SAASI,QAAQA,CAACL,GAAqB,EAAkC;EACvE,OAAQA,GAAG,CAACC,IAAI,KAAK,QAAQ;AAC/B;AAEA,SAASK,MAAMA,CAACN,GAA2B,EAA2B;EACpE,OAAO;IACLM,MAAM,EAAEN,GAAG;IACXC,IAAI,EAAE;EACR,CAAC;AACH;AAEA,SAASM,QAAQA,CAACP,GAAqB,EAAkC;EACvE,OAAQA,GAAG,CAACC,IA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,EAAEA,QAAQ;EAClBC,MAAM,EAAEA,MAAM;EACdC,QAAQ,EAAEA,QAAQ;EAClBC,MAAM,EAAEA,MAAM;EACdC,MAAM,EAAEA,MAAM;EACdC,IAAI,EAAEA,IAAI;EACVC,eAAe,EAAEA,eAAe;EAChCC,aAAa,EAAEA,aAAa;EAC5BC,SAAS,EAAEA,SAAS;EACpBC,OAAO,EAAEA,OAAO;EAChBC,KAAK,EAAEA;AACT,CAAC","ignoreList":[]}
@@ -0,0 +1,40 @@
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 fs from "fs-extra";
18
+ import path from "path";
19
+ import { fileURLToPath } from "url";
20
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
21
+
22
+ // Walk up directories to find the nearest package.json (works for both src and build/esm locations)
23
+ function findPackageJson(startDir) {
24
+ let dir = startDir;
25
+ while (dir !== path.dirname(dir)) {
26
+ const packageJsonPath = path.join(dir, "package.json");
27
+ if (fs.existsSync(packageJsonPath)) {
28
+ return packageJsonPath;
29
+ }
30
+ dir = path.dirname(dir);
31
+ }
32
+ throw new Error("Could not find package.json");
33
+ }
34
+ const packageJsonPath = findPackageJson(currentDir);
35
+ const {
36
+ name: packageName,
37
+ version
38
+ } = fs.readJsonSync(packageJsonPath);
39
+ export const GENERATED_FILE_HEADER = `/* Generated by ${packageName}@${version} */\n\n`;
40
+ //# sourceMappingURL=generatedFileHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatedFileHeader.js","names":["fs","path","fileURLToPath","currentDir","dirname","import","meta","url","findPackageJson","startDir","dir","packageJsonPath","join","existsSync","Error","name","packageName","version","readJsonSync","GENERATED_FILE_HEADER"],"sources":["generatedFileHeader.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 fs from \"fs-extra\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n// Walk up directories to find the nearest package.json (works for both src and build/esm locations)\nfunction findPackageJson(startDir: string): string {\n let dir = startDir;\n while (dir !== path.dirname(dir)) {\n const packageJsonPath = path.join(dir, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n dir = path.dirname(dir);\n }\n throw new Error(\"Could not find package.json\");\n}\n\nconst packageJsonPath = findPackageJson(currentDir);\nconst { name: packageName, version } = fs.readJsonSync(packageJsonPath) as {\n name: string;\n version: string;\n};\n\nexport const GENERATED_FILE_HEADER: string = `/* Generated by ${packageName}@${version} */\\n\\n`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;;AAE/D;AACA,SAASC,eAAeA,CAACC,QAAgB,EAAU;EACjD,IAAIC,GAAG,GAAGD,QAAQ;EAClB,OAAOC,GAAG,KAAKT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC,EAAE;IAChC,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACF,GAAG,EAAE,cAAc,CAAC;IACtD,IAAIV,EAAE,CAACa,UAAU,CAACF,eAAe,CAAC,EAAE;MAClC,OAAOA,eAAe;IACxB;IACAD,GAAG,GAAGT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC;EACzB;EACA,MAAM,IAAII,KAAK,CAAC,6BAA6B,CAAC;AAChD;AAEA,MAAMH,eAAe,GAAGH,eAAe,CAACL,UAAU,CAAC;AACnD,MAAM;EAAEY,IAAI,EAAEC,WAAW;EAAEC;AAAQ,CAAC,GAAGjB,EAAE,CAACkB,YAAY,CAACP,eAAe,CAGrE;AAED,OAAO,MAAMQ,qBAA6B,GAAG,mBAAmBH,WAAW,IAAIC,OAAO,SAAS","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
3
+ import { Metadata } from '@palantir/pack.document-schema.model-types';
4
+ import { AnimalCatSchema, AnimalDogSchema, AnimalSchema, CatSchema, DogSchema } from './schema.js';
5
+ export const CatModel = {
6
+ __type: {},
7
+ zodSchema: CatSchema,
8
+ [Metadata]: {
9
+ name: 'Cat'
10
+ }
11
+ };
12
+ export const DogModel = {
13
+ __type: {},
14
+ zodSchema: DogSchema,
15
+ [Metadata]: {
16
+ name: 'Dog'
17
+ }
18
+ };
19
+ export const AnimalModel = {
20
+ __type: {},
21
+ zodSchema: AnimalSchema,
22
+ [Metadata]: {
23
+ discriminant: 'kind',
24
+ name: 'Animal'
25
+ }
26
+ };
27
+ export const AnimalCatModel = {
28
+ __type: {},
29
+ zodSchema: AnimalCatSchema,
30
+ [Metadata]: {
31
+ discriminant: 'kind',
32
+ name: 'AnimalCat'
33
+ }
34
+ };
35
+ export const AnimalDogModel = {
36
+ __type: {},
37
+ zodSchema: AnimalDogSchema,
38
+ [Metadata]: {
39
+ discriminant: 'kind',
40
+ name: 'AnimalDog'
41
+ }
42
+ };
43
+ export const DocumentModel = {
44
+ Cat: CatModel,
45
+ Dog: DogModel,
46
+ Animal: AnimalModel,
47
+ AnimalCat: AnimalCatModel,
48
+ AnimalDog: AnimalDogModel,
49
+ [Metadata]: {
50
+ version: 1
51
+ }
52
+ };
53
+ //# sourceMappingURL=custom-discriminant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-discriminant.js","names":["Metadata","AnimalCatSchema","AnimalDogSchema","AnimalSchema","CatSchema","DogSchema","CatModel","__type","zodSchema","name","DogModel","AnimalModel","discriminant","AnimalCatModel","AnimalDogModel","DocumentModel","Cat","Dog","Animal","AnimalCat","AnimalDog","version"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Animal, AnimalCat, AnimalDog, Cat, Dog } from './types.js';\nimport {\n AnimalCatSchema,\n AnimalDogSchema,\n AnimalSchema,\n CatSchema,\n DogSchema,\n} from './schema.js';\n\nexport interface CatModel extends RecordModel<Cat, typeof CatSchema> {}\nexport const CatModel: CatModel = {\n __type: {} as Cat,\n zodSchema: CatSchema,\n [Metadata]: {\n name: 'Cat',\n },\n};\n\nexport interface DogModel extends RecordModel<Dog, typeof DogSchema> {}\nexport const DogModel: DogModel = {\n __type: {} as Dog,\n zodSchema: DogSchema,\n [Metadata]: {\n name: 'Dog',\n },\n};\n\nexport interface AnimalModel extends UnionModel<Animal, typeof AnimalSchema> {}\nexport const AnimalModel: AnimalModel = {\n __type: {} as Animal,\n zodSchema: AnimalSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'Animal',\n },\n};\n\nexport interface AnimalCatModel extends UnionModel<\n AnimalCat,\n typeof AnimalCatSchema\n> {}\nexport const AnimalCatModel: AnimalCatModel = {\n __type: {} as AnimalCat,\n zodSchema: AnimalCatSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'AnimalCat',\n },\n};\n\nexport interface AnimalDogModel extends UnionModel<\n AnimalDog,\n typeof AnimalDogSchema\n> {}\nexport const AnimalDogModel: AnimalDogModel = {\n __type: {} as AnimalDog,\n zodSchema: AnimalDogSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'AnimalDog',\n },\n};\n\nexport const DocumentModel = {\n Cat: CatModel,\n Dog: DogModel,\n Animal: AnimalModel,\n AnimalCat: AnimalCatModel,\n AnimalDog: AnimalDogModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SACEC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,SAAS,EACTC,SAAS,QACJ,aAAa;AAGpB,OAAO,MAAMC,QAAkB,GAAG;EAChCC,MAAM,EAAE,CAAC,CAAQ;EACjBC,SAAS,EAAEJ,SAAS;EACpB,CAACJ,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAMC,QAAkB,GAAG;EAChCH,MAAM,EAAE,CAAC,CAAQ;EACjBC,SAAS,EAAEH,SAAS;EACpB,CAACL,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAME,WAAwB,GAAG;EACtCJ,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEL,YAAY;EACvB,CAACH,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMI,cAA8B,GAAG;EAC5CN,MAAM,EAAE,CAAC,CAAc;EACvBC,SAAS,EAAEP,eAAe;EAC1B,CAACD,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMK,cAA8B,GAAG;EAC5CP,MAAM,EAAE,CAAC,CAAc;EACvBC,SAAS,EAAEN,eAAe;EAC1B,CAACF,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMM,aAAa,GAAG;EAC3BC,GAAG,EAAEV,QAAQ;EACbW,GAAG,EAAEP,QAAQ;EACbQ,MAAM,EAAEP,WAAW;EACnBQ,SAAS,EAAEN,cAAc;EACzBO,SAAS,EAAEN,cAAc;EACzB,CAACd,QAAQ,GAAG;IACVqB,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
2
4
  import { EventSchema } from './schema.js';
3
5
  export const EventModel = {
@@ -1 +1 @@
1
- {"version":3,"file":"external-refs.js","names":["Metadata","EventSchema","EventModel","__type","zodSchema","externalRefFieldTypes","documentRef","userRef","name","DocumentModel","Event","version"],"sources":["external-refs.ts"],"sourcesContent":["import type {\n DocumentSchema,\n Model,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Event } from './types.js';\nimport { EventSchema } from './schema.js';\n\nexport interface EventModel extends Model<Event, typeof EventSchema> {}\nexport const EventModel: EventModel = {\n __type: {} as Event,\n zodSchema: EventSchema,\n [Metadata]: {\n externalRefFieldTypes: {\n documentRef: 'docRef',\n userRef: 'userRef',\n },\n name: 'Event',\n },\n};\n\nexport const DocumentModel = {\n Event: EventModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,WAAW,QAAQ,aAAa;AAGzC,OAAO,MAAMC,UAAsB,GAAG;EACpCC,MAAM,EAAE,CAAC,CAAU;EACnBC,SAAS,EAAEH,WAAW;EACtB,CAACD,QAAQ,GAAG;IACVK,qBAAqB,EAAE;MACrBC,WAAW,EAAE,QAAQ;MACrBC,OAAO,EAAE;IACX,CAAC;IACDC,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,KAAK,EAAER,UAAU;EACjB,CAACF,QAAQ,GAAG;IACVW,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
1
+ {"version":3,"file":"external-refs.js","names":["Metadata","EventSchema","EventModel","__type","zodSchema","externalRefFieldTypes","documentRef","userRef","name","DocumentModel","Event","version"],"sources":["external-refs.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Event } from './types.js';\nimport { EventSchema } from './schema.js';\n\nexport interface EventModel extends RecordModel<Event, typeof EventSchema> {}\nexport const EventModel: EventModel = {\n __type: {} as Event,\n zodSchema: EventSchema,\n [Metadata]: {\n externalRefFieldTypes: {\n documentRef: 'docRef',\n userRef: 'userRef',\n },\n name: 'Event',\n },\n};\n\nexport const DocumentModel = {\n Event: EventModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,WAAW,QAAQ,aAAa;AAGzC,OAAO,MAAMC,UAAsB,GAAG;EACpCC,MAAM,EAAE,CAAC,CAAU;EACnBC,SAAS,EAAEH,WAAW;EACtB,CAACD,QAAQ,GAAG;IACVK,qBAAqB,EAAE;MACrBC,WAAW,EAAE,QAAQ;MACrBC,OAAO,EAAE;IACX,CAAC;IACDC,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,KAAK,EAAER,UAAU;EACjB,CAACF,QAAQ,GAAG;IACVW,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
2
4
  import { PersonSchema } from './schema.js';
3
5
  export const PersonModel = {
@@ -1 +1 @@
1
- {"version":3,"file":"simple-record.js","names":["Metadata","PersonSchema","PersonModel","__type","zodSchema","name","DocumentModel","Person","version"],"sources":["simple-record.ts"],"sourcesContent":["import type {\n DocumentSchema,\n Model,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Person } from './types.js';\nimport { PersonSchema } from './schema.js';\n\nexport interface PersonModel extends Model<Person, typeof PersonSchema> {}\nexport const PersonModel: PersonModel = {\n __type: {} as Person,\n zodSchema: PersonSchema,\n [Metadata]: {\n name: 'Person',\n },\n};\n\nexport const DocumentModel = {\n Person: PersonModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,YAAY,QAAQ,aAAa;AAG1C,OAAO,MAAMC,WAAwB,GAAG;EACtCC,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEH,YAAY;EACvB,CAACD,QAAQ,GAAG;IACVK,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,MAAM,EAAEL,WAAW;EACnB,CAACF,QAAQ,GAAG;IACVQ,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
1
+ {"version":3,"file":"simple-record.js","names":["Metadata","PersonSchema","PersonModel","__type","zodSchema","name","DocumentModel","Person","version"],"sources":["simple-record.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Person } from './types.js';\nimport { PersonSchema } from './schema.js';\n\nexport interface PersonModel extends RecordModel<Person, typeof PersonSchema> {}\nexport const PersonModel: PersonModel = {\n __type: {} as Person,\n zodSchema: PersonSchema,\n [Metadata]: {\n name: 'Person',\n },\n};\n\nexport const DocumentModel = {\n Person: PersonModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,YAAY,QAAQ,aAAa;AAG1C,OAAO,MAAMC,WAAwB,GAAG;EACtCC,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEH,YAAY;EACvB,CAACD,QAAQ,GAAG;IACVK,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,MAAM,EAAEL,WAAW;EACnB,CAACF,QAAQ,GAAG;IACVQ,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
2
4
  import { NodeObjectSchema, NodeSchema, NodeTextBoxSchema, ObjectNodeSchema, TextBoxSchema } from './schema.js';
3
5
  export const ObjectNodeModel = {
@@ -18,6 +20,7 @@ export const NodeModel = {
18
20
  __type: {},
19
21
  zodSchema: NodeSchema,
20
22
  [Metadata]: {
23
+ discriminant: 'type',
21
24
  name: 'Node'
22
25
  }
23
26
  };
@@ -25,6 +28,7 @@ export const NodeObjectModel = {
25
28
  __type: {},
26
29
  zodSchema: NodeObjectSchema,
27
30
  [Metadata]: {
31
+ discriminant: 'type',
28
32
  name: 'NodeObject'
29
33
  }
30
34
  };
@@ -32,6 +36,7 @@ export const NodeTextBoxModel = {
32
36
  __type: {},
33
37
  zodSchema: NodeTextBoxSchema,
34
38
  [Metadata]: {
39
+ discriminant: 'type',
35
40
  name: 'NodeTextBox'
36
41
  }
37
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"union-types.js","names":["Metadata","NodeObjectSchema","NodeSchema","NodeTextBoxSchema","ObjectNodeSchema","TextBoxSchema","ObjectNodeModel","__type","zodSchema","name","TextBoxModel","NodeModel","NodeObjectModel","NodeTextBoxModel","DocumentModel","ObjectNode","TextBox","Node","NodeObject","NodeTextBox","version"],"sources":["union-types.ts"],"sourcesContent":["import type {\n DocumentSchema,\n Model,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type {\n Node,\n NodeObject,\n NodeTextBox,\n ObjectNode,\n TextBox,\n} from './types.js';\nimport {\n NodeObjectSchema,\n NodeSchema,\n NodeTextBoxSchema,\n ObjectNodeSchema,\n TextBoxSchema,\n} from './schema.js';\n\nexport interface ObjectNodeModel\n extends Model<ObjectNode, typeof ObjectNodeSchema> {}\nexport const ObjectNodeModel: ObjectNodeModel = {\n __type: {} as ObjectNode,\n zodSchema: ObjectNodeSchema,\n [Metadata]: {\n name: 'ObjectNode',\n },\n};\n\nexport interface TextBoxModel extends Model<TextBox, typeof TextBoxSchema> {}\nexport const TextBoxModel: TextBoxModel = {\n __type: {} as TextBox,\n zodSchema: TextBoxSchema,\n [Metadata]: {\n name: 'TextBox',\n },\n};\n\nexport interface NodeModel extends Model<Node, typeof NodeSchema> {}\nexport const NodeModel: NodeModel = {\n __type: {} as Node,\n zodSchema: NodeSchema,\n [Metadata]: {\n name: 'Node',\n },\n};\n\nexport interface NodeObjectModel\n extends Model<NodeObject, typeof NodeObjectSchema> {}\nexport const NodeObjectModel: NodeObjectModel = {\n __type: {} as NodeObject,\n zodSchema: NodeObjectSchema,\n [Metadata]: {\n name: 'NodeObject',\n },\n};\n\nexport interface NodeTextBoxModel\n extends Model<NodeTextBox, typeof NodeTextBoxSchema> {}\nexport const NodeTextBoxModel: NodeTextBoxModel = {\n __type: {} as NodeTextBox,\n zodSchema: NodeTextBoxSchema,\n [Metadata]: {\n name: 'NodeTextBox',\n },\n};\n\nexport const DocumentModel = {\n ObjectNode: ObjectNodeModel,\n TextBox: TextBoxModel,\n Node: NodeModel,\n NodeObject: NodeObjectModel,\n NodeTextBox: NodeTextBoxModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,4CAA4C;AAQrE,SACEC,gBAAgB,EAChBC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,EAChBC,aAAa,QACR,aAAa;AAIpB,OAAO,MAAMC,eAAgC,GAAG;EAC9CC,MAAM,EAAE,CAAC,CAAe;EACxBC,SAAS,EAAEJ,gBAAgB;EAC3B,CAACJ,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAMC,YAA0B,GAAG;EACxCH,MAAM,EAAE,CAAC,CAAY;EACrBC,SAAS,EAAEH,aAAa;EACxB,CAACL,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAME,SAAoB,GAAG;EAClCJ,MAAM,EAAE,CAAC,CAAS;EAClBC,SAAS,EAAEN,UAAU;EACrB,CAACF,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAID,OAAO,MAAMG,eAAgC,GAAG;EAC9CL,MAAM,EAAE,CAAC,CAAe;EACxBC,SAAS,EAAEP,gBAAgB;EAC3B,CAACD,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAID,OAAO,MAAMI,gBAAkC,GAAG;EAChDN,MAAM,EAAE,CAAC,CAAgB;EACzBC,SAAS,EAAEL,iBAAiB;EAC5B,CAACH,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMK,aAAa,GAAG;EAC3BC,UAAU,EAAET,eAAe;EAC3BU,OAAO,EAAEN,YAAY;EACrBO,IAAI,EAAEN,SAAS;EACfO,UAAU,EAAEN,eAAe;EAC3BO,WAAW,EAAEN,gBAAgB;EAC7B,CAACb,QAAQ,GAAG;IACVoB,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
1
+ {"version":3,"file":"union-types.js","names":["Metadata","NodeObjectSchema","NodeSchema","NodeTextBoxSchema","ObjectNodeSchema","TextBoxSchema","ObjectNodeModel","__type","zodSchema","name","TextBoxModel","NodeModel","discriminant","NodeObjectModel","NodeTextBoxModel","DocumentModel","ObjectNode","TextBox","Node","NodeObject","NodeTextBox","version"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type {\n Node,\n NodeObject,\n NodeTextBox,\n ObjectNode,\n TextBox,\n} from './types.js';\nimport {\n NodeObjectSchema,\n NodeSchema,\n NodeTextBoxSchema,\n ObjectNodeSchema,\n TextBoxSchema,\n} from './schema.js';\n\nexport interface ObjectNodeModel extends RecordModel<\n ObjectNode,\n typeof ObjectNodeSchema\n> {}\nexport const ObjectNodeModel: ObjectNodeModel = {\n __type: {} as ObjectNode,\n zodSchema: ObjectNodeSchema,\n [Metadata]: {\n name: 'ObjectNode',\n },\n};\n\nexport interface TextBoxModel extends RecordModel<\n TextBox,\n typeof TextBoxSchema\n> {}\nexport const TextBoxModel: TextBoxModel = {\n __type: {} as TextBox,\n zodSchema: TextBoxSchema,\n [Metadata]: {\n name: 'TextBox',\n },\n};\n\nexport interface NodeModel extends UnionModel<Node, typeof NodeSchema> {}\nexport const NodeModel: NodeModel = {\n __type: {} as Node,\n zodSchema: NodeSchema,\n [Metadata]: {\n discriminant: 'type',\n name: 'Node',\n },\n};\n\nexport interface NodeObjectModel extends UnionModel<\n NodeObject,\n typeof NodeObjectSchema\n> {}\nexport const NodeObjectModel: NodeObjectModel = {\n __type: {} as NodeObject,\n zodSchema: NodeObjectSchema,\n [Metadata]: {\n discriminant: 'type',\n name: 'NodeObject',\n },\n};\n\nexport interface NodeTextBoxModel extends UnionModel<\n NodeTextBox,\n typeof NodeTextBoxSchema\n> {}\nexport const NodeTextBoxModel: NodeTextBoxModel = {\n __type: {} as NodeTextBox,\n zodSchema: NodeTextBoxSchema,\n [Metadata]: {\n discriminant: 'type',\n name: 'NodeTextBox',\n },\n};\n\nexport const DocumentModel = {\n ObjectNode: ObjectNodeModel,\n TextBox: TextBoxModel,\n Node: NodeModel,\n NodeObject: NodeObjectModel,\n NodeTextBox: NodeTextBoxModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAQrE,SACEC,gBAAgB,EAChBC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,EAChBC,aAAa,QACR,aAAa;AAMpB,OAAO,MAAMC,eAAgC,GAAG;EAC9CC,MAAM,EAAE,CAAC,CAAe;EACxBC,SAAS,EAAEJ,gBAAgB;EAC3B,CAACJ,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMC,YAA0B,GAAG;EACxCH,MAAM,EAAE,CAAC,CAAY;EACrBC,SAAS,EAAEH,aAAa;EACxB,CAACL,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAME,SAAoB,GAAG;EAClCJ,MAAM,EAAE,CAAC,CAAS;EAClBC,SAAS,EAAEN,UAAU;EACrB,CAACF,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMI,eAAgC,GAAG;EAC9CN,MAAM,EAAE,CAAC,CAAe;EACxBC,SAAS,EAAEP,gBAAgB;EAC3B,CAACD,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMK,gBAAkC,GAAG;EAChDP,MAAM,EAAE,CAAC,CAAgB;EACzBC,SAAS,EAAEL,iBAAiB;EAC5B,CAACH,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMM,aAAa,GAAG;EAC3BC,UAAU,EAAEV,eAAe;EAC3BW,OAAO,EAAEP,YAAY;EACrBQ,IAAI,EAAEP,SAAS;EACfQ,UAAU,EAAEN,eAAe;EAC3BO,WAAW,EAAEN,gBAAgB;EAC7B,CAACd,QAAQ,GAAG;IACVqB,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { z } from 'zod';
2
4
  export const ContainerSchema = z.object({
3
5
  tags: z.array(z.string()),
@@ -1 +1 @@
1
- {"version":3,"file":"array-and-map-types.js","names":["z","ContainerSchema","object","tags","array","string","metadata","record","unknown"],"sources":["array-and-map-types.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const ContainerSchema = z.object({\n tags: z.array(z.string()),\n metadata: z.record(z.string(), z.unknown()),\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAAC;EACzBC,QAAQ,EAAEN,CAAC,CAACO,MAAM,CAACP,CAAC,CAACK,MAAM,CAAC,CAAC,EAAEL,CAAC,CAACQ,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"array-and-map-types.js","names":["z","ContainerSchema","object","tags","array","string","metadata","record","unknown"],"sources":["array-and-map-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */\n\nimport { z } from 'zod';\n\nexport const ContainerSchema = z.object({\n tags: z.array(z.string()),\n metadata: z.record(z.string(), z.unknown()),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAAC;EACzBC,QAAQ,EAAEN,CAAC,CAACO,MAAM,CAACP,CAAC,CAACK,MAAM,CAAC,CAAC,EAAEL,CAAC,CAACQ,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
3
+ import { z } from 'zod';
4
+ export const FeatureSchema = z.object({
5
+ enabled: z.boolean(),
6
+ isPublic: z.boolean().optional(),
7
+ flags: z.array(z.boolean())
8
+ });
9
+ //# sourceMappingURL=boolean-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean-fields.js","names":["z","FeatureSchema","object","enabled","boolean","isPublic","optional","flags","array"],"sources":["boolean-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */\n\nimport { z } from 'zod';\n\nexport const FeatureSchema = z.object({\n enabled: z.boolean(),\n isPublic: z.boolean().optional(),\n flags: z.array(z.boolean()),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,aAAa,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,OAAO,EAAEH,CAAC,CAACI,OAAO,CAAC,CAAC;EACpBC,QAAQ,EAAEL,CAAC,CAACI,OAAO,CAAC,CAAC,CAACE,QAAQ,CAAC,CAAC;EAChCC,KAAK,EAAEP,CAAC,CAACQ,KAAK,CAACR,CAAC,CAACI,OAAO,CAAC,CAAC;AAC5B,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
3
+ import { z } from 'zod';
4
+ export const CatSchema = z.object({
5
+ meow: z.string()
6
+ });
7
+ export const DogSchema = z.object({
8
+ bark: z.string()
9
+ });
10
+ export const AnimalCatSchema = CatSchema.extend({
11
+ kind: z.literal('cat')
12
+ });
13
+ export const AnimalDogSchema = DogSchema.extend({
14
+ kind: z.literal('dog')
15
+ });
16
+ export const AnimalSchema = z.discriminatedUnion('kind', [AnimalCatSchema, AnimalDogSchema]);
17
+ //# sourceMappingURL=custom-discriminant.js.map
@@ -0,0 +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.2.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,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { z } from 'zod';
2
4
  export const EventSchema = z.object({
3
5
  timestamp: z.string().datetime()
@@ -1 +1 @@
1
- {"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const EventSchema = z.object({\n timestamp: z.string().datetime(),\n});\n"],"mappings":"AAAA,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.2.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,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { z } from 'zod';
2
4
  export const PersonSchema = z.object({
3
5
  name: z.string().min(2).max(50),
@@ -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":["import { 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,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.2.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,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { z } from 'zod';
2
4
  export const FooSchema = z.object({
3
5
  value: z.string()
@@ -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":["import { 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,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.2.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,3 +1,5 @@
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.2.0 */
2
+
1
3
  import { z } from 'zod';
2
4
  export const ObjectNodeSchema = z.object({
3
5
  x: z.number(),
@@ -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":["import { 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,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.2.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":[]}
@@ -289,5 +289,89 @@ describe("generateModelsFromIr", () => {
289
289
  expect(formatted).toContain("NodeTextBox: NodeTextBoxModel");
290
290
  await expect(formatted).toMatchFileSnapshot(path.join(snapshotDir, "union-types.ts"));
291
291
  });
292
+ it("should generate Model constants with custom discriminant", async () => {
293
+ const result = await generateModelsFromIr({
294
+ name: "Test Schema",
295
+ description: "A test schema with custom discriminant",
296
+ version: 1,
297
+ primaryModelKeys: ["Cat", "Dog", "Animal"],
298
+ models: {
299
+ Cat: {
300
+ type: "record",
301
+ record: {
302
+ key: "Cat",
303
+ name: "Cat",
304
+ description: "A cat",
305
+ fields: [{
306
+ key: "meow",
307
+ name: "Meow",
308
+ description: "Cat sound",
309
+ value: {
310
+ type: "value",
311
+ value: {
312
+ type: "string",
313
+ string: {}
314
+ }
315
+ },
316
+ meta: {
317
+ addedIn: 1
318
+ }
319
+ }],
320
+ meta: {
321
+ addedIn: 1
322
+ }
323
+ }
324
+ },
325
+ Dog: {
326
+ type: "record",
327
+ record: {
328
+ key: "Dog",
329
+ name: "Dog",
330
+ description: "A dog",
331
+ fields: [{
332
+ key: "bark",
333
+ name: "Bark",
334
+ description: "Dog sound",
335
+ value: {
336
+ type: "value",
337
+ value: {
338
+ type: "string",
339
+ string: {}
340
+ }
341
+ },
342
+ meta: {
343
+ addedIn: 1
344
+ }
345
+ }],
346
+ meta: {
347
+ addedIn: 1
348
+ }
349
+ }
350
+ },
351
+ Animal: {
352
+ type: "union",
353
+ union: {
354
+ key: "Animal",
355
+ discriminant: "kind",
356
+ name: "Animal",
357
+ description: "An animal union with custom discriminant",
358
+ variants: {
359
+ cat: "Cat",
360
+ dog: "Dog"
361
+ },
362
+ meta: {
363
+ addedIn: 1
364
+ }
365
+ }
366
+ }
367
+ }
368
+ });
369
+ const formatted = await formatWithPrettier(result);
370
+ expect(formatted).toContain("discriminant: 'kind'");
371
+ expect(formatted).toContain("export const AnimalModel");
372
+ expect(formatted).toContain("export const AnimalCatModel");
373
+ expect(formatted).toContain("export const AnimalDogModel");
374
+ await expect(formatted).toMatchFileSnapshot(path.join(snapshotDir, "custom-discriminant.ts"));
375
+ });
292
376
  });
293
377
  //# sourceMappingURL=generateModelsFromIr.test.js.map