@prisma-next/core-control-plane 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 (97) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -99
  3. package/dist/constants.d.mts +9 -0
  4. package/dist/constants.d.mts.map +1 -0
  5. package/dist/constants.mjs +10 -0
  6. package/dist/constants.mjs.map +1 -0
  7. package/dist/emission.d.mts +58 -0
  8. package/dist/emission.d.mts.map +1 -0
  9. package/dist/emission.mjs +315 -0
  10. package/dist/emission.mjs.map +1 -0
  11. package/dist/errors.d.mts +232 -0
  12. package/dist/errors.d.mts.map +1 -0
  13. package/dist/errors.mjs +330 -0
  14. package/dist/errors.mjs.map +1 -0
  15. package/dist/{schema-view.d.ts → schema-view-DObwT8x9.d.mts} +17 -14
  16. package/dist/schema-view-DObwT8x9.d.mts.map +1 -0
  17. package/dist/schema-view.d.mts +2 -0
  18. package/dist/schema-view.mjs +1 -0
  19. package/dist/stack.d.mts +30 -0
  20. package/dist/stack.d.mts.map +1 -0
  21. package/dist/stack.mjs +30 -0
  22. package/dist/stack.mjs.map +1 -0
  23. package/dist/types-BArIWumw.d.mts +615 -0
  24. package/dist/types-BArIWumw.d.mts.map +1 -0
  25. package/dist/types.d.mts +2 -0
  26. package/dist/types.mjs +1 -0
  27. package/package.json +31 -43
  28. package/src/constants.ts +5 -0
  29. package/src/emission/canonicalization.ts +68 -21
  30. package/src/emission/emit.ts +82 -21
  31. package/src/emission/hashing.ts +29 -27
  32. package/src/emission/types.ts +13 -2
  33. package/src/errors.ts +127 -20
  34. package/src/exports/constants.ts +1 -0
  35. package/src/exports/emission.ts +1 -1
  36. package/src/exports/errors.ts +6 -1
  37. package/src/exports/types.ts +0 -1
  38. package/src/migrations.ts +27 -1
  39. package/src/schema-view.ts +5 -5
  40. package/src/types.ts +24 -12
  41. package/dist/chunk-473ODD3P.js +0 -14
  42. package/dist/chunk-473ODD3P.js.map +0 -1
  43. package/dist/chunk-U5RYT6PT.js +0 -229
  44. package/dist/chunk-U5RYT6PT.js.map +0 -1
  45. package/dist/config-types.d.ts +0 -68
  46. package/dist/config-types.d.ts.map +0 -1
  47. package/dist/config-validation.d.ts +0 -10
  48. package/dist/config-validation.d.ts.map +0 -1
  49. package/dist/emission/canonicalization.d.ts +0 -6
  50. package/dist/emission/canonicalization.d.ts.map +0 -1
  51. package/dist/emission/emit.d.ts +0 -5
  52. package/dist/emission/emit.d.ts.map +0 -1
  53. package/dist/emission/hashing.d.ts +0 -17
  54. package/dist/emission/hashing.d.ts.map +0 -1
  55. package/dist/emission/types.d.ts +0 -16
  56. package/dist/emission/types.d.ts.map +0 -1
  57. package/dist/errors.d.ts +0 -183
  58. package/dist/errors.d.ts.map +0 -1
  59. package/dist/exports/config-types.d.ts +0 -3
  60. package/dist/exports/config-types.d.ts.map +0 -1
  61. package/dist/exports/config-types.js +0 -53
  62. package/dist/exports/config-types.js.map +0 -1
  63. package/dist/exports/config-validation.d.ts +0 -2
  64. package/dist/exports/config-validation.d.ts.map +0 -1
  65. package/dist/exports/config-validation.js +0 -252
  66. package/dist/exports/config-validation.js.map +0 -1
  67. package/dist/exports/emission.d.ts +0 -5
  68. package/dist/exports/emission.d.ts.map +0 -1
  69. package/dist/exports/emission.js +0 -310
  70. package/dist/exports/emission.js.map +0 -1
  71. package/dist/exports/errors.d.ts +0 -3
  72. package/dist/exports/errors.d.ts.map +0 -1
  73. package/dist/exports/errors.js +0 -43
  74. package/dist/exports/errors.js.map +0 -1
  75. package/dist/exports/schema-view.d.ts +0 -2
  76. package/dist/exports/schema-view.d.ts.map +0 -1
  77. package/dist/exports/schema-view.js +0 -1
  78. package/dist/exports/schema-view.js.map +0 -1
  79. package/dist/exports/stack.d.ts +0 -2
  80. package/dist/exports/stack.d.ts.map +0 -1
  81. package/dist/exports/stack.js +0 -7
  82. package/dist/exports/stack.js.map +0 -1
  83. package/dist/exports/types.d.ts +0 -3
  84. package/dist/exports/types.d.ts.map +0 -1
  85. package/dist/exports/types.js +0 -7
  86. package/dist/exports/types.js.map +0 -1
  87. package/dist/migrations.d.ts +0 -190
  88. package/dist/migrations.d.ts.map +0 -1
  89. package/dist/schema-view.d.ts.map +0 -1
  90. package/dist/stack.d.ts +0 -25
  91. package/dist/stack.d.ts.map +0 -1
  92. package/dist/types.d.ts +0 -411
  93. package/dist/types.d.ts.map +0 -1
  94. package/src/config-types.ts +0 -157
  95. package/src/config-validation.ts +0 -270
  96. package/src/exports/config-types.ts +0 -5
  97. package/src/exports/config-validation.ts +0 -1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2026] [Prisma Data, Inc]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,98 +1,56 @@
