@prisma-next/framework-components 0.5.0-dev.9 → 0.6.0-dev.1

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 (95) hide show
  1. package/README.md +51 -4
  2. package/dist/authoring.d.mts +2 -2
  3. package/dist/authoring.mjs +2 -122
  4. package/dist/codec-m_-FAyQn.d.mts +168 -0
  5. package/dist/codec-m_-FAyQn.d.mts.map +1 -0
  6. package/dist/codec.d.mts +48 -2
  7. package/dist/codec.d.mts.map +1 -0
  8. package/dist/codec.mjs +67 -4
  9. package/dist/codec.mjs.map +1 -1
  10. package/dist/components.d.mts +1 -1
  11. package/dist/components.mjs +2 -3
  12. package/dist/control.d.mts +421 -78
  13. package/dist/control.d.mts.map +1 -1
  14. package/dist/control.mjs +83 -58
  15. package/dist/control.mjs.map +1 -1
  16. package/dist/emission-types-CMv_053d.d.mts +38 -0
  17. package/dist/emission-types-CMv_053d.d.mts.map +1 -0
  18. package/dist/emission.d.mts +2 -2
  19. package/dist/emission.mjs +1 -1
  20. package/dist/execution.d.mts +5 -5
  21. package/dist/execution.d.mts.map +1 -1
  22. package/dist/execution.mjs +4 -6
  23. package/dist/execution.mjs.map +1 -1
  24. package/dist/{framework-authoring-D1-JZ37B.d.mts → framework-authoring-DGIQbNPt.d.mts} +43 -12
  25. package/dist/framework-authoring-DGIQbNPt.d.mts.map +1 -0
  26. package/dist/framework-authoring-DxXcjyJX.mjs +209 -0
  27. package/dist/framework-authoring-DxXcjyJX.mjs.map +1 -0
  28. package/dist/{framework-components-DFZMi2h7.d.mts → framework-components-CHuBHXQN.d.mts} +45 -58
  29. package/dist/framework-components-CHuBHXQN.d.mts.map +1 -0
  30. package/dist/{framework-components-C8ZhSwXe.mjs → framework-components-FdqmlGUj.mjs} +3 -3
  31. package/dist/framework-components-FdqmlGUj.mjs.map +1 -0
  32. package/dist/psl-ast-Ckn_G-jv.d.mts +159 -0
  33. package/dist/psl-ast-Ckn_G-jv.d.mts.map +1 -0
  34. package/dist/psl-ast.d.mts +2 -0
  35. package/dist/psl-ast.mjs +1 -0
  36. package/dist/runtime.d.mts +273 -37
  37. package/dist/runtime.d.mts.map +1 -1
  38. package/dist/runtime.mjs +172 -30
  39. package/dist/runtime.mjs.map +1 -1
  40. package/dist/{types-import-spec-C4sc7wbb.d.mts → types-import-spec-BxI5cSQy.d.mts} +2 -2
  41. package/dist/types-import-spec-BxI5cSQy.d.mts.map +1 -0
  42. package/package.json +12 -8
  43. package/src/control/control-capabilities.ts +96 -0
  44. package/src/{control-descriptors.ts → control/control-descriptors.ts} +7 -7
  45. package/src/{control-instances.ts → control/control-instances.ts} +52 -6
  46. package/src/{control-migration-types.ts → control/control-migration-types.ts} +251 -63
  47. package/src/control/control-operation-preview.ts +23 -0
  48. package/src/{control-result-types.ts → control/control-result-types.ts} +0 -2
  49. package/src/control/control-spaces.ts +82 -0
  50. package/src/{control-stack.ts → control/control-stack.ts} +77 -111
  51. package/src/control/emission-types.ts +48 -0
  52. package/src/control/psl-ast.ts +193 -0
  53. package/src/{execution-descriptors.ts → execution/execution-descriptors.ts} +7 -7
  54. package/src/{execution-instances.ts → execution/execution-instances.ts} +1 -1
  55. package/src/{execution-requirements.ts → execution/execution-requirements.ts} +1 -1
  56. package/src/execution/race-against-abort.ts +89 -0
  57. package/src/execution/run-with-middleware.ts +153 -0
  58. package/src/{runtime-core.ts → execution/runtime-core.ts} +27 -3
  59. package/src/execution/runtime-error.ts +94 -0
  60. package/src/execution/runtime-middleware.ts +235 -0
  61. package/src/exports/authoring.ts +5 -2
  62. package/src/exports/codec.ts +27 -2
  63. package/src/exports/components.ts +2 -2
  64. package/src/exports/control.ts +41 -14
  65. package/src/exports/emission.ts +2 -2
  66. package/src/exports/execution.ts +5 -5
  67. package/src/exports/psl-ast.ts +1 -0
  68. package/src/exports/runtime.ts +18 -9
  69. package/src/shared/codec-descriptor.ts +87 -0
  70. package/src/shared/codec-types.ts +79 -0
  71. package/src/shared/codec.ts +80 -0
  72. package/src/shared/column-spec.ts +83 -0
  73. package/src/{framework-authoring.ts → shared/framework-authoring.ts} +210 -23
  74. package/src/{framework-components.ts → shared/framework-components.ts} +22 -49
  75. package/src/{mutation-default-types.ts → shared/mutation-default-types.ts} +22 -2
  76. package/dist/authoring.mjs.map +0 -1
  77. package/dist/codec-types-DQ1Agjom.d.mts +0 -58
  78. package/dist/codec-types-DQ1Agjom.d.mts.map +0 -1
  79. package/dist/emission-types-BPAALJbF.d.mts +0 -24
  80. package/dist/emission-types-BPAALJbF.d.mts.map +0 -1
  81. package/dist/framework-authoring-D1-JZ37B.d.mts.map +0 -1
  82. package/dist/framework-components-C8ZhSwXe.mjs.map +0 -1
  83. package/dist/framework-components-DFZMi2h7.d.mts.map +0 -1
  84. package/dist/types-import-spec-C4sc7wbb.d.mts.map +0 -1
  85. package/src/codec-types.ts +0 -64
  86. package/src/control-capabilities.ts +0 -34
  87. package/src/emission-types.ts +0 -28
  88. package/src/run-with-middleware.ts +0 -77
  89. package/src/runtime-error.ts +0 -55
  90. package/src/runtime-middleware.ts +0 -87
  91. /package/src/{control-schema-view.ts → control/control-schema-view.ts} +0 -0
  92. /package/src/{async-iterable-result.ts → execution/async-iterable-result.ts} +0 -0
  93. /package/src/{execution-stack.ts → execution/execution-stack.ts} +0 -0
  94. /package/src/{query-plan.ts → execution/query-plan.ts} +0 -0
  95. /package/src/{types-import-spec.ts → shared/types-import-spec.ts} +0 -0
