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

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DYikGC04.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { DomainModel } from './domain-types';\n\n/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\n}\n\nexport interface ContractBase<\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: TStorageHash;\n readonly executionHash?: TExecutionHash | undefined;\n readonly profileHash?: TProfileHash | undefined;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, Source>;\n readonly execution?: ExecutionSection;\n readonly roots: Record<string, string>;\n readonly models: Record<string, DomainModel>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type TaggedBigInt = { readonly $type: 'bigint'; readonly value: string };\n\nexport function isTaggedBigInt(value: unknown): value is TaggedBigInt {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { $type?: unknown }).$type === 'bigint' &&\n typeof (value as { value?: unknown }).value === 'string'\n );\n}\n\nexport function bigintJsonReplacer(_key: string, value: unknown): unknown {\n if (typeof value === 'bigint') {\n return { $type: 'bigint', value: value.toString() } satisfies TaggedBigInt;\n }\n return value;\n}\n\nexport type TaggedRaw = { readonly $type: 'raw'; readonly value: JsonValue };\n\nexport function isTaggedRaw(value: unknown): value is TaggedRaw {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { $type?: unknown }).$type === 'raw' &&\n 'value' in (value as object)\n );\n}\n\nexport type TaggedLiteralValue = TaggedBigInt | TaggedRaw;\n\nexport type ColumnDefaultLiteralValue = JsonValue | TaggedLiteralValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | bigint | Date;\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\nexport type ExecutionSection<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface DocumentStorage {\n readonly document: {\n readonly collections: Record<string, DocCollection>;\n };\n}\n\nexport interface DocumentContract<\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> extends ContractBase<TStorageHash, TExecutionHash, TProfileHash> {\n // Accept string to work with JSON imports; runtime validation ensures 'document'\n readonly targetFamily: string;\n readonly storage: DocumentStorage;\n}\n\n// Plan types - target-family agnostic execution types\nexport interface ParamDescriptor {\n readonly index?: number;\n readonly name?: string;\n readonly codecId?: string;\n readonly nativeType?: string;\n readonly nullable?: boolean;\n readonly source: 'dsl' | 'raw' | 'lane';\n readonly refs?: { table: string; column: string };\n}\n\nexport interface PlanRefs {\n readonly tables?: readonly string[];\n readonly columns?: ReadonlyArray<{ table: string; column: string }>;\n readonly indexes?: ReadonlyArray<{\n readonly table: string;\n readonly columns: ReadonlyArray<string>;\n readonly name?: string;\n }>;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n codecs?: Record<string, string>; // alias/param → codec id ('ns/name@v')\n [key: string]: unknown;\n };\n readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;\n readonly refs?: PlanRefs;\n readonly projection?: Record<string, string> | ReadonlyArray<string>;\n /**\n * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).\n * Used for codec resolution when AST+refs don't provide enough type info.\n */\n readonly projectionTypes?: Record<string, string>;\n}\n\n/**\n * Canonical execution plan shape used by runtimes.\n *\n * - Row is the inferred result row type (TypeScript-only).\n * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).\n *\n * The payload executed by the runtime is represented by the sql + params pair\n * for now; future families can specialize this via Ast or additional metadata.\n */\nexport interface ExecutionPlan<Row = unknown, Ast = unknown> {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly ast?: Ast;\n readonly meta: PlanMeta;\n /**\n * Phantom property to carry the Row generic for type-level utilities.\n * Not set at runtime; used only for ResultType extraction.\n */\n readonly _row?: Row;\n}\n\n/**\n * Utility type to extract the Row type from an ExecutionPlan.\n * Example: `type Row = ResultType<typeof plan>`\n *\n * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).\n * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter\n * for type extraction.\n */\nexport type ResultType<P> =\n P extends ExecutionPlan<infer R, unknown> ? R : P extends { readonly _Row?: infer R } ? R : never;\n\n/**\n * Type guard to check if a contract is a Document contract\n */\nexport function isDocumentContract(contract: unknown): contract is DocumentContract {\n return (\n typeof contract === 'object' &&\n contract !== null &&\n 'targetFamily' in contract &&\n contract.targetFamily === 'document'\n );\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n}\n"],"mappings":";AAiCA,SAAgB,cAAsC,OAAgC;AACpF,QAAO;;AAGT,SAAgB,SAAiC,OAA8B;AAC7E,QAAO;;AAUT,SAAgB,YAAoC,OAA8B;AAChF,QAAO;;AAqDT,SAAgB,eAAe,OAAuC;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA8B,UAAU,YACzC,OAAQ,MAA8B,UAAU;;AAIpD,SAAgB,mBAAmB,MAAc,OAAyB;AACxE,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,OAAO;EAAU,OAAO,MAAM,UAAU;EAAE;AAErD,QAAO;;AAKT,SAAgB,YAAY,OAAoC;AAC9D,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA8B,UAAU,SACzC,WAAY;;;;;AA6JhB,SAAgB,mBAAmB,UAAiD;AAClF,QACE,OAAO,aAAa,YACpB,aAAa,QACb,kBAAkB,YAClB,SAAS,iBAAiB"}
@@ -1,5 +1,3 @@
1
- import { OperationRegistry } from "@prisma-next/operations";
2
-
3
1
  //#region src/domain-types.d.ts
4
2
  type ContractField = {
5
3
  readonly nullable: boolean;
@@ -59,50 +57,6 @@ type HasModelsWithRelations = {
59
57
  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
58
  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
59
  //#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
60
  //#region src/types.d.ts
107
61
  /**
108
62
  * Unique symbol used as the key for branding types.
@@ -117,13 +71,6 @@ declare const $: unique symbol;
117
71
  type Brand<TKey extends string | number | symbol, TValue = true> = {
118
72
  [$]: { [K in TKey]: TValue };
119
73
  };
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
74
  /**
128
75
  * Base type for storage contract hashes.
129
76
  * Emitted contract.d.ts files use this with the hash value as a type parameter:
@@ -136,6 +83,7 @@ type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
136
83
  * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`
137
84
  */
138
85
  type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
86
+ declare function executionHash<const T extends string>(value: T): ExecutionHashBase<T>;
139
87
  declare function coreHash<const T extends string>(value: T): StorageHashBase<T>;
140
88
  /**
141
89
  * Base type for profile contract hashes.
@@ -215,7 +163,8 @@ type ExecutionMutationDefault = {
215
163
  readonly onCreate?: ExecutionMutationDefaultValue;
216
164
  readonly onUpdate?: ExecutionMutationDefaultValue;
217
165
  };
218
- type ExecutionSection = {
166
+ type ExecutionSection<THash extends string = string> = {
167
+ readonly executionHash: ExecutionHashBase<THash>;
219
168
  readonly mutations: {
220
169
  readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
221
170
  };
@@ -349,163 +298,6 @@ interface ContractMarkerRecord {
349
298
  readonly appTag: string | null;
350
299
  readonly meta: Record<string, unknown>;
351
300
  }
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
301
  //#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
302
+ export { DomainRelation as $, TaggedBigInt as A, ContractDiscriminator as B, PlanMeta as C, Source as D, ResultType as E, executionHash as F, ContractRelation as G, ContractField as H, isDocumentContract as I, DomainDiscriminator as J, ContractRelationOn as K, isTaggedBigInt as L, TaggedRaw as M, bigintJsonReplacer as N, StorageBase as O, coreHash as P, DomainReferenceRelation as Q, isTaggedRaw as R, ParamDescriptor as S, ProfileHashBase as T, ContractModel as U, ContractEmbedRelation as V, ContractReferenceRelation as W, DomainField as X, DomainEmbedRelation as Y, DomainModel as Z, Expr as _, ColumnDefaultLiteralValue as a, JsonPrimitive as b, DocCollection as c, DocumentStorage as d, DomainRelationOn as et, ExecutionHashBase as f, ExecutionSection as g, ExecutionPlan as h, ColumnDefaultLiteralInputValue as i, ReferenceRelationKeys as it, TaggedLiteralValue as j, StorageHashBase as k, DocIndex as l, ExecutionMutationDefaultValue as m, Brand as n, EmbedRelationKeys as nt, ContractBase as o, ExecutionMutationDefault as p, ContractVariantEntry as q, ColumnDefault as r, ModelStorageBase as rt, ContractMarkerRecord as s, $ as t, DomainVariantEntry as tt, DocumentContract as u, FieldType as v, PlanRefs as w, JsonValue as x, GeneratedValueSpec as y, profileHash as z };
303
+ //# sourceMappingURL=types-DmKtoEd-.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DmKtoEd-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AG8B,CAAA,CAAA;;AACzB,UAXD,QAAA,CAWC;EACM,SAAA,MAAA,EAAA,MAAA;EAAyB,SAAA,YAAA,CAAA,EAAA,MAAA;EAKpB,SAAA,WAAA,EAAA,MAAA;EAAM,SAAA,WAAA,CAAA,EAAA,MAAA;EAYlB,SAAA,IAAA,EAAA,MAAa;EAGb,SAAA,WAAA,CAAA,EAAA;IACA,MAAA,CAAA,EA1BJ,MA0BI,CAAA,MAAA,EAAA,MAAA,CAAA;IAKC,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAG,CAAA;EAWT,SAAA,gBAAU,EAvCO,aAuCP,CAvCqB,eAuCrB,CAAA;EACpB,SAAA,IAAA,CAAA,EAvCgB,QAuChB;EAAU,SAAA,UAAA,CAAA,EAtCY,MAsCZ,CAAA,MAAA,EAAA,MAAA,CAAA,GAtCqC,aAsCrC,CAAA,MAAA,CAAA;EAAsC;;AAKlD;AAaA;6BAnD6B;;;;;;;;;;;UAYZ;;;iBAGA;iBACA;;;;;kBAKC;;;;;;;;;;KAWN,gBACV,UAAU,sCAAsC;;;;;;iBAKlC,kBAAA,iCAAmD;;;;;UAalD,oBAAA;;;;;sBAKK;;iBAEL"}
package/dist/types.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- import { $ as ContractModel, A as Source, B as TypesImportSpec, C as ParamDescriptor, D as ProfileHashBase, E as PlanRefs, F as TaggedRaw, G as isTaggedBigInt, H as bigintJsonReplacer, I as TargetFamilyHook, J as Contract, K as isTaggedRaw, L as TypeRenderContext, M as StorageHashBase, N as TaggedBigInt, O as RenderTypeContext, P as TaggedLiteralValue, Q as ContractField, R as TypeRenderEntry, S as JsonValue, T as PlanMeta, U as coreHash, V as ValidationContext, W as isDocumentContract, X as ContractDiscriminator, Y as ContractExecutionSection, Z as ContractEmbedRelation, _ as Expr, a as ColumnDefaultLiteralValue, at as DomainEmbedRelation, b as GeneratedValueSpec, c as DocCollection, ct as DomainReferenceRelation, d as DocumentStorage, dt as DomainVariantEntry, et as ContractReferenceRelation, f as ExecutionHashBase, ft as EmbedRelationKeys, g as ExecutionSection, h as ExecutionPlan, i as ColumnDefaultLiteralInputValue, it as DomainDiscriminator, j as StorageBase, k as ResultType, l as DocIndex, lt as DomainRelation, m as ExecutionMutationDefaultValue, mt as ReferenceRelationKeys, n as Brand, nt as ContractRelationOn, o as ContractBase, ot as DomainField, p as ExecutionMutationDefault, pt as ModelStorageBase, q as profileHash, r as ColumnDefault, rt as ContractVariantEntry, s as ContractMarkerRecord, st as DomainModel, t as $, tt as ContractRelation, u as DocumentContract, ut as DomainRelationOn, v as FieldType, w as ParameterizedCodecDescriptor, x as JsonPrimitive, y as GenerateContractTypesOptions, z as TypeRenderer } from "./types-D-iOS0Ks.mjs";
2
- export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractBase, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractMarkerRecord, type ContractModel, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractVariantEntry, type DocCollection, type DocIndex, type DocumentContract, type DocumentStorage, type DomainDiscriminator, type DomainEmbedRelation, type DomainField, type DomainModel, type DomainReferenceRelation, type DomainRelation, type DomainRelationOn, type DomainVariantEntry, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultValue, type ExecutionPlan, type ExecutionSection, type Expr, type FieldType, type GenerateContractTypesOptions, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type ParamDescriptor, type ParameterizedCodecDescriptor, type PlanMeta, type PlanRefs, type ProfileHashBase, type ReferenceRelationKeys, type RenderTypeContext, type ResultType, type Source, type StorageBase, type StorageHashBase, type TaggedBigInt, type TaggedLiteralValue, type TaggedRaw, type TargetFamilyHook, type TypeRenderContext, type TypeRenderEntry, type TypeRenderer, type TypesImportSpec, type ValidationContext, bigintJsonReplacer, coreHash, isDocumentContract, isTaggedBigInt, isTaggedRaw, profileHash };
1
+ import { $ as DomainRelation, A as TaggedBigInt, B as ContractDiscriminator, C as PlanMeta, D as Source, E as ResultType, F as executionHash, G as ContractRelation, H as ContractField, I as isDocumentContract, J as DomainDiscriminator, K as ContractRelationOn, L as isTaggedBigInt, M as TaggedRaw, N as bigintJsonReplacer, O as StorageBase, P as coreHash, Q as DomainReferenceRelation, R as isTaggedRaw, S as ParamDescriptor, T as ProfileHashBase, U as ContractModel, V as ContractEmbedRelation, W as ContractReferenceRelation, X as DomainField, Y as DomainEmbedRelation, Z as DomainModel, _ as Expr, a as ColumnDefaultLiteralValue, b as JsonPrimitive, c as DocCollection, d as DocumentStorage, et as DomainRelationOn, f as ExecutionHashBase, g as ExecutionSection, h as ExecutionPlan, i as ColumnDefaultLiteralInputValue, it as ReferenceRelationKeys, j as TaggedLiteralValue, k as StorageHashBase, l as DocIndex, m as ExecutionMutationDefaultValue, n as Brand, nt as EmbedRelationKeys, o as ContractBase, p as ExecutionMutationDefault, q as ContractVariantEntry, r as ColumnDefault, rt as ModelStorageBase, s as ContractMarkerRecord, t as $, tt as DomainVariantEntry, u as DocumentContract, v as FieldType, w as PlanRefs, x as JsonValue, y as GeneratedValueSpec, z as profileHash } from "./types-DmKtoEd-.mjs";
2
+ import { n as ContractExecutionSection, t as Contract } from "./contract-types-x89nqTli.mjs";
3
+ export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractBase, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractMarkerRecord, type ContractModel, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractVariantEntry, type DocCollection, type DocIndex, type DocumentContract, type DocumentStorage, type DomainDiscriminator, type DomainEmbedRelation, type DomainField, type DomainModel, type DomainReferenceRelation, type DomainRelation, type DomainRelationOn, type DomainVariantEntry, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultValue, type ExecutionPlan, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type ParamDescriptor, type PlanMeta, type PlanRefs, type ProfileHashBase, type ReferenceRelationKeys, type ResultType, type Source, type StorageBase, type StorageHashBase, type TaggedBigInt, type TaggedLiteralValue, type TaggedRaw, bigintJsonReplacer, coreHash, executionHash, isDocumentContract, isTaggedBigInt, isTaggedRaw, profileHash };
package/dist/types.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as isTaggedRaw, i as isTaggedBigInt, n as coreHash, o as profileHash, r as isDocumentContract, t as bigintJsonReplacer } from "./types-DokLaU9G.mjs";
1
+ import { a as isTaggedBigInt, i as isDocumentContract, n as coreHash, o as isTaggedRaw, r as executionHash, s as profileHash, t as bigintJsonReplacer } from "./types-DYikGC04.mjs";
2
2
 
3
- export { bigintJsonReplacer, coreHash, isDocumentContract, isTaggedBigInt, isTaggedRaw, profileHash };
3
+ export { bigintJsonReplacer, coreHash, executionHash, isDocumentContract, isTaggedBigInt, isTaggedRaw, profileHash };
@@ -1,4 +1,4 @@
1
- import { J as Contract } from "./types-D-iOS0Ks.mjs";
1
+ import { t as Contract } from "./contract-types-x89nqTli.mjs";
2
2
 
3
3
  //#region src/validate-contract.d.ts
4
4
 
package/package.json CHANGED
@@ -1,21 +1,20 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.3.0-dev.140",
3
+ "version": "0.3.0-dev.142",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Data contract type definitions and JSON schema for Prisma Next",
7
7
  "dependencies": {
8
8
  "arktype": "^2.1.29",
9
- "@prisma-next/operations": "0.3.0-dev.140",
10
- "@prisma-next/utils": "0.3.0-dev.140"
9
+ "@prisma-next/utils": "0.3.0-dev.142"
11
10
  },
12
11
  "devDependencies": {
13
12
  "tsdown": "0.18.4",
14
13
  "typescript": "5.9.3",
15
14
  "vitest": "4.0.17",
16
- "@prisma-next/tsconfig": "0.0.0",
17
15
  "@prisma-next/test-utils": "0.0.1",
18
- "@prisma-next/tsdown": "0.0.0"
16
+ "@prisma-next/tsdown": "0.0.0",
17
+ "@prisma-next/tsconfig": "0.0.0"
19
18
  },
20
19
  "files": [
21
20
  "dist",
@@ -36,7 +35,7 @@
36
35
  "repository": {
37
36
  "type": "git",
38
37
  "url": "https://github.com/prisma/prisma-next.git",
39
- "directory": "packages/1-framework/1-core/shared/contract"
38
+ "directory": "packages/1-framework/0-foundation/shared/contract"
40
39
  },
41
40
  "scripts": {
42
41
  "build": "tsdown",
@@ -39,16 +39,13 @@ export type {
39
39
  ExecutionSection,
40
40
  Expr,
41
41
  FieldType,
42
- GenerateContractTypesOptions,
43
42
  GeneratedValueSpec,
44
43
  JsonPrimitive,
45
44
  JsonValue,
46
45
  ParamDescriptor,
47
- ParameterizedCodecDescriptor,
48
46
  PlanMeta,
49
47
  PlanRefs,
50
48
  ProfileHashBase,
51
- RenderTypeContext,
52
49
  ResultType,
53
50
  Source,
54
51
  StorageBase,
@@ -56,16 +53,11 @@ export type {
56
53
  TaggedBigInt,
57
54
  TaggedLiteralValue,
58
55
  TaggedRaw,
59
- TargetFamilyHook,
60
- TypeRenderContext,
61
- TypeRenderEntry,
62
- TypeRenderer,
63
- TypesImportSpec,
64
- ValidationContext,
65
56
  } from '../types';
66
57
  export {
67
58
  bigintJsonReplacer,
68
59
  coreHash,
60
+ executionHash,
69
61
  isDocumentContract,
70
62
  isTaggedBigInt,
71
63
  isTaggedRaw,
@@ -15,7 +15,7 @@ type ContractOverrides<
15
15
  storage?: Omit<TStorage, 'storageHash'>;
16
16
  capabilities?: Record<string, Record<string, boolean>>;
17
17
  extensionPacks?: Record<string, unknown>;
18
- execution?: ExecutionSection;
18
+ execution?: Omit<ExecutionSection, 'executionHash'>;
19
19
  profileHash?: ProfileHashBase<string>;
20
20
  meta?: Record<string, unknown>;
21
21
  };
package/src/types.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { OperationRegistry } from '@prisma-next/operations';
2
- import type { Contract } from './contract-types';
3
1
  import type { DomainModel } from './domain-types';
4
2
 
5
3
  /**
@@ -19,14 +17,6 @@ export type Brand<TKey extends string | number | symbol, TValue = true> = {
19
17
  };
20
18
  };
21
19
 
22
- /**
23
- * Context passed to type renderers during contract.d.ts generation.
24
- */
25
- export interface RenderTypeContext {
26
- /** The name of the CodecTypes type alias (typically 'CodecTypes') */
27
- readonly codecTypesName: string;
28
- }
29
-
30
20
  /**
31
21
  * Base type for storage contract hashes.
32
22
  * Emitted contract.d.ts files use this with the hash value as a type parameter:
@@ -41,6 +31,10 @@ export type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>
41
31
  */
42
32
  export type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
43
33
 
34
+ export function executionHash<const T extends string>(value: T): ExecutionHashBase<T> {
35
+ return value as ExecutionHashBase<T>;
36
+ }
37
+
44
38
  export function coreHash<const T extends string>(value: T): StorageHashBase<T> {
45
39
  return value as StorageHashBase<T>;
46
40
  }
@@ -158,7 +152,8 @@ export type ExecutionMutationDefault = {
158
152
  readonly onUpdate?: ExecutionMutationDefaultValue;
159
153
  };
160
154
 
161
- export type ExecutionSection = {
155
+ export type ExecutionSection<THash extends string = string> = {
156
+ readonly executionHash: ExecutionHashBase<THash>;
162
157
  readonly mutations: {
163
158
  readonly defaults: ReadonlyArray<ExecutionMutationDefault>;
164
159
  };
@@ -307,193 +302,3 @@ export interface ContractMarkerRecord {
307
302
  readonly appTag: string | null;
308
303
  readonly meta: Record<string, unknown>;
309
304
  }
310
-
311
- // Emitter types - moved from @prisma-next/emitter to shared location
312
- /**
313
- * Specifies how to import TypeScript types from a package.
314
- * Used in extension pack manifests to declare codec and operation type imports.
315
- */
316
- export interface TypesImportSpec {
317
- readonly package: string;
318
- readonly named: string;
319
- readonly alias: string;
320
- }
321
-
322
- /**
323
- * Validation context passed to TargetFamilyHook.validateTypes().
324
- * Contains pre-assembled operation registry, type imports, and extension IDs.
325
- */
326
- export interface ValidationContext {
327
- readonly operationRegistry?: OperationRegistry;
328
- readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
329
- readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
330
- readonly extensionIds?: ReadonlyArray<string>;
331
- /**
332
- * Parameterized codec descriptors collected from adapters and extensions.
333
- * Map of codecId → descriptor for quick lookup during type generation.
334
- */
335
- readonly parameterizedCodecs?: Map<string, ParameterizedCodecDescriptor>;
336
- }
337
-
338
- /**
339
- * Context for rendering parameterized types during contract.d.ts generation.
340
- * Passed to type renderers so they can reference CodecTypes by name.
341
- */
342
- export interface TypeRenderContext {
343
- readonly codecTypesName: string;
344
- }
345
-
346
- /**
347
- * A normalized type renderer for parameterized codecs.
348
- * This is the interface expected by TargetFamilyHook.generateContractTypes.
349
- */
350
- export interface TypeRenderEntry {
351
- readonly codecId: string;
352
- readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;
353
- }
354
-
355
- /**
356
- * Additional options for generateContractTypes.
357
- */
358
- export interface GenerateContractTypesOptions {
359
- /**
360
- * Normalized parameterized type renderers, keyed by codecId.
361
- * When a column has typeParams and a renderer exists for its codecId,
362
- * the renderer is called to produce the TypeScript type expression.
363
- */
364
- readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;
365
- /**
366
- * Type imports for parameterized codecs.
367
- * These are merged with codec and operation type imports in contract.d.ts.
368
- */
369
- readonly parameterizedTypeImports?: ReadonlyArray<TypesImportSpec>;
370
- /**
371
- * Query operation type imports for the query builder.
372
- * Flat operation signatures keyed by operation name, emitted as standalone QueryOperationTypes.
373
- */
374
- readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
375
- }
376
-
377
- /**
378
- * SPI interface for target family hooks that extend emission behavior.
379
- * Implemented by family-specific emitter hooks (e.g., SQL family).
380
- */
381
- export interface TargetFamilyHook {
382
- readonly id: string;
383
-
384
- /**
385
- * Validates that all type IDs in the contract come from referenced extension packs.
386
- * @param contract - Contract to validate
387
- * @param ctx - Validation context with operation registry and extension IDs
388
- */
389
- validateTypes(contract: Contract, ctx: ValidationContext): void;
390
-
391
- /**
392
- * Validates family-specific contract structure.
393
- * @param contract - Contract to validate
394
- */
395
- validateStructure(contract: Contract): void;
396
-
397
- /**
398
- * Generates contract.d.ts file content.
399
- * @param contract - Contract
400
- * @param codecTypeImports - Array of codec type import specs
401
- * @param operationTypeImports - Array of operation type import specs
402
- * @param hashes - Contract hash values (storageHash, executionHash, profileHash)
403
- * @param options - Additional options including parameterized type renderers
404
- * @returns Generated TypeScript type definitions as string
405
- */
406
- generateContractTypes(
407
- contract: Contract,
408
- codecTypeImports: ReadonlyArray<TypesImportSpec>,
409
- operationTypeImports: ReadonlyArray<TypesImportSpec>,
410
- hashes: {
411
- readonly storageHash: string;
412
- readonly executionHash?: string;
413
- readonly profileHash: string;
414
- },
415
- options?: GenerateContractTypesOptions,
416
- ): string;
417
- }
418
-
419
- // ============================================================================
420
- // Parameterized Codec Descriptor Types
421
- // ============================================================================
422
- //
423
- // Types for codecs that support type parameters (e.g., Vector<1536>, Decimal<2>).
424
- // These enable precise TypeScript types for parameterized columns without
425
- // coupling the SQL family emitter to specific adapter codec IDs.
426
- //
427
- // ============================================================================
428
-
429
- /**
430
- * Declarative type renderer that produces a TypeScript type expression.
431
- *
432
- * Renderers can be:
433
- * - A template string with `{{paramName}}` placeholders (e.g., `Vector<{{length}}>`)
434
- * - A function that receives typeParams and context and returns a type expression
435
- *
436
- * **Prefer template strings** for most cases:
437
- * - Templates are JSON-serializable (safe for pack-ref metadata)
438
- * - Templates can be statically analyzed by tooling
439
- *
440
- * Function renderers are allowed but have tradeoffs:
441
- * - Require runtime execution during emission (the emitter runs code)
442
- * - Not JSON-serializable (can't be stored in contract.json)
443
- * - The emitted artifacts (contract.json, contract.d.ts) still contain no
444
- * executable code - this constraint applies to outputs, not the emission process
445
- */
446
- export type TypeRenderer =
447
- | string
448
- | ((params: Record<string, unknown>, ctx: RenderTypeContext) => string);
449
-
450
- /**
451
- * Descriptor for a codec that supports type parameters.
452
- *
453
- * Parameterized codecs allow columns to carry additional metadata (typeParams)
454
- * that affects the generated TypeScript types. For example:
455
- * - A vector codec can use `{ length: 1536 }` to generate `Vector<1536>`
456
- * - A decimal codec can use `{ precision: 10, scale: 2 }` to generate `Decimal<10, 2>`
457
- *
458
- * The SQL family emitter uses these descriptors to generate precise types
459
- * without hard-coding knowledge of specific codec IDs.
460
- *
461
- * @example
462
- * ```typescript
463
- * const vectorCodecDescriptor: ParameterizedCodecDescriptor = {
464
- * codecId: 'pg/vector@1',
465
- * outputTypeRenderer: 'Vector<{{length}}>',
466
- * // Optional: paramsSchema for runtime validation
467
- * };
468
- * ```
469
- */
470
- export interface ParameterizedCodecDescriptor {
471
- /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */
472
- readonly codecId: string;
473
-
474
- /**
475
- * Renderer for the output (read) type.
476
- * Can be a template string or function.
477
- *
478
- * This is the primary renderer used by SQL emission to generate
479
- * model field types in contract.d.ts.
480
- */
481
- readonly outputTypeRenderer: TypeRenderer;
482
-
483
- /**
484
- * Optional renderer for the input (write) type.
485
- * If not provided, outputTypeRenderer is used for both.
486
- *
487
- * **Reserved for future use**: Currently, SQL emission only uses
488
- * outputTypeRenderer. This field is defined for future support of
489
- * asymmetric codecs where input and output types differ (e.g., a
490
- * codec that accepts `string | number` but always returns `number`).
491
- */
492
- readonly inputTypeRenderer?: TypeRenderer;
493
-
494
- /**
495
- * Optional import spec for types used by this codec's renderers.
496
- * The emitter will add this import to contract.d.ts.
497
- */
498
- readonly typesImport?: TypesImportSpec;
499
- }