@prisma-next/framework-components 0.0.1 → 0.3.0-dev.147
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/dist/authoring.d.mts +2 -0
- package/dist/authoring.mjs +122 -0
- package/dist/authoring.mjs.map +1 -0
- package/dist/codec-types-D9ixsdxw.d.mts +40 -0
- package/dist/codec-types-D9ixsdxw.d.mts.map +1 -0
- package/dist/codec.d.mts +2 -0
- package/dist/codec.mjs +6 -0
- package/dist/codec.mjs.map +1 -0
- package/dist/components.d.mts +2 -0
- package/dist/components.mjs +3 -0
- package/dist/control.d.mts +550 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +140 -0
- package/dist/control.mjs.map +1 -0
- package/dist/emission-types-Dt9_NXRb.d.mts +24 -0
- package/dist/emission-types-Dt9_NXRb.d.mts.map +1 -0
- package/dist/emission.d.mts +3 -0
- package/dist/emission.mjs +1 -0
- package/dist/execution.d.mts +78 -0
- package/dist/execution.d.mts.map +1 -0
- package/dist/execution.mjs +43 -0
- package/dist/execution.mjs.map +1 -0
- package/dist/framework-authoring-BybjSfF5.d.mts +99 -0
- package/dist/framework-authoring-BybjSfF5.d.mts.map +1 -0
- package/dist/framework-components-Bl3SLyGG.mjs +27 -0
- package/dist/framework-components-Bl3SLyGG.mjs.map +1 -0
- package/dist/framework-components-W-TA8p5-.d.mts +333 -0
- package/dist/framework-components-W-TA8p5-.d.mts.map +1 -0
- package/dist/types-import-spec-BupmVNbx.d.mts +13 -0
- package/dist/types-import-spec-BupmVNbx.d.mts.map +1 -0
- package/package.json +6 -6
package/dist/control.mjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//#region src/control-capabilities.ts
|
|
2
|
+
function hasMigrations(target) {
|
|
3
|
+
return "migrations" in target && !!target["migrations"];
|
|
4
|
+
}
|
|
5
|
+
function hasSchemaView(instance) {
|
|
6
|
+
return "toSchemaView" in instance && typeof instance["toSchemaView"] === "function";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/control-stack.ts
|
|
11
|
+
function addUniqueId(ids, seen, id) {
|
|
12
|
+
if (!seen.has(id)) {
|
|
13
|
+
ids.push(id);
|
|
14
|
+
seen.add(id);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function assertUniqueCodecOwner(options) {
|
|
18
|
+
const existingOwner = options.owners.get(options.codecId);
|
|
19
|
+
if (existingOwner !== void 0) throw new Error(`Duplicate ${options.entityLabel} for codecId "${options.codecId}". Descriptor "${options.descriptorId}" conflicts with "${existingOwner}". Each codecId can only have one ${options.entityOwnershipLabel}.`);
|
|
20
|
+
}
|
|
21
|
+
function extractCodecTypeImports(descriptors) {
|
|
22
|
+
const imports = [];
|
|
23
|
+
for (const descriptor of descriptors) {
|
|
24
|
+
const codecTypes = descriptor.types?.codecTypes;
|
|
25
|
+
if (codecTypes?.import) imports.push(codecTypes.import);
|
|
26
|
+
if (codecTypes?.typeImports) imports.push(...codecTypes.typeImports);
|
|
27
|
+
}
|
|
28
|
+
return imports;
|
|
29
|
+
}
|
|
30
|
+
function extractOperationTypeImports(descriptors) {
|
|
31
|
+
const imports = [];
|
|
32
|
+
for (const descriptor of descriptors) {
|
|
33
|
+
const operationTypes = descriptor.types?.operationTypes;
|
|
34
|
+
if (operationTypes?.import) imports.push(operationTypes.import);
|
|
35
|
+
}
|
|
36
|
+
return imports;
|
|
37
|
+
}
|
|
38
|
+
function extractQueryOperationTypeImports(descriptors) {
|
|
39
|
+
const imports = [];
|
|
40
|
+
for (const descriptor of descriptors) {
|
|
41
|
+
const queryOperationTypes = descriptor.types?.queryOperationTypes;
|
|
42
|
+
if (queryOperationTypes?.import) imports.push(queryOperationTypes.import);
|
|
43
|
+
}
|
|
44
|
+
return imports;
|
|
45
|
+
}
|
|
46
|
+
function extractComponentIds(family, target, adapter, extensions) {
|
|
47
|
+
const ids = [];
|
|
48
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49
|
+
addUniqueId(ids, seen, family.id);
|
|
50
|
+
addUniqueId(ids, seen, target.id);
|
|
51
|
+
if (adapter) addUniqueId(ids, seen, adapter.id);
|
|
52
|
+
for (const ext of extensions) addUniqueId(ids, seen, ext.id);
|
|
53
|
+
return ids;
|
|
54
|
+
}
|
|
55
|
+
function isTypeConstructorDescriptor(value) {
|
|
56
|
+
return typeof value === "object" && value !== null && value.kind === "typeConstructor";
|
|
57
|
+
}
|
|
58
|
+
function isFieldPresetDescriptor(value) {
|
|
59
|
+
return typeof value === "object" && value !== null && value.kind === "fieldPreset";
|
|
60
|
+
}
|
|
61
|
+
function mergeAuthoringNamespaces(target, source, path, leafGuard, label) {
|
|
62
|
+
const assertSafePath = (currentPath) => {
|
|
63
|
+
const blockedSegment = currentPath.find((segment) => segment === "__proto__" || segment === "constructor" || segment === "prototype");
|
|
64
|
+
if (blockedSegment) throw new Error(`Invalid authoring ${label} helper "${currentPath.join(".")}". Helper path segments must not use "${blockedSegment}".`);
|
|
65
|
+
};
|
|
66
|
+
for (const [key, sourceValue] of Object.entries(source)) {
|
|
67
|
+
const currentPath = [...path, key];
|
|
68
|
+
assertSafePath(currentPath);
|
|
69
|
+
const hasExistingValue = Object.hasOwn(target, key);
|
|
70
|
+
const existingValue = hasExistingValue ? target[key] : void 0;
|
|
71
|
+
if (!hasExistingValue) {
|
|
72
|
+
target[key] = sourceValue;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const existingIsLeaf = leafGuard(existingValue);
|
|
76
|
+
const sourceIsLeaf = leafGuard(sourceValue);
|
|
77
|
+
if (existingIsLeaf || sourceIsLeaf) throw new Error(`Duplicate authoring ${label} helper "${currentPath.join(".")}". Descriptor contributions must be unique across composed components.`);
|
|
78
|
+
mergeAuthoringNamespaces(existingValue, sourceValue, currentPath, leafGuard, label);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function assembleAuthoringContributions(descriptors) {
|
|
82
|
+
const field = {};
|
|
83
|
+
const type = {};
|
|
84
|
+
for (const descriptor of descriptors) {
|
|
85
|
+
if (descriptor.authoring?.field) mergeAuthoringNamespaces(field, descriptor.authoring.field, [], isFieldPresetDescriptor, "field");
|
|
86
|
+
if (!descriptor.authoring?.type) continue;
|
|
87
|
+
mergeAuthoringNamespaces(type, descriptor.authoring.type, [], isTypeConstructorDescriptor, "type");
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
field,
|
|
91
|
+
type
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function extractCodecLookup(descriptors) {
|
|
95
|
+
const byId = /* @__PURE__ */ new Map();
|
|
96
|
+
const owners = /* @__PURE__ */ new Map();
|
|
97
|
+
for (const descriptor of descriptors) {
|
|
98
|
+
const codecInstances = descriptor.types?.codecTypes?.codecInstances;
|
|
99
|
+
if (!codecInstances) continue;
|
|
100
|
+
const descriptorId = descriptor.id ?? "<unknown>";
|
|
101
|
+
for (const codec of codecInstances) {
|
|
102
|
+
assertUniqueCodecOwner({
|
|
103
|
+
codecId: codec.id,
|
|
104
|
+
owners,
|
|
105
|
+
descriptorId,
|
|
106
|
+
entityLabel: "codec instance",
|
|
107
|
+
entityOwnershipLabel: "codec instance provider"
|
|
108
|
+
});
|
|
109
|
+
owners.set(codec.id, descriptorId);
|
|
110
|
+
byId.set(codec.id, codec);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return { get: (id) => byId.get(id) };
|
|
114
|
+
}
|
|
115
|
+
function createControlStack(input) {
|
|
116
|
+
const { family, target, adapter, driver, extensionPacks = [] } = input;
|
|
117
|
+
const allDescriptors = [
|
|
118
|
+
family,
|
|
119
|
+
target,
|
|
120
|
+
...adapter ? [adapter] : [],
|
|
121
|
+
...extensionPacks
|
|
122
|
+
];
|
|
123
|
+
return {
|
|
124
|
+
family,
|
|
125
|
+
target,
|
|
126
|
+
adapter,
|
|
127
|
+
driver,
|
|
128
|
+
extensionPacks,
|
|
129
|
+
codecTypeImports: extractCodecTypeImports(allDescriptors),
|
|
130
|
+
operationTypeImports: extractOperationTypeImports(allDescriptors),
|
|
131
|
+
queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),
|
|
132
|
+
extensionIds: extractComponentIds(family, target, adapter, extensionPacks),
|
|
133
|
+
codecLookup: extractCodecLookup(allDescriptors),
|
|
134
|
+
authoringContributions: assembleAuthoringContributions(allDescriptors)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { assembleAuthoringContributions, assertUniqueCodecOwner, createControlStack, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports, hasMigrations, hasSchemaView };
|
|
140
|
+
//# sourceMappingURL=control.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.mjs","names":["imports: TypesImportSpec[]","ids: string[]"],"sources":["../src/control-capabilities.ts","../src/control-stack.ts"],"sourcesContent":["import type { ControlTargetDescriptor } from './control-descriptors';\nimport type { ControlFamilyInstance } from './control-instances';\nimport type { TargetMigrationsCapability } from './control-migration-types';\nimport type { CoreSchemaView } from './control-schema-view';\n\nexport interface MigratableTargetDescriptor<\n TFamilyId extends string,\n TTargetId extends string,\n TFamilyInstance extends ControlFamilyInstance<TFamilyId> = ControlFamilyInstance<TFamilyId>,\n> extends ControlTargetDescriptor<TFamilyId, TTargetId> {\n readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>;\n}\n\nexport function hasMigrations<TFamilyId extends string, TTargetId extends string>(\n target: ControlTargetDescriptor<TFamilyId, TTargetId>,\n): target is MigratableTargetDescriptor<TFamilyId, TTargetId> {\n return 'migrations' in target && !!(target as Record<string, unknown>)['migrations'];\n}\n\nexport interface SchemaViewCapable<TSchemaIR = unknown> {\n toSchemaView(schema: TSchemaIR): CoreSchemaView;\n}\n\nexport function hasSchemaView<TFamilyId extends string>(\n instance: ControlFamilyInstance<TFamilyId>,\n): instance is ControlFamilyInstance<TFamilyId> & SchemaViewCapable {\n return (\n 'toSchemaView' in instance &&\n typeof (instance as Record<string, unknown>)['toSchemaView'] === 'function'\n );\n}\n","import type { CodecLookup } from './codec-types';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from './control-descriptors';\nimport type {\n AuthoringContributions,\n AuthoringFieldNamespace,\n AuthoringFieldPresetDescriptor,\n AuthoringTypeConstructorDescriptor,\n AuthoringTypeNamespace,\n} from './framework-authoring';\nimport type { ComponentMetadata } from './framework-components';\nimport type { TypesImportSpec } from './types-import-spec';\n\nexport interface AssembledAuthoringContributions {\n readonly field: AuthoringFieldNamespace;\n readonly type: AuthoringTypeNamespace;\n}\n\nexport interface ControlStack<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly queryOperationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly codecLookup: CodecLookup;\n readonly authoringContributions: AssembledAuthoringContributions;\n}\n\nexport interface CreateControlStackInput<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks?:\n | ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>\n | undefined;\n}\n\nfunction addUniqueId(ids: string[], seen: Set<string>, id: string): void {\n if (!seen.has(id)) {\n ids.push(id);\n seen.add(id);\n }\n}\n\nexport function assertUniqueCodecOwner(options: {\n readonly codecId: string;\n readonly owners: Map<string, string>;\n readonly descriptorId: string;\n readonly entityLabel: string;\n readonly entityOwnershipLabel: string;\n}): void {\n const existingOwner = options.owners.get(options.codecId);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". ` +\n `Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". ` +\n `Each codecId can only have one ${options.entityOwnershipLabel}.`,\n );\n }\n}\n\nexport function extractCodecTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n if (codecTypes?.import) {\n imports.push(codecTypes.import);\n }\n if (codecTypes?.typeImports) {\n imports.push(...codecTypes.typeImports);\n }\n }\n\n return imports;\n}\n\nexport function extractOperationTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const operationTypes = descriptor.types?.operationTypes;\n if (operationTypes?.import) {\n imports.push(operationTypes.import);\n }\n }\n\n return imports;\n}\n\nexport function extractQueryOperationTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const queryOperationTypes = descriptor.types?.queryOperationTypes;\n if (queryOperationTypes?.import) {\n imports.push(queryOperationTypes.import);\n }\n }\n\n return imports;\n}\n\nexport function extractComponentIds(\n family: { readonly id: string },\n target: { readonly id: string },\n adapter: { readonly id: string } | undefined,\n extensions: ReadonlyArray<{ readonly id: string }>,\n): ReadonlyArray<string> {\n const ids: string[] = [];\n const seen = new Set<string>();\n\n addUniqueId(ids, seen, family.id);\n addUniqueId(ids, seen, target.id);\n if (adapter) {\n addUniqueId(ids, seen, adapter.id);\n }\n\n for (const ext of extensions) {\n addUniqueId(ids, seen, ext.id);\n }\n\n return ids;\n}\n\nfunction isTypeConstructorDescriptor(value: unknown): value is AuthoringTypeConstructorDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'typeConstructor'\n );\n}\n\nfunction isFieldPresetDescriptor(value: unknown): value is AuthoringFieldPresetDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'fieldPreset'\n );\n}\n\nfunction mergeAuthoringNamespaces(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n path: readonly string[],\n leafGuard: (value: unknown) => boolean,\n label: string,\n): void {\n const assertSafePath = (currentPath: readonly string[]) => {\n const blockedSegment = currentPath.find(\n (segment) => segment === '__proto__' || segment === 'constructor' || segment === 'prototype',\n );\n if (blockedSegment) {\n throw new Error(\n `Invalid authoring ${label} helper \"${currentPath.join('.')}\". Helper path segments must not use \"${blockedSegment}\".`,\n );\n }\n };\n\n for (const [key, sourceValue] of Object.entries(source)) {\n const currentPath = [...path, key];\n assertSafePath(currentPath);\n const hasExistingValue = Object.hasOwn(target, key);\n const existingValue = hasExistingValue ? target[key] : undefined;\n\n if (!hasExistingValue) {\n target[key] = sourceValue;\n continue;\n }\n\n const existingIsLeaf = leafGuard(existingValue);\n const sourceIsLeaf = leafGuard(sourceValue);\n\n if (existingIsLeaf || sourceIsLeaf) {\n throw new Error(\n `Duplicate authoring ${label} helper \"${currentPath.join('.')}\". Descriptor contributions must be unique across composed components.`,\n );\n }\n\n mergeAuthoringNamespaces(\n existingValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>,\n currentPath,\n leafGuard,\n label,\n );\n }\n}\n\nexport function assembleAuthoringContributions(\n descriptors: ReadonlyArray<{ readonly authoring?: AuthoringContributions }>,\n): AssembledAuthoringContributions {\n const field = {} as Record<string, unknown>;\n const type = {} as Record<string, unknown>;\n\n for (const descriptor of descriptors) {\n if (descriptor.authoring?.field) {\n mergeAuthoringNamespaces(\n field,\n descriptor.authoring.field,\n [],\n isFieldPresetDescriptor,\n 'field',\n );\n }\n if (!descriptor.authoring?.type) {\n continue;\n }\n mergeAuthoringNamespaces(\n type,\n descriptor.authoring.type,\n [],\n isTypeConstructorDescriptor,\n 'type',\n );\n }\n\n return {\n field: field as AuthoringFieldNamespace,\n type: type as AuthoringTypeNamespace,\n };\n}\n\nexport function extractCodecLookup(\n descriptors: ReadonlyArray<Pick<ComponentMetadata & { id?: string }, 'types' | 'id'>>,\n): CodecLookup {\n const byId = new Map<string, import('./codec-types').Codec>();\n const owners = new Map<string, string>();\n for (const descriptor of descriptors) {\n const codecInstances = descriptor.types?.codecTypes?.codecInstances;\n if (!codecInstances) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n for (const codec of codecInstances) {\n assertUniqueCodecOwner({\n codecId: codec.id,\n owners,\n descriptorId,\n entityLabel: 'codec instance',\n entityOwnershipLabel: 'codec instance provider',\n });\n owners.set(codec.id, descriptorId);\n byId.set(codec.id, codec);\n }\n }\n return { get: (id) => byId.get(id) };\n}\n\nexport function createControlStack<TFamilyId extends string, TTargetId extends string>(\n input: CreateControlStackInput<TFamilyId, TTargetId>,\n): ControlStack<TFamilyId, TTargetId> {\n const { family, target, adapter, driver, extensionPacks = [] } = input;\n\n const allDescriptors = [family, target, ...(adapter ? [adapter] : []), ...extensionPacks];\n\n return {\n family,\n target,\n adapter,\n driver,\n extensionPacks: extensionPacks as readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[],\n\n codecTypeImports: extractCodecTypeImports(allDescriptors),\n operationTypeImports: extractOperationTypeImports(allDescriptors),\n queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n extensionIds: extractComponentIds(family, target, adapter, extensionPacks),\n codecLookup: extractCodecLookup(allDescriptors),\n authoringContributions: assembleAuthoringContributions(allDescriptors),\n };\n}\n"],"mappings":";AAaA,SAAgB,cACd,QAC4D;AAC5D,QAAO,gBAAgB,UAAU,CAAC,CAAE,OAAmC;;AAOzE,SAAgB,cACd,UACkE;AAClE,QACE,kBAAkB,YAClB,OAAQ,SAAqC,oBAAoB;;;;;AC0BrE,SAAS,YAAY,KAAe,MAAmB,IAAkB;AACvE,KAAI,CAAC,KAAK,IAAI,GAAG,EAAE;AACjB,MAAI,KAAK,GAAG;AACZ,OAAK,IAAI,GAAG;;;AAIhB,SAAgB,uBAAuB,SAM9B;CACP,MAAM,gBAAgB,QAAQ,OAAO,IAAI,QAAQ,QAAQ;AACzD,KAAI,kBAAkB,OACpB,OAAM,IAAI,MACR,aAAa,QAAQ,YAAY,gBAAgB,QAAQ,QAAQ,iBAChD,QAAQ,aAAa,oBAAoB,cAAc,oCACpC,QAAQ,qBAAqB,GAClE;;AAIL,SAAgB,wBACd,aACgC;CAChC,MAAMA,UAA6B,EAAE;AAErC,MAAK,MAAM,cAAc,aAAa;EACpC,MAAM,aAAa,WAAW,OAAO;AACrC,MAAI,YAAY,OACd,SAAQ,KAAK,WAAW,OAAO;AAEjC,MAAI,YAAY,YACd,SAAQ,KAAK,GAAG,WAAW,YAAY;;AAI3C,QAAO;;AAGT,SAAgB,4BACd,aACgC;CAChC,MAAMA,UAA6B,EAAE;AAErC,MAAK,MAAM,cAAc,aAAa;EACpC,MAAM,iBAAiB,WAAW,OAAO;AACzC,MAAI,gBAAgB,OAClB,SAAQ,KAAK,eAAe,OAAO;;AAIvC,QAAO;;AAGT,SAAgB,iCACd,aACgC;CAChC,MAAMA,UAA6B,EAAE;AAErC,MAAK,MAAM,cAAc,aAAa;EACpC,MAAM,sBAAsB,WAAW,OAAO;AAC9C,MAAI,qBAAqB,OACvB,SAAQ,KAAK,oBAAoB,OAAO;;AAI5C,QAAO;;AAGT,SAAgB,oB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Ef,MAAK,MAAM,cAAc,aAAa;AACpC,MAAI,WAAW,WAAW,MACxB,0BACE,OACA,WAAW,UAAU,OACrB,EAAE,EACF,yBACA,QACD;AAEH,MAAI,CAAC,WAAW,WAAW,KACzB;AAEF,2BACE,MACA,WAAW,UAAU,MACrB,EAAE,EACF,6BACA,OACD;;AAGH,QAAO;EACE;EACD;EACP;;AAGH,SAAgB,mBACd,aACa;CACb,MAAM,uBAAO,IAAI,KAA4C;CAC7D,MAAM,yBAAS,IAAI,KAAqB;AACxC,MAAK,MAAM,cAAc,aAAa;EACpC,MAAM,iBAAiB,WAAW,OAAO,YAAY;AACrD,MAAI,CAAC,eAAgB;EACrB,MAAM,eAAe,WAAW,MAAM;AACtC,OAAK,MAAM,SAAS,gBAAgB;AAClC,0BAAuB;IACrB,SAAS,MAAM;IACf;IACA;IACA,aAAa;IACb,sBAAsB;IACvB,CAAC;AACF,UAAO,IAAI,MAAM,IAAI,aAAa;AAClC,QAAK,IAAI,MAAM,IAAI,MAAM;;;AAG7B,QAAO,EAAE,MAAM,OAAO,KAAK,IAAI,GAAG,EAAE;;AAGtC,SAAgB,mBACd,OACoC;CACpC,MAAM,EAAE,QAAQ,QAAQ,SAAS,QAAQ,iBAAiB,EAAE,KAAK;CAEjE,MAAM,iBAAiB;EAAC;EAAQ;EAAQ,GAAI,UAAU,CAAC,QAAQ,GAAG,EAAE;EAAG,GAAG;EAAe;AAEzF,QAAO;EACL;EACA;EACA;EACA;EACgB;EAEhB,kBAAkB,wBAAwB,eAAe;EACzD,sBAAsB,4BAA4B,eAAe;EACjE,2BAA2B,iCAAiC,eAAe;EAC3E,cAAc,oBAAoB,QAAQ,QAAQ,SAAS,eAAe;EAC1E,aAAa,mBAAmB,eAAe;EAC/C,wBAAwB,+BAA+B,eAAe;EACvE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
|
|
2
|
+
import { Contract, ContractModel } from "@prisma-next/contract/types";
|
|
3
|
+
|
|
4
|
+
//#region src/emission-types.d.ts
|
|
5
|
+
interface GenerateContractTypesOptions {
|
|
6
|
+
readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
7
|
+
}
|
|
8
|
+
interface ValidationContext {
|
|
9
|
+
readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
10
|
+
readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
11
|
+
readonly extensionIds?: ReadonlyArray<string>;
|
|
12
|
+
}
|
|
13
|
+
interface EmissionSpi {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
generateStorageType(contract: Contract, storageHashTypeName: string): string;
|
|
16
|
+
generateModelStorageType(modelName: string, model: ContractModel): string;
|
|
17
|
+
getFamilyImports(): string[];
|
|
18
|
+
getFamilyTypeAliases(options?: GenerateContractTypesOptions): string;
|
|
19
|
+
getTypeMapsExpression(): string;
|
|
20
|
+
getContractWrapper(contractBaseName: string, typeMapsName: string): string;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { GenerateContractTypesOptions as n, ValidationContext as r, EmissionSpi as t };
|
|
24
|
+
//# sourceMappingURL=emission-types-Dt9_NXRb.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emission-types-Dt9_NXRb.d.mts","names":[],"sources":["../src/emission-types.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,4BAAA;uCACsB,cAAc;AADrD;AAIiB,UAAA,iBAAA,CAAiB;EACU,SAAA,gBAAA,CAAA,EAAd,aAAc,CAAA,eAAA,CAAA;EAAd,SAAA,oBAAA,CAAA,EACI,aADJ,CACkB,eADlB,CAAA;EACkB,SAAA,YAAA,CAAA,EACtB,aADsB,CAAA,MAAA,CAAA;;AACtB,UAGT,WAAA,CAHS;EAAa,SAAA,EAAA,EAAA,MAAA;EAGtB,mBAAW,CAAA,QAAA,EAGI,QAHJ,EAAA,mBAAA,EAAA,MAAA,CAAA,EAAA,MAAA;EAGI,wBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,EAEqB,aAFrB,CAAA,EAAA,MAAA;EAEqB,gBAAA,EAAA,EAAA,MAAA,EAAA;EAIpB,oBAAA,CAAA,OAAA,CAAA,EAAA,4BAAA,CAAA,EAAA,MAAA;EAA4B,qBAAA,EAAA,EAAA,MAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
|
|
2
|
+
import { n as GenerateContractTypesOptions, r as ValidationContext, t as EmissionSpi } from "./emission-types-Dt9_NXRb.mjs";
|
|
3
|
+
export { type EmissionSpi, type GenerateContractTypesOptions, type TypesImportSpec, type ValidationContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, y as TargetDescriptor } from "./framework-components-W-TA8p5-.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/execution-instances.d.ts
|
|
4
|
+
interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {}
|
|
5
|
+
interface RuntimeTargetInstance<TFamilyId extends string, TTargetId extends string> extends TargetInstance<TFamilyId, TTargetId> {}
|
|
6
|
+
interface RuntimeAdapterInstance<TFamilyId extends string, TTargetId extends string> extends AdapterInstance<TFamilyId, TTargetId> {}
|
|
7
|
+
interface RuntimeDriverInstance<TFamilyId extends string, TTargetId extends string> extends DriverInstance<TFamilyId, TTargetId> {}
|
|
8
|
+
interface RuntimeExtensionInstance<TFamilyId extends string, TTargetId extends string> extends ExtensionInstance<TFamilyId, TTargetId> {}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/execution-descriptors.d.ts
|
|
11
|
+
interface RuntimeFamilyDescriptor<TFamilyId extends string, TFamilyInstance extends RuntimeFamilyInstance<TFamilyId> = RuntimeFamilyInstance<TFamilyId>> extends FamilyDescriptor<TFamilyId> {
|
|
12
|
+
create<TTargetId extends string>(options: {
|
|
13
|
+
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
|
|
14
|
+
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
|
|
15
|
+
readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
|
|
16
|
+
readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
|
|
17
|
+
}): TFamilyInstance;
|
|
18
|
+
}
|
|
19
|
+
interface RuntimeTargetDescriptor<TFamilyId extends string, TTargetId extends string, TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId> = RuntimeTargetInstance<TFamilyId, TTargetId>> extends TargetDescriptor<TFamilyId, TTargetId> {
|
|
20
|
+
create(): TTargetInstance;
|
|
21
|
+
}
|
|
22
|
+
interface RuntimeAdapterDescriptor<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<TFamilyId, TTargetId>> extends AdapterDescriptor<TFamilyId, TTargetId> {
|
|
23
|
+
create(): TAdapterInstance;
|
|
24
|
+
}
|
|
25
|
+
interface RuntimeDriverDescriptor<TFamilyId extends string, TTargetId extends string, TCreateOptions = void, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<TFamilyId, TTargetId>> extends DriverDescriptor<TFamilyId, TTargetId> {
|
|
26
|
+
create(options?: TCreateOptions): TDriverInstance;
|
|
27
|
+
}
|
|
28
|
+
interface RuntimeExtensionDescriptor<TFamilyId extends string, TTargetId extends string, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>> extends ExtensionDescriptor<TFamilyId, TTargetId> {
|
|
29
|
+
create(): TExtensionInstance;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/execution-requirements.d.ts
|
|
33
|
+
declare function assertRuntimeContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({
|
|
34
|
+
contract,
|
|
35
|
+
family,
|
|
36
|
+
target,
|
|
37
|
+
adapter,
|
|
38
|
+
extensionPacks
|
|
39
|
+
}: {
|
|
40
|
+
readonly contract: {
|
|
41
|
+
readonly target: string;
|
|
42
|
+
readonly extensionPacks?: Record<string, unknown>;
|
|
43
|
+
};
|
|
44
|
+
readonly family: RuntimeFamilyDescriptor<TFamilyId>;
|
|
45
|
+
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
|
|
46
|
+
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
|
|
47
|
+
readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
|
|
48
|
+
}): void;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/execution-stack.d.ts
|
|
51
|
+
interface ExecutionStack<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<TFamilyId, TTargetId>, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<TFamilyId, TTargetId>, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>> {
|
|
52
|
+
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
|
|
53
|
+
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>;
|
|
54
|
+
readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance> | undefined;
|
|
55
|
+
readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId, TExtensionInstance>[];
|
|
56
|
+
}
|
|
57
|
+
interface ExecutionStackInstance<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<TFamilyId, TTargetId>, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<TFamilyId, TTargetId>, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>> {
|
|
58
|
+
readonly stack: ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance>;
|
|
59
|
+
readonly target: RuntimeTargetInstance<TFamilyId, TTargetId>;
|
|
60
|
+
readonly adapter: TAdapterInstance;
|
|
61
|
+
readonly driver: TDriverInstance | undefined;
|
|
62
|
+
readonly extensionPacks: readonly TExtensionInstance[];
|
|
63
|
+
}
|
|
64
|
+
declare function createExecutionStack<TFamilyId extends string, TTargetId extends string, TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId>, TTargetDescriptor extends RuntimeTargetDescriptor<TFamilyId, TTargetId, TTargetInstance>, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>, TAdapterDescriptor extends RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<TFamilyId, TTargetId>, TDriverDescriptor extends RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance> | undefined = undefined, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>, TExtensionDescriptor extends RuntimeExtensionDescriptor<TFamilyId, TTargetId, TExtensionInstance> = never>(input: {
|
|
65
|
+
readonly target: TTargetDescriptor;
|
|
66
|
+
readonly adapter: TAdapterDescriptor;
|
|
67
|
+
readonly driver?: TDriverDescriptor | undefined;
|
|
68
|
+
readonly extensionPacks?: readonly TExtensionDescriptor[] | undefined;
|
|
69
|
+
}): ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance> & {
|
|
70
|
+
readonly target: TTargetDescriptor;
|
|
71
|
+
readonly adapter: TAdapterDescriptor;
|
|
72
|
+
readonly driver: TDriverDescriptor | undefined;
|
|
73
|
+
readonly extensionPacks: readonly TExtensionDescriptor[];
|
|
74
|
+
};
|
|
75
|
+
declare function instantiateExecutionStack<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId>, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId>>(stack: ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance>): ExecutionStackInstance<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance>;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { type ExecutionStack, type ExecutionStackInstance, type RuntimeAdapterDescriptor, type RuntimeAdapterInstance, type RuntimeDriverDescriptor, type RuntimeDriverInstance, type RuntimeExtensionDescriptor, type RuntimeExtensionInstance, type RuntimeFamilyDescriptor, type RuntimeFamilyInstance, type RuntimeTargetDescriptor, type RuntimeTargetInstance, assertRuntimeContractRequirementsSatisfied, createExecutionStack, instantiateExecutionStack };
|
|
78
|
+
//# sourceMappingURL=execution.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.mts","names":[],"sources":["../src/execution-instances.ts","../src/execution-descriptors.ts","../src/execution-requirements.ts","../src/execution-stack.ts"],"sourcesContent":[],"mappings":";;;UAQiB,wDACP,eAAe;AADR,UAGA,qBAHqB,CAAA,kBACb,MAAf,EAAA,kBAAc,MAAA,CAAA,SAGd,cAHc,CAGC,SAHD,EAGY,SAHZ,CAAA,CAAA,CAExB;AACyB,UAER,sBAFQ,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,SAGf,eAHe,CAGC,SAHD,EAGY,SAHZ,CAAA,CAAA;AAAf,UAKO,qBALP,CAAA,kBAAA,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} from "./framework-components-Bl3SLyGG.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/execution-requirements.ts
|
|
4
|
+
function assertRuntimeContractRequirementsSatisfied({ contract, family, target, adapter, extensionPacks }) {
|
|
5
|
+
const providedComponentIds = new Set([
|
|
6
|
+
family.id,
|
|
7
|
+
target.id,
|
|
8
|
+
adapter.id
|
|
9
|
+
]);
|
|
10
|
+
for (const extension of extensionPacks) providedComponentIds.add(extension.id);
|
|
11
|
+
const result = checkContractComponentRequirements({
|
|
12
|
+
contract,
|
|
13
|
+
expectedTargetId: target.targetId,
|
|
14
|
+
providedComponentIds
|
|
15
|
+
});
|
|
16
|
+
if (result.targetMismatch) throw new Error(`Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`);
|
|
17
|
+
for (const packId of result.missingExtensionPackIds) throw new Error(`Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/execution-stack.ts
|
|
22
|
+
function createExecutionStack(input) {
|
|
23
|
+
return {
|
|
24
|
+
target: input.target,
|
|
25
|
+
adapter: input.adapter,
|
|
26
|
+
driver: input.driver,
|
|
27
|
+
extensionPacks: input.extensionPacks ?? []
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function instantiateExecutionStack(stack) {
|
|
31
|
+
const driver = stack.driver ? stack.driver.create() : void 0;
|
|
32
|
+
return {
|
|
33
|
+
stack,
|
|
34
|
+
target: stack.target.create(),
|
|
35
|
+
adapter: stack.adapter.create(),
|
|
36
|
+
driver,
|
|
37
|
+
extensionPacks: stack.extensionPacks.map((descriptor) => descriptor.create())
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { assertRuntimeContractRequirementsSatisfied, createExecutionStack, instantiateExecutionStack };
|
|
43
|
+
//# sourceMappingURL=execution.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.mjs","names":[],"sources":["../src/execution-requirements.ts","../src/execution-stack.ts"],"sourcesContent":["import type {\n RuntimeAdapterDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from './execution-descriptors';\nimport { checkContractComponentRequirements } from './framework-components';\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 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 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","import type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeTargetDescriptor,\n} from './execution-descriptors';\nimport type {\n RuntimeAdapterInstance,\n RuntimeDriverInstance,\n RuntimeExtensionInstance,\n RuntimeTargetInstance,\n} from './execution-instances';\n\nexport interface ExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n> {\n readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>;\n readonly driver:\n | RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance>\n | undefined;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<\n TFamilyId,\n TTargetId,\n TExtensionInstance\n >[];\n}\n\nexport interface ExecutionStackInstance<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n> {\n readonly stack: ExecutionStack<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n >;\n readonly target: RuntimeTargetInstance<TFamilyId, TTargetId>;\n readonly adapter: TAdapterInstance;\n readonly driver: TDriverInstance | undefined;\n readonly extensionPacks: readonly TExtensionInstance[];\n}\n\nexport function createExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId>,\n TTargetDescriptor extends RuntimeTargetDescriptor<TFamilyId, TTargetId, TTargetInstance>,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>,\n TAdapterDescriptor extends RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<\n TFamilyId,\n TTargetId\n >,\n TDriverDescriptor extends\n | RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance>\n | undefined = undefined,\n TExtensionInstance extends RuntimeExtensionInstance<\n TFamilyId,\n TTargetId\n > = RuntimeExtensionInstance<TFamilyId, TTargetId>,\n TExtensionDescriptor extends RuntimeExtensionDescriptor<\n TFamilyId,\n TTargetId,\n TExtensionInstance\n > = never,\n>(input: {\n readonly target: TTargetDescriptor;\n readonly adapter: TAdapterDescriptor;\n readonly driver?: TDriverDescriptor | undefined;\n readonly extensionPacks?: readonly TExtensionDescriptor[] | undefined;\n}): ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance> & {\n readonly target: TTargetDescriptor;\n readonly adapter: TAdapterDescriptor;\n readonly driver: TDriverDescriptor | undefined;\n readonly extensionPacks: readonly TExtensionDescriptor[];\n} {\n return {\n target: input.target,\n adapter: input.adapter,\n driver: input.driver,\n extensionPacks: input.extensionPacks ?? [],\n };\n}\n\nexport function instantiateExecutionStack<\n TFamilyId extends string,\n TTargetId extends string,\n TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId>,\n TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId>,\n TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId>,\n>(\n stack: ExecutionStack<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n >,\n): ExecutionStackInstance<\n TFamilyId,\n TTargetId,\n TAdapterInstance,\n TDriverInstance,\n TExtensionInstance\n> {\n const driver = stack.driver ? stack.driver.create() : undefined;\n\n return {\n stack,\n target: stack.target.create(),\n adapter: stack.adapter.create(),\n driver,\n extensionPacks: stack.extensionPacks.map((descriptor) => descriptor.create()),\n };\n}\n"],"mappings":";;;AAQA,SAAgB,2CAGd,EACA,UACA,QACA,QACA,SACA,kBAOO;CACP,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;AAGH,MAAK,MAAM,UAAU,OAAO,wBAC1B,OAAM,IAAI,MACR,qCAAqC,OAAO,iEAC7C;;;;;AC0BL,SAAgB,qBAuBd,OAUA;AACA,QAAO;EACL,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,gBAAgB,MAAM,kBAAkB,EAAE;EAC3C;;AAGH,SAAgB,0BAOd,OAaA;CACA,MAAM,SAAS,MAAM,SAAS,MAAM,OAAO,QAAQ,GAAG;AAEtD,QAAO;EACL;EACA,QAAQ,MAAM,OAAO,QAAQ;EAC7B,SAAS,MAAM,QAAQ,QAAQ;EAC/B;EACA,gBAAgB,MAAM,eAAe,KAAK,eAAe,WAAW,QAAQ,CAAC;EAC9E"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region src/framework-authoring.d.ts
|
|
2
|
+
type AuthoringArgRef = {
|
|
3
|
+
readonly kind: 'arg';
|
|
4
|
+
readonly index: number;
|
|
5
|
+
readonly path?: readonly string[];
|
|
6
|
+
readonly default?: AuthoringTemplateValue;
|
|
7
|
+
};
|
|
8
|
+
type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | readonly AuthoringTemplateValue[] | {
|
|
9
|
+
readonly [key: string]: AuthoringTemplateValue;
|
|
10
|
+
};
|
|
11
|
+
type AuthoringArgumentDescriptor = {
|
|
12
|
+
readonly kind: 'string';
|
|
13
|
+
readonly optional?: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'number';
|
|
16
|
+
readonly optional?: boolean;
|
|
17
|
+
readonly integer?: boolean;
|
|
18
|
+
readonly minimum?: number;
|
|
19
|
+
readonly maximum?: number;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'stringArray';
|
|
22
|
+
readonly optional?: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'object';
|
|
25
|
+
readonly optional?: boolean;
|
|
26
|
+
readonly properties: Record<string, AuthoringArgumentDescriptor>;
|
|
27
|
+
};
|
|
28
|
+
interface AuthoringStorageTypeTemplate {
|
|
29
|
+
readonly codecId: string;
|
|
30
|
+
readonly nativeType: AuthoringTemplateValue;
|
|
31
|
+
readonly typeParams?: Record<string, AuthoringTemplateValue>;
|
|
32
|
+
}
|
|
33
|
+
interface AuthoringTypeConstructorDescriptor {
|
|
34
|
+
readonly kind: 'typeConstructor';
|
|
35
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
36
|
+
readonly output: AuthoringStorageTypeTemplate;
|
|
37
|
+
}
|
|
38
|
+
interface AuthoringColumnDefaultTemplateLiteral {
|
|
39
|
+
readonly kind: 'literal';
|
|
40
|
+
readonly value: AuthoringTemplateValue;
|
|
41
|
+
}
|
|
42
|
+
interface AuthoringColumnDefaultTemplateFunction {
|
|
43
|
+
readonly kind: 'function';
|
|
44
|
+
readonly expression: AuthoringTemplateValue;
|
|
45
|
+
}
|
|
46
|
+
type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction;
|
|
47
|
+
interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {
|
|
48
|
+
readonly nullable?: boolean;
|
|
49
|
+
readonly default?: AuthoringColumnDefaultTemplate;
|
|
50
|
+
readonly executionDefault?: AuthoringTemplateValue;
|
|
51
|
+
readonly id?: boolean;
|
|
52
|
+
readonly unique?: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface AuthoringFieldPresetDescriptor {
|
|
55
|
+
readonly kind: 'fieldPreset';
|
|
56
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
57
|
+
readonly output: AuthoringFieldPresetOutput;
|
|
58
|
+
}
|
|
59
|
+
type AuthoringTypeNamespace = {
|
|
60
|
+
readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;
|
|
61
|
+
};
|
|
62
|
+
type AuthoringFieldNamespace = {
|
|
63
|
+
readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;
|
|
64
|
+
};
|
|
65
|
+
interface AuthoringContributions {
|
|
66
|
+
readonly type?: AuthoringTypeNamespace;
|
|
67
|
+
readonly field?: AuthoringFieldNamespace;
|
|
68
|
+
}
|
|
69
|
+
declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef;
|
|
70
|
+
declare function isAuthoringTypeConstructorDescriptor(value: unknown): value is AuthoringTypeConstructorDescriptor;
|
|
71
|
+
declare function isAuthoringFieldPresetDescriptor(value: unknown): value is AuthoringFieldPresetDescriptor;
|
|
72
|
+
declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue, args: readonly unknown[]): unknown;
|
|
73
|
+
declare function validateAuthoringHelperArguments(helperPath: string, descriptors: readonly AuthoringArgumentDescriptor[] | undefined, args: readonly unknown[]): void;
|
|
74
|
+
declare function instantiateAuthoringTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor, args: readonly unknown[]): {
|
|
75
|
+
readonly codecId: string;
|
|
76
|
+
readonly nativeType: string;
|
|
77
|
+
readonly typeParams?: Record<string, unknown>;
|
|
78
|
+
};
|
|
79
|
+
declare function instantiateAuthoringFieldPreset(descriptor: AuthoringFieldPresetDescriptor, args: readonly unknown[]): {
|
|
80
|
+
readonly descriptor: {
|
|
81
|
+
readonly codecId: string;
|
|
82
|
+
readonly nativeType: string;
|
|
83
|
+
readonly typeParams?: Record<string, unknown>;
|
|
84
|
+
};
|
|
85
|
+
readonly nullable: boolean;
|
|
86
|
+
readonly default?: {
|
|
87
|
+
readonly kind: 'literal';
|
|
88
|
+
readonly value: unknown;
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: 'function';
|
|
91
|
+
readonly expression: string;
|
|
92
|
+
};
|
|
93
|
+
readonly executionDefault?: unknown;
|
|
94
|
+
readonly id: boolean;
|
|
95
|
+
readonly unique: boolean;
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { resolveAuthoringTemplateValue as _, AuthoringFieldNamespace as a, AuthoringStorageTypeTemplate as c, AuthoringTypeNamespace as d, instantiateAuthoringFieldPreset as f, isAuthoringTypeConstructorDescriptor as g, isAuthoringFieldPresetDescriptor as h, AuthoringContributions as i, AuthoringTemplateValue as l, isAuthoringArgRef as m, AuthoringArgumentDescriptor as n, AuthoringFieldPresetDescriptor as o, instantiateAuthoringTypeConstructor as p, AuthoringColumnDefaultTemplate as r, AuthoringFieldPresetOutput as s, AuthoringArgRef as t, AuthoringTypeConstructorDescriptor as u, validateAuthoringHelperArguments as v };
|
|
99
|
+
//# sourceMappingURL=framework-authoring-BybjSfF5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-authoring-BybjSfF5.d.mts","names":[],"sources":["../src/framework-authoring.ts"],"sourcesContent":[],"mappings":";KAEY,eAAA;EAAA,SAAA,IAAA,EAAA,KAAe;EAOf,SAAA,KAAA,EAAA,MAAA;EAKR,SAAA,IAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EACS,SAAA,OAAA,CAAA,EATQ,sBASR;CACiB;AAAsB,KAPxC,sBAAA,GAOwC,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAFhD,eAEgD,GAAA,SADvC,sBACuC,EAAA,GAAA;EAExC,UAAA,GAAA,EAAA,MAAA,CAAA,EAFkB,sBAqBY;AAG1C,CAAA;AAEuB,KAxBX,2BAAA,GAwBW;EACgB,SAAA,IAAA,EAAA,QAAA;EAAf,SAAA,QAAA,CAAA,EAAA,OAAA;CAAM,GAAA;EAGb,SAAA,IAAA,EAAA,QAAA;EAMA,SAAA,QAAA,CAAA,EAAA,OAAA;EAKA,SAAA,OAAA,CAAA,EAAA,OAAA;EAKL,SAAA,OAAA,CAAA,EAAA,MAAA;EAIK,SAAA,OAAA,CAAA,EAAA,MAAA;CAEI,GAAA;EACS,SAAA,IAAA,EAAA,aAAA;EAHsB,SAAA,QAAA,CAAA,EAAA,OAAA;CAA4B,GAAA;EAQ/D,SAAA,IAAA,EAAA,QAAA;EAML,SAAA,QAAA,CAAA,EAAA,OAAsB;EAItB,SAAA,UAAA,EA/Ce,MA+CQ,CAAA,MAAA,EA/CO,2BAgDf,CAAA;AAG3B,CAAA;AAKgB,UArDC,4BAAA,CAqD2C;EAkB5C,SAAA,OAAA,EAAA,MAAA;EAYA,SAAA,UAAA,EAjFO,sBAiFyB;EAYhC,SAAA,UAAA,CAAA,EA5FQ,MA4FR,CAAA,MAA6B,EA5FN,sBA6F3B,CAAA;AA2GZ;AAuFgB,UA5RC,kCAAA,CA4RkC;EAWnC,SAAA,IAAA,EAAA,iBAAA;2BArSW;mBACR;;UAGF,qCAAA;;kBAEC;;UAGD,sCAAA;;uBAEM;;KAGX,8BAAA,GACR,wCACA;UAEa,0BAAA,SAAmC;;qBAE/B;8BACS;;;;UAKb,8BAAA;;2BAEU;mBACR;;KAGP,sBAAA;2BACe,qCAAqC;;KAGpD,uBAAA;2BACe,iCAAiC;;UAG3C,sBAAA;kBACC;mBACC;;iBAGH,iBAAA,2BAA4C;iBAkB5C,oCAAA,2BAEJ;iBAUI,gCAAA,2BAEJ;iBAUI,6BAAA,WACJ;iBA2GI,gCAAA,2CAEQ;iBAqFR,mCAAA,aACF;;;wBAKU;;iBAKR,+BAAA,aACF;;;;0BAMY"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/framework-components.ts
|
|
2
|
+
function checkContractComponentRequirements(input) {
|
|
3
|
+
const providedIds = /* @__PURE__ */ new Set();
|
|
4
|
+
for (const id of input.providedComponentIds) providedIds.add(id);
|
|
5
|
+
const missingExtensionPackIds = (input.contract.extensionPacks ? Object.keys(input.contract.extensionPacks) : []).filter((id) => !providedIds.has(id));
|
|
6
|
+
const expectedTargetFamily = input.expectedTargetFamily;
|
|
7
|
+
const contractTargetFamily = input.contract.targetFamily;
|
|
8
|
+
const familyMismatch = expectedTargetFamily !== void 0 && contractTargetFamily !== void 0 && contractTargetFamily !== expectedTargetFamily ? {
|
|
9
|
+
expected: expectedTargetFamily,
|
|
10
|
+
actual: contractTargetFamily
|
|
11
|
+
} : void 0;
|
|
12
|
+
const expectedTargetId = input.expectedTargetId;
|
|
13
|
+
const contractTargetId = input.contract.target;
|
|
14
|
+
const targetMismatch = expectedTargetId !== void 0 && contractTargetId !== expectedTargetId ? {
|
|
15
|
+
expected: expectedTargetId,
|
|
16
|
+
actual: contractTargetId
|
|
17
|
+
} : void 0;
|
|
18
|
+
return {
|
|
19
|
+
...familyMismatch ? { familyMismatch } : {},
|
|
20
|
+
...targetMismatch ? { targetMismatch } : {},
|
|
21
|
+
missingExtensionPackIds
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { checkContractComponentRequirements as t };
|
|
27
|
+
//# sourceMappingURL=framework-components-Bl3SLyGG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-components-Bl3SLyGG.mjs","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":["import type { Codec } from './codec-types';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { TypesImportSpec } from './types-import-spec';\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\n * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);\n * keep these declarations in sync. Targets are identifiers/descriptors and typically do not\n * declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n /**\n * Base codec types import spec.\n * Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Additional type-only imports for parameterized codec branded types.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as\n * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId.\n * Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec instances contributed by this component.\n * Used to build a CodecLookup for codec-dispatched type rendering during emission.\n */\n readonly codecInstances?: ReadonlyArray<Codec>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly queryOperationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because\n * they contain only declarative metadata. Higher-level authoring packages may\n * project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\n * the component and provide its metadata. This interface is extended by\n * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type.\n * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',\n * but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics\n * (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets\n * (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\n * (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation\n * details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference.\n * Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target.\n * Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with\n * any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target.\n * Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible\n * adapter. Multiple drivers can exist for the same target (e.g., node-postgres\n * vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the\n * config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";AAiHA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAK,MAAM,MAAM,MAAM,qBACrB,aAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD;AAEN,QAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
|