@palantir/pack.document-schema.type-gen 0.6.0 → 0.8.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/build/esm/cli.js +2 -0
- package/build/esm/cli.js.map +1 -1
- package/build/esm/commands/asset/assetDeployHandler.js +60 -0
- package/build/esm/commands/asset/assetDeployHandler.js.map +1 -0
- package/build/esm/commands/asset/registerAssetCommands.js +22 -0
- package/build/esm/commands/asset/registerAssetCommands.js.map +1 -0
- package/build/esm/commands/ir/irDeployHandler.js +5 -4
- package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
- package/build/esm/commands/ir/irGenAssetHandler.js +83 -0
- package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -0
- package/build/esm/commands/ir/registerIrCommands.js +2 -0
- package/build/esm/commands/ir/registerIrCommands.js.map +1 -1
- package/build/esm/commands/steps/stepsGenIrHandler.js +6 -1
- package/build/esm/commands/steps/stepsGenIrHandler.js.map +1 -1
- package/build/esm/commands/types.js +2 -0
- package/build/esm/commands/types.js.map +1 -0
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldDef.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/recordDef.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/unionDef.js.map +1 -1
- package/build/esm/utils/generatedFileHeader.js +1 -0
- package/build/esm/utils/generatedFileHeader.js.map +1 -1
- 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/ir/__tests__/convertIrToWireSchema.test.js +335 -0
- package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js.map +1 -0
- package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js +49 -49
- package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js.map +1 -1
- package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js +83 -83
- package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js.map +1 -1
- package/build/esm/utils/ir/convertIrToWireSchema.js +199 -0
- package/build/esm/utils/ir/convertIrToWireSchema.js.map +1 -0
- package/build/esm/utils/ir/generateModelsFromIr.js +2 -2
- package/build/esm/utils/ir/generateModelsFromIr.js.map +1 -1
- package/build/esm/utils/ir/generateZodSchemasFromIr.js +1 -1
- package/build/esm/utils/ir/generateZodSchemasFromIr.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/esm/utils/steps/__tests__/convertStepsToIr.test.js +81 -8
- package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js.map +1 -1
- package/build/esm/utils/steps/convertStepsToIr.js +8 -10
- package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
- package/build/esm/utils/steps/parseMigrationSteps.js +4 -2
- package/build/esm/utils/steps/parseMigrationSteps.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/commands/asset/assetDeployHandler.d.ts +10 -0
- package/build/types/commands/asset/assetDeployHandler.d.ts.map +1 -0
- package/build/types/commands/asset/registerAssetCommands.d.ts +3 -0
- package/build/types/commands/asset/registerAssetCommands.d.ts.map +1 -0
- package/build/types/commands/ir/irDeployHandler.d.ts +1 -1
- package/build/types/commands/ir/irDeployHandler.d.ts.map +1 -1
- package/build/types/commands/ir/irGenAssetHandler.d.ts +19 -0
- package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -0
- package/build/types/commands/ir/registerIrCommands.d.ts.map +1 -1
- package/build/types/commands/steps/stepsGenIrHandler.d.ts.map +1 -1
- package/build/types/commands/types.d.ts +12 -0
- package/build/types/commands/types.d.ts.map +1 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldDef.d.ts +2 -2
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldDef.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.d.ts +1 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.d.ts +1 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.d.ts +3 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.d.ts +2 -2
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/unionDef.d.ts +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/unionDef.d.ts.map +1 -1
- package/build/types/utils/generatedFileHeader.d.ts +1 -0
- package/build/types/utils/generatedFileHeader.d.ts.map +1 -1
- package/build/types/utils/ir/__tests__/convertIrToWireSchema.test.d.ts +2 -0
- package/build/types/utils/ir/__tests__/convertIrToWireSchema.test.d.ts.map +1 -0
- package/build/types/utils/ir/convertIrToWireSchema.d.ts +17 -0
- package/build/types/utils/ir/convertIrToWireSchema.d.ts.map +1 -0
- package/build/types/utils/steps/parseMigrationSteps.d.ts.map +1 -1
- package/package.json +2 -2
package/build/esm/cli.js
CHANGED
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Command } from "commander";
|
|
18
|
+
import { registerAssetCommands } from "./commands/asset/registerAssetCommands.js";
|
|
18
19
|
import { registerIrCommands } from "./commands/ir/registerIrCommands.js";
|
|
19
20
|
import { registerSchemaCommands } from "./commands/schema/registerSchemaCommands.js";
|
|
20
21
|
import { registerStepsCommands } from "./commands/steps/registerStepsCommands.js";
|
|
21
22
|
export function cli(args) {
|
|
22
23
|
const program = new Command();
|
|
23
24
|
program.name("document-schema-type-gen").description("Document schema type generation CLI").version("0.0.1");
|
|
25
|
+
registerAssetCommands(program);
|
|
24
26
|
registerIrCommands(program);
|
|
25
27
|
registerSchemaCommands(program);
|
|
26
28
|
registerStepsCommands(program);
|
package/build/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"cli.js","names":["Command","registerAssetCommands","registerIrCommands","registerSchemaCommands","registerStepsCommands","cli","args","program","name","description","version","parse"],"sources":["cli.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Command } from \"commander\";\nimport { registerAssetCommands } from \"./commands/asset/registerAssetCommands.js\";\nimport { registerIrCommands } from \"./commands/ir/registerIrCommands.js\";\nimport { registerSchemaCommands } from \"./commands/schema/registerSchemaCommands.js\";\nimport { registerStepsCommands } from \"./commands/steps/registerStepsCommands.js\";\n\nexport function cli(args: string[]): void {\n const program = new Command();\n\n program\n .name(\"document-schema-type-gen\")\n .description(\"Document schema type generation CLI\")\n .version(\"0.0.1\");\n\n registerAssetCommands(program);\n registerIrCommands(program);\n registerSchemaCommands(program);\n registerStepsCommands(program);\n\n program.parse(args);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;AACnC,SAASC,qBAAqB,QAAQ,2CAA2C;AACjF,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,sBAAsB,QAAQ,6CAA6C;AACpF,SAASC,qBAAqB,QAAQ,2CAA2C;AAEjF,OAAO,SAASC,GAAGA,CAACC,IAAc,EAAQ;EACxC,MAAMC,OAAO,GAAG,IAAIP,OAAO,CAAC,CAAC;EAE7BO,OAAO,CACJC,IAAI,CAAC,0BAA0B,CAAC,CAChCC,WAAW,CAAC,qCAAqC,CAAC,CAClDC,OAAO,CAAC,OAAO,CAAC;EAEnBT,qBAAqB,CAACM,OAAO,CAAC;EAC9BL,kBAAkB,CAACK,OAAO,CAAC;EAC3BJ,sBAAsB,CAACI,OAAO,CAAC;EAC/BH,qBAAqB,CAACG,OAAO,CAAC;EAE9BA,OAAO,CAACI,KAAK,CAACL,IAAI,CAAC;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createPlatformClient, PalantirApiError } from "@osdk/client";
|
|
18
|
+
import { DocumentTypes } from "@osdk/foundry.pack";
|
|
19
|
+
import { CommanderError } from "commander";
|
|
20
|
+
import { consola } from "consola";
|
|
21
|
+
import { readFileSync } from "fs";
|
|
22
|
+
import { resolve } from "path";
|
|
23
|
+
/** Useful for manually deploying a document type during development to test schema changes. */
|
|
24
|
+
export async function assetDeployHandler(options) {
|
|
25
|
+
try {
|
|
26
|
+
const assetPath = resolve(options.input);
|
|
27
|
+
consola.info(`Reading asset file from: ${assetPath}`);
|
|
28
|
+
const assetContent = readFileSync(assetPath, "utf8");
|
|
29
|
+
const asset = JSON.parse(assetContent);
|
|
30
|
+
const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));
|
|
31
|
+
const request = {
|
|
32
|
+
requestBody: {
|
|
33
|
+
name: asset.documentTypeName,
|
|
34
|
+
ontologyRid: options.ontologyRid,
|
|
35
|
+
schema: asset.documentStorageType.yjs,
|
|
36
|
+
fileSystemType: asset.fileSystemType,
|
|
37
|
+
version: asset.schemaVersion
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
consola.info("Creating first-party document type", request);
|
|
41
|
+
const result = await DocumentTypes.createFirstParty(osdkClient, request, {
|
|
42
|
+
preview: true
|
|
43
|
+
});
|
|
44
|
+
consola.success("Successfully created first-party document type", result);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error instanceof PalantirApiError) {
|
|
47
|
+
const {
|
|
48
|
+
message,
|
|
49
|
+
errorName,
|
|
50
|
+
errorCode
|
|
51
|
+
} = error;
|
|
52
|
+
const details = [errorName, errorCode].filter(Boolean).join(" ");
|
|
53
|
+
consola.error(`❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : ""}`);
|
|
54
|
+
} else {
|
|
55
|
+
consola.error("❌ Error during first-party deploy:", error);
|
|
56
|
+
}
|
|
57
|
+
throw new CommanderError(1, "ERRASSETDEPLOY", "Error deploying document type from asset");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=assetDeployHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetDeployHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","assetDeployHandler","options","assetPath","input","info","assetContent","asset","JSON","parse","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","join"],"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}\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 osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\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;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;AAU9B;AACA,OAAO,eAAeC,kBAAkBA,CAACC,OAA2B,EAAiB;EACnF,IAAI;IACF,MAAMC,SAAS,GAAGH,OAAO,CAACE,OAAO,CAACE,KAAK,CAAC;IAExCN,OAAO,CAACO,IAAI,CAAC,4BAA4BF,SAAS,EAAE,CAAC;IAErD,MAAMG,YAAY,GAAGP,YAAY,CAACI,SAAS,EAAE,MAAM,CAAC;IACpD,MAAMI,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACH,YAAY,CAAsB;IAE3D,MAAMI,UAAU,GAAGhB,oBAAoB,CACrCQ,OAAO,CAACS,OAAO,EACf,MAAMC,OAAO,CAACZ,OAAO,CAACE,OAAO,CAACW,IAAI,CACpC,CAAC;IAED,MAAMC,OAA4C,GAAG;MACnDC,WAAW,EAAE;QACXC,IAAI,EAAET,KAAK,CAACU,gBAAgB;QAC5BC,WAAW,EAAEhB,OAAO,CAACgB,WAAW;QAChCC,MAAM,EAAEZ,KAAK,CAACa,mBAAmB,CAACC,GAAG;QACrCC,cAAc,EAAEf,KAAK,CAACe,cAAc;QACpCC,OAAO,EAAEhB,KAAK,CAACiB;MACjB;IACF,CAAC;IAED1B,OAAO,CAACO,IAAI,CAAC,oCAAoC,EAAES,OAAO,CAAC;IAE3D,MAAMW,MAAM,GAAG,MAAM7B,aAAa,CAAC8B,gBAAgB,CAAChB,UAAU,EAAEI,OAAO,EAAE;MAAEa,OAAO,EAAE;IAAK,CAAC,CAAC;IAE3F7B,OAAO,CAAC8B,OAAO,CAAC,gDAAgD,EAAEH,MAAM,CAAC;EAC3E,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYlC,gBAAgB,EAAE;MACrC,MAAM;QAAEmC,OAAO;QAAEC,SAAS;QAAEC;MAAU,CAAC,GAAGH,KAAK;MAC/C,MAAMI,OAAO,GAAG,CAACF,SAAS,EAAEC,SAAS,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAChEtC,OAAO,CAAC+B,KAAK,CACX,sCAAsCC,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAChF,CAAC;IACH,CAAC,MAAM;MACLnC,OAAO,CAAC+B,KAAK,CAAC,oCAAoC,EAAEA,KAAK,CAAC;IAC5D;IACA,MAAM,IAAIhC,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,0CAA0C,CAAC;EAC3F;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { assetDeployHandler } from "./assetDeployHandler.js";
|
|
18
|
+
export function registerAssetCommands(program) {
|
|
19
|
+
const assetCmd = program.command("asset").description("Asset-based document type commands");
|
|
20
|
+
assetCmd.command("deploy").description("Deploy a document type to a Foundry stack using an asset JSON file").requiredOption("-i, --input <file>", "Path to asset JSON file (output of 'ir asset')").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").action(assetDeployHandler);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=registerAssetCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerAssetCommands.js","names":["assetDeployHandler","registerAssetCommands","program","assetCmd","command","description","requiredOption","action"],"sources":["registerAssetCommands.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 { assetDeployHandler } from \"./assetDeployHandler.js\";\n\nexport function registerAssetCommands(program: Command): void {\n const assetCmd = program\n .command(\"asset\")\n .description(\"Asset-based document type commands\");\n\n assetCmd\n .command(\"deploy\")\n .description(\"Deploy a document type to a Foundry stack using an asset JSON file\")\n .requiredOption(\"-i, --input <file>\", \"Path to asset JSON file (output of 'ir asset')\")\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 .action(assetDeployHandler);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,kBAAkB,QAAQ,yBAAyB;AAE5D,OAAO,SAASC,qBAAqBA,CAACC,OAAgB,EAAQ;EAC5D,MAAMC,QAAQ,GAAGD,OAAO,CACrBE,OAAO,CAAC,OAAO,CAAC,CAChBC,WAAW,CAAC,oCAAoC,CAAC;EAEpDF,QAAQ,CACLC,OAAO,CAAC,QAAQ,CAAC,CACjBC,WAAW,CAAC,oEAAoE,CAAC,CACjFC,cAAc,CAAC,oBAAoB,EAAE,gDAAgD,CAAC,CACtFA,cAAc,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAClEA,cAAc,CAAC,oBAAoB,EAAE,sCAAsC,CAAC,CAC5EA,cAAc,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CACjEC,MAAM,CAACP,kBAAkB,CAAC;AAC/B","ignoreList":[]}
|
|
@@ -20,6 +20,7 @@ import { CommanderError } from "commander";
|
|
|
20
20
|
import { consola } from "consola";
|
|
21
21
|
import { readFileSync } from "fs";
|
|
22
22
|
import { resolve } from "path";
|
|
23
|
+
import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
|
|
23
24
|
export async function irDeployHandler(options) {
|
|
24
25
|
try {
|
|
25
26
|
const irPath = resolve(options.ir);
|
|
@@ -29,16 +30,16 @@ export async function irDeployHandler(options) {
|
|
|
29
30
|
// TODO: conjureToZod based validation that IR content matches the conjure IR shape
|
|
30
31
|
const ir = JSON.parse(irContent);
|
|
31
32
|
const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth));
|
|
33
|
+
const schema = convertIrToWireSchema(ir);
|
|
32
34
|
const request = {
|
|
33
35
|
name: ir.name,
|
|
34
|
-
parentFolderRid: options.parentFolder
|
|
36
|
+
parentFolderRid: options.parentFolder,
|
|
37
|
+
schema
|
|
35
38
|
};
|
|
36
39
|
if (options.fileSystemType != null) {
|
|
37
40
|
request.fileSystemType = options.fileSystemType;
|
|
38
41
|
}
|
|
39
|
-
|
|
40
|
-
// PACK BE does not yet support storing schemas...
|
|
41
|
-
consola.warn("Creating document type without schema information", request);
|
|
42
|
+
consola.info("Creating document type with schema", request);
|
|
42
43
|
await DocumentTypes.create(osdkClient, request, {
|
|
43
44
|
preview: true
|
|
44
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","irDeployHandler","options","irPath","ir","info","irContent","JSON","parse","osdkClient","baseUrl","Promise","auth","request","name","parentFolderRid","parentFolder","fileSystemType","
|
|
1
|
+
{"version":3,"file":"irDeployHandler.js","names":["createPlatformClient","DocumentTypes","CommanderError","consola","readFileSync","resolve","convertIrToWireSchema","irDeployHandler","options","irPath","ir","info","irContent","JSON","parse","osdkClient","baseUrl","Promise","auth","schema","request","name","parentFolderRid","parentFolder","fileSystemType","create","preview","error"],"sources":["irDeployHandler.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPlatformClient } from \"@osdk/client\";\nimport type { CreateDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport type { IRealTimeDocumentSchema } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { convertIrToWireSchema } from \"../../utils/ir/convertIrToWireSchema.js\";\nimport type { FileSystemType } from \"../types.js\";\n\ninterface DeployOptions {\n readonly ir: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly parentFolder: string;\n readonly fileSystemType: FileSystemType;\n}\n\nexport async function irDeployHandler(options: DeployOptions): Promise<void> {\n try {\n const irPath = resolve(options.ir);\n\n consola.info(`Reading schema from: ${irPath}`);\n\n const irContent = readFileSync(irPath, \"utf8\");\n\n // TODO: conjureToZod based validation that IR content matches the conjure IR shape\n const ir = JSON.parse(irContent) as IRealTimeDocumentSchema;\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n );\n\n const schema = convertIrToWireSchema(ir);\n\n const request: CreateDocumentTypeRequest = {\n name: ir.name,\n parentFolderRid: options.parentFolder,\n schema,\n };\n\n if (options.fileSystemType != null) {\n request.fileSystemType = options.fileSystemType;\n }\n\n consola.info(\"Creating document type with schema\", request);\n\n await DocumentTypes.create(osdkClient, request, { preview: true });\n } catch (error) {\n consola.error(\"❌ Error during Deploy:\", error);\n throw new CommanderError(1, \"ERRIRMDEPLOY\", \"Error deploying IR document schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,QAAQ,cAAc;AAEnD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAE9B,SAASC,qBAAqB,QAAQ,yCAAyC;AAW/E,OAAO,eAAeC,eAAeA,CAACC,OAAsB,EAAiB;EAC3E,IAAI;IACF,MAAMC,MAAM,GAAGJ,OAAO,CAACG,OAAO,CAACE,EAAE,CAAC;IAElCP,OAAO,CAACQ,IAAI,CAAC,wBAAwBF,MAAM,EAAE,CAAC;IAE9C,MAAMG,SAAS,GAAGR,YAAY,CAACK,MAAM,EAAE,MAAM,CAAC;;IAE9C;IACA,MAAMC,EAAE,GAAGG,IAAI,CAACC,KAAK,CAACF,SAAS,CAA4B;IAE3D,MAAMG,UAAU,GAAGf,oBAAoB,CACrCQ,OAAO,CAACQ,OAAO,EACf,MAAMC,OAAO,CAACZ,OAAO,CAACG,OAAO,CAACU,IAAI,CACpC,CAAC;IAED,MAAMC,MAAM,GAAGb,qBAAqB,CAACI,EAAE,CAAC;IAExC,MAAMU,OAAkC,GAAG;MACzCC,IAAI,EAAEX,EAAE,CAACW,IAAI;MACbC,eAAe,EAAEd,OAAO,CAACe,YAAY;MACrCJ;IACF,CAAC;IAED,IAAIX,OAAO,CAACgB,cAAc,IAAI,IAAI,EAAE;MAClCJ,OAAO,CAACI,cAAc,GAAGhB,OAAO,CAACgB,cAAc;IACjD;IAEArB,OAAO,CAACQ,IAAI,CAAC,oCAAoC,EAAES,OAAO,CAAC;IAE3D,MAAMnB,aAAa,CAACwB,MAAM,CAACV,UAAU,EAAEK,OAAO,EAAE;MAAEM,OAAO,EAAE;IAAK,CAAC,CAAC;EACpE,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdxB,OAAO,CAACwB,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;IAC9C,MAAM,IAAIzB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,oCAAoC,CAAC;EACnF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { CommanderError } from "commander";
|
|
18
|
+
import { consola } from "consola";
|
|
19
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
20
|
+
import { dirname, resolve } from "path";
|
|
21
|
+
import { GENERATED_JSON_COMMENT } from "../../utils/generatedFileHeader.js";
|
|
22
|
+
import { convertIrToWireSchema } from "../../utils/ir/convertIrToWireSchema.js";
|
|
23
|
+
/**
|
|
24
|
+
* Generates a document type asset JSON file from an IR schema.
|
|
25
|
+
*
|
|
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.
|
|
30
|
+
*
|
|
31
|
+
* If you are unsure whether you need this command, you almost certainly do not.
|
|
32
|
+
*/
|
|
33
|
+
export function irGenAssetHandler(options) {
|
|
34
|
+
try {
|
|
35
|
+
const irPath = resolve(options.ir);
|
|
36
|
+
const outputPath = resolve(options.output);
|
|
37
|
+
if (!existsSync(irPath)) {
|
|
38
|
+
throw new CommanderError(1, "ENOENT", `IR file does not exist: ${irPath}`);
|
|
39
|
+
}
|
|
40
|
+
consola.info(`Reading IR schema from: ${irPath}`);
|
|
41
|
+
const irSchema = JSON.parse(readFileSync(irPath, "utf8"));
|
|
42
|
+
const {
|
|
43
|
+
name: documentTypeName,
|
|
44
|
+
version: schemaVersion
|
|
45
|
+
} = irSchema;
|
|
46
|
+
const wireSchema = convertIrToWireSchema(irSchema);
|
|
47
|
+
const fileSystemType = options.fileSystemType ?? "ARTIFACTS";
|
|
48
|
+
if (fileSystemType !== "ARTIFACTS" && fileSystemType !== "COMPASS") {
|
|
49
|
+
throw new CommanderError(1, "EINVAL", `Invalid fileSystemType "${fileSystemType}". Must be "ARTIFACTS" or "COMPASS".`);
|
|
50
|
+
}
|
|
51
|
+
const outputDir = dirname(outputPath);
|
|
52
|
+
if (!existsSync(outputDir)) {
|
|
53
|
+
mkdirSync(outputDir, {
|
|
54
|
+
recursive: true
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const output = {
|
|
58
|
+
__comment: GENERATED_JSON_COMMENT,
|
|
59
|
+
...{
|
|
60
|
+
documentTypeName,
|
|
61
|
+
documentStorageType: {
|
|
62
|
+
type: "yjs",
|
|
63
|
+
yjs: wireSchema
|
|
64
|
+
},
|
|
65
|
+
fileSystemType,
|
|
66
|
+
schemaVersion
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
writeFileSync(outputPath, JSON.stringify(output, null, 2), "utf8");
|
|
70
|
+
consola.success("Successfully generated document type asset");
|
|
71
|
+
consola.info(` Output: ${outputPath}`);
|
|
72
|
+
consola.info(` Document type: ${documentTypeName}`);
|
|
73
|
+
consola.info(` Schema version: ${schemaVersion}`);
|
|
74
|
+
consola.info(` File system type: ${fileSystemType}`);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (error instanceof CommanderError) {
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
consola.error("Error generating document type asset:", error);
|
|
80
|
+
throw new CommanderError(1, "IR_ASSET_ERROR", "Failed to generate document type asset");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=irGenAssetHandler.js.map
|
|
@@ -0,0 +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,UAAU,CAACU,MAAM,CAAC,EAAE;MACvB,MAAM,IAAIZ,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,2BAA2BY,MAAM,EAAE,CAAC;IAC5E;IAEAX,OAAO,CAACe,IAAI,CAAC,2BAA2BJ,MAAM,EAAE,CAAC;IACjD,MAAMK,QAAQ,GAAGC,IAAI,CAACC,KAAK,CACzBf,YAAY,CAACQ,MAAM,EAAE,MAAM,CAC7B,CAA4B;IAE5B,MAAM;MAAEQ,IAAI,EAAEC,gBAAgB;MAAEC,OAAO,EAAEC;IAAc,CAAC,GAAGN,QAAQ;IACnE,MAAMO,UAAU,GAAGf,qBAAqB,CAACQ,QAAQ,CAAC;IAElD,MAAMQ,cAAc,GAAGd,OAAO,CAACc,cAAc,IAAI,WAAW;IAC5D,IAAIA,cAAc,KAAK,WAAW,IAAIA,cAAc,KAAK,SAAS,EAAE;MAClE,MAAM,IAAIzB,cAAc,CACtB,CAAC,EACD,QAAQ,EACR,2BAA2ByB,cAAc,sCAC3C,CAAC;IACH;IAYA,MAAMC,SAAS,GAAGpB,OAAO,CAACQ,UAAU,CAAC;IACrC,IAAI,CAACZ,UAAU,CAACwB,SAAS,CAAC,EAAE;MAC1BvB,SAAS,CAACuB,SAAS,EAAE;QAAEC,SAAS,EAAE;MAAK,CAAC,CAAC;IAC3C;IACA,MAAMZ,MAAM,GAAG;MAAEa,SAAS,EAAEpB,sBAAsB;MAAE,GAdnB;QAC/Ba,gBAAgB;QAChBQ,mBAAmB,EAAE;UACnBC,IAAI,EAAE,KAAK;UACXC,GAAG,EAAEP;QACP,CAAC;QACDC,cAAc;QACdF;MACF;IAM6D,CAAC;IAC9DlB,aAAa,CAACS,UAAU,EAAEI,IAAI,CAACc,SAAS,CAACjB,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAElEd,OAAO,CAACgC,OAAO,CAAC,4CAA4C,CAAC;IAC7DhC,OAAO,CAACe,IAAI,CAAC,cAAcF,UAAU,EAAE,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":[]}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { irDeployHandler } from "./irDeployHandler.js";
|
|
18
|
+
import { irGenAssetHandler } from "./irGenAssetHandler.js";
|
|
18
19
|
import { irGenModelsHandler } from "./irGenModelsHandler.js";
|
|
19
20
|
import { irGenZodHandler } from "./irGenZodHandler.js";
|
|
20
21
|
export function registerIrCommands(program) {
|
|
@@ -22,5 +23,6 @@ export function registerIrCommands(program) {
|
|
|
22
23
|
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);
|
|
23
24
|
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);
|
|
24
25
|
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);
|
|
26
|
+
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);
|
|
25
27
|
}
|
|
26
28
|
//# sourceMappingURL=registerIrCommands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenModelsHandler","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 { irGenModelsHandler } from \"./irGenModelsHandler.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(\"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,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,KAAK,CAAC,CACdC,WAAW,CAAC,0DAA0D,CAAC,CACvEC,cAAc,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CACjEA,cAAc,CAAC,qBAAqB,EAAE,4CAA4C,CAAC,CACnFC,MAAM,CACL,+BAA+B,EAC/B,yDACF,CAAC,CACAC,MAAM,CAACR,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,CACvFC,MAAM,CACL,+BAA+B,EAC/B,2BAA2B,EAC3B,YACF,CAAC,CACAA,MAAM,CACL,6BAA6B,EAC7B,6BAA6B,EAC7B,aACF,CAAC,CACAC,MAAM,CAACT,kBAAkB,CAAC;EAE7BI,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,CACAE,MAAM,
|
|
1
|
+
{"version":3,"file":"registerIrCommands.js","names":["irDeployHandler","irGenAssetHandler","irGenModelsHandler","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 { 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(\"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,QAAQ,sBAAsB;AACtD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,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,KAAK,CAAC,CACdC,WAAW,CAAC,0DAA0D,CAAC,CACvEC,cAAc,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CACjEA,cAAc,CAAC,qBAAqB,EAAE,4CAA4C,CAAC,CACnFC,MAAM,CACL,+BAA+B,EAC/B,yDACF,CAAC,CACAC,MAAM,CAACR,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,CACvFC,MAAM,CACL,+BAA+B,EAC/B,2BAA2B,EAC3B,YACF,CAAC,CACAA,MAAM,CACL,6BAA6B,EAC7B,6BAA6B,EAC7B,aACF,CAAC,CACAC,MAAM,CAACT,kBAAkB,CAAC;EAE7BI,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,CACAE,MAAM,CAACX,eAAe,CAAC;EAE1BM,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,CAACV,iBAAiB,CAAC;AAC9B","ignoreList":[]}
|
|
@@ -19,6 +19,7 @@ import { consola } from "consola";
|
|
|
19
19
|
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
20
20
|
import { dirname, join } from "path";
|
|
21
21
|
import * as YAML from "yaml";
|
|
22
|
+
import { GENERATED_JSON_COMMENT } from "../../utils/generatedFileHeader.js";
|
|
22
23
|
import { convertStepsToIr } from "../../utils/steps/convertStepsToIr.js";
|
|
23
24
|
import { parseMigrationSteps } from "../../utils/steps/parseMigrationSteps.js";
|
|
24
25
|
export function stepsGenIrHandler(options) {
|
|
@@ -61,7 +62,11 @@ export function stepsGenIrHandler(options) {
|
|
|
61
62
|
recursive: true
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
const output = {
|
|
66
|
+
__comment: GENERATED_JSON_COMMENT,
|
|
67
|
+
...schema
|
|
68
|
+
};
|
|
69
|
+
writeFileSync(outputFile, JSON.stringify(output, null, 2), "utf8");
|
|
65
70
|
consola.success("✅ Successfully converted migration steps to IR format");
|
|
66
71
|
consola.info(` Generated types written to: ${outputFile}`);
|
|
67
72
|
consola.info(` Schema: ${schema.name} v${schema.version}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepsGenIrHandler.js","names":["CommanderError","consola","existsSync","mkdirSync","readdirSync","readFileSync","statSync","writeFileSync","dirname","join","YAML","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","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 { 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 writeFileSync(outputFile, JSON.stringify(
|
|
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;IAEA,MAAMI,KAAK,GAAGjB,WAAW,CAACa,QAAQ,CAAC,CAChCK,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACC,QAAQ,CAAC,MAAM,CAAC,IAAID,IAAI,CAACC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAElE,IAAIH,KAAK,CAACI,MAAM,KAAK,CAAC,EAAE;MACtB,MAAM,IAAIzB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,qCAAqCiB,QAAQ,EAAE,CAAC;IAC1F;IAEA,MAAMS,WAAW,GAAGL,KAAK,CAACM,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;IAE5D,MAAME,cAA+B,GAAG,EAAE;IAC1C,KAAK,MAAMR,IAAI,IAAIG,WAAW,EAAE;MAC9B,MAAMM,QAAQ,GAAGvB,IAAI,CAACQ,QAAQ,EAAEM,IAAI,CAAC;MACrC,MAAMU,WAAW,GAAG5B,YAAY,CAAC2B,QAAQ,EAAE,MAAM,CAAC;MAClD,MAAME,MAAM,GAAGxB,IAAI,CAACyB,KAAK,CAACF,WAAW,CAAY;MACjD,MAAMG,cAAc,GAAGvB,mBAAmB,CAACqB,MAAM,CAAC;MAClDH,cAAc,CAACM,IAAI,CAAC,GAAGD,cAAc,CAAC;IACxC;IAEAnC,OAAO,CAACqC,IAAI,CAAC,cAAcP,cAAc,CAACN,MAAM,oCAAoC,CAAC;;IAErF;IACA,MAAMc,QAAwB,GAAG;MAC/BC,IAAI,EAAEzB,OAAO,CAAC0B,UAAU;MACxBC,WAAW,EAAE3B,OAAO,CAAC4B,iBAAiB;MACtCC,OAAO,EAAE7B,OAAO,CAAC6B,OAAO,GAAGC,QAAQ,CAAC9B,OAAO,CAAC6B,OAAO,EAAE,EAAE,CAAC,GAAGE;IAC7D,CAAC;IAED,MAAMC,MAAM,GAAGnC,gBAAgB,CAACmB,cAAc,EAAEQ,QAAQ,CAAC;IAEzD,MAAMS,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,SAAS,EAAEvC,sBAAsB;MAAE,GAAGoC;IAAO,CAAC;IAC/DxC,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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DocumentTypeSchema } from \"@osdk/foundry.pack\";\n\nexport type FileSystemType = \"ARTIFACTS\" | \"COMPASS\";\n\nexport interface DocumentTypeAsset {\n readonly documentTypeName: string;\n readonly documentStorageType: {\n readonly type: \"yjs\";\n readonly yjs: DocumentTypeSchema;\n };\n readonly fileSystemType: FileSystemType;\n readonly schemaVersion: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldDef.js","names":[],"sources":["fieldDef.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 { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type * as IFieldTypeUnion from \"./fieldTypeUnion.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IFieldDef {\n readonly \"key\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"isOptional\"?: boolean | null;\n readonly \"
|
|
1
|
+
{"version":3,"file":"fieldDef.js","names":[],"sources":["fieldDef.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 { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type * as IFieldTypeUnion from \"./fieldTypeUnion.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IFieldDef {\n readonly \"key\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"isOptional\"?: boolean | null;\n readonly \"fieldType\": IFieldTypeUnion.IFieldTypeUnion;\n readonly \"metadata\": ISchemaMeta;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueDatetime.js","names":[],"sources":["fieldValueDatetime.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueDatetime {\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fieldValueDatetime.js","names":[],"sources":["fieldValueDatetime.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueDatetime {\n readonly \"value\"?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueMediaRef.js","names":[],"sources":["fieldValueMediaRef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueMediaRef {\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fieldValueMediaRef.js","names":[],"sources":["fieldValueMediaRef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueMediaRef {\n readonly \"value\"?: any;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueText.js","names":[],"sources":["fieldValueText.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueText {\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fieldValueText.js","names":[],"sources":["fieldValueText.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueText {\n readonly \"defaultValue\"?: string | null;\n readonly \"minLength\"?: number | null;\n readonly \"maxLength\"?: number | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordDef.js","names":[],"sources":["recordDef.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 { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IFieldDef } from \"./fieldDef.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IRecordDef {\n readonly \"key\": IModelTypeKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"fields\": ReadonlyArray<IFieldDef>;\n readonly \"
|
|
1
|
+
{"version":3,"file":"recordDef.js","names":[],"sources":["recordDef.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 { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IFieldDef } from \"./fieldDef.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IRecordDef {\n readonly \"key\": IModelTypeKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"fields\": ReadonlyArray<IFieldDef>;\n readonly \"metadata\": ISchemaMeta;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaMeta.js","names":[],"sources":["schemaMeta.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 { ISchemaVersion } from \"../pack-docschema-api/schemaVersion.js\";\nexport interface ISchemaMeta {\n readonly \"
|
|
1
|
+
{"version":3,"file":"schemaMeta.js","names":[],"sources":["schemaMeta.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 { ISchemaVersion } from \"../pack-docschema-api/schemaVersion.js\";\nexport interface ISchemaMeta {\n readonly \"addedInVersion\": ISchemaVersion;\n readonly \"deprecatedFromVersion\"?: ISchemaVersion | null;\n readonly \"deprecatedMessage\"?: string | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionDef.js","names":[],"sources":["unionDef.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 { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IUnionVariantKey } from \"../pack-docschema-api/unionVariantKey.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IUnionDef {\n readonly \"key\": IModelTypeKey;\n readonly \"discriminant\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"variants\": {\n readonly [key: IUnionVariantKey]: IModelTypeKey;\n };\n readonly \"
|
|
1
|
+
{"version":3,"file":"unionDef.js","names":[],"sources":["unionDef.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 { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IUnionVariantKey } from \"../pack-docschema-api/unionVariantKey.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IUnionDef {\n readonly \"key\": IModelTypeKey;\n readonly \"discriminant\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"variants\": {\n readonly [key: IUnionVariantKey]: IModelTypeKey;\n };\n readonly \"metadata\": ISchemaMeta;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -37,4 +37,5 @@ const {
|
|
|
37
37
|
version
|
|
38
38
|
} = fs.readJsonSync(packageJsonPath);
|
|
39
39
|
export const GENERATED_FILE_HEADER = `/* Generated by ${packageName}@${version} */\n\n`;
|
|
40
|
+
export const GENERATED_JSON_COMMENT = `Auto-generated by ${packageName}@${version}. Do not edit this file manually.`;
|
|
40
41
|
//# sourceMappingURL=generatedFileHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatedFileHeader.js","names":["fs","path","fileURLToPath","currentDir","dirname","import","meta","url","findPackageJson","startDir","dir","packageJsonPath","join","existsSync","Error","name","packageName","version","readJsonSync","GENERATED_FILE_HEADER"],"sources":["generatedFileHeader.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n// Walk up directories to find the nearest package.json (works for both src and build/esm locations)\nfunction findPackageJson(startDir: string): string {\n let dir = startDir;\n while (dir !== path.dirname(dir)) {\n const packageJsonPath = path.join(dir, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n dir = path.dirname(dir);\n }\n throw new Error(\"Could not find package.json\");\n}\n\nconst packageJsonPath = findPackageJson(currentDir);\nconst { name: packageName, version } = fs.readJsonSync(packageJsonPath) as {\n name: string;\n version: string;\n};\n\nexport const GENERATED_FILE_HEADER: string = `/* Generated by ${packageName}@${version} */\\n\\n`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;;AAE/D;AACA,SAASC,eAAeA,CAACC,QAAgB,EAAU;EACjD,IAAIC,GAAG,GAAGD,QAAQ;EAClB,OAAOC,GAAG,KAAKT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC,EAAE;IAChC,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACF,GAAG,EAAE,cAAc,CAAC;IACtD,IAAIV,EAAE,CAACa,UAAU,CAACF,eAAe,CAAC,EAAE;MAClC,OAAOA,eAAe;IACxB;IACAD,GAAG,GAAGT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC;EACzB;EACA,MAAM,IAAII,KAAK,CAAC,6BAA6B,CAAC;AAChD;AAEA,MAAMH,eAAe,GAAGH,eAAe,CAACL,UAAU,CAAC;AACnD,MAAM;EAAEY,IAAI,EAAEC,WAAW;EAAEC;AAAQ,CAAC,GAAGjB,EAAE,CAACkB,YAAY,CAACP,eAAe,CAGrE;AAED,OAAO,MAAMQ,qBAA6B,GAAG,mBAAmBH,WAAW,IAAIC,OAAO,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generatedFileHeader.js","names":["fs","path","fileURLToPath","currentDir","dirname","import","meta","url","findPackageJson","startDir","dir","packageJsonPath","join","existsSync","Error","name","packageName","version","readJsonSync","GENERATED_FILE_HEADER","GENERATED_JSON_COMMENT"],"sources":["generatedFileHeader.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n// Walk up directories to find the nearest package.json (works for both src and build/esm locations)\nfunction findPackageJson(startDir: string): string {\n let dir = startDir;\n while (dir !== path.dirname(dir)) {\n const packageJsonPath = path.join(dir, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n dir = path.dirname(dir);\n }\n throw new Error(\"Could not find package.json\");\n}\n\nconst packageJsonPath = findPackageJson(currentDir);\nconst { name: packageName, version } = fs.readJsonSync(packageJsonPath) as {\n name: string;\n version: string;\n};\n\nexport const GENERATED_FILE_HEADER: string = `/* Generated by ${packageName}@${version} */\\n\\n`;\n\nexport const GENERATED_JSON_COMMENT: string =\n `Auto-generated by ${packageName}@${version}. Do not edit this file manually.`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;;AAE/D;AACA,SAASC,eAAeA,CAACC,QAAgB,EAAU;EACjD,IAAIC,GAAG,GAAGD,QAAQ;EAClB,OAAOC,GAAG,KAAKT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC,EAAE;IAChC,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACF,GAAG,EAAE,cAAc,CAAC;IACtD,IAAIV,EAAE,CAACa,UAAU,CAACF,eAAe,CAAC,EAAE;MAClC,OAAOA,eAAe;IACxB;IACAD,GAAG,GAAGT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC;EACzB;EACA,MAAM,IAAII,KAAK,CAAC,6BAA6B,CAAC;AAChD;AAEA,MAAMH,eAAe,GAAGH,eAAe,CAACL,UAAU,CAAC;AACnD,MAAM;EAAEY,IAAI,EAAEC,WAAW;EAAEC;AAAQ,CAAC,GAAGjB,EAAE,CAACkB,YAAY,CAACP,eAAe,CAGrE;AAED,OAAO,MAAMQ,qBAA6B,GAAG,mBAAmBH,WAAW,IAAIC,OAAO,SAAS;AAE/F,OAAO,MAAMG,sBAA8B,GACzC,qBAAqBJ,WAAW,IAAIC,OAAO,mCAAmC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
|
|
2
2
|
|
|
3
3
|
import { Metadata } from '@palantir/pack.document-schema.model-types';
|
|
4
4
|
import { AnimalCatSchema, AnimalDogSchema, AnimalSchema, CatSchema, DogSchema } from './schema.js';
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-discriminant.js","names":["Metadata","AnimalCatSchema","AnimalDogSchema","AnimalSchema","CatSchema","DogSchema","CatModel","__type","zodSchema","name","DogModel","AnimalModel","discriminant","AnimalCatModel","AnimalDogModel","DocumentModel","Cat","Dog","Animal","AnimalCat","AnimalDog","version"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"custom-discriminant.js","names":["Metadata","AnimalCatSchema","AnimalDogSchema","AnimalSchema","CatSchema","DogSchema","CatModel","__type","zodSchema","name","DogModel","AnimalModel","discriminant","AnimalCatModel","AnimalDogModel","DocumentModel","Cat","Dog","Animal","AnimalCat","AnimalDog","version"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Animal, AnimalCat, AnimalDog, Cat, Dog } from './types.js';\nimport {\n AnimalCatSchema,\n AnimalDogSchema,\n AnimalSchema,\n CatSchema,\n DogSchema,\n} from './schema.js';\n\nexport interface CatModel extends RecordModel<Cat, typeof CatSchema> {}\nexport const CatModel: CatModel = {\n __type: {} as Cat,\n zodSchema: CatSchema,\n [Metadata]: {\n name: 'Cat',\n },\n};\n\nexport interface DogModel extends RecordModel<Dog, typeof DogSchema> {}\nexport const DogModel: DogModel = {\n __type: {} as Dog,\n zodSchema: DogSchema,\n [Metadata]: {\n name: 'Dog',\n },\n};\n\nexport interface AnimalModel extends UnionModel<Animal, typeof AnimalSchema> {}\nexport const AnimalModel: AnimalModel = {\n __type: {} as Animal,\n zodSchema: AnimalSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'Animal',\n },\n};\n\nexport interface AnimalCatModel extends UnionModel<\n AnimalCat,\n typeof AnimalCatSchema\n> {}\nexport const AnimalCatModel: AnimalCatModel = {\n __type: {} as AnimalCat,\n zodSchema: AnimalCatSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'AnimalCat',\n },\n};\n\nexport interface AnimalDogModel extends UnionModel<\n AnimalDog,\n typeof AnimalDogSchema\n> {}\nexport const AnimalDogModel: AnimalDogModel = {\n __type: {} as AnimalDog,\n zodSchema: AnimalDogSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'AnimalDog',\n },\n};\n\nexport const DocumentModel = {\n Cat: CatModel,\n Dog: DogModel,\n Animal: AnimalModel,\n AnimalCat: AnimalCatModel,\n AnimalDog: AnimalDogModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SACEC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,SAAS,EACTC,SAAS,QACJ,aAAa;AAGpB,OAAO,MAAMC,QAAkB,GAAG;EAChCC,MAAM,EAAE,CAAC,CAAQ;EACjBC,SAAS,EAAEJ,SAAS;EACpB,CAACJ,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAMC,QAAkB,GAAG;EAChCH,MAAM,EAAE,CAAC,CAAQ;EACjBC,SAAS,EAAEH,SAAS;EACpB,CAACL,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAME,WAAwB,GAAG;EACtCJ,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEL,YAAY;EACvB,CAACH,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMI,cAA8B,GAAG;EAC5CN,MAAM,EAAE,CAAC,CAAc;EACvBC,SAAS,EAAEP,eAAe;EAC1B,CAACD,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMK,cAA8B,GAAG;EAC5CP,MAAM,EAAE,CAAC,CAAc;EACvBC,SAAS,EAAEN,eAAe;EAC1B,CAACF,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMM,aAAa,GAAG;EAC3BC,GAAG,EAAEV,QAAQ;EACbW,GAAG,EAAEP,QAAQ;EACbQ,MAAM,EAAEP,WAAW;EACnBQ,SAAS,EAAEN,cAAc;EACzBO,SAAS,EAAEN,cAAc;EACzB,CAACd,QAAQ,GAAG;IACVqB,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-refs.js","names":["Metadata","EventSchema","EventModel","__type","zodSchema","externalRefFieldTypes","documentRef","userRef","name","DocumentModel","Event","version"],"sources":["external-refs.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"external-refs.js","names":["Metadata","EventSchema","EventModel","__type","zodSchema","externalRefFieldTypes","documentRef","userRef","name","DocumentModel","Event","version"],"sources":["external-refs.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Event } from './types.js';\nimport { EventSchema } from './schema.js';\n\nexport interface EventModel extends RecordModel<Event, typeof EventSchema> {}\nexport const EventModel: EventModel = {\n __type: {} as Event,\n zodSchema: EventSchema,\n [Metadata]: {\n externalRefFieldTypes: {\n documentRef: 'docRef',\n userRef: 'userRef',\n },\n name: 'Event',\n },\n};\n\nexport const DocumentModel = {\n Event: EventModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,WAAW,QAAQ,aAAa;AAGzC,OAAO,MAAMC,UAAsB,GAAG;EACpCC,MAAM,EAAE,CAAC,CAAU;EACnBC,SAAS,EAAEH,WAAW;EACtB,CAACD,QAAQ,GAAG;IACVK,qBAAqB,EAAE;MACrBC,WAAW,EAAE,QAAQ;MACrBC,OAAO,EAAE;IACX,CAAC;IACDC,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,KAAK,EAAER,UAAU;EACjB,CAACF,QAAQ,GAAG;IACVW,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-record.js","names":["Metadata","PersonSchema","PersonModel","__type","zodSchema","name","DocumentModel","Person","version"],"sources":["simple-record.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"simple-record.js","names":["Metadata","PersonSchema","PersonModel","__type","zodSchema","name","DocumentModel","Person","version"],"sources":["simple-record.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Person } from './types.js';\nimport { PersonSchema } from './schema.js';\n\nexport interface PersonModel extends RecordModel<Person, typeof PersonSchema> {}\nexport const PersonModel: PersonModel = {\n __type: {} as Person,\n zodSchema: PersonSchema,\n [Metadata]: {\n name: 'Person',\n },\n};\n\nexport const DocumentModel = {\n Person: PersonModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,YAAY,QAAQ,aAAa;AAG1C,OAAO,MAAMC,WAAwB,GAAG;EACtCC,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEH,YAAY;EACvB,CAACD,QAAQ,GAAG;IACVK,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,MAAM,EAAEL,WAAW;EACnB,CAACF,QAAQ,GAAG;IACVQ,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
|
|
2
2
|
|
|
3
3
|
import { Metadata } from '@palantir/pack.document-schema.model-types';
|
|
4
4
|
import { NodeObjectSchema, NodeSchema, NodeTextBoxSchema, ObjectNodeSchema, TextBoxSchema } from './schema.js';
|