@prisma-next/contract 0.3.0-pr.99.3 → 0.3.0-pr.99.5

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 (39) hide show
  1. package/dist/framework-components-B-XOtXw3.d.mts +854 -0
  2. package/dist/framework-components-B-XOtXw3.d.mts.map +1 -0
  3. package/dist/framework-components.d.mts +2 -0
  4. package/dist/framework-components.mjs +70 -0
  5. package/dist/framework-components.mjs.map +1 -0
  6. package/dist/ir-B8zNqals.d.mts +79 -0
  7. package/dist/ir-B8zNqals.d.mts.map +1 -0
  8. package/dist/ir.d.mts +2 -0
  9. package/dist/ir.mjs +46 -0
  10. package/dist/ir.mjs.map +1 -0
  11. package/dist/pack-manifest-types.d.mts +2 -0
  12. package/dist/pack-manifest-types.mjs +1 -0
  13. package/dist/types.d.mts +2 -0
  14. package/dist/types.mjs +11 -0
  15. package/dist/types.mjs.map +1 -0
  16. package/package.json +15 -23
  17. package/src/ir.ts +3 -3
  18. package/dist/exports/framework-components.d.ts +0 -3
  19. package/dist/exports/framework-components.d.ts.map +0 -1
  20. package/dist/exports/framework-components.js +0 -57
  21. package/dist/exports/framework-components.js.map +0 -1
  22. package/dist/exports/ir.d.ts +0 -2
  23. package/dist/exports/ir.d.ts.map +0 -1
  24. package/dist/exports/ir.js +0 -35
  25. package/dist/exports/ir.js.map +0 -1
  26. package/dist/exports/pack-manifest-types.d.ts +0 -2
  27. package/dist/exports/pack-manifest-types.d.ts.map +0 -1
  28. package/dist/exports/pack-manifest-types.js +0 -1
  29. package/dist/exports/pack-manifest-types.js.map +0 -1
  30. package/dist/exports/types.d.ts +0 -3
  31. package/dist/exports/types.d.ts.map +0 -1
  32. package/dist/exports/types.js +0 -8
  33. package/dist/exports/types.js.map +0 -1
  34. package/dist/framework-components.d.ts +0 -526
  35. package/dist/framework-components.d.ts.map +0 -1
  36. package/dist/ir.d.ts +0 -76
  37. package/dist/ir.d.ts.map +0 -1
  38. package/dist/types.d.ts +0 -326
  39. package/dist/types.d.ts.map +0 -1
@@ -0,0 +1,854 @@
1
+ import { t as ContractIR } from "./ir-B8zNqals.mjs";
2
+ import { OperationRegistry } from "@prisma-next/operations";
3
+
4
+ //#region src/types.d.ts
5
+ interface ContractBase {
6
+ readonly schemaVersion: string;
7
+ readonly target: string;
8
+ readonly targetFamily: string;
9
+ readonly coreHash: string;
10
+ readonly profileHash?: string;
11
+ readonly capabilities: Record<string, Record<string, boolean>>;
12
+ readonly extensionPacks: Record<string, unknown>;
13
+ readonly meta: Record<string, unknown>;
14
+ readonly sources: Record<string, Source>;
15
+ }
16
+ interface FieldType {
17
+ readonly type: string;
18
+ readonly nullable: boolean;
19
+ readonly items?: FieldType;
20
+ readonly properties?: Record<string, FieldType>;
21
+ }
22
+ interface Source {
23
+ readonly readOnly: boolean;
24
+ readonly projection: Record<string, FieldType>;
25
+ readonly origin?: Record<string, unknown>;
26
+ readonly capabilities?: Record<string, boolean>;
27
+ }
28
+ interface DocIndex {
29
+ readonly name: string;
30
+ readonly keys: Record<string, 'asc' | 'desc'>;
31
+ readonly unique?: boolean;
32
+ readonly where?: Expr;
33
+ }
34
+ type Expr = {
35
+ readonly kind: 'eq';
36
+ readonly path: ReadonlyArray<string>;
37
+ readonly value: unknown;
38
+ } | {
39
+ readonly kind: 'exists';
40
+ readonly path: ReadonlyArray<string>;
41
+ };
42
+ interface DocCollection {
43
+ readonly name: string;
44
+ readonly id?: {
45
+ readonly strategy: 'auto' | 'client' | 'uuid' | 'cuid' | 'objectId';
46
+ };
47
+ readonly fields: Record<string, FieldType>;
48
+ readonly indexes?: ReadonlyArray<DocIndex>;
49
+ readonly readOnly?: boolean;
50
+ }
51
+ interface DocumentStorage {
52
+ readonly document: {
53
+ readonly collections: Record<string, DocCollection>;
54
+ };
55
+ }
56
+ interface DocumentContract extends ContractBase {
57
+ readonly targetFamily: string;
58
+ readonly storage: DocumentStorage;
59
+ }
60
+ interface ParamDescriptor {
61
+ readonly index?: number;
62
+ readonly name?: string;
63
+ readonly codecId?: string;
64
+ readonly nativeType?: string;
65
+ readonly nullable?: boolean;
66
+ readonly source: 'dsl' | 'raw';
67
+ readonly refs?: {
68
+ table: string;
69
+ column: string;
70
+ };
71
+ }
72
+ interface PlanRefs {
73
+ readonly tables?: readonly string[];
74
+ readonly columns?: ReadonlyArray<{
75
+ table: string;
76
+ column: string;
77
+ }>;
78
+ readonly indexes?: ReadonlyArray<{
79
+ readonly table: string;
80
+ readonly columns: ReadonlyArray<string>;
81
+ readonly name?: string;
82
+ }>;
83
+ }
84
+ interface PlanMeta {
85
+ readonly target: string;
86
+ readonly targetFamily?: string;
87
+ readonly coreHash: string;
88
+ readonly profileHash?: string;
89
+ readonly lane: string;
90
+ readonly annotations?: {
91
+ codecs?: Record<string, string>;
92
+ [key: string]: unknown;
93
+ };
94
+ readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;
95
+ readonly refs?: PlanRefs;
96
+ readonly projection?: Record<string, string> | ReadonlyArray<string>;
97
+ /**
98
+ * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).
99
+ * Used for codec resolution when AST+refs don't provide enough type info.
100
+ */
101
+ readonly projectionTypes?: Record<string, string>;
102
+ }
103
+ /**
104
+ * Canonical execution plan shape used by runtimes.
105
+ *
106
+ * - Row is the inferred result row type (TypeScript-only).
107
+ * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).
108
+ *
109
+ * The payload executed by the runtime is represented by the sql + params pair
110
+ * for now; future families can specialize this via Ast or additional metadata.
111
+ */
112
+ interface ExecutionPlan<Row = unknown, Ast = unknown> {
113
+ readonly sql: string;
114
+ readonly params: readonly unknown[];
115
+ readonly ast?: Ast;
116
+ readonly meta: PlanMeta;
117
+ /**
118
+ * Phantom property to carry the Row generic for type-level utilities.
119
+ * Not set at runtime; used only for ResultType extraction.
120
+ */
121
+ readonly _row?: Row;
122
+ }
123
+ /**
124
+ * Utility type to extract the Row type from an ExecutionPlan.
125
+ * Example: `type Row = ResultType<typeof plan>`
126
+ *
127
+ * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).
128
+ * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter
129
+ * for type extraction.
130
+ */
131
+ type ResultType<P> = P extends ExecutionPlan<infer R, unknown> ? R : P extends {
132
+ readonly _Row?: infer R;
133
+ } ? R : never;
134
+ /**
135
+ * Type guard to check if a contract is a Document contract
136
+ */
137
+ declare function isDocumentContract(contract: unknown): contract is DocumentContract;
138
+ /**
139
+ * Contract marker record stored in the database.
140
+ * Represents the current contract identity for a database.
141
+ */
142
+ interface ContractMarkerRecord {
143
+ readonly coreHash: string;
144
+ readonly profileHash: string;
145
+ readonly contractJson: unknown | null;
146
+ readonly canonicalVersion: number | null;
147
+ readonly updatedAt: Date;
148
+ readonly appTag: string | null;
149
+ readonly meta: Record<string, unknown>;
150
+ }
151
+ /**
152
+ * Specifies how to import TypeScript types from a package.
153
+ * Used in extension pack manifests to declare codec and operation type imports.
154
+ */
155
+ interface TypesImportSpec {
156
+ readonly package: string;
157
+ readonly named: string;
158
+ readonly alias: string;
159
+ }
160
+ /**
161
+ * Validation context passed to TargetFamilyHook.validateTypes().
162
+ * Contains pre-assembled operation registry, type imports, and extension IDs.
163
+ */
164
+ interface ValidationContext {
165
+ readonly operationRegistry?: OperationRegistry;
166
+ readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
167
+ readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
168
+ readonly extensionIds?: ReadonlyArray<string>;
169
+ /**
170
+ * Parameterized codec descriptors collected from adapters and extensions.
171
+ * Map of codecId → descriptor for quick lookup during type generation.
172
+ */
173
+ readonly parameterizedCodecs?: Map<string, ParameterizedCodecDescriptor>;
174
+ }
175
+ /**
176
+ * Context for rendering parameterized types during contract.d.ts generation.
177
+ * Passed to type renderers so they can reference CodecTypes by name.
178
+ */
179
+ interface TypeRenderContext {
180
+ readonly codecTypesName: string;
181
+ }
182
+ /**
183
+ * A normalized type renderer for parameterized codecs.
184
+ * This is the interface expected by TargetFamilyHook.generateContractTypes.
185
+ */
186
+ interface TypeRenderEntry {
187
+ readonly codecId: string;
188
+ readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;
189
+ }
190
+ /**
191
+ * Additional options for generateContractTypes.
192
+ */
193
+ interface GenerateContractTypesOptions {
194
+ /**
195
+ * Normalized parameterized type renderers, keyed by codecId.
196
+ * When a column has typeParams and a renderer exists for its codecId,
197
+ * the renderer is called to produce the TypeScript type expression.
198
+ */
199
+ readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;
200
+ /**
201
+ * Type imports for parameterized codecs.
202
+ * These are merged with codec and operation type imports in contract.d.ts.
203
+ */
204
+ readonly parameterizedTypeImports?: ReadonlyArray<TypesImportSpec>;
205
+ }
206
+ /**
207
+ * SPI interface for target family hooks that extend emission behavior.
208
+ * Implemented by family-specific emitter hooks (e.g., SQL family).
209
+ */
210
+ interface TargetFamilyHook {
211
+ readonly id: string;
212
+ /**
213
+ * Validates that all type IDs in the contract come from referenced extension packs.
214
+ * @param ir - Contract IR to validate
215
+ * @param ctx - Validation context with operation registry and extension IDs
216
+ */
217
+ validateTypes(ir: ContractIR, ctx: ValidationContext): void;
218
+ /**
219
+ * Validates family-specific contract structure.
220
+ * @param ir - Contract IR to validate
221
+ */
222
+ validateStructure(ir: ContractIR): void;
223
+ /**
224
+ * Generates contract.d.ts file content.
225
+ * @param ir - Contract IR
226
+ * @param codecTypeImports - Array of codec type import specs
227
+ * @param operationTypeImports - Array of operation type import specs
228
+ * @param options - Additional options including parameterized type renderers
229
+ * @returns Generated TypeScript type definitions as string
230
+ */
231
+ generateContractTypes(ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>, options?: GenerateContractTypesOptions): string;
232
+ }
233
+ type ArgSpecManifest = {
234
+ readonly kind: 'typeId';
235
+ readonly type: string;
236
+ } | {
237
+ readonly kind: 'param';
238
+ } | {
239
+ readonly kind: 'literal';
240
+ };
241
+ type ReturnSpecManifest = {
242
+ readonly kind: 'typeId';
243
+ readonly type: string;
244
+ } | {
245
+ readonly kind: 'builtin';
246
+ readonly type: 'number' | 'boolean' | 'string';
247
+ };
248
+ interface LoweringSpecManifest {
249
+ readonly targetFamily: 'sql';
250
+ readonly strategy: 'infix' | 'function';
251
+ readonly template: string;
252
+ }
253
+ interface OperationManifest {
254
+ readonly for: string;
255
+ readonly method: string;
256
+ readonly args: ReadonlyArray<ArgSpecManifest>;
257
+ readonly returns: ReturnSpecManifest;
258
+ readonly lowering: LoweringSpecManifest;
259
+ readonly capabilities?: ReadonlyArray<string>;
260
+ }
261
+ /**
262
+ * Declarative type renderer that produces a TypeScript type expression.
263
+ *
264
+ * Renderers can be:
265
+ * - A template string with `{{paramName}}` placeholders (e.g., `Vector<{{length}}>`)
266
+ * - A function that receives typeParams and context and returns a type expression
267
+ *
268
+ * **Prefer template strings** for most cases:
269
+ * - Templates are JSON-serializable (safe for pack-ref metadata)
270
+ * - Templates can be statically analyzed by tooling
271
+ *
272
+ * Function renderers are allowed but have tradeoffs:
273
+ * - Require runtime execution during emission (the emitter runs code)
274
+ * - Not JSON-serializable (can't be stored in contract.json)
275
+ * - The emitted artifacts (contract.json, contract.d.ts) still contain no
276
+ * executable code - this constraint applies to outputs, not the emission process
277
+ */
278
+ type TypeRenderer$1 = string | ((params: Record<string, unknown>, ctx: RenderTypeContext) => string);
279
+ /**
280
+ * Descriptor for a codec that supports type parameters.
281
+ *
282
+ * Parameterized codecs allow columns to carry additional metadata (typeParams)
283
+ * that affects the generated TypeScript types. For example:
284
+ * - A vector codec can use `{ length: 1536 }` to generate `Vector<1536>`
285
+ * - A decimal codec can use `{ precision: 10, scale: 2 }` to generate `Decimal<10, 2>`
286
+ *
287
+ * The SQL family emitter uses these descriptors to generate precise types
288
+ * without hard-coding knowledge of specific codec IDs.
289
+ *
290
+ * @example
291
+ * ```typescript
292
+ * const vectorCodecDescriptor: ParameterizedCodecDescriptor = {
293
+ * codecId: 'pg/vector@1',
294
+ * outputTypeRenderer: 'Vector<{{length}}>',
295
+ * // Optional: paramsSchema for runtime validation
296
+ * };
297
+ * ```
298
+ */
299
+ interface ParameterizedCodecDescriptor {
300
+ /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */
301
+ readonly codecId: string;
302
+ /**
303
+ * Renderer for the output (read) type.
304
+ * Can be a template string or function.
305
+ *
306
+ * This is the primary renderer used by SQL emission to generate
307
+ * model field types in contract.d.ts.
308
+ */
309
+ readonly outputTypeRenderer: TypeRenderer$1;
310
+ /**
311
+ * Optional renderer for the input (write) type.
312
+ * If not provided, outputTypeRenderer is used for both.
313
+ *
314
+ * **Reserved for future use**: Currently, SQL emission only uses
315
+ * outputTypeRenderer. This field is defined for future support of
316
+ * asymmetric codecs where input and output types differ (e.g., a
317
+ * codec that accepts `string | number` but always returns `number`).
318
+ */
319
+ readonly inputTypeRenderer?: TypeRenderer$1;
320
+ /**
321
+ * Optional import spec for types used by this codec's renderers.
322
+ * The emitter will add this import to contract.d.ts.
323
+ */
324
+ readonly typesImport?: TypesImportSpec;
325
+ }
326
+ //#endregion
327
+ //#region src/framework-components.d.ts
328
+ /**
329
+ * Context passed to type renderers during contract.d.ts generation.
330
+ */
331
+ interface RenderTypeContext {
332
+ /** The name of the CodecTypes type alias (typically 'CodecTypes') */
333
+ readonly codecTypesName: string;
334
+ }
335
+ /**
336
+ * A template-based type renderer (structured form).
337
+ * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are
338
+ * replaced with typeParams values during rendering.
339
+ *
340
+ * @example
341
+ * ```ts
342
+ * { kind: 'template', template: 'Vector<{{length}}>' }
343
+ * // With typeParams { length: 1536 }, renders: 'Vector<1536>'
344
+ * ```
345
+ */
346
+ interface TypeRendererTemplate {
347
+ readonly kind: 'template';
348
+ /** Template string with `{{key}}` placeholders for typeParams values */
349
+ readonly template: string;
350
+ }
351
+ /**
352
+ * A function-based type renderer for full control over type expression generation.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * {
357
+ * kind: 'function',
358
+ * render: (params, ctx) => `Vector<${params.length}>`
359
+ * }
360
+ * ```
361
+ */
362
+ interface TypeRendererFunction {
363
+ readonly kind: 'function';
364
+ /** Render function that produces a TypeScript type expression */
365
+ readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
366
+ }
367
+ /**
368
+ * A raw template string type renderer (convenience form).
369
+ * Shorthand for TypeRendererTemplate - just the template string without wrapper.
370
+ *
371
+ * @example
372
+ * ```ts
373
+ * 'Vector<{{length}}>'
374
+ * // Equivalent to: { kind: 'template', template: 'Vector<{{length}}>' }
375
+ * ```
376
+ */
377
+ type TypeRendererString = string;
378
+ /**
379
+ * A raw function type renderer (convenience form).
380
+ * Shorthand for TypeRendererFunction - just the function without wrapper.
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * (params, ctx) => `Vector<${params.length}>`
385
+ * // Equivalent to: { kind: 'function', render: ... }
386
+ * ```
387
+ */
388
+ type TypeRendererRawFunction = (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
389
+ /**
390
+ * Union of type renderer formats.
391
+ *
392
+ * Supports both structured forms (with `kind` discriminator) and convenience forms:
393
+ * - `string` - Template string with `{{key}}` placeholders (manifest-safe, JSON-serializable)
394
+ * - `function` - Render function for full control (requires runtime execution)
395
+ * - `{ kind: 'template', template: string }` - Structured template form
396
+ * - `{ kind: 'function', render: fn }` - Structured function form
397
+ *
398
+ * Templates are normalized to functions during pack assembly.
399
+ * **Prefer template strings** for most cases - they are JSON-serializable.
400
+ */
401
+ type TypeRenderer = TypeRendererString | TypeRendererRawFunction | TypeRendererTemplate | TypeRendererFunction;
402
+ /**
403
+ * Normalized type renderer - always a function after assembly.
404
+ * This is the form received by the emitter.
405
+ */
406
+ interface NormalizedTypeRenderer {
407
+ readonly codecId: string;
408
+ readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
409
+ }
410
+ /**
411
+ * Interpolates a template string with params values.
412
+ * Used internally by normalizeRenderer to compile templates to functions.
413
+ *
414
+ * @throws Error if a placeholder key is not found in params (except 'CodecTypes')
415
+ */
416
+ declare function interpolateTypeTemplate(template: string, params: Record<string, unknown>, ctx: RenderTypeContext): string;
417
+ /**
418
+ * Normalizes a TypeRenderer to function form.
419
+ * Called during pack assembly, not at emission time.
420
+ *
421
+ * Handles all TypeRenderer forms:
422
+ * - Raw string template: `'Vector<{{length}}>'`
423
+ * - Raw function: `(params, ctx) => ...`
424
+ * - Structured template: `{ kind: 'template', template: '...' }`
425
+ * - Structured function: `{ kind: 'function', render: fn }`
426
+ */
427
+ declare function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer;
428
+ /**
429
+ * Declarative fields that describe component metadata.
430
+ * These fields are owned directly by descriptors (not nested under a manifest).
431
+ */
432
+ interface ComponentMetadata {
433
+ /** Component version (semver) */
434
+ readonly version: string;
435
+ /**
436
+ * Capabilities this component provides.
437
+ *
438
+ * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
439
+ * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
440
+ * keep these declarations in sync. Targets are identifiers/descriptors and typically do not
441
+ * declare capabilities.
442
+ */
443
+ readonly capabilities?: Record<string, unknown>;
444
+ /** Type imports for contract.d.ts generation */
445
+ readonly types?: {
446
+ readonly codecTypes?: {
447
+ /**
448
+ * Base codec types import spec.
449
+ * Optional: adapters typically provide this, extensions usually don't.
450
+ */
451
+ readonly import?: TypesImportSpec;
452
+ /**
453
+ * Optional renderers for parameterized codecs owned by this component.
454
+ * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.
455
+ *
456
+ * Templates are normalized to functions during pack assembly.
457
+ * Duplicate codecId across descriptors is a hard error.
458
+ */
459
+ readonly parameterized?: Record<string, TypeRenderer>;
460
+ /**
461
+ * Optional type imports for parameterized codecs.
462
+ * These imports are added to contract.d.ts when parameterized renderers
463
+ * reference types from external packages.
464
+ */
465
+ readonly parameterizedImports?: ReadonlyArray<TypesImportSpec>;
466
+ };
467
+ readonly operationTypes?: {
468
+ readonly import: TypesImportSpec;
469
+ };
470
+ readonly storage?: ReadonlyArray<{
471
+ readonly typeId: string;
472
+ readonly familyId: string;
473
+ readonly targetId: string;
474
+ readonly nativeType?: string;
475
+ }>;
476
+ };
477
+ /** Operation manifests for building operation registries */
478
+ readonly operations?: ReadonlyArray<OperationManifest>;
479
+ }
480
+ /**
481
+ * Base descriptor for any framework component.
482
+ *
483
+ * All component descriptors share these fundamental properties that identify
484
+ * the component and provide its metadata. This interface is extended by
485
+ * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
486
+ *
487
+ * @template Kind - Discriminator literal identifying the component type.
488
+ * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
489
+ * but the type accepts any string to allow ecosystem extensions.
490
+ *
491
+ * @example
492
+ * ```ts
493
+ * // All descriptors have these properties
494
+ * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)
495
+ * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')
496
+ * descriptor.version // Component version (semver)
497
+ * ```
498
+ */
499
+ interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {
500
+ /** Discriminator identifying the component type */
501
+ readonly kind: Kind;
502
+ /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */
503
+ readonly id: string;
504
+ }
505
+ interface ContractComponentRequirementsCheckInput {
506
+ readonly contract: {
507
+ readonly target: string;
508
+ readonly targetFamily?: string | undefined;
509
+ readonly extensionPacks?: Record<string, unknown> | undefined;
510
+ };
511
+ readonly expectedTargetFamily?: string | undefined;
512
+ readonly expectedTargetId?: string | undefined;
513
+ readonly providedComponentIds: Iterable<string>;
514
+ }
515
+ interface ContractComponentRequirementsCheckResult {
516
+ readonly familyMismatch?: {
517
+ readonly expected: string;
518
+ readonly actual: string;
519
+ } | undefined;
520
+ readonly targetMismatch?: {
521
+ readonly expected: string;
522
+ readonly actual: string;
523
+ } | undefined;
524
+ readonly missingExtensionPackIds: readonly string[];
525
+ }
526
+ declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult;
527
+ /**
528
+ * Descriptor for a family component.
529
+ *
530
+ * A "family" represents a category of data sources with shared semantics
531
+ * (e.g., SQL databases, document stores). Families define:
532
+ * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
533
+ * - Contract structure (tables vs collections, columns vs fields)
534
+ * - Type system and codecs
535
+ *
536
+ * Families are the top-level grouping. Each family contains multiple targets
537
+ * (e.g., SQL family contains Postgres, MySQL, SQLite targets).
538
+ *
539
+ * Extended by plane-specific descriptors:
540
+ * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations
541
+ * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods
542
+ *
543
+ * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
544
+ *
545
+ * @example
546
+ * ```ts
547
+ * import sql from '@prisma-next/family-sql/control';
548
+ *
549
+ * sql.kind // 'family'
550
+ * sql.familyId // 'sql'
551
+ * sql.id // 'sql'
552
+ * ```
553
+ */
554
+ interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {
555
+ /** The family identifier (e.g., 'sql', 'document') */
556
+ readonly familyId: TFamilyId;
557
+ }
558
+ /**
559
+ * Descriptor for a target component.
560
+ *
561
+ * A "target" represents a specific database or data store within a family
562
+ * (e.g., Postgres, MySQL, MongoDB). Targets define:
563
+ * - Native type mappings (e.g., Postgres int4 → TypeScript number)
564
+ * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
565
+ *
566
+ * Targets are bound to a family and provide the target-specific implementation
567
+ * details that adapters and drivers use.
568
+ *
569
+ * Extended by plane-specific descriptors:
570
+ * - `ControlTargetDescriptor` - adds optional `migrations` capability
571
+ * - `RuntimeTargetDescriptor` - adds runtime factory method
572
+ *
573
+ * @template TFamilyId - Literal type for the family identifier
574
+ * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
575
+ *
576
+ * @example
577
+ * ```ts
578
+ * import postgres from '@prisma-next/target-postgres/control';
579
+ *
580
+ * postgres.kind // 'target'
581
+ * postgres.familyId // 'sql'
582
+ * postgres.targetId // 'postgres'
583
+ * ```
584
+ */
585
+ interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> {
586
+ /** The family this target belongs to */
587
+ readonly familyId: TFamilyId;
588
+ /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
589
+ readonly targetId: TTargetId;
590
+ }
591
+ /**
592
+ * Base shape for any pack reference.
593
+ * Pack refs are pure JSON-friendly objects safe to import in authoring flows.
594
+ */
595
+ interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
596
+ readonly kind: Kind;
597
+ readonly id: string;
598
+ readonly familyId: TFamilyId;
599
+ readonly targetId?: string;
600
+ }
601
+ type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & {
602
+ readonly targetId: TTargetId;
603
+ };
604
+ type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & {
605
+ readonly targetId: TTargetId;
606
+ };
607
+ type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & {
608
+ readonly targetId: TTargetId;
609
+ };
610
+ type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & {
611
+ readonly targetId: TTargetId;
612
+ };
613
+ /**
614
+ * Descriptor for an adapter component.
615
+ *
616
+ * An "adapter" provides the protocol and dialect implementation for a target.
617
+ * Adapters handle:
618
+ * - SQL/query generation (lowering AST to target-specific syntax)
619
+ * - Codec registration (encoding/decoding between JS and wire types)
620
+ * - Type mappings and coercions
621
+ *
622
+ * Adapters are bound to a specific family+target combination and work with
623
+ * any compatible driver for that target.
624
+ *
625
+ * Extended by plane-specific descriptors:
626
+ * - `ControlAdapterDescriptor` - control-plane factory
627
+ * - `RuntimeAdapterDescriptor` - runtime factory
628
+ *
629
+ * @template TFamilyId - Literal type for the family identifier
630
+ * @template TTargetId - Literal type for the target identifier
631
+ *
632
+ * @example
633
+ * ```ts
634
+ * import postgresAdapter from '@prisma-next/adapter-postgres/control';
635
+ *
636
+ * postgresAdapter.kind // 'adapter'
637
+ * postgresAdapter.familyId // 'sql'
638
+ * postgresAdapter.targetId // 'postgres'
639
+ * ```
640
+ */
641
+ interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> {
642
+ /** The family this adapter belongs to */
643
+ readonly familyId: TFamilyId;
644
+ /** The target this adapter is designed for */
645
+ readonly targetId: TTargetId;
646
+ }
647
+ /**
648
+ * Descriptor for a driver component.
649
+ *
650
+ * A "driver" provides the connection and execution layer for a target.
651
+ * Drivers handle:
652
+ * - Connection management (pooling, timeouts, retries)
653
+ * - Query execution (sending SQL/commands, receiving results)
654
+ * - Transaction management
655
+ * - Wire protocol communication
656
+ *
657
+ * Drivers are bound to a specific family+target and work with any compatible
658
+ * adapter. Multiple drivers can exist for the same target (e.g., node-postgres
659
+ * vs postgres.js for Postgres).
660
+ *
661
+ * Extended by plane-specific descriptors:
662
+ * - `ControlDriverDescriptor` - creates driver from connection URL
663
+ * - `RuntimeDriverDescriptor` - creates driver with runtime options
664
+ *
665
+ * @template TFamilyId - Literal type for the family identifier
666
+ * @template TTargetId - Literal type for the target identifier
667
+ *
668
+ * @example
669
+ * ```ts
670
+ * import postgresDriver from '@prisma-next/driver-postgres/control';
671
+ *
672
+ * postgresDriver.kind // 'driver'
673
+ * postgresDriver.familyId // 'sql'
674
+ * postgresDriver.targetId // 'postgres'
675
+ * ```
676
+ */
677
+ interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> {
678
+ /** The family this driver belongs to */
679
+ readonly familyId: TFamilyId;
680
+ /** The target this driver connects to */
681
+ readonly targetId: TTargetId;
682
+ }
683
+ /**
684
+ * Descriptor for an extension component.
685
+ *
686
+ * An "extension" adds optional capabilities to a target. Extensions can provide:
687
+ * - Additional operations (e.g., vector similarity search with pgvector)
688
+ * - Custom types and codecs (e.g., vector type)
689
+ * - Extended query capabilities
690
+ *
691
+ * Extensions are bound to a specific family+target and are registered in the
692
+ * config alongside the core components. Multiple extensions can be used together.
693
+ *
694
+ * Extended by plane-specific descriptors:
695
+ * - `ControlExtensionDescriptor` - control-plane extension factory
696
+ * - `RuntimeExtensionDescriptor` - runtime extension factory
697
+ *
698
+ * @template TFamilyId - Literal type for the family identifier
699
+ * @template TTargetId - Literal type for the target identifier
700
+ *
701
+ * @example
702
+ * ```ts
703
+ * import pgvector from '@prisma-next/extension-pgvector/control';
704
+ *
705
+ * pgvector.kind // 'extension'
706
+ * pgvector.familyId // 'sql'
707
+ * pgvector.targetId // 'postgres'
708
+ * ```
709
+ */
710
+ interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> {
711
+ /** The family this extension belongs to */
712
+ readonly familyId: TFamilyId;
713
+ /** The target this extension is designed for */
714
+ readonly targetId: TTargetId;
715
+ }
716
+ /**
717
+ * Union type for target-bound component descriptors.
718
+ *
719
+ * Target-bound components are those that must be compatible with a specific
720
+ * family+target combination. This includes targets, adapters, drivers, and
721
+ * extensions. Families are not target-bound.
722
+ *
723
+ * This type is used in migration and verification interfaces to enforce
724
+ * type-level compatibility between components.
725
+ *
726
+ * @template TFamilyId - Literal type for the family identifier
727
+ * @template TTargetId - Literal type for the target identifier
728
+ *
729
+ * @example
730
+ * ```ts
731
+ * // All these components must have matching familyId and targetId
732
+ * const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [
733
+ * postgresTarget,
734
+ * postgresAdapter,
735
+ * postgresDriver,
736
+ * pgvectorExtension,
737
+ * ];
738
+ * ```
739
+ */
740
+ type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>;
741
+ /**
742
+ * Base interface for family instances.
743
+ *
744
+ * A family instance is created by a family descriptor's `create()` method.
745
+ * This base interface carries only the identity; plane-specific interfaces
746
+ * add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).
747
+ *
748
+ * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
749
+ *
750
+ * @example
751
+ * ```ts
752
+ * const instance = sql.create({ target, adapter, driver, extensions });
753
+ * instance.familyId // 'sql'
754
+ * ```
755
+ */
756
+ interface FamilyInstance<TFamilyId extends string> {
757
+ /** The family identifier (e.g., 'sql', 'document') */
758
+ readonly familyId: TFamilyId;
759
+ }
760
+ /**
761
+ * Base interface for target instances.
762
+ *
763
+ * A target instance is created by a target descriptor's `create()` method.
764
+ * This base interface carries only the identity; plane-specific interfaces
765
+ * add target-specific behavior.
766
+ *
767
+ * @template TFamilyId - Literal type for the family identifier
768
+ * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
769
+ *
770
+ * @example
771
+ * ```ts
772
+ * const instance = postgres.create();
773
+ * instance.familyId // 'sql'
774
+ * instance.targetId // 'postgres'
775
+ * ```
776
+ */
777
+ interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
778
+ /** The family this target belongs to */
779
+ readonly familyId: TFamilyId;
780
+ /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
781
+ readonly targetId: TTargetId;
782
+ }
783
+ /**
784
+ * Base interface for adapter instances.
785
+ *
786
+ * An adapter instance is created by an adapter descriptor's `create()` method.
787
+ * This base interface carries only the identity; plane-specific interfaces
788
+ * add adapter-specific behavior (e.g., codec registration, query lowering).
789
+ *
790
+ * @template TFamilyId - Literal type for the family identifier
791
+ * @template TTargetId - Literal type for the target identifier
792
+ *
793
+ * @example
794
+ * ```ts
795
+ * const instance = postgresAdapter.create();
796
+ * instance.familyId // 'sql'
797
+ * instance.targetId // 'postgres'
798
+ * ```
799
+ */
800
+ interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
801
+ /** The family this adapter belongs to */
802
+ readonly familyId: TFamilyId;
803
+ /** The target this adapter is designed for */
804
+ readonly targetId: TTargetId;
805
+ }
806
+ /**
807
+ * Base interface for driver instances.
808
+ *
809
+ * A driver instance is created by a driver descriptor's `create()` method.
810
+ * This base interface carries only the identity; plane-specific interfaces
811
+ * add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).
812
+ *
813
+ * @template TFamilyId - Literal type for the family identifier
814
+ * @template TTargetId - Literal type for the target identifier
815
+ *
816
+ * @example
817
+ * ```ts
818
+ * const instance = postgresDriver.create({ databaseUrl });
819
+ * instance.familyId // 'sql'
820
+ * instance.targetId // 'postgres'
821
+ * ```
822
+ */
823
+ interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
824
+ /** The family this driver belongs to */
825
+ readonly familyId: TFamilyId;
826
+ /** The target this driver connects to */
827
+ readonly targetId: TTargetId;
828
+ }
829
+ /**
830
+ * Base interface for extension instances.
831
+ *
832
+ * An extension instance is created by an extension descriptor's `create()` method.
833
+ * This base interface carries only the identity; plane-specific interfaces
834
+ * add extension-specific behavior.
835
+ *
836
+ * @template TFamilyId - Literal type for the family identifier
837
+ * @template TTargetId - Literal type for the target identifier
838
+ *
839
+ * @example
840
+ * ```ts
841
+ * const instance = pgvector.create();
842
+ * instance.familyId // 'sql'
843
+ * instance.targetId // 'postgres'
844
+ * ```
845
+ */
846
+ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
847
+ /** The family this extension belongs to */
848
+ readonly familyId: TFamilyId;
849
+ /** The target this extension is designed for */
850
+ readonly targetId: TTargetId;
851
+ }
852
+ //#endregion
853
+ export { TypesImportSpec as $, ContractBase as A, LoweringSpecManifest as B, TypeRenderer as C, interpolateTypeTemplate as D, checkContractComponentRequirements as E, DocumentStorage as F, PlanRefs as G, ParamDescriptor as H, ExecutionPlan as I, Source as J, ResultType as K, Expr as L, DocCollection as M, DocIndex as N, normalizeRenderer as O, DocumentContract as P, TypeRenderer$1 as Q, FieldType as R, TargetPackRef as S, TypeRendererTemplate as T, ParameterizedCodecDescriptor as U, OperationManifest as V, PlanMeta as W, TypeRenderContext as X, TargetFamilyHook as Y, TypeRenderEntry as Z, PackRefBase as _, ComponentMetadata as a, TargetDescriptor as b, DriverDescriptor as c, ExtensionDescriptor as d, ValidationContext as et, ExtensionInstance as f, NormalizedTypeRenderer as g, FamilyInstance as h, ComponentDescriptor as i, ContractMarkerRecord as j, ArgSpecManifest as k, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, ReturnSpecManifest as q, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, isDocumentContract as tt, DriverPackRef as u, RenderTypeContext as v, TypeRendererFunction as w, TargetInstance as x, TargetBoundComponentDescriptor as y, GenerateContractTypesOptions as z };
854
+ //# sourceMappingURL=framework-components-B-XOtXw3.d.mts.map