@prisma-next/runtime-executor 0.3.0-pr.99.6 → 0.3.0
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.
- package/LICENSE +201 -0
- package/README.md +2 -3
- package/dist/index.d.mts +118 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +309 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +19 -11
- package/src/exports/index.ts +8 -11
- package/src/marker.ts +1 -4
- package/src/middleware/types.ts +29 -0
- package/src/runtime-core.ts +145 -77
- package/dist/async-iterable-result.d.ts +0 -17
- package/dist/async-iterable-result.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -8
- package/dist/errors.d.ts.map +0 -1
- package/dist/exports/index.d.ts +0 -17
- package/dist/exports/index.d.ts.map +0 -1
- package/dist/fingerprint.d.ts +0 -2
- package/dist/fingerprint.d.ts.map +0 -1
- package/dist/guardrails/raw.d.ts +0 -28
- package/dist/guardrails/raw.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -746
- package/dist/index.js.map +0 -1
- package/dist/marker.d.ts +0 -13
- package/dist/marker.d.ts.map +0 -1
- package/dist/plugins/budgets.d.ts +0 -16
- package/dist/plugins/budgets.d.ts.map +0 -1
- package/dist/plugins/lints.d.ts +0 -11
- package/dist/plugins/lints.d.ts.map +0 -1
- package/dist/plugins/types.d.ts +0 -27
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/runtime-core.d.ts +0 -37
- package/dist/runtime-core.d.ts.map +0 -1
- package/dist/runtime-spi.d.ts +0 -14
- package/dist/runtime-spi.d.ts.map +0 -1
- package/src/async-iterable-result.ts +0 -61
- package/src/errors.ts +0 -39
- package/src/plugins/budgets.ts +0 -328
- package/src/plugins/lints.ts +0 -85
- package/src/plugins/types.ts +0 -42
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
|
@@ -18,7 +18,7 @@ Provide a target-agnostic execution engine that family runtimes (e.g., `@prisma-
|
|
|
18
18
|
|
|
19
19
|
## Responsibilities
|
|
20
20
|
|
|
21
|
-
- **Plan Validation**: Verify plans against contracts (
|
|
21
|
+
- **Plan Validation**: Verify plans against contracts (storageHash/profileHash checks)
|
|
22
22
|
- **Marker Verification**: Read and parse contract markers from databases
|
|
23
23
|
- **Plugin Orchestration**: Manage plugin lifecycle (beforeExecute, onRow, afterExecute hooks)
|
|
24
24
|
- **Telemetry Recording**: Track execution metrics (lane, target, fingerprint, outcome, duration)
|
|
@@ -64,7 +64,7 @@ const core = createRuntimeCore({
|
|
|
64
64
|
driver,
|
|
65
65
|
verify: { mode: 'onFirstUse', requireMarker: false },
|
|
66
66
|
operationRegistry,
|
|
67
|
-
plugins: [
|
|
67
|
+
plugins: [],
|
|
68
68
|
});
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -73,7 +73,6 @@ const core = createRuntimeCore({
|
|
|
73
73
|
- `createRuntimeCore` - Create a target-neutral runtime instance
|
|
74
74
|
- `RuntimeFamilyAdapter` - Interface for family runtimes
|
|
75
75
|
- `MarkerReader` - Interface for marker reading
|
|
76
|
-
- `budgets`, `lints` - Target-neutral plugins
|
|
77
76
|
- `runtimeError` - Error envelope utilities
|
|
78
77
|
- `computeSqlFingerprint` - SQL fingerprint computation
|
|
79
78
|
- `parseContractMarkerRow` - Marker parsing utilities
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { AfterExecuteResult, AsyncIterableResult, AsyncIterableResult as AsyncIterableResult$1, RuntimeErrorEnvelope, RuntimeExecutor, RuntimeLog, RuntimeMiddleware, RuntimeMiddlewareContext, runtimeError } from "@prisma-next/framework-components/runtime";
|
|
2
|
+
import { ContractMarkerRecord, ExecutionPlan } from "@prisma-next/contract/types";
|
|
3
|
+
|
|
4
|
+
//#region src/fingerprint.d.ts
|
|
5
|
+
declare function computeSqlFingerprint(sql: string): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/guardrails/raw.d.ts
|
|
8
|
+
type LintSeverity = 'error' | 'warn';
|
|
9
|
+
type BudgetSeverity = 'error' | 'warn';
|
|
10
|
+
interface LintFinding {
|
|
11
|
+
readonly code: `LINT.${string}`;
|
|
12
|
+
readonly severity: LintSeverity;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
readonly details?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
interface BudgetFinding {
|
|
17
|
+
readonly code: `BUDGET.${string}`;
|
|
18
|
+
readonly severity: BudgetSeverity;
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly details?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
interface RawGuardrailConfig {
|
|
23
|
+
readonly budgets?: {
|
|
24
|
+
readonly unboundedSelectSeverity?: BudgetSeverity;
|
|
25
|
+
readonly estimatedRows?: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface RawGuardrailResult {
|
|
29
|
+
readonly lints: LintFinding[];
|
|
30
|
+
readonly budgets: BudgetFinding[];
|
|
31
|
+
readonly statement: 'select' | 'mutation' | 'other';
|
|
32
|
+
}
|
|
33
|
+
declare function evaluateRawGuardrails(plan: ExecutionPlan, config?: RawGuardrailConfig): RawGuardrailResult;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/marker.d.ts
|
|
36
|
+
declare function parseContractMarkerRow(row: unknown): ContractMarkerRecord;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/middleware/types.d.ts
|
|
39
|
+
type Severity = 'error' | 'warn' | 'info';
|
|
40
|
+
interface MiddlewareContext<TContract = unknown> extends RuntimeMiddlewareContext {
|
|
41
|
+
readonly contract: TContract;
|
|
42
|
+
}
|
|
43
|
+
interface Middleware<TContract = unknown> extends RuntimeMiddleware {
|
|
44
|
+
beforeExecute?(plan: ExecutionPlan, ctx: MiddlewareContext<TContract>): Promise<void>;
|
|
45
|
+
onRow?(row: Record<string, unknown>, plan: ExecutionPlan, ctx: MiddlewareContext<TContract>): Promise<void>;
|
|
46
|
+
afterExecute?(plan: ExecutionPlan, result: AfterExecuteResult, ctx: MiddlewareContext<TContract>): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/runtime-spi.d.ts
|
|
50
|
+
interface MarkerStatement {
|
|
51
|
+
readonly sql: string;
|
|
52
|
+
readonly params: readonly unknown[];
|
|
53
|
+
}
|
|
54
|
+
interface MarkerReader {
|
|
55
|
+
readMarkerStatement(): MarkerStatement;
|
|
56
|
+
}
|
|
57
|
+
interface RuntimeFamilyAdapter<TContract = unknown> {
|
|
58
|
+
readonly contract: TContract;
|
|
59
|
+
readonly markerReader: MarkerReader;
|
|
60
|
+
validatePlan(plan: ExecutionPlan, contract: TContract): void;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/runtime-core.d.ts
|
|
64
|
+
interface RuntimeVerifyOptions {
|
|
65
|
+
readonly mode: 'onFirstUse' | 'startup' | 'always';
|
|
66
|
+
readonly requireMarker: boolean;
|
|
67
|
+
}
|
|
68
|
+
type TelemetryOutcome = 'success' | 'runtime-error';
|
|
69
|
+
interface RuntimeTelemetryEvent {
|
|
70
|
+
readonly lane: string;
|
|
71
|
+
readonly target: string;
|
|
72
|
+
readonly fingerprint: string;
|
|
73
|
+
readonly outcome: TelemetryOutcome;
|
|
74
|
+
readonly durationMs?: number;
|
|
75
|
+
}
|
|
76
|
+
interface RuntimeCoreOptions<TContract = unknown, TDriver = unknown> {
|
|
77
|
+
readonly familyAdapter: RuntimeFamilyAdapter<TContract>;
|
|
78
|
+
readonly driver: TDriver;
|
|
79
|
+
readonly verify: RuntimeVerifyOptions;
|
|
80
|
+
readonly middleware?: readonly Middleware<TContract>[];
|
|
81
|
+
readonly mode?: 'strict' | 'permissive';
|
|
82
|
+
readonly log?: RuntimeLog;
|
|
83
|
+
}
|
|
84
|
+
interface RuntimeCore<TContract = unknown, TDriver = unknown> extends RuntimeQueryable, RuntimeExecutor<ExecutionPlan> {
|
|
85
|
+
readonly _typeContract?: TContract;
|
|
86
|
+
readonly _typeDriver?: TDriver;
|
|
87
|
+
connection(): Promise<RuntimeConnection>;
|
|
88
|
+
telemetry(): RuntimeTelemetryEvent | null;
|
|
89
|
+
close(): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
interface RuntimeConnection extends RuntimeQueryable {
|
|
92
|
+
transaction(): Promise<RuntimeTransaction>;
|
|
93
|
+
release(): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
interface RuntimeTransaction extends RuntimeQueryable {
|
|
96
|
+
commit(): Promise<void>;
|
|
97
|
+
rollback(): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Shared query execution trait for anything that can run an ExecutionPlan:
|
|
101
|
+
* RuntimeCore, RuntimeConnection, and RuntimeTransaction. This is a
|
|
102
|
+
* SQL-domain internal mixin — it is NOT the cross-family SPI.
|
|
103
|
+
*
|
|
104
|
+
* For the cross-family SPI, see RuntimeExecutor in framework-components.
|
|
105
|
+
* RuntimeCore nominally extends both this interface and RuntimeExecutor.
|
|
106
|
+
*
|
|
107
|
+
* The execute signature uses the same `_row` phantom intersection as
|
|
108
|
+
* RuntimeExecutor so that RuntimeCore can extend both without conflicts.
|
|
109
|
+
*/
|
|
110
|
+
interface RuntimeQueryable {
|
|
111
|
+
execute<Row>(plan: ExecutionPlan & {
|
|
112
|
+
readonly _row?: Row;
|
|
113
|
+
}): AsyncIterableResult$1<Row>;
|
|
114
|
+
}
|
|
115
|
+
declare function createRuntimeCore<TContract = unknown, TDriver = unknown>(options: RuntimeCoreOptions<TContract, TDriver>): RuntimeCore<TContract, TDriver>;
|
|
116
|
+
//#endregion
|
|
117
|
+
export { type AfterExecuteResult, AsyncIterableResult, type BudgetFinding, type LintFinding, type RuntimeLog as Log, type MarkerReader, type MarkerStatement, type Middleware, type MiddlewareContext, type RawGuardrailResult, type RuntimeConnection, type RuntimeCore, type RuntimeCoreOptions, type RuntimeErrorEnvelope, type RuntimeFamilyAdapter, type RuntimeQueryable, type RuntimeTelemetryEvent, type RuntimeTransaction, type RuntimeVerifyOptions, type Severity, type TelemetryOutcome, computeSqlFingerprint, createRuntimeCore, evaluateRawGuardrails, parseContractMarkerRow, runtimeError };
|
|
118
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/fingerprint.ts","../src/guardrails/raw.ts","../src/marker.ts","../src/middleware/types.ts","../src/runtime-spi.ts","../src/runtime-core.ts"],"sourcesContent":[],"mappings":"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"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { AsyncIterableResult, AsyncIterableResult as AsyncIterableResult$1, runtimeError, runtimeError as runtimeError$1 } from "@prisma-next/framework-components/runtime";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { type } from "arktype";
|
|
4
|
+
|
|
5
|
+
//#region src/fingerprint.ts
|
|
6
|
+
const STRING_LITERAL_REGEX = /'(?:''|[^'])*'/g;
|
|
7
|
+
const NUMERIC_LITERAL_REGEX = /\b\d+(?:\.\d+)?\b/g;
|
|
8
|
+
const WHITESPACE_REGEX = /\s+/g;
|
|
9
|
+
function computeSqlFingerprint(sql) {
|
|
10
|
+
const normalized = sql.replace(STRING_LITERAL_REGEX, "?").replace(NUMERIC_LITERAL_REGEX, "?").replace(WHITESPACE_REGEX, " ").trim().toLowerCase();
|
|
11
|
+
return `sha256:${createHash("sha256").update(normalized).digest("hex")}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/guardrails/raw.ts
|
|
16
|
+
const SELECT_STAR_REGEX = /select\s+\*/i;
|
|
17
|
+
const LIMIT_REGEX = /\blimit\b/i;
|
|
18
|
+
const MUTATION_PREFIX_REGEX = /^(insert|update|delete|create|alter|drop|truncate)\b/i;
|
|
19
|
+
const READ_ONLY_INTENTS = new Set([
|
|
20
|
+
"read",
|
|
21
|
+
"report",
|
|
22
|
+
"readonly"
|
|
23
|
+
]);
|
|
24
|
+
function evaluateRawGuardrails(plan, config) {
|
|
25
|
+
const lints = [];
|
|
26
|
+
const budgets = [];
|
|
27
|
+
const normalized = normalizeWhitespace(plan.sql);
|
|
28
|
+
const statementType = classifyStatement(normalized);
|
|
29
|
+
if (statementType === "select") {
|
|
30
|
+
if (SELECT_STAR_REGEX.test(normalized)) lints.push(createLint("LINT.SELECT_STAR", "error", "Raw SQL plan selects all columns via *", { sql: snippet(plan.sql) }));
|
|
31
|
+
if (!LIMIT_REGEX.test(normalized)) {
|
|
32
|
+
const severity = config?.budgets?.unboundedSelectSeverity ?? "error";
|
|
33
|
+
lints.push(createLint("LINT.NO_LIMIT", "warn", "Raw SQL plan omits LIMIT clause", { sql: snippet(plan.sql) }));
|
|
34
|
+
budgets.push(createBudget("BUDGET.ROWS_EXCEEDED", severity, "Raw SQL plan is unbounded and may exceed row budget", {
|
|
35
|
+
sql: snippet(plan.sql),
|
|
36
|
+
...config?.budgets?.estimatedRows !== void 0 ? { estimatedRows: config.budgets.estimatedRows } : {}
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (isMutationStatement(statementType) && isReadOnlyIntent(plan.meta)) lints.push(createLint("LINT.READ_ONLY_MUTATION", "error", "Raw SQL plan mutates data despite read-only intent", {
|
|
41
|
+
sql: snippet(plan.sql),
|
|
42
|
+
intent: plan.meta.annotations?.["intent"]
|
|
43
|
+
}));
|
|
44
|
+
const refs = plan.meta.refs;
|
|
45
|
+
if (refs) evaluateIndexCoverage(refs, lints);
|
|
46
|
+
return {
|
|
47
|
+
lints,
|
|
48
|
+
budgets,
|
|
49
|
+
statement: statementType
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function evaluateIndexCoverage(refs, lints) {
|
|
53
|
+
const predicateColumns = refs.columns ?? [];
|
|
54
|
+
if (predicateColumns.length === 0) return;
|
|
55
|
+
const indexes = refs.indexes ?? [];
|
|
56
|
+
if (indexes.length === 0) {
|
|
57
|
+
lints.push(createLint("LINT.UNINDEXED_PREDICATE", "warn", "Raw SQL plan predicates lack supporting indexes", { predicates: predicateColumns }));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!predicateColumns.every((column) => indexes.some((index) => index.table === column.table && index.columns.some((col) => col.toLowerCase() === column.column.toLowerCase())))) lints.push(createLint("LINT.UNINDEXED_PREDICATE", "warn", "Raw SQL plan predicates lack supporting indexes", { predicates: predicateColumns }));
|
|
61
|
+
}
|
|
62
|
+
function classifyStatement(sql) {
|
|
63
|
+
const trimmed = sql.trim();
|
|
64
|
+
const lower = trimmed.toLowerCase();
|
|
65
|
+
if (lower.startsWith("with")) {
|
|
66
|
+
if (lower.includes("select")) return "select";
|
|
67
|
+
}
|
|
68
|
+
if (lower.startsWith("select")) return "select";
|
|
69
|
+
if (MUTATION_PREFIX_REGEX.test(trimmed)) return "mutation";
|
|
70
|
+
return "other";
|
|
71
|
+
}
|
|
72
|
+
function isMutationStatement(statement) {
|
|
73
|
+
return statement === "mutation";
|
|
74
|
+
}
|
|
75
|
+
function isReadOnlyIntent(meta) {
|
|
76
|
+
const annotations = meta.annotations;
|
|
77
|
+
const intent = typeof annotations?.intent === "string" ? annotations.intent.toLowerCase() : void 0;
|
|
78
|
+
return intent !== void 0 && READ_ONLY_INTENTS.has(intent);
|
|
79
|
+
}
|
|
80
|
+
function normalizeWhitespace(value) {
|
|
81
|
+
return value.replace(/\s+/g, " ").trim();
|
|
82
|
+
}
|
|
83
|
+
function snippet(sql) {
|
|
84
|
+
return normalizeWhitespace(sql).slice(0, 200);
|
|
85
|
+
}
|
|
86
|
+
function createLint(code, severity, message, details) {
|
|
87
|
+
return {
|
|
88
|
+
code,
|
|
89
|
+
severity,
|
|
90
|
+
message,
|
|
91
|
+
...details ? { details } : {}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function createBudget(code, severity, message, details) {
|
|
95
|
+
return {
|
|
96
|
+
code,
|
|
97
|
+
severity,
|
|
98
|
+
message,
|
|
99
|
+
...details ? { details } : {}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/marker.ts
|
|
105
|
+
const MetaSchema = type({ "[string]": "unknown" });
|
|
106
|
+
function parseMeta(meta) {
|
|
107
|
+
if (meta === null || meta === void 0) return {};
|
|
108
|
+
let parsed;
|
|
109
|
+
if (typeof meta === "string") try {
|
|
110
|
+
parsed = JSON.parse(meta);
|
|
111
|
+
} catch {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
else parsed = meta;
|
|
115
|
+
const result = MetaSchema(parsed);
|
|
116
|
+
if (result instanceof type.errors) return {};
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
const ContractMarkerRowSchema = type({
|
|
120
|
+
core_hash: "string",
|
|
121
|
+
profile_hash: "string",
|
|
122
|
+
"contract_json?": "unknown | null",
|
|
123
|
+
"canonical_version?": "number | null",
|
|
124
|
+
"updated_at?": "Date | string",
|
|
125
|
+
"app_tag?": "string | null",
|
|
126
|
+
"meta?": "unknown | null"
|
|
127
|
+
});
|
|
128
|
+
function parseContractMarkerRow(row) {
|
|
129
|
+
const result = ContractMarkerRowSchema(row);
|
|
130
|
+
if (result instanceof type.errors) {
|
|
131
|
+
const messages = result.map((p) => p.message).join("; ");
|
|
132
|
+
throw new Error(`Invalid contract marker row: ${messages}`);
|
|
133
|
+
}
|
|
134
|
+
const validatedRow = result;
|
|
135
|
+
const updatedAt = validatedRow.updated_at ? validatedRow.updated_at instanceof Date ? validatedRow.updated_at : new Date(validatedRow.updated_at) : /* @__PURE__ */ new Date();
|
|
136
|
+
return {
|
|
137
|
+
storageHash: validatedRow.core_hash,
|
|
138
|
+
profileHash: validatedRow.profile_hash,
|
|
139
|
+
contractJson: validatedRow.contract_json ?? null,
|
|
140
|
+
canonicalVersion: validatedRow.canonical_version ?? null,
|
|
141
|
+
updatedAt,
|
|
142
|
+
appTag: validatedRow.app_tag ?? null,
|
|
143
|
+
meta: parseMeta(validatedRow.meta)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/runtime-core.ts
|
|
149
|
+
var RuntimeCoreImpl = class {
|
|
150
|
+
_typeContract;
|
|
151
|
+
_typeDriver;
|
|
152
|
+
contract;
|
|
153
|
+
familyAdapter;
|
|
154
|
+
driver;
|
|
155
|
+
middleware;
|
|
156
|
+
mode;
|
|
157
|
+
verify;
|
|
158
|
+
middlewareContext;
|
|
159
|
+
verified;
|
|
160
|
+
startupVerified;
|
|
161
|
+
_telemetry;
|
|
162
|
+
constructor(options) {
|
|
163
|
+
const { familyAdapter, driver } = options;
|
|
164
|
+
this.contract = familyAdapter.contract;
|
|
165
|
+
this.familyAdapter = familyAdapter;
|
|
166
|
+
this.driver = driver;
|
|
167
|
+
this.middleware = options.middleware ?? [];
|
|
168
|
+
this.mode = options.mode ?? "strict";
|
|
169
|
+
this.verify = options.verify;
|
|
170
|
+
this.verified = options.verify.mode === "startup" ? false : options.verify.mode === "always";
|
|
171
|
+
this.startupVerified = false;
|
|
172
|
+
this._telemetry = null;
|
|
173
|
+
this.middlewareContext = {
|
|
174
|
+
contract: this.contract,
|
|
175
|
+
mode: this.mode,
|
|
176
|
+
now: () => Date.now(),
|
|
177
|
+
log: options.log ?? {
|
|
178
|
+
info: () => {},
|
|
179
|
+
warn: () => {},
|
|
180
|
+
error: () => {}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
async verifyPlanIfNeeded(_plan) {
|
|
185
|
+
if (this.verify.mode === "always") this.verified = false;
|
|
186
|
+
if (this.verified) return;
|
|
187
|
+
const readStatement = this.familyAdapter.markerReader.readMarkerStatement();
|
|
188
|
+
const result = await this.driver.query(readStatement.sql, readStatement.params);
|
|
189
|
+
if (result.rows.length === 0) {
|
|
190
|
+
if (this.verify.requireMarker) throw runtimeError$1("CONTRACT.MARKER_MISSING", "Contract marker not found in database");
|
|
191
|
+
this.verified = true;
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const marker = parseContractMarkerRow(result.rows[0]);
|
|
195
|
+
const contract = this.contract;
|
|
196
|
+
if (marker.storageHash !== contract.storage.storageHash) throw runtimeError$1("CONTRACT.MARKER_MISMATCH", "Database storage hash does not match contract", {
|
|
197
|
+
expected: contract.storage.storageHash,
|
|
198
|
+
actual: marker.storageHash
|
|
199
|
+
});
|
|
200
|
+
const expectedProfile = contract.profileHash ?? null;
|
|
201
|
+
if (expectedProfile !== null && marker.profileHash !== expectedProfile) throw runtimeError$1("CONTRACT.MARKER_MISMATCH", "Database profile hash does not match contract", {
|
|
202
|
+
expectedProfile,
|
|
203
|
+
actualProfile: marker.profileHash
|
|
204
|
+
});
|
|
205
|
+
this.verified = true;
|
|
206
|
+
this.startupVerified = true;
|
|
207
|
+
}
|
|
208
|
+
validatePlan(plan) {
|
|
209
|
+
this.familyAdapter.validatePlan(plan, this.contract);
|
|
210
|
+
}
|
|
211
|
+
recordTelemetry(plan, outcome, durationMs) {
|
|
212
|
+
const contract = this.contract;
|
|
213
|
+
this._telemetry = Object.freeze({
|
|
214
|
+
lane: plan.meta.lane,
|
|
215
|
+
target: contract.target,
|
|
216
|
+
fingerprint: computeSqlFingerprint(plan.sql),
|
|
217
|
+
outcome,
|
|
218
|
+
...durationMs !== void 0 ? { durationMs } : {}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
execute(plan) {
|
|
222
|
+
return this.#executeWith(plan, this.driver);
|
|
223
|
+
}
|
|
224
|
+
async connection() {
|
|
225
|
+
const driverConn = await this.driver.acquireConnection();
|
|
226
|
+
const self = this;
|
|
227
|
+
return {
|
|
228
|
+
async transaction() {
|
|
229
|
+
const driverTx = await driverConn.beginTransaction();
|
|
230
|
+
return {
|
|
231
|
+
async commit() {
|
|
232
|
+
await driverTx.commit();
|
|
233
|
+
},
|
|
234
|
+
async rollback() {
|
|
235
|
+
await driverTx.rollback();
|
|
236
|
+
},
|
|
237
|
+
execute(plan) {
|
|
238
|
+
return self.#executeWith(plan, driverTx);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
execute(plan) {
|
|
243
|
+
return self.#executeWith(plan, driverConn);
|
|
244
|
+
},
|
|
245
|
+
async release() {
|
|
246
|
+
await driverConn.release();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
telemetry() {
|
|
251
|
+
return this._telemetry;
|
|
252
|
+
}
|
|
253
|
+
close() {
|
|
254
|
+
const driver = this.driver;
|
|
255
|
+
if (typeof driver.close === "function") return driver.close();
|
|
256
|
+
return Promise.resolve();
|
|
257
|
+
}
|
|
258
|
+
#executeWith(plan, queryable) {
|
|
259
|
+
this.validatePlan(plan);
|
|
260
|
+
this._telemetry = null;
|
|
261
|
+
const iterator = async function* (self) {
|
|
262
|
+
const startedAt = Date.now();
|
|
263
|
+
let rowCount = 0;
|
|
264
|
+
let completed = false;
|
|
265
|
+
if (!self.startupVerified && self.verify.mode === "startup") await self.verifyPlanIfNeeded(plan);
|
|
266
|
+
if (self.verify.mode === "onFirstUse") await self.verifyPlanIfNeeded(plan);
|
|
267
|
+
try {
|
|
268
|
+
if (self.verify.mode === "always") await self.verifyPlanIfNeeded(plan);
|
|
269
|
+
for (const mw of self.middleware) if (mw.beforeExecute) await mw.beforeExecute(plan, self.middlewareContext);
|
|
270
|
+
const encodedParams = plan.params;
|
|
271
|
+
for await (const row of queryable.execute({
|
|
272
|
+
sql: plan.sql,
|
|
273
|
+
params: encodedParams
|
|
274
|
+
})) {
|
|
275
|
+
for (const mw of self.middleware) if (mw.onRow) await mw.onRow(row, plan, self.middlewareContext);
|
|
276
|
+
rowCount++;
|
|
277
|
+
yield row;
|
|
278
|
+
}
|
|
279
|
+
completed = true;
|
|
280
|
+
self.recordTelemetry(plan, "success", Date.now() - startedAt);
|
|
281
|
+
} catch (error) {
|
|
282
|
+
if (self._telemetry === null) self.recordTelemetry(plan, "runtime-error", Date.now() - startedAt);
|
|
283
|
+
const latencyMs$1 = Date.now() - startedAt;
|
|
284
|
+
for (const mw of self.middleware) if (mw.afterExecute) try {
|
|
285
|
+
await mw.afterExecute(plan, {
|
|
286
|
+
rowCount,
|
|
287
|
+
latencyMs: latencyMs$1,
|
|
288
|
+
completed
|
|
289
|
+
}, self.middlewareContext);
|
|
290
|
+
} catch {}
|
|
291
|
+
throw error;
|
|
292
|
+
}
|
|
293
|
+
const latencyMs = Date.now() - startedAt;
|
|
294
|
+
for (const mw of self.middleware) if (mw.afterExecute) await mw.afterExecute(plan, {
|
|
295
|
+
rowCount,
|
|
296
|
+
latencyMs,
|
|
297
|
+
completed
|
|
298
|
+
}, self.middlewareContext);
|
|
299
|
+
};
|
|
300
|
+
return new AsyncIterableResult$1(iterator(this));
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
function createRuntimeCore(options) {
|
|
304
|
+
return new RuntimeCoreImpl(options);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
//#endregion
|
|
308
|
+
export { AsyncIterableResult, computeSqlFingerprint, createRuntimeCore, evaluateRawGuardrails, parseContractMarkerRow, runtimeError };
|
|
309
|
+
//# sourceMappingURL=index.mjs.map
|