@palantir/pack.document-schema.type-gen 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +19 -0
  2. package/build/esm/cli.js +0 -2
  3. package/build/esm/cli.js.map +1 -1
  4. package/build/esm/commands/ir/__tests__/resolveIrInput.test.js +88 -0
  5. package/build/esm/commands/ir/__tests__/resolveIrInput.test.js.map +1 -0
  6. package/build/esm/commands/ir/irDeployHandler.js +69 -17
  7. package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
  8. package/build/esm/commands/ir/irGenAssetHandler.js +3 -34
  9. package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
  10. package/build/esm/commands/{asset/assetUpdateSchemaHandler.js → ir/irUpdateSchemaHandler.js} +26 -31
  11. package/build/esm/commands/ir/irUpdateSchemaHandler.js.map +1 -0
  12. package/build/esm/commands/ir/registerIrCommands.js +3 -1
  13. package/build/esm/commands/ir/registerIrCommands.js.map +1 -1
  14. package/build/esm/commands/ir/resolveIrInput.js +50 -0
  15. package/build/esm/commands/ir/resolveIrInput.js.map +1 -0
  16. package/build/esm/commands/schema/registerSchemaCommands.js +1 -1
  17. package/build/esm/commands/schema/registerSchemaCommands.js.map +1 -1
  18. package/build/esm/commands/schema/schemaIrHandler.js +14 -4
  19. package/build/esm/commands/schema/schemaIrHandler.js.map +1 -1
  20. package/build/esm/commands/types.js.map +1 -1
  21. package/build/esm/commands/{asset → utils}/__tests__/buildPrefixRewriteFetch.test.js +1 -1
  22. package/build/esm/commands/utils/__tests__/buildPrefixRewriteFetch.test.js.map +1 -0
  23. package/build/esm/commands/utils/firstPartyPrefix.js +47 -0
  24. package/build/esm/commands/utils/firstPartyPrefix.js.map +1 -0
  25. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
  26. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
  27. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
  28. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
  29. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
  30. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
  31. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
  32. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
  33. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
  34. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
  35. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
  36. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
  37. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
  38. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
  39. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
  40. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
  41. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
  42. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
  43. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
  44. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
  45. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
  46. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
  47. package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js +1 -1
  48. package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js.map +1 -1
  49. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -1
  50. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -1
  51. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -1
  52. package/build/esm/utils/schema/__tests__/fixtures.js +11 -0
  53. package/build/esm/utils/schema/__tests__/fixtures.js.map +1 -1
  54. package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js +6 -1
  55. package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js.map +1 -1
  56. package/build/esm/utils/schema/__tests__/resolveSchemaChain.test.js +13 -0
  57. package/build/esm/utils/schema/__tests__/resolveSchemaChain.test.js.map +1 -1
  58. package/build/esm/utils/schema/generateInternalFromSchema.js +54 -33
  59. package/build/esm/utils/schema/generateInternalFromSchema.js.map +1 -1
  60. package/build/esm/utils/schema/generateModelMetadataFromSchema.js +12 -10
  61. package/build/esm/utils/schema/generateModelMetadataFromSchema.js.map +1 -1
  62. package/build/esm/utils/schema/generateScopeFromSchema.js +13 -1
  63. package/build/esm/utils/schema/generateScopeFromSchema.js.map +1 -1
  64. package/build/esm/utils/schema/resolveSchemaChain.js +37 -11
  65. package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -1
  66. package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
  67. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
  68. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
  69. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
  70. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
  71. package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
  72. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
  73. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
  74. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
  75. package/build/types/cli.d.ts.map +1 -1
  76. package/build/types/commands/ir/__tests__/resolveIrInput.test.d.ts +2 -0
  77. package/build/types/commands/ir/__tests__/resolveIrInput.test.d.ts.map +1 -0
  78. package/build/types/commands/ir/irDeployHandler.d.ts +8 -2
  79. package/build/types/commands/ir/irDeployHandler.d.ts.map +1 -1
  80. package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
  81. package/build/types/commands/ir/irUpdateSchemaHandler.d.ts +15 -0
  82. package/build/types/commands/ir/irUpdateSchemaHandler.d.ts.map +1 -0
  83. package/build/types/commands/ir/registerIrCommands.d.ts.map +1 -1
  84. package/build/types/commands/ir/resolveIrInput.d.ts +8 -0
  85. package/build/types/commands/ir/resolveIrInput.d.ts.map +1 -0
  86. package/build/types/commands/schema/registerSchemaCommands.d.ts.map +1 -1
  87. package/build/types/commands/schema/schemaIrHandler.d.ts +4 -3
  88. package/build/types/commands/schema/schemaIrHandler.d.ts.map +1 -1
  89. package/build/types/commands/types.d.ts +1 -3
  90. package/build/types/commands/types.d.ts.map +1 -1
  91. package/build/types/commands/utils/__tests__/buildPrefixRewriteFetch.test.d.ts.map +1 -0
  92. package/build/types/commands/{asset/assetDeployHandler.d.ts → utils/firstPartyPrefix.d.ts} +2 -11
  93. package/build/types/commands/utils/firstPartyPrefix.d.ts.map +1 -0
  94. package/build/types/utils/schema/__tests__/fixtures.d.ts +1 -0
  95. package/build/types/utils/schema/__tests__/fixtures.d.ts.map +1 -1
  96. package/build/types/utils/schema/generateInternalFromSchema.d.ts.map +1 -1
  97. package/build/types/utils/schema/generateModelMetadataFromSchema.d.ts.map +1 -1
  98. package/build/types/utils/schema/generateScopeFromSchema.d.ts.map +1 -1
  99. package/build/types/utils/schema/resolveSchemaChain.d.ts +13 -5
  100. package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -1
  101. package/package.json +3 -3
  102. package/build/esm/commands/asset/__tests__/buildPrefixRewriteFetch.test.js.map +0 -1
  103. package/build/esm/commands/asset/assetDeployHandler.js +0 -95
  104. package/build/esm/commands/asset/assetDeployHandler.js.map +0 -1
  105. package/build/esm/commands/asset/assetUpdateSchemaHandler.js.map +0 -1
  106. package/build/esm/commands/asset/registerAssetCommands.js +0 -24
  107. package/build/esm/commands/asset/registerAssetCommands.js.map +0 -1
  108. package/build/types/commands/asset/__tests__/buildPrefixRewriteFetch.test.d.ts.map +0 -1
  109. package/build/types/commands/asset/assetDeployHandler.d.ts.map +0 -1
  110. package/build/types/commands/asset/assetUpdateSchemaHandler.d.ts +0 -12
  111. package/build/types/commands/asset/assetUpdateSchemaHandler.d.ts.map +0 -1
  112. package/build/types/commands/asset/registerAssetCommands.d.ts +0 -3
  113. package/build/types/commands/asset/registerAssetCommands.d.ts.map +0 -1
  114. /package/build/types/commands/{asset → utils}/__tests__/buildPrefixRewriteFetch.test.d.ts +0 -0
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright 2026 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 { CommanderError } from "commander";
18
+ import { resolveMinVersion } from "../../utils/schema/resolveSchemaChain.js";
19
+ function isChainPayload(parsed) {
20
+ return typeof parsed === "object" && parsed != null && "chain" in parsed && Array.isArray(parsed.chain) && typeof parsed.latestVersion === "number";
21
+ }
22
+ function resolveFromChain(payload, irPath) {
23
+ if (payload.chain.length === 0) {
24
+ throw new CommanderError(1, "EINVAL", `Invalid IR chain payload at ${irPath}: 'chain' is empty`);
25
+ }
26
+ const {
27
+ latestVersion,
28
+ minVersion
29
+ } = resolveMinVersion(payload.chain, payload.minSupportedVersion);
30
+ const latestEntry = payload.chain.find(c => c.version === latestVersion);
31
+ if (latestEntry == null) {
32
+ throw new CommanderError(1, "EINVAL", `IR chain payload at ${irPath} has no entry matching latestVersion ${latestVersion}`);
33
+ }
34
+ return {
35
+ ir: latestEntry.ir,
36
+ latestVersion,
37
+ minSupportedVersion: minVersion
38
+ };
39
+ }
40
+ function resolveFromSingleIr(ir) {
41
+ return {
42
+ ir,
43
+ latestVersion: ir.version,
44
+ minSupportedVersion: ir.version
45
+ };
46
+ }
47
+ export function resolveIrInput(parsed, irPath) {
48
+ return isChainPayload(parsed) ? resolveFromChain(parsed, irPath) : resolveFromSingleIr(parsed);
49
+ }
50
+ //# sourceMappingURL=resolveIrInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveIrInput.js","names":["CommanderError","resolveMinVersion","isChainPayload","parsed","Array","isArray","chain","latestVersion","resolveFromChain","payload","irPath","length","minVersion","minSupportedVersion","latestEntry","find","c","version","ir","resolveFromSingleIr","resolveIrInput"],"sources":["resolveIrInput.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { CommanderError } from \"commander\";\nimport type { IRealTimeDocumentSchema } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { type IrChainPayload, resolveMinVersion } from \"../../utils/schema/resolveSchemaChain.js\";\n\nexport interface ResolvedIrInput {\n readonly ir: IRealTimeDocumentSchema;\n readonly latestVersion: number;\n readonly minSupportedVersion: number;\n}\n\nfunction isChainPayload(parsed: unknown): parsed is IrChainPayload {\n return (\n typeof parsed === \"object\"\n && parsed != null\n && \"chain\" in parsed\n && Array.isArray((parsed as IrChainPayload).chain)\n && typeof (parsed as IrChainPayload).latestVersion === \"number\"\n );\n}\n\nfunction resolveFromChain(payload: IrChainPayload, irPath: string): ResolvedIrInput {\n if (payload.chain.length === 0) {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n `Invalid IR chain payload at ${irPath}: 'chain' is empty`,\n );\n }\n const { latestVersion, minVersion } = resolveMinVersion(\n payload.chain,\n payload.minSupportedVersion,\n );\n const latestEntry = payload.chain.find(c => c.version === latestVersion);\n if (latestEntry == null) {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n `IR chain payload at ${irPath} has no entry matching latestVersion ${latestVersion}`,\n );\n }\n return { ir: latestEntry.ir, latestVersion, minSupportedVersion: minVersion };\n}\n\nfunction resolveFromSingleIr(ir: IRealTimeDocumentSchema): ResolvedIrInput {\n return { ir, latestVersion: ir.version, minSupportedVersion: ir.version };\n}\n\nexport function resolveIrInput(parsed: unknown, irPath: string): ResolvedIrInput {\n return isChainPayload(parsed)\n ? resolveFromChain(parsed, irPath)\n : resolveFromSingleIr(parsed as IRealTimeDocumentSchema);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,WAAW;AAE1C,SAA8BC,iBAAiB,QAAQ,0CAA0C;AA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mB,CAAChB,MAAiC,CAAC;AAC5D","ignoreList":[]}
@@ -19,6 +19,6 @@ import { schemaToYamlHandler } from "./schemaToYamlHandler.js";
19
19
  export function registerSchemaCommands(program) {
20
20
  const schemaCmd = program.command("schema").description("Commands for working with TypeScript schema definitions");
21
21
  schemaCmd.command("yaml").description("Convert TypeScript schema to YAML migration steps").requiredOption("-i, --input <file>", "Input TypeScript schema file").requiredOption("-o, --output <file>", "Output YAML file").action(schemaToYamlHandler);
22
- schemaCmd.command("ir").description("Resolve a TypeScript schema module to a versioned IR chain JSON file").requiredOption("-i, --input <file>", "Input TypeScript/JavaScript schema module").requiredOption("-o, --output <file>", "Output IR chain JSON file").requiredOption("--config <file>", "Path to the SDK's pack-config JSON file. Its optional 'minSupportedVersion' field declares the oldest schema version this SDK supports; omit the field to track latest only.").action(schemaIrHandler);
22
+ schemaCmd.command("ir").description("Resolve a TypeScript schema module to a versioned IR chain JSON file").requiredOption("-i, --input <file>", "Input TypeScript/JavaScript schema module").requiredOption("-o, --output <file>", "Output IR chain JSON file").requiredOption("--config <file>", "Path to the SDK's pack-config JSON file. Its optional 'minSupportedVersion' field declares the oldest schema version this SDK supports; omit the field to track latest only.").option("--max-version <version>", "Generate an IR chain capped at this schema version").action(schemaIrHandler);
23
23
  }
