@prisma-next/core-execution-plane 0.3.0-dev.3 → 0.3.0-dev.31

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.
@@ -0,0 +1,32 @@
1
+ import { a as RuntimeExtensionDescriptor, l as RuntimeTargetDescriptor, s as RuntimeFamilyDescriptor, t as RuntimeAdapterDescriptor } from "./types-CRenF7tV.mjs";
2
+
3
+ //#region src/framework-components.d.ts
4
+
5
+ /**
6
+ * Asserts that runtime component descriptors satisfy contract requirements.
7
+ *
8
+ * Routes the same framework composition through validation as control-plane:
9
+ * family, target, adapter, extensionPacks (all as descriptors with IDs).
10
+ *
11
+ * @throws Error if contract target doesn't match the provided target descriptor
12
+ * @throws Error if contract requires extension packs not provided in descriptors
13
+ */
14
+ declare function assertRuntimeContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({
15
+ contract,
16
+ family,
17
+ target,
18
+ adapter,
19
+ extensionPacks
20
+ }: {
21
+ readonly contract: {
22
+ readonly target: string;
23
+ readonly extensionPacks?: Record<string, unknown>;
24
+ };
25
+ readonly family: RuntimeFamilyDescriptor<TFamilyId>;
26
+ readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
27
+ readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
28
+ readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
29
+ }): void;
30
+ //#endregion
31
+ export { assertRuntimeContractRequirementsSatisfied };
32
+ //# sourceMappingURL=framework-components.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components.d.mts","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;;;;;;;AAW2C,iBAX3B,0CAW2B,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,CAAA;EAAA,QAAA;EAAA,MAAA;EAAA,MAAA;EAAA,OAAA;EAAA;CAAA,EAAA;EAAxB,SAAA,QAAA,EAAA;IACwB,SAAA,MAAA,EAAA,MAAA;IAAW,SAAA,cAAA,CAAA,EAFoB,MAEpB,CAAA,MAAA,EAAA,OAAA,CAAA;EAAnC,CAAA;EAC0B,SAAA,MAAA,EAF1B,uBAE0B,CAFF,SAEE,CAAA;EAAW,SAAA,MAAA,EADrC,uBACqC,CADb,SACa,EADF,SACE,CAAA;EAApC,SAAA,OAAA,EAAA,wBAAA,CAAyB,SAAzB,EAAoC,SAApC,CAAA;EAC2C,SAAA,cAAA,EAAA,SAA3B,0BAA2B,CAAA,SAAA,EAAW,SAAX,CAAA,EAAA;CAAW,CAAA,EAAA,IAAA"}
@@ -0,0 +1,31 @@
1
+ import { checkContractComponentRequirements } from "@prisma-next/contract/framework-components";
2
+
3
+ //#region src/framework-components.ts
4
+ /**
5
+ * Asserts that runtime component descriptors satisfy contract requirements.
6
+ *
7
+ * Routes the same framework composition through validation as control-plane:
8
+ * family, target, adapter, extensionPacks (all as descriptors with IDs).
9
+ *
10
+ * @throws Error if contract target doesn't match the provided target descriptor
11
+ * @throws Error if contract requires extension packs not provided in descriptors
12
+ */
13
+ function assertRuntimeContractRequirementsSatisfied({ contract, family, target, adapter, extensionPacks }) {
14
+ const providedComponentIds = new Set([
15
+ family.id,
16
+ target.id,
17
+ adapter.id
18
+ ]);
19
+ for (const extension of extensionPacks) providedComponentIds.add(extension.id);
20
+ const result = checkContractComponentRequirements({
21
+ contract,
22
+ expectedTargetId: target.targetId,
23
+ providedComponentIds
24
+ });
25
+ if (result.targetMismatch) throw new Error(`Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`);
26
+ for (const packId of result.missingExtensionPackIds) throw new Error(`Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`);
27
+ }
28
+
29
+ //#endregion
30
+ export { assertRuntimeContractRequirementsSatisfied };
31
+ //# sourceMappingURL=framework-components.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components.mjs","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":["import { checkContractComponentRequirements } from '@prisma-next/contract/framework-components';\n\nimport type {\n RuntimeAdapterDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from './types';\n\n/**\n * Asserts that runtime component descriptors satisfy contract requirements.\n *\n * Routes the same framework composition through validation as control-plane:\n * family, target, adapter, extensionPacks (all as descriptors with IDs).\n *\n * @throws Error if contract target doesn't match the provided target descriptor\n * @throws Error if contract requires extension packs not provided in descriptors\n */\nexport function assertRuntimeContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n family,\n target,\n adapter,\n extensionPacks,\n}: {\n readonly contract: { readonly target: string; readonly extensionPacks?: Record<string, unknown> };\n readonly family: RuntimeFamilyDescriptor<TFamilyId>;\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];\n}): void {\n // Build set of provided component IDs from descriptors\n const providedComponentIds = new Set<string>([family.id, target.id, adapter.id]);\n for (const extension of extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetId: target.targetId,\n providedComponentIds,\n });\n\n if (result.targetMismatch) {\n throw new Error(\n `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`,\n );\n }\n\n // Strict enforcement: all extension packs required by contract must be provided as descriptors\n for (const packId of result.missingExtensionPackIds) {\n throw new Error(\n `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAgB,2CAGd,EACA,UACA,QACA,QACA,SACA,kBAOO;CAEP,MAAM,uBAAuB,IAAI,IAAY;EAAC,OAAO;EAAI,OAAO;EAAI,QAAQ;EAAG,CAAC;AAChF,MAAK,MAAM,aAAa,eACtB,sBAAqB,IAAI,UAAU,GAAG;CAGxC,MAAM,SAAS,mCAAmC;EAChD;EACA,kBAAkB,OAAO;EACzB;EACD,CAAC;AAEF,KAAI,OAAO,eACT,OAAM,IAAI,MACR,oBAAoB,OAAO,eAAe,OAAO,8CAA8C,OAAO,eAAe,SAAS,IAC/H;AAIH,MAAK,MAAM,UAAU,OAAO,wBAC1B,OAAM,IAAI,MACR,qCAAqC,OAAO,iEAC7C"}
@@ -1,4 +1,6 @@
1
- import { AdapterInstance, AdapterDescriptor, DriverInstance, DriverDescriptor, ExtensionInstance, ExtensionDescriptor, FamilyInstance, FamilyDescriptor, TargetInstance, TargetDescriptor } from '@prisma-next/contract/framework-components';
1
+ import { AdapterDescriptor, AdapterInstance, DriverDescriptor, DriverInstance, ExtensionDescriptor, ExtensionInstance, FamilyDescriptor, FamilyInstance, TargetDescriptor, TargetInstance } from "@prisma-next/contract/framework-components";
2
+
3
+ //#region src/types.d.ts
2
4
 
