@prisma-next/contract 0.12.0-dev.5 → 0.12.0-dev.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/apply-specifier-default-control-policy.d.mts +7 -0
  2. package/dist/apply-specifier-default-control-policy.d.mts.map +1 -0
  3. package/dist/apply-specifier-default-control-policy.mjs +12 -0
  4. package/dist/apply-specifier-default-control-policy.mjs.map +1 -0
  5. package/dist/{canonicalization-CM6bJ8i8.d.mts → canonicalization-D_iHy7iE.d.mts} +2 -2
  6. package/dist/canonicalization-D_iHy7iE.d.mts.map +1 -0
  7. package/dist/{canonicalization-path-match-b2jFuEso.mjs → canonicalization-path-match-Czn4Vds5.mjs} +1 -1
  8. package/dist/{canonicalization-path-match-b2jFuEso.mjs.map → canonicalization-path-match-Czn4Vds5.mjs.map} +1 -1
  9. package/dist/{contract-types-9BbapbkL.d.mts → contract-types-D5lcjipq.d.mts} +27 -11
  10. package/dist/contract-types-D5lcjipq.d.mts.map +1 -0
  11. package/dist/{contract-validation-error-T5LH4DW-.d.mts → contract-validation-error-B8UtbPEl.d.mts} +1 -1
  12. package/dist/{contract-validation-error-T5LH4DW-.d.mts.map → contract-validation-error-B8UtbPEl.d.mts.map} +1 -1
  13. package/dist/contract-validation-error.d.mts +1 -1
  14. package/dist/default-namespace-Bhu0oN8U.mjs +33 -0
  15. package/dist/default-namespace-Bhu0oN8U.mjs.map +1 -0
  16. package/dist/default-namespace-CWdFpoc_.d.mts +25 -0
  17. package/dist/default-namespace-CWdFpoc_.d.mts.map +1 -0
  18. package/dist/default-namespace.d.mts +2 -0
  19. package/dist/default-namespace.mjs +2 -0
  20. package/dist/{domain-envelope-Cv5OTm8D.d.mts → domain-envelope-BFYbgufo.d.mts} +2 -10
  21. package/dist/{domain-envelope-Cv5OTm8D.d.mts.map → domain-envelope-BFYbgufo.d.mts.map} +1 -1
  22. package/dist/hashing-utils.d.mts +1 -1
  23. package/dist/hashing-utils.d.mts.map +1 -1
  24. package/dist/hashing-utils.mjs +5 -4
  25. package/dist/hashing-utils.mjs.map +1 -1
  26. package/dist/hashing.d.mts +2 -2
  27. package/dist/hashing.d.mts.map +1 -1
  28. package/dist/hashing.mjs +38 -11
  29. package/dist/hashing.mjs.map +1 -1
  30. package/dist/{namespace-id-CVpkSFUK.mjs → namespace-id-BSCer2Vd.mjs} +1 -1
  31. package/dist/{namespace-id-CVpkSFUK.mjs.map → namespace-id-BSCer2Vd.mjs.map} +1 -1
  32. package/dist/resolve-domain-model-DMXbLLjV.d.mts +17 -0
  33. package/dist/resolve-domain-model-DMXbLLjV.d.mts.map +1 -0
  34. package/dist/resolve-domain-model-R4txseVc.mjs +20 -0
  35. package/dist/resolve-domain-model-R4txseVc.mjs.map +1 -0
  36. package/dist/resolve-domain-model.d.mts +2 -0
  37. package/dist/resolve-domain-model.mjs +2 -0
  38. package/dist/types.d.mts +21 -4
  39. package/dist/types.d.mts.map +1 -0
  40. package/dist/types.mjs +22 -27
  41. package/dist/types.mjs.map +1 -1
  42. package/dist/validate-domain.d.mts +1 -1
  43. package/dist/validate-domain.mjs +1 -1
  44. package/package.json +7 -4
  45. package/src/apply-specifier-default-control-policy.ts +12 -0
  46. package/src/canonicalization-storage-sort.ts +8 -1
  47. package/src/canonicalization.ts +13 -4
  48. package/src/contract-types.ts +8 -6
  49. package/src/control-policy.ts +3 -3
  50. package/src/default-namespace.ts +36 -0
  51. package/src/domain-envelope.ts +1 -60
  52. package/src/domain-namespace-access.ts +32 -0
  53. package/src/exports/apply-specifier-default-control-policy.ts +1 -0
  54. package/src/exports/default-namespace.ts +1 -0
  55. package/src/exports/resolve-domain-model.ts +1 -0
  56. package/src/exports/types.ts +10 -8
  57. package/src/hashing.ts +42 -13
  58. package/src/resolve-domain-model.ts +27 -0
  59. package/src/types.ts +18 -2
  60. package/dist/canonicalization-CM6bJ8i8.d.mts.map +0 -1
  61. package/dist/contract-types-9BbapbkL.d.mts.map +0 -1
