@prisma-next/core-execution-plane 0.1.0-dev.29 → 0.1.0-dev.30

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 CHANGED
@@ -14,7 +14,7 @@ This package provides TypeScript type definitions for execution/runtime-plane de
14
14
  ## Dependencies
15
15
 
16
16
  - **Depends on**:
17
- - `@prisma-next/contract` - Extension pack manifest types (`ExtensionPackManifest`)
17
+ - `@prisma-next/contract/framework-components` - Framework component types (`AdapterDescriptor`, `AdapterInstance`, `DriverDescriptor`, `DriverInstance`, `ExtensionDescriptor`, `ExtensionInstance`, `FamilyDescriptor`, `FamilyInstance`, `TargetDescriptor`, `TargetInstance`)
18
18
 
19
19
  - **Depended on by**:
20
20
  - Runtime plane packages (adapters, drivers, targets) - Use descriptor and instance types
@@ -0,0 +1,24 @@
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 };
@@ -0,0 +1,33 @@
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
@@ -0,0 +1 @@
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":[]}
@@ -57,7 +57,7 @@ interface RuntimeFamilyDescriptor<TFamilyId extends string, TFamilyInstance exte
57
57
  readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
58
58
  readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
59
59
  readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
60
- readonly extensions: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
60
+ readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
61
61
  }): TFamilyInstance;
62
62
  }
63
63
  /**
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@prisma-next/core-execution-plane",
3
- "version": "0.1.0-dev.29",
3
+ "version": "0.1.0-dev.30",
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.1.0-dev.29",
9
- "@prisma-next/contract": "0.1.0-dev.29"
8
+ "@prisma-next/contract": "0.1.0-dev.30",
9
+ "@prisma-next/core-control-plane": "0.1.0-dev.30"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@vitest/coverage-v8": "^4.0.0",
@@ -22,6 +22,10 @@
22
22
  "./types": {
23
23
  "types": "./dist/exports/types.d.ts",
24
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"
25
29
  }
26
30
  },
27
31
  "scripts": {