@palantir/pack.document-schema.type-gen 0.11.0 → 0.13.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 (109) hide show
  1. package/build/esm/commands/asset/assetDeployHandler.js +1 -1
  2. package/build/esm/commands/asset/assetDeployHandler.js.map +1 -1
  3. package/build/esm/commands/asset/assetUpdateSchemaHandler.js +1 -1
  4. package/build/esm/commands/asset/assetUpdateSchemaHandler.js.map +1 -1
  5. package/build/esm/commands/ir/irGenAssetHandler.js +81 -12
  6. package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
  7. package/build/esm/commands/ir/irGenTypesHandler.js +10 -8
  8. package/build/esm/commands/ir/irGenTypesHandler.js.map +1 -1
  9. package/build/esm/commands/ir/registerIrCommands.js +2 -2
  10. package/build/esm/commands/ir/registerIrCommands.js.map +1 -1
  11. package/build/esm/commands/schema/__tests__/readPackConfig.test.js +112 -0
  12. package/build/esm/commands/schema/__tests__/readPackConfig.test.js.map +1 -0
  13. package/build/esm/commands/schema/registerSchemaCommands.js +1 -1
  14. package/build/esm/commands/schema/registerSchemaCommands.js.map +1 -1
  15. package/build/esm/commands/schema/schemaIrHandler.js +77 -11
  16. package/build/esm/commands/schema/schemaIrHandler.js.map +1 -1
  17. package/build/esm/commands/types.js.map +1 -1
  18. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
  19. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
  20. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
  21. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
  22. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
  23. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
  24. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
  25. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
  26. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
  27. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
  28. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
  29. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
  30. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
  31. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
  32. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
  33. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
  34. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
  35. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
  36. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
  37. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
  38. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
  39. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
  40. package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js +9 -0
  41. package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js.map +1 -0
  42. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -1
  43. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -1
  44. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -1
  45. package/build/esm/utils/schema/__tests__/generateDocumentTypeFromSchema.test.js +34 -0
  46. package/build/esm/utils/schema/__tests__/generateDocumentTypeFromSchema.test.js.map +1 -0
  47. package/build/esm/utils/schema/__tests__/provenanceScenarios.test.js +184 -0
  48. package/build/esm/utils/schema/__tests__/provenanceScenarios.test.js.map +1 -0
  49. package/build/esm/utils/schema/__tests__/resolveSchemaChain.test.js +122 -0
  50. package/build/esm/utils/schema/__tests__/resolveSchemaChain.test.js.map +1 -0
  51. package/build/esm/utils/schema/generateDocumentTypeFromSchema.js +39 -0
  52. package/build/esm/utils/schema/generateDocumentTypeFromSchema.js.map +1 -0
  53. package/build/esm/utils/schema/generateIndexFromSchema.js +3 -1
  54. package/build/esm/utils/schema/generateIndexFromSchema.js.map +1 -1
  55. package/build/esm/utils/schema/generateInternalFromSchema.js +1 -1
  56. package/build/esm/utils/schema/generateInternalFromSchema.js.map +1 -1
  57. package/build/esm/utils/schema/generateScopeFromSchema.js +2 -2
  58. package/build/esm/utils/schema/generateScopeFromSchema.js.map +1 -1
  59. package/build/esm/utils/schema/loadSchemaModule.js +2 -5
  60. package/build/esm/utils/schema/loadSchemaModule.js.map +1 -1
  61. package/build/esm/utils/schema/resolveSchemaChain.js +104 -17
  62. package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -1
  63. package/build/esm/utils/schema/runtimeSchema.js +3 -0
  64. package/build/esm/utils/schema/runtimeSchema.js.map +1 -1
  65. package/build/esm/utils/schema/writeAllSdkFiles.js +8 -8
  66. package/build/esm/utils/schema/writeAllSdkFiles.js.map +1 -1
  67. package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
  68. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
  69. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
  70. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
  71. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
  72. package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
  73. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
  74. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
  75. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
  76. package/build/esm/utils/steps/convertStepsToIr.js +49 -24
  77. package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
  78. package/build/types/commands/ir/irGenAssetHandler.d.ts +16 -5
  79. package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
  80. package/build/types/commands/ir/irGenTypesHandler.d.ts +0 -1
  81. package/build/types/commands/ir/irGenTypesHandler.d.ts.map +1 -1
  82. package/build/types/commands/ir/registerIrCommands.d.ts.map +1 -1
  83. package/build/types/commands/schema/__tests__/readPackConfig.test.d.ts +2 -0
  84. package/build/types/commands/schema/__tests__/readPackConfig.test.d.ts.map +1 -0
  85. package/build/types/commands/schema/registerSchemaCommands.d.ts.map +1 -1
  86. package/build/types/commands/schema/schemaIrHandler.d.ts +28 -6
  87. package/build/types/commands/schema/schemaIrHandler.d.ts.map +1 -1
  88. package/build/types/commands/types.d.ts +3 -1
  89. package/build/types/commands/types.d.ts.map +1 -1
  90. package/build/types/utils/schema/__tests__/generateDocumentTypeFromSchema.test.d.ts +2 -0
  91. package/build/types/utils/schema/__tests__/generateDocumentTypeFromSchema.test.d.ts.map +1 -0
  92. package/build/types/utils/schema/__tests__/provenanceScenarios.test.d.ts +2 -0
  93. package/build/types/utils/schema/__tests__/provenanceScenarios.test.d.ts.map +1 -0
  94. package/build/types/utils/schema/__tests__/resolveSchemaChain.test.d.ts +2 -0
  95. package/build/types/utils/schema/__tests__/resolveSchemaChain.test.d.ts.map +1 -0
  96. package/build/types/utils/schema/generateDocumentTypeFromSchema.d.ts +17 -0
  97. package/build/types/utils/schema/generateDocumentTypeFromSchema.d.ts.map +1 -0
  98. package/build/types/utils/schema/generateIndexFromSchema.d.ts +1 -0
  99. package/build/types/utils/schema/generateIndexFromSchema.d.ts.map +1 -1
  100. package/build/types/utils/schema/loadSchemaModule.d.ts.map +1 -1
  101. package/build/types/utils/schema/resolveSchemaChain.d.ts +26 -1
  102. package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -1
  103. package/build/types/utils/schema/runtimeSchema.d.ts +2 -0
  104. package/build/types/utils/schema/runtimeSchema.d.ts.map +1 -1
  105. package/build/types/utils/schema/writeAllSdkFiles.d.ts +0 -1
  106. package/build/types/utils/schema/writeAllSdkFiles.d.ts.map +1 -1
  107. package/build/types/utils/steps/convertStepsToIr.d.ts +19 -4
  108. package/build/types/utils/steps/convertStepsToIr.d.ts.map +1 -1
  109. package/package.json +4 -4