@@ -1,9 +1,9 @@
1
- import { i as AuthoringContributions } from "./framework-authoring-D1-JZ37B.mjs";
2
- import { t as Codec } from "./codec-types-DQ1Agjom.mjs";
3
- import { t as TypesImportSpec } from "./types-import-spec-C4sc7wbb.mjs";
4
- import { ColumnDefault, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
1
+ import { i as AuthoringContributions } from "./framework-authoring-DGIQbNPt.mjs";
2
+ import { r as AnyCodecDescriptor } from "./codec-m_-FAyQn.mjs";
3
+ import { t as TypesImportSpec } from "./types-import-spec-BxI5cSQy.mjs";
4
+ import { ColumnDefault, ExecutionMutationDefaultPhases, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
5
5
 
6
- //#region src/mutation-default-types.d.ts
6
+ //#region src/shared/mutation-default-types.d.ts
7
7
  interface SourcePosition {
8
8
  readonly offset: number;
9
9
  readonly line: number;
@@ -61,7 +61,16 @@ interface DefaultFunctionRegistryEntry {
61
61
  type DefaultFunctionRegistry = ReadonlyMap<string, DefaultFunctionRegistryEntry>;
62
62
  interface MutationDefaultGeneratorDescriptor {
63
63
  readonly id: string;
64
- readonly applicableCodecIds: readonly string[];
64
+ /**
65
+ * Codec ids the generator is compatible with when the codec choice
66
+ * and the generator choice are made independently by the contract
67
+ * author. Set when the registry-coherence check is meaningful
68
+ * (the codec and the generator can be paired arbitrarily by the
69
+ * caller); omitted when the generator is only reachable through a
70
+ * descriptor that co-registers a fixed codec, so coherence is
71
+ * structural and the list would be tautological.
72
+ */
73
+ readonly applicableCodecIds?: readonly string[];
65
74
  readonly resolveGeneratedColumnDescriptor?: (input: {
66
75
  readonly generated: ExecutionMutationDefaultValue;
67
76
  }) => {
@@ -70,6 +79,13 @@ interface MutationDefaultGeneratorDescriptor {
70
79
  readonly typeRef?: string;
71
80
  readonly typeParams?: Record<string, unknown>;
72
81
  } | undefined;
82
+ /**
83
+ * Construct the `onCreate`/`onUpdate` phases value owned by this
84
+ * generator. Authoring layers (PSL `temporal.updatedAt()`, TS field presets) call
85
+ * this instead of building the literal inline so PSL/TS-authored
86
+ * contracts stay byte-equivalent for any future params-bearing generator.
87
+ */
88
+ readonly buildPhases?: (args?: Record<string, unknown>) => ExecutionMutationDefaultPhases;
73
89
  }
74
90
  interface ControlMutationDefaultEntry {
75
91
  readonly lower: (input: {
@@ -84,7 +100,7 @@ interface ControlMutationDefaults {
84
100
  readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[];
85
101
  }
86
102
  //#endregion
87
- //#region src/framework-components.d.ts
103
+ //#region src/shared/framework-components.d.ts
88
104
  /**
89
105
  * Declarative fields that describe component metadata.
90
106
  */
@@ -94,42 +110,32 @@ interface ComponentMetadata {
94
110
  /**
95
111
  * Capabilities this component provides.
96
112
  *
97
- * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
98
- * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
99
- * keep these declarations in sync. Targets are identifiers/descriptors and typically do not
100
- * declare capabilities.
113
+ * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`); keep these declarations in sync. Targets are identifiers/descriptors and typically do not declare capabilities.
101
114
  */
102
115
  readonly capabilities?: Record<string, unknown>;
103
116
  /** Type imports for contract.d.ts generation */
104
117
  readonly types?: {
105
118
  readonly codecTypes?: {
106
119
  /**
107
- * Base codec types import spec.
108
- * Optional: adapters typically provide this, extensions usually don't.
120
+ * Base codec types import spec. Optional: adapters typically provide this, extensions usually don't.
109
121
  */
110
122
  readonly import?: TypesImportSpec;
111
123
  /**
112
124
  * Additional type-only imports for parameterized codec branded types.
113
125
  *
114
- * These imports are included in generated `contract.d.ts` but are NOT treated as
115
- * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).
126
+ * These imports are included in generated `contract.d.ts` but are NOT treated as codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).
116
127
  *
117
128
  * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`
118
129
  */
119
130
  readonly typeImports?: ReadonlyArray<TypesImportSpec>;
120
131
  /**
121
- * Optional control-plane hooks keyed by codecId.
122
- * Used by family-specific planners/verifiers to handle storage types.
132
+ * Optional control-plane hooks keyed by codecId. Used by family-specific planners/verifiers to handle storage types.
123
133
  */
124
134
  readonly controlPlaneHooks?: Record<string, unknown>;
125
135
  /**
126
- * Codec instances contributed by this component.
127
- * Used to build a CodecLookup for codec-dispatched type rendering during emission.
136
+ * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.
128
137
  */
129
- readonly codecInstances?: ReadonlyArray<Codec>;
130
- };
131
- readonly operationTypes?: {
132
- readonly import: TypesImportSpec;
138
+ readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;
133
139
  };
134
140
  readonly queryOperationTypes?: {
135
141
  readonly import: TypesImportSpec;
@@ -144,32 +150,24 @@ interface ComponentMetadata {
144
150
  /**
145
151
  * Optional pure-data authoring contributions exposed by this component.
146
152
  *
147
- * These contributions are safe to include on pack refs and descriptors because
148
- * they contain only declarative metadata. Higher-level authoring packages may
149
- * project them into concrete helper functions for TS-first workflows.
153
+ * These contributions are safe to include on pack refs and descriptors because they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows.
150
154
  */
151
155
  readonly authoring?: AuthoringContributions;
152
156
  /**
153
- * Scalar type name to codec ID mapping contributed by this component.
154
- * Assembled by `createControlStack` with duplicate detection.
157
+ * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.
155
158
  */
156
159
  readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;
157
160
  /**
158
- * Mutation default function handlers and generator descriptors contributed
159
- * by this component. Assembled by `createControlStack` with duplicate detection.
161
+ * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.
160
162
  */
161
163
  readonly controlMutationDefaults?: ControlMutationDefaults;
162
164
  }
163
165
  /**
164
166
  * Base descriptor for any framework component.
165
167
  *
166
- * All component descriptors share these fundamental properties that identify
167
- * the component and provide its metadata. This interface is extended by
168
- * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
168
+ * All component descriptors share these fundamental properties that identify the component and provide its metadata. This interface is extended by specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
169
169
  *
170
- * @template Kind - Discriminator literal identifying the component type.
171
- * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
172
- * but the type accepts any string to allow ecosystem extensions.
170
+ * @template Kind - Discriminator literal identifying the component type. Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension', but the type accepts any string to allow ecosystem extensions.
173
171
  *
174
172
  * @example
175
173
  * ```ts
@@ -210,14 +208,12 @@ declare function checkContractComponentRequirements(input: ContractComponentRequ
210
208
  /**
211
209
  * Descriptor for a family component.
212
210
  *
213
- * A "family" represents a category of data sources with shared semantics
214
- * (e.g., SQL databases, document stores). Families define:
211
+ * A "family" represents a category of data sources with shared semantics (e.g., SQL databases, document stores). Families define:
215
212
  * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
216
213
  * - Contract structure (tables vs collections, columns vs fields)
217
214
  * - Type system and codecs
218
215
  *
219
- * Families are the top-level grouping. Each family contains multiple targets
220
- * (e.g., SQL family contains Postgres, MySQL, SQLite targets).
216
+ * Families are the top-level grouping. Each family contains multiple targets (e.g., SQL family contains Postgres, MySQL, SQLite targets).
221
217
  *
222
218
  * Extended by plane-specific descriptors:
223
219
  * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations
@@ -241,13 +237,11 @@ interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor
241
237
  /**
242
238
  * Descriptor for a target component.
243
239
  *
244
- * A "target" represents a specific database or data store within a family
245
- * (e.g., Postgres, MySQL, MongoDB). Targets define:
240
+ * A "target" represents a specific database or data store within a family (e.g., Postgres, MySQL, MongoDB). Targets define:
246
241
  * - Native type mappings (e.g., Postgres int4 → TypeScript number)
247
242
  * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
248
243
  *
249
- * Targets are bound to a family and provide the target-specific implementation
250
- * details that adapters and drivers use.
244
+ * Targets are bound to a family and provide the target-specific implementation details that adapters and drivers use.
251
245
  *
252
246
  * Extended by plane-specific descriptors:
253
247
  * - `ControlTargetDescriptor` - adds optional `migrations` capability
@@ -272,8 +266,7 @@ interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> e
272
266
  readonly targetId: TTargetId;
273
267
  }
274
268
  /**
275
- * Base shape for any pack reference.
276
- * Pack refs are pure JSON-friendly objects safe to import in authoring flows.
269
+ * Base shape for any pack reference. Pack refs are pure JSON-friendly objects safe to import in authoring flows.
277
270
  */
278
271
  interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
279
272
  readonly kind: Kind;
@@ -298,14 +291,12 @@ type DriverPackRef<TFamilyId extends string = string, TTargetId extends string =
298
291
  /**
299
292
  * Descriptor for an adapter component.
300
293
  *
301
- * An "adapter" provides the protocol and dialect implementation for a target.
302
- * Adapters handle:
294
+ * An "adapter" provides the protocol and dialect implementation for a target. Adapters handle:
303
295
  * - SQL/query generation (lowering AST to target-specific syntax)
304
296
  * - Codec registration (encoding/decoding between JS and wire types)
305
297
  * - Type mappings and coercions
306
298
  *
307
- * Adapters are bound to a specific family+target combination and work with
308
- * any compatible driver for that target.
299
+ * Adapters are bound to a specific family+target combination and work with any compatible driver for that target.
309
300
  *
310
301
  * Extended by plane-specific descriptors:
311
302
  * - `ControlAdapterDescriptor` - control-plane factory
@@ -332,16 +323,13 @@ interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>
332
323
  /**
333
324
  * Descriptor for a driver component.
334
325
  *
335
- * A "driver" provides the connection and execution layer for a target.
336
- * Drivers handle:
326
+ * A "driver" provides the connection and execution layer for a target. Drivers handle:
337
327
  * - Connection management (pooling, timeouts, retries)
338
328
  * - Query execution (sending SQL/commands, receiving results)
339
329
  * - Transaction management
340
330
  * - Wire protocol communication
341
331
  *
342
- * Drivers are bound to a specific family+target and work with any compatible
343
- * adapter. Multiple drivers can exist for the same target (e.g., node-postgres
344
- * vs postgres.js for Postgres).
332
+ * Drivers are bound to a specific family+target and work with any compatible adapter. Multiple drivers can exist for the same target (e.g., node-postgres vs postgres.js for Postgres).
345
333
  *
346
334
  * Extended by plane-specific descriptors:
347
335
  * - `ControlDriverDescriptor` - creates driver from connection URL
@@ -373,8 +361,7 @@ interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> e
373
361
  * - Custom types and codecs (e.g., vector type)
374
362
  * - Extended query capabilities
375
363
  *
376
- * Extensions are bound to a specific family+target and are registered in the
377
- * config alongside the core components. Multiple extensions can be used together.
364
+ * Extensions are bound to a specific family+target and are registered in the config alongside the core components. Multiple extensions can be used together.
378
365
  *
379
366
  * Extended by plane-specific descriptors:
380
367
  * - `ControlExtensionDescriptor` - control-plane extension factory
@@ -421,4 +408,4 @@ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string>
421
408
  }
422
409
  //#endregion
423
410
  export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, checkContractComponentRequirements as S, ControlMutationDefaults as T, 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, LoweredDefaultValue as j, DefaultFunctionRegistryEntry as k, 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, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
424
- //# sourceMappingURL=framework-components-DFZMi2h7.d.mts.map
411
+ //# sourceMappingURL=framework-components-CHuBHXQN.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-CHuBHXQN.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"mappings":";;;;;;UAMU,cAAA;EAAA,SACC,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,UAAA;EAAA,SACN,KAAA,EAAO,cAAA;EAAA,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AAvMrB;;;;;;;;;;;UAqOiB,gBAAA,6DACP,mBAAA;EA9N8C;EAAA,SAgO7C,QAAA,EAAU,SAAA;EAxNoB;EAAA,SA2N9B,QAAA,EAAU,SAAA;AAAA;;;;;;;;;;AAxNrB;;;;;;;;;;;;;AAMA;;;;UA+OiB,mBAAA,6DACP,mBAAA;EA/OR;EAAA,SAiPS,QAAA,EAAU,SAAA;EAhPsB;EAAA,SAmPhC,QAAA,EAAU,SAAA;AAAA;;KAIT,8BAAA,uDACR,gBAAA,CAAiB,SAAA,EAAW,SAAA,IAC5B,iBAAA,CAAkB,SAAA,EAAW,SAAA,IAC7B,gBAAA,CAAiB,SAAA,EAAW,SAAA,IAC5B,mBAAA,CAAoB,SAAA,EAAW,SAAA;AAAA,UAElB,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;AAAA;AAAA,UAGJ,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAA;AAAA;AAAA,UAGJ,eAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAA;AAAA;AAAA,UAGJ,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAA;AAAA;AAAA,UAGJ,iBAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- //#region src/framework-components.ts
1
+ //#region src/shared/framework-components.ts
2
2
  function checkContractComponentRequirements(input) {
3
3
  const providedIds = /* @__PURE__ */ new Set();
4
4
  for (const id of input.providedComponentIds) providedIds.add(id);
@@ -21,7 +21,7 @@ function checkContractComponentRequirements(input) {
21
21
  missingExtensionPackIds
22
22
  };
23
23
  }
24
-
25
24
  //#endregion
26
25
  export { checkContractComponentRequirements as t };
27
- //# sourceMappingURL=framework-components-C8ZhSwXe.mjs.map
26
+
27
+ //# sourceMappingURL=framework-components-FdqmlGUj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-FdqmlGUj.mjs","names":[],"sources":["../src/shared/framework-components.ts"],"sourcesContent":["import type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { ControlMutationDefaults } from './mutation-default-types';\nimport type { TypesImportSpec } from './types-import-spec';\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`); keep these declarations in sync. Targets are identifiers/descriptors and typically do not declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n /**\n * Base codec types import spec. Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Additional type-only imports for parameterized codec branded types.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId. Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.\n */\n readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;\n };\n readonly queryOperationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n\n /**\n * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;\n\n /**\n * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly controlMutationDefaults?: ControlMutationDefaults;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify the component and provide its metadata. This interface is extended by specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type. Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension', but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference. Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target. Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target. Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible adapter. Multiple drivers can exist for the same target (e.g., node-postgres vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";AA8GA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;CACrC,KAAK,MAAM,MAAM,MAAM,sBACrB,YAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,KAAA,KACzB,yBAAyB,KAAA,KACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE,KAAA;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,KAAA,KAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD,KAAA;CAEN,OAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
@@ -0,0 +1,159 @@
1
+ //#region src/control/psl-ast.d.ts
2
+ interface PslPosition {
3
+ readonly offset: number;
4
+ readonly line: number;
5
+ readonly column: number;
6
+ }
7
+ interface PslSpan {
8
+ readonly start: PslPosition;
9
+ readonly end: PslPosition;
10
+ }
11
+ type PslDiagnosticCode = 'PSL_UNTERMINATED_BLOCK' | 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK' | 'PSL_INVALID_ATTRIBUTE_SYNTAX' | 'PSL_INVALID_MODEL_MEMBER' | 'PSL_UNSUPPORTED_MODEL_ATTRIBUTE' | 'PSL_UNSUPPORTED_FIELD_ATTRIBUTE' | 'PSL_INVALID_RELATION_ATTRIBUTE' | 'PSL_INVALID_REFERENTIAL_ACTION' | 'PSL_INVALID_DEFAULT_VALUE' | 'PSL_INVALID_ENUM_MEMBER' | 'PSL_INVALID_TYPES_MEMBER';
12
+ interface PslDiagnostic {
13
+ readonly code: PslDiagnosticCode;
14
+ readonly message: string;
15
+ readonly sourceId: string;
16
+ readonly span: PslSpan;
17
+ }
18
+ interface PslDefaultFunctionValue {
19
+ readonly kind: 'function';
20
+ readonly name: 'autoincrement' | 'now';
21
+ }
22
+ interface PslDefaultLiteralValue {
23
+ readonly kind: 'literal';
24
+ readonly value: string | number | boolean;
25
+ }
26
+ type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;
27
+ type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';
28
+ interface PslAttributePositionalArgument {
29
+ readonly kind: 'positional';
30
+ readonly value: string;
31
+ readonly span: PslSpan;
32
+ }
33
+ interface PslAttributeNamedArgument {
34
+ readonly kind: 'named';
35
+ readonly name: string;
36
+ readonly value: string;
37
+ readonly span: PslSpan;
38
+ }
39
+ type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;
40
+ interface PslTypeConstructorCall {
41
+ readonly kind: 'typeConstructor';
42
+ readonly path: readonly string[];
43
+ readonly args: readonly PslAttributeArgument[];
44
+ readonly span: PslSpan;
45
+ }
46
+ interface PslAttribute {
47
+ readonly kind: 'attribute';
48
+ readonly target: PslAttributeTarget;
49
+ readonly name: string;
50
+ readonly args: readonly PslAttributeArgument[];
51
+ readonly span: PslSpan;
52
+ }
53
+ type PslReferentialAction = string;
54
+ type PslFieldAttribute = PslAttribute;
55
+ interface PslField {
56
+ readonly kind: 'field';
57
+ readonly name: string;
58
+ readonly typeName: string;
59
+ readonly typeConstructor?: PslTypeConstructorCall;
60
+ readonly optional: boolean;
61
+ readonly list: boolean;
62
+ readonly typeRef?: string;
63
+ readonly attributes: readonly PslFieldAttribute[];
64
+ readonly span: PslSpan;
65
+ }
66
+ interface PslUniqueConstraint {
67
+ readonly kind: 'unique';
68
+ readonly fields: readonly string[];
69
+ readonly span: PslSpan;
70
+ }
71
+ interface PslIndexConstraint {
72
+ readonly kind: 'index';
73
+ readonly fields: readonly string[];
74
+ readonly span: PslSpan;
75
+ }
76
+ type PslModelAttribute = PslAttribute;
77
+ interface PslModel {
78
+ readonly kind: 'model';
79
+ readonly name: string;
80
+ readonly fields: readonly PslField[];
81
+ readonly attributes: readonly PslModelAttribute[];
82
+ readonly span: PslSpan;
83
+ /**
84
+ * Optional leading comment line emitted above the `model` keyword by the
85
+ * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection
86
+ * advisories such as "// WARNING: This table has no primary key in the
87
+ * database" here. The parser leaves this field unset; round-tripping a
88
+ * parsed schema does not re-attach comments.
89
+ */
90
+ readonly comment?: string;
91
+ }
92
+ interface PslEnumValue {
93
+ readonly kind: 'enumValue';
94
+ readonly name: string;
95
+ /**
96
+ * Optional storage label for the enum member, captured from a trailing
97
+ * `@map("...")` attribute on the member line. The parser populates this
98
+ * when the source PSL carries an explicit `@map`. Producers (e.g.
99
+ * `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)`
100
+ * automatically when normalisation would change the printed member name
101
+ * (so an enum value `'in-progress'` becomes `inProgress @map("in-progress")`
102
+ * in PSL, preserving the round-trip).
103
+ */
104
+ readonly mapName?: string;
105
+ readonly span: PslSpan;
106
+ }
107
+ interface PslEnum {
108
+ readonly kind: 'enum';
109
+ readonly name: string;
110
+ readonly values: readonly PslEnumValue[];
111
+ readonly attributes: readonly PslAttribute[];
112
+ readonly span: PslSpan;
113
+ }
114
+ interface PslCompositeType {
115
+ readonly kind: 'compositeType';
116
+ readonly name: string;
117
+ readonly fields: readonly PslField[];
118
+ readonly attributes: readonly PslAttribute[];
119
+ readonly span: PslSpan;
120
+ }
121
+ interface PslNamedTypeDeclaration {
122
+ readonly kind: 'namedType';
123
+ readonly name: string;
124
+ /**
125
+ * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.
126
+ * Expressing this as a discriminated union trips TypeScript narrowing when
127
+ * the declaration flows through helpers that accept the full union.
128
+ */
129
+ readonly baseType?: string;
130
+ readonly typeConstructor?: PslTypeConstructorCall;
131
+ readonly attributes: readonly PslAttribute[];
132
+ readonly span: PslSpan;
133
+ }
134
+ interface PslTypesBlock {
135
+ readonly kind: 'types';
136
+ readonly declarations: readonly PslNamedTypeDeclaration[];
137
+ readonly span: PslSpan;
138
+ }
139
+ interface PslDocumentAst {
140
+ readonly kind: 'document';
141
+ readonly sourceId: string;
142
+ readonly models: readonly PslModel[];
143
+ readonly enums: readonly PslEnum[];
144
+ readonly compositeTypes: readonly PslCompositeType[];
145
+ readonly types?: PslTypesBlock;
146
+ readonly span: PslSpan;
147
+ }
148
+ interface ParsePslDocumentInput {
149
+ readonly schema: string;
150
+ readonly sourceId: string;
151
+ }
152
+ interface ParsePslDocumentResult {
153
+ readonly ast: PslDocumentAst;
154
+ readonly diagnostics: readonly PslDiagnostic[];
155
+ readonly ok: boolean;
156
+ }
157
+ //#endregion
158
+ export { PslPosition as C, PslTypesBlock as D, PslTypeConstructorCall as E, PslUniqueConstraint as O, PslNamedTypeDeclaration as S, PslSpan as T, PslField as _, PslAttributeNamedArgument as a, PslModel as b, PslCompositeType as c, PslDefaultValue as d, PslDiagnostic as f, PslEnumValue as g, PslEnum as h, PslAttributeArgument as i, PslDefaultFunctionValue as l, PslDocumentAst as m, ParsePslDocumentResult as n, PslAttributePositionalArgument as o, PslDiagnosticCode as p, PslAttribute as r, PslAttributeTarget as s, ParsePslDocumentInput as t, PslDefaultLiteralValue as u, PslFieldAttribute as v, PslReferentialAction as w, PslModelAttribute as x, PslIndexConstraint as y };
159
+ //# sourceMappingURL=psl-ast-Ckn_G-jv.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-ast-Ckn_G-jv.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";UAAiB,WAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,OAAA;EAAA,SACN,KAAA,EAAO,WAAA;EAAA,SACP,GAAA,EAAK,WAAA;AAAA;AAAA,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AA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,sBAAA;EAAA,SACN,GAAA,EAAK,cAAA;EAAA,SACL,WAAA,WAAsB,aAAA;EAAA,SACtB,EAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ import { C as PslPosition, D as PslTypesBlock, E as PslTypeConstructorCall, O as PslUniqueConstraint, S as PslNamedTypeDeclaration, T as PslSpan, _ as PslField, a as PslAttributeNamedArgument, b as PslModel, c as PslCompositeType, d as PslDefaultValue, f as PslDiagnostic, g as PslEnumValue, h as PslEnum, i as PslAttributeArgument, l as PslDefaultFunctionValue, m as PslDocumentAst, n as ParsePslDocumentResult, o as PslAttributePositionalArgument, p as PslDiagnosticCode, r as PslAttribute, s as PslAttributeTarget, t as ParsePslDocumentInput, u as PslDefaultLiteralValue, v as PslFieldAttribute, w as PslReferentialAction, x as PslModelAttribute, y as PslIndexConstraint } from "./psl-ast-Ckn_G-jv.mjs";
2
+ export { ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, PslDiagnosticCode, PslDocumentAst, PslEnum, PslEnumValue, PslField, PslFieldAttribute, PslIndexConstraint, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslPosition, PslReferentialAction, PslSpan, PslTypeConstructorCall, PslTypesBlock, PslUniqueConstraint };
@@ -0,0 +1 @@
1
+ export {};