24
24
  //# sourceMappingURL=registerSchemaCommands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerSchemaCommands.js","names":["schemaIrHandler","schemaToYamlHandler","registerSchemaCommands","program","schemaCmd","command","description","requiredOption","action"],"sources":["registerSchemaCommands.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 { Command } from \"commander\";\nimport { schemaIrHandler } from \"./schemaIrHandler.js\";\nimport { schemaToYamlHandler } from \"./schemaToYamlHandler.js\";\n\nexport function registerSchemaCommands(program: Command): void {\n const schemaCmd = program\n .command(\"schema\")\n .description(\"Commands for working with TypeScript schema definitions\");\n\n schemaCmd\n .command(\"yaml\")\n .description(\"Convert TypeScript schema to YAML migration steps\")\n .requiredOption(\"-i, --input <file>\", \"Input TypeScript schema file\")\n .requiredOption(\"-o, --output <file>\", \"Output YAML file\")\n .action(schemaToYamlHandler);\n\n schemaCmd\n .command(\"ir\")\n .description(\"Resolve a TypeScript schema module to a versioned IR chain JSON file\")\n .requiredOption(\"-i, --input <file>\", \"Input TypeScript/JavaScript schema module\")\n .requiredOption(\"-o, --output <file>\", \"Output IR chain JSON file\")\n .requiredOption(\n \"--config <file>\",\n \"Path to the SDK's pack-config JSON file. Its optional 'minSupportedVersion' field declares the oldest schema version this SDK supports; omit the field to track latest only.\",\n )\n .action(schemaIrHandler);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,OAAO,SAASC,sBAAsBA,CAACC,OAAgB,EAAQ;EAC7D,MAAMC,SAAS,GAAGD,OAAO,CACtBE,OAAO,CAAC,QAAQ,CAAC,CACjBC,WAAW,CAAC,yDAAyD,CAAC;EAEzEF,SAAS,CACNC,OAAO,CAAC,MAAM,CAAC,CACfC,WAAW,CAAC,mDAAmD,CAAC,CAChEC,cAAc,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CACpEA,cAAc,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CACzDC,MAAM,CAACP,mBAAmB,CAAC;EAE9BG,SAAS,CACNC,OAAO,CAAC,IAAI,CAAC,CACbC,WAAW,CAAC,sEAAsE,CAAC,CACnFC,cAAc,CAAC,oBAAoB,EAAE,2CAA2C,CAAC,CACjFA,cAAc,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAClEA,cAAc,CACb,iBAAiB,EACjB,8KACF,CAAC,CACAC,MAAM,CAACR,eAAe,CAAC;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"registerSchemaCommands.js","names":["schemaIrHandler","schemaToYamlHandler","registerSchemaCommands","program","schemaCmd","command","description","requiredOption","action","option"],"sources":["registerSchemaCommands.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 { Command } from \"commander\";\nimport { schemaIrHandler } from \"./schemaIrHandler.js\";\nimport { schemaToYamlHandler } from \"./schemaToYamlHandler.js\";\n\nexport function registerSchemaCommands(program: Command): void {\n const schemaCmd = program\n .command(\"schema\")\n .description(\"Commands for working with TypeScript schema definitions\");\n\n schemaCmd\n .command(\"yaml\")\n .description(\"Convert TypeScript schema to YAML migration steps\")\n .requiredOption(\"-i, --input <file>\", \"Input TypeScript schema file\")\n .requiredOption(\"-o, --output <file>\", \"Output YAML file\")\n .action(schemaToYamlHandler);\n\n schemaCmd\n .command(\"ir\")\n .description(\"Resolve a TypeScript schema module to a versioned IR chain JSON file\")\n .requiredOption(\"-i, --input <file>\", \"Input TypeScript/JavaScript schema module\")\n .requiredOption(\"-o, --output <file>\", \"Output IR chain JSON file\")\n .requiredOption(\n \"--config <file>\",\n \"Path to the SDK's pack-config JSON file. Its optional 'minSupportedVersion' field declares the oldest schema version this SDK supports; omit the field to track latest only.\",\n )\n .option(\n \"--max-version <version>\",\n \"Generate an IR chain capped at this schema version\",\n )\n .action(schemaIrHandler);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,OAAO,SAASC,sBAAsBA,CAACC,OAAgB,EAAQ;EAC7D,MAAMC,SAAS,GAAGD,OAAO,CACtBE,OAAO,CAAC,QAAQ,CAAC,CACjBC,WAAW,CAAC,yDAAyD,CAAC;EAEzEF,SAAS,CACNC,OAAO,CAAC,MAAM,CAAC,CACfC,WAAW,CAAC,mDAAmD,CAAC,CAChEC,cAAc,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CACpEA,cAAc,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CACzDC,MAAM,CAACP,mBAAmB,CAAC;EAE9BG,SAAS,CACNC,OAAO,CAAC,IAAI,CAAC,CACbC,WAAW,CAAC,sEAAsE,CAAC,CACnFC,cAAc,CAAC,oBAAoB,EAAE,2CAA2C,CAAC,CACjFA,cAAc,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAClEA,cAAc,CACb,iBAAiB,EACjB,8KACF,CAAC,CACAE,MAAM,CACL,yBAAyB,EACzB,oDACF,CAAC,CACAD,MAAM,CAACR,eAAe,CAAC;AAC5B","ignoreList":[]}