@@ -67,7 +67,7 @@ export async function assetDeployHandler(options) {
67
67
  requestBody: {
68
68
  name: asset.documentTypeName,
69
69
  ontologyRid: options.ontologyRid,
70
- schema: asset.documentStorageType.yjs,
70
+ schema: asset.documentStorageType.yjs.schema,
71
71
  fileSystemType: asset.fileSystemType,
72
72
  version: asset.schemaVersion
73
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"assetDeployHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","DEFAULT_API_PREFIX","ALLOWED_FIRST_PARTY_PREFIXES","buildPrefixRewriteFetch","prefix","includes","Error","join","input","init","req","Request","url","URL","pathname","startsWith","globalThis","fetch","slice","length","assetDeployHandler","options","assetPath","info","assetContent","asset","JSON","parse","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","requestBody","name","documentTypeName","ontologyRid","schema","documentStorageType","yjs","fileSystemType","version","schemaVersion","result","createFirstParty","preview","success","error","message","errorName","errorCode","details","filter","Boolean"],"sources":["assetDeployHandler.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 { CreateFirstPartyDocumentTypeRequest } 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 { DocumentTypeAsset } from \"../types.js\";\n\ninterface AssetDeployOptions {\n readonly input: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly firstPartyPrefix?: string;\n}\n\nconst 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\n/** Useful for manually deploying a document type during development to test schema changes. */\nexport async function assetDeployHandler(options: AssetDeployOptions): Promise<void> {\n try {\n const assetPath = resolve(options.input);\n\n consola.info(`Reading asset file from: ${assetPath}`);\n\n const assetContent = readFileSync(assetPath, \"utf8\");\n const asset = JSON.parse(assetContent) as DocumentTypeAsset;\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: asset.documentTypeName,\n ontologyRid: options.ontologyRid,\n schema: asset.documentStorageType.yjs,\n fileSystemType: asset.fileSystemType,\n version: asset.schemaVersion,\n },\n };\n\n consola.info(\"Creating first-party document type\", request);\n\n const result = await DocumentTypes.createFirstParty(osdkClient, request, { preview: true });\n\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 } else {\n consola.error(\"❌ Error during first-party deploy:\", error);\n }\n throw new CommanderError(1, \"ERRASSETDEPLOY\", \"Error deploying document type from asset\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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;EAC3E,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYvD,gBAAgB,EAAE;MACrC,MAAM;QAAEwD,OAAO;QAAEC,SAAS;QAAEC;MAAU,CAAC,GAAGH,KAAK;MAC/C,MAAMI,OAAO,GAAG,CAACF,SAAS,EAAEC,SAAS,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACjD,IAAI,CAAC,GAAG,CAAC;MAChET,OAAO,CAACoD,KAAK,CACX,sCAAsCC,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAChF,CAAC;IACH,CAAC,MAAM;MACLxD,OAAO,CAACoD,KAAK,CAAC,oCAAoC,EAAEA,KAAK,CAAC;IAC5D;IACA,MAAM,IAAIrD,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,0CAA0C,CAAC;EAC3F;AACF","ignoreList":[]}
1
+ {"version":3,"file":"assetDeployHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","DEFAULT_API_PREFIX","ALLOWED_FIRST_PARTY_PREFIXES","buildPrefixRewriteFetch","prefix","includes","Error","join","input","init","req","Request","url","URL","pathname","startsWith","globalThis","fetch","slice","length","assetDeployHandler","options","assetPath","info","assetContent","asset","JSON","parse","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","requestBody","name","documentTypeName","ontologyRid","schema","documentStorageType","yjs","fileSystemType","version","schemaVersion","result","createFirstParty","preview","success","error","message","errorName","errorCode","details","filter","Boolean"],"sources":["assetDeployHandler.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 { CreateFirstPartyDocumentTypeRequest } 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 { DocumentTypeAsset } from \"../types.js\";\n\ninterface AssetDeployOptions {\n readonly input: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly firstPartyPrefix?: string;\n}\n\nconst 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\n/** Useful for manually deploying a document type during development to test schema changes. */\nexport async function assetDeployHandler(options: AssetDeployOptions): Promise<void> {\n try {\n const assetPath = resolve(options.input);\n\n consola.info(`Reading asset file from: ${assetPath}`);\n\n const assetContent = readFileSync(assetPath, \"utf8\");\n const asset = JSON.parse(assetContent) as DocumentTypeAsset;\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: asset.documentTypeName,\n ontologyRid: options.ontologyRid,\n schema: asset.documentStorageType.yjs.schema,\n fileSystemType: asset.fileSystemType,\n version: asset.schemaVersion,\n },\n };\n\n consola.info(\"Creating first-party document type\", request);\n\n const result = await DocumentTypes.createFirstParty(osdkClient, request, { preview: true });\n\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 } else {\n consola.error(\"❌ Error during first-party deploy:\", error);\n }\n throw new CommanderError(1, \"ERRASSETDEPLOY\", \"Error deploying document type from asset\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,cAAc;AAErE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAW9B,MAAMC,kBAAkB,GAAG,MAAM;;AAEjC;AACA;AACA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AACoD,KAAK,CACX,sCAAsCC,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAChF,CAAC;IACH,CAAC,MAAM;MACLxD,OAAO,CAACoD,KAAK,CAAC,oCAAoC,EAAEA,KAAK,CAAC;IAC5D;IACA,MAAM,IAAIrD,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,0CAA0C,CAAC;EAC3F;AACF","ignoreList":[]}
@@ -39,7 +39,7 @@ export async function assetUpdateSchemaHandler(options) {
39
39
  documentTypeName: asset.documentTypeName,
40
40
  requestBody: {
41
41
  ontologyRid: options.ontologyRid,
42
- schema: asset.documentStorageType.yjs,
42
+ schema: asset.documentStorageType.yjs.schema,
43
43
  version: asset.schemaVersion,
44
44
  ...(options.forceOverwrite ? {
45
45
  forceOverwrite: true
@@ -1 +1 @@
1
- {"version":3,"file":"assetUpdateSchemaHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","assetUpdateSchemaHandler","options","assetPath","input","info","assetContent","asset","JSON","parse","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","documentTypeName","requestBody","ontologyRid","schema","documentStorageType","yjs","version","schemaVersion","forceOverwrite","warn","result","updateSchema","preview","type","success","error","violations","length","violation","fieldPath","violationType","message","errorName","errorCode","details","filter","Boolean","join"],"sources":["assetUpdateSchemaHandler.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 { 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 type { DocumentTypeAsset } from \"../types.js\";\nimport { buildPrefixRewriteFetch } from \"./assetDeployHandler.js\";\n\ninterface AssetUpdateSchemaOptions {\n readonly input: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly forceOverwrite?: boolean;\n readonly firstPartyPrefix?: string;\n}\n\nconst DEFAULT_API_PREFIX = \"/api\";\n\n/** Updates the schema of an existing document type using a generated asset JSON file. */\nexport async function assetUpdateSchemaHandler(\n options: AssetUpdateSchemaOptions,\n): Promise<void> {\n try {\n const assetPath = resolve(options.input);\n\n consola.info(`Reading asset file from: ${assetPath}`);\n\n const assetContent = readFileSync(assetPath, \"utf8\");\n const asset = JSON.parse(assetContent) as DocumentTypeAsset;\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: asset.documentTypeName,\n requestBody: {\n ontologyRid: options.ontologyRid,\n schema: asset.documentStorageType.yjs,\n version: asset.schemaVersion,\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\n consola.info(\n `Updating schema for document type \"${asset.documentTypeName}\" -> version ${asset.schemaVersion}`,\n );\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(` - ${violation.fieldPath}\\t${violation.violationType}\\t${violation.message}`);\n }\n consola.info(\"Hint: re-run with --force-overwrite to skip validation.\");\n throw new CommanderError(\n 1,\n \"ERRSCHEMAVALIDATION\",\n \"Schema validation failed during update\",\n );\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\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 schema update: ${message}${details ? ` [${details}]` : \"\"}`,\n );\n } else {\n consola.error(\"❌ Error during schema update:\", error);\n }\n throw new CommanderError(1, \"ERRASSETUPDATESCHEMA\", \"Error updating document type schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,cAAc;AAErE,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,uBAAuB,QAAQ,yBAAyB;AAWjE,MAAMC,kBAAkB,GAAG,MAAM;;AAEjC;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,OAAiC,EAClB;EACf,IAAI;IACF,MAAMC,SAAS,GAAGL,OAAO,CAACI,OAAO,CAACE,KAAK,CAAC;IAExCR,OAAO,CAACS,IAAI,CAAC,4BAA4BF,SAAS,EAAE,CAAC;IAErD,MAAMG,YAAY,GAAGT,YAAY,CAACM,SAAS,EAAE,MAAM,CAAC;IACpD,MAAMI,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACH,YAAY,CAAsB;I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AiCL,MAAM,CAACM,UAAU,CAACC,MAAM,gBAAgB,CAAC;IACxF,KAAK,MAAMC,SAAS,IAAIR,MAAM,CAACM,UAAU,EAAE;MACzCtC,OAAO,CAACqC,KAAK,CAAC,OAAOG,SAAS,CAACC,SAAS,KAAKD,SAAS,CAACE,aAAa,KAAKF,SAAS,CAACG,OAAO,EAAE,CAAC;IAC/F;IACA3C,OAAO,CAACS,IAAI,CAAC,yDAAyD,CAAC;IACvE,MAAM,IAAIV,cAAc,CACtB,CAAC,EACD,qBAAqB,EACrB,wCACF,CAAC;EACH,CAAC,CAAC,OAAOsC,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYtC,cAAc,EAAE;MACnC,MAAMsC,KAAK;IACb;IACA,IAAIA,KAAK,YAAYxC,gBAAgB,EAAE;MACrC,MAAM;QAAE8C,OAAO;QAAEC,SAAS;QAAEC;MAAU,CAAC,GAAGR,KAAK;MAC/C,MAAMS,OAAO,GAAG,CAACF,SAAS,EAAEC,SAAS,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAChEjD,OAAO,CAACqC,KAAK,CACX,iCAAiCM,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAC3E,CAAC;IACH,CAAC,MAAM;MACL9C,OAAO,CAACqC,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACvD;IACA,MAAM,IAAItC,cAAc,CAAC,CAAC,EAAE,sBAAsB,EAAE,qCAAqC,CAAC;EAC5F;AACF","ignoreList":[]}
1
+ {"version":3,"file":"assetUpdateSchemaHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","assetUpdateSchemaHandler","options","assetPath","input","info","assetContent","asset","JSON","parse","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","documentTypeName","requestBody","ontologyRid","schema","documentStorageType","yjs","version","schemaVersion","forceOverwrite","warn","result","updateSchema","preview","type","success","error","violations","length","violation","fieldPath","violationType","message","errorName","errorCode","details","filter","Boolean","join"],"sources":["assetUpdateSchemaHandler.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 { 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 type { DocumentTypeAsset } from \"../types.js\";\nimport { buildPrefixRewriteFetch } from \"./assetDeployHandler.js\";\n\ninterface AssetUpdateSchemaOptions {\n readonly input: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly forceOverwrite?: boolean;\n readonly firstPartyPrefix?: string;\n}\n\nconst DEFAULT_API_PREFIX = \"/api\";\n\n/** Updates the schema of an existing document type using a generated asset JSON file. */\nexport async function assetUpdateSchemaHandler(\n options: AssetUpdateSchemaOptions,\n): Promise<void> {\n try {\n const assetPath = resolve(options.input);\n\n consola.info(`Reading asset file from: ${assetPath}`);\n\n const assetContent = readFileSync(assetPath, \"utf8\");\n const asset = JSON.parse(assetContent) as DocumentTypeAsset;\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: asset.documentTypeName,\n requestBody: {\n ontologyRid: options.ontologyRid,\n schema: asset.documentStorageType.yjs.schema,\n version: asset.schemaVersion,\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\n consola.info(\n `Updating schema for document type \"${asset.documentTypeName}\" -> version ${asset.schemaVersion}`,\n );\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(` - ${violation.fieldPath}\\t${violation.violationType}\\t${violation.message}`);\n }\n consola.info(\"Hint: re-run with --force-overwrite to skip validation.\");\n throw new CommanderError(\n 1,\n \"ERRSCHEMAVALIDATION\",\n \"Schema validation failed during update\",\n );\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\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 schema update: ${message}${details ? ` [${details}]` : \"\"}`,\n );\n } else {\n consola.error(\"❌ Error during schema update:\", error);\n }\n throw new CommanderError(1, \"ERRASSETUPDATESCHEMA\", \"Error updating document type schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,cAAc;AAErE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAA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AG,GAAG,EAAE,EAC3E,CAAC;IACH,CAAC,MAAM;MACL9C,OAAO,CAACqC,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACvD;IACA,MAAM,IAAItC,cAAc,CAAC,CAAC,EAAE,sBAAsB,EAAE,qCAAqC,CAAC;EAC5F;AACF","ignoreList":[]}
@@ -17,16 +17,61 @@
17
17
  import { CommanderError } from "commander";
18
18
  import { consola } from "consola";
19
19
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
20
- import { dirname, resolve } from "path";
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
+ }
53
+ function deriveCompatibilityRangePath(assetOutputPath) {
54
+ const stem = basename(assetOutputPath, extname(assetOutputPath));
55
+ return join(dirname(assetOutputPath), `${stem}-schema-compatibility-range.json`);
56
+ }
57
+
23
58
  /**
24
- * Generates a document type asset JSON file from an IR schema.
59
+ * Generates a document type asset JSON file (and a sibling schema
60
+ * compatibility range JSON file) from an IR schema.
61
+ *
62
+ * The input IR may be either:
63
+ * - a chain payload `{ latestVersion, minSupportedVersion?, chain }` produced
64
+ * by `schema ir`. The latest entry's `ir` is used as the wire schema; the
65
+ * asset's `schemaVersion` is `latestVersion`; the compatibility range is
66
+ * `{ min: minSupportedVersion ?? latestVersion, max: latestVersion }`.
67
+ * - a bare single-version `IRealTimeDocumentSchema` (legacy). The compat
68
+ * range defaults to `{ min: version, max: version }` since no chain
69
+ * information is available.
25
70
  *
26
- * This command is intended for internal platform applications where the document
27
- * type asset must exist on disk so the platform can discover it and register the
28
- * document type automatically at deploy time. Most users should use `ir deploy`
29
- * to register document types via the Foundry API instead.
71
+ * This command is intended for internal platform applications where the
72
+ * document type asset must exist on disk so the platform can discover it and
73
+ * register the document type automatically at deploy time. Most users should
74
+ * use `ir deploy` to register document types via the Foundry API instead.
30
75
  *
31
76
  * If you are unsure whether you need this command, you almost certainly do not.
32
77
  */
@@ -38,10 +83,15 @@ export function irGenAssetHandler(options) {
38
83
  throw new CommanderError(1, "ENOENT", `IR file does not exist: ${irPath}`);
39
84
  }
40
85
  consola.info(`Reading IR schema from: ${irPath}`);
41
- const irSchema = JSON.parse(readFileSync(irPath, "utf8"));
86
+ const parsed = JSON.parse(readFileSync(irPath, "utf8"));
87
+ const resolved = isChainPayload(parsed) ? resolveFromChain(parsed, irPath) : resolveFromSingleIr(parsed);
42
88
  const {
43
- name: documentTypeName,
44
- version: schemaVersion
89
+ ir: irSchema,
90
+ latestVersion,
91
+ minSupportedVersion
92
+ } = resolved;
93
+ const {
94
+ name: documentTypeName
45
95
  } = irSchema;
46
96
  const wireSchema = convertIrToWireSchema(irSchema);
47
97
  const fileSystemType = options.fileSystemType ?? "ARTIFACTS";
@@ -60,17 +110,36 @@ export function irGenAssetHandler(options) {
60
110
  documentTypeName,
61
111
  documentStorageType: {
62
112
  type: "yjs",
63
- yjs: wireSchema
113
+ yjs: {
114
+ schema: wireSchema
115
+ }
64
116
  },
65
117
  fileSystemType,
66
- schemaVersion
118
+ schemaVersion: latestVersion
67
119
  }
68
120
  };
69
121
  writeFileSync(outputPath, JSON.stringify(output, null, 2), "utf8");
122
+ const compatibilityRangePath = resolve(options.compatibilityRangeOutput ?? deriveCompatibilityRangePath(outputPath));
123
+ const compatibilityRangeDir = dirname(compatibilityRangePath);
124
+ if (!existsSync(compatibilityRangeDir)) {
125
+ mkdirSync(compatibilityRangeDir, {
126
+ recursive: true
127
+ });
128
+ }
129
+ const compatibilityRangeOutput = {
130
+ __comment: GENERATED_JSON_COMMENT,
131
+ ...{
132
+ min: minSupportedVersion,
133
+ max: latestVersion
134
+ }
135
+ };
136
+ writeFileSync(compatibilityRangePath, JSON.stringify(compatibilityRangeOutput, null, 2), "utf8");
70
137
  consola.success("Successfully generated document type asset");
71
138
  consola.info(` Output: ${outputPath}`);
139
+ consola.info(` Compatibility range output: ${compatibilityRangePath}`);
72
140
  consola.info(` Document type: ${documentTypeName}`);
73
- consola.info(` Schema version: ${schemaVersion}`);
141
+ consola.info(` Schema version: ${latestVersion}`);
142
+ consola.info(` Compatibility range: [${minSupportedVersion}, ${latestVersion}]`);
74
143
  consola.info(` File system type: ${fileSystemType}`);
75
144
  } catch (error) {
76
145
  if (error instanceof CommanderError) {
@@ -1 +1 @@
1
- {"version":3,"file":"irGenAssetHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readFileSync","writeFileSync","dirname","resolve","GENERATED_JSON_COMMENT","convertIrToWireSchema","irGenAssetHandler","options","irPath","ir","outputPath","output","info","irSchema","JSON","parse","name","documentTypeName","version","schemaVersion","wireSchema","fileSystemType","outputDir","recursive","__comment","documentStorageType","type","yjs","stringify","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 { dirname, 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 { DocumentTypeAsset, FileSystemType } from \"../types.js\";\n\ninterface IrGenAssetOptions {\n readonly ir: string;\n readonly output: string;\n readonly fileSystemType?: FileSystemType;\n}\n\n/**\n * Generates a document type asset JSON file from an IR schema.\n *\n * This command is intended for internal platform applications where the document\n * type asset must exist on disk so the platform can discover it and register the\n * document type automatically at deploy time. Most users should use `ir deploy`\n * 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 irSchema = JSON.parse(\n readFileSync(irPath, \"utf8\"),\n ) as IRealTimeDocumentSchema;\n\n const { name: documentTypeName, version: schemaVersion } = 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: wireSchema,\n },\n fileSystemType,\n schemaVersion,\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 consola.success(\"Successfully generated document type asset\");\n consola.info(` Output: ${outputPath}`);\n consola.info(` Document type: ${documentTypeName}`);\n consola.info(` Schema version: ${schemaVersion}`);\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,OAAO,EAAEC,OAAO,QAAQ,MAAM;AAEvC,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,qBAAqB,QAAQ,yCAAyC;AAS/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,OAA0B,EAAQ;EAClE,IAAI;IACF,MAAMC,MAAM,GAAGL,OAAO,CAACI,OAAO,CAACE,EAAE,CAAC;IAClC,MAAMC,UAAU,GAAGP,OAAO,CAACI,OAAO,CAACI,MAAM,CAAC;IAE1C,IAAI,CAACb,U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AAE,CAAC;IACxCb,OAAO,CAACe,IAAI,CAAC,qBAAqBK,gBAAgB,EAAE,CAAC;IACrDpB,OAAO,CAACe,IAAI,CAAC,sBAAsBO,aAAa,EAAE,CAAC;IACnDtB,OAAO,CAACe,IAAI,CAAC,wBAAwBS,cAAc,EAAE,CAAC;EACxD,CAAC,CAAC,OAAOS,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYlC,cAAc,EAAE;MACnC,MAAMkC,KAAK;IACb;IACAjC,OAAO,CAACiC,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;IAC7D,MAAM,IAAIlC,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","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,EAAE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E,IAAI,EAAE,CAAC,CAAC,EACjD,MACF,CAAC;IAEDzD,OAAO,CAAC6D,OAAO,CAAC,4CAA4C,CAAC;IAC7D7D,OAAO,CAACsC,IAAI,CAAC,cAAcF,UAAU,EAAE,CAAC;IACxCpC,OAAO,CAACsC,IAAI,CAAC,kCAAkCkB,sBAAsB,EAAE,CAAC;IACxExD,OAAO,CAACsC,IAAI,CAAC,qBAAqBM,gBAAgB,EAAE,CAAC;IACrD5C,OAAO,CAACsC,IAAI,CAAC,sBAAsBpB,aAAa,EAAE,CAAC;IACnDlB,OAAO,CAACsC,IAAI,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":[]}
@@ -17,8 +17,8 @@
17
17
  import { consola } from "consola";
18
18
  import fs from "fs-extra";
19
19
  import path from "path";
20
- import { resolveMinVersion } from "../../utils/schema/resolveSchemaChain.js";
21
- import { parseMinVersion, writeAllSdkFiles } from "../../utils/schema/writeAllSdkFiles.js";
20
+ import { resolveMinVersion, stripDeprecatedFieldsForSdk } from "../../utils/schema/resolveSchemaChain.js";
21
+ import { writeAllSdkFiles } from "../../utils/schema/writeAllSdkFiles.js";
22
22
  export async function irGenTypesHandler(options) {
23
23
  const {
24
24
  schema: schemaPath,
@@ -33,17 +33,19 @@ export async function irGenTypesHandler(options) {
33
33
  if (!Array.isArray(payload.chain) || payload.chain.length === 0) {
34
34
  throw new Error(`Invalid IR chain payload at ${inputPath}: missing non-empty 'chain' array`);
35
35
  }
36
- const minSupportedVersion = parseMinVersion(options.minVersion);
36
+ const {
37
+ minSupportedVersion
38
+ } = payload;
37
39
  const {
38
40
  latestVersion,
39
41
  minVersion
40
42
  } = resolveMinVersion(payload.chain, minSupportedVersion);
41
- const resolved = {
42
- chain: payload.chain,
43
+ const chain = stripDeprecatedFieldsForSdk(payload.chain);
44
+ const resolvedOutputDir = path.resolve(outputDir);
45
+ await writeAllSdkFiles({
46
+ chain,
43
47
  latestVersion,
44
48
  minVersion
45
- };
46
- const resolvedOutputDir = path.resolve(outputDir);
47
- await writeAllSdkFiles(resolved, resolvedOutputDir, minSupportedVersion);
49
+ }, resolvedOutputDir, minSupportedVersion);
48
50
  }
49
51
  //# sourceMappingURL=irGenTypesHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"irGenTypesHandler.js","names":["consola","fs","path","resolveMinVersion","parseMinVersion","writeAllSdkFiles","irGenTypesHandler","options","schema","schemaPath","output","outputDir","inputPath","resolve","pathExists","Error","info","payload","readJson","Array","isArray","chain","length","minSupportedVersion","minVersion","latestVersion","resolved","resolvedOutputDir"],"sources":["irGenTypesHandler.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 { resolveMinVersion, type VersionedIrEntry } from \"../../utils/schema/resolveSchemaChain.js\";\nimport { parseMinVersion, writeAllSdkFiles } from \"../../utils/schema/writeAllSdkFiles.js\";\n\ninterface IrGenTypesOptions {\n schema: string;\n output: string;\n minVersion?: string;\n}\n\ninterface IrChainPayload {\n __comment?: string;\n latestVersion: number;\n chain: VersionedIrEntry[];\n}\n\nexport async function irGenTypesHandler(options: IrGenTypesOptions): Promise<void> {\n const { schema: schemaPath, output: outputDir } = options;\n\n const inputPath = path.resolve(schemaPath);\n if (!(await fs.pathExists(inputPath))) {\n throw new Error(`Input file not found: ${inputPath}`);\n }\n\n consola.info(`Loading IR chain from: ${inputPath}`);\n const payload = (await fs.readJson(inputPath)) as IrChainPayload;\n\n if (!Array.isArray(payload.chain) || payload.chain.length === 0) {\n throw new Error(`Invalid IR chain payload at ${inputPath}: missing non-empty 'chain' array`);\n }\n\n const minSupportedVersion = parseMinVersion(options.minVersion);\n const { latestVersion, minVersion } = resolveMinVersion(payload.chain, minSupportedVersion);\n const resolved = { chain: payload.chain, latestVersion, minVersion };\n\n const resolvedOutputDir = path.resolve(outputDir);\n await writeAllSdkFiles(resolved, resolvedOutputDir, minSupportedVersion);\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,iBAAiB,QAA+B,0CAA0C;AACnG,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,wCAAwC;AAc1F,OAAO,eAAeC,iBAAiBA,CAACC,OAA0B,EAAiB;EACjF,MAAM;IAAEC,MAAM,EAAEC,UAAU;IAAEC,MAAM,EAAEC;EAAU,CAAC,GAAGJ,OAAO;EAEzD,MAAMK,SAAS,GAAGV,IAAI,CAACW,OAAO,CAACJ,UAAU,CAAC;EAC1C,IAAI,EAAE,MAAMR,EAAE,CAACa,UAAU,CAACF,SAAS,CAAC,CAAC,EAAE;IACrC,MAAM,IAAIG,KAAK,CAAC,yBAAyBH,SAAS,EAAE,CAAC;EACvD;EAEAZ,OAAO,CAACgB,IAAI,CAAC,0BAA0BJ,SAAS,EAAE,CAAC;EACnD,MAAMK,OAAO,GAAI,MAAMhB,EAAE,CAACiB,QAAQ,CAACN,SAAS,CAAoB;EAEhE,IAAI,CAACO,KAAK,CAACC,OAAO,CAACH,OAAO,CAACI,KAAK,CAAC,IAAIJ,OAAO,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;IAC/D,MAAM,IAAIP,KAAK,CAAC,+BAA+BH,SAAS,mCAAmC,CAAC;EAC9F;EAEA,MAAMW,mBAAmB,GAAGnB,eAAe,CAACG,OAAO,CAACiB,UAAU,CAAC;EAC/D,MAAM;IAAEC,aAAa;IAAED;EAAW,CAAC,GAAGrB,iBAAiB,CAACc,OAAO,CAACI,KAAK,EAAEE,mBAAmB,CAAC;EAC3F,MAAMG,QAAQ,GAAG;IAAEL,KAAK,EAAEJ,OAAO,CAACI,KAAK;IAAEI,aAAa;IAAED;EAAW,CAAC;EAEpE,MAAMG,iBAAiB,GAAGzB,IAAI,CAACW,OAAO,CAACF,SAAS,CAAC;EACjD,MAAMN,gBAAgB,CAACqB,QAAQ,EAAEC,iBAAiB,EAAEJ,mBAAmB,CAAC;AAC1E","ignoreList":[]}
1
+ {"version":3,"file":"irGenTypesHandler.js","names":["consola","fs","path","resolveMinVersion","stripDeprecatedFieldsForSdk","writeAllSdkFiles","irGenTypesHandler","options","schema","schemaPath","output","outputDir","inputPath","resolve","pathExists","Error","info","payload","readJson","Array","isArray","chain","length","minSupportedVersion","latestVersion","minVersion","resolvedOutputDir"],"sources":["irGenTypesHandler.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 {\n type IrChainPayload,\n resolveMinVersion,\n stripDeprecatedFieldsForSdk,\n} from \"../../utils/schema/resolveSchemaChain.js\";\nimport { writeAllSdkFiles } from \"../../utils/schema/writeAllSdkFiles.js\";\n\ninterface IrGenTypesOptions {\n schema: string;\n output: string;\n}\n\nexport async function irGenTypesHandler(options: IrGenTypesOptions): Promise<void> {\n const { schema: schemaPath, output: outputDir } = options;\n\n const inputPath = path.resolve(schemaPath);\n if (!(await fs.pathExists(inputPath))) {\n throw new Error(`Input file not found: ${inputPath}`);\n }\n\n consola.info(`Loading IR chain from: ${inputPath}`);\n const payload = (await fs.readJson(inputPath)) as IrChainPayload;\n\n if (!Array.isArray(payload.chain) || payload.chain.length === 0) {\n throw new Error(`Invalid IR chain payload at ${inputPath}: missing non-empty 'chain' array`);\n }\n\n const { minSupportedVersion } = payload;\n const { latestVersion, minVersion } = resolveMinVersion(payload.chain, minSupportedVersion);\n const chain = stripDeprecatedFieldsForSdk(payload.chain);\n const resolved = { chain, latestVersion, minVersion };\n\n const resolvedOutputDir = path.resolve(outputDir);\n await writeAllSdkFiles(resolved, resolvedOutputDir, minSupportedVersion);\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,SAEEC,iBAAiB,EACjBC,2BAA2B,QACtB,0CAA0C;AACjD,SAASC,gBAAgB,QAAQ,wCAAwC;AAOzE,OAAO,eAAeC,iBAAiBA,CAACC,OAA0B,EAAiB;EACjF,MAAM;IAAEC,MAAM,EAAEC,UAAU;IAAEC,MAAM,EAAEC;EAAU,CAAC,GAAGJ,OAAO;EAEzD,MAAMK,SAAS,GAAGV,IAAI,CAACW,OAAO,CAACJ,UAAU,CAAC;EAC1C,IAAI,EAAE,MAAMR,EAAE,CAACa,UAAU,CAACF,SAAS,CAAC,CAAC,EAAE;IACrC,MAAM,IAAIG,KAAK,CAAC,yBAAyBH,SAAS,EAAE,CAAC;EACvD;EAEAZ,OAAO,CAACgB,IAAI,CAAC,0BAA0BJ,SAAS,EAAE,CAAC;EACnD,MAAMK,OAAO,GAAI,MAAMhB,EAAE,CAACiB,QAAQ,CAACN,SAAS,CAAoB;EAEhE,IAAI,CAACO,KAAK,CAACC,OAAO,CAACH,OAAO,CAACI,KAAK,CAAC,IAAIJ,OAAO,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;IAC/D,MAAM,IAAIP,KAAK,CAAC,+BAA+BH,SAAS,mCAAmC,CAAC;EAC9F;EAEA,MAAM;IAAEW;EAAoB,CAAC,GAAGN,OAAO;EACvC,MAAM;IAAEO,aAAa;IAAEC;EAAW,CAAC,GAAGtB,iBAAiB,CAACc,OAAO,CAACI,KAAK,EAAEE,mBAAmB,CAAC;EAC3F,MAAMF,KAAK,GAAGjB,2BAA2B,CAACa,OAAO,CAACI,KAAK,CAAC;EAGxD,MAAMK,iBAAiB,GAAGxB,IAAI,CAACW,OAAO,CAACF,SAAS,CAAC;EACjD,MAAMN,gBAAgB,CAHL;IAAEgB,KAAK;IAAEG,aAAa;IAAEC;EAAW,CAAC,EAGpBC,iBAAiB,EAAEH,mBAAmB,CAAC;AAC1E","ignoreList":[]}
@@ -21,10 +21,10 @@ import { irGenTypesHandler } from "./irGenTypesHandler.js";
21
21
  import { irGenZodHandler } from "./irGenZodHandler.js";
22
22
  export function registerIrCommands(program) {
23
23
  const irCmd = program.command("ir").description("IR (Intermediate Representation) based generation commands");
24
- 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").option("--min-version <version>", "Minimum supported version").action(irGenTypesHandler);
24
+ 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
25
  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
26
  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
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("asset").description("Generate document type asset JSON from IR schema (advanced — most users should use 'ir deploy' instead)").requiredOption("-i, --ir <file>", "Path to IR JSON file").requiredOption("-o, --output <file>", "Output file path for asset JSON").option("-f, --file-system-type <type>", "File system type (ARTIFACTS or COMPASS)", "ARTIFACTS").action(irGenAssetHandler);
28
+ 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
29
  }
30
30
  //# sourceMappingURL=registerIrCommands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenAssetHandler","irGenModelsHandler","irGenTypesHandler","irGenZodHandler","registerIrCommands","program","irCmd","command","description","requiredOption","option","action"],"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 .option(\"--min-version <version>\", \"Minimum supported version\")\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 from IR schema (advanced — most users should use 'ir deploy' instead)\",\n )\n .requiredOption(\"-i, --ir <file>\", \"Path to IR JSON file\")\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 .action(irGenAssetHandler);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA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,iBAAiB,EAAE,sBAAsB,CAAC,CACzDA,cAAc,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAClEA,cAAc,CAAC,oBAAoB,EAAE,sCAAsC,CAAC,CAC5EA,cAAc,CAAC,2BAA2B,EAAE,yCAAyC,CAAC,CACtFA,cAAc,CACb,+BAA+B,EAC/B,+DACF,CAAC,CACAE,MAAM,CAACZ,eAAe,CAAC;EAE1BO,KAAK,CACFC,OAAO,CAAC,OAAO,CAAC,CAChBC,WAAW,CACV,yGACF,CAAC,CACAC,cAAc,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CACzDA,cAAc,CAAC,qBAAqB,EAAE,iCAAiC,CAAC,CACxEC,MAAM,CACL,+BAA+B,EAC/B,yCAAyC,EACzC,WACF,CAAC,CACAC,MAAM,CAACX,iBAAiB,CAAC;AAC9B","ignoreList":[]}
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,WAAW,CAAC,4DAA4D,CAAC;EAE5EF,KAAK,CACFC,OAAO,CAAC,WAAW,CAAC,CACpBC,WAAW,CACV,gJACF,CAAC,CACAC,cAAc,CAAC,qBAAqB,EAAE,sCAAsC,CAAC,CAC7EA,cAAc,CAAC,oBAAoB,EAAE,0CAA0C,CAAC,CAChFC,MAAM,CAACR,iBAAiB,CAAC;EAE5BI,KAAK,CACFC,OAAO,CAAC,KAAK,CAAC,CACdC,WAAW,CAAC,0DAA0D,CAAC,CACvEC,cAAc,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CACjEA,cAAc,CAAC,qBAAqB,EAAE,4CAA4C,CAAC,CACnFE,MAAM,CACL,+BAA+B,EAC/B,yDACF,CAAC,CACAD,MAAM,CAACP,eAAe,CAAC;EAE1BG,KAAK,CACFC,OAAO,CAAC,QAAQ,CAAC,CACjBC,WAAW,CAAC,8DAA8D,CAAC,CAC3EC,cAAc,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CACjEA,cAAc,CAAC,qBAAqB,EAAE,gDAAgD,CAAC,CACvFE,MAAM,CACL,+BAA+B,EAC/B,2BAA2B,EAC3B,YACF,CAAC,CACAA,MAAM,CACL,6BAA6B,EAC7B,6BAA6B,EAC7B,aACF,CAAC,CACAD,MAAM,CAACT,kBAAkB,CAAC;EAE7BK,KAAK,CACFC,OAAO,CAAC,QAAQ,CAAC,CACjBC,WAAW,CAAC,uEAAuE,CAAC,CACpFC,cAAc,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CACzDA,cAAc,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAClEA,cAAc,CAAC,oBAAoB,EAAE,sCAAsC,CAAC,CAC5EA,cAAc,CAAC,2BAA2B,EAAE,yCAAyC,CAAC,CACtFA,cAAc,CACb,+BAA+B,EAC/B,+DACF,CAAC,CACAC,MAAM,CAACX,eAAe,CAAC;EAE1BO,KAAK,CACFC,OAAO,CAAC,OAAO,CAAC,CAChBC,WAAW,CACV,4VACF,CAAC,CACAC,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":[]}
@@ -0,0 +1,112 @@
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 fs from "fs-extra";
18
+ import os from "os";
19
+ import path from "path";
20
+ import { afterEach, beforeEach, describe, expect, it } from "vitest";
21
+ import { readPackConfig } from "../schemaIrHandler.js";
22
+ describe("readPackConfig", () => {
23
+ let tmpDir;
24
+ beforeEach(async () => {
25
+ tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "pack-config-"));
26
+ });
27
+ afterEach(async () => {
28
+ await fs.remove(tmpDir);
29
+ });
30
+ async function writeConfig(config) {
31
+ const configPath = path.join(tmpDir, "pack-config.json");
32
+ await fs.writeJson(configPath, config);
33
+ return configPath;
34
+ }
35
+ it("reads a valid config", async () => {
36
+ const configPath = await writeConfig({
37
+ documentTypeName: "Canvas Document Type",
38
+ documentTypeDescription: "Document type description for demo canvas",
39
+ minSupportedVersion: 1
40
+ });
41
+ await expect(readPackConfig(configPath)).resolves.toEqual({
42
+ documentTypeName: "Canvas Document Type",
43
+ documentTypeDescription: "Document type description for demo canvas",
44
+ minSupportedVersion: 1
45
+ });
46
+ });
47
+ it("reads a valid config with minSupportedVersion omitted", async () => {
48
+ const configPath = await writeConfig({
49
+ documentTypeName: "Canvas Document Type",
50
+ documentTypeDescription: "Document type description for demo canvas"
51
+ });
52
+ await expect(readPackConfig(configPath)).resolves.toEqual({
53
+ documentTypeName: "Canvas Document Type",
54
+ documentTypeDescription: "Document type description for demo canvas",
55
+ minSupportedVersion: undefined
56
+ });
57
+ });
58
+ it("throws when the config file does not exist", async () => {
59
+ const configPath = path.join(tmpDir, "missing.json");
60
+ await expect(readPackConfig(configPath)).rejects.toThrow(`--config file not found: ${configPath}`);
61
+ });
62
+ it("throws when documentTypeName is missing", async () => {
63
+ const configPath = await writeConfig({
64
+ documentTypeDescription: "Document type description for demo canvas"
65
+ });
66
+ await expect(readPackConfig(configPath)).rejects.toThrow("'documentTypeName' is required");
67
+ });
68
+ it("throws when documentTypeName is an empty string", async () => {
69
+ const configPath = await writeConfig({
70
+ documentTypeName: " ",
71
+ documentTypeDescription: "Document type description for demo canvas"
72
+ });
73
+ await expect(readPackConfig(configPath)).rejects.toThrow("'documentTypeName' in");
74
+ });
75
+ it("throws when documentTypeName is not a string", async () => {
76
+ const configPath = await writeConfig({
77
+ documentTypeName: 42,
78
+ documentTypeDescription: "Document type description for demo canvas"
79
+ });
80
+ await expect(readPackConfig(configPath)).rejects.toThrow("'documentTypeName' in");
81
+ });
82
+ it("throws when documentTypeDescription is missing", async () => {
83
+ const configPath = await writeConfig({
84
+ documentTypeName: "Canvas Document Type"
85
+ });
86
+ await expect(readPackConfig(configPath)).rejects.toThrow("'documentTypeDescription' is required");
87
+ });
88
+ it("throws when documentTypeDescription is an empty string", async () => {
89
+ const configPath = await writeConfig({
90
+ documentTypeName: "Canvas Document Type",
91
+ documentTypeDescription: ""
92
+ });
93
+ await expect(readPackConfig(configPath)).rejects.toThrow("'documentTypeDescription' in");
94
+ });
95
+ it("throws when minSupportedVersion is not a positive integer", async () => {
96
+ const configPath = await writeConfig({
97
+ documentTypeName: "Canvas Document Type",
98
+ documentTypeDescription: "Document type description for demo canvas",
99
+ minSupportedVersion: 0
100
+ });
101
+ await expect(readPackConfig(configPath)).rejects.toThrow("'minSupportedVersion' in");
102
+ });
103
+ it("throws when minSupportedVersion is not an integer", async () => {
104
+ const configPath = await writeConfig({
105
+ documentTypeName: "Canvas Document Type",
106
+ documentTypeDescription: "Document type description for demo canvas",
107
+ minSupportedVersion: 1.5
108
+ });
109
+ await expect(readPackConfig(configPath)).rejects.toThrow("'minSupportedVersion' in");
110
+ });
111
+ });
112
+ //# sourceMappingURL=readPackConfig.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readPackConfig.test.js","names":["fs","os","path","afterEach","beforeEach","describe","expect","it","readPackConfig","tmpDir","mkdtemp","join","tmpdir","remove","writeConfig","config","configPath","writeJson","documentTypeName","documentTypeDescription","minSupportedVersion","resolves","toEqual","undefined","rejects","toThrow"],"sources":["readPackConfig.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 fs from \"fs-extra\";\nimport os from \"os\";\nimport path from \"path\";\nimport { afterEach, beforeEach, describe, expect, it } from \"vitest\";\nimport { readPackConfig } from \"../schemaIrHandler.js\";\n\ndescribe(\"readPackConfig\", () => {\n let tmpDir: string;\n\n beforeEach(async () => {\n tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), \"pack-config-\"));\n });\n\n afterEach(async () => {\n await fs.remove(tmpDir);\n });\n\n async function writeConfig(config: unknown): Promise<string> {\n const configPath = path.join(tmpDir, \"pack-config.json\");\n await fs.writeJson(configPath, config);\n return configPath;\n }\n\n it(\"reads a valid config\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"Document type description for demo canvas\",\n minSupportedVersion: 1,\n });\n await expect(readPackConfig(configPath)).resolves.toEqual({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"Document type description for demo canvas\",\n minSupportedVersion: 1,\n });\n });\n\n it(\"reads a valid config with minSupportedVersion omitted\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"Document type description for demo canvas\",\n });\n await expect(readPackConfig(configPath)).resolves.toEqual({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"Document type description for demo canvas\",\n minSupportedVersion: undefined,\n });\n });\n\n it(\"throws when the config file does not exist\", async () => {\n const configPath = path.join(tmpDir, \"missing.json\");\n await expect(readPackConfig(configPath)).rejects.toThrow(\n `--config file not found: ${configPath}`,\n );\n });\n\n it(\"throws when documentTypeName is missing\", async () => {\n const configPath = await writeConfig({\n documentTypeDescription: \"Document type description for demo canvas\",\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'documentTypeName' is required\",\n );\n });\n\n it(\"throws when documentTypeName is an empty string\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \" \",\n documentTypeDescription: \"Document type description for demo canvas\",\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'documentTypeName' in\",\n );\n });\n\n it(\"throws when documentTypeName is not a string\", async () => {\n const configPath = await writeConfig({\n documentTypeName: 42,\n documentTypeDescription: \"Document type description for demo canvas\",\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'documentTypeName' in\",\n );\n });\n\n it(\"throws when documentTypeDescription is missing\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \"Canvas Document Type\",\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'documentTypeDescription' is required\",\n );\n });\n\n it(\"throws when documentTypeDescription is an empty string\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"\",\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'documentTypeDescription' in\",\n );\n });\n\n it(\"throws when minSupportedVersion is not a positive integer\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"Document type description for demo canvas\",\n minSupportedVersion: 0,\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'minSupportedVersion' in\",\n );\n });\n\n it(\"throws when minSupportedVersion is not an integer\", async () => {\n const configPath = await writeConfig({\n documentTypeName: \"Canvas Document Type\",\n documentTypeDescription: \"Document type description for demo canvas\",\n minSupportedVersion: 1.5,\n });\n await expect(readPackConfig(configPath)).rejects.toThrow(\n \"'minSupportedVersion' in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AO,CAACC,OAAO,CACtD,0BACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","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").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.").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 .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,CAClEC,MAAM,CAACR,eAAe,CAAC;AAC5B","ignoreList":[]}
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":[]}