@prisma-next/framework-components 0.0.1 → 0.3.0-dev.146

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,333 @@
1
+ import { i as AuthoringContributions } from "./framework-authoring-BybjSfF5.mjs";
2
+ import { t as Codec } from "./codec-types-D9ixsdxw.mjs";
3
+ import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
4
+
5
+ //#region src/framework-components.d.ts
6
+
7
+ /**
8
+ * Declarative fields that describe component metadata.
9
+ */
10
+ interface ComponentMetadata {
11
+ /** Component version (semver) */
12
+ readonly version: string;
13
+ /**
14
+ * Capabilities this component provides.
15
+ *
16
+ * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
17
+ * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
18
+ * keep these declarations in sync. Targets are identifiers/descriptors and typically do not
19
+ * declare capabilities.
20
+ */
21
+ readonly capabilities?: Record<string, unknown>;
22
+ /** Type imports for contract.d.ts generation */
23
+ readonly types?: {
24
+ readonly codecTypes?: {
25
+ /**
26
+ * Base codec types import spec.
27
+ * Optional: adapters typically provide this, extensions usually don't.
28
+ */
29
+ readonly import?: TypesImportSpec;
30
+ /**
31
+ * Additional type-only imports for parameterized codec branded types.
32
+ *
33
+ * These imports are included in generated `contract.d.ts` but are NOT treated as
34
+ * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).
35
+ *
36
+ * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`
37
+ */
38
+ readonly typeImports?: ReadonlyArray<TypesImportSpec>;
39
+ /**
40
+ * Optional control-plane hooks keyed by codecId.
41
+ * Used by family-specific planners/verifiers to handle storage types.
42
+ */
43
+ readonly controlPlaneHooks?: Record<string, unknown>;
44
+ /**
45
+ * Codec instances contributed by this component.
46
+ * Used to build a CodecLookup for codec-dispatched type rendering during emission.
47
+ */
48
+ readonly codecInstances?: ReadonlyArray<Codec>;
49
+ };
50
+ readonly operationTypes?: {
51
+ readonly import: TypesImportSpec;
52
+ };
53
+ readonly queryOperationTypes?: {
54
+ readonly import: TypesImportSpec;
55
+ };
56
+ readonly storage?: ReadonlyArray<{
57
+ readonly typeId: string;
58
+ readonly familyId: string;
59
+ readonly targetId: string;
60
+ readonly nativeType?: string;
61
+ }>;
62
+ };
63
+ /**
64
+ * Optional pure-data authoring contributions exposed by this component.
65
+ *
66
+ * These contributions are safe to include on pack refs and descriptors because
67
+ * they contain only declarative metadata. Higher-level authoring packages may
68
+ * project them into concrete helper functions for TS-first workflows.
69
+ */
70
+ readonly authoring?: AuthoringContributions;
71
+ }
72
+ /**
73
+ * Base descriptor for any framework component.
74
+ *
75
+ * All component descriptors share these fundamental properties that identify
76
+ * the component and provide its metadata. This interface is extended by
77
+ * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
78
+ *
79
+ * @template Kind - Discriminator literal identifying the component type.
80
+ * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
81
+ * but the type accepts any string to allow ecosystem extensions.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * // All descriptors have these properties
86
+ * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)
87
+ * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')
88
+ * descriptor.version // Component version (semver)
89
+ * ```
90
+ */
91
+ interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {
92
+ /** Discriminator identifying the component type */
93
+ readonly kind: Kind;
94
+ /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */
95
+ readonly id: string;
96
+ }
97
+ interface ContractComponentRequirementsCheckInput {
98
+ readonly contract: {
99
+ readonly target: string;
100
+ readonly targetFamily?: string | undefined;
101
+ readonly extensionPacks?: Record<string, unknown> | undefined;
102
+ };
103
+ readonly expectedTargetFamily?: string | undefined;
104
+ readonly expectedTargetId?: string | undefined;
105
+ readonly providedComponentIds: Iterable<string>;
106
+ }
107
+ interface ContractComponentRequirementsCheckResult {
108
+ readonly familyMismatch?: {
109
+ readonly expected: string;
110
+ readonly actual: string;
111
+ } | undefined;
112
+ readonly targetMismatch?: {
113
+ readonly expected: string;
114
+ readonly actual: string;
115
+ } | undefined;
116
+ readonly missingExtensionPackIds: readonly string[];
117
+ }
118
+ declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult;
119
+ /**
120
+ * Descriptor for a family component.
121
+ *
122
+ * A "family" represents a category of data sources with shared semantics
123
+ * (e.g., SQL databases, document stores). Families define:
124
+ * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
125
+ * - Contract structure (tables vs collections, columns vs fields)
126
+ * - Type system and codecs
127
+ *
128
+ * Families are the top-level grouping. Each family contains multiple targets
129
+ * (e.g., SQL family contains Postgres, MySQL, SQLite targets).
130
+ *
131
+ * Extended by plane-specific descriptors:
132
+ * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations
133
+ * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods
134
+ *
135
+ * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * import sql from '@prisma-next/family-sql/control';
140
+ *
141
+ * sql.kind // 'family'
142
+ * sql.familyId // 'sql'
143
+ * sql.id // 'sql'
144
+ * ```
145
+ */
146
+ interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {
147
+ /** The family identifier (e.g., 'sql', 'document') */
148
+ readonly familyId: TFamilyId;
149
+ }
150
+ /**
151
+ * Descriptor for a target component.
152
+ *
153
+ * A "target" represents a specific database or data store within a family
154
+ * (e.g., Postgres, MySQL, MongoDB). Targets define:
155
+ * - Native type mappings (e.g., Postgres int4 → TypeScript number)
156
+ * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
157
+ *
158
+ * Targets are bound to a family and provide the target-specific implementation
159
+ * details that adapters and drivers use.
160
+ *
161
+ * Extended by plane-specific descriptors:
162
+ * - `ControlTargetDescriptor` - adds optional `migrations` capability
163
+ * - `RuntimeTargetDescriptor` - adds runtime factory method
164
+ *
165
+ * @template TFamilyId - Literal type for the family identifier
166
+ * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * import postgres from '@prisma-next/target-postgres/control';
171
+ *
172
+ * postgres.kind // 'target'
173
+ * postgres.familyId // 'sql'
174
+ * postgres.targetId // 'postgres'
175
+ * ```
176
+ */
177
+ interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> {
178
+ /** The family this target belongs to */
179
+ readonly familyId: TFamilyId;
180
+ /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
181
+ readonly targetId: TTargetId;
182
+ }
183
+ /**
184
+ * Base shape for any pack reference.
185
+ * Pack refs are pure JSON-friendly objects safe to import in authoring flows.
186
+ */
187
+ interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
188
+ readonly kind: Kind;
189
+ readonly id: string;
190
+ readonly familyId: TFamilyId;
191
+ readonly targetId?: string;
192
+ readonly authoring?: AuthoringContributions;
193
+ }
194
+ type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;
195
+ type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & {
196
+ readonly targetId: TTargetId;
197
+ };
198
+ type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & {
199
+ readonly targetId: TTargetId;
200
+ };
201
+ type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & {
202
+ readonly targetId: TTargetId;
203
+ };
204
+ type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & {
205
+ readonly targetId: TTargetId;
206
+ };
207
+ /**
208
+ * Descriptor for an adapter component.
209
+ *
210
+ * An "adapter" provides the protocol and dialect implementation for a target.
211
+ * Adapters handle:
212
+ * - SQL/query generation (lowering AST to target-specific syntax)
213
+ * - Codec registration (encoding/decoding between JS and wire types)
214
+ * - Type mappings and coercions
215
+ *
216
+ * Adapters are bound to a specific family+target combination and work with
217
+ * any compatible driver for that target.
218
+ *
219
+ * Extended by plane-specific descriptors:
220
+ * - `ControlAdapterDescriptor` - control-plane factory
221
+ * - `RuntimeAdapterDescriptor` - runtime factory
222
+ *
223
+ * @template TFamilyId - Literal type for the family identifier
224
+ * @template TTargetId - Literal type for the target identifier
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * import postgresAdapter from '@prisma-next/adapter-postgres/control';
229
+ *
230
+ * postgresAdapter.kind // 'adapter'
231
+ * postgresAdapter.familyId // 'sql'
232
+ * postgresAdapter.targetId // 'postgres'
233
+ * ```
234
+ */
235
+ interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> {
236
+ /** The family this adapter belongs to */
237
+ readonly familyId: TFamilyId;
238
+ /** The target this adapter is designed for */
239
+ readonly targetId: TTargetId;
240
+ }
241
+ /**
242
+ * Descriptor for a driver component.
243
+ *
244
+ * A "driver" provides the connection and execution layer for a target.
245
+ * Drivers handle:
246
+ * - Connection management (pooling, timeouts, retries)
247
+ * - Query execution (sending SQL/commands, receiving results)
248
+ * - Transaction management
249
+ * - Wire protocol communication
250
+ *
251
+ * Drivers are bound to a specific family+target and work with any compatible
252
+ * adapter. Multiple drivers can exist for the same target (e.g., node-postgres
253
+ * vs postgres.js for Postgres).
254
+ *
255
+ * Extended by plane-specific descriptors:
256
+ * - `ControlDriverDescriptor` - creates driver from connection URL
257
+ * - `RuntimeDriverDescriptor` - creates driver with runtime options
258
+ *
259
+ * @template TFamilyId - Literal type for the family identifier
260
+ * @template TTargetId - Literal type for the target identifier
261
+ *
262
+ * @example
263
+ * ```ts
264
+ * import postgresDriver from '@prisma-next/driver-postgres/control';
265
+ *
266
+ * postgresDriver.kind // 'driver'
267
+ * postgresDriver.familyId // 'sql'
268
+ * postgresDriver.targetId // 'postgres'
269
+ * ```
270
+ */
271
+ interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> {
272
+ /** The family this driver belongs to */
273
+ readonly familyId: TFamilyId;
274
+ /** The target this driver connects to */
275
+ readonly targetId: TTargetId;
276
+ }
277
+ /**
278
+ * Descriptor for an extension component.
279
+ *
280
+ * An "extension" adds optional capabilities to a target. Extensions can provide:
281
+ * - Additional operations (e.g., vector similarity search with pgvector)
282
+ * - Custom types and codecs (e.g., vector type)
283
+ * - Extended query capabilities
284
+ *
285
+ * Extensions are bound to a specific family+target and are registered in the
286
+ * config alongside the core components. Multiple extensions can be used together.
287
+ *
288
+ * Extended by plane-specific descriptors:
289
+ * - `ControlExtensionDescriptor` - control-plane extension factory
290
+ * - `RuntimeExtensionDescriptor` - runtime extension factory
291
+ *
292
+ * @template TFamilyId - Literal type for the family identifier
293
+ * @template TTargetId - Literal type for the target identifier
294
+ *
295
+ * @example
296
+ * ```ts
297
+ * import pgvector from '@prisma-next/extension-pgvector/control';
298
+ *
299
+ * pgvector.kind // 'extension'
300
+ * pgvector.familyId // 'sql'
301
+ * pgvector.targetId // 'postgres'
302
+ * ```
303
+ */
304
+ interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> {
305
+ /** The family this extension belongs to */
306
+ readonly familyId: TFamilyId;
307
+ /** The target this extension is designed for */
308
+ readonly targetId: TTargetId;
309
+ }
310
+ /** Components bound to a specific family+target combination. */
311
+ type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>;
312
+ interface FamilyInstance<TFamilyId extends string> {
313
+ readonly familyId: TFamilyId;
314
+ }
315
+ interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
316
+ readonly familyId: TFamilyId;
317
+ readonly targetId: TTargetId;
318
+ }
319
+ interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
320
+ readonly familyId: TFamilyId;
321
+ readonly targetId: TTargetId;
322
+ }
323
+ interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
324
+ readonly familyId: TFamilyId;
325
+ readonly targetId: TTargetId;
326
+ }
327
+ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
328
+ readonly familyId: TFamilyId;
329
+ readonly targetId: TTargetId;
330
+ }
331
+ //#endregion
332
+ export { checkContractComponentRequirements as S, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, TargetPackRef as x, TargetDescriptor as y };
333
+ //# sourceMappingURL=framework-components-W-TA8p5-.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-W-TA8p5-.d.mts","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAOA;AAY0B,UAZT,iBAAA,CAYS;EASF;EASmB,SAAA,OAAA,EAAA,MAAA;EAAd;;;;;;;;EA6BgB,SAAA,YAAA,CAAA,EA/CnB,MA+CmB,CAAA,MAAA,EAAA,OAAA,CAAA;EAsB5B;EAQA,SAAA,KAAA,CAAA,EAAA;IAWA,SAAA,UAAA,CAAA,EAAA;MAMD;AA+DhB;AAgCA;;MAMqB,SAAA,MAAA,CAAA,EA1LG,eA0LH;MALX;;AAYV;;;;;;MASY,SAAa,WAAA,CAAA,EAjMI,aAiMwD,CAjM1C,eAiM+B,CAAA;MAE9D;;;;MAIkB,SAAA,iBAAA,CAAA,EAlMK,MAkML,CAAA,MAA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A8BJ,gFACP;;qBAEW;;qBAGA;;;KAIT,qFACR,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB;qBACI;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
@@ -0,0 +1,13 @@
1
+ //#region src/types-import-spec.d.ts
2
+ /**
3
+ * Specifies how to import TypeScript types from a package.
4
+ * Used in extension pack manifests to declare codec and operation type imports.
5
+ */
6
+ interface TypesImportSpec {
7
+ readonly package: string;
8
+ readonly named: string;
9
+ readonly alias: string;
10
+ }
11
+ //#endregion
12
+ export { TypesImportSpec as t };
13
+ //# sourceMappingURL=types-import-spec-BupmVNbx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-import-spec-BupmVNbx.d.mts","names":[],"sources":["../src/types-import-spec.ts"],"sourcesContent":[],"mappings":";;AAIA;;;UAAiB,eAAA"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@prisma-next/framework-components",
3
- "version": "0.0.1",
3
+ "version": "0.3.0-dev.146",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Framework component types, assembly logic, and stack creation for Prisma Next",
7
7
  "dependencies": {
8
- "@prisma-next/contract": "0.0.1",
9
- "@prisma-next/utils": "0.0.1",
10
- "@prisma-next/operations": "0.0.1"
8
+ "@prisma-next/contract": "0.3.0-dev.146",
9
+ "@prisma-next/operations": "0.3.0-dev.146",
10
+ "@prisma-next/utils": "0.3.0-dev.146"
11
11
  },
12
12
  "devDependencies": {
13
13
  "tsdown": "0.18.4",