@palantir/pack.document-schema.type-gen 0.16.0 → 0.18.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/commands/ir/__tests__/resolveIrInput.test.js +11 -0
- package/build/esm/commands/ir/__tests__/resolveIrInput.test.js.map +1 -1
- package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
- package/build/esm/commands/ir/irGenAssetHandler.js +19 -14
- package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
- package/build/esm/commands/ir/resolveIrInput.js +2 -1
- package/build/esm/commands/ir/resolveIrInput.js.map +1 -1
- package/build/esm/commands/schema/__tests__/readPackConfig.test.js +25 -2
- package/build/esm/commands/schema/__tests__/readPackConfig.test.js.map +1 -1
- package/build/esm/commands/schema/schemaIrHandler.js +14 -2
- package/build/esm/commands/schema/schemaIrHandler.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/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -1
- package/build/esm/utils/schema/__tests__/generateIndexFromSchema.test.js +38 -0
- package/build/esm/utils/schema/__tests__/generateIndexFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/generateIndexFromSchema.js +12 -2
- package/build/esm/utils/schema/generateIndexFromSchema.js.map +1 -1
- package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
- package/build/types/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 +1 -1
- package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
- package/build/types/commands/ir/resolveIrInput.d.ts +1 -0
- package/build/types/commands/ir/resolveIrInput.d.ts.map +1 -1
- package/build/types/commands/schema/schemaIrHandler.d.ts +4 -0
- package/build/types/commands/schema/schemaIrHandler.d.ts.map +1 -1
- package/build/types/utils/schema/__tests__/generateIndexFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateIndexFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/generateIndexFromSchema.d.ts +3 -0
- package/build/types/utils/schema/generateIndexFromSchema.d.ts.map +1 -1
- package/build/types/utils/schema/resolveSchemaChain.d.ts +1 -0
- package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -1
- package/package.json +3 -3
- package/build/esm/commands/types.js +0 -2
- package/build/esm/commands/types.js.map +0 -1
- package/build/types/commands/types.d.ts +0 -12
- package/build/types/commands/types.d.ts.map +0 -1
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nimport { z } from 'zod';\n\nexport const EventSchema = z.object({\n timestamp: z.string().datetime(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,WAAW,GAAGD,CAAC,CAACE,MAAM,CAAC;EAClCC,SAAS,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACjC,CAAC,CAAC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-records.js","names":["z","PersonSchema","object","name","string","min","max","age","number","int","email","optional"],"sources":["simple-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"simple-records.js","names":["z","PersonSchema","object","name","string","min","max","age","number","int","email","optional"],"sources":["simple-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nimport { z } from 'zod';\n\nexport const PersonSchema = z.object({\n name: z.string().min(2).max(50),\n age: z.number().int().min(0).max(150),\n email: z.string().optional(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,YAAY,GAAGD,CAAC,CAACE,MAAM,CAAC;EACnCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,EAAE,CAAC;EAC/BC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACJ,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC;EACrCI,KAAK,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;AAC7B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-before-records.js","names":["z","FooSchema","object","value","string","BarSchema","count","number","int","FooBarFooSchema","extend","type","literal","FooBarBarSchema","FooBarSchema","discriminatedUnion"],"sources":["union-before-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"union-before-records.js","names":["z","FooSchema","object","value","string","BarSchema","count","number","int","FooBarFooSchema","extend","type","literal","FooBarBarSchema","FooBarSchema","discriminatedUnion"],"sources":["union-before-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nimport { z } from 'zod';\n\nexport const FooSchema = z.object({\n value: z.string(),\n});\n\nexport const BarSchema = z.object({\n count: z.number().int(),\n});\n\nexport const FooBarFooSchema = FooSchema.extend({\n type: z.literal('foo'),\n});\n\nexport const FooBarBarSchema = BarSchema.extend({\n type: z.literal('bar'),\n});\n\nexport const FooBarSchema = z.discriminatedUnion('type', [\n FooBarFooSchema,\n FooBarBarSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACS,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACK,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGd,CAAC,CAACe,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-types.js","names":["z","ObjectNodeSchema","object","x","number","y","label","string","optional","TextBoxSchema","text","NodeObjectSchema","extend","type","literal","NodeTextBoxSchema","NodeSchema","discriminatedUnion"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"union-types.js","names":["z","ObjectNodeSchema","object","x","number","y","label","string","optional","TextBoxSchema","text","NodeObjectSchema","extend","type","literal","NodeTextBoxSchema","NodeSchema","discriminatedUnion"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nimport { z } from 'zod';\n\nexport const ObjectNodeSchema = z.object({\n x: z.number(),\n y: z.number(),\n label: z.string().optional(),\n});\n\nexport const TextBoxSchema = z.object({\n x: z.number(),\n y: z.number(),\n text: z.string(),\n});\n\nexport const NodeObjectSchema = ObjectNodeSchema.extend({\n type: z.literal('object'),\n});\n\nexport const NodeTextBoxSchema = TextBoxSchema.extend({\n type: z.literal('text-box'),\n});\n\nexport const NodeSchema = z.discriminatedUnion('type', [\n NodeObjectSchema,\n NodeTextBoxSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,gBAAgB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbE,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAEF,OAAO,MAAMC,aAAa,GAAGT,CAAC,CAACE,MAAM,CAAC;EACpCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbM,IAAI,EAAEV,CAAC,CAACO,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMI,gBAAgB,GAAGV,gBAAgB,CAACW,MAAM,CAAC;EACtDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,QAAQ;AAC1B,CAAC,CAAC;AAEF,OAAO,MAAMC,iBAAiB,GAAGN,aAAa,CAACG,MAAM,CAAC;EACpDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,UAAU;AAC5B,CAAC,CAAC;AAEF,OAAO,MAAME,UAAU,GAAGhB,CAAC,CAACiB,kBAAkB,CAAC,MAAM,EAAE,CACrDN,gBAAgB,EAChBI,iBAAiB,CAClB,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// documentType.ts
|
|
3
3
|
// ============================================================
|
|
4
4
|
|
|
5
|
-
/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
5
|
+
/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */
|
|
6
6
|
|
|
7
7
|
export const DOCUMENT_TYPE_NAME = 'Canvas Document Type';
|
|
8
8
|
export const DOCUMENT_TYPE_DESCRIPTION = 'Document type description for demo canvas';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-name-and-description.js","names":["DOCUMENT_TYPE_NAME","DOCUMENT_TYPE_DESCRIPTION"],"sources":["with-name-and-description.ts"],"sourcesContent":["// ============================================================\n// documentType.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"with-name-and-description.js","names":["DOCUMENT_TYPE_NAME","DOCUMENT_TYPE_DESCRIPTION"],"sources":["with-name-and-description.ts"],"sourcesContent":["// ============================================================\n// documentType.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nexport const DOCUMENT_TYPE_NAME = 'Canvas Document Type';\nexport const DOCUMENT_TYPE_DESCRIPTION =\n 'Document type description for demo canvas';\n"],"mappings":"AAAA;AACA;AACA;;AAEA;;AAEA,OAAO,MAAMA,kBAAkB,GAAG,sBAAsB;AACxD,OAAO,MAAMC,yBAAyB,GACpC,2CAA2C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single-version.js","names":[],"sources":["single-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"single-version.js","names":[],"sources":["single-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nexport type SupportedVersions = 1;\nexport type LatestVersion = 1;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"three-version-chain.js","names":[],"sources":["three-version-chain.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"three-version-chain.js","names":[],"sources":["three-version-chain.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nexport type SupportedVersions = 1 | 2 | 3;\nexport type LatestVersion = 3;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
|
package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"two-version.js","names":[],"sources":["two-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"two-version.js","names":[],"sources":["two-version.ts"],"sourcesContent":["// ============================================================\n// versions.ts\n// ============================================================\n\n/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nexport type SupportedVersions = 1 | 2;\nexport type LatestVersion = 2;\nexport type MinSupportedVersion = 1;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { generateIndexFromChain } from "../generateIndexFromSchema.js";
|
|
19
|
+
import { resolveSchemaChain } from "../resolveSchemaChain.js";
|
|
20
|
+
import { singleVersionSchema, unionTypesSchema } from "./fixtures.js";
|
|
21
|
+
describe("generateIndexFromChain", () => {
|
|
22
|
+
it("re-exports union variant type guards as values", () => {
|
|
23
|
+
const result = generateIndexFromChain(resolveSchemaChain(unionTypesSchema));
|
|
24
|
+
|
|
25
|
+
// Guards are exported as values (not `export type`) so consumers can narrow
|
|
26
|
+
// a union at runtime without re-deriving the discriminant check.
|
|
27
|
+
expect(result).toContain(`export { isShape_v1Circle, isShape_v1Rectangle } from "./types_v1.js";`);
|
|
28
|
+
// The variant *types* remain a separate type-only export.
|
|
29
|
+
expect(result).toMatch(/export type \{[^}]*Shape_v1Circle[^}]*\} from "\.\/types_v1\.js";/);
|
|
30
|
+
});
|
|
31
|
+
it("emits no value guard export when the schema has no unions", () => {
|
|
32
|
+
const result = generateIndexFromChain(resolveSchemaChain(singleVersionSchema));
|
|
33
|
+
|
|
34
|
+
// No unions → no `is<Variant>` guards → no value export from types_v1.
|
|
35
|
+
expect(result).not.toMatch(/export \{ is\w+ \} from "\.\/types_v1\.js";/);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=generateIndexFromSchema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateIndexFromSchema.test.js","names":["describe","expect","it","generateIndexFromChain","resolveSchemaChain","singleVersionSchema","unionTypesSchema","result","toContain","toMatch","not"],"sources":["generateIndexFromSchema.test.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { generateIndexFromChain } from \"../generateIndexFromSchema.js\";\nimport { resolveSchemaChain } from \"../resolveSchemaChain.js\";\nimport { singleVersionSchema, unionTypesSchema } from \"./fixtures.js\";\n\ndescribe(\"generateIndexFromChain\", () => {\n it(\"re-exports union variant type guards as values\", () => {\n const result = generateIndexFromChain(resolveSchemaChain(unionTypesSchema));\n\n // Guards are exported as values (not `export type`) so consumers can narrow\n // a union at runtime without re-deriving the discriminant check.\n expect(result).toContain(\n `export { isShape_v1Circle, isShape_v1Rectangle } from \"./types_v1.js\";`,\n );\n // The variant *types* remain a separate type-only export.\n expect(result).toMatch(/export type \\{[^}]*Shape_v1Circle[^}]*\\} from \"\\.\\/types_v1\\.js\";/);\n });\n\n it(\"emits no value guard export when the schema has no unions\", () => {\n const result = generateIndexFromChain(resolveSchemaChain(singleVersionSchema));\n\n // No unions → no `is<Variant>` guards → no value export from types_v1.\n expect(result).not.toMatch(/export \\{ is\\w+ \\} from \"\\.\\/types_v1\\.js\";/);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,eAAe;AAErEN,QAAQ,CAAC,wBAAwB,EAAE,MAAM;EACvCE,EAAE,CAAC,gDAAgD,EAAE,MAAM;IACzD,MAAMK,MAAM,GAAGJ,sBAAsB,CAACC,kBAAkB,CAACE,gBAAgB,CAAC,CAAC;;IAE3E;IACA;IACAL,MAAM,CAACM,MAAM,CAAC,CAACC,SAAS,CACtB,wEACF,CAAC;IACD;IACAP,MAAM,CAACM,MAAM,CAAC,CAACE,OAAO,CAAC,mEAAmE,CAAC;EAC7F,CAAC,CAAC;EAEFP,EAAE,CAAC,2DAA2D,EAAE,MAAM;IACpE,MAAMK,MAAM,GAAGJ,sBAAsB,CAACC,kBAAkB,CAACC,mBAAmB,CAAC,CAAC;;IAE9E;IACAJ,MAAM,CAACM,MAAM,CAAC,CAACG,GAAG,CAACD,OAAO,CAAC,6CAA6C,CAAC;EAC3E,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -32,6 +32,9 @@ import { DOCUMENT_TYPE_PATH, INTERNAL_UPGRADE_FNS_PATH, MODELS_PATH, TYPES_REEXP
|
|
|
32
32
|
* - `DocumentUpgradeFns` type (the typed shape the factory accepts)
|
|
33
33
|
* - Per supported version: explicit named type exports from `types_vN.js`
|
|
34
34
|
* (not star exports, to avoid polluting autocomplete for read-only consumers)
|
|
35
|
+
* - Per supported version: the union variant type guard *functions* from
|
|
36
|
+
* `types_vN.js` as values (e.g. `isFooBar_v1`), so consumers can narrow a
|
|
37
|
+
* union without re-deriving the discriminant check
|
|
35
38
|
*/
|
|
36
39
|
export function generateIndexFromChain(resolved, minSupportedVersion) {
|
|
37
40
|
const {
|
|
@@ -59,22 +62,29 @@ export function generateIndexFromChain(resolved, minSupportedVersion) {
|
|
|
59
62
|
} of chain) {
|
|
60
63
|
if (version < minVersion) continue;
|
|
61
64
|
const typeNames = [];
|
|
65
|
+
// Union variant type guard functions (values, not types).
|
|
66
|
+
const guardNames = [];
|
|
62
67
|
for (const [modelKey, modelDef] of Object.entries(ir.models)) {
|
|
63
68
|
if (modelDef.type === "record") {
|
|
64
69
|
typeNames.push(versionedTypeName(modelKey, version));
|
|
65
70
|
} else if (modelDef.type === "union") {
|
|
66
71
|
typeNames.push(versionedTypeName(modelKey, version));
|
|
67
72
|
|
|
68
|
-
// Union variant types
|
|
73
|
+
// Union variant types and their generated `is<Variant>` guards.
|
|
69
74
|
for (const variantName of Object.keys(modelDef.union.variants)) {
|
|
70
75
|
const formattedVariant = formatVariantName(variantName);
|
|
71
|
-
|
|
76
|
+
const variantTypeName = `${versionedTypeName(modelKey, version)}${formattedVariant}`;
|
|
77
|
+
typeNames.push(variantTypeName);
|
|
78
|
+
guardNames.push(`is${variantTypeName}`);
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
if (typeNames.length > 0) {
|
|
76
83
|
output += `export type { ${typeNames.sort().join(", ")} } from "${typesFilePath(version)}";\n`;
|
|
77
84
|
}
|
|
85
|
+
if (guardNames.length > 0) {
|
|
86
|
+
output += `export { ${guardNames.sort().join(", ")} } from "${typesFilePath(version)}";\n`;
|
|
87
|
+
}
|
|
78
88
|
}
|
|
79
89
|
return output;
|
|
80
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateIndexFromSchema.js","names":["formatVariantName","GENERATED_FILE_HEADER","resolveMinVersion","DOCUMENT_TYPE_PATH","INTERNAL_UPGRADE_FNS_PATH","MODELS_PATH","TYPES_REEXPORT_PATH","typesFilePath","VERSIONED_DOC_REF_PATH","versionedTypeName","VERSIONS_PATH","generateIndexFromChain","resolved","minSupportedVersion","chain","minVersion","output","version","ir","typeNames","modelKey","modelDef","Object","entries","models","type","push","variantName","keys","union","variants","formattedVariant","length","sort","join"],"sources":["generateIndexFromSchema.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { formatVariantName } from \"../formatVariantName.js\";\nimport { GENERATED_FILE_HEADER } from \"../generatedFileHeader.js\";\nimport type { ResolvedIrChain } from \"./resolveSchemaChain.js\";\nimport { resolveMinVersion } from \"./resolveSchemaChain.js\";\nimport {\n DOCUMENT_TYPE_PATH,\n INTERNAL_UPGRADE_FNS_PATH,\n MODELS_PATH,\n TYPES_REEXPORT_PATH,\n typesFilePath,\n VERSIONED_DOC_REF_PATH,\n versionedTypeName,\n VERSIONS_PATH,\n} from \"./runtimeSchema.js\";\n\n/**\n * Generate the index.ts barrel export from a versioned schema.\n *\n * Exports:\n * - `models.js` (star export — model constants and `DocumentModel`; emitted\n * as a factory function when the schema has derived fields, otherwise a const)\n * - `types.js` (star export — latest-version type aliases)\n * - `versions.js` (star export — SupportedVersions, LatestVersion, MinSupportedVersion)\n * - `versionedDocRef.js` (star export — VersionedDocRef types and factory)\n * - `documentType.js` (star export — DOCUMENT_TYPE_NAME and DOCUMENT_TYPE_DESCRIPTION)\n * - `DocumentUpgradeFns` type (the typed shape the factory accepts)\n * - Per supported version: explicit named type exports from `types_vN.js`\n * (not star exports, to avoid polluting autocomplete for read-only consumers)\n */\nexport function generateIndexFromChain(\n resolved: ResolvedIrChain,\n minSupportedVersion?: number,\n): string {\n const { chain } = resolved;\n const { minVersion } = resolveMinVersion(chain, minSupportedVersion);\n\n let output = GENERATED_FILE_HEADER;\n\n // Star exports for core modules\n output += `export * from \"${MODELS_PATH}\";\\n`;\n output += `export * from \"${TYPES_REEXPORT_PATH}\";\\n`;\n output += `export * from \"${VERSIONS_PATH}\";\\n`;\n output += `export * from \"${VERSIONED_DOC_REF_PATH}\";\\n`;\n output += `export * from \"${DOCUMENT_TYPE_PATH}\";\\n`;\n // The typed upgrade-function table shape. Apps reference this type when\n // constructing the value passed to `DocumentModel(...)`.\n output += `export { type DocumentUpgradeFns } from \"${INTERNAL_UPGRADE_FNS_PATH}\";\\n`;\n\n // Per-version explicit named type exports\n for (const { version, ir } of chain) {\n if (version < minVersion) continue;\n\n const typeNames: string[] = [];\n\n for (const [modelKey, modelDef] of Object.entries(ir.models)) {\n if (modelDef.type === \"record\") {\n typeNames.push(versionedTypeName(modelKey, version));\n } else if (modelDef.type === \"union\") {\n typeNames.push(versionedTypeName(modelKey, version));\n\n // Union variant types
|
|
1
|
+
{"version":3,"file":"generateIndexFromSchema.js","names":["formatVariantName","GENERATED_FILE_HEADER","resolveMinVersion","DOCUMENT_TYPE_PATH","INTERNAL_UPGRADE_FNS_PATH","MODELS_PATH","TYPES_REEXPORT_PATH","typesFilePath","VERSIONED_DOC_REF_PATH","versionedTypeName","VERSIONS_PATH","generateIndexFromChain","resolved","minSupportedVersion","chain","minVersion","output","version","ir","typeNames","guardNames","modelKey","modelDef","Object","entries","models","type","push","variantName","keys","union","variants","formattedVariant","variantTypeName","length","sort","join"],"sources":["generateIndexFromSchema.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { formatVariantName } from \"../formatVariantName.js\";\nimport { GENERATED_FILE_HEADER } from \"../generatedFileHeader.js\";\nimport type { ResolvedIrChain } from \"./resolveSchemaChain.js\";\nimport { resolveMinVersion } from \"./resolveSchemaChain.js\";\nimport {\n DOCUMENT_TYPE_PATH,\n INTERNAL_UPGRADE_FNS_PATH,\n MODELS_PATH,\n TYPES_REEXPORT_PATH,\n typesFilePath,\n VERSIONED_DOC_REF_PATH,\n versionedTypeName,\n VERSIONS_PATH,\n} from \"./runtimeSchema.js\";\n\n/**\n * Generate the index.ts barrel export from a versioned schema.\n *\n * Exports:\n * - `models.js` (star export — model constants and `DocumentModel`; emitted\n * as a factory function when the schema has derived fields, otherwise a const)\n * - `types.js` (star export — latest-version type aliases)\n * - `versions.js` (star export — SupportedVersions, LatestVersion, MinSupportedVersion)\n * - `versionedDocRef.js` (star export — VersionedDocRef types and factory)\n * - `documentType.js` (star export — DOCUMENT_TYPE_NAME and DOCUMENT_TYPE_DESCRIPTION)\n * - `DocumentUpgradeFns` type (the typed shape the factory accepts)\n * - Per supported version: explicit named type exports from `types_vN.js`\n * (not star exports, to avoid polluting autocomplete for read-only consumers)\n * - Per supported version: the union variant type guard *functions* from\n * `types_vN.js` as values (e.g. `isFooBar_v1`), so consumers can narrow a\n * union without re-deriving the discriminant check\n */\nexport function generateIndexFromChain(\n resolved: ResolvedIrChain,\n minSupportedVersion?: number,\n): string {\n const { chain } = resolved;\n const { minVersion } = resolveMinVersion(chain, minSupportedVersion);\n\n let output = GENERATED_FILE_HEADER;\n\n // Star exports for core modules\n output += `export * from \"${MODELS_PATH}\";\\n`;\n output += `export * from \"${TYPES_REEXPORT_PATH}\";\\n`;\n output += `export * from \"${VERSIONS_PATH}\";\\n`;\n output += `export * from \"${VERSIONED_DOC_REF_PATH}\";\\n`;\n output += `export * from \"${DOCUMENT_TYPE_PATH}\";\\n`;\n // The typed upgrade-function table shape. Apps reference this type when\n // constructing the value passed to `DocumentModel(...)`.\n output += `export { type DocumentUpgradeFns } from \"${INTERNAL_UPGRADE_FNS_PATH}\";\\n`;\n\n // Per-version explicit named type exports\n for (const { version, ir } of chain) {\n if (version < minVersion) continue;\n\n const typeNames: string[] = [];\n // Union variant type guard functions (values, not types).\n const guardNames: string[] = [];\n\n for (const [modelKey, modelDef] of Object.entries(ir.models)) {\n if (modelDef.type === \"record\") {\n typeNames.push(versionedTypeName(modelKey, version));\n } else if (modelDef.type === \"union\") {\n typeNames.push(versionedTypeName(modelKey, version));\n\n // Union variant types and their generated `is<Variant>` guards.\n for (const variantName of Object.keys(modelDef.union.variants)) {\n const formattedVariant = formatVariantName(variantName);\n const variantTypeName = `${versionedTypeName(modelKey, version)}${formattedVariant}`;\n typeNames.push(variantTypeName);\n guardNames.push(`is${variantTypeName}`);\n }\n }\n }\n\n if (typeNames.length > 0) {\n output += `export type { ${typeNames.sort().join(\", \")} } from \"${\n typesFilePath(version)\n }\";\\n`;\n }\n\n if (guardNames.length > 0) {\n output += `export { ${guardNames.sort().join(\", \")} } from \"${typesFilePath(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MAAM,CAAC,EAAE;MAC5D,IAAIH,QAAQ,CAACI,IAAI,KAAK,QAAQ,EAAE;QAC9BP,SAAS,CAACQ,IAAI,CAAClB,iBAAiB,CAACY,QAAQ,EAAEJ,OAAO,CAAC,CAAC;MACtD,CAAC,MAAM,IAAIK,QAAQ,CAACI,IAAI,KAAK,OAAO,EAAE;QACpCP,SAAS,CAACQ,IAAI,CAAClB,iBAAiB,CAACY,QAAQ,EAAEJ,OAAO,CAAC,CAAC;;QAEpD;QACA,KAAK,MAAMW,WAAW,IAAIL,MAAM,CAACM,IAAI,CAACP,QAAQ,CAACQ,KAAK,CAACC,QAAQ,CAAC,EAAE;UAC9D,MAAMC,gBAAgB,GAAGhC,iBAAiB,CAAC4B,WAAW,CAAC;UACvD,MAAMK,eAAe,GAAG,GAAGxB,iBAAiB,CAACY,QAAQ,EAAEJ,OAAO,CAAC,GAAGe,gBAAgB,EAAE;UACpFb,SAAS,CAACQ,IAAI,CAACM,eAAe,CAAC;UAC/Bb,UAAU,CAACO,IAAI,CAAC,KAAKM,eAAe,EAAE,CAAC;QACzC;MACF;IACF;IAEA,IAAId,SAAS,CAACe,MAAM,GAAG,CAAC,EAAE;MACxBlB,MAAM,IAAI,iBAAiBG,SAAS,CAACgB,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,YACpD7B,aAAa,CAACU,OAAO,CAAC,MAClB;IACR;IAEA,IAAIG,UAAU,CAACc,MAAM,GAAG,CAAC,EAAE;MACzBlB,MAAM,IAAI,YAAYI,UAAU,CAACe,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,YAAY7B,aAAa,CAACU,OAAO,CAAC,MAAM;IAC5F;EACF;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSchemaChain.js","names":["IModelDef","IModelDefCtor","convertSchemaToIr","collectVersionedIrChain","input","identity","schemas","collectSchemaDefinitions","provenances","deriveProvenance","map","schema","index","version","ir","models","name","description","type","migrations","serializeMigrations","current","unshift","previous","firstModelVersions","Map","firstFieldVersions","modelVersions","fieldVersions","modelKey","modelDef","Object","entries","has","set","get","fieldVersionsForModel","fields","fieldKey","keys","length","deprecations","undefined","result","fieldEntries","fieldName","migration","derivedFrom","resolveMinVersion","chain","minSupportedVersion","Error","latestVersion","some","c","join","minVersion","capVersionedIrChain","maxVersion","filter","resolveSchemaChain","stripDeprecatedFieldsForSdk","entry","record","field","dep","metadata","deprecatedFromVersion","chainNeedsUpgradeFns","i","prevEntry","currEntry","currModelDef","prevModelDef","prevFields","Set","f","key","recordMigrations","isOptional"],"sources":["resolveSchemaChain.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SchemaDefinition, VersionMigrations } from \"@palantir/pack.schema\";\nimport type {\n IModelDef,\n IRealTimeDocumentSchema,\n} from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { IModelDef as IModelDefCtor } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport type { SchemaProvenance } from \"../steps/convertStepsToIr.js\";\nimport { convertSchemaToIr } from \"../steps/convertStepsToIr.js\";\n\n/** JSON-serializable form of a single field migration. */\nexport interface SerializedFieldMigration {\n readonly derivedFrom: readonly string[];\n}\n\n/** Serialized migrations keyed by `[recordModelName][fieldName]`. */\nexport type SerializedVersionMigrations = Record<\n string,\n Record<string, SerializedFieldMigration>\n>;\n\nexport interface VersionedIrEntry {\n version: number;\n ir: IRealTimeDocumentSchema;\n migrations?: SerializedVersionMigrations;\n}\n\nexport interface ResolvedIrChain {\n chain: VersionedIrEntry[];\n latestVersion: number;\n minVersion: number;\n}\n\nexport interface IrChainPayload {\n comment?: string;\n latestVersion: number;\n minSupportedVersion?: number;\n chain: VersionedIrEntry[];\n}\n\nexport interface SchemaIdentity {\n readonly name?: string;\n readonly description?: string;\n}\n\nfunction collectVersionedIrChain(\n input: SchemaDefinition,\n identity: SchemaIdentity,\n): VersionedIrEntry[] {\n const schemas = collectSchemaDefinitions(input);\n const provenances = deriveProvenance(schemas);\n\n return schemas.map((schema, index): VersionedIrEntry => ({\n version: schema.version,\n ir: convertSchemaToIr(\n schema.models,\n { version: schema.version, name: identity.name, description: identity.description },\n provenances[index]!,\n ),\n ...(schema.type === \"versioned\" ? { migrations: serializeMigrations(schema.migrations) } : {}),\n }));\n}\n\nfunction collectSchemaDefinitions(input: SchemaDefinition): SchemaDefinition[] {\n const schemas: SchemaDefinition[] = [];\n let current: SchemaDefinition = input;\n\n while (current.type === \"versioned\") {\n schemas.unshift(current);\n current = current.previous;\n }\n schemas.unshift(current);\n\n return schemas;\n}\n\n/**\n * Build field/model provenance by walking the version chain from oldest to\n * newest. The first version where a model key or record field appears is the\n * version stamped into IR metadata.\n */\nfunction deriveProvenance(schemas: readonly SchemaDefinition[]): SchemaProvenance[] {\n const firstModelVersions = new Map<string, number>();\n const firstFieldVersions = new Map<string, Map<string, number>>();\n\n return schemas.map(schema => {\n const modelVersions: Record<string, number> = {};\n const fieldVersions: Record<string, Record<string, number>> = {};\n\n for (const [modelKey, modelDef] of Object.entries(schema.models)) {\n if (!firstModelVersions.has(modelKey)) {\n firstModelVersions.set(modelKey, schema.version);\n }\n modelVersions[modelKey] = firstModelVersions.get(modelKey)!;\n\n if (modelDef.type !== \"record\") continue;\n\n let fieldVersionsForModel = firstFieldVersions.get(modelKey);\n if (fieldVersionsForModel == null) {\n fieldVersionsForModel = new Map<string, number>();\n firstFieldVersions.set(modelKey, fieldVersionsForModel);\n }\n\n const fields: Record<string, number> = {};\n for (const fieldKey of Object.keys(modelDef.fields)) {\n if (!fieldVersionsForModel.has(fieldKey)) {\n fieldVersionsForModel.set(fieldKey, schema.version);\n }\n fields[fieldKey] = fieldVersionsForModel.get(fieldKey)!;\n }\n\n if (Object.keys(fields).length > 0) {\n fieldVersions[modelKey] = fields;\n }\n }\n\n return {\n fieldVersions,\n modelVersions,\n deprecations: \"deprecations\" in schema ? schema.deprecations : undefined,\n };\n });\n}\n\n/** Convert schema-builder migrations to their JSON-serializable form. */\nfunction serializeMigrations(\n migrations: VersionMigrations | undefined,\n): SerializedVersionMigrations | undefined {\n if (migrations == null) return undefined;\n const result: SerializedVersionMigrations = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const fieldEntries: Record<string, SerializedFieldMigration> = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n fieldEntries[fieldName] = {\n derivedFrom: [...migration.derivedFrom],\n };\n }\n result[modelKey] = fieldEntries;\n }\n return result;\n}\n\n/**\n * Validate `minSupportedVersion` against an already-resolved chain and return\n * the effective `minVersion`. Throws on invalid input.\n */\nexport function resolveMinVersion(\n chain: VersionedIrEntry[],\n minSupportedVersion: number | undefined,\n): { latestVersion: number; minVersion: number } {\n if (chain.length === 0) {\n throw new Error(\"Schema version chain is empty\");\n }\n\n const latestVersion = chain[chain.length - 1]!.version;\n\n if (minSupportedVersion != null && !chain.some(c => c.version === minSupportedVersion)) {\n throw new Error(\n `minSupportedVersion ${minSupportedVersion} is not in the schema chain `\n + `(available versions: ${chain.map(c => c.version).join(\", \")})`,\n );\n }\n\n return {\n latestVersion,\n minVersion: minSupportedVersion ?? latestVersion,\n };\n}\n\nfunction capVersionedIrChain(\n chain: VersionedIrEntry[],\n maxVersion: number | undefined,\n): VersionedIrEntry[] {\n if (maxVersion == null) {\n return chain;\n }\n\n if (!chain.some(c => c.version === maxVersion)) {\n throw new Error(\n `maxVersion ${maxVersion} is not in the schema chain `\n + `(available versions: ${chain.map(c => c.version).join(\", \")})`,\n );\n }\n\n return chain.filter(c => c.version <= maxVersion);\n}\n\n/**\n * Collect the version chain and resolve min/latest versions.\n * Each version's models are converted to IR (IRealTimeDocumentSchema).\n * `identity.name` / `identity.description` are embedded into each chain entry's\n * IR; when omitted (e.g. test callers), `convertSchemaToIr` falls back to its\n * defaults.\n * Throws on empty chain or invalid minSupportedVersion.\n */\nexport function resolveSchemaChain(\n schema: SchemaDefinition,\n minSupportedVersion?: number,\n identity: SchemaIdentity = {},\n maxVersion?: number,\n): ResolvedIrChain {\n const chain = capVersionedIrChain(collectVersionedIrChain(schema, identity), maxVersion);\n const { latestVersion, minVersion } = resolveMinVersion(chain, minSupportedVersion);\n return { chain, latestVersion, minVersion };\n}\n\n/**\n * Return a copy of the chain with deprecated fields removed from every version\n * at or after the version in which they were deprecated.\n *\n * The SDK type generators (`writeAllSdkFiles` and friends) must treat a\n * deprecated field exactly as a removed field: it disappears from that version's\n * public read/write types and per-version internal types, and the prev/curr diff\n * records it as a `removedField` (driving the upgrade lens). The field is still\n * collected into the all-versions `__Internal` type from earlier versions, which\n * are left untouched.\n */\nexport function stripDeprecatedFieldsForSdk(chain: VersionedIrEntry[]): VersionedIrEntry[] {\n return chain.map((entry): VersionedIrEntry => {\n const models: Record<string, IModelDef> = {};\n for (const [modelKey, modelDef] of Object.entries(entry.ir.models)) {\n if (modelDef.type === \"record\") {\n const fields = modelDef.record.fields.filter(field => {\n const dep = field.metadata.deprecatedFromVersion;\n return dep == null || entry.version < dep;\n });\n models[modelKey] = IModelDefCtor.record({ ...modelDef.record, fields });\n } else {\n models[modelKey] = modelDef;\n }\n }\n return { ...entry, ir: { ...entry.ir, models } };\n });\n}\n\n/**\n * True if the chain has any field that requires a runtime upgrade function.\n * Drives whether the generated SDK emits `DocumentModel` as a factory\n * (requires the app to supply typed upgrade functions) or as a const.\n *\n * Two cases trigger this:\n * - A field declares `derivedFrom` with one or more source fields — the app\n * must supply a forward function.\n * - A required field is added in a version past v1 (no `derivedFrom`) — the\n * app must supply a zero-arg thunk; `undefined` is not a legal value.\n *\n * Optional additive fields don't trigger it; the lens leaves them alone.\n */\nexport function chainNeedsUpgradeFns(chain: VersionedIrEntry[]): boolean {\n for (let i = 1; i < chain.length; i++) {\n const prevEntry = chain[i - 1]!;\n const currEntry = chain[i]!;\n for (const [modelKey, currModelDef] of Object.entries(currEntry.ir.models)) {\n if (currModelDef.type !== \"record\") continue;\n const prevModelDef = prevEntry.ir.models[modelKey];\n if (prevModelDef == null || prevModelDef.type !== \"record\") continue;\n const prevFields = new Set(prevModelDef.record.fields.map(f => f.key));\n const recordMigrations = currEntry.migrations?.[modelKey];\n for (const field of currModelDef.record.fields) {\n if (prevFields.has(field.key)) continue;\n const derivedFrom = recordMigrations?.[field.key]?.derivedFrom ?? [];\n if (derivedFrom.length > 0) return true;\n if (field.isOptional !== true) return true;\n }\n }\n }\n return false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,SAAS,IAAIC,aAAa,QAAQ,yDAAyD;AAEpG,SAASC,iBAAiB,QAAQ,8BAA8B;;AAEhE;;AAKA;;AA8BA,SAASC,uBAAuBA,CAC9BC,KAAuB,EACvBC,QAAwB,EACJ;EACpB,MAAMC,OAAO,GAAGC,wBAAwB,CAACH,KAAK,CAAC;EAC/C,MAAMI,WAAW,GAAGC,gBAAgB,CAACH,OAAO,CAAC;EAE7C,OAAOA,OAAO,CAACI,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,MAAwB;IACvDC,OAAO,EAAEF,MAAM,CAACE,OAAO;IACvBC,EAAE,EAAEZ,iBAAiB,CACnBS,MAAM,CAACI,MAAM,EACb;MAAEF,OAAO,EAAEF,MAAM,CAACE,OAAO;MAAEG,IAAI,EAAEX,QAAQ,CAACW,IAAI;MAAEC,WAAW,EAAEZ,QAAQ,CAACY;IAAY,CAAC,EACnFT,WAAW,CAACI,KAAK,CACnB,CAA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U,CAACzC,GAAG,CAAC+B,KAAK,CAACa,GAAG,CAAC,EAAE;QAC/B,MAAM9B,WAAW,GAAG+B,gBAAgB,GAAGd,KAAK,CAACa,GAAG,CAAC,EAAE9B,WAAW,IAAI,EAAE;QACpE,IAAIA,WAAW,CAACP,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI;QACvC,IAAIwB,KAAK,CAACe,UAAU,KAAK,IAAI,EAAE,OAAO,IAAI;MAC5C;IACF;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"resolveSchemaChain.js","names":["IModelDef","IModelDefCtor","convertSchemaToIr","collectVersionedIrChain","input","identity","schemas","collectSchemaDefinitions","provenances","deriveProvenance","map","schema","index","version","ir","models","name","description","type","migrations","serializeMigrations","current","unshift","previous","firstModelVersions","Map","firstFieldVersions","modelVersions","fieldVersions","modelKey","modelDef","Object","entries","has","set","get","fieldVersionsForModel","fields","fieldKey","keys","length","deprecations","undefined","result","fieldEntries","fieldName","migration","derivedFrom","resolveMinVersion","chain","minSupportedVersion","Error","latestVersion","some","c","join","minVersion","capVersionedIrChain","maxVersion","filter","resolveSchemaChain","stripDeprecatedFieldsForSdk","entry","record","field","dep","metadata","deprecatedFromVersion","chainNeedsUpgradeFns","i","prevEntry","currEntry","currModelDef","prevModelDef","prevFields","Set","f","key","recordMigrations","isOptional"],"sources":["resolveSchemaChain.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SchemaDefinition, VersionMigrations } from \"@palantir/pack.schema\";\nimport type {\n IModelDef,\n IRealTimeDocumentSchema,\n} from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { IModelDef as IModelDefCtor } from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport type { SchemaProvenance } from \"../steps/convertStepsToIr.js\";\nimport { convertSchemaToIr } from \"../steps/convertStepsToIr.js\";\n\n/** JSON-serializable form of a single field migration. */\nexport interface SerializedFieldMigration {\n readonly derivedFrom: readonly string[];\n}\n\n/** Serialized migrations keyed by `[recordModelName][fieldName]`. */\nexport type SerializedVersionMigrations = Record<\n string,\n Record<string, SerializedFieldMigration>\n>;\n\nexport interface VersionedIrEntry {\n version: number;\n ir: IRealTimeDocumentSchema;\n migrations?: SerializedVersionMigrations;\n}\n\nexport interface ResolvedIrChain {\n chain: VersionedIrEntry[];\n latestVersion: number;\n minVersion: number;\n}\n\nexport interface IrChainPayload {\n comment?: string;\n latestVersion: number;\n minSupportedVersion?: number;\n owningApplicationId?: string;\n chain: VersionedIrEntry[];\n}\n\nexport interface SchemaIdentity {\n readonly name?: string;\n readonly description?: string;\n}\n\nfunction collectVersionedIrChain(\n input: SchemaDefinition,\n identity: SchemaIdentity,\n): VersionedIrEntry[] {\n const schemas = collectSchemaDefinitions(input);\n const provenances = deriveProvenance(schemas);\n\n return schemas.map((schema, index): VersionedIrEntry => ({\n version: schema.version,\n ir: convertSchemaToIr(\n schema.models,\n { version: schema.version, name: identity.name, description: identity.description },\n provenances[index]!,\n ),\n ...(schema.type === \"versioned\" ? { migrations: serializeMigrations(schema.migrations) } : {}),\n }));\n}\n\nfunction collectSchemaDefinitions(input: SchemaDefinition): SchemaDefinition[] {\n const schemas: SchemaDefinition[] = [];\n let current: SchemaDefinition = input;\n\n while (current.type === \"versioned\") {\n schemas.unshift(current);\n current = current.previous;\n }\n schemas.unshift(current);\n\n return schemas;\n}\n\n/**\n * Build field/model provenance by walking the version chain from oldest to\n * newest. The first version where a model key or record field appears is the\n * version stamped into IR metadata.\n */\nfunction deriveProvenance(schemas: readonly SchemaDefinition[]): SchemaProvenance[] {\n const firstModelVersions = new Map<string, number>();\n const firstFieldVersions = new Map<string, Map<string, number>>();\n\n return schemas.map(schema => {\n const modelVersions: Record<string, number> = {};\n const fieldVersions: Record<string, Record<string, number>> = {};\n\n for (const [modelKey, modelDef] of Object.entries(schema.models)) {\n if (!firstModelVersions.has(modelKey)) {\n firstModelVersions.set(modelKey, schema.version);\n }\n modelVersions[modelKey] = firstModelVersions.get(modelKey)!;\n\n if (modelDef.type !== \"record\") continue;\n\n let fieldVersionsForModel = firstFieldVersions.get(modelKey);\n if (fieldVersionsForModel == null) {\n fieldVersionsForModel = new Map<string, number>();\n firstFieldVersions.set(modelKey, fieldVersionsForModel);\n }\n\n const fields: Record<string, number> = {};\n for (const fieldKey of Object.keys(modelDef.fields)) {\n if (!fieldVersionsForModel.has(fieldKey)) {\n fieldVersionsForModel.set(fieldKey, schema.version);\n }\n fields[fieldKey] = fieldVersionsForModel.get(fieldKey)!;\n }\n\n if (Object.keys(fields).length > 0) {\n fieldVersions[modelKey] = fields;\n }\n }\n\n return {\n fieldVersions,\n modelVersions,\n deprecations: \"deprecations\" in schema ? schema.deprecations : undefined,\n };\n });\n}\n\n/** Convert schema-builder migrations to their JSON-serializable form. */\nfunction serializeMigrations(\n migrations: VersionMigrations | undefined,\n): SerializedVersionMigrations | undefined {\n if (migrations == null) return undefined;\n const result: SerializedVersionMigrations = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const fieldEntries: Record<string, SerializedFieldMigration> = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n fieldEntries[fieldName] = {\n derivedFrom: [...migration.derivedFrom],\n };\n }\n result[modelKey] = fieldEntries;\n }\n return result;\n}\n\n/**\n * Validate `minSupportedVersion` against an already-resolved chain and return\n * the effective `minVersion`. Throws on invalid input.\n */\nexport function resolveMinVersion(\n chain: VersionedIrEntry[],\n minSupportedVersion: number | undefined,\n): { latestVersion: number; minVersion: number } {\n if (chain.length === 0) {\n throw new Error(\"Schema version chain is empty\");\n }\n\n const latestVersion = chain[chain.length - 1]!.version;\n\n if (minSupportedVersion != null && !chain.some(c => c.version === minSupportedVersion)) {\n throw new Error(\n `minSupportedVersion ${minSupportedVersion} is not in the schema chain `\n + `(available versions: ${chain.map(c => c.version).join(\", \")})`,\n );\n }\n\n return {\n latestVersion,\n minVersion: minSupportedVersion ?? latestVersion,\n };\n}\n\nfunction capVersionedIrChain(\n chain: VersionedIrEntry[],\n maxVersion: number | undefined,\n): VersionedIrEntry[] {\n if (maxVersion == null) {\n return chain;\n }\n\n if (!chain.some(c => c.version === maxVersion)) {\n throw new Error(\n `maxVersion ${maxVersion} is not in the schema chain `\n + `(available versions: ${chain.map(c => c.version).join(\", \")})`,\n );\n }\n\n return chain.filter(c => c.version <= maxVersion);\n}\n\n/**\n * Collect the version chain and resolve min/latest versions.\n * Each version's models are converted to IR (IRealTimeDocumentSchema).\n * `identity.name` / `identity.description` are embedded into each chain entry's\n * IR; when omitted (e.g. test callers), `convertSchemaToIr` falls back to its\n * defaults.\n * Throws on empty chain or invalid minSupportedVersion.\n */\nexport function resolveSchemaChain(\n schema: SchemaDefinition,\n minSupportedVersion?: number,\n identity: SchemaIdentity = {},\n maxVersion?: number,\n): ResolvedIrChain {\n const chain = capVersionedIrChain(collectVersionedIrChain(schema, identity), maxVersion);\n const { latestVersion, minVersion } = resolveMinVersion(chain, minSupportedVersion);\n return { chain, latestVersion, minVersion };\n}\n\n/**\n * Return a copy of the chain with deprecated fields removed from every version\n * at or after the version in which they were deprecated.\n *\n * The SDK type generators (`writeAllSdkFiles` and friends) must treat a\n * deprecated field exactly as a removed field: it disappears from that version's\n * public read/write types and per-version internal types, and the prev/curr diff\n * records it as a `removedField` (driving the upgrade lens). The field is still\n * collected into the all-versions `__Internal` type from earlier versions, which\n * are left untouched.\n */\nexport function stripDeprecatedFieldsForSdk(chain: VersionedIrEntry[]): VersionedIrEntry[] {\n return chain.map((entry): VersionedIrEntry => {\n const models: Record<string, IModelDef> = {};\n for (const [modelKey, modelDef] of Object.entries(entry.ir.models)) {\n if (modelDef.type === \"record\") {\n const fields = modelDef.record.fields.filter(field => {\n const dep = field.metadata.deprecatedFromVersion;\n return dep == null || entry.version < dep;\n });\n models[modelKey] = IModelDefCtor.record({ ...modelDef.record, fields });\n } else {\n models[modelKey] = modelDef;\n }\n }\n return { ...entry, ir: { ...entry.ir, models } };\n });\n}\n\n/**\n * True if the chain has any field that requires a runtime upgrade function.\n * Drives whether the generated SDK emits `DocumentModel` as a factory\n * (requires the app to supply typed upgrade functions) or as a const.\n *\n * Two cases trigger this:\n * - A field declares `derivedFrom` with one or more source fields — the app\n * must supply a forward function.\n * - A required field is added in a version past v1 (no `derivedFrom`) — the\n * app must supply a zero-arg thunk; `undefined` is not a legal value.\n *\n * Optional additive fields don't trigger it; the lens leaves them alone.\n */\nexport function chainNeedsUpgradeFns(chain: VersionedIrEntry[]): boolean {\n for (let i = 1; i < chain.length; i++) {\n const prevEntry = chain[i - 1]!;\n const currEntry = chain[i]!;\n for (const [modelKey, currModelDef] of Object.entries(currEntry.ir.models)) {\n if (currModelDef.type !== \"record\") continue;\n const prevModelDef = prevEntry.ir.models[modelKey];\n if (prevModelDef == null || prevModelDef.type !== \"record\") continue;\n const prevFields = new Set(prevModelDef.record.fields.map(f => f.key));\n const recordMigrations = currEntry.migrations?.[modelKey];\n for (const field of currModelDef.record.fields) {\n if (prevFields.has(field.key)) continue;\n const derivedFrom = recordMigrations?.[field.key]?.derivedFrom ?? [];\n if (derivedFrom.length > 0) return true;\n if (field.isOptional !== true) return true;\n }\n }\n }\n return false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,SAAS,IAAIC,aAAa,QAAQ,yDAAyD;AAEpG,SAASC,iBAAiB,QAAQ,8BAA8B;;AAEhE;;AAKA;;AA+BA,SAASC,uBAAuBA,CAC9BC,KAAu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pC,MAAMuD,YAAY,GAAGH,SAAS,CAACxD,EAAE,CAACC,MAAM,CAACc,QAAQ,CAAC;MAClD,IAAI4C,YAAY,IAAI,IAAI,IAAIA,YAAY,CAACvD,IAAI,KAAK,QAAQ,EAAE;MAC5D,MAAMwD,UAAU,GAAG,IAAIC,GAAG,CAACF,YAAY,CAACV,MAAM,CAAC1B,MAAM,CAAC3B,GAAG,CAACkE,CAAC,IAAIA,CAAC,CAACC,GAAG,CAAC,CAAC;MACtE,MAAMC,gBAAgB,GAAGP,SAAS,CAACpD,UAAU,GAAGU,QAAQ,CAAC;MACzD,KAAK,MAAMmC,KAAK,IAAIQ,YAAY,CAACT,MAAM,CAAC1B,MAAM,EAAE;QAC9C,IAAIqC,UAAU,CAACzC,GAAG,CAAC+B,KAAK,CAACa,GAAG,CAAC,EAAE;QAC/B,MAAM9B,WAAW,GAAG+B,gBAAgB,GAAGd,KAAK,CAACa,GAAG,CAAC,EAAE9B,WAAW,IAAI,EAAE;QACpE,IAAIA,WAAW,CAACP,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI;QACvC,IAAIwB,KAAK,CAACe,UAAU,KAAK,IAAI,EAAE,OAAO,IAAI;MAC5C;IACF;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayFields.js","names":[],"sources":["arrayFields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"arrayFields.js","names":[],"sources":["arrayFields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\n\nexport interface Container {\n readonly items: readonly string[];\n readonly numbers: readonly number[];\n}\n\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customDiscriminant.js","names":["isAnimalCat","value","kind","isAnimalDog"],"sources":["customDiscriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"customDiscriminant.js","names":["isAnimalCat","value","kind","isAnimalDog"],"sources":["customDiscriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\n\n/**\n * A cat\n */\nexport interface Cat {\n readonly meow: string;\n readonly whiskers: number;\n}\n\n/**\n * A dog\n */\nexport interface Dog {\n readonly bark: string;\n readonly tailWags: number;\n}\n\nexport interface AnimalCat extends Cat {\n readonly kind: \"cat\";\n}\n\nexport interface AnimalDog extends Dog {\n readonly kind: \"dog\";\n}\n\nexport type Animal = AnimalCat | AnimalDog;\n\nexport function isAnimalCat(value: Animal): value is AnimalCat {\n return value.kind === \"cat\";\n}\n\nexport function isAnimalDog(value: Animal): value is AnimalDog {\n return value.kind === \"dog\";\n}\n\n"],"mappings":"AAAA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAgBA,OAAO,SAASA,WAAWA,CAACC,KAAa,EAAsB;EAC7D,OAAOA,KAAK,CAACC,IAAI,KAAK,KAAK;AAC7B;AAEA,OAAO,SAASC,WAAWA,CAACF,KAAa,EAAsB;EAC7D,OAAOA,KAAK,CAACC,IAAI,KAAK,KAAK;AAC7B","ignoreList":[]}
|
package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTypeScriptInterfaces.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["generateTypeScriptInterfaces.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"generateTypeScriptInterfaces.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["generateTypeScriptInterfaces.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\n\n/**\n * Represents an edge in a graph\n */\nexport interface Edge {\n readonly source: ObjectNode;\n readonly target: ObjectNode;\n}\n\nexport interface ObjectNode {\n readonly x: number;\n readonly y: number;\n readonly label?: string;\n readonly color?: string;\n}\n\n/**\n * Represents a text box in a graph\n */\nexport interface TextBox {\n readonly x: number;\n readonly y: number;\n readonly text: string;\n}\n\nexport interface NodeObject extends ObjectNode {\n readonly type: \"object\";\n}\n\nexport interface NodeTextBox extends TextBox {\n readonly type: \"text-box\";\n}\n\nexport type Node = NodeObject | NodeTextBox;\n\nexport function isNodeObject(value: Node): value is NodeObject {\n return value.type === \"object\";\n}\n\nexport function isNodeTextBox(value: Node): value is NodeTextBox {\n return value.type === \"text-box\";\n}\n\n"],"mappings":"AAAA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAiBA,OAAO,SAASA,YAAYA,CAACC,KAAW,EAAuB;EAC7D,OAAOA,KAAK,CAACC,IAAI,KAAK,QAAQ;AAChC;AAEA,OAAO,SAASC,aAAaA,CAACF,KAAW,EAAwB;EAC/D,OAAOA,KAAK,CAACC,IAAI,KAAK,UAAU;AAClC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refTypes.js","names":[],"sources":["refTypes.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"refTypes.js","names":[],"sources":["refTypes.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\nimport type { DocumentRef, MediaRef, ObjectRef, UserRef } from \"@palantir/pack.document-schema.model-types\";\n\n/**\n * A record containing all reference types\n */\nexport interface Document {\n readonly id: string;\n readonly docRef: DocumentRef;\n readonly userRef: UserRef;\n readonly objectRef: ObjectRef;\n readonly mediaRef: MediaRef;\n readonly optionalDocRef?: DocumentRef;\n readonly docRefArray: readonly DocumentRef[];\n readonly userRefArray: readonly UserRef[];\n}\n\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleRecord.js","names":[],"sources":["simpleRecord.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"simpleRecord.js","names":[],"sources":["simpleRecord.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\n\n/**\n * A person record\n */\nexport interface Person {\n readonly name: string;\n readonly age: number;\n readonly email?: string;\n}\n\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSteps.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["simpleSteps.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"simpleSteps.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["simpleSteps.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.18.0 */\n\n\n/**\n * A node in the graph\n */\nexport interface ObjectNode {\n readonly x: number;\n readonly y: number;\n readonly object: string;\n readonly label?: string;\n readonly edges: readonly Edge[];\n}\n\n/**\n * A text box in the graph\n */\nexport interface TextBox {\n readonly x: number;\n readonly y: number;\n readonly text: string;\n}\n\n/**\n * An edge in the graph\n */\nexport interface Edge {\n readonly source: ObjectNode;\n readonly target: ObjectNode;\n}\n\nexport interface NodeObject extends ObjectNode {\n readonly type: \"object\";\n}\n\nexport interface NodeTextBox extends TextBox {\n readonly type: \"textBox\";\n}\n\nexport type Node = NodeObject | NodeTextBox;\n\nexport function isNodeObject(value: Node): value is NodeObject {\n return value.type === \"object\";\n}\n\nexport function isNodeTextBox(value: Node): value is NodeTextBox {\n return value.type === \"textBox\";\n}\n\n"],"mappings":"AAAA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAOA;AACA;AACA;;AAgBA,OAAO,SAASA,YAAYA,CAACC,KAAW,EAAuB;EAC7D,OAAOA,KAAK,CAACC,IAAI,KAAK,QAAQ;AAChC;AAEA,OAAO,SAASC,aAAaA,CAACF,KAAW,EAAwB;EAC/D,OAAOA,KAAK,CAACC,IAAI,KAAK,SAAS;AACjC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"irDeployHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/ir/irDeployHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"irDeployHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/ir/irDeployHandler.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,oBAAoB,CAAC;AAU5B,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wCAAwC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"irGenAssetHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/ir/irGenAssetHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"irGenAssetHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/ir/irGenAssetHandler.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAS5E,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CAC5C;AAYD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAmFlE"}
|
|
@@ -3,6 +3,7 @@ export interface ResolvedIrInput {
|
|
|
3
3
|
readonly ir: IRealTimeDocumentSchema;
|
|
4
4
|
readonly latestVersion: number;
|
|
5
5
|
readonly minSupportedVersion: number;
|
|
6
|
+
readonly owningApplicationId?: string;
|
|
6
7
|
}
|
|
7
8
|
export declare function resolveIrInput(parsed: unknown, irPath: string): ResolvedIrInput;
|
|
8
9
|
//# sourceMappingURL=resolveIrInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveIrInput.d.ts","sourceRoot":"","sources":["../../../../src/commands/ir/resolveIrInput.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAGvG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,uBAAuB,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveIrInput.d.ts","sourceRoot":"","sources":["../../../../src/commands/ir/resolveIrInput.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAGvG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,uBAAuB,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AA4CD,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAI/E"}
|
|
@@ -8,6 +8,7 @@ interface PackConfigValues {
|
|
|
8
8
|
readonly documentTypeName: string;
|
|
9
9
|
readonly documentTypeDescription: string;
|
|
10
10
|
readonly minSupportedVersion?: number;
|
|
11
|
+
readonly owningApplicationId?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare function readPackConfig(configPath: string): Promise<PackConfigValues>;
|
|
13
14
|
/**
|
|
@@ -31,6 +32,9 @@ export declare function readPackConfig(configPath: string): Promise<PackConfigVa
|
|
|
31
32
|
* (`ir gen-types`, `ir asset`) read the same value. Omitting the field is
|
|
32
33
|
* an explicit opt-out: the IR will not include `minSupportedVersion` and
|
|
33
34
|
* downstream tools default to supporting only the latest schema version.
|
|
35
|
+
* - `owningApplicationId`: the application that owns this document type; when
|
|
36
|
+
* set, it is embedded in the payload and surfaced as `owningApplicationId`
|
|
37
|
+
* by `ir asset`.
|
|
34
38
|
*
|
|
35
39
|
* Note: this is distinct from the legacy single-version IR JSON consumed by
|
|
36
40
|
* `ir zod`, which is a bare `IRealTimeDocumentSchema` (no chain, no migrations).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaIrHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/schema/schemaIrHandler.ts"],"names":[],"mappings":"AAuBA,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"schemaIrHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/schema/schemaIrHandler.ts"],"names":[],"mappings":"AAuBA,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AASD,UAAU,gBAAgB;IACxB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAwBD,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0ClF;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateIndexFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateIndexFromSchema.test.ts"],"names":[],"mappings":""}
|
|
@@ -12,6 +12,9 @@ import type { ResolvedIrChain } from "./resolveSchemaChain.js";
|
|
|
12
12
|
* - `DocumentUpgradeFns` type (the typed shape the factory accepts)
|
|
13
13
|
* - Per supported version: explicit named type exports from `types_vN.js`
|
|
14
14
|
* (not star exports, to avoid polluting autocomplete for read-only consumers)
|
|
15
|
+
* - Per supported version: the union variant type guard *functions* from
|
|
16
|
+
* `types_vN.js` as values (e.g. `isFooBar_v1`), so consumers can narrow a
|
|
17
|
+
* union without re-deriving the discriminant check
|
|
15
18
|
*/
|
|
16
19
|
export declare function generateIndexFromChain(resolved: ResolvedIrChain, minSupportedVersion?: number): string;
|
|
17
20
|
//# sourceMappingURL=generateIndexFromSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateIndexFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateIndexFromSchema.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAa/D
|
|
1
|
+
{"version":3,"file":"generateIndexFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateIndexFromSchema.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAa/D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAoDR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSchemaChain.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/resolveSchemaChain.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,yDAAyD,CAAC;AAKjE,0DAA0D;AAC1D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,qEAAqE;AACrE,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CACzC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,uBAAuB,CAAC;IAC5B,UAAU,CAAC,EAAE,2BAA2B,CAAC;CAC1C;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,MAAM,W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.0",
|
|
4
4
|
"description": "TypeScript type generation from document schema",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@osdk/client": "^2.5.2",
|
|
21
|
-
"@osdk/foundry.pack": "^2.
|
|
21
|
+
"@osdk/foundry.pack": "^2.68.0",
|
|
22
22
|
"commander": "^14.0.0",
|
|
23
23
|
"conjure-client": "^2.15.0",
|
|
24
24
|
"consola": "^3.4.2",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"tiny-invariant": "^1.3.3",
|
|
28
28
|
"yaml": "^2.8.2",
|
|
29
29
|
"zod": "^4.1.13",
|
|
30
|
-
"@palantir/pack.document-schema.model-types": "~0.
|
|
30
|
+
"@palantir/pack.document-schema.model-types": "~0.15.0",
|
|
31
31
|
"@palantir/pack.schema": "0.10.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DocumentTypeSchema } from \"@osdk/foundry.pack\";\n\nexport type FileSystemType = \"ARTIFACTS\" | \"COMPASS\";\n\nexport interface DocumentTypeAsset {\n readonly documentTypeName: string;\n readonly documentStorageType: {\n readonly type: \"yjs\";\n readonly schema: DocumentTypeSchema;\n };\n readonly fileSystemType: FileSystemType;\n readonly schemaVersion: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DocumentTypeSchema } from "@osdk/foundry.pack";
|
|
2
|
-
export type FileSystemType = "ARTIFACTS" | "COMPASS";
|
|
3
|
-
export interface DocumentTypeAsset {
|
|
4
|
-
readonly documentTypeName: string;
|
|
5
|
-
readonly documentStorageType: {
|
|
6
|
-
readonly type: "yjs";
|
|
7
|
-
readonly schema: DocumentTypeSchema;
|
|
8
|
-
};
|
|
9
|
-
readonly fileSystemType: FileSystemType;
|
|
10
|
-
readonly schemaVersion: number;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/types.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE;QAC5B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;QACrB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;KACrC,CAAC;IACF,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC"}
|