1
1
  # @prisma-next/core-control-plane
2
2
 
3
- Control plane domain actions, config types, validation, and error factories for Prisma Next.
3
+ Control-plane migration and emission primitives for Prisma Next.
4
4
 
5
5
  ## Overview
6
6
 
7
- This package provides the core domain logic for control plane operations (contract emission, database verification) without any file I/O or CLI awareness. It's part of the core layer and can be used programmatically or by the CLI layer.
7
+ This package provides control-plane building blocks consumed by CLI/tooling and target-family packages:
8
8
 
9
- ## Responsibilities
10
-
11
- - **Config Types**: Type definitions for Prisma Next configuration (`PrismaNextConfig`, `ControlFamilyDescriptor`, `ControlTargetDescriptor`, `ControlAdapterDescriptor`, `ControlDriverDescriptor`, `ControlExtensionDescriptor`)
12
- - **Config Validation**: Pure validation logic for config structure (no file I/O)
13
- - **Config Normalization**: `defineConfig()` function for normalizing config with defaults
14
- - **Domain Actions**:
15
- - `verifyDatabase()`: Verifies database contract markers (accepts config object and ContractIR)
9
+ - migration/result interfaces and control-plane component types
10
+ - stack composition helper (`createControlPlaneStack`)
11
+ - schema-view interfaces
12
+ - contract emission/hash helpers
13
+ - structured error utilities used by CLI output mapping
16
14
 
17
- Note: Contract emission is implemented on the SQL family instance (e.g., `familyInstance.emitContract()`), not as a core domain action.
18
- - **Error Factories**: Domain error factories (`CliStructuredError`, config errors, runtime errors)
19
- - **Pack Manifest Types**: Type definitions for extension pack manifests
20
- - **Migration SPI**: Generic migration planner/runner interfaces (`MigrationPlanner<TFamilyId, TTargetId>`, `MigrationRunner<TFamilyId, TTargetId>`, `TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>`) that thread family/target IDs for compile-time component compatibility enforcement
21
- - `MigrationRunnerFailure` includes optional `meta` for structured debugging context (e.g., schema issues, SQL state)
15
+ ## Responsibilities
22
16
 
23
- ## Dependencies
17
+ - **Control stack and component contracts**: stack composition and migration-facing descriptor/instance types
18
+ - **Migration SPI**: planner/runner/capability interfaces that thread family/target IDs through control flows
19
+ - **Emission helpers**: canonicalization/hash utilities and emit result shaping
20
+ - **Structured errors**: CLI/runtime envelope-compatible error factories
24
21
 
