@prisma-next/contract 0.3.0-dev.9 → 0.3.0-dev.90

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 (46) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +42 -6
  3. package/dist/framework-components.d.mts +529 -0
  4. package/dist/framework-components.d.mts.map +1 -0
  5. package/dist/framework-components.mjs +70 -0
  6. package/dist/framework-components.mjs.map +1 -0
  7. package/dist/ir-C9rRU5WS.d.mts +84 -0
  8. package/dist/ir-C9rRU5WS.d.mts.map +1 -0
  9. package/dist/ir.d.mts +2 -0
  10. package/dist/ir.mjs +51 -0
  11. package/dist/ir.mjs.map +1 -0
  12. package/dist/types-54JRJq9p.d.mts +395 -0
  13. package/dist/types-54JRJq9p.d.mts.map +1 -0
  14. package/dist/types.d.mts +2 -0
  15. package/dist/types.mjs +30 -0
  16. package/dist/types.mjs.map +1 -0
  17. package/package.json +24 -28
  18. package/schemas/data-contract-document-v1.json +9 -4
  19. package/src/exports/framework-components.ts +10 -1
  20. package/src/exports/types.ts +31 -7
  21. package/src/framework-components.ts +179 -46
  22. package/src/ir.ts +28 -12
  23. package/src/types.ts +274 -37
  24. package/dist/exports/framework-components.d.ts +0 -3
  25. package/dist/exports/framework-components.d.ts.map +0 -1
  26. package/dist/exports/framework-components.js +0 -24
  27. package/dist/exports/framework-components.js.map +0 -1
  28. package/dist/exports/ir.d.ts +0 -2
  29. package/dist/exports/ir.d.ts.map +0 -1
  30. package/dist/exports/ir.js +0 -35
  31. package/dist/exports/ir.js.map +0 -1
  32. package/dist/exports/pack-manifest-types.d.ts +0 -2
  33. package/dist/exports/pack-manifest-types.d.ts.map +0 -1
  34. package/dist/exports/pack-manifest-types.js +0 -1
  35. package/dist/exports/pack-manifest-types.js.map +0 -1
  36. package/dist/exports/types.d.ts +0 -3
  37. package/dist/exports/types.d.ts.map +0 -1
  38. package/dist/exports/types.js +0 -8
  39. package/dist/exports/types.js.map +0 -1
  40. package/dist/framework-components.d.ts +0 -408
  41. package/dist/framework-components.d.ts.map +0 -1
  42. package/dist/ir.d.ts +0 -76
  43. package/dist/ir.d.ts.map +0 -1
  44. package/dist/types.d.ts +0 -222
  45. package/dist/types.d.ts.map +0 -1
  46. package/src/exports/pack-manifest-types.ts +0 -6
@@ -1,408 +0,0 @@
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
@@ -1 +0,0 @@
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,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;SAC9B,CAAC,CAAC;KACJ,CAAC;IAEF,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACxD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,mBAAmB,CAAC,IAAI,SAAS,MAAM,CAAE,SAAQ,iBAAiB;IACjF,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MA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;AACH,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM;IACtD,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM;IAChF,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE7B,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,eAAe,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM;IACjF,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE7B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM;IAChF,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE7B,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM;IACnF,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE7B,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B"}
package/dist/ir.d.ts DELETED
@@ -1,76 +0,0 @@
1
- /**
2
- * ContractIR types and factories for building contract intermediate representation.
3
- * ContractIR is family-agnostic and used by authoring, emitter, and no-emit runtime.
4
- */
5
- /**
6
- * ContractIR represents the intermediate representation of a contract.
7
- * It is family-agnostic and contains generic storage, models, and relations.
8
- * Note: coreHash and profileHash are computed by the emitter, not part of the IR.
9
- */
10
- export interface ContractIR<TStorage extends Record<string, unknown> = Record<string, unknown>, TModels extends Record<string, unknown> = Record<string, unknown>, TRelations extends Record<string, unknown> = Record<string, unknown>> {
11
- readonly schemaVersion: string;
12
- readonly targetFamily: string;
13
- readonly target: string;
14
- readonly models: TModels;
15
- readonly relations: TRelations;
16
- readonly storage: TStorage;
17
- readonly extensionPacks: Record<string, unknown>;
18
- readonly capabilities: Record<string, Record<string, boolean>>;
19
- readonly meta: Record<string, unknown>;
20
- readonly sources: Record<string, unknown>;
21
- }
22
- /**
23
- * Creates the header portion of a ContractIR.
24
- * Contains schema version, target, target family, core hash, and optional profile hash.
25
- */
26
- export declare function irHeader(opts: {
27
- target: string;
28
- targetFamily: string;
29
- coreHash: string;
30
- profileHash?: string;
31
- }): {
32
- readonly schemaVersion: string;
33
- readonly target: string;
34
- readonly targetFamily: string;
35
- readonly coreHash: string;
36
- readonly profileHash?: string;
37
- };
38
- /**
39
- * Creates the meta portion of a ContractIR.
40
- * Contains capabilities, extensionPacks, meta, and sources with empty object defaults.
41
- * If a field is explicitly `undefined`, it will be omitted (for testing validation).
42
- */
43
- export declare function irMeta(opts?: {
44
- capabilities?: Record<string, Record<string, boolean>> | undefined;
45
- extensionPacks?: Record<string, unknown> | undefined;
46
- meta?: Record<string, unknown> | undefined;
47
- sources?: Record<string, unknown> | undefined;
48
- }): {
49
- readonly capabilities: Record<string, Record<string, boolean>>;
50
- readonly extensionPacks: Record<string, unknown>;
51
- readonly meta: Record<string, unknown>;
52
- readonly sources: Record<string, unknown>;
53
- };
54
- /**
55
- * Creates a complete ContractIR by combining header, meta, and family-specific sections.
56
- * This is a family-agnostic factory that accepts generic storage, models, and relations.
57
- */
58
- export declare function contractIR<TStorage extends Record<string, unknown>, TModels extends Record<string, unknown>, TRelations extends Record<string, unknown>>(opts: {
59
- header: {
60
- readonly schemaVersion: string;
61
- readonly target: string;
62
- readonly targetFamily: string;
63
- readonly coreHash: string;
64
- readonly profileHash?: string;
65
- };
66
- meta: {
67
- readonly capabilities: Record<string, Record<string, boolean>>;
68
- readonly extensionPacks: Record<string, unknown>;
69
- readonly meta: Record<string, unknown>;
70
- readonly sources: Record<string, unknown>;
71
- };
72
- storage: TStorage;
73
- models: TModels;
74
- relations: TRelations;
75
- }): ContractIR<TStorage, TModels, TRelations>;
76
- //# sourceMappingURL=ir.d.ts.map
package/dist/ir.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,WAAW,UAAU,CACzB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEpE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC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