@palantir/pack.schema 0.10.0 → 0.25.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/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-transpileBrowser.log +1 -1
- package/.turbo/turbo-transpileCjs.log +1 -1
- package/.turbo/turbo-transpileEsm.log +1 -1
- package/.turbo/turbo-transpileTypes.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +10 -0
- package/build/browser/index.js +5 -1
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +5 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +7 -2
- package/build/esm/index.js +5 -1
- package/build/esm/index.js.map +1 -1
- package/build/types/primitives.d.ts +6 -1
- package/build/types/primitives.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/primitives.ts +7 -0
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @palantir/pack.schema
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
## 0.24.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- eae6a45: Document Type schemas can now declare a field as a reference to an arbitrary platform resource via the new `resourceRef` field type, written as `S.ResourceRef`. Such fields surface as the new `ResourceRid` type in generated read and write types, matching the `string` / `z.string()` internal representation, and are reported through model metadata as `externalRefFieldTypes: { <field>: "resourceRef" }`. The generated document type asset carries the field as `{ type: "resourceRef" }`, allowing backpack to identify and extract resource references from document content.
|
|
10
|
+
|
|
11
|
+
Also fixes `RecordModelMetadata.externalRefFieldTypes` to be partial. It was `Record<keyof T, ExternalRefType>`, which required an entry for _every_ field in the model, so any model combining a reference field with ordinary fields produced a generated `models.ts` that did not typecheck.
|
|
12
|
+
|
|
3
13
|
## 0.10.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/build/browser/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var TypeKind = {
|
|
|
14
14
|
OBJECT_REF: "objectRef",
|
|
15
15
|
OPTIONAL: "optional",
|
|
16
16
|
REF: "ref",
|
|
17
|
+
RESOURCE_REF: "resourceRef",
|
|
17
18
|
STRING: "string",
|
|
18
19
|
UNKNOWN: "unknown",
|
|
19
20
|
USER_REF: "userRef"
|
|
@@ -30,6 +31,9 @@ var Boolean = {
|
|
|
30
31
|
var Unknown = {
|
|
31
32
|
type: TypeKind.UNKNOWN
|
|
32
33
|
};
|
|
34
|
+
var ResourceRef = {
|
|
35
|
+
type: TypeKind.RESOURCE_REF
|
|
36
|
+
};
|
|
33
37
|
function unwrapOneOptional(t) {
|
|
34
38
|
return t.type === TypeKind.OPTIONAL && "item" in t ? t.item : t;
|
|
35
39
|
}
|
|
@@ -390,6 +394,6 @@ function nextSchema(previous) {
|
|
|
390
394
|
return new SchemaVersionBuilderImpl(previous.models, version, previous, void 0, deprecations);
|
|
391
395
|
}
|
|
392
396
|
|
|
393
|
-
export { Array, Boolean, Double, ModelDefType, Optional, String, TypeKind, Unknown, applyMigration, createRef, defineMigration, defineRecord, defineSchema, defineSchemaUpdate, defineUnion, isRecordDef, isUnionDef, modelToRef, nextSchema, resolveUnionVariantArg };
|
|
397
|
+
export { Array, Boolean, Double, ModelDefType, Optional, ResourceRef, String, TypeKind, Unknown, applyMigration, createRef, defineMigration, defineRecord, defineSchema, defineSchemaUpdate, defineUnion, isRecordDef, isUnionDef, modelToRef, nextSchema, resolveUnionVariantArg };
|
|
394
398
|
//# sourceMappingURL=index.js.map
|
|
395
399
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/defs.ts","../../src/primitives.ts","../../src/utils.ts","../../src/defineUnion.ts","../../src/defineMigration.ts","../../src/defineRecord.ts","../../src/defineSchemaUpdate.ts"],"names":[],"mappings":";AAgBO,IAAM,YAAA,GAAe;AAA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A,EAAQ;AAAA,QACN,GAAG,IAAA,CAAK;AAAA,OACV;AAAA,MACA,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,UAAU,IAAA,CAAK,QAAA;AAAA,MACf,GAAI,IAAA,CAAK,WAAA,IAAe,IAAA,GAAO;AAAA,QAC7B,YAAY,IAAA,CAAK;AAAA,UACf,EAAC;AAAA,MACL,GAAI,IAAA,CAAK,aAAA,IAAiB,IAAA,GAAO;AAAA,QAC/B,cAAc,IAAA,CAAK;AAAA,UACjB;AAAC,KACP;AAAA,EACF;AACF,CAAA;AACO,SAAS,WAAW,QAAA,EAAU;AACnC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,GAAU,CAAA;AACnC,EAAA,MAAM,YAAA,GAAe,cAAA,IAAkB,QAAA,GAAW,QAAA,CAAS,YAAA,GAAe,MAAA;AAC1E,EAAA,OAAO,IAAI,wBAAA,CAAyB,QAAA,CAAS,QAAQ,OAAA,EAAS,QAAA,EAAU,QAAW,YAAY,CAAA;AACjG","file":"index.js","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 const ModelDefType = {\n RECORD: \"record\",\n UNION: \"union\"\n};","/*\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 const TypeKind = {\n ARRAY: \"array\",\n BOOLEAN: \"boolean\",\n DOC_REF: \"docRef\",\n DOUBLE: \"double\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n OPTIONAL: \"optional\",\n REF: \"ref\",\n STRING: \"string\",\n UNKNOWN: \"unknown\",\n USER_REF: \"userRef\"\n};\n\n// Forward declaration to avoid circular reference\n\n// A reference to a record or a union type\n\nexport const String = {\n type: TypeKind.STRING\n};\nexport const Double = {\n type: TypeKind.DOUBLE\n};\nexport const Boolean = {\n type: TypeKind.BOOLEAN\n};\nexport const Unknown = {\n type: TypeKind.UNKNOWN\n};\nfunction unwrapOneOptional(t) {\n return t.type === TypeKind.OPTIONAL && \"item\" in t ? t.item : t;\n}\nexport const Array = item => {\n if (unwrapOneOptional(item).type === TypeKind.ARRAY) {\n throw new Error(\"Nested arrays (Array(Array(...)) or Array(Optional(Array(...)))) are not supported. \" + \"Wrap the inner array in a record instead.\");\n }\n return {\n type: TypeKind.ARRAY,\n items: item\n };\n};\nexport const Optional = item => {\n if (item.type === TypeKind.OPTIONAL) {\n throw new Error(\"Nested optionals (Optional(Optional(...))) are not supported.\");\n }\n return {\n type: TypeKind.OPTIONAL,\n item\n };\n};","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\n\n/**\n * Helper function to safely transform a record definition to a reference.\n * This function helps TypeScript track type transformations better.\n */\nexport function modelToRef(model) {\n return createRef(model.name, model.type);\n}\n\n/**\n * Helper function to create a reference with proper typing.\n * This avoids type assertions in multiple places.\n */\nexport function createRef(name, refType) {\n return {\n type: TypeKind.REF,\n name,\n refType\n };\n}\n\n/**\n * Type guard to check if a value is a RecordDef\n */\nexport function isRecordDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.RECORD && \"fields\" in value;\n}\n\n/**\n * Type guard to check if a value is a UnionDef\n */\nexport function isUnionDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.UNION && \"variants\" in value;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\nimport { modelToRef } from \"./utils.js\";\nexport function defineUnion(name, {\n discriminant = \"type\",\n docs,\n variants\n}) {\n const entries = Object.entries(variants).map(([key, value]) => [key, resolveUnionVariantArg(value)]);\n const resolvedVariants = Object.fromEntries(entries);\n return {\n type: ModelDefType.UNION,\n discriminant,\n name,\n docs,\n variants: resolvedVariants\n };\n}\nexport function resolveUnionVariantArg(arg) {\n const resolved = typeof arg === \"function\" ? arg() : arg;\n return resolved.type === TypeKind.REF ? resolved : modelToRef(resolved);\n}","/*\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 { resolveUnionVariantArg } from \"./defineUnion.js\";\nimport { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef } from \"./utils.js\";\n\n/** Soon to be deprecated - Use `ModelDefs` instead. */\n\n/** Soon to be deprecated - use `ModelDefs` instead. */\n\n/**\n * Upgrade options for a field added in this version. Supplied as the third\n * argument to `addField`; surfaced by `applyMigration` as part of\n * `MigrationResult.upgrades`. Declares the structural dependency\n * (`derivedFrom`) the runtime lens uses to decide when to invoke the\n * upgrade function. The function itself — derived or constant — is supplied\n * at boot via the generated `DocumentModel(...)` factory's `UpgradeFns`\n * parameter.\n */\n\nclass UnionBuilderImpl {\n name;\n docs;\n variants;\n constructor({\n name,\n docs,\n variants\n }) {\n this.name = name;\n this.docs = docs;\n this.variants = {\n ...variants\n };\n }\n addVariant(variantName, modelDefOrRef) {\n const ref = resolveUnionVariantArg(modelDefOrRef);\n const newVariants = {\n ...this.variants,\n [variantName]: ref\n };\n return new UnionBuilderImpl({\n type: ModelDefType.UNION,\n name: this.name,\n variants: newVariants,\n discriminant: \"type\"\n });\n }\n build() {\n return {\n type: ModelDefType.UNION,\n variants: this.variants,\n discriminant: \"type\",\n name: this.name\n };\n }\n}\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `FieldOptions`. `applyMigration` reads this and then deletes the property,\n * so the `RecordDef` it returns is structurally clean (no extra keys, no\n * symbol-keyed metadata).\n */\nconst UPGRADE_OPTIONS_CARRIER = \"__pack_upgrade_options__\";\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `deprecateField` calls. `applyMigration` reads this and then deletes the\n * property, so the returned `RecordDef` is structurally clean. Maps field name\n * → its deprecation info.\n */\nconst DEPRECATED_FIELDS_CARRIER = \"__pack_deprecated_fields__\";\nclass RecordBuilderImpl {\n name;\n fields;\n upgradeOptions;\n deprecatedFields;\n constructor(initialRecordDef, upgradeOptions, deprecatedFields) {\n this.name = initialRecordDef.name;\n this.fields = {\n ...initialRecordDef.fields\n };\n // Upgrade options only flow forward within a single migration callback —\n // they are NOT inherited from the prior version's RecordDef, because each\n // version's upgrades describe a specific version transition.\n this.upgradeOptions = new Map(upgradeOptions ?? []);\n this.deprecatedFields = new Map(deprecatedFields ?? []);\n }\n\n // TODO: resolve field value from arg instead\n addField(name, value, options) {\n const next = new Map(this.upgradeOptions);\n if (options != null) {\n next.set(name, options);\n }\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields,\n [name]: value\n },\n docs: \"\"\n }, next, this.deprecatedFields);\n }\n deprecateField(name, message) {\n const next = new Map(this.deprecatedFields);\n next.set(name, {\n message\n });\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields\n },\n docs: \"\"\n }, this.upgradeOptions, next);\n }\n build() {\n const result = {\n type: ModelDefType.RECORD,\n name: this.name,\n fields: this.fields,\n docs: \"\"\n };\n if (this.upgradeOptions.size > 0) {\n Object.defineProperty(result, UPGRADE_OPTIONS_CARRIER, {\n value: this.upgradeOptions,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n if (this.deprecatedFields.size > 0) {\n Object.defineProperty(result, DEPRECATED_FIELDS_CARRIER, {\n value: this.deprecatedFields,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n return result;\n }\n}\nfunction makeBuilders(models) {\n const builders = {};\n for (const key in models) {\n const v = models[key];\n if (isRecordDef(v)) {\n builders[key] = new RecordBuilderImpl(v);\n } else if (isUnionDef(v)) {\n builders[key] = new UnionBuilderImpl(v);\n }\n }\n return builders;\n}\n\n/** Per-model field migrations: `[modelKey][fieldName]` → upgrade options. */\n\n/**\n * Lower-level entry point that returns the merged models plus the per-field\n * metadata collected during the migration callback: `UpgradeFieldOptions` from\n * `addField(name, type, options)` and deprecations from `deprecateField(name)`.\n * Used by `addSchemaUpdate` to fold sugar-form upgrades into a\n * `VersionedSchema`'s migrations map and deprecations into its deprecations map.\n *\n * Each `RecordBuilderImpl.build()` attaches its collected upgrade options and\n * deprecations to the produced `RecordDef` via two non-enumerable carrier\n * properties; this function walks the merged result, extracts both keyed by the\n * user's chosen output key (so renames are handled), and strips the carriers so\n * the returned `RecordDef`s are structurally clean.\n */\nexport function applyMigration(models, migration) {\n const builders = makeBuilders(models);\n const merged = {\n ...models,\n ...migration(builders)\n };\n const upgrades = {};\n const deprecations = {};\n for (const [modelKey, def] of Object.entries(merged)) {\n if (!isRecordDef(def)) continue;\n const carrier = def;\n const opts = carrier[UPGRADE_OPTIONS_CARRIER];\n if (opts != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[UPGRADE_OPTIONS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, options] of opts) {\n fieldEntries[fieldName] = options;\n }\n if (Object.keys(fieldEntries).length > 0) {\n upgrades[modelKey] = fieldEntries;\n }\n }\n const deprecated = carrier[DEPRECATED_FIELDS_CARRIER];\n if (deprecated != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[DEPRECATED_FIELDS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, info] of deprecated) {\n fieldEntries[fieldName] = info;\n }\n if (Object.keys(fieldEntries).length > 0) {\n deprecations[modelKey] = fieldEntries;\n }\n }\n }\n return {\n models: merged,\n upgrades: Object.keys(upgrades).length > 0 ? upgrades : undefined,\n deprecations: Object.keys(deprecations).length > 0 ? deprecations : undefined\n };\n}\nexport function defineMigration(models, migration) {\n return applyMigration(models, migration).models;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef, modelToRef } from \"./utils.js\";\n/**\n * Helper function to resolve a field value, handling functions and transforming\n * types as needed.\n */\nfunction resolveFieldArg(value) {\n // Handle function values\n const resolved = typeof value === \"function\" ? value() : value;\n if (isRecordDef(resolved) || isUnionDef(resolved)) {\n return modelToRef(resolved);\n }\n\n // For primitive types and other Types\n return resolved;\n}\nexport function defineRecord(name, record) {\n const entries = Object.entries(record.fields).map(([key, value]) => [key, resolveFieldArg(value)]);\n const fields = Object.fromEntries(entries);\n return {\n type: ModelDefType.RECORD,\n name: name,\n docs: record.docs,\n fields\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { applyMigration } from \"./defineMigration.js\";\nimport { isRecordDef } from \"./utils.js\";\nexport function defineSchema(models) {\n return {\n type: \"initial\",\n version: 1,\n models\n };\n}\nexport function defineSchemaUpdate(name, migration) {\n return {\n name,\n migration\n };\n}\n/**\n * Shallow-merge two `[modelKey][fieldName]` maps; `override` wins per field.\n * Used for both migrations (so `withMigrations` supplements `addField` sugar)\n * and deprecations (so each version's deprecations accumulate forward). The\n * maps are combined at both the model and field level.\n */\nfunction mergeByModelField(base, override) {\n if (base == null) return override;\n if (override == null) return base;\n const result = {\n ...base\n };\n for (const [modelKey, fields] of Object.entries(override)) {\n result[modelKey] = {\n ...result[modelKey],\n ...fields\n };\n }\n return result;\n}\n\n/**\n * Drop migration entries that no longer correspond to a field on a record in\n * `models`. Required because `mergeByModelField` is monotonic — a later\n * `addSchemaUpdate` that removes or retypes a field would otherwise leave a\n * stale entry in the accumulator. Entries are dropped when:\n * - the model key is no longer present,\n * - the model is no longer a record (e.g. replaced by a union), or\n * - the field name is no longer one of the record's fields.\n */\nfunction pruneMigrations(migrations, models) {\n if (migrations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const def = models[modelKey];\n if (!isRecordDef(def)) continue;\n const recordFields = def.fields;\n const kept = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n if (fieldName in recordFields) {\n kept[fieldName] = migration;\n }\n }\n if (Object.keys(kept).length > 0) {\n result[modelKey] = kept;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Convert the version-agnostic `FieldDeprecations` collected by `applyMigration`\n * (just `{ message? }`) into `VersionDeprecations` by stamping `fromVersion`.\n */\nfunction stampDeprecationVersions(deprecations, version) {\n if (deprecations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(deprecations)) {\n const out = {};\n for (const [fieldName, info] of Object.entries(fields)) {\n out[fieldName] = {\n fromVersion: version,\n ...info\n };\n }\n result[modelKey] = out;\n }\n return result;\n}\nclass SchemaVersionBuilderImpl {\n models;\n version;\n previous;\n _migrations;\n _deprecations;\n constructor(models, version, previous, migrations, deprecations) {\n this.models = models;\n this.version = version;\n this.previous = previous;\n this._migrations = migrations;\n this._deprecations = deprecations;\n }\n addSchemaUpdate(update) {\n // applyMigration returns the merged models, any sugar-form upgrades from\n // `addField(name, type, { derivedFrom })`, and any `deprecateField` calls.\n const {\n models,\n upgrades,\n deprecations\n } = applyMigration(this.models, update.migration);\n const merged = mergeByModelField(this._migrations, upgrades);\n // Reconcile against the new models: a later update that retypes a field\n // must drop the prior step's stale migration entry.\n const pruned = pruneMigrations(merged, models);\n // Attach this version to each freshly-deprecated field, then merge forward.\n const thisVersionDeprecations = stampDeprecationVersions(deprecations, this.version);\n const mergedDeprecations = mergeByModelField(this._deprecations, thisVersionDeprecations);\n return new SchemaVersionBuilderImpl(models, this.version, this.previous, pruned, mergedDeprecations);\n }\n withMigrations(migrations) {\n const merged = mergeByModelField(this._migrations, migrations);\n const pruned = pruneMigrations(merged, this.models);\n return new SchemaVersionBuilderImpl(this.models, this.version, this.previous, pruned, this._deprecations);\n }\n build() {\n return {\n type: \"versioned\",\n models: {\n ...this.models\n },\n version: this.version,\n previous: this.previous,\n ...(this._migrations != null ? {\n migrations: this._migrations\n } : {}),\n ...(this._deprecations != null ? {\n deprecations: this._deprecations\n } : {})\n };\n }\n}\nexport function nextSchema(previous) {\n const version = previous.version + 1;\n const deprecations = \"deprecations\" in previous ? previous.deprecations : undefined;\n return new SchemaVersionBuilderImpl(previous.models, version, previous, undefined, deprecations);\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/defs.ts","../../src/primitives.ts","../../src/utils.ts","../../src/defineUnion.ts","../../src/defineMigration.ts","../../src/defineRecord.ts","../../src/defineSchemaUpdate.ts"],"names":[],"mappings":";AAgBO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO;AACT;;;ACHO,IAAM,QAAA,GAAW;AAAA,EACtB,KAAA,EAAO,OAAA;AAAA,EACP,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,QAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU,UAAA;AAAA,EACV,GAAA,EAAK,KAAA;AAAA,EACL,YAAA,EAAc,aAAA;AAAA,EACd,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU;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ACF,CAAA;AACO,SAAS,WAAW,QAAA,EAAU;AACnC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,GAAU,CAAA;AACnC,EAAA,MAAM,YAAA,GAAe,cAAA,IAAkB,QAAA,GAAW,QAAA,CAAS,YAAA,GAAe,MAAA;AAC1E,EAAA,OAAO,IAAI,wBAAA,CAAyB,QAAA,CAAS,QAAQ,OAAA,EAAS,QAAA,EAAU,QAAW,YAAY,CAAA;AACjG","file":"index.js","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 const ModelDefType = {\n RECORD: \"record\",\n UNION: \"union\"\n};","/*\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 const TypeKind = {\n ARRAY: \"array\",\n BOOLEAN: \"boolean\",\n DOC_REF: \"docRef\",\n DOUBLE: \"double\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n OPTIONAL: \"optional\",\n REF: \"ref\",\n RESOURCE_REF: \"resourceRef\",\n STRING: \"string\",\n UNKNOWN: \"unknown\",\n USER_REF: \"userRef\"\n};\n\n// Forward declaration to avoid circular reference\n\n// A reference to a record or a union type\n\nexport const String = {\n type: TypeKind.STRING\n};\nexport const Double = {\n type: TypeKind.DOUBLE\n};\nexport const Boolean = {\n type: TypeKind.BOOLEAN\n};\nexport const Unknown = {\n type: TypeKind.UNKNOWN\n};\nexport const ResourceRef = {\n type: TypeKind.RESOURCE_REF\n};\nfunction unwrapOneOptional(t) {\n return t.type === TypeKind.OPTIONAL && \"item\" in t ? t.item : t;\n}\nexport const Array = item => {\n if (unwrapOneOptional(item).type === TypeKind.ARRAY) {\n throw new Error(\"Nested arrays (Array(Array(...)) or Array(Optional(Array(...)))) are not supported. \" + \"Wrap the inner array in a record instead.\");\n }\n return {\n type: TypeKind.ARRAY,\n items: item\n };\n};\nexport const Optional = item => {\n if (item.type === TypeKind.OPTIONAL) {\n throw new Error(\"Nested optionals (Optional(Optional(...))) are not supported.\");\n }\n return {\n type: TypeKind.OPTIONAL,\n item\n };\n};","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\n\n/**\n * Helper function to safely transform a record definition to a reference.\n * This function helps TypeScript track type transformations better.\n */\nexport function modelToRef(model) {\n return createRef(model.name, model.type);\n}\n\n/**\n * Helper function to create a reference with proper typing.\n * This avoids type assertions in multiple places.\n */\nexport function createRef(name, refType) {\n return {\n type: TypeKind.REF,\n name,\n refType\n };\n}\n\n/**\n * Type guard to check if a value is a RecordDef\n */\nexport function isRecordDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.RECORD && \"fields\" in value;\n}\n\n/**\n * Type guard to check if a value is a UnionDef\n */\nexport function isUnionDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.UNION && \"variants\" in value;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\nimport { modelToRef } from \"./utils.js\";\nexport function defineUnion(name, {\n discriminant = \"type\",\n docs,\n variants\n}) {\n const entries = Object.entries(variants).map(([key, value]) => [key, resolveUnionVariantArg(value)]);\n const resolvedVariants = Object.fromEntries(entries);\n return {\n type: ModelDefType.UNION,\n discriminant,\n name,\n docs,\n variants: resolvedVariants\n };\n}\nexport function resolveUnionVariantArg(arg) {\n const resolved = typeof arg === \"function\" ? arg() : arg;\n return resolved.type === TypeKind.REF ? resolved : modelToRef(resolved);\n}","/*\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 { resolveUnionVariantArg } from \"./defineUnion.js\";\nimport { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef } from \"./utils.js\";\n\n/** Soon to be deprecated - Use `ModelDefs` instead. */\n\n/** Soon to be deprecated - use `ModelDefs` instead. */\n\n/**\n * Upgrade options for a field added in this version. Supplied as the third\n * argument to `addField`; surfaced by `applyMigration` as part of\n * `MigrationResult.upgrades`. Declares the structural dependency\n * (`derivedFrom`) the runtime lens uses to decide when to invoke the\n * upgrade function. The function itself — derived or constant — is supplied\n * at boot via the generated `DocumentModel(...)` factory's `UpgradeFns`\n * parameter.\n */\n\nclass UnionBuilderImpl {\n name;\n docs;\n variants;\n constructor({\n name,\n docs,\n variants\n }) {\n this.name = name;\n this.docs = docs;\n this.variants = {\n ...variants\n };\n }\n addVariant(variantName, modelDefOrRef) {\n const ref = resolveUnionVariantArg(modelDefOrRef);\n const newVariants = {\n ...this.variants,\n [variantName]: ref\n };\n return new UnionBuilderImpl({\n type: ModelDefType.UNION,\n name: this.name,\n variants: newVariants,\n discriminant: \"type\"\n });\n }\n build() {\n return {\n type: ModelDefType.UNION,\n variants: this.variants,\n discriminant: \"type\",\n name: this.name\n };\n }\n}\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `FieldOptions`. `applyMigration` reads this and then deletes the property,\n * so the `RecordDef` it returns is structurally clean (no extra keys, no\n * symbol-keyed metadata).\n */\nconst UPGRADE_OPTIONS_CARRIER = \"__pack_upgrade_options__\";\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `deprecateField` calls. `applyMigration` reads this and then deletes the\n * property, so the returned `RecordDef` is structurally clean. Maps field name\n * → its deprecation info.\n */\nconst DEPRECATED_FIELDS_CARRIER = \"__pack_deprecated_fields__\";\nclass RecordBuilderImpl {\n name;\n fields;\n upgradeOptions;\n deprecatedFields;\n constructor(initialRecordDef, upgradeOptions, deprecatedFields) {\n this.name = initialRecordDef.name;\n this.fields = {\n ...initialRecordDef.fields\n };\n // Upgrade options only flow forward within a single migration callback —\n // they are NOT inherited from the prior version's RecordDef, because each\n // version's upgrades describe a specific version transition.\n this.upgradeOptions = new Map(upgradeOptions ?? []);\n this.deprecatedFields = new Map(deprecatedFields ?? []);\n }\n\n // TODO: resolve field value from arg instead\n addField(name, value, options) {\n const next = new Map(this.upgradeOptions);\n if (options != null) {\n next.set(name, options);\n }\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields,\n [name]: value\n },\n docs: \"\"\n }, next, this.deprecatedFields);\n }\n deprecateField(name, message) {\n const next = new Map(this.deprecatedFields);\n next.set(name, {\n message\n });\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields\n },\n docs: \"\"\n }, this.upgradeOptions, next);\n }\n build() {\n const result = {\n type: ModelDefType.RECORD,\n name: this.name,\n fields: this.fields,\n docs: \"\"\n };\n if (this.upgradeOptions.size > 0) {\n Object.defineProperty(result, UPGRADE_OPTIONS_CARRIER, {\n value: this.upgradeOptions,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n if (this.deprecatedFields.size > 0) {\n Object.defineProperty(result, DEPRECATED_FIELDS_CARRIER, {\n value: this.deprecatedFields,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n return result;\n }\n}\nfunction makeBuilders(models) {\n const builders = {};\n for (const key in models) {\n const v = models[key];\n if (isRecordDef(v)) {\n builders[key] = new RecordBuilderImpl(v);\n } else if (isUnionDef(v)) {\n builders[key] = new UnionBuilderImpl(v);\n }\n }\n return builders;\n}\n\n/** Per-model field migrations: `[modelKey][fieldName]` → upgrade options. */\n\n/**\n * Lower-level entry point that returns the merged models plus the per-field\n * metadata collected during the migration callback: `UpgradeFieldOptions` from\n * `addField(name, type, options)` and deprecations from `deprecateField(name)`.\n * Used by `addSchemaUpdate` to fold sugar-form upgrades into a\n * `VersionedSchema`'s migrations map and deprecations into its deprecations map.\n *\n * Each `RecordBuilderImpl.build()` attaches its collected upgrade options and\n * deprecations to the produced `RecordDef` via two non-enumerable carrier\n * properties; this function walks the merged result, extracts both keyed by the\n * user's chosen output key (so renames are handled), and strips the carriers so\n * the returned `RecordDef`s are structurally clean.\n */\nexport function applyMigration(models, migration) {\n const builders = makeBuilders(models);\n const merged = {\n ...models,\n ...migration(builders)\n };\n const upgrades = {};\n const deprecations = {};\n for (const [modelKey, def] of Object.entries(merged)) {\n if (!isRecordDef(def)) continue;\n const carrier = def;\n const opts = carrier[UPGRADE_OPTIONS_CARRIER];\n if (opts != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[UPGRADE_OPTIONS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, options] of opts) {\n fieldEntries[fieldName] = options;\n }\n if (Object.keys(fieldEntries).length > 0) {\n upgrades[modelKey] = fieldEntries;\n }\n }\n const deprecated = carrier[DEPRECATED_FIELDS_CARRIER];\n if (deprecated != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[DEPRECATED_FIELDS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, info] of deprecated) {\n fieldEntries[fieldName] = info;\n }\n if (Object.keys(fieldEntries).length > 0) {\n deprecations[modelKey] = fieldEntries;\n }\n }\n }\n return {\n models: merged,\n upgrades: Object.keys(upgrades).length > 0 ? upgrades : undefined,\n deprecations: Object.keys(deprecations).length > 0 ? deprecations : undefined\n };\n}\nexport function defineMigration(models, migration) {\n return applyMigration(models, migration).models;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef, modelToRef } from \"./utils.js\";\n/**\n * Helper function to resolve a field value, handling functions and transforming\n * types as needed.\n */\nfunction resolveFieldArg(value) {\n // Handle function values\n const resolved = typeof value === \"function\" ? value() : value;\n if (isRecordDef(resolved) || isUnionDef(resolved)) {\n return modelToRef(resolved);\n }\n\n // For primitive types and other Types\n return resolved;\n}\nexport function defineRecord(name, record) {\n const entries = Object.entries(record.fields).map(([key, value]) => [key, resolveFieldArg(value)]);\n const fields = Object.fromEntries(entries);\n return {\n type: ModelDefType.RECORD,\n name: name,\n docs: record.docs,\n fields\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { applyMigration } from \"./defineMigration.js\";\nimport { isRecordDef } from \"./utils.js\";\nexport function defineSchema(models) {\n return {\n type: \"initial\",\n version: 1,\n models\n };\n}\nexport function defineSchemaUpdate(name, migration) {\n return {\n name,\n migration\n };\n}\n/**\n * Shallow-merge two `[modelKey][fieldName]` maps; `override` wins per field.\n * Used for both migrations (so `withMigrations` supplements `addField` sugar)\n * and deprecations (so each version's deprecations accumulate forward). The\n * maps are combined at both the model and field level.\n */\nfunction mergeByModelField(base, override) {\n if (base == null) return override;\n if (override == null) return base;\n const result = {\n ...base\n };\n for (const [modelKey, fields] of Object.entries(override)) {\n result[modelKey] = {\n ...result[modelKey],\n ...fields\n };\n }\n return result;\n}\n\n/**\n * Drop migration entries that no longer correspond to a field on a record in\n * `models`. Required because `mergeByModelField` is monotonic — a later\n * `addSchemaUpdate` that removes or retypes a field would otherwise leave a\n * stale entry in the accumulator. Entries are dropped when:\n * - the model key is no longer present,\n * - the model is no longer a record (e.g. replaced by a union), or\n * - the field name is no longer one of the record's fields.\n */\nfunction pruneMigrations(migrations, models) {\n if (migrations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const def = models[modelKey];\n if (!isRecordDef(def)) continue;\n const recordFields = def.fields;\n const kept = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n if (fieldName in recordFields) {\n kept[fieldName] = migration;\n }\n }\n if (Object.keys(kept).length > 0) {\n result[modelKey] = kept;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Convert the version-agnostic `FieldDeprecations` collected by `applyMigration`\n * (just `{ message? }`) into `VersionDeprecations` by stamping `fromVersion`.\n */\nfunction stampDeprecationVersions(deprecations, version) {\n if (deprecations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(deprecations)) {\n const out = {};\n for (const [fieldName, info] of Object.entries(fields)) {\n out[fieldName] = {\n fromVersion: version,\n ...info\n };\n }\n result[modelKey] = out;\n }\n return result;\n}\nclass SchemaVersionBuilderImpl {\n models;\n version;\n previous;\n _migrations;\n _deprecations;\n constructor(models, version, previous, migrations, deprecations) {\n this.models = models;\n this.version = version;\n this.previous = previous;\n this._migrations = migrations;\n this._deprecations = deprecations;\n }\n addSchemaUpdate(update) {\n // applyMigration returns the merged models, any sugar-form upgrades from\n // `addField(name, type, { derivedFrom })`, and any `deprecateField` calls.\n const {\n models,\n upgrades,\n deprecations\n } = applyMigration(this.models, update.migration);\n const merged = mergeByModelField(this._migrations, upgrades);\n // Reconcile against the new models: a later update that retypes a field\n // must drop the prior step's stale migration entry.\n const pruned = pruneMigrations(merged, models);\n // Attach this version to each freshly-deprecated field, then merge forward.\n const thisVersionDeprecations = stampDeprecationVersions(deprecations, this.version);\n const mergedDeprecations = mergeByModelField(this._deprecations, thisVersionDeprecations);\n return new SchemaVersionBuilderImpl(models, this.version, this.previous, pruned, mergedDeprecations);\n }\n withMigrations(migrations) {\n const merged = mergeByModelField(this._migrations, migrations);\n const pruned = pruneMigrations(merged, this.models);\n return new SchemaVersionBuilderImpl(this.models, this.version, this.previous, pruned, this._deprecations);\n }\n build() {\n return {\n type: \"versioned\",\n models: {\n ...this.models\n },\n version: this.version,\n previous: this.previous,\n ...(this._migrations != null ? {\n migrations: this._migrations\n } : {}),\n ...(this._deprecations != null ? {\n deprecations: this._deprecations\n } : {})\n };\n }\n}\nexport function nextSchema(previous) {\n const version = previous.version + 1;\n const deprecations = \"deprecations\" in previous ? previous.deprecations : undefined;\n return new SchemaVersionBuilderImpl(previous.models, version, previous, undefined, deprecations);\n}"]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ var TypeKind = {
|
|
|
16
16
|
OBJECT_REF: "objectRef",
|
|
17
17
|
OPTIONAL: "optional",
|
|
18
18
|
REF: "ref",
|
|
19
|
+
RESOURCE_REF: "resourceRef",
|
|
19
20
|
STRING: "string",
|
|
20
21
|
UNKNOWN: "unknown",
|
|
21
22
|
USER_REF: "userRef"
|
|
@@ -32,6 +33,9 @@ var Boolean = {
|
|
|
32
33
|
var Unknown = {
|
|
33
34
|
type: TypeKind.UNKNOWN
|
|
34
35
|
};
|
|
36
|
+
var ResourceRef = {
|
|
37
|
+
type: TypeKind.RESOURCE_REF
|
|
38
|
+
};
|
|
35
39
|
function unwrapOneOptional(t) {
|
|
36
40
|
return t.type === TypeKind.OPTIONAL && "item" in t ? t.item : t;
|
|
37
41
|
}
|
|
@@ -397,6 +401,7 @@ exports.Boolean = Boolean;
|
|
|
397
401
|
exports.Double = Double;
|
|
398
402
|
exports.ModelDefType = ModelDefType;
|
|
399
403
|
exports.Optional = Optional;
|
|
404
|
+
exports.ResourceRef = ResourceRef;
|
|
400
405
|
exports.String = String;
|
|
401
406
|
exports.TypeKind = TypeKind;
|
|
402
407
|
exports.Unknown = Unknown;
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/defs.ts","../../src/primitives.ts","../../src/utils.ts","../../src/defineUnion.ts","../../src/defineMigration.ts","../../src/defineRecord.ts","../../src/defineSchemaUpdate.ts"],"names":[],"mappings":";;;AAgBO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO;AACT;;;ACHO,IAAM,QAAA,GAAW;AAAA,EACtB,KAAA,EAAO,OAAA;AAAA,EACP,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,QAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU,UAAA;AAAA,EACV,GAAA,EAAK,KAAA;AAAA,EACL,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU;AACZ;AAMO,IAAM,MAAA,GAAS;AAAA,EACpB,MAAM,QAAA,CAAS;AACjB;AACO,IAAM,MAAA,GAAS;AAAA,EACpB,MAAM,QAAA,CAAS;AACjB;AACO,IAAM,OAAA,GAAU;AAAA,EACrB,MAAM,QAAA,CAAS;AACjB;AACO,IAAM,OAAA,GAAU;AAAA,EACrB,MAAM,QAAA,CAAS;AACjB;AACA,SAAS,kBAAkB,CAAA,EAAG;AAC5B,EAAA,OAAO,EAAE,IAAA,KAAS,QAAA,CAAS,YAAY,MAAA,IAAU,CAAA,GAAI,EAAE,IAAA,GAAO,CAAA;AAChE;AACO,IAAM,QAAQ,CAAA,IAAA,KAAQ;AAC3B,EAAA,IAAI,iBAAA,CAAkB,IAAI,CAAA,CAAE,IAAA,KAAS,SAAS,KAAA,EAAO;AACnD,IAAA,MAAM,IAAI,MAAM,+HAAoI,CAAA;AAAA,EACtJ;AACA,EAAA,OAAO;AAAA,IACL,MAAM,QAAA,CAAS,KAAA;AAAA,IACf,KAAA,EAAO;AAAA,GACT;AACF;AACO,IAAM,WAAW,CAAA,IAAA,KAAQ;AAC9B,EAAA,IAAI,IAAA,CAA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,CAAK,aAAa,CAAA;AAAA,EAC1G;AAAA,EACA,KAAA,GAAQ;AACN,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,WAAA;AAAA,MACN,MAAA,EAAQ;AAAA,QACN,GAAG,IAAA,CAAK;AAAA,OACV;AAAA,MACA,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,UAAU,IAAA,CAAK,QAAA;AAAA,MACf,GAAI,IAAA,CAAK,WAAA,IAAe,IAAA,GAAO;AAAA,QAC7B,YAAY,IAAA,CAAK;AAAA,UACf,EAAC;AAAA,MACL,GAAI,IAAA,CAAK,aAAA,IAAiB,IAAA,GAAO;AAAA,QAC/B,cAAc,IAAA,CAAK;AAAA,UACjB;AAAC,KACP;AAAA,EACF;AACF,CAAA;AACO,SAAS,WAAW,QAAA,EAAU;AACnC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,GAAU,CAAA;AACnC,EAAA,MAAM,YAAA,GAAe,cAAA,IAAkB,QAAA,GAAW,QAAA,CAAS,YAAA,GAAe,MAAA;AAC1E,EAAA,OAAO,IAAI,wBAAA,CAAyB,QAAA,CAAS,QAAQ,OAAA,EAAS,QAAA,EAAU,QAAW,YAAY,CAAA;AACjG","file":"index.cjs","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 const ModelDefType = {\n RECORD: \"record\",\n UNION: \"union\"\n};","/*\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 const TypeKind = {\n ARRAY: \"array\",\n BOOLEAN: \"boolean\",\n DOC_REF: \"docRef\",\n DOUBLE: \"double\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n OPTIONAL: \"optional\",\n REF: \"ref\",\n STRING: \"string\",\n UNKNOWN: \"unknown\",\n USER_REF: \"userRef\"\n};\n\n// Forward declaration to avoid circular reference\n\n// A reference to a record or a union type\n\nexport const String = {\n type: TypeKind.STRING\n};\nexport const Double = {\n type: TypeKind.DOUBLE\n};\nexport const Boolean = {\n type: TypeKind.BOOLEAN\n};\nexport const Unknown = {\n type: TypeKind.UNKNOWN\n};\nfunction unwrapOneOptional(t) {\n return t.type === TypeKind.OPTIONAL && \"item\" in t ? t.item : t;\n}\nexport const Array = item => {\n if (unwrapOneOptional(item).type === TypeKind.ARRAY) {\n throw new Error(\"Nested arrays (Array(Array(...)) or Array(Optional(Array(...)))) are not supported. \" + \"Wrap the inner array in a record instead.\");\n }\n return {\n type: TypeKind.ARRAY,\n items: item\n };\n};\nexport const Optional = item => {\n if (item.type === TypeKind.OPTIONAL) {\n throw new Error(\"Nested optionals (Optional(Optional(...))) are not supported.\");\n }\n return {\n type: TypeKind.OPTIONAL,\n item\n };\n};","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\n\n/**\n * Helper function to safely transform a record definition to a reference.\n * This function helps TypeScript track type transformations better.\n */\nexport function modelToRef(model) {\n return createRef(model.name, model.type);\n}\n\n/**\n * Helper function to create a reference with proper typing.\n * This avoids type assertions in multiple places.\n */\nexport function createRef(name, refType) {\n return {\n type: TypeKind.REF,\n name,\n refType\n };\n}\n\n/**\n * Type guard to check if a value is a RecordDef\n */\nexport function isRecordDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.RECORD && \"fields\" in value;\n}\n\n/**\n * Type guard to check if a value is a UnionDef\n */\nexport function isUnionDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.UNION && \"variants\" in value;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\nimport { modelToRef } from \"./utils.js\";\nexport function defineUnion(name, {\n discriminant = \"type\",\n docs,\n variants\n}) {\n const entries = Object.entries(variants).map(([key, value]) => [key, resolveUnionVariantArg(value)]);\n const resolvedVariants = Object.fromEntries(entries);\n return {\n type: ModelDefType.UNION,\n discriminant,\n name,\n docs,\n variants: resolvedVariants\n };\n}\nexport function resolveUnionVariantArg(arg) {\n const resolved = typeof arg === \"function\" ? arg() : arg;\n return resolved.type === TypeKind.REF ? resolved : modelToRef(resolved);\n}","/*\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 { resolveUnionVariantArg } from \"./defineUnion.js\";\nimport { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef } from \"./utils.js\";\n\n/** Soon to be deprecated - Use `ModelDefs` instead. */\n\n/** Soon to be deprecated - use `ModelDefs` instead. */\n\n/**\n * Upgrade options for a field added in this version. Supplied as the third\n * argument to `addField`; surfaced by `applyMigration` as part of\n * `MigrationResult.upgrades`. Declares the structural dependency\n * (`derivedFrom`) the runtime lens uses to decide when to invoke the\n * upgrade function. The function itself — derived or constant — is supplied\n * at boot via the generated `DocumentModel(...)` factory's `UpgradeFns`\n * parameter.\n */\n\nclass UnionBuilderImpl {\n name;\n docs;\n variants;\n constructor({\n name,\n docs,\n variants\n }) {\n this.name = name;\n this.docs = docs;\n this.variants = {\n ...variants\n };\n }\n addVariant(variantName, modelDefOrRef) {\n const ref = resolveUnionVariantArg(modelDefOrRef);\n const newVariants = {\n ...this.variants,\n [variantName]: ref\n };\n return new UnionBuilderImpl({\n type: ModelDefType.UNION,\n name: this.name,\n variants: newVariants,\n discriminant: \"type\"\n });\n }\n build() {\n return {\n type: ModelDefType.UNION,\n variants: this.variants,\n discriminant: \"type\",\n name: this.name\n };\n }\n}\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `FieldOptions`. `applyMigration` reads this and then deletes the property,\n * so the `RecordDef` it returns is structurally clean (no extra keys, no\n * symbol-keyed metadata).\n */\nconst UPGRADE_OPTIONS_CARRIER = \"__pack_upgrade_options__\";\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `deprecateField` calls. `applyMigration` reads this and then deletes the\n * property, so the returned `RecordDef` is structurally clean. Maps field name\n * → its deprecation info.\n */\nconst DEPRECATED_FIELDS_CARRIER = \"__pack_deprecated_fields__\";\nclass RecordBuilderImpl {\n name;\n fields;\n upgradeOptions;\n deprecatedFields;\n constructor(initialRecordDef, upgradeOptions, deprecatedFields) {\n this.name = initialRecordDef.name;\n this.fields = {\n ...initialRecordDef.fields\n };\n // Upgrade options only flow forward within a single migration callback —\n // they are NOT inherited from the prior version's RecordDef, because each\n // version's upgrades describe a specific version transition.\n this.upgradeOptions = new Map(upgradeOptions ?? []);\n this.deprecatedFields = new Map(deprecatedFields ?? []);\n }\n\n // TODO: resolve field value from arg instead\n addField(name, value, options) {\n const next = new Map(this.upgradeOptions);\n if (options != null) {\n next.set(name, options);\n }\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields,\n [name]: value\n },\n docs: \"\"\n }, next, this.deprecatedFields);\n }\n deprecateField(name, message) {\n const next = new Map(this.deprecatedFields);\n next.set(name, {\n message\n });\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields\n },\n docs: \"\"\n }, this.upgradeOptions, next);\n }\n build() {\n const result = {\n type: ModelDefType.RECORD,\n name: this.name,\n fields: this.fields,\n docs: \"\"\n };\n if (this.upgradeOptions.size > 0) {\n Object.defineProperty(result, UPGRADE_OPTIONS_CARRIER, {\n value: this.upgradeOptions,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n if (this.deprecatedFields.size > 0) {\n Object.defineProperty(result, DEPRECATED_FIELDS_CARRIER, {\n value: this.deprecatedFields,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n return result;\n }\n}\nfunction makeBuilders(models) {\n const builders = {};\n for (const key in models) {\n const v = models[key];\n if (isRecordDef(v)) {\n builders[key] = new RecordBuilderImpl(v);\n } else if (isUnionDef(v)) {\n builders[key] = new UnionBuilderImpl(v);\n }\n }\n return builders;\n}\n\n/** Per-model field migrations: `[modelKey][fieldName]` → upgrade options. */\n\n/**\n * Lower-level entry point that returns the merged models plus the per-field\n * metadata collected during the migration callback: `UpgradeFieldOptions` from\n * `addField(name, type, options)` and deprecations from `deprecateField(name)`.\n * Used by `addSchemaUpdate` to fold sugar-form upgrades into a\n * `VersionedSchema`'s migrations map and deprecations into its deprecations map.\n *\n * Each `RecordBuilderImpl.build()` attaches its collected upgrade options and\n * deprecations to the produced `RecordDef` via two non-enumerable carrier\n * properties; this function walks the merged result, extracts both keyed by the\n * user's chosen output key (so renames are handled), and strips the carriers so\n * the returned `RecordDef`s are structurally clean.\n */\nexport function applyMigration(models, migration) {\n const builders = makeBuilders(models);\n const merged = {\n ...models,\n ...migration(builders)\n };\n const upgrades = {};\n const deprecations = {};\n for (const [modelKey, def] of Object.entries(merged)) {\n if (!isRecordDef(def)) continue;\n const carrier = def;\n const opts = carrier[UPGRADE_OPTIONS_CARRIER];\n if (opts != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[UPGRADE_OPTIONS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, options] of opts) {\n fieldEntries[fieldName] = options;\n }\n if (Object.keys(fieldEntries).length > 0) {\n upgrades[modelKey] = fieldEntries;\n }\n }\n const deprecated = carrier[DEPRECATED_FIELDS_CARRIER];\n if (deprecated != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[DEPRECATED_FIELDS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, info] of deprecated) {\n fieldEntries[fieldName] = info;\n }\n if (Object.keys(fieldEntries).length > 0) {\n deprecations[modelKey] = fieldEntries;\n }\n }\n }\n return {\n models: merged,\n upgrades: Object.keys(upgrades).length > 0 ? upgrades : undefined,\n deprecations: Object.keys(deprecations).length > 0 ? deprecations : undefined\n };\n}\nexport function defineMigration(models, migration) {\n return applyMigration(models, migration).models;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef, modelToRef } from \"./utils.js\";\n/**\n * Helper function to resolve a field value, handling functions and transforming\n * types as needed.\n */\nfunction resolveFieldArg(value) {\n // Handle function values\n const resolved = typeof value === \"function\" ? value() : value;\n if (isRecordDef(resolved) || isUnionDef(resolved)) {\n return modelToRef(resolved);\n }\n\n // For primitive types and other Types\n return resolved;\n}\nexport function defineRecord(name, record) {\n const entries = Object.entries(record.fields).map(([key, value]) => [key, resolveFieldArg(value)]);\n const fields = Object.fromEntries(entries);\n return {\n type: ModelDefType.RECORD,\n name: name,\n docs: record.docs,\n fields\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { applyMigration } from \"./defineMigration.js\";\nimport { isRecordDef } from \"./utils.js\";\nexport function defineSchema(models) {\n return {\n type: \"initial\",\n version: 1,\n models\n };\n}\nexport function defineSchemaUpdate(name, migration) {\n return {\n name,\n migration\n };\n}\n/**\n * Shallow-merge two `[modelKey][fieldName]` maps; `override` wins per field.\n * Used for both migrations (so `withMigrations` supplements `addField` sugar)\n * and deprecations (so each version's deprecations accumulate forward). The\n * maps are combined at both the model and field level.\n */\nfunction mergeByModelField(base, override) {\n if (base == null) return override;\n if (override == null) return base;\n const result = {\n ...base\n };\n for (const [modelKey, fields] of Object.entries(override)) {\n result[modelKey] = {\n ...result[modelKey],\n ...fields\n };\n }\n return result;\n}\n\n/**\n * Drop migration entries that no longer correspond to a field on a record in\n * `models`. Required because `mergeByModelField` is monotonic — a later\n * `addSchemaUpdate` that removes or retypes a field would otherwise leave a\n * stale entry in the accumulator. Entries are dropped when:\n * - the model key is no longer present,\n * - the model is no longer a record (e.g. replaced by a union), or\n * - the field name is no longer one of the record's fields.\n */\nfunction pruneMigrations(migrations, models) {\n if (migrations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const def = models[modelKey];\n if (!isRecordDef(def)) continue;\n const recordFields = def.fields;\n const kept = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n if (fieldName in recordFields) {\n kept[fieldName] = migration;\n }\n }\n if (Object.keys(kept).length > 0) {\n result[modelKey] = kept;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Convert the version-agnostic `FieldDeprecations` collected by `applyMigration`\n * (just `{ message? }`) into `VersionDeprecations` by stamping `fromVersion`.\n */\nfunction stampDeprecationVersions(deprecations, version) {\n if (deprecations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(deprecations)) {\n const out = {};\n for (const [fieldName, info] of Object.entries(fields)) {\n out[fieldName] = {\n fromVersion: version,\n ...info\n };\n }\n result[modelKey] = out;\n }\n return result;\n}\nclass SchemaVersionBuilderImpl {\n models;\n version;\n previous;\n _migrations;\n _deprecations;\n constructor(models, version, previous, migrations, deprecations) {\n this.models = models;\n this.version = version;\n this.previous = previous;\n this._migrations = migrations;\n this._deprecations = deprecations;\n }\n addSchemaUpdate(update) {\n // applyMigration returns the merged models, any sugar-form upgrades from\n // `addField(name, type, { derivedFrom })`, and any `deprecateField` calls.\n const {\n models,\n upgrades,\n deprecations\n } = applyMigration(this.models, update.migration);\n const merged = mergeByModelField(this._migrations, upgrades);\n // Reconcile against the new models: a later update that retypes a field\n // must drop the prior step's stale migration entry.\n const pruned = pruneMigrations(merged, models);\n // Attach this version to each freshly-deprecated field, then merge forward.\n const thisVersionDeprecations = stampDeprecationVersions(deprecations, this.version);\n const mergedDeprecations = mergeByModelField(this._deprecations, thisVersionDeprecations);\n return new SchemaVersionBuilderImpl(models, this.version, this.previous, pruned, mergedDeprecations);\n }\n withMigrations(migrations) {\n const merged = mergeByModelField(this._migrations, migrations);\n const pruned = pruneMigrations(merged, this.models);\n return new SchemaVersionBuilderImpl(this.models, this.version, this.previous, pruned, this._deprecations);\n }\n build() {\n return {\n type: \"versioned\",\n models: {\n ...this.models\n },\n version: this.version,\n previous: this.previous,\n ...(this._migrations != null ? {\n migrations: this._migrations\n } : {}),\n ...(this._deprecations != null ? {\n deprecations: this._deprecations\n } : {})\n };\n }\n}\nexport function nextSchema(previous) {\n const version = previous.version + 1;\n const deprecations = \"deprecations\" in previous ? previous.deprecations : undefined;\n return new SchemaVersionBuilderImpl(previous.models, version, previous, undefined, deprecations);\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/defs.ts","../../src/primitives.ts","../../src/utils.ts","../../src/defineUnion.ts","../../src/defineMigration.ts","../../src/defineRecord.ts","../../src/defineSchemaUpdate.ts"],"names":[],"mappings":";;;AAgBO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO;AACT;;;ACHO,IAAM,QAAA,GAAW;AAAA,EACtB,KAAA,EAAO,OAAA;AAAA,EACP,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,QAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU,UAAA;AAAA,EACV,GAAA,E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;AAAA,MACL,GAAI,IAAA,CAAK,aAAA,IAAiB,IAAA,GAAO;AAAA,QAC/B,cAAc,IAAA,CAAK;AAAA,UACjB;AAAC,KACP;AAAA,EACF;AACF,CAAA;AACO,SAAS,WAAW,QAAA,EAAU;AACnC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,GAAU,CAAA;AACnC,EAAA,MAAM,YAAA,GAAe,cAAA,IAAkB,QAAA,GAAW,QAAA,CAAS,YAAA,GAAe,MAAA;AAC1E,EAAA,OAAO,IAAI,wBAAA,CAAyB,QAAA,CAAS,QAAQ,OAAA,EAAS,QAAA,EAAU,QAAW,YAAY,CAAA;AACjG","file":"index.cjs","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 const ModelDefType = {\n RECORD: \"record\",\n UNION: \"union\"\n};","/*\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 const TypeKind = {\n ARRAY: \"array\",\n BOOLEAN: \"boolean\",\n DOC_REF: \"docRef\",\n DOUBLE: \"double\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n OPTIONAL: \"optional\",\n REF: \"ref\",\n RESOURCE_REF: \"resourceRef\",\n STRING: \"string\",\n UNKNOWN: \"unknown\",\n USER_REF: \"userRef\"\n};\n\n// Forward declaration to avoid circular reference\n\n// A reference to a record or a union type\n\nexport const String = {\n type: TypeKind.STRING\n};\nexport const Double = {\n type: TypeKind.DOUBLE\n};\nexport const Boolean = {\n type: TypeKind.BOOLEAN\n};\nexport const Unknown = {\n type: TypeKind.UNKNOWN\n};\nexport const ResourceRef = {\n type: TypeKind.RESOURCE_REF\n};\nfunction unwrapOneOptional(t) {\n return t.type === TypeKind.OPTIONAL && \"item\" in t ? t.item : t;\n}\nexport const Array = item => {\n if (unwrapOneOptional(item).type === TypeKind.ARRAY) {\n throw new Error(\"Nested arrays (Array(Array(...)) or Array(Optional(Array(...)))) are not supported. \" + \"Wrap the inner array in a record instead.\");\n }\n return {\n type: TypeKind.ARRAY,\n items: item\n };\n};\nexport const Optional = item => {\n if (item.type === TypeKind.OPTIONAL) {\n throw new Error(\"Nested optionals (Optional(Optional(...))) are not supported.\");\n }\n return {\n type: TypeKind.OPTIONAL,\n item\n };\n};","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\n\n/**\n * Helper function to safely transform a record definition to a reference.\n * This function helps TypeScript track type transformations better.\n */\nexport function modelToRef(model) {\n return createRef(model.name, model.type);\n}\n\n/**\n * Helper function to create a reference with proper typing.\n * This avoids type assertions in multiple places.\n */\nexport function createRef(name, refType) {\n return {\n type: TypeKind.REF,\n name,\n refType\n };\n}\n\n/**\n * Type guard to check if a value is a RecordDef\n */\nexport function isRecordDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.RECORD && \"fields\" in value;\n}\n\n/**\n * Type guard to check if a value is a UnionDef\n */\nexport function isUnionDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.UNION && \"variants\" in value;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\nimport { modelToRef } from \"./utils.js\";\nexport function defineUnion(name, {\n discriminant = \"type\",\n docs,\n variants\n}) {\n const entries = Object.entries(variants).map(([key, value]) => [key, resolveUnionVariantArg(value)]);\n const resolvedVariants = Object.fromEntries(entries);\n return {\n type: ModelDefType.UNION,\n discriminant,\n name,\n docs,\n variants: resolvedVariants\n };\n}\nexport function resolveUnionVariantArg(arg) {\n const resolved = typeof arg === \"function\" ? arg() : arg;\n return resolved.type === TypeKind.REF ? resolved : modelToRef(resolved);\n}","/*\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 { resolveUnionVariantArg } from \"./defineUnion.js\";\nimport { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef } from \"./utils.js\";\n\n/** Soon to be deprecated - Use `ModelDefs` instead. */\n\n/** Soon to be deprecated - use `ModelDefs` instead. */\n\n/**\n * Upgrade options for a field added in this version. Supplied as the third\n * argument to `addField`; surfaced by `applyMigration` as part of\n * `MigrationResult.upgrades`. Declares the structural dependency\n * (`derivedFrom`) the runtime lens uses to decide when to invoke the\n * upgrade function. The function itself — derived or constant — is supplied\n * at boot via the generated `DocumentModel(...)` factory's `UpgradeFns`\n * parameter.\n */\n\nclass UnionBuilderImpl {\n name;\n docs;\n variants;\n constructor({\n name,\n docs,\n variants\n }) {\n this.name = name;\n this.docs = docs;\n this.variants = {\n ...variants\n };\n }\n addVariant(variantName, modelDefOrRef) {\n const ref = resolveUnionVariantArg(modelDefOrRef);\n const newVariants = {\n ...this.variants,\n [variantName]: ref\n };\n return new UnionBuilderImpl({\n type: ModelDefType.UNION,\n name: this.name,\n variants: newVariants,\n discriminant: \"type\"\n });\n }\n build() {\n return {\n type: ModelDefType.UNION,\n variants: this.variants,\n discriminant: \"type\",\n name: this.name\n };\n }\n}\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `FieldOptions`. `applyMigration` reads this and then deletes the property,\n * so the `RecordDef` it returns is structurally clean (no extra keys, no\n * symbol-keyed metadata).\n */\nconst UPGRADE_OPTIONS_CARRIER = \"__pack_upgrade_options__\";\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `deprecateField` calls. `applyMigration` reads this and then deletes the\n * property, so the returned `RecordDef` is structurally clean. Maps field name\n * → its deprecation info.\n */\nconst DEPRECATED_FIELDS_CARRIER = \"__pack_deprecated_fields__\";\nclass RecordBuilderImpl {\n name;\n fields;\n upgradeOptions;\n deprecatedFields;\n constructor(initialRecordDef, upgradeOptions, deprecatedFields) {\n this.name = initialRecordDef.name;\n this.fields = {\n ...initialRecordDef.fields\n };\n // Upgrade options only flow forward within a single migration callback —\n // they are NOT inherited from the prior version's RecordDef, because each\n // version's upgrades describe a specific version transition.\n this.upgradeOptions = new Map(upgradeOptions ?? []);\n this.deprecatedFields = new Map(deprecatedFields ?? []);\n }\n\n // TODO: resolve field value from arg instead\n addField(name, value, options) {\n const next = new Map(this.upgradeOptions);\n if (options != null) {\n next.set(name, options);\n }\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields,\n [name]: value\n },\n docs: \"\"\n }, next, this.deprecatedFields);\n }\n deprecateField(name, message) {\n const next = new Map(this.deprecatedFields);\n next.set(name, {\n message\n });\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields\n },\n docs: \"\"\n }, this.upgradeOptions, next);\n }\n build() {\n const result = {\n type: ModelDefType.RECORD,\n name: this.name,\n fields: this.fields,\n docs: \"\"\n };\n if (this.upgradeOptions.size > 0) {\n Object.defineProperty(result, UPGRADE_OPTIONS_CARRIER, {\n value: this.upgradeOptions,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n if (this.deprecatedFields.size > 0) {\n Object.defineProperty(result, DEPRECATED_FIELDS_CARRIER, {\n value: this.deprecatedFields,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n return result;\n }\n}\nfunction makeBuilders(models) {\n const builders = {};\n for (const key in models) {\n const v = models[key];\n if (isRecordDef(v)) {\n builders[key] = new RecordBuilderImpl(v);\n } else if (isUnionDef(v)) {\n builders[key] = new UnionBuilderImpl(v);\n }\n }\n return builders;\n}\n\n/** Per-model field migrations: `[modelKey][fieldName]` → upgrade options. */\n\n/**\n * Lower-level entry point that returns the merged models plus the per-field\n * metadata collected during the migration callback: `UpgradeFieldOptions` from\n * `addField(name, type, options)` and deprecations from `deprecateField(name)`.\n * Used by `addSchemaUpdate` to fold sugar-form upgrades into a\n * `VersionedSchema`'s migrations map and deprecations into its deprecations map.\n *\n * Each `RecordBuilderImpl.build()` attaches its collected upgrade options and\n * deprecations to the produced `RecordDef` via two non-enumerable carrier\n * properties; this function walks the merged result, extracts both keyed by the\n * user's chosen output key (so renames are handled), and strips the carriers so\n * the returned `RecordDef`s are structurally clean.\n */\nexport function applyMigration(models, migration) {\n const builders = makeBuilders(models);\n const merged = {\n ...models,\n ...migration(builders)\n };\n const upgrades = {};\n const deprecations = {};\n for (const [modelKey, def] of Object.entries(merged)) {\n if (!isRecordDef(def)) continue;\n const carrier = def;\n const opts = carrier[UPGRADE_OPTIONS_CARRIER];\n if (opts != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[UPGRADE_OPTIONS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, options] of opts) {\n fieldEntries[fieldName] = options;\n }\n if (Object.keys(fieldEntries).length > 0) {\n upgrades[modelKey] = fieldEntries;\n }\n }\n const deprecated = carrier[DEPRECATED_FIELDS_CARRIER];\n if (deprecated != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[DEPRECATED_FIELDS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, info] of deprecated) {\n fieldEntries[fieldName] = info;\n }\n if (Object.keys(fieldEntries).length > 0) {\n deprecations[modelKey] = fieldEntries;\n }\n }\n }\n return {\n models: merged,\n upgrades: Object.keys(upgrades).length > 0 ? upgrades : undefined,\n deprecations: Object.keys(deprecations).length > 0 ? deprecations : undefined\n };\n}\nexport function defineMigration(models, migration) {\n return applyMigration(models, migration).models;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef, modelToRef } from \"./utils.js\";\n/**\n * Helper function to resolve a field value, handling functions and transforming\n * types as needed.\n */\nfunction resolveFieldArg(value) {\n // Handle function values\n const resolved = typeof value === \"function\" ? value() : value;\n if (isRecordDef(resolved) || isUnionDef(resolved)) {\n return modelToRef(resolved);\n }\n\n // For primitive types and other Types\n return resolved;\n}\nexport function defineRecord(name, record) {\n const entries = Object.entries(record.fields).map(([key, value]) => [key, resolveFieldArg(value)]);\n const fields = Object.fromEntries(entries);\n return {\n type: ModelDefType.RECORD,\n name: name,\n docs: record.docs,\n fields\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { applyMigration } from \"./defineMigration.js\";\nimport { isRecordDef } from \"./utils.js\";\nexport function defineSchema(models) {\n return {\n type: \"initial\",\n version: 1,\n models\n };\n}\nexport function defineSchemaUpdate(name, migration) {\n return {\n name,\n migration\n };\n}\n/**\n * Shallow-merge two `[modelKey][fieldName]` maps; `override` wins per field.\n * Used for both migrations (so `withMigrations` supplements `addField` sugar)\n * and deprecations (so each version's deprecations accumulate forward). The\n * maps are combined at both the model and field level.\n */\nfunction mergeByModelField(base, override) {\n if (base == null) return override;\n if (override == null) return base;\n const result = {\n ...base\n };\n for (const [modelKey, fields] of Object.entries(override)) {\n result[modelKey] = {\n ...result[modelKey],\n ...fields\n };\n }\n return result;\n}\n\n/**\n * Drop migration entries that no longer correspond to a field on a record in\n * `models`. Required because `mergeByModelField` is monotonic — a later\n * `addSchemaUpdate` that removes or retypes a field would otherwise leave a\n * stale entry in the accumulator. Entries are dropped when:\n * - the model key is no longer present,\n * - the model is no longer a record (e.g. replaced by a union), or\n * - the field name is no longer one of the record's fields.\n */\nfunction pruneMigrations(migrations, models) {\n if (migrations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const def = models[modelKey];\n if (!isRecordDef(def)) continue;\n const recordFields = def.fields;\n const kept = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n if (fieldName in recordFields) {\n kept[fieldName] = migration;\n }\n }\n if (Object.keys(kept).length > 0) {\n result[modelKey] = kept;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Convert the version-agnostic `FieldDeprecations` collected by `applyMigration`\n * (just `{ message? }`) into `VersionDeprecations` by stamping `fromVersion`.\n */\nfunction stampDeprecationVersions(deprecations, version) {\n if (deprecations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(deprecations)) {\n const out = {};\n for (const [fieldName, info] of Object.entries(fields)) {\n out[fieldName] = {\n fromVersion: version,\n ...info\n };\n }\n result[modelKey] = out;\n }\n return result;\n}\nclass SchemaVersionBuilderImpl {\n models;\n version;\n previous;\n _migrations;\n _deprecations;\n constructor(models, version, previous, migrations, deprecations) {\n this.models = models;\n this.version = version;\n this.previous = previous;\n this._migrations = migrations;\n this._deprecations = deprecations;\n }\n addSchemaUpdate(update) {\n // applyMigration returns the merged models, any sugar-form upgrades from\n // `addField(name, type, { derivedFrom })`, and any `deprecateField` calls.\n const {\n models,\n upgrades,\n deprecations\n } = applyMigration(this.models, update.migration);\n const merged = mergeByModelField(this._migrations, upgrades);\n // Reconcile against the new models: a later update that retypes a field\n // must drop the prior step's stale migration entry.\n const pruned = pruneMigrations(merged, models);\n // Attach this version to each freshly-deprecated field, then merge forward.\n const thisVersionDeprecations = stampDeprecationVersions(deprecations, this.version);\n const mergedDeprecations = mergeByModelField(this._deprecations, thisVersionDeprecations);\n return new SchemaVersionBuilderImpl(models, this.version, this.previous, pruned, mergedDeprecations);\n }\n withMigrations(migrations) {\n const merged = mergeByModelField(this._migrations, migrations);\n const pruned = pruneMigrations(merged, this.models);\n return new SchemaVersionBuilderImpl(this.models, this.version, this.previous, pruned, this._deprecations);\n }\n build() {\n return {\n type: \"versioned\",\n models: {\n ...this.models\n },\n version: this.version,\n previous: this.previous,\n ...(this._migrations != null ? {\n migrations: this._migrations\n } : {}),\n ...(this._deprecations != null ? {\n deprecations: this._deprecations\n } : {})\n };\n }\n}\nexport function nextSchema(previous) {\n const version = previous.version + 1;\n const deprecations = \"deprecations\" in previous ? previous.deprecations : undefined;\n return new SchemaVersionBuilderImpl(previous.models, version, previous, undefined, deprecations);\n}"]}
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ declare const TypeKind: {
|
|
|
7
7
|
readonly OBJECT_REF: "objectRef";
|
|
8
8
|
readonly OPTIONAL: "optional";
|
|
9
9
|
readonly REF: "ref";
|
|
10
|
+
readonly RESOURCE_REF: "resourceRef";
|
|
10
11
|
readonly STRING: "string";
|
|
11
12
|
readonly UNKNOWN: "unknown";
|
|
12
13
|
readonly USER_REF: "userRef";
|
|
@@ -32,7 +33,7 @@ type ObjectRef = {
|
|
|
32
33
|
type UserRef = {
|
|
33
34
|
readonly type: typeof TypeKind.USER_REF;
|
|
34
35
|
};
|
|
35
|
-
type Type = Array | Boolean | DocRef | Double | MediaRef | ObjectRef | Optional | Ref | String | Unknown | UserRef;
|
|
36
|
+
type Type = Array | Boolean | DocRef | Double | MediaRef | ObjectRef | ResourceRef | Optional | Ref | String | Unknown | UserRef;
|
|
36
37
|
type String = {
|
|
37
38
|
readonly type: typeof TypeKind.STRING;
|
|
38
39
|
};
|
|
@@ -49,6 +50,10 @@ type Unknown = {
|
|
|
49
50
|
readonly type: typeof TypeKind.UNKNOWN;
|
|
50
51
|
};
|
|
51
52
|
declare const Unknown: Unknown;
|
|
53
|
+
type ResourceRef = {
|
|
54
|
+
readonly type: typeof TypeKind.RESOURCE_REF;
|
|
55
|
+
};
|
|
56
|
+
declare const ResourceRef: ResourceRef;
|
|
52
57
|
type Array<T extends TypeBase = TypeBase> = {
|
|
53
58
|
readonly type: typeof TypeKind.ARRAY;
|
|
54
59
|
readonly items: T;
|
|
@@ -233,4 +238,4 @@ declare function isRecordDef(value: unknown): value is RecordDef;
|
|
|
233
238
|
*/
|
|
234
239
|
declare function isUnionDef(value: unknown): value is UnionDef;
|
|
235
240
|
|
|
236
|
-
export { Array, Boolean, type DocRef, Double, type FieldArg, type FieldArgExplicit, type FieldArgExplicitOf, type FieldArgs, type FieldDeprecation, type FieldDeprecationInfo, type FieldDeprecations, type FieldMigration, type FieldOptions, type FieldUpgrades, type InitialSchema, type MediaRef, type MigrationResult, type ModelDef, ModelDefType, type ModelDefs, type ObjectRef, Optional, type RecordArgs, type RecordBuilder, type RecordDef, type RecordFields, type Ref, type ResolvedFieldArg, type ResolvedFieldArgExplicit, type ResolvedFields, type ResolvedUnionVariants, type ReturnedSchema, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaUpdate, type SchemaVersionBuilder, String, type Type, TypeKind, type UnionArgs, type UnionBuilder, type UnionDef, type UnionVariantArg, type UnionVariantArgExplicit, type UnionVariantArgs, type UnionVariants, Unknown, type UpgradeFieldOptions, type UserRef, type VersionDeprecations, type VersionMigrations, type VersionedSchema, applyMigration, createRef, defineMigration, defineRecord, defineSchema, defineSchemaUpdate, defineUnion, isRecordDef, isUnionDef, modelToRef, nextSchema, resolveUnionVariantArg };
|
|
241
|
+
export { Array, Boolean, type DocRef, Double, type FieldArg, type FieldArgExplicit, type FieldArgExplicitOf, type FieldArgs, type FieldDeprecation, type FieldDeprecationInfo, type FieldDeprecations, type FieldMigration, type FieldOptions, type FieldUpgrades, type InitialSchema, type MediaRef, type MigrationResult, type ModelDef, ModelDefType, type ModelDefs, type ObjectRef, Optional, type RecordArgs, type RecordBuilder, type RecordDef, type RecordFields, type Ref, type ResolvedFieldArg, type ResolvedFieldArgExplicit, type ResolvedFields, type ResolvedUnionVariants, ResourceRef, type ReturnedSchema, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaUpdate, type SchemaVersionBuilder, String, type Type, TypeKind, type UnionArgs, type UnionBuilder, type UnionDef, type UnionVariantArg, type UnionVariantArgExplicit, type UnionVariantArgs, type UnionVariants, Unknown, type UpgradeFieldOptions, type UserRef, type VersionDeprecations, type VersionMigrations, type VersionedSchema, applyMigration, createRef, defineMigration, defineRecord, defineSchema, defineSchemaUpdate, defineUnion, isRecordDef, isUnionDef, modelToRef, nextSchema, resolveUnionVariantArg };
|
package/build/esm/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var TypeKind = {
|
|
|
14
14
|
OBJECT_REF: "objectRef",
|
|
15
15
|
OPTIONAL: "optional",
|
|
16
16
|
REF: "ref",
|
|
17
|
+
RESOURCE_REF: "resourceRef",
|
|
17
18
|
STRING: "string",
|
|
18
19
|
UNKNOWN: "unknown",
|
|
19
20
|
USER_REF: "userRef"
|
|
@@ -30,6 +31,9 @@ var Boolean = {
|
|
|
30
31
|
var Unknown = {
|
|
31
32
|
type: TypeKind.UNKNOWN
|
|
32
33
|
};
|
|
34
|
+
var ResourceRef = {
|
|
35
|
+
type: TypeKind.RESOURCE_REF
|
|
36
|
+
};
|
|
33
37
|
function unwrapOneOptional(t) {
|
|
34
38
|
return t.type === TypeKind.OPTIONAL && "item" in t ? t.item : t;
|
|
35
39
|
}
|
|
@@ -390,6 +394,6 @@ function nextSchema(previous) {
|
|
|
390
394
|
return new SchemaVersionBuilderImpl(previous.models, version, previous, void 0, deprecations);
|
|
391
395
|
}
|
|
392
396
|
|
|
393
|
-
export { Array, Boolean, Double, ModelDefType, Optional, String, TypeKind, Unknown, applyMigration, createRef, defineMigration, defineRecord, defineSchema, defineSchemaUpdate, defineUnion, isRecordDef, isUnionDef, modelToRef, nextSchema, resolveUnionVariantArg };
|
|
397
|
+
export { Array, Boolean, Double, ModelDefType, Optional, ResourceRef, String, TypeKind, Unknown, applyMigration, createRef, defineMigration, defineRecord, defineSchema, defineSchemaUpdate, defineUnion, isRecordDef, isUnionDef, modelToRef, nextSchema, resolveUnionVariantArg };
|
|
394
398
|
//# sourceMappingURL=index.js.map
|
|
395
399
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/defs.ts","../../src/primitives.ts","../../src/utils.ts","../../src/defineUnion.ts","../../src/defineMigration.ts","../../src/defineRecord.ts","../../src/defineSchemaUpdate.ts"],"names":[],"mappings":";AAgBO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO;AACT;;;ACHO,IAAM,QAAA,GAAW;AAAA,EACtB,KAAA,EAAO,OAAA;AAAA,EACP,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,QAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU,UAAA;AAAA,EACV,GAAA,EAAK,KAAA;AAAA,EACL,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU;AACZ;AAMO,IAAM,MAAA,GAAS;AAAA,EACpB,MAAM,QAAA,CAAS;AACjB;AACO,IAAM,MAAA,GAAS;AAAA,EACpB,MAAM,QAAA,CAAS;AACjB;AACO,IAAM,OAAA,GAAU;AAAA,EACrB,MAAM,QAAA,CAAS;AACjB;AACO,IAAM,OAAA,GAAU;AAAA,EACrB,MAAM,QAAA,CAAS;AACjB;AACA,SAAS,kBAAkB,CAAA,EAAG;AAC5B,EAAA,OAAO,EAAE,IAAA,KAAS,QAAA,CAAS,YAAY,MAAA,IAAU,CAAA,GAAI,EAAE,IAAA,GAAO,CAAA;AAChE;AACO,IAAM,QAAQ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AAAA,EACA,eAAe,UAAA,EAAY;AACzB,IAAA,MAAM,MAAA,GAAS,iBAAA,CAAkB,IAAA,CAAK,WAAA,EAAa,UAAU,CAAA;AAC7D,IAAA,MAAM,MAAA,GAAS,eAAA,CAAgB,MAAA,EAAQ,IAAA,CAAK,MAAM,CAAA;AAClD,IAAA,OAAO,IAAI,yBAAA,CAAyB,IAAA,CAAK,MAAA,EAAQ,IAAA,CAAK,SAAS,IAAA,CAAK,QAAA,EAAU,MAAA,EAAQ,IAAA,CAAK,aAAa,CAAA;AAAA,EAC1G;AAAA,EACA,KAAA,GAAQ;AACN,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,WAAA;AAAA,MACN,MAAA,EAAQ;AAAA,QACN,GAAG,IAAA,CAAK;AAAA,OACV;AAAA,MACA,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,UAAU,IAAA,CAAK,QAAA;AAAA,MACf,GAAI,IAAA,CAAK,WAAA,IAAe,IAAA,GAAO;AAAA,QAC7B,YAAY,IAAA,CAAK;AAAA,UACf,EAAC;AAAA,MACL,GAAI,IAAA,CAAK,aAAA,IAAiB,IAAA,GAAO;AAAA,QAC/B,cAAc,IAAA,CAAK;AAAA,UACjB;AAAC,KACP;AAAA,EACF;AACF,CAAA;AACO,SAAS,WAAW,QAAA,EAAU;AACnC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,GAAU,CAAA;AACnC,EAAA,MAAM,YAAA,GAAe,cAAA,IAAkB,QAAA,GAAW,QAAA,CAAS,YAAA,GAAe,MAAA;AAC1E,EAAA,OAAO,IAAI,wBAAA,CAAyB,QAAA,CAAS,QAAQ,OAAA,EAAS,QAAA,EAAU,QAAW,YAAY,CAAA;AACjG","file":"index.js","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 const ModelDefType = {\n RECORD: \"record\",\n UNION: \"union\"\n};","/*\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 const TypeKind = {\n ARRAY: \"array\",\n BOOLEAN: \"boolean\",\n DOC_REF: \"docRef\",\n DOUBLE: \"double\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n OPTIONAL: \"optional\",\n REF: \"ref\",\n STRING: \"string\",\n UNKNOWN: \"unknown\",\n USER_REF: \"userRef\"\n};\n\n// Forward declaration to avoid circular reference\n\n// A reference to a record or a union type\n\nexport const String = {\n type: TypeKind.STRING\n};\nexport const Double = {\n type: TypeKind.DOUBLE\n};\nexport const Boolean = {\n type: TypeKind.BOOLEAN\n};\nexport const Unknown = {\n type: TypeKind.UNKNOWN\n};\nfunction unwrapOneOptional(t) {\n return t.type === TypeKind.OPTIONAL && \"item\" in t ? t.item : t;\n}\nexport const Array = item => {\n if (unwrapOneOptional(item).type === TypeKind.ARRAY) {\n throw new Error(\"Nested arrays (Array(Array(...)) or Array(Optional(Array(...)))) are not supported. \" + \"Wrap the inner array in a record instead.\");\n }\n return {\n type: TypeKind.ARRAY,\n items: item\n };\n};\nexport const Optional = item => {\n if (item.type === TypeKind.OPTIONAL) {\n throw new Error(\"Nested optionals (Optional(Optional(...))) are not supported.\");\n }\n return {\n type: TypeKind.OPTIONAL,\n item\n };\n};","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\n\n/**\n * Helper function to safely transform a record definition to a reference.\n * This function helps TypeScript track type transformations better.\n */\nexport function modelToRef(model) {\n return createRef(model.name, model.type);\n}\n\n/**\n * Helper function to create a reference with proper typing.\n * This avoids type assertions in multiple places.\n */\nexport function createRef(name, refType) {\n return {\n type: TypeKind.REF,\n name,\n refType\n };\n}\n\n/**\n * Type guard to check if a value is a RecordDef\n */\nexport function isRecordDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.RECORD && \"fields\" in value;\n}\n\n/**\n * Type guard to check if a value is a UnionDef\n */\nexport function isUnionDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.UNION && \"variants\" in value;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\nimport { modelToRef } from \"./utils.js\";\nexport function defineUnion(name, {\n discriminant = \"type\",\n docs,\n variants\n}) {\n const entries = Object.entries(variants).map(([key, value]) => [key, resolveUnionVariantArg(value)]);\n const resolvedVariants = Object.fromEntries(entries);\n return {\n type: ModelDefType.UNION,\n discriminant,\n name,\n docs,\n variants: resolvedVariants\n };\n}\nexport function resolveUnionVariantArg(arg) {\n const resolved = typeof arg === \"function\" ? arg() : arg;\n return resolved.type === TypeKind.REF ? resolved : modelToRef(resolved);\n}","/*\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 { resolveUnionVariantArg } from \"./defineUnion.js\";\nimport { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef } from \"./utils.js\";\n\n/** Soon to be deprecated - Use `ModelDefs` instead. */\n\n/** Soon to be deprecated - use `ModelDefs` instead. */\n\n/**\n * Upgrade options for a field added in this version. Supplied as the third\n * argument to `addField`; surfaced by `applyMigration` as part of\n * `MigrationResult.upgrades`. Declares the structural dependency\n * (`derivedFrom`) the runtime lens uses to decide when to invoke the\n * upgrade function. The function itself — derived or constant — is supplied\n * at boot via the generated `DocumentModel(...)` factory's `UpgradeFns`\n * parameter.\n */\n\nclass UnionBuilderImpl {\n name;\n docs;\n variants;\n constructor({\n name,\n docs,\n variants\n }) {\n this.name = name;\n this.docs = docs;\n this.variants = {\n ...variants\n };\n }\n addVariant(variantName, modelDefOrRef) {\n const ref = resolveUnionVariantArg(modelDefOrRef);\n const newVariants = {\n ...this.variants,\n [variantName]: ref\n };\n return new UnionBuilderImpl({\n type: ModelDefType.UNION,\n name: this.name,\n variants: newVariants,\n discriminant: \"type\"\n });\n }\n build() {\n return {\n type: ModelDefType.UNION,\n variants: this.variants,\n discriminant: \"type\",\n name: this.name\n };\n }\n}\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `FieldOptions`. `applyMigration` reads this and then deletes the property,\n * so the `RecordDef` it returns is structurally clean (no extra keys, no\n * symbol-keyed metadata).\n */\nconst UPGRADE_OPTIONS_CARRIER = \"__pack_upgrade_options__\";\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `deprecateField` calls. `applyMigration` reads this and then deletes the\n * property, so the returned `RecordDef` is structurally clean. Maps field name\n * → its deprecation info.\n */\nconst DEPRECATED_FIELDS_CARRIER = \"__pack_deprecated_fields__\";\nclass RecordBuilderImpl {\n name;\n fields;\n upgradeOptions;\n deprecatedFields;\n constructor(initialRecordDef, upgradeOptions, deprecatedFields) {\n this.name = initialRecordDef.name;\n this.fields = {\n ...initialRecordDef.fields\n };\n // Upgrade options only flow forward within a single migration callback —\n // they are NOT inherited from the prior version's RecordDef, because each\n // version's upgrades describe a specific version transition.\n this.upgradeOptions = new Map(upgradeOptions ?? []);\n this.deprecatedFields = new Map(deprecatedFields ?? []);\n }\n\n // TODO: resolve field value from arg instead\n addField(name, value, options) {\n const next = new Map(this.upgradeOptions);\n if (options != null) {\n next.set(name, options);\n }\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields,\n [name]: value\n },\n docs: \"\"\n }, next, this.deprecatedFields);\n }\n deprecateField(name, message) {\n const next = new Map(this.deprecatedFields);\n next.set(name, {\n message\n });\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields\n },\n docs: \"\"\n }, this.upgradeOptions, next);\n }\n build() {\n const result = {\n type: ModelDefType.RECORD,\n name: this.name,\n fields: this.fields,\n docs: \"\"\n };\n if (this.upgradeOptions.size > 0) {\n Object.defineProperty(result, UPGRADE_OPTIONS_CARRIER, {\n value: this.upgradeOptions,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n if (this.deprecatedFields.size > 0) {\n Object.defineProperty(result, DEPRECATED_FIELDS_CARRIER, {\n value: this.deprecatedFields,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n return result;\n }\n}\nfunction makeBuilders(models) {\n const builders = {};\n for (const key in models) {\n const v = models[key];\n if (isRecordDef(v)) {\n builders[key] = new RecordBuilderImpl(v);\n } else if (isUnionDef(v)) {\n builders[key] = new UnionBuilderImpl(v);\n }\n }\n return builders;\n}\n\n/** Per-model field migrations: `[modelKey][fieldName]` → upgrade options. */\n\n/**\n * Lower-level entry point that returns the merged models plus the per-field\n * metadata collected during the migration callback: `UpgradeFieldOptions` from\n * `addField(name, type, options)` and deprecations from `deprecateField(name)`.\n * Used by `addSchemaUpdate` to fold sugar-form upgrades into a\n * `VersionedSchema`'s migrations map and deprecations into its deprecations map.\n *\n * Each `RecordBuilderImpl.build()` attaches its collected upgrade options and\n * deprecations to the produced `RecordDef` via two non-enumerable carrier\n * properties; this function walks the merged result, extracts both keyed by the\n * user's chosen output key (so renames are handled), and strips the carriers so\n * the returned `RecordDef`s are structurally clean.\n */\nexport function applyMigration(models, migration) {\n const builders = makeBuilders(models);\n const merged = {\n ...models,\n ...migration(builders)\n };\n const upgrades = {};\n const deprecations = {};\n for (const [modelKey, def] of Object.entries(merged)) {\n if (!isRecordDef(def)) continue;\n const carrier = def;\n const opts = carrier[UPGRADE_OPTIONS_CARRIER];\n if (opts != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[UPGRADE_OPTIONS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, options] of opts) {\n fieldEntries[fieldName] = options;\n }\n if (Object.keys(fieldEntries).length > 0) {\n upgrades[modelKey] = fieldEntries;\n }\n }\n const deprecated = carrier[DEPRECATED_FIELDS_CARRIER];\n if (deprecated != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[DEPRECATED_FIELDS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, info] of deprecated) {\n fieldEntries[fieldName] = info;\n }\n if (Object.keys(fieldEntries).length > 0) {\n deprecations[modelKey] = fieldEntries;\n }\n }\n }\n return {\n models: merged,\n upgrades: Object.keys(upgrades).length > 0 ? upgrades : undefined,\n deprecations: Object.keys(deprecations).length > 0 ? deprecations : undefined\n };\n}\nexport function defineMigration(models, migration) {\n return applyMigration(models, migration).models;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef, modelToRef } from \"./utils.js\";\n/**\n * Helper function to resolve a field value, handling functions and transforming\n * types as needed.\n */\nfunction resolveFieldArg(value) {\n // Handle function values\n const resolved = typeof value === \"function\" ? value() : value;\n if (isRecordDef(resolved) || isUnionDef(resolved)) {\n return modelToRef(resolved);\n }\n\n // For primitive types and other Types\n return resolved;\n}\nexport function defineRecord(name, record) {\n const entries = Object.entries(record.fields).map(([key, value]) => [key, resolveFieldArg(value)]);\n const fields = Object.fromEntries(entries);\n return {\n type: ModelDefType.RECORD,\n name: name,\n docs: record.docs,\n fields\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { applyMigration } from \"./defineMigration.js\";\nimport { isRecordDef } from \"./utils.js\";\nexport function defineSchema(models) {\n return {\n type: \"initial\",\n version: 1,\n models\n };\n}\nexport function defineSchemaUpdate(name, migration) {\n return {\n name,\n migration\n };\n}\n/**\n * Shallow-merge two `[modelKey][fieldName]` maps; `override` wins per field.\n * Used for both migrations (so `withMigrations` supplements `addField` sugar)\n * and deprecations (so each version's deprecations accumulate forward). The\n * maps are combined at both the model and field level.\n */\nfunction mergeByModelField(base, override) {\n if (base == null) return override;\n if (override == null) return base;\n const result = {\n ...base\n };\n for (const [modelKey, fields] of Object.entries(override)) {\n result[modelKey] = {\n ...result[modelKey],\n ...fields\n };\n }\n return result;\n}\n\n/**\n * Drop migration entries that no longer correspond to a field on a record in\n * `models`. Required because `mergeByModelField` is monotonic — a later\n * `addSchemaUpdate` that removes or retypes a field would otherwise leave a\n * stale entry in the accumulator. Entries are dropped when:\n * - the model key is no longer present,\n * - the model is no longer a record (e.g. replaced by a union), or\n * - the field name is no longer one of the record's fields.\n */\nfunction pruneMigrations(migrations, models) {\n if (migrations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const def = models[modelKey];\n if (!isRecordDef(def)) continue;\n const recordFields = def.fields;\n const kept = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n if (fieldName in recordFields) {\n kept[fieldName] = migration;\n }\n }\n if (Object.keys(kept).length > 0) {\n result[modelKey] = kept;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Convert the version-agnostic `FieldDeprecations` collected by `applyMigration`\n * (just `{ message? }`) into `VersionDeprecations` by stamping `fromVersion`.\n */\nfunction stampDeprecationVersions(deprecations, version) {\n if (deprecations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(deprecations)) {\n const out = {};\n for (const [fieldName, info] of Object.entries(fields)) {\n out[fieldName] = {\n fromVersion: version,\n ...info\n };\n }\n result[modelKey] = out;\n }\n return result;\n}\nclass SchemaVersionBuilderImpl {\n models;\n version;\n previous;\n _migrations;\n _deprecations;\n constructor(models, version, previous, migrations, deprecations) {\n this.models = models;\n this.version = version;\n this.previous = previous;\n this._migrations = migrations;\n this._deprecations = deprecations;\n }\n addSchemaUpdate(update) {\n // applyMigration returns the merged models, any sugar-form upgrades from\n // `addField(name, type, { derivedFrom })`, and any `deprecateField` calls.\n const {\n models,\n upgrades,\n deprecations\n } = applyMigration(this.models, update.migration);\n const merged = mergeByModelField(this._migrations, upgrades);\n // Reconcile against the new models: a later update that retypes a field\n // must drop the prior step's stale migration entry.\n const pruned = pruneMigrations(merged, models);\n // Attach this version to each freshly-deprecated field, then merge forward.\n const thisVersionDeprecations = stampDeprecationVersions(deprecations, this.version);\n const mergedDeprecations = mergeByModelField(this._deprecations, thisVersionDeprecations);\n return new SchemaVersionBuilderImpl(models, this.version, this.previous, pruned, mergedDeprecations);\n }\n withMigrations(migrations) {\n const merged = mergeByModelField(this._migrations, migrations);\n const pruned = pruneMigrations(merged, this.models);\n return new SchemaVersionBuilderImpl(this.models, this.version, this.previous, pruned, this._deprecations);\n }\n build() {\n return {\n type: \"versioned\",\n models: {\n ...this.models\n },\n version: this.version,\n previous: this.previous,\n ...(this._migrations != null ? {\n migrations: this._migrations\n } : {}),\n ...(this._deprecations != null ? {\n deprecations: this._deprecations\n } : {})\n };\n }\n}\nexport function nextSchema(previous) {\n const version = previous.version + 1;\n const deprecations = \"deprecations\" in previous ? previous.deprecations : undefined;\n return new SchemaVersionBuilderImpl(previous.models, version, previous, undefined, deprecations);\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/defs.ts","../../src/primitives.ts","../../src/utils.ts","../../src/defineUnion.ts","../../src/defineMigration.ts","../../src/defineRecord.ts","../../src/defineSchemaUpdate.ts"],"names":[],"mappings":";AAgBO,IAAM,YAAA,GAAe;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EAC1G;AAAA,EACA,KAAA,GAAQ;AACN,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,WAAA;AAAA,MACN,MAAA,EAAQ;AAAA,QACN,GAAG,IAAA,CAAK;AAAA,OACV;AAAA,MACA,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,UAAU,IAAA,CAAK,QAAA;AAAA,MACf,GAAI,IAAA,CAAK,WAAA,IAAe,IAAA,GAAO;AAAA,QAC7B,YAAY,IAAA,CAAK;AAAA,UACf,EAAC;AAAA,MACL,GAAI,IAAA,CAAK,aAAA,IAAiB,IAAA,GAAO;AAAA,QAC/B,cAAc,IAAA,CAAK;AAAA,UACjB;AAAC,KACP;AAAA,EACF;AACF,CAAA;AACO,SAAS,WAAW,QAAA,EAAU;AACnC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,GAAU,CAAA;AACnC,EAAA,MAAM,YAAA,GAAe,cAAA,IAAkB,QAAA,GAAW,QAAA,CAAS,YAAA,GAAe,MAAA;AAC1E,EAAA,OAAO,IAAI,wBAAA,CAAyB,QAAA,CAAS,QAAQ,OAAA,EAAS,QAAA,EAAU,QAAW,YAAY,CAAA;AACjG","file":"index.js","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 const ModelDefType = {\n RECORD: \"record\",\n UNION: \"union\"\n};","/*\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 const TypeKind = {\n ARRAY: \"array\",\n BOOLEAN: \"boolean\",\n DOC_REF: \"docRef\",\n DOUBLE: \"double\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n OPTIONAL: \"optional\",\n REF: \"ref\",\n RESOURCE_REF: \"resourceRef\",\n STRING: \"string\",\n UNKNOWN: \"unknown\",\n USER_REF: \"userRef\"\n};\n\n// Forward declaration to avoid circular reference\n\n// A reference to a record or a union type\n\nexport const String = {\n type: TypeKind.STRING\n};\nexport const Double = {\n type: TypeKind.DOUBLE\n};\nexport const Boolean = {\n type: TypeKind.BOOLEAN\n};\nexport const Unknown = {\n type: TypeKind.UNKNOWN\n};\nexport const ResourceRef = {\n type: TypeKind.RESOURCE_REF\n};\nfunction unwrapOneOptional(t) {\n return t.type === TypeKind.OPTIONAL && \"item\" in t ? t.item : t;\n}\nexport const Array = item => {\n if (unwrapOneOptional(item).type === TypeKind.ARRAY) {\n throw new Error(\"Nested arrays (Array(Array(...)) or Array(Optional(Array(...)))) are not supported. \" + \"Wrap the inner array in a record instead.\");\n }\n return {\n type: TypeKind.ARRAY,\n items: item\n };\n};\nexport const Optional = item => {\n if (item.type === TypeKind.OPTIONAL) {\n throw new Error(\"Nested optionals (Optional(Optional(...))) are not supported.\");\n }\n return {\n type: TypeKind.OPTIONAL,\n item\n };\n};","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\n\n/**\n * Helper function to safely transform a record definition to a reference.\n * This function helps TypeScript track type transformations better.\n */\nexport function modelToRef(model) {\n return createRef(model.name, model.type);\n}\n\n/**\n * Helper function to create a reference with proper typing.\n * This avoids type assertions in multiple places.\n */\nexport function createRef(name, refType) {\n return {\n type: TypeKind.REF,\n name,\n refType\n };\n}\n\n/**\n * Type guard to check if a value is a RecordDef\n */\nexport function isRecordDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.RECORD && \"fields\" in value;\n}\n\n/**\n * Type guard to check if a value is a UnionDef\n */\nexport function isUnionDef(value) {\n return value != null && typeof value === \"object\" && \"type\" in value && value.type === ModelDefType.UNION && \"variants\" in value;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { TypeKind } from \"./primitives.js\";\nimport { modelToRef } from \"./utils.js\";\nexport function defineUnion(name, {\n discriminant = \"type\",\n docs,\n variants\n}) {\n const entries = Object.entries(variants).map(([key, value]) => [key, resolveUnionVariantArg(value)]);\n const resolvedVariants = Object.fromEntries(entries);\n return {\n type: ModelDefType.UNION,\n discriminant,\n name,\n docs,\n variants: resolvedVariants\n };\n}\nexport function resolveUnionVariantArg(arg) {\n const resolved = typeof arg === \"function\" ? arg() : arg;\n return resolved.type === TypeKind.REF ? resolved : modelToRef(resolved);\n}","/*\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 { resolveUnionVariantArg } from \"./defineUnion.js\";\nimport { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef } from \"./utils.js\";\n\n/** Soon to be deprecated - Use `ModelDefs` instead. */\n\n/** Soon to be deprecated - use `ModelDefs` instead. */\n\n/**\n * Upgrade options for a field added in this version. Supplied as the third\n * argument to `addField`; surfaced by `applyMigration` as part of\n * `MigrationResult.upgrades`. Declares the structural dependency\n * (`derivedFrom`) the runtime lens uses to decide when to invoke the\n * upgrade function. The function itself — derived or constant — is supplied\n * at boot via the generated `DocumentModel(...)` factory's `UpgradeFns`\n * parameter.\n */\n\nclass UnionBuilderImpl {\n name;\n docs;\n variants;\n constructor({\n name,\n docs,\n variants\n }) {\n this.name = name;\n this.docs = docs;\n this.variants = {\n ...variants\n };\n }\n addVariant(variantName, modelDefOrRef) {\n const ref = resolveUnionVariantArg(modelDefOrRef);\n const newVariants = {\n ...this.variants,\n [variantName]: ref\n };\n return new UnionBuilderImpl({\n type: ModelDefType.UNION,\n name: this.name,\n variants: newVariants,\n discriminant: \"type\"\n });\n }\n build() {\n return {\n type: ModelDefType.UNION,\n variants: this.variants,\n discriminant: \"type\",\n name: this.name\n };\n }\n}\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `FieldOptions`. `applyMigration` reads this and then deletes the property,\n * so the `RecordDef` it returns is structurally clean (no extra keys, no\n * symbol-keyed metadata).\n */\nconst UPGRADE_OPTIONS_CARRIER = \"__pack_upgrade_options__\";\n\n/**\n * Non-enumerable carrier property attached to a `RecordDef` by\n * `RecordBuilderImpl.build()` when the builder has collected one or more\n * `deprecateField` calls. `applyMigration` reads this and then deletes the\n * property, so the returned `RecordDef` is structurally clean. Maps field name\n * → its deprecation info.\n */\nconst DEPRECATED_FIELDS_CARRIER = \"__pack_deprecated_fields__\";\nclass RecordBuilderImpl {\n name;\n fields;\n upgradeOptions;\n deprecatedFields;\n constructor(initialRecordDef, upgradeOptions, deprecatedFields) {\n this.name = initialRecordDef.name;\n this.fields = {\n ...initialRecordDef.fields\n };\n // Upgrade options only flow forward within a single migration callback —\n // they are NOT inherited from the prior version's RecordDef, because each\n // version's upgrades describe a specific version transition.\n this.upgradeOptions = new Map(upgradeOptions ?? []);\n this.deprecatedFields = new Map(deprecatedFields ?? []);\n }\n\n // TODO: resolve field value from arg instead\n addField(name, value, options) {\n const next = new Map(this.upgradeOptions);\n if (options != null) {\n next.set(name, options);\n }\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields,\n [name]: value\n },\n docs: \"\"\n }, next, this.deprecatedFields);\n }\n deprecateField(name, message) {\n const next = new Map(this.deprecatedFields);\n next.set(name, {\n message\n });\n return new RecordBuilderImpl({\n type: ModelDefType.RECORD,\n name: this.name,\n fields: {\n ...this.fields\n },\n docs: \"\"\n }, this.upgradeOptions, next);\n }\n build() {\n const result = {\n type: ModelDefType.RECORD,\n name: this.name,\n fields: this.fields,\n docs: \"\"\n };\n if (this.upgradeOptions.size > 0) {\n Object.defineProperty(result, UPGRADE_OPTIONS_CARRIER, {\n value: this.upgradeOptions,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n if (this.deprecatedFields.size > 0) {\n Object.defineProperty(result, DEPRECATED_FIELDS_CARRIER, {\n value: this.deprecatedFields,\n enumerable: false,\n configurable: true,\n writable: false\n });\n }\n return result;\n }\n}\nfunction makeBuilders(models) {\n const builders = {};\n for (const key in models) {\n const v = models[key];\n if (isRecordDef(v)) {\n builders[key] = new RecordBuilderImpl(v);\n } else if (isUnionDef(v)) {\n builders[key] = new UnionBuilderImpl(v);\n }\n }\n return builders;\n}\n\n/** Per-model field migrations: `[modelKey][fieldName]` → upgrade options. */\n\n/**\n * Lower-level entry point that returns the merged models plus the per-field\n * metadata collected during the migration callback: `UpgradeFieldOptions` from\n * `addField(name, type, options)` and deprecations from `deprecateField(name)`.\n * Used by `addSchemaUpdate` to fold sugar-form upgrades into a\n * `VersionedSchema`'s migrations map and deprecations into its deprecations map.\n *\n * Each `RecordBuilderImpl.build()` attaches its collected upgrade options and\n * deprecations to the produced `RecordDef` via two non-enumerable carrier\n * properties; this function walks the merged result, extracts both keyed by the\n * user's chosen output key (so renames are handled), and strips the carriers so\n * the returned `RecordDef`s are structurally clean.\n */\nexport function applyMigration(models, migration) {\n const builders = makeBuilders(models);\n const merged = {\n ...models,\n ...migration(builders)\n };\n const upgrades = {};\n const deprecations = {};\n for (const [modelKey, def] of Object.entries(merged)) {\n if (!isRecordDef(def)) continue;\n const carrier = def;\n const opts = carrier[UPGRADE_OPTIONS_CARRIER];\n if (opts != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[UPGRADE_OPTIONS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, options] of opts) {\n fieldEntries[fieldName] = options;\n }\n if (Object.keys(fieldEntries).length > 0) {\n upgrades[modelKey] = fieldEntries;\n }\n }\n const deprecated = carrier[DEPRECATED_FIELDS_CARRIER];\n if (deprecated != null) {\n // Strip the carrier so the returned RecordDef is structurally clean.\n delete carrier[DEPRECATED_FIELDS_CARRIER];\n const fieldEntries = {};\n for (const [fieldName, info] of deprecated) {\n fieldEntries[fieldName] = info;\n }\n if (Object.keys(fieldEntries).length > 0) {\n deprecations[modelKey] = fieldEntries;\n }\n }\n }\n return {\n models: merged,\n upgrades: Object.keys(upgrades).length > 0 ? upgrades : undefined,\n deprecations: Object.keys(deprecations).length > 0 ? deprecations : undefined\n };\n}\nexport function defineMigration(models, migration) {\n return applyMigration(models, migration).models;\n}","/*\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 { ModelDefType } from \"./defs.js\";\nimport { isRecordDef, isUnionDef, modelToRef } from \"./utils.js\";\n/**\n * Helper function to resolve a field value, handling functions and transforming\n * types as needed.\n */\nfunction resolveFieldArg(value) {\n // Handle function values\n const resolved = typeof value === \"function\" ? value() : value;\n if (isRecordDef(resolved) || isUnionDef(resolved)) {\n return modelToRef(resolved);\n }\n\n // For primitive types and other Types\n return resolved;\n}\nexport function defineRecord(name, record) {\n const entries = Object.entries(record.fields).map(([key, value]) => [key, resolveFieldArg(value)]);\n const fields = Object.fromEntries(entries);\n return {\n type: ModelDefType.RECORD,\n name: name,\n docs: record.docs,\n fields\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { applyMigration } from \"./defineMigration.js\";\nimport { isRecordDef } from \"./utils.js\";\nexport function defineSchema(models) {\n return {\n type: \"initial\",\n version: 1,\n models\n };\n}\nexport function defineSchemaUpdate(name, migration) {\n return {\n name,\n migration\n };\n}\n/**\n * Shallow-merge two `[modelKey][fieldName]` maps; `override` wins per field.\n * Used for both migrations (so `withMigrations` supplements `addField` sugar)\n * and deprecations (so each version's deprecations accumulate forward). The\n * maps are combined at both the model and field level.\n */\nfunction mergeByModelField(base, override) {\n if (base == null) return override;\n if (override == null) return base;\n const result = {\n ...base\n };\n for (const [modelKey, fields] of Object.entries(override)) {\n result[modelKey] = {\n ...result[modelKey],\n ...fields\n };\n }\n return result;\n}\n\n/**\n * Drop migration entries that no longer correspond to a field on a record in\n * `models`. Required because `mergeByModelField` is monotonic — a later\n * `addSchemaUpdate` that removes or retypes a field would otherwise leave a\n * stale entry in the accumulator. Entries are dropped when:\n * - the model key is no longer present,\n * - the model is no longer a record (e.g. replaced by a union), or\n * - the field name is no longer one of the record's fields.\n */\nfunction pruneMigrations(migrations, models) {\n if (migrations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(migrations)) {\n const def = models[modelKey];\n if (!isRecordDef(def)) continue;\n const recordFields = def.fields;\n const kept = {};\n for (const [fieldName, migration] of Object.entries(fields)) {\n if (fieldName in recordFields) {\n kept[fieldName] = migration;\n }\n }\n if (Object.keys(kept).length > 0) {\n result[modelKey] = kept;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Convert the version-agnostic `FieldDeprecations` collected by `applyMigration`\n * (just `{ message? }`) into `VersionDeprecations` by stamping `fromVersion`.\n */\nfunction stampDeprecationVersions(deprecations, version) {\n if (deprecations == null) return undefined;\n const result = {};\n for (const [modelKey, fields] of Object.entries(deprecations)) {\n const out = {};\n for (const [fieldName, info] of Object.entries(fields)) {\n out[fieldName] = {\n fromVersion: version,\n ...info\n };\n }\n result[modelKey] = out;\n }\n return result;\n}\nclass SchemaVersionBuilderImpl {\n models;\n version;\n previous;\n _migrations;\n _deprecations;\n constructor(models, version, previous, migrations, deprecations) {\n this.models = models;\n this.version = version;\n this.previous = previous;\n this._migrations = migrations;\n this._deprecations = deprecations;\n }\n addSchemaUpdate(update) {\n // applyMigration returns the merged models, any sugar-form upgrades from\n // `addField(name, type, { derivedFrom })`, and any `deprecateField` calls.\n const {\n models,\n upgrades,\n deprecations\n } = applyMigration(this.models, update.migration);\n const merged = mergeByModelField(this._migrations, upgrades);\n // Reconcile against the new models: a later update that retypes a field\n // must drop the prior step's stale migration entry.\n const pruned = pruneMigrations(merged, models);\n // Attach this version to each freshly-deprecated field, then merge forward.\n const thisVersionDeprecations = stampDeprecationVersions(deprecations, this.version);\n const mergedDeprecations = mergeByModelField(this._deprecations, thisVersionDeprecations);\n return new SchemaVersionBuilderImpl(models, this.version, this.previous, pruned, mergedDeprecations);\n }\n withMigrations(migrations) {\n const merged = mergeByModelField(this._migrations, migrations);\n const pruned = pruneMigrations(merged, this.models);\n return new SchemaVersionBuilderImpl(this.models, this.version, this.previous, pruned, this._deprecations);\n }\n build() {\n return {\n type: \"versioned\",\n models: {\n ...this.models\n },\n version: this.version,\n previous: this.previous,\n ...(this._migrations != null ? {\n migrations: this._migrations\n } : {}),\n ...(this._deprecations != null ? {\n deprecations: this._deprecations\n } : {})\n };\n }\n}\nexport function nextSchema(previous) {\n const version = previous.version + 1;\n const deprecations = \"deprecations\" in previous ? previous.deprecations : undefined;\n return new SchemaVersionBuilderImpl(previous.models, version, previous, undefined, deprecations);\n}"]}
|
|
@@ -7,6 +7,7 @@ export declare const TypeKind: {
|
|
|
7
7
|
readonly OBJECT_REF: "objectRef";
|
|
8
8
|
readonly OPTIONAL: "optional";
|
|
9
9
|
readonly REF: "ref";
|
|
10
|
+
readonly RESOURCE_REF: "resourceRef";
|
|
10
11
|
readonly STRING: "string";
|
|
11
12
|
readonly UNKNOWN: "unknown";
|
|
12
13
|
readonly USER_REF: "userRef";
|
|
@@ -49,14 +50,18 @@ export type MediaRef = {
|
|
|
49
50
|
export type ObjectRef = {
|
|
50
51
|
readonly type: typeof TypeKind.OBJECT_REF;
|
|
51
52
|
};
|
|
53
|
+
export type ResourceRef = {
|
|
54
|
+
readonly type: typeof TypeKind.RESOURCE_REF;
|
|
55
|
+
};
|
|
52
56
|
export type UserRef = {
|
|
53
57
|
readonly type: typeof TypeKind.USER_REF;
|
|
54
58
|
};
|
|
55
|
-
export type Type = Array | Boolean | DocRef | Double | MediaRef | ObjectRef | Optional | Ref | String | Unknown | UserRef;
|
|
59
|
+
export type Type = Array | Boolean | DocRef | Double | MediaRef | ObjectRef | ResourceRef | Optional | Ref | String | Unknown | UserRef;
|
|
56
60
|
export declare const String: String;
|
|
57
61
|
export declare const Double: Double;
|
|
58
62
|
export declare const Boolean: Boolean;
|
|
59
63
|
export declare const Unknown: Unknown;
|
|
64
|
+
export declare const ResourceRef: ResourceRef;
|
|
60
65
|
export declare const Array: <T extends TypeBase>(item: T) => Array<T>;
|
|
61
66
|
export declare const Optional: <T extends TypeBase>(item: T) => Optional<T>;
|
|
62
67
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,OAAO,cAAM;UACX,OAAO;UACP,SAAS;UACT,SAAS;UACT,QAAQ;UACR,WAAW;UACX,YAAY;UACZ,UAAU;UACV,KAAK;UACL,QAAQ;UACR,SAAS;UACT,UAAU;;AAGZ,YAAY,kBAAkB,sBAAsB;AAEpD,YAAY,SAAS;UACV,aAAa,SAAS;;AAGjC,YAAY,SAAS;UACV,aAAa,SAAS;;AAGjC,YAAY,UAAU;UACX,aAAa,SAAS;;UAIvB,SAAS;UACR,MAAM;;AAGjB,YAAY,MAAM,UAAU,WAAW,YAAY;UACxC,aAAa,SAAS;UACtB,OAAO;;AAIlB,YAAY,MAAM;UACP,aAAa,SAAS;UACtB,SAAS,WAAW;UACpB;;AAGX,YAAY,SAAS,UAAU,WAAW,YAAY;UAC3C,aAAa,SAAS;UACtB,MAAM;;AAGjB,YAAY,UAAU;UACX,aAAa,SAAS;;AAGjC,YAAY,SAAS;UACV,aAAa,SAAS;;AAGjC,YAAY,WAAW;UACZ,aAAa,SAAS;;AAGjC,YAAY,YAAY;UACb,aAAa,SAAS;;AAGjC,YAAY,UAAU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WAAY,UAAU,UAAU,MAAM,MAAI,SAAS","names":["String: String","Double: Double","Boolean: Boolean","Unknown: Unknown","ResourceRef: ResourceRef"],"sources":["../../src/primitives.ts"],"version":3,"file":"primitives.d.ts"}
|
package/package.json
CHANGED
package/src/primitives.ts
CHANGED
|
@@ -23,6 +23,7 @@ export const TypeKind = {
|
|
|
23
23
|
OBJECT_REF: "objectRef",
|
|
24
24
|
OPTIONAL: "optional",
|
|
25
25
|
REF: "ref",
|
|
26
|
+
RESOURCE_REF: "resourceRef",
|
|
26
27
|
STRING: "string",
|
|
27
28
|
UNKNOWN: "unknown",
|
|
28
29
|
USER_REF: "userRef",
|
|
@@ -80,6 +81,10 @@ export type ObjectRef = {
|
|
|
80
81
|
readonly type: typeof TypeKind.OBJECT_REF;
|
|
81
82
|
};
|
|
82
83
|
|
|
84
|
+
export type ResourceRef = {
|
|
85
|
+
readonly type: typeof TypeKind.RESOURCE_REF;
|
|
86
|
+
};
|
|
87
|
+
|
|
83
88
|
export type UserRef = {
|
|
84
89
|
readonly type: typeof TypeKind.USER_REF;
|
|
85
90
|
};
|
|
@@ -91,6 +96,7 @@ export type Type =
|
|
|
91
96
|
| Double
|
|
92
97
|
| MediaRef
|
|
93
98
|
| ObjectRef
|
|
99
|
+
| ResourceRef
|
|
94
100
|
| Optional
|
|
95
101
|
| Ref
|
|
96
102
|
| String
|
|
@@ -101,6 +107,7 @@ export const String: String = { type: TypeKind.STRING };
|
|
|
101
107
|
export const Double: Double = { type: TypeKind.DOUBLE };
|
|
102
108
|
export const Boolean: Boolean = { type: TypeKind.BOOLEAN };
|
|
103
109
|
export const Unknown: Unknown = { type: TypeKind.UNKNOWN };
|
|
110
|
+
export const ResourceRef: ResourceRef = { type: TypeKind.RESOURCE_REF };
|
|
104
111
|
function unwrapOneOptional(t: TypeBase): TypeBase {
|
|
105
112
|
return t.type === TypeKind.OPTIONAL && "item" in t ? (t as { item: TypeBase }).item : t;
|
|
106
113
|
}
|