3
5
  /**
4
6
  * Runtime-plane family instance interface.
@@ -6,8 +8,7 @@ import { AdapterInstance, AdapterDescriptor, DriverInstance, DriverDescriptor, E
6
8
  *
7
9
  * @template TFamilyId - The family ID (e.g., 'sql', 'document')
8
10
  */
9
- interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {
10
- }
11
+ interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {}
11
12
  /**
12
13
  * Runtime-plane target instance interface.
13
14
  * Extends the base TargetInstance with runtime-plane specific behavior.
@@ -15,8 +16,7 @@ interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance
15
16
  * @template TFamilyId - The family ID (e.g., 'sql', 'document')
16
17
  * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
17
18
  */
18
- interface RuntimeTargetInstance<TFamilyId extends string, TTargetId extends string> extends TargetInstance<TFamilyId, TTargetId> {
19
- }
19
+ interface RuntimeTargetInstance<TFamilyId extends string, TTargetId extends string> extends TargetInstance<TFamilyId, TTargetId> {}
20
20
  /**
21
21
  * Runtime-plane adapter instance interface.
22
22
  * Extends the base AdapterInstance with runtime-plane specific behavior.
@@ -25,8 +25,7 @@ interface RuntimeTargetInstance<TFamilyId extends string, TTargetId extends stri
25
25
  * @template TFamilyId - The family ID (e.g., 'sql', 'document')
26
26
  * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
27
27
  */
28
- interface RuntimeAdapterInstance<TFamilyId extends string, TTargetId extends string> extends AdapterInstance<TFamilyId, TTargetId> {
29
- }
28
+ interface RuntimeAdapterInstance<TFamilyId extends string, TTargetId extends string> extends AdapterInstance<TFamilyId, TTargetId> {}
30
29
  /**
31
30
  * Runtime-plane driver instance interface.
32
31
  * Extends the base DriverInstance with runtime-plane specific behavior.
@@ -34,8 +33,7 @@ interface RuntimeAdapterInstance<TFamilyId extends string, TTargetId extends str
34
33
  * @template TFamilyId - The family ID (e.g., 'sql', 'document')
35
34
  * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
36
35
  */
