@palantir/pack.document-schema.type-gen 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/build/esm/commands/schema/registerSchemaCommands.js +2 -0
  2. package/build/esm/commands/schema/registerSchemaCommands.js.map +1 -1
  3. package/build/esm/commands/schema/schemaGenTypesHandler.js +147 -0
  4. package/build/esm/commands/schema/schemaGenTypesHandler.js.map +1 -0
  5. package/build/esm/index.js +6 -0
  6. package/build/esm/index.js.map +1 -1
  7. package/build/esm/lib/pack-docschema-api/pack-docschema-ir/recordDef.js.map +1 -1
  8. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
  9. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
  10. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
  11. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
  12. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
  13. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
  14. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
  15. package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
  16. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
  17. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
  18. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
  19. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
  20. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
  21. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
  22. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
  23. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
  24. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
  25. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
  26. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
  27. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
  28. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
  29. package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
  30. package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js +4 -16
  31. package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js.map +1 -1
  32. package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js +6 -24
  33. package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js.map +1 -1
  34. package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js +10 -40
  35. package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js.map +1 -1
  36. package/build/esm/utils/ir/convertIrToWireSchema.js +4 -2
  37. package/build/esm/utils/ir/convertIrToWireSchema.js.map +1 -1
  38. package/build/esm/utils/ir/generateZodSchemasFromIr.js +1 -1
  39. package/build/esm/utils/ir/generateZodSchemasFromIr.js.map +1 -1
  40. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js +2 -0
  41. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -0
  42. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js +2 -0
  43. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -0
  44. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js +2 -0
  45. package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -0
  46. package/build/esm/utils/schema/__tests__/fixtures.js +207 -0
  47. package/build/esm/utils/schema/__tests__/fixtures.js.map +1 -0
  48. package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js +41 -0
  49. package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js.map +1 -0
  50. package/build/esm/utils/schema/__tests__/generateModelMetadataFromSchema.test.js +41 -0
  51. package/build/esm/utils/schema/__tests__/generateModelMetadataFromSchema.test.js.map +1 -0
  52. package/build/esm/utils/schema/__tests__/generateScopeFromSchema.test.js +37 -0
  53. package/build/esm/utils/schema/__tests__/generateScopeFromSchema.test.js.map +1 -0
  54. package/build/esm/utils/schema/__tests__/generateVersionedTypesFromSchema.test.js +55 -0
  55. package/build/esm/utils/schema/__tests__/generateVersionedTypesFromSchema.test.js.map +1 -0
  56. package/build/esm/utils/schema/__tests__/generateVersionedZodFromSchema.test.js +55 -0
  57. package/build/esm/utils/schema/__tests__/generateVersionedZodFromSchema.test.js.map +1 -0
  58. package/build/esm/utils/schema/__tests__/generateVersionsFromSchema.test.js +37 -0
  59. package/build/esm/utils/schema/__tests__/generateVersionsFromSchema.test.js.map +1 -0
  60. package/build/esm/utils/schema/__tests__/snapshotUtils.js +106 -0
  61. package/build/esm/utils/schema/__tests__/snapshotUtils.js.map +1 -0
  62. package/build/esm/utils/schema/generateIndexFromSchema.js +72 -0
  63. package/build/esm/utils/schema/generateIndexFromSchema.js.map +1 -0
  64. package/build/esm/utils/schema/generateInternalFromSchema.js +380 -0
  65. package/build/esm/utils/schema/generateInternalFromSchema.js.map +1 -0
  66. package/build/esm/utils/schema/generateModelMetadataFromSchema.js +195 -0
  67. package/build/esm/utils/schema/generateModelMetadataFromSchema.js.map +1 -0
  68. package/build/esm/utils/schema/generateScopeFromSchema.js +155 -0
  69. package/build/esm/utils/schema/generateScopeFromSchema.js.map +1 -0
  70. package/build/esm/utils/schema/generateTypesFromSchema.js +16 -30
  71. package/build/esm/utils/schema/generateTypesFromSchema.js.map +1 -1
  72. package/build/esm/utils/schema/generateVersionedTypesFromSchema.js +281 -0
  73. package/build/esm/utils/schema/generateVersionedTypesFromSchema.js.map +1 -0
  74. package/build/esm/utils/schema/generateVersionedZodFromSchema.js +189 -0
  75. package/build/esm/utils/schema/generateVersionedZodFromSchema.js.map +1 -0
  76. package/build/esm/utils/schema/generateVersionsFromSchema.js +50 -0
  77. package/build/esm/utils/schema/generateVersionsFromSchema.js.map +1 -0
  78. package/build/esm/utils/schema/resolveSchemaChain.js +54 -0
  79. package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -0
  80. package/build/esm/utils/schema/runtimeSchema.js +96 -0
  81. package/build/esm/utils/schema/runtimeSchema.js.map +1 -0
  82. package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
  83. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
  84. package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
  85. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
  86. package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
  87. package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
  88. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
  89. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
  90. package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
  91. package/build/esm/utils/steps/convertStepsToIr.js +2 -5
  92. package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
  93. package/build/types/commands/schema/registerSchemaCommands.d.ts.map +1 -1
  94. package/build/types/commands/schema/schemaGenTypesHandler.d.ts +8 -0
  95. package/build/types/commands/schema/schemaGenTypesHandler.d.ts.map +1 -0
  96. package/build/types/index.d.ts +6 -0
  97. package/build/types/index.d.ts.map +1 -1
  98. package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts +0 -2
  99. package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts.map +1 -1
  100. package/build/types/utils/schema/__tests__/fixtures.d.ts +14 -0
  101. package/build/types/utils/schema/__tests__/fixtures.d.ts.map +1 -0
  102. package/build/types/utils/schema/__tests__/generateInternalFromSchema.test.d.ts +2 -0
  103. package/build/types/utils/schema/__tests__/generateInternalFromSchema.test.d.ts.map +1 -0
  104. package/build/types/utils/schema/__tests__/generateModelMetadataFromSchema.test.d.ts +2 -0
  105. package/build/types/utils/schema/__tests__/generateModelMetadataFromSchema.test.d.ts.map +1 -0
  106. package/build/types/utils/schema/__tests__/generateScopeFromSchema.test.d.ts +2 -0
  107. package/build/types/utils/schema/__tests__/generateScopeFromSchema.test.d.ts.map +1 -0
  108. package/build/types/utils/schema/__tests__/generateVersionedTypesFromSchema.test.d.ts +2 -0
  109. package/build/types/utils/schema/__tests__/generateVersionedTypesFromSchema.test.d.ts.map +1 -0
  110. package/build/types/utils/schema/__tests__/generateVersionedZodFromSchema.test.d.ts +2 -0
  111. package/build/types/utils/schema/__tests__/generateVersionedZodFromSchema.test.d.ts.map +1 -0
  112. package/build/types/utils/schema/__tests__/generateVersionsFromSchema.test.d.ts +2 -0
  113. package/build/types/utils/schema/__tests__/generateVersionsFromSchema.test.d.ts.map +1 -0
  114. package/build/types/utils/schema/__tests__/snapshotUtils.d.ts +47 -0
  115. package/build/types/utils/schema/__tests__/snapshotUtils.d.ts.map +1 -0
  116. package/build/types/utils/schema/generateIndexFromSchema.d.ts +14 -0
  117. package/build/types/utils/schema/generateIndexFromSchema.d.ts.map +1 -0
  118. package/build/types/utils/schema/generateInternalFromSchema.d.ts +18 -0
  119. package/build/types/utils/schema/generateInternalFromSchema.d.ts.map +1 -0
  120. package/build/types/utils/schema/generateModelMetadataFromSchema.d.ts +15 -0
  121. package/build/types/utils/schema/generateModelMetadataFromSchema.d.ts.map +1 -0
  122. package/build/types/utils/schema/generateScopeFromSchema.d.ts +13 -0
  123. package/build/types/utils/schema/generateScopeFromSchema.d.ts.map +1 -0
  124. package/build/types/utils/schema/generateTypesFromSchema.d.ts.map +1 -1
  125. package/build/types/utils/schema/generateVersionedTypesFromSchema.d.ts +18 -0
  126. package/build/types/utils/schema/generateVersionedTypesFromSchema.d.ts.map +1 -0
  127. package/build/types/utils/schema/generateVersionedZodFromSchema.d.ts +16 -0
  128. package/build/types/utils/schema/generateVersionedZodFromSchema.d.ts.map +1 -0
  129. package/build/types/utils/schema/generateVersionsFromSchema.d.ts +13 -0
  130. package/build/types/utils/schema/generateVersionsFromSchema.d.ts.map +1 -0
  131. package/build/types/utils/schema/resolveSchemaChain.d.ts +18 -0
  132. package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -0
  133. package/build/types/utils/schema/runtimeSchema.d.ts +59 -0
  134. package/build/types/utils/schema/runtimeSchema.d.ts.map +1 -0
  135. package/build/types/utils/steps/convertStepsToIr.d.ts.map +1 -1
  136. package/package.json +3 -3
@@ -0,0 +1,54 @@
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
+ function collectVersionedSchemaChain(input) {
18
+ const chain = [];
19
+ let current = input;
20
+ while (current.type === "versioned") {
21
+ chain.unshift({
22
+ version: current.version,
23
+ schema: current.models,
24
+ migrations: current.migrations
25
+ });
26
+ current = current.previous;
27
+ }
28
+ chain.unshift({
29
+ version: current.version,
30
+ schema: current.models
31
+ });
32
+ return chain;
33
+ }
34
+
35
+ /**
36
+ * Collect the version chain and resolve min/latest versions.
37
+ * Throws on empty chain or invalid minSupportedVersion.
38
+ */
39
+ export function resolveSchemaChain(schema, minSupportedVersion) {
40
+ const chain = collectVersionedSchemaChain(schema);
41
+ if (chain.length === 0) {
42
+ throw new Error("Schema version chain is empty");
43
+ }
44
+ const latestVersion = chain[chain.length - 1].version;
45
+ if (minSupportedVersion != null && !chain.some(c => c.version === minSupportedVersion)) {
46
+ throw new Error(`minSupportedVersion ${minSupportedVersion} is not in the schema chain ` + `(available versions: ${chain.map(c => c.version).join(", ")})`);
47
+ }
48
+ return {
49
+ chain,
50
+ latestVersion,
51
+ minVersion: minSupportedVersion ?? latestVersion
52
+ };
53
+ }
54
+ //# sourceMappingURL=resolveSchemaChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSchemaChain.js","names":["collectVersionedSchemaChain","input","chain","current","type","unshift","version","schema","models","migrations","previous","resolveSchemaChain","minSupportedVersion","length","Error","latestVersion","some","c","map","join","minVersion"],"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 { RuntimeSchema } from \"./runtimeSchema.js\";\n\nexport interface VersionedSchemaEntry {\n version: number;\n schema: RuntimeSchema;\n migrations?: VersionMigrations;\n}\n\nexport interface ResolvedSchemaChain {\n chain: VersionedSchemaEntry[];\n latestVersion: number;\n minVersion: number;\n}\n\nfunction collectVersionedSchemaChain(input: SchemaDefinition): VersionedSchemaEntry[] {\n const chain: VersionedSchemaEntry[] = [];\n let current: SchemaDefinition = input;\n\n while (current.type === \"versioned\") {\n chain.unshift({\n version: current.version,\n schema: current.models as RuntimeSchema,\n migrations: current.migrations,\n });\n current = current.previous;\n }\n chain.unshift({ version: current.version, schema: current.models as RuntimeSchema });\n\n return chain;\n}\n\n/**\n * Collect the version chain and resolve min/latest versions.\n * Throws on empty chain or invalid minSupportedVersion.\n */\nexport function resolveSchemaChain(\n schema: SchemaDefinition,\n minSupportedVersion?: number,\n): ResolvedSchemaChain {\n const chain = collectVersionedSchemaChain(schema);\n\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 const minVersion = minSupportedVersion ?? latestVersion;\n\n return { chain, latestVersion, minVersion };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,SAASA,2BAA2BA,CAACC,KAAuB,EAA0B;EACpF,MAAMC,KAA6B,GAAG,EAAE;EACxC,IAAIC,OAAyB,GAAGF,KAAK;EAErC,OAAOE,OAAO,CAACC,IAAI,KAAK,WAAW,EAAE;IACnCF,KAAK,CAACG,OAAO,CAAC;MACZC,OAAO,EAAEH,OAAO,CAACG,OAAO;MACxBC,MAAM,EAAEJ,OAAO,CAACK,MAAuB;MACvCC,UAAU,EAAEN,OAAO,CAACM;IACtB,CAAC,CAAC;IACFN,OAAO,GAAGA,OAAO,CAACO,QAAQ;EAC5B;EACAR,KAAK,CAACG,OAAO,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAO;IAAEC,MAAM,EAAEJ,OAAO,CAACK;EAAwB,CAAC,CAAC;EAEpF,OAAON,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASS,kBAAkBA,CAChCJ,MAAwB,EACxBK,mBAA4B,EACP;EACrB,MAAMV,KAAK,GAAGF,2BAA2B,CAACO,MAAM,CAAC;EAEjD,IAAIL,KAAK,CAACW,MAAM,KAAK,CAAC,EAAE;IACtB,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;EAClD;EAEA,MAAMC,aAAa,GAAGb,KAAK,CAACA,KAAK,CAACW,MAAM,GAAG,CAAC,CAAC,CAAEP,OAAO;EAEtD,IAAIM,mBAAmB,IAAI,IAAI,IAAI,CAACV,KAAK,CAACc,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACX,OAAO,KAAKM,mBAAmB,CAAC,EAAE;IACtF,MAAM,IAAIE,KAAK,CACb,uBAAuBF,mBAAmB,8BAA8B,GACpE,wBAAwBV,KAAK,CAACgB,GAAG,CAACD,CAAC,IAAIA,CAAC,CAACX,OAAO,CAAC,CAACa,IAAI,CAAC,IAAI,CAAC,GAClE,CAAC;EACH;EAIA,OAAO;IAAEjB,KAAK;IAAEa,aAAa;IAAEK,UAAU,EAFtBR,mBAAmB,IAAIG;EAEA,CAAC;AAC7C","ignoreList":[]}
@@ -0,0 +1,96 @@
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 { TypeKind as SchemaTypeKind } from "@palantir/pack.schema";
18
+ export const TypeKind = {
19
+ ...SchemaTypeKind,
20
+ ANY: "any"
21
+ };
22
+ export const SchemaDefKind = {
23
+ RECORD: "record",
24
+ UNION: "union"
25
+ };
26
+
27
+ // Runtime types mirroring the schema structure
28
+
29
+ export function isRecordSchema(item) {
30
+ return item.type === SchemaDefKind.RECORD && "fields" in item;
31
+ }
32
+ export function isUnionSchema(item) {
33
+ return item.type === SchemaDefKind.UNION && "variants" in item;
34
+ }
35
+ export function findRecordExportName(recordName, schema) {
36
+ for (const [exportName, item] of Object.entries(schema)) {
37
+ if (isRecordSchema(item) && item.name === recordName) {
38
+ return exportName;
39
+ }
40
+ }
41
+ return null;
42
+ }
43
+
44
+ /** Versioned read type name: `RecordName_vN` */
45
+ export function versionedTypeName(exportName, version) {
46
+ return `${exportName}_v${version}`;
47
+ }
48
+
49
+ /** Versioned write type name: `RecordNameUpdate_vN` */
50
+ export function versionedWriteTypeName(exportName, version) {
51
+ return `${exportName}Update_v${version}`;
52
+ }
53
+
54
+ /** Versioned Zod schema name: `RecordNameSchema_vN` */
55
+ export function versionedSchemaName(exportName, version) {
56
+ return `${exportName}Schema_v${version}`;
57
+ }
58
+
59
+ /** Model constant name: `RecordNameModel` */
60
+ export function modelName(exportName) {
61
+ return `${exportName}Model`;
62
+ }
63
+
64
+ /** Unversioned Zod schema name: `RecordNameSchema` */
65
+ export function schemaName(exportName) {
66
+ return `${exportName}Schema`;
67
+ }
68
+
69
+ /** Per-version types file path: `./types_vN.js` */
70
+ export function typesFilePath(version) {
71
+ return `./types_v${version}.js`;
72
+ }
73
+
74
+ /** Per-version write types file path: `./writeTypes_vN.js` */
75
+ export function writeTypesFilePath(version) {
76
+ return `./writeTypes_v${version}.js`;
77
+ }
78
+
79
+ /** Types re-export file path: `./types.js` */
80
+ export const TYPES_REEXPORT_PATH = "./types.js";
81
+
82
+ /** Schema re-export file path: `./schema.js` */
83
+ export const SCHEMA_REEXPORT_PATH = "./schema.js";
84
+
85
+ /** Models file path: `./models.js` */
86
+ export const MODELS_PATH = "./models.js";
87
+
88
+ /** Internal upgrades file path: `./_internal/upgrades.js` */
89
+ export const INTERNAL_UPGRADES_PATH = "./_internal/upgrades.js";
90
+
91
+ /** Versions file path: `./versions.js` */
92
+ export const VERSIONS_PATH = "./versions.js";
93
+
94
+ /** Versioned doc ref file path: `./versionedDocRef.js` */
95
+ export const VERSIONED_DOC_REF_PATH = "./versionedDocRef.js";
96
+ //# sourceMappingURL=runtimeSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeSchema.js","names":["TypeKind","SchemaTypeKind","ANY","SchemaDefKind","RECORD","UNION","isRecordSchema","item","type","isUnionSchema","findRecordExportName","recordName","schema","exportName","Object","entries","name","versionedTypeName","version","versionedWriteTypeName","versionedSchemaName","modelName","schemaName","typesFilePath","writeTypesFilePath","TYPES_REEXPORT_PATH","SCHEMA_REEXPORT_PATH","MODELS_PATH","INTERNAL_UPGRADES_PATH","VERSIONS_PATH","VERSIONED_DOC_REF_PATH"],"sources":["runtimeSchema.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 { TypeKind as SchemaTypeKind } from \"@palantir/pack.schema\";\n\nexport const TypeKind: typeof SchemaTypeKind & { readonly ANY: \"any\" } = {\n ...SchemaTypeKind,\n ANY: \"any\",\n};\n\nexport const SchemaDefKind = {\n RECORD: \"record\",\n UNION: \"union\",\n} as const;\n\n// Runtime types mirroring the schema structure\nexport interface SchemaField {\n readonly type: string;\n readonly items?: SchemaField;\n readonly item?: SchemaField;\n readonly refType?: \"record\" | \"union\";\n readonly name?: string;\n}\n\nexport interface RuntimeSchemaRecord {\n readonly type: typeof SchemaDefKind.RECORD;\n readonly name: string;\n readonly docs?: string;\n readonly fields: Readonly<Record<string, SchemaField>>;\n}\n\nexport interface RuntimeSchemaUnion {\n readonly type: typeof SchemaDefKind.UNION;\n readonly name?: string;\n readonly variants: Readonly<Record<string, SchemaField>>;\n readonly discriminant: string;\n}\n\nexport type RuntimeSchemaItem = RuntimeSchemaRecord | RuntimeSchemaUnion;\nexport type RuntimeSchema = Record<string, RuntimeSchemaItem>;\n\nexport function isRecordSchema(item: RuntimeSchemaItem): item is RuntimeSchemaRecord {\n return item.type === SchemaDefKind.RECORD && \"fields\" in item;\n}\n\nexport function isUnionSchema(item: RuntimeSchemaItem): item is RuntimeSchemaUnion {\n return item.type === SchemaDefKind.UNION && \"variants\" in item;\n}\n\nexport function findRecordExportName(recordName: string, schema: RuntimeSchema): string | null {\n for (const [exportName, item] of Object.entries(schema)) {\n if (isRecordSchema(item) && item.name === recordName) {\n return exportName;\n }\n }\n return null;\n}\n\n/** Versioned read type name: `RecordName_vN` */\nexport function versionedTypeName(exportName: string, version: number): string {\n return `${exportName}_v${version}`;\n}\n\n/** Versioned write type name: `RecordNameUpdate_vN` */\nexport function versionedWriteTypeName(exportName: string, version: number): string {\n return `${exportName}Update_v${version}`;\n}\n\n/** Versioned Zod schema name: `RecordNameSchema_vN` */\nexport function versionedSchemaName(exportName: string, version: number): string {\n return `${exportName}Schema_v${version}`;\n}\n\n/** Model constant name: `RecordNameModel` */\nexport function modelName(exportName: string): string {\n return `${exportName}Model`;\n}\n\n/** Unversioned Zod schema name: `RecordNameSchema` */\nexport function schemaName(exportName: string): string {\n return `${exportName}Schema`;\n}\n\n/** Per-version types file path: `./types_vN.js` */\nexport function typesFilePath(version: number): string {\n return `./types_v${version}.js`;\n}\n\n/** Per-version write types file path: `./writeTypes_vN.js` */\nexport function writeTypesFilePath(version: number): string {\n return `./writeTypes_v${version}.js`;\n}\n\n/** Types re-export file path: `./types.js` */\nexport const TYPES_REEXPORT_PATH = \"./types.js\";\n\n/** Schema re-export file path: `./schema.js` */\nexport const SCHEMA_REEXPORT_PATH = \"./schema.js\";\n\n/** Models file path: `./models.js` */\nexport const MODELS_PATH = \"./models.js\";\n\n/** Internal upgrades file path: `./_internal/upgrades.js` */\nexport const INTERNAL_UPGRADES_PATH = \"./_internal/upgrades.js\";\n\n/** Versions file path: `./versions.js` */\nexport const VERSIONS_PATH = \"./versions.js\";\n\n/** Versioned doc ref file path: `./versionedDocRef.js` */\nexport const VERSIONED_DOC_REF_PATH = \"./versionedDocRef.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,IAAIC,cAAc,QAAQ,uBAAuB;AAElE,OAAO,MAAMD,QAAyD,GAAG;EACvE,GAAGC,cAAc;EACjBC,GAAG,EAAE;AACP,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE;AACT,CAAU;;AAEV;;AA0BA,OAAO,SAASC,cAAcA,CAACC,IAAuB,EAA+B;EACnF,OAAOA,IAAI,CAACC,IAAI,KAAKL,aAAa,CAACC,MAAM,IAAI,QAAQ,IAAIG,IAAI;AAC/D;AAEA,OAAO,SAASE,aAAaA,CAACF,IAAuB,EAA8B;EACjF,OAAOA,IAAI,CAACC,IAAI,KAAKL,aAAa,CAACE,KAAK,IAAI,UAAU,IAAIE,IAAI;AAChE;AAEA,OAAO,SAASG,oBAAoBA,CAACC,UAAkB,EAAEC,MAAqB,EAAiB;EAC7F,KAAK,MAAM,CAACC,UA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":3,"file":"arrayFields.js","names":[],"sources":["arrayFields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */\n\n\nexport interface Container {\n readonly items: readonly string[];\n readonly numbers: readonly number[];\n}\n\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"arrayFields.js","names":[],"sources":["arrayFields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\n\nexport interface Container {\n readonly items: readonly string[];\n readonly numbers: readonly number[];\n}\n\n"],"mappings":"","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */
2
2
 
3
3
  /**
4
4
  * A cat
@@ -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.8.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":[]}
1
+ {"version":3,"file":"customDiscriminant.js","names":["isAnimalCat","value","kind","isAnimalDog"],"sources":["customDiscriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.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":[]}
@@ -1,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */
2
2
 
3
3
  /**
4
4
  * Represents an edge in a graph
@@ -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.8.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
+ {"version":3,"file":"generateTypeScriptInterfaces.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["generateTypeScriptInterfaces.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.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.8.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
+ {"version":3,"file":"refTypes.js","names":[],"sources":["refTypes.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.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.8.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
+ {"version":3,"file":"simpleRecord.js","names":[],"sources":["simpleRecord.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.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,4 +1,4 @@
1
- /* Generated by @palantir/pack.document-schema.type-gen@0.8.0 */
1
+ /* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */
2
2
 
3
3
  /**
4
4
  * A node in the graph
@@ -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.8.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
+ {"version":3,"file":"simpleSteps.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["simpleSteps.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.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":[]}
@@ -84,11 +84,8 @@ export function convertRecordDefToIr(recordDef) {
84
84
  return {
85
85
  key: recordDef.name,
86
86
  name: recordDef.name,
87
- description: recordDef.docs || undefined,
88
- fields,
89
- metadata: {
90
- addedInVersion: 1
91
- }
87
+ description: recordDef.docs ?? undefined,
88
+ fields
92
89
  };
93
90
  }
94
91
  export function convertUnionDefToIr(unionDef) {
@@ -1 +1 @@
1
- {"version":3,"file":"convertStepsToIr.js","names":["invariant","IFieldTypeUnion","IFieldValueUnion","IModelDef","assertNever","convertStepsToSchema","convertStepsToIr","steps","metadata","recordDefinitions","unionDefinitions","schema","Object","fromEntries","map","def","name","convertSchemaToIr","inputSchema","primaryModelKeys","models","Map","modelDef","values","collectModels","push","description","version","outModels","has","process","env","NODE_ENV","type","set","record","convertRecordDefToIr","union","convertUnionDefToIr","recordDef","fields","entries","fieldKey","fieldType","key","undefined","convertTypeToFieldTypeUnion","addedInVersion","isOptional","docs","unionDef","variantEntries","variants","variantName","modelRef","discriminant","schemaType","array","allowNullValue","value","convertTypeToFieldValueUnion","items","item","boolean","docRef","documentTypeRids","double","mediaRef","object","interfaceTypeRids","objectTypeRids","modelTypes","string","unmanagedJson","userRef"],"sources":["convertStepsToIr.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 * as P from \"@palantir/pack.schema\";\nimport invariant from \"tiny-invariant\";\nimport type {\n IModelTypeKey,\n IUnionVariantKey,\n} from \"../../lib/pack-docschema-api/pack-docschema-api\";\nimport type {\n IFieldDef,\n IRealTimeDocumentSchema,\n IRecordDef,\n IUnionDef,\n} from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport {\n IFieldTypeUnion,\n IFieldValueUnion,\n IModelDef,\n} from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { assertNever } from \"../assertNever.js\";\nimport { convertStepsToSchema } from \"./convertStepsToSchema.js\";\nimport type { MigrationStep } from \"./parseMigrationSteps.js\";\n\nexport interface SchemaMetadata {\n readonly name?: string;\n readonly description?: string;\n readonly version?: number;\n}\n\n/**\n * Converts migration steps to Palantir IR format\n */\nexport function convertStepsToIr(\n steps: readonly MigrationStep[],\n metadata?: SchemaMetadata,\n): IRealTimeDocumentSchema {\n // First convert steps to document-schema-api format\n const { recordDefinitions, unionDefinitions } = convertStepsToSchema(steps as MigrationStep[]);\n\n const schema = {\n ...Object.fromEntries(recordDefinitions.map(def => [def.name, def])),\n ...Object.fromEntries(unionDefinitions.map(def => [def.name, def])),\n };\n\n return convertSchemaToIr(schema, metadata);\n}\n\n/**\n * Converts record and union definitions to Palantir IR format\n */\nexport function convertSchemaToIr(\n inputSchema: P.Schema<P.ReturnedSchema>,\n metadata?: SchemaMetadata,\n): IRealTimeDocumentSchema {\n const primaryModelKeys: IModelTypeKey[] = [];\n const models = new Map<IModelTypeKey, IModelDef>();\n\n for (const modelDef of Object.values(inputSchema)) {\n if (collectModels(modelDef, models)) {\n primaryModelKeys.push(modelDef.name);\n }\n }\n\n return {\n name: metadata?.name ?? \"Generated Schema\",\n description: metadata?.description ?? \"Schema generated from migration steps\",\n version: metadata?.version ?? 1,\n primaryModelKeys,\n models: Object.fromEntries(models),\n };\n}\n\nfunction collectModels(\n modelDef: P.ModelDef,\n outModels: Map<IModelTypeKey, IModelDef>,\n): boolean {\n invariant(\n !outModels.has(modelDef.name),\n `Duplicate model definition: ${modelDef.name}`,\n );\n\n switch (modelDef.type) {\n case \"record\": {\n outModels.set(modelDef.name, IModelDef.record(convertRecordDefToIr(modelDef)));\n return true;\n }\n case \"union\": {\n outModels.set(modelDef.name, IModelDef.union(convertUnionDefToIr(modelDef)));\n return true;\n }\n default:\n assertNever(modelDef);\n }\n}\n\nexport function convertRecordDefToIr(recordDef: P.RecordDef): IRecordDef {\n const fields = Object.entries(recordDef.fields).map(([fieldKey, fieldType]): IFieldDef => ({\n key: fieldKey,\n name: fieldKey,\n description: undefined,\n fieldType: convertTypeToFieldTypeUnion(fieldType),\n metadata: { addedInVersion: 1 },\n isOptional: fieldType.type === \"optional\" ? true : undefined,\n }));\n\n return {\n key: recordDef.name,\n name: recordDef.name,\n description: recordDef.docs || undefined,\n fields,\n metadata: { addedInVersion: 1 },\n };\n}\n\nexport function convertUnionDefToIr(unionDef: P.UnionDef): IUnionDef {\n const variantEntries = Object.entries(unionDef.variants).map((\n [variantName, modelRef],\n ) =>\n [\n variantName as IUnionVariantKey,\n modelRef.name as IModelTypeKey,\n ] as const\n );\n\n return {\n key: unionDef.name,\n name: unionDef.name,\n description: unionDef.docs,\n discriminant: unionDef.discriminant,\n variants: Object.fromEntries(variantEntries),\n metadata: { addedInVersion: 1 },\n };\n}\n\n// TODO: rename to convertSchemaTypeToFieldTypeUnion\nexport function convertTypeToFieldTypeUnion(schemaType: P.Type): IFieldTypeUnion {\n switch (schemaType.type) {\n case \"array\": {\n const arrayType = schemaType as P.Array;\n return IFieldTypeUnion.array({\n allowNullValue: false,\n value: convertTypeToFieldValueUnion(arrayType.items as P.Type),\n });\n }\n // TODO: have map/set types in document-schema-api\n\n case \"optional\": {\n // Optional flag is handled at field level, but we need to unwrap the inner type\n const optionalType = schemaType as P.Optional;\n return convertTypeToFieldTypeUnion(optionalType.item as P.Type);\n }\n\n case \"boolean\":\n case \"docRef\":\n case \"double\":\n case \"mediaRef\":\n case \"objectRef\":\n case \"ref\":\n case \"string\":\n case \"unknown\":\n case \"userRef\":\n return IFieldTypeUnion.value(convertTypeToFieldValueUnion(schemaType));\n\n default:\n assertNever(schemaType);\n }\n}\n\nfunction convertTypeToFieldValueUnion(schemaType: P.Type): IFieldValueUnion {\n switch (schemaType.type) {\n case \"array\":\n // TODO: fix the argument types so these aren't possible\n invariant(\n false,\n `Collection type passed to convertTypeToFieldValueUnion: ${schemaType.type}`,\n );\n\n case \"boolean\":\n return IFieldValueUnion.boolean({});\n\n case \"docRef\":\n return IFieldValueUnion.docRef({\n documentTypeRids: [], // FIXME: confirm whether we will use rids in the deployed schema.\n });\n\n case \"double\":\n return IFieldValueUnion.double({});\n\n case \"mediaRef\":\n return IFieldValueUnion.mediaRef({});\n\n case \"objectRef\":\n return IFieldValueUnion.object({\n // FIXME: confirm whether we will use rids in the deployed schema.\n interfaceTypeRids: [],\n objectTypeRids: [],\n });\n\n case \"optional\": {\n // If we get here, it means we have nested optionals - unwrap and continue\n // TODO: probably warn? maybe throw\n const optionalType = schemaType as P.Optional;\n return convertTypeToFieldValueUnion(optionalType.item as P.Type);\n }\n\n case \"ref\":\n return IFieldValueUnion.modelRef({\n modelTypes: [schemaType.name as IModelTypeKey],\n });\n\n case \"string\":\n return IFieldValueUnion.string({});\n\n case \"unknown\":\n return IFieldValueUnion.unmanagedJson({});\n\n case \"userRef\":\n return IFieldValueUnion.userRef({});\n\n default:\n assertNever(schemaType);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAWtC,SACEC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,QACJ,yDAAyD;AAChE,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAQ,2BAA2B;AAShE;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,KAA+B,EAC/BC,QAAyB,EACA;EACzB;EACA,MAAM;IAAEC,iBAAiB;IAAEC;EAAiB,CAAC,GAAGL,oBAAoB,CAACE,KAAwB,CAAC;EAE9F,MAAMI,MAAM,GAAG;IACb,GAAGC,MAAM,CAACC,WAAW,CAACJ,iBAAiB,CAACK,GAAG,CAACC,GAAG,IAAI,CAACA,GAAG,CAACC,IAAI,EAAED,GAAG,CAAC,CAAC,CAAC;IACpE,GAAGH,MAAM,CAACC,WAAW,CAACH,gBAAgB,CAACI,GAAG,CAACC,GAAG,IAAI,CAACA,GAAG,CAACC,IAAI,EAAED,GAAG,CAAC,CAAC;EACpE,CAAC;EAED,OAAOE,iBAAiB,CAACN,MAAM,EAAEH,QAAQ,CAAC;AAC5C;;AAEA;AACA;AACA;AACA,OAAO,SAASS,iBAAiBA,CAC/BC,WAAuC,EACvCV,QAAyB,EACA;EACzB,MAAMW,gBAAiC,GAAG,EAAE;EAC5C,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAA2B,C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CAAC,CAAC;IAEJ,KAAK,UAAU;MAAE;QACf;QACA;;QAEA,OAAOV,4BAA4B,CADdJ,UAAU,CACkBM,IAAc,CAAC;MAClE;IAEA,KAAK,KAAK;MACR,OAAO5D,gBAAgB,CAACoD,QAAQ,CAAC;QAC/BiB,UAAU,EAAE,CAACf,UAAU,CAACxC,IAAI;MAC9B,CAAC,CAAC;IAEJ,KAAK,QAAQ;MACX,OAAOd,gBAAgB,CAACsE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpC,KAAK,SAAS;MACZ,OAAOtE,gBAAgB,CAACuE,aAAa,CAAC,CAAC,CAAC,CAAC;IAE3C,KAAK,SAAS;MACZ,OAAOvE,gBAAgB,CAACwE,OAAO,CAAC,CAAC,CAAC,CAAC;IAErC;MACEtE,WAAW,CAACoD,UAAU,CAAC;EAC3B;AACF","ignoreList":[]}
1
+ {"version":3,"file":"convertStepsToIr.js","names":["invariant","IFieldTypeUnion","IFieldValueUnion","IModelDef","assertNever","convertStepsToSchema","convertStepsToIr","steps","metadata","recordDefinitions","unionDefinitions","schema","Object","fromEntries","map","def","name","convertSchemaToIr","inputSchema","primaryModelKeys","models","Map","modelDef","values","collectModels","push","description","version","outModels","has","process","env","NODE_ENV","type","set","record","convertRecordDefToIr","union","convertUnionDefToIr","recordDef","fields","entries","fieldKey","fieldType","key","undefined","convertTypeToFieldTypeUnion","addedInVersion","isOptional","docs","unionDef","variantEntries","variants","variantName","modelRef","discriminant","schemaType","array","allowNullValue","value","convertTypeToFieldValueUnion","items","item","boolean","docRef","documentTypeRids","double","mediaRef","object","interfaceTypeRids","objectTypeRids","modelTypes","string","unmanagedJson","userRef"],"sources":["convertStepsToIr.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 * as P from \"@palantir/pack.schema\";\nimport invariant from \"tiny-invariant\";\nimport type {\n IModelTypeKey,\n IUnionVariantKey,\n} from \"../../lib/pack-docschema-api/pack-docschema-api\";\nimport type {\n IFieldDef,\n IRealTimeDocumentSchema,\n IRecordDef,\n IUnionDef,\n} from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport {\n IFieldTypeUnion,\n IFieldValueUnion,\n IModelDef,\n} from \"../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { assertNever } from \"../assertNever.js\";\nimport { convertStepsToSchema } from \"./convertStepsToSchema.js\";\nimport type { MigrationStep } from \"./parseMigrationSteps.js\";\n\nexport interface SchemaMetadata {\n readonly name?: string;\n readonly description?: string;\n readonly version?: number;\n}\n\n/**\n * Converts migration steps to Palantir IR format\n */\nexport function convertStepsToIr(\n steps: readonly MigrationStep[],\n metadata?: SchemaMetadata,\n): IRealTimeDocumentSchema {\n // First convert steps to document-schema-api format\n const { recordDefinitions, unionDefinitions } = convertStepsToSchema(steps as MigrationStep[]);\n\n const schema = {\n ...Object.fromEntries(recordDefinitions.map(def => [def.name, def])),\n ...Object.fromEntries(unionDefinitions.map(def => [def.name, def])),\n };\n\n return convertSchemaToIr(schema, metadata);\n}\n\n/**\n * Converts record and union definitions to Palantir IR format\n */\nexport function convertSchemaToIr(\n inputSchema: P.Schema<P.ReturnedSchema>,\n metadata?: SchemaMetadata,\n): IRealTimeDocumentSchema {\n const primaryModelKeys: IModelTypeKey[] = [];\n const models = new Map<IModelTypeKey, IModelDef>();\n\n for (const modelDef of Object.values(inputSchema)) {\n if (collectModels(modelDef, models)) {\n primaryModelKeys.push(modelDef.name);\n }\n }\n\n return {\n name: metadata?.name ?? \"Generated Schema\",\n description: metadata?.description ?? \"Schema generated from migration steps\",\n version: metadata?.version ?? 1,\n primaryModelKeys,\n models: Object.fromEntries(models),\n };\n}\n\nfunction collectModels(\n modelDef: P.ModelDef,\n outModels: Map<IModelTypeKey, IModelDef>,\n): boolean {\n invariant(\n !outModels.has(modelDef.name),\n `Duplicate model definition: ${modelDef.name}`,\n );\n\n switch (modelDef.type) {\n case \"record\": {\n outModels.set(modelDef.name, IModelDef.record(convertRecordDefToIr(modelDef)));\n return true;\n }\n case \"union\": {\n outModels.set(modelDef.name, IModelDef.union(convertUnionDefToIr(modelDef)));\n return true;\n }\n default:\n assertNever(modelDef);\n }\n}\n\nexport function convertRecordDefToIr(recordDef: P.RecordDef): IRecordDef {\n const fields = Object.entries(recordDef.fields).map(([fieldKey, fieldType]): IFieldDef => ({\n key: fieldKey,\n name: fieldKey,\n description: undefined,\n fieldType: convertTypeToFieldTypeUnion(fieldType),\n metadata: { addedInVersion: 1 },\n isOptional: fieldType.type === \"optional\" ? true : undefined,\n }));\n\n return {\n key: recordDef.name,\n name: recordDef.name,\n description: recordDef.docs ?? undefined,\n fields,\n };\n}\n\nexport function convertUnionDefToIr(unionDef: P.UnionDef): IUnionDef {\n const variantEntries = Object.entries(unionDef.variants).map((\n [variantName, modelRef],\n ) =>\n [\n variantName as IUnionVariantKey,\n modelRef.name as IModelTypeKey,\n ] as const\n );\n\n return {\n key: unionDef.name,\n name: unionDef.name,\n description: unionDef.docs,\n discriminant: unionDef.discriminant,\n variants: Object.fromEntries(variantEntries),\n metadata: { addedInVersion: 1 },\n };\n}\n\n// TODO: rename to convertSchemaTypeToFieldTypeUnion\nexport function convertTypeToFieldTypeUnion(schemaType: P.Type): IFieldTypeUnion {\n switch (schemaType.type) {\n case \"array\": {\n const arrayType = schemaType as P.Array;\n return IFieldTypeUnion.array({\n allowNullValue: false,\n value: convertTypeToFieldValueUnion(arrayType.items as P.Type),\n });\n }\n // TODO: have map/set types in document-schema-api\n\n case \"optional\": {\n // Optional flag is handled at field level, but we need to unwrap the inner type\n const optionalType = schemaType as P.Optional;\n return convertTypeToFieldTypeUnion(optionalType.item as P.Type);\n }\n\n case \"boolean\":\n case \"docRef\":\n case \"double\":\n case \"mediaRef\":\n case \"objectRef\":\n case \"ref\":\n case \"string\":\n case \"unknown\":\n case \"userRef\":\n return IFieldTypeUnion.value(convertTypeToFieldValueUnion(schemaType));\n\n default:\n assertNever(schemaType);\n }\n}\n\nfunction convertTypeToFieldValueUnion(schemaType: P.Type): IFieldValueUnion {\n switch (schemaType.type) {\n case \"array\":\n // TODO: fix the argument types so these aren't possible\n invariant(\n false,\n `Collection type passed to convertTypeToFieldValueUnion: ${schemaType.type}`,\n );\n\n case \"boolean\":\n return IFieldValueUnion.boolean({});\n\n case \"docRef\":\n return IFieldValueUnion.docRef({\n documentTypeRids: [], // FIXME: confirm whether we will use rids in the deployed schema.\n });\n\n case \"double\":\n return IFieldValueUnion.double({});\n\n case \"mediaRef\":\n return IFieldValueUnion.mediaRef({});\n\n case \"objectRef\":\n return IFieldValueUnion.object({\n // FIXME: confirm whether we will use rids in the deployed schema.\n interfaceTypeRids: [],\n objectTypeRids: [],\n });\n\n case \"optional\": {\n // If we get here, it means we have nested optionals - unwrap and continue\n // TODO: probably warn? maybe throw\n const optionalType = schemaType as P.Optional;\n return convertTypeToFieldValueUnion(optionalType.item as P.Type);\n }\n\n case \"ref\":\n return IFieldValueUnion.modelRef({\n modelTypes: [schemaType.name as IModelTypeKey],\n });\n\n case \"string\":\n return IFieldValueUnion.string({});\n\n case \"unknown\":\n return IFieldValueUnion.unmanagedJson({});\n\n case \"userRef\":\n return IFieldValueUnion.userRef({});\n\n default:\n assertNever(schemaType);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAWtC,SACEC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,QACJ,yDAAyD;AAChE,SAASC,WAAW,QAAQ,mBAAmB;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aCommands.d.ts","sourceRoot":"","sources":["../../../../src/commands/schema/registerSchemaCommands.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAW7D"}
1
+ {"version":3,"file":"registerSchemaCommands.d.ts","sourceRoot":"","sources":["../../../../src/commands/schema/registerSchemaCommands.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmB7D"}
@@ -0,0 +1,8 @@
1
+ interface SchemaGenTypesOptions {
2
+ input: string;
3
+ output: string;
4
+ minVersion?: string;
5
+ }
6
+ export declare function schemaGenTypesHandler(options: SchemaGenTypesOptions): Promise<void>;
7
+ export {};
8
+ //# sourceMappingURL=schemaGenTypesHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaGenTypesHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/schema/schemaGenTypesHandler.ts"],"names":[],"mappings":"AA8BA,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAmBD,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+GzF"}
@@ -4,7 +4,13 @@ export { registerSchemaCommands } from "./commands/schema/registerSchemaCommands
4
4
  export { registerStepsCommands } from "./commands/steps/registerStepsCommands.js";
5
5
  export { generateZodSchemasFromIr } from "./utils/ir/generateZodSchemasFromIr.js";
6
6
  export { convertSchemaToSteps, convertStepsToYamlString, } from "./utils/schema/convertSchemaToSteps.js";
7
+ export { generateInternalFromSchema } from "./utils/schema/generateInternalFromSchema.js";
8
+ export { generateModelMetadataFromSchema, type ModelMetadataOutput, } from "./utils/schema/generateModelMetadataFromSchema.js";
9
+ export { generateScopeFromSchema } from "./utils/schema/generateScopeFromSchema.js";
7
10
  export { generateTypesFromSchema } from "./utils/schema/generateTypesFromSchema.js";
11
+ export { generateVersionedTypesFromSchema } from "./utils/schema/generateVersionedTypesFromSchema.js";
12
+ export { generateVersionedZodFromSchema } from "./utils/schema/generateVersionedZodFromSchema.js";
13
+ export { generateVersionsFromSchema } from "./utils/schema/generateVersionsFromSchema.js";
8
14
  export { generateZodFromSchema } from "./utils/schema/generateZodFromSchema.js";
9
15
  export { convertRecordDefToIr, convertSchemaToIr, convertStepsToIr, convertTypeToFieldTypeUnion, type SchemaMetadata, } from "./utils/steps/convertStepsToIr.js";
10
16
  export { generateZodFromStepsSchema } from "./utils/steps/generateZodFromStepsSchema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,cAAc,GACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EACL,+BAA+B,EAC/B,KAAK,mBAAmB,GACzB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,cAAc,GACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC"}
@@ -1,11 +1,9 @@
1
1
  import type { IModelTypeKey } from "../pack-docschema-api/modelTypeKey.js";
2
2
  import type { IFieldDef } from "./fieldDef.js";
3
- import type { ISchemaMeta } from "./schemaMeta.js";
4
3
  export interface IRecordDef {
5
4
  readonly "key": IModelTypeKey;
6
5
  readonly "name": string;
7
6
  readonly "description"?: string | null;
8
7
  readonly "fields": ReadonlyArray<IFieldDef>;
9
- readonly "metadata": ISchemaMeta;
10
8
  }
11
9
  //# sourceMappingURL=recordDef.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recordDef.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pack-docschema-api/pack-docschema-ir/recordDef.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC"}
1
+ {"version":3,"file":"recordDef.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pack-docschema-api/pack-docschema-ir/recordDef.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAC7C"}
@@ -0,0 +1,14 @@
1
+ import type { SchemaDefinition } from "@palantir/pack.schema";
2
+ export declare const singleVersionSchema: SchemaDefinition;
3
+ /** Two-version schema with field removal (color removed, fillColor + strokeColor + opacity added) */
4
+ export declare const twoVersionFieldRemovalSchema: SchemaDefinition;
5
+ export declare const twoVersionAdditiveSchema: SchemaDefinition;
6
+ export declare const refFieldsSchema: SchemaDefinition;
7
+ export declare const unionTypesSchema: SchemaDefinition;
8
+ /** Schema with nested optionals: tests that optional inside array/nested structures is preserved */
9
+ export declare const nestedOptionalsSchema: SchemaDefinition;
10
+ /** Two-version schema with derived fields (color split into fillColor + strokeColor) */
11
+ export declare const twoVersionDerivedFieldsSchema: SchemaDefinition;
12
+ /** Three-version chain: Item (name, color -> name, hexColor -> name, hexColor, tags) */
13
+ export declare const threeVersionChainSchema: SchemaDefinition;
14
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/fixtures.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAyB7E,eAAO,MAAM,mBAAmB,EAAE,gBAA4C,CAAC;AAE/E,qGAAqG;AACrG,eAAO,MAAM,4BAA4B,EAAE,gBAkB1C,CAAC;AAYF,eAAO,MAAM,wBAAwB,EAAE,gBAE7B,CAAC;AAaX,eAAO,MAAM,eAAe,EAAE,gBAY5B,CAAC;AAWH,eAAO,MAAM,gBAAgB,EAAE,gBAU7B,CAAC;AAEH,oGAAoG;AACpG,eAAO,MAAM,qBAAqB,EAAE,gBAWlC,CAAC;AAEH,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,EAAE,gBA8B3C,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,EAAE,gBAwClC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateInternalFromSchema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateInternalFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateInternalFromSchema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateModelMetadataFromSchema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateModelMetadataFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateModelMetadataFromSchema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateScopeFromSchema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateScopeFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateScopeFromSchema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateVersionedTypesFromSchema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateVersionedTypesFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateVersionedTypesFromSchema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateVersionedZodFromSchema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateVersionedZodFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateVersionedZodFromSchema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateVersionsFromSchema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateVersionsFromSchema.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/generateVersionsFromSchema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import type { InternalTypesOutput } from "../generateInternalFromSchema.js";
2
+ import type { ModelMetadataOutput } from "../generateModelMetadataFromSchema.js";
3
+ import type { VersionedTypesOutput } from "../generateVersionedTypesFromSchema.js";
4
+ import type { VersionedZodOutput } from "../generateVersionedZodFromSchema.js";
5
+ /**
6
+ * Combine a VersionedTypesOutput into a single snapshot string.
7
+ *
8
+ * Layout:
9
+ * // === types_v1.ts ===
10
+ * ...formatted code...
11
+ * // === writeTypes_v1.ts ===
12
+ * ...
13
+ * // === types.ts ===
14
+ * ...
15
+ */
16
+ export declare function formatVersionedTypesSnapshot(result: VersionedTypesOutput): Promise<string>;
17
+ /**
18
+ * Format a ModelMetadataOutput into a snapshot string.
19
+ */
20
+ export declare function formatModelMetadataSnapshot(result: ModelMetadataOutput): Promise<string>;
21
+ /**
22
+ * Format a single generated string into a snapshot.
23
+ */
24
+ export declare function formatSingleSnapshot(filename: string, code: string): Promise<string>;
25
+ /**
26
+ * Combine a VersionedZodOutput into a single snapshot string.
27
+ *
28
+ * Layout:
29
+ * // === schema_v1.ts ===
30
+ * ...formatted code...
31
+ * // === schema.ts ===
32
+ * ...
33
+ */
34
+ export declare function formatVersionedZodSnapshot(result: VersionedZodOutput): Promise<string>;
35
+ /**
36
+ * Combine an InternalTypesOutput into a single snapshot string.
37
+ *
38
+ * Layout:
39
+ * // === _internal/types.ts ===
40
+ * ...formatted code...
41
+ * // === _internal/upgrades.ts ===
42
+ * ...
43
+ * // === _internal/schema.ts ===
44
+ * ...
45
+ */
46
+ export declare function formatInternalTypesSnapshot(result: InternalTypesOutput): Promise<string>;
47
+ //# sourceMappingURL=snapshotUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotUtils.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/snapshotUtils.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAiB/E;;;;;;;;;;GAUG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAQjB"}
@@ -0,0 +1,14 @@
1
+ import type { SchemaDefinition } from "@palantir/pack.schema";
2
+ /**
3
+ * Generate the index.ts barrel export from a versioned schema.
4
+ *
5
+ * Exports:
6
+ * - `models.js` (star export — model constants and DocumentModel)
7
+ * - `types.js` (star export — latest-version type aliases)
8
+ * - `versions.js` (star export — SupportedVersions, LatestVersion, MinSupportedVersion)
9
+ * - `versionedDocRef.js` (star export — VersionedDocRef types and factory)
10
+ * - Per supported version: explicit named type exports from `types_vN.js`
11
+ * (not star exports, to avoid polluting autocomplete for read-only consumers)
12
+ */
13
+ export declare function generateIndexFromSchema(schema: SchemaDefinition, minSupportedVersion?: number): string;
14
+ //# sourceMappingURL=generateIndexFromSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateIndexFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateIndexFromSchema.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAe9D;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,gBAAgB,EACxB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAuCR"}
@@ -0,0 +1,18 @@
1
+ import type { SchemaDefinition } from "@palantir/pack.schema";
2
+ export interface InternalTypesOutput {
3
+ /** _internal/types.ts content */
4
+ internalTypes: string;
5
+ /** _internal/upgrades.ts content */
6
+ upgrades: string;
7
+ /** _internal/schema.ts content */
8
+ internalSchema: string;
9
+ }
10
+ /**
11
+ * Generate _internal/types.ts, _internal/upgrades.ts, and _internal/schema.ts
12
+ * from a versioned schema chain.
13
+ *
14
+ * @param schema - The schema definition (initial or versioned)
15
+ * @returns Object containing generated code for each internal file
16
+ */
17
+ export declare function generateInternalFromSchema(schema: SchemaDefinition): InternalTypesOutput;
18
+ //# sourceMappingURL=generateInternalFromSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateInternalFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateInternalFromSchema.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;CACxB;AAsZD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,gBAAgB,GACvB,mBAAmB,CAWrB"}
@@ -0,0 +1,15 @@
1
+ import type { SchemaDefinition } from "@palantir/pack.schema";
2
+ export interface ModelMetadataOutput {
3
+ /** models.ts content -- DocumentModel with version metadata and upgrade references */
4
+ modelsFile: string;
5
+ }
6
+ /**
7
+ * Generate models.ts and schema manifest from a versioned schema chain.
8
+ *
9
+ * @param schema - The schema definition (initial or versioned)
10
+ * @param minSupportedVersion - Minimum version this client supports (defaults to latest)
11
+ * @param options - Configuration for import paths
12
+ * @returns Object containing generated models.ts content and schema manifest JSON
13
+ */
14
+ export declare function generateModelMetadataFromSchema(schema: SchemaDefinition, minSupportedVersion?: number): ModelMetadataOutput;
15
+ //# sourceMappingURL=generateModelMetadataFromSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateModelMetadataFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateModelMetadataFromSchema.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAe9D,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;CACpB;AAsCD;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,gBAAgB,EACxB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,mBAAmB,CAmJrB"}
@@ -0,0 +1,13 @@
1
+ import type { SchemaDefinition } from "@palantir/pack.schema";
2
+ /**
3
+ * Generate versionedDocRef.ts from a versioned schema chain.
4
+ *
5
+ * Produces:
6
+ * - Per-version VersionedDocRef_vN interfaces extending DocumentRef<DocumentModel>
7
+ * - Union type VersionedDocRef = VersionedDocRef_v1 | VersionedDocRef_v2
8
+ *
9
+ * Every model gets a version-specific overload on every version so that
10
+ * write data is always typed to the exact version, not the latest.
11
+ */
12
+ export declare function generateScopeFromSchema(schema: SchemaDefinition, minSupportedVersion?: number): string;
13
+ //# sourceMappingURL=generateScopeFromSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateScopeFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateScopeFromSchema.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAc9D;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,gBAAgB,EACxB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAmIR"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateTypesFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateTypesFromSchema.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AA6KpE,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,cAAc,EAC9D,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAChB,MAAM,CA4CR"}
1
+ {"version":3,"file":"generateTypesFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateTypesFromSchema.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AA2JpE,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,cAAc,EAC9D,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAChB,MAAM,CA4CR"}