@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
package/README.md CHANGED
@@ -53,6 +53,25 @@ Generate schemas from Intermediate Representation format:
53
53
  type-gen ir zod -s <schema.json> -r <records.json> -o <output.ts>
54
54
  ```
55
55
 
56
+ Deploy and update document types directly from an IR file (the wire schema and version are sourced
57
+ from the IR):
58
+
59
+ ```bash
60
+ # Create a third-party document type (default)
61
+ type-gen ir deploy -i <ir.json> -b <base-url> -a <token> -p <parent-folder-rid> [-f ARTIFACTS|COMPASS]
62
+
63
+ # Create a first-party document type
64
+ type-gen ir deploy -i <ir.json> -b <base-url> -a <token> --first-party -o <ontology-rid> \
65
+ [-f ARTIFACTS|COMPASS] [--first-party-prefix /api/gotham]
66
+
67
+ # Update an existing document type's schema
68
+ type-gen ir update-schema -i <ir.json> -b <base-url> -a <token> -o <ontology-rid> \
69
+ [--force-overwrite] [--first-party-prefix /api/gotham]
70
+ ```
71
+
72
+ `ir asset` (generate an asset JSON consumed by backpack's asset-track loader) remains available;
73
+ the deploy/update-schema REST commands are IR-sourced.
74
+
56
75
  ### Examples
57
76
 
58
77
  #### Generating TypeScript Types from YAML
package/build/esm/cli.js CHANGED
@@ -15,14 +15,12 @@
15
15
  */
16
16
 
17
17
  import { Command } from "commander";
18
- import { registerAssetCommands } from "./commands/asset/registerAssetCommands.js";
19
18
  import { registerIrCommands } from "./commands/ir/registerIrCommands.js";
20
19
  import { registerSchemaCommands } from "./commands/schema/registerSchemaCommands.js";
21
20
  import { registerStepsCommands } from "./commands/steps/registerStepsCommands.js";
22
21
  export function cli(args) {
23
22
  const program = new Command();
24
23
  program.name("document-schema-type-gen").description("Document schema type generation CLI").version("0.0.1");
25
- registerAssetCommands(program);
26
24
  registerIrCommands(program);
27
25
  registerSchemaCommands(program);
28
26
  registerStepsCommands(program);
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":["Command","registerAssetCommands","registerIrCommands","registerSchemaCommands","registerStepsCommands","cli","args","program","name","description","version","parse"],"sources":["cli.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 { Command } from \"commander\";\nimport { registerAssetCommands } from \"./commands/asset/registerAssetCommands.js\";\nimport { registerIrCommands } from \"./commands/ir/registerIrCommands.js\";\nimport { registerSchemaCommands } from \"./commands/schema/registerSchemaCommands.js\";\nimport { registerStepsCommands } from \"./commands/steps/registerStepsCommands.js\";\n\nexport function cli(args: string[]): void {\n const program = new Command();\n\n program\n .name(\"document-schema-type-gen\")\n .description(\"Document schema type generation CLI\")\n .version(\"0.0.1\");\n\n registerAssetCommands(program);\n registerIrCommands(program);\n registerSchemaCommands(program);\n registerStepsCommands(program);\n\n program.parse(args);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;AACnC,SAASC,qBAAqB,QAAQ,2CAA2C;AACjF,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,sBAAsB,QAAQ,6CAA6C;AACpF,SAASC,qBAAqB,QAAQ,2CAA2C;AAEjF,OAAO,SAASC,GAAGA,CAACC,IAAc,EAAQ;EACxC,MAAMC,OAAO,GAAG,IAAIP,OAAO,CAAC,CAAC;EAE7BO,OAAO,CACJC,IAAI,CAAC,0BAA0B,CAAC,CAChCC,WAAW,CAAC,qCAAqC,CAAC,CAClDC,OAAO,CAAC,OAAO,CAAC;EAEnBT,qBAAqB,CAACM,OAAO,CAAC;EAC9BL,kBAAkB,CAACK,OAAO,CAAC;EAC3BJ,sBAAsB,CAACI,OAAO,CAAC;EAC/BH,qBAAqB,CAACG,OAAO,CAAC;EAE9BA,OAAO,CAACI,KAAK,CAACL,IAAI,CAAC;AACrB","ignoreList":[]}
1
+ {"version":3,"file":"cli.js","names":["Command","registerIrCommands","registerSchemaCommands","registerStepsCommands","cli","args","program","name","description","version","parse"],"sources":["cli.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 { Command } from \"commander\";\nimport { registerIrCommands } from \"./commands/ir/registerIrCommands.js\";\nimport { registerSchemaCommands } from \"./commands/schema/registerSchemaCommands.js\";\nimport { registerStepsCommands } from \"./commands/steps/registerStepsCommands.js\";\n\nexport function cli(args: string[]): void {\n const program = new Command();\n\n program\n .name(\"document-schema-type-gen\")\n .description(\"Document schema type generation CLI\")\n .version(\"0.0.1\");\n\n registerIrCommands(program);\n registerSchemaCommands(program);\n registerStepsCommands(program);\n\n program.parse(args);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;AACnC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,sBAAsB,QAAQ,6CAA6C;AACpF,SAASC,qBAAqB,QAAQ,2CAA2C;AAEjF,OAAO,SAASC,GAAGA,CAACC,IAAc,EAAQ;EACxC,MAAMC,OAAO,GAAG,IAAIN,OAAO,CAAC,CAAC;EAE7BM,OAAO,CACJC,IAAI,CAAC,0BAA0B,CAAC,CAChCC,WAAW,CAAC,qCAAqC,CAAC,CAClDC,OAAO,CAAC,OAAO,CAAC;EAEnBR,kBAAkB,CAACK,OAAO,CAAC;EAC3BJ,sBAAsB,CAACI,OAAO,CAAC;EAC/BH,qBAAqB,CAACG,OAAO,CAAC;EAE9BA,OAAO,CAACI,KAAK,CAACL,IAAI,CAAC;AACrB","ignoreList":[]}
@@ -0,0 +1,88 @@
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 { describe, expect, it } from "vitest";
18
+ import { resolveIrInput } from "../resolveIrInput.js";
19
+ function ir(version) {
20
+ return {
21
+ name: `Test v${version}`,
22
+ description: "Test schema",
23
+ version,
24
+ primaryModelKeys: [],
25
+ models: {}
26
+ };
27
+ }
28
+ describe("resolveIrInput", () => {
29
+ it("passes through legacy single-version IR", () => {
30
+ const resolved = resolveIrInput(ir(2), "legacy.json");
31
+ expect(resolved).toEqual({
32
+ ir: ir(2),
33
+ latestVersion: 2,
34
+ minSupportedVersion: 2
35
+ });
36
+ });
37
+ it("selects the latest entry from a versioned IR chain", () => {
38
+ const resolved = resolveIrInput({
39
+ latestVersion: 3,
40
+ minSupportedVersion: 1,
41
+ chain: [{
42
+ version: 1,
43
+ ir: ir(1)
44
+ }, {
45
+ version: 3,
46
+ ir: ir(3)
47
+ }]
48
+ }, "chain.json");
49
+ expect(resolved).toEqual({
50
+ ir: ir(3),
51
+ latestVersion: 3,
52
+ minSupportedVersion: 1
53
+ });
54
+ });
55
+ it("defaults chain minSupportedVersion to latestVersion", () => {
56
+ const resolved = resolveIrInput({
57
+ latestVersion: 3,
58
+ chain: [{
59
+ version: 1,
60
+ ir: ir(1)
61
+ }, {
62
+ version: 3,
63
+ ir: ir(3)
64
+ }]
65
+ }, "chain.json");
66
+ expect(resolved.minSupportedVersion).toBe(3);
67
+ });
68
+ it("rejects an empty chain", () => {
69
+ expect(() => resolveIrInput({
70
+ latestVersion: 1,
71
+ chain: []
72
+ }, "empty.json")).toThrow("chain");
73
+ });
74
+ it("rejects a chain with an invalid minSupportedVersion", () => {
75
+ expect(() => resolveIrInput({
76
+ latestVersion: 3,
77
+ minSupportedVersion: 2,
78
+ chain: [{
79
+ version: 1,
80
+ ir: ir(1)
81
+ }, {
82
+ version: 3,
83
+ ir: ir(3)
84
+ }]
85
+ }, "missing.json")).toThrow("minSupportedVersion 2");
86
+ });
87
+ });
88
+ //# sourceMappingURL=resolveIrInput.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveIrInput.test.js","names":["describe","expect","it","resolveIrInput","ir","version","name","description","primaryModelKeys","models","resolved","toEqual","latestVersion","minSupportedVersion","chain","toBe","toThrow"],"sources":["resolveIrInput.test.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 { describe, expect, it } from \"vitest\";\nimport type { IRealTimeDocumentSchema } from \"../../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { resolveIrInput } from \"../resolveIrInput.js\";\n\nfunction ir(version: number): IRealTimeDocumentSchema {\n return {\n name: `Test v${version}`,\n description: \"Test schema\",\n version,\n primaryModelKeys: [],\n models: {},\n };\n}\n\ndescribe(\"resolveIrInput\", () => {\n it(\"passes through legacy single-version IR\", () => {\n const resolved = resolveIrInput(ir(2), \"legacy.json\");\n\n expect(resolved).toEqual({\n ir: ir(2),\n latestVersion: 2,\n minSupportedVersion: 2,\n });\n });\n\n it(\"selects the latest entry from a versioned IR chain\", () => {\n const resolved = resolveIrInput({\n latestVersion: 3,\n minSupportedVersion: 1,\n chain: [\n { version: 1, ir: ir(1) },\n { version: 3, ir: ir(3) },\n ],\n }, \"chain.json\");\n\n expect(resolved).toEqual({\n ir: ir(3),\n latestVersion: 3,\n minSupportedVersion: 1,\n });\n });\n\n it(\"defaults chain minSupportedVersion to latestVersion\", () => {\n const resolved = resolveIrInput({\n latestVersion: 3,\n chain: [\n { version: 1, ir: ir(1) },\n { version: 3, ir: ir(3) },\n ],\n }, \"chain.json\");\n\n expect(resolved.minSupportedVersion).toBe(3);\n });\n\n it(\"rejects an empty chain\", () => {\n expect(() =>\n resolveIrInput({\n latestVersion: 1,\n chain: [],\n }, \"empty.json\")\n ).toThrow(\"chain\");\n });\n\n it(\"rejects a chain with an invalid minSupportedVersion\", () => {\n expect(() =>\n resolveIrInput({\n latestVersion: 3,\n minSupportedVersion: 2,\n chain: [\n { version: 1, ir: ir(1) },\n { version: 3, ir: ir(3) },\n ],\n }, \"missing.json\")\n ).toThrow(\"minSupportedVersion 2\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,cAAc,QAAQ,sBAAsB;AAErD,SAASC,EAAEA,CAACC,OAAe,EAA2B;EACpD,OAAO;IACLC,IAAI,EAAE,SAASD,OAAO,EAAE;IACxBE,WAAW,EAAE,aAAa;IAC1BF,OAAO;IACPG,gBAAgB,EAAE,EAAE;IACpBC,MAAM,EAAE,CAAC;EACX,CAAC;AACH;AAEAT,QAAQ,CAAC,gBAAgB,EAAE,MAAM;EAC/BE,EAAE,CAAC,yCAAyC,EAAE,MAAM;IAClD,MAAMQ,QAAQ,GAAGP,cAAc,CAACC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC;IAErDH,MAAM,CAACS,QAAQ,CAAC,CAACC,OAAO,CAAC;MACvBP,EAAE,EAAEA,EAAE,CAAC,CAAC,CAAC;MACTQ,aAAa,EAAE,CAAC;MAChBC,mBAAmB,EAAE;IACvB,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFX,EAAE,CAAC,oDAAoD,EAAE,MAAM;IAC7D,MAAMQ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EAAE,CACL;QAAET,OAAO,EAAE,CAAC;QAAED,EAAE,EAAEA,EAAE,CAAC,CAAC;MAAE,CAAC,EACzB;QAAEC,OAAO,EAAE,CAAC;QAAED,EAAE,EAAEA,EAAE,CAAC,CAAC;MAAE,CAAC;IAE7B,CAAC,EAAE,cAAc,CACnB,CAAC,CAACY,OAAO,CAAC,uBAAuB,CAAC;EACpC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -14,38 +14,90 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { createPlatformClient } from "@osdk/client";
17
+ import { createPlatformClient, PalantirApiError } from "@osdk/client";
18
18
  import { DocumentTypes } from "@osdk/foundry.pack";
19
19
  import { CommanderError } from "commander";
20
20
  import { consola } from "consola";
21
21
  import { readFileSync } from "fs";
22
22
  import { resolve } from "path";
23
23
  import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
24
+ import { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from "../utils/firstPartyPrefix.js";
25
+ import { resolveIrInput } from "./resolveIrInput.js";
24
26
  export async function irDeployHandler(options) {
25
27
  try {
26
28
  const irPath = resolve(options.ir);
27
29
  consola.info(`Reading schema from: ${irPath}`);
28
- const irContent = readFileSync(irPath, "utf8");
29
-
30
- // TODO: conjureToZod based validation that IR content matches the conjure IR shape
31
- const ir = JSON.parse(irContent);
32
- const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));
30
+ const {
31
+ ir,
32
+ latestVersion
33
+ } = resolveIrInput(JSON.parse(readFileSync(irPath, "utf8")), irPath);
33
34
  const schema = convertIrToWireSchema(ir);
34
- const request = {
35
- name: ir.name,
36
- parentFolderRid: options.parentFolder,
37
- schema
38
- };
39
- if (options.fileSystemType != null) {
40
- request.fileSystemType = options.fileSystemType;
35
+ const fileSystemType = options.fileSystemType ?? "ARTIFACTS";
36
+ if (options.firstParty) {
37
+ await deployFirstParty(options, ir.name, schema, latestVersion, fileSystemType);
38
+ } else {
39
+ await deployThirdParty(options, ir.name, schema, fileSystemType);
41
40
  }
42
- consola.info("Creating document type with schema", request);
43
- await DocumentTypes.create(osdkClient, request, {
44
- preview: true
45
- });
46
41
  } catch (error) {
42
+ if (error instanceof CommanderError) {
43
+ throw error;
44
+ }
47
45
  consola.error("❌ Error during Deploy:", error);
48
46
  throw new CommanderError(1, "ERRIRMDEPLOY", "Error deploying IR document schema");
49
47
  }
50
48
  }
49
+ async function deployThirdParty(options, name, schema, fileSystemType) {
50
+ if (options.parentFolder == null) {
51
+ throw new CommanderError(1, "EINVAL", "--parent-folder is required when deploying a third-party document type");
52
+ }
53
+ const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));
54
+ const request = {
55
+ name,
56
+ parentFolderRid: options.parentFolder,
57
+ schema,
58
+ fileSystemType
59
+ };
60
+ consola.info("Creating document type with schema", request);
61
+ const result = await DocumentTypes.create(osdkClient, request, {
62
+ preview: true
63
+ });
64
+ consola.success("Successfully created document type", result);
65
+ }
66
+ async function deployFirstParty(options, name, schema, version, fileSystemType) {
67
+ if (options.ontologyRid == null) {
68
+ throw new CommanderError(1, "EINVAL", "--ontology-rid is required when deploying a first-party document type");
69
+ }
70
+ const fetchFn = options.firstPartyPrefix != null ? buildPrefixRewriteFetch(options.firstPartyPrefix) : undefined;
71
+ if (fetchFn != null) {
72
+ consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);
73
+ }
74
+ const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth), undefined, fetchFn);
75
+ const request = {
76
+ requestBody: {
77
+ name,
78
+ ontologyRid: options.ontologyRid,
79
+ schema,
80
+ version,
81
+ fileSystemType
82
+ }
83
+ };
84
+ consola.info("Creating first-party document type", request);
85
+ try {
86
+ const result = await DocumentTypes.createFirstParty(osdkClient, request, {
87
+ preview: true
88
+ });
89
+ consola.success("Successfully created first-party document type", result);
90
+ } catch (error) {
91
+ if (error instanceof PalantirApiError) {
92
+ const {
93
+ message,
94
+ errorName,
95
+ errorCode
96
+ } = error;
97
+ const details = [errorName, errorCode].filter(Boolean).join(" ");
98
+ consola.error(`❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : ""}`);
99
+ }
100
+ throw error;
101
+ }
102
+ }
51
103
  //# sourceMappingURL=irDeployHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","irDeployHandler","options","irPath","ir","info","irContent","JSON","parse","osdkClient","baseUrl","Promise","auth","schema","request","name","parentFolderRid","parentFolder","fileSystemType","create","preview","error"],"sources":["irDeployHandler.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPlatformClient } from \"@osdk/client\";\nimport type { CreateDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport type { IRealTimeDocumentSchema } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport type { FileSystemType } from \"../types.js\";\n\ninterface DeployOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly parentFolder: string;\n readonly fileSystemType: FileSystemType;\n}\n\nexport async function irDeployHandler(options: DeployOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n\n consola.info(`Reading schema from: ${irPath}`);\n\n const irContent = readFileSync(irPath, \"utf8\");\n\n // TODO: conjureToZod based validation that IR content matches the conjure IR shape\n const ir = JSON.parse(irContent) as IRealTimeDocumentSchema;\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n );\n\n const schema = convertIrToWireSchema(ir);\n\n const request: CreateDocumentTypeRequest = {\n name: ir.name,\n parentFolderRid: options.parentFolder,\n schema,\n };\n\n if (options.fileSystemType != null) {\n request.fileSystemType = options.fileSystemType;\n }\n\n consola.info(\"Creating document type with schema\", request);\n\n await DocumentTypes.create(osdkClient, request, { preview: true });\n } catch (error) {\n consola.error(\"❌ Error during Deploy:\", error);\n throw new CommanderError(1, \"ERRIRMDEPLOY\", \"Error deploying IR document schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,QAAQ,cAAc;AAEnD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAE9B,SAASC,qBAAqB,QAAQ,yCAAyC;AAW/E,OAAO,eAAeC,eAAeA,CAACC,OAAsB,EAAiB;EAC3E,IAAI;IACF,MAAMC,MAAM,GAAGJ,OAAO,CAACG,OAAO,CAACE,EAAE,CAAC;IAElCP,OAAO,CAACQ,IAAI,CAAC,wBAAwBF,MAAM,EAAE,CAAC;IAE9C,MAAMG,SAAS,GAAGR,YAAY,CAACK,MAAM,EAAE,MAAM,CAAC;;IAE9C;IACA,MAAMC,EAAE,GAAGG,IAAI,CAACC,KAAK,CAACF,SAAS,CAA4B;IAE3D,MAAMG,UAAU,GAAGf,oBAAoB,CACrCQ,OAAO,CAACQ,OAAO,EACf,MAAMC,OAAO,CAACZ,OAAO,CAACG,OAAO,CAACU,IAAI,CACpC,CAAC;IAED,MAAMC,MAAM,GAAGb,qBAAqB,CAACI,EAAE,CAAC;IAExC,MAAMU,OAAkC,GAAG;MACzCC,IAAI,EAAEX,EAAE,CAACW,IAAI;MACbC,eAAe,EAAEd,OAAO,CAACe,YAAY;MACrCJ;IACF,CAAC;IAED,IAAIX,OAAO,CAACgB,cAAc,IAAI,IAAI,EAAE;MAClCJ,OAAO,CAACI,cAAc,GAAGhB,OAAO,CAACgB,cAAc;IACjD;IAEArB,OAAO,CAACQ,IAAI,CAAC,oCAAoC,EAAES,OAAO,CAAC;IAE3D,MAAMnB,aAAa,CAACwB,MAAM,CAACV,UAAU,EAAEK,OAAO,EAAE;MAAEM,OAAO,EAAE;IAAK,CAAC,CAAC;EACpE,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdxB,OAAO,CAACwB,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;IAC9C,MAAM,IAAIzB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,oCAAoC,CAAC;EACnF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","resolveIrInput","irDeployHandler","options","irPath","ir","info","latestVersion","JSON","parse","schema","fileSystemType","firstParty","deployFirstParty","name","deployThirdParty","error","parentFolder","osdkClient","baseUrl","Promise","auth","request","parentFolderRid","result","create","preview","success","version","ontologyRid","fetchFn","firstPartyPrefix","undefined","requestBody","createFirstParty","message","errorName","errorCode","details","filter","Boolean","join"],"sources":["irDeployHandler.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPlatformClient, PalantirApiError } from \"@osdk/client\";\nimport type {\n CreateDocumentTypeRequest,\n CreateFirstPartyDocumentTypeRequest,\n} from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport type { FileSystemType } from \"../types.js\";\nimport { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from \"../utils/firstPartyPrefix.js\";\nimport { resolveIrInput } from \"./resolveIrInput.js\";\n\ninterface DeployOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly fileSystemType?: FileSystemType;\n readonly firstParty?: boolean;\n /** Required for third-party deploys. */\n readonly parentFolder?: string;\n /** Required for first-party deploys. */\n readonly ontologyRid?: string;\n /** Overrides the API prefix for first-party deploys (e.g. /api/gotham). */\n readonly firstPartyPrefix?: string;\n}\n\nexport async function irDeployHandler(options: DeployOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n consola.info(`Reading schema from: ${irPath}`);\n\n const { ir, latestVersion } = resolveIrInput(\n JSON.parse(readFileSync(irPath, \"utf8\")) as unknown,\n irPath,\n );\n const schema = convertIrToWireSchema(ir);\n const fileSystemType = options.fileSystemType ?? \"ARTIFACTS\";\n\n if (options.firstParty) {\n await deployFirstParty(options, ir.name, schema, latestVersion, fileSystemType);\n } else {\n await deployThirdParty(options, ir.name, schema, fileSystemType);\n }\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"❌ Error during Deploy:\", error);\n throw new CommanderError(1, \"ERRIRMDEPLOY\", \"Error deploying IR document schema\");\n }\n}\n\ntype DocumentTypeSchema = CreateDocumentTypeRequest[\"schema\"];\n\nasync function deployThirdParty(\n options: DeployOptions,\n name: string,\n schema: DocumentTypeSchema,\n fileSystemType: FileSystemType,\n): Promise<void> {\n if (options.parentFolder == null) {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n \"--parent-folder is required when deploying a third-party document type\",\n );\n }\n\n const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));\n\n const request: CreateDocumentTypeRequest = {\n name,\n parentFolderRid: options.parentFolder,\n schema,\n fileSystemType,\n };\n\n consola.info(\"Creating document type with schema\", request);\n const result = await DocumentTypes.create(osdkClient, request, { preview: true });\n consola.success(\"Successfully created document type\", result);\n}\n\nasync function deployFirstParty(\n options: DeployOptions,\n name: string,\n schema: DocumentTypeSchema,\n version: number,\n fileSystemType: FileSystemType,\n): Promise<void> {\n if (options.ontologyRid == null) {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n \"--ontology-rid is required when deploying a first-party document type\",\n );\n }\n\n const fetchFn = options.firstPartyPrefix != null\n ? buildPrefixRewriteFetch(options.firstPartyPrefix)\n : undefined;\n if (fetchFn != null) {\n consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);\n }\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n undefined,\n fetchFn,\n );\n\n const request: CreateFirstPartyDocumentTypeRequest = {\n requestBody: {\n name,\n ontologyRid: options.ontologyRid,\n schema,\n version,\n fileSystemType,\n },\n };\n\n consola.info(\"Creating first-party document type\", request);\n try {\n const result = await DocumentTypes.createFirstParty(osdkClient, request, { preview: true });\n consola.success(\"Successfully created first-party document type\", result);\n } catch (error) {\n if (error instanceof PalantirApiError) {\n const { message, errorName, errorCode } = error;\n const details = [errorName, errorCode].filter(Boolean).join(\" \");\n consola.error(\n `❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : \"\"}`,\n );\n }\n throw error;\n }\n}\n"],"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,OAAO,CAACW,IAAI,CAAC,mBAAmBN,kBAAkB,SAASG,OAAO,CAAC4B,gBAAgB,GAAG,CAAC;EACzF;EAEA,MAAMb,UAAU,GAAG3B,oBAAoB,CACrCY,OAAO,CAACgB,OAAO,EACf,MAAMC,OAAO,CAACvB,OAAO,CAACM,OAAO,CAACkB,IAAI,CAAC,EACnCW,SAAS,EACTF,OACF,CAAC;EAED,MAAMR,OAA4C,GAAG;IACnDW,WAAW,EAAE;MACXnB,IAAI;MACJe,WAAW,EAAE1B,OAAO,CAAC0B,WAAW;MAChCnB,MAAM;MACNkB,OAAO;MACPjB;IACF;EACF,CAAC;EAEDhB,OAAO,CAACW,IAAI,CAAC,oCAAoC,EAAEgB,OAAO,CAAC;EAC3D,IAAI;IACF,MAAME,MAAM,GAAG,MAAM/B,aAAa,CAACyC,gBAAgB,CAAChB,UAAU,EAAEI,OAAO,EAAE;MAAEI,OAAO,EAAE;IAAK,CAAC,CAAC;IAC3F/B,OAAO,CAACgC,OAAO,CAAC,gDAAgD,EAAEH,MAAM,CAAC;EAC3E,CAAC,CAAC,OAAOR,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYxB,gBAAgB,EAAE;MACrC,MAAM;QAAE2C,OAAO;QAAEC,SAAS;QAAEC;MAAU,CAAC,GAAGrB,KAAK;MAC/C,MAAMsB,OAAO,GAAG,CAACF,SAAS,EAAEC,SAAS,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAChE9C,OAAO,CAACqB,KAAK,CACX,sCAAsCmB,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAChF,CAAC;IACH;IACA,MAAMtB,KAAK;EACb;AACF","ignoreList":[]}
