@prisma-next/contract 0.3.0-dev.26 → 0.3.0-dev.28

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 (41) 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/framework-components.ts +11 -1
  18. package/src/ir.ts +3 -3
  19. package/src/types.ts +10 -0
  20. package/dist/exports/framework-components.d.ts +0 -3
  21. package/dist/exports/framework-components.d.ts.map +0 -1
  22. package/dist/exports/framework-components.js +0 -57
  23. package/dist/exports/framework-components.js.map +0 -1
  24. package/dist/exports/ir.d.ts +0 -2
  25. package/dist/exports/ir.d.ts.map +0 -1
  26. package/dist/exports/ir.js +0 -35
  27. package/dist/exports/ir.js.map +0 -1
  28. package/dist/exports/pack-manifest-types.d.ts +0 -2
  29. package/dist/exports/pack-manifest-types.d.ts.map +0 -1
  30. package/dist/exports/pack-manifest-types.js +0 -1
  31. package/dist/exports/pack-manifest-types.js.map +0 -1
  32. package/dist/exports/types.d.ts +0 -3
  33. package/dist/exports/types.d.ts.map +0 -1
  34. package/dist/exports/types.js +0 -8
  35. package/dist/exports/types.js.map +0 -1
  36. package/dist/framework-components.d.ts +0 -516
  37. package/dist/framework-components.d.ts.map +0 -1
  38. package/dist/ir.d.ts +0 -76
  39. package/dist/ir.d.ts.map +0 -1
  40. package/dist/types.d.ts +0 -316
  41. package/dist/types.d.ts.map +0 -1
