@palantir/pack.document-schema.type-gen 0.7.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.
- package/build/esm/cli.js +2 -0
- package/build/esm/cli.js.map +1 -1
- package/build/esm/commands/asset/assetDeployHandler.js +60 -0
- package/build/esm/commands/asset/assetDeployHandler.js.map +1 -0
- package/build/esm/commands/asset/registerAssetCommands.js +22 -0
- package/build/esm/commands/asset/registerAssetCommands.js.map +1 -0
- package/build/esm/commands/ir/irDeployHandler.js +5 -4
- package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
- package/build/esm/commands/ir/irGenAssetHandler.js +19 -13
- package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
- package/build/esm/commands/schema/registerSchemaCommands.js +2 -0
- package/build/esm/commands/schema/registerSchemaCommands.js.map +1 -1
- package/build/esm/commands/schema/schemaGenTypesHandler.js +147 -0
- package/build/esm/commands/schema/schemaGenTypesHandler.js.map +1 -0
- package/build/esm/commands/steps/stepsGenIrHandler.js +6 -1
- package/build/esm/commands/steps/stepsGenIrHandler.js.map +1 -1
- package/build/esm/commands/types.js +2 -0
- package/build/esm/commands/types.js.map +1 -0
- package/build/esm/index.js +6 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldDef.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/recordDef.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.js.map +1 -1
- package/build/esm/lib/pack-docschema-api/pack-docschema-ir/unionDef.js.map +1 -1
- package/build/esm/utils/generatedFileHeader.js +1 -0
- package/build/esm/utils/generatedFileHeader.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js +323 -0
- package/build/esm/utils/ir/__tests__/convertIrToWireSchema.test.js.map +1 -0
- package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js +43 -61
- package/build/esm/utils/ir/__tests__/generateModelsFromIr.test.js.map +1 -1
- package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js +73 -103
- package/build/esm/utils/ir/__tests__/generateZodSchemasFromIr.test.js.map +1 -1
- package/build/esm/utils/ir/convertIrToWireSchema.js +201 -0
- package/build/esm/utils/ir/convertIrToWireSchema.js.map +1 -0
- package/build/esm/utils/ir/generateModelsFromIr.js +2 -2
- package/build/esm/utils/ir/generateModelsFromIr.js.map +1 -1
- package/build/esm/utils/ir/generateZodSchemasFromIr.js +2 -2
- package/build/esm/utils/ir/generateZodSchemasFromIr.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js +2 -0
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -0
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js +2 -0
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -0
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js +2 -0
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -0
- package/build/esm/utils/schema/__tests__/fixtures.js +207 -0
- package/build/esm/utils/schema/__tests__/fixtures.js.map +1 -0
- package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js +41 -0
- package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/__tests__/generateModelMetadataFromSchema.test.js +41 -0
- package/build/esm/utils/schema/__tests__/generateModelMetadataFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/__tests__/generateScopeFromSchema.test.js +37 -0
- package/build/esm/utils/schema/__tests__/generateScopeFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/__tests__/generateVersionedTypesFromSchema.test.js +55 -0
- package/build/esm/utils/schema/__tests__/generateVersionedTypesFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/__tests__/generateVersionedZodFromSchema.test.js +55 -0
- package/build/esm/utils/schema/__tests__/generateVersionedZodFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/__tests__/generateVersionsFromSchema.test.js +37 -0
- package/build/esm/utils/schema/__tests__/generateVersionsFromSchema.test.js.map +1 -0
- package/build/esm/utils/schema/__tests__/snapshotUtils.js +106 -0
- package/build/esm/utils/schema/__tests__/snapshotUtils.js.map +1 -0
- package/build/esm/utils/schema/generateIndexFromSchema.js +72 -0
- package/build/esm/utils/schema/generateIndexFromSchema.js.map +1 -0
- package/build/esm/utils/schema/generateInternalFromSchema.js +380 -0
- package/build/esm/utils/schema/generateInternalFromSchema.js.map +1 -0
- package/build/esm/utils/schema/generateModelMetadataFromSchema.js +195 -0
- package/build/esm/utils/schema/generateModelMetadataFromSchema.js.map +1 -0
- package/build/esm/utils/schema/generateScopeFromSchema.js +155 -0
- package/build/esm/utils/schema/generateScopeFromSchema.js.map +1 -0
- package/build/esm/utils/schema/generateTypesFromSchema.js +16 -30
- package/build/esm/utils/schema/generateTypesFromSchema.js.map +1 -1
- package/build/esm/utils/schema/generateVersionedTypesFromSchema.js +281 -0
- package/build/esm/utils/schema/generateVersionedTypesFromSchema.js.map +1 -0
- package/build/esm/utils/schema/generateVersionedZodFromSchema.js +189 -0
- package/build/esm/utils/schema/generateVersionedZodFromSchema.js.map +1 -0
- package/build/esm/utils/schema/generateVersionsFromSchema.js +50 -0
- package/build/esm/utils/schema/generateVersionsFromSchema.js.map +1 -0
- package/build/esm/utils/schema/resolveSchemaChain.js +54 -0
- package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -0
- package/build/esm/utils/schema/runtimeSchema.js +96 -0
- package/build/esm/utils/schema/runtimeSchema.js.map +1 -0
- package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
- package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js +81 -8
- package/build/esm/utils/steps/__tests__/convertStepsToIr.test.js.map +1 -1
- package/build/esm/utils/steps/convertStepsToIr.js +8 -13
- package/build/esm/utils/steps/convertStepsToIr.js.map +1 -1
- package/build/esm/utils/steps/parseMigrationSteps.js +4 -2
- package/build/esm/utils/steps/parseMigrationSteps.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/commands/asset/assetDeployHandler.d.ts +10 -0
- package/build/types/commands/asset/assetDeployHandler.d.ts.map +1 -0
- package/build/types/commands/asset/registerAssetCommands.d.ts +3 -0
- package/build/types/commands/asset/registerAssetCommands.d.ts.map +1 -0
- package/build/types/commands/ir/irDeployHandler.d.ts +1 -1
- package/build/types/commands/ir/irDeployHandler.d.ts.map +1 -1
- package/build/types/commands/ir/irGenAssetHandler.d.ts +1 -1
- package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
- package/build/types/commands/schema/registerSchemaCommands.d.ts.map +1 -1
- package/build/types/commands/schema/schemaGenTypesHandler.d.ts +8 -0
- package/build/types/commands/schema/schemaGenTypesHandler.d.ts.map +1 -0
- package/build/types/commands/steps/stepsGenIrHandler.d.ts.map +1 -1
- package/build/types/commands/types.d.ts +12 -0
- package/build/types/commands/types.d.ts.map +1 -0
- package/build/types/index.d.ts +6 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldDef.d.ts +2 -2
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldDef.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.d.ts +1 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueDatetime.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.d.ts +1 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueMediaRef.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.d.ts +3 -0
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/fieldValueText.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts +0 -2
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/recordDef.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.d.ts +2 -2
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/schemaMeta.d.ts.map +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/unionDef.d.ts +1 -1
- package/build/types/lib/pack-docschema-api/pack-docschema-ir/unionDef.d.ts.map +1 -1
- package/build/types/utils/generatedFileHeader.d.ts +1 -0
- package/build/types/utils/generatedFileHeader.d.ts.map +1 -1
- package/build/types/utils/ir/__tests__/convertIrToWireSchema.test.d.ts +2 -0
- package/build/types/utils/ir/__tests__/convertIrToWireSchema.test.d.ts.map +1 -0
- package/build/types/utils/ir/convertIrToWireSchema.d.ts +17 -0
- package/build/types/utils/ir/convertIrToWireSchema.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/fixtures.d.ts +14 -0
- package/build/types/utils/schema/__tests__/fixtures.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/generateInternalFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateInternalFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/generateModelMetadataFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateModelMetadataFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/generateScopeFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateScopeFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/generateVersionedTypesFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateVersionedTypesFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/generateVersionedZodFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateVersionedZodFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/generateVersionsFromSchema.test.d.ts +2 -0
- package/build/types/utils/schema/__tests__/generateVersionsFromSchema.test.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/snapshotUtils.d.ts +47 -0
- package/build/types/utils/schema/__tests__/snapshotUtils.d.ts.map +1 -0
- package/build/types/utils/schema/generateIndexFromSchema.d.ts +14 -0
- package/build/types/utils/schema/generateIndexFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/generateInternalFromSchema.d.ts +18 -0
- package/build/types/utils/schema/generateInternalFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/generateModelMetadataFromSchema.d.ts +15 -0
- package/build/types/utils/schema/generateModelMetadataFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/generateScopeFromSchema.d.ts +13 -0
- package/build/types/utils/schema/generateScopeFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/generateTypesFromSchema.d.ts.map +1 -1
- package/build/types/utils/schema/generateVersionedTypesFromSchema.d.ts +18 -0
- package/build/types/utils/schema/generateVersionedTypesFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/generateVersionedZodFromSchema.d.ts +16 -0
- package/build/types/utils/schema/generateVersionedZodFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/generateVersionsFromSchema.d.ts +13 -0
- package/build/types/utils/schema/generateVersionsFromSchema.d.ts.map +1 -0
- package/build/types/utils/schema/resolveSchemaChain.d.ts +18 -0
- package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -0
- package/build/types/utils/schema/runtimeSchema.d.ts +59 -0
- package/build/types/utils/schema/runtimeSchema.d.ts.map +1 -0
- package/build/types/utils/steps/convertStepsToIr.d.ts.map +1 -1
- package/build/types/utils/steps/parseMigrationSteps.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldDef.js","names":[],"sources":["fieldDef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type * as IFieldTypeUnion from \"./fieldTypeUnion.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IFieldDef {\n readonly \"key\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"isOptional\"?: boolean | null;\n readonly \"
|
|
1
|
+
{"version":3,"file":"fieldDef.js","names":[],"sources":["fieldDef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type * as IFieldTypeUnion from \"./fieldTypeUnion.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IFieldDef {\n readonly \"key\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"isOptional\"?: boolean | null;\n readonly \"fieldType\": IFieldTypeUnion.IFieldTypeUnion;\n readonly \"metadata\": ISchemaMeta;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueDatetime.js","names":[],"sources":["fieldValueDatetime.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueDatetime {\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fieldValueDatetime.js","names":[],"sources":["fieldValueDatetime.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueDatetime {\n readonly \"value\"?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueMediaRef.js","names":[],"sources":["fieldValueMediaRef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueMediaRef {\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fieldValueMediaRef.js","names":[],"sources":["fieldValueMediaRef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueMediaRef {\n readonly \"value\"?: any;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValueText.js","names":[],"sources":["fieldValueText.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueText {\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fieldValueText.js","names":[],"sources":["fieldValueText.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IFieldValueText {\n readonly \"defaultValue\"?: string | null;\n readonly \"minLength\"?: number | null;\n readonly \"maxLength\"?: number | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordDef.js","names":[],"sources":["recordDef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IFieldDef } from \"./fieldDef.js\";\
|
|
1
|
+
{"version":3,"file":"recordDef.js","names":[],"sources":["recordDef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IFieldDef } from \"./fieldDef.js\";\nexport interface IRecordDef {\n readonly \"key\": IModelTypeKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"fields\": ReadonlyArray<IFieldDef>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaMeta.js","names":[],"sources":["schemaMeta.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ISchemaVersion } from \"../pack-docschema-api/schemaVersion.js\";\nexport interface ISchemaMeta {\n readonly \"
|
|
1
|
+
{"version":3,"file":"schemaMeta.js","names":[],"sources":["schemaMeta.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ISchemaVersion } from \"../pack-docschema-api/schemaVersion.js\";\nexport interface ISchemaMeta {\n readonly \"addedInVersion\": ISchemaVersion;\n readonly \"deprecatedFromVersion\"?: ISchemaVersion | null;\n readonly \"deprecatedMessage\"?: string | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionDef.js","names":[],"sources":["unionDef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IUnionVariantKey } from \"../pack-docschema-api/unionVariantKey.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IUnionDef {\n readonly \"key\": IModelTypeKey;\n readonly \"discriminant\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"variants\": {\n readonly [key: IUnionVariantKey]: IModelTypeKey;\n };\n readonly \"
|
|
1
|
+
{"version":3,"file":"unionDef.js","names":[],"sources":["unionDef.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IFieldKey } from \"../pack-docschema-api/fieldKey.js\";\nimport type { IModelTypeKey } from \"../pack-docschema-api/modelTypeKey.js\";\nimport type { IUnionVariantKey } from \"../pack-docschema-api/unionVariantKey.js\";\nimport type { ISchemaMeta } from \"./schemaMeta.js\";\nexport interface IUnionDef {\n readonly \"key\": IModelTypeKey;\n readonly \"discriminant\": IFieldKey;\n readonly \"name\": string;\n readonly \"description\"?: string | null;\n readonly \"variants\": {\n readonly [key: IUnionVariantKey]: IModelTypeKey;\n };\n readonly \"metadata\": ISchemaMeta;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -37,4 +37,5 @@ const {
|
|
|
37
37
|
version
|
|
38
38
|
} = fs.readJsonSync(packageJsonPath);
|
|
39
39
|
export const GENERATED_FILE_HEADER = `/* Generated by ${packageName}@${version} */\n\n`;
|
|
40
|
+
export const GENERATED_JSON_COMMENT = `Auto-generated by ${packageName}@${version}. Do not edit this file manually.`;
|
|
40
41
|
//# sourceMappingURL=generatedFileHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatedFileHeader.js","names":["fs","path","fileURLToPath","currentDir","dirname","import","meta","url","findPackageJson","startDir","dir","packageJsonPath","join","existsSync","Error","name","packageName","version","readJsonSync","GENERATED_FILE_HEADER"],"sources":["generatedFileHeader.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n// Walk up directories to find the nearest package.json (works for both src and build/esm locations)\nfunction findPackageJson(startDir: string): string {\n let dir = startDir;\n while (dir !== path.dirname(dir)) {\n const packageJsonPath = path.join(dir, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n dir = path.dirname(dir);\n }\n throw new Error(\"Could not find package.json\");\n}\n\nconst packageJsonPath = findPackageJson(currentDir);\nconst { name: packageName, version } = fs.readJsonSync(packageJsonPath) as {\n name: string;\n version: string;\n};\n\nexport const GENERATED_FILE_HEADER: string = `/* Generated by ${packageName}@${version} */\\n\\n`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;;AAE/D;AACA,SAASC,eAAeA,CAACC,QAAgB,EAAU;EACjD,IAAIC,GAAG,GAAGD,QAAQ;EAClB,OAAOC,GAAG,KAAKT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC,EAAE;IAChC,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACF,GAAG,EAAE,cAAc,CAAC;IACtD,IAAIV,EAAE,CAACa,UAAU,CAACF,eAAe,CAAC,EAAE;MAClC,OAAOA,eAAe;IACxB;IACAD,GAAG,GAAGT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC;EACzB;EACA,MAAM,IAAII,KAAK,CAAC,6BAA6B,CAAC;AAChD;AAEA,MAAMH,eAAe,GAAGH,eAAe,CAACL,UAAU,CAAC;AACnD,MAAM;EAAEY,IAAI,EAAEC,WAAW;EAAEC;AAAQ,CAAC,GAAGjB,EAAE,CAACkB,YAAY,CAACP,eAAe,CAGrE;AAED,OAAO,MAAMQ,qBAA6B,GAAG,mBAAmBH,WAAW,IAAIC,OAAO,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generatedFileHeader.js","names":["fs","path","fileURLToPath","currentDir","dirname","import","meta","url","findPackageJson","startDir","dir","packageJsonPath","join","existsSync","Error","name","packageName","version","readJsonSync","GENERATED_FILE_HEADER","GENERATED_JSON_COMMENT"],"sources":["generatedFileHeader.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n// Walk up directories to find the nearest package.json (works for both src and build/esm locations)\nfunction findPackageJson(startDir: string): string {\n let dir = startDir;\n while (dir !== path.dirname(dir)) {\n const packageJsonPath = path.join(dir, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n dir = path.dirname(dir);\n }\n throw new Error(\"Could not find package.json\");\n}\n\nconst packageJsonPath = findPackageJson(currentDir);\nconst { name: packageName, version } = fs.readJsonSync(packageJsonPath) as {\n name: string;\n version: string;\n};\n\nexport const GENERATED_FILE_HEADER: string = `/* Generated by ${packageName}@${version} */\\n\\n`;\n\nexport const GENERATED_JSON_COMMENT: string =\n `Auto-generated by ${packageName}@${version}. Do not edit this file manually.`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,UAAU;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;;AAE/D;AACA,SAASC,eAAeA,CAACC,QAAgB,EAAU;EACjD,IAAIC,GAAG,GAAGD,QAAQ;EAClB,OAAOC,GAAG,KAAKT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC,EAAE;IAChC,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACF,GAAG,EAAE,cAAc,CAAC;IACtD,IAAIV,EAAE,CAACa,UAAU,CAACF,eAAe,CAAC,EAAE;MAClC,OAAOA,eAAe;IACxB;IACAD,GAAG,GAAGT,IAAI,CAACG,OAAO,CAACM,GAAG,CAAC;EACzB;EACA,MAAM,IAAII,KAAK,CAAC,6BAA6B,CAAC;AAChD;AAEA,MAAMH,eAAe,GAAGH,eAAe,CAACL,UAAU,CAAC;AACnD,MAAM;EAAEY,IAAI,EAAEC,WAAW;EAAEC;AAAQ,CAAC,GAAGjB,EAAE,CAACkB,YAAY,CAACP,eAAe,CAGrE;AAED,OAAO,MAAMQ,qBAA6B,GAAG,mBAAmBH,WAAW,IAAIC,OAAO,SAAS;AAE/F,OAAO,MAAMG,sBAA8B,GACzC,qBAAqBJ,WAAW,IAAIC,OAAO,mCAAmC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */
|
|
2
2
|
|
|
3
3
|
import { Metadata } from '@palantir/pack.document-schema.model-types';
|
|
4
4
|
import { AnimalCatSchema, AnimalDogSchema, AnimalSchema, CatSchema, DogSchema } from './schema.js';
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-discriminant.js","names":["Metadata","AnimalCatSchema","AnimalDogSchema","AnimalSchema","CatSchema","DogSchema","CatModel","__type","zodSchema","name","DogModel","AnimalModel","discriminant","AnimalCatModel","AnimalDogModel","DocumentModel","Cat","Dog","Animal","AnimalCat","AnimalDog","version"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"custom-discriminant.js","names":["Metadata","AnimalCatSchema","AnimalDogSchema","AnimalSchema","CatSchema","DogSchema","CatModel","__type","zodSchema","name","DogModel","AnimalModel","discriminant","AnimalCatModel","AnimalDogModel","DocumentModel","Cat","Dog","Animal","AnimalCat","AnimalDog","version"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Animal, AnimalCat, AnimalDog, Cat, Dog } from './types.js';\nimport {\n AnimalCatSchema,\n AnimalDogSchema,\n AnimalSchema,\n CatSchema,\n DogSchema,\n} from './schema.js';\n\nexport interface CatModel extends RecordModel<Cat, typeof CatSchema> {}\nexport const CatModel: CatModel = {\n __type: {} as Cat,\n zodSchema: CatSchema,\n [Metadata]: {\n name: 'Cat',\n },\n};\n\nexport interface DogModel extends RecordModel<Dog, typeof DogSchema> {}\nexport const DogModel: DogModel = {\n __type: {} as Dog,\n zodSchema: DogSchema,\n [Metadata]: {\n name: 'Dog',\n },\n};\n\nexport interface AnimalModel extends UnionModel<Animal, typeof AnimalSchema> {}\nexport const AnimalModel: AnimalModel = {\n __type: {} as Animal,\n zodSchema: AnimalSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'Animal',\n },\n};\n\nexport interface AnimalCatModel extends UnionModel<\n AnimalCat,\n typeof AnimalCatSchema\n> {}\nexport const AnimalCatModel: AnimalCatModel = {\n __type: {} as AnimalCat,\n zodSchema: AnimalCatSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'AnimalCat',\n },\n};\n\nexport interface AnimalDogModel extends UnionModel<\n AnimalDog,\n typeof AnimalDogSchema\n> {}\nexport const AnimalDogModel: AnimalDogModel = {\n __type: {} as AnimalDog,\n zodSchema: AnimalDogSchema,\n [Metadata]: {\n discriminant: 'kind',\n name: 'AnimalDog',\n },\n};\n\nexport const DocumentModel = {\n Cat: CatModel,\n Dog: DogModel,\n Animal: AnimalModel,\n AnimalCat: AnimalCatModel,\n AnimalDog: AnimalDogModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SACEC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,SAAS,EACTC,SAAS,QACJ,aAAa;AAGpB,OAAO,MAAMC,QAAkB,GAAG;EAChCC,MAAM,EAAE,CAAC,CAAQ;EACjBC,SAAS,EAAEJ,SAAS;EACpB,CAACJ,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAMC,QAAkB,GAAG;EAChCH,MAAM,EAAE,CAAC,CAAQ;EACjBC,SAAS,EAAEH,SAAS;EACpB,CAACL,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAME,WAAwB,GAAG;EACtCJ,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEL,YAAY;EACvB,CAACH,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMI,cAA8B,GAAG;EAC5CN,MAAM,EAAE,CAAC,CAAc;EACvBC,SAAS,EAAEP,eAAe;EAC1B,CAACD,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMK,cAA8B,GAAG;EAC5CP,MAAM,EAAE,CAAC,CAAc;EACvBC,SAAS,EAAEN,eAAe;EAC1B,CAACF,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMM,aAAa,GAAG;EAC3BC,GAAG,EAAEV,QAAQ;EACbW,GAAG,EAAEP,QAAQ;EACbQ,MAAM,EAAEP,WAAW;EACnBQ,SAAS,EAAEN,cAAc;EACzBO,SAAS,EAAEN,cAAc;EACzB,CAACd,QAAQ,GAAG;IACVqB,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-refs.js","names":["Metadata","EventSchema","EventModel","__type","zodSchema","externalRefFieldTypes","documentRef","userRef","name","DocumentModel","Event","version"],"sources":["external-refs.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"external-refs.js","names":["Metadata","EventSchema","EventModel","__type","zodSchema","externalRefFieldTypes","documentRef","userRef","name","DocumentModel","Event","version"],"sources":["external-refs.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Event } from './types.js';\nimport { EventSchema } from './schema.js';\n\nexport interface EventModel extends RecordModel<Event, typeof EventSchema> {}\nexport const EventModel: EventModel = {\n __type: {} as Event,\n zodSchema: EventSchema,\n [Metadata]: {\n externalRefFieldTypes: {\n documentRef: 'docRef',\n userRef: 'userRef',\n },\n name: 'Event',\n },\n};\n\nexport const DocumentModel = {\n Event: EventModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,WAAW,QAAQ,aAAa;AAGzC,OAAO,MAAMC,UAAsB,GAAG;EACpCC,MAAM,EAAE,CAAC,CAAU;EACnBC,SAAS,EAAEH,WAAW;EACtB,CAACD,QAAQ,GAAG;IACVK,qBAAqB,EAAE;MACrBC,WAAW,EAAE,QAAQ;MACrBC,OAAO,EAAE;IACX,CAAC;IACDC,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,KAAK,EAAER,UAAU;EACjB,CAACF,QAAQ,GAAG;IACVW,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-record.js","names":["Metadata","PersonSchema","PersonModel","__type","zodSchema","name","DocumentModel","Person","version"],"sources":["simple-record.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"simple-record.js","names":["Metadata","PersonSchema","PersonModel","__type","zodSchema","name","DocumentModel","Person","version"],"sources":["simple-record.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type { Person } from './types.js';\nimport { PersonSchema } from './schema.js';\n\nexport interface PersonModel extends RecordModel<Person, typeof PersonSchema> {}\nexport const PersonModel: PersonModel = {\n __type: {} as Person,\n zodSchema: PersonSchema,\n [Metadata]: {\n name: 'Person',\n },\n};\n\nexport const DocumentModel = {\n Person: PersonModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAErE,SAASC,YAAY,QAAQ,aAAa;AAG1C,OAAO,MAAMC,WAAwB,GAAG;EACtCC,MAAM,EAAE,CAAC,CAAW;EACpBC,SAAS,EAAEH,YAAY;EACvB,CAACD,QAAQ,GAAG;IACVK,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG;EAC3BC,MAAM,EAAEL,WAAW;EACnB,CAACF,QAAQ,GAAG;IACVQ,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */
|
|
2
2
|
|
|
3
3
|
import { Metadata } from '@palantir/pack.document-schema.model-types';
|
|
4
4
|
import { NodeObjectSchema, NodeSchema, NodeTextBoxSchema, ObjectNodeSchema, TextBoxSchema } from './schema.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-types.js","names":["Metadata","NodeObjectSchema","NodeSchema","NodeTextBoxSchema","ObjectNodeSchema","TextBoxSchema","ObjectNodeModel","__type","zodSchema","name","TextBoxModel","NodeModel","discriminant","NodeObjectModel","NodeTextBoxModel","DocumentModel","ObjectNode","TextBox","Node","NodeObject","NodeTextBox","version"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"union-types.js","names":["Metadata","NodeObjectSchema","NodeSchema","NodeTextBoxSchema","ObjectNodeSchema","TextBoxSchema","ObjectNodeModel","__type","zodSchema","name","TextBoxModel","NodeModel","discriminant","NodeObjectModel","NodeTextBoxModel","DocumentModel","ObjectNode","TextBox","Node","NodeObject","NodeTextBox","version"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport type {\n DocumentSchema,\n RecordModel,\n UnionModel,\n} from '@palantir/pack.document-schema.model-types';\nimport { Metadata } from '@palantir/pack.document-schema.model-types';\nimport type {\n Node,\n NodeObject,\n NodeTextBox,\n ObjectNode,\n TextBox,\n} from './types.js';\nimport {\n NodeObjectSchema,\n NodeSchema,\n NodeTextBoxSchema,\n ObjectNodeSchema,\n TextBoxSchema,\n} from './schema.js';\n\nexport interface ObjectNodeModel extends RecordModel<\n ObjectNode,\n typeof ObjectNodeSchema\n> {}\nexport const ObjectNodeModel: ObjectNodeModel = {\n __type: {} as ObjectNode,\n zodSchema: ObjectNodeSchema,\n [Metadata]: {\n name: 'ObjectNode',\n },\n};\n\nexport interface TextBoxModel extends RecordModel<\n TextBox,\n typeof TextBoxSchema\n> {}\nexport const TextBoxModel: TextBoxModel = {\n __type: {} as TextBox,\n zodSchema: TextBoxSchema,\n [Metadata]: {\n name: 'TextBox',\n },\n};\n\nexport interface NodeModel extends UnionModel<Node, typeof NodeSchema> {}\nexport const NodeModel: NodeModel = {\n __type: {} as Node,\n zodSchema: NodeSchema,\n [Metadata]: {\n discriminant: 'type',\n name: 'Node',\n },\n};\n\nexport interface NodeObjectModel extends UnionModel<\n NodeObject,\n typeof NodeObjectSchema\n> {}\nexport const NodeObjectModel: NodeObjectModel = {\n __type: {} as NodeObject,\n zodSchema: NodeObjectSchema,\n [Metadata]: {\n discriminant: 'type',\n name: 'NodeObject',\n },\n};\n\nexport interface NodeTextBoxModel extends UnionModel<\n NodeTextBox,\n typeof NodeTextBoxSchema\n> {}\nexport const NodeTextBoxModel: NodeTextBoxModel = {\n __type: {} as NodeTextBox,\n zodSchema: NodeTextBoxSchema,\n [Metadata]: {\n discriminant: 'type',\n name: 'NodeTextBox',\n },\n};\n\nexport const DocumentModel = {\n ObjectNode: ObjectNodeModel,\n TextBox: TextBoxModel,\n Node: NodeModel,\n NodeObject: NodeObjectModel,\n NodeTextBox: NodeTextBoxModel,\n [Metadata]: {\n version: 1,\n },\n} as const satisfies DocumentSchema;\n\nexport type DocumentModel = typeof DocumentModel;\n"],"mappings":"AAAA;;AAOA,SAASA,QAAQ,QAAQ,4CAA4C;AAQrE,SACEC,gBAAgB,EAChBC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,EAChBC,aAAa,QACR,aAAa;AAMpB,OAAO,MAAMC,eAAgC,GAAG;EAC9CC,MAAM,EAAE,CAAC,CAAe;EACxBC,SAAS,EAAEJ,gBAAgB;EAC3B,CAACJ,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMC,YAA0B,GAAG;EACxCH,MAAM,EAAE,CAAC,CAAY;EACrBC,SAAS,EAAEH,aAAa;EACxB,CAACL,QAAQ,GAAG;IACVS,IAAI,EAAE;EACR;AACF,CAAC;AAGD,OAAO,MAAME,SAAoB,GAAG;EAClCJ,MAAM,EAAE,CAAC,CAAS;EAClBC,SAAS,EAAEN,UAAU;EACrB,CAACF,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMI,eAAgC,GAAG;EAC9CN,MAAM,EAAE,CAAC,CAAe;EACxBC,SAAS,EAAEP,gBAAgB;EAC3B,CAACD,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAMD,OAAO,MAAMK,gBAAkC,GAAG;EAChDP,MAAM,EAAE,CAAC,CAAgB;EACzBC,SAAS,EAAEL,iBAAiB;EAC5B,CAACH,QAAQ,GAAG;IACVY,YAAY,EAAE,MAAM;IACpBH,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMM,aAAa,GAAG;EAC3BC,UAAU,EAAEV,eAAe;EAC3BW,OAAO,EAAEP,YAAY;EACrBQ,IAAI,EAAEP,SAAS;EACfQ,UAAU,EAAEN,eAAe;EAC3BO,WAAW,EAAEN,gBAAgB;EAC7B,CAACd,QAAQ,GAAG;IACVqB,OAAO,EAAE;EACX;AACF,CAAmC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-and-map-types.js","names":["z","ContainerSchema","object","tags","array","string","metadata","record","unknown"],"sources":["array-and-map-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"array-and-map-types.js","names":["z","ContainerSchema","object","tags","array","string","metadata","record","unknown"],"sources":["array-and-map-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const ContainerSchema = z.object({\n tags: z.array(z.string()),\n metadata: z.record(z.string(), z.unknown()),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAAC;EACzBC,QAAQ,EAAEN,CAAC,CAACO,MAAM,CAACP,CAAC,CAACK,MAAM,CAAC,CAAC,EAAEL,CAAC,CAACQ,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean-fields.js","names":["z","FeatureSchema","object","enabled","boolean","isPublic","optional","flags","array"],"sources":["boolean-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"boolean-fields.js","names":["z","FeatureSchema","object","enabled","boolean","isPublic","optional","flags","array"],"sources":["boolean-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const FeatureSchema = z.object({\n enabled: z.boolean(),\n isPublic: z.boolean().optional(),\n flags: z.array(z.boolean()),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,aAAa,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,OAAO,EAAEH,CAAC,CAACI,OAAO,CAAC,CAAC;EACpBC,QAAQ,EAAEL,CAAC,CAACI,OAAO,CAAC,CAAC,CAACE,QAAQ,CAAC,CAAC;EAChCC,KAAK,EAAEP,CAAC,CAACQ,KAAK,CAACR,CAAC,CAACI,OAAO,CAAC,CAAC;AAC5B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-discriminant.js","names":["z","CatSchema","object","meow","string","DogSchema","bark","AnimalCatSchema","extend","kind","literal","AnimalDogSchema","AnimalSchema","discriminatedUnion"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"custom-discriminant.js","names":["z","CatSchema","object","meow","string","DogSchema","bark","AnimalCatSchema","extend","kind","literal","AnimalDogSchema","AnimalSchema","discriminatedUnion"],"sources":["custom-discriminant.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const CatSchema = z.object({\n meow: z.string(),\n});\n\nexport const DogSchema = z.object({\n bark: z.string(),\n});\n\nexport const AnimalCatSchema = CatSchema.extend({\n kind: z.literal('cat'),\n});\n\nexport const AnimalDogSchema = DogSchema.extend({\n kind: z.literal('dog'),\n});\n\nexport const AnimalSchema = z.discriminatedUnion('kind', [\n AnimalCatSchema,\n AnimalDogSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,IAAI,EAAEN,CAAC,CAACI,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMG,eAAe,GAAGN,SAAS,CAACO,MAAM,CAAC;EAC9CC,IAAI,EAAET,CAAC,CAACU,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGN,SAAS,CAACG,MAAM,CAAC;EAC9CC,IAAI,EAAET,CAAC,CAACU,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGZ,CAAC,CAACa,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"datetime-fields.js","names":["z","EventSchema","object","timestamp","string","datetime"],"sources":["datetime-fields.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const EventSchema = z.object({\n timestamp: z.string().datetime(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,WAAW,GAAGD,CAAC,CAACE,MAAM,CAAC;EAClCC,SAAS,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACjC,CAAC,CAAC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-records.js","names":["z","PersonSchema","object","name","string","min","max","age","number","int","email","optional"],"sources":["simple-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"simple-records.js","names":["z","PersonSchema","object","name","string","min","max","age","number","int","email","optional"],"sources":["simple-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const PersonSchema = z.object({\n name: z.string().min(2).max(50),\n age: z.number().int().min(0).max(150),\n email: z.string().optional(),\n});\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,YAAY,GAAGD,CAAC,CAACE,MAAM,CAAC;EACnCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,EAAE,CAAC;EAC/BC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACJ,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC;EACrCI,KAAK,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;AAC7B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-before-records.js","names":["z","FooSchema","object","value","string","BarSchema","count","number","int","FooBarFooSchema","extend","type","literal","FooBarBarSchema","FooBarSchema","discriminatedUnion"],"sources":["union-before-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"union-before-records.js","names":["z","FooSchema","object","value","string","BarSchema","count","number","int","FooBarFooSchema","extend","type","literal","FooBarBarSchema","FooBarSchema","discriminatedUnion"],"sources":["union-before-records.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const FooSchema = z.object({\n value: z.string(),\n});\n\nexport const BarSchema = z.object({\n count: z.number().int(),\n});\n\nexport const FooBarFooSchema = FooSchema.extend({\n type: z.literal('foo'),\n});\n\nexport const FooBarBarSchema = BarSchema.extend({\n type: z.literal('bar'),\n});\n\nexport const FooBarSchema = z.discriminatedUnion('type', [\n FooBarFooSchema,\n FooBarBarSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,SAAS,GAAGL,CAAC,CAACE,MAAM,CAAC;EAChCI,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACS,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAGR,SAAS,CAACK,MAAM,CAAC;EAC9CC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,KAAK;AACvB,CAAC,CAAC;AAEF,OAAO,MAAME,YAAY,GAAGd,CAAC,CAACe,kBAAkB,CAAC,MAAM,EAAE,CACvDN,eAAe,EACfI,eAAe,CAChB,CAAC","ignoreList":[]}
|
package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-types.js","names":["z","ObjectNodeSchema","object","x","number","y","label","string","optional","TextBoxSchema","text","NodeObjectSchema","extend","type","literal","NodeTextBoxSchema","NodeSchema","discriminatedUnion"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.
|
|
1
|
+
{"version":3,"file":"union-types.js","names":["z","ObjectNodeSchema","object","x","number","y","label","string","optional","TextBoxSchema","text","NodeObjectSchema","extend","type","literal","NodeTextBoxSchema","NodeSchema","discriminatedUnion"],"sources":["union-types.ts"],"sourcesContent":["/* Generated by @palantir/pack.document-schema.type-gen@0.9.0 */\n\nimport { z } from 'zod';\n\nexport const ObjectNodeSchema = z.object({\n x: z.number(),\n y: z.number(),\n label: z.string().optional(),\n});\n\nexport const TextBoxSchema = z.object({\n x: z.number(),\n y: z.number(),\n text: z.string(),\n});\n\nexport const NodeObjectSchema = ObjectNodeSchema.extend({\n type: z.literal('object'),\n});\n\nexport const NodeTextBoxSchema = TextBoxSchema.extend({\n type: z.literal('text-box'),\n});\n\nexport const NodeSchema = z.discriminatedUnion('type', [\n NodeObjectSchema,\n NodeTextBoxSchema,\n]);\n"],"mappings":"AAAA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,gBAAgB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbE,KAAK,EAAEN,CAAC,CAACO,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAEF,OAAO,MAAMC,aAAa,GAAGT,CAAC,CAACE,MAAM,CAAC;EACpCC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACbC,CAAC,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACbM,IAAI,EAAEV,CAAC,CAACO,MAAM,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMI,gBAAgB,GAAGV,gBAAgB,CAACW,MAAM,CAAC;EACtDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,QAAQ;AAC1B,CAAC,CAAC;AAEF,OAAO,MAAMC,iBAAiB,GAAGN,aAAa,CAACG,MAAM,CAAC;EACpDC,IAAI,EAAEb,CAAC,CAACc,OAAO,CAAC,UAAU;AAC5B,CAAC,CAAC;AAEF,OAAO,MAAME,UAAU,GAAGhB,CAAC,CAACiB,kBAAkB,CAAC,MAAM,EAAE,CACrDN,gBAAgB,EAChBI,iBAAiB,CAClB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { IFieldValueUnion } from "../../../lib/pack-docschema-api/pack-docschema-ir/index.js";
|
|
19
|
+
import { convertIrToWireSchema } from "../convertIrToWireSchema.js";
|
|
20
|
+
describe("convertIrToWireSchema", () => {
|
|
21
|
+
it("should flatten record model and rename fields correctly", () => {
|
|
22
|
+
const record = {
|
|
23
|
+
key: "Person",
|
|
24
|
+
name: "Person",
|
|
25
|
+
description: "A person",
|
|
26
|
+
fields: [{
|
|
27
|
+
key: "name",
|
|
28
|
+
name: "Name",
|
|
29
|
+
fieldType: {
|
|
30
|
+
type: "value",
|
|
31
|
+
value: IFieldValueUnion.string({})
|
|
32
|
+
},
|
|
33
|
+
metadata: {
|
|
34
|
+
addedInVersion: 1
|
|
35
|
+
}
|
|
36
|
+
}]
|
|
37
|
+
};
|
|
38
|
+
const wire = convertIrToWireSchema({
|
|
39
|
+
name: "Test",
|
|
40
|
+
description: "Test schema",
|
|
41
|
+
version: 1,
|
|
42
|
+
primaryModelKeys: ["Person"],
|
|
43
|
+
models: {
|
|
44
|
+
Person: {
|
|
45
|
+
type: "record",
|
|
46
|
+
record
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Top-level structure
|
|
52
|
+
expect(wire.primaryModelKeys).toEqual(["Person"]);
|
|
53
|
+
expect(wire.models).toBeDefined();
|
|
54
|
+
|
|
55
|
+
// Model is flattened (no .record wrapper)
|
|
56
|
+
const personModel = wire.models["Person"];
|
|
57
|
+
expect(personModel).toBeDefined();
|
|
58
|
+
expect(personModel.type).toBe("record");
|
|
59
|
+
const person = personModel;
|
|
60
|
+
expect(person.key).toBe("Person");
|
|
61
|
+
expect(person.name).toBe("Person");
|
|
62
|
+
expect("record" in person).toBe(false); // no conjure nesting
|
|
63
|
+
|
|
64
|
+
// Field uses wire field names
|
|
65
|
+
const nameField = person.fields[0];
|
|
66
|
+
expect(nameField.key).toBe("name");
|
|
67
|
+
expect(nameField.fieldType).toBeDefined();
|
|
68
|
+
expect(nameField.metadata).toEqual({
|
|
69
|
+
addedInVersion: 1
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
it("should flatten union model", () => {
|
|
73
|
+
const wire = convertIrToWireSchema({
|
|
74
|
+
name: "Test",
|
|
75
|
+
description: "Test",
|
|
76
|
+
version: 1,
|
|
77
|
+
primaryModelKeys: ["Shape"],
|
|
78
|
+
models: {
|
|
79
|
+
Shape: {
|
|
80
|
+
type: "union",
|
|
81
|
+
union: {
|
|
82
|
+
key: "Shape",
|
|
83
|
+
discriminant: "shapeType",
|
|
84
|
+
name: "Shape",
|
|
85
|
+
variants: {
|
|
86
|
+
circle: "Circle",
|
|
87
|
+
square: "Square"
|
|
88
|
+
},
|
|
89
|
+
metadata: {
|
|
90
|
+
addedInVersion: 1
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const shapeModel = wire.models["Shape"];
|
|
97
|
+
expect(shapeModel).toBeDefined();
|
|
98
|
+
expect(shapeModel.type).toBe("union");
|
|
99
|
+
const shape = shapeModel;
|
|
100
|
+
expect(shape.key).toBe("Shape");
|
|
101
|
+
expect(shape.discriminant).toBe("shapeType");
|
|
102
|
+
expect(shape.variants).toEqual({
|
|
103
|
+
circle: "Circle",
|
|
104
|
+
square: "Square"
|
|
105
|
+
});
|
|
106
|
+
expect("union" in shape).toBe(false); // no conjure nesting
|
|
107
|
+
});
|
|
108
|
+
it("should convert value field type with FieldValueType wrapper", () => {
|
|
109
|
+
const record = {
|
|
110
|
+
key: "R",
|
|
111
|
+
name: "R",
|
|
112
|
+
fields: [{
|
|
113
|
+
key: "f",
|
|
114
|
+
name: "f",
|
|
115
|
+
fieldType: {
|
|
116
|
+
type: "value",
|
|
117
|
+
value: IFieldValueUnion.string({
|
|
118
|
+
defaultValue: "abc"
|
|
119
|
+
})
|
|
120
|
+
},
|
|
121
|
+
metadata: {
|
|
122
|
+
addedInVersion: 1
|
|
123
|
+
}
|
|
124
|
+
}]
|
|
125
|
+
};
|
|
126
|
+
const wire = convertIrToWireSchema({
|
|
127
|
+
name: "Test",
|
|
128
|
+
description: "Test",
|
|
129
|
+
version: 1,
|
|
130
|
+
primaryModelKeys: ["R"],
|
|
131
|
+
models: {
|
|
132
|
+
R: {
|
|
133
|
+
type: "record",
|
|
134
|
+
record
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
expect(wire.models["R"]).toBeDefined();
|
|
139
|
+
expect(wire.models["R"].type).toBe("record");
|
|
140
|
+
const recordModel = wire.models["R"];
|
|
141
|
+
const field = recordModel.fields[0];
|
|
142
|
+
|
|
143
|
+
// Wire format wraps in { valueType: { type: "string", defaultValue: "abc" } }
|
|
144
|
+
expect(field.fieldType).toEqual({
|
|
145
|
+
type: "value",
|
|
146
|
+
valueType: {
|
|
147
|
+
type: "string",
|
|
148
|
+
defaultValue: "abc"
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
it("should convert array field type with FieldValueType wrapper on elements", () => {
|
|
153
|
+
const record = {
|
|
154
|
+
key: "R",
|
|
155
|
+
name: "R",
|
|
156
|
+
fields: [{
|
|
157
|
+
key: "tags",
|
|
158
|
+
name: "Tags",
|
|
159
|
+
fieldType: {
|
|
160
|
+
type: "array",
|
|
161
|
+
array: {
|
|
162
|
+
allowNullValue: false,
|
|
163
|
+
value: IFieldValueUnion.string({})
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
metadata: {
|
|
167
|
+
addedInVersion: 1
|
|
168
|
+
}
|
|
169
|
+
}]
|
|
170
|
+
};
|
|
171
|
+
const wire = convertIrToWireSchema({
|
|
172
|
+
name: "Test",
|
|
173
|
+
description: "Test",
|
|
174
|
+
version: 1,
|
|
175
|
+
primaryModelKeys: ["R"],
|
|
176
|
+
models: {
|
|
177
|
+
R: {
|
|
178
|
+
type: "record",
|
|
179
|
+
record
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
expect(wire.models["R"]).toBeDefined();
|
|
184
|
+
expect(wire.models["R"].type).toBe("record");
|
|
185
|
+
const recordModel = wire.models["R"];
|
|
186
|
+
const field = recordModel.fields[0];
|
|
187
|
+
expect(field.fieldType).toEqual({
|
|
188
|
+
type: "array",
|
|
189
|
+
allowNullValue: false,
|
|
190
|
+
value: {
|
|
191
|
+
valueType: {
|
|
192
|
+
type: "string"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
it("should flatten all field value union variants", () => {
|
|
198
|
+
const variants = [{
|
|
199
|
+
fn: IFieldValueUnion.boolean,
|
|
200
|
+
type: "boolean",
|
|
201
|
+
payload: {}
|
|
202
|
+
}, {
|
|
203
|
+
fn: IFieldValueUnion.datetime,
|
|
204
|
+
type: "datetime",
|
|
205
|
+
payload: {}
|
|
206
|
+
}, {
|
|
207
|
+
fn: IFieldValueUnion.docRef,
|
|
208
|
+
type: "docRef",
|
|
209
|
+
payload: {
|
|
210
|
+
documentTypeRids: ["rid1"]
|
|
211
|
+
}
|
|
212
|
+
}, {
|
|
213
|
+
fn: IFieldValueUnion.double,
|
|
214
|
+
type: "double",
|
|
215
|
+
payload: {
|
|
216
|
+
minValue: 0,
|
|
217
|
+
maxValue: 100
|
|
218
|
+
}
|
|
219
|
+
}, {
|
|
220
|
+
fn: IFieldValueUnion.integer,
|
|
221
|
+
type: "integer",
|
|
222
|
+
payload: {
|
|
223
|
+
defaultValue: 42
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
fn: IFieldValueUnion.mediaRef,
|
|
227
|
+
type: "mediaRef",
|
|
228
|
+
payload: {}
|
|
229
|
+
}, {
|
|
230
|
+
fn: IFieldValueUnion.modelRef,
|
|
231
|
+
type: "modelRef",
|
|
232
|
+
payload: {
|
|
233
|
+
modelTypes: ["Foo"]
|
|
234
|
+
}
|
|
235
|
+
}, {
|
|
236
|
+
fn: IFieldValueUnion.object,
|
|
237
|
+
type: "object",
|
|
238
|
+
payload: {
|
|
239
|
+
interfaceTypeRids: [],
|
|
240
|
+
objectTypeRids: ["rid2"]
|
|
241
|
+
}
|
|
242
|
+
}, {
|
|
243
|
+
fn: IFieldValueUnion.string,
|
|
244
|
+
type: "string",
|
|
245
|
+
payload: {
|
|
246
|
+
maxLength: 255
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
fn: IFieldValueUnion.text,
|
|
250
|
+
type: "text",
|
|
251
|
+
payload: {}
|
|
252
|
+
}, {
|
|
253
|
+
fn: IFieldValueUnion.unmanagedJson,
|
|
254
|
+
type: "unmanagedJson",
|
|
255
|
+
payload: {}
|
|
256
|
+
}, {
|
|
257
|
+
fn: IFieldValueUnion.userRef,
|
|
258
|
+
type: "userRef",
|
|
259
|
+
payload: {}
|
|
260
|
+
}];
|
|
261
|
+
for (const {
|
|
262
|
+
fn,
|
|
263
|
+
type,
|
|
264
|
+
payload
|
|
265
|
+
} of variants) {
|
|
266
|
+
const record = {
|
|
267
|
+
key: "R",
|
|
268
|
+
name: "R",
|
|
269
|
+
fields: [{
|
|
270
|
+
key: "f",
|
|
271
|
+
name: "f",
|
|
272
|
+
fieldType: {
|
|
273
|
+
type: "value",
|
|
274
|
+
value: fn(payload)
|
|
275
|
+
},
|
|
276
|
+
metadata: {
|
|
277
|
+
addedInVersion: 1
|
|
278
|
+
}
|
|
279
|
+
}]
|
|
280
|
+
};
|
|
281
|
+
const wire = convertIrToWireSchema({
|
|
282
|
+
name: "Test",
|
|
283
|
+
description: "Test",
|
|
284
|
+
version: 1,
|
|
285
|
+
primaryModelKeys: ["R"],
|
|
286
|
+
models: {
|
|
287
|
+
R: {
|
|
288
|
+
type: "record",
|
|
289
|
+
record
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
expect(wire.models["R"]).toBeDefined();
|
|
294
|
+
expect(wire.models["R"].type).toBe("record");
|
|
295
|
+
const recordModel = wire.models["R"];
|
|
296
|
+
const fieldType = recordModel.fields[0].fieldType;
|
|
297
|
+
expect(fieldType.type).toBe("value");
|
|
298
|
+
const wireValue = fieldType.valueType;
|
|
299
|
+
expect(wireValue.type).toBe(type);
|
|
300
|
+
// no conjure nesting key
|
|
301
|
+
expect(wireValue[type]).toBeUndefined();
|
|
302
|
+
// Payload fields should be at top level
|
|
303
|
+
for (const [key, val] of Object.entries(payload)) {
|
|
304
|
+
expect(wireValue[key]).toEqual(val);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
it("should strip name, description, version from output", () => {
|
|
309
|
+
const wire = convertIrToWireSchema({
|
|
310
|
+
name: "My Schema",
|
|
311
|
+
description: "My description",
|
|
312
|
+
version: 5,
|
|
313
|
+
primaryModelKeys: [],
|
|
314
|
+
models: {}
|
|
315
|
+
});
|
|
316
|
+
expect("name" in wire).toBe(false);
|
|
317
|
+
expect("description" in wire).toBe(false);
|
|
318
|
+
expect("version" in wire).toBe(false);
|
|
319
|
+
expect(wire.primaryModelKeys).toEqual([]);
|
|
320
|
+
expect(wire.models).toEqual({});
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
//# sourceMappingURL=convertIrToWireSchema.test.js.map
|