37
- interface RuntimeDriverInstance<TFamilyId extends string, TTargetId extends string> extends DriverInstance<TFamilyId, TTargetId> {
38
- }
36
+ interface RuntimeDriverInstance<TFamilyId extends string, TTargetId extends string> extends DriverInstance<TFamilyId, TTargetId> {}
39
37
  /**
40
38
  * Runtime-plane extension instance interface.
41
39
  * Extends the base ExtensionInstance with runtime-plane specific behavior.
@@ -43,8 +41,7 @@ interface RuntimeDriverInstance<TFamilyId extends string, TTargetId extends stri
43
41
  * @template TFamilyId - The family ID (e.g., 'sql', 'document')
44
42
  * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
45
43
  */
46
- interface RuntimeExtensionInstance<TFamilyId extends string, TTargetId extends string> extends ExtensionInstance<TFamilyId, TTargetId> {
47
- }
44
+ interface RuntimeExtensionInstance<TFamilyId extends string, TTargetId extends string> extends ExtensionInstance<TFamilyId, TTargetId> {}
48
45
  /**
49
46
  * Descriptor for an execution/runtime-plane family (e.g., SQL).
50
47
  * Provides factory method to create runtime family instance.
@@ -53,12 +50,12 @@ interface RuntimeExtensionInstance<TFamilyId extends string, TTargetId extends s
53
50
  * @template TFamilyInstance - The family instance type
54
51
  */
55
52
  interface RuntimeFamilyDescriptor<TFamilyId extends string, TFamilyInstance extends RuntimeFamilyInstance<TFamilyId> = RuntimeFamilyInstance<TFamilyId>> extends FamilyDescriptor<TFamilyId> {
56
- create<TTargetId extends string>(options: {
57
- readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
58
- readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
59
- readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
60
- readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
61
- }): TFamilyInstance;
53
+ create<TTargetId extends string>(options: {
54
+ readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
55
+ readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
56
+ readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
57
+ readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
58
+ }): TFamilyInstance;
62
59
  }
63
60
  /**
64
61
  * Descriptor for an execution/runtime-plane target component (e.g., Postgres target).
@@ -68,7 +65,7 @@ interface RuntimeFamilyDescriptor<TFamilyId extends string, TFamilyInstance exte
68
65
  * @template TTargetInstance - The target instance type
69
66
  */
70
67
  interface RuntimeTargetDescriptor<TFamilyId extends string, TTargetId extends string, TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId> = RuntimeTargetInstance<TFamilyId, TTargetId>> extends TargetDescriptor<TFamilyId, TTargetId> {
71
- create(): TTargetInstance;
68
+ create(): TTargetInstance;
72
69
  }
73
70
  /**
74
71
  * Descriptor for an execution/runtime-plane adapter component (e.g., Postgres adapter).
@@ -78,7 +75,7 @@ interface RuntimeTargetDescriptor<TFamilyId extends string, TTargetId extends st
78
75
  * @template TAdapterInstance - The adapter instance type
79
76
  */
80
77
  interface RuntimeAdapterDescriptor<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<TFamilyId, TTargetId>> extends AdapterDescriptor<TFamilyId, TTargetId> {
81
- create(): TAdapterInstance;
78
+ create(): TAdapterInstance;
82
79
  }
83
80
  /**
84
81
  * Descriptor for an execution/runtime-plane driver component (e.g., Postgres driver).
@@ -88,7 +85,7 @@ interface RuntimeAdapterDescriptor<TFamilyId extends string, TTargetId extends s
88
85
  * @template TDriverInstance - The driver instance type
89
86
  */
90
87
  interface RuntimeDriverDescriptor<TFamilyId extends string, TTargetId extends string, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<TFamilyId, TTargetId>> extends DriverDescriptor<TFamilyId, TTargetId> {
91
- create(options: unknown): TDriverInstance;
88
+ create(options: unknown): TDriverInstance;
92
89
  }
93
90
  /**
94
91
  * Descriptor for an execution/runtime-plane extension component (e.g., pgvector).
@@ -98,7 +95,8 @@ interface RuntimeDriverDescriptor<TFamilyId extends string, TTargetId extends st
98
95
  * @template TExtensionInstance - The extension instance type
99
96
  */