@@ -0,0 +1,17 @@
1
+ import { l as ContractModelBase, t as ApplicationDomain } from "./domain-envelope-BFYbgufo.mjs";
2
+
3
+ //#region src/resolve-domain-model.d.ts
4
+ interface ResolvedDomainModel {
5
+ readonly namespaceId: string;
6
+ readonly model: ContractModelBase;
7
+ }
8
+ /**
9
+ * Resolve a bare domain model name to its namespace coordinate and model IR by
10
+ * scanning the contract's namespaces. For the single-namespace contracts in
11
+ * scope the scan is exact; cross-namespace bare-name collisions are selected
12
+ * explicitly (TML-2550).
13
+ */
14
+ declare function resolveDomainModel(domain: ApplicationDomain, modelName: string): ResolvedDomainModel | undefined;
15
+ //#endregion
16
+ export { resolveDomainModel as n, ResolvedDomainModel as t };
17
+ //# sourceMappingURL=resolve-domain-model-DMXbLLjV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-domain-model-DMXbLLjV.d.mts","names":[],"sources":["../src/resolve-domain-model.ts"],"mappings":";;;UAGiB,mBAAA;EAAA,SACN,WAAA;EAAA,SACA,KAAA,EAAO,iBAAiB;AAAA;;;;;;AAAA;iBASnB,kBAAA,CACd,MAAA,EAAQ,iBAAA,EACR,SAAA,WACC,mBAAmB"}
@@ -0,0 +1,20 @@
1
+ //#region src/resolve-domain-model.ts
2
+ /**
3
+ * Resolve a bare domain model name to its namespace coordinate and model IR by
4
+ * scanning the contract's namespaces. For the single-namespace contracts in
5
+ * scope the scan is exact; cross-namespace bare-name collisions are selected
6
+ * explicitly (TML-2550).
7
+ */
8
+ function resolveDomainModel(domain, modelName) {
9
+ for (const namespaceId of Object.keys(domain.namespaces)) {
10
+ const model = domain.namespaces[namespaceId]?.models[modelName];
11
+ if (model !== void 0) return {
12
+ namespaceId,
13
+ model
14
+ };
15
+ }
16
+ }
17
+ //#endregion
18
+ export { resolveDomainModel as t };
19
+
20
+ //# sourceMappingURL=resolve-domain-model-R4txseVc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-domain-model-R4txseVc.mjs","names":[],"sources":["../src/resolve-domain-model.ts"],"sourcesContent":["import type { ApplicationDomain } from './domain-envelope';\nimport type { ContractModelBase } from './domain-types';\n\nexport interface ResolvedDomainModel {\n readonly namespaceId: string;\n readonly model: ContractModelBase;\n}\n\n/**\n * Resolve a bare domain model name to its namespace coordinate and model IR by\n * scanning the contract's namespaces. For the single-namespace contracts in\n * scope the scan is exact; cross-namespace bare-name collisions are selected\n * explicitly (TML-2550).\n */\nexport function resolveDomainModel(\n domain: ApplicationDomain,\n modelName: string,\n): ResolvedDomainModel | undefined {\n for (const namespaceId of Object.keys(domain.namespaces)) {\n const model = domain.namespaces[namespaceId]?.models[modelName];\n if (model !== undefined) {\n return { namespaceId, model };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,mBACd,QACA,WACiC;CACjC,KAAK,MAAM,eAAe,OAAO,KAAK,OAAO,UAAU,GAAG;EACxD,MAAM,QAAQ,OAAO,WAAW,cAAc,OAAO;EACrD,IAAI,UAAU,KAAA,GACZ,OAAO;GAAE;GAAa;EAAM;CAEhC;AAGF"}
@@ -0,0 +1,2 @@
1
+ import { n as resolveDomainModel, t as ResolvedDomainModel } from "./resolve-domain-model-DMXbLLjV.mjs";
2
+ export { type ResolvedDomainModel, resolveDomainModel };
@@ -0,0 +1,2 @@
1
+ import { t as resolveDomainModel } from "./resolve-domain-model-R4txseVc.mjs";
2
+ export { resolveDomainModel };
package/dist/types.d.mts CHANGED
@@ -1,4 +1,21 @@
1
- import { r as DomainNamespaceResolutionError } from "./contract-validation-error-T5LH4DW-.mjs";
2
- import { A as coreHash, C as PlanMeta, D as StorageEntitySlot, E as StorageBase, F as profileHash, I as ControlPolicy, L as effectiveControl, M as isColumnDefault, N as isColumnDefaultLiteralInputValue, O as StorageHashBase, P as isExecutionMutationDefaultValue, S as JsonValue, T as Source, _ as ExecutionSection, a as $, b as GeneratedValueSpec, c as ColumnDefaultLiteralInputValue, d as DocCollection, f as DocIndex, g as ExecutionMutationDefaultValue, h as ExecutionMutationDefaultPhases, i as ContractValueObjectsMap, j as executionHash, k as StorageNamespace, l as ColumnDefaultLiteralValue, m as ExecutionMutationDefault, n as ContractExecutionSection, o as Brand, p as ExecutionHashBase, r as ContractModelsMap, s as ColumnDefault, t as Contract, u as ContractMarkerRecord, v as Expr, w as ProfileHashBase, x as JsonPrimitive, y as FieldType } from "./contract-types-9BbapbkL.mjs";
3
- import { C as UnionFieldType, D as crossRef, E as CrossReferenceSchema, O as NamespaceId, S as ScalarFieldType, T as CrossReference, _ as ContractValueObject, a as contractModels, b as ModelStorageBase, c as ContractDiscriminator, d as ContractFieldType, f as ContractModel, g as ContractRelationOn, h as ContractRelation, i as UNBOUND_DOMAIN_NAMESPACE_ID, k as asNamespaceId, l as ContractEmbedRelation, m as ContractReferenceRelation, n as ApplicationDomainNamespace, o as contractValueObjects, p as ContractModelBase, r as ContractWithDomain, s as resolveSingleDomainNamespaceId, t as ApplicationDomain, u as ContractField, v as ContractVariantEntry, w as ValueObjectFieldType, x as ReferenceRelationKeys, y as EmbedRelationKeys } from "./domain-envelope-Cv5OTm8D.mjs";
4
- export { type $, type ApplicationDomain, type ApplicationDomainNamespace, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractFieldType, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractModelsMap, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractValueObject, type ContractValueObjectsMap, type ContractVariantEntry, type ContractWithDomain, type ControlPolicy, type CrossReference, CrossReferenceSchema, type DocCollection, type DocIndex, DomainNamespaceResolutionError, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultPhases, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type NamespaceId, type PlanMeta, type ProfileHashBase, type ReferenceRelationKeys, type ScalarFieldType, type Source, type StorageBase, type StorageEntitySlot, type StorageHashBase, type StorageNamespace, UNBOUND_DOMAIN_NAMESPACE_ID, type UnionFieldType, type ValueObjectFieldType, asNamespaceId, contractModels, contractValueObjects, coreHash, crossRef, effectiveControl, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, profileHash, resolveSingleDomainNamespaceId };
1
+ import { A as StorageNamespace, C as LedgerEntryRecord, D as StorageBase, E as Source, F as isExecutionMutationDefaultValue, I as profileHash, L as ControlPolicy, M as executionHash, N as isColumnDefault, O as StorageEntitySlot, P as isColumnDefaultLiteralInputValue, R as effectiveControlPolicy, S as JsonValue, T as ProfileHashBase, _ as ExecutionSection, a as $, b as GeneratedValueSpec, c as ColumnDefaultLiteralInputValue, d as DocCollection, f as DocIndex, g as ExecutionMutationDefaultValue, h as ExecutionMutationDefaultPhases, i as ContractValueObjectDefinitions, j as coreHash, k as StorageHashBase, l as ColumnDefaultLiteralValue, m as ExecutionMutationDefault, n as ContractExecutionSection, o as Brand, p as ExecutionHashBase, r as ContractModelDefinitions, s as ColumnDefault, t as Contract, u as ContractMarkerRecord, v as Expr, w as PlanMeta, x as JsonPrimitive, y as FieldType } from "./contract-types-D5lcjipq.mjs";
2
+ import { C as crossRef, S as CrossReferenceSchema, T as asNamespaceId, _ as ReferenceRelationKeys, a as ContractEmbedRelation, b as ValueObjectFieldType, c as ContractModel, d as ContractRelation, f as ContractRelationOn, g as ModelStorageBase, h as EmbedRelationKeys, i as ContractDiscriminator, l as ContractModelBase, m as ContractVariantEntry, n as ApplicationDomainNamespace, o as ContractField, p as ContractValueObject, r as ContractWithDomain, s as ContractFieldType, t as ApplicationDomain, u as ContractReferenceRelation, v as ScalarFieldType, w as NamespaceId, x as CrossReference, y as UnionFieldType } from "./domain-envelope-BFYbgufo.mjs";
3
+ import { n as soleDomainNamespaceId, t as UNBOUND_DOMAIN_NAMESPACE_ID } from "./default-namespace-CWdFpoc_.mjs";
4
+ import { r as DomainNamespaceResolutionError } from "./contract-validation-error-B8UtbPEl.mjs";
5
+ import { n as resolveDomainModel, t as ResolvedDomainModel } from "./resolve-domain-model-DMXbLLjV.mjs";
6
+
7
+ //#region src/domain-namespace-access.d.ts
8
+ /**
9
+ * Models map for the contract's single domain namespace. Throws when the
10
+ * contract does not declare exactly one namespace — bare-name access is
11
+ * ambiguous across namespaces and must be qualified explicitly (TML-2550).
12
+ */
13
+ declare function domainModelsAtDefaultNamespace<TModels extends Record<string, ContractModelBase>>(domain: ApplicationDomain<TModels>): TModels;
14
+ /**
15
+ * Value objects for the contract's single domain namespace, when present.
16
+ * Throws when the contract does not declare exactly one namespace.
17
+ */
18
+ declare function domainValueObjectsAtDefaultNamespace<TModels extends Record<string, ContractModelBase>>(domain: ApplicationDomain<TModels>): Record<string, ContractValueObject> | undefined;
19
+ //#endregion
20
+ export { type $, type ApplicationDomain, type ApplicationDomainNamespace, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractFieldType, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractModelDefinitions, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractValueObject, type ContractValueObjectDefinitions, type ContractVariantEntry, type ContractWithDomain, type ControlPolicy, type CrossReference, CrossReferenceSchema, type DocCollection, type DocIndex, DomainNamespaceResolutionError, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultPhases, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type LedgerEntryRecord, type ModelStorageBase, type NamespaceId, type PlanMeta, type ProfileHashBase, type ReferenceRelationKeys, type ResolvedDomainModel, type ScalarFieldType, type Source, type StorageBase, type StorageEntitySlot, type StorageHashBase, type StorageNamespace, UNBOUND_DOMAIN_NAMESPACE_ID, type UnionFieldType, type ValueObjectFieldType, asNamespaceId, coreHash, crossRef, domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace, effectiveControlPolicy, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, profileHash, resolveDomainModel, soleDomainNamespaceId };
21
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../src/domain-namespace-access.ts"],"mappings":";;;;;;;;;;;;iBAUgB,8BAAA,iBAA+C,MAAA,SAAe,iBAAA,EAAA,CAC5E,MAAA,EAAQ,iBAAA,CAAkB,OAAA,IACzB,OAAA;;;;;iBAea,oCAAA,iBACE,MAAA,SAAe,iBAAA,EAAA,CAC/B,MAAA,EAAQ,iBAAA,CAAkB,OAAA,IAAW,MAAA,SAAe,mBAAA"}
package/dist/types.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  import { n as DomainNamespaceResolutionError } from "./contract-validation-error-ClZaKqMW.mjs";
2
- import { t as asNamespaceId } from "./namespace-id-CVpkSFUK.mjs";
2
+ import { n as soleDomainNamespaceId, t as UNBOUND_DOMAIN_NAMESPACE_ID } from "./default-namespace-Bhu0oN8U.mjs";
3
+ import { t as resolveDomainModel } from "./resolve-domain-model-R4txseVc.mjs";
4
+ import { t as asNamespaceId } from "./namespace-id-BSCer2Vd.mjs";
3
5
  import { blindCast } from "@prisma-next/utils/casts";
4
6
  import { type } from "arktype";
5
7
  //#region src/control-policy.ts
@@ -11,8 +13,8 @@ import { type } from "arktype";
11
13
  * Both parameters are optional raw values so this function stays node-type-agnostic
12
14
  * and can be called by any consumer (verifier, planner, etc.) without importing IR classes.
13
15
  */
14
- function effectiveControl(nodeControl, defaultControl) {
15
- return nodeControl ?? defaultControl ?? "managed";
16
+ function effectiveControlPolicy(nodeControl, defaultControlPolicy) {
17
+ return nodeControl ?? defaultControlPolicy ?? "managed";
16
18
  }
17
19
  //#endregion
18
20
  //#region src/cross-reference.ts
@@ -29,31 +31,24 @@ function crossRef(model, namespace = DEFAULT_CROSS_REF_NAMESPACE) {
29
31
  };
30
32
  }
31
33
  //#endregion
32
- //#region src/domain-envelope.ts
33
- const UNBOUND_DOMAIN_NAMESPACE_ID = "__unbound__";
34
- function resolveSingleDomainNamespaceId(domain, namespaceId) {
35
- if (namespaceId !== void 0) {
36
- if (!Object.hasOwn(domain.namespaces, namespaceId)) throw new DomainNamespaceResolutionError(`domain namespace "${namespaceId}" is not present on the contract`);
37
- return namespaceId;
38
- }
39
- const namespaceIds = Object.keys(domain.namespaces);
40
- if (namespaceIds.length === 0) throw new DomainNamespaceResolutionError("domain has no namespaces");
41
- if (namespaceIds.length > 1) throw new DomainNamespaceResolutionError(`expected exactly one domain namespace, found ${namespaceIds.length} (${namespaceIds.join(", ")})`);
42
- const [soleNamespaceId] = namespaceIds;
43
- if (soleNamespaceId === void 0) throw new DomainNamespaceResolutionError("domain has no namespaces");
44
- return soleNamespaceId;
45
- }
46
- function contractModels(contract, namespaceId) {
47
- const resolved = resolveSingleDomainNamespaceId(contract.domain, namespaceId);
48
- const domainNamespace = contract.domain.namespaces[resolved];
49
- if (domainNamespace === void 0) throw new DomainNamespaceResolutionError(`domain namespace "${resolved}" is not present on the contract`);
34
+ //#region src/domain-namespace-access.ts
35
+ /**
36
+ * Models map for the contract's single domain namespace. Throws when the
37
+ * contract does not declare exactly one namespace — bare-name access is
38
+ * ambiguous across namespaces and must be qualified explicitly (TML-2550).
39
+ */
40
+ function domainModelsAtDefaultNamespace(domain) {
41
+ const namespaceId = soleDomainNamespaceId(domain);
42
+ const domainNamespace = domain.namespaces[namespaceId];
43
+ if (domainNamespace === void 0) throw new DomainNamespaceResolutionError(`domain namespace "${namespaceId}" is not present on the contract`);
50
44
  return domainNamespace.models;
51
45
  }
52
- function contractValueObjects(contract, namespaceId) {
53
- const resolved = resolveSingleDomainNamespaceId(contract.domain, namespaceId);
54
- const domainNamespace = contract.domain.namespaces[resolved];
55
- if (domainNamespace === void 0) throw new DomainNamespaceResolutionError(`domain namespace "${resolved}" is not present on the contract`);
56
- return domainNamespace.valueObjects;
46
+ /**
47
+ * Value objects for the contract's single domain namespace, when present.
48
+ * Throws when the contract does not declare exactly one namespace.
49
+ */
50
+ function domainValueObjectsAtDefaultNamespace(domain) {
51
+ return domain.namespaces[soleDomainNamespaceId(domain)]?.valueObjects;
57
52
  }
58
53
  //#endregion
59
54
  //#region src/types.ts
@@ -99,6 +94,6 @@ function isExecutionMutationDefaultValue(value) {
99
94
  return true;
100
95
  }
101
96
  //#endregion
102
- export { CrossReferenceSchema, DomainNamespaceResolutionError, UNBOUND_DOMAIN_NAMESPACE_ID, asNamespaceId, contractModels, contractValueObjects, coreHash, crossRef, effectiveControl, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, profileHash, resolveSingleDomainNamespaceId };
97
+ export { CrossReferenceSchema, DomainNamespaceResolutionError, UNBOUND_DOMAIN_NAMESPACE_ID, asNamespaceId, coreHash, crossRef, domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace, effectiveControlPolicy, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, profileHash, resolveDomainModel, soleDomainNamespaceId };
103
98
 
104
99
  //# sourceMappingURL=types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../src/control-policy.ts","../src/cross-reference.ts","../src/domain-envelope.ts","../src/types.ts"],"sourcesContent":["/**\n * Governance posture for a storage-plane node or for the contract as a whole.\n *\n * - `managed` — Prisma Next owns the full lifecycle (DDL, migrations, verification).\n * - `tolerated` — node was found in the database but is not schema-managed; Prisma Next\n * leaves it untouched while tracking its existence.\n * - `external` — node is owned by an external system; Prisma Next never emits DDL for it.\n * - `observed` — read-only access; Prisma Next does not write to or migrate the node.\n */\nexport type ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed';\n\n/**\n * Resolves the effective control policy for a storage-plane node.\n *\n * Precedence: node-level value → contract default → `'managed'`.\n *\n * Both parameters are optional raw values so this function stays node-type-agnostic\n * and can be called by any consumer (verifier, planner, etc.) without importing IR classes.\n */\nexport function effectiveControl(\n nodeControl: ControlPolicy | undefined,\n defaultControl: ControlPolicy | undefined,\n): ControlPolicy {\n return nodeControl ?? defaultControl ?? 'managed';\n}\n","import { blindCast } from '@prisma-next/utils/casts';\nimport { type Type, type } from 'arktype';\nimport { asNamespaceId, type NamespaceId } from './namespace-id';\n\nexport interface CrossReference {\n readonly namespace: NamespaceId;\n readonly model: string;\n}\n\nexport const CrossReferenceSchema = /* @__PURE__ */ blindCast<\n Type<CrossReference>,\n 'namespace is validated as string at runtime and branded to NamespaceId by asNamespaceId in crossRef(); the schema accepts plain strings but the public type reflects the branded shape'\n>(\n /* @__PURE__ */ type({\n '+': 'reject',\n namespace: 'string',\n model: 'string',\n }),\n);\n\nconst DEFAULT_CROSS_REF_NAMESPACE = '__unbound__';\n\nexport function crossRef(\n model: string,\n namespace: string = DEFAULT_CROSS_REF_NAMESPACE,\n): CrossReference {\n return { namespace: asNamespaceId(namespace), model };\n}\n","import { DomainNamespaceResolutionError } from './contract-validation-error';\nimport type { ContractModelBase, ContractValueObject } from './domain-types';\n\nexport const UNBOUND_DOMAIN_NAMESPACE_ID = '__unbound__' as const;\n\n/**\n * One namespace's application-domain entities — models and optional value\n * objects keyed by entity name within that namespace coordinate.\n */\nexport interface ApplicationDomainNamespace<\n TModels extends Record<string, ContractModelBase> = Record<string, ContractModelBase>,\n> {\n readonly models: TModels;\n readonly valueObjects?: Record<string, ContractValueObject>;\n}\n\n/**\n * Application-domain envelope: entity content keyed by namespace id.\n * Mirrors the storage plane's `namespaces` segment (ADR 221).\n */\nexport interface ApplicationDomain<\n TModels extends Record<string, ContractModelBase> = Record<string, ContractModelBase>,\n> {\n readonly namespaces: Readonly<Record<string, ApplicationDomainNamespace<TModels>>>;\n}\n\nexport type ContractWithDomain = {\n readonly domain: ApplicationDomain;\n};\n\nexport function resolveSingleDomainNamespaceId(\n domain: ApplicationDomain,\n namespaceId?: string,\n): string {\n if (namespaceId !== undefined) {\n if (!Object.hasOwn(domain.namespaces, namespaceId)) {\n throw new DomainNamespaceResolutionError(\n `domain namespace \"${namespaceId}\" is not present on the contract`,\n );\n }\n return namespaceId;\n }\n\n const namespaceIds = Object.keys(domain.namespaces);\n if (namespaceIds.length === 0) {\n throw new DomainNamespaceResolutionError('domain has no namespaces');\n }\n if (namespaceIds.length > 1) {\n throw new DomainNamespaceResolutionError(\n `expected exactly one domain namespace, found ${namespaceIds.length} (${namespaceIds.join(', ')})`,\n );\n }\n const [soleNamespaceId] = namespaceIds;\n if (soleNamespaceId === undefined) {\n throw new DomainNamespaceResolutionError('domain has no namespaces');\n }\n return soleNamespaceId;\n}\n\n// Transitional single-namespace projection; pending runtime-qualification slice.\nexport function contractModels<TModels extends Record<string, ContractModelBase>>(\n contract: { readonly domain: ApplicationDomain<TModels> },\n namespaceId?: string,\n): TModels {\n const resolved = resolveSingleDomainNamespaceId(contract.domain, namespaceId);\n const domainNamespace = contract.domain.namespaces[resolved];\n if (domainNamespace === undefined) {\n throw new DomainNamespaceResolutionError(\n `domain namespace \"${resolved}\" is not present on the contract`,\n );\n }\n return domainNamespace.models;\n}\n\nexport function contractValueObjects<TModels extends Record<string, ContractModelBase>>(\n contract: { readonly domain: ApplicationDomain<TModels> },\n namespaceId?: string,\n): Record<string, ContractValueObject> | undefined {\n const resolved = resolveSingleDomainNamespaceId(contract.domain, namespaceId);\n const domainNamespace = contract.domain.namespaces[resolved];\n if (domainNamespace === undefined) {\n throw new DomainNamespaceResolutionError(\n `domain namespace \"${resolved}\" is not present on the contract`,\n );\n }\n return domainNamespace.valueObjects;\n}\n","/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\n/**\n * One entity-kind slot in a namespace — a map of entity name to entry.\n * Values are opaque at the foundation layer; family and target concretions\n * refine them to typed IR classes.\n */\nexport type StorageEntitySlot = Readonly<Record<string, unknown>>;\n\n/**\n * Plain-data namespace entry in a storage block. Every hydrated contract\n * carries at least `id` plus zero or more entity-kind slot maps (`tables`,\n * `collections`, …). Foundation declares only this shape — no IR machinery.\n */\nexport interface StorageNamespace {\n readonly id: string;\n}\n\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n *\n * The `namespaces` map is carried by every hydrated storage block. Serialized\n * envelope shape is target-owned; this types the in-memory contract after\n * `deserializeContract`.\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\n readonly namespaces: Readonly<Record<string, StorageNamespace>>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type ColumnDefaultLiteralValue = JsonValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;\n\n/**\n * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers\n * resolve template values from caller-supplied args (typed `unknown` at the\n * boundary) and need to validate before constructing a `ColumnDefault`.\n * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`\n * instances. Rejects functions, class instances (other than `Date`),\n * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.\n */\nexport function isColumnDefaultLiteralInputValue(\n value: unknown,\n): value is ColumnDefaultLiteralInputValue {\n if (value === null) return true;\n const t = typeof value;\n if (t === 'string' || t === 'number' || t === 'boolean') return true;\n if (value instanceof Date) return true;\n if (Array.isArray(value)) return value.every(isColumnDefaultLiteralInputValue);\n if (t === 'object' && Object.getPrototypeOf(value) === Object.prototype) {\n return Object.values(value as Record<string, unknown>).every(isColumnDefaultLiteralInputValue);\n }\n return false;\n}\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport function isColumnDefault(value: unknown): value is ColumnDefault {\n if (typeof value !== 'object' || value === null) return false;\n const kind = (value as { kind?: unknown }).kind;\n if (kind === 'literal') {\n return 'value' in value;\n }\n if (kind === 'function') {\n return typeof (value as { expression?: unknown }).expression === 'string';\n }\n return false;\n}\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport function isExecutionMutationDefaultValue(\n value: unknown,\n): value is ExecutionMutationDefaultValue {\n if (typeof value !== 'object' || value === null) return false;\n const candidate = value as {\n kind?: unknown;\n id?: unknown;\n params?: unknown;\n };\n if (candidate.kind !== 'generator') return false;\n if (typeof candidate.id !== 'string') return false;\n if (\n candidate.params !== undefined &&\n (typeof candidate.params !== 'object' ||\n candidate.params === null ||\n Array.isArray(candidate.params))\n ) {\n return false;\n }\n return true;\n}\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\n/**\n * `ExecutionMutationDefault` minus its `ref` — the per-field phases value\n * authoring layers attach to a column before the column ref is known.\n */\nexport type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;\n\nexport type ExecutionSection<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n readonly [key: string]: unknown;\n };\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n readonly invariants: readonly string[];\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAgB,iBACd,aACA,gBACe;CACf,OAAO,eAAe,kBAAkB;AAC1C;;;ACfA,MAAa,uBAAuC,0BAIlC,qBAAK;CACnB,KAAK;CACL,WAAW;CACX,OAAO;AACT,CAAC,CACH;AAEA,MAAM,8BAA8B;AAEpC,SAAgB,SACd,OACA,YAAoB,6BACJ;CAChB,OAAO;EAAE,WAAW,cAAc,SAAS;EAAG;CAAM;AACtD;;;ACxBA,MAAa,8BAA8B;AA2B3C,SAAgB,+BACd,QACA,aACQ;CACR,IAAI,gBAAgB,KAAA,GAAW;EAC7B,IAAI,CAAC,OAAO,OAAO,OAAO,YAAY,WAAW,GAC/C,MAAM,IAAI,+BACR,qBAAqB,YAAY,iCACnC;EAEF,OAAO;CACT;CAEA,MAAM,eAAe,OAAO,KAAK,OAAO,UAAU;CAClD,IAAI,aAAa,WAAW,GAC1B,MAAM,IAAI,+BAA+B,0BAA0B;CAErE,IAAI,aAAa,SAAS,GACxB,MAAM,IAAI,+BACR,gDAAgD,aAAa,OAAO,IAAI,aAAa,KAAK,IAAI,EAAE,EAClG;CAEF,MAAM,CAAC,mBAAmB;CAC1B,IAAI,oBAAoB,KAAA,GACtB,MAAM,IAAI,+BAA+B,0BAA0B;CAErE,OAAO;AACT;AAGA,SAAgB,eACd,UACA,aACS;CACT,MAAM,WAAW,+BAA+B,SAAS,QAAQ,WAAW;CAC5E,MAAM,kBAAkB,SAAS,OAAO,WAAW;CACnD,IAAI,oBAAoB,KAAA,GACtB,MAAM,IAAI,+BACR,qBAAqB,SAAS,iCAChC;CAEF,OAAO,gBAAgB;AACzB;AAEA,SAAgB,qBACd,UACA,aACiD;CACjD,MAAM,WAAW,+BAA+B,SAAS,QAAQ,WAAW;CAC5E,MAAM,kBAAkB,SAAS,OAAO,WAAW;CACnD,IAAI,oBAAoB,KAAA,GACtB,MAAM,IAAI,+BACR,qBAAqB,SAAS,iCAChC;CAEF,OAAO,gBAAgB;AACzB;;;ACvDA,SAAgB,cAAsC,OAAgC;CACpF,OAAO;AACT;AAEA,SAAgB,SAAiC,OAA8B;CAC7E,OAAO;AACT;AASA,SAAgB,YAAoC,OAA8B;CAChF,OAAO;AACT;;;;;;;;;AA+DA,SAAgB,iCACd,OACyC;CACzC,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,IAAI,OAAO;CACjB,IAAI,MAAM,YAAY,MAAM,YAAY,MAAM,WAAW,OAAO;CAChE,IAAI,iBAAiB,MAAM,OAAO;CAClC,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,MAAM,gCAAgC;CAC7E,IAAI,MAAM,YAAY,OAAO,eAAe,KAAK,MAAM,OAAO,WAC5D,OAAO,OAAO,OAAO,KAAgC,EAAE,MAAM,gCAAgC;CAE/F,OAAO;AACT;AASA,SAAgB,gBAAgB,OAAwC;CACtE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,OAAQ,MAA6B;CAC3C,IAAI,SAAS,WACX,OAAO,WAAW;CAEpB,IAAI,SAAS,YACX,OAAO,OAAQ,MAAmC,eAAe;CAEnE,OAAO;AACT;AAQA,SAAgB,gCACd,OACwC;CACxC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,YAAY;CAKlB,IAAI,UAAU,SAAS,aAAa,OAAO;CAC3C,IAAI,OAAO,UAAU,OAAO,UAAU,OAAO;CAC7C,IACE,UAAU,WAAW,KAAA,MACpB,OAAO,UAAU,WAAW,YAC3B,UAAU,WAAW,QACrB,MAAM,QAAQ,UAAU,MAAM,IAEhC,OAAO;CAET,OAAO;AACT"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../src/control-policy.ts","../src/cross-reference.ts","../src/domain-namespace-access.ts","../src/types.ts"],"sourcesContent":["/**\n * Governance posture for a storage-plane node or for the contract as a whole.\n *\n * - `managed` — Prisma Next owns the full lifecycle (DDL, migrations, verification).\n * - `tolerated` — node was found in the database but is not schema-managed; Prisma Next\n * leaves it untouched while tracking its existence.\n * - `external` — node is owned by an external system; Prisma Next never emits DDL for it.\n * - `observed` — read-only access; Prisma Next does not write to or migrate the node.\n */\nexport type ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed';\n\n/**\n * Resolves the effective control policy for a storage-plane node.\n *\n * Precedence: node-level value → contract default → `'managed'`.\n *\n * Both parameters are optional raw values so this function stays node-type-agnostic\n * and can be called by any consumer (verifier, planner, etc.) without importing IR classes.\n */\nexport function effectiveControlPolicy(\n nodeControl: ControlPolicy | undefined,\n defaultControlPolicy: ControlPolicy | undefined,\n): ControlPolicy {\n return nodeControl ?? defaultControlPolicy ?? 'managed';\n}\n","import { blindCast } from '@prisma-next/utils/casts';\nimport { type Type, type } from 'arktype';\nimport { asNamespaceId, type NamespaceId } from './namespace-id';\n\nexport interface CrossReference {\n readonly namespace: NamespaceId;\n readonly model: string;\n}\n\nexport const CrossReferenceSchema = /* @__PURE__ */ blindCast<\n Type<CrossReference>,\n 'namespace is validated as string at runtime and branded to NamespaceId by asNamespaceId in crossRef(); the schema accepts plain strings but the public type reflects the branded shape'\n>(\n /* @__PURE__ */ type({\n '+': 'reject',\n namespace: 'string',\n model: 'string',\n }),\n);\n\nconst DEFAULT_CROSS_REF_NAMESPACE = '__unbound__';\n\nexport function crossRef(\n model: string,\n namespace: string = DEFAULT_CROSS_REF_NAMESPACE,\n): CrossReference {\n return { namespace: asNamespaceId(namespace), model };\n}\n","import { DomainNamespaceResolutionError } from './contract-validation-error';\nimport { soleDomainNamespaceId } from './default-namespace';\nimport type { ApplicationDomain } from './domain-envelope';\nimport type { ContractModelBase, ContractValueObject } from './domain-types';\n\n/**\n * Models map for the contract's single domain namespace. Throws when the\n * contract does not declare exactly one namespace — bare-name access is\n * ambiguous across namespaces and must be qualified explicitly (TML-2550).\n */\nexport function domainModelsAtDefaultNamespace<TModels extends Record<string, ContractModelBase>>(\n domain: ApplicationDomain<TModels>,\n): TModels {\n const namespaceId = soleDomainNamespaceId(domain);\n const domainNamespace = domain.namespaces[namespaceId];\n if (domainNamespace === undefined) {\n throw new DomainNamespaceResolutionError(\n `domain namespace \"${namespaceId}\" is not present on the contract`,\n );\n }\n return domainNamespace.models;\n}\n\n/**\n * Value objects for the contract's single domain namespace, when present.\n * Throws when the contract does not declare exactly one namespace.\n */\nexport function domainValueObjectsAtDefaultNamespace<\n TModels extends Record<string, ContractModelBase>,\n>(domain: ApplicationDomain<TModels>): Record<string, ContractValueObject> | undefined {\n return domain.namespaces[soleDomainNamespaceId(domain)]?.valueObjects;\n}\n","/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\n/**\n * One entity-kind slot in a namespace — a map of entity name to entry.\n * Values are opaque at the foundation layer; family and target concretions\n * refine them to typed IR classes.\n */\nexport type StorageEntitySlot = Readonly<Record<string, unknown>>;\n\n/**\n * Plain-data namespace entry in a storage block. Every hydrated contract\n * carries at least `id` plus entity-kind slot maps under `entries`\n * (`table`, `collection`, …). Foundation declares only this shape — no IR\n * machinery.\n */\nexport interface StorageNamespace {\n readonly id: string;\n readonly entries: Readonly<Record<string, StorageEntitySlot>>;\n}\n\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n *\n * The `namespaces` map is carried by every hydrated storage block. Serialized\n * envelope shape is target-owned; this types the in-memory contract after\n * `deserializeContract`.\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\n readonly namespaces: Readonly<Record<string, StorageNamespace>>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type ColumnDefaultLiteralValue = JsonValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;\n\n/**\n * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers\n * resolve template values from caller-supplied args (typed `unknown` at the\n * boundary) and need to validate before constructing a `ColumnDefault`.\n * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`\n * instances. Rejects functions, class instances (other than `Date`),\n * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.\n */\nexport function isColumnDefaultLiteralInputValue(\n value: unknown,\n): value is ColumnDefaultLiteralInputValue {\n if (value === null) return true;\n const t = typeof value;\n if (t === 'string' || t === 'number' || t === 'boolean') return true;\n if (value instanceof Date) return true;\n if (Array.isArray(value)) return value.every(isColumnDefaultLiteralInputValue);\n if (t === 'object' && Object.getPrototypeOf(value) === Object.prototype) {\n return Object.values(value as Record<string, unknown>).every(isColumnDefaultLiteralInputValue);\n }\n return false;\n}\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport function isColumnDefault(value: unknown): value is ColumnDefault {\n if (typeof value !== 'object' || value === null) return false;\n const kind = (value as { kind?: unknown }).kind;\n if (kind === 'literal') {\n return 'value' in value;\n }\n if (kind === 'function') {\n return typeof (value as { expression?: unknown }).expression === 'string';\n }\n return false;\n}\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport function isExecutionMutationDefaultValue(\n value: unknown,\n): value is ExecutionMutationDefaultValue {\n if (typeof value !== 'object' || value === null) return false;\n const candidate = value as {\n kind?: unknown;\n id?: unknown;\n params?: unknown;\n };\n if (candidate.kind !== 'generator') return false;\n if (typeof candidate.id !== 'string') return false;\n if (\n candidate.params !== undefined &&\n (typeof candidate.params !== 'object' ||\n candidate.params === null ||\n Array.isArray(candidate.params))\n ) {\n return false;\n }\n return true;\n}\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\n/**\n * `ExecutionMutationDefault` minus its `ref` — the per-field phases value\n * authoring layers attach to a column before the column ref is known.\n */\nexport type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;\n\nexport type ExecutionSection<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n readonly [key: string]: unknown;\n };\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n readonly invariants: readonly string[];\n}\n\n/**\n * One applied migration edge from the per-space ledger journal.\n * Returned by `readLedger` in append (apply) order.\n */\nexport interface LedgerEntryRecord {\n readonly space: string;\n readonly migrationName: string;\n readonly migrationHash: string;\n readonly from: string | null;\n readonly to: string;\n readonly appliedAt: Date;\n readonly operationCount: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAgB,uBACd,aACA,sBACe;CACf,OAAO,eAAe,wBAAwB;AAChD;;;ACfA,MAAa,uBAAuC,0BAIlC,qBAAK;CACnB,KAAK;CACL,WAAW;CACX,OAAO;AACT,CAAC,CACH;AAEA,MAAM,8BAA8B;AAEpC,SAAgB,SACd,OACA,YAAoB,6BACJ;CAChB,OAAO;EAAE,WAAW,cAAc,SAAS;EAAG;CAAM;AACtD;;;;;;;;ACjBA,SAAgB,+BACd,QACS;CACT,MAAM,cAAc,sBAAsB,MAAM;CAChD,MAAM,kBAAkB,OAAO,WAAW;CAC1C,IAAI,oBAAoB,KAAA,GACtB,MAAM,IAAI,+BACR,qBAAqB,YAAY,iCACnC;CAEF,OAAO,gBAAgB;AACzB;;;;;AAMA,SAAgB,qCAEd,QAAqF;CACrF,OAAO,OAAO,WAAW,sBAAsB,MAAM,IAAI;AAC3D;;;ACAA,SAAgB,cAAsC,OAAgC;CACpF,OAAO;AACT;AAEA,SAAgB,SAAiC,OAA8B;CAC7E,OAAO;AACT;AASA,SAAgB,YAAoC,OAA8B;CAChF,OAAO;AACT;;;;;;;;;AAiEA,SAAgB,iCACd,OACyC;CACzC,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,IAAI,OAAO;CACjB,IAAI,MAAM,YAAY,MAAM,YAAY,MAAM,WAAW,OAAO;CAChE,IAAI,iBAAiB,MAAM,OAAO;CAClC,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,MAAM,gCAAgC;CAC7E,IAAI,MAAM,YAAY,OAAO,eAAe,KAAK,MAAM,OAAO,WAC5D,OAAO,OAAO,OAAO,KAAgC,EAAE,MAAM,gCAAgC;CAE/F,OAAO;AACT;AASA,SAAgB,gBAAgB,OAAwC;CACtE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,OAAQ,MAA6B;CAC3C,IAAI,SAAS,WACX,OAAO,WAAW;CAEpB,IAAI,SAAS,YACX,OAAO,OAAQ,MAAmC,eAAe;CAEnE,OAAO;AACT;AAQA,SAAgB,gCACd,OACwC;CACxC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,YAAY;CAKlB,IAAI,UAAU,SAAS,aAAa,OAAO;CAC3C,IAAI,OAAO,UAAU,OAAO,UAAU,OAAO;CAC7C,IACE,UAAU,WAAW,KAAA,MACpB,OAAO,UAAU,WAAW,YAC3B,UAAU,WAAW,QACrB,MAAM,QAAQ,UAAU,MAAM,IAEhC,OAAO;CAET,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { T as CrossReference, r as ContractWithDomain } from "./domain-envelope-Cv5OTm8D.mjs";
1
+ import { r as ContractWithDomain, x as CrossReference } from "./domain-envelope-BFYbgufo.mjs";
2
2
 
3
3
  //#region src/validate-domain.d.ts
4
4
  interface DomainModelShape {
@@ -1,5 +1,5 @@
1
1
  import { t as ContractValidationError } from "./contract-validation-error-ClZaKqMW.mjs";
2
- import { t as asNamespaceId } from "./namespace-id-CVpkSFUK.mjs";
2
+ import { t as asNamespaceId } from "./namespace-id-BSCer2Vd.mjs";
3
3
  //#region src/validate-domain.ts
4
4
  function indexDomainModels(contract) {
5
5
  const index = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.12.0-dev.5",
3
+ "version": "0.12.0-dev.50",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Data contract type definitions and JSON schema for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/utils": "0.12.0-dev.5",
9
+ "@prisma-next/utils": "0.12.0-dev.50",
10
10
  "@standard-schema/spec": "^1.1.0",
11
11
  "arktype": "^2.2.0"
12
12
  },
13
13
  "devDependencies": {
14
- "@prisma-next/tsconfig": "0.12.0-dev.5",
15
- "@prisma-next/tsdown": "0.12.0-dev.5",
14
+ "@prisma-next/tsconfig": "0.12.0-dev.50",
15
+ "@prisma-next/tsdown": "0.12.0-dev.50",
16
16
  "tsdown": "0.22.0",
17
17
  "typescript": "5.9.3",
18
18
  "vitest": "4.1.6"
@@ -31,9 +31,12 @@
31
31
  "schemas"
32
32
  ],
33
33
  "exports": {
34
+ "./apply-specifier-default-control-policy": "./dist/apply-specifier-default-control-policy.mjs",
34
35
  "./contract-validation-error": "./dist/contract-validation-error.mjs",
36
+ "./default-namespace": "./dist/default-namespace.mjs",
35
37
  "./hashing": "./dist/hashing.mjs",
36
38
  "./hashing-utils": "./dist/hashing-utils.mjs",
39
+ "./resolve-domain-model": "./dist/resolve-domain-model.mjs",
37
40
  "./types": "./dist/types.mjs",
38
41
  "./validate-domain": "./dist/validate-domain.mjs",
39
42
  "./package.json": "./package.json"
@@ -0,0 +1,12 @@
1
+ import type { Contract } from './contract-types';
2
+ import type { ControlPolicy } from './control-policy';
3
+
4
+ export function applySpecifierDefaultControlPolicy(
5
+ contract: Contract,
6
+ specifierDefault: ControlPolicy | undefined,
7
+ ): Contract {
8
+ if (specifierDefault === undefined || contract.defaultControlPolicy !== undefined) {
9
+ return contract;
10
+ }
11
+ return { ...contract, defaultControlPolicy: specifierDefault };
12
+ }
@@ -11,10 +11,17 @@ function isPlainRecord(value: unknown): value is Record<string, unknown> {
11
11
  return typeof value === 'object' && value !== null && !Array.isArray(value);
12
12
  }
13
13
 
14
+ // Order by UTF-16 code unit, not locale collation: canonicalization feeds
15
+ // storageHash, which must be byte-identical across hosts, and locale
16
+ // collation (localeCompare/Intl) varies by the engine's ICU build.
17
+ function compareCodeUnits(a: string, b: string): number {
18
+ return a < b ? -1 : a > b ? 1 : 0;
19
+ }
20
+
14
21
  export function compareByNameProperty(a: unknown, b: unknown): number {
15
22
  const nameA = isPlainRecord(a) && typeof a['name'] === 'string' ? a['name'] : '';
16
23
  const nameB = isPlainRecord(b) && typeof b['name'] === 'string' ? b['name'] : '';
17
- return nameA.localeCompare(nameB);
24
+ return compareCodeUnits(nameA, nameB);
18
25
  }
19
26
 
20
27
  function sortArrayKeysOnRecord(
@@ -56,6 +56,12 @@ const DOMAIN_MODEL_STORAGE_PATTERN = [
56
56
  '*',
57
57
  'storage',
58
58
  ] as const satisfies PathPattern;
59
+ const STORAGE_NAMESPACE_ENTRIES_PATTERN = [
60
+ 'storage',
61
+ 'namespaces',
62
+ '*',
63
+ 'entries',
64
+ ] as const satisfies PathPattern;
59
65
 
60
66
  const TOP_LEVEL_ORDER = [
61
67
  'schemaVersion',
@@ -69,6 +75,7 @@ const TOP_LEVEL_ORDER = [
69
75
  'execution',
70
76
  'capabilities',
71
77
  'extensionPacks',
78
+ 'defaultControlPolicy',
72
79
  'meta',
73
80
  ] as const;
74
81
 
@@ -121,9 +128,10 @@ function omitDefaults(
121
128
  DOMAIN_MODELS_CONTAINER_PATTERN,
122
129
  );
123
130
  const isRequiredStorageNamespaces = isArrayEqual(currentPath, ['storage', 'namespaces']);
124
- const isStorageNamespaceSlot =
125
- currentPath.length === 3 &&
126
- isArrayEqual([currentPath[0], currentPath[1]], ['storage', 'namespaces']);
131
+ const isStorageNamespaceEntries = matchesPathPattern(
132
+ currentPath,
133
+ STORAGE_NAMESPACE_ENTRIES_PATTERN,
134
+ );
127
135
  const isRequiredRoots = isArrayEqual(currentPath, ['roots']);
128
136
  const isRequiredExtensionPacks = isArrayEqual(currentPath, ['extensionPacks']);
129
137
  const isRequiredCapabilities = isArrayEqual(currentPath, ['capabilities']);
@@ -146,7 +154,7 @@ function omitDefaults(
146
154
  !isDomainNamespaceSlot &&
147
155
  !isRequiredDomainModels &&
148
156
  !isRequiredStorageNamespaces &&
149
- !isStorageNamespaceSlot &&
157
+ !isStorageNamespaceEntries &&
150
158
  !isRequiredRoots &&
151
159
  !isRequiredExtensionPacks &&
152
160
  !isRequiredCapabilities &&
@@ -255,6 +263,7 @@ export function canonicalizeContractToObject(
255
263
  ...ifDefined('execution', serialized['execution']),
256
264
  extensionPacks: serialized['extensionPacks'],
257
265
  capabilities: serialized['capabilities'],
266
+ ...ifDefined('defaultControlPolicy', serialized['defaultControlPolicy']),
258
267
  meta: serialized['meta'],
259
268
  };
260
269
  const withDefaultsOmitted = omitDefaults(normalized, [], options.shouldPreserveEmpty) as Record<
@@ -58,13 +58,15 @@ export interface Contract<
58
58
  readonly execution?: ContractExecutionSection;
59
59
  readonly profileHash: ProfileHashBase<string>;
60
60
  readonly meta: Record<string, unknown>;
61
- readonly defaultControl?: ControlPolicy;
61
+ readonly defaultControlPolicy?: ControlPolicy;
62
62
  }
63
63
 
64
- export type ContractModelsMap<TContract extends Contract> =
64
+ /** Model definitions union carried on a {@link Contract}'s `TModels` type parameter. */
65
+ export type ContractModelDefinitions<TContract extends Contract> =
65
66
  TContract extends Contract<StorageBase, infer TModels> ? TModels : never;
66
67
 
67
- type ExactlyOneKey<T extends Record<string, unknown>> = keyof T extends infer Only extends keyof T
68
+ type ExactlyOneNamespace<T extends Record<string, unknown>> = keyof T extends infer Only extends
69
+ keyof T
68
70
  ? [keyof T] extends [Only]
69
71
  ? Only
70
72
  : never
@@ -78,10 +80,10 @@ type NamespaceValueObjectsOf<TNamespace> = TNamespace extends {
78
80
  : Record<never, never>
79
81
  : Record<never, never>;
80
82
 
81
- /** Value-object map for the contract's sole domain namespace (type-level single-namespace projection). */
82
- export type ContractValueObjectsMap<TContract extends Contract> =
83
+ /** Value-object map when the contract declares exactly one domain namespace. */
84
+ export type ContractValueObjectDefinitions<TContract extends Contract> =
83
85
  NamespaceValueObjectsOf<
84
- TContract['domain']['namespaces'][ExactlyOneKey<TContract['domain']['namespaces']>]
86
+ TContract['domain']['namespaces'][ExactlyOneNamespace<TContract['domain']['namespaces']>]
85
87
  > extends infer Projected
86
88
  ? Projected extends Record<string, ContractValueObject>
87
89
  ? Projected
@@ -17,9 +17,9 @@ export type ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed';
17
17
  * Both parameters are optional raw values so this function stays node-type-agnostic
18
18
  * and can be called by any consumer (verifier, planner, etc.) without importing IR classes.
19
19
  */
20
- export function effectiveControl(
20
+ export function effectiveControlPolicy(
21
21
  nodeControl: ControlPolicy | undefined,
22
- defaultControl: ControlPolicy | undefined,
22
+ defaultControlPolicy: ControlPolicy | undefined,
23
23
  ): ControlPolicy {
24
- return nodeControl ?? defaultControl ?? 'managed';
24
+ return nodeControl ?? defaultControlPolicy ?? 'managed';
25
25
  }
@@ -0,0 +1,36 @@
1
+ import { DomainNamespaceResolutionError } from './contract-validation-error';
2
+
3
+ /**
4
+ * Reserved sentinel domain namespace id for the late-bound application-domain
5
+ * slot — the namespace a model lands in when it is authored without an explicit
6
+ * namespace. This is target-agnostic: targets that allow un-namespaced
7
+ * authoring (e.g. Mongo, SQLite) declare this id as their default on the target
8
+ * descriptor; the framework names the sentinel, never a target. Mirrors
9
+ * storage's `UNBOUND_NAMESPACE_ID` on the domain plane.
10
+ */
11
+ export const UNBOUND_DOMAIN_NAMESPACE_ID = '__unbound__' as const;
12
+
13
+ /**
14
+ * Resolve the single domain namespace of a single-namespace contract.
15
+ *
16
+ * Bare-name access (`db.User`) reads "the contract's one namespace". Every
17
+ * contract in scope today declares exactly one domain namespace, so this is
18
+ * exact — there is nothing to infer. A contract that declares more than one
19
+ * namespace is ambiguous for a bare name, so rather than silently pick one this
20
+ * throws; cross-namespace selection is made explicit (TML-2550).
21
+ */
22
+ export function soleDomainNamespaceId(domain: {
23
+ readonly namespaces: Readonly<Record<string, unknown>>;
24
+ }): string {
25
+ const [soleNamespaceId, ...rest] = Object.keys(domain.namespaces);
26
+ if (soleNamespaceId === undefined) {
27
+ throw new DomainNamespaceResolutionError('domain has no namespaces');
28
+ }
29
+ if (rest.length > 0) {
30
+ const all = [soleNamespaceId, ...rest];
31
+ throw new DomainNamespaceResolutionError(
32
+ `bare-name resolution requires exactly one domain namespace, found ${all.length} (${all.join(', ')}); select a namespace explicitly`,
33
+ );
34
+ }
35
+ return soleNamespaceId;
36
+ }
@@ -1,7 +1,6 @@
1
- import { DomainNamespaceResolutionError } from './contract-validation-error';
2
1
  import type { ContractModelBase, ContractValueObject } from './domain-types';
3
2
 
4
- export const UNBOUND_DOMAIN_NAMESPACE_ID = '__unbound__' as const;
3
+ export { UNBOUND_DOMAIN_NAMESPACE_ID } from './default-namespace';
5
4
 
6
5
  /**
7
6
  * One namespace's application-domain entities — models and optional value
@@ -27,61 +26,3 @@ export interface ApplicationDomain<
27
26
  export type ContractWithDomain = {
28
27
  readonly domain: ApplicationDomain;
29
28
  };
30
-
31
- export function resolveSingleDomainNamespaceId(
32
- domain: ApplicationDomain,
33
- namespaceId?: string,
34
- ): string {
35
- if (namespaceId !== undefined) {
36
- if (!Object.hasOwn(domain.namespaces, namespaceId)) {
37
- throw new DomainNamespaceResolutionError(
38
- `domain namespace "${namespaceId}" is not present on the contract`,
39
- );
40
- }
41
- return namespaceId;
42
- }
43
-
44
- const namespaceIds = Object.keys(domain.namespaces);
45
- if (namespaceIds.length === 0) {
46
- throw new DomainNamespaceResolutionError('domain has no namespaces');
47
- }
48
- if (namespaceIds.length > 1) {
49
- throw new DomainNamespaceResolutionError(
50
- `expected exactly one domain namespace, found ${namespaceIds.length} (${namespaceIds.join(', ')})`,
51
- );
52
- }
53
- const [soleNamespaceId] = namespaceIds;
54
- if (soleNamespaceId === undefined) {
55
- throw new DomainNamespaceResolutionError('domain has no namespaces');
56
- }
57
- return soleNamespaceId;
58
- }
59
-
60
- // Transitional single-namespace projection; pending runtime-qualification slice.
61
- export function contractModels<TModels extends Record<string, ContractModelBase>>(
62
- contract: { readonly domain: ApplicationDomain<TModels> },
63
- namespaceId?: string,
64
- ): TModels {
65
- const resolved = resolveSingleDomainNamespaceId(contract.domain, namespaceId);
66
- const domainNamespace = contract.domain.namespaces[resolved];
67
- if (domainNamespace === undefined) {
68
- throw new DomainNamespaceResolutionError(
69
- `domain namespace "${resolved}" is not present on the contract`,
70
- );
71
- }
72
- return domainNamespace.models;
73
- }
74
-
75
- export function contractValueObjects<TModels extends Record<string, ContractModelBase>>(
76
- contract: { readonly domain: ApplicationDomain<TModels> },
77
- namespaceId?: string,
78
- ): Record<string, ContractValueObject> | undefined {
79
- const resolved = resolveSingleDomainNamespaceId(contract.domain, namespaceId);
80
- const domainNamespace = contract.domain.namespaces[resolved];
81
- if (domainNamespace === undefined) {
82
- throw new DomainNamespaceResolutionError(
83
- `domain namespace "${resolved}" is not present on the contract`,
84
- );
85
- }
86
- return domainNamespace.valueObjects;
87
- }
@@ -0,0 +1,32 @@
1
+ import { DomainNamespaceResolutionError } from './contract-validation-error';
2
+ import { soleDomainNamespaceId } from './default-namespace';
3
+ import type { ApplicationDomain } from './domain-envelope';
4
+ import type { ContractModelBase, ContractValueObject } from './domain-types';
5
+
6
+ /**
7
+ * Models map for the contract's single domain namespace. Throws when the
8
+ * contract does not declare exactly one namespace — bare-name access is
9
+ * ambiguous across namespaces and must be qualified explicitly (TML-2550).
10
+ */
11
+ export function domainModelsAtDefaultNamespace<TModels extends Record<string, ContractModelBase>>(
12
+ domain: ApplicationDomain<TModels>,
13
+ ): TModels {
14
+ const namespaceId = soleDomainNamespaceId(domain);
15
+ const domainNamespace = domain.namespaces[namespaceId];
16
+ if (domainNamespace === undefined) {
17
+ throw new DomainNamespaceResolutionError(
18
+ `domain namespace "${namespaceId}" is not present on the contract`,
19
+ );
20
+ }
21
+ return domainNamespace.models;
22
+ }
23
+
24
+ /**
25
+ * Value objects for the contract's single domain namespace, when present.
26
+ * Throws when the contract does not declare exactly one namespace.
27
+ */
28
+ export function domainValueObjectsAtDefaultNamespace<
29
+ TModels extends Record<string, ContractModelBase>,
30
+ >(domain: ApplicationDomain<TModels>): Record<string, ContractValueObject> | undefined {
31
+ return domain.namespaces[soleDomainNamespaceId(domain)]?.valueObjects;
32
+ }
@@ -0,0 +1 @@
1
+ export { applySpecifierDefaultControlPolicy } from '../apply-specifier-default-control-policy';
@@ -0,0 +1 @@
1
+ export { soleDomainNamespaceId, UNBOUND_DOMAIN_NAMESPACE_ID } from '../default-namespace';
@@ -0,0 +1 @@
1
+ export { type ResolvedDomainModel, resolveDomainModel } from '../resolve-domain-model';