@@ -1,516 +0,0 @@
1
- import type { OperationManifest, TypesImportSpec } from './types';
2
- /**
3
- * Context passed to type renderers during contract.d.ts generation.
4
- */
5
- export interface RenderTypeContext {
6
- /** The name of the CodecTypes type alias (typically 'CodecTypes') */
7
- readonly codecTypesName: string;
8
- }
9
- /**
10
- * A template-based type renderer (structured form).
11
- * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are
12
- * replaced with typeParams values during rendering.
13
- *
14
- * @example
15
- * ```ts
16
- * { kind: 'template', template: 'Vector<{{length}}>' }
17
- * // With typeParams { length: 1536 }, renders: 'Vector<1536>'
18
- * ```
19
- */
20
- export interface TypeRendererTemplate {
21
- readonly kind: 'template';
22
- /** Template string with `{{key}}` placeholders for typeParams values */
23
- readonly template: string;
24
- }
25
- /**
26
- * A function-based type renderer for full control over type expression generation.
27
- *
28
- * @example
29
- * ```ts
30
- * {
31
- * kind: 'function',
32
- * render: (params, ctx) => `Vector<${params.length}>`
33
- * }
34
- * ```
35
- */
36
- export interface TypeRendererFunction {
37
- readonly kind: 'function';
38
- /** Render function that produces a TypeScript type expression */
39
- readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
40
- }
41
- /**
42
- * A raw template string type renderer (convenience form).
43
- * Shorthand for TypeRendererTemplate - just the template string without wrapper.
44
- *
45
- * @example
46
- * ```ts
47
- * 'Vector<{{length}}>'
48
- * // Equivalent to: { kind: 'template', template: 'Vector<{{length}}>' }
49
- * ```
50
- */
51
- export type TypeRendererString = string;
52
- /**
53
- * A raw function type renderer (convenience form).
54
- * Shorthand for TypeRendererFunction - just the function without wrapper.
55
- *
56
- * @example
57
- * ```ts
58
- * (params, ctx) => `Vector<${params.length}>`
59
- * // Equivalent to: { kind: 'function', render: ... }
60
- * ```
61
- */
62
- export type TypeRendererRawFunction = (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
63
- /**
64
- * Union of type renderer formats.
65
- *
66
- * Supports both structured forms (with `kind` discriminator) and convenience forms:
67
- * - `string` - Template string with `{{key}}` placeholders (manifest-safe, JSON-serializable)
68
- * - `function` - Render function for full control (requires runtime execution)
69
- * - `{ kind: 'template', template: string }` - Structured template form
70
- * - `{ kind: 'function', render: fn }` - Structured function form
71
- *
72
- * Templates are normalized to functions during pack assembly.
73
- * **Prefer template strings** for most cases - they are JSON-serializable.
74
- */
75
- export type TypeRenderer = TypeRendererString | TypeRendererRawFunction | TypeRendererTemplate | TypeRendererFunction;
76
- /**
77
- * Normalized type renderer - always a function after assembly.
78
- * This is the form received by the emitter.
79
- */
80
- export interface NormalizedTypeRenderer {
81
- readonly codecId: string;
82
- readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
83
- }
84
- /**
85
- * Interpolates a template string with params values.
86
- * Used internally by normalizeRenderer to compile templates to functions.
87
- *
88
- * @throws Error if a placeholder key is not found in params (except 'CodecTypes')
89
- */
90
- export declare function interpolateTypeTemplate(template: string, params: Record<string, unknown>, ctx: RenderTypeContext): string;
91
- /**
92
- * Normalizes a TypeRenderer to function form.
93
- * Called during pack assembly, not at emission time.
94
- *
95
- * Handles all TypeRenderer forms:
96
- * - Raw string template: `'Vector<{{length}}>'`
97
- * - Raw function: `(params, ctx) => ...`
98
- * - Structured template: `{ kind: 'template', template: '...' }`
99
- * - Structured function: `{ kind: 'function', render: fn }`
100
- */
101
- export declare function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer;
102
- /**
103
- * Declarative fields that describe component metadata.
104
- * These fields are owned directly by descriptors (not nested under a manifest).
105
- */
106
- export interface ComponentMetadata {
107
- /** Component version (semver) */
108
- readonly version: string;
109
- /**
110
- * Capabilities this component provides.
111
- *
112
- * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
113
- * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
114
- * keep these declarations in sync. Targets are identifiers/descriptors and typically do not
115
- * declare capabilities.
116
- */
117
- readonly capabilities?: Record<string, unknown>;
118
- /** Type imports for contract.d.ts generation */
119
- readonly types?: {
120
- readonly codecTypes?: {
121
- readonly import: TypesImportSpec;
122
- /**
123
- * Optional renderers for parameterized codecs owned by this component.
124
- * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.
125
- *
126
- * Templates are normalized to functions during pack assembly.
127
- * Duplicate codecId across descriptors is a hard error.
128
- */
129
- readonly parameterized?: Record<string, TypeRenderer>;
130
- };
131
- readonly operationTypes?: {
132
- readonly import: TypesImportSpec;
133
- };
134
- readonly storage?: ReadonlyArray<{
135
- readonly typeId: string;
136
- readonly familyId: string;
137
- readonly targetId: string;
138
- readonly nativeType?: string;
139
- }>;
140
- };
141
- /** Operation manifests for building operation registries */
142
- readonly operations?: ReadonlyArray<OperationManifest>;
143
- }
144
- /**
145
- * Base descriptor for any framework component.
146
- *
147
- * All component descriptors share these fundamental properties that identify
148
- * the component and provide its metadata. This interface is extended by
149
- * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
150
- *
151
- * @template Kind - Discriminator literal identifying the component type.
152
- * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
153
- * but the type accepts any string to allow ecosystem extensions.
154
- *
155
- * @example
156
- * ```ts
157
- * // All descriptors have these properties
158
- * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)
159
- * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')
160
- * descriptor.version // Component version (semver)
161
- * ```
162
- */
163
- export interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {
164
- /** Discriminator identifying the component type */
165
- readonly kind: Kind;
166
- /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */
167
- readonly id: string;
168
- }
169
- export interface ContractComponentRequirementsCheckInput {
170
- readonly contract: {
171
- readonly target: string;
172
- readonly targetFamily?: string | undefined;
173
- readonly extensionPacks?: Record<string, unknown> | undefined;
174
- };
175
- readonly expectedTargetFamily?: string | undefined;
176
- readonly expectedTargetId?: string | undefined;
177
- readonly providedComponentIds: Iterable<string>;
178
- }
179
- export interface ContractComponentRequirementsCheckResult {
180
- readonly familyMismatch?: {
181
- readonly expected: string;
182
- readonly actual: string;
183
- } | undefined;
184
- readonly targetMismatch?: {
185
- readonly expected: string;
186
- readonly actual: string;
187
- } | undefined;
188
- readonly missingExtensionPackIds: readonly string[];
189
- }
190
- export declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult;
191
- /**
192
- * Descriptor for a family component.
193
- *
194
- * A "family" represents a category of data sources with shared semantics
195
- * (e.g., SQL databases, document stores). Families define:
196
- * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
197
- * - Contract structure (tables vs collections, columns vs fields)
198
- * - Type system and codecs
199
- *
200
- * Families are the top-level grouping. Each family contains multiple targets
201
- * (e.g., SQL family contains Postgres, MySQL, SQLite targets).
202
- *
203
- * Extended by plane-specific descriptors:
204
- * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations
205
- * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods
206
- *
207
- * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
208
- *
209
- * @example
210
- * ```ts
211
- * import sql from '@prisma-next/family-sql/control';
212
- *
213
- * sql.kind // 'family'
214
- * sql.familyId // 'sql'
215
- * sql.id // 'sql'
216
- * ```
217
- */
218
- export interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {
219
- /** The family identifier (e.g., 'sql', 'document') */
220
- readonly familyId: TFamilyId;
221
- }
222
- /**
223
- * Descriptor for a target component.
224
- *
225
- * A "target" represents a specific database or data store within a family
226
- * (e.g., Postgres, MySQL, MongoDB). Targets define:
227
- * - Native type mappings (e.g., Postgres int4 → TypeScript number)
228
- * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
229
- *
230
- * Targets are bound to a family and provide the target-specific implementation
231
- * details that adapters and drivers use.
232
- *
233
- * Extended by plane-specific descriptors:
234
- * - `ControlTargetDescriptor` - adds optional `migrations` capability
235
- * - `RuntimeTargetDescriptor` - adds runtime factory method
236
- *
237
- * @template TFamilyId - Literal type for the family identifier
238
- * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
239
- *
240
- * @example
241
- * ```ts
242
- * import postgres from '@prisma-next/target-postgres/control';
243
- *
244
- * postgres.kind // 'target'
245
- * postgres.familyId // 'sql'
246
- * postgres.targetId // 'postgres'
247
- * ```
248
- */
249
- export interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> {
250
- /** The family this target belongs to */
251
- readonly familyId: TFamilyId;
252
- /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
253
- readonly targetId: TTargetId;
254
- }
255
- /**
256
- * Base shape for any pack reference.
257
- * Pack refs are pure JSON-friendly objects safe to import in authoring flows.
258
- */
259
- export interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
260
- readonly kind: Kind;
261
- readonly id: string;
262
- readonly familyId: TFamilyId;
263
- readonly targetId?: string;
264
- }
265
- export type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & {
266
- readonly targetId: TTargetId;
267
- };
268
- export type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & {
269
- readonly targetId: TTargetId;
270
- };
271
- export type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & {
272
- readonly targetId: TTargetId;
273
- };
274
- export type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & {
275
- readonly targetId: TTargetId;
276
- };
277
- /**
278
- * Descriptor for an adapter component.
279
- *
280
- * An "adapter" provides the protocol and dialect implementation for a target.
281
- * Adapters handle:
282
- * - SQL/query generation (lowering AST to target-specific syntax)
283
- * - Codec registration (encoding/decoding between JS and wire types)
284
- * - Type mappings and coercions
285
- *
286
- * Adapters are bound to a specific family+target combination and work with
287
- * any compatible driver for that target.
288
- *
289
- * Extended by plane-specific descriptors:
290
- * - `ControlAdapterDescriptor` - control-plane factory
291
- * - `RuntimeAdapterDescriptor` - runtime factory
292
- *
293
- * @template TFamilyId - Literal type for the family identifier
294
- * @template TTargetId - Literal type for the target identifier
295
- *
296
- * @example
297
- * ```ts
298
- * import postgresAdapter from '@prisma-next/adapter-postgres/control';
299
- *
300
- * postgresAdapter.kind // 'adapter'
301
- * postgresAdapter.familyId // 'sql'
302
- * postgresAdapter.targetId // 'postgres'
303
- * ```
304
- */
305
- export interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> {
306
- /** The family this adapter belongs to */
307
- readonly familyId: TFamilyId;
308
- /** The target this adapter is designed for */
309
- readonly targetId: TTargetId;
310
- }
311
- /**
312
- * Descriptor for a driver component.
313
- *
314
- * A "driver" provides the connection and execution layer for a target.
315
- * Drivers handle:
316
- * - Connection management (pooling, timeouts, retries)
317
- * - Query execution (sending SQL/commands, receiving results)
318
- * - Transaction management
319
- * - Wire protocol communication
320
- *
321
- * Drivers are bound to a specific family+target and work with any compatible
322
- * adapter. Multiple drivers can exist for the same target (e.g., node-postgres
323
- * vs postgres.js for Postgres).
324
- *
325
- * Extended by plane-specific descriptors:
326
- * - `ControlDriverDescriptor` - creates driver from connection URL
327
- * - `RuntimeDriverDescriptor` - creates driver with runtime options
328
- *
329
- * @template TFamilyId - Literal type for the family identifier
330
- * @template TTargetId - Literal type for the target identifier
331
- *
332
- * @example
333
- * ```ts
334
- * import postgresDriver from '@prisma-next/driver-postgres/control';
335
- *
336
- * postgresDriver.kind // 'driver'
337
- * postgresDriver.familyId // 'sql'
338
- * postgresDriver.targetId // 'postgres'
339
- * ```
340
- */
341
- export interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> {
342
- /** The family this driver belongs to */
343
- readonly familyId: TFamilyId;
344
- /** The target this driver connects to */
345
- readonly targetId: TTargetId;
346
- }
347
- /**
348
- * Descriptor for an extension component.
349
- *
350
- * An "extension" adds optional capabilities to a target. Extensions can provide:
351
- * - Additional operations (e.g., vector similarity search with pgvector)
352
- * - Custom types and codecs (e.g., vector type)
353
- * - Extended query capabilities
354
- *
355
- * Extensions are bound to a specific family+target and are registered in the
356
- * config alongside the core components. Multiple extensions can be used together.
357
- *
358
- * Extended by plane-specific descriptors:
359
- * - `ControlExtensionDescriptor` - control-plane extension factory
360
- * - `RuntimeExtensionDescriptor` - runtime extension factory
361
- *
362
- * @template TFamilyId - Literal type for the family identifier
363
- * @template TTargetId - Literal type for the target identifier
364
- *
365
- * @example
366
- * ```ts
367
- * import pgvector from '@prisma-next/extension-pgvector/control';
368
- *
369
- * pgvector.kind // 'extension'
370
- * pgvector.familyId // 'sql'
371
- * pgvector.targetId // 'postgres'
372
- * ```
373
- */
374
- export interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> {
375
- /** The family this extension belongs to */
376
- readonly familyId: TFamilyId;
377
- /** The target this extension is designed for */
378
- readonly targetId: TTargetId;
379
- }
380
- /**
381
- * Union type for target-bound component descriptors.
382
- *
383
- * Target-bound components are those that must be compatible with a specific
384
- * family+target combination. This includes targets, adapters, drivers, and
385
- * extensions. Families are not target-bound.
386
- *
387
- * This type is used in migration and verification interfaces to enforce
388
- * type-level compatibility between components.
389
- *
390
- * @template TFamilyId - Literal type for the family identifier
391
- * @template TTargetId - Literal type for the target identifier
392
- *
393
- * @example
394
- * ```ts
395
- * // All these components must have matching familyId and targetId
396
- * const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [
397
- * postgresTarget,
398
- * postgresAdapter,
399
- * postgresDriver,
400
- * pgvectorExtension,
401
- * ];
402
- * ```
403
- */
404
- export type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>;
405
- /**
406
- * Base interface for family instances.
407
- *
408
- * A family instance is created by a family descriptor's `create()` method.
409
- * This base interface carries only the identity; plane-specific interfaces
410
- * add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).
411
- *
412
- * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
413
- *
414
- * @example
415
- * ```ts
416
- * const instance = sql.create({ target, adapter, driver, extensions });
417
- * instance.familyId // 'sql'
418
- * ```
419
- */
420
- export interface FamilyInstance<TFamilyId extends string> {
421
- /** The family identifier (e.g., 'sql', 'document') */
422
- readonly familyId: TFamilyId;
423
- }
424
- /**
425
- * Base interface for target instances.
426
- *
427
- * A target instance is created by a target descriptor's `create()` method.
428
- * This base interface carries only the identity; plane-specific interfaces
429
- * add target-specific behavior.
430
- *
431
- * @template TFamilyId - Literal type for the family identifier
432
- * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
433
- *
434
- * @example
435
- * ```ts
436
- * const instance = postgres.create();
437
- * instance.familyId // 'sql'
438
- * instance.targetId // 'postgres'
439
- * ```
440
- */
441
- export interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
442
- /** The family this target belongs to */
443
- readonly familyId: TFamilyId;
444
- /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
445
- readonly targetId: TTargetId;
446
- }
447
- /**
448
- * Base interface for adapter instances.
449
- *
450
- * An adapter instance is created by an adapter descriptor's `create()` method.
451
- * This base interface carries only the identity; plane-specific interfaces
452
- * add adapter-specific behavior (e.g., codec registration, query lowering).
453
- *
454
- * @template TFamilyId - Literal type for the family identifier
455
- * @template TTargetId - Literal type for the target identifier
456
- *
457
- * @example
458
- * ```ts
459
- * const instance = postgresAdapter.create();
460
- * instance.familyId // 'sql'
461
- * instance.targetId // 'postgres'
462
- * ```
463
- */
464
- export interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
465
- /** The family this adapter belongs to */
466
- readonly familyId: TFamilyId;
467
- /** The target this adapter is designed for */
468
- readonly targetId: TTargetId;
469
- }
470
- /**
471
- * Base interface for driver instances.
472
- *
473
- * A driver instance is created by a driver descriptor's `create()` method.
474
- * This base interface carries only the identity; plane-specific interfaces
475
- * add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).
476
- *
477
- * @template TFamilyId - Literal type for the family identifier
478
- * @template TTargetId - Literal type for the target identifier
479
- *
480
- * @example
481
- * ```ts
482
- * const instance = postgresDriver.create({ databaseUrl });
483
- * instance.familyId // 'sql'
484
- * instance.targetId // 'postgres'
485
- * ```
486
- */
487
- export interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
488
- /** The family this driver belongs to */
489
- readonly familyId: TFamilyId;
490
- /** The target this driver connects to */
491
- readonly targetId: TTargetId;
492
- }
493
- /**
494
- * Base interface for extension instances.
495
- *
496
- * An extension instance is created by an extension descriptor's `create()` method.
497
- * This base interface carries only the identity; plane-specific interfaces
498
- * add extension-specific behavior.
499
- *
500
- * @template TFamilyId - Literal type for the family identifier
501
- * @template TTargetId - Literal type for the target identifier
502
- *
503
- * @example
504
- * ```ts
505
- * const instance = pgvector.create();
506
- * instance.familyId // 'sql'
507
- * instance.targetId // 'postgres'
508
- * ```
509
- */
510
- export interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
511
- /** The family this extension belongs to */
512
- readonly familyId: TFamilyId;
513
- /** The target this extension is designed for */
514
- readonly targetId: TTargetId;
515
- }
516
- //# 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;AAiBlE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,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,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;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAC7B,MAAM,EAAE,MAAM,CAAC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