@prisma-next/core-execution-plane 0.0.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.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @prisma-next/core-execution-plane
2
+
3
+ Execution/runtime plane descriptor and instance types for Prisma Next.
4
+
5
+ ## Overview
6
+
7
+ This package provides TypeScript type definitions for execution/runtime-plane descriptors and instances. These types define the structure for runtime components (families, targets, adapters, drivers, extensions) that are used during query execution.
8
+
9
+ ## Responsibilities
10
+
11
+ - **Runtime Instance Types**: Base interfaces for runtime plane instances (`RuntimeFamilyInstance`, `RuntimeTargetInstance`, `RuntimeAdapterInstance`, `RuntimeDriverInstance`, `RuntimeExtensionInstance`)
12
+ - **Runtime Descriptor Types**: Type definitions for runtime plane descriptors (`RuntimeFamilyDescriptor`, `RuntimeTargetDescriptor`, `RuntimeAdapterDescriptor`, `RuntimeDriverDescriptor`, `RuntimeExtensionDescriptor`)
13
+
14
+ ## Dependencies
15
+
16
+ - **Depends on**:
17
+ - `@prisma-next/contract` - Extension pack manifest types (`ExtensionPackManifest`)
18
+
19
+ - **Depended on by**:
20
+ - Runtime plane packages (adapters, drivers, targets) - Use descriptor and instance types
21
+ - SQL family runtime - Uses runtime family descriptor types
22
+
23
+ ## Architecture
24
+
25
+ ```mermaid
26
+ flowchart TD
27
+ subgraph "Core Layer - Runtime Plane"
28
+ CEP[@prisma-next/core-execution-plane]
29
+ end
30
+
31
+ subgraph "Runtime Plane Packages"
32
+ ADAPTER[Adapters]
33
+ DRIVER[Drivers]
34
+ TARGET[Targets]
35
+ FAMILY[SQL Family Runtime]
36
+ end
37
+
38
+ ADAPTER -->|uses| CEP
39
+ DRIVER -->|uses| CEP
40
+ TARGET -->|uses| CEP
41
+ FAMILY -->|uses| CEP
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ### Runtime Descriptors
47
+
48
+ Runtime descriptors provide factory methods to create runtime instances:
49
+
50
+ ```typescript
51
+ import type {
52
+ RuntimeAdapterDescriptor,
53
+ RuntimeAdapterInstance,
54
+ } from '@prisma-next/core-execution-plane/types';
55
+
56
+ // Adapter descriptor provides create() method
57
+ const adapterDescriptor: RuntimeAdapterDescriptor<'sql', 'postgres', SqlAdapter> = {
58
+ kind: 'adapter',
59
+ id: 'postgres',
60
+ familyId: 'sql',
61
+ targetId: 'postgres',
62
+ manifest: adapterManifest,
63
+ create(): SqlAdapter {
64
+ return createPostgresAdapter();
65
+ },
66
+ };
67
+ ```
68
+
69
+ ### Runtime Instances
70
+
71
+ Runtime instances are created from descriptors and used during query execution:
72
+
73
+ ```typescript
74
+ import type { RuntimeAdapterInstance } from '@prisma-next/core-execution-plane/types';
75
+
76
+ // Adapter instance used at runtime
77
+ const adapter: RuntimeAdapterInstance<'sql', 'postgres'> = adapterDescriptor.create();
78
+ ```
79
+
80
+ ## Package Location
81
+
82
+ This package is part of the **framework domain**, **core layer**, **runtime plane**:
83
+ - **Domain**: framework (target-agnostic)
84
+ - **Layer**: core
85
+ - **Plane**: runtime
86
+ - **Path**: `packages/framework/core-execution-plane`
87
+
88
+ ## Related Documentation
89
+
90
+ - `docs/architecture docs/adrs/ADR 152 - Runtime Plane Descriptors and Instances.md`: Complete ADR specification
91
+ - `.cursor/rules/multi-plane-packages.mdc`: Multi-plane package structure
92
+ - `packages/framework/core-control-plane/README.md`: Control plane counterpart
93
+
@@ -0,0 +1,131 @@
1
+ import { ExtensionPackManifest } from '@prisma-next/contract/pack-manifest-types';
2
+
3
+ /**
4
+ * Base interface for execution/runtime-plane family instances.
5
+ * Families extend this with domain-specific methods.
6
+ *
7
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
8
+ */
9
+ interface RuntimeFamilyInstance<TFamilyId extends string = string> {
10
+ readonly familyId: TFamilyId;
11
+ }
12
+ /**
13
+ * Base interface for execution/runtime-plane target instances.
14
+ *
15
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
16
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
17
+ */
18
+ interface RuntimeTargetInstance<TFamilyId extends string = string, TTargetId extends string = string> {
19
+ readonly familyId: TFamilyId;
20
+ readonly targetId: TTargetId;
21
+ }
22
+ /**
23
+ * Base interface for execution/runtime-plane adapter instances.
24
+ * Families extend this with family-specific adapter interfaces.
25
+ *
26
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
27
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
28
+ */
29
+ interface RuntimeAdapterInstance<TFamilyId extends string = string, TTargetId extends string = string> {
30
+ readonly familyId: TFamilyId;
31
+ readonly targetId: TTargetId;
32
+ }
33
+ /**
34
+ * Base interface for execution/runtime-plane driver instances.
35
+ *
36
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
37
+ */
38
+ interface RuntimeDriverInstance<TTargetId extends string = string> {
39
+ readonly targetId?: TTargetId;
40
+ }
41
+ /**
42
+ * Base interface for execution/runtime-plane extension instances.
43
+ *
44
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
45
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
46
+ */
47
+ interface RuntimeExtensionInstance<TFamilyId extends string = string, TTargetId extends string = string> {
48
+ readonly familyId: TFamilyId;
49
+ readonly targetId: TTargetId;
50
+ }
51
+ /**
52
+ * Descriptor for an execution/runtime-plane family (e.g., SQL).
53
+ * Provides factory method to create runtime family instance.
54
+ *
55
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
56
+ * @template TFamilyInstance - The family instance type
57
+ */
58
+ interface RuntimeFamilyDescriptor<TFamilyId extends string, TFamilyInstance extends RuntimeFamilyInstance<TFamilyId> = RuntimeFamilyInstance<TFamilyId>> {
59
+ readonly kind: 'family';
60
+ readonly id: string;
61
+ readonly familyId: TFamilyId;
62
+ readonly manifest: ExtensionPackManifest;
63
+ create<TTargetId extends string>(options: {
64
+ readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
65
+ readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
66
+ readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
67
+ readonly extensions: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
68
+ }): TFamilyInstance;
69
+ }
70
+ /**
71
+ * Descriptor for an execution/runtime-plane target pack (e.g., Postgres target).
72
+ *
73
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
74
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
75
+ * @template TTargetInstance - The target instance type
76
+ */
77
+ interface RuntimeTargetDescriptor<TFamilyId extends string, TTargetId extends string, TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId> = RuntimeTargetInstance<TFamilyId, TTargetId>> {
78
+ readonly kind: 'target';
79
+ readonly id: string;
80
+ readonly familyId: TFamilyId;
81
+ readonly targetId: TTargetId;
82
+ readonly manifest: ExtensionPackManifest;
83
+ create(): TTargetInstance;
84
+ }
85
+ /**
86
+ * Descriptor for an execution/runtime-plane adapter pack (e.g., Postgres adapter).
87
+ *
88
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
89
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
90
+ * @template TAdapterInstance - The adapter instance type
91
+ */
92
+ interface RuntimeAdapterDescriptor<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<TFamilyId, TTargetId>> {
93
+ readonly kind: 'adapter';
94
+ readonly id: string;
95
+ readonly familyId: TFamilyId;
96
+ readonly targetId: TTargetId;
97
+ readonly manifest: ExtensionPackManifest;
98
+ create(): TAdapterInstance;
99
+ }
100
+ /**
101
+ * Descriptor for an execution/runtime-plane driver pack (e.g., Postgres driver).
102
+ *
103
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
104
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
105
+ * @template TDriverInstance - The driver instance type
106
+ */
107
+ interface RuntimeDriverDescriptor<TFamilyId extends string, TTargetId extends string, TDriverInstance extends RuntimeDriverInstance<TTargetId> = RuntimeDriverInstance<TTargetId>> {
108
+ readonly kind: 'driver';
109
+ readonly id: string;
110
+ readonly familyId: TFamilyId;
111
+ readonly targetId: TTargetId;
112
+ readonly manifest: ExtensionPackManifest;
113
+ create(options: unknown): TDriverInstance;
114
+ }
115
+ /**
116
+ * Descriptor for an execution/runtime-plane extension pack (e.g., pgvector).
117
+ *
118
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
119
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
120
+ * @template TExtensionInstance - The extension instance type
121
+ */
122
+ interface RuntimeExtensionDescriptor<TFamilyId extends string, TTargetId extends string, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>> {
123
+ readonly kind: 'extension';
124
+ readonly id: string;
125
+ readonly familyId: TFamilyId;
126
+ readonly targetId: TTargetId;
127
+ readonly manifest: ExtensionPackManifest;
128
+ create(): TExtensionInstance;
129
+ }
130
+
131
+ export type { RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeFamilyDescriptor, RuntimeFamilyInstance, RuntimeTargetDescriptor, RuntimeTargetInstance };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@prisma-next/core-execution-plane",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "Execution/runtime plane descriptor and instance types for Prisma Next",
7
+ "dependencies": {
8
+ "@prisma-next/contract": "0.0.1",
9
+ "@prisma-next/core-control-plane": "0.0.1"
10
+ },
11
+ "devDependencies": {
12
+ "tsup": "^8.3.0",
13
+ "typescript": "^5.9.3",
14
+ "vitest": "^2.1.1",
15
+ "@prisma-next/test-utils": "0.0.1"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "exports": {
21
+ "./types": {
22
+ "types": "./dist/exports/types.d.ts",
23
+ "import": "./dist/exports/types.js"
24
+ }
25
+ },
26
+ "scripts": {
27
+ "build": "tsup --config tsup.config.ts",
28
+ "test": "vitest run --passWithNoTests",
29
+ "test:coverage": "vitest run --coverage --passWithNoTests",
30
+ "typecheck": "tsc --project tsconfig.json --noEmit",
31
+ "lint": "biome check . --config-path ../../../biome.json --error-on-warnings",
32
+ "clean": "node ../../../scripts/clean.mjs"
33
+ }
34
+ }