@prisma/orm-framework 8.0.0-rc.21-dev.4 → 8.0.0-rc.21-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apply-specifier-default-control-policy-Dlz0iwnK.d.mts → apply-specifier-default-control-policy-BSgLNgKj.d.mts} +2 -2
- package/dist/apply-specifier-default-control-policy-BSgLNgKj.d.mts.map +1 -0
- package/dist/{authoring-C2UAuRfN.d.mts → authoring-D75oR8Nt.d.mts} +5 -5
- package/dist/{authoring-C2UAuRfN.d.mts.map → authoring-D75oR8Nt.d.mts.map} +1 -1
- package/dist/{binder-BszqDG1t-icu83_4f.d.mts → binder-BszqDG1t-pSH-fXt5.d.mts} +12 -12
- package/dist/{binder-BszqDG1t-icu83_4f.d.mts.map → binder-BszqDG1t-pSH-fXt5.d.mts.map} +1 -1
- package/dist/{canonicalization-CyrrXGmj-CeKUkht1.d.mts → canonicalization-BIS6ONYT-VttZI7M4.d.mts} +3 -3
- package/dist/{canonicalization-CyrrXGmj-CeKUkht1.d.mts.map → canonicalization-BIS6ONYT-VttZI7M4.d.mts.map} +1 -1
- package/dist/{codec-CZ3VQq7G.d.mts → codec-h0kvF5B8.d.mts} +4 -3
- package/dist/codec-h0kvF5B8.d.mts.map +1 -0
- package/dist/{codec-types-B4wPvO-K-BqcGrCE-.d.mts → codec-types-B4wPvO-K-BIPFT7EP.d.mts} +2 -2
- package/dist/{codec-types-B4wPvO-K-BqcGrCE-.d.mts.map → codec-types-B4wPvO-K-BIPFT7EP.d.mts.map} +1 -1
- package/dist/{components-BenCVFk4.d.mts → components-CHWGZJ5q.d.mts} +5 -5
- package/dist/{components-BenCVFk4.d.mts.map → components-CHWGZJ5q.d.mts.map} +1 -1
- package/dist/components.d.mts +17 -17
- package/dist/components.mjs +2 -2
- package/dist/components__authoring.d.mts +3 -3
- package/dist/components__codec.d.mts +2 -2
- package/dist/components__components.d.mts +4 -4
- package/dist/components__control.d.mts +4 -4
- package/dist/components__emission.d.mts +3 -3
- package/dist/components__execution.d.mts +1 -1
- package/dist/components__ir.d.mts +2 -2
- package/dist/components__ir.mjs +2 -2
- package/dist/components__psl-ast.d.mts +3 -3
- package/dist/components__runtime.d.mts +1 -1
- package/dist/{config-types-BJ79TZCl.d.mts → config-types-B0JjhuaX.d.mts} +8 -8
- package/dist/{config-types-BJ79TZCl.d.mts.map → config-types-B0JjhuaX.d.mts.map} +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config__config-types.d.mts +1 -1
- package/dist/contract-authoring.d.mts +6 -6
- package/dist/{contract-types-DEIEpzU_-DvAVuBr5.d.mts → contract-types-ib-VnKHG-l9vE5Vd-.d.mts} +22 -8
- package/dist/contract-types-ib-VnKHG-l9vE5Vd-.d.mts.map +1 -0
- package/dist/contract.d.mts +13 -11
- package/dist/contract.mjs +5 -3
- package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -1
- package/dist/contract__enum-accessor.d.mts +1 -1
- package/dist/contract__hashing-utils.d.mts +1 -1
- package/dist/contract__hashing.d.mts +2 -2
- package/dist/contract__resolve-domain-model.d.mts +1 -1
- package/dist/contract__types.d.mts +6 -5
- package/dist/contract__types.mjs +3 -2
- package/dist/contract__validate-domain.d.mts +2 -2
- package/dist/contract__validate-domain.mjs +2 -2
- package/dist/contract__validate-storage.d.mts +2 -0
- package/dist/contract__validate-storage.mjs +2 -0
- package/dist/{control-BeXOxtXA-BU8y-LiK.d.mts → control-BeXOxtXA-DyPvQsqJ.d.mts} +2 -2
- package/dist/{control-BeXOxtXA-BU8y-LiK.d.mts.map → control-BeXOxtXA-DyPvQsqJ.d.mts.map} +1 -1
- package/dist/{control-CS1uqJj_.d.mts → control-BrO2h8ed.d.mts} +24 -12
- package/dist/control-BrO2h8ed.d.mts.map +1 -0
- package/dist/control-COPuZO7V.d.mts +1 -0
- package/dist/domain-envelope-CJNIHBn_-DBFAmkNL.d.mts +191 -0
- package/dist/domain-envelope-CJNIHBn_-DBFAmkNL.d.mts.map +1 -0
- package/dist/emission-DGYCaKjl.d.mts +2 -0
- package/dist/{emission-types-bX2HmNSC-C9vDMKbg.d.mts → emission-types-bX2HmNSC-vaRddb1_.d.mts} +6 -5
- package/dist/emission-types-bX2HmNSC-vaRddb1_.d.mts.map +1 -0
- package/dist/{enum-accessor-2OZgavDX.d.mts → enum-accessor-BXc2Jseo.d.mts} +4 -3
- package/dist/enum-accessor-BXc2Jseo.d.mts.map +1 -0
- package/dist/errors.d.mts +4 -4
- package/dist/errors__control.d.mts +2 -2
- package/dist/errors__execution.d.mts +1 -1
- package/dist/errors__migration.d.mts +1 -1
- package/dist/{execution-BPJbNttJ.d.mts → execution-BhFeCTkt.d.mts} +2 -2
- package/dist/{execution-BPJbNttJ.d.mts.map → execution-BhFeCTkt.d.mts.map} +1 -1
- package/dist/{execution-BWR_z8XI.d.mts → execution-Cgkrs6UV.d.mts} +2 -2
- package/dist/{execution-BWR_z8XI.d.mts.map → execution-Cgkrs6UV.d.mts.map} +1 -1
- package/dist/field-problems-DMpmScuG-R70w-aDk.mjs +41 -0
- package/dist/field-problems-DMpmScuG-R70w-aDk.mjs.map +1 -0
- package/dist/{framework-authoring-ebqZ8M_M-DIDpVcUB.d.mts → framework-authoring-ebqZ8M_M-Bdi8MutX.d.mts} +3 -3
- package/dist/{framework-authoring-ebqZ8M_M-DIDpVcUB.d.mts.map → framework-authoring-ebqZ8M_M-Bdi8MutX.d.mts.map} +1 -1
- package/dist/{framework-components-BqHA1V92-D9j8uXa-.d.mts → framework-components-BqHA1V92-D_nUDFf9.d.mts} +4 -4
- package/dist/{framework-components-BqHA1V92-D9j8uXa-.d.mts.map → framework-components-BqHA1V92-D_nUDFf9.d.mts.map} +1 -1
- package/dist/{hashing-D-DHz0zl.d.mts → hashing-Ca2uTBmm.d.mts} +4 -4
- package/dist/{hashing-D-DHz0zl.d.mts.map → hashing-Ca2uTBmm.d.mts.map} +1 -1
- package/dist/{hashing-utils-DiGHKd3b.d.mts → hashing-utils-daflaalA.d.mts} +2 -2
- package/dist/{hashing-utils-DiGHKd3b.d.mts.map → hashing-utils-daflaalA.d.mts.map} +1 -1
- package/dist/ids__runtime.d.mts +1 -1
- package/dist/{ir-uDGU9vaj.mjs → ir-B7QKO3dq.mjs} +18 -2
- package/dist/ir-B7QKO3dq.mjs.map +1 -0
- package/dist/{ir-LV4tXsw3.d.mts → ir-DoVMhmqa.d.mts} +10 -25
- package/dist/ir-DoVMhmqa.d.mts.map +1 -0
- package/dist/{migration-Dk1sYIvs.d.mts → migration-CMMT3vcR.d.mts} +2 -2
- package/dist/{migration-Dk1sYIvs.d.mts.map → migration-CMMT3vcR.d.mts.map} +1 -1
- package/dist/{parse-djL5wker-DnMlKOii.d.mts → parse-djL5wker-Bf4uawTE.d.mts} +6 -6
- package/dist/{parse-djL5wker-DnMlKOii.d.mts.map → parse-djL5wker-Bf4uawTE.d.mts.map} +1 -1
- package/dist/{psl-ast-0oMzInxd-Nx9cHmcc.d.mts → psl-ast-0oMzInxd-BjKbrwNk.d.mts} +2 -2
- package/dist/{psl-ast-0oMzInxd-Nx9cHmcc.d.mts.map → psl-ast-0oMzInxd-BjKbrwNk.d.mts.map} +1 -1
- package/dist/psl-ast-DjTRQDW7.d.mts +2 -0
- package/dist/psl-parser.d.mts +10 -10
- package/dist/psl-parser__format.d.mts +1 -1
- package/dist/psl-parser__interpret.d.mts +7 -7
- package/dist/psl-parser__syntax.d.mts +1 -1
- package/dist/psl-printer.d.mts +4 -4
- package/dist/{resolve-domain-model-BNr1glea-BLuR-phK.d.mts → resolve-domain-model-CZ5E6qxa-Caq2Becx.d.mts} +3 -3
- package/dist/resolve-domain-model-CZ5E6qxa-Caq2Becx.d.mts.map +1 -0
- package/dist/{runtime-CTJc8PII.d.mts → runtime-BERs-lBJ.d.mts} +4 -4
- package/dist/{runtime-CTJc8PII.d.mts.map → runtime-BERs-lBJ.d.mts.map} +1 -1
- package/dist/storage-value-objects-Di8Cowdl-QNqJXkk0.mjs +28 -0
- package/dist/storage-value-objects-Di8Cowdl-QNqJXkk0.mjs.map +1 -0
- package/dist/{temporal-type-aliases-BIiamFSH-BrpK13hf.d.mts → temporal-type-aliases-BIiamFSH-DLxWO37e.d.mts} +3 -3
- package/dist/{temporal-type-aliases-BIiamFSH-BrpK13hf.d.mts.map → temporal-type-aliases-BIiamFSH-DLxWO37e.d.mts.map} +1 -1
- package/dist/{types-B8ULzMAX.mjs → types-Boh5NGDz.mjs} +52 -9
- package/dist/types-Boh5NGDz.mjs.map +1 -0
- package/dist/types-CkFfDIud-C1u8M2UE.d.mts +196 -0
- package/dist/types-CkFfDIud-C1u8M2UE.d.mts.map +1 -0
- package/dist/{types-GNXJ7xW2.d.mts → types-Dh_AMVRf.d.mts} +145 -25
- package/dist/types-Dh_AMVRf.d.mts.map +1 -0
- package/dist/{types-import-spec-Bkh243Hv-B-fdw0Wl.d.mts → types-import-spec-Bkh243Hv-BI9m5WFL.d.mts} +3 -3
- package/dist/{types-import-spec-Bkh243Hv-B-fdw0Wl.d.mts.map → types-import-spec-Bkh243Hv-BI9m5WFL.d.mts.map} +1 -1
- package/dist/{validate-domain-CbXHDYpF.mjs → validate-domain-KUhPCj7i.mjs} +18 -35
- package/dist/validate-domain-KUhPCj7i.mjs.map +1 -0
- package/dist/{validate-domain-B5kmlBFB.d.mts → validate-domain-eU07L3vi.d.mts} +7 -3
- package/dist/{validate-domain-B5kmlBFB.d.mts.map → validate-domain-eU07L3vi.d.mts.map} +1 -1
- package/dist/validate-storage-CGeJ-62G.mjs +31 -0
- package/dist/validate-storage-CGeJ-62G.mjs.map +1 -0
- package/dist/validate-storage-ChcQuhTb.d.mts +10 -0
- package/dist/validate-storage-ChcQuhTb.d.mts.map +1 -0
- package/package.json +16 -15
- package/dist/apply-specifier-default-control-policy-Dlz0iwnK.d.mts.map +0 -1
- package/dist/codec-CZ3VQq7G.d.mts.map +0 -1
- package/dist/contract-types-DEIEpzU_-DvAVuBr5.d.mts.map +0 -1
- package/dist/control-B3OS8JEw.d.mts +0 -1
- package/dist/control-CS1uqJj_.d.mts.map +0 -1
- package/dist/domain-envelope-CN721GnP-4huRt7Wc.d.mts +0 -373
- package/dist/domain-envelope-CN721GnP-4huRt7Wc.d.mts.map +0 -1
- package/dist/emission-ByTWEe2j.d.mts +0 -2
- package/dist/emission-types-bX2HmNSC-C9vDMKbg.d.mts.map +0 -1
- package/dist/enum-accessor-2OZgavDX.d.mts.map +0 -1
- package/dist/ir-LV4tXsw3.d.mts.map +0 -1
- package/dist/ir-uDGU9vaj.mjs.map +0 -1
- package/dist/psl-ast-CFQfCJeM.d.mts +0 -2
- package/dist/resolve-domain-model-BNr1glea-BLuR-phK.d.mts.map +0 -1
- package/dist/types-B8ULzMAX.mjs.map +0 -1
- package/dist/types-GNXJ7xW2.d.mts.map +0 -1
- package/dist/validate-domain-CbXHDYpF.mjs.map +0 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
//#region ../../../1-framework/0-foundation/contract/dist/types-CkFfDIud.d.mts
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Unique symbol used as the key for branding types.
|
|
5
|
+
*/
|
|
6
|
+
declare const $: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* A helper type to brand a given type with a unique identifier.
|
|
9
|
+
*
|
|
10
|
+
* @template TKey Text used as the brand key.
|
|
11
|
+
* @template TValue Optional value associated with the brand key. Defaults to `true`.
|
|
12
|
+
*/
|
|
13
|
+
type Brand<TKey extends string | number | symbol, TValue = true> = {
|
|
14
|
+
[$]: { [K in TKey]: TValue; };
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Base type for storage contract hashes.
|
|
18
|
+
* Emitted contract.d.ts files use this with the hash value as a type parameter:
|
|
19
|
+
* `type StorageHash = StorageHashBase<'abc123...'>`
|
|
20
|
+
*/
|
|
21
|
+
type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
|
|
22
|
+
/**
|
|
23
|
+
* Base type for execution contract hashes.
|
|
24
|
+
* Emitted contract.d.ts files use this with the hash value as a type parameter:
|
|
25
|
+
* `type ExecutionHash = ExecutionHashBase<'def456...'>`
|
|
26
|
+
*/
|
|
27
|
+
type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
|
|
28
|
+
declare function executionHash<const T extends string>(value: T): ExecutionHashBase<T>;
|
|
29
|
+
declare function coreHash<const T extends string>(value: T): StorageHashBase<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Base type for profile contract hashes.
|
|
32
|
+
* Emitted contract.d.ts files use this with the hash value as a type parameter:
|
|
33
|
+
* `type ProfileHash = ProfileHashBase<'def456...'>`
|
|
34
|
+
*/
|
|
35
|
+
type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
|
|
36
|
+
declare function profileHash<const T extends string>(value: T): ProfileHashBase<T>;
|
|
37
|
+
/**
|
|
38
|
+
* One entity-kind slot in a namespace — a map of entity name to entry.
|
|
39
|
+
* Values are opaque at the foundation layer; family and target concretions
|
|
40
|
+
* refine them to typed IR classes.
|
|
41
|
+
*/
|
|
42
|
+
type StorageEntitySlot = Readonly<Record<string, unknown>>;
|
|
43
|
+
/**
|
|
44
|
+
* Plain-data namespace entry in a storage block. Every hydrated contract
|
|
45
|
+
* carries at least `id` plus entity-kind slot maps under `entries`
|
|
46
|
+
* (`table`, `collection`, …). Foundation declares only this shape — no IR
|
|
47
|
+
* machinery.
|
|
48
|
+
*/
|
|
49
|
+
interface StorageNamespace {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly entries: Readonly<Record<string, StorageEntitySlot>>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Base type for family-specific storage blocks.
|
|
55
|
+
* Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the
|
|
56
|
+
* storage hash alongside family-specific data (tables, collections, etc.).
|
|
57
|
+
*
|
|
58
|
+
* The `namespaces` map is carried by every hydrated storage block. Serialized
|
|
59
|
+
* envelope shape is target-owned; this types the in-memory contract after
|
|
60
|
+
* `deserializeContract`.
|
|
61
|
+
*/
|
|
62
|
+
interface StorageBase<THash extends string = string> {
|
|
63
|
+
readonly storageHash: StorageHashBase<THash>;
|
|
64
|
+
readonly namespaces: Readonly<Record<string, StorageNamespace>>;
|
|
65
|
+
}
|
|
66
|
+
interface FieldType {
|
|
67
|
+
readonly type: string;
|
|
68
|
+
readonly nullable: boolean;
|
|
69
|
+
readonly items?: FieldType;
|
|
70
|
+
readonly properties?: Record<string, FieldType>;
|
|
71
|
+
}
|
|
72
|
+
type GeneratedValueSpec = {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
readonly params?: Record<string, unknown>;
|
|
75
|
+
};
|
|
76
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
77
|
+
type JsonValue = JsonPrimitive | {
|
|
78
|
+
readonly [key: string]: JsonValue;
|
|
79
|
+
} | readonly JsonValue[];
|
|
80
|
+
type ColumnDefaultLiteralValue = JsonValue;
|
|
81
|
+
type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
|
|
82
|
+
/**
|
|
83
|
+
* Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
|
|
84
|
+
* resolve template values from caller-supplied args (typed `unknown` at the
|
|
85
|
+
* boundary) and need to validate before constructing a `ColumnDefault`.
|
|
86
|
+
* Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
|
|
87
|
+
* instances. Rejects functions, class instances (other than `Date`),
|
|
88
|
+
* `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
|
|
89
|
+
*/
|
|
90
|
+
declare function isColumnDefaultLiteralInputValue(value: unknown): value is ColumnDefaultLiteralInputValue;
|
|
91
|
+
type ColumnDefault = {
|
|
92
|
+
readonly kind: 'literal';
|
|
93
|
+
readonly value: ColumnDefaultLiteralInputValue;
|
|
94
|
+
} | {
|
|
95
|
+
readonly kind: 'function';
|
|
96
|
+
readonly expression: string;
|
|
97
|
+
};
|
|
98
|
+
declare function isColumnDefault(value: unknown): value is ColumnDefault;
|
|
99
|
+
type ExecutionMutationDefaultValue = {
|
|
100
|
+
readonly kind: 'generator';
|
|
101
|
+
readonly id: GeneratedValueSpec['id'];
|
|
102
|
+
readonly params?: Record<string, unknown>;
|
|
103
|
+
};
|
|
104
|
+
declare function isExecutionMutationDefaultValue(value: unknown): value is ExecutionMutationDefaultValue;
|
|
105
|
+
/**
|
|
106
|
+
* A generator that fills a stored field on create, on update, or both. `ref.entry` names the storage entry that holds the field (a table or a collection) and `ref.field` the stored field in it (a column or a document field).
|
|
107
|
+
*/
|
|
108
|
+
type ExecutionMutationDefault = {
|
|
109
|
+
readonly ref: {
|
|
110
|
+
readonly namespace: string;
|
|
111
|
+
readonly entry: string;
|
|
112
|
+
readonly field: string;
|
|
113
|
+
};
|
|
114
|
+
readonly onCreate?: ExecutionMutationDefaultValue;
|
|
115
|
+
readonly onUpdate?: ExecutionMutationDefaultValue;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* `ExecutionMutationDefault` minus its `ref` — the per-field phases value
|
|
119
|
+
* authoring layers attach to a field before its ref is known.
|
|
120
|
+
*/
|
|
121
|
+
type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;
|
|
122
|
+
type ExecutionSection<THash extends string = string> = {
|
|
123
|
+
readonly executionHash: ExecutionHashBase<THash>;
|
|
124
|
+
readonly mutations: {
|
|
125
|
+
readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
interface Source {
|
|
129
|
+
readonly readOnly: boolean;
|
|
130
|
+
readonly projection: Record<string, FieldType>;
|
|
131
|
+
readonly origin?: Record<string, unknown>;
|
|
132
|
+
readonly capabilities?: Record<string, boolean>;
|
|
133
|
+
}
|
|
134
|
+
interface DocIndex {
|
|
135
|
+
readonly name: string;
|
|
136
|
+
readonly keys: Record<string, 'asc' | 'desc'>;
|
|
137
|
+
readonly unique?: boolean;
|
|
138
|
+
readonly where?: Expr;
|
|
139
|
+
}
|
|
140
|
+
type Expr = {
|
|
141
|
+
readonly kind: 'eq';
|
|
142
|
+
readonly path: ReadonlyArray<string>;
|
|
143
|
+
readonly value: unknown;
|
|
144
|
+
} | {
|
|
145
|
+
readonly kind: 'exists';
|
|
146
|
+
readonly path: ReadonlyArray<string>;
|
|
147
|
+
};
|
|
148
|
+
interface DocCollection {
|
|
149
|
+
readonly name: string;
|
|
150
|
+
readonly id?: {
|
|
151
|
+
readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';
|
|
152
|
+
};
|
|
153
|
+
readonly fields: Record<string, FieldType>;
|
|
154
|
+
readonly indexes?: ReadonlyArray<DocIndex>;
|
|
155
|
+
readonly readOnly?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface PlanMeta {
|
|
158
|
+
readonly target: string;
|
|
159
|
+
readonly targetFamily?: string;
|
|
160
|
+
readonly storageHash: string;
|
|
161
|
+
readonly profileHash?: string;
|
|
162
|
+
readonly lane: string;
|
|
163
|
+
readonly annotations?: {
|
|
164
|
+
readonly [key: string]: unknown;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Contract marker record stored in the database.
|
|
169
|
+
* Represents the current contract identity for a database.
|
|
170
|
+
*/
|
|
171
|
+
interface ContractMarkerRecord {
|
|
172
|
+
readonly storageHash: string;
|
|
173
|
+
readonly profileHash: string;
|
|
174
|
+
readonly contractJson: unknown | null;
|
|
175
|
+
readonly canonicalVersion: number | null;
|
|
176
|
+
readonly updatedAt: Date;
|
|
177
|
+
readonly appTag: string | null;
|
|
178
|
+
readonly meta: Record<string, unknown>;
|
|
179
|
+
readonly invariants: readonly string[];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* One applied migration edge from the per-space ledger journal.
|
|
183
|
+
* Returned by `readLedger` in append (apply) order.
|
|
184
|
+
*/
|
|
185
|
+
interface LedgerEntryRecord {
|
|
186
|
+
readonly space: string;
|
|
187
|
+
readonly migrationName: string;
|
|
188
|
+
readonly migrationHash: string;
|
|
189
|
+
readonly from: string | null;
|
|
190
|
+
readonly to: string;
|
|
191
|
+
readonly appliedAt: Date;
|
|
192
|
+
readonly operationCount: number;
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { isColumnDefaultLiteralInputValue as A, StorageBase as C, coreHash as D, StorageNamespace as E, profileHash as M, executionHash as O, Source as S, StorageHashBase as T, JsonPrimitive as _, ColumnDefaultLiteralValue as a, PlanMeta as b, DocIndex as c, ExecutionMutationDefaultPhases as d, ExecutionMutationDefaultValue as f, GeneratedValueSpec as g, FieldType as h, ColumnDefaultLiteralInputValue as i, isExecutionMutationDefaultValue as j, isColumnDefault as k, ExecutionHashBase as l, Expr as m, Brand as n, ContractMarkerRecord as o, ExecutionSection as p, ColumnDefault as r, DocCollection as s, $ as t, ExecutionMutationDefault as u, JsonValue as v, StorageEntitySlot as w, ProfileHashBase as x, LedgerEntryRecord as y };
|
|
196
|
+
//# sourceMappingURL=types-CkFfDIud-C1u8M2UE.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CkFfDIud-C1u8M2UE.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/types-CkFfDIud.d.mts"],"mappings":";;;;;cAIc;;;;;;;KAOT,MAAM,uCAAuC;GAC/C,OAAO,KAAK,OAAO;;;;;;;KAOjB,gBAAgB,wBAAwB,QAAQ;;;;;;KAMhD,kBAAkB,wBAAwB,QAAQ;iBACtC,oBAAoB,kBAAkB,OAAO,IAAI,kBAAkB;iBACnE,eAAe,kBAAkB,OAAO,IAAI,gBAAgB;;;;;;KAMxE,gBAAgB,wBAAwB,QAAQ;iBACpC,kBAAkB,kBAAkB,OAAO,IAAI,gBAAgB;;;;;;KAM3E,oBAAoB,SAAS;;;;;;;UAOxB;WACC;WACA,SAAS,SAAS,eAAe;;;;;;;;;;;UAWlC,YAAY;WACX,aAAa,gBAAgB;WAC7B,YAAY,SAAS,eAAe;;UAErC;WACC;WACA;WACA,QAAQ;WACR,aAAa,eAAe;;KAElC;WACM;WACA,SAAS;;KAEf;KACA,YAAY;YACL,cAAc;aACb;KACR,4BAA4B;KAC5B,iCAAiC,4BAA4B;;;;;;;;;iBASjD,iCAAiC,iBAAiB,SAAS;KACvE;WACM;WACA,OAAO;;WAEP;WACA;;iBAEM,gBAAgB,iBAAiB,SAAS;KACtD;WACM;WACA,IAAI;WACJ,SAAS;;iBAEH,gCAAgC,iBAAiB,SAAS;;;;KAItE;WACM;aACE;aACA;aACA;;WAEF,WAAW;WACX,WAAW;;;;;;KAMjB,iCAAiC,KAAK;KACtC,iBAAiB;WACX,eAAe,kBAAkB;WACjC;aACE,UAAU,cAAc;;;UAG3B;WACC;WACA,YAAY,eAAe;WAC3B,SAAS;WACT,eAAe;;UAEhB;WACC;WACA,MAAM;WACN;WACA,QAAQ;;KAEd;WACM;WACA,MAAM;WACN;;WAEA;WACA,MAAM;;UAEP;WACC;WACA;aACE;;WAEF,QAAQ,eAAe;WACvB,UAAU,cAAc;WACxB;;UAED;WACC;WACA;WACA;WACA;WACA;WACA;cACG;;;;;;;UAOJ;WACC;WACA;WACA;WACA;WACA,WAAW;WACX;WACA,MAAM;WACN;;;;;;UAMD;WACC;WACA;WACA;WACA;WACA;WACA,WAAW;WACX"}
|
|
@@ -1,6 +1,120 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { C as StorageBase } from "./types-CkFfDIud-C1u8M2UE.mjs";
|
|
2
|
+
import { t as ApplicationDomain, u as ContractModelBase, v as ContractValueObject, w as EntityCoordinate } from "./domain-envelope-CJNIHBn_-DBFAmkNL.mjs";
|
|
3
|
+
import { n as ContractExecutionSection } from "./contract-types-ib-VnKHG-l9vE5Vd-.mjs";
|
|
3
4
|
//#region ../../../1-framework/0-foundation/contract/dist/types.d.mts
|
|
5
|
+
//#region src/contract-value-object-schema.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The type of a domain field or of a value object's member, `ContractFieldType`: a scalar with its codec, a value object by its storage coordinate, or a union of those. A union holds no union.
|
|
8
|
+
*/
|
|
9
|
+
declare const ContractFieldTypeSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
10
|
+
kind: "scalar";
|
|
11
|
+
codecId: string;
|
|
12
|
+
typeParams?: Record<string, unknown>;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "valueObject";
|
|
15
|
+
plane: "storage";
|
|
16
|
+
namespaceId: string;
|
|
17
|
+
entityKind: "valueObject";
|
|
18
|
+
entityName: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "union";
|
|
21
|
+
members: ({
|
|
22
|
+
kind: "scalar";
|
|
23
|
+
codecId: string;
|
|
24
|
+
typeParams?: Record<string, unknown>;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "valueObject";
|
|
27
|
+
plane: "storage";
|
|
28
|
+
namespaceId: string;
|
|
29
|
+
entityKind: "valueObject";
|
|
30
|
+
entityName: string;
|
|
31
|
+
})[];
|
|
32
|
+
}, {}>;
|
|
33
|
+
/** A value object's member, `ContractValueObjectField`. */
|
|
34
|
+
declare const ContractValueObjectFieldSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
35
|
+
nullable: boolean;
|
|
36
|
+
type: {
|
|
37
|
+
kind: "scalar";
|
|
38
|
+
codecId: string;
|
|
39
|
+
typeParams?: Record<string, unknown>;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "valueObject";
|
|
42
|
+
plane: "storage";
|
|
43
|
+
namespaceId: string;
|
|
44
|
+
entityKind: "valueObject";
|
|
45
|
+
entityName: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "union";
|
|
48
|
+
members: ({
|
|
49
|
+
kind: "scalar";
|
|
50
|
+
codecId: string;
|
|
51
|
+
typeParams?: Record<string, unknown>;
|
|
52
|
+
} | {
|
|
53
|
+
kind: "valueObject";
|
|
54
|
+
plane: "storage";
|
|
55
|
+
namespaceId: string;
|
|
56
|
+
entityKind: "valueObject";
|
|
57
|
+
entityName: string;
|
|
58
|
+
})[];
|
|
59
|
+
};
|
|
60
|
+
many?: false | {
|
|
61
|
+
elementNullable: boolean;
|
|
62
|
+
};
|
|
63
|
+
dict?: true;
|
|
64
|
+
valueSet?: {
|
|
65
|
+
plane: "storage";
|
|
66
|
+
namespaceId: string;
|
|
67
|
+
entityKind: "valueSet";
|
|
68
|
+
entityName: string;
|
|
69
|
+
spaceId?: string;
|
|
70
|
+
};
|
|
71
|
+
}, {}>;
|
|
72
|
+
/**
|
|
73
|
+
* A value object, `ContractValueObject`: the storage entity under `storage.namespaces.<ns>.entries.valueObject.<name>` (ADR 309). The framework defines this entity kind, since domain fields refer to it; both families validate their entries against this schema.
|
|
74
|
+
*/
|
|
75
|
+
declare const ContractValueObjectSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
76
|
+
fields: {
|
|
77
|
+
[x: string]: {
|
|
78
|
+
nullable: boolean;
|
|
79
|
+
type: {
|
|
80
|
+
kind: "scalar";
|
|
81
|
+
codecId: string;
|
|
82
|
+
typeParams?: Record<string, unknown>;
|
|
83
|
+
} | {
|
|
84
|
+
kind: "valueObject";
|
|
85
|
+
plane: "storage";
|
|
86
|
+
namespaceId: string;
|
|
87
|
+
entityKind: "valueObject";
|
|
88
|
+
entityName: string;
|
|
89
|
+
} | {
|
|
90
|
+
kind: "union";
|
|
91
|
+
members: ({
|
|
92
|
+
kind: "scalar";
|
|
93
|
+
codecId: string;
|
|
94
|
+
typeParams?: Record<string, unknown>;
|
|
95
|
+
} | {
|
|
96
|
+
kind: "valueObject";
|
|
97
|
+
plane: "storage";
|
|
98
|
+
namespaceId: string;
|
|
99
|
+
entityKind: "valueObject";
|
|
100
|
+
entityName: string;
|
|
101
|
+
})[];
|
|
102
|
+
};
|
|
103
|
+
many?: false | {
|
|
104
|
+
elementNullable: boolean;
|
|
105
|
+
};
|
|
106
|
+
dict?: true;
|
|
107
|
+
valueSet?: {
|
|
108
|
+
plane: "storage";
|
|
109
|
+
namespaceId: string;
|
|
110
|
+
entityKind: "valueSet";
|
|
111
|
+
entityName: string;
|
|
112
|
+
spaceId?: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
}, {}>;
|
|
117
|
+
//#endregion
|
|
4
118
|
//#region src/domain-namespace-access.d.ts
|
|
5
119
|
/**
|
|
6
120
|
* Models map for the contract's single domain namespace. Throws when the
|
|
@@ -8,11 +122,6 @@ import { n as ContractExecutionSection } from "./contract-types-DEIEpzU_-DvAVuBr
|
|
|
8
122
|
* ambiguous across namespaces and must be qualified explicitly (TML-2550).
|
|
9
123
|
*/
|
|
10
124
|
declare function domainModelsAtDefaultNamespace(domain: ApplicationDomain): Record<string, ContractModelBase>;
|
|
11
|
-
/**
|
|
12
|
-
* Value objects for the contract's single domain namespace, when present.
|
|
13
|
-
* Throws when the contract does not declare exactly one namespace.
|
|
14
|
-
*/
|
|
15
|
-
declare function domainValueObjectsAtDefaultNamespace(domain: ApplicationDomain): Record<string, ContractValueObject> | undefined;
|
|
16
125
|
//#endregion
|
|
17
126
|
//#region src/execution-section-schema.d.ts
|
|
18
127
|
declare const ContractExecutionSectionSchema: import("arktype/internal/variants/object.ts").ObjectType<ContractExecutionSection, {}>;
|
|
@@ -66,15 +175,17 @@ type NullableFlag<Entry> = Entry extends {
|
|
|
66
175
|
} ? true : false;
|
|
67
176
|
type ClosedWhenEmpty<T> = [keyof T] extends [never] ? Record<string, never> : T;
|
|
68
177
|
type InputClosedWhenEmpty<Side extends ValueTypeSide, T> = Side extends 'input' ? ClosedWhenEmpty<T> : T;
|
|
69
|
-
type
|
|
70
|
-
readonly
|
|
71
|
-
readonly overrides:
|
|
178
|
+
type ContractParts<StorageNamespaces, Overrides> = {
|
|
179
|
+
readonly storage: StorageNamespaces;
|
|
180
|
+
readonly overrides: Overrides;
|
|
72
181
|
};
|
|
73
|
-
type
|
|
182
|
+
type ValueObjectFields<Ns, Name, Parts> = Lookup<Lookup<Lookup<Lookup<Lookup<Lookup<Parts, 'storage'>, Ns>, 'entries'>, 'valueObject'>, Name>, 'fields'>;
|
|
183
|
+
type ValueObjectType<Ns, Name, Parts, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Side extends ValueTypeSide> = ClosedWhenEmpty<{ readonly [F in keyof ValueObjectFields<Ns, Name, Parts>]: FieldValueType<ValueObjectFields<Ns, Name, Parts>[F], Lookup<Lookup<Lookup<Lookup<Lookup<Parts, 'overrides'>, Ns>, 'valueObjects'>, Name>, F>, Parts, CodecTypes, ParameterizedOutputs, Side>; }>;
|
|
74
184
|
type ElementType<FieldType, Parts, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Side extends ValueTypeSide> = FieldType extends {
|
|
75
185
|
readonly kind: 'valueObject';
|
|
76
|
-
readonly
|
|
77
|
-
|
|
186
|
+
readonly namespaceId: infer Ns;
|
|
187
|
+
readonly entityName: infer Name;
|
|
188
|
+
} ? ValueObjectType<Ns, Name, Parts, CodecTypes, ParameterizedOutputs, Side> : FieldType extends {
|
|
78
189
|
readonly kind: 'union';
|
|
79
190
|
readonly members: infer Members extends readonly unknown[];
|
|
80
191
|
} ? UnionMemberType<Members[number], Parts, CodecTypes, ParameterizedOutputs, Side> : unknown;
|
|
@@ -98,34 +209,43 @@ type FieldValueType<Field, Override, Parts, CodecTypes, ParameterizedOutputs ext
|
|
|
98
209
|
} ? ScalarValueType<CodecId, TypeParams, Override, NullableFlag<Field>, Many, Dictionary, CodecTypes, ParameterizedOutputs, Side> : Field extends {
|
|
99
210
|
readonly type: {
|
|
100
211
|
readonly kind: 'valueObject';
|
|
101
|
-
readonly
|
|
212
|
+
readonly namespaceId: infer Ns;
|
|
213
|
+
readonly entityName: infer Name;
|
|
102
214
|
};
|
|
103
215
|
readonly many?: infer Many;
|
|
104
216
|
readonly dict?: infer Dictionary;
|
|
105
|
-
} ? WithModifiers<BaseType<Override, ValueObjectType<Name, Parts, CodecTypes, ParameterizedOutputs, Side>, Side>, NullableFlag<Field>, Many, Dictionary> : Field extends {
|
|
217
|
+
} ? WithModifiers<BaseType<Override, ValueObjectType<Ns, Name, Parts, CodecTypes, ParameterizedOutputs, Side>, Side>, NullableFlag<Field>, Many, Dictionary> : Field extends {
|
|
106
218
|
readonly type: infer FieldType;
|
|
107
219
|
readonly many?: infer Many;
|
|
108
220
|
readonly dict?: infer Dictionary;
|
|
109
221
|
} ? WithModifiers<BaseType<Override, ElementType<FieldType, Parts, CodecTypes, ParameterizedOutputs, Side>, Side>, NullableFlag<Field>, Many, Dictionary> : never;
|
|
110
|
-
type NamespacePartsOf<DomainNamespaces, Ns, Overrides> = NamespaceParts<Lookup<Lookup<DomainNamespaces, Ns>, 'valueObjects'>, Lookup<Overrides, Ns>>;
|
|
111
222
|
/**
|
|
112
|
-
* `FieldOutputTypes` (`Side` `'output'`) or `FieldInputTypes` (`'input'`) of a contract whose domain namespaces are `DomainNamespaces`, computed from the contract's literal shape. Both an emitted `contract.d.ts` and a contract written with `defineContract` type their fields through it.
|
|
223
|
+
* `FieldOutputTypes` (`Side` `'output'`) or `FieldInputTypes` (`'input'`) of a contract whose domain namespaces are `DomainNamespaces` and whose storage namespaces are `StorageNamespaces`, computed from the contract's literal shape. It reads both planes: the domain for the fields, and storage for the value objects the fields refer to, so it always takes both. Both an emitted `contract.d.ts` and a contract written with `defineContract` type their fields through it.
|
|
113
224
|
*
|
|
114
225
|
* Each value is typed by, in order:
|
|
115
226
|
*
|
|
116
|
-
* 1. its override for that side, `{ output?, input? }`, from `Overrides` at `[namespace]['models'][model][field]` for a model field, or at `[namespace]['valueObjects'][valueObject][field]` for a value object field. An override is the type of a field that the contract's shape and the codec types cannot give: the members of the value set it holds, the type its codec renders as text, or the type a family's storage entry gives it;
|
|
227
|
+
* 1. its override for that side, `{ output?, input? }`, from `Overrides` at `[namespace]['models'][model][field]` for a model field, or at `[storage namespace]['valueObjects'][valueObject][field]` for a value object field. An override is the type of a field that the contract's shape and the codec types cannot give: the members of the value set it holds, the type its codec renders as text, or the type a family's storage entry gives it;
|
|
117
228
|
* 2. for a scalar field, on the output side, the type a pack's type function in `ParameterizedOutputs` gives it for its type parameters (`ParameterizedOutputType`), else its codec's `output` or `input` type, or `unknown` for a codec `CodecTypes` lacks;
|
|
118
|
-
* 3. for a value object field, an object of the value object
|
|
229
|
+
* 3. for a value object field, an object of the field types of the value object its reference names in `StorageNamespaces`, at `[namespaceId]['entries']['valueObject'][entityName]`, computed by these rules;
|
|
119
230
|
* 4. for a union field, the union of its members' types, each a codec's plain type or a value object's type;
|
|
120
231
|
*
|
|
121
232
|
* then wrapped in `ReadonlyArray` for a list and in `Readonly<Record<string, …>>` for a dictionary, with `null` for a nullable element or value. A model without fields has `{}` output types and `Record<string, never>` input types; a value object without fields has `Record<string, never>` on both sides.
|
|
122
233
|
*/
|
|
123
|
-
type FieldTypesFromDomain<DomainNamespaces, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Overrides, Side extends ValueTypeSide> = { readonly [Ns in keyof DomainNamespaces]: NamespaceFieldTypes<Lookup<DomainNamespaces[Ns], 'models'>,
|
|
124
|
-
type NamespaceFieldTypes<Models, Parts, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Side extends ValueTypeSide> = { readonly [M in keyof Models]: Lookup<Models[M], 'fields'> extends (infer Fields) ? [Fields] extends [never] ? never : InputClosedWhenEmpty<Side, { readonly [F in keyof Fields]: FieldValueType<Fields[F], Lookup<Lookup<Lookup<
|
|
234
|
+
type FieldTypesFromDomain<DomainNamespaces, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Overrides, Side extends ValueTypeSide, StorageNamespaces> = { readonly [Ns in keyof DomainNamespaces]: NamespaceFieldTypes<Lookup<DomainNamespaces[Ns], 'models'>, Lookup<Overrides, Ns>, ContractParts<StorageNamespaces, Overrides>, CodecTypes, ParameterizedOutputs, Side>; };
|
|
235
|
+
type NamespaceFieldTypes<Models, NamespaceOverrides, Parts, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Side extends ValueTypeSide> = { readonly [M in keyof Models]: Lookup<Models[M], 'fields'> extends (infer Fields) ? [Fields] extends [never] ? never : InputClosedWhenEmpty<Side, { readonly [F in keyof Fields]: FieldValueType<Fields[F], Lookup<Lookup<Lookup<NamespaceOverrides, 'models'>, M>, F>, Parts, CodecTypes, ParameterizedOutputs, Side>; }> : never; };
|
|
125
236
|
/**
|
|
126
|
-
* The output (`Side` `'output'`) or input (`'input'`) type of each value object of a contract whose
|
|
237
|
+
* The output (`Side` `'output'`) or input (`'input'`) type of each value object of a contract whose storage namespaces are `StorageNamespaces`, keyed by storage namespace and value object name, by the rules of {@link FieldTypesFromDomain}.
|
|
127
238
|
*/
|
|
128
|
-
type
|
|
239
|
+
type ValueObjectTypesFromStorage<StorageNamespaces, CodecTypes, ParameterizedOutputs extends ParameterizedOutputTypesFunction, Overrides, Side extends ValueTypeSide> = { readonly [Ns in keyof StorageNamespaces]: { readonly [V in keyof Lookup<Lookup<StorageNamespaces[Ns], 'entries'>, 'valueObject'>]: ValueObjectType<Ns, V, ContractParts<StorageNamespaces, Overrides>, CodecTypes, ParameterizedOutputs, Side>; }; };
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/storage-value-objects.d.ts
|
|
242
|
+
/** The storage value object a reference names, or `undefined` when storage does not have it. */
|
|
243
|
+
declare function valueObjectAt(storage: Pick<StorageBase, 'namespaces'>, reference: EntityCoordinate<'storage', 'valueObject'>): ContractValueObject | undefined;
|
|
244
|
+
/** Each value object in storage, in every namespace, with its coordinate. */
|
|
245
|
+
declare function valueObjectsWithCoordinates(storage: Pick<StorageBase, 'namespaces'>): ReadonlyArray<{
|
|
246
|
+
readonly coordinate: EntityCoordinate<'storage', 'valueObject'>;
|
|
247
|
+
readonly valueObject: ContractValueObject;
|
|
248
|
+
}>;
|
|
129
249
|
//#endregion
|
|
130
|
-
export {
|
|
131
|
-
//# sourceMappingURL=types-
|
|
250
|
+
export { ContractValueObjectSchema as a, ParameterizedOutputType as c, ValueObjectTypesFromStorage as d, ValueTypeSide as f, valueObjectsWithCoordinates as h, ContractValueObjectFieldSchema as i, ParameterizedOutputTypesFunction as l, valueObjectAt as m, ContractExecutionSectionSchema as n, EnumMemberValueType as o, domainModelsAtDefaultNamespace as p, ContractFieldTypeSchema as r, FieldTypesFromDomain as s, ApplyParameterizedOutputTypes as t, StoredValueType as u };
|
|
251
|
+
//# sourceMappingURL=types-Dh_AMVRf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-Dh_AMVRf.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/types.d.mts"],"mappings":";;;;;;;;cASc,uEAAuE;EACnF;EACA;EACA,aAAa;;EAEb;EACA;EACA;EACA;EACA;;EAEA;EACA;IACE;IACA;IACA,aAAa;;IAEb;IACA;IACA;IACA;IACA;;;;cAIU,8EAA8E;EAC1F;EACA;IACE;IACA;IACA,aAAa;;IAEb;IACA;IACA;IACA;IACA;;IAEA;IACA;MACE;MACA;MACA,aAAa;;MAEb;MACA;MACA;MACA;MACA;;;EAGJ;IACE;;EAEF;EACA;IACE;IACA;IACA;IACA;IACA;;;;;;cAMU,yEAAyE;EACrF;KACG;MACC;MACA;QACE;QACA;QACA,aAAa;;QAEb;QACA;QACA;QACA;QACA;;QAEA;QACA;UACE;UACA;UACA,aAAa;;UAEb;UACA;UACA;UACA;UACA;;;MAGJ;QACE;;MAEF;MACA;QACE;QACA;QACA;QACA;QACA;;;;;;;;;;;;iBAYS,+BAA+B,QAAQ,oBAAoB,eAAe;;;cAG7E,8EAA8E,WAAW;;;;;;UAM7F;WACC,YAAY;WACZ,aAAa;;KAEnB,8BAA8B,qBAAqB,kCAAkC,mBAAmB,4BAA4B;WAC9H,YAAY;;KAElB,kBAAkB,cAAc,SAAS,mBAAmB,2BAA2B,qBAAqB,mCAAmC,8BAA8B,cAAc,2BAA2B,WAAW,sBAAsB,UAAU,QAAQ;;;;KAIzQ,wB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AAO,OAAO,aAAa,QAAQ,MAAM,cAAc;WACpJ,YAAY;WACZ,aAAa;WACb,aAAa;IACpB,cAAc,SAAS,UAAU,YAAY,WAAW,OAAO,YAAY,sBAAsB,OAAO,OAAO,aAAa,QAAQ,MAAM;;;;;;;;;;;;;KAazI,qBAAqB,kBAAkB,YAAY,6BAA6B,kCAAkC,WAAW,aAAa,eAAe,iCAAiC,YAAY,mBAAmB,oBAAoB,OAAO,iBAAiB,gBAAgB,OAAO,WAAW,KAAK,cAAc,mBAAmB,YAAY,YAAY,sBAAsB;KAC3X,oBAAoB,QAAQ,oBAAoB,OAAO,YAAY,6BAA6B,kCAAkC,aAAa,6BAA6B,WAAW,SAAS,OAAO,OAAO,6BAA6B,WAAW,kCAAkC,qBAAqB,kBAAkB,WAAW,SAAS,eAAe,OAAO,IAAI,OAAO,OAAO,OAAO,+BAA+B,IAAI,IAAI,OAAO,YAAY,sBAAsB;;;;KAIld,4BAA4B,mBAAmB,YAAY,6BAA6B,kCAAkC,WAAW,aAAa,6BAA6B,YAAY,gCAAgC,WAAW,OAAO,OAAO,kBAAkB,kCAAkC,gBAAgB,IAAI,GAAG,cAAc,mBAAmB,YAAY,YAAY,sBAAsB;;;;iBAIlY,cAAc,SAAS,KAAK,4BAA4B,WAAW,6CAA6C;;iBAEhH,4BAA4B,SAAS,KAAK,6BAA6B;WAC7E,YAAY;WACZ,aAAa"}
|
package/dist/{types-import-spec-Bkh243Hv-B-fdw0Wl.d.mts → types-import-spec-Bkh243Hv-BI9m5WFL.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as CodecTrait, m as CodecRef } from "./codec-types-B4wPvO-K-
|
|
1
|
+
import { v as JsonValue } from "./types-CkFfDIud-C1u8M2UE.mjs";
|
|
2
|
+
import { g as CodecTrait, m as CodecRef } from "./codec-types-B4wPvO-K-BIPFT7EP.mjs";
|
|
3
3
|
//#region ../../../1-framework/1-core/framework-components/dist/types-import-spec-Bkh243Hv.d.mts
|
|
4
4
|
//#region src/shared/aggregate-descriptor.d.ts
|
|
5
5
|
/**
|
|
@@ -110,4 +110,4 @@ interface TypesImportSpec {
|
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
112
|
export { AnyInputAggregateDescriptor as a, SelfAggregateOutput as c, aggregateDescriptorKey as d, isAggregateDescriptor as f, AggregateResultNullability as i, TypesImportSpec as l, isNoInputAggregateDescriptor as m, AggregateInputMatch as n, NamedAggregateOutput as o, isAnyInputAggregateDescriptor as p, AggregateOutputCodec as r, NoInputAggregateDescriptor as s, AggregateDescriptor as t, ValueInputAggregateDescriptor as u };
|
|
113
|
-
//# sourceMappingURL=types-import-spec-Bkh243Hv-
|
|
113
|
+
//# sourceMappingURL=types-import-spec-Bkh243Hv-BI9m5WFL.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-import-spec-Bkh243Hv-
|
|
1
|
+
{"version":3,"file":"types-import-spec-Bkh243Hv-BI9m5WFL.d.mts","names":[],"sources":["../../../../1-framework/1-core/framework-components/dist/types-import-spec-Bkh243Hv.d.mts"],"mappings":";;;;;;;;;;;;;;KAaK;WACM;;WAEA;WACA;;WAEA;WACA,OAAO;;WAEP;;;;;;;UAOD;WACC;WACA;WACA,cAAc,OAAO,yBAAyB;;;UAG/C;WACC;;;KAGN,uBAAuB,sBAAsB;;;;;;KAM7C;WACM;;WAEA;WACA;;KAEN,0BAA0B;;WAEpB;;;KAGN,6BAA6B;WACvB;aACE;;WAEF,QAAQ;;;KAGd,8BAA8B;WACxB;aACE;;WAEF,QAAQ;;;KAGd,gCAAgC;WAC1B;aACE;aACA;;aAEA;aACA,OAAO;;WAET,QAAQ;;;;;;;KAOd,sBAAsB,6BAA6B,8BAA8B;;;;iBAIrE,uBAAuB,YAAY;;iBAEnC,6BAA6B,YAAY,sBAAsB,cAAc;;iBAE7E,8BAA8B,YAAY,sBAAsB,cAAc;;;;iBAI9E,sBAAsB,iBAAiB,SAAS;;;;;;;UAOvD;WACC;WACA;WACA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as ContractValidationError } from "./contract-validation-error-CAnTGhkt-DSnujRaK.mjs";
|
|
2
|
-
import { t as
|
|
2
|
+
import { t as isPlainRecord } from "./is-plain-record-CUofyVQ7-DWEzdhIx.mjs";
|
|
3
3
|
import { t as asNamespaceId } from "./namespace-id-asbWpwMw-3yxn-tRe.mjs";
|
|
4
|
+
import { n as fieldModifierProblems, r as valueObjectTypeProblems, t as fieldLike } from "./field-problems-DMpmScuG-R70w-aDk.mjs";
|
|
4
5
|
//#region ../../../1-framework/0-foundation/contract/dist/validate-domain.mjs
|
|
5
6
|
function indexDomainModels(contract) {
|
|
6
7
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -25,8 +26,17 @@ function lookupModel(index, ref) {
|
|
|
25
26
|
function* iterateIndexedModels(index) {
|
|
26
27
|
for (const modelsInNamespace of index.values()) for (const entry of modelsInNamespace.values()) yield entry;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The keys an older contract stores in its domain plane that a contract no longer has: value objects, which are storage entities since ADR 309. A family's structural validation reports these before anything else, so an old contract is refused with a message that says to re-emit it.
|
|
31
|
+
*/
|
|
32
|
+
function removedDomainKeyProblems(contract) {
|
|
33
|
+
if (!isPlainRecord(contract) || !isPlainRecord(contract["domain"])) return [];
|
|
34
|
+
const namespaces = contract["domain"]["namespaces"];
|
|
35
|
+
if (!isPlainRecord(namespaces)) return [];
|
|
36
|
+
return Object.entries(namespaces).flatMap(([namespaceId, namespace]) => isPlainRecord(namespace) && Object.hasOwn(namespace, "valueObjects") ? [`domain.namespaces.${namespaceId}.valueObjects: contracts no longer store value objects in the domain plane; they are storage entities under storage.namespaces.<namespace>.entries.valueObject, so re-emit the contract from its source, or rewrite a stored contract such as a migration snapshot with value-objects-in-storage.ts, which ships in the value-objects-in-storage scripts of the Prisma 8 upgrade guide`] : []);
|
|
37
|
+
}
|
|
28
38
|
function validateContractDomain(contract) {
|
|
29
|
-
const errors = [];
|
|
39
|
+
const errors = [...removedDomainKeyProblems(contract)];
|
|
30
40
|
const modelIndex = indexDomainModels(contract);
|
|
31
41
|
validateRoots(contract, modelIndex, errors);
|
|
32
42
|
validateVariantsAndBases(modelIndex, errors);
|
|
@@ -35,7 +45,7 @@ function validateContractDomain(contract) {
|
|
|
35
45
|
validateDiscriminators(modelIndex, errors);
|
|
36
46
|
validateOwnership(contract, modelIndex, errors);
|
|
37
47
|
validateValueObjectReferences(contract, errors);
|
|
38
|
-
validateFieldModifiers(modelIndex,
|
|
48
|
+
validateFieldModifiers(modelIndex, errors);
|
|
39
49
|
if (errors.length > 0) throw new ContractValidationError(`Contract domain validation failed:\n- ${errors.join("\n- ")}`, "domain");
|
|
40
50
|
}
|
|
41
51
|
function validateRoots(contract, modelIndex, errors) {
|
|
@@ -123,42 +133,15 @@ function validateOwnership(contract, modelIndex, errors) {
|
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
function validateValueObjectReferences(contract, errors) {
|
|
126
|
-
const voNamesByNamespace = /* @__PURE__ */ new Map();
|
|
127
|
-
for (const [namespaceKey, namespace] of Object.entries(contract.domain.namespaces)) {
|
|
128
|
-
const namespaceId = asNamespaceId(namespaceKey);
|
|
129
|
-
voNamesByNamespace.set(namespaceId, new Set(Object.keys(namespace.valueObjects ?? {})));
|
|
130
|
-
}
|
|
131
|
-
function checkType(type, location, namespaceId) {
|
|
132
|
-
if (!type) return;
|
|
133
|
-
const voNames = voNamesByNamespace.get(namespaceId) ?? /* @__PURE__ */ new Set();
|
|
134
|
-
if (type.kind === "valueObject" && type.name && !voNames.has(type.name)) {
|
|
135
|
-
errors.push(`${location} references value object "${namespaceId}:${type.name}" which does not exist in that namespace's valueObjects`);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (type.kind === "union") for (const member of type.members ?? []) checkType(member, location, namespaceId);
|
|
139
|
-
}
|
|
140
136
|
for (const [namespaceKey, namespace] of Object.entries(contract.domain.namespaces)) {
|
|
141
137
|
const namespaceId = asNamespaceId(namespaceKey);
|
|
142
|
-
for (const [modelName, model] of Object.entries(namespace.models)) for (const [fieldName, field] of Object.entries(model.fields))
|
|
143
|
-
for (const [voName, vo] of Object.entries(namespace.valueObjects ?? {})) for (const [fieldName, field] of Object.entries(vo.fields)) checkType(blindCast(field)?.type, `Value object "${namespaceId}:${voName}" field "${fieldName}"`, namespaceId);
|
|
138
|
+
for (const [modelName, model] of Object.entries(namespace.models)) for (const [fieldName, field] of Object.entries(model.fields)) errors.push(...valueObjectTypeProblems(contract.storage, fieldLike(field)?.type, `Model "${namespaceId}:${modelName}" field "${fieldName}"`));
|
|
144
139
|
}
|
|
145
140
|
}
|
|
146
|
-
function validateFieldModifiers(modelIndex,
|
|
147
|
-
|
|
148
|
-
const candidate = blindCast(field);
|
|
149
|
-
const many = candidate?.many;
|
|
150
|
-
const isList = typeof many === "object" && many !== null && !Array.isArray(many) && Object.keys(many).length === 1 && "elementNullable" in many && typeof many.elementNullable === "boolean";
|
|
151
|
-
if (many !== void 0 && many !== false && !isList) errors.push(`${location} has invalid "many"; expected false or an elementNullable descriptor`);
|
|
152
|
-
if (candidate?.elementNullable !== void 0) errors.push(`${location} cannot have sibling "elementNullable"; put it inside "many"`);
|
|
153
|
-
if (isList && candidate?.dict) errors.push(`${location} cannot have both "many" and "dict" modifiers`);
|
|
154
|
-
}
|
|
155
|
-
for (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) for (const [fieldName, field] of Object.entries(model.fields)) validateField(`Model "${namespaceId}:${modelName}" field "${fieldName}"`, field);
|
|
156
|
-
for (const [namespaceKey, namespace] of Object.entries(contract.domain.namespaces)) {
|
|
157
|
-
const namespaceId = asNamespaceId(namespaceKey);
|
|
158
|
-
for (const [voName, vo] of Object.entries(namespace.valueObjects ?? {})) for (const [fieldName, field] of Object.entries(vo.fields)) validateField(`Value object "${namespaceId}:${voName}" field "${fieldName}"`, field);
|
|
159
|
-
}
|
|
141
|
+
function validateFieldModifiers(modelIndex, errors) {
|
|
142
|
+
for (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) for (const [fieldName, field] of Object.entries(model.fields)) errors.push(...fieldModifierProblems(`Model "${namespaceId}:${modelName}" field "${fieldName}"`, field));
|
|
160
143
|
}
|
|
161
144
|
//#endregion
|
|
162
|
-
export { validateContractDomain as t };
|
|
145
|
+
export { validateContractDomain as n, removedDomainKeyProblems as t };
|
|
163
146
|
|
|
164
|
-
//# sourceMappingURL=validate-domain-
|
|
147
|
+
//# sourceMappingURL=validate-domain-KUhPCj7i.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-domain-KUhPCj7i.mjs","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/validate-domain.mjs"],"sourcesContent":["import { t as asNamespaceId } from \"./namespace-id-asbWpwMw.mjs\";\nimport { t as isPlainRecord } from \"./is-plain-record-CUofyVQ7.mjs\";\nimport { t as ContractValidationError } from \"./contract-validation-error-CAnTGhkt.mjs\";\nimport { n as fieldModifierProblems, r as valueObjectTypeProblems, t as fieldLike } from \"./field-problems-DMpmScuG.mjs\";\n//#region src/validate-domain.ts\nfunction indexDomainModels(contract) {\n\tconst index = /* @__PURE__ */ new Map();\n\tfor (const [namespaceKey, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst namespaceId = asNamespaceId(namespaceKey);\n\t\tlet modelsInNamespace = index.get(namespaceId);\n\t\tif (modelsInNamespace === void 0) {\n\t\t\tmodelsInNamespace = /* @__PURE__ */ new Map();\n\t\t\tindex.set(namespaceId, modelsInNamespace);\n\t\t}\n\t\tfor (const [name, model] of Object.entries(namespace.models)) modelsInNamespace.set(name, {\n\t\t\tnamespaceId,\n\t\t\tname,\n\t\t\tmodel\n\t\t});\n\t}\n\treturn index;\n}\nfunction lookupModel(index, ref) {\n\treturn index.get(ref.namespace)?.get(ref.model);\n}\nfunction* iterateIndexedModels(index) {\n\tfor (const modelsInNamespace of index.values()) for (const entry of modelsInNamespace.values()) yield entry;\n}\n/**\n* The keys an older contract stores in its domain plane that a contract no longer has: value objects, which are storage entities since ADR 309. A family's structural validation reports these before anything else, so an old contract is refused with a message that says to re-emit it.\n*/\nfunction removedDomainKeyProblems(contract) {\n\tif (!isPlainRecord(contract) || !isPlainRecord(contract[\"domain\"])) return [];\n\tconst namespaces = contract[\"domain\"][\"namespaces\"];\n\tif (!isPlainRecord(namespaces)) return [];\n\treturn Object.entries(namespaces).flatMap(([namespaceId, namespace]) => isPlainRecord(namespace) && Object.hasOwn(namespace, \"valueObjects\") ? [`domain.namespaces.${namespaceId}.valueObjects: contracts no longer store value objects in the domain plane; they are storage entities under storage.namespaces.<namespace>.entries.valueObject, so re-emit the contract from its source, or rewrite a stored contract such as a migration snapshot with value-objects-in-storage.ts, which ships in the value-objects-in-storage scripts of the Prisma 8 upgrade guide`] : []);\n}\nfunction validateContractDomain(contract) {\n\tconst errors = [...removedDomainKeyProblems(contract)];\n\tconst modelIndex = indexDomainModels(contract);\n\tvalidateRoots(contract, modelIndex, errors);\n\tvalidateVariantsAndBases(modelIndex, errors);\n\tvalidateRelationTargets(modelIndex, errors);\n\tvalidateRelationNullability(modelIndex, errors);\n\tvalidateDiscriminators(modelIndex, errors);\n\tvalidateOwnership(contract, modelIndex, errors);\n\tvalidateValueObjectReferences(contract, errors);\n\tvalidateFieldModifiers(modelIndex, errors);\n\tif (errors.length > 0) throw new ContractValidationError(`Contract domain validation failed:\\n- ${errors.join(\"\\n- \")}`, \"domain\");\n}\nfunction validateRoots(contract, modelIndex, errors) {\n\tconst seenRootTargets = /* @__PURE__ */ new Map();\n\tfor (const [rootKey, crossRef] of Object.entries(contract.roots)) {\n\t\tlet modelsInNamespace = seenRootTargets.get(crossRef.namespace);\n\t\tif (modelsInNamespace === void 0) {\n\t\t\tmodelsInNamespace = /* @__PURE__ */ new Set();\n\t\t\tseenRootTargets.set(crossRef.namespace, modelsInNamespace);\n\t\t}\n\t\tif (modelsInNamespace.has(crossRef.model)) errors.push(`Duplicate root value: \"${crossRef.namespace}:${crossRef.model}\" is mapped by multiple root keys`);\n\t\tmodelsInNamespace.add(crossRef.model);\n\t\tif (!lookupModel(modelIndex, crossRef)) errors.push(`Root \"${rootKey}\" references model \"${crossRef.namespace}:${crossRef.model}\" which does not exist in domain.namespaces`);\n\t}\n}\nfunction validateVariantsAndBases(modelIndex, errors) {\n\tfor (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) {\n\t\tif (model.variants) {\n\t\t\tconst valuesByVariant = /* @__PURE__ */ new Map();\n\t\t\tfor (const [value, variantRef] of Object.entries(model.variants)) {\n\t\t\t\tconst variantKey = JSON.stringify([variantRef.namespace, variantRef.model]);\n\t\t\t\tconst earlierValue = valuesByVariant.get(variantKey);\n\t\t\t\tif (earlierValue !== void 0) errors.push(`Model \"${namespaceId}:${modelName}\" lists variant \"${variantRef.namespace}:${variantRef.model}\" under both discriminator values \"${earlierValue}\" and \"${value}\"`);\n\t\t\t\tvaluesByVariant.set(variantKey, value);\n\t\t\t\tconst variantEntry = lookupModel(modelIndex, variantRef);\n\t\t\t\tif (!variantEntry) {\n\t\t\t\t\terrors.push(`Model \"${namespaceId}:${modelName}\" lists variant \"${variantRef.namespace}:${variantRef.model}\" which does not exist in domain.namespaces`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst variantBase = variantEntry.model.base;\n\t\t\t\tif (variantBase?.namespace !== namespaceId || variantBase?.model !== modelName) errors.push(`Variant \"${variantRef.namespace}:${variantRef.model}\" has base \"${variantBase?.namespace ?? \"?\"}:${variantBase?.model ?? \"(none)\"}\" but expected \"${namespaceId}:${modelName}\"`);\n\t\t\t}\n\t\t}\n\t\tif (model.base) {\n\t\t\tconst baseEntry = lookupModel(modelIndex, model.base);\n\t\t\tif (!baseEntry) {\n\t\t\t\terrors.push(`Model \"${namespaceId}:${modelName}\" has base \"${model.base.namespace}:${model.base.model}\" which does not exist in domain.namespaces`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!Object.values(baseEntry.model.variants ?? {}).some((ref) => ref.namespace === namespaceId && ref.model === modelName)) errors.push(`Model \"${namespaceId}:${modelName}\" has base \"${model.base.namespace}:${model.base.model}\" which does not list it as a variant`);\n\t\t}\n\t}\n}\nfunction validateRelationTargets(modelIndex, errors) {\n\tfor (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) for (const [relName, relation] of Object.entries(model.relations ?? {})) {\n\t\tif (relation.to.space !== void 0) continue;\n\t\tif (!lookupModel(modelIndex, relation.to)) errors.push(`Relation \"${relName}\" on model \"${namespaceId}:${modelName}\" targets \"${relation.to.namespace}:${relation.to.model}\" which does not exist in domain.namespaces`);\n\t}\n}\nfunction relationKindLabel(relation) {\n\treturn relation.on === void 0 ? \"embed relation\" : `${relation.cardinality} relation`;\n}\nfunction validateRelationNullability(modelIndex, errors) {\n\tfor (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) for (const [relName, relation] of Object.entries(model.relations ?? {})) {\n\t\tconst location = `Relation \"${relName}\" on model \"${namespaceId}:${modelName}\"`;\n\t\tif (relation.on !== void 0 && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\")) {\n\t\t\tif (relation.nullable !== void 0 && typeof relation.nullable !== \"boolean\") errors.push(`${location} is a ${relation.cardinality} relation and its \"nullable\" must be a boolean`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (relation.nullable !== void 0) errors.push(`${location} is a ${relationKindLabel(relation)} and must not carry \"nullable\"`);\n\t}\n}\nfunction validateDiscriminators(modelIndex, errors) {\n\tfor (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) {\n\t\tif (model.discriminator) {\n\t\t\tif (!model.variants || Object.keys(model.variants).length === 0) errors.push(`Model \"${namespaceId}:${modelName}\" has discriminator but no variants`);\n\t\t\tif (!Object.hasOwn(model.fields, model.discriminator.field)) errors.push(`Discriminator field \"${model.discriminator.field}\" is not a field on model \"${namespaceId}:${modelName}\"`);\n\t\t}\n\t\tif (model.variants && Object.keys(model.variants).length > 0 && !model.discriminator) errors.push(`Model \"${namespaceId}:${modelName}\" has variants but no discriminator`);\n\t\tif (model.base) {\n\t\t\tif (model.discriminator) errors.push(`Model \"${namespaceId}:${modelName}\" has base and must not have discriminator`);\n\t\t\tif (model.variants && Object.keys(model.variants).length > 0) errors.push(`Model \"${namespaceId}:${modelName}\" has base and must not have variants`);\n\t\t}\n\t}\n}\nfunction validateOwnership(contract, modelIndex, errors) {\n\tfor (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) {\n\t\tif (!model.owner) continue;\n\t\tif (model.owner === modelName) errors.push(`Model \"${namespaceId}:${modelName}\" cannot own itself`);\n\t\tif (!lookupModel(modelIndex, {\n\t\t\tnamespace: namespaceId,\n\t\t\tmodel: model.owner\n\t\t})) errors.push(`Model \"${namespaceId}:${modelName}\" has owner \"${namespaceId}:${model.owner}\" which does not exist in domain.namespaces`);\n\t\tfor (const [rootKey, rootRef] of Object.entries(contract.roots)) if (rootRef.namespace === namespaceId && rootRef.model === modelName) errors.push(`Owned model \"${namespaceId}:${modelName}\" must not appear in roots (found as root \"${rootKey}\")`);\n\t}\n}\nfunction validateValueObjectReferences(contract, errors) {\n\tfor (const [namespaceKey, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst namespaceId = asNamespaceId(namespaceKey);\n\t\tfor (const [modelName, model] of Object.entries(namespace.models)) for (const [fieldName, field] of Object.entries(model.fields)) errors.push(...valueObjectTypeProblems(contract.storage, fieldLike(field)?.type, `Model \"${namespaceId}:${modelName}\" field \"${fieldName}\"`));\n\t}\n}\nfunction validateFieldModifiers(modelIndex, errors) {\n\tfor (const { namespaceId, name: modelName, model } of iterateIndexedModels(modelIndex)) for (const [fieldName, field] of Object.entries(model.fields)) errors.push(...fieldModifierProblems(`Model \"${namespaceId}:${modelName}\" field \"${fieldName}\"`, field));\n}\n//#endregion\nexport { removedDomainKe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M,EAAE,aAAa,MAAM,WAAW,WAAW,qBAAqB,UAAU,GAAG,KAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,MAAM,MAAM,GAAG,OAAO,KAAK,GAAG,sBAAsB,UAAU,YAAY,GAAG,UAAU,WAAW,UAAU,IAAI,KAAK,CAAC;AAC/P"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as ContractWithDomain, x as CrossReference } from "./domain-envelope-CJNIHBn_-DBFAmkNL.mjs";
|
|
2
2
|
//#region ../../../1-framework/0-foundation/contract/dist/validate-domain.d.mts
|
|
3
3
|
//#region src/validate-domain.d.ts
|
|
4
4
|
interface DomainRelationShape {
|
|
@@ -20,7 +20,11 @@ interface DomainModelShape {
|
|
|
20
20
|
interface DomainContractShape extends ContractWithDomain {
|
|
21
21
|
readonly roots: Record<string, CrossReference>;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The keys an older contract stores in its domain plane that a contract no longer has: value objects, which are storage entities since ADR 309. A family's structural validation reports these before anything else, so an old contract is refused with a message that says to re-emit it.
|
|
25
|
+
*/
|
|
26
|
+
declare function removedDomainKeyProblems(contract: unknown): readonly string[];
|
|
23
27
|
declare function validateContractDomain(contract: DomainContractShape): void;
|
|
24
28
|
//#endregion
|
|
25
|
-
export { DomainModelShape as n,
|
|
26
|
-
//# sourceMappingURL=validate-domain-
|
|
29
|
+
export { validateContractDomain as i, DomainModelShape as n, removedDomainKeyProblems as r, DomainContractShape as t };
|
|
30
|
+
//# sourceMappingURL=validate-domain-eU07L3vi.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-domain-
|
|
1
|
+
{"version":3,"file":"validate-domain-eU07L3vi.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/validate-domain.d.mts"],"mappings":";;;UAEU;WACC,IAAI;WACJ;WACA;WACA;;UAED;WACC,QAAQ;WACR,YAAY,eAAe;WAC3B;aACE;;WAEF,WAAW,eAAe;WAC1B,OAAO;WACP;;UAED,4BAA4B;WAC3B,OAAO,eAAe;;;;;iBAKhB,yBAAyB;iBACzB,uBAAuB,UAAU"}
|