100
97
  interface RuntimeExtensionDescriptor<TFamilyId extends string, TTargetId extends string, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>> extends ExtensionDescriptor<TFamilyId, TTargetId> {
101
- create(): TExtensionInstance;
98
+ create(): TExtensionInstance;
102
99
  }
103
-
104
- export type { RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeFamilyDescriptor, RuntimeFamilyInstance, RuntimeTargetDescriptor, RuntimeTargetInstance };
100
+ //#endregion
101
+ export { RuntimeExtensionDescriptor as a, RuntimeFamilyInstance as c, RuntimeDriverInstance as i, RuntimeTargetDescriptor as l, RuntimeAdapterInstance as n, RuntimeExtensionInstance as o, RuntimeDriverDescriptor as r, RuntimeFamilyDescriptor as s, RuntimeAdapterDescriptor as t, RuntimeTargetInstance as u };
102
+ //# sourceMappingURL=types-CRenF7tV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CRenF7tV.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;AAuBA;AAWA;;;AACU,UAZO,qBAYP,CAAA,kBAAA,MAAA,CAAA,SAZ+D,cAY/D,CAZ8E,SAY9E,CAAA,CAAA;AAUV;;;;;AAUA;;AACoC,UAtBnB,qBAsBmB,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,SArB1B,cAqB0B,CArBX,SAqBW,EArBA,SAqBA,CAAA,CAAA;;AASpC;;;;;AAcA;;AAE0B,UApCT,sBAoCS,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,SAnChB,eAmCgB,CAnCA,SAmCA,EAnCW,SAmCX,CAAA,CAAA;;;;;;;;AAIJ,UA9BL,qBA8BK,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,SA7BZ,cA6BY,CA7BG,SA6BH,EA7Bc,SA6Bd,CAAA,CAAA;;;;;;;;AAHI,UAjBT,wBAiBS,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,SAhBhB,iBAgBgB,CAhBE,SAgBF,EAhBa,SAgBb,CAAA,CAAA,CAgB1B;;;;;;;;AAOsC,UA1BrB,uBA0BqB,CAAA,kBAAA,MAAA,EAAA,wBAxBZ,qBAwBY,CAxBU,SAwBV,CAAA,GAxBuB,qBAwBvB,CAxB6C,SAwB7C,CAAA,CAAA,SAvB5B,gBAuB4B,CAvBX,SAuBW,CAAA,CAAA;EAC1B,MAAA,CAAA,kBAAA,MAAA,CAAA,CAAA,OAAA,EAAA;IADF,SAAA,MAAA,EArBW,uBAqBX,CArBmC,SAqBnC,EArB8C,SAqB9C,CAAA;IAAgB,SAAA,OAAA,EApBJ,wBAoBI,CApBqB,SAoBrB,EApBgC,SAoBhC,CAAA;IAWT,SAAA,MAAA,EA9BI,uBA8BoB,CA9BI,SA8BJ,EA9Be,SA8Bf,CAAA;IAGS,SAAA,cAAA,EAAA,SAhCZ,0BAgCY,CAhCe,SAgCf,EAhC0B,SAgC1B,CAAA,EAAA;EAAW,CAAA,CAAA,EA/BvD,eA+BuD;;;;;;;;;AAIlC,UAzBV,uBAyBU,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,EAAA,wBAtBD,qBAsBC,CAtBqB,SAsBrB,EAtBgC,SAsBhC,CAAA,GAtB6C,qBAsB7C,CArBvB,SAqBuB,EApBvB,SAoBuB,CAAA,CAAA,SAlBjB,gBAkBiB,CAlBA,SAkBA,EAlBW,SAkBX,CAAA,CAAA;EAWV,MAAA,EAAA,EA5BL,eA4BK;;;;;;;;;AAQW,UA1BX,wBA0BW,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,EAAA,yBAvBD,sBAuBC,CAvBsB,SAuBtB,EAvBiC,SAuBjC,CAAA,GAvB8C,sBAuB9C,CAtBxB,SAsBwB,EArBxB,SAqBwB,CAAA,CAAA,SAnBlB,iBAmBkB,CAnBA,SAmBA,EAnBW,SAmBX,CAAA,CAAA;EADlB,MAAA,EAAA,EAjBE,gBAiBF;;AAWV;;;;;;;AAO8B,UAzBb,uBAyBa,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,EAAA,wBAtBJ,qBAsBI,CAtBkB,SAsBlB,EAtB6B,SAsB7B,CAAA,GAtB0C,qBAsB1C,CArB1B,SAqB0B,EApB1B,SAoB0B,CAAA,CAAA,SAlBpB,gBAkBoB,CAlBH,SAkBG,EAlBQ,SAkBR,CAAA,CAAA;EAAW,MAAA,CAAA,OAAA,EAAA,OAAA,CAAA,EAjBb,eAiBa;;;;;;;;;UAPxB,0GAGY,yBACzB,WACA,aACE,yBAAyB,WAAW,oBAChC,oBAAoB,WAAW;YAC7B"}
@@ -0,0 +1,2 @@
1
+ import { a as RuntimeExtensionDescriptor, c as RuntimeFamilyInstance, i as RuntimeDriverInstance, l as RuntimeTargetDescriptor, n as RuntimeAdapterInstance, o as RuntimeExtensionInstance, r as RuntimeDriverDescriptor, s as RuntimeFamilyDescriptor, t as RuntimeAdapterDescriptor, u as RuntimeTargetInstance } from "./types-CRenF7tV.mjs";
2
+ export { type RuntimeAdapterDescriptor, type RuntimeAdapterInstance, type RuntimeDriverDescriptor, type RuntimeDriverInstance, type RuntimeExtensionDescriptor, type RuntimeExtensionInstance, type RuntimeFamilyDescriptor, type RuntimeFamilyInstance, type RuntimeTargetDescriptor, type RuntimeTargetInstance };
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
2
  "name": "@prisma-next/core-execution-plane",