@@ -20,36 +20,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
20
20
  import { basename, dirname, extname, join, resolve } from "path";
21
21
  import { GENERATED_JSON_COMMENT } from "../../utils/generatedFileHeader.js";
22
22
  import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
23
- import { resolveMinVersion } from "../../utils/schema/resolveSchemaChain.js";
24
- function isChainPayload(parsed) {
25
- return typeof parsed === "object" && parsed != null && "chain" in parsed && Array.isArray(parsed.chain) && typeof parsed.latestVersion === "number";
26
- }
27
- function resolveFromChain(payload, irPath) {
28
- if (payload.chain.length === 0) {
29
- throw new CommanderError(1, "EINVAL", `Invalid IR chain payload at ${irPath}: 'chain' is empty`);
30
- }
31
- const {
32
- latestVersion,
33
- minVersion
34
- } = resolveMinVersion(payload.chain, payload.minSupportedVersion);
35
- const latestEntry = payload.chain.find(c => c.version === latestVersion);
36
- if (latestEntry == null) {
37
- throw new CommanderError(1, "EINVAL", `IR chain payload at ${irPath} has no entry matching latestVersion ${latestVersion}`);
38
- }
39
- return {
40
- ir: latestEntry.ir,
41
- latestVersion,
42
- minSupportedVersion: minVersion
43
- };
44
- }
45
- function resolveFromSingleIr(ir) {
46
- // Legacy single-IR input has no chain, so min defaults to max (no back-compat claim).
47
- return {
48
- ir,
49
- latestVersion: ir.version,
50
- minSupportedVersion: ir.version
51
- };
52
- }
23
+ import { resolveIrInput } from "./resolveIrInput.js";
53
24
  function deriveCompatibilityRangePath(assetOutputPath) {
54
25
  const stem = basename(assetOutputPath, extname(assetOutputPath));
55
26
  return join(dirname(assetOutputPath), `${stem}-schema-compatibility-range.json`);
@@ -84,7 +55,7 @@ export function irGenAssetHandler(options) {
84
55
  }
85
56
  consola.info(`Reading IR schema from: ${irPath}`);
86
57
  const parsed = JSON.parse(readFileSync(irPath, "utf8"));
87
- const resolved = isChainPayload(parsed) ? resolveFromChain(parsed, irPath) : resolveFromSingleIr(parsed);
58
+ const resolved = resolveIrInput(parsed, irPath);
88
59
  const {
89
60
  ir: irSchema,
90
61
  latestVersion,
@@ -110,9 +81,7 @@ export function irGenAssetHandler(options) {
110
81
  documentTypeName,
111
82
  documentStorageType: {
112
83
  type: "yjs",
113
- yjs: {
114
- schema: wireSchema
115
- }
84
+ schema: wireSchema
116
85
  },
117
86
  fileSystemType,
118
87
  schemaVersion: latestVersion
@@ -1 +1 @@
1
- {"version":3,"file":"irGenAssetHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readFileSync","writeFileSync","basename","dirname","extname","join","resolve","GENERATED_JSON_COMMENT","convertIrToWireSchema","resolveMinVersion","isChainPayload","parsed","Array","isArray","chain","latestVersion","resolveFromChain","payload","irPath","length","minVersion","minSupportedVersion","latestEntry","find","c","version","ir","resolveFromSingleIr","deriveCompatibilityRangePath","assetOutputPath","stem","irGenAssetHandler","options","outputPath","output","info","JSON","parse","resolved","irSchema","name","documentTypeName","wireSchema","fileSystemType","outputDir","recursive","__comment","documentStorageType","type","yjs","schema","schemaVersion","stringify","compatibilityRangePath","compatibilityRangeOutput","compatibilityRangeDir","min","max","success","error"],"sources":["irGenAssetHandler.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 { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\";\nimport { basename, dirname, extname, join, resolve } from \"path\";\nimport type { IRealTimeDocumentSchema } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport { type IrChainPayload, resolveMinVersion } from \"../../utils/schema/resolveSchemaChain.js\";\nimport type { DocumentTypeAsset, FileSystemType } from \"../types.js\";\n\ninterface IrGenAssetOptions {\n readonly ir: string;\n readonly output: string;\n readonly fileSystemType?: FileSystemType;\n readonly compatibilityRangeOutput?: string;\n}\n\ninterface SchemaCompatibilityRangeFile {\n readonly min: number;\n readonly max: number;\n}\n\ninterface 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 // Legacy single-IR input has no chain, so min defaults to max (no back-compat claim).\n return { ir, latestVersion: ir.version, minSupportedVersion: ir.version };\n}\n\nfunction deriveCompatibilityRangePath(assetOutputPath: string): string {\n const stem = basename(assetOutputPath, extname(assetOutputPath));\n return join(dirname(assetOutputPath), `${stem}-schema-compatibility-range.json`);\n}\n\n/**\n * Generates a document type asset JSON file (and a sibling schema\n * compatibility range JSON file) from an IR schema.\n *\n * The input IR may be either:\n * - a chain payload `{ latestVersion, minSupportedVersion?, chain }` produced\n * by `schema ir`. The latest entry's `ir` is used as the wire schema; the\n * asset's `schemaVersion` is `latestVersion`; the compatibility range is\n * `{ min: minSupportedVersion ?? latestVersion, max: latestVersion }`.\n * - a bare single-version `IRealTimeDocumentSchema` (legacy). The compat\n * range defaults to `{ min: version, max: version }` since no chain\n * information is available.\n *\n * This command is intended for internal platform applications where the\n * document type asset must exist on disk so the platform can discover it and\n * register the document type automatically at deploy time. Most users should\n * use `ir deploy` to register document types via the Foundry API instead.\n *\n * If you are unsure whether you need this command, you almost certainly do not.\n */\nexport function irGenAssetHandler(options: IrGenAssetOptions): void {\n try {\n const irPath = resolve(options.ir);\n const outputPath = resolve(options.output);\n\n if (!existsSync(irPath)) {\n throw new CommanderError(1, \"ENOENT\", `IR file does not exist: ${irPath}`);\n }\n\n consola.info(`Reading IR schema from: ${irPath}`);\n const parsed = JSON.parse(readFileSync(irPath, \"utf8\")) as unknown;\n\n const resolved = isChainPayload(parsed)\n ? resolveFromChain(parsed, irPath)\n : resolveFromSingleIr(parsed as IRealTimeDocumentSchema);\n\n const { ir: irSchema, latestVersion, minSupportedVersion } = resolved;\n const { name: documentTypeName } = irSchema;\n const wireSchema = convertIrToWireSchema(irSchema);\n\n const fileSystemType = options.fileSystemType ?? \"ARTIFACTS\";\n if (fileSystemType !== \"ARTIFACTS\" && fileSystemType !== \"COMPASS\") {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n `Invalid fileSystemType \"${fileSystemType}\". Must be \"ARTIFACTS\" or \"COMPASS\".`,\n );\n }\n\n const asset: DocumentTypeAsset = {\n documentTypeName,\n documentStorageType: {\n type: \"yjs\",\n yjs: {\n schema: wireSchema,\n },\n },\n fileSystemType,\n schemaVersion: latestVersion,\n };\n\n const outputDir = dirname(outputPath);\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n const output = { __comment: GENERATED_JSON_COMMENT, ...asset };\n writeFileSync(outputPath, JSON.stringify(output, null, 2), \"utf8\");\n\n const compatibilityRange: SchemaCompatibilityRangeFile = {\n min: minSupportedVersion,\n max: latestVersion,\n };\n const compatibilityRangePath = resolve(\n options.compatibilityRangeOutput ?? deriveCompatibilityRangePath(outputPath),\n );\n const compatibilityRangeDir = dirname(compatibilityRangePath);\n if (!existsSync(compatibilityRangeDir)) {\n mkdirSync(compatibilityRangeDir, { recursive: true });\n }\n const compatibilityRangeOutput = {\n __comment: GENERATED_JSON_COMMENT,\n ...compatibilityRange,\n };\n writeFileSync(\n compatibilityRangePath,\n JSON.stringify(compatibilityRangeOutput, null, 2),\n \"utf8\",\n );\n\n consola.success(\"Successfully generated document type asset\");\n consola.info(` Output: ${outputPath}`);\n consola.info(` Compatibility range output: ${compatibilityRangePath}`);\n consola.info(` Document type: ${documentTypeName}`);\n consola.info(` Schema version: ${latestVersion}`);\n consola.info(` Compatibility range: [${minSupportedVersion}, ${latestVersion}]`);\n consola.info(` File system type: ${fileSystemType}`);\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"Error generating document type asset:\", error);\n throw new CommanderError(1, \"IR_ASSET_ERROR\", \"Failed to generate document type asset\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,aAAa,QAAQ,IAAI;AACvE,SAASC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,QAAQ,MAAM;AAEhE,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAA8BC,iBAAiB,QAAQ,0CAA0C;AAqBjG,SAASC,cAAcA,CAACC,MAAe,EAA4B;EACjE,OACE,OAAOA,MAAM,KAAK,QAAQ,IACvBA,MAAM,IAAI,IAAI,IACd,OAAO,IAAIA,MAAM,IACjBC,KAAK,CAACC,OAAO,CAAEF,MAAM,CAAoBG,KAAK,CAAC,IAC/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AI,CAAC,4BAA4Bd,mBAAmB,KAAKN,aAAa,GAAG,CAAC;IAClFlB,OAAO,CAACsC,IAAI,CAAC,wBAAwBQ,cAAc,EAAE,CAAC;EACxD,CAAC,CAAC,OAAOgB,KAAK,EAAE;IACd,IAAIA,KAAK,YAAY/D,cAAc,EAAE;MACnC,MAAM+D,KAAK;IACb;IACA9D,OAAO,CAAC8D,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;IAC7D,MAAM,IAAI/D,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,wCAAwC,CAAC;EACzF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"irGenAssetHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readFileSync","writeFileSync","basename","dirname","extname","join","resolve","GENERATED_JSON_COMMENT","convertIrToWireSchema","resolveIrInput","deriveCompatibilityRangePath","assetOutputPath","stem","irGenAssetHandler","options","irPath","ir","outputPath","output","info","parsed","JSON","parse","resolved","irSchema","latestVersion","minSupportedVersion","name","documentTypeName","wireSchema","fileSystemType","outputDir","recursive","__comment","documentStorageType","type","schema","schemaVersion","stringify","compatibilityRangePath","compatibilityRangeOutput","compatibilityRangeDir","min","max","success","error"],"sources":["irGenAssetHandler.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 { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\";\nimport { basename, dirname, extname, join, resolve } from \"path\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport type { DocumentTypeAsset, FileSystemType } from \"../types.js\";\nimport { resolveIrInput } from \"./resolveIrInput.js\";\n\ninterface IrGenAssetOptions {\n readonly ir: string;\n readonly output: string;\n readonly fileSystemType?: FileSystemType;\n readonly compatibilityRangeOutput?: string;\n}\n\ninterface SchemaCompatibilityRangeFile {\n readonly min: number;\n readonly max: number;\n}\n\nfunction deriveCompatibilityRangePath(assetOutputPath: string): string {\n const stem = basename(assetOutputPath, extname(assetOutputPath));\n return join(dirname(assetOutputPath), `${stem}-schema-compatibility-range.json`);\n}\n\n/**\n * Generates a document type asset JSON file (and a sibling schema\n * compatibility range JSON file) from an IR schema.\n *\n * The input IR may be either:\n * - a chain payload `{ latestVersion, minSupportedVersion?, chain }` produced\n * by `schema ir`. The latest entry's `ir` is used as the wire schema; the\n * asset's `schemaVersion` is `latestVersion`; the compatibility range is\n * `{ min: minSupportedVersion ?? latestVersion, max: latestVersion }`.\n * - a bare single-version `IRealTimeDocumentSchema` (legacy). The compat\n * range defaults to `{ min: version, max: version }` since no chain\n * information is available.\n *\n * This command is intended for internal platform applications where the\n * document type asset must exist on disk so the platform can discover it and\n * register the document type automatically at deploy time. Most users should\n * use `ir deploy` to register document types via the Foundry API instead.\n *\n * If you are unsure whether you need this command, you almost certainly do not.\n */\nexport function irGenAssetHandler(options: IrGenAssetOptions): void {\n try {\n const irPath = resolve(options.ir);\n const outputPath = resolve(options.output);\n\n if (!existsSync(irPath)) {\n throw new CommanderError(1, \"ENOENT\", `IR file does not exist: ${irPath}`);\n }\n\n consola.info(`Reading IR schema from: ${irPath}`);\n const parsed = JSON.parse(readFileSync(irPath, \"utf8\")) as unknown;\n\n const resolved = resolveIrInput(parsed, irPath);\n\n const { ir: irSchema, latestVersion, minSupportedVersion } = resolved;\n const { name: documentTypeName } = irSchema;\n const wireSchema = convertIrToWireSchema(irSchema);\n\n const fileSystemType = options.fileSystemType ?? \"ARTIFACTS\";\n if (fileSystemType !== \"ARTIFACTS\" && fileSystemType !== \"COMPASS\") {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n `Invalid fileSystemType \"${fileSystemType}\". Must be \"ARTIFACTS\" or \"COMPASS\".`,\n );\n }\n\n const asset: DocumentTypeAsset = {\n documentTypeName,\n documentStorageType: {\n type: \"yjs\",\n schema: wireSchema,\n },\n fileSystemType,\n schemaVersion: latestVersion,\n };\n\n const outputDir = dirname(outputPath);\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n const output = { __comment: GENERATED_JSON_COMMENT, ...asset };\n writeFileSync(outputPath, JSON.stringify(output, null, 2), \"utf8\");\n\n const compatibilityRange: SchemaCompatibilityRangeFile = {\n min: minSupportedVersion,\n max: latestVersion,\n };\n const compatibilityRangePath = resolve(\n options.compatibilityRangeOutput ?? deriveCompatibilityRangePath(outputPath),\n );\n const compatibilityRangeDir = dirname(compatibilityRangePath);\n if (!existsSync(compatibilityRangeDir)) {\n mkdirSync(compatibilityRangeDir, { recursive: true });\n }\n const compatibilityRangeOutput = {\n __comment: GENERATED_JSON_COMMENT,\n ...compatibilityRange,\n };\n writeFileSync(\n compatibilityRangePath,\n JSON.stringify(compatibilityRangeOutput, null, 2),\n \"utf8\",\n );\n\n consola.success(\"Successfully generated document type asset\");\n consola.info(` Output: ${outputPath}`);\n consola.info(` Compatibility range output: ${compatibilityRangePath}`);\n consola.info(` Document type: ${documentTypeName}`);\n consola.info(` Schema version: ${latestVersion}`);\n consola.info(` Compatibility range: [${minSupportedVersion}, ${latestVersion}]`);\n consola.info(` File system type: ${fileSystemType}`);\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"Error generating document type asset:\", error);\n throw new CommanderError(1, \"IR_ASSET_ERROR\", \"Failed to generate document type asset\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;A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/BP,SAAS,EAAE1B,sBAAsB;MACjC,GAbuD;QACvDmC,GAAG,EAAEhB,mBAAmB;QACxBiB,GAAG,EAAElB;MACP;IAWA,CAAC;IACDxB,aAAa,CACXsC,sBAAsB,EACtBlB,IAAI,CAACiB,SAAS,CAACE,wBAAwB,EAAE,IAAI,EAAE,CAAC,CAAC,EACjD,MACF,CAAC;IAED3C,OAAO,CAAC+C,OAAO,CAAC,4CAA4C,CAAC;IAC7D/C,OAAO,CAACsB,IAAI,CAAC,cAAcF,UAAU,EAAE,CAAC;IACxCpB,OAAO,CAACsB,IAAI,CAAC,kCAAkCoB,sBAAsB,EAAE,CAAC;IACxE1C,OAAO,CAACsB,IAAI,CAAC,qBAAqBS,gBAAgB,EAAE,CAAC;IACrD/B,OAAO,CAACsB,IAAI,CAAC,sBAAsBM,aAAa,EAAE,CAAC;IACnD5B,OAAO,CAACsB,IAAI,CAAC,4BAA4BO,mBAAmB,KAAKD,aAAa,GAAG,CAAC;IAClF5B,OAAO,CAACsB,IAAI,CAAC,wBAAwBW,cAAc,EAAE,CAAC;EACxD,CAAC,CAAC,OAAOe,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYjD,cAAc,EAAE;MACnC,MAAMiD,KAAK;IACb;IACAhD,OAAO,CAACgD,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;IAC7D,MAAM,IAAIjD,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,wCAAwC,CAAC;EACzF;AACF","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,33 +14,39 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { createPlatformClient, PalantirApiError } from "@osdk/client";
17
+ import { createPlatformClient } from "@osdk/client";
18
18
  import { DocumentTypes } from "@osdk/foundry.pack";
19
19
  import { CommanderError } from "commander";
20
20
  import { consola } from "consola";
21
21
  import { readFileSync } from "fs";
22
22
  import { resolve } from "path";
23
- import { buildPrefixRewriteFetch } from "./assetDeployHandler.js";
24
- const DEFAULT_API_PREFIX = "/api";
25
-
26
- /** Updates the schema of an existing document type using a generated asset JSON file. */
27
- export async function assetUpdateSchemaHandler(options) {
23
+ import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
24
+ import { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from "../utils/firstPartyPrefix.js";
25
+ import { resolveIrInput } from "./resolveIrInput.js";
26
+ /**
27
+ * Updates the schema of an existing document type from an IR file. Sources the wire schema and version directly from
28
+ * the IR (the same single source of truth used by `ir deploy`), avoiding a separately-generated asset file.
29
+ */
30
+ export async function irUpdateSchemaHandler(options) {
28
31
  try {
29
- const assetPath = resolve(options.input);
30
- consola.info(`Reading asset file from: ${assetPath}`);
31
- const assetContent = readFileSync(assetPath, "utf8");
32
- const asset = JSON.parse(assetContent);
32
+ const irPath = resolve(options.ir);
33
+ consola.info(`Reading schema from: ${irPath}`);
34
+ const {
35
+ ir,
36
+ latestVersion
37
+ } = resolveIrInput(JSON.parse(readFileSync(irPath, "utf8")), irPath);
38
+ const schema = convertIrToWireSchema(ir);
33
39
  const fetchFn = options.firstPartyPrefix != null ? buildPrefixRewriteFetch(options.firstPartyPrefix) : undefined;
34
40
  if (fetchFn != null) {
35
41
  consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);
36
42
  }
37
43
  const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth), undefined, fetchFn);
38
44
  const request = {
39
- documentTypeName: asset.documentTypeName,
45
+ documentTypeName: ir.name,
40
46
  requestBody: {
41
47
  ontologyRid: options.ontologyRid,
42
- schema: asset.documentStorageType.yjs.schema,
43
- version: asset.schemaVersion,
48
+ schema,
49
+ version: latestVersion,
44
50
  ...(options.forceOverwrite ? {
45
51
  forceOverwrite: true
46
52
  } : {})
@@ -49,7 +55,7 @@ export async function assetUpdateSchemaHandler(options) {
49
55
  if (options.forceOverwrite) {
50
56
  consola.warn("--force-overwrite is set: backwards-compatibility validation will be skipped.");
51
57
  }
52
- consola.info(`Updating schema for document type "${asset.documentTypeName}" -> version ${asset.schemaVersion}`);
58
+ consola.info(`Updating schema for document type "${ir.name}" -> version ${latestVersion}`);
53
59
  const result = await DocumentTypes.updateSchema(osdkClient, request, {
54
60
  preview: true
55
61
  });
@@ -59,26 +65,15 @@ export async function assetUpdateSchemaHandler(options) {
59
65
  }
60
66
  consola.error(`Schema validation failed with ${result.violations.length} violation(s):`);
61
67
  for (const violation of result.violations) {
62
- consola.error(` - ${violation.fieldPath}\t${violation.violationType}\t${violation.message}`);
68
+ consola.error(` - ${violation.fieldPath}: ${violation.message} (${violation.violationType})`);
63
69
  }
64
- consola.info("Hint: re-run with --force-overwrite to skip validation.");
65
- throw new CommanderError(1, "ERRSCHEMAVALIDATION", "Schema validation failed during update");
70
+ throw new CommanderError(1, "ERRIRUPDATESCHEMA", "Schema validation failed");
66
71
  } catch (error) {
67
72
  if (error instanceof CommanderError) {
68
73
  throw error;
69
74
  }
70
- if (error instanceof PalantirApiError) {
71
- const {
72
- message,
73
- errorName,
74
- errorCode
75
- } = error;
76
- const details = [errorName, errorCode].filter(Boolean).join(" ");
77
- consola.error(`❌ Error during schema update: ${message}${details ? ` [${details}]` : ""}`);
78
- } else {
79
- consola.error("❌ Error during schema update:", error);
80
- }
81
- throw new CommanderError(1, "ERRASSETUPDATESCHEMA", "Error updating document type schema");
75
+ consola.error("❌ Error during update-schema:", error);
76
+ throw new CommanderError(1, "ERRIRUPDATESCHEMA", "Error updating schema from IR");
82
77
  }
83
78
  }
84
- //# sourceMappingURL=assetUpdateSchemaHandler.js.map
79
+ //# sourceMappingURL=irUpdateSchemaHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irUpdateSchemaHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","resolveIrInput","irUpdateSchemaHandler","options","irPath","ir","info","latestVersion","JSON","parse","schema","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","documentTypeName","name","requestBody","ontologyRid","version","forceOverwrite","warn","result","updateSchema","preview","type","success","error","violations","length","violation","fieldPath","message","violationType"],"sources":["irUpdateSchemaHandler.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 { createPlatformClient } from \"@osdk/client\";\nimport type { UpdateSchemaDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from \"../utils/firstPartyPrefix.js\";\nimport { resolveIrInput } from \"./resolveIrInput.js\";\n\ninterface IrUpdateSchemaOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly forceOverwrite?: boolean;\n readonly firstPartyPrefix?: string;\n}\n\n/**\n * Updates the schema of an existing document type from an IR file. Sources the wire schema and version directly from\n * the IR (the same single source of truth used by `ir deploy`), avoiding a separately-generated asset file.\n */\nexport async function irUpdateSchemaHandler(options: IrUpdateSchemaOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n consola.info(`Reading schema from: ${irPath}`);\n\n const { ir, latestVersion } = resolveIrInput(\n JSON.parse(readFileSync(irPath, \"utf8\")) as unknown,\n irPath,\n );\n const schema = convertIrToWireSchema(ir);\n\n const fetchFn = options.firstPartyPrefix != null\n ? buildPrefixRewriteFetch(options.firstPartyPrefix)\n : undefined;\n if (fetchFn != null) {\n consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);\n }\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n undefined,\n fetchFn,\n );\n\n const request: UpdateSchemaDocumentTypeRequest = {\n documentTypeName: ir.name,\n requestBody: {\n ontologyRid: options.ontologyRid,\n schema,\n version: latestVersion,\n ...(options.forceOverwrite ? { forceOverwrite: true } : {}),\n },\n };\n\n if (options.forceOverwrite) {\n consola.warn(\"--force-overwrite is set: backwards-compatibility validation will be skipped.\");\n }\n consola.info(`Updating schema for document type \"${ir.name}\" -> version ${latestVersion}`);\n\n const result = await DocumentTypes.updateSchema(osdkClient, request, { preview: true });\n\n if (result.type === \"success\") {\n consola.success(`Schema updated successfully (version ${result.version})`);\n return;\n }\n\n consola.error(`Schema validation failed with ${result.violations.length} violation(s):`);\n for (const violation of result.violations) {\n consola.error(\n ` - ${violation.fieldPath}: ${violation.message} (${violation.violationType})`,\n );\n }\n throw new CommanderError(1, \"ERRIRUPDATESCHEMA\", \"Schema validation failed\");\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"❌ Error during update-schema:\", error);\n throw new CommanderError(1, \"ERRIRUPDATESCHEMA\", \"Error updating schema from IR\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,QAAQ,cAAc;AAEnD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,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J,OAAO,CAACqB,cAAc,GAAG;UAAEA,cAAc,EAAE;QAAK,CAAC,GAAG,CAAC,CAAC;MAC5D;IACF,CAAC;IAED,IAAIrB,OAAO,CAACqB,cAAc,EAAE;MAC1B7B,OAAO,CAAC8B,IAAI,CAAC,+EAA+E,CAAC;IAC/F;IACA9B,OAAO,CAACW,IAAI,CAAC,sCAAsCD,EAAE,CAACe,IAAI,gBAAgBb,aAAa,EAAE,CAAC;IAE1F,MAAMmB,MAAM,GAAG,MAAMjC,aAAa,CAACkC,YAAY,CAACb,UAAU,EAAEI,OAAO,EAAE;MAAEU,OAAO,EAAE;IAAK,CAAC,CAAC;IAEvF,IAAIF,MAAM,CAACG,IAAI,KAAK,SAAS,EAAE;MAC7BlC,OAAO,CAACmC,OAAO,CAAC,wCAAwCJ,MAAM,CAACH,OAAO,GAAG,CAAC;MAC1E;IACF;IAEA5B,OAAO,CAACoC,KAAK,CAAC,iCAAiCL,MAAM,CAACM,UAAU,CAACC,MAAM,gBAAgB,CAAC;IACxF,KAAK,MAAMC,SAAS,IAAIR,MAAM,CAACM,UAAU,EAAE;MACzCrC,OAAO,CAACoC,KAAK,CACX,OAAOG,SAAS,CAACC,SAAS,KAAKD,SAAS,CAACE,OAAO,KAAKF,SAAS,CAACG,aAAa,GAC9E,CAAC;IACH;IACA,MAAM,IAAI3C,cAAc,CAAC,CAAC,EAAE,mBAAmB,EAAE,0BAA0B,CAAC;EAC9E,CAAC,CAAC,OAAOqC,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYrC,cAAc,EAAE;MACnC,MAAMqC,KAAK;IACb;IACApC,OAAO,CAACoC,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACrD,MAAM,IAAIrC,cAAc,CAAC,CAAC,EAAE,mBAAmB,EAAE,+BAA+B,CAAC;EACnF;AACF","ignoreList":[]}
@@ -19,12 +19,14 @@ import { irGenAssetHandler } from "./irGenAssetHandler.js";
19
19
  import { irGenModelsHandler } from "./irGenModelsHandler.js";
20
20
  import { irGenTypesHandler } from "./irGenTypesHandler.js";
21
21
  import { irGenZodHandler } from "./irGenZodHandler.js";
22
+ import { irUpdateSchemaHandler } from "./irUpdateSchemaHandler.js";
22
23
  export function registerIrCommands(program) {
23
24
  const irCmd = program.command("ir").description("IR (Intermediate Representation) based generation commands");
24
25
  irCmd.command("gen-types").description("Generate versioned SDK files (types, schemas, internal/, models.ts, versions.ts, versionedDocRef.ts, index.ts) from a versioned IR chain JSON.").requiredOption("-s, --schema <file>", "Path to versioned IR chain JSON file").requiredOption("-o, --output <dir>", "Output directory for generated SDK files").action(irGenTypesHandler);
25
26
  irCmd.command("zod").description("Generate Zod schemas from IR document schema definitions").requiredOption("-s, --schema <file>", "Path to schema JSON file").requiredOption("-o, --output <file>", "Output file path for generated Zod schemas").option("-t, --type-import-path <path>", "Path to import types from (enables satisfies operators)").action(irGenZodHandler);
26
27
  irCmd.command("models").description("Generate Model constants from IR document schema definitions").requiredOption("-s, --schema <file>", "Path to schema JSON file").requiredOption("-o, --output <file>", "Output file path for generated Model constants").option("-t, --type-import-path <path>", "Path to import types from", "./types.js").option("--schema-import-path <path>", "Path to import schemas from", "./schema.js").action(irGenModelsHandler);
27
- irCmd.command("deploy").description("Create a document type on a Foundry stack using an IR document schema").requiredOption("-i, --ir <file>", "Path to IR JSON file").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").requiredOption("-p, --parent-folder <rid>", "Parent folder RID for the document type").requiredOption("-f, --file-system-type <type>", "File system type for the document type (ARTIFACTS or COMPASS)").action(irDeployHandler);
28
+ irCmd.command("deploy").description("Create a document type on a Foundry stack using an IR document schema. Deploys via the general " + "(third-party) path by default, or the first-party path with --first-party.").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").option("-p, --parent-folder <rid>", "Parent folder RID for the document type (required for third-party deploys)").option("--first-party", "Deploy as a first-party document type (uses the first-party endpoint; requires --ontology-rid)", false).option("-o, --ontology-rid <rid>", "Target ontology RID (required for first-party deploys)").option("-f, --file-system-type <type>", "File system type for the document type (ARTIFACTS or COMPASS)").option("--first-party-prefix <path>", "Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.").action(irDeployHandler);
29
+ irCmd.command("update-schema").description("Update the schema of an existing document type using an IR document schema").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").requiredOption("-o, --ontology-rid <rid>", "Target ontology RID").option("--force-overwrite", "Skip backwards-compatibility validation when updating the schema", false).option("--first-party-prefix <path>", "Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.").action(irUpdateSchemaHandler);
28
30
  irCmd.command("asset").description("Generate document type asset JSON and a sibling schema compatibility range JSON from an IR file (advanced — most users should use 'ir deploy' instead). The minimum supported schema version is sourced from the IR payload's 'minSupportedVersion' field (set by 'schema ir --config <pack-config.json>'); legacy single-IR inputs default to min == max.").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-o, --output <file>", "Output file path for asset JSON").option("-f, --file-system-type <type>", "File system type (ARTIFACTS or COMPASS)", "ARTIFACTS").option("--compatibility-range-output <file>", "Output path for the schema compatibility range JSON (defaults to a sibling of --output with '-schema-compatibility-range' suffix)").action(irGenAssetHandler);
29
31
  }
30
32
  //# sourceMappingURL=registerIrCommands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenAssetHandler","irGenModelsHandler","irGenTypesHandler","irGenZodHandler","registerIrCommands","program","irCmd","command","description","requiredOption","action","option"],"sources":["registerIrCommands.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 { irDeployHandler } from \"./irDeployHandler.js\";\nimport { irGenAssetHandler } from \"./irGenAssetHandler.js\";\nimport { irGenModelsHandler } from \"./irGenModelsHandler.js\";\nimport { irGenTypesHandler } from \"./irGenTypesHandler.js\";\nimport { irGenZodHandler } from \"./irGenZodHandler.js\";\n\nexport function registerIrCommands(program: Command): void {\n const irCmd = program\n .command(\"ir\")\n .description(\"IR (Intermediate Representation) based generation commands\");\n\n irCmd\n .command(\"gen-types\")\n .description(\n \"Generate versioned SDK files (types, schemas, internal/, models.ts, versions.ts, versionedDocRef.ts, index.ts) from a versioned IR chain JSON.\",\n )\n .requiredOption(\"-s, --schema <file>\", \"Path to versioned IR chain JSON file\")\n .requiredOption(\"-o, --output <dir>\", \"Output directory for generated SDK files\")\n .action(irGenTypesHandler);\n\n irCmd\n .command(\"zod\")\n .description(\"Generate Zod schemas from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Zod schemas\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from (enables satisfies operators)\",\n )\n .action(irGenZodHandler);\n\n irCmd\n .command(\"models\")\n .description(\"Generate Model constants from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Model constants\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from\",\n \"./types.js\",\n )\n .option(\n \"--schema-import-path <path>\",\n \"Path to import schemas from\",\n \"./schema.js\",\n )\n .action(irGenModelsHandler);\n\n irCmd\n .command(\"deploy\")\n .description(\"Create a document type on a Foundry stack using an IR document schema\")\n .requiredOption(\"-i, --ir <file>\", \"Path to IR JSON file\")\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .requiredOption(\"-p, --parent-folder <rid>\", \"Parent folder RID for the document type\")\n .requiredOption(\n \"-f, --file-system-type <type>\",\n \"File system type for the document type (ARTIFACTS or COMPASS)\",\n )\n .action(irDeployHandler);\n\n irCmd\n .command(\"asset\")\n .description(\n \"Generate document type asset JSON and a sibling schema compatibility range JSON from an IR file (advanced — most users should use 'ir deploy' instead). The minimum supported schema version is sourced from the IR payload's 'minSupportedVersion' field (set by 'schema ir --config <pack-config.json>'); legacy single-IR inputs default to min == max.\",\n )\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-o, --output <file>\", \"Output file path for asset JSON\")\n .option(\n \"-f, --file-system-type <type>\",\n \"File system type (ARTIFACTS or COMPASS)\",\n \"ARTIFACTS\",\n )\n .option(\n \"--compatibility-range-output <file>\",\n \"Output path for the schema compatibility range JSON (defaults to a sibling of --output with '-schema-compatibility-range' suffix)\",\n )\n .action(irGenAssetHandler);\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,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,OAAO,SAASC,kBAAkBA,CAACC,OAAgB,EAAQ;EACzD,MAAMC,KAAK,GAAGD,OAAO,CAClBE,OAAO,CAAC,IAAI,CAAC,CACbC,WAA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C,cAAc,CACb,iBAAiB,EACjB,oFACF,CAAC,CACAA,cAAc,CAAC,qBAAqB,EAAE,iCAAiC,CAAC,CACxEE,MAAM,CACL,+BAA+B,EAC/B,yCAAyC,EACzC,WACF,CAAC,CACAA,MAAM,CACL,qCAAqC,EACrC,mIACF,CAAC,CACAD,MAAM,CAACV,iBAAiB,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenAssetHandler","irGenModelsHandler","irGenTypesHandler","irGenZodHandler","irUpdateSchemaHandler","registerIrCommands","program","irCmd","command","description","requiredOption","action","option"],"sources":["registerIrCommands.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 { irDeployHandler } from \"./irDeployHandler.js\";\nimport { irGenAssetHandler } from \"./irGenAssetHandler.js\";\nimport { irGenModelsHandler } from \"./irGenModelsHandler.js\";\nimport { irGenTypesHandler } from \"./irGenTypesHandler.js\";\nimport { irGenZodHandler } from \"./irGenZodHandler.js\";\nimport { irUpdateSchemaHandler } from \"./irUpdateSchemaHandler.js\";\n\nexport function registerIrCommands(program: Command): void {\n const irCmd = program\n .command(\"ir\")\n .description(\"IR (Intermediate Representation) based generation commands\");\n\n irCmd\n .command(\"gen-types\")\n .description(\n \"Generate versioned SDK files (types, schemas, internal/, models.ts, versions.ts, versionedDocRef.ts, index.ts) from a versioned IR chain JSON.\",\n )\n .requiredOption(\"-s, --schema <file>\", \"Path to versioned IR chain JSON file\")\n .requiredOption(\"-o, --output <dir>\", \"Output directory for generated SDK files\")\n .action(irGenTypesHandler);\n\n irCmd\n .command(\"zod\")\n .description(\"Generate Zod schemas from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Zod schemas\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from (enables satisfies operators)\",\n )\n .action(irGenZodHandler);\n\n irCmd\n .command(\"models\")\n .description(\"Generate Model constants from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Model constants\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from\",\n \"./types.js\",\n )\n .option(\n \"--schema-import-path <path>\",\n \"Path to import schemas from\",\n \"./schema.js\",\n )\n .action(irGenModelsHandler);\n\n irCmd\n .command(\"deploy\")\n .description(\n \"Create a document type on a Foundry stack using an IR document schema. Deploys via the general \"\n + \"(third-party) path by default, or the first-party path with --first-party.\",\n )\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .option(\n \"-p, --parent-folder <rid>\",\n \"Parent folder RID for the document type (required for third-party deploys)\",\n )\n .option(\n \"--first-party\",\n \"Deploy as a first-party document type (uses the first-party endpoint; requires --ontology-rid)\",\n false,\n )\n .option(\n \"-o, --ontology-rid <rid>\",\n \"Target ontology RID (required for first-party deploys)\",\n )\n .option(\n \"-f, --file-system-type <type>\",\n \"File system type for the document type (ARTIFACTS or COMPASS)\",\n )\n .option(\n \"--first-party-prefix <path>\",\n \"Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.\",\n )\n .action(irDeployHandler);\n\n irCmd\n .command(\"update-schema\")\n .description(\"Update the schema of an existing document type using an IR document schema\")\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .requiredOption(\"-o, --ontology-rid <rid>\", \"Target ontology RID\")\n .option(\n \"--force-overwrite\",\n \"Skip backwards-compatibility validation when updating the schema\",\n false,\n )\n .option(\n \"--first-party-prefix <path>\",\n \"Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.\",\n )\n .action(irUpdateSchemaHandler);\n\n irCmd\n .command(\"asset\")\n .description(\n \"Generate document type asset JSON and a sibling schema compatibility range JSON from an IR file (advanced — most users should use 'ir deploy' instead). The minimum supported schema version is sourced from the IR payload's 'minSupportedVersion' field (set by 'schema ir --config <pack-config.json>'); legacy single-IR inputs default to min == max.\",\n )\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-o, --output <file>\", \"Output file path for asset JSON\")\n .option(\n \"-f, --file-system-type <type>\",\n \"File system type (ARTIFACTS or COMPASS)\",\n \"ARTIFACTS\",\n )\n .option(\n \"--compatibility-range-output <file>\",\n \"Output path for the schema compatibility range JSON (defaults to a sibling of --output with '-schema-compatibility-range' suffix)\",\n )\n .action(irGenAssetHandler);\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,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,qBAAqB,QAAQ,4BAA4B;AAElE,OAAO,SAASC,kBAAkBA,CAACC,OAAgB,EAAQ;EACzD,MAAMC,KAAK,GAAG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