25
- - **Depends on**:
26
- - `@prisma-next/contract` - ContractIR types
27
- - `@prisma-next/emitter` - TargetFamilyHook, emit function
28
- - `@prisma-next/operations` - OperationRegistry
29
- - `arktype` - Validation
22
+ ## Usage
30
23
 
31
- - **Depended on by**:
32
- - `@prisma-next/cli` - CLI layer uses domain actions
24
+ Config authoring types and validation now live in `@prisma-next/config`:
33
25
 
34
- ## Architecture
26
+ - `@prisma-next/config/config-types`
27
+ - `@prisma-next/config/config-validation`
35
28
 
36
- ```mermaid
37
- flowchart TD
38
- subgraph "Core Layer"
39
- CCP[@prisma-next/core-control-plane]
40
- end
29
+ ### ControlPlaneStack
41
30
 
42
- subgraph "Tooling Layer"
43
- CLI[@prisma-next/cli]
44
- end
31
+ The `ControlPlaneStack` bundles component descriptors for control plane operations (creating family instances, running CLI commands, connecting to databases):
45
32
 
46
- CLI -->|uses| CCP
47
- ```
33
+ ```ts
34
+ import { createControlPlaneStack } from '@prisma-next/core-control-plane/stack';
35
+ import type { ControlPlaneStack } from '@prisma-next/core-control-plane/types';
48
36
 
49
- ## Usage
50
-
51
- ### Config Types and Validation
52
-
53
- ```typescript
54
- import { defineConfig, validateConfig, type PrismaNextConfig } from '@prisma-next/core-control-plane/config-types';
55
- import { validateConfig } from '@prisma-next/core-control-plane/config-validation';
56
-
57
- // Define and normalize config
58
- const config = defineConfig({
59
- family: sqlFamilyDescriptor,
60
- target: postgresTargetDescriptor,
61
- adapter: postgresAdapterDescriptor,
62
- contract: {
63
- source: contractBuilder,
64
- output: 'src/prisma/contract.json',
65
- },
37
+ // Create a stack with sensible defaults
38
+ const stack = createControlPlaneStack({
39
+ target: postgresTarget,
40
+ adapter: postgresAdapter,
41
+ driver: postgresDriver, // optional, defaults to undefined
42
+ extensionPacks: [pgvector], // optional, defaults to []
66
43
  });
67
44
 
68
- // Validate config structure (pure validation, no file I/O)
69
- validateConfig(config);
70
- ```
71
-
72
- ### Verify Database
45
+ // Use stack for family instance creation
46
+ const familyInstance = config.family.create(stack);
73
47
 
74
- ```typescript
75
- import { verifyDatabase } from '@prisma-next/core-control-plane/verify-database';
76
-
77
- // Verify database - accepts config object and ContractIR (no file loading)
78
- const result = await verifyDatabase({
79
- config: loadedConfig,
80
- contractIR: parsedContract,
81
- dbUrl: connectionString,
82
- contractPath: 'src/prisma/contract.json',
83
- configPath: 'prisma-next.config.ts',
84
- });
85
-
86
- if (result.ok) {
87
- console.log('Database matches contract');
88
- } else {
89
- console.error(`Verification failed: ${result.summary}`);
90
- }
48
+ // Stack is also used internally by ControlClient and CLI commands
91
49
  ```
92
50
 
93
51
  ### Error Factories
94
52
 
95
- ```typescript
53
+ ```ts
96
54
  import {
97
55
  errorConfigFileNotFound,
98
56
  errorMarkerMissing,
@@ -104,30 +62,6 @@ throw errorConfigFileNotFound('prisma-next.config.ts', {
104
62
  });
105
63
  ```
106
64
 
107
- ## Migration SPI Design
108
-
109
- The migration planner/runner interfaces are generic over `TFamilyId` and `TTargetId` to enable compile-time enforcement of component compatibility:
110
-
111
- - **`MigrationPlanner<TFamilyId, TTargetId>`**: Generic planner interface that accepts `TargetBoundComponentDescriptor<TFamilyId, TTargetId>[]`
112
- - **`MigrationRunner<TFamilyId, TTargetId>`**: Generic runner interface that accepts `TargetBoundComponentDescriptor<TFamilyId, TTargetId>[]`
113
- - **`TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>`**: Generic capability interface for targets that support migrations
114
-
115
- The CLI performs runtime validation at the composition boundary using `assertFrameworkComponentsCompatible()` before calling typed planner/runner instances. This validates that all components have matching `familyId` and `targetId`, then returns a typed `TargetBoundComponentDescriptor` array that satisfies the planner/runner interface requirements.
116
-
117
- ```typescript
118
- // CLI composition boundary - runtime assertion + type narrowing
119
- const rawComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];
120
- const frameworkComponents = assertFrameworkComponentsCompatible(
121
- config.family.familyId,
122
- config.target.targetId,
123
- rawComponents,
124
- );
125
-
126
- // Now frameworkComponents is typed as TargetBoundComponentDescriptor<TFamilyId, TTargetId>[]
127
- const planner = target.migrations.createPlanner(sqlFamilyInstance);
128
- planner.plan({ contract, schema, policy, frameworkComponents });
129
- ```
130
-
131
65
  ## Package Location
132
66
 
133
67
  This package is part of the **framework domain**, **core layer**, **migration plane**:
@@ -140,5 +74,3 @@ This package is part of the **framework domain**, **core layer**, **migration pl
140
74
 
141
75
  - [Package Layering](../../../../docs/architecture docs/Package-Layering.md)
142
76
  - [ADR 140 - Package Layering & Target-Family Namespacing](../../../../docs/architecture docs/adrs/ADR 140 - Package Layering & Target-Family Namespacing.md)
143
-
144
-
@@ -0,0 +1,9 @@
1
+ //#region src/constants.d.ts
2
+ /**
3
+ * Sentinel value representing the absence of a contract (empty/new project).
4
+ * This is a human-readable marker, not a real SHA-256 hash.
5
+ */
6
+ declare const EMPTY_CONTRACT_HASH: "sha256:empty";
7
+ //#endregion
8
+ export { EMPTY_CONTRACT_HASH };
9
+ //# sourceMappingURL=constants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;AAIA;;;cAAa"}
@@ -0,0 +1,10 @@
1
+ //#region src/constants.ts
2
+ /**
3
+ * Sentinel value representing the absence of a contract (empty/new project).
4
+ * This is a human-readable marker, not a real SHA-256 hash.
5
+ */
6
+ const EMPTY_CONTRACT_HASH = "sha256:empty";
7
+
8
+ //#endregion
9
+ export { EMPTY_CONTRACT_HASH };
10
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Sentinel value representing the absence of a contract (empty/new project).\n * This is a human-readable marker, not a real SHA-256 hash.\n */\nexport const EMPTY_CONTRACT_HASH = 'sha256:empty' as const;\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB"}
@@ -0,0 +1,58 @@
1
+ import { TargetFamilyHook, TypeRenderEntry, TypesImportSpec } from "@prisma-next/contract/types";
2
+ import { ContractIR } from "@prisma-next/contract/ir";
3
+ import { OperationRegistry } from "@prisma-next/operations";
4
+
5
+ //#region src/emission/canonicalization.d.ts
6
+ type CanonicalContractInput = {
7
+ schemaVersion: string;
8
+ targetFamily: string;
9
+ target: string;
10
+ models: Record<string, unknown>;
11
+ relations: Record<string, unknown>;
12
+ storage: Record<string, unknown>;
13
+ execution?: Record<string, unknown>;
14
+ extensionPacks: Record<string, unknown>;
15
+ capabilities: Record<string, Record<string, boolean>>;
16
+ meta: Record<string, unknown>;
17
+ storageHash?: string;
18
+ executionHash?: string;
19
+ profileHash?: string;
20
+ };
21
+ declare function canonicalizeContract(ir: CanonicalContractInput): string;
22
+ //#endregion
23
+ //#region src/emission/types.d.ts
24
+ interface EmitOptions {
25
+ readonly outputDir: string;
26
+ readonly operationRegistry?: OperationRegistry;
27
+ readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
28
+ readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
29
+ readonly extensionIds?: ReadonlyArray<string>;
30
+ /**
31
+ * Normalized parameterized type renderers, keyed by codecId.
32
+ * These are extracted from descriptors and normalized during assembly.
33
+ */
34
+ readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;
35
+ /**
36
+ * Type imports for parameterized codecs.
37
+ * These are added to contract.d.ts alongside codec and operation type imports.
38
+ */
39
+ readonly parameterizedTypeImports?: ReadonlyArray<TypesImportSpec>;
40
+ }
41
+ interface EmitResult {
42
+ readonly contractJson: string;
43
+ readonly contractDts: string;
44
+ readonly storageHash: string;
45
+ readonly executionHash?: string;
46
+ readonly profileHash: string;
47
+ }
48
+ //#endregion
49
+ //#region src/emission/emit.d.ts
50
+ declare function emit(ir: ContractIR, options: EmitOptions, targetFamily: TargetFamilyHook): Promise<EmitResult>;
51
+ //#endregion
52
+ //#region src/emission/hashing.d.ts
53
+ declare function computeStorageHash(contract: CanonicalContractInput): string;
54
+ declare function computeProfileHash(contract: CanonicalContractInput): string;
55
+ declare function computeExecutionHash(contract: CanonicalContractInput): string;
56
+ //#endregion
57
+ export { type EmitOptions, type EmitResult, canonicalizeContract, computeExecutionHash, computeProfileHash, computeStorageHash, emit };
58
+ //# sourceMappingURL=emission.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emission.d.mts","names":[],"sources":["../src/emission/canonicalization.ts","../src/emission/types.ts","../src/emission/emit.ts","../src/emission/hashing.ts"],"sourcesContent":[],"mappings":";;;;;KAoBY,sBAAA;;;;UAIF;EAJE,SAAA,EAKC,MALD,CAAA,MAAA,EAAsB,OAAA,CAAA;EAIxB,OAAA,EAEC,MAFD,CAAA,MAAA,EAAA,OAAA,CAAA;EACG,SAAA,CAAA,EAEC,MAFD,CAAA,MAAA,EAAA,OAAA,CAAA;EACF,cAAA,EAEO,MAFP,CAAA,MAAA,EAAA,OAAA,CAAA;EACG,YAAA,EAEE,MAFF,CAAA,MAAA,EAEiB,MAFjB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EACI,IAAA,EAEV,MAFU,CAAA,MAAA,EAAA,OAAA,CAAA;EACa,WAAA,CAAA,EAAA,MAAA;EAAf,aAAA,CAAA,EAAA,MAAA;EACR,WAAA,CAAA,EAAA,MAAA;CAAM;AAkPE,iBAAA,oBAAA,CAAyB,EAAA,EAAA,sBAAsB,CAAA,EAAA,MAAA;;;UC7Q9C,WAAA;;+BAEc;EDenB,SAAA,gBAAsB,CAAA,ECdJ,aDcI,CCdU,eDcV,CAAA;EAIxB,SAAA,oBAAA,CAAA,ECjBwB,aDiBxB,CCjBsC,eDiBtC,CAAA;EACG,SAAA,YAAA,CAAA,ECjBa,aDiBb,CAAA,MAAA,CAAA;EACF;;;;EAGK,SAAA,sBAAA,CAAA,EChBoB,GDgBpB,CAAA,MAAA,EChBgC,eDgBhC,CAAA;EACR;;AAkPR;;sCC9PsC,cAAc;;AAfnC,UAkBA,UAAA,CAlBW;EAEG,SAAA,YAAA,EAAA,MAAA;EACa,SAAA,WAAA,EAAA,MAAA;EAAd,SAAA,WAAA,EAAA,MAAA;EACkB,SAAA,aAAA,CAAA,EAAA,MAAA;EAAd,SAAA,WAAA,EAAA,MAAA;;;;iBCmEZ,IAAA,KAChB,qBACK,2BACK,mBACb,QAAQ;;;iBCnEK,kBAAA,WAA6B;iBAgB7B,kBAAA,WAA6B;iBAgB7B,oBAAA,WAA+B"}