3
- "version": "0.3.0-dev.3",
3
+ "version": "0.3.0-dev.31",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Execution/runtime plane descriptor and instance types for Prisma Next",
7
7
  "dependencies": {
8
- "@prisma-next/core-control-plane": "0.3.0-dev.3",
9
- "@prisma-next/contract": "0.3.0-dev.3"
8
+ "@prisma-next/contract": "0.3.0-dev.31",
9
+ "@prisma-next/core-control-plane": "0.3.0-dev.31"
10
10
  },
11
11
  "devDependencies": {
12
- "@vitest/coverage-v8": "^4.0.0",
13
- "tsup": "^8.3.0",
14
- "typescript": "^5.9.3",
15
- "vitest": "^4.0.16",
16
- "@prisma-next/test-utils": "0.0.1"
12
+ "tsdown": "0.18.4",
13
+ "typescript": "5.9.3",
14
+ "vitest": "4.0.16",
15
+ "@prisma-next/test-utils": "0.0.1",
16
+ "@prisma-next/tsconfig": "0.0.0",
17
+ "@prisma-next/tsdown": "0.0.0"
17
18
  },
18
19
  "files": [
19
- "dist"
20
+ "dist",
21
+ "src"
20
22
  ],
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
21
26
  "exports": {
22
- "./types": {
23
- "types": "./dist/exports/types.d.ts",
24
- "import": "./dist/exports/types.js"
25
- },
26
- "./framework-components": {
27
- "types": "./dist/exports/framework-components.d.ts",
28
- "import": "./dist/exports/framework-components.js"
29
- }
27
+ "./framework-components": "./dist/framework-components.mjs",
28
+ "./types": "./dist/types.mjs",
29
+ "./package.json": "./package.json"
30
30
  },
31
31
  "scripts": {
32
- "build": "tsup --config tsup.config.ts",
32
+ "build": "tsdown",
33
33
  "test": "vitest run --passWithNoTests",
34
34
  "test:coverage": "vitest run --coverage --passWithNoTests",
35
- "typecheck": "tsc --project tsconfig.json --noEmit",
36
- "lint": "biome check . --config-path ../../../../../biome.json --error-on-warnings",
37
- "lint:fix": "biome check --write . --config-path ../../../biome.json",
38
- "lint:fix:unsafe": "biome check --write --unsafe . --config-path ../../../biome.json",
39
- "clean": "node ../../../../../scripts/clean.mjs"
35
+ "typecheck": "tsc --noEmit",
36
+ "lint": "biome check . --error-on-warnings",
37
+ "lint:fix": "biome check --write .",
38
+ "lint:fix:unsafe": "biome check --write --unsafe .",
39
+ "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
40
40
  }
41
41
  }