@@ -54,6 +54,15 @@ export async function readPackConfig(configPath) {
54
54
  minSupportedVersion
55
55
  };
56
56
  }
57
+ function parseMaxVersion(maxVersion) {
58
+ if (maxVersion == null) {
59
+ return undefined;
60
+ }
61
+ if (!/^[1-9]\d*$/.test(maxVersion)) {
62
+ throw new Error(`--max-version must be a positive integer, got: ${JSON.stringify(maxVersion)}`);
63
+ }
64
+ return Number(maxVersion);
65
+ }
57
66
 
58
67
  /**
59
68
  * Resolve a TypeScript schema module to a versioned IR chain JSON file.
@@ -78,9 +87,9 @@ export async function readPackConfig(configPath) {
78
87
  * downstream tools default to supporting only the latest schema version.
79
88
  *
80
89
  * Note: this is distinct from the legacy single-version IR JSON consumed by
81
- * `ir deploy` / `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain,
82
- * no migrations). Tools that previously read that format should pick the
83
- * entry matching `latestVersion` from `chain` and use its `ir` field.
90
+ * `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain, no migrations).
91
+ * Tools that previously read that format should pick the entry matching
92
+ * `latestVersion` from `chain` and use its `ir` field.
84
93
  */
85
94
  export async function schemaIrHandler(options) {
86
95
  const {
@@ -88,6 +97,7 @@ export async function schemaIrHandler(options) {
88
97
  output,
89
98
  config
90
99
  } = options;
100
+ const maxVersion = parseMaxVersion(options.maxVersion);
91
101
  const {
92
102
  documentTypeName,
93
103
  documentTypeDescription,
@@ -105,7 +115,7 @@ export async function schemaIrHandler(options) {
105
115
  } = resolveSchemaChain(schema, minSupportedVersion, {
106
116
  name: documentTypeName,
107
117
  description: documentTypeDescription
108
- });
118
+ }, maxVersion);
109
119
  const outputPath = path.resolve(output);
110
120
  await fs.ensureDir(path.dirname(outputPath));
111
121
  const payload = {
@@ -1 +1 @@
1
- {"version":3,"file":"schemaIrHandler.js","names":["consola","fs","path","GENERATED_JSON_COMMENT","loadSchemaModule","resolveSchemaChain","assertNonEmptyString","value","field","configPath","trim","Error","JSON","stringify","readRequiredNonEmptyString","readPackConfig","resolvedConfigPath","resolve","pathExists","config","readJson","documentTypeName","documentTypeDescription","minSupportedVersion","rawMin","Number","isInteger","schemaIrHandler","options","input","output","warn","info","schema","chain","latestVersion","name","description","outputPath","ensureDir","dirname","payload","__comment","writeFile","success","length"],"sources":["schemaIrHandler.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { consola } from \"consola\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { loadSchemaModule } from \"../../utils/schema/loadSchemaModule.js\";\nimport { resolveSchemaChain } from \"../../utils/schema/resolveSchemaChain.js\";\n\ninterface SchemaIrOptions {\n input: string;\n output: string;\n config: string;\n}\n\ninterface PackConfigLike {\n documentTypeName?: unknown;\n documentTypeDescription?: unknown;\n minSupportedVersion?: unknown;\n}\n\ninterface PackConfigValues {\n readonly documentTypeName: string;\n readonly documentTypeDescription: string;\n readonly minSupportedVersion?: number;\n}\n\nfunction assertNonEmptyString(value: unknown, field: string, configPath: string): string {\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw new Error(\n `'${field}' in ${configPath} must be a non-empty string, got: ${JSON.stringify(value)}`,\n );\n }\n return value;\n}\n\nfunction readRequiredNonEmptyString(\n value: unknown,\n field: string,\n configPath: string,\n): string {\n if (value == null) {\n throw new Error(\n `'${field}' is required in ${configPath} and must be a non-empty string`,\n );\n }\n return assertNonEmptyString(value, field, configPath);\n}\n\nexport async function readPackConfig(configPath: string): Promise<PackConfigValues> {\n const resolvedConfigPath = path.resolve(configPath);\n if (!(await fs.pathExists(resolvedConfigPath))) {\n throw new Error(`--config file not found: ${resolvedConfigPath}`);\n }\n const config = (await fs.readJson(resolvedConfigPath)) as PackConfigLike;\n\n const documentTypeName = readRequiredNonEmptyString(\n config.documentTypeName,\n \"documentTypeName\",\n resolvedConfigPath,\n );\n\n const documentTypeDescription = readRequiredNonEmptyString(\n config.documentTypeDescription,\n \"documentTypeDescription\",\n resolvedConfigPath,\n );\n\n let minSupportedVersion: number | undefined;\n const rawMin = config.minSupportedVersion;\n if (rawMin != null) {\n if (typeof rawMin !== \"number\" || !Number.isInteger(rawMin) || rawMin <= 0) {\n throw new Error(\n `'minSupportedVersion' in ${resolvedConfigPath} must be a positive integer, got: ${\n JSON.stringify(rawMin)\n }`,\n );\n }\n minSupportedVersion = rawMin;\n }\n\n return { documentTypeName, documentTypeDescription, minSupportedVersion };\n}\n\n/**\n * Resolve a TypeScript schema module to a versioned IR chain JSON file.\n *\n * The output is a `{ latestVersion, minSupportedVersion?, chain }` payload\n * where each entry is `{ version, ir, migrations? }` and `ir` is a\n * single-version `IRealTimeDocumentSchema`. This is the input format for\n * `ir gen-types` and `ir asset`.\n *\n * `--config <pack-config.json>` is required: the pack-config is the single\n * source of truth for document-type identity. Required fields:\n * - `documentTypeName`: the document type name embedded into each chain\n * entry's IR (and surfaced as `documentTypeName` by `ir asset`).\n * - `documentTypeDescription`: document type description embedded into each\n * chain entry's IR.\n * Optional fields:\n * - `minSupportedVersion`: declares the oldest version this SDK supports;\n * when set, it must match one of the chain entries' `version` values and is\n * embedded as `minSupportedVersion` in the payload so downstream consumers\n * (`ir gen-types`, `ir asset`) read the same value. Omitting the field is\n * an explicit opt-out: the IR will not include `minSupportedVersion` and\n * downstream tools default to supporting only the latest schema version.\n *\n * Note: this is distinct from the legacy single-version IR JSON consumed by\n * `ir deploy` / `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain,\n * no migrations). Tools that previously read that format should pick the\n * entry matching `latestVersion` from `chain` and use its `ir` field.\n */\nexport async function schemaIrHandler(options: SchemaIrOptions): Promise<void> {\n const { input, output, config } = options;\n const { documentTypeName, documentTypeDescription, minSupportedVersion } = await readPackConfig(\n config,\n );\n\n if (minSupportedVersion == null) {\n consola.warn(\n `--config ${\n path.resolve(config)\n } does not set 'minSupportedVersion'. The generated IR will not include it, so downstream tools (ir gen-types, ir asset) will default to supporting only the latest schema version. Add 'minSupportedVersion' to your pack-config to enable back-compat.`,\n );\n }\n\n consola.info(`Loading schema from: ${input}`);\n const schema = await loadSchemaModule(input);\n\n consola.info(\"Resolving versioned IR chain...\");\n const { chain, latestVersion } = resolveSchemaChain(schema, minSupportedVersion, {\n name: documentTypeName,\n description: documentTypeDescription,\n });\n\n const outputPath = path.resolve(output);\n await fs.ensureDir(path.dirname(outputPath));\n\n const payload = {\n __comment: GENERATED_JSON_COMMENT,\n latestVersion,\n ...(minSupportedVersion != null ? { minSupportedVersion } : {}),\n chain,\n };\n await fs.writeFile(outputPath, JSON.stringify(payload, null, 2) + \"\\n\", \"utf8\");\n\n consola.success(\n `Wrote IR chain (${chain.length} version(s), min=${\n minSupportedVersion ?? latestVersion\n }, max=${latestVersion}) to: ${outputPath}`,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAOC,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,gBAAgB,QAAQ,wCAAwC;AACzE,SAASC,kBAAkB,QAAQ,0CAA0C;AAoB7E,SAASC,oBAAoBA,CAACC,KAAc,EAAEC,KAAa,EAAEC,UAAkB,EAAU;EACvF,IAAI,OAAOF,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACpD,MAAM,IAAIC,KAAK,CACb,IAAIH,KAAK,QAAQC,UAAU,qCAAqCG,IAAI,CAACC,SAAS,CAACN,KAAK,CAAC,EACvF,CAAC;EACH;EACA,OAAOA,KAAK;AACd;AAEA,SAASO,0BAA0BA,CACjCP,KAAc,EACdC,KAAa,EACbC,UAAkB,EACV;EACR,IAAIF,KAAK,IAAI,IAAI,EAAE;IACjB,MAAM,IAAII,KAAK,CACb,IAAIH,KAAK,oBAAoBC,UAAU,iCACzC,CAAC;EACH;EACA,OAAOH,oBAAoB,CAACC,KAAK,EAA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"version":3,"file":"schemaIrHandler.js","names":["consola","fs","path","GENERATED_JSON_COMMENT","loadSchemaModule","resolveSchemaChain","assertNonEmptyString","value","field","configPath","trim","Error","JSON","stringify","readRequiredNonEmptyString","readPackConfig","resolvedConfigPath","resolve","pathExists","config","readJson","documentTypeName","documentTypeDescription","minSupportedVersion","rawMin","Number","isInteger","parseMaxVersion","maxVersion","undefined","test","schemaIrHandler","options","input","output","warn","info","schema","chain","latestVersion","name","description","outputPath","ensureDir","dirname","payload","__comment","writeFile","success","length"],"sources":["schemaIrHandler.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { consola } from \"consola\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { loadSchemaModule } from \"../../utils/schema/loadSchemaModule.js\";\nimport { resolveSchemaChain } from \"../../utils/schema/resolveSchemaChain.js\";\n\ninterface SchemaIrOptions {\n input: string;\n output: string;\n config: string;\n maxVersion?: string;\n}\n\ninterface PackConfigLike {\n documentTypeName?: unknown;\n documentTypeDescription?: unknown;\n minSupportedVersion?: unknown;\n}\n\ninterface PackConfigValues {\n readonly documentTypeName: string;\n readonly documentTypeDescription: string;\n readonly minSupportedVersion?: number;\n}\n\nfunction assertNonEmptyString(value: unknown, field: string, configPath: string): string {\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw new Error(\n `'${field}' in ${configPath} must be a non-empty string, got: ${JSON.stringify(value)}`,\n );\n }\n return value;\n}\n\nfunction readRequiredNonEmptyString(\n value: unknown,\n field: string,\n configPath: string,\n): string {\n if (value == null) {\n throw new Error(\n `'${field}' is required in ${configPath} and must be a non-empty string`,\n );\n }\n return assertNonEmptyString(value, field, configPath);\n}\n\nexport async function readPackConfig(configPath: string): Promise<PackConfigValues> {\n const resolvedConfigPath = path.resolve(configPath);\n if (!(await fs.pathExists(resolvedConfigPath))) {\n throw new Error(`--config file not found: ${resolvedConfigPath}`);\n }\n const config = (await fs.readJson(resolvedConfigPath)) as PackConfigLike;\n\n const documentTypeName = readRequiredNonEmptyString(\n config.documentTypeName,\n \"documentTypeName\",\n resolvedConfigPath,\n );\n\n const documentTypeDescription = readRequiredNonEmptyString(\n config.documentTypeDescription,\n \"documentTypeDescription\",\n resolvedConfigPath,\n );\n\n let minSupportedVersion: number | undefined;\n const rawMin = config.minSupportedVersion;\n if (rawMin != null) {\n if (typeof rawMin !== \"number\" || !Number.isInteger(rawMin) || rawMin <= 0) {\n throw new Error(\n `'minSupportedVersion' in ${resolvedConfigPath} must be a positive integer, got: ${\n JSON.stringify(rawMin)\n }`,\n );\n }\n minSupportedVersion = rawMin;\n }\n\n return { documentTypeName, documentTypeDescription, minSupportedVersion };\n}\n\nfunction parseMaxVersion(maxVersion: string | undefined): number | undefined {\n if (maxVersion == null) {\n return undefined;\n }\n\n if (!/^[1-9]\\d*$/.test(maxVersion)) {\n throw new Error(\n `--max-version must be a positive integer, got: ${JSON.stringify(maxVersion)}`,\n );\n }\n\n return Number(maxVersion);\n}\n\n/**\n * Resolve a TypeScript schema module to a versioned IR chain JSON file.\n *\n * The output is a `{ latestVersion, minSupportedVersion?, chain }` payload\n * where each entry is `{ version, ir, migrations? }` and `ir` is a\n * single-version `IRealTimeDocumentSchema`. This is the input format for\n * `ir gen-types` and `ir asset`.\n *\n * `--config <pack-config.json>` is required: the pack-config is the single\n * source of truth for document-type identity. Required fields:\n * - `documentTypeName`: the document type name embedded into each chain\n * entry's IR (and surfaced as `documentTypeName` by `ir asset`).\n * - `documentTypeDescription`: document type description embedded into each\n * chain entry's IR.\n * Optional fields:\n * - `minSupportedVersion`: declares the oldest version this SDK supports;\n * when set, it must match one of the chain entries' `version` values and is\n * embedded as `minSupportedVersion` in the payload so downstream consumers\n * (`ir gen-types`, `ir asset`) read the same value. Omitting the field is\n * an explicit opt-out: the IR will not include `minSupportedVersion` and\n * downstream tools default to supporting only the latest schema version.\n *\n * Note: this is distinct from the legacy single-version IR JSON consumed by\n * `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain, no migrations).\n * Tools that previously read that format should pick the entry matching\n * `latestVersion` from `chain` and use its `ir` field.\n */\nexport async function schemaIrHandler(options: SchemaIrOptions): Promise<void> {\n const { input, output, config } = options;\n const maxVersion = parseMaxVersion(options.maxVersion);\n const { documentTypeName, documentTypeDescription, minSupportedVersion } = await readPackConfig(\n config,\n );\n\n if (minSupportedVersion == null) {\n consola.warn(\n `--config ${\n path.resolve(config)\n } does not set 'minSupportedVersion'. The generated IR will not include it, so downstream tools (ir gen-types, ir asset) will default to supporting only the latest schema version. Add 'minSupportedVersion' to your pack-config to enable back-compat.`,\n );\n }\n\n consola.info(`Loading schema from: ${input}`);\n const schema = await loadSchemaModule(input);\n\n consola.info(\"Resolving versioned IR chain...\");\n const { chain, latestVersion } = resolveSchemaChain(\n schema,\n minSupportedVersion,\n {\n name: documentTypeName,\n description: documentTypeDescription,\n },\n maxVersion,\n );\n\n const outputPath = path.resolve(output);\n await fs.ensureDir(path.dirname(outputPath));\n\n const payload = {\n __comment: GENERATED_JSON_COMMENT,\n latestVersion,\n ...(minSupportedVersion != null ? { minSupportedVersion } : {}),\n chain,\n };\n await fs.writeFile(outputPath, JSON.stringify(payload, null, 2) + \"\\n\", \"utf8\");\n\n consola.success(\n `Wrote IR chain (${chain.length} version(s), min=${\n minSupportedVersion ?? latestVersion\n }, max=${latestVersion}) to: ${outputPath}`,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAC;EAED,IAAII,mBAAmB,IAAI,IAAI,EAAE;IAC/BvB,OAAO,CAACmC,IAAI,CACV,YACEjC,IAAI,CAACe,OAAO,CAACE,MAAM,CAAC,yPAExB,CAAC;EACH;EAEAnB,OAAO,CAACoC,IAAI,CAAC,wBAAwBH,KAAK,EAAE,CAAC;EAC7C,MAAMI,MAAM,GAAG,MAAMjC,gBAAgB,CAAC6B,KAAK,CAAC;EAE5CjC,OAAO,CAACoC,IAAI,CAAC,iCAAiC,CAAC;EAC/C,MAAM;IAAEE,KAAK;IAAEC;EAAc,CAAC,GAAGlC,kBAAkB,CACjDgC,MAAM,EACNd,mBAAmB,EACnB;IACEiB,IAAI,EAAEnB,gBAAgB;IACtBoB,WAAW,EAAEnB;EACf,CAAC,EACDM,UACF,CAAC;EAED,MAAMc,UAAU,GAAGxC,IAAI,CAACe,OAAO,CAACiB,MAAM,CAAC;EACvC,MAAMjC,EAAE,CAAC0C,SAAS,CAACzC,IAAI,CAAC0C,OAAO,CAACF,UAAU,CAAC,CAAC;EAE5C,MAAMG,OAAO,GAAG;IACdC,SAAS,EAAE3C,sBAAsB;IACjCoC,aAAa;IACb,IAAIhB,mBAAmB,IAAI,IAAI,GAAG;MAAEA;IAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/De;EACF,CAAC;EACD,MAAMrC,EAAE,CAAC8C,SAAS,CAACL,UAAU,EAAE9B,IAAI,CAACC,SAAS,CAACgC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC;EAE/E7C,OAAO,CAACgD,OAAO,CACb,mBAAmBV,KAAK,CAACW,MAAM,oBAC7B1B,mBAAmB,IAAIgB,aAAa,SAC7BA,aAAa,SAASG,UAAU,EAC3C,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["types.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 { DocumentTypeSchema } from \"@osdk/foundry.pack\";\n\nexport type FileSystemType = \"ARTIFACTS\" | \"COMPASS\";\n\nexport interface DocumentTypeAsset {\n readonly documentTypeName: string;\n readonly documentStorageType: {\n readonly type: \"yjs\";\n readonly yjs: {\n readonly schema: DocumentTypeSchema;\n };\n };\n readonly fileSystemType: FileSystemType;\n readonly schemaVersion: number;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.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 { DocumentTypeSchema } from \"@osdk/foundry.pack\";\n\nexport type FileSystemType = \"ARTIFACTS\" | \"COMPASS\";\n\nexport interface DocumentTypeAsset {\n readonly documentTypeName: string;\n readonly documentStorageType: {\n readonly type: \"yjs\";\n readonly schema: DocumentTypeSchema;\n };\n readonly fileSystemType: FileSystemType;\n readonly schemaVersion: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
18
- import { buildPrefixRewriteFetch } from "../assetDeployHandler.js";
18
+ import { buildPrefixRewriteFetch } from "../firstPartyPrefix.js";
19
19
  describe("buildPrefixRewriteFetch", () => {
20
20
  const originalFetch = globalThis.fetch;
21
21
  let fetchSpy;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildPrefixRewriteFetch.test.js","names":["afterEach","beforeEach","describe","expect","it","vi","buildPrefixRewriteFetch","originalFetch","globalThis","fetch","fetchSpy","fn","Promise","resolve","Response","status","calledUrl","arg","mock","calls","url","wrapped","toBe","method","headers","body","JSON","stringify","hello","req","get","text","resolves","toThrow"],"sources":["buildPrefixRewriteFetch.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 { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { buildPrefixRewriteFetch } from \"../firstPartyPrefix.js\";\n\ndescribe(\"buildPrefixRewriteFetch\", () => {\n const originalFetch = globalThis.fetch;\n let fetchSpy: ReturnType<typeof vi.fn>;\n\n beforeEach(() => {\n fetchSpy = vi.fn(() => Promise.resolve(new Response(null, { status: 204 })));\n globalThis.fetch = fetchSpy as unknown as typeof globalThis.fetch;\n });\n\n afterEach(() => {\n globalThis.fetch = originalFetch;\n });\n\n function calledUrl(): string {\n const arg = fetchSpy.mock.calls[0]![0] as Request;\n return arg.url;\n }\n\n it(\"rewrites /api/foo to /api/gotham/foo\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api/foo\");\n expect(calledUrl()).toBe(\"https://stack.example.com/api/gotham/foo\");\n });\n\n it(\"rewrites bare /api to /api/gotham\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api\");\n expect(calledUrl()).toBe(\"https://stack.example.com/api/gotham\");\n });\n\n it(\"preserves query strings on rewritten requests\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api/foo?x=1&y=2\");\n expect(calledUrl()).toBe(\"https://stack.example.com/api/gotham/foo?x=1&y=2\");\n });\n\n it(\"does not rewrite paths that only share the /api prefix string\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/apiother/foo\");\n expect(calledUrl()).toBe(\"https://stack.example.com/apiother/foo\");\n });\n\n it(\"does not rewrite non-/api paths\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/healthz\");\n expect(calledUrl()).toBe(\"https://stack.example.com/healthz\");\n });\n\n it(\"forwards method and headers from the original request\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api/foo\", {\n method: \"POST\",\n headers: { \"x-custom\": \"value\" },\n body: JSON.stringify({ hello: \"world\" }),\n });\n const req = fetchSpy.mock.calls[0]![0] as Request;\n expect(req.method).toBe(\"POST\");\n expect(req.headers.get(\"x-custom\")).toBe(\"value\");\n await expect(req.text()).resolves.toBe(JSON.stringify({ hello: \"world\" }));\n });\n\n it(\"throws on an unsupported prefix\", () => {\n expect(() => buildPrefixRewriteFetch(\"/api/other\")).toThrow(\n /Unsupported first-party prefix/,\n );\n });\n\n it(\"throws on a prefix missing the leading slash\", () => {\n expect(() => buildPrefixRewriteFetch(\"api/gotham\")).toThrow(\n /Unsupported first-party prefix/,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,UAAU,EAAEC,QAA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G,CAACE,IAAI,CAAC,CAAC,CAAC,CAACC,QAAQ,CAACV,IAAI,CAACI,IAAI,CAACC,SAAS,CAAC;MAAEC,KAAK,EAAE;IAAQ,CAAC,CAAC,CAAC;EAC5E,CAAC,CAAC;EAEFxB,EAAE,CAAC,iCAAiC,EAAE,MAAM;IAC1CD,MAAM,CAAC,MAAMG,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC2B,OAAO,CACzD,gCACF,CAAC;EACH,CAAC,CAAC;EAEF7B,EAAE,CAAC,8CAA8C,EAAE,MAAM;IACvDD,MAAM,CAAC,MAAMG,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC2B,OAAO,CACzD,gCACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Copyright 2026 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
+ export const DEFAULT_API_PREFIX = "/api";
18
+
19
+ /**
20
+ * The set of API prefixes that `--first-party-prefix` is allowed to rewrite to.
21
+ * Only `/api/gotham` is supported today; expand this list as new gateways are added.
22
+ */
23
+ export const ALLOWED_FIRST_PARTY_PREFIXES = ["/api/gotham"];
24
+
25
+ /**
26
+ * Builds a fetch wrapper that rewrites the OSDK client's `/api/...` requests
27
+ * to a different prefix (e.g. `/api/gotham`). Used for stacks where the
28
+ * endpoint is served behind a different gateway path instead
29
+ * of the default `/api` route.
30
+ *
31
+ * Throws if `prefix` is not one of {@link ALLOWED_FIRST_PARTY_PREFIXES}.
32
+ */
33
+ export function buildPrefixRewriteFetch(prefix) {
34
+ if (!ALLOWED_FIRST_PARTY_PREFIXES.includes(prefix)) {
35
+ throw new Error(`Unsupported first-party prefix '${prefix}'. Allowed values: ${ALLOWED_FIRST_PARTY_PREFIXES.join(", ")}`);
36
+ }
37
+ return (input, init) => {
38
+ const req = new Request(input, init);
39
+ const url = new URL(req.url);
40
+ if (url.pathname !== DEFAULT_API_PREFIX && !url.pathname.startsWith(`${DEFAULT_API_PREFIX}/`)) {
41
+ return globalThis.fetch(req);
42
+ }
43
+ url.pathname = prefix + url.pathname.slice(DEFAULT_API_PREFIX.length);
44
+ return globalThis.fetch(new Request(url, req));
45
+ };
46
+ }
47
+ //# sourceMappingURL=firstPartyPrefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firstPartyPrefix.js","names":["DEFAULT_API_PREFIX","ALLOWED_FIRST_PARTY_PREFIXES","buildPrefixRewriteFetch","prefix","includes","Error","join","input","init","req","Request","url","URL","pathname","startsWith","globalThis","fetch","slice","length"],"sources":["firstPartyPrefix.ts"],"sourcesContent":["/*\n * Copyright 2026 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 const DEFAULT_API_PREFIX = \"/api\";\n\n/**\n * The set of API prefixes that `--first-party-prefix` is allowed to rewrite to.\n * Only `/api/gotham` is supported today; expand this list as new gateways are added.\n */\nexport const ALLOWED_FIRST_PARTY_PREFIXES = [\"/api/gotham\"] as const;\n\n/**\n * Builds a fetch wrapper that rewrites the OSDK client's `/api/...` requests\n * to a different prefix (e.g. `/api/gotham`). Used for stacks where the\n * endpoint is served behind a different gateway path instead\n * of the default `/api` route.\n *\n * Throws if `prefix` is not one of {@link ALLOWED_FIRST_PARTY_PREFIXES}.\n */\nexport function buildPrefixRewriteFetch(prefix: string): typeof globalThis.fetch {\n if (!(ALLOWED_FIRST_PARTY_PREFIXES as readonly string[]).includes(prefix)) {\n throw new Error(\n `Unsupported first-party prefix '${prefix}'. Allowed values: ${\n ALLOWED_FIRST_PARTY_PREFIXES.join(\", \")\n }`,\n );\n }\n return (input, init) => {\n const req = new Request(input, init);\n const url = new URL(req.url);\n if (\n url.pathname !== DEFAULT_API_PREFIX\n && !url.pathname.startsWith(`${DEFAULT_API_PREFIX}/`)\n ) {\n return globalThis.fetch(req);\n }\n url.pathname = prefix + url.pathname.slice(DEFAULT_API_PREFIX.length);\n return globalThis.fetch(new Request(url, req));\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,kBAAkB,GAAG,MAAM;;AAExC;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GAAG,CAAC,aAAa,CAAU;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,MAAc,EAA2B;EAC/E,IAAI,CAAEF,4BAA4B,CAAuBG,QAAQ,CAACD,MAAM,CAAC,EAAE;IACzE,MAAM,IAAIE,KAAK,CACb,mCAAmCF,MAAM,sBACvCF,4BAA4B,CAACK,IAAI,CAAC,IAAI,CAAC,EAE3C,CAAC;EACH;EACA,OAAO,CAACC,KAAK,EAAEC,IAAI,KAAK;IACtB,MAAMC,GAAG,GAAG,IAAIC,OAAO,CAACH,KAAK,EAAEC,IAAI,CAAC;IACpC,MAAMG,GAAG,GAAG,IAAIC,GAAG,CAACH,GAAG,CAACE,GAAG,CAAC;IAC5B,IACEA,GAAG,CAACE,QAAQ,KAAKb,kBAAkB,IAChC,CAACW,GAAG,CAACE,QAAQ,CAACC,UAAU,CAAC,GAAGd,kBAAkB,GAAG,CAAC,EACrD;MACA,OAAOe,UAAU,CAACC,KAAK,CAACP,GAAG,CAAC;IAC9B;IACAE,GAAG,CAACE,QAAQ,GAAGV,MAAM,GAAGQ,GAAG,CAACE,QAAQ,CAACI,KAAK,CAACjB,kBAAkB,CAACkB,MAAM,CAAC;IACrE,OAAOH,UAAU,CAACC,KAAK,CAAC,IAAIN,OAAO,CAACC,GAAG,EAAEF,GAAG,CAAC,CAAC;EAChD,CAAC;AACH","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
4
4
  import { AnimalCatSchema, AnimalDogSchema, AnimalSchema, CatSchema, DogSchema } from './schema.js';
@@ -1 +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.13.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
+ {"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.15.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,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
4
4
  import { EventSchema } from './schema.js';
@@ -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":["/* Generated by @palantir/pack.document-schema.type-gen@0.13.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
+ {"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.15.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,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
4
4
  import { PersonSchema } from './schema.js';
@@ -1 +1 @@
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.13.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
+ {"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.15.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,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { Metadata } from '@palantir/pack.document-schema.model-types';
4
4
  import { NodeObjectSchema, NodeSchema, NodeTextBoxSchema, ObjectNodeSchema, TextBoxSchema } from './schema.js';
@@ -1 +1 @@
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.13.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
+ {"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.15.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,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const ContainerSchema = z.object({
@@ -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":["/* Generated by @palantir/pack.document-schema.type-gen@0.13.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":[]}
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.15.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":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const FeatureSchema = z.object({
@@ -1 +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.13.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":[]}
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.15.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":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
2
2
 
3
3
  import { z } from 'zod';
4
4
  export const CatSchema = z.object({
@@ -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.13.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.15.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.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.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.13.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.15.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.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.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.13.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.15.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.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.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.13.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.15.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.13.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.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.13.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.15.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":[]}
@@ -2,7 +2,7 @@
2
2
  // documentType.ts
3
3
  // ============================================================
4
4
 
5
- /* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */
5
+ /* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */
6
6
 
7
7
  export const DOCUMENT_TYPE_NAME = 'Canvas Document Type';
8
8
  export const DOCUMENT_TYPE_DESCRIPTION = 'Document type description for demo canvas';
@@ -1 +1 @@
1
- {"version":3,"file":"with-name-and-description.js","names":["DOCUMENT_TYPE_NAME","DOCUMENT_TYPE_DESCRIPTION"],"sources":["with-name-and-description.ts"],"sourcesContent":["// ============================================================\n// documentType.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */\n\nexport const DOCUMENT_TYPE_NAME = 'Canvas Document Type';\nexport const DOCUMENT_TYPE_DESCRIPTION =\n 'Document type description for demo canvas';\n"],"mappings":"AAAA;AACA;AACA;;AAEA;;AAEA,OAAO,MAAMA,kBAAkB,GAAG,sBAAsB;AACxD,OAAO,MAAMC,yBAAyB,GACpC,2CAA2C","ignoreList":[]}
1
+ {"version":3,"file":"with-name-and-description.js","names":["DOCUMENT_TYPE_NAME","DOCUMENT_TYPE_DESCRIPTION"],"sources":["with-name-and-description.ts"],"sourcesContent":["// ============================================================\n// documentType.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */\n\nexport const DOCUMENT_TYPE_NAME = 'Canvas Document Type';\nexport const DOCUMENT_TYPE_DESCRIPTION =\n 'Document type description for demo canvas';\n"],"mappings":"AAAA;AACA;AACA;;AAEA;;AAEA,OAAO,MAAMA,kBAAkB,GAAG,sBAAsB;AACxD,OAAO,MAAMC,yBAAyB,GACpC,2CAA2C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"single-version.js","names":[],"sources":["single-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */\n\nexport type SupportedVersions = 1;\nexport type LatestVersion = 1;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"single-version.js","names":[],"sources":["single-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */\n\nexport type SupportedVersions = 1;\nexport type LatestVersion = 1;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"three-version-chain.js","names":[],"sources":["three-version-chain.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */\n\nexport type SupportedVersions = 1 | 2 | 3;\nexport type LatestVersion = 3;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"three-version-chain.js","names":[],"sources":["three-version-chain.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */\n\nexport type SupportedVersions = 1 | 2 | 3;\nexport type LatestVersion = 3;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"two-version.js","names":[],"sources":["two-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.13.0 */\n\nexport type SupportedVersions = 1 | 2;\nexport type LatestVersion = 2;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"two-version.js","names":[],"sources":["two-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.15.0 */\n\nexport type SupportedVersions = 1 | 2;\nexport type LatestVersion = 2;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
@@ -60,6 +60,17 @@ const addFillColorUpdate = defineSchemaUpdate("addFillColor", schema => ({
60
60
  }));
61
61
  export const twoVersionAdditiveSchema = nextSchema(singleVersionSchemaNarrow).addSchemaUpdate(addFillColorUpdate).build();
62
62
 
63
+ /**
64
+ * Two-version schema adding a *required* additive field. Drives the type
65
+ * generator down the path where `DocumentUpgradeFns` must include a zero-arg
66
+ * thunk for the new field — `() => Model__v<current>[field]`. Optional
67
+ * additive fields (above) are deliberately absent from `DocumentUpgradeFns`.
68
+ */
69
+ const addOpacityRequiredUpdate = defineSchemaUpdate("addOpacityRequired", schema => ({
70
+ ShapeBox: schema.ShapeBox.addField("opacity", P.Double).build()
71
+ }));
72
+ export const twoVersionRequiredAdditiveSchema = nextSchema(singleVersionSchemaNarrow).addSchemaUpdate(addOpacityRequiredUpdate).build();
73
+
63
74
  /** Schema with ref fields: tests import paths for record refs, DocumentRef, UserRef */
64
75
  const CircleRecord = defineRecord("Circle", {
65
76
  docs: "A circle",