@prisma-next/core-execution-plane 0.1.0-pr.65.5 → 0.1.0-pr.65.7
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` -
|
|
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,15 @@
|
|
|
1
|
+
import { RuntimeTargetDescriptor, RuntimeAdapterDescriptor, RuntimeExtensionDescriptor } from './types.js';
|
|
2
|
+
import '@prisma-next/contract/framework-components';
|
|
3
|
+
|
|
4
|
+
declare function assertRuntimeContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({ contract, target, adapter, extensions, runtimeExtensionPacksProvided, }: {
|
|
5
|
+
readonly contract: {
|
|
6
|
+
readonly target: string;
|
|
7
|
+
readonly extensionPacks?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
|
|
10
|
+
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
|
|
11
|
+
readonly extensions: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
|
|
12
|
+
readonly runtimeExtensionPacksProvided?: boolean | undefined;
|
|
13
|
+
}): void;
|
|
14
|
+
|
|
15
|
+
export { assertRuntimeContractRequirementsSatisfied };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/framework-components.ts
|
|
2
|
+
import { checkContractComponentRequirements } from "@prisma-next/contract/framework-components";
|
|
3
|
+
function assertRuntimeContractRequirementsSatisfied({
|
|
4
|
+
contract,
|
|
5
|
+
target,
|
|
6
|
+
adapter,
|
|
7
|
+
extensions,
|
|
8
|
+
runtimeExtensionPacksProvided
|
|
9
|
+
}) {
|
|
10
|
+
const providedComponentIds = /* @__PURE__ */ new Set([target.id, adapter.id]);
|
|
11
|
+
for (const extension of extensions) {
|
|
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
|
+
if (runtimeExtensionPacksProvided === true) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const packId of result.missingExtensionPackIds) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
assertRuntimeContractRequirementsSatisfied
|
|
35
|
+
};
|
|
36
|
+
//# 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 RuntimeTargetDescriptor,\n} from './types';\n\nexport function assertRuntimeContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n target,\n adapter,\n extensions,\n runtimeExtensionPacksProvided,\n}: {\n readonly contract: { readonly target: string; readonly extensionPacks?: Record<string, unknown> };\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensions: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];\n readonly runtimeExtensionPacksProvided?: boolean | undefined;\n}): void {\n const providedComponentIds = new Set<string>([target.id, adapter.id]);\n for (const extension of extensions) {\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 if (runtimeExtensionPacksProvided === true) {\n return;\n }\n\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;AAQ5C,SAAS,2CAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMS;AACP,QAAM,uBAAuB,oBAAI,IAAY,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;AACpE,aAAW,aAAa,YAAY;AAClC,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;AAEA,MAAI,kCAAkC,MAAM;AAC1C;AAAA,EACF;AAEA,aAAW,UAAU,OAAO,yBAAyB;AACnD,UAAM,IAAI;AAAA,MACR,qCAAqC,MAAM;AAAA,IAC7C;AAAA,EACF;AACF;","names":[]}
|
package/dist/exports/types.d.ts
CHANGED
|
@@ -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
|
|
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-pr.65.
|
|
3
|
+
"version": "0.1.0-pr.65.7",
|
|
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/
|
|
9
|
-
"@prisma-next/
|
|
8
|
+
"@prisma-next/contract": "0.1.0-pr.65.7",
|
|
9
|
+
"@prisma-next/core-control-plane": "0.1.0-pr.65.7"
|
|
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": {
|