@@ -0,0 +1 @@
1
+ export { assertRuntimeContractRequirementsSatisfied } from '../framework-components';
@@ -0,0 +1,12 @@
1
+ export type {
2
+ RuntimeAdapterDescriptor,
3
+ RuntimeAdapterInstance,
4
+ RuntimeDriverDescriptor,
5
+ RuntimeDriverInstance,
6
+ RuntimeExtensionDescriptor,
7
+ RuntimeExtensionInstance,
8
+ RuntimeFamilyDescriptor,
9
+ RuntimeFamilyInstance,
10
+ RuntimeTargetDescriptor,
11
+ RuntimeTargetInstance,
12
+ } from '../types';
@@ -0,0 +1,59 @@
1
+ import { checkContractComponentRequirements } from '@prisma-next/contract/framework-components';
2
+
3
+ import type {
4
+ RuntimeAdapterDescriptor,
5
+ RuntimeExtensionDescriptor,
6
+ RuntimeFamilyDescriptor,
7
+ RuntimeTargetDescriptor,
8
+ } from './types';
9
+
10
+ /**
11
+ * Asserts that runtime component descriptors satisfy contract requirements.
12
+ *
13
+ * Routes the same framework composition through validation as control-plane:
14
+ * family, target, adapter, extensionPacks (all as descriptors with IDs).
15
+ *
16
+ * @throws Error if contract target doesn't match the provided target descriptor
17
+ * @throws Error if contract requires extension packs not provided in descriptors
18
+ */
19
+ export function assertRuntimeContractRequirementsSatisfied<
20
+ TFamilyId extends string,
21
+ TTargetId extends string,
22
+ >({
23
+ contract,
24
+ family,
25
+ target,
26
+ adapter,
27
+ extensionPacks,
28
+ }: {
29
+ readonly contract: { readonly target: string; readonly extensionPacks?: Record<string, unknown> };
30
+ readonly family: RuntimeFamilyDescriptor<TFamilyId>;
31
+ readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
32
+ readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
33
+ readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
34
+ }): void {
35
+ // Build set of provided component IDs from descriptors
36
+ const providedComponentIds = new Set<string>([family.id, target.id, adapter.id]);
37
+ for (const extension of extensionPacks) {
38
+ providedComponentIds.add(extension.id);
39
+ }
40
+
41
+ const result = checkContractComponentRequirements({
42
+ contract,
43
+ expectedTargetId: target.targetId,
44
+ providedComponentIds,
45
+ });
46
+
47
+ if (result.targetMismatch) {
48
+ throw new Error(
49
+ `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`,
50
+ );
51
+ }
52
+
53
+ // Strict enforcement: all extension packs required by contract must be provided as descriptors
54
+ for (const packId of result.missingExtensionPackIds) {
55
+ throw new Error(
56
+ `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`,
57
+ );
58
+ }
59
+ }
package/src/types.ts ADDED
@@ -0,0 +1,162 @@
1
+ import type {
2
+ AdapterDescriptor,
3
+ AdapterInstance,
4
+ DriverDescriptor,
5
+ DriverInstance,
6
+ ExtensionDescriptor,
7
+ ExtensionInstance,
8
+ FamilyDescriptor,
9
+ FamilyInstance,
10
+ TargetDescriptor,
11
+ TargetInstance,
12
+ } from '@prisma-next/contract/framework-components';
13
+
14
+ // ============================================================================
15
+ // Runtime*Instance Base Interfaces
16
+ // ============================================================================
17
+
18
+ /**
19
+ * Runtime-plane family instance interface.
20
+ * Extends the base FamilyInstance for runtime-plane specific methods.
21
+ *
22
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
23
+ */
24
+ export interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {
25
+ // Placeholder for future runtime-plane-specific methods
26
+ }
27
+
28
+ /**
29
+ * Runtime-plane target instance interface.
30
+ * Extends the base TargetInstance with runtime-plane specific behavior.
31
+ *
32
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
33
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
34
+ */
35
+ export interface RuntimeTargetInstance<TFamilyId extends string, TTargetId extends string>
36
+ extends TargetInstance<TFamilyId, TTargetId> {}
37
+
38
+ /**
39
+ * Runtime-plane adapter instance interface.
40
+ * Extends the base AdapterInstance with runtime-plane specific behavior.
41
+ * Families extend this with family-specific adapter interfaces.
42
+ *
43
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
44
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
45
+ */
46
+ export interface RuntimeAdapterInstance<TFamilyId extends string, TTargetId extends string>
47
+ extends AdapterInstance<TFamilyId, TTargetId> {}
48
+
49
+ /**
50
+ * Runtime-plane driver instance interface.
51
+ * Extends the base DriverInstance with runtime-plane specific behavior.
52
+ *
53
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
54
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
55
+ */
56
+ export interface RuntimeDriverInstance<TFamilyId extends string, TTargetId extends string>
57
+ extends DriverInstance<TFamilyId, TTargetId> {}
58
+
59
+ /**
60
+ * Runtime-plane extension instance interface.
61
+ * Extends the base ExtensionInstance with runtime-plane specific behavior.
62
+ *
63
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
64
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
65
+ */
66
+ export interface RuntimeExtensionInstance<TFamilyId extends string, TTargetId extends string>
67
+ extends ExtensionInstance<TFamilyId, TTargetId> {}
68
+
69
+ // ============================================================================
70
+ // Runtime*Descriptor Interfaces (ADR 152)
71
+ // ============================================================================
72
+
73
+ /**
74
+ * Descriptor for an execution/runtime-plane family (e.g., SQL).
75
+ * Provides factory method to create runtime family instance.
76
+ *
77
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
78
+ * @template TFamilyInstance - The family instance type
79
+ */
80
+ export interface RuntimeFamilyDescriptor<
81
+ TFamilyId extends string,
82
+ TFamilyInstance extends RuntimeFamilyInstance<TFamilyId> = RuntimeFamilyInstance<TFamilyId>,
83
+ > extends FamilyDescriptor<TFamilyId> {
84
+ create<TTargetId extends string>(options: {
85
+ readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
86
+ readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
87
+ readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
88
+ readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
89
+ }): TFamilyInstance;
90
+ }
91
+
92
+ /**
93
+ * Descriptor for an execution/runtime-plane target component (e.g., Postgres target).
94
+ *
95
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
96
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
97
+ * @template TTargetInstance - The target instance type
98
+ */
99
+ export interface RuntimeTargetDescriptor<
100
+ TFamilyId extends string,
101
+ TTargetId extends string,
102
+ TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId> = RuntimeTargetInstance<
103
+ TFamilyId,
104
+ TTargetId
105
+ >,
106
+ > extends TargetDescriptor<TFamilyId, TTargetId> {
107
+ create(): TTargetInstance;
108
+ }
109
+
110
+ /**
111
+ * Descriptor for an execution/runtime-plane adapter component (e.g., Postgres adapter).
112
+ *
113
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
114
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
115
+ * @template TAdapterInstance - The adapter instance type
116
+ */
117
+ export interface RuntimeAdapterDescriptor<
118
+ TFamilyId extends string,
119
+ TTargetId extends string,
120
+ TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<
121
+ TFamilyId,
122
+ TTargetId
123
+ >,
124
+ > extends AdapterDescriptor<TFamilyId, TTargetId> {
125
+ create(): TAdapterInstance;
126
+ }
127
+
128
+ /**
129
+ * Descriptor for an execution/runtime-plane driver component (e.g., Postgres driver).
130
+ *
131
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
132
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
133
+ * @template TDriverInstance - The driver instance type
134
+ */
135
+ export interface RuntimeDriverDescriptor<
136
+ TFamilyId extends string,
137
+ TTargetId extends string,
138
+ TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<
139
+ TFamilyId,
140
+ TTargetId
141
+ >,
142
+ > extends DriverDescriptor<TFamilyId, TTargetId> {
143
+ create(options: unknown): TDriverInstance;
144
+ }
145
+
146
+ /**
147
+ * Descriptor for an execution/runtime-plane extension component (e.g., pgvector).
148
+ *
149
+ * @template TFamilyId - The family ID (e.g., 'sql', 'document')
150
+ * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
151
+ * @template TExtensionInstance - The extension instance type
152
+ */
153
+ export interface RuntimeExtensionDescriptor<
154
+ TFamilyId extends string,
155
+ TTargetId extends string,
156
+ TExtensionInstance extends RuntimeExtensionInstance<
157
+ TFamilyId,
158
+ TTargetId
159
+ > = RuntimeExtensionInstance<TFamilyId, TTargetId>,
160
+ > extends ExtensionDescriptor<TFamilyId, TTargetId> {
161
+ create(): TExtensionInstance;
162
+ }
@@ -1,24 +0,0 @@
1
- import { RuntimeFamilyDescriptor, RuntimeTargetDescriptor, RuntimeAdapterDescriptor, RuntimeExtensionDescriptor } from './types.js';
2
- import '@prisma-next/contract/framework-components';
3
-
4
- /**
5
- * Asserts that runtime component descriptors satisfy contract requirements.
6
- *
7
- * Routes the same framework composition through validation as control-plane:
8
- * family, target, adapter, extensionPacks (all as descriptors with IDs).
9
- *
10
- * @throws Error if contract target doesn't match the provided target descriptor
11
- * @throws Error if contract requires extension packs not provided in descriptors
12
- */
13
- declare function assertRuntimeContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({ contract, family, target, adapter, extensionPacks, }: {
14
- readonly contract: {
15
- readonly target: string;
16
- readonly extensionPacks?: Record<string, unknown>;
17
- };
18
- readonly family: RuntimeFamilyDescriptor<TFamilyId>;
19
- readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
20
- readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
21
- readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
22
- }): void;
23
-
24
- export { assertRuntimeContractRequirementsSatisfied };
@@ -1,33 +0,0 @@
1
- // src/framework-components.ts
2
- import { checkContractComponentRequirements } from "@prisma-next/contract/framework-components";
3
- function assertRuntimeContractRequirementsSatisfied({
4
- contract,
5
- family,
6
- target,
7
- adapter,
8
- extensionPacks
9
- }) {
10
- const providedComponentIds = /* @__PURE__ */ new Set([family.id, target.id, adapter.id]);
11
- for (const extension of extensionPacks) {
12
- providedComponentIds.add(extension.id);
13
- }
14
- const result = checkContractComponentRequirements({
15
- contract,
16
- expectedTargetId: target.targetId,
17
- providedComponentIds
18
- });
19
- if (result.targetMismatch) {
20
- throw new Error(
21
- `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`
22
- );
23
- }
24
- for (const packId of result.missingExtensionPackIds) {
25
- throw new Error(
26
- `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`
27
- );
28
- }
29
- }
30
- export {
31
- assertRuntimeContractRequirementsSatisfied
32
- };
33
- //# sourceMappingURL=framework-components.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/framework-components.ts"],"sourcesContent":["import { checkContractComponentRequirements } from '@prisma-next/contract/framework-components';\n\nimport type {\n RuntimeAdapterDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from './types';\n\n/**\n * Asserts that runtime component descriptors satisfy contract requirements.\n *\n * Routes the same framework composition through validation as control-plane:\n * family, target, adapter, extensionPacks (all as descriptors with IDs).\n *\n * @throws Error if contract target doesn't match the provided target descriptor\n * @throws Error if contract requires extension packs not provided in descriptors\n */\nexport function assertRuntimeContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n family,\n target,\n adapter,\n extensionPacks,\n}: {\n readonly contract: { readonly target: string; readonly extensionPacks?: Record<string, unknown> };\n readonly family: RuntimeFamilyDescriptor<TFamilyId>;\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];\n}): void {\n // Build set of provided component IDs from descriptors\n const providedComponentIds = new Set<string>([family.id, target.id, adapter.id]);\n for (const extension of extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetId: target.targetId,\n providedComponentIds,\n });\n\n if (result.targetMismatch) {\n throw new Error(\n `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`,\n );\n }\n\n // Strict enforcement: all extension packs required by contract must be provided as descriptors\n for (const packId of result.missingExtensionPackIds) {\n throw new Error(\n `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`,\n );\n }\n}\n"],"mappings":";AAAA,SAAS,0CAA0C;AAkB5C,SAAS,2CAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMS;AAEP,QAAM,uBAAuB,oBAAI,IAAY,CAAC,OAAO,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;AAC/E,aAAW,aAAa,gBAAgB;AACtC,yBAAqB,IAAI,UAAU,EAAE;AAAA,EACvC;AAEA,QAAM,SAAS,mCAAmC;AAAA,IAChD;AAAA,IACA,kBAAkB,OAAO;AAAA,IACzB;AAAA,EACF,CAAC;AAED,MAAI,OAAO,gBAAgB;AACzB,UAAM,IAAI;AAAA,MACR,oBAAoB,OAAO,eAAe,MAAM,+CAA+C,OAAO,eAAe,QAAQ;AAAA,IAC/H;AAAA,EACF;AAGA,aAAW,UAAU,OAAO,yBAAyB;AACnD,UAAM,IAAI;AAAA,MACR,qCAAqC,MAAM;AAAA,IAC7C;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}