@prisma-next/contract 0.3.0-dev.4 → 0.3.0-dev.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.
@@ -1,224 +1,3 @@
1
- import { OperationRegistry } from '@prisma-next/operations';
2
- import { ContractIR } from './ir.js';
3
-
4
- interface ContractBase {
5
- readonly schemaVersion: string;
6
- readonly target: string;
7
- readonly targetFamily: string;
8
- readonly coreHash: string;
9
- readonly profileHash?: string;
10
- readonly capabilities?: Record<string, Record<string, boolean>>;
11
- readonly extensionPacks?: Record<string, unknown>;
12
- readonly meta?: Record<string, unknown>;
13
- readonly sources?: Record<string, Source>;
14
- }
15
- interface FieldType {
16
- readonly type: string;
17
- readonly nullable: boolean;
18
- readonly items?: FieldType;
19
- readonly properties?: Record<string, FieldType>;
20
- }
21
- interface Source {
22
- readonly readOnly: boolean;
23
- readonly projection: Record<string, FieldType>;
24
- readonly origin?: Record<string, unknown>;
25
- readonly capabilities?: Record<string, boolean>;
26
- }
27
- interface DocIndex {
28
- readonly name: string;
29
- readonly keys: Record<string, 'asc' | 'desc'>;
30
- readonly unique?: boolean;
31
- readonly where?: Expr;
32
- }
33
- type Expr = {
34
- readonly kind: 'eq';
35
- readonly path: ReadonlyArray<string>;
36
- readonly value: unknown;
37
- } | {
38
- readonly kind: 'exists';
39
- readonly path: ReadonlyArray<string>;
40
- };
41
- interface DocCollection {
42
- readonly name: string;
43
- readonly id?: {
44
- readonly strategy: 'auto' | 'client' | 'uuid' | 'cuid' | 'objectId';
45
- };
46
- readonly fields: Record<string, FieldType>;
47
- readonly indexes?: ReadonlyArray<DocIndex>;
48
- readonly readOnly?: boolean;
49
- }
50
- interface DocumentStorage {
51
- readonly document: {
52
- readonly collections: Record<string, DocCollection>;
53
- };
54
- }
55
- interface DocumentContract extends ContractBase {
56
- readonly targetFamily: string;
57
- readonly storage: DocumentStorage;
58
- }
59
- interface ParamDescriptor {
60
- readonly index?: number;
61
- readonly name?: string;
62
- readonly codecId?: string;
63
- readonly nativeType?: string;
64
- readonly nullable?: boolean;
65
- readonly source: 'dsl' | 'raw';
66
- readonly refs?: {
67
- table: string;
68
- column: string;
69
- };
70
- }
71
- interface PlanRefs {
72
- readonly tables?: readonly string[];
73
- readonly columns?: ReadonlyArray<{
74
- table: string;
75
- column: string;
76
- }>;
77
- readonly indexes?: ReadonlyArray<{
78
- readonly table: string;
79
- readonly columns: ReadonlyArray<string>;
80
- readonly name?: string;
81
- }>;
82
- }
83
- interface PlanMeta {
84
- readonly target: string;
85
- readonly targetFamily?: string;
86
- readonly coreHash: string;
87
- readonly profileHash?: string;
88
- readonly lane: string;
89
- readonly annotations?: {
90
- codecs?: Record<string, string>;
91
- [key: string]: unknown;
92
- };
93
- readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;
94
- readonly refs?: PlanRefs;
95
- readonly projection?: Record<string, string> | ReadonlyArray<string>;
96
- /**
97
- * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).
98
- * Used for codec resolution when AST+refs don't provide enough type info.
99
- */
100
- readonly projectionTypes?: Record<string, string>;
101
- }
102
- /**
103
- * Canonical execution plan shape used by runtimes.
104
- *
105
- * - Row is the inferred result row type (TypeScript-only).
106
- * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).
107
- *
108
- * The payload executed by the runtime is represented by the sql + params pair
109
- * for now; future families can specialize this via Ast or additional metadata.
110
- */
111
- interface ExecutionPlan<Row = unknown, Ast = unknown> {
112
- readonly sql: string;
113
- readonly params: readonly unknown[];
114
- readonly ast?: Ast;
115
- readonly meta: PlanMeta;
116
- /**
117
- * Phantom property to carry the Row generic for type-level utilities.
118
- * Not set at runtime; used only for ResultType extraction.
119
- */
120
- readonly _row?: Row;
121
- }
122
- /**
123
- * Utility type to extract the Row type from an ExecutionPlan.
124
- * Example: `type Row = ResultType<typeof plan>`
125
- *
126
- * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).
127
- * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter
128
- * for type extraction.
129
- */
130
- type ResultType<P> = P extends ExecutionPlan<infer R, unknown> ? R : P extends {
131
- readonly _Row?: infer R;
132
- } ? R : never;
133
- /**
134
- * Type guard to check if a contract is a Document contract
135
- */
136
- declare function isDocumentContract(contract: unknown): contract is DocumentContract;
137
- /**
138
- * Contract marker record stored in the database.
139
- * Represents the current contract identity for a database.
140
- */
141
- interface ContractMarkerRecord {
142
- readonly coreHash: string;
143
- readonly profileHash: string;
144
- readonly contractJson: unknown | null;
145
- readonly canonicalVersion: number | null;
146
- readonly updatedAt: Date;
147
- readonly appTag: string | null;
148
- readonly meta: Record<string, unknown>;
149
- }
150
- /**
151
- * Specifies how to import TypeScript types from a package.
152
- * Used in extension pack manifests to declare codec and operation type imports.
153
- */
154
- interface TypesImportSpec {
155
- readonly package: string;
156
- readonly named: string;
157
- readonly alias: string;
158
- }
159
- /**
160
- * Validation context passed to TargetFamilyHook.validateTypes().
161
- * Contains pre-assembled operation registry, type imports, and extension IDs.
162
- */
163
- interface ValidationContext {
164
- readonly operationRegistry?: OperationRegistry;
165
- readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
166
- readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
167
- readonly extensionIds?: ReadonlyArray<string>;
168
- }
169
- /**
170
- * SPI interface for target family hooks that extend emission behavior.
171
- * Implemented by family-specific emitter hooks (e.g., SQL family).
172
- */
173
- interface TargetFamilyHook {
174
- readonly id: string;
175
- /**
176
- * Validates that all type IDs in the contract come from referenced extension packs.
177
- * @param ir - Contract IR to validate
178
- * @param ctx - Validation context with operation registry and extension IDs
179
- */
180
- validateTypes(ir: ContractIR, ctx: ValidationContext): void;
181
- /**
182
- * Validates family-specific contract structure.
183
- * @param ir - Contract IR to validate
184
- */
185
- validateStructure(ir: ContractIR): void;
186
- /**
187
- * Generates contract.d.ts file content.
188
- * @param ir - Contract IR
189
- * @param codecTypeImports - Array of codec type import specs
190
- * @param operationTypeImports - Array of operation type import specs
191
- * @returns Generated TypeScript type definitions as string
192
- */
193
- generateContractTypes(ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>): string;
194
- }
195
- type ArgSpecManifest = {
196
- readonly kind: 'typeId';
197
- readonly type: string;
198
- } | {
199
- readonly kind: 'param';
200
- } | {
201
- readonly kind: 'literal';
202
- };
203
- type ReturnSpecManifest = {
204
- readonly kind: 'typeId';
205
- readonly type: string;
206
- } | {
207
- readonly kind: 'builtin';
208
- readonly type: 'number' | 'boolean' | 'string';
209
- };
210
- interface LoweringSpecManifest {
211
- readonly targetFamily: 'sql';
212
- readonly strategy: 'infix' | 'function';
213
- readonly template: string;
214
- }
215
- interface OperationManifest {
216
- readonly for: string;
217
- readonly method: string;
218
- readonly args: ReadonlyArray<ArgSpecManifest>;
219
- readonly returns: ReturnSpecManifest;
220
- readonly lowering: LoweringSpecManifest;
221
- readonly capabilities?: ReadonlyArray<string>;
222
- }
223
-
224
- export { type ArgSpecManifest as A, type ContractBase, type ContractMarkerRecord, type DocCollection, type DocIndex, type DocumentContract, type DocumentStorage, type ExecutionPlan, type Expr, type FieldType, type LoweringSpecManifest as L, type OperationManifest, type ParamDescriptor, type PlanMeta, type PlanRefs, type ReturnSpecManifest as R, type ResultType, type Source, type TargetFamilyHook, type TypesImportSpec, type ValidationContext, isDocumentContract };
1
+ export type { ContractBase, ContractMarkerRecord, DocCollection, DocIndex, DocumentContract, DocumentStorage, ExecutionPlan, Expr, FieldType, OperationManifest, ParamDescriptor, PlanMeta, PlanRefs, ResultType, Source, TargetFamilyHook, TypesImportSpec, ValidationContext, } from '../types';
2
+ export { isDocumentContract } from '../types';
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,408 @@
1
+ import type { OperationManifest, TypesImportSpec } from './types';
2
+ /**
3
+ * Declarative fields that describe component metadata.
4
+ * These fields are owned directly by descriptors (not nested under a manifest).
5
+ */
6
+ export interface ComponentMetadata {
7
+ /** Component version (semver) */
8
+ readonly version: string;
9
+ /**
10
+ * Capabilities this component provides.
11
+ *
12
+ * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
13
+ * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
14
+ * keep these declarations in sync. Targets are identifiers/descriptors and typically do not
15
+ * declare capabilities.
16
+ */
17
+ readonly capabilities?: Record<string, unknown>;
18
+ /** Type imports for contract.d.ts generation */
19
+ readonly types?: {
20
+ readonly codecTypes?: {
21
+ readonly import: TypesImportSpec;
22
+ };
23
+ readonly operationTypes?: {
24
+ readonly import: TypesImportSpec;
25
+ };
26
+ readonly storage?: ReadonlyArray<{
27
+ readonly typeId: string;
28
+ readonly familyId: string;
29
+ readonly targetId: string;
30
+ readonly nativeType?: string;
31
+ }>;
32
+ };
33
+ /** Operation manifests for building operation registries */
34
+ readonly operations?: ReadonlyArray<OperationManifest>;
35
+ }
36
+ /**
37
+ * Base descriptor for any framework component.
38
+ *
39
+ * All component descriptors share these fundamental properties that identify
40
+ * the component and provide its metadata. This interface is extended by
41
+ * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
42
+ *
43
+ * @template Kind - Discriminator literal identifying the component type.
44
+ * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
45
+ * but the type accepts any string to allow ecosystem extensions.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // All descriptors have these properties
50
+ * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)
51
+ * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')
52
+ * descriptor.version // Component version (semver)
53
+ * ```
54
+ */
55
+ export interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {
56
+ /** Discriminator identifying the component type */
57
+ readonly kind: Kind;
58
+ /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */
59
+ readonly id: string;
60
+ }
61
+ export interface ContractComponentRequirementsCheckInput {
62
+ readonly contract: {
63
+ readonly target: string;
64
+ readonly targetFamily?: string | undefined;
65
+ readonly extensionPacks?: Record<string, unknown> | undefined;
66
+ };
67
+ readonly expectedTargetFamily?: string | undefined;
68
+ readonly expectedTargetId?: string | undefined;
69
+ readonly providedComponentIds: Iterable<string>;
70
+ }
71
+ export interface ContractComponentRequirementsCheckResult {
72
+ readonly familyMismatch?: {
73
+ readonly expected: string;
74
+ readonly actual: string;
75
+ } | undefined;
76
+ readonly targetMismatch?: {
77
+ readonly expected: string;
78
+ readonly actual: string;
79
+ } | undefined;
80
+ readonly missingExtensionPackIds: readonly string[];
81
+ }
82
+ export declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult;
83
+ /**
84
+ * Descriptor for a family component.
85
+ *
86
+ * A "family" represents a category of data sources with shared semantics
87
+ * (e.g., SQL databases, document stores). Families define:
88
+ * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
89
+ * - Contract structure (tables vs collections, columns vs fields)
90
+ * - Type system and codecs
91
+ *
92
+ * Families are the top-level grouping. Each family contains multiple targets
93
+ * (e.g., SQL family contains Postgres, MySQL, SQLite targets).
94
+ *
95
+ * Extended by plane-specific descriptors:
96
+ * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations
97
+ * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods
98
+ *
99
+ * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * import sql from '@prisma-next/family-sql/control';
104
+ *
105
+ * sql.kind // 'family'
106
+ * sql.familyId // 'sql'
107
+ * sql.id // 'sql'
108
+ * ```
109
+ */
110
+ export interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {
111
+ /** The family identifier (e.g., 'sql', 'document') */
112
+ readonly familyId: TFamilyId;
113
+ }
114
+ /**
115
+ * Descriptor for a target component.
116
+ *
117
+ * A "target" represents a specific database or data store within a family
118
+ * (e.g., Postgres, MySQL, MongoDB). Targets define:
119
+ * - Native type mappings (e.g., Postgres int4 → TypeScript number)
120
+ * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
121
+ *
122
+ * Targets are bound to a family and provide the target-specific implementation
123
+ * details that adapters and drivers use.
124
+ *
125
+ * Extended by plane-specific descriptors:
126
+ * - `ControlTargetDescriptor` - adds optional `migrations` capability
127
+ * - `RuntimeTargetDescriptor` - adds runtime factory method
128
+ *
129
+ * @template TFamilyId - Literal type for the family identifier
130
+ * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * import postgres from '@prisma-next/target-postgres/control';
135
+ *
136
+ * postgres.kind // 'target'
137
+ * postgres.familyId // 'sql'
138
+ * postgres.targetId // 'postgres'
139
+ * ```
140
+ */
141
+ export interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> {
142
+ /** The family this target belongs to */
143
+ readonly familyId: TFamilyId;
144
+ /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
145
+ readonly targetId: TTargetId;
146
+ }
147
+ /**
148
+ * Base shape for any pack reference.
149
+ * Pack refs are pure JSON-friendly objects safe to import in authoring flows.
150
+ */
151
+ export interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
152
+ readonly kind: Kind;
153
+ readonly id: string;
154
+ readonly familyId: TFamilyId;
155
+ readonly targetId?: string;
156
+ }
157
+ export type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & {
158
+ readonly targetId: TTargetId;
159
+ };
160
+ export type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & {
161
+ readonly targetId: TTargetId;
162
+ };
163
+ export type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & {
164
+ readonly targetId: TTargetId;
165
+ };
166
+ export type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & {
167
+ readonly targetId: TTargetId;
168
+ };
169
+ /**
170
+ * Descriptor for an adapter component.
171
+ *
172
+ * An "adapter" provides the protocol and dialect implementation for a target.
173
+ * Adapters handle:
174
+ * - SQL/query generation (lowering AST to target-specific syntax)
175
+ * - Codec registration (encoding/decoding between JS and wire types)
176
+ * - Type mappings and coercions
177
+ *
178
+ * Adapters are bound to a specific family+target combination and work with
179
+ * any compatible driver for that target.
180
+ *
181
+ * Extended by plane-specific descriptors:
182
+ * - `ControlAdapterDescriptor` - control-plane factory
183
+ * - `RuntimeAdapterDescriptor` - runtime factory
184
+ *
185
+ * @template TFamilyId - Literal type for the family identifier
186
+ * @template TTargetId - Literal type for the target identifier
187
+ *
188
+ * @example
189
+ * ```ts
190
+ * import postgresAdapter from '@prisma-next/adapter-postgres/control';
191
+ *
192
+ * postgresAdapter.kind // 'adapter'
193
+ * postgresAdapter.familyId // 'sql'
194
+ * postgresAdapter.targetId // 'postgres'
195
+ * ```
196
+ */
197
+ export interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> {
198
+ /** The family this adapter belongs to */
199
+ readonly familyId: TFamilyId;
200
+ /** The target this adapter is designed for */
201
+ readonly targetId: TTargetId;
202
+ }
203
+ /**
204
+ * Descriptor for a driver component.
205
+ *
206
+ * A "driver" provides the connection and execution layer for a target.
207
+ * Drivers handle:
208
+ * - Connection management (pooling, timeouts, retries)
209
+ * - Query execution (sending SQL/commands, receiving results)
210
+ * - Transaction management
211
+ * - Wire protocol communication
212
+ *
213
+ * Drivers are bound to a specific family+target and work with any compatible
214
+ * adapter. Multiple drivers can exist for the same target (e.g., node-postgres
215
+ * vs postgres.js for Postgres).
216
+ *
217
+ * Extended by plane-specific descriptors:
218
+ * - `ControlDriverDescriptor` - creates driver from connection URL
219
+ * - `RuntimeDriverDescriptor` - creates driver with runtime options
220
+ *
221
+ * @template TFamilyId - Literal type for the family identifier
222
+ * @template TTargetId - Literal type for the target identifier
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * import postgresDriver from '@prisma-next/driver-postgres/control';
227
+ *
228
+ * postgresDriver.kind // 'driver'
229
+ * postgresDriver.familyId // 'sql'
230
+ * postgresDriver.targetId // 'postgres'
231
+ * ```
232
+ */
233
+ export interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> {
234
+ /** The family this driver belongs to */
235
+ readonly familyId: TFamilyId;
236
+ /** The target this driver connects to */
237
+ readonly targetId: TTargetId;
238
+ }
239
+ /**
240
+ * Descriptor for an extension component.
241
+ *
242
+ * An "extension" adds optional capabilities to a target. Extensions can provide:
243
+ * - Additional operations (e.g., vector similarity search with pgvector)
244
+ * - Custom types and codecs (e.g., vector type)
245
+ * - Extended query capabilities
246
+ *
247
+ * Extensions are bound to a specific family+target and are registered in the
248
+ * config alongside the core components. Multiple extensions can be used together.
249
+ *
250
+ * Extended by plane-specific descriptors:
251
+ * - `ControlExtensionDescriptor` - control-plane extension factory
252
+ * - `RuntimeExtensionDescriptor` - runtime extension factory
253
+ *
254
+ * @template TFamilyId - Literal type for the family identifier
255
+ * @template TTargetId - Literal type for the target identifier
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * import pgvector from '@prisma-next/extension-pgvector/control';
260
+ *
261
+ * pgvector.kind // 'extension'
262
+ * pgvector.familyId // 'sql'
263
+ * pgvector.targetId // 'postgres'
264
+ * ```
265
+ */
266
+ export interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> {
267
+ /** The family this extension belongs to */
268
+ readonly familyId: TFamilyId;
269
+ /** The target this extension is designed for */
270
+ readonly targetId: TTargetId;
271
+ }
272
+ /**
273
+ * Union type for target-bound component descriptors.
274
+ *
275
+ * Target-bound components are those that must be compatible with a specific
276
+ * family+target combination. This includes targets, adapters, drivers, and
277
+ * extensions. Families are not target-bound.
278
+ *
279
+ * This type is used in migration and verification interfaces to enforce
280
+ * type-level compatibility between components.
281
+ *
282
+ * @template TFamilyId - Literal type for the family identifier
283
+ * @template TTargetId - Literal type for the target identifier
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * // All these components must have matching familyId and targetId
288
+ * const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [
289
+ * postgresTarget,
290
+ * postgresAdapter,
291
+ * postgresDriver,
292
+ * pgvectorExtension,
293
+ * ];
294
+ * ```
295
+ */
296
+ export type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>;
297
+ /**
298
+ * Base interface for family instances.
299
+ *
300
+ * A family instance is created by a family descriptor's `create()` method.
301
+ * This base interface carries only the identity; plane-specific interfaces
302
+ * add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).
303
+ *
304
+ * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
305
+ *
306
+ * @example
307
+ * ```ts
308
+ * const instance = sql.create({ target, adapter, driver, extensions });
309
+ * instance.familyId // 'sql'
310
+ * ```
311
+ */
312
+ export interface FamilyInstance<TFamilyId extends string> {
313
+ /** The family identifier (e.g., 'sql', 'document') */
314
+ readonly familyId: TFamilyId;
315
+ }
316
+ /**
317
+ * Base interface for target instances.
318
+ *
319
+ * A target instance is created by a target descriptor's `create()` method.
320
+ * This base interface carries only the identity; plane-specific interfaces
321
+ * add target-specific behavior.
322
+ *
323
+ * @template TFamilyId - Literal type for the family identifier
324
+ * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
325
+ *
326
+ * @example
327
+ * ```ts
328
+ * const instance = postgres.create();
329
+ * instance.familyId // 'sql'
330
+ * instance.targetId // 'postgres'
331
+ * ```
332
+ */
333
+ export interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
334
+ /** The family this target belongs to */
335
+ readonly familyId: TFamilyId;
336
+ /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
337
+ readonly targetId: TTargetId;
338
+ }
339
+ /**
340
+ * Base interface for adapter instances.
341
+ *
342
+ * An adapter instance is created by an adapter descriptor's `create()` method.
343
+ * This base interface carries only the identity; plane-specific interfaces
344
+ * add adapter-specific behavior (e.g., codec registration, query lowering).
345
+ *
346
+ * @template TFamilyId - Literal type for the family identifier
347
+ * @template TTargetId - Literal type for the target identifier
348
+ *
349
+ * @example
350
+ * ```ts
351
+ * const instance = postgresAdapter.create();
352
+ * instance.familyId // 'sql'
353
+ * instance.targetId // 'postgres'
354
+ * ```
355
+ */
356
+ export interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
357
+ /** The family this adapter belongs to */
358
+ readonly familyId: TFamilyId;
359
+ /** The target this adapter is designed for */
360
+ readonly targetId: TTargetId;
361
+ }
362
+ /**
363
+ * Base interface for driver instances.
364
+ *
365
+ * A driver instance is created by a driver descriptor's `create()` method.
366
+ * This base interface carries only the identity; plane-specific interfaces
367
+ * add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).
368
+ *
369
+ * @template TFamilyId - Literal type for the family identifier
370
+ * @template TTargetId - Literal type for the target identifier
371
+ *
372
+ * @example
373
+ * ```ts
374
+ * const instance = postgresDriver.create({ databaseUrl });
375
+ * instance.familyId // 'sql'
376
+ * instance.targetId // 'postgres'
377
+ * ```
378
+ */
379
+ export interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
380
+ /** The family this driver belongs to */
381
+ readonly familyId: TFamilyId;
382
+ /** The target this driver connects to */
383
+ readonly targetId: TTargetId;
384
+ }
385
+ /**
386
+ * Base interface for extension instances.
387
+ *
388
+ * An extension instance is created by an extension descriptor's `create()` method.
389
+ * This base interface carries only the identity; plane-specific interfaces
390
+ * add extension-specific behavior.
391
+ *
392
+ * @template TFamilyId - Literal type for the family identifier
393
+ * @template TTargetId - Literal type for the target identifier
394
+ *
395
+ * @example
396
+ * ```ts
397
+ * const instance = pgvector.create();
398
+ * instance.familyId // 'sql'
399
+ * instance.targetId // 'postgres'
400
+ * ```
401
+ */
402
+ export interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
403
+ /** The family this extension belongs to */
404
+ readonly familyId: TFamilyId;
405
+ /** The target this extension is designed for */
406
+ readonly targetId: TTargetId;
407
+ }
408
+ //# sourceMappingURL=framework-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components.d.ts","sourceRoot":"","sources":["../src/framework-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA+BlE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhD,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,UAAU,CAAC,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;SAAE,CAAC;QAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;SAAE,CAAC;QAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;YAC/B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