@prisma-next/framework-components 0.5.0-dev.5 → 0.5.0-dev.51
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/README.md +61 -0
- package/dist/authoring.d.mts +1 -1
- package/dist/authoring.mjs +1 -1
- package/dist/authoring.mjs.map +1 -1
- package/dist/codec-types-CB0jWeHU.d.mts +207 -0
- package/dist/codec-types-CB0jWeHU.d.mts.map +1 -0
- package/dist/codec.d.mts +2 -2
- package/dist/codec.mjs +38 -2
- package/dist/codec.mjs.map +1 -1
- package/dist/components.d.mts +1 -1
- package/dist/components.mjs +1 -1
- package/dist/control.d.mts +109 -70
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +11 -5
- package/dist/control.mjs.map +1 -1
- package/dist/emission-types-D6t3_a0x.d.mts +39 -0
- package/dist/emission-types-D6t3_a0x.d.mts.map +1 -0
- package/dist/emission.d.mts +2 -2
- package/dist/execution.d.mts +5 -5
- package/dist/execution.d.mts.map +1 -1
- package/dist/execution.mjs +3 -3
- package/dist/execution.mjs.map +1 -1
- package/dist/{framework-authoring-D1-JZ37B.d.mts → framework-authoring-BdrFDx4x.d.mts} +2 -2
- package/dist/framework-authoring-BdrFDx4x.d.mts.map +1 -0
- package/dist/{framework-components-EJXe-pum.d.mts → framework-components-AHI6V96G.d.mts} +6 -6
- package/dist/framework-components-AHI6V96G.d.mts.map +1 -0
- package/dist/{framework-components-C8ZhSwXe.mjs → framework-components-BsWST1Rn.mjs} +2 -2
- package/dist/framework-components-BsWST1Rn.mjs.map +1 -0
- package/dist/psl-ast-9X5rwo98.d.mts +159 -0
- package/dist/psl-ast-9X5rwo98.d.mts.map +1 -0
- package/dist/psl-ast.d.mts +2 -0
- package/dist/psl-ast.mjs +1 -0
- package/dist/runtime.d.mts +346 -19
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +256 -4
- package/dist/runtime.mjs.map +1 -1
- package/dist/{types-import-spec-C4sc7wbb.d.mts → types-import-spec-D-O6GotH.d.mts} +2 -2
- package/dist/types-import-spec-D-O6GotH.d.mts.map +1 -0
- package/package.json +6 -4
- package/src/control/control-capabilities.ts +71 -0
- package/src/{control-descriptors.ts → control/control-descriptors.ts} +7 -7
- package/src/{control-instances.ts → control/control-instances.ts} +6 -6
- package/src/{control-migration-types.ts → control/control-migration-types.ts} +57 -60
- package/src/control/control-operation-preview.ts +23 -0
- package/src/{control-stack.ts → control/control-stack.ts} +13 -13
- package/src/control/emission-types.ts +49 -0
- package/src/control/psl-ast.ts +193 -0
- package/src/{execution-descriptors.ts → execution/execution-descriptors.ts} +7 -7
- package/src/{execution-instances.ts → execution/execution-instances.ts} +1 -1
- package/src/{execution-requirements.ts → execution/execution-requirements.ts} +1 -1
- package/src/execution/query-plan.ts +53 -0
- package/src/execution/race-against-abort.ts +85 -0
- package/src/execution/run-with-middleware.ts +132 -0
- package/src/execution/runtime-core.ts +133 -0
- package/src/execution/runtime-error.ts +83 -0
- package/src/execution/runtime-middleware.ts +182 -0
- package/src/exports/authoring.ts +2 -2
- package/src/exports/codec.ts +14 -2
- package/src/exports/components.ts +2 -2
- package/src/exports/control.ts +26 -13
- package/src/exports/emission.ts +2 -2
- package/src/exports/execution.ts +5 -5
- package/src/exports/psl-ast.ts +1 -0
- package/src/exports/runtime.ts +17 -5
- package/src/shared/codec-types.ts +261 -0
- package/dist/codec-types-B58nCJiu.d.mts +0 -40
- package/dist/codec-types-B58nCJiu.d.mts.map +0 -1
- package/dist/emission-types-BPAALJbF.d.mts +0 -24
- package/dist/emission-types-BPAALJbF.d.mts.map +0 -1
- package/dist/framework-authoring-D1-JZ37B.d.mts.map +0 -1
- package/dist/framework-components-C8ZhSwXe.mjs.map +0 -1
- package/dist/framework-components-EJXe-pum.d.mts.map +0 -1
- package/dist/types-import-spec-C4sc7wbb.d.mts.map +0 -1
- package/src/codec-types.ts +0 -46
- package/src/control-capabilities.ts +0 -34
- package/src/emission-types.ts +0 -28
- package/src/runtime-error.ts +0 -39
- package/src/runtime-middleware.ts +0 -83
- /package/src/{control-result-types.ts → control/control-result-types.ts} +0 -0
- /package/src/{control-schema-view.ts → control/control-schema-view.ts} +0 -0
- /package/src/{async-iterable-result.ts → execution/async-iterable-result.ts} +0 -0
- /package/src/{execution-stack.ts → execution/execution-stack.ts} +0 -0
- /package/src/{framework-authoring.ts → shared/framework-authoring.ts} +0 -0
- /package/src/{framework-components.ts → shared/framework-components.ts} +0 -0
- /package/src/{mutation-default-types.ts → shared/mutation-default-types.ts} +0 -0
- /package/src/{types-import-spec.ts → shared/types-import-spec.ts} +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { PlanMeta } from '@prisma-next/contract/types';
|
|
2
|
-
import type { AsyncIterableResult } from './async-iterable-result';
|
|
3
|
-
import { runtimeError } from './runtime-error';
|
|
4
|
-
|
|
5
|
-
export interface RuntimeLog {
|
|
6
|
-
info(event: unknown): void;
|
|
7
|
-
warn(event: unknown): void;
|
|
8
|
-
error(event: unknown): void;
|
|
9
|
-
debug?(event: unknown): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface RuntimeMiddlewareContext {
|
|
13
|
-
readonly contract: unknown;
|
|
14
|
-
readonly mode: 'strict' | 'permissive';
|
|
15
|
-
readonly now: () => number;
|
|
16
|
-
readonly log: RuntimeLog;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface AfterExecuteResult {
|
|
20
|
-
readonly rowCount: number;
|
|
21
|
-
readonly latencyMs: number;
|
|
22
|
-
readonly completed: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface RuntimeMiddleware {
|
|
26
|
-
readonly name: string;
|
|
27
|
-
readonly familyId?: string;
|
|
28
|
-
readonly targetId?: string;
|
|
29
|
-
beforeExecute?(plan: { readonly meta: PlanMeta }, ctx: RuntimeMiddlewareContext): Promise<void>;
|
|
30
|
-
onRow?(
|
|
31
|
-
row: Record<string, unknown>,
|
|
32
|
-
plan: { readonly meta: PlanMeta },
|
|
33
|
-
ctx: RuntimeMiddlewareContext,
|
|
34
|
-
): Promise<void>;
|
|
35
|
-
afterExecute?(
|
|
36
|
-
plan: { readonly meta: PlanMeta },
|
|
37
|
-
result: AfterExecuteResult,
|
|
38
|
-
ctx: RuntimeMiddlewareContext,
|
|
39
|
-
): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Cross-family SPI for any runtime that can execute plans and be shut down.
|
|
44
|
-
* Each family runtime (SQL, Mongo) satisfies this interface — SQL nominally,
|
|
45
|
-
* Mongo structurally (due to its phantom Row parameter using a unique symbol).
|
|
46
|
-
*
|
|
47
|
-
* The `_row` intersection on `execute` connects the `Row` type parameter to the
|
|
48
|
-
* plan, mirroring how `ExecutionPlan<Row>` carries a phantom `_row?: Row`.
|
|
49
|
-
*/
|
|
50
|
-
export interface RuntimeExecutor<TPlan extends { readonly meta: PlanMeta }> {
|
|
51
|
-
execute<Row>(plan: TPlan & { readonly _row?: Row }): AsyncIterableResult<Row>;
|
|
52
|
-
close(): Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function checkMiddlewareCompatibility(
|
|
56
|
-
middleware: RuntimeMiddleware,
|
|
57
|
-
runtimeFamilyId: string,
|
|
58
|
-
runtimeTargetId: string,
|
|
59
|
-
): void {
|
|
60
|
-
if (middleware.targetId !== undefined && middleware.familyId === undefined) {
|
|
61
|
-
throw runtimeError(
|
|
62
|
-
'RUNTIME.MIDDLEWARE_INCOMPATIBLE',
|
|
63
|
-
`Middleware '${middleware.name}' specifies targetId '${middleware.targetId}' without familyId`,
|
|
64
|
-
{ middleware: middleware.name, targetId: middleware.targetId },
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (middleware.familyId !== undefined && middleware.familyId !== runtimeFamilyId) {
|
|
69
|
-
throw runtimeError(
|
|
70
|
-
'RUNTIME.MIDDLEWARE_FAMILY_MISMATCH',
|
|
71
|
-
`Middleware '${middleware.name}' requires family '${middleware.familyId}' but the runtime is configured for family '${runtimeFamilyId}'`,
|
|
72
|
-
{ middleware: middleware.name, middlewareFamilyId: middleware.familyId, runtimeFamilyId },
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (middleware.targetId !== undefined && middleware.targetId !== runtimeTargetId) {
|
|
77
|
-
throw runtimeError(
|
|
78
|
-
'RUNTIME.MIDDLEWARE_TARGET_MISMATCH',
|
|
79
|
-
`Middleware '${middleware.name}' requires target '${middleware.targetId}' but the runtime is configured for target '${runtimeTargetId}'`,
|
|
80
|
-
{ middleware: middleware.name, middlewareTargetId: middleware.targetId, runtimeTargetId },
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|