🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/contract

Package Overview
Dependencies
Maintainers
4
Versions
1100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/contract - npm Package Compare versions

Comparing version
0.15.0-dev.20
to
0.15.0-dev.23
+68
dist/canonicalization-lc9irAy3.d.mts
import { t as Contract } from "./contract-types-BVJDOpEC.mjs";
import { JsonObject } from "@prisma-next/utils/json";
//#region src/canonicalization.d.ts
/**
* Per-target contract serializer hook. The framework canonicalizer uses
* this to convert an in-memory contract (which may carry class-instance
* IR nodes whose runtime-only fields must not appear in the on-disk
* envelope) into a plain JsonObject before applying the family-agnostic
* canonical-key ordering / default-omission / sort steps. Targets whose
* contract is JSON-clean by construction return the contract unchanged.
*/
type SerializeContract = (contract: Contract) => JsonObject;
/**
* Family-contributed predicate for the default-omission walk. Called when
* a value at `path` is a default (empty object/array or `false`); if this
* returns `true` the value is kept rather than stripped.
*
* The framework only calls the predicate inside the `isDefaultValue` branch,
* so there is no need to guard against non-default values.
*/
type PreserveEmptyPredicate = (path: readonly string[]) => boolean;
/**
* Family-contributed storage sort. Applied to the serialized `storage`
* subtree after the default-omission walk; the result replaces the
* `storage` field before the final key sort. Use to establish a
* deterministic order for storage arrays (indexes, uniques) that the
* family-agnostic `sortObjectKeys` pass cannot handle.
*/
type StorageSort = (storage: unknown) => unknown;
interface CanonicalizeContractOptions {
readonly schemaVersion?: string;
/**
* Per-target hook that converts the in-memory contract (which may
* carry class-instance IR nodes) into a plain JsonObject before the
* family-agnostic canonicalization steps run.
*
* Routing through the hook is what lets each target decide which
* fields appear in the on-disk envelope; runtime-only class API
* fields stay invisible to the canonicalization walk by virtue of
* the per-target serializer not putting them in the JSON shape.
*/
readonly serializeContract: SerializeContract;
/**
* Family-contributed preserve-empty predicate. When the walk encounters a
* default value (empty object/array or `false`) at `path`, calling this
* with the full path allows the family to veto the omission. If absent,
* only the framework's family-agnostic required-slot rules apply.
*/
readonly shouldPreserveEmpty?: PreserveEmptyPredicate;
/**
* Family-contributed storage sort. Applied to the serialized `storage`
* subtree after the default-omission walk, before the final key sort.
* SQL family uses this to impose a deterministic order on `indexes` and
* `uniques` arrays within each namespace table. Families that require no
* special storage ordering omit this hook.
*/
readonly sortStorage?: StorageSort;
}
/**
* Object-form variant of {@link canonicalizeContract}. Exported because the
* emitter writes the canonical contract through a separate JSON-stringify
* pass and consumes the structured object directly.
*/
declare function canonicalizeContractToObject(contract: Contract, options: CanonicalizeContractOptions): Record<string, unknown>;
declare function canonicalizeContract(contract: Contract, options: CanonicalizeContractOptions): string;
//#endregion
export { canonicalizeContract as a, StorageSort as i, PreserveEmptyPredicate as n, canonicalizeContractToObject as o, SerializeContract as r, CanonicalizeContractOptions as t };
//# sourceMappingURL=canonicalization-lc9irAy3.d.mts.map
{"version":3,"file":"canonicalization-lc9irAy3.d.mts","names":[],"sources":["../src/canonicalization.ts"],"mappings":";;;;;;;;;;;KAcY,qBAAqB,UAAU,aAAa;;;;;;;;;KAU5C,0BAA0B;;;;;;;;KAS1B,eAAe;UAqLV;WACN;;;;;;;;;;;WAWA,mBAAmB;;;;;;;WAOnB,sBAAsB;;;;;;;;WAQtB,cAAc;;;;;;;iBAQT,6BACd,UAAU,UACV,SAAS,8BACR;iBA2Ba,qBACd,UAAU,UACV,SAAS"}
import { F as ExecutionMutationDefault, J as StorageBase, K as ProfileHashBase, P as ExecutionHashBase, _ as ContractValueObject, it as CrossReference, t as ApplicationDomain } from "./domain-envelope-CXbPct2s.mjs";
//#region src/control-policy.d.ts
/**
* Governance posture for a storage-plane node or for the contract as a whole.
*
* - `managed` — Prisma Next owns the full lifecycle (DDL, migrations, verification).
* - `tolerated` — node was found in the database but is not schema-managed; Prisma Next
* leaves it untouched while tracking its existence.
* - `external` — node is owned by an external system; Prisma Next never emits DDL for it.
* - `observed` — read-only access; Prisma Next does not write to or migrate the node.
*/
type ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed';
/**
* Resolves the effective control policy for a storage-plane node.
*
* Precedence: node-level value → contract default → `'managed'`.
*
* Both parameters are optional raw values so this function stays node-type-agnostic
* and can be called by any consumer (verifier, planner, etc.) without importing IR classes.
*/
declare function effectiveControlPolicy(nodeControl: ControlPolicy | undefined, defaultControlPolicy: ControlPolicy | undefined): ControlPolicy;
//#endregion
//#region src/contract-types.d.ts
/**
* Execution section for the unified contract (ADR 182).
*
* Unlike the legacy {@link import('./types').ExecutionSection}, this type
* requires `executionHash` — when an execution section is present, its
* hash must be too (consistent with `StorageBase.storageHash`).
*
* @template THash Literal hash string type for type-safe hash tracking.
*/
type ContractExecutionSection<THash extends string = string> = {
readonly executionHash: ExecutionHashBase<THash>;
readonly mutations: {
readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
};
};
/**
* Unified contract representation (ADR 182).
*
* A `Contract` is the canonical in-memory representation of a data contract.
* It is model-first (domain models carry their own storage bridge) and
* family-parameterized (SQL, Mongo, etc. specialize via `TStorage` and model
* storage generics on `ContractModel`).
*
* JSON persistence fields (`schemaVersion`, `sources`) are not represented
* here — they are handled at the serialization boundary.
*
* @template TStorage Family-specific storage block (extends {@link StorageBase}).
*/
interface Contract<TStorage extends StorageBase = StorageBase> {
readonly target: string;
readonly targetFamily: string;
readonly roots: Record<string, CrossReference>;
/**
* Application plane (ADR 221): `domain.namespaces.<nsId>.{ models, valueObjects }`.
*/
readonly domain: ApplicationDomain;
readonly storage: TStorage;
readonly capabilities: Record<string, Record<string, boolean>>;
readonly extensionPacks: Record<string, unknown>;
readonly execution?: ContractExecutionSection;
readonly profileHash: ProfileHashBase<string>;
readonly meta: Record<string, unknown>;
readonly defaultControlPolicy?: ControlPolicy;
}
type ExactlyOneNamespace<T extends Record<string, unknown>> = keyof T extends (infer Only extends keyof T) ? [keyof T] extends [Only] ? Only : never : never;
type NamespaceValueObjectsOf<TNamespace> = TNamespace extends {
readonly valueObjects?: infer VO;
} ? VO extends Record<string, ContractValueObject> ? VO : Record<never, never> : Record<never, never>;
/** Value-object map when the contract declares exactly one domain namespace. */
type ContractValueObjectDefinitions<TContract extends Contract> = NamespaceValueObjectsOf<TContract['domain']['namespaces'][ExactlyOneNamespace<TContract['domain']['namespaces']>]> extends (infer Projected) ? Projected extends Record<string, ContractValueObject> ? Projected : Record<never, never> : Record<never, never>;
//#endregion
export { effectiveControlPolicy as a, ControlPolicy as i, ContractExecutionSection as n, ContractValueObjectDefinitions as r, Contract as t };
//# sourceMappingURL=contract-types-BVJDOpEC.d.mts.map
{"version":3,"file":"contract-types-BVJDOpEC.d.mts","names":[],"sources":["../src/control-policy.ts","../src/contract-types.ts"],"mappings":";;;;;;;;;;;KASY;;;;;;;;;iBAUI,uBACd,aAAa,2BACb,sBAAsB,4BACrB;;;;;;;;;;;;KCFS,yBAAyB;WAC1B,eAAe,kBAAkB;WACjC;aACE,UAAU,cAAc;;;;;;;;;;;;;;;;UAiBpB,SAAS,iBAAiB,cAAc;WAC9C;WACA;WACA,OAAO,eAAe;;;;WAItB,QAAQ;WACR,SAAS;WACT,cAAc,eAAe;WAC7B,gBAAgB;WAChB,YAAY;WACZ,aAAa;WACb,MAAM;WACN,uBAAuB;;KAG7B,oBAAoB,UAAU,iCAAiC,iBAAgB,mBAC5E,YACG,YAAY,QACjB;KAID,wBAAwB,cAAc;WAChC,qBAAqB;IAE5B,WAAW,eAAe,uBACxB,KACA,uBACF;;KAGQ,+BAA+B,kBAAkB,YAC3D,wBACE,kCAAkC,oBAAoB,oDACxC,aACZ,kBAAkB,eAAe,uBAC/B,YACA,uBACF"}
//#region src/namespace-id.d.ts
type NamespaceId = string & {
readonly __brand: 'NamespaceId';
};
declare function asNamespaceId(value: string): NamespaceId;
//#endregion
//#region src/cross-reference.d.ts
interface CrossReference {
readonly namespace: NamespaceId;
readonly model: string;
/**
* Contract-space identity for cross-space relations. When present, the
* referenced model lives in a different contract space. Absent for local
* (same-space) relations.
*/
readonly space?: string;
}
declare const CrossReferenceSchema: import("arktype/internal/variants/object.ts").ObjectType<CrossReference, {}>;
declare function crossRef(model: string, namespace?: string, space?: string): CrossReference;
//#endregion
//#region src/types.d.ts
/**
* Unique symbol used as the key for branding types.
*/
declare const $: unique symbol;
/**
* A helper type to brand a given type with a unique identifier.
*
* @template TKey Text used as the brand key.
* @template TValue Optional value associated with the brand key. Defaults to `true`.
*/
type Brand<TKey extends string | number | symbol, TValue = true> = {
[$]: { [K in TKey]: TValue; };
};
/**
* Base type for storage contract hashes.
* Emitted contract.d.ts files use this with the hash value as a type parameter:
* `type StorageHash = StorageHashBase<'sha256:abc123...'>`
*/
type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
/**
* Base type for execution contract hashes.
* Emitted contract.d.ts files use this with the hash value as a type parameter:
* `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`
*/
type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
declare function executionHash<const T extends string>(value: T): ExecutionHashBase<T>;
declare function coreHash<const T extends string>(value: T): StorageHashBase<T>;
/**
* Base type for profile contract hashes.
* Emitted contract.d.ts files use this with the hash value as a type parameter:
* `type ProfileHash = ProfileHashBase<'sha256:def456...'>`
*/
type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
declare function profileHash<const T extends string>(value: T): ProfileHashBase<T>;
/**
* One entity-kind slot in a namespace — a map of entity name to entry.
* Values are opaque at the foundation layer; family and target concretions
* refine them to typed IR classes.
*/
type StorageEntitySlot = Readonly<Record<string, unknown>>;
/**
* Plain-data namespace entry in a storage block. Every hydrated contract
* carries at least `id` plus entity-kind slot maps under `entries`
* (`table`, `collection`, …). Foundation declares only this shape — no IR
* machinery.
*/
interface StorageNamespace {
readonly id: string;
readonly entries: Readonly<Record<string, StorageEntitySlot>>;
}
/**
* Base type for family-specific storage blocks.
* Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the
* storage hash alongside family-specific data (tables, collections, etc.).
*
* The `namespaces` map is carried by every hydrated storage block. Serialized
* envelope shape is target-owned; this types the in-memory contract after
* `deserializeContract`.
*/
interface StorageBase<THash extends string = string> {
readonly storageHash: StorageHashBase<THash>;
readonly namespaces: Readonly<Record<string, StorageNamespace>>;
}
interface FieldType {
readonly type: string;
readonly nullable: boolean;
readonly items?: FieldType;
readonly properties?: Record<string, FieldType>;
}
type GeneratedValueSpec = {
readonly id: string;
readonly params?: Record<string, unknown>;
};
type JsonPrimitive = string | number | boolean | null;
type JsonValue = JsonPrimitive | {
readonly [key: string]: JsonValue;
} | readonly JsonValue[];
type ColumnDefaultLiteralValue = JsonValue;
type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
/**
* Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
* resolve template values from caller-supplied args (typed `unknown` at the
* boundary) and need to validate before constructing a `ColumnDefault`.
* Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
* instances. Rejects functions, class instances (other than `Date`),
* `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
*/
declare function isColumnDefaultLiteralInputValue(value: unknown): value is ColumnDefaultLiteralInputValue;
type ColumnDefault = {
readonly kind: 'literal';
readonly value: ColumnDefaultLiteralInputValue;
} | {
readonly kind: 'function';
readonly expression: string;
};
declare function isColumnDefault(value: unknown): value is ColumnDefault;
type ExecutionMutationDefaultValue = {
readonly kind: 'generator';
readonly id: GeneratedValueSpec['id'];
readonly params?: Record<string, unknown>;
};
declare function isExecutionMutationDefaultValue(value: unknown): value is ExecutionMutationDefaultValue;
type ExecutionMutationDefault = {
readonly ref: {
readonly namespace: string;
readonly table: string;
readonly column: string;
};
readonly onCreate?: ExecutionMutationDefaultValue;
readonly onUpdate?: ExecutionMutationDefaultValue;
};
/**
* `ExecutionMutationDefault` minus its `ref` — the per-field phases value
* authoring layers attach to a column before the column ref is known.
*/
type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;
type ExecutionSection<THash extends string = string> = {
readonly executionHash: ExecutionHashBase<THash>;
readonly mutations: {
readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
};
};
interface Source {
readonly readOnly: boolean;
readonly projection: Record<string, FieldType>;
readonly origin?: Record<string, unknown>;
readonly capabilities?: Record<string, boolean>;
}
interface DocIndex {
readonly name: string;
readonly keys: Record<string, 'asc' | 'desc'>;
readonly unique?: boolean;
readonly where?: Expr;
}
type Expr = {
readonly kind: 'eq';
readonly path: ReadonlyArray<string>;
readonly value: unknown;
} | {
readonly kind: 'exists';
readonly path: ReadonlyArray<string>;
};
interface DocCollection {
readonly name: string;
readonly id?: {
readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';
};
readonly fields: Record<string, FieldType>;
readonly indexes?: ReadonlyArray<DocIndex>;
readonly readOnly?: boolean;
}
interface PlanMeta {
readonly target: string;
readonly targetFamily?: string;
readonly storageHash: string;
readonly profileHash?: string;
readonly lane: string;
readonly annotations?: {
readonly [key: string]: unknown;
};
}
/**
* Contract marker record stored in the database.
* Represents the current contract identity for a database.
*/
interface ContractMarkerRecord {
readonly storageHash: string;
readonly profileHash: string;
readonly contractJson: unknown | null;
readonly canonicalVersion: number | null;
readonly updatedAt: Date;
readonly appTag: string | null;
readonly meta: Record<string, unknown>;
readonly invariants: readonly string[];
}
/**
* One applied migration edge from the per-space ledger journal.
* Returned by `readLedger` in append (apply) order.
*/
interface LedgerEntryRecord {
readonly space: string;
readonly migrationName: string;
readonly migrationHash: string;
readonly from: string | null;
readonly to: string;
readonly appliedAt: Date;
readonly operationCount: number;
}
//#endregion
//#region src/value-set-ref.d.ts
/**
* Entity coordinate for a domain enum or storage value-set reference.
*
* Field-name identity with the framework's `EntityCoordinate` type
* (packages/1-framework/1-core/framework-components/src/ir/storage.ts).
* Foundation-contract cannot import framework-components (dependency points
* the other way), so this is a standalone mirror of that shape plus the
* cross-space discriminator.
*
* One-vocabulary rule (ADR 224): `entityKind` is equal to the entries slot
* key the referenced entity lives under — `'enum'` for domain's `enum` slot,
* `'valueSet'` for storage's `entries.valueSet` slot. No consumer-side
* translation between the kind string and the slot key.
*
* Every `valueSet` reference is intra-plane (domain field → domain enum;
* storage column/check → storage value-set). The directional invariant:
* domain may reference storage; storage may never reference domain.
*
* `namespaceId` admits the `UNBOUND_NAMESPACE_ID` (`__unbound__`) sentinel
* for single-namespace (unbound) references.
*
* `spaceId` is the cross-space discriminator: absent ⇒ local (same
* contract-space); present ⇒ cross-space. No separate tag field.
*/
interface ValueSetRef {
readonly plane: 'domain' | 'storage';
readonly namespaceId: string;
readonly entityKind: 'enum' | 'valueSet';
readonly entityName: string;
readonly spaceId?: string;
}
//#endregion
//#region src/domain-types.d.ts
type ScalarFieldType = {
readonly kind: 'scalar';
readonly codecId: string;
readonly typeParams?: Record<string, unknown>;
};
type ValueObjectFieldType = {
readonly kind: 'valueObject';
readonly name: string;
};
type UnionFieldType = {
readonly kind: 'union';
readonly members: ReadonlyArray<ScalarFieldType | ValueObjectFieldType>;
};
type ContractFieldType = ScalarFieldType | ValueObjectFieldType | UnionFieldType;
type ContractField = {
readonly nullable: boolean;
readonly type: ContractFieldType;
readonly many?: true;
readonly dict?: true;
readonly valueSet?: ValueSetRef;
};
/**
* A domain enum: an ordered set of named members, each with a codec-encoded
* value. The `codecId` identifies the codec used to encode member values in
* storage. The `members` array is ordered (declaration order is preserved).
*/
type ContractEnum = {
readonly codecId: string;
readonly members: readonly {
readonly name: string;
readonly value: JsonValue;
}[];
};
type ContractRelationOn = {
readonly localFields: readonly string[];
readonly targetFields: readonly string[];
};
type ContractRelationThrough = {
readonly table: string;
readonly namespaceId: string;
readonly parentColumns: readonly string[];
readonly childColumns: readonly string[];
readonly targetColumns: readonly string[];
};
type ContractManyToManyRelation = {
readonly to: CrossReference;
readonly cardinality: 'N:M';
readonly on: ContractRelationOn;
readonly through: ContractRelationThrough;
};
type ContractNonJunctionRelation = {
readonly to: CrossReference;
readonly cardinality: '1:1' | '1:N' | 'N:1';
readonly on: ContractRelationOn;
readonly through?: never;
};
type ContractReferenceRelation = ContractManyToManyRelation | ContractNonJunctionRelation;
type ContractEmbedRelation = {
readonly to: CrossReference;
readonly cardinality: '1:1' | '1:N';
};
type ContractRelation = ContractReferenceRelation | ContractEmbedRelation;
type ContractDiscriminator = {
readonly field: string;
};
type ContractVariantEntry = {
readonly value: string;
};
type ContractValueObject = {
readonly fields: Record<string, ContractField>;
};
type ModelStorageBase = Readonly<Record<string, unknown>>;
interface ContractModelBase<TModelStorage extends ModelStorageBase = ModelStorageBase> {
readonly fields: Record<string, ContractField>;
readonly relations: Record<string, ContractRelation>;
readonly storage: TModelStorage;
readonly discriminator?: ContractDiscriminator;
readonly variants?: Record<string, ContractVariantEntry>;
readonly base?: CrossReference;
readonly owner?: string;
}
interface ContractModel<TModelStorage extends ModelStorageBase = ModelStorageBase> extends ContractModelBase<TModelStorage> {
readonly fields: Record<string, ContractField>;
}
type ReferenceRelationKeys<TModels extends Record<string, {
readonly relations: Record<string, ContractRelation>;
}>, ModelName extends string & keyof TModels> = { [K in keyof TModels[ModelName]['relations']]: TModels[ModelName]['relations'][K] extends ContractReferenceRelation ? K : never; }[keyof TModels[ModelName]['relations']];
type EmbedRelationKeys<TModels extends Record<string, {
readonly relations: Record<string, ContractRelation>;
}>, ModelName extends string & keyof TModels> = { [K in keyof TModels[ModelName]['relations']]: TModels[ModelName]['relations'][K] extends ContractReferenceRelation ? never : K; }[keyof TModels[ModelName]['relations']];
//#endregion
//#region src/domain-envelope.d.ts
/**
* One namespace's application-domain entities — models and optional value
* objects keyed by entity name within that namespace coordinate.
*/
interface ApplicationDomainNamespace {
readonly models: Record<string, ContractModelBase>;
readonly valueObjects?: Record<string, ContractValueObject>;
readonly enum?: Record<string, ContractEnum>;
}
/**
* Application-domain envelope: entity content keyed by namespace id.
* Mirrors the storage plane's `namespaces` segment (ADR 221).
*/
interface ApplicationDomain {
readonly namespaces: Readonly<Record<string, ApplicationDomainNamespace>>;
}
type ContractWithDomain = {
readonly domain: ApplicationDomain;
};
//#endregion
export { executionHash as $, ColumnDefaultLiteralValue as A, FieldType as B, UnionFieldType as C, Brand as D, $ as E, ExecutionMutationDefault as F, PlanMeta as G, JsonPrimitive as H, ExecutionMutationDefaultPhases as I, StorageBase as J, ProfileHashBase as K, ExecutionMutationDefaultValue as L, DocCollection as M, DocIndex as N, ColumnDefault as O, ExecutionHashBase as P, coreHash as Q, ExecutionSection as R, ScalarFieldType as S, ValueSetRef as T, JsonValue as U, GeneratedValueSpec as V, LedgerEntryRecord as W, StorageHashBase as X, StorageEntitySlot as Y, StorageNamespace as Z, ContractValueObject as _, ContractEmbedRelation as a, CrossReferenceSchema as at, ModelStorageBase as b, ContractFieldType as c, asNamespaceId as ct, ContractModelBase as d, isColumnDefault as et, ContractNonJunctionRelation as f, ContractRelationThrough as g, ContractRelationOn as h, ContractDiscriminator as i, CrossReference as it, ContractMarkerRecord as j, ColumnDefaultLiteralInputValue as k, ContractManyToManyRelation as l, ContractRelation as m, ApplicationDomainNamespace as n, isExecutionMutationDefaultValue as nt, ContractEnum as o, crossRef as ot, ContractReferenceRelation as p, Source as q, ContractWithDomain as r, profileHash as rt, ContractField as s, NamespaceId as st, ApplicationDomain as t, isColumnDefaultLiteralInputValue as tt, ContractModel as u, ContractVariantEntry as v, ValueObjectFieldType as w, ReferenceRelationKeys as x, EmbedRelationKeys as y, Expr as z };
//# sourceMappingURL=domain-envelope-CXbPct2s.d.mts.map
{"version":3,"file":"domain-envelope-CXbPct2s.d.mts","names":[],"sources":["../src/namespace-id.ts","../src/cross-reference.ts","../src/types.ts","../src/value-set-ref.ts","../src/domain-types.ts","../src/domain-envelope.ts"],"mappings":";KAEY;WAAkC;;iBAE9B,cAAc,gBAAgB;;;UCA7B;WACN,WAAW;WACX;;;;;;WAMA;;cAGE,oEAAoB,WAAA;iBAcjB,SACd,eACA,oBACA,iBACC;;;;;;cC9BU;;;;;;;KAQD,MAAM,uCAAuC;GACtD,OACE,KAAK,OAAO;;;;;;;KASL,gBAAgB,wBAAwB,QAAQ;;;;;;KAOhD,kBAAkB,wBAAwB,QAA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Aa;;KAGZ;WACD;WACA;;KAGC;WACD;WACA,SAAS,cAAc,kBAAkB;;KAGxC,oBAAoB,kBAAkB,uBAAuB;KAE7D;WACD;WACA,MAAM;WACN;WACA;WACA,WAAW;;;;;;;KAQV;WACD;WACA;aAA6B;aAAuB,OAAO;;;KAG1D;WACD;WACA;;KAGC;WACD;WACA;WACA;WACA;WACA;;KAGC;WACD,IAAI;WACJ;WACA,IAAI;WACJ,SAAS;;KAGR;WACD,IAAI;WACJ;WACA,IAAI;WACJ;;KAGC,4BAA4B,6BAA6B;KAEzD;WACD,IAAI;WACJ;;KAGC,mBAAmB,4BAA4B;KAE/C;WACD;;KAGC;WACD;;KAGC;WACD,QAAQ,eAAe;;KAGtB,mBAAmB,SAAS;UAEvB,kBAAkB,sBAAsB,mBAAmB;WACjE,QAAQ,eAAe;WACvB,WAAW,eAAe;WAC1B,SAAS;WACT,gBAAgB;WAChB,WAAW,eAAe;WAC1B,OAAO;WACP;;UAGM,cAAc,sBAAsB,mBAAmB,0BAC9D,kBAAkB;WACjB,QAAQ,eAAe;;KAKtB,sBACV,gBAAgB;WAA0B,WAAW,eAAe;IACpE,iCAAiC,cAEhC,WAAW,QAAQ,0BAA0B,QAAQ,wBAAwB,WAAW,4BACrF,mBAEE,QAAQ;KAEJ,kBACV,gBAAgB;WAA0B,WAAW,eAAe;IACpE,iCAAiC,cAEhC,WAAW,QAAQ,0BAA0B,QAAQ,wBAAwB,WAAW,oCAErF,WACE,QAAQ;;;;;;;UCnHC;WACN,QAAQ,eAAe;WACvB,eAAe,eAAe;WAC9B,OAAO,eAAe;;;;;;UAOhB;WACN,YAAY,SAAS,eAAe;;KAGnC;WACD,QAAQ"}
import { d as ContractModelBase, t as ApplicationDomain } from "./domain-envelope-CXbPct2s.mjs";
//#region src/resolve-domain-model.d.ts
interface ResolvedDomainModel {
readonly namespaceId: string;
readonly model: ContractModelBase;
}
/**
* Resolve a bare domain model name to its namespace coordinate and model IR by
* scanning the contract's namespaces. For the single-namespace contracts in
* scope the scan is exact; cross-namespace bare-name collisions are selected
* explicitly (TML-2550).
*/
declare function resolveDomainModel(domain: ApplicationDomain, modelName: string): ResolvedDomainModel | undefined;
//#endregion
export { resolveDomainModel as n, ResolvedDomainModel as t };
//# sourceMappingURL=resolve-domain-model-CfMSnbL2.d.mts.map
{"version":3,"file":"resolve-domain-model-CfMSnbL2.d.mts","names":[],"sources":["../src/resolve-domain-model.ts"],"mappings":";;UAGiB;WACN;WACA,OAAO;;;;;;;;iBASF,mBACd,QAAQ,mBACR,oBACC"}
+1
-2

@@ -1,3 +0,2 @@

import { i as ControlPolicy, t as Contract } from "./contract-types-DrjCtVOs.mjs";
import { i as ControlPolicy, t as Contract } from "./contract-types-BVJDOpEC.mjs";
//#region src/apply-specifier-default-control-policy.d.ts

@@ -4,0 +3,0 @@ declare function applySpecifierDefaultControlPolicy(contract: Contract, specifierDefault: ControlPolicy | undefined): Contract;

@@ -1,1 +0,1 @@

{"version":3,"file":"apply-specifier-default-control-policy.d.mts","names":[],"sources":["../src/apply-specifier-default-control-policy.ts"],"mappings":";;;iBAGgB,kCAAA,CACd,QAAA,EAAU,QAAA,EACV,gBAAA,EAAkB,aAAA,eACjB,QAAA"}
{"version":3,"file":"apply-specifier-default-control-policy.d.mts","names":[],"sources":["../src/apply-specifier-default-control-policy.ts"],"mappings":";;iBAGgB,mCACd,UAAU,UACV,kBAAkB,4BACjB"}

@@ -1,1 +0,1 @@

{"version":3,"file":"contract-validation-error-D7g0kmcc.d.mts","names":[],"sources":["../src/contract-validation-error.ts"],"mappings":";KAAY,uBAAA;AAAA,cAEC,uBAAA,SAAgC,KAAA;EAAA,SAClC,IAAA;EAAA,SACA,KAAA,EAAO,uBAAA;cAEJ,OAAA,UAAiB,KAAA,EAAO,uBAAA;AAAA;AAAA,cAOzB,8BAAA,SAAuC,KAAK;cAC3C,OAAA;AAAA"}
{"version":3,"file":"contract-validation-error-D7g0kmcc.d.mts","names":[],"sources":["../src/contract-validation-error.ts"],"mappings":";KAAY;cAEC,gCAAgC;WAClC;WACA,OAAO;cAEJ,iBAAiB,OAAO;;cAOzB,uCAAuC;cACtC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"default-namespace-D5X_k6hJ.d.mts","names":[],"sources":["../src/default-namespace.ts"],"mappings":";;AAUA;;;;AAAiE;AAWjE;;cAXa,2BAAA;;;;;;;AAaZ;;;iBAFe,qBAAA,CAAsB,MAAA;EAAA,SAC3B,UAAA,EAAY,QAAQ,CAAC,MAAA;AAAA"}
{"version":3,"file":"default-namespace-D5X_k6hJ.d.mts","names":[],"sources":["../src/default-namespace.ts"],"mappings":";;;;;;;;;cAUa;;;;;;;;;;iBAWG,sBAAsB;WAC3B,YAAY,SAAS"}

@@ -1,4 +0,3 @@

import { t as Contract } from "./contract-types-DrjCtVOs.mjs";
import { U as JsonValue, o as ContractEnum } from "./domain-envelope-Bj-zQbVU.mjs";
import { t as Contract } from "./contract-types-BVJDOpEC.mjs";
import { U as JsonValue, o as ContractEnum } from "./domain-envelope-CXbPct2s.mjs";
//#region src/enum-accessor.d.ts

@@ -39,12 +38,14 @@ /**

};
type MemberValues<Members> = { readonly [I in keyof Members]: Members[I] extends EnumMemberEntry ? Members[I]['value'] : never };
type MemberNames<Members> = { readonly [I in keyof Members]: Members[I] extends EnumMemberEntry ? Members[I]['name'] : never };
type MemberValues<Members> = { readonly [I in keyof Members]: Members[I] extends EnumMemberEntry ? Members[I]['value'] : never; };
type MemberNames<Members> = { readonly [I in keyof Members]: Members[I] extends EnumMemberEntry ? Members[I]['name'] : never; };
type EnumEntryValues<Entry extends EnumEntry> = MemberValues<Entry['members']>;
type EnumEntryNames<Entry extends EnumEntry> = MemberNames<Entry['members']>;
type EnumEntryMembers<Entry extends EnumEntry> = { readonly [M in Entry['members'][number] as M['name']]: M['value'] };
type EnumEntryMembers<Entry extends EnumEntry> = { readonly [M in Entry['members'][number] as M['name']]: M['value']; };
type ContractEnumAccessor<Entry extends EnumEntry> = {
readonly values: EnumEntryValues<Entry>;
readonly names: EnumEntryNames<Entry>;
readonly members: EnumEntryMembers<Entry>; /** Returns true and narrows `v` to the enum's value union when `v` is a declared member value. */
has(v: JsonValue): v is EnumEntryValues<Entry>[number]; /** Returns true and narrows `name` to the enum's member-name union when `name` is a declared member name. */
readonly members: EnumEntryMembers<Entry>;
/** Returns true and narrows `v` to the enum's value union when `v` is a declared member value. */
has(v: JsonValue): v is EnumEntryValues<Entry>[number];
/** Returns true and narrows `name` to the enum's member-name union when `name` is a declared member name. */
hasName(name: string): name is Extract<EnumEntryNames<Entry>[number], string>;

@@ -73,3 +74,3 @@ nameOf(v: EnumEntryValues<Entry>[number]): string | undefined;

} ? N : never;
type EnumEntriesToAccessors<Enums> = { readonly [K in keyof Enums]: Enums[K] extends EnumEntry ? ContractEnumAccessor<Enums[K]> : never };
type EnumEntriesToAccessors<Enums> = { readonly [K in keyof Enums]: Enums[K] extends EnumEntry ? ContractEnumAccessor<Enums[K]> : never; };
type BuiltEnumAccessorsOf<TContract> = TContract extends {

@@ -82,5 +83,5 @@ readonly enumAccessors?: infer A;

type NamespaceEnumAccessors<TContract extends Contract, NsId extends keyof TContract['domain']['namespaces']> = keyof BuiltEnumAccessorsOf<TContract> extends never ? EnumEntriesToAccessors<NamespaceEnumEntries<TContract['domain']['namespaces'][NsId]>> : BuiltEnumAccessorsOf<TContract>;
type NamespacedEnums<TContract extends Contract> = { readonly [Ns in keyof TContract['domain']['namespaces']]: NamespaceEnumAccessors<TContract, Ns> };
type NamespacedEnums<TContract extends Contract> = { readonly [Ns in keyof TContract['domain']['namespaces']]: NamespaceEnumAccessors<TContract, Ns>; };
//#endregion
export { type ContractEnumAccessor, type EnumAccessor, type EnumEntriesToAccessors, type EnumMemberNames, type EnumValues, type NamespaceEnumAccessors, type NamespacedEnums, buildEnumsMapForNamespace, buildNamespacedEnums, createEnumAccessor };
//# sourceMappingURL=enum-accessor.d.mts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"enum-accessor.d.mts","names":[],"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qB;KAEb,gBAAgB,kBAAkB,wBAClC,YAAY,oCAAoC,uBAAuB,WAAW"}

@@ -1,3 +0,2 @@

import { i as StorageSort, n as PreserveEmptyPredicate } from "./canonicalization-05YMFrf7.mjs";
import { i as StorageSort, n as PreserveEmptyPredicate } from "./canonicalization-lc9irAy3.mjs";
//#region src/canonicalization-path-match.d.ts

@@ -4,0 +3,0 @@ type PathSegment = string | '*' | readonly string[];

@@ -1,1 +0,1 @@

{"version":3,"file":"hashing-utils.d.mts","names":[],"sources":["../src/canonicalization-path-match.ts","../src/canonicalization-storage-sort.ts"],"mappings":";;;KAEY,WAAA;AAAA,KAEA,WAAA,YAAuB,WAAW;AAAA,iBAE9B,kBAAA,CAAmB,IAAA,qBAAyB,OAAA,EAAS,WAAW;AAAA,iBAiChE,4BAAA,CACd,QAAA,WAAmB,WAAA,KAClB,sBAAsB;;;KCtCb,aAAA;AAAA,UAEK,oBAAA;EAAA,SACN,IAAA,WAAe,aAAW;EAAA,SAC1B,SAAA;AAAA;AAAA,iBAUK,qBAAA,CAAsB,CAAA,WAAY,CAAU;AAAA,iBA2D5C,iBAAA,CACd,OAAA,WAAkB,oBAAA,IAClB,OAAA,IAAU,CAAA,WAAY,CAAA,uBACrB,WAAW"}
{"version":3,"file":"hashing-utils.d.mts","names":[],"sources":["../src/canonicalization-path-match.ts","../src/canonicalization-storage-sort.ts"],"mappings":";;KAEY;KAEA,uBAAuB;iBAEnB,mBAAmB,yBAAyB,SAAS;iBAiCrD,6BACd,mBAAmB,gBAClB;;;KCtCS;UAEK;WACN,eAAe;WACf;;iBAUK,sBAAsB,YAAY;iBA2DlC,kBACd,kBAAkB,wBAClB,WAAU,YAAY,wBACrB"}

@@ -1,4 +0,3 @@

import { K as ProfileHashBase, P as ExecutionHashBase, X as StorageHashBase } from "./domain-envelope-Bj-zQbVU.mjs";
import { a as canonicalizeContract, i as StorageSort, n as PreserveEmptyPredicate, o as canonicalizeContractToObject, r as SerializeContract, t as CanonicalizeContractOptions } from "./canonicalization-05YMFrf7.mjs";
import { K as ProfileHashBase, P as ExecutionHashBase, X as StorageHashBase } from "./domain-envelope-CXbPct2s.mjs";
import { a as canonicalizeContract, i as StorageSort, n as PreserveEmptyPredicate, o as canonicalizeContractToObject, r as SerializeContract, t as CanonicalizeContractOptions } from "./canonicalization-lc9irAy3.mjs";
//#region src/hashing.d.ts

@@ -5,0 +4,0 @@ type ComputeStorageHashArgs = {

@@ -1,1 +0,1 @@

{"version":3,"file":"hashing.d.mts","names":[],"sources":["../src/hashing.ts"],"mappings":";;;;KAyEY,sBAAA;EACV,MAAA;EACA,YAAA;EACA,OAAA,EAAS,MAAA;EAAA,SACA,mBAAA,GAAsB,sBAAA;EAAA,SACtB,WAAA,GAAc,WAAA;AAAA;AAAA,iBAGT,kBAAA,CAAmB,IAAA,EAAM,sBAAA,GAAyB,eAAe;AAAA,iBAMjE,oBAAA,CAAqB,IAAA;EACnC,MAAA;EACA,YAAA;EACA,SAAA,EAAW,MAAA;AAAA,IACT,iBAAiB;AAAA,iBAML,kBAAA,CAAmB,IAAA;EACjC,MAAA;EACA,YAAA;EACA,YAAA,EAAc,MAAA,SAAe,MAAA;AAAA,IAC3B,eAAA"}
{"version":3,"file":"hashing.d.mts","names":[],"sources":["../src/hashing.ts"],"mappings":";;;KAyEY;EACV;EACA;EACA,SAAS;WACA,sBAAsB;WACtB,cAAc;;iBAGT,mBAAmB,MAAM,yBAAyB;iBAMlD,qBAAqB;EACnC;EACA;EACA,WAAW;IACT;iBAMY,mBAAmB;EACjC;EACA;EACA,cAAc,eAAe;IAC3B"}

@@ -1,1 +0,1 @@

{"version":3,"file":"is-plain-record.d.mts","names":[],"sources":["../src/is-plain-record.ts"],"mappings":";;AAMA;;;;;iBAAgB,aAAA,CAAc,KAAA,YAAiB,KAAA,IAAS,QAAQ,CAAC,MAAA"}
{"version":3,"file":"is-plain-record.d.mts","names":[],"sources":["../src/is-plain-record.ts"],"mappings":";;;;;;;iBAMgB,cAAc,iBAAiB,SAAS,SAAS"}

@@ -1,2 +0,2 @@

import { n as resolveDomainModel, t as ResolvedDomainModel } from "./resolve-domain-model-5aHgzqTD.mjs";
import { n as resolveDomainModel, t as ResolvedDomainModel } from "./resolve-domain-model-CfMSnbL2.mjs";
export { type ResolvedDomainModel, resolveDomainModel };

@@ -1,7 +0,6 @@

import { a as effectiveControlPolicy, i as ControlPolicy, n as ContractExecutionSection, r as ContractValueObjectDefinitions, t as Contract } from "./contract-types-DrjCtVOs.mjs";
import { $ as executionHash, A as ColumnDefaultLiteralValue, B as FieldType, C as UnionFieldType, D as Brand, E as $, F as ExecutionMutationDefault, G as PlanMeta, H as JsonPrimitive, I as ExecutionMutationDefaultPhases, J as StorageBase, K as ProfileHashBase, L as ExecutionMutationDefaultValue, M as DocCollection, N as DocIndex, O as ColumnDefault, P as ExecutionHashBase, Q as coreHash, R as ExecutionSection, S as ScalarFieldType, T as ValueSetRef, U as JsonValue, V as GeneratedValueSpec, W as LedgerEntryRecord, X as StorageHashBase, Y as StorageEntitySlot, Z as StorageNamespace, _ as ContractValueObject, a as ContractEmbedRelation, at as CrossReferenceSchema, b as ModelStorageBase, c as ContractFieldType, ct as asNamespaceId, d as ContractModelBase, et as isColumnDefault, f as ContractNonJunctionRelation, g as ContractRelationThrough, h as ContractRelationOn, i as ContractDiscriminator, it as CrossReference, j as ContractMarkerRecord, k as ColumnDefaultLiteralInputValue, l as ContractManyToManyRelation, m as ContractRelation, n as ApplicationDomainNamespace, nt as isExecutionMutationDefaultValue, o as ContractEnum, ot as crossRef, p as ContractReferenceRelation, q as Source, r as ContractWithDomain, rt as profileHash, s as ContractField, st as NamespaceId, t as ApplicationDomain, tt as isColumnDefaultLiteralInputValue, u as ContractModel, v as ContractVariantEntry, w as ValueObjectFieldType, x as ReferenceRelationKeys, y as EmbedRelationKeys, z as Expr } from "./domain-envelope-Bj-zQbVU.mjs";
import { a as effectiveControlPolicy, i as ControlPolicy, n as ContractExecutionSection, r as ContractValueObjectDefinitions, t as Contract } from "./contract-types-BVJDOpEC.mjs";
import { $ as executionHash, A as ColumnDefaultLiteralValue, B as FieldType, C as UnionFieldType, D as Brand, E as $, F as ExecutionMutationDefault, G as PlanMeta, H as JsonPrimitive, I as ExecutionMutationDefaultPhases, J as StorageBase, K as ProfileHashBase, L as ExecutionMutationDefaultValue, M as DocCollection, N as DocIndex, O as ColumnDefault, P as ExecutionHashBase, Q as coreHash, R as ExecutionSection, S as ScalarFieldType, T as ValueSetRef, U as JsonValue, V as GeneratedValueSpec, W as LedgerEntryRecord, X as StorageHashBase, Y as StorageEntitySlot, Z as StorageNamespace, _ as ContractValueObject, a as ContractEmbedRelation, at as CrossReferenceSchema, b as ModelStorageBase, c as ContractFieldType, ct as asNamespaceId, d as ContractModelBase, et as isColumnDefault, f as ContractNonJunctionRelation, g as ContractRelationThrough, h as ContractRelationOn, i as ContractDiscriminator, it as CrossReference, j as ContractMarkerRecord, k as ColumnDefaultLiteralInputValue, l as ContractManyToManyRelation, m as ContractRelation, n as ApplicationDomainNamespace, nt as isExecutionMutationDefaultValue, o as ContractEnum, ot as crossRef, p as ContractReferenceRelation, q as Source, r as ContractWithDomain, rt as profileHash, s as ContractField, st as NamespaceId, t as ApplicationDomain, tt as isColumnDefaultLiteralInputValue, u as ContractModel, v as ContractVariantEntry, w as ValueObjectFieldType, x as ReferenceRelationKeys, y as EmbedRelationKeys, z as Expr } from "./domain-envelope-CXbPct2s.mjs";
import { n as soleDomainNamespaceId, t as UNBOUND_DOMAIN_NAMESPACE_ID } from "./default-namespace-D5X_k6hJ.mjs";
import { r as DomainNamespaceResolutionError } from "./contract-validation-error-D7g0kmcc.mjs";
import { n as resolveDomainModel, t as ResolvedDomainModel } from "./resolve-domain-model-5aHgzqTD.mjs";
import { n as resolveDomainModel, t as ResolvedDomainModel } from "./resolve-domain-model-CfMSnbL2.mjs";
//#region src/domain-namespace-access.d.ts

@@ -8,0 +7,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"file":"types.d.mts","names":[],"sources":["../src/domain-namespace-access.ts"],"mappings":";;;;;;;;;;;;iBAUgB,8BAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,iBAAA;;;;;iBAeF,oCAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,mBAAA"}
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/domain-namespace-access.ts"],"mappings":";;;;;;;;;;;iBAUgB,+BACd,QAAQ,oBACP,eAAe;;;;;iBAeF,qCACd,QAAQ,oBACP,eAAe"}

@@ -1,3 +0,2 @@

import { it as CrossReference, r as ContractWithDomain } from "./domain-envelope-Bj-zQbVU.mjs";
import { it as CrossReference, r as ContractWithDomain } from "./domain-envelope-CXbPct2s.mjs";
//#region src/validate-domain.d.ts

@@ -4,0 +3,0 @@ interface DomainModelShape {

@@ -1,1 +0,1 @@

{"version":3,"file":"validate-domain.d.mts","names":[],"sources":["../src/validate-domain.ts"],"mappings":";;;UAKiB,gBAAA;EAAA,SACN,MAAA,EAAQ,MAAA;EAAA,SACR,SAAA,GAAY,MAAA;IAAA,SAA0B,EAAA,EAAI,cAAA;EAAA;EAAA,SAC1C,aAAA;IAAA,SAA2B,KAAA;EAAA;EAAA,SAC3B,QAAA,GAAW,MAAA;EAAA,SACX,IAAA,GAAO,cAAA;EAAA,SACP,KAAA;AAAA;AAAA,UAGM,mBAAA,SAA4B,kBAAA;EAAA,SAClC,KAAA,EAAO,MAAA,SAAe,cAAA;AAAA;AAAA,iBAuCjB,sBAAA,CAAuB,QAA6B,EAAnB,mBAAmB"}
{"version":3,"file":"validate-domain.d.mts","names":[],"sources":["../src/validate-domain.ts"],"mappings":";;UAKiB;WACN,QAAQ;WACR,YAAY;aAA0B,IAAI;;WAC1C;aAA2B;;WAC3B,WAAW;WACX,OAAO;WACP;;UAGM,4BAA4B;WAClC,OAAO,eAAe;;iBAuCjB,uBAAuB,UAAU"}
{
"name": "@prisma-next/contract",
"version": "0.15.0-dev.20",
"version": "0.15.0-dev.23",
"license": "Apache-2.0",

@@ -9,3 +9,3 @@ "type": "module",

"dependencies": {
"@prisma-next/utils": "0.15.0-dev.20",
"@prisma-next/utils": "0.15.0-dev.23",
"@standard-schema/spec": "^1.1.0",

@@ -15,5 +15,5 @@ "arktype": "^2.2.2"

"devDependencies": {
"@prisma-next/tsconfig": "0.15.0-dev.20",
"@prisma-next/tsdown": "0.15.0-dev.20",
"tsdown": "0.22.3",
"@prisma-next/tsconfig": "0.15.0-dev.23",
"@prisma-next/tsdown": "0.15.0-dev.23",
"tsdown": "0.22.8",
"typescript": "5.9.3",

@@ -20,0 +20,0 @@ "vitest": "4.1.10"

import { t as Contract } from "./contract-types-DrjCtVOs.mjs";
import { JsonObject } from "@prisma-next/utils/json";
//#region src/canonicalization.d.ts
/**
* Per-target contract serializer hook. The framework canonicalizer uses
* this to convert an in-memory contract (which may carry class-instance
* IR nodes whose runtime-only fields must not appear in the on-disk
* envelope) into a plain JsonObject before applying the family-agnostic
* canonical-key ordering / default-omission / sort steps. Targets whose
* contract is JSON-clean by construction return the contract unchanged.
*/
type SerializeContract = (contract: Contract) => JsonObject;
/**
* Family-contributed predicate for the default-omission walk. Called when
* a value at `path` is a default (empty object/array or `false`); if this
* returns `true` the value is kept rather than stripped.
*
* The framework only calls the predicate inside the `isDefaultValue` branch,
* so there is no need to guard against non-default values.
*/
type PreserveEmptyPredicate = (path: readonly string[]) => boolean;
/**
* Family-contributed storage sort. Applied to the serialized `storage`
* subtree after the default-omission walk; the result replaces the
* `storage` field before the final key sort. Use to establish a
* deterministic order for storage arrays (indexes, uniques) that the
* family-agnostic `sortObjectKeys` pass cannot handle.
*/
type StorageSort = (storage: unknown) => unknown;
interface CanonicalizeContractOptions {
readonly schemaVersion?: string;
/**
* Per-target hook that converts the in-memory contract (which may
* carry class-instance IR nodes) into a plain JsonObject before the
* family-agnostic canonicalization steps run.
*
* Routing through the hook is what lets each target decide which
* fields appear in the on-disk envelope; runtime-only class API
* fields stay invisible to the canonicalization walk by virtue of
* the per-target serializer not putting them in the JSON shape.
*/
readonly serializeContract: SerializeContract;
/**
* Family-contributed preserve-empty predicate. When the walk encounters a
* default value (empty object/array or `false`) at `path`, calling this
* with the full path allows the family to veto the omission. If absent,
* only the framework's family-agnostic required-slot rules apply.
*/
readonly shouldPreserveEmpty?: PreserveEmptyPredicate;
/**
* Family-contributed storage sort. Applied to the serialized `storage`
* subtree after the default-omission walk, before the final key sort.
* SQL family uses this to impose a deterministic order on `indexes` and
* `uniques` arrays within each namespace table. Families that require no
* special storage ordering omit this hook.
*/
readonly sortStorage?: StorageSort;
}
/**
* Object-form variant of {@link canonicalizeContract}. Exported because the
* emitter writes the canonical contract through a separate JSON-stringify
* pass and consumes the structured object directly.
*/
declare function canonicalizeContractToObject(contract: Contract, options: CanonicalizeContractOptions): Record<string, unknown>;
declare function canonicalizeContract(contract: Contract, options: CanonicalizeContractOptions): string;
//#endregion
export { canonicalizeContract as a, StorageSort as i, PreserveEmptyPredicate as n, canonicalizeContractToObject as o, SerializeContract as r, CanonicalizeContractOptions as t };
//# sourceMappingURL=canonicalization-05YMFrf7.d.mts.map
{"version":3,"file":"canonicalization-05YMFrf7.d.mts","names":[],"sources":["../src/canonicalization.ts"],"mappings":";;;;;;AAcA;;;;;;KAAY,iBAAA,IAAqB,QAAA,EAAU,QAAA,KAAa,UAAU;;AAAA;AAUlE;;;;AAA6D;AAS7D;KATY,sBAAA,IAA0B,IAAuB;;;AASlB;AAqL3C;;;;KArLY,WAAA,IAAe,OAAgB;AAAA,UAqL1B,2BAAA;EAAA,SACN,aAAA;EAAA;;;;;;;;AA0ByB;AAQpC;EAlCW,SAWA,iBAAA,EAAmB,iBAAA;;;;;;;WAOnB,mBAAA,GAAsB,sBAAA;EAiB/B;;;;;AAEO;AA2BT;EA7BE,SATS,WAAA,GAAc,WAAA;AAAA;;;;;;iBAQT,4BAAA,CACd,QAAA,EAAU,QAAA,EACV,OAAA,EAAS,2BAAA,GACR,MAAA;AAAA,iBA2Ba,oBAAA,CACd,QAAA,EAAU,QAAA,EACV,OAAA,EAAS,2BAA2B"}
import { F as ExecutionMutationDefault, J as StorageBase, K as ProfileHashBase, P as ExecutionHashBase, _ as ContractValueObject, it as CrossReference, t as ApplicationDomain } from "./domain-envelope-Bj-zQbVU.mjs";
//#region src/control-policy.d.ts
/**
* Governance posture for a storage-plane node or for the contract as a whole.
*
* - `managed` — Prisma Next owns the full lifecycle (DDL, migrations, verification).
* - `tolerated` — node was found in the database but is not schema-managed; Prisma Next
* leaves it untouched while tracking its existence.
* - `external` — node is owned by an external system; Prisma Next never emits DDL for it.
* - `observed` — read-only access; Prisma Next does not write to or migrate the node.
*/
type ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed';
/**
* Resolves the effective control policy for a storage-plane node.
*
* Precedence: node-level value → contract default → `'managed'`.
*
* Both parameters are optional raw values so this function stays node-type-agnostic
* and can be called by any consumer (verifier, planner, etc.) without importing IR classes.
*/
declare function effectiveControlPolicy(nodeControl: ControlPolicy | undefined, defaultControlPolicy: ControlPolicy | undefined): ControlPolicy;
//#endregion
//#region src/contract-types.d.ts
/**
* Execution section for the unified contract (ADR 182).
*
* Unlike the legacy {@link import('./types').ExecutionSection}, this type
* requires `executionHash` — when an execution section is present, its
* hash must be too (consistent with `StorageBase.storageHash`).
*
* @template THash Literal hash string type for type-safe hash tracking.
*/
type ContractExecutionSection<THash extends string = string> = {
readonly executionHash: ExecutionHashBase<THash>;
readonly mutations: {
readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
};
};
/**
* Unified contract representation (ADR 182).
*
* A `Contract` is the canonical in-memory representation of a data contract.
* It is model-first (domain models carry their own storage bridge) and
* family-parameterized (SQL, Mongo, etc. specialize via `TStorage` and model
* storage generics on `ContractModel`).
*
* JSON persistence fields (`schemaVersion`, `sources`) are not represented
* here — they are handled at the serialization boundary.
*
* @template TStorage Family-specific storage block (extends {@link StorageBase}).
*/
interface Contract<TStorage extends StorageBase = StorageBase> {
readonly target: string;
readonly targetFamily: string;
readonly roots: Record<string, CrossReference>;
/**
* Application plane (ADR 221): `domain.namespaces.<nsId>.{ models, valueObjects }`.
*/
readonly domain: ApplicationDomain;
readonly storage: TStorage;
readonly capabilities: Record<string, Record<string, boolean>>;
readonly extensionPacks: Record<string, unknown>;
readonly execution?: ContractExecutionSection;
readonly profileHash: ProfileHashBase<string>;
readonly meta: Record<string, unknown>;
readonly defaultControlPolicy?: ControlPolicy;
}
type ExactlyOneNamespace<T extends Record<string, unknown>> = keyof T extends infer Only extends keyof T ? [keyof T] extends [Only] ? Only : never : never;
type NamespaceValueObjectsOf<TNamespace> = TNamespace extends {
readonly valueObjects?: infer VO;
} ? VO extends Record<string, ContractValueObject> ? VO : Record<never, never> : Record<never, never>;
/** Value-object map when the contract declares exactly one domain namespace. */
type ContractValueObjectDefinitions<TContract extends Contract> = NamespaceValueObjectsOf<TContract['domain']['namespaces'][ExactlyOneNamespace<TContract['domain']['namespaces']>]> extends infer Projected ? Projected extends Record<string, ContractValueObject> ? Projected : Record<never, never> : Record<never, never>;
//#endregion
export { effectiveControlPolicy as a, ControlPolicy as i, ContractExecutionSection as n, ContractValueObjectDefinitions as r, Contract as t };
//# sourceMappingURL=contract-types-DrjCtVOs.d.mts.map
{"version":3,"file":"contract-types-DrjCtVOs.d.mts","names":[],"sources":["../src/control-policy.ts","../src/contract-types.ts"],"mappings":";;;;;;AASA;;;;AAAyB;AAUzB;KAVY,aAAA;;;;;;;;;iBAUI,sBAAA,CACd,WAAA,EAAa,aAAA,cACb,oBAAA,EAAsB,aAAA,eACrB,aAAA;;;;;AAbsB;AAUzB;;;;;;KCCY,wBAAA;EAAA,SACD,aAAA,EAAe,iBAAA,CAAkB,KAAA;EAAA,SACjC,SAAA;IAAA,SACE,QAAA,EAAU,aAAA,CAAc,wBAAA;EAAA;AAAA;;;ADDrB;;;;ACFhB;;;;;;;UAoBiB,QAAA,kBAA0B,WAAA,GAAc,WAAA;EAAA,SAC9C,MAAA;EAAA,SACA,YAAA;EAAA,SACA,KAAA,EAAO,MAAA,SAAe,cAAA;EAtBP;;;EAAA,SA0Bf,MAAA,EAAQ,iBAAA;EAAA,SACR,OAAA,EAAS,QAAA;EAAA,SACT,YAAA,EAAc,MAAA,SAAe,MAAA;EAAA,SAC7B,cAAA,EAAgB,MAAA;EAAA,SAChB,SAAA,GAAY,wBAAA;EAAA,SACZ,WAAA,EAAa,eAAA;EAAA,SACb,IAAA,EAAM,MAAA;EAAA,SACN,oBAAA,GAAuB,aAAA;AAAA;AAAA,KAG7B,mBAAA,WAA8B,MAAA,2BAAiC,CAAA,kCAC5D,CAAA,UACG,CAAA,WAAY,IAAA,IACjB,IAAA;AAAA,KAID,uBAAA,eAAsC,UAAA;EAAA,SAChC,YAAA;AAAA,IAEP,EAAA,SAAW,MAAA,SAAe,mBAAA,IACxB,EAAA,GACA,MAAA,iBACF,MAAA;;KAGQ,8BAAA,mBAAiD,QAAA,IAC3D,uBAAA,CACE,SAAA,yBAAkC,mBAAA,CAAoB,SAAA,sDAEpD,SAAA,SAAkB,MAAA,SAAe,mBAAA,IAC/B,SAAA,GACA,MAAA,iBACF,MAAA"}
//#region src/namespace-id.d.ts
type NamespaceId = string & {
readonly __brand: 'NamespaceId';
};
declare function asNamespaceId(value: string): NamespaceId;
//#endregion
//#region src/cross-reference.d.ts
interface CrossReference {
readonly namespace: NamespaceId;
readonly model: string;
/**
* Contract-space identity for cross-space relations. When present, the
* referenced model lives in a different contract space. Absent for local
* (same-space) relations.
*/
readonly space?: string;
}
declare const CrossReferenceSchema: import("arktype/internal/variants/object.ts").ObjectType<CrossReference, {}>;
declare function crossRef(model: string, namespace?: string, space?: string): CrossReference;
//#endregion
//#region src/types.d.ts
/**
* Unique symbol used as the key for branding types.
*/
declare const $: unique symbol;
/**
* A helper type to brand a given type with a unique identifier.
*
* @template TKey Text used as the brand key.
* @template TValue Optional value associated with the brand key. Defaults to `true`.
*/
type Brand<TKey extends string | number | symbol, TValue = true> = {
[$]: { [K in TKey]: TValue };
};
/**
* Base type for storage contract hashes.
* Emitted contract.d.ts files use this with the hash value as a type parameter:
* `type StorageHash = StorageHashBase<'sha256:abc123...'>`
*/
type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
/**
* Base type for execution contract hashes.
* Emitted contract.d.ts files use this with the hash value as a type parameter:
* `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`
*/
type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
declare function executionHash<const T extends string>(value: T): ExecutionHashBase<T>;
declare function coreHash<const T extends string>(value: T): StorageHashBase<T>;
/**
* Base type for profile contract hashes.
* Emitted contract.d.ts files use this with the hash value as a type parameter:
* `type ProfileHash = ProfileHashBase<'sha256:def456...'>`
*/
type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
declare function profileHash<const T extends string>(value: T): ProfileHashBase<T>;
/**
* One entity-kind slot in a namespace — a map of entity name to entry.
* Values are opaque at the foundation layer; family and target concretions
* refine them to typed IR classes.
*/
type StorageEntitySlot = Readonly<Record<string, unknown>>;
/**
* Plain-data namespace entry in a storage block. Every hydrated contract
* carries at least `id` plus entity-kind slot maps under `entries`
* (`table`, `collection`, …). Foundation declares only this shape — no IR
* machinery.
*/
interface StorageNamespace {
readonly id: string;
readonly entries: Readonly<Record<string, StorageEntitySlot>>;
}
/**
* Base type for family-specific storage blocks.
* Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the
* storage hash alongside family-specific data (tables, collections, etc.).
*
* The `namespaces` map is carried by every hydrated storage block. Serialized
* envelope shape is target-owned; this types the in-memory contract after
* `deserializeContract`.
*/
interface StorageBase<THash extends string = string> {
readonly storageHash: StorageHashBase<THash>;
readonly namespaces: Readonly<Record<string, StorageNamespace>>;
}
interface FieldType {
readonly type: string;
readonly nullable: boolean;
readonly items?: FieldType;
readonly properties?: Record<string, FieldType>;
}
type GeneratedValueSpec = {
readonly id: string;
readonly params?: Record<string, unknown>;
};
type JsonPrimitive = string | number | boolean | null;
type JsonValue = JsonPrimitive | {
readonly [key: string]: JsonValue;
} | readonly JsonValue[];
type ColumnDefaultLiteralValue = JsonValue;
type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
/**
* Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
* resolve template values from caller-supplied args (typed `unknown` at the
* boundary) and need to validate before constructing a `ColumnDefault`.
* Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
* instances. Rejects functions, class instances (other than `Date`),
* `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
*/
declare function isColumnDefaultLiteralInputValue(value: unknown): value is ColumnDefaultLiteralInputValue;
type ColumnDefault = {
readonly kind: 'literal';
readonly value: ColumnDefaultLiteralInputValue;
} | {
readonly kind: 'function';
readonly expression: string;
};
declare function isColumnDefault(value: unknown): value is ColumnDefault;
type ExecutionMutationDefaultValue = {
readonly kind: 'generator';
readonly id: GeneratedValueSpec['id'];
readonly params?: Record<string, unknown>;
};
declare function isExecutionMutationDefaultValue(value: unknown): value is ExecutionMutationDefaultValue;
type ExecutionMutationDefault = {
readonly ref: {
readonly namespace: string;
readonly table: string;
readonly column: string;
};
readonly onCreate?: ExecutionMutationDefaultValue;
readonly onUpdate?: ExecutionMutationDefaultValue;
};
/**
* `ExecutionMutationDefault` minus its `ref` — the per-field phases value
* authoring layers attach to a column before the column ref is known.
*/
type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;
type ExecutionSection<THash extends string = string> = {
readonly executionHash: ExecutionHashBase<THash>;
readonly mutations: {
readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
};
};
interface Source {
readonly readOnly: boolean;
readonly projection: Record<string, FieldType>;
readonly origin?: Record<string, unknown>;
readonly capabilities?: Record<string, boolean>;
}
interface DocIndex {
readonly name: string;
readonly keys: Record<string, 'asc' | 'desc'>;
readonly unique?: boolean;
readonly where?: Expr;
}
type Expr = {
readonly kind: 'eq';
readonly path: ReadonlyArray<string>;
readonly value: unknown;
} | {
readonly kind: 'exists';
readonly path: ReadonlyArray<string>;
};
interface DocCollection {
readonly name: string;
readonly id?: {
readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';
};
readonly fields: Record<string, FieldType>;
readonly indexes?: ReadonlyArray<DocIndex>;
readonly readOnly?: boolean;
}
interface PlanMeta {
readonly target: string;
readonly targetFamily?: string;
readonly storageHash: string;
readonly profileHash?: string;
readonly lane: string;
readonly annotations?: {
readonly [key: string]: unknown;
};
}
/**
* Contract marker record stored in the database.
* Represents the current contract identity for a database.
*/
interface ContractMarkerRecord {
readonly storageHash: string;
readonly profileHash: string;
readonly contractJson: unknown | null;
readonly canonicalVersion: number | null;
readonly updatedAt: Date;
readonly appTag: string | null;
readonly meta: Record<string, unknown>;
readonly invariants: readonly string[];
}
/**
* One applied migration edge from the per-space ledger journal.
* Returned by `readLedger` in append (apply) order.
*/
interface LedgerEntryRecord {
readonly space: string;
readonly migrationName: string;
readonly migrationHash: string;
readonly from: string | null;
readonly to: string;
readonly appliedAt: Date;
readonly operationCount: number;
}
//#endregion
//#region src/value-set-ref.d.ts
/**
* Entity coordinate for a domain enum or storage value-set reference.
*
* Field-name identity with the framework's `EntityCoordinate` type
* (packages/1-framework/1-core/framework-components/src/ir/storage.ts).
* Foundation-contract cannot import framework-components (dependency points
* the other way), so this is a standalone mirror of that shape plus the
* cross-space discriminator.
*
* One-vocabulary rule (ADR 224): `entityKind` is equal to the entries slot
* key the referenced entity lives under — `'enum'` for domain's `enum` slot,
* `'valueSet'` for storage's `entries.valueSet` slot. No consumer-side
* translation between the kind string and the slot key.
*
* Every `valueSet` reference is intra-plane (domain field → domain enum;
* storage column/check → storage value-set). The directional invariant:
* domain may reference storage; storage may never reference domain.
*
* `namespaceId` admits the `UNBOUND_NAMESPACE_ID` (`__unbound__`) sentinel
* for single-namespace (unbound) references.
*
* `spaceId` is the cross-space discriminator: absent ⇒ local (same
* contract-space); present ⇒ cross-space. No separate tag field.
*/
interface ValueSetRef {
readonly plane: 'domain' | 'storage';
readonly namespaceId: string;
readonly entityKind: 'enum' | 'valueSet';
readonly entityName: string;
readonly spaceId?: string;
}
//#endregion
//#region src/domain-types.d.ts
type ScalarFieldType = {
readonly kind: 'scalar';
readonly codecId: string;
readonly typeParams?: Record<string, unknown>;
};
type ValueObjectFieldType = {
readonly kind: 'valueObject';
readonly name: string;
};
type UnionFieldType = {
readonly kind: 'union';
readonly members: ReadonlyArray<ScalarFieldType | ValueObjectFieldType>;
};
type ContractFieldType = ScalarFieldType | ValueObjectFieldType | UnionFieldType;
type ContractField = {
readonly nullable: boolean;
readonly type: ContractFieldType;
readonly many?: true;
readonly dict?: true;
readonly valueSet?: ValueSetRef;
};
/**
* A domain enum: an ordered set of named members, each with a codec-encoded
* value. The `codecId` identifies the codec used to encode member values in
* storage. The `members` array is ordered (declaration order is preserved).
*/
type ContractEnum = {
readonly codecId: string;
readonly members: readonly {
readonly name: string;
readonly value: JsonValue;
}[];
};
type ContractRelationOn = {
readonly localFields: readonly string[];
readonly targetFields: readonly string[];
};
type ContractRelationThrough = {
readonly table: string;
readonly namespaceId: string;
readonly parentColumns: readonly string[];
readonly childColumns: readonly string[];
readonly targetColumns: readonly string[];
};
type ContractManyToManyRelation = {
readonly to: CrossReference;
readonly cardinality: 'N:M';
readonly on: ContractRelationOn;
readonly through: ContractRelationThrough;
};
type ContractNonJunctionRelation = {
readonly to: CrossReference;
readonly cardinality: '1:1' | '1:N' | 'N:1';
readonly on: ContractRelationOn;
readonly through?: never;
};
type ContractReferenceRelation = ContractManyToManyRelation | ContractNonJunctionRelation;
type ContractEmbedRelation = {
readonly to: CrossReference;
readonly cardinality: '1:1' | '1:N';
};
type ContractRelation = ContractReferenceRelation | ContractEmbedRelation;
type ContractDiscriminator = {
readonly field: string;
};
type ContractVariantEntry = {
readonly value: string;
};
type ContractValueObject = {
readonly fields: Record<string, ContractField>;
};
type ModelStorageBase = Readonly<Record<string, unknown>>;
interface ContractModelBase<TModelStorage extends ModelStorageBase = ModelStorageBase> {
readonly fields: Record<string, ContractField>;
readonly relations: Record<string, ContractRelation>;
readonly storage: TModelStorage;
readonly discriminator?: ContractDiscriminator;
readonly variants?: Record<string, ContractVariantEntry>;
readonly base?: CrossReference;
readonly owner?: string;
}
interface ContractModel<TModelStorage extends ModelStorageBase = ModelStorageBase> extends ContractModelBase<TModelStorage> {
readonly fields: Record<string, ContractField>;
}
type ReferenceRelationKeys<TModels extends Record<string, {
readonly relations: Record<string, ContractRelation>;
}>, ModelName extends string & keyof TModels> = { [K in keyof TModels[ModelName]['relations']]: TModels[ModelName]['relations'][K] extends ContractReferenceRelation ? K : never }[keyof TModels[ModelName]['relations']];
type EmbedRelationKeys<TModels extends Record<string, {
readonly relations: Record<string, ContractRelation>;
}>, ModelName extends string & keyof TModels> = { [K in keyof TModels[ModelName]['relations']]: TModels[ModelName]['relations'][K] extends ContractReferenceRelation ? never : K }[keyof TModels[ModelName]['relations']];
//#endregion
//#region src/domain-envelope.d.ts
/**
* One namespace's application-domain entities — models and optional value
* objects keyed by entity name within that namespace coordinate.
*/
interface ApplicationDomainNamespace {
readonly models: Record<string, ContractModelBase>;
readonly valueObjects?: Record<string, ContractValueObject>;
readonly enum?: Record<string, ContractEnum>;
}
/**
* Application-domain envelope: entity content keyed by namespace id.
* Mirrors the storage plane's `namespaces` segment (ADR 221).
*/
interface ApplicationDomain {
readonly namespaces: Readonly<Record<string, ApplicationDomainNamespace>>;
}
type ContractWithDomain = {
readonly domain: ApplicationDomain;
};
//#endregion
export { executionHash as $, ColumnDefaultLiteralValue as A, FieldType as B, UnionFieldType as C, Brand as D, $ as E, ExecutionMutationDefault as F, PlanMeta as G, JsonPrimitive as H, ExecutionMutationDefaultPhases as I, StorageBase as J, ProfileHashBase as K, ExecutionMutationDefaultValue as L, DocCollection as M, DocIndex as N, ColumnDefault as O, ExecutionHashBase as P, coreHash as Q, ExecutionSection as R, ScalarFieldType as S, ValueSetRef as T, JsonValue as U, GeneratedValueSpec as V, LedgerEntryRecord as W, StorageHashBase as X, StorageEntitySlot as Y, StorageNamespace as Z, ContractValueObject as _, ContractEmbedRelation as a, CrossReferenceSchema as at, ModelStorageBase as b, ContractFieldType as c, asNamespaceId as ct, ContractModelBase as d, isColumnDefault as et, ContractNonJunctionRelation as f, ContractRelationThrough as g, ContractRelationOn as h, ContractDiscriminator as i, CrossReference as it, ContractMarkerRecord as j, ColumnDefaultLiteralInputValue as k, ContractManyToManyRelation as l, ContractRelation as m, ApplicationDomainNamespace as n, isExecutionMutationDefaultValue as nt, ContractEnum as o, crossRef as ot, ContractReferenceRelation as p, Source as q, ContractWithDomain as r, profileHash as rt, ContractField as s, NamespaceId as st, ApplicationDomain as t, isColumnDefaultLiteralInputValue as tt, ContractModel as u, ContractVariantEntry as v, ValueObjectFieldType as w, ReferenceRelationKeys as x, EmbedRelationKeys as y, Expr as z };
//# sourceMappingURL=domain-envelope-Bj-zQbVU.d.mts.map
{"version":3,"file":"domain-envelope-Bj-zQbVU.d.mts","names":[],"sources":["../src/namespace-id.ts","../src/cross-reference.ts","../src/types.ts","../src/value-set-ref.ts","../src/domain-types.ts","../src/domain-envelope.ts"],"mappings":";KAEY,WAAA;EAAA,SAAkC,OAAO;AAAA;AAAA,iBAErC,aAAA,CAAc,KAAA,WAAgB,WAAW;;;UCAxC,cAAA;EAAA,SACN,SAAA,EAAW,WAAW;EAAA,SACtB,KAAA;EDJ0C;AAAA;AAErD;;;EAFqD,SCU1C,KAAA;AAAA;AAAA,cAGE,oBAAA,gDAAoB,UAAA,CAAA,cAAA;AAAA,iBAcjB,QAAA,CACd,KAAA,UACA,SAAA,WACA,KAAA,YACC,cAAc;;;;AD/BjB;;cECa,CAAA;;AFDwC;AAErD;;;;KEOY,KAAA;EAAA,CACT,CAAA,WACO,IAAA,GAAO,MAAA;AAAA;;;;;;KASL,eAAA,yBAAwC,KAAA,GAAQ,KAAK;;;ADVjD;AAGhB;;KCcY,iBAAA,yBAA0C,KAAA,GAAQ,KAAK;AAAA,iBAEnD,aAAA,yBAAsC,KAAA,EAAO,CAAA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A;AAAA,KAEJ,iBAAA,iBACM,MAAA;EAAA,SAA0B,SAAA,EAAW,MAAA,SAAe,gBAAA;AAAA,qCACnC,OAAA,kBAErB,OAAA,CAAQ,SAAA,iBAA0B,OAAA,CAAQ,SAAA,eAAwB,CAAA,UAAW,yBAAA,WAErF,CAAA,SACE,OAAA,CAAQ,SAAA;;;;;;AJzHqC;UKMpC,0BAAA;EAAA,SACN,MAAA,EAAQ,MAAA,SAAe,iBAAA;EAAA,SACvB,YAAA,GAAe,MAAA,SAAe,mBAAA;EAAA,SAC9B,IAAA,GAAO,MAAA,SAAe,YAAA;AAAA;;;;AJPjC;UIciB,iBAAA;EAAA,SACN,UAAA,EAAY,QAAA,CAAS,MAAA,SAAe,0BAAA;AAAA;AAAA,KAGnC,kBAAA;EAAA,SACD,MAAA,EAAQ,iBAAiB;AAAA"}
import { d as ContractModelBase, t as ApplicationDomain } from "./domain-envelope-Bj-zQbVU.mjs";
//#region src/resolve-domain-model.d.ts
interface ResolvedDomainModel {
readonly namespaceId: string;
readonly model: ContractModelBase;
}
/**
* Resolve a bare domain model name to its namespace coordinate and model IR by
* scanning the contract's namespaces. For the single-namespace contracts in
* scope the scan is exact; cross-namespace bare-name collisions are selected
* explicitly (TML-2550).
*/
declare function resolveDomainModel(domain: ApplicationDomain, modelName: string): ResolvedDomainModel | undefined;
//#endregion
export { resolveDomainModel as n, ResolvedDomainModel as t };
//# sourceMappingURL=resolve-domain-model-5aHgzqTD.d.mts.map
{"version":3,"file":"resolve-domain-model-5aHgzqTD.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"}