@palantir/pack.document-schema.type-gen 0.1.1 → 0.2.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/schema/__tests__/schemaToYaml.integration.test.js +4 -2
- package/build/esm/commands/schema/__tests__/schemaToYaml.integration.test.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.js +2 -0
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.js.map +1 -0
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.js +14 -0
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.js.map +1 -1
- package/build/esm/utils/generatedFileHeader.js +40 -0
- package/build/esm/utils/generatedFileHeader.js.map +1 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +53 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +2 -0
- 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 +2 -0
- 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 +5 -0
- 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 +2 -0
- 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 +9 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +17 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +2 -0
- 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 +2 -0
- 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 +2 -0
- 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 +2 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js +84 -0
- package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js.map +1 -1
- package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js +153 -0
- package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js.map +1 -1
- package/build/esm/utils/ir/generateModelsFromIr.js +17 -11
- package/build/esm/utils/ir/generateModelsFromIr.js.map +1 -1
- package/build/esm/utils/ir/generateZodSchemasFromIr.js +4 -1
- package/build/esm/utils/ir/generateZodSchemasFromIr.js.map +1 -1
- package/build/esm/utils/schema/__tests__/convertSchemaToSteps.test.js +5 -2
- package/build/esm/utils/schema/__tests__/convertSchemaToSteps.test.js.map +1 -1
- package/build/esm/utils/schema/convertSchemaToSteps.js +10 -2
- package/build/esm/utils/schema/convertSchemaToSteps.js.map +1 -1
- package/build/esm/utils/schema/generateTypesFromSchema.js +6 -4
- package/build/esm/utils/schema/generateTypesFromSchema.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/customDiscriminant.js +47 -0
- package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/customDiscriminant.js.map +1 -0
- package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/simpleSteps.js +3 -3
- package/build/esm/utils/steps/__tests__/__snapshots__/stepSchemas/simpleSteps.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 +17 -0
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -0
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
- package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js +4 -2
- package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js.map +1 -1
- package/build/esm/utils/steps/__tests__/fixtures/stepSchemas/customDiscriminant.js +47 -0
- package/build/esm/utils/steps/__tests__/fixtures/stepSchemas/customDiscriminant.js.map +1 -0
- package/build/esm/utils/steps/convertStepsToIr.js +3 -0
- package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
- package/build/esm/utils/steps/convertStepsToSchema.js +6 -7
- package/build/esm/utils/steps/convertStepsToSchema.js.map +1 -1
- package/build/esm/utils/steps/parseMigrationSteps.js +5 -5
- package/build/esm/utils/steps/parseMigrationSteps.js.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.d.ts +4 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.d.ts.map +1 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.d.ts +11 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.d.ts.map +1 -1
- package/build/types/utils/generatedFileHeader.d.ts +2 -0
- package/build/types/utils/generatedFileHeader.d.ts.map +1 -0
- package/build/types/utils/ir/generateModelsFromIr.d.ts.map +1 -1
- package/build/types/utils/ir/generateZodSchemasFromIr.d.ts.map +1 -1
- package/build/types/utils/schema/convertSchemaToSteps.d.ts.map +1 -1
- package/build/types/utils/schema/generateTypesFromSchema.d.ts.map +1 -1
- package/build/types/utils/steps/convertStepsToIr.d.ts.map +1 -1
- package/build/types/utils/steps/parseMigrationSteps.d.ts +6 -2
- package/build/types/utils/steps/parseMigrationSteps.d.ts.map +1 -1
- package/package.json +12 -13
- package/bin/cli.ts +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSteps.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["simpleSteps.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"simpleSteps.js","names":["isNodeObject","value","type","isNodeTextBox"],"sources":["simpleSteps.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.2.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":"convertStepsToIr.test.js","names":["describe","expect","it","convertStepsToIr","schema","Person","docs","fields","name","age","email","toBe","description","version","primaryModelKeys","toEqual","Object","keys","models","toHaveLength","personModel","toBeDefined","type","Error","personRecord","record","key","nameField","find","f","isOptional","toBeUndefined","value","string","ageField","double","emailField","Container","tags","numbers","containerModel","containerRecord","tagsField","array","allowNullValue","numbersField","Address","street","city","address","addressField","modelRef","modelTypes","position","x","y","ObjectNode","extends","label","objectNodeModel","objectNode","xField","yField","labelField","TextBox","text","Node","object","textBox","Graph","nodes","graphModel","graphRecord","nodesField"],"sources":["convertStepsToIr.test.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 { describe, expect, it } from \"vitest\";\nimport type { IFieldTypeUnion } from \"../../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { convertStepsToIr } from \"../convertStepsToIr.js\";\nimport type { MigrationStep } from \"../parseMigrationSteps.js\";\n\ndescribe(\"convertStepsToIr\", () => {\n it(\"should convert simple record types to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Person: {\n docs: \"A person record\",\n fields: {\n name: \"string\",\n age: \"double\",\n email: \"optional<string>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n\n expect(schema.name).toBe(\"Generated Schema\");\n expect(schema.description).toBe(\"Schema generated from migration steps\");\n expect(schema.version).toBe(1);\n expect(schema.primaryModelKeys).toEqual([\"Person\"]);\n expect(Object.keys(schema.models)).toHaveLength(1);\n\n const personModel = schema.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel?.type).toBe(\"record\");\n if (personModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const personRecord = personModel.record;\n\n expect(personRecord.key).toBe(\"Person\");\n expect(personRecord.name).toBe(\"Person\");\n expect(personRecord.description).toBe(\"A person record\");\n expect(personRecord.fields).toHaveLength(3);\n\n // Check name field\n const nameField = personRecord.fields.find(f => f.key === \"name\");\n expect(nameField).toBeDefined();\n expect(nameField?.isOptional).toBeUndefined();\n expect(nameField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"string\",\n string: {},\n },\n });\n\n // Check age field\n const ageField = personRecord.fields.find(f => f.key === \"age\");\n expect(ageField).toBeDefined();\n expect(ageField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"double\",\n double: {},\n },\n });\n\n // Check optional email field\n const emailField = personRecord.fields.find(f => f.key === \"email\");\n expect(emailField).toBeDefined();\n expect(emailField?.isOptional).toBe(true);\n expect(emailField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"string\",\n string: {},\n },\n });\n });\n\n it(\"should convert array and list types to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Container: {\n docs: \"A container with collections\",\n fields: {\n tags: \"array<string>\",\n numbers: \"list<double>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const containerModel = schema.models[\"Container\"];\n expect(containerModel).toBeDefined();\n expect(containerModel?.type).toBe(\"record\");\n if (containerModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const containerRecord = containerModel.record;\n\n // Check tags array field\n const tagsField = containerRecord.fields.find(f => f.key === \"tags\");\n expect(tagsField?.value).toEqual({\n type: \"array\",\n array: {\n allowNullValue: false,\n value: {\n type: \"string\",\n string: {},\n },\n },\n });\n\n // Check numbers list field (treated as array)\n const numbersField = containerRecord.fields.find(f => f.key === \"numbers\");\n expect(numbersField?.value).toEqual({\n type: \"array\",\n array: {\n allowNullValue: false,\n value: {\n type: \"double\",\n double: {},\n },\n },\n });\n });\n\n it(\"should convert record references to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Address: {\n fields: {\n street: \"string\",\n city: \"string\",\n },\n },\n Person: {\n fields: {\n name: \"string\",\n address: \"Address\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const personModel = schema.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel?.type).toBe(\"record\");\n if (personModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const personRecord = personModel.record;\n\n const addressField = personRecord.fields.find(f => f.key === \"address\");\n expect(addressField?.value).toEqual(\n {\n type: \"value\",\n value: {\n type: \"modelRef\",\n modelRef: {\n modelTypes: [\"Address\"],\n },\n },\n } satisfies IFieldTypeUnion,\n );\n });\n\n it(\"should handle local fragments and extends\", () => {\n const steps: MigrationStep[] = [\n {\n \"local-fragment\": {\n position: {\n x: \"double\",\n y: \"double\",\n },\n },\n },\n {\n \"add-records\": {\n ObjectNode: {\n docs: \"A node with position\",\n extends: [\"position\"],\n fields: {\n label: \"string\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const objectNodeModel = schema.models[\"ObjectNode\"];\n expect(objectNodeModel).toBeDefined();\n expect(objectNodeModel?.type).toBe(\"record\");\n if (objectNodeModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const objectNode = objectNodeModel.record;\n\n expect(objectNode.fields).toHaveLength(3);\n\n // Check inherited fields from fragment\n const xField = objectNode.fields.find(f => f.key === \"x\");\n expect(xField).toBeDefined();\n expect(xField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"double\",\n double: {},\n },\n });\n\n const yField = objectNode.fields.find(f => f.key === \"y\");\n expect(yField).toBeDefined();\n\n // Check own field\n const labelField = objectNode.fields.find(f => f.key === \"label\");\n expect(labelField).toBeDefined();\n });\n\n it(\"should convert unions to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n ObjectNode: {\n fields: {\n label: \"string\",\n },\n },\n TextBox: {\n fields: {\n text: \"string\",\n },\n },\n },\n },\n {\n \"add-union\": {\n Node: {\n object: \"ObjectNode\",\n textBox: \"TextBox\",\n },\n },\n },\n {\n \"add-records\": {\n Graph: {\n fields: {\n nodes: \"array<Node>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const graphModel = schema.models[\"Graph\"];\n if (graphModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const graphRecord = graphModel.record;\n\n const nodesField = graphRecord.fields.find(f => f.key === \"nodes\");\n expect(nodesField?.value).toEqual({\n type: \"array\",\n array: {\n allowNullValue: false,\n value: {\n type: \"modelRef\",\n modelRef: {\n modelTypes: [\"Node\"],\n },\n },\n },\n });\n });\n\n it(\"should handle modify-records step\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Person: {\n fields: {\n name: \"string\",\n },\n },\n },\n },\n {\n \"modify-records\": {\n Person: {\n \"add-fields\": {\n age: \"double\",\n email: \"optional<string>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const personModel = schema.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel?.type).toBe(\"record\");\n if (personModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const personRecord = personModel.record;\n\n expect(personRecord.fields).toHaveLength(3);\n\n // Original field\n expect(personRecord.fields.find(f => f.key === \"name\")).toBeDefined();\n\n // Added fields\n expect(personRecord.fields.find(f => f.key === \"age\")).toBeDefined();\n\n const emailField = personRecord.fields.find(f => f.key === \"email\");\n expect(emailField).toBeDefined();\n expect(emailField?.isOptional).toBe(true);\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;AAE7C,SAASC,gBAAgB,QAAQ,wBAAwB;AAGzDH,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCE,EAAE,CAAC,iDAAiD,EAAE,MAAM;IAgB1D,MAAME,MAAM,GAAGD,gBAAgB,CAfA,CAC7B;MACE,aAAa,EAAE;QACbE,MAAM,EAAE;UACNC,IAAI,EAAE,iBAAiB;UACvBC,MAAM,EAAE;YACNC,IAAI,EAAE,QAAQ;YACdC,GAAG,EAAE,QAAQ;YACbC,KAAK,EAAE;UACT;QACF;MACF;IACF,CAAC,CAGkC,CAAC;IAEtCT,MAAM,CAACG,MAAM,CAACI,IAAI,CAAC,CAACG,IAAI,CAAC,kBAAkB,CAAC;IAC5CV,MAAM,CAACG,MAAM,CAACQ,WAAW,CAAC,CAACD,IAAI,CAAC,uCAAuC,CAAC;IACxEV,MAAM,CAACG,MAAM,CAACS,OAAO,CAAC,CAACF,IAAI,CAAC,CAAC,CAAC;IAC9BV,MAAM,CAACG,MAAM,CAACU,gBAAgB,CAAC,CAACC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IACnDd,MAAM,CAACe,MAAM,CAACC,IAAI,CAACb,MAAM,CAACc,MAAM,CAAC,CAAC,CAACC,YAAY,CAAC,CAAC,CAAC;IAElD,MAAMC,WAAW,GAAGhB,MAAM,CAACc,MAAM,CAAC,QAAQ,CAAC;IAC3CjB,MAAM,CAACmB,WAAW,CAAC,CAACC,WAAW,CAAC,CAAC;IACjCpB,MAAM,CAACmB,WAA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AAW,CAACK,MAAM;IAEvCxB,MAAM,CAACuB,YAAY,CAACjB,MAAM,CAAC,CAACY,YAAY,CAAC,CAAC,CAAC;;IAE3C;IACAlB,MAAM,CAACuB,YAAY,CAACjB,MAAM,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,GAAG,KAAK,MAAM,CAAC,CAAC,CAACL,WAAW,CAAC,CAAC;;IAErE;IACApB,MAAM,CAACuB,YAAY,CAACjB,MAAM,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,GAAG,KAAK,KAAK,CAAC,CAAC,CAACL,WAAW,CAAC,CAAC;IAEpE,MAAMe,UAAU,GAAGZ,YAAY,CAACjB,MAAM,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,GAAG,KAAK,OAAO,CAAC;IACnEzB,MAAM,CAACmC,UAAU,CAAC,CAACf,WAAW,CAAC,CAAC;IAChCpB,MAAM,CAACmC,UAAU,EAAEN,UAAU,CAAC,CAACnB,IAAI,CAAC,IAAI,CAAC;EAC3C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertStepsToIr.test.js","names":["describe","expect","it","convertStepsToIr","schema","Person","docs","fields","name","age","email","toBe","description","version","primaryModelKeys","toEqual","Object","keys","models","toHaveLength","personModel","toBeDefined","type","Error","personRecord","record","key","nameField","find","f","isOptional","toBeUndefined","value","string","ageField","double","emailField","Container","tags","numbers","containerModel","containerRecord","tagsField","array","allowNullValue","numbersField","Address","street","city","address","addressField","modelRef","modelTypes","position","x","y","ObjectNode","extends","label","objectNodeModel","objectNode","xField","yField","labelField","TextBox","text","Node","variants","object","textBox","Graph","nodes","graphModel","graphRecord","nodesField"],"sources":["convertStepsToIr.test.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 { describe, expect, it } from \"vitest\";\nimport type { IFieldTypeUnion } from \"../../../lib/pack-docschema-api/pack-docschema-ir/index.js\";\nimport { convertStepsToIr } from \"../convertStepsToIr.js\";\nimport type { MigrationStep } from \"../parseMigrationSteps.js\";\n\ndescribe(\"convertStepsToIr\", () => {\n it(\"should convert simple record types to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Person: {\n docs: \"A person record\",\n fields: {\n name: \"string\",\n age: \"double\",\n email: \"optional<string>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n\n expect(schema.name).toBe(\"Generated Schema\");\n expect(schema.description).toBe(\"Schema generated from migration steps\");\n expect(schema.version).toBe(1);\n expect(schema.primaryModelKeys).toEqual([\"Person\"]);\n expect(Object.keys(schema.models)).toHaveLength(1);\n\n const personModel = schema.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel?.type).toBe(\"record\");\n if (personModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const personRecord = personModel.record;\n\n expect(personRecord.key).toBe(\"Person\");\n expect(personRecord.name).toBe(\"Person\");\n expect(personRecord.description).toBe(\"A person record\");\n expect(personRecord.fields).toHaveLength(3);\n\n // Check name field\n const nameField = personRecord.fields.find(f => f.key === \"name\");\n expect(nameField).toBeDefined();\n expect(nameField?.isOptional).toBeUndefined();\n expect(nameField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"string\",\n string: {},\n },\n });\n\n // Check age field\n const ageField = personRecord.fields.find(f => f.key === \"age\");\n expect(ageField).toBeDefined();\n expect(ageField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"double\",\n double: {},\n },\n });\n\n // Check optional email field\n const emailField = personRecord.fields.find(f => f.key === \"email\");\n expect(emailField).toBeDefined();\n expect(emailField?.isOptional).toBe(true);\n expect(emailField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"string\",\n string: {},\n },\n });\n });\n\n it(\"should convert array and list types to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Container: {\n docs: \"A container with collections\",\n fields: {\n tags: \"array<string>\",\n numbers: \"list<double>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const containerModel = schema.models[\"Container\"];\n expect(containerModel).toBeDefined();\n expect(containerModel?.type).toBe(\"record\");\n if (containerModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const containerRecord = containerModel.record;\n\n // Check tags array field\n const tagsField = containerRecord.fields.find(f => f.key === \"tags\");\n expect(tagsField?.value).toEqual({\n type: \"array\",\n array: {\n allowNullValue: false,\n value: {\n type: \"string\",\n string: {},\n },\n },\n });\n\n // Check numbers list field (treated as array)\n const numbersField = containerRecord.fields.find(f => f.key === \"numbers\");\n expect(numbersField?.value).toEqual({\n type: \"array\",\n array: {\n allowNullValue: false,\n value: {\n type: \"double\",\n double: {},\n },\n },\n });\n });\n\n it(\"should convert record references to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Address: {\n fields: {\n street: \"string\",\n city: \"string\",\n },\n },\n Person: {\n fields: {\n name: \"string\",\n address: \"Address\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const personModel = schema.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel?.type).toBe(\"record\");\n if (personModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const personRecord = personModel.record;\n\n const addressField = personRecord.fields.find(f => f.key === \"address\");\n expect(addressField?.value).toEqual(\n {\n type: \"value\",\n value: {\n type: \"modelRef\",\n modelRef: {\n modelTypes: [\"Address\"],\n },\n },\n } satisfies IFieldTypeUnion,\n );\n });\n\n it(\"should handle local fragments and extends\", () => {\n const steps: MigrationStep[] = [\n {\n \"local-fragment\": {\n position: {\n x: \"double\",\n y: \"double\",\n },\n },\n },\n {\n \"add-records\": {\n ObjectNode: {\n docs: \"A node with position\",\n extends: [\"position\"],\n fields: {\n label: \"string\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const objectNodeModel = schema.models[\"ObjectNode\"];\n expect(objectNodeModel).toBeDefined();\n expect(objectNodeModel?.type).toBe(\"record\");\n if (objectNodeModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const objectNode = objectNodeModel.record;\n\n expect(objectNode.fields).toHaveLength(3);\n\n // Check inherited fields from fragment\n const xField = objectNode.fields.find(f => f.key === \"x\");\n expect(xField).toBeDefined();\n expect(xField?.value).toEqual({\n type: \"value\",\n value: {\n type: \"double\",\n double: {},\n },\n });\n\n const yField = objectNode.fields.find(f => f.key === \"y\");\n expect(yField).toBeDefined();\n\n // Check own field\n const labelField = objectNode.fields.find(f => f.key === \"label\");\n expect(labelField).toBeDefined();\n });\n\n it(\"should convert unions to IR format\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n ObjectNode: {\n fields: {\n label: \"string\",\n },\n },\n TextBox: {\n fields: {\n text: \"string\",\n },\n },\n },\n },\n {\n \"add-union\": {\n Node: {\n variants: {\n object: \"ObjectNode\",\n textBox: \"TextBox\",\n },\n },\n },\n },\n {\n \"add-records\": {\n Graph: {\n fields: {\n nodes: \"array<Node>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const graphModel = schema.models[\"Graph\"];\n if (graphModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const graphRecord = graphModel.record;\n\n const nodesField = graphRecord.fields.find(f => f.key === \"nodes\");\n expect(nodesField?.value).toEqual({\n type: \"array\",\n array: {\n allowNullValue: false,\n value: {\n type: \"modelRef\",\n modelRef: {\n modelTypes: [\"Node\"],\n },\n },\n },\n });\n });\n\n it(\"should handle modify-records step\", () => {\n const steps: MigrationStep[] = [\n {\n \"add-records\": {\n Person: {\n fields: {\n name: \"string\",\n },\n },\n },\n },\n {\n \"modify-records\": {\n Person: {\n \"add-fields\": {\n age: \"double\",\n email: \"optional<string>\",\n },\n },\n },\n },\n ];\n\n const schema = convertStepsToIr(steps);\n const personModel = schema.models[\"Person\"];\n expect(personModel).toBeDefined();\n expect(personModel?.type).toBe(\"record\");\n if (personModel?.type !== \"record\") throw new Error(\"Expected record type\");\n const personRecord = personModel.record;\n\n expect(personRecord.fields).toHaveLength(3);\n\n // Original field\n expect(personRecord.fields.find(f => f.key === \"name\")).toBeDefined();\n\n // Added fields\n expect(personRecord.fields.find(f => f.key === \"age\")).toBeDefined();\n\n const emailField = personRecord.fields.find(f => f.key === \"email\");\n expect(emailField).toBeDefined();\n expect(emailField?.isOptional).toBe(true);\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;AAE7C,SAASC,gBAAgB,QAAQ,wBAAwB;AAGzDH,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCE,EAAE,CAAC,iDAAiD,EAAE,MAAM;IAgB1D,MAAME,MAAM,GAAGD,gBAAgB,CAfA,CAC7B;MACE,aAAa,EAAE;QACbE,MAAM,EAAE;UACNC,IAAI,EAAE,iBAAiB;UACvBC,MAAM,EAAE;YACNC,IAAI,EAAE,QAAQ;YACdC,GAAG,EAAE,QAAQ;YACbC,KAAK,EAAE;UACT;QACF;MACF;IACF,CAAC,CAGkC,CAAC;IAEtCT,MAAM,CAACG,MAAM,CAACI,IAAI,CAAC,CAACG,IAAI,CAAC,kBAAkB,CAAC;IAC5CV,MAAM,CAACG,MAAM,CAACQ,WAAW,CAAC,CAACD,IAAI,CAAC,uCAAuC,CAAC;IACxEV,MAAM,CAACG,MAAM,CAACS,OAAO,CAAC,CAACF,IAAI,CAAC,CAAC,CAAC;IAC9BV,MAAM,CAACG,MAAM,CAAC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GkC,CAAC;IACtC,MAAMU,WAAW,GAAGhB,MAAM,CAACc,MAAM,CAAC,QAAQ,CAAC;IAC3CjB,MAAM,CAACmB,WAAW,CAAC,CAACC,WAAW,CAAC,CAAC;IACjCpB,MAAM,CAACmB,WAAW,EAAEE,IAAI,CAAC,CAACX,IAAI,CAAC,QAAQ,CAAC;IACxC,IAAIS,WAAW,EAAEE,IAAI,KAAK,QAAQ,EAAE,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IAC3E,MAAMC,YAAY,GAAGJ,WAAW,CAACK,MAAM;IAEvCxB,MAAM,CAACuB,YAAY,CAACjB,MAAM,CAAC,CAACY,YAAY,CAAC,CAAC,CAAC;;IAE3C;IACAlB,MAAM,CAACuB,YAAY,CAACjB,MAAM,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,GAAG,KAAK,MAAM,CAAC,CAAC,CAACL,WAAW,CAAC,CAAC;;IAErE;IACApB,MAAM,CAACuB,YAAY,CAACjB,MAAM,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,GAAG,KAAK,KAAK,CAAC,CAAC,CAACL,WAAW,CAAC,CAAC;IAEpE,MAAMe,UAAU,GAAGZ,YAAY,CAACjB,MAAM,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,GAAG,KAAK,OAAO,CAAC;IACnEzB,MAAM,CAACmC,UAAU,CAAC,CAACf,WAAW,CAAC,CAAC;IAChCpB,MAAM,CAACmC,UAAU,EAAEN,UAAU,CAAC,CAACnB,IAAI,CAAC,IAAI,CAAC;EAC3C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const customDiscriminant = {
|
|
2
|
+
"Animal": {
|
|
3
|
+
"type": "union",
|
|
4
|
+
"name": "Animal",
|
|
5
|
+
"variants": {
|
|
6
|
+
"cat": {
|
|
7
|
+
"type": "ref",
|
|
8
|
+
"refType": "record",
|
|
9
|
+
"name": "Cat"
|
|
10
|
+
},
|
|
11
|
+
"dog": {
|
|
12
|
+
"type": "ref",
|
|
13
|
+
"refType": "record",
|
|
14
|
+
"name": "Dog"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"discriminant": "kind"
|
|
18
|
+
},
|
|
19
|
+
"Cat": {
|
|
20
|
+
"type": "record",
|
|
21
|
+
"name": "Cat",
|
|
22
|
+
"docs": "A cat",
|
|
23
|
+
"fields": {
|
|
24
|
+
"meow": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"whiskers": {
|
|
28
|
+
"type": "double"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"Dog": {
|
|
33
|
+
"type": "record",
|
|
34
|
+
"name": "Dog",
|
|
35
|
+
"docs": "A dog",
|
|
36
|
+
"fields": {
|
|
37
|
+
"bark": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"tailWags": {
|
|
41
|
+
"type": "double"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export default customDiscriminant;
|
|
47
|
+
//# sourceMappingURL=customDiscriminant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customDiscriminant.js","names":["customDiscriminant"],"sources":["customDiscriminant.ts"],"sourcesContent":["import { Schema } from \"@palantir/pack.schema\";\n\nconst customDiscriminant = {\n \"Animal\": {\n \"type\": \"union\",\n \"name\": \"Animal\",\n \"variants\": {\n \"cat\": {\n \"type\": \"ref\",\n \"refType\": \"record\",\n \"name\": \"Cat\",\n },\n \"dog\": {\n \"type\": \"ref\",\n \"refType\": \"record\",\n \"name\": \"Dog\",\n },\n },\n \"discriminant\": \"kind\",\n },\n \"Cat\": {\n \"type\": \"record\",\n \"name\": \"Cat\",\n \"docs\": \"A cat\",\n \"fields\": {\n \"meow\": {\n \"type\": \"string\",\n },\n \"whiskers\": {\n \"type\": \"double\",\n },\n },\n },\n \"Dog\": {\n \"type\": \"record\",\n \"name\": \"Dog\",\n \"docs\": \"A dog\",\n \"fields\": {\n \"bark\": {\n \"type\": \"string\",\n },\n \"tailWags\": {\n \"type\": \"double\",\n },\n },\n },\n} satisfies Schema<any>;\n\nexport default customDiscriminant;\n"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG;EACzB,QAAQ,EAAE;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE;MACV,KAAK,EAAE;QACL,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE;MACV,CAAC;MACD,KAAK,EAAE;QACL,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE;MACV;IACF,CAAC;IACD,cAAc,EAAE;EAClB,CAAC;EACD,KAAK,EAAE;IACL,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE;MACR,MAAM,EAAE;QACN,MAAM,EAAE;MACV,CAAC;MACD,UAAU,EAAE;QACV,MAAM,EAAE;MACV;IACF;EACF,CAAC;EACD,KAAK,EAAE;IACL,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE;MACR,MAAM,EAAE;QACN,MAAM,EAAE;MACV,CAAC;MACD,UAAU,EAAE;QACV,MAAM,EAAE;MACV;IACF;EACF;AACF,CAAuB;AAEvB,eAAeA,kBAAkB","ignoreList":[]}
|
|
@@ -123,6 +123,7 @@ export function convertTypeToFieldTypeUnion(schemaType) {
|
|
|
123
123
|
|
|
124
124
|
return convertTypeToFieldTypeUnion(schemaType.item);
|
|
125
125
|
}
|
|
126
|
+
case "boolean":
|
|
126
127
|
case "docRef":
|
|
127
128
|
case "double":
|
|
128
129
|
case "mediaRef":
|
|
@@ -141,6 +142,8 @@ function convertTypeToFieldValueUnion(schemaType) {
|
|
|
141
142
|
case "array":
|
|
142
143
|
// TODO: fix the argument types so these aren't possible
|
|
143
144
|
process.env.NODE_ENV !== "production" ? invariant(false, `Collection type passed to convertTypeToFieldValueUnion: ${schemaType.type}`) : invariant(false);
|
|
145
|
+
case "boolean":
|
|
146
|
+
return IFieldValueUnion.boolean({});
|
|
144
147
|
case "docRef":
|
|
145
148
|
return IFieldValueUnion.docRef({
|
|
146
149
|
documentTypeRids: [] // FIXME: confirm whether we will use rids in the deployed schema.
|
|
@@ -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","value","convertTypeToFieldTypeUnion","meta","addedIn","isOptional","docs","unionDef","variantEntries","variants","variantName","modelRef","discriminant","schemaType","array","allowNullValue","convertTypeToFieldValueUnion","items","item","docRef","documentTypeRids","double","mediaRef","mediaTypeRids","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 value: convertTypeToFieldTypeUnion(fieldType),\n meta: { addedIn: 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 meta: { addedIn: 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 meta: { addedIn: 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 \"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 \"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 mediaTypeRids: [], // FIXME: confirm whether we will use rids in the deployed schema.\n });\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,oBAA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AU,CAACzB,IAAI,EAAE,IAF9EjC,SAAS;IAKX,KAAK,QAAQ;MACX,OAAOE,gBAAgB,CAAC8D,MAAM,CAAC;QAC7BC,gBAAgB,EAAE,EAAE,CAAE;MACxB,CAAC,CAAC;IAEJ,KAAK,QAAQ;MACX,OAAO/D,gBAAgB,CAACgE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpC,KAAK,UAAU;MACb,OAAOhE,gBAAgB,CAACiE,QAAQ,CAAC;QAC/BC,aAAa,EAAE,EAAE,CAAE;MACrB,CAAC,CAAC;IAEJ,KAAK,WAAW;MACd,OAAOlE,gBAAgB,CAACmE,MAAM,CAAC;QAC7B;QACAC,iBAAiB,EAAE,EAAE;QACrBC,cAAc,EAAE;MAClB,CAAC,CAAC;IAEJ,KAAK,UAAU;MAAE;QACf;QACA;;QAEA,OAAOV,4BAA4B,CADdH,UAAU,CACkBK,IAAc,CAAC;MAClE;IAEA,KAAK,KAAK;MACR,OAAO7D,gBAAgB,CAACsD,QAAQ,CAAC;QAC/BgB,UAAU,EAAE,CAACd,UAAU,CAAC1C,IAAI;MAC9B,CAAC,CAAC;IAEJ,KAAK,QAAQ;MACX,OAAOd,gBAAgB,CAACuE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpC,KAAK,SAAS;MACZ,OAAOvE,gBAAgB,CAACwE,aAAa,CAAC,CAAC,CAAC,CAAC;IAE3C,KAAK,SAAS;MACZ,OAAOxE,gBAAgB,CAACyE,OAAO,CAAC,CAAC,CAAC,CAAC;IAErC;MACEvE,WAAW,CAACsD,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","value","convertTypeToFieldTypeUnion","meta","addedIn","isOptional","docs","unionDef","variantEntries","variants","variantName","modelRef","discriminant","schemaType","array","allowNullValue","convertTypeToFieldValueUnion","items","item","boolean","docRef","documentTypeRids","double","mediaRef","mediaTypeRids","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 value: convertTypeToFieldTypeUnion(fieldType),\n meta: { addedIn: 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 meta: { addedIn: 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 meta: { addedIn: 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 mediaTypeRids: [], // FIXME: confirm whether we will use rids in the deployed schema.\n });\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,IAAI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B,EAAE,EAAE;QACrBC,cAAc,EAAE;MAClB,CAAC,CAAC;IAEJ,KAAK,UAAU;MAAE;QACf;QACA;;QAEA,OAAOX,4BAA4B,CADdH,UAAU,CACkBK,IAAc,CAAC;MAClE;IAEA,KAAK,KAAK;MACR,OAAO7D,gBAAgB,CAACsD,QAAQ,CAAC;QAC/BiB,UAAU,EAAE,CAACf,UAAU,CAAC1C,IAAI;MAC9B,CAAC,CAAC;IAEJ,KAAK,QAAQ;MACX,OAAOd,gBAAgB,CAACwE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpC,KAAK,SAAS;MACZ,OAAOxE,gBAAgB,CAACyE,aAAa,CAAC,CAAC,CAAC,CAAC;IAE3C,KAAK,SAAS;MACZ,OAAOzE,gBAAgB,CAAC0E,OAAO,CAAC,CAAC,CAAC,CAAC;IAErC;MACExE,WAAW,CAACsD,UAAU,CAAC;EAC3B;AACF","ignoreList":[]}
|
|
@@ -50,10 +50,9 @@ export function convertStepsToSchema(steps) {
|
|
|
50
50
|
if ("add-union" in step) {
|
|
51
51
|
const addUnion = step["add-union"];
|
|
52
52
|
for (const [unionKey, unionDef] of Object.entries(addUnion)) {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const discriminant = unionDef.discriminant ?? "type";
|
|
55
54
|
const variants = {};
|
|
56
|
-
for (const [typeKey, recordKey] of Object.entries(unionDef)) {
|
|
55
|
+
for (const [typeKey, recordKey] of Object.entries(unionDef.variants)) {
|
|
57
56
|
const recordDef = recordDefinitionsByName[recordKey];
|
|
58
57
|
if (!recordDef) {
|
|
59
58
|
throw new Error(`Record ${recordKey} not found`);
|
|
@@ -61,11 +60,11 @@ export function convertStepsToSchema(steps) {
|
|
|
61
60
|
variants[typeKey] = modelToRef(recordDef);
|
|
62
61
|
}
|
|
63
62
|
unionDefinitionsByName[unionKey] = {
|
|
64
|
-
|
|
63
|
+
discriminant,
|
|
64
|
+
docs: undefined,
|
|
65
65
|
name: unionKey,
|
|
66
|
-
|
|
67
|
-
variants
|
|
68
|
-
discriminant: "type"
|
|
66
|
+
type: "union",
|
|
67
|
+
variants
|
|
69
68
|
};
|
|
70
69
|
}
|
|
71
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertStepsToSchema.js","names":["modelToRef","convertStepsToSchema","steps","localFragmentsByName","recordDefinitionsByName","unionDefinitionsByName","step","localFragment","Object","assign","addRecords","recordKey","recordDef","entries","recordFields","localFragmentName","extends","fieldKey","fieldDefinition","fields","recordFieldsAsSchemaType","recordFieldDefinitionToSchemaType","type","name","docs","addUnion","unionKey","unionDef","variants","typeKey","Error","discriminant","modifyRecords","modifyRecord","recordDefinitions","values","unionDefinitions","recordFieldDefinition","arrayMatch","match","innerType","items","optionalMatch","item","charAt","toUpperCase","refType","JSON","stringify"],"sources":["convertStepsToSchema.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 {\n modelToRef,\n type RecordDef,\n type Ref,\n type Type,\n type UnionDef,\n} from \"@palantir/pack.schema\";\nimport type { MigrationStep, RecordFieldDefinition } from \"./parseMigrationSteps.js\";\n\nexport function convertStepsToSchema(steps: MigrationStep[]): {\n recordDefinitions: RecordDef[];\n unionDefinitions: UnionDef[];\n} {\n const localFragmentsByName: Record<string, Record<string, string>> = {};\n const recordDefinitionsByName: Record<string, RecordDef> = {};\n const unionDefinitionsByName: Record<string, UnionDef> = {};\n\n for (const step of steps) {\n if (\"local-fragment\" in step) {\n const localFragment = step[\"local-fragment\"]!;\n Object.assign(localFragmentsByName, localFragment);\n }\n\n const addRecords = step[\"add-records\"];\n if (addRecords) {\n for (const [recordKey, recordDef] of Object.entries(addRecords)) {\n const recordFields: Record<string, RecordFieldDefinition> = {};\n for (const localFragmentName of recordDef.extends ?? []) {\n const localFragment = localFragmentsByName[localFragmentName];\n Object.assign(recordFields, localFragment);\n }\n for (const [fieldKey, fieldDefinition] of Object.entries(recordDef.fields)) {\n recordFields[fieldKey] = fieldDefinition;\n }\n\n const recordFieldsAsSchemaType: Record<string, Type> = {};\n for (const [fieldKey, fieldDefinition] of Object.entries(recordFields)) {\n recordFieldsAsSchemaType[fieldKey] = recordFieldDefinitionToSchemaType(fieldDefinition);\n }\n\n recordDefinitionsByName[recordKey] = {\n type: \"record\",\n name: recordKey,\n fields: recordFieldsAsSchemaType,\n docs: recordDef.docs,\n };\n }\n }\n\n if (\"add-union\" in step) {\n const addUnion = step[\"add-union\"]!;\n for (const [unionKey, unionDef] of Object.entries(addUnion)) {\n // unionDef is a map from typeKey to recordKey (i.e. {\"object\" -> \"ObjectNode\"} implies { type: \"object\", ...ObjectNode })\n\n const variants: Record<string, Ref> = {};\n for (const [typeKey, recordKey] of Object.entries(unionDef)) {\n const recordDef = recordDefinitionsByName[recordKey];\n if (!recordDef) {\n throw new Error(`Record ${recordKey} not found`);\n }\n variants[typeKey] = modelToRef(recordDef);\n }\n\n unionDefinitionsByName[unionKey] = {\n type: \"union\",\n name: unionKey,\n docs: unionDef.docs,\n variants,\n discriminant: \"type\",\n };\n }\n }\n\n if (\"modify-records\" in step) {\n const modifyRecords = step[\"modify-records\"]!;\n for (const [recordKey, modifyRecord] of Object.entries(modifyRecords)) {\n const recordDef = recordDefinitionsByName[recordKey];\n if (!recordDef) {\n throw new Error(`Record ${recordKey} not found`);\n }\n for (const [fieldKey, fieldDefinition] of Object.entries(modifyRecord[\"add-fields\"])) {\n recordDef.fields[fieldKey] = recordFieldDefinitionToSchemaType(fieldDefinition);\n }\n }\n }\n }\n\n return {\n recordDefinitions: Object.values(recordDefinitionsByName),\n unionDefinitions: Object.values(unionDefinitionsByName),\n };\n}\n\nfunction recordFieldDefinitionToSchemaType(\n recordFieldDefinition: RecordFieldDefinition,\n): Type {\n if (typeof recordFieldDefinition === \"string\") {\n // Basic types\n if (recordFieldDefinition === \"docRef\") {\n return { type: \"docRef\" };\n }\n if (recordFieldDefinition === \"double\") {\n return { type: \"double\" };\n }\n if (recordFieldDefinition === \"mediaRef\") {\n return { type: \"mediaRef\" };\n }\n if (recordFieldDefinition === \"objectRef\") {\n return { type: \"objectRef\" };\n }\n if (recordFieldDefinition === \"string\") {\n return { type: \"string\" };\n }\n if (recordFieldDefinition === \"userRef\") {\n return { type: \"userRef\" };\n }\n\n // Array types - e.g., \"array<string>\", \"list<double>\"\n const arrayMatch = recordFieldDefinition.match(/^(?:array|list)<(.+)>$/);\n if (arrayMatch?.[1]) {\n const innerType = recordFieldDefinitionToSchemaType(arrayMatch[1]);\n return { type: \"array\", items: innerType };\n }\n\n // Optional types - e.g., \"optional<string>\"\n const optionalMatch = recordFieldDefinition.match(/^optional<(.+)>$/);\n if (optionalMatch?.[1]) {\n const innerType = recordFieldDefinitionToSchemaType(optionalMatch[1]);\n return { type: \"optional\", item: innerType };\n }\n\n // Capitalized names are assumed to be references to other records or unions\n if (\n recordFieldDefinition.charAt(0)\n === recordFieldDefinition.charAt(0).toUpperCase()\n ) {\n return {\n type: \"ref\",\n refType: \"record\", // Could be union, but we assume record for now\n name: recordFieldDefinition,\n };\n }\n }\n throw new Error(\n \"Invalid record field definition \" + JSON.stringify(recordFieldDefinition),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,UAAU,QAKL,uBAAuB;AAG9B,OAAO,SAASC,oBAAoBA,CAACC,KAAsB,EAGzD;EACA,MAAMC,oBAA4D,GAAG,CAAC,CAAC;EACvE,MAAMC,uBAAkD,GAAG,CAAC,CAAC;EAC7D,MAAMC,sBAA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F,SAAS,GAAGnB,iCAAiC,CAACqB,aAAa,CAAC,CAAC,CAAC,CAAC;MACrE,OAAO;QAAEpB,IAAI,EAAE,UAAU;QAAEqB,IAAI,EAAEH;MAAU,CAAC;IAC9C;;IAEA;IACA,IACEH,qBAAqB,CAACO,MAAM,CAAC,CAAC,CAAC,KACzBP,qBAAqB,CAACO,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,EACnD;MACA,OAAO;QACLvB,IAAI,EAAE,KAAK;QACXwB,OAAO,EAAE,QAAQ;QAAE;QACnBvB,IAAI,EAAEc;MACR,CAAC;IACH;EACF;EACA,MAAM,IAAIP,KAAK,CACb,kCAAkC,GAAGiB,IAAI,CAACC,SAAS,CAACX,qBAAqB,CAC3E,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertStepsToSchema.js","names":["modelToRef","convertStepsToSchema","steps","localFragmentsByName","recordDefinitionsByName","unionDefinitionsByName","step","localFragment","Object","assign","addRecords","recordKey","recordDef","entries","recordFields","localFragmentName","extends","fieldKey","fieldDefinition","fields","recordFieldsAsSchemaType","recordFieldDefinitionToSchemaType","type","name","docs","addUnion","unionKey","unionDef","discriminant","variants","typeKey","Error","undefined","modifyRecords","modifyRecord","recordDefinitions","values","unionDefinitions","recordFieldDefinition","arrayMatch","match","innerType","items","optionalMatch","item","charAt","toUpperCase","refType","JSON","stringify"],"sources":["convertStepsToSchema.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 {\n modelToRef,\n type RecordDef,\n type Ref,\n type Type,\n type UnionDef,\n} from \"@palantir/pack.schema\";\nimport type { MigrationStep, RecordFieldDefinition } from \"./parseMigrationSteps.js\";\n\nexport function convertStepsToSchema(steps: MigrationStep[]): {\n recordDefinitions: RecordDef[];\n unionDefinitions: UnionDef[];\n} {\n const localFragmentsByName: Record<string, Record<string, string>> = {};\n const recordDefinitionsByName: Record<string, RecordDef> = {};\n const unionDefinitionsByName: Record<string, UnionDef> = {};\n\n for (const step of steps) {\n if (\"local-fragment\" in step) {\n const localFragment = step[\"local-fragment\"]!;\n Object.assign(localFragmentsByName, localFragment);\n }\n\n const addRecords = step[\"add-records\"];\n if (addRecords) {\n for (const [recordKey, recordDef] of Object.entries(addRecords)) {\n const recordFields: Record<string, RecordFieldDefinition> = {};\n for (const localFragmentName of recordDef.extends ?? []) {\n const localFragment = localFragmentsByName[localFragmentName];\n Object.assign(recordFields, localFragment);\n }\n for (const [fieldKey, fieldDefinition] of Object.entries(recordDef.fields)) {\n recordFields[fieldKey] = fieldDefinition;\n }\n\n const recordFieldsAsSchemaType: Record<string, Type> = {};\n for (const [fieldKey, fieldDefinition] of Object.entries(recordFields)) {\n recordFieldsAsSchemaType[fieldKey] = recordFieldDefinitionToSchemaType(fieldDefinition);\n }\n\n recordDefinitionsByName[recordKey] = {\n type: \"record\",\n name: recordKey,\n fields: recordFieldsAsSchemaType,\n docs: recordDef.docs,\n };\n }\n }\n\n if (\"add-union\" in step) {\n const addUnion = step[\"add-union\"]!;\n for (const [unionKey, unionDef] of Object.entries(addUnion)) {\n const discriminant = unionDef.discriminant ?? \"type\";\n\n const variants: Record<string, Ref> = {};\n for (const [typeKey, recordKey] of Object.entries(unionDef.variants)) {\n const recordDef = recordDefinitionsByName[recordKey];\n if (!recordDef) {\n throw new Error(`Record ${recordKey} not found`);\n }\n variants[typeKey] = modelToRef(recordDef);\n }\n\n unionDefinitionsByName[unionKey] = {\n discriminant,\n docs: undefined,\n name: unionKey,\n type: \"union\",\n variants,\n };\n }\n }\n\n if (\"modify-records\" in step) {\n const modifyRecords = step[\"modify-records\"]!;\n for (const [recordKey, modifyRecord] of Object.entries(modifyRecords)) {\n const recordDef = recordDefinitionsByName[recordKey];\n if (!recordDef) {\n throw new Error(`Record ${recordKey} not found`);\n }\n for (const [fieldKey, fieldDefinition] of Object.entries(modifyRecord[\"add-fields\"])) {\n recordDef.fields[fieldKey] = recordFieldDefinitionToSchemaType(fieldDefinition);\n }\n }\n }\n }\n\n return {\n recordDefinitions: Object.values(recordDefinitionsByName),\n unionDefinitions: Object.values(unionDefinitionsByName),\n };\n}\n\nfunction recordFieldDefinitionToSchemaType(\n recordFieldDefinition: RecordFieldDefinition,\n): Type {\n if (typeof recordFieldDefinition === \"string\") {\n // Basic types\n if (recordFieldDefinition === \"docRef\") {\n return { type: \"docRef\" };\n }\n if (recordFieldDefinition === \"double\") {\n return { type: \"double\" };\n }\n if (recordFieldDefinition === \"mediaRef\") {\n return { type: \"mediaRef\" };\n }\n if (recordFieldDefinition === \"objectRef\") {\n return { type: \"objectRef\" };\n }\n if (recordFieldDefinition === \"string\") {\n return { type: \"string\" };\n }\n if (recordFieldDefinition === \"userRef\") {\n return { type: \"userRef\" };\n }\n\n // Array types - e.g., \"array<string>\", \"list<double>\"\n const arrayMatch = recordFieldDefinition.match(/^(?:array|list)<(.+)>$/);\n if (arrayMatch?.[1]) {\n const innerType = recordFieldDefinitionToSchemaType(arrayMatch[1]);\n return { type: \"array\", items: innerType };\n }\n\n // Optional types - e.g., \"optional<string>\"\n const optionalMatch = recordFieldDefinition.match(/^optional<(.+)>$/);\n if (optionalMatch?.[1]) {\n const innerType = recordFieldDefinitionToSchemaType(optionalMatch[1]);\n return { type: \"optional\", item: innerType };\n }\n\n // Capitalized names are assumed to be references to other records or unions\n if (\n recordFieldDefinition.charAt(0)\n === recordFieldDefinition.charAt(0).toUpperCase()\n ) {\n return {\n type: \"ref\",\n refType: \"record\", // Could be union, but we assume record for now\n name: recordFieldDefinition,\n };\n }\n }\n throw new Error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GD,qBAAqB,CAACE,KAAK,CAAC,wBAAwB,CAAC;IACxE,IAAID,UAAU,GAAG,CAAC,CAAC,EAAE;MACnB,MAAME,SAAS,GAAGpB,iCAAiC,CAACkB,UAAU,CAAC,CAAC,CAAC,CAAC;MAClE,OAAO;QAAEjB,IAAI,EAAE,OAAO;QAAEoB,KAAK,EAAED;MAAU,CAAC;IAC5C;;IAEA;IACA,MAAME,aAAa,GAAGL,qBAAqB,CAACE,KAAK,CAAC,kBAAkB,CAAC;IACrE,IAAIG,aAAa,GAAG,CAAC,CAAC,EAAE;MACtB,MAAMF,SAAS,GAAGpB,iCAAiC,CAACsB,aAAa,CAAC,CAAC,CAAC,CAAC;MACrE,OAAO;QAAErB,IAAI,EAAE,UAAU;QAAEsB,IAAI,EAAEH;MAAU,CAAC;IAC9C;;IAEA;IACA,IACEH,qBAAqB,CAACO,MAAM,CAAC,CAAC,CAAC,KACzBP,qBAAqB,CAACO,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,EACnD;MACA,OAAO;QACLxB,IAAI,EAAE,KAAK;QACXyB,OAAO,EAAE,QAAQ;QAAE;QACnBxB,IAAI,EAAEe;MACR,CAAC;IACH;EACF;EACA,MAAM,IAAIP,KAAK,CACb,kCAAkC,GAAGiB,IAAI,CAACC,SAAS,CAACX,qBAAqB,CAC3E,CAAC;AACH","ignoreList":[]}
|
|
@@ -58,13 +58,13 @@ z.object({
|
|
|
58
58
|
extends: z.array(z.string()).optional(),
|
|
59
59
|
fields: z.record(recordFieldKey, recordFieldDefinition)
|
|
60
60
|
}));
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const unionDefinition = z.object({
|
|
62
|
+
discriminant: z.string().optional(),
|
|
63
|
+
variants: z.record(z.string(), z.string().regex(/^[A-Z][a-zA-Z0-9]*$/))
|
|
64
|
+
});
|
|
64
65
|
const addUnion = z.record(z.string().regex(/^[A-Z][a-zA-Z0-9]*$/),
|
|
65
66
|
// Union names must be capitalized
|
|
66
|
-
|
|
67
|
-
);
|
|
67
|
+
unionDefinition);
|
|
68
68
|
const modifyRecords = z.record(z.string().regex(/^[A-Z][a-zA-Z0-9]*$/),
|
|
69
69
|
// Record names must be capitalized
|
|
70
70
|
z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseMigrationSteps.js","names":["z","primitiveType","enum","genericTypePattern","string","regex","message","typeReference","basicType","union","complexFieldDefinition","object","type","docs","optional","recordFieldDefinition","recordFieldKey","fragmentKey","localFragment","record","addRecords","extends","array","fields","addUnion","modifyRecords","migrationStep","migrationStepsSchema","parseMigrationSteps","unparsed","parsed","parse"],"sources":["parseMigrationSteps.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 z from \"zod\";\n\n// Type definitions for the migration steps\n// Note: These match the YAML syntax, not the P.Type objects\n// Only \"string\" and \"double\" are valid primitives in P.TypeKind\ntype PrimitiveType = \"string\" | \"double\";\n\ninterface ComplexFieldDefinition {\n type: string; // Can be primitive, generic pattern, or type reference\n docs?: string;\n}\n\n// RecordFieldDefinition represents the YAML field values\n// Can be: \"string\", \"double\", \"optional<T>\", \"list<T>\", \"ObjectNode\", or a complex definition\ntype RecordFieldDefinition = string | ComplexFieldDefinition;\n\ninterface RecordDefinition {\n docs?: string;\n extends?: string[];\n fields: Record<string, RecordFieldDefinition>;\n}\n\ninterface MigrationStep {\n \"local-fragment\"?: Record<string, Record<string, RecordFieldDefinition>>;\n \"add-records\"?: Record<string, RecordDefinition>;\n \"add-union\"?: Record<string,
|
|
1
|
+
{"version":3,"file":"parseMigrationSteps.js","names":["z","primitiveType","enum","genericTypePattern","string","regex","message","typeReference","basicType","union","complexFieldDefinition","object","type","docs","optional","recordFieldDefinition","recordFieldKey","fragmentKey","localFragment","record","addRecords","extends","array","fields","unionDefinition","discriminant","variants","addUnion","modifyRecords","migrationStep","migrationStepsSchema","parseMigrationSteps","unparsed","parsed","parse"],"sources":["parseMigrationSteps.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 z from \"zod\";\n\n// Type definitions for the migration steps\n// Note: These match the YAML syntax, not the P.Type objects\n// Only \"string\" and \"double\" are valid primitives in P.TypeKind\ntype PrimitiveType = \"string\" | \"double\";\n\ninterface ComplexFieldDefinition {\n type: string; // Can be primitive, generic pattern, or type reference\n docs?: string;\n}\n\n// RecordFieldDefinition represents the YAML field values\n// Can be: \"string\", \"double\", \"optional<T>\", \"list<T>\", \"ObjectNode\", or a complex definition\ntype RecordFieldDefinition = string | ComplexFieldDefinition;\n\ninterface RecordDefinition {\n docs?: string;\n extends?: string[];\n fields: Record<string, RecordFieldDefinition>;\n}\n\ninterface UnionDefinition {\n discriminant?: string;\n variants: Record<string, string>;\n}\n\ninterface MigrationStep {\n \"local-fragment\"?: Record<string, Record<string, RecordFieldDefinition>>;\n \"add-records\"?: Record<string, RecordDefinition>;\n \"add-union\"?: Record<string, UnionDefinition>;\n \"modify-records\"?: Record<string, { \"add-fields\": Record<string, RecordFieldDefinition> }>;\n}\n\n// Define allowed primitive types (matching TypeKind from document-schema-api)\nconst primitiveType: z.ZodType<PrimitiveType> = z.enum([\"string\", \"double\"]);\n\n// Define generic type patterns like \"optional<T>\", \"list<T>\", \"array<T>\"\nconst genericTypePattern: z.ZodType<string> = z\n .string()\n .regex(/^(optional|list|array|set|map)<[^<>]+>$/, {\n message: \"Invalid generic type pattern\",\n });\n\n// Reference to other record/union types (capitalized names)\nconst typeReference: z.ZodType<string> = z.string().regex(/^[A-Z][a-zA-Z0-9]*$/, {\n message: \"Type references must be capitalized\",\n});\n\nconst basicType: z.ZodType<string> = z.union([primitiveType, genericTypePattern]);\n\n// Complex field definition object (for future extensibility)\nconst complexFieldDefinition: z.ZodType<ComplexFieldDefinition> = z.object({\n type: basicType,\n docs: z.string().optional(),\n // This can be extended with e.g. constraints like min/max value or length, in the future\n});\n\n// Union of all allowed field definition types - more specific than just z.string()\nconst recordFieldDefinition: z.ZodType<RecordFieldDefinition> = z.union([\n primitiveType,\n genericTypePattern,\n typeReference,\n complexFieldDefinition,\n]);\n\n// Keep as simple strings for now to maintain compatibility with existing code\nconst recordFieldKey = z.string(); // TODO: could be improved w/ regex if we want to control format\nconst fragmentKey = z.string();\n\nconst localFragment: z.ZodType<Record<string, Record<string, RecordFieldDefinition>>> = z\n .record(\n fragmentKey,\n z.record(recordFieldKey, recordFieldDefinition),\n );\nconst addRecords: z.ZodType<Record<string, RecordDefinition>> = z.record(\n z.string().regex(/^[A-Z][a-zA-Z0-9]*$/), // Keys must be capitalized type names\n z.object({\n docs: z.optional(z.string()),\n extends: z.array(z.string()).optional(),\n fields: z.record(recordFieldKey, recordFieldDefinition),\n }),\n);\n\nconst unionDefinition: z.ZodType<UnionDefinition> = z.object({\n discriminant: z.string().optional(),\n variants: z.record(z.string(), z.string().regex(/^[A-Z][a-zA-Z0-9]*$/)),\n});\n\nconst addUnion: z.ZodType<Record<string, UnionDefinition>> = z.record(\n z.string().regex(/^[A-Z][a-zA-Z0-9]*$/), // Union names must be capitalized\n unionDefinition,\n);\n\nconst modifyRecords: z.ZodType<\n Record<string, { \"add-fields\": Record<string, RecordFieldDefinition> }>\n> = z.record(\n z.string().regex(/^[A-Z][a-zA-Z0-9]*$/), // Record names must be capitalized\n z.object({\n \"add-fields\": z.record(recordFieldKey, recordFieldDefinition),\n }),\n);\n\nconst migrationStep: z.ZodType<MigrationStep> = z.object({\n \"local-fragment\": z.optional(localFragment),\n \"add-records\": z.optional(addRecords),\n \"add-union\": z.optional(addUnion),\n \"modify-records\": z.optional(modifyRecords),\n});\n\nconst migrationStepsSchema: z.ZodType<MigrationStep[]> = z.array(migrationStep);\n\nexport type { MigrationStep, RecordFieldDefinition, UnionDefinition };\n\nexport function parseMigrationSteps(unparsed: unknown): MigrationStep[] {\n const parsed = migrationStepsSchema.parse(unparsed);\n return parsed;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,CAAC,MAAM,KAAK;;AAEnB;AACA;AACA;;AAQA;AACA;;AAqBA;AACA,MAAMC,aAAuC,GAAGD,CAAC,CAACE,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;;AAE5E;AACA,MAAMC,kBAAqC,GAAGH,CAAC,CAC5CI,MAAM,CAAC,CAAC,CACRC,KAAK,CAAC,yCAAyC,EAAE;EAChDC,OAAO,EAAE;AACX,CAAC,CAAC;;AAEJ;AACA,MAAMC,aAAgC,GAAGP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,KAAK,CAAC,qBAAqB,EAAE;EAC/EC,OAAO,EAAE;AACX,CAAC,CAAC;AAEF,MAAME,SAA4B,GAAGR,CAAC,CAACS,KAAK,CAAC,CAACR,aAAa,EAAEE,kBAAkB,CAAC,CAAC;;AAEjF;AACA,MAAMO,sBAAyD,GAAGV,CAAC,CAACW,MAAM,CAAC;EACzEC,IAAI,EAAEJ,SAAS;EACfK,IAAI,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC,CAACU,QAAQ,CA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CAAC,CAACC,KAAK,CAAC,qBAAqB,CAAC;AAAE;AACzCmB,eACF,CAAC;AAED,MAAMI,aAEL,GAAG5B,CAAC,CAACmB,MAAM,CACVnB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,KAAK,CAAC,qBAAqB,CAAC;AAAE;AACzCL,CAAC,CAACW,MAAM,CAAC;EACP,YAAY,EAAEX,CAAC,CAACmB,MAAM,CAACH,cAAc,EAAED,qBAAqB;AAC9D,CAAC,CACH,CAAC;AAED,MAAMc,aAAuC,GAAG7B,CAAC,CAACW,MAAM,CAAC;EACvD,gBAAgB,EAAEX,CAAC,CAACc,QAAQ,CAACI,aAAa,CAAC;EAC3C,aAAa,EAAElB,CAAC,CAACc,QAAQ,CAACM,UAAU,CAAC;EACrC,WAAW,EAAEpB,CAAC,CAACc,QAAQ,CAACa,QAAQ,CAAC;EACjC,gBAAgB,EAAE3B,CAAC,CAACc,QAAQ,CAACc,aAAa;AAC5C,CAAC,CAAC;AAEF,MAAME,oBAAgD,GAAG9B,CAAC,CAACsB,KAAK,CAACO,aAAa,CAAC;AAI/E,OAAO,SAASE,mBAAmBA,CAACC,QAAiB,EAAmB;EACtE,MAAMC,MAAM,GAAGH,oBAAoB,CAACI,KAAK,CAACF,QAAQ,CAAC;EACnD,OAAOC,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldValueBoolean.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pack-docschema-api/pack-docschema-ir/fieldValueBoolean.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IFieldValueBoolean } from "./fieldValueBoolean.js";
|
|
1
2
|
import type { IFieldValueDatetime } from "./fieldValueDatetime.js";
|
|
2
3
|
import type { IFieldValueDocumentRef } from "./fieldValueDocumentRef.js";
|
|
3
4
|
import type { IFieldValueDouble } from "./fieldValueDouble.js";
|
|
@@ -9,6 +10,10 @@ import type { IFieldValueString } from "./fieldValueString.js";
|
|
|
9
10
|
import type { IFieldValueText } from "./fieldValueText.js";
|
|
10
11
|
import type { IFieldValueUnmanagedJson } from "./fieldValueUnmanagedJson.js";
|
|
11
12
|
import type { IFieldValueUserRef } from "./fieldValueUserRef.js";
|
|
13
|
+
export interface IFieldValueUnion_Boolean {
|
|
14
|
+
readonly "boolean": IFieldValueBoolean;
|
|
15
|
+
readonly "type": "boolean";
|
|
16
|
+
}
|
|
12
17
|
export interface IFieldValueUnion_Datetime {
|
|
13
18
|
readonly "datetime": IFieldValueDatetime;
|
|
14
19
|
readonly "type": "datetime";
|
|
@@ -53,8 +58,9 @@ export interface IFieldValueUnion_UserRef {
|
|
|
53
58
|
readonly "userRef": IFieldValueUserRef;
|
|
54
59
|
readonly "type": "userRef";
|
|
55
60
|
}
|
|
56
|
-
export type IFieldValueUnion = IFieldValueUnion_Datetime | IFieldValueUnion_DocRef | IFieldValueUnion_Double | IFieldValueUnion_Integer | IFieldValueUnion_MediaRef | IFieldValueUnion_ModelRef | IFieldValueUnion_Object | IFieldValueUnion_String | IFieldValueUnion_Text | IFieldValueUnion_UnmanagedJson | IFieldValueUnion_UserRef;
|
|
61
|
+
export type IFieldValueUnion = IFieldValueUnion_Boolean | IFieldValueUnion_Datetime | IFieldValueUnion_DocRef | IFieldValueUnion_Double | IFieldValueUnion_Integer | IFieldValueUnion_MediaRef | IFieldValueUnion_ModelRef | IFieldValueUnion_Object | IFieldValueUnion_String | IFieldValueUnion_Text | IFieldValueUnion_UnmanagedJson | IFieldValueUnion_UserRef;
|
|
57
62
|
export interface IFieldValueUnionVisitor<T> {
|
|
63
|
+
readonly "boolean": (obj: IFieldValueBoolean) => T;
|
|
58
64
|
readonly "datetime": (obj: IFieldValueDatetime) => T;
|
|
59
65
|
readonly "docRef": (obj: IFieldValueDocumentRef) => T;
|
|
60
66
|
readonly "double": (obj: IFieldValueDouble) => T;
|
|
@@ -68,6 +74,8 @@ export interface IFieldValueUnionVisitor<T> {
|
|
|
68
74
|
readonly "userRef": (obj: IFieldValueUserRef) => T;
|
|
69
75
|
readonly "unknown": (obj: IFieldValueUnion) => T;
|
|
70
76
|
}
|
|
77
|
+
declare function isBoolean(obj: IFieldValueUnion): obj is IFieldValueUnion_Boolean;
|
|
78
|
+
declare function boolean(obj: IFieldValueBoolean): IFieldValueUnion_Boolean;
|
|
71
79
|
declare function isDatetime(obj: IFieldValueUnion): obj is IFieldValueUnion_Datetime;
|
|
72
80
|
declare function datetime(obj: IFieldValueDatetime): IFieldValueUnion_Datetime;
|
|
73
81
|
declare function isDocRef(obj: IFieldValueUnion): obj is IFieldValueUnion_DocRef;
|
|
@@ -92,6 +100,8 @@ declare function isUserRef(obj: IFieldValueUnion): obj is IFieldValueUnion_UserR
|
|
|
92
100
|
declare function userRef(obj: IFieldValueUserRef): IFieldValueUnion_UserRef;
|
|
93
101
|
declare function visit<T>(obj: IFieldValueUnion, visitor: IFieldValueUnionVisitor<T>): T;
|
|
94
102
|
export declare const IFieldValueUnion: {
|
|
103
|
+
isBoolean: typeof isBoolean;
|
|
104
|
+
boolean: typeof boolean;
|
|
95
105
|
isDatetime: typeof isDatetime;
|
|
96
106
|
datetime: typeof datetime;
|
|
97
107
|
isDocRef: typeof isDocRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueUnion.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pack-docschema-api/pack-docschema-ir/fieldValueUnion.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,w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":"","sources":["../../../src/utils/generatedFileHeader.ts"],"names":[],"mappings":"AAyCA,eAAO,MAAM,qBAAqB,EAAE,MAA2D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateModelsFromIr.d.ts","sourceRoot":"","sources":["../../../../src/utils/ir/generateModelsFromIr.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"generateModelsFromIr.d.ts","sourceRoot":"","sources":["../../../../src/utils/ir/generateModelsFromIr.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAIvG,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,MAAM,EAAE,uBAAuB,EAC/B,OAAO,GAAE,qBAAqB,GAAG,SAAqB;IAGlE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAyDxC,OAAO,CAAC,sBAAsB;IAuC9B,OAAO,CAAC,qBAAqB;IAkC7B,OAAO,CAAC,4BAA4B;IAyBpC,OAAO,CAAC,sBAAsB;CAqC/B;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateZodSchemasFromIr.d.ts","sourceRoot":"","sources":["../../../../src/utils/ir/generateZodSchemasFromIr.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAKV,uBAAuB,EAGxB,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"generateZodSchemasFromIr.d.ts","sourceRoot":"","sources":["../../../../src/utils/ir/generateZodSchemasFromIr.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAKV,uBAAuB,EAGxB,MAAM,yDAAyD,CAAC;AAKjE,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA6WD,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertSchemaToSteps.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/convertSchemaToSteps.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"convertSchemaToSteps.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/convertSchemaToSteps.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,2BAA2B,CAAC;AAqEnD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,cAAc,GAAG,aAAa,EAAE,CA2B9E;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CASvE"}
|
|
@@ -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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertStepsToIr.d.ts","sourceRoot":"","sources":["../../../../src/utils/steps/convertStepsToIr.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAMhD,OAAO,KAAK,EAEV,uBAAuB,EACvB,UAAU,EACV,SAAS,EACV,MAAM,yDAAyD,CAAC;AACjE,OAAO,EACL,eAAe,EAGhB,MAAM,yDAAyD,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,QAAQ,CAAC,EAAE,cAAc,GACxB,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,GACxB,uBAAuB,CAiBzB;AAyBD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,UAAU,CAiBvE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,GAAG,SAAS,CAkBnE;AAGD,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"convertStepsToIr.d.ts","sourceRoot":"","sources":["../../../../src/utils/steps/convertStepsToIr.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAMhD,OAAO,KAAK,EAEV,uBAAuB,EACvB,UAAU,EACV,SAAS,EACV,MAAM,yDAAyD,CAAC;AACjE,OAAO,EACL,eAAe,EAGhB,MAAM,yDAAyD,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,QAAQ,CAAC,EAAE,cAAc,GACxB,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,GACxB,uBAAuB,CAiBzB;AAyBD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,UAAU,CAiBvE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,GAAG,SAAS,CAkBnE;AAGD,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,GAAG,eAAe,CA+B/E"}
|
|
@@ -8,14 +8,18 @@ interface RecordDefinition {
|
|
|
8
8
|
extends?: string[];
|
|
9
9
|
fields: Record<string, RecordFieldDefinition>;
|
|
10
10
|
}
|
|
11
|
+
interface UnionDefinition {
|
|
12
|
+
discriminant?: string;
|
|
13
|
+
variants: Record<string, string>;
|
|
14
|
+
}
|
|
11
15
|
interface MigrationStep {
|
|
12
16
|
"local-fragment"?: Record<string, Record<string, RecordFieldDefinition>>;
|
|
13
17
|
"add-records"?: Record<string, RecordDefinition>;
|
|
14
|
-
"add-union"?: Record<string,
|
|
18
|
+
"add-union"?: Record<string, UnionDefinition>;
|
|
15
19
|
"modify-records"?: Record<string, {
|
|
16
20
|
"add-fields": Record<string, RecordFieldDefinition>;
|
|
17
21
|
}>;
|
|
18
22
|
}
|
|
19
|
-
export type { MigrationStep, RecordFieldDefinition };
|
|
23
|
+
export type { MigrationStep, RecordFieldDefinition, UnionDefinition };
|
|
20
24
|
export declare function parseMigrationSteps(unparsed: unknown): MigrationStep[];
|
|
21
25
|
//# sourceMappingURL=parseMigrationSteps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseMigrationSteps.d.ts","sourceRoot":"","sources":["../../../../src/utils/steps/parseMigrationSteps.ts"],"names":[],"mappings":"AAuBA,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,KAAK,qBAAqB,GAAG,MAAM,GAAG,sBAAsB,CAAC;AAE7D,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CAC/C;AAED,UAAU,aAAa;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{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