@prisma-next/contract 0.3.0-dev.14 → 0.3.0-dev.140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +42 -6
  3. package/dist/hashing-CVS9sXxd.mjs +215 -0
  4. package/dist/hashing-CVS9sXxd.mjs.map +1 -0
  5. package/dist/hashing.d.mts +38 -0
  6. package/dist/hashing.d.mts.map +1 -0
  7. package/dist/hashing.mjs +3 -0
  8. package/dist/testing.d.mts +28 -0
  9. package/dist/testing.d.mts.map +1 -0
  10. package/dist/testing.mjs +56 -0
  11. package/dist/testing.mjs.map +1 -0
  12. package/dist/types-D-iOS0Ks.d.mts +511 -0
  13. package/dist/types-D-iOS0Ks.d.mts.map +1 -0
  14. package/dist/types-DokLaU9G.mjs +30 -0
  15. package/dist/types-DokLaU9G.mjs.map +1 -0
  16. package/dist/types.d.mts +2 -0
  17. package/dist/types.mjs +3 -0
  18. package/dist/validate-contract.d.mts +35 -0
  19. package/dist/validate-contract.d.mts.map +1 -0
  20. package/dist/validate-contract.mjs +61 -0
  21. package/dist/validate-contract.mjs.map +1 -0
  22. package/dist/validate-domain-CTQiBiei.mjs +84 -0
  23. package/dist/validate-domain-CTQiBiei.mjs.map +1 -0
  24. package/dist/validate-domain.d.mts +24 -0
  25. package/dist/validate-domain.d.mts.map +1 -0
  26. package/dist/validate-domain.mjs +3 -0
  27. package/package.json +25 -25
  28. package/schemas/data-contract-document-v1.json +5 -5
  29. package/src/canonicalization.ts +286 -0
  30. package/src/contract-types.ts +54 -0
  31. package/src/domain-types.ts +85 -0
  32. package/src/exports/hashing.ts +6 -0
  33. package/src/exports/testing.ts +1 -0
  34. package/src/exports/types.ts +54 -7
  35. package/src/exports/validate-contract.ts +5 -0
  36. package/src/exports/validate-domain.ts +6 -0
  37. package/src/hashing.ts +69 -0
  38. package/src/testing-factories.ts +93 -0
  39. package/src/types.ts +292 -35
  40. package/src/validate-contract.ts +93 -0
  41. package/src/validate-domain.ts +205 -0
  42. package/dist/exports/framework-components.d.ts +0 -3
  43. package/dist/exports/framework-components.d.ts.map +0 -1
  44. package/dist/exports/framework-components.js +0 -24
  45. package/dist/exports/framework-components.js.map +0 -1
  46. package/dist/exports/ir.d.ts +0 -2
  47. package/dist/exports/ir.d.ts.map +0 -1
  48. package/dist/exports/ir.js +0 -35
  49. package/dist/exports/ir.js.map +0 -1
  50. package/dist/exports/pack-manifest-types.d.ts +0 -2
  51. package/dist/exports/pack-manifest-types.d.ts.map +0 -1
  52. package/dist/exports/pack-manifest-types.js +0 -1
  53. package/dist/exports/pack-manifest-types.js.map +0 -1
  54. package/dist/exports/types.d.ts +0 -3
  55. package/dist/exports/types.d.ts.map +0 -1
  56. package/dist/exports/types.js +0 -8
  57. package/dist/exports/types.js.map +0 -1
  58. package/dist/framework-components.d.ts +0 -408
  59. package/dist/framework-components.d.ts.map +0 -1
  60. package/dist/ir.d.ts +0 -76
  61. package/dist/ir.d.ts.map +0 -1
  62. package/dist/types.d.ts +0 -222
  63. package/dist/types.d.ts.map +0 -1
  64. package/src/exports/framework-components.ts +0 -26
  65. package/src/exports/ir.ts +0 -1
  66. package/src/exports/pack-manifest-types.ts +0 -6
  67. package/src/framework-components.ts +0 -525
  68. package/src/ir.ts +0 -113
@@ -0,0 +1,56 @@
1
+ import { n as coreHash } from "./types-DokLaU9G.mjs";
2
+ import { n as computeProfileHash, r as computeStorageHash, t as computeExecutionHash } from "./hashing-CVS9sXxd.mjs";
3
+
4
+ //#region src/testing-factories.ts
5
+ const DUMMY_HASH = coreHash("sha256:test");
6
+ function createContract(overrides = {}) {
7
+ const target = overrides.target ?? "postgres";
8
+ const targetFamily = overrides.targetFamily ?? "sql";
9
+ const capabilities = overrides.capabilities ?? {};
10
+ const rawStorage = overrides.storage ?? { tables: {} };
11
+ const storageHash = computeStorageHash({
12
+ target,
13
+ targetFamily,
14
+ storage: rawStorage
15
+ });
16
+ const storage = {
17
+ ...rawStorage,
18
+ storageHash
19
+ };
20
+ const computedProfileHash = overrides.profileHash ?? computeProfileHash({
21
+ target,
22
+ targetFamily,
23
+ capabilities
24
+ });
25
+ return {
26
+ target,
27
+ targetFamily,
28
+ roots: overrides.roots ?? {},
29
+ models: overrides.models ?? {},
30
+ storage,
31
+ capabilities,
32
+ extensionPacks: overrides.extensionPacks ?? {},
33
+ ...overrides.execution !== void 0 ? { execution: {
34
+ ...overrides.execution,
35
+ executionHash: computeExecutionHash({
36
+ target,
37
+ targetFamily,
38
+ execution: overrides.execution
39
+ })
40
+ } } : {},
41
+ profileHash: computedProfileHash,
42
+ meta: overrides.meta ?? {}
43
+ };
44
+ }
45
+ function createSqlContract(overrides = {}) {
46
+ return createContract({
47
+ target: "postgres",
48
+ targetFamily: "sql",
49
+ storage: overrides.storage ?? { tables: {} },
50
+ ...overrides
51
+ });
52
+ }
53
+
54
+ //#endregion
55
+ export { DUMMY_HASH, createContract, createSqlContract };
56
+ //# sourceMappingURL=testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.mjs","names":[],"sources":["../src/testing-factories.ts"],"sourcesContent":["import type { Contract } from './contract-types';\nimport type { ContractModel, ModelStorageBase } from './domain-types';\nimport { computeExecutionHash, computeProfileHash, computeStorageHash } from './hashing';\nimport type { ExecutionSection, ProfileHashBase, StorageBase } from './types';\nimport { coreHash } from './types';\n\ntype ContractOverrides<\n TStorage extends StorageBase = StorageBase,\n TModels extends Record<string, ContractModel> = Record<string, ContractModel>,\n> = {\n target?: string;\n targetFamily?: string;\n roots?: Record<string, string>;\n models?: TModels;\n storage?: Omit<TStorage, 'storageHash'>;\n capabilities?: Record<string, Record<string, boolean>>;\n extensionPacks?: Record<string, unknown>;\n execution?: ExecutionSection;\n profileHash?: ProfileHashBase<string>;\n meta?: Record<string, unknown>;\n};\n\nconst DUMMY_HASH = coreHash('sha256:test');\n\nexport function createContract<\n TStorage extends StorageBase = StorageBase,\n TModels extends Record<string, ContractModel> = Record<string, ContractModel>,\n>(overrides: ContractOverrides<TStorage, TModels> = {}): Contract<TStorage, TModels> {\n const target = overrides.target ?? 'postgres';\n const targetFamily = overrides.targetFamily ?? 'sql';\n const capabilities = overrides.capabilities ?? {};\n\n const rawStorage =\n overrides.storage ?? ({ tables: {} } as unknown as Omit<TStorage, 'storageHash'>);\n\n const storageHash = computeStorageHash({\n target,\n targetFamily,\n storage: rawStorage as Record<string, unknown>,\n });\n\n const storage = {\n ...rawStorage,\n storageHash,\n } as TStorage;\n\n const computedProfileHash =\n overrides.profileHash ?? computeProfileHash({ target, targetFamily, capabilities });\n\n return {\n target,\n targetFamily,\n roots: overrides.roots ?? {},\n models: (overrides.models ?? {}) as TModels,\n storage,\n capabilities,\n extensionPacks: overrides.extensionPacks ?? {},\n ...(overrides.execution !== undefined\n ? {\n execution: {\n ...overrides.execution,\n executionHash: computeExecutionHash({\n target,\n targetFamily,\n execution: overrides.execution,\n }),\n },\n }\n : {}),\n profileHash: computedProfileHash,\n meta: overrides.meta ?? {},\n };\n}\n\ntype SqlStorageLike = StorageBase & {\n readonly tables: Record<string, unknown>;\n readonly types?: Record<string, unknown>;\n};\n\ntype SqlModelLike = ContractModel<ModelStorageBase & { table: string }>;\n\nexport function createSqlContract(\n overrides: ContractOverrides<SqlStorageLike, Record<string, SqlModelLike>> = {},\n): Contract<SqlStorageLike, Record<string, SqlModelLike>> {\n return createContract<SqlStorageLike, Record<string, SqlModelLike>>({\n target: 'postgres',\n targetFamily: 'sql',\n storage: overrides.storage ?? { tables: {} },\n ...overrides,\n });\n}\n\nexport { DUMMY_HASH };\n"],"mappings":";;;;AAsBA,MAAM,aAAa,SAAS,cAAc;AAE1C,SAAgB,eAGd,YAAkD,EAAE,EAA+B;CACnF,MAAM,SAAS,UAAU,UAAU;CACnC,MAAM,eAAe,UAAU,gBAAgB;CAC/C,MAAM,eAAe,UAAU,gBAAgB,EAAE;CAEjD,MAAM,aACJ,UAAU,WAAY,EAAE,QAAQ,EAAE,EAAE;CAEtC,MAAM,cAAc,mBAAmB;EACrC;EACA;EACA,SAAS;EACV,CAAC;CAEF,MAAM,UAAU;EACd,GAAG;EACH;EACD;CAED,MAAM,sBACJ,UAAU,eAAe,mBAAmB;EAAE;EAAQ;EAAc;EAAc,CAAC;AAErF,QAAO;EACL;EACA;EACA,OAAO,UAAU,SAAS,EAAE;EAC5B,QAAS,UAAU,UAAU,EAAE;EAC/B;EACA;EACA,gBAAgB,UAAU,kBAAkB,EAAE;EAC9C,GAAI,UAAU,cAAc,SACxB,EACE,WAAW;GACT,GAAG,UAAU;GACb,eAAe,qBAAqB;IAClC;IACA;IACA,WAAW,UAAU;IACtB,CAAC;GACH,EACF,GACD,EAAE;EACN,aAAa;EACb,MAAM,UAAU,QAAQ,EAAE;EAC3B;;AAUH,SAAgB,kBACd,YAA6E,EAAE,EACvB;AACxD,QAAO,eAA6D;EAClE,QAAQ;EACR,cAAc;EACd,SAAS,UAAU,WAAW,EAAE,QAAQ,EAAE,EAAE;EAC5C,GAAG;EACJ,CAAC"}
@@ -0,0 +1,511 @@
1
+ import { OperationRegistry } from "@prisma-next/operations";
2
+
3
+ //#region src/domain-types.d.ts
4
+ type ContractField = {
5
+ readonly nullable: boolean;
6
+ readonly codecId: string;
7
+ };
8
+ type ContractRelationOn = {
9
+ readonly localFields: readonly string[];
10
+ readonly targetFields: readonly string[];
11
+ };
12
+ type ContractReferenceRelation = {
13
+ readonly to: string;
14
+ readonly cardinality: '1:1' | '1:N' | 'N:1';
15
+ readonly on: ContractRelationOn;
16
+ };
17
+ type ContractEmbedRelation = {
18
+ readonly to: string;
19
+ readonly cardinality: '1:1' | '1:N';
20
+ };
21
+ type ContractRelation = ContractReferenceRelation | ContractEmbedRelation;
22
+ type ContractDiscriminator = {
23
+ readonly field: string;
24
+ };
25
+ type ContractVariantEntry = {
26
+ readonly value: string;
27
+ };
28
+ type ModelStorageBase = Readonly<Record<string, unknown>>;
29
+ interface ContractModel<TModelStorage extends ModelStorageBase = ModelStorageBase> {
30
+ readonly fields: Record<string, ContractField>;
31
+ readonly relations: Record<string, ContractRelation>;
32
+ readonly storage: TModelStorage;
33
+ readonly discriminator?: ContractDiscriminator;
34
+ readonly variants?: Record<string, ContractVariantEntry>;
35
+ readonly base?: string;
36
+ readonly owner?: string;
37
+ }
38
+ /** @deprecated Use {@link ContractField} */
39
+ type DomainField = ContractField;
40
+ /** @deprecated Use {@link ContractRelationOn} */
41
+ type DomainRelationOn = ContractRelationOn;
42
+ /** @deprecated Use {@link ContractReferenceRelation} */
43
+ type DomainReferenceRelation = ContractReferenceRelation;
44
+ /** @deprecated Use {@link ContractEmbedRelation} */
45
+ type DomainEmbedRelation = ContractEmbedRelation;
46
+ /** @deprecated Use {@link ContractRelation} */
47
+ type DomainRelation = ContractRelation;
48
+ /** @deprecated Use {@link ContractDiscriminator} */
49
+ type DomainDiscriminator = ContractDiscriminator;
50
+ /** @deprecated Use {@link ContractVariantEntry} */
51
+ type DomainVariantEntry = ContractVariantEntry;
52
+ /** @deprecated Use {@link ContractModel} */
53
+ type DomainModel = ContractModel;
54
+ type HasModelsWithRelations = {
55
+ readonly models: Record<string, {
56
+ readonly relations: Record<string, ContractRelation>;
57
+ }>;
58
+ };
59
+ type ReferenceRelationKeys<TContract extends HasModelsWithRelations, ModelName extends string & keyof TContract['models']> = { [K in keyof TContract['models'][ModelName]['relations']]: TContract['models'][ModelName]['relations'][K] extends ContractReferenceRelation ? K : never }[keyof TContract['models'][ModelName]['relations']];
60
+ type EmbedRelationKeys<TContract extends HasModelsWithRelations, ModelName extends string & keyof TContract['models']> = { [K in keyof TContract['models'][ModelName]['relations']]: TContract['models'][ModelName]['relations'][K] extends ContractReferenceRelation ? never : K }[keyof TContract['models'][ModelName]['relations']];
61
+ //#endregion
62
+ //#region src/contract-types.d.ts
63
+ /**
64
+ * Execution section for the unified contract (ADR 182).
65
+ *
66
+ * Unlike the legacy {@link import('./types').ExecutionSection}, this type
67
+ * requires `executionHash` — when an execution section is present, its
68
+ * hash must be too (consistent with `StorageBase.storageHash`).
69
+ *
70
+ * @template THash Literal hash string type for type-safe hash tracking.
71
+ */
72
+ type ContractExecutionSection<THash extends string = string> = {
73
+ readonly executionHash: ExecutionHashBase<THash>;
74
+ readonly mutations: {
75
+ readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
76
+ };
77
+ };
78
+ /**
79
+ * Unified contract representation (ADR 182).
80
+ *
81
+ * A `Contract` is the canonical in-memory representation of a data contract.
82
+ * It is model-first (domain models carry their own storage bridge) and
83
+ * family-parameterized (SQL, Mongo, etc. specialize via `TStorage` and model
84
+ * storage generics on `ContractModel`).
85
+ *
86
+ * JSON persistence fields (`schemaVersion`, `sources`) are not represented
87
+ * here — they are handled at the serialization boundary.
88
+ *
89
+ * @template TStorage Family-specific storage block (extends {@link StorageBase}).
90
+ * @template TModels Record of model name → {@link ContractModel} with
91
+ * family-specific model storage.
92
+ */
93
+ interface Contract<TStorage extends StorageBase = StorageBase, TModels extends Record<string, ContractModel> = Record<string, ContractModel>> {
94
+ readonly target: string;
95
+ readonly targetFamily: string;
96
+ readonly roots: Record<string, string>;
97
+ readonly models: TModels;
98
+ readonly storage: TStorage;
99
+ readonly capabilities: Record<string, Record<string, boolean>>;
100
+ readonly extensionPacks: Record<string, unknown>;
101
+ readonly execution?: ContractExecutionSection;
102
+ readonly profileHash: ProfileHashBase<string>;
103
+ readonly meta: Record<string, unknown>;
104
+ }
105
+ //#endregion
106
+ //#region src/types.d.ts
107
+ /**
108
+ * Unique symbol used as the key for branding types.
109
+ */
110
+ declare const $: unique symbol;
111
+ /**
112
+ * A helper type to brand a given type with a unique identifier.
113
+ *
114
+ * @template TKey Text used as the brand key.
115
+ * @template TValue Optional value associated with the brand key. Defaults to `true`.
116
+ */
117
+ type Brand<TKey extends string | number | symbol, TValue = true> = {
118
+ [$]: { [K in TKey]: TValue };
119
+ };
120
+ /**
121
+ * Context passed to type renderers during contract.d.ts generation.
122
+ */
123
+ interface RenderTypeContext {
124
+ /** The name of the CodecTypes type alias (typically 'CodecTypes') */
125
+ readonly codecTypesName: string;
126
+ }
127
+ /**
128
+ * Base type for storage contract hashes.
129
+ * Emitted contract.d.ts files use this with the hash value as a type parameter:
130
+ * `type StorageHash = StorageHashBase<'sha256:abc123...'>`
131
+ */
132
+ type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
133
+ /**
134
+ * Base type for execution contract hashes.
135
+ * Emitted contract.d.ts files use this with the hash value as a type parameter:
136
+ * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`
137
+ */
138
+ type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
139
+ declare function coreHash<const T extends string>(value: T): StorageHashBase<T>;
140
+ /**
141
+ * Base type for profile contract hashes.
142
+ * Emitted contract.d.ts files use this with the hash value as a type parameter:
143
+ * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`
144
+ */
145
+ type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
146
+ declare function profileHash<const T extends string>(value: T): ProfileHashBase<T>;
147
+ /**
148
+ * Base type for family-specific storage blocks.
149
+ * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the
150
+ * storage hash alongside family-specific data (tables, collections, etc.).
151
+ */
152
+ interface StorageBase<THash extends string = string> {
153
+ readonly storageHash: StorageHashBase<THash>;
154
+ }
155
+ interface ContractBase<TStorageHash extends StorageHashBase<string> = StorageHashBase<string>, TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>, TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>> {
156
+ readonly schemaVersion: string;
157
+ readonly target: string;
158
+ readonly targetFamily: string;
159
+ readonly storageHash: TStorageHash;
160
+ readonly executionHash?: TExecutionHash | undefined;
161
+ readonly profileHash?: TProfileHash | undefined;
162
+ readonly capabilities: Record<string, Record<string, boolean>>;
163
+ readonly extensionPacks: Record<string, unknown>;
164
+ readonly meta: Record<string, unknown>;
165
+ readonly sources: Record<string, Source>;
166
+ readonly execution?: ExecutionSection;
167
+ readonly roots: Record<string, string>;
168
+ readonly models: Record<string, DomainModel>;
169
+ }
170
+ interface FieldType {
171
+ readonly type: string;
172
+ readonly nullable: boolean;
173
+ readonly items?: FieldType;
174
+ readonly properties?: Record<string, FieldType>;
175
+ }
176
+ type GeneratedValueSpec = {
177
+ readonly id: string;
178
+ readonly params?: Record<string, unknown>;
179
+ };
180
+ type JsonPrimitive = string | number | boolean | null;
181
+ type JsonValue = JsonPrimitive | {
182
+ readonly [key: string]: JsonValue;
183
+ } | readonly JsonValue[];
184
+ type TaggedBigInt = {
185
+ readonly $type: 'bigint';
186
+ readonly value: string;
187
+ };
188
+ declare function isTaggedBigInt(value: unknown): value is TaggedBigInt;
189
+ declare function bigintJsonReplacer(_key: string, value: unknown): unknown;
190
+ type TaggedRaw = {
191
+ readonly $type: 'raw';
192
+ readonly value: JsonValue;
193
+ };
194
+ declare function isTaggedRaw(value: unknown): value is TaggedRaw;
195
+ type TaggedLiteralValue = TaggedBigInt | TaggedRaw;
196
+ type ColumnDefaultLiteralValue = JsonValue | TaggedLiteralValue;
197
+ type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | bigint | Date;
198
+ type ColumnDefault = {
199
+ readonly kind: 'literal';
200
+ readonly value: ColumnDefaultLiteralInputValue;
201
+ } | {
202
+ readonly kind: 'function';
203
+ readonly expression: string;
204
+ };
205
+ type ExecutionMutationDefaultValue = {
206
+ readonly kind: 'generator';
207
+ readonly id: GeneratedValueSpec['id'];
208
+ readonly params?: Record<string, unknown>;
209
+ };
210
+ type ExecutionMutationDefault = {
211
+ readonly ref: {
212
+ readonly table: string;
213
+ readonly column: string;
214
+ };
215
+ readonly onCreate?: ExecutionMutationDefaultValue;
216
+ readonly onUpdate?: ExecutionMutationDefaultValue;
217
+ };
218
+ type ExecutionSection = {
219
+ readonly mutations: {
220
+ readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
221
+ };
222
+ };
223
+ interface Source {
224
+ readonly readOnly: boolean;
225
+ readonly projection: Record<string, FieldType>;
226
+ readonly origin?: Record<string, unknown>;
227
+ readonly capabilities?: Record<string, boolean>;
228
+ }
229
+ interface DocIndex {
230
+ readonly name: string;
231
+ readonly keys: Record<string, 'asc' | 'desc'>;
232
+ readonly unique?: boolean;
233
+ readonly where?: Expr;
234
+ }
235
+ type Expr = {
236
+ readonly kind: 'eq';
237
+ readonly path: ReadonlyArray<string>;
238
+ readonly value: unknown;
239
+ } | {
240
+ readonly kind: 'exists';
241
+ readonly path: ReadonlyArray<string>;
242
+ };
243
+ interface DocCollection {
244
+ readonly name: string;
245
+ readonly id?: {
246
+ readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';
247
+ };
248
+ readonly fields: Record<string, FieldType>;
249
+ readonly indexes?: ReadonlyArray<DocIndex>;
250
+ readonly readOnly?: boolean;
251
+ }
252
+ interface DocumentStorage {
253
+ readonly document: {
254
+ readonly collections: Record<string, DocCollection>;
255
+ };
256
+ }
257
+ interface DocumentContract<TStorageHash extends StorageHashBase<string> = StorageHashBase<string>, TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>, TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>> extends ContractBase<TStorageHash, TExecutionHash, TProfileHash> {
258
+ readonly targetFamily: string;
259
+ readonly storage: DocumentStorage;
260
+ }
261
+ interface ParamDescriptor {
262
+ readonly index?: number;
263
+ readonly name?: string;
264
+ readonly codecId?: string;
265
+ readonly nativeType?: string;
266
+ readonly nullable?: boolean;
267
+ readonly source: 'dsl' | 'raw' | 'lane';
268
+ readonly refs?: {
269
+ table: string;
270
+ column: string;
271
+ };
272
+ }
273
+ interface PlanRefs {
274
+ readonly tables?: readonly string[];
275
+ readonly columns?: ReadonlyArray<{
276
+ table: string;
277
+ column: string;
278
+ }>;
279
+ readonly indexes?: ReadonlyArray<{
280
+ readonly table: string;
281
+ readonly columns: ReadonlyArray<string>;
282
+ readonly name?: string;
283
+ }>;
284
+ }
285
+ interface PlanMeta {
286
+ readonly target: string;
287
+ readonly targetFamily?: string;
288
+ readonly storageHash: string;
289
+ readonly profileHash?: string;
290
+ readonly lane: string;
291
+ readonly annotations?: {
292
+ codecs?: Record<string, string>;
293
+ [key: string]: unknown;
294
+ };
295
+ readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;
296
+ readonly refs?: PlanRefs;
297
+ readonly projection?: Record<string, string> | ReadonlyArray<string>;
298
+ /**
299
+ * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).
300
+ * Used for codec resolution when AST+refs don't provide enough type info.
301
+ */
302
+ readonly projectionTypes?: Record<string, string>;
303
+ }
304
+ /**
305
+ * Canonical execution plan shape used by runtimes.
306
+ *
307
+ * - Row is the inferred result row type (TypeScript-only).
308
+ * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).
309
+ *
310
+ * The payload executed by the runtime is represented by the sql + params pair
311
+ * for now; future families can specialize this via Ast or additional metadata.
312
+ */
313
+ interface ExecutionPlan<Row = unknown, Ast = unknown> {
314
+ readonly sql: string;
315
+ readonly params: readonly unknown[];
316
+ readonly ast?: Ast;
317
+ readonly meta: PlanMeta;
318
+ /**
319
+ * Phantom property to carry the Row generic for type-level utilities.
320
+ * Not set at runtime; used only for ResultType extraction.
321
+ */
322
+ readonly _row?: Row;
323
+ }
324
+ /**
325
+ * Utility type to extract the Row type from an ExecutionPlan.
326
+ * Example: `type Row = ResultType<typeof plan>`
327
+ *
328
+ * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).
329
+ * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter
330
+ * for type extraction.
331
+ */
332
+ type ResultType<P> = P extends ExecutionPlan<infer R, unknown> ? R : P extends {
333
+ readonly _Row?: infer R;
334
+ } ? R : never;
335
+ /**
336
+ * Type guard to check if a contract is a Document contract
337
+ */
338
+ declare function isDocumentContract(contract: unknown): contract is DocumentContract;
339
+ /**
340
+ * Contract marker record stored in the database.
341
+ * Represents the current contract identity for a database.
342
+ */
343
+ interface ContractMarkerRecord {
344
+ readonly storageHash: string;
345
+ readonly profileHash: string;
346
+ readonly contractJson: unknown | null;
347
+ readonly canonicalVersion: number | null;
348
+ readonly updatedAt: Date;
349
+ readonly appTag: string | null;
350
+ readonly meta: Record<string, unknown>;
351
+ }
352
+ /**
353
+ * Specifies how to import TypeScript types from a package.
354
+ * Used in extension pack manifests to declare codec and operation type imports.
355
+ */
356
+ interface TypesImportSpec {
357
+ readonly package: string;
358
+ readonly named: string;
359
+ readonly alias: string;
360
+ }
361
+ /**
362
+ * Validation context passed to TargetFamilyHook.validateTypes().
363
+ * Contains pre-assembled operation registry, type imports, and extension IDs.
364
+ */
365
+ interface ValidationContext {
366
+ readonly operationRegistry?: OperationRegistry;
367
+ readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
368
+ readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
369
+ readonly extensionIds?: ReadonlyArray<string>;
370
+ /**
371
+ * Parameterized codec descriptors collected from adapters and extensions.
372
+ * Map of codecId → descriptor for quick lookup during type generation.
373
+ */
374
+ readonly parameterizedCodecs?: Map<string, ParameterizedCodecDescriptor>;
375
+ }
376
+ /**
377
+ * Context for rendering parameterized types during contract.d.ts generation.
378
+ * Passed to type renderers so they can reference CodecTypes by name.
379
+ */
380
+ interface TypeRenderContext {
381
+ readonly codecTypesName: string;
382
+ }
383
+ /**
384
+ * A normalized type renderer for parameterized codecs.
385
+ * This is the interface expected by TargetFamilyHook.generateContractTypes.
386
+ */
387
+ interface TypeRenderEntry {
388
+ readonly codecId: string;
389
+ readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;
390
+ }
391
+ /**
392
+ * Additional options for generateContractTypes.
393
+ */
394
+ interface GenerateContractTypesOptions {
395
+ /**
396
+ * Normalized parameterized type renderers, keyed by codecId.
397
+ * When a column has typeParams and a renderer exists for its codecId,
398
+ * the renderer is called to produce the TypeScript type expression.
399
+ */
400
+ readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;
401
+ /**
402
+ * Type imports for parameterized codecs.
403
+ * These are merged with codec and operation type imports in contract.d.ts.
404
+ */
405
+ readonly parameterizedTypeImports?: ReadonlyArray<TypesImportSpec>;
406
+ /**
407
+ * Query operation type imports for the query builder.
408
+ * Flat operation signatures keyed by operation name, emitted as standalone QueryOperationTypes.
409
+ */
410
+ readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
411
+ }
412
+ /**
413
+ * SPI interface for target family hooks that extend emission behavior.
414
+ * Implemented by family-specific emitter hooks (e.g., SQL family).
415
+ */
416
+ interface TargetFamilyHook {
417
+ readonly id: string;
418
+ /**
419
+ * Validates that all type IDs in the contract come from referenced extension packs.
420
+ * @param contract - Contract to validate
421
+ * @param ctx - Validation context with operation registry and extension IDs
422
+ */
423
+ validateTypes(contract: Contract, ctx: ValidationContext): void;
424
+ /**
425
+ * Validates family-specific contract structure.
426
+ * @param contract - Contract to validate
427
+ */
428
+ validateStructure(contract: Contract): void;
429
+ /**
430
+ * Generates contract.d.ts file content.
431
+ * @param contract - Contract
432
+ * @param codecTypeImports - Array of codec type import specs
433
+ * @param operationTypeImports - Array of operation type import specs
434
+ * @param hashes - Contract hash values (storageHash, executionHash, profileHash)
435
+ * @param options - Additional options including parameterized type renderers
436
+ * @returns Generated TypeScript type definitions as string
437
+ */
438
+ generateContractTypes(contract: Contract, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>, hashes: {
439
+ readonly storageHash: string;
440
+ readonly executionHash?: string;
441
+ readonly profileHash: string;
442
+ }, options?: GenerateContractTypesOptions): string;
443
+ }
444
+ /**
445
+ * Declarative type renderer that produces a TypeScript type expression.
446
+ *
447
+ * Renderers can be:
448
+ * - A template string with `{{paramName}}` placeholders (e.g., `Vector<{{length}}>`)
449
+ * - A function that receives typeParams and context and returns a type expression
450
+ *
451
+ * **Prefer template strings** for most cases:
452
+ * - Templates are JSON-serializable (safe for pack-ref metadata)
453
+ * - Templates can be statically analyzed by tooling
454
+ *
455
+ * Function renderers are allowed but have tradeoffs:
456
+ * - Require runtime execution during emission (the emitter runs code)
457
+ * - Not JSON-serializable (can't be stored in contract.json)
458
+ * - The emitted artifacts (contract.json, contract.d.ts) still contain no
459
+ * executable code - this constraint applies to outputs, not the emission process
460
+ */
461
+ type TypeRenderer = string | ((params: Record<string, unknown>, ctx: RenderTypeContext) => string);
462
+ /**
463
+ * Descriptor for a codec that supports type parameters.
464
+ *
465
+ * Parameterized codecs allow columns to carry additional metadata (typeParams)
466
+ * that affects the generated TypeScript types. For example:
467
+ * - A vector codec can use `{ length: 1536 }` to generate `Vector<1536>`
468
+ * - A decimal codec can use `{ precision: 10, scale: 2 }` to generate `Decimal<10, 2>`
469
+ *
470
+ * The SQL family emitter uses these descriptors to generate precise types
471
+ * without hard-coding knowledge of specific codec IDs.
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * const vectorCodecDescriptor: ParameterizedCodecDescriptor = {
476
+ * codecId: 'pg/vector@1',
477
+ * outputTypeRenderer: 'Vector<{{length}}>',
478
+ * // Optional: paramsSchema for runtime validation
479
+ * };
480
+ * ```
481
+ */
482
+ interface ParameterizedCodecDescriptor {
483
+ /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */
484
+ readonly codecId: string;
485
+ /**
486
+ * Renderer for the output (read) type.
487
+ * Can be a template string or function.
488
+ *
489
+ * This is the primary renderer used by SQL emission to generate
490
+ * model field types in contract.d.ts.
491
+ */
492
+ readonly outputTypeRenderer: TypeRenderer;
493
+ /**
494
+ * Optional renderer for the input (write) type.
495
+ * If not provided, outputTypeRenderer is used for both.
496
+ *
497
+ * **Reserved for future use**: Currently, SQL emission only uses
498
+ * outputTypeRenderer. This field is defined for future support of
499
+ * asymmetric codecs where input and output types differ (e.g., a
500
+ * codec that accepts `string | number` but always returns `number`).
501
+ */
502
+ readonly inputTypeRenderer?: TypeRenderer;
503
+ /**
504
+ * Optional import spec for types used by this codec's renderers.
505
+ * The emitter will add this import to contract.d.ts.
506
+ */
507
+ readonly typesImport?: TypesImportSpec;
508
+ }
509
+ //#endregion
510
+ export { ContractModel as $, Source as A, TypesImportSpec as B, ParamDescriptor as C, ProfileHashBase as D, PlanRefs as E, TaggedRaw as F, isTaggedBigInt as G, bigintJsonReplacer as H, TargetFamilyHook as I, Contract as J, isTaggedRaw as K, TypeRenderContext as L, StorageHashBase as M, TaggedBigInt as N, RenderTypeContext as O, TaggedLiteralValue as P, ContractField as Q, TypeRenderEntry as R, JsonValue as S, PlanMeta as T, coreHash as U, ValidationContext as V, isDocumentContract as W, ContractDiscriminator as X, ContractExecutionSection as Y, ContractEmbedRelation as Z, Expr as _, ColumnDefaultLiteralValue as a, DomainEmbedRelation as at, GeneratedValueSpec as b, DocCollection as c, DomainReferenceRelation as ct, DocumentStorage as d, DomainVariantEntry as dt, ContractReferenceRelation as et, ExecutionHashBase as f, EmbedRelationKeys as ft, ExecutionSection as g, ExecutionPlan as h, ColumnDefaultLiteralInputValue as i, DomainDiscriminator as it, StorageBase as j, ResultType as k, DocIndex as l, DomainRelation as lt, ExecutionMutationDefaultValue as m, ReferenceRelationKeys as mt, Brand as n, ContractRelationOn as nt, ContractBase as o, DomainField as ot, ExecutionMutationDefault as p, ModelStorageBase as pt, profileHash as q, ColumnDefault as r, ContractVariantEntry as rt, ContractMarkerRecord as s, DomainModel as st, $ as t, ContractRelation as tt, DocumentContract as u, DomainRelationOn as ut, FieldType as v, ParameterizedCodecDescriptor as w, JsonPrimitive as x, GenerateContractTypesOptions as y, TypeRenderer as z };
511
+ //# sourceMappingURL=types-D-iOS0Ks.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-D-iOS0Ks.d.mts","names":[],"sources":["../src/domain-types.ts","../src/contract-types.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;KAAY,aAAA;;;AAAZ,CAAA;AAKY,KAAA,kBAAA,GAAkB;EAKlB,SAAA,WAAA,EAAA,SAAyB,MAAA,EAAA;EAMzB,SAAA,YAAA,EAAA,SAAqB,MAAA,EAA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;;eAM1B;;;;;;;;;;;;;;;;;;;KA+BF,YAAA,sBAEE,8BAA8B;;;;;;;;;;;;;;;;;;;;;UAsB3B,4BAAA;;;;;;;;;;+BAWc;;;;;;;;;;+BAWA;;;;;yBAMN"}
@@ -0,0 +1,30 @@
1
+ //#region src/types.ts
2
+ function coreHash(value) {
3
+ return value;
4
+ }
5
+ function profileHash(value) {
6
+ return value;
7
+ }
8
+ function isTaggedBigInt(value) {
9
+ return typeof value === "object" && value !== null && value.$type === "bigint" && typeof value.value === "string";
10
+ }
11
+ function bigintJsonReplacer(_key, value) {
12
+ if (typeof value === "bigint") return {
13
+ $type: "bigint",
14
+ value: value.toString()
15
+ };
16
+ return value;
17
+ }
18
+ function isTaggedRaw(value) {
19
+ return typeof value === "object" && value !== null && value.$type === "raw" && "value" in value;
20
+ }
21
+ /**
22
+ * Type guard to check if a contract is a Document contract
23
+ */
24
+ function isDocumentContract(contract) {
25
+ return typeof contract === "object" && contract !== null && "targetFamily" in contract && contract.targetFamily === "document";
26
+ }
27
+
28
+ //#endregion
29
+ export { isTaggedRaw as a, isTaggedBigInt as i, coreHash as n, profileHash as o, isDocumentContract as r, bigintJsonReplacer as t };
30
+ //# sourceMappingURL=types-DokLaU9G.mjs.map