@palantir/pack.document-schema.type-gen 0.14.0 → 0.16.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.
- package/README.md +19 -0
- package/build/esm/cli.js +0 -2
- package/build/esm/cli.js.map +1 -1
- package/build/esm/commands/ir/irDeployHandler.js +67 -16
- package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
- package/build/esm/commands/ir/irGenAssetHandler.js +3 -5
- package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
- package/build/esm/commands/{asset/assetUpdateSchemaHandler.js → ir/irUpdateSchemaHandler.js} +26 -32
- package/build/esm/commands/ir/irUpdateSchemaHandler.js.map +1 -0
- package/build/esm/commands/ir/registerIrCommands.js +3 -1
- package/build/esm/commands/ir/registerIrCommands.js.map +1 -1
- package/build/esm/commands/schema/schemaIrHandler.js +1 -1
- package/build/esm/commands/schema/schemaIrHandler.js.map +1 -1
- package/build/esm/commands/steps/stepsGenIrHandler.js +1 -1
- package/build/esm/commands/steps/stepsGenIrHandler.js.map +1 -1
- package/build/esm/commands/types.js.map +1 -1
- package/build/esm/commands/{asset → utils}/__tests__/buildPrefixRewriteFetch.test.js +1 -1
- package/build/esm/commands/utils/__tests__/buildPrefixRewriteFetch.test.js.map +1 -0
- package/build/esm/commands/utils/firstPartyPrefix.js +47 -0
- package/build/esm/commands/utils/firstPartyPrefix.js.map +1 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -1
- package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/commands/ir/irDeployHandler.d.ts +8 -2
- package/build/types/commands/ir/irDeployHandler.d.ts.map +1 -1
- package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
- package/build/types/commands/ir/irUpdateSchemaHandler.d.ts +15 -0
- package/build/types/commands/ir/irUpdateSchemaHandler.d.ts.map +1 -0
- package/build/types/commands/ir/registerIrCommands.d.ts.map +1 -1
- package/build/types/commands/types.d.ts +1 -3
- package/build/types/commands/types.d.ts.map +1 -1
- package/build/types/commands/utils/__tests__/buildPrefixRewriteFetch.test.d.ts.map +1 -0
- package/build/types/commands/{asset/assetDeployHandler.d.ts → utils/firstPartyPrefix.d.ts} +2 -11
- package/build/types/commands/utils/firstPartyPrefix.d.ts.map +1 -0
- package/build/types/utils/schema/resolveSchemaChain.d.ts +1 -1
- package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -1
- package/package.json +3 -3
- package/build/esm/commands/asset/__tests__/buildPrefixRewriteFetch.test.js.map +0 -1
- package/build/esm/commands/asset/assetDeployHandler.js +0 -95
- package/build/esm/commands/asset/assetDeployHandler.js.map +0 -1
- package/build/esm/commands/asset/assetUpdateSchemaHandler.js.map +0 -1
- package/build/esm/commands/asset/registerAssetCommands.js +0 -24
- package/build/esm/commands/asset/registerAssetCommands.js.map +0 -1
- package/build/types/commands/asset/__tests__/buildPrefixRewriteFetch.test.d.ts.map +0 -1
- package/build/types/commands/asset/assetDeployHandler.d.ts.map +0 -1
- package/build/types/commands/asset/assetUpdateSchemaHandler.d.ts +0 -12
- package/build/types/commands/asset/assetUpdateSchemaHandler.d.ts.map +0 -1
- package/build/types/commands/asset/registerAssetCommands.d.ts +0 -3
- package/build/types/commands/asset/registerAssetCommands.d.ts.map +0 -1
- /package/build/types/commands/{asset → utils}/__tests__/buildPrefixRewriteFetch.test.d.ts +0 -0
package/README.md
CHANGED
|
@@ -53,6 +53,25 @@ Generate schemas from Intermediate Representation format:
|
|
|
53
53
|
type-gen ir zod -s <schema.json> -r <records.json> -o <output.ts>
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
Deploy and update document types directly from an IR file (the wire schema and version are sourced
|
|
57
|
+
from the IR):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Create a third-party document type (default)
|
|
61
|
+
type-gen ir deploy -i <ir.json> -b <base-url> -a <token> -p <parent-folder-rid> [-f ARTIFACTS|COMPASS]
|
|
62
|
+
|
|
63
|
+
# Create a first-party document type
|
|
64
|
+
type-gen ir deploy -i <ir.json> -b <base-url> -a <token> --first-party -o <ontology-rid> \
|
|
65
|
+
[-f ARTIFACTS|COMPASS] [--first-party-prefix /api/gotham]
|
|
66
|
+
|
|
67
|
+
# Update an existing document type's schema
|
|
68
|
+
type-gen ir update-schema -i <ir.json> -b <base-url> -a <token> -o <ontology-rid> \
|
|
69
|
+
[--force-overwrite] [--first-party-prefix /api/gotham]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`ir asset` (generate an asset JSON consumed by backpack's asset-track loader) remains available;
|
|
73
|
+
the deploy/update-schema REST commands are IR-sourced.
|
|
74
|
+
|
|
56
75
|
### Examples
|
|
57
76
|
|
|
58
77
|
#### Generating TypeScript Types from YAML
|
package/build/esm/cli.js
CHANGED
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Command } from "commander";
|
|
18
|
-
import { registerAssetCommands } from "./commands/asset/registerAssetCommands.js";
|
|
19
18
|
import { registerIrCommands } from "./commands/ir/registerIrCommands.js";
|
|
20
19
|
import { registerSchemaCommands } from "./commands/schema/registerSchemaCommands.js";
|
|
21
20
|
import { registerStepsCommands } from "./commands/steps/registerStepsCommands.js";
|
|
22
21
|
export function cli(args) {
|
|
23
22
|
const program = new Command();
|
|
24
23
|
program.name("document-schema-type-gen").description("Document schema type generation CLI").version("0.0.1");
|
|
25
|
-
registerAssetCommands(program);
|
|
26
24
|
registerIrCommands(program);
|
|
27
25
|
registerSchemaCommands(program);
|
|
28
26
|
registerStepsCommands(program);
|
package/build/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":["Command","
|
|
1
|
+
{"version":3,"file":"cli.js","names":["Command","registerIrCommands","registerSchemaCommands","registerStepsCommands","cli","args","program","name","description","version","parse"],"sources":["cli.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Command } from \"commander\";\nimport { registerIrCommands } from \"./commands/ir/registerIrCommands.js\";\nimport { registerSchemaCommands } from \"./commands/schema/registerSchemaCommands.js\";\nimport { registerStepsCommands } from \"./commands/steps/registerStepsCommands.js\";\n\nexport function cli(args: string[]): void {\n const program = new Command();\n\n program\n .name(\"document-schema-type-gen\")\n .description(\"Document schema type generation CLI\")\n .version(\"0.0.1\");\n\n registerIrCommands(program);\n registerSchemaCommands(program);\n registerStepsCommands(program);\n\n program.parse(args);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;AACnC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,sBAAsB,QAAQ,6CAA6C;AACpF,SAASC,qBAAqB,QAAQ,2CAA2C;AAEjF,OAAO,SAASC,GAAGA,CAACC,IAAc,EAAQ;EACxC,MAAMC,OAAO,GAAG,IAAIN,OAAO,CAAC,CAAC;EAE7BM,OAAO,CACJC,IAAI,CAAC,0BAA0B,CAAC,CAChCC,WAAW,CAAC,qCAAqC,CAAC,CAClDC,OAAO,CAAC,OAAO,CAAC;EAEnBR,kBAAkB,CAACK,OAAO,CAAC;EAC3BJ,sBAAsB,CAACI,OAAO,CAAC;EAC/BH,qBAAqB,CAACG,OAAO,CAAC;EAE9BA,OAAO,CAACI,KAAK,CAACL,IAAI,CAAC;AACrB","ignoreList":[]}
|
|
@@ -14,39 +14,90 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { createPlatformClient } from "@osdk/client";
|
|
17
|
+
import { createPlatformClient, PalantirApiError } from "@osdk/client";
|
|
18
18
|
import { DocumentTypes } from "@osdk/foundry.pack";
|
|
19
19
|
import { CommanderError } from "commander";
|
|
20
20
|
import { consola } from "consola";
|
|
21
21
|
import { readFileSync } from "fs";
|
|
22
22
|
import { resolve } from "path";
|
|
23
23
|
import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
|
|
24
|
+
import { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from "../utils/firstPartyPrefix.js";
|
|
24
25
|
import { resolveIrInput } from "./resolveIrInput.js";
|
|
25
26
|
export async function irDeployHandler(options) {
|
|
26
27
|
try {
|
|
27
28
|
const irPath = resolve(options.ir);
|
|
28
29
|
consola.info(`Reading schema from: ${irPath}`);
|
|
29
|
-
const irContent = readFileSync(irPath, "utf8");
|
|
30
30
|
const {
|
|
31
|
-
ir
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
ir,
|
|
32
|
+
latestVersion
|
|
33
|
+
} = resolveIrInput(JSON.parse(readFileSync(irPath, "utf8")), irPath);
|
|
34
34
|
const schema = convertIrToWireSchema(ir);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (options.fileSystemType != null) {
|
|
41
|
-
request.fileSystemType = options.fileSystemType;
|
|
35
|
+
const fileSystemType = options.fileSystemType ?? "ARTIFACTS";
|
|
36
|
+
if (options.firstParty) {
|
|
37
|
+
await deployFirstParty(options, ir.name, schema, latestVersion, fileSystemType);
|
|
38
|
+
} else {
|
|
39
|
+
await deployThirdParty(options, ir.name, schema, fileSystemType);
|
|
42
40
|
}
|
|
43
|
-
consola.info("Creating document type with schema", request);
|
|
44
|
-
await DocumentTypes.create(osdkClient, request, {
|
|
45
|
-
preview: true
|
|
46
|
-
});
|
|
47
41
|
} catch (error) {
|
|
42
|
+
if (error instanceof CommanderError) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
48
45
|
consola.error("❌ Error during Deploy:", error);
|
|
49
46
|
throw new CommanderError(1, "ERRIRMDEPLOY", "Error deploying IR document schema");
|
|
50
47
|
}
|
|
51
48
|
}
|
|
49
|
+
async function deployThirdParty(options, name, schema, fileSystemType) {
|
|
50
|
+
if (options.parentFolder == null) {
|
|
51
|
+
throw new CommanderError(1, "EINVAL", "--parent-folder is required when deploying a third-party document type");
|
|
52
|
+
}
|
|
53
|
+
const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));
|
|
54
|
+
const request = {
|
|
55
|
+
name,
|
|
56
|
+
parentFolderRid: options.parentFolder,
|
|
57
|
+
schema,
|
|
58
|
+
fileSystemType
|
|
59
|
+
};
|
|
60
|
+
consola.info("Creating document type with schema", request);
|
|
61
|
+
const result = await DocumentTypes.create(osdkClient, request, {
|
|
62
|
+
preview: true
|
|
63
|
+
});
|
|
64
|
+
consola.success("Successfully created document type", result);
|
|
65
|
+
}
|
|
66
|
+
async function deployFirstParty(options, name, schema, version, fileSystemType) {
|
|
67
|
+
if (options.ontologyRid == null) {
|
|
68
|
+
throw new CommanderError(1, "EINVAL", "--ontology-rid is required when deploying a first-party document type");
|
|
69
|
+
}
|
|
70
|
+
const fetchFn = options.firstPartyPrefix != null ? buildPrefixRewriteFetch(options.firstPartyPrefix) : undefined;
|
|
71
|
+
if (fetchFn != null) {
|
|
72
|
+
consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);
|
|
73
|
+
}
|
|
74
|
+
const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth), undefined, fetchFn);
|
|
75
|
+
const request = {
|
|
76
|
+
requestBody: {
|
|
77
|
+
name,
|
|
78
|
+
ontologyRid: options.ontologyRid,
|
|
79
|
+
schema,
|
|
80
|
+
version,
|
|
81
|
+
fileSystemType
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
consola.info("Creating first-party document type", request);
|
|
85
|
+
try {
|
|
86
|
+
const result = await DocumentTypes.createFirstParty(osdkClient, request, {
|
|
87
|
+
preview: true
|
|
88
|
+
});
|
|
89
|
+
consola.success("Successfully created first-party document type", result);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof PalantirApiError) {
|
|
92
|
+
const {
|
|
93
|
+
message,
|
|
94
|
+
errorName,
|
|
95
|
+
errorCode
|
|
96
|
+
} = error;
|
|
97
|
+
const details = [errorName, errorCode].filter(Boolean).join(" ");
|
|
98
|
+
consola.error(`❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : ""}`);
|
|
99
|
+
}
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
52
103
|
//# sourceMappingURL=irDeployHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","resolveIrInput","irDeployHandler","options","irPath","ir","info","
|
|
1
|
+
{"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","resolveIrInput","irDeployHandler","options","irPath","ir","info","latestVersion","JSON","parse","schema","fileSystemType","firstParty","deployFirstParty","name","deployThirdParty","error","parentFolder","osdkClient","baseUrl","Promise","auth","request","parentFolderRid","result","create","preview","success","version","ontologyRid","fetchFn","firstPartyPrefix","undefined","requestBody","createFirstParty","message","errorName","errorCode","details","filter","Boolean","join"],"sources":["irDeployHandler.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPlatformClient, PalantirApiError } from \"@osdk/client\";\nimport type {\n CreateDocumentTypeRequest,\n CreateFirstPartyDocumentTypeRequest,\n} from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport type { FileSystemType } from \"../types.js\";\nimport { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from \"../utils/firstPartyPrefix.js\";\nimport { resolveIrInput } from \"./resolveIrInput.js\";\n\ninterface DeployOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly fileSystemType?: FileSystemType;\n readonly firstParty?: boolean;\n /** Required for third-party deploys. */\n readonly parentFolder?: string;\n /** Required for first-party deploys. */\n readonly ontologyRid?: string;\n /** Overrides the API prefix for first-party deploys (e.g. /api/gotham). */\n readonly firstPartyPrefix?: string;\n}\n\nexport async function irDeployHandler(options: DeployOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n consola.info(`Reading schema from: ${irPath}`);\n\n const { ir, latestVersion } = resolveIrInput(\n JSON.parse(readFileSync(irPath, \"utf8\")) as unknown,\n irPath,\n );\n const schema = convertIrToWireSchema(ir);\n const fileSystemType = options.fileSystemType ?? \"ARTIFACTS\";\n\n if (options.firstParty) {\n await deployFirstParty(options, ir.name, schema, latestVersion, fileSystemType);\n } else {\n await deployThirdParty(options, ir.name, schema, fileSystemType);\n }\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"❌ Error during Deploy:\", error);\n throw new CommanderError(1, \"ERRIRMDEPLOY\", \"Error deploying IR document schema\");\n }\n}\n\ntype DocumentTypeSchema = CreateDocumentTypeRequest[\"schema\"];\n\nasync function deployThirdParty(\n options: DeployOptions,\n name: string,\n schema: DocumentTypeSchema,\n fileSystemType: FileSystemType,\n): Promise<void> {\n if (options.parentFolder == null) {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n \"--parent-folder is required when deploying a third-party document type\",\n );\n }\n\n const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));\n\n const request: CreateDocumentTypeRequest = {\n name,\n parentFolderRid: options.parentFolder,\n schema,\n fileSystemType,\n };\n\n consola.info(\"Creating document type with schema\", request);\n const result = await DocumentTypes.create(osdkClient, request, { preview: true });\n consola.success(\"Successfully created document type\", result);\n}\n\nasync function deployFirstParty(\n options: DeployOptions,\n name: string,\n schema: DocumentTypeSchema,\n version: number,\n fileSystemType: FileSystemType,\n): Promise<void> {\n if (options.ontologyRid == null) {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n \"--ontology-rid is required when deploying a first-party document type\",\n );\n }\n\n const fetchFn = options.firstPartyPrefix != null\n ? buildPrefixRewriteFetch(options.firstPartyPrefix)\n : undefined;\n if (fetchFn != null) {\n consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);\n }\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n undefined,\n fetchFn,\n );\n\n const request: CreateFirstPartyDocumentTypeRequest = {\n requestBody: {\n name,\n ontologyRid: options.ontologyRid,\n schema,\n version,\n fileSystemType,\n },\n };\n\n consola.info(\"Creating first-party document type\", request);\n try {\n const result = await DocumentTypes.createFirstParty(osdkClient, request, { preview: true });\n consola.success(\"Successfully created first-party document type\", result);\n } catch (error) {\n if (error instanceof PalantirApiError) {\n const { message, errorName, errorCode } = error;\n const details = [errorName, errorCode].filter(Boolean).join(\" \");\n consola.error(\n `❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : \"\"}`,\n );\n }\n throw error;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,cAAc;AAKrE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAC9B,SAASC,qBAAqB,QAAQ,yCAAyC;AA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AAC0B,WAAW;MAChCnB,MAAM;MACNkB,OAAO;MACPjB;IACF;EACF,CAAC;EAEDhB,OAAO,CAACW,IAAI,CAAC,oCAAoC,EAAEgB,OAAO,CAAC;EAC3D,IAAI;IACF,MAAME,MAAM,GAAG,MAAM/B,aAAa,CAACyC,gBAAgB,CAAChB,UAAU,EAAEI,OAAO,EAAE;MAAEI,OAAO,EAAE;IAAK,CAAC,CAAC;IAC3F/B,OAAO,CAACgC,OAAO,CAAC,gDAAgD,EAAEH,MAAM,CAAC;EAC3E,CAAC,CAAC,OAAOR,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYxB,gBAAgB,EAAE;MACrC,MAAM;QAAE2C,OAAO;QAAEC,SAAS;QAAEC;MAAU,CAAC,GAAGrB,KAAK;MAC/C,MAAMsB,OAAO,GAAG,CAACF,SAAS,EAAEC,SAAS,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAChE9C,OAAO,CAACqB,KAAK,CACX,sCAAsCmB,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAChF,CAAC;IACH;IACA,MAAMtB,KAAK;EACb;AACF","ignoreList":[]}
|
|
@@ -76,14 +76,12 @@ export function irGenAssetHandler(options) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
const output = {
|
|
79
|
-
|
|
79
|
+
comment: GENERATED_JSON_COMMENT,
|
|
80
80
|
...{
|
|
81
81
|
documentTypeName,
|
|
82
82
|
documentStorageType: {
|
|
83
83
|
type: "yjs",
|
|
84
|
-
|
|
85
|
-
schema: wireSchema
|
|
86
|
-
}
|
|
84
|
+
schema: wireSchema
|
|
87
85
|
},
|
|
88
86
|
fileSystemType,
|
|
89
87
|
schemaVersion: latestVersion
|
|
@@ -98,7 +96,7 @@ export function irGenAssetHandler(options) {
|
|
|
98
96
|
});
|
|
99
97
|
}
|
|
100
98
|
const compatibilityRangeOutput = {
|
|
101
|
-
|
|
99
|
+
comment: GENERATED_JSON_COMMENT,
|
|
102
100
|
...{
|
|
103
101
|
min: minSupportedVersion,
|
|
104
102
|
max: latestVersion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"irGenAssetHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readFileSync","writeFileSync","basename","dirname","extname","join","resolve","GENERATED_JSON_COMMENT","convertIrToWireSchema","resolveIrInput","deriveCompatibilityRangePath","assetOutputPath","stem","irGenAssetHandler","options","irPath","ir","outputPath","output","info","parsed","JSON","parse","resolved","irSchema","latestVersion","minSupportedVersion","name","documentTypeName","wireSchema","fileSystemType","outputDir","recursive","
|
|
1
|
+
{"version":3,"file":"irGenAssetHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readFileSync","writeFileSync","basename","dirname","extname","join","resolve","GENERATED_JSON_COMMENT","convertIrToWireSchema","resolveIrInput","deriveCompatibilityRangePath","assetOutputPath","stem","irGenAssetHandler","options","irPath","ir","outputPath","output","info","parsed","JSON","parse","resolved","irSchema","latestVersion","minSupportedVersion","name","documentTypeName","wireSchema","fileSystemType","outputDir","recursive","comment","documentStorageType","type","schema","schemaVersion","stringify","compatibilityRangePath","compatibilityRangeOutput","compatibilityRangeDir","min","max","success","error"],"sources":["irGenAssetHandler.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\";\nimport { basename, dirname, extname, join, resolve } from \"path\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport type { DocumentTypeAsset, FileSystemType } from \"../types.js\";\nimport { resolveIrInput } from \"./resolveIrInput.js\";\n\ninterface IrGenAssetOptions {\n readonly ir: string;\n readonly output: string;\n readonly fileSystemType?: FileSystemType;\n readonly compatibilityRangeOutput?: string;\n}\n\ninterface SchemaCompatibilityRangeFile {\n readonly min: number;\n readonly max: number;\n}\n\nfunction deriveCompatibilityRangePath(assetOutputPath: string): string {\n const stem = basename(assetOutputPath, extname(assetOutputPath));\n return join(dirname(assetOutputPath), `${stem}-schema-compatibility-range.json`);\n}\n\n/**\n * Generates a document type asset JSON file (and a sibling schema\n * compatibility range JSON file) from an IR schema.\n *\n * The input IR may be either:\n * - a chain payload `{ latestVersion, minSupportedVersion?, chain }` produced\n * by `schema ir`. The latest entry's `ir` is used as the wire schema; the\n * asset's `schemaVersion` is `latestVersion`; the compatibility range is\n * `{ min: minSupportedVersion ?? latestVersion, max: latestVersion }`.\n * - a bare single-version `IRealTimeDocumentSchema` (legacy). The compat\n * range defaults to `{ min: version, max: version }` since no chain\n * information is available.\n *\n * This command is intended for internal platform applications where the\n * document type asset must exist on disk so the platform can discover it and\n * register the document type automatically at deploy time. Most users should\n * use `ir deploy` to register document types via the Foundry API instead.\n *\n * If you are unsure whether you need this command, you almost certainly do not.\n */\nexport function irGenAssetHandler(options: IrGenAssetOptions): void {\n try {\n const irPath = resolve(options.ir);\n const outputPath = resolve(options.output);\n\n if (!existsSync(irPath)) {\n throw new CommanderError(1, \"ENOENT\", `IR file does not exist: ${irPath}`);\n }\n\n consola.info(`Reading IR schema from: ${irPath}`);\n const parsed = JSON.parse(readFileSync(irPath, \"utf8\")) as unknown;\n\n const resolved = resolveIrInput(parsed, irPath);\n\n const { ir: irSchema, latestVersion, minSupportedVersion } = resolved;\n const { name: documentTypeName } = irSchema;\n const wireSchema = convertIrToWireSchema(irSchema);\n\n const fileSystemType = options.fileSystemType ?? \"ARTIFACTS\";\n if (fileSystemType !== \"ARTIFACTS\" && fileSystemType !== \"COMPASS\") {\n throw new CommanderError(\n 1,\n \"EINVAL\",\n `Invalid fileSystemType \"${fileSystemType}\". Must be \"ARTIFACTS\" or \"COMPASS\".`,\n );\n }\n\n const asset: DocumentTypeAsset = {\n documentTypeName,\n documentStorageType: {\n type: \"yjs\",\n schema: wireSchema,\n },\n fileSystemType,\n schemaVersion: latestVersion,\n };\n\n const outputDir = dirname(outputPath);\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n const output = { comment: GENERATED_JSON_COMMENT, ...asset };\n writeFileSync(outputPath, JSON.stringify(output, null, 2), \"utf8\");\n\n const compatibilityRange: SchemaCompatibilityRangeFile = {\n min: minSupportedVersion,\n max: latestVersion,\n };\n const compatibilityRangePath = resolve(\n options.compatibilityRangeOutput ?? deriveCompatibilityRangePath(outputPath),\n );\n const compatibilityRangeDir = dirname(compatibilityRangePath);\n if (!existsSync(compatibilityRangeDir)) {\n mkdirSync(compatibilityRangeDir, { recursive: true });\n }\n const compatibilityRangeOutput = {\n comment: GENERATED_JSON_COMMENT,\n ...compatibilityRange,\n };\n writeFileSync(\n compatibilityRangePath,\n JSON.stringify(compatibilityRangeOutput, null, 2),\n \"utf8\",\n );\n\n consola.success(\"Successfully generated document type asset\");\n consola.info(` Output: ${outputPath}`);\n consola.info(` Compatibility range output: ${compatibilityRangePath}`);\n consola.info(` Document type: ${documentTypeName}`);\n consola.info(` Schema version: ${latestVersion}`);\n consola.info(` Compatibility range: [${minSupportedVersion}, ${latestVersion}]`);\n consola.info(` File system type: ${fileSystemType}`);\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"Error generating document type asset:\", error);\n throw new CommanderError(1, \"IR_ASSET_ERROR\", \"Failed to generate document type asset\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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;IACA,MAAMQ,wBAAwB,GAAG;MAC/BP,OAAO,EAAE1B,sBAAsB;MAC/B,GAbuD;QACvDmC,GAAG,EAAEhB,mBAAmB;QACxBiB,GAAG,EAAElB;MACP;IAWA,CAAC;IACDxB,aAAa,CACXsC,sBAAsB,EACtBlB,IAAI,CAACiB,SAAS,CAACE,wBAAwB,EAAE,IAAI,EAAE,CAAC,CAAC,EACjD,MACF,CAAC;IAED3C,OAAO,CAAC+C,OAAO,CAAC,4CAA4C,CAAC;IAC7D/C,OAAO,CAACsB,IAAI,CAAC,cAAcF,UAAU,EAAE,CAAC;IACxCpB,OAAO,CAACsB,IAAI,CAAC,kCAAkCoB,sBAAsB,EAAE,CAAC;IACxE1C,OAAO,CAACsB,IAAI,CAAC,qBAAqBS,gBAAgB,EAAE,CAAC;IACrD/B,OAAO,CAACsB,IAAI,CAAC,sBAAsBM,aAAa,EAAE,CAAC;IACnD5B,OAAO,CAACsB,IAAI,CAAC,4BAA4BO,mBAAmB,KAAKD,aAAa,GAAG,CAAC;IAClF5B,OAAO,CAACsB,IAAI,CAAC,wBAAwBW,cAAc,EAAE,CAAC;EACxD,CAAC,CAAC,OAAOe,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYjD,cAAc,EAAE;MACnC,MAAMiD,KAAK;IACb;IACAhD,OAAO,CAACgD,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;IAC7D,MAAM,IAAIjD,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,wCAAwC,CAAC;EACzF;AACF","ignoreList":[]}
|
package/build/esm/commands/{asset/assetUpdateSchemaHandler.js → ir/irUpdateSchemaHandler.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,34 +14,39 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { createPlatformClient
|
|
17
|
+
import { createPlatformClient } from "@osdk/client";
|
|
18
18
|
import { DocumentTypes } from "@osdk/foundry.pack";
|
|
19
19
|
import { CommanderError } from "commander";
|
|
20
20
|
import { consola } from "consola";
|
|
21
21
|
import { readFileSync } from "fs";
|
|
22
22
|
import { resolve } from "path";
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
23
|
+
import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
|
|
24
|
+
import { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from "../utils/firstPartyPrefix.js";
|
|
25
|
+
import { resolveIrInput } from "./resolveIrInput.js";
|
|
26
|
+
/**
|
|
27
|
+
* Updates the schema of an existing document type from an IR file. Sources the wire schema and version directly from
|
|
28
|
+
* the IR (the same single source of truth used by `ir deploy`), avoiding a separately-generated asset file.
|
|
29
|
+
*/
|
|
30
|
+
export async function irUpdateSchemaHandler(options) {
|
|
28
31
|
try {
|
|
29
|
-
const
|
|
30
|
-
consola.info(`Reading
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const irPath = resolve(options.ir);
|
|
33
|
+
consola.info(`Reading schema from: ${irPath}`);
|
|
34
|
+
const {
|
|
35
|
+
ir,
|
|
36
|
+
latestVersion
|
|
37
|
+
} = resolveIrInput(JSON.parse(readFileSync(irPath, "utf8")), irPath);
|
|
38
|
+
const schema = convertIrToWireSchema(ir);
|
|
34
39
|
const fetchFn = options.firstPartyPrefix != null ? buildPrefixRewriteFetch(options.firstPartyPrefix) : undefined;
|
|
35
40
|
if (fetchFn != null) {
|
|
36
41
|
consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);
|
|
37
42
|
}
|
|
38
43
|
const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth), undefined, fetchFn);
|
|
39
44
|
const request = {
|
|
40
|
-
documentTypeName:
|
|
45
|
+
documentTypeName: ir.name,
|
|
41
46
|
requestBody: {
|
|
42
47
|
ontologyRid: options.ontologyRid,
|
|
43
|
-
schema
|
|
44
|
-
version:
|
|
48
|
+
schema,
|
|
49
|
+
version: latestVersion,
|
|
45
50
|
...(options.forceOverwrite ? {
|
|
46
51
|
forceOverwrite: true
|
|
47
52
|
} : {})
|
|
@@ -50,7 +55,7 @@ export async function assetUpdateSchemaHandler(options) {
|
|
|
50
55
|
if (options.forceOverwrite) {
|
|
51
56
|
consola.warn("--force-overwrite is set: backwards-compatibility validation will be skipped.");
|
|
52
57
|
}
|
|
53
|
-
consola.info(`Updating schema for document type "${
|
|
58
|
+
consola.info(`Updating schema for document type "${ir.name}" -> version ${latestVersion}`);
|
|
54
59
|
const result = await DocumentTypes.updateSchema(osdkClient, request, {
|
|
55
60
|
preview: true
|
|
56
61
|
});
|
|
@@ -60,26 +65,15 @@ export async function assetUpdateSchemaHandler(options) {
|
|
|
60
65
|
}
|
|
61
66
|
consola.error(`Schema validation failed with ${result.violations.length} violation(s):`);
|
|
62
67
|
for (const violation of result.violations) {
|
|
63
|
-
consola.error(` - ${violation.fieldPath}
|
|
68
|
+
consola.error(` - ${violation.fieldPath}: ${violation.message} (${violation.violationType})`);
|
|
64
69
|
}
|
|
65
|
-
|
|
66
|
-
throw new CommanderError(1, "ERRSCHEMAVALIDATION", "Schema validation failed during update");
|
|
70
|
+
throw new CommanderError(1, "ERRIRUPDATESCHEMA", "Schema validation failed");
|
|
67
71
|
} catch (error) {
|
|
68
72
|
if (error instanceof CommanderError) {
|
|
69
73
|
throw error;
|
|
70
74
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
message,
|
|
74
|
-
errorName,
|
|
75
|
-
errorCode
|
|
76
|
-
} = error;
|
|
77
|
-
const details = [errorName, errorCode].filter(Boolean).join(" ");
|
|
78
|
-
consola.error(`❌ Error during schema update: ${message}${details ? ` [${details}]` : ""}`);
|
|
79
|
-
} else {
|
|
80
|
-
consola.error("❌ Error during schema update:", error);
|
|
81
|
-
}
|
|
82
|
-
throw new CommanderError(1, "ERRASSETUPDATESCHEMA", "Error updating document type schema");
|
|
75
|
+
consola.error("❌ Error during update-schema:", error);
|
|
76
|
+
throw new CommanderError(1, "ERRIRUPDATESCHEMA", "Error updating schema from IR");
|
|
83
77
|
}
|
|
84
78
|
}
|
|
85
|
-
//# sourceMappingURL=
|
|
79
|
+
//# sourceMappingURL=irUpdateSchemaHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irUpdateSchemaHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","resolveIrInput","irUpdateSchemaHandler","options","irPath","ir","info","latestVersion","JSON","parse","schema","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","documentTypeName","name","requestBody","ontologyRid","version","forceOverwrite","warn","result","updateSchema","preview","type","success","error","violations","length","violation","fieldPath","message","violationType"],"sources":["irUpdateSchemaHandler.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPlatformClient } from \"@osdk/client\";\nimport type { UpdateSchemaDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport { buildPrefixRewriteFetch, DEFAULT_API_PREFIX } from \"../utils/firstPartyPrefix.js\";\nimport { resolveIrInput } from \"./resolveIrInput.js\";\n\ninterface IrUpdateSchemaOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly forceOverwrite?: boolean;\n readonly firstPartyPrefix?: string;\n}\n\n/**\n * Updates the schema of an existing document type from an IR file. Sources the wire schema and version directly from\n * the IR (the same single source of truth used by `ir deploy`), avoiding a separately-generated asset file.\n */\nexport async function irUpdateSchemaHandler(options: IrUpdateSchemaOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n consola.info(`Reading schema from: ${irPath}`);\n\n const { ir, latestVersion } = resolveIrInput(\n JSON.parse(readFileSync(irPath, \"utf8\")) as unknown,\n irPath,\n );\n const schema = convertIrToWireSchema(ir);\n\n const fetchFn = options.firstPartyPrefix != null\n ? buildPrefixRewriteFetch(options.firstPartyPrefix)\n : undefined;\n if (fetchFn != null) {\n consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);\n }\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n undefined,\n fetchFn,\n );\n\n const request: UpdateSchemaDocumentTypeRequest = {\n documentTypeName: ir.name,\n requestBody: {\n ontologyRid: options.ontologyRid,\n schema,\n version: latestVersion,\n ...(options.forceOverwrite ? { forceOverwrite: true } : {}),\n },\n };\n\n if (options.forceOverwrite) {\n consola.warn(\"--force-overwrite is set: backwards-compatibility validation will be skipped.\");\n }\n consola.info(`Updating schema for document type \"${ir.name}\" -> version ${latestVersion}`);\n\n const result = await DocumentTypes.updateSchema(osdkClient, request, { preview: true });\n\n if (result.type === \"success\") {\n consola.success(`Schema updated successfully (version ${result.version})`);\n return;\n }\n\n consola.error(`Schema validation failed with ${result.violations.length} violation(s):`);\n for (const violation of result.violations) {\n consola.error(\n ` - ${violation.fieldPath}: ${violation.message} (${violation.violationType})`,\n );\n }\n throw new CommanderError(1, \"ERRIRUPDATESCHEMA\", \"Schema validation failed\");\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n consola.error(\"❌ Error during update-schema:\", error);\n throw new CommanderError(1, \"ERRIRUPDATESCHEMA\", \"Error updating schema from IR\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,QAAQ,cAAc;AAEnD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAC9B,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ,8BAA8B;AAC1F,SAASC,cAAc,QAAQ,qBAAqB;AAWpD;AACA;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CAACC,OAA8B,EAAiB;EACzF,IAAI;IACF,MAAMC,MAAM,GAAGP,OAAO,CAACM,OAAO,CAACE,EAAE,CAAC;IAClCV,OAAO,CAACW,IAAI,CAAC,wBAAwBF,MAAM,EAAE,CAAC;IAE9C,MAAM;MAAEC,EAAE;MAAEE;IAAc,CAAC,GAAGN,cAAc,CAC1CO,IAAI,CAACC,KAAK,CAACb,YAAY,CAACQ,MAAM,EAAE,MAAM,CAAC,CAAC,EACxCA,MACF,CAAC;IACD,MAAMM,MAAM,GAAGZ,qBAAqB,CAACO,EAAE,CAAC;IAExC,MAAMM,OAAO,GAAGR,OAAO,CAACS,gBAAgB,IAAI,IAAI,GAC5Cb,uBAAuB,CAACI,OAAO,CAACS,gBAAgB,CAAC,GACjDC,SAAS;IACb,IAAIF,OAAO,IAAI,IAAI,EAAE;MACnBh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IACA,MAAM,IAAI3C,cAAc,CAAC,CAAC,EAAE,mBAAmB,EAAE,0BAA0B,CAAC;EAC9E,CAAC,CAAC,OAAOqC,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYrC,cAAc,EAAE;MACnC,MAAMqC,KAAK;IACb;IACApC,OAAO,CAACoC,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACrD,MAAM,IAAIrC,cAAc,CAAC,CAAC,EAAE,mBAAmB,EAAE,+BAA+B,CAAC;EACnF;AACF","ignoreList":[]}
|
|
@@ -19,12 +19,14 @@ import { irGenAssetHandler } from "./irGenAssetHandler.js";
|
|
|
19
19
|
import { irGenModelsHandler } from "./irGenModelsHandler.js";
|
|
20
20
|
import { irGenTypesHandler } from "./irGenTypesHandler.js";
|
|
21
21
|
import { irGenZodHandler } from "./irGenZodHandler.js";
|
|
22
|
+
import { irUpdateSchemaHandler } from "./irUpdateSchemaHandler.js";
|
|
22
23
|
export function registerIrCommands(program) {
|
|
23
24
|
const irCmd = program.command("ir").description("IR (Intermediate Representation) based generation commands");
|
|
24
25
|
irCmd.command("gen-types").description("Generate versioned SDK files (types, schemas, internal/, models.ts, versions.ts, versionedDocRef.ts, index.ts) from a versioned IR chain JSON.").requiredOption("-s, --schema <file>", "Path to versioned IR chain JSON file").requiredOption("-o, --output <dir>", "Output directory for generated SDK files").action(irGenTypesHandler);
|
|
25
26
|
irCmd.command("zod").description("Generate Zod schemas from IR document schema definitions").requiredOption("-s, --schema <file>", "Path to schema JSON file").requiredOption("-o, --output <file>", "Output file path for generated Zod schemas").option("-t, --type-import-path <path>", "Path to import types from (enables satisfies operators)").action(irGenZodHandler);
|
|
26
27
|
irCmd.command("models").description("Generate Model constants from IR document schema definitions").requiredOption("-s, --schema <file>", "Path to schema JSON file").requiredOption("-o, --output <file>", "Output file path for generated Model constants").option("-t, --type-import-path <path>", "Path to import types from", "./types.js").option("--schema-import-path <path>", "Path to import schemas from", "./schema.js").action(irGenModelsHandler);
|
|
27
|
-
irCmd.command("deploy").description("Create a document type on a Foundry stack using an IR document schema").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").
|
|
28
|
+
irCmd.command("deploy").description("Create a document type on a Foundry stack using an IR document schema. Deploys via the general " + "(third-party) path by default, or the first-party path with --first-party.").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").option("-p, --parent-folder <rid>", "Parent folder RID for the document type (required for third-party deploys)").option("--first-party", "Deploy as a first-party document type (uses the first-party endpoint; requires --ontology-rid)", false).option("-o, --ontology-rid <rid>", "Target ontology RID (required for first-party deploys)").option("-f, --file-system-type <type>", "File system type for the document type (ARTIFACTS or COMPASS)").option("--first-party-prefix <path>", "Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.").action(irDeployHandler);
|
|
29
|
+
irCmd.command("update-schema").description("Update the schema of an existing document type using an IR document schema").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").requiredOption("-o, --ontology-rid <rid>", "Target ontology RID").option("--force-overwrite", "Skip backwards-compatibility validation when updating the schema", false).option("--first-party-prefix <path>", "Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.").action(irUpdateSchemaHandler);
|
|
28
30
|
irCmd.command("asset").description("Generate document type asset JSON and a sibling schema compatibility range JSON from an IR file (advanced — most users should use 'ir deploy' instead). The minimum supported schema version is sourced from the IR payload's 'minSupportedVersion' field (set by 'schema ir --config <pack-config.json>'); legacy single-IR inputs default to min == max.").requiredOption("-i, --ir <file>", "Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)").requiredOption("-o, --output <file>", "Output file path for asset JSON").option("-f, --file-system-type <type>", "File system type (ARTIFACTS or COMPASS)", "ARTIFACTS").option("--compatibility-range-output <file>", "Output path for the schema compatibility range JSON (defaults to a sibling of --output with '-schema-compatibility-range' suffix)").action(irGenAssetHandler);
|
|
29
31
|
}
|
|
30
32
|
//# sourceMappingURL=registerIrCommands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenAssetHandler","irGenModelsHandler","irGenTypesHandler","irGenZodHandler","registerIrCommands","program","irCmd","command","description","requiredOption","action","option"],"sources":["registerIrCommands.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Command } from \"commander\";\nimport { irDeployHandler } from \"./irDeployHandler.js\";\nimport { irGenAssetHandler } from \"./irGenAssetHandler.js\";\nimport { irGenModelsHandler } from \"./irGenModelsHandler.js\";\nimport { irGenTypesHandler } from \"./irGenTypesHandler.js\";\nimport { irGenZodHandler } from \"./irGenZodHandler.js\";\n\nexport function registerIrCommands(program: Command): void {\n const irCmd = program\n .command(\"ir\")\n .description(\"IR (Intermediate Representation) based generation commands\");\n\n irCmd\n .command(\"gen-types\")\n .description(\n \"Generate versioned SDK files (types, schemas, internal/, models.ts, versions.ts, versionedDocRef.ts, index.ts) from a versioned IR chain JSON.\",\n )\n .requiredOption(\"-s, --schema <file>\", \"Path to versioned IR chain JSON file\")\n .requiredOption(\"-o, --output <dir>\", \"Output directory for generated SDK files\")\n .action(irGenTypesHandler);\n\n irCmd\n .command(\"zod\")\n .description(\"Generate Zod schemas from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Zod schemas\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from (enables satisfies operators)\",\n )\n .action(irGenZodHandler);\n\n irCmd\n .command(\"models\")\n .description(\"Generate Model constants from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Model constants\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from\",\n \"./types.js\",\n )\n .option(\n \"--schema-import-path <path>\",\n \"Path to import schemas from\",\n \"./schema.js\",\n )\n .action(irGenModelsHandler);\n\n irCmd\n .command(\"deploy\")\n .description(\"Create a document type on a Foundry stack using an IR document schema\")\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .
|
|
1
|
+
{"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenAssetHandler","irGenModelsHandler","irGenTypesHandler","irGenZodHandler","irUpdateSchemaHandler","registerIrCommands","program","irCmd","command","description","requiredOption","action","option"],"sources":["registerIrCommands.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Command } from \"commander\";\nimport { irDeployHandler } from \"./irDeployHandler.js\";\nimport { irGenAssetHandler } from \"./irGenAssetHandler.js\";\nimport { irGenModelsHandler } from \"./irGenModelsHandler.js\";\nimport { irGenTypesHandler } from \"./irGenTypesHandler.js\";\nimport { irGenZodHandler } from \"./irGenZodHandler.js\";\nimport { irUpdateSchemaHandler } from \"./irUpdateSchemaHandler.js\";\n\nexport function registerIrCommands(program: Command): void {\n const irCmd = program\n .command(\"ir\")\n .description(\"IR (Intermediate Representation) based generation commands\");\n\n irCmd\n .command(\"gen-types\")\n .description(\n \"Generate versioned SDK files (types, schemas, internal/, models.ts, versions.ts, versionedDocRef.ts, index.ts) from a versioned IR chain JSON.\",\n )\n .requiredOption(\"-s, --schema <file>\", \"Path to versioned IR chain JSON file\")\n .requiredOption(\"-o, --output <dir>\", \"Output directory for generated SDK files\")\n .action(irGenTypesHandler);\n\n irCmd\n .command(\"zod\")\n .description(\"Generate Zod schemas from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Zod schemas\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from (enables satisfies operators)\",\n )\n .action(irGenZodHandler);\n\n irCmd\n .command(\"models\")\n .description(\"Generate Model constants from IR document schema definitions\")\n .requiredOption(\"-s, --schema <file>\", \"Path to schema JSON file\")\n .requiredOption(\"-o, --output <file>\", \"Output file path for generated Model constants\")\n .option(\n \"-t, --type-import-path <path>\",\n \"Path to import types from\",\n \"./types.js\",\n )\n .option(\n \"--schema-import-path <path>\",\n \"Path to import schemas from\",\n \"./schema.js\",\n )\n .action(irGenModelsHandler);\n\n irCmd\n .command(\"deploy\")\n .description(\n \"Create a document type on a Foundry stack using an IR document schema. Deploys via the general \"\n + \"(third-party) path by default, or the first-party path with --first-party.\",\n )\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .option(\n \"-p, --parent-folder <rid>\",\n \"Parent folder RID for the document type (required for third-party deploys)\",\n )\n .option(\n \"--first-party\",\n \"Deploy as a first-party document type (uses the first-party endpoint; requires --ontology-rid)\",\n false,\n )\n .option(\n \"-o, --ontology-rid <rid>\",\n \"Target ontology RID (required for first-party deploys)\",\n )\n .option(\n \"-f, --file-system-type <type>\",\n \"File system type for the document type (ARTIFACTS or COMPASS)\",\n )\n .option(\n \"--first-party-prefix <path>\",\n \"Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.\",\n )\n .action(irDeployHandler);\n\n irCmd\n .command(\"update-schema\")\n .description(\"Update the schema of an existing document type using an IR document schema\")\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .requiredOption(\"-o, --ontology-rid <rid>\", \"Target ontology RID\")\n .option(\n \"--force-overwrite\",\n \"Skip backwards-compatibility validation when updating the schema\",\n false,\n )\n .option(\n \"--first-party-prefix <path>\",\n \"Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.\",\n )\n .action(irUpdateSchemaHandler);\n\n irCmd\n .command(\"asset\")\n .description(\n \"Generate document type asset JSON and a sibling schema compatibility range JSON from an IR file (advanced — most users should use 'ir deploy' instead). The minimum supported schema version is sourced from the IR payload's 'minSupportedVersion' field (set by 'schema ir --config <pack-config.json>'); legacy single-IR inputs default to min == max.\",\n )\n .requiredOption(\n \"-i, --ir <file>\",\n \"Path to IR JSON file (chain payload from 'schema ir', or legacy single-version IR)\",\n )\n .requiredOption(\"-o, --output <file>\", \"Output file path for asset JSON\")\n .option(\n \"-f, --file-system-type <type>\",\n \"File system type (ARTIFACTS or COMPASS)\",\n \"ARTIFACTS\",\n )\n .option(\n \"--compatibility-range-output <file>\",\n \"Output path for the schema compatibility range JSON (defaults to a sibling of --output with '-schema-compatibility-range' suffix)\",\n )\n .action(irGenAssetHandler);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,qBAAqB,QAAQ,4BAA4B;AAElE,OAAO,SAASC,kBAAkBA,CAACC,OAAgB,EAAQ;EACzD,MAAMC,KAAK,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,CAACT,iBAAiB,CAAC;EAE5BK,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,CAACR,eAAe,CAAC;EAE1BI,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,EAC3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MAAM,CACL,qCAAqC,EACrC,mIACF,CAAC,CACAD,MAAM,CAACX,iBAAiB,CAAC;AAC9B","ignoreList":[]}
|
|
@@ -119,7 +119,7 @@ export async function schemaIrHandler(options) {
|
|
|
119
119
|
const outputPath = path.resolve(output);
|
|
120
120
|
await fs.ensureDir(path.dirname(outputPath));
|
|
121
121
|
const payload = {
|
|
122
|
-
|
|
122
|
+
comment: GENERATED_JSON_COMMENT,
|
|
123
123
|
latestVersion,
|
|
124
124
|
...(minSupportedVersion != null ? {
|
|
125
125
|
minSupportedVersion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaIrHandler.js","names":["consola","fs","path","GENERATED_JSON_COMMENT","loadSchemaModule","resolveSchemaChain","assertNonEmptyString","value","field","configPath","trim","Error","JSON","stringify","readRequiredNonEmptyString","readPackConfig","resolvedConfigPath","resolve","pathExists","config","readJson","documentTypeName","documentTypeDescription","minSupportedVersion","rawMin","Number","isInteger","parseMaxVersion","maxVersion","undefined","test","schemaIrHandler","options","input","output","warn","info","schema","chain","latestVersion","name","description","outputPath","ensureDir","dirname","payload","__comment","writeFile","success","length"],"sources":["schemaIrHandler.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { loadSchemaModule } from \"../../utils/schema/loadSchemaModule.js\";\nimport { resolveSchemaChain } from \"../../utils/schema/resolveSchemaChain.js\";\n\ninterface SchemaIrOptions {\n input: string;\n output: string;\n config: string;\n maxVersion?: string;\n}\n\ninterface PackConfigLike {\n documentTypeName?: unknown;\n documentTypeDescription?: unknown;\n minSupportedVersion?: unknown;\n}\n\ninterface PackConfigValues {\n readonly documentTypeName: string;\n readonly documentTypeDescription: string;\n readonly minSupportedVersion?: number;\n}\n\nfunction assertNonEmptyString(value: unknown, field: string, configPath: string): string {\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw new Error(\n `'${field}' in ${configPath} must be a non-empty string, got: ${JSON.stringify(value)}`,\n );\n }\n return value;\n}\n\nfunction readRequiredNonEmptyString(\n value: unknown,\n field: string,\n configPath: string,\n): string {\n if (value == null) {\n throw new Error(\n `'${field}' is required in ${configPath} and must be a non-empty string`,\n );\n }\n return assertNonEmptyString(value, field, configPath);\n}\n\nexport async function readPackConfig(configPath: string): Promise<PackConfigValues> {\n const resolvedConfigPath = path.resolve(configPath);\n if (!(await fs.pathExists(resolvedConfigPath))) {\n throw new Error(`--config file not found: ${resolvedConfigPath}`);\n }\n const config = (await fs.readJson(resolvedConfigPath)) as PackConfigLike;\n\n const documentTypeName = readRequiredNonEmptyString(\n config.documentTypeName,\n \"documentTypeName\",\n resolvedConfigPath,\n );\n\n const documentTypeDescription = readRequiredNonEmptyString(\n config.documentTypeDescription,\n \"documentTypeDescription\",\n resolvedConfigPath,\n );\n\n let minSupportedVersion: number | undefined;\n const rawMin = config.minSupportedVersion;\n if (rawMin != null) {\n if (typeof rawMin !== \"number\" || !Number.isInteger(rawMin) || rawMin <= 0) {\n throw new Error(\n `'minSupportedVersion' in ${resolvedConfigPath} must be a positive integer, got: ${\n JSON.stringify(rawMin)\n }`,\n );\n }\n minSupportedVersion = rawMin;\n }\n\n return { documentTypeName, documentTypeDescription, minSupportedVersion };\n}\n\nfunction parseMaxVersion(maxVersion: string | undefined): number | undefined {\n if (maxVersion == null) {\n return undefined;\n }\n\n if (!/^[1-9]\\d*$/.test(maxVersion)) {\n throw new Error(\n `--max-version must be a positive integer, got: ${JSON.stringify(maxVersion)}`,\n );\n }\n\n return Number(maxVersion);\n}\n\n/**\n * Resolve a TypeScript schema module to a versioned IR chain JSON file.\n *\n * The output is a `{ latestVersion, minSupportedVersion?, chain }` payload\n * where each entry is `{ version, ir, migrations? }` and `ir` is a\n * single-version `IRealTimeDocumentSchema`. This is the input format for\n * `ir gen-types` and `ir asset`.\n *\n * `--config <pack-config.json>` is required: the pack-config is the single\n * source of truth for document-type identity. Required fields:\n * - `documentTypeName`: the document type name embedded into each chain\n * entry's IR (and surfaced as `documentTypeName` by `ir asset`).\n * - `documentTypeDescription`: document type description embedded into each\n * chain entry's IR.\n * Optional fields:\n * - `minSupportedVersion`: declares the oldest version this SDK supports;\n * when set, it must match one of the chain entries' `version` values and is\n * embedded as `minSupportedVersion` in the payload so downstream consumers\n * (`ir gen-types`, `ir asset`) read the same value. Omitting the field is\n * an explicit opt-out: the IR will not include `minSupportedVersion` and\n * downstream tools default to supporting only the latest schema version.\n *\n * Note: this is distinct from the legacy single-version IR JSON consumed by\n * `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain, no migrations).\n * Tools that previously read that format should pick the entry matching\n * `latestVersion` from `chain` and use its `ir` field.\n */\nexport async function schemaIrHandler(options: SchemaIrOptions): Promise<void> {\n const { input, output, config } = options;\n const maxVersion = parseMaxVersion(options.maxVersion);\n const { documentTypeName, documentTypeDescription, minSupportedVersion } = await readPackConfig(\n config,\n );\n\n if (minSupportedVersion == null) {\n consola.warn(\n `--config ${\n path.resolve(config)\n } does not set 'minSupportedVersion'. The generated IR will not include it, so downstream tools (ir gen-types, ir asset) will default to supporting only the latest schema version. Add 'minSupportedVersion' to your pack-config to enable back-compat.`,\n );\n }\n\n consola.info(`Loading schema from: ${input}`);\n const schema = await loadSchemaModule(input);\n\n consola.info(\"Resolving versioned IR chain...\");\n const { chain, latestVersion } = resolveSchemaChain(\n schema,\n minSupportedVersion,\n {\n name: documentTypeName,\n description: documentTypeDescription,\n },\n maxVersion,\n );\n\n const outputPath = path.resolve(output);\n await fs.ensureDir(path.dirname(outputPath));\n\n const payload = {\n __comment: GENERATED_JSON_COMMENT,\n latestVersion,\n ...(minSupportedVersion != null ? { minSupportedVersion } : {}),\n chain,\n };\n await fs.writeFile(outputPath, JSON.stringify(payload, null, 2) + \"\\n\", \"utf8\");\n\n consola.success(\n `Wrote IR chain (${chain.length} version(s), min=${\n minSupportedVersion ?? latestVersion\n }, max=${latestVersion}) to: ${outputPath}`,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAOC,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,gBAAgB,QAAQ,wCAAwC;AACzE,SAASC,kBAAkB,QAAQ,0CAA0C;AAqB7E,SAASC,oBAAoBA,CAACC,KAAc,EAAEC,KAAa,EAAEC,UAAkB,EAAU;EACvF,IAAI,OAAOF,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACpD,MAAM,IAAIC,KAAK,CACb,IAAIH,KAAK,QAAQC,UAAU,qCAAqCG,IAAI,CAACC,SAAS,CAACN,KAAK,CAAC,EACvF,CAAC;EACH;EACA,OAAOA,KAAK;AACd;AAEA,SAASO,0BAA0BA,CACjCP,KAAc,EACdC,KAAa,EACbC,UAAkB,EACV;EACR,IAAIF,KAAK,IAAI,IAAI,EAAE;IACjB,MAAM,IAAII,KAAK,CACb,IAAIH,KAAK,oBAAoBC,UAAU,iCACzC,CAAC;EACH;EACA,OAAOH,oBAAoB,CAACC,KAAK,EAAEC,KAAK,EAAEC,UAAU,CAAC;AACvD;AAEA,OAAO,eAAeM,cAAcA,CAACN,UAAkB,EAA6B;EAClF,MAAMO,kBAAkB,GAAGd,IA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UAAU,EAAE9B,IAAI,CAACC,SAAS,CAACgC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC;EAE/E7C,OAAO,CAACgD,OAAO,CACb,mBAAmBV,KAAK,CAACW,MAAM,oBAC7B1B,mBAAmB,IAAIgB,aAAa,SAC7BA,aAAa,SAASG,UAAU,EAC3C,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"schemaIrHandler.js","names":["consola","fs","path","GENERATED_JSON_COMMENT","loadSchemaModule","resolveSchemaChain","assertNonEmptyString","value","field","configPath","trim","Error","JSON","stringify","readRequiredNonEmptyString","readPackConfig","resolvedConfigPath","resolve","pathExists","config","readJson","documentTypeName","documentTypeDescription","minSupportedVersion","rawMin","Number","isInteger","parseMaxVersion","maxVersion","undefined","test","schemaIrHandler","options","input","output","warn","info","schema","chain","latestVersion","name","description","outputPath","ensureDir","dirname","payload","comment","writeFile","success","length"],"sources":["schemaIrHandler.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { loadSchemaModule } from \"../../utils/schema/loadSchemaModule.js\";\nimport { resolveSchemaChain } from \"../../utils/schema/resolveSchemaChain.js\";\n\ninterface SchemaIrOptions {\n input: string;\n output: string;\n config: string;\n maxVersion?: string;\n}\n\ninterface PackConfigLike {\n documentTypeName?: unknown;\n documentTypeDescription?: unknown;\n minSupportedVersion?: unknown;\n}\n\ninterface PackConfigValues {\n readonly documentTypeName: string;\n readonly documentTypeDescription: string;\n readonly minSupportedVersion?: number;\n}\n\nfunction assertNonEmptyString(value: unknown, field: string, configPath: string): string {\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw new Error(\n `'${field}' in ${configPath} must be a non-empty string, got: ${JSON.stringify(value)}`,\n );\n }\n return value;\n}\n\nfunction readRequiredNonEmptyString(\n value: unknown,\n field: string,\n configPath: string,\n): string {\n if (value == null) {\n throw new Error(\n `'${field}' is required in ${configPath} and must be a non-empty string`,\n );\n }\n return assertNonEmptyString(value, field, configPath);\n}\n\nexport async function readPackConfig(configPath: string): Promise<PackConfigValues> {\n const resolvedConfigPath = path.resolve(configPath);\n if (!(await fs.pathExists(resolvedConfigPath))) {\n throw new Error(`--config file not found: ${resolvedConfigPath}`);\n }\n const config = (await fs.readJson(resolvedConfigPath)) as PackConfigLike;\n\n const documentTypeName = readRequiredNonEmptyString(\n config.documentTypeName,\n \"documentTypeName\",\n resolvedConfigPath,\n );\n\n const documentTypeDescription = readRequiredNonEmptyString(\n config.documentTypeDescription,\n \"documentTypeDescription\",\n resolvedConfigPath,\n );\n\n let minSupportedVersion: number | undefined;\n const rawMin = config.minSupportedVersion;\n if (rawMin != null) {\n if (typeof rawMin !== \"number\" || !Number.isInteger(rawMin) || rawMin <= 0) {\n throw new Error(\n `'minSupportedVersion' in ${resolvedConfigPath} must be a positive integer, got: ${\n JSON.stringify(rawMin)\n }`,\n );\n }\n minSupportedVersion = rawMin;\n }\n\n return { documentTypeName, documentTypeDescription, minSupportedVersion };\n}\n\nfunction parseMaxVersion(maxVersion: string | undefined): number | undefined {\n if (maxVersion == null) {\n return undefined;\n }\n\n if (!/^[1-9]\\d*$/.test(maxVersion)) {\n throw new Error(\n `--max-version must be a positive integer, got: ${JSON.stringify(maxVersion)}`,\n );\n }\n\n return Number(maxVersion);\n}\n\n/**\n * Resolve a TypeScript schema module to a versioned IR chain JSON file.\n *\n * The output is a `{ latestVersion, minSupportedVersion?, chain }` payload\n * where each entry is `{ version, ir, migrations? }` and `ir` is a\n * single-version `IRealTimeDocumentSchema`. This is the input format for\n * `ir gen-types` and `ir asset`.\n *\n * `--config <pack-config.json>` is required: the pack-config is the single\n * source of truth for document-type identity. Required fields:\n * - `documentTypeName`: the document type name embedded into each chain\n * entry's IR (and surfaced as `documentTypeName` by `ir asset`).\n * - `documentTypeDescription`: document type description embedded into each\n * chain entry's IR.\n * Optional fields:\n * - `minSupportedVersion`: declares the oldest version this SDK supports;\n * when set, it must match one of the chain entries' `version` values and is\n * embedded as `minSupportedVersion` in the payload so downstream consumers\n * (`ir gen-types`, `ir asset`) read the same value. Omitting the field is\n * an explicit opt-out: the IR will not include `minSupportedVersion` and\n * downstream tools default to supporting only the latest schema version.\n *\n * Note: this is distinct from the legacy single-version IR JSON consumed by\n * `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain, no migrations).\n * Tools that previously read that format should pick the entry matching\n * `latestVersion` from `chain` and use its `ir` field.\n */\nexport async function schemaIrHandler(options: SchemaIrOptions): Promise<void> {\n const { input, output, config } = options;\n const maxVersion = parseMaxVersion(options.maxVersion);\n const { documentTypeName, documentTypeDescription, minSupportedVersion } = await readPackConfig(\n config,\n );\n\n if (minSupportedVersion == null) {\n consola.warn(\n `--config ${\n path.resolve(config)\n } does not set 'minSupportedVersion'. The generated IR will not include it, so downstream tools (ir gen-types, ir asset) will default to supporting only the latest schema version. Add 'minSupportedVersion' to your pack-config to enable back-compat.`,\n );\n }\n\n consola.info(`Loading schema from: ${input}`);\n const schema = await loadSchemaModule(input);\n\n consola.info(\"Resolving versioned IR chain...\");\n const { chain, latestVersion } = resolveSchemaChain(\n schema,\n minSupportedVersion,\n {\n name: documentTypeName,\n description: documentTypeDescription,\n },\n maxVersion,\n );\n\n const outputPath = path.resolve(output);\n await fs.ensureDir(path.dirname(outputPath));\n\n const payload = {\n comment: GENERATED_JSON_COMMENT,\n latestVersion,\n ...(minSupportedVersion != null ? { minSupportedVersion } : {}),\n chain,\n };\n await fs.writeFile(outputPath, JSON.stringify(payload, null, 2) + \"\\n\", \"utf8\");\n\n consola.success(\n `Wrote IR chain (${chain.length} version(s), min=${\n minSupportedVersion ?? latestVersion\n }, max=${latestVersion}) to: ${outputPath}`,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAOC,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,gBAAgB,QAAQ,wCAAwC;AACzE,SAASC,kBAAkB,QAAQ,0CAA0C;AAqB7E,SAASC,oBAAoBA,CAACC,KAAc,EAAEC,KAAa,EAAEC,UAAkB,EAAU;EACvF,IAAI,OAAOF,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACpD,MAAM,IAAIC,KAAK,CACb,IAAIH,KAAK,QAAQC,UAAU,qCAAqCG,IAAI,CAACC,SAAS,CAACN,KAAK,CAAC,EACvF,CAAC;EACH;EACA,OAAOA,KAAK;AACd;AAEA,SAASO,0BAA0BA,CACjCP,KAAc,EACdC,KAAa,EACbC,UAAkB,EACV;EACR,IAAIF,KAAK,IAAI,IAAI,EAAE;IACjB,MAAM,IAAII,KAAK,CACb,IAAIH,KAAK,oBAAoBC,UAAU,iCACzC,CAAC;EACH;EACA,OAAOH,oBAAoB,CAACC,KAAK,EAAEC,KAAK,EAAEC,UAAU,CAAC;AACvD;AAEA,OAAO,eAAeM,cAAcA,CAACN,UAAkB,EAA6B;EAClF,MAAMO,kBAAkB,GAAGd,IAAI,CAACe,OAAO,CAACR,UAAU,CAAC;EACnD,IAAI,EAAE,MAAMR,EAAE,CAACiB,UAAU,CAACF,kBAAkB,CAAC,CAAC,EAAE;I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E7C,OAAO,CAACgD,OAAO,CACb,mBAAmBV,KAAK,CAACW,MAAM,oBAC7B1B,mBAAmB,IAAIgB,aAAa,SAC7BA,aAAa,SAASG,UAAU,EAC3C,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepsGenIrHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readdirSync","readFileSync","statSync","writeFileSync","dirname","join","YAML","GENERATED_JSON_COMMENT","convertStepsToIr","parseMigrationSteps","stepsGenIrHandler","options","input","inputDir","output","outputFile","isDirectory","files","filter","file","endsWith","length","sortedFiles","sort","a","b","localeCompare","migrationSteps","filePath","fileContent","parsed","parse","parsedCommands","push","info","metadata","name","schemaName","description","schemaDescription","version","parseInt","undefined","schema","outputDir","recursive","
|
|
1
|
+
{"version":3,"file":"stepsGenIrHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readdirSync","readFileSync","statSync","writeFileSync","dirname","join","YAML","GENERATED_JSON_COMMENT","convertStepsToIr","parseMigrationSteps","stepsGenIrHandler","options","input","inputDir","output","outputFile","isDirectory","files","filter","file","endsWith","length","sortedFiles","sort","a","b","localeCompare","migrationSteps","filePath","fileContent","parsed","parse","parsedCommands","push","info","metadata","name","schemaName","description","schemaDescription","version","parseInt","undefined","schema","outputDir","recursive","comment","JSON","stringify","success","Object","keys","models","primaryModelKeys","error"],"sources":["stepsGenIrHandler.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, readdirSync, readFileSync, statSync, writeFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\nimport * as YAML from \"yaml\";\nimport { GENERATED_JSON_COMMENT } from \"../../utils/generatedFileHeader.js\";\nimport { convertStepsToIr, type SchemaMetadata } from \"../../utils/steps/convertStepsToIr.js\";\nimport type { MigrationStep } from \"../../utils/steps/parseMigrationSteps.js\";\nimport { parseMigrationSteps } from \"../../utils/steps/parseMigrationSteps.js\";\n\ninterface StepsGenIrOptions {\n input: string;\n output: string;\n schemaName?: string;\n schemaDescription?: string;\n version?: string;\n}\n\nexport function stepsGenIrHandler(options: StepsGenIrOptions): void {\n try {\n const { input: inputDir, output: outputFile } = options;\n\n if (!existsSync(inputDir)) {\n throw new CommanderError(1, \"ENOENT\", `Input directory does not exist: ${inputDir}`);\n }\n\n if (!statSync(inputDir).isDirectory()) {\n throw new CommanderError(1, \"ENOTDIR\", `Input path is not a directory: ${inputDir}`);\n }\n\n const files = readdirSync(inputDir)\n .filter(file => file.endsWith(\".yml\") || file.endsWith(\".yaml\"));\n\n if (files.length === 0) {\n throw new CommanderError(1, \"ENOFILES\", `No YAML files found in directory: ${inputDir}`);\n }\n\n const sortedFiles = files.sort((a, b) => a.localeCompare(b));\n\n const migrationSteps: MigrationStep[] = [];\n for (const file of sortedFiles) {\n const filePath = join(inputDir, file);\n const fileContent = readFileSync(filePath, \"utf8\");\n const parsed = YAML.parse(fileContent) as unknown;\n const parsedCommands = parseMigrationSteps(parsed);\n migrationSteps.push(...parsedCommands);\n }\n\n consola.info(`Converting ${migrationSteps.length} migration step(s) to IR format...`);\n\n // Prepare metadata if provided\n const metadata: SchemaMetadata = {\n name: options.schemaName,\n description: options.schemaDescription,\n version: options.version ? parseInt(options.version, 10) : undefined,\n };\n\n const schema = convertStepsToIr(migrationSteps, metadata);\n\n const outputDir = dirname(outputFile);\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n const output = { comment: GENERATED_JSON_COMMENT, ...schema };\n writeFileSync(outputFile, JSON.stringify(output, null, 2), \"utf8\");\n\n consola.success(\"✅ Successfully converted migration steps to IR format\");\n consola.info(` Generated types written to: ${outputFile}`);\n consola.info(` Schema: ${schema.name} v${schema.version}`);\n consola.info(` Models: ${Object.keys(schema.models).length}`);\n consola.info(` Primary models: ${schema.primaryModelKeys.length}`);\n } catch (error) {\n consola.error(\"❌ Error converting steps to IR:\", error);\n throw new CommanderError(1, \"STEPS_IR_ERROR\", \"Failed to convert steps to IR format\");\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,WAAW,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,IAAI;AAC9F,SAASC,OAAO,EAAEC,IAAI,QAAQ,MAAM;AACpC,OAAO,KAAKC,IAAI,MAAM,MAAM;AAC5B,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,gBAAgB,QAA6B,uCAAuC;AAE7F,SAASC,mBAAmB,QAAQ,0CAA0C;AAU9E,OAAO,SAASC,iBAAiBA,CAACC,OAA0B,EAAQ;EAClE,IAAI;IACF,MAAM;MAAEC,KAAK,EAAEC,QAAQ;MAAEC,MAAM,EAAEC;IAAW,CAAC,GAAGJ,OAAO;IAEvD,IAAI,CAACb,UAAU,CAACe,QAAQ,CAAC,EAAE;MACzB,MAAM,IAAIjB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,mCAAmCiB,QAAQ,EAAE,CAAC;IACtF;IAEA,IAAI,CAACX,QAAQ,CAACW,QAAQ,CAAC,CAACG,WAAW,CAAC,CAAC,EAAE;MACrC,MAAM,IAAIpB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,kCAAkCiB,QAAQ,EAAE,CAAC;IACtF;I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SAAS,GAAGxC,OAAO,CAACW,UAAU,CAAC;IACrC,IAAI,CAACjB,UAAU,CAAC8C,SAAS,CAAC,EAAE;MAC1B7C,SAAS,CAAC6C,SAAS,EAAE;QAAEC,SAAS,EAAE;MAAK,CAAC,CAAC;IAC3C;IACA,MAAM/B,MAAM,GAAG;MAAEgC,OAAO,EAAEvC,sBAAsB;MAAE,GAAGoC;IAAO,CAAC;IAC7DxC,aAAa,CAACY,UAAU,EAAEgC,IAAI,CAACC,SAAS,CAAClC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAElEjB,OAAO,CAACoD,OAAO,CAAC,uDAAuD,CAAC;IACxEpD,OAAO,CAACqC,IAAI,CAAC,kCAAkCnB,UAAU,EAAE,CAAC;IAC5DlB,OAAO,CAACqC,IAAI,CAAC,cAAcS,MAAM,CAACP,IAAI,KAAKO,MAAM,CAACH,OAAO,EAAE,CAAC;IAC5D3C,OAAO,CAACqC,IAAI,CAAC,cAAcgB,MAAM,CAACC,IAAI,CAACR,MAAM,CAACS,MAAM,CAAC,CAAC/B,MAAM,EAAE,CAAC;IAC/DxB,OAAO,CAACqC,IAAI,CAAC,sBAAsBS,MAAM,CAACU,gBAAgB,CAAChC,MAAM,EAAE,CAAC;EACtE,CAAC,CAAC,OAAOiC,KAAK,EAAE;IACdzD,OAAO,CAACyD,KAAK,CAAC,iCAAiC,EAAEA,KAAK,CAAC;IACvD,MAAM,IAAI1D,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,sCAAsC,CAAC;EACvF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DocumentTypeSchema } from \"@osdk/foundry.pack\";\n\nexport type FileSystemType = \"ARTIFACTS\" | \"COMPASS\";\n\nexport interface DocumentTypeAsset {\n readonly documentTypeName: string;\n readonly documentStorageType: {\n readonly type: \"yjs\";\n readonly
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DocumentTypeSchema } from \"@osdk/foundry.pack\";\n\nexport type FileSystemType = \"ARTIFACTS\" | \"COMPASS\";\n\nexport interface DocumentTypeAsset {\n readonly documentTypeName: string;\n readonly documentStorageType: {\n readonly type: \"yjs\";\n readonly schema: DocumentTypeSchema;\n };\n readonly fileSystemType: FileSystemType;\n readonly schemaVersion: number;\n}\n"],"mappings":"","ignoreList":[]}
|