🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/framework-components

Package Overview
Dependencies
Maintainers
3
Versions
470
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/framework-components - npm Package Compare versions

Comparing version
0.0.1
to
0.3.0-dev.146
+2
dist/authoring.d.mts
import { _ as resolveAuthoringTemplateValue, a as AuthoringFieldNamespace, c as AuthoringStorageTypeTemplate, d as AuthoringTypeNamespace, f as instantiateAuthoringFieldPreset, g as isAuthoringTypeConstructorDescriptor, h as isAuthoringFieldPresetDescriptor, i as AuthoringContributions, l as AuthoringTemplateValue, m as isAuthoringArgRef, n as AuthoringArgumentDescriptor, o as AuthoringFieldPresetDescriptor, p as instantiateAuthoringTypeConstructor, r as AuthoringColumnDefaultTemplate, s as AuthoringFieldPresetOutput, t as AuthoringArgRef, u as AuthoringTypeConstructorDescriptor, v as validateAuthoringHelperArguments } from "./framework-authoring-BybjSfF5.mjs";
export { type AuthoringArgRef, type AuthoringArgumentDescriptor, type AuthoringColumnDefaultTemplate, type AuthoringContributions, type AuthoringFieldNamespace, type AuthoringFieldPresetDescriptor, type AuthoringFieldPresetOutput, type AuthoringStorageTypeTemplate, type AuthoringTemplateValue, type AuthoringTypeConstructorDescriptor, type AuthoringTypeNamespace, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, resolveAuthoringTemplateValue, validateAuthoringHelperArguments };
import { ifDefined } from "@prisma-next/utils/defined";
//#region src/framework-authoring.ts
function isAuthoringArgRef(value) {
if (typeof value !== "object" || value === null || value.kind !== "arg") return false;
const { index, path } = value;
if (typeof index !== "number" || !Number.isInteger(index) || index < 0) return false;
if (path !== void 0 && (!Array.isArray(path) || path.some((s) => typeof s !== "string"))) return false;
return true;
}
function isAuthoringTemplateRecord(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function isAuthoringTypeConstructorDescriptor(value) {
return typeof value === "object" && value !== null && value.kind === "typeConstructor" && typeof value.output === "object" && value.output !== null;
}
function isAuthoringFieldPresetDescriptor(value) {
return typeof value === "object" && value !== null && value.kind === "fieldPreset" && typeof value.output === "object" && value.output !== null;
}
function resolveAuthoringTemplateValue(template, args) {
if (isAuthoringArgRef(template)) {
let value = args[template.index];
for (const segment of template.path ?? []) {
if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {
value = void 0;
break;
}
value = value[segment];
}
if (value === void 0 && template.default !== void 0) return resolveAuthoringTemplateValue(template.default, args);
return value;
}
if (Array.isArray(template)) return template.map((value) => resolveAuthoringTemplateValue(value, args));
if (typeof template === "object" && template !== null) {
const resolved = {};
for (const [key, value] of Object.entries(template)) {
const resolvedValue = resolveAuthoringTemplateValue(value, args);
if (resolvedValue !== void 0) resolved[key] = resolvedValue;
}
return resolved;
}
return template;
}
function validateAuthoringArgument(descriptor, value, path) {
if (value === void 0) {
if (descriptor.optional) return;
throw new Error(`Missing required authoring helper argument at ${path}`);
}
if (descriptor.kind === "string") {
if (typeof value !== "string") throw new Error(`Authoring helper argument at ${path} must be a string`);
return;
}
if (descriptor.kind === "stringArray") {
if (!Array.isArray(value)) throw new Error(`Authoring helper argument at ${path} must be an array of strings`);
for (const entry of value) if (typeof entry !== "string") throw new Error(`Authoring helper argument at ${path} must be an array of strings`);
return;
}
if (descriptor.kind === "object") {
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`Authoring helper argument at ${path} must be an object`);
const input = value;
const expectedKeys = new Set(Object.keys(descriptor.properties));
for (const key of Object.keys(input)) if (!expectedKeys.has(key)) throw new Error(`Authoring helper argument at ${path} contains unknown property "${key}"`);
for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);
return;
}
if (typeof value !== "number" || Number.isNaN(value)) throw new Error(`Authoring helper argument at ${path} must be a number`);
if (descriptor.integer && !Number.isInteger(value)) throw new Error(`Authoring helper argument at ${path} must be an integer`);
if (descriptor.minimum !== void 0 && value < descriptor.minimum) throw new Error(`Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`);
if (descriptor.maximum !== void 0 && value > descriptor.maximum) throw new Error(`Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`);
}
function validateAuthoringHelperArguments(helperPath, descriptors, args) {
const expected = descriptors ?? [];
const minimumArgs = expected.reduce((count, descriptor, index) => descriptor.optional ? count : index + 1, 0);
if (args.length < minimumArgs || args.length > expected.length) throw new Error(`${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`);
expected.forEach((descriptor, index) => {
validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);
});
}
function resolveAuthoringStorageTypeTemplate(template, args) {
const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);
if (typeof nativeType !== "string") throw new Error(`Resolved authoring nativeType must be a string for codec "${template.codecId}", received ${String(nativeType)}`);
const typeParams = template.typeParams === void 0 ? void 0 : resolveAuthoringTemplateValue(template.typeParams, args);
if (typeParams !== void 0 && !isAuthoringTemplateRecord(typeParams)) throw new Error(`Resolved authoring typeParams must be an object for codec "${template.codecId}", received ${String(typeParams)}`);
return {
codecId: template.codecId,
nativeType,
...typeParams === void 0 ? {} : { typeParams }
};
}
function resolveAuthoringColumnDefaultTemplate(template, args) {
if (template.kind === "literal") {
const value = resolveAuthoringTemplateValue(template.value, args);
if (value === void 0) throw new Error("Resolved authoring literal default must not be undefined");
return {
kind: "literal",
value
};
}
const expression = resolveAuthoringTemplateValue(template.expression, args);
if (expression === void 0 || typeof expression === "object" && expression !== null) throw new Error(`Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`);
return {
kind: "function",
expression: String(expression)
};
}
function instantiateAuthoringTypeConstructor(descriptor, args) {
return resolveAuthoringStorageTypeTemplate(descriptor.output, args);
}
function instantiateAuthoringFieldPreset(descriptor, args) {
return {
descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),
nullable: descriptor.output.nullable ?? false,
...ifDefined("default", descriptor.output.default !== void 0 ? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args) : void 0),
...ifDefined("executionDefault", descriptor.output.executionDefault !== void 0 ? resolveAuthoringTemplateValue(descriptor.output.executionDefault, args) : void 0),
id: descriptor.output.id ?? false,
unique: descriptor.output.unique ?? false
};
}
//#endregion
export { instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, resolveAuthoringTemplateValue, validateAuthoringHelperArguments };
//# sourceMappingURL=authoring.mjs.map
{"version":3,"file":"authoring.mjs","names":["resolved: Record<string, unknown>"],"sources":["../src/framework-authoring.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\n\nexport type AuthoringArgRef = {\n readonly kind: 'arg';\n readonly index: number;\n readonly path?: readonly string[];\n readonly default?: AuthoringTemplateValue;\n};\n\nexport type AuthoringTemplateValue =\n | string\n | number\n | boolean\n | null\n | AuthoringArgRef\n | readonly AuthoringTemplateValue[]\n | { readonly [key: string]: AuthoringTemplateValue };\n\nexport type AuthoringArgumentDescriptor =\n | {\n readonly kind: 'string';\n readonly optional?: boolean;\n }\n | {\n readonly kind: 'number';\n readonly optional?: boolean;\n readonly integer?: boolean;\n readonly minimum?: number;\n readonly maximum?: number;\n }\n | {\n readonly kind: 'stringArray';\n readonly optional?: boolean;\n }\n | {\n readonly kind: 'object';\n readonly optional?: boolean;\n readonly properties: Record<string, AuthoringArgumentDescriptor>;\n };\n\nexport interface AuthoringStorageTypeTemplate {\n readonly codecId: string;\n readonly nativeType: AuthoringTemplateValue;\n readonly typeParams?: Record<string, AuthoringTemplateValue>;\n}\n\nexport interface AuthoringTypeConstructorDescriptor {\n readonly kind: 'typeConstructor';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringStorageTypeTemplate;\n}\n\nexport interface AuthoringColumnDefaultTemplateLiteral {\n readonly kind: 'literal';\n readonly value: AuthoringTemplateValue;\n}\n\nexport interface AuthoringColumnDefaultTemplateFunction {\n readonly kind: 'function';\n readonly expression: AuthoringTemplateValue;\n}\n\nexport type AuthoringColumnDefaultTemplate =\n | AuthoringColumnDefaultTemplateLiteral\n | AuthoringColumnDefaultTemplateFunction;\n\nexport interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {\n readonly nullable?: boolean;\n readonly default?: AuthoringColumnDefaultTemplate;\n readonly executionDefault?: AuthoringTemplateValue;\n readonly id?: boolean;\n readonly unique?: boolean;\n}\n\nexport interface AuthoringFieldPresetDescriptor {\n readonly kind: 'fieldPreset';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringFieldPresetOutput;\n}\n\nexport type AuthoringTypeNamespace = {\n readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;\n};\n\nexport type AuthoringFieldNamespace = {\n readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;\n};\n\nexport interface AuthoringContributions {\n readonly type?: AuthoringTypeNamespace;\n readonly field?: AuthoringFieldNamespace;\n}\n\nexport function isAuthoringArgRef(value: unknown): value is AuthoringArgRef {\n if (typeof value !== 'object' || value === null || (value as { kind?: unknown }).kind !== 'arg') {\n return false;\n }\n const { index, path } = value as { index?: unknown; path?: unknown };\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {\n return false;\n }\n if (path !== undefined && (!Array.isArray(path) || path.some((s) => typeof s !== 'string'))) {\n return false;\n }\n return true;\n}\n\nfunction isAuthoringTemplateRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function isAuthoringTypeConstructorDescriptor(\n value: unknown,\n): value is AuthoringTypeConstructorDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'typeConstructor' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\nexport function isAuthoringFieldPresetDescriptor(\n value: unknown,\n): value is AuthoringFieldPresetDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'fieldPreset' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\nexport function resolveAuthoringTemplateValue(\n template: AuthoringTemplateValue,\n args: readonly unknown[],\n): unknown {\n if (isAuthoringArgRef(template)) {\n let value = args[template.index];\n\n for (const segment of template.path ?? []) {\n if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n\n if (value === undefined && template.default !== undefined) {\n return resolveAuthoringTemplateValue(template.default, args);\n }\n\n return value;\n }\n if (Array.isArray(template)) {\n return template.map((value) => resolveAuthoringTemplateValue(value, args));\n }\n if (typeof template === 'object' && template !== null) {\n const resolved: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(template)) {\n const resolvedValue = resolveAuthoringTemplateValue(value, args);\n if (resolvedValue !== undefined) {\n resolved[key] = resolvedValue;\n }\n }\n return resolved;\n }\n return template;\n}\n\nfunction validateAuthoringArgument(\n descriptor: AuthoringArgumentDescriptor,\n value: unknown,\n path: string,\n): void {\n if (value === undefined) {\n if (descriptor.optional) {\n return;\n }\n throw new Error(`Missing required authoring helper argument at ${path}`);\n }\n\n if (descriptor.kind === 'string') {\n if (typeof value !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be a string`);\n }\n return;\n }\n\n if (descriptor.kind === 'stringArray') {\n if (!Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n for (const entry of value) {\n if (typeof entry !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n }\n return;\n }\n\n if (descriptor.kind === 'object') {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an object`);\n }\n\n const input = value as Record<string, unknown>;\n const expectedKeys = new Set(Object.keys(descriptor.properties));\n\n for (const key of Object.keys(input)) {\n if (!expectedKeys.has(key)) {\n throw new Error(`Authoring helper argument at ${path} contains unknown property \"${key}\"`);\n }\n }\n\n for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) {\n validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);\n }\n\n return;\n }\n\n if (typeof value !== 'number' || Number.isNaN(value)) {\n throw new Error(`Authoring helper argument at ${path} must be a number`);\n }\n\n if (descriptor.integer && !Number.isInteger(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an integer`);\n }\n if (descriptor.minimum !== undefined && value < descriptor.minimum) {\n throw new Error(\n `Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`,\n );\n }\n if (descriptor.maximum !== undefined && value > descriptor.maximum) {\n throw new Error(\n `Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`,\n );\n }\n}\n\nexport function validateAuthoringHelperArguments(\n helperPath: string,\n descriptors: readonly AuthoringArgumentDescriptor[] | undefined,\n args: readonly unknown[],\n): void {\n const expected = descriptors ?? [];\n const minimumArgs = expected.reduce(\n (count, descriptor, index) => (descriptor.optional ? count : index + 1),\n 0,\n );\n if (args.length < minimumArgs || args.length > expected.length) {\n throw new Error(\n `${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`,\n );\n }\n\n expected.forEach((descriptor, index) => {\n validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);\n });\n}\n\nfunction resolveAuthoringStorageTypeTemplate(\n template: AuthoringStorageTypeTemplate,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);\n if (typeof nativeType !== 'string') {\n throw new Error(\n `Resolved authoring nativeType must be a string for codec \"${template.codecId}\", received ${String(nativeType)}`,\n );\n }\n const typeParams =\n template.typeParams === undefined\n ? undefined\n : resolveAuthoringTemplateValue(template.typeParams, args);\n if (typeParams !== undefined && !isAuthoringTemplateRecord(typeParams)) {\n throw new Error(\n `Resolved authoring typeParams must be an object for codec \"${template.codecId}\", received ${String(typeParams)}`,\n );\n }\n\n return {\n codecId: template.codecId,\n nativeType,\n ...(typeParams === undefined ? {} : { typeParams }),\n };\n}\n\nfunction resolveAuthoringColumnDefaultTemplate(\n template: AuthoringColumnDefaultTemplate,\n args: readonly unknown[],\n):\n | {\n readonly kind: 'literal';\n readonly value: unknown;\n }\n | {\n readonly kind: 'function';\n readonly expression: string;\n } {\n if (template.kind === 'literal') {\n const value = resolveAuthoringTemplateValue(template.value, args);\n if (value === undefined) {\n throw new Error('Resolved authoring literal default must not be undefined');\n }\n return {\n kind: 'literal',\n value,\n };\n }\n\n const expression = resolveAuthoringTemplateValue(template.expression, args);\n if (expression === undefined || (typeof expression === 'object' && expression !== null)) {\n throw new Error(\n `Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`,\n );\n }\n return {\n kind: 'function',\n expression: String(expression),\n };\n}\n\nexport function instantiateAuthoringTypeConstructor(\n descriptor: AuthoringTypeConstructorDescriptor,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n return resolveAuthoringStorageTypeTemplate(descriptor.output, args);\n}\n\nexport function instantiateAuthoringFieldPreset(\n descriptor: AuthoringFieldPresetDescriptor,\n args: readonly unknown[],\n): {\n readonly descriptor: {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n };\n readonly nullable: boolean;\n readonly default?:\n | {\n readonly kind: 'literal';\n readonly value: unknown;\n }\n | {\n readonly kind: 'function';\n readonly expression: string;\n };\n readonly executionDefault?: unknown;\n readonly id: boolean;\n readonly unique: boolean;\n} {\n return {\n descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),\n nullable: descriptor.output.nullable ?? false,\n ...ifDefined(\n 'default',\n descriptor.output.default !== undefined\n ? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args)\n : undefined,\n ),\n ...ifDefined(\n 'executionDefault',\n descriptor.output.executionDefault !== undefined\n ? resolveAuthoringTemplateValue(descriptor.output.executionDefault, args)\n : undefined,\n ),\n id: descriptor.output.id ?? false,\n unique: descriptor.output.unique ?? false,\n };\n}\n"],"mappings":";;;AA6FA,SAAgB,kBAAkB,OAA0C;AAC1E,KAAI,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,MACxF,QAAO;CAET,MAAM,EAAE,OAAO,SAAS;AACxB,KAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,MAAM,IAAI,QAAQ,EACnE,QAAO;AAET,KAAI,SAAS,WAAc,CAAC,MAAM,QAAQ,KAAK,IAAI,KAAK,MAAM,MAAM,OAAO,MAAM,SAAS,EACxF,QAAO;AAET,QAAO;;AAGT,SAAS,0BAA0B,OAAkD;AACnF,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,qCACd,OAC6C;AAC7C,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,qBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;;AAI/C,SAAgB,iCACd,OACyC;AACzC,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,iBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;;AAI/C,SAAgB,8BACd,UACA,MACS;AACT,KAAI,kBAAkB,SAAS,EAAE;EAC/B,IAAI,QAAQ,KAAK,SAAS;AAE1B,OAAK,MAAM,WAAW,SAAS,QAAQ,EAAE,EAAE;AACzC,OAAI,CAAC,0BAA0B,MAAM,IAAI,CAAC,OAAO,OAAO,OAAO,QAAQ,EAAE;AACvE,YAAQ;AACR;;AAEF,WAAS,M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CAAC,0BAA0B,WAAW,CACpE,OAAM,IAAI,MACR,8DAA8D,SAAS,QAAQ,cAAc,OAAO,WAAW,GAChH;AAGH,QAAO;EACL,SAAS,SAAS;EAClB;EACA,GAAI,eAAe,SAAY,EAAE,GAAG,EAAE,YAAY;EACnD;;AAGH,SAAS,sCACP,UACA,MASI;AACJ,KAAI,SAAS,SAAS,WAAW;EAC/B,MAAM,QAAQ,8BAA8B,SAAS,OAAO,KAAK;AACjE,MAAI,UAAU,OACZ,OAAM,IAAI,MAAM,2DAA2D;AAE7E,SAAO;GACL,MAAM;GACN;GACD;;CAGH,MAAM,aAAa,8BAA8B,SAAS,YAAY,KAAK;AAC3E,KAAI,eAAe,UAAc,OAAO,eAAe,YAAY,eAAe,KAChF,OAAM,IAAI,MACR,wFAAwF,OAAO,WAAW,GAC3G;AAEH,QAAO;EACL,MAAM;EACN,YAAY,OAAO,WAAW;EAC/B;;AAGH,SAAgB,oCACd,YACA,MAKA;AACA,QAAO,oCAAoC,WAAW,QAAQ,KAAK;;AAGrE,SAAgB,gCACd,YACA,MAoBA;AACA,QAAO;EACL,YAAY,oCAAoC,WAAW,QAAQ,KAAK;EACxE,UAAU,WAAW,OAAO,YAAY;EACxC,GAAG,UACD,WACA,WAAW,OAAO,YAAY,SAC1B,sCAAsC,WAAW,OAAO,SAAS,KAAK,GACtE,OACL;EACD,GAAG,UACD,oBACA,WAAW,OAAO,qBAAqB,SACnC,8BAA8B,WAAW,OAAO,kBAAkB,KAAK,GACvE,OACL;EACD,IAAI,WAAW,OAAO,MAAM;EAC5B,QAAQ,WAAW,OAAO,UAAU;EACrC"}
import { JsonValue } from "@prisma-next/contract/types";
//#region src/codec-types.d.ts
type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';
/**
* Base codec interface for all target families.
*
* A codec maps between three representations of a value:
* - **JS** (`TJs`): the JavaScript type used in application code
* - **Wire** (`TWire`): the format sent to/from the database driver
* - **JSON** (`JsonValue`): the JSON-safe form stored in contract artifacts
*
* Family-specific codec interfaces (SQL `Codec`, Mongo `MongoCodec`) extend
* this base to add family-specific metadata.
*/
interface Codec<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TJs = unknown> {
/** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). */
readonly id: Id;
/** Database-native type names this codec handles (e.g. `['timestamptz']`). */
readonly targetTypes: readonly string[];
/** Semantic traits for operator gating (e.g. equality, order, numeric). */
readonly traits?: TTraits;
/** Converts a JS value to the wire format expected by the database driver. Optional when the driver accepts the JS type directly. */
encode?(value: TJs): TWire;
/** Converts a wire value from the database driver into the JS type. */
decode(wire: TWire): TJs;
/** Converts a JS value to a JSON-safe representation for contract serialization. Called during contract emission. */
encodeJson(value: TJs): JsonValue;
/** Converts a JSON representation back to the JS type. Called during contract loading via `validateContract`. */
decodeJson(json: JsonValue): TJs;
/** Produces the TypeScript output type expression for a field given its `typeParams`. Used during contract.d.ts emission. */
renderOutputType?(typeParams: Record<string, unknown>): string | undefined;
}
interface CodecLookup {
get(id: string): Codec | undefined;
}
declare const emptyCodecLookup: CodecLookup;
//#endregion
export { emptyCodecLookup as i, CodecLookup as n, CodecTrait as r, Codec as t };
//# sourceMappingURL=codec-types-D9ixsdxw.d.mts.map
{"version":3,"file":"codec-types-D9ixsdxw.d.mts","names":[],"sources":["../src/codec-types.ts"],"sourcesContent":[],"mappings":";;;KAEY,UAAA;;AAAZ;AAaA;;;;;;;;;AAiBoB,UAjBH,KAiBG,CAAA,WAAA,MAAA,GAAA,MAAA,EAAA,gBAAA,SAfO,UAeP,EAAA,GAAA,SAf+B,UAe/B,EAAA,EAAA,QAAA,OAAA,EAAA,MAAA,OAAA,CAAA,CAAA;EAAM;EAEP,SAAA,EAAA,EAZJ,EAYI;EAAY;EAEC,SAAA,WAAA,EAAA,SAAA,MAAA,EAAA;EAAM;EAGrB,SAAA,MAAW,CAAA,EAbR,OAaQ;EAIf;iBAfI,MAAM;;eAER,QAAQ;;oBAEH,MAAM;;mBAEP,YAAY;;gCAEC;;UAGf,WAAA;mBACE;;cAGN,kBAAkB"}
import { i as emptyCodecLookup, n as CodecLookup, r as CodecTrait, t as Codec } from "./codec-types-D9ixsdxw.mjs";
export { type Codec, type CodecLookup, type CodecTrait, emptyCodecLookup };
//#region src/codec-types.ts
const emptyCodecLookup = { get: () => void 0 };
//#endregion
export { emptyCodecLookup };
//# sourceMappingURL=codec.mjs.map
{"version":3,"file":"codec.mjs","names":["emptyCodecLookup: CodecLookup"],"sources":["../src/codec-types.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\n\nexport type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';\n\n/**\n * Base codec interface for all target families.\n *\n * A codec maps between three representations of a value:\n * - **JS** (`TJs`): the JavaScript type used in application code\n * - **Wire** (`TWire`): the format sent to/from the database driver\n * - **JSON** (`JsonValue`): the JSON-safe form stored in contract artifacts\n *\n * Family-specific codec interfaces (SQL `Codec`, Mongo `MongoCodec`) extend\n * this base to add family-specific metadata.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TJs = unknown,\n> {\n /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). */\n readonly id: Id;\n /** Database-native type names this codec handles (e.g. `['timestamptz']`). */\n readonly targetTypes: readonly string[];\n /** Semantic traits for operator gating (e.g. equality, order, numeric). */\n readonly traits?: TTraits;\n /** Converts a JS value to the wire format expected by the database driver. Optional when the driver accepts the JS type directly. */\n encode?(value: TJs): TWire;\n /** Converts a wire value from the database driver into the JS type. */\n decode(wire: TWire): TJs;\n /** Converts a JS value to a JSON-safe representation for contract serialization. Called during contract emission. */\n encodeJson(value: TJs): JsonValue;\n /** Converts a JSON representation back to the JS type. Called during contract loading via `validateContract`. */\n decodeJson(json: JsonValue): TJs;\n /** Produces the TypeScript output type expression for a field given its `typeParams`. Used during contract.d.ts emission. */\n renderOutputType?(typeParams: Record<string, unknown>): string | undefined;\n}\n\nexport interface CodecLookup {\n get(id: string): Codec | undefined;\n}\n\nexport const emptyCodecLookup: CodecLookup = {\n get: () => undefined,\n};\n"],"mappings":";AA2CA,MAAaA,mBAAgC,EAC3C,WAAW,QACZ"}
import { S as checkContractComponentRequirements, _ as PackRefBase, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, g as FamilyPackRef, h as FamilyInstance, i as ComponentDescriptor, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, o as ContractComponentRequirementsCheckInput, p as ExtensionPackRef, r as AdapterPackRef, s as ContractComponentRequirementsCheckResult, t as AdapterDescriptor, u as DriverPackRef, v as TargetBoundComponentDescriptor, x as TargetPackRef, y as TargetDescriptor } from "./framework-components-W-TA8p5-.mjs";
export { type AdapterDescriptor, type AdapterInstance, type AdapterPackRef, type ComponentDescriptor, type ComponentMetadata, type ContractComponentRequirementsCheckInput, type ContractComponentRequirementsCheckResult, type DriverDescriptor, type DriverInstance, type DriverPackRef, type ExtensionDescriptor, type ExtensionInstance, type ExtensionPackRef, type FamilyDescriptor, type FamilyInstance, type FamilyPackRef, type PackRefBase, type TargetBoundComponentDescriptor, type TargetDescriptor, type TargetInstance, type TargetPackRef, checkContractComponentRequirements };
import { t as checkContractComponentRequirements } from "./framework-components-Bl3SLyGG.mjs";
export { checkContractComponentRequirements };
import { a as AuthoringFieldNamespace, d as AuthoringTypeNamespace, i as AuthoringContributions } from "./framework-authoring-BybjSfF5.mjs";
import { n as CodecLookup } from "./codec-types-D9ixsdxw.mjs";
import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
import { a as ComponentMetadata, 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, v as TargetBoundComponentDescriptor, y as TargetDescriptor } from "./framework-components-W-TA8p5-.mjs";
import { t as EmissionSpi } from "./emission-types-Dt9_NXRb.mjs";
import { Contract, ContractMarkerRecord } from "@prisma-next/contract/types";
import { Result } from "@prisma-next/utils/result";
//#region src/control-result-types.d.ts
interface OperationContext {
readonly contractPath?: string;
readonly configPath?: string;
readonly meta?: Readonly<Record<string, unknown>>;
}
interface VerifyDatabaseResult {
readonly ok: boolean;
readonly code?: string;
readonly summary: string;
readonly contract: {
readonly storageHash: string;
readonly profileHash?: string;
};
readonly marker?: {
readonly storageHash?: string;
readonly profileHash?: string;
};
readonly target: {
readonly expected: string;
readonly actual?: string;
};
readonly missingCodecs?: readonly string[];
readonly codecCoverageSkipped?: boolean;
readonly meta?: {
readonly configPath?: string;
readonly contractPath: string;
};
readonly timings: {
readonly total: number;
};
}
interface SchemaIssue {
readonly kind: 'missing_table' | 'missing_column' | 'extra_table' | 'extra_column' | 'extra_primary_key' | 'extra_foreign_key' | 'extra_unique_constraint' | 'extra_index' | 'type_mismatch' | 'type_missing' | 'type_values_mismatch' | 'nullability_mismatch' | 'primary_key_mismatch' | 'foreign_key_mismatch' | 'unique_constraint_mismatch' | 'index_mismatch' | 'dependency_missing' | 'default_missing' | 'default_mismatch' | 'extra_default';
readonly table?: string;
readonly column?: string;
readonly indexOrConstraint?: string;
readonly typeName?: string;
readonly expected?: string;
readonly actual?: string;
readonly message: string;
}
interface SchemaVerificationNode {
readonly status: 'pass' | 'warn' | 'fail';
readonly kind: string;
readonly name: string;
readonly contractPath: string;
readonly code: string;
readonly message: string;
readonly expected: unknown;
readonly actual: unknown;
readonly children: readonly SchemaVerificationNode[];
}
interface VerifyDatabaseSchemaResult {
readonly ok: boolean;
readonly code?: string;
readonly summary: string;
readonly contract: {
readonly storageHash: string;
readonly profileHash?: string;
};
readonly target: {
readonly expected: string;
readonly actual?: string;
};
readonly schema: {
readonly issues: readonly SchemaIssue[];
readonly root: SchemaVerificationNode;
readonly counts: {
readonly pass: number;
readonly warn: number;
readonly fail: number;
readonly totalNodes: number;
};
};
readonly meta?: {
readonly configPath?: string;
readonly contractPath?: string;
readonly strict: boolean;
};
readonly timings: {
readonly total: number;
};
}
interface EmitContractResult {
readonly contractJson: string;
readonly contractDts: string;
readonly storageHash: string;
readonly executionHash?: string;
readonly profileHash: string;
}
interface IntrospectSchemaResult<TSchemaIR> {
readonly ok: true;
readonly summary: string;
readonly target: {
readonly familyId: string;
readonly id: string;
};
readonly schema: TSchemaIR;
readonly meta?: {
readonly configPath?: string;
readonly dbUrl?: string;
};
readonly timings: {
readonly total: number;
};
}
interface SignDatabaseResult {
readonly ok: boolean;
readonly summary: string;
readonly contract: {
readonly storageHash: string;
readonly profileHash?: string;
};
readonly target: {
readonly expected: string;
readonly actual?: string;
};
readonly marker: {
readonly created: boolean;
readonly updated: boolean;
readonly previous?: {
readonly storageHash?: string;
readonly profileHash?: string;
};
};
readonly meta?: {
readonly configPath?: string;
readonly contractPath: string;
};
readonly timings: {
readonly total: number;
};
}
//#endregion
//#region src/control-instances.d.ts
interface ControlFamilyInstance<TFamilyId extends string, TSchemaIR = unknown> extends FamilyInstance<TFamilyId> {
validateContract(contractJson: unknown): Contract;
verify(options: {
readonly driver: ControlDriverInstance<TFamilyId, string>;
readonly contract: unknown;
readonly expectedTargetId: string;
readonly contractPath: string;
readonly configPath?: string;
}): Promise<VerifyDatabaseResult>;
schemaVerify(options: {
readonly driver: ControlDriverInstance<TFamilyId, string>;
readonly contract: unknown;
readonly strict: boolean;
readonly contractPath: string;
readonly configPath?: string;
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, string>>;
}): Promise<VerifyDatabaseSchemaResult>;
sign(options: {
readonly driver: ControlDriverInstance<TFamilyId, string>;
readonly contract: unknown;
readonly contractPath: string;
readonly configPath?: string;
}): Promise<SignDatabaseResult>;
readMarker(options: {
readonly driver: ControlDriverInstance<TFamilyId, string>;
}): Promise<ContractMarkerRecord | null>;
introspect(options: {
readonly driver: ControlDriverInstance<TFamilyId, string>;
readonly contract?: unknown;
}): Promise<TSchemaIR>;
}
interface ControlTargetInstance<TFamilyId extends string, TTargetId extends string> extends TargetInstance<TFamilyId, TTargetId> {}
interface ControlAdapterInstance<TFamilyId extends string, TTargetId extends string> extends AdapterInstance<TFamilyId, TTargetId> {}
interface ControlDriverInstance<TFamilyId extends string, TTargetId extends string> extends DriverInstance<TFamilyId, TTargetId> {
query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<{
readonly rows: Row[];
}>;
close(): Promise<void>;
}
interface ControlExtensionInstance<TFamilyId extends string, TTargetId extends string> extends ExtensionInstance<TFamilyId, TTargetId> {}
//#endregion
//#region src/control-stack.d.ts
interface AssembledAuthoringContributions {
readonly field: AuthoringFieldNamespace;
readonly type: AuthoringTypeNamespace;
}
interface ControlStack<TFamilyId extends string = string, TTargetId extends string = string> {
readonly family: ControlFamilyDescriptor<TFamilyId>;
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;
readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;
readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];
readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;
readonly operationTypeImports: ReadonlyArray<TypesImportSpec>;
readonly queryOperationTypeImports: ReadonlyArray<TypesImportSpec>;
readonly extensionIds: ReadonlyArray<string>;
readonly codecLookup: CodecLookup;
readonly authoringContributions: AssembledAuthoringContributions;
}
interface CreateControlStackInput<TFamilyId extends string = string, TTargetId extends string = string> {
readonly family: ControlFamilyDescriptor<TFamilyId>;
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;
readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;
readonly extensionPacks?: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>> | undefined;
}
declare function assertUniqueCodecOwner(options: {
readonly codecId: string;
readonly owners: Map<string, string>;
readonly descriptorId: string;
readonly entityLabel: string;
readonly entityOwnershipLabel: string;
}): void;
declare function extractCodecTypeImports(descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>): ReadonlyArray<TypesImportSpec>;
declare function extractOperationTypeImports(descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>): ReadonlyArray<TypesImportSpec>;
declare function extractQueryOperationTypeImports(descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>): ReadonlyArray<TypesImportSpec>;
declare function extractComponentIds(family: {
readonly id: string;
}, target: {
readonly id: string;
}, adapter: {
readonly id: string;
} | undefined, extensions: ReadonlyArray<{
readonly id: string;
}>): ReadonlyArray<string>;
declare function assembleAuthoringContributions(descriptors: ReadonlyArray<{
readonly authoring?: AuthoringContributions;
}>): AssembledAuthoringContributions;
declare function extractCodecLookup(descriptors: ReadonlyArray<Pick<ComponentMetadata & {
id?: string;
}, 'types' | 'id'>>): CodecLookup;
declare function createControlStack<TFamilyId extends string, TTargetId extends string>(input: CreateControlStackInput<TFamilyId, TTargetId>): ControlStack<TFamilyId, TTargetId>;
//#endregion
//#region src/control-descriptors.d.ts
interface ControlFamilyDescriptor<TFamilyId extends string, TFamilyInstance extends ControlFamilyInstance<TFamilyId> = ControlFamilyInstance<TFamilyId>> extends FamilyDescriptor<TFamilyId> {
readonly emission: EmissionSpi;
create<TTargetId extends string>(stack: ControlStack<TFamilyId, TTargetId>): TFamilyInstance;
}
interface ControlTargetDescriptor<TFamilyId extends string, TTargetId extends string, TTargetInstance extends ControlTargetInstance<TFamilyId, TTargetId> = ControlTargetInstance<TFamilyId, TTargetId>> extends TargetDescriptor<TFamilyId, TTargetId> {
create(): TTargetInstance;
}
interface ControlAdapterDescriptor<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends ControlAdapterInstance<TFamilyId, TTargetId> = ControlAdapterInstance<TFamilyId, TTargetId>> extends AdapterDescriptor<TFamilyId, TTargetId> {
create(): TAdapterInstance;
}
interface ControlDriverDescriptor<TFamilyId extends string, TTargetId extends string, TDriverInstance extends ControlDriverInstance<TFamilyId, TTargetId> = ControlDriverInstance<TFamilyId, TTargetId>, TConnection = string> extends DriverDescriptor<TFamilyId, TTargetId> {
create(connection: TConnection): Promise<TDriverInstance>;
}
interface ControlExtensionDescriptor<TFamilyId extends string, TTargetId extends string, TExtensionInstance extends ControlExtensionInstance<TFamilyId, TTargetId> = ControlExtensionInstance<TFamilyId, TTargetId>> extends ExtensionDescriptor<TFamilyId, TTargetId> {
create(): TExtensionInstance;
}
//#endregion
//#region src/control-migration-types.d.ts
/**
* Migration operation classes define the safety level of an operation.
* - 'additive': Adds new structures without modifying existing ones (safe)
* - 'widening': Relaxes constraints or expands types (generally safe)
* - 'destructive': Removes or alters existing structures (potentially unsafe)
*/
type MigrationOperationClass = 'additive' | 'widening' | 'destructive';
/**
* Policy defining which operation classes are allowed during a migration.
*/
interface MigrationOperationPolicy {
readonly allowedOperationClasses: readonly MigrationOperationClass[];
}
/**
* A single migration operation for display purposes.
* Contains only the fields needed for CLI output (tree view, JSON envelope).
*/
interface MigrationPlanOperation {
/** Unique identifier for this operation (e.g., "table.users.create"). */
readonly id: string;
/** Human-readable label for display in UI/CLI (e.g., "Create table users"). */
readonly label: string;
/** The class of operation (additive, widening, destructive). */
readonly operationClass: MigrationOperationClass;
}
/**
* A migration plan for display purposes.
* Contains only the fields needed for CLI output (summary, JSON envelope).
*/
interface MigrationPlan {
/** The target ID this plan is for (e.g., 'postgres'). */
readonly targetId: string;
/**
* Origin contract identity that the plan expects the database to currently be at.
* If omitted or null, the runner skips origin validation entirely.
*/
readonly origin?: {
readonly storageHash: string;
readonly profileHash?: string;
} | null;
/** Destination contract identity that the plan intends to reach. */
readonly destination: {
readonly storageHash: string;
readonly profileHash?: string;
};
/** Ordered list of operations to execute. */
readonly operations: readonly MigrationPlanOperation[];
}
/**
* A conflict detected during migration planning.
*/
interface MigrationPlannerConflict {
/** Kind of conflict (e.g., 'typeMismatch', 'nullabilityConflict'). */
readonly kind: string;
/** Human-readable summary of the conflict. */
readonly summary: string;
/** Optional explanation of why this conflict occurred. */
readonly why?: string;
}
/**
* Successful planner result with the migration plan.
*/
interface MigrationPlannerSuccessResult {
readonly kind: 'success';
readonly plan: MigrationPlan;
}
/**
* Failed planner result with the list of conflicts.
*/
interface MigrationPlannerFailureResult {
readonly kind: 'failure';
readonly conflicts: readonly MigrationPlannerConflict[];
}
/**
* Union type for planner results.
*/
type MigrationPlannerResult = MigrationPlannerSuccessResult | MigrationPlannerFailureResult;
/**
* Success value for migration runner execution.
*/
interface MigrationRunnerSuccessValue {
readonly operationsPlanned: number;
readonly operationsExecuted: number;
}
/**
* Failure details for migration runner execution.
*/
interface MigrationRunnerFailure {
/** Error code for the failure. */
readonly code: string;
/** Human-readable summary of the failure. */
readonly summary: string;
/** Optional explanation of why the failure occurred. */
readonly why?: string;
/** Optional metadata for debugging and UX (e.g., schema issues, SQL state). */
readonly meta?: Record<string, unknown>;
}
/**
* Result type for migration runner execution.
*/
type MigrationRunnerResult = Result<MigrationRunnerSuccessValue, MigrationRunnerFailure>;
/**
* Execution-time checks configuration for migration runners.
* All checks default to `true` (enabled) when omitted.
*/
interface MigrationRunnerExecutionChecks {
/**
* Whether to run prechecks before executing operations.
* Defaults to `true` (prechecks are run).
*/
readonly prechecks?: boolean;
/**
* Whether to run postchecks after executing operations.
* Defaults to `true` (postchecks are run).
*/
readonly postchecks?: boolean;
/**
* Whether to run idempotency probe (check if postcheck is already satisfied before execution).
* Defaults to `true` (idempotency probe is run).
*/
readonly idempotencyChecks?: boolean;
}
/**
* Migration planner interface for planning schema changes.
* This is the minimal interface that CLI commands use.
*
* @template TFamilyId - The family ID (e.g., 'sql', 'document')
* @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
*/
interface MigrationPlanner<TFamilyId extends string = string, TTargetId extends string = string> {
plan(options: {
readonly contract: unknown;
readonly schema: unknown;
readonly policy: MigrationOperationPolicy;
/**
* Active framework components participating in this composition.
* Families/targets can interpret this list to derive family-specific metadata.
* All components must have matching familyId and targetId.
*/
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
}): MigrationPlannerResult;
}
/**
* Migration runner interface for executing migration plans.
* This is the minimal interface that CLI commands use.
*
* @template TFamilyId - The family ID (e.g., 'sql', 'document')
* @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
*/
interface MigrationRunner<TFamilyId extends string = string, TTargetId extends string = string> {
execute(options: {
readonly plan: MigrationPlan;
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
readonly destinationContract: unknown;
readonly policy: MigrationOperationPolicy;
readonly callbacks?: {
onOperationStart?(op: MigrationPlanOperation): void;
onOperationComplete?(op: MigrationPlanOperation): void;
};
/**
* Execution-time checks configuration.
* All checks default to `true` (enabled) when omitted.
*/
readonly executionChecks?: MigrationRunnerExecutionChecks;
/**
* Active framework components participating in this composition.
* Families/targets can interpret this list to derive family-specific metadata.
* All components must have matching familyId and targetId.
*/
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
}): Promise<MigrationRunnerResult>;
}
/**
* Optional capability interface for targets that support migrations.
* Targets that implement migrations expose this via their descriptor.
*
* @template TFamilyId - The family ID (e.g., 'sql', 'document')
* @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
* @template TFamilyInstance - The family instance type (e.g., SqlControlFamilyInstance)
*/
interface TargetMigrationsCapability<TFamilyId extends string = string, TTargetId extends string = string, TFamilyInstance extends ControlFamilyInstance<TFamilyId> = ControlFamilyInstance<TFamilyId>> {
createPlanner(family: TFamilyInstance): MigrationPlanner<TFamilyId, TTargetId>;
createRunner(family: TFamilyInstance): MigrationRunner<TFamilyId, TTargetId>;
/**
* Synthesizes a family-specific schema IR from a contract for offline planning.
* The returned schema can be passed to `planner.plan({ schema })` as the "from" state.
*
* @param contract - The contract to convert, or null for a new project (empty schema).
* @param frameworkComponents - Active framework components, used to derive database
* dependencies (e.g. extensions) that should be reflected in the schema IR.
* @returns Family-specific schema IR (e.g., `SqlSchemaIR` for SQL targets).
*/
contractToSchema(contract: Contract | null, frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>): unknown;
}
//#endregion
//#region src/control-schema-view.d.ts
/**
* Core schema view types for family-agnostic schema visualization.
*
* These types provide a minimal, generic, tree-shaped representation of schemas
* across families, designed for CLI visualization and lightweight tooling.
*
* Families can optionally project their family-specific Schema IR into this
* core view via the `toSchemaView` method on `FamilyInstance`.
*
* ## Example: SQL Family Mapping
*
* For the SQL family, `SqlSchemaIR` can be mapped to `CoreSchemaView` as follows:
*
* ```ts
* // SqlSchemaIR structure:
* // {
* // tables: { user: { columns: {...}, primaryKey: {...}, ... }, ... },
* // dependencies: [{ id: 'postgres.extension.vector' }],
* // annotations: {...}
* // }
*
* // CoreSchemaView mapping:
* // {
* // root: {
* // kind: 'root',
* // id: 'sql-schema',
* // label: 'sql schema (tables: 2)',
* // children: [
* // {
* // kind: 'entity',
* // id: 'table-user',
* // label: 'table user',
* // meta: { primaryKey: ['id'], ... },
* // children: [
* // {
* // kind: 'field',
* // id: 'column-id',
* // label: 'id: int4 (pg/int4@1, not null)',
* // meta: { nativeType: 'int4', codecId: 'pg/int4@1', nullable: false, ... }
* // },
* // {
* // kind: 'index',
* // id: 'index-user-email',
* // label: 'index user_email_unique',
* // meta: { columns: ['email'], unique: true, ... }
* // }
* // ]
* // },
* // {
* // kind: 'dependency',
* // id: 'dependency-postgres.extension.pgvector',
* // label: 'pgvector extension is enabled',
* // meta: { ... }
* // }
* // ]
* // }
* // }
* ```
*
* This mapping demonstrates that the core view types are expressive enough
* to represent SQL schemas without being SQL-specific.
*/
/**
* Node kinds for schema tree nodes.
* Designed to be generic enough for SQL, document, KV, and future families.
*/
type SchemaNodeKind = 'root' | 'namespace' | 'collection' | 'entity' | 'field' | 'index' | 'dependency';
/**
* A node in the schema tree.
* Tree-shaped structure good for Command Tree-style CLI output.
*/
interface SchemaTreeNode {
readonly kind: SchemaNodeKind;
readonly id: string;
readonly label: string;
readonly meta?: Record<string, unknown>;
readonly children?: readonly SchemaTreeNode[];
}
/**
* Core schema view providing a family-agnostic tree representation of a schema.
* Used by CLI and cross-family tooling for visualization.
*/
interface CoreSchemaView {
readonly root: SchemaTreeNode;
}
//#endregion
//#region src/control-capabilities.d.ts
interface MigratableTargetDescriptor<TFamilyId extends string, TTargetId extends string, TFamilyInstance extends ControlFamilyInstance<TFamilyId> = ControlFamilyInstance<TFamilyId>> extends ControlTargetDescriptor<TFamilyId, TTargetId> {
readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>;
}
declare function hasMigrations<TFamilyId extends string, TTargetId extends string>(target: ControlTargetDescriptor<TFamilyId, TTargetId>): target is MigratableTargetDescriptor<TFamilyId, TTargetId>;
interface SchemaViewCapable<TSchemaIR = unknown> {
toSchemaView(schema: TSchemaIR): CoreSchemaView;
}
declare function hasSchemaView<TFamilyId extends string>(instance: ControlFamilyInstance<TFamilyId>): instance is ControlFamilyInstance<TFamilyId> & SchemaViewCapable;
//#endregion
export { type AssembledAuthoringContributions, type ControlAdapterDescriptor, type ControlAdapterInstance, type ControlDriverDescriptor, type ControlDriverInstance, type ControlExtensionDescriptor, type ControlExtensionInstance, type ControlFamilyDescriptor, type ControlFamilyInstance, type ControlStack, type ControlTargetDescriptor, type ControlTargetInstance, type CoreSchemaView, type CreateControlStackInput, type EmitContractResult, type IntrospectSchemaResult, type MigratableTargetDescriptor, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerFailureResult, type MigrationPlannerResult, type MigrationPlannerSuccessResult, type MigrationRunner, type MigrationRunnerExecutionChecks, type MigrationRunnerFailure, type MigrationRunnerResult, type MigrationRunnerSuccessValue, type OperationContext, type SchemaIssue, type SchemaNodeKind, type SchemaTreeNode, type SchemaVerificationNode, type SchemaViewCapable, type SignDatabaseResult, type TargetMigrationsCapability, type VerifyDatabaseResult, type VerifyDatabaseSchemaResult, assembleAuthoringContributions, assertUniqueCodecOwner, createControlStack, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports, hasMigrations, hasSchemaView };
//# sourceMappingURL=control.d.mts.map
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/control-result-types.ts","../src/control-instances.ts","../src/control-stack.ts","../src/control-descriptors.ts","../src/control-migration-types.ts","../src/control-schema-view.ts","../src/control-capabilities.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAAiB,gBAAA;;;kBAGC,SAAS;;UAGV,oBAAA;;;;EANA,SAAA,QAAA,EAAgB;IAMhB,SAAA,WAAoB,EAAA,MAAA;IA2BpB,SAAA,WAAW,CAAA,EAAA,MAAA;EA+BX,CAAA;EAYA,SAAA,MAAA,CAAA,EAAA;IAgCA,SAAA,WAAkB,CAAA,EAAA,MAAA;IAQlB,SAAA,WAAA,CAAsB,EAAA,MAAA;EAiBtB,CAAA;;;;ECtHA,CAAA;EACQ,SAAA,aAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EACkB,SAAA,oBAAA,CAAA,EAAA,OAAA;EAGA,SAAA,IAAA,CAAA,EAAA;IAAtB,SAAA,UAAA,CAAA,EAAA,MAAA;IAKP,SAAA,YAAA,EAAA,MAAA;EAAR,CAAA;EAGqC,SAAA,OAAA,EAAA;IAAtB,SAAA,KAAA,EAAA,MAAA;EAK0D,CAAA;;AAA7C,UDAjB,WAAA,CCAiB;EACpB,SAAA,IAAA,EAAA,eAAA,GAAA,gBAAA,GAAA,aAAA,GAAA,cAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,yBAAA,GAAA,aAAA,GAAA,eAAA,GAAA,cAAA,GAAA,sBAAA,GAAA,sBAAA,GAAA,sBAAA,GAAA,sBAAA,GAAA,4BAAA,GAAA,gBAAA,GAAA,oBAAA,GAAA,iBAAA,GAAA,kBAAA,GAAA,e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AA,EAAA,QAAA,IMRb,qBNQa,CMRS,SNQT,CAAA,GMRsB,iBNQtB"}
//#region src/control-capabilities.ts
function hasMigrations(target) {
return "migrations" in target && !!target["migrations"];
}
function hasSchemaView(instance) {
return "toSchemaView" in instance && typeof instance["toSchemaView"] === "function";
}
//#endregion
//#region src/control-stack.ts
function addUniqueId(ids, seen, id) {
if (!seen.has(id)) {
ids.push(id);
seen.add(id);
}
}
function assertUniqueCodecOwner(options) {
const existingOwner = options.owners.get(options.codecId);
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}.`);
}
function extractCodecTypeImports(descriptors) {
const imports = [];
for (const descriptor of descriptors) {
const codecTypes = descriptor.types?.codecTypes;
if (codecTypes?.import) imports.push(codecTypes.import);
if (codecTypes?.typeImports) imports.push(...codecTypes.typeImports);
}
return imports;
}
function extractOperationTypeImports(descriptors) {
const imports = [];
for (const descriptor of descriptors) {
const operationTypes = descriptor.types?.operationTypes;
if (operationTypes?.import) imports.push(operationTypes.import);
}
return imports;
}
function extractQueryOperationTypeImports(descriptors) {
const imports = [];
for (const descriptor of descriptors) {
const queryOperationTypes = descriptor.types?.queryOperationTypes;
if (queryOperationTypes?.import) imports.push(queryOperationTypes.import);
}
return imports;
}
function extractComponentIds(family, target, adapter, extensions) {
const ids = [];
const seen = /* @__PURE__ */ new Set();
addUniqueId(ids, seen, family.id);
addUniqueId(ids, seen, target.id);
if (adapter) addUniqueId(ids, seen, adapter.id);
for (const ext of extensions) addUniqueId(ids, seen, ext.id);
return ids;
}
function isTypeConstructorDescriptor(value) {
return typeof value === "object" && value !== null && value.kind === "typeConstructor";
}
function isFieldPresetDescriptor(value) {
return typeof value === "object" && value !== null && value.kind === "fieldPreset";
}
function mergeAuthoringNamespaces(target, source, path, leafGuard, label) {
const assertSafePath = (currentPath) => {
const blockedSegment = currentPath.find((segment) => segment === "__proto__" || segment === "constructor" || segment === "prototype");
if (blockedSegment) throw new Error(`Invalid authoring ${label} helper "${currentPath.join(".")}". Helper path segments must not use "${blockedSegment}".`);
};
for (const [key, sourceValue] of Object.entries(source)) {
const currentPath = [...path, key];
assertSafePath(currentPath);
const hasExistingValue = Object.hasOwn(target, key);
const existingValue = hasExistingValue ? target[key] : void 0;
if (!hasExistingValue) {
target[key] = sourceValue;
continue;
}
const existingIsLeaf = leafGuard(existingValue);
const sourceIsLeaf = leafGuard(sourceValue);
if (existingIsLeaf || sourceIsLeaf) throw new Error(`Duplicate authoring ${label} helper "${currentPath.join(".")}". Descriptor contributions must be unique across composed components.`);
mergeAuthoringNamespaces(existingValue, sourceValue, currentPath, leafGuard, label);
}
}
function assembleAuthoringContributions(descriptors) {
const field = {};
const type = {};
for (const descriptor of descriptors) {
if (descriptor.authoring?.field) mergeAuthoringNamespaces(field, descriptor.authoring.field, [], isFieldPresetDescriptor, "field");
if (!descriptor.authoring?.type) continue;
mergeAuthoringNamespaces(type, descriptor.authoring.type, [], isTypeConstructorDescriptor, "type");
}
return {
field,
type
};
}
function extractCodecLookup(descriptors) {
const byId = /* @__PURE__ */ new Map();
const owners = /* @__PURE__ */ new Map();
for (const descriptor of descriptors) {
const codecInstances = descriptor.types?.codecTypes?.codecInstances;
if (!codecInstances) continue;
const descriptorId = descriptor.id ?? "<unknown>";
for (const codec of codecInstances) {
assertUniqueCodecOwner({
codecId: codec.id,
owners,
descriptorId,
entityLabel: "codec instance",
entityOwnershipLabel: "codec instance provider"
});
owners.set(codec.id, descriptorId);
byId.set(codec.id, codec);
}
}
return { get: (id) => byId.get(id) };
}
function createControlStack(input) {
const { family, target, adapter, driver, extensionPacks = [] } = input;
const allDescriptors = [
family,
target,
...adapter ? [adapter] : [],
...extensionPacks
];
return {
family,
target,
adapter,
driver,
extensionPacks,
codecTypeImports: extractCodecTypeImports(allDescriptors),
operationTypeImports: extractOperationTypeImports(allDescriptors),
queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),
extensionIds: extractComponentIds(family, target, adapter, extensionPacks),
codecLookup: extractCodecLookup(allDescriptors),
authoringContributions: assembleAuthoringContributions(allDescriptors)
};
}
//#endregion
export { assembleAuthoringContributions, assertUniqueCodecOwner, createControlStack, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports, hasMigrations, hasSchemaView };
//# sourceMappingURL=control.mjs.map
{"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,SAA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,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"}
import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
import { Contract, ContractModel } from "@prisma-next/contract/types";
//#region src/emission-types.d.ts
interface GenerateContractTypesOptions {
readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
}
interface ValidationContext {
readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
readonly extensionIds?: ReadonlyArray<string>;
}
interface EmissionSpi {
readonly id: string;
generateStorageType(contract: Contract, storageHashTypeName: string): string;
generateModelStorageType(modelName: string, model: ContractModel): string;
getFamilyImports(): string[];
getFamilyTypeAliases(options?: GenerateContractTypesOptions): string;
getTypeMapsExpression(): string;
getContractWrapper(contractBaseName: string, typeMapsName: string): string;
}
//#endregion
export { GenerateContractTypesOptions as n, ValidationContext as r, EmissionSpi as t };
//# sourceMappingURL=emission-types-Dt9_NXRb.d.mts.map
{"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"}
import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
import { n as GenerateContractTypesOptions, r as ValidationContext, t as EmissionSpi } from "./emission-types-Dt9_NXRb.mjs";
export { type EmissionSpi, type GenerateContractTypesOptions, type TypesImportSpec, type ValidationContext };
export { };
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";
//#region src/execution-instances.d.ts
interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {}
interface RuntimeTargetInstance<TFamilyId extends string, TTargetId extends string> extends TargetInstance<TFamilyId, TTargetId> {}
interface RuntimeAdapterInstance<TFamilyId extends string, TTargetId extends string> extends AdapterInstance<TFamilyId, TTargetId> {}
interface RuntimeDriverInstance<TFamilyId extends string, TTargetId extends string> extends DriverInstance<TFamilyId, TTargetId> {}
interface RuntimeExtensionInstance<TFamilyId extends string, TTargetId extends string> extends ExtensionInstance<TFamilyId, TTargetId> {}
//#endregion
//#region src/execution-descriptors.d.ts
interface RuntimeFamilyDescriptor<TFamilyId extends string, TFamilyInstance extends RuntimeFamilyInstance<TFamilyId> = RuntimeFamilyInstance<TFamilyId>> extends FamilyDescriptor<TFamilyId> {
create<TTargetId extends string>(options: {
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId>;
readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
}): TFamilyInstance;
}
interface RuntimeTargetDescriptor<TFamilyId extends string, TTargetId extends string, TTargetInstance extends RuntimeTargetInstance<TFamilyId, TTargetId> = RuntimeTargetInstance<TFamilyId, TTargetId>> extends TargetDescriptor<TFamilyId, TTargetId> {
create(): TTargetInstance;
}
interface RuntimeAdapterDescriptor<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends RuntimeAdapterInstance<TFamilyId, TTargetId> = RuntimeAdapterInstance<TFamilyId, TTargetId>> extends AdapterDescriptor<TFamilyId, TTargetId> {
create(): TAdapterInstance;
}
interface RuntimeDriverDescriptor<TFamilyId extends string, TTargetId extends string, TCreateOptions = void, TDriverInstance extends RuntimeDriverInstance<TFamilyId, TTargetId> = RuntimeDriverInstance<TFamilyId, TTargetId>> extends DriverDescriptor<TFamilyId, TTargetId> {
create(options?: TCreateOptions): TDriverInstance;
}
interface RuntimeExtensionDescriptor<TFamilyId extends string, TTargetId extends string, TExtensionInstance extends RuntimeExtensionInstance<TFamilyId, TTargetId> = RuntimeExtensionInstance<TFamilyId, TTargetId>> extends ExtensionDescriptor<TFamilyId, TTargetId> {
create(): TExtensionInstance;
}
//#endregion
//#region src/execution-requirements.d.ts
declare function assertRuntimeContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({
contract,
family,
target,
adapter,
extensionPacks
}: {
readonly contract: {
readonly target: string;
readonly extensionPacks?: Record<string, unknown>;
};
readonly family: RuntimeFamilyDescriptor<TFamilyId>;
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId>;
readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId>[];
}): void;
//#endregion
//#region src/execution-stack.d.ts
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>> {
readonly target: RuntimeTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter: RuntimeAdapterDescriptor<TFamilyId, TTargetId, TAdapterInstance>;
readonly driver: RuntimeDriverDescriptor<TFamilyId, TTargetId, unknown, TDriverInstance> | undefined;
readonly extensionPacks: readonly RuntimeExtensionDescriptor<TFamilyId, TTargetId, TExtensionInstance>[];
}
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>> {
readonly stack: ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance>;
readonly target: RuntimeTargetInstance<TFamilyId, TTargetId>;
readonly adapter: TAdapterInstance;
readonly driver: TDriverInstance | undefined;
readonly extensionPacks: readonly TExtensionInstance[];
}
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: {
readonly target: TTargetDescriptor;
readonly adapter: TAdapterDescriptor;
readonly driver?: TDriverDescriptor | undefined;
readonly extensionPacks?: readonly TExtensionDescriptor[] | undefined;
}): ExecutionStack<TFamilyId, TTargetId, TAdapterInstance, TDriverInstance, TExtensionInstance> & {
readonly target: TTargetDescriptor;
readonly adapter: TAdapterDescriptor;
readonly driver: TDriverDescriptor | undefined;
readonly extensionPacks: readonly TExtensionDescriptor[];
};
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>;
//#endregion
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 };
//# sourceMappingURL=execution.d.mts.map
{"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,MAAA,EAAA,kBAAA,MAAA,CAAA,SAMA,cANA,CAMe,SANf,EAM0B,SAN1B,CAAA,CAAA;AAEO,UAMA,wBANsB,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,SAO7B,iBAP6B,CAOX,SAPW,EAOA,SAPA,CAAA,CAAA;;;UCCtB,0EAES,sBAAsB,aAAa,sBAAsB,oBACzE,iBAAiB;EDVV,MAAA,CAAA,kBAAqB,MAAA,CAAA,CAAA,OAAA,EAAA;IAGrB,SAAA,MAAA,ECSI,uBDTiB,CCSO,SDTP,ECSkB,SDTlB,CAAA;IACb,SAAA,OAAA,ECSH,wBDTG,CCSsB,SDTtB,ECSiC,SDTjC,CAAA;IAAW,SAAA,MAAA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N,EGqEiB,SHrEjB,CAAA,EAAA,6BGsEM,0BHtEN,CGuErB,SHvEqB,EGwErB,SHxEqB,EGyErB,kBHzEqB,CAAA,GAAA,KAAA,CAAA,CAAA,KAAA,EAAA;EAAW,SAAA,MAAA,EG4EjB,iBH5EiB;EAA1B,SAAA,OAAA,EG6EU,kBH7EV;EAAc,SAAA,MAAA,CAAA,EG8EJ,iBH9EI,GAAA,SAAA;EAEP,SAAA,cAAA,CAAA,EAAA,SG6EoB,oBH7EI,EAAA,GAAA,SAAA;CACb,CAAA,EG6ExB,cH7EwB,CG6ET,SH7ES,EG6EE,SH7EF,EG6Ea,gBH7Eb,EG6E+B,eH7E/B,EG6EgD,kBH7EhD,CAAA,GAAA;EAAW,SAAA,MAAA,EG8EpB,iBH9EoB;EAA7B,SAAA,OAAA,EG+EU,kBH/EV;EAAiB,SAAA,MAAA,EGgFR,iBHhFQ,GAAA,SAAA;oCGiFS;;iBAUpB,uGAGW,uBAAuB,WAAW,oCACnC,sBAAsB,WAAW,uCAC9B,yBAAyB,WAAW,mBAExD,eACL,WACA,WACA,kBACA,iBACA,sBAED,uBACD,WACA,WACA,kBACA,iBACA"}
import { t as checkContractComponentRequirements } from "./framework-components-Bl3SLyGG.mjs";
//#region src/execution-requirements.ts
function assertRuntimeContractRequirementsSatisfied({ contract, family, target, adapter, extensionPacks }) {
const providedComponentIds = new Set([
family.id,
target.id,
adapter.id
]);
for (const extension of extensionPacks) providedComponentIds.add(extension.id);
const result = checkContractComponentRequirements({
contract,
expectedTargetId: target.targetId,
providedComponentIds
});
if (result.targetMismatch) throw new Error(`Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`);
for (const packId of result.missingExtensionPackIds) throw new Error(`Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`);
}
//#endregion
//#region src/execution-stack.ts
function createExecutionStack(input) {
return {
target: input.target,
adapter: input.adapter,
driver: input.driver,
extensionPacks: input.extensionPacks ?? []
};
}
function instantiateExecutionStack(stack) {
const driver = stack.driver ? stack.driver.create() : void 0;
return {
stack,
target: stack.target.create(),
adapter: stack.adapter.create(),
driver,
extensionPacks: stack.extensionPacks.map((descriptor) => descriptor.create())
};
}
//#endregion
export { assertRuntimeContractRequirementsSatisfied, createExecutionStack, instantiateExecutionStack };
//# sourceMappingURL=execution.mjs.map
{"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"}
//#region src/framework-authoring.d.ts
type AuthoringArgRef = {
readonly kind: 'arg';
readonly index: number;
readonly path?: readonly string[];
readonly default?: AuthoringTemplateValue;
};
type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | readonly AuthoringTemplateValue[] | {
readonly [key: string]: AuthoringTemplateValue;
};
type AuthoringArgumentDescriptor = {
readonly kind: 'string';
readonly optional?: boolean;
} | {
readonly kind: 'number';
readonly optional?: boolean;
readonly integer?: boolean;
readonly minimum?: number;
readonly maximum?: number;
} | {
readonly kind: 'stringArray';
readonly optional?: boolean;
} | {
readonly kind: 'object';
readonly optional?: boolean;
readonly properties: Record<string, AuthoringArgumentDescriptor>;
};
interface AuthoringStorageTypeTemplate {
readonly codecId: string;
readonly nativeType: AuthoringTemplateValue;
readonly typeParams?: Record<string, AuthoringTemplateValue>;
}
interface AuthoringTypeConstructorDescriptor {
readonly kind: 'typeConstructor';
readonly args?: readonly AuthoringArgumentDescriptor[];
readonly output: AuthoringStorageTypeTemplate;
}
interface AuthoringColumnDefaultTemplateLiteral {
readonly kind: 'literal';
readonly value: AuthoringTemplateValue;
}
interface AuthoringColumnDefaultTemplateFunction {
readonly kind: 'function';
readonly expression: AuthoringTemplateValue;
}
type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction;
interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {
readonly nullable?: boolean;
readonly default?: AuthoringColumnDefaultTemplate;
readonly executionDefault?: AuthoringTemplateValue;
readonly id?: boolean;
readonly unique?: boolean;
}
interface AuthoringFieldPresetDescriptor {
readonly kind: 'fieldPreset';
readonly args?: readonly AuthoringArgumentDescriptor[];
readonly output: AuthoringFieldPresetOutput;
}
type AuthoringTypeNamespace = {
readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;
};
type AuthoringFieldNamespace = {
readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;
};
interface AuthoringContributions {
readonly type?: AuthoringTypeNamespace;
readonly field?: AuthoringFieldNamespace;
}
declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef;
declare function isAuthoringTypeConstructorDescriptor(value: unknown): value is AuthoringTypeConstructorDescriptor;
declare function isAuthoringFieldPresetDescriptor(value: unknown): value is AuthoringFieldPresetDescriptor;
declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue, args: readonly unknown[]): unknown;
declare function validateAuthoringHelperArguments(helperPath: string, descriptors: readonly AuthoringArgumentDescriptor[] | undefined, args: readonly unknown[]): void;
declare function instantiateAuthoringTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor, args: readonly unknown[]): {
readonly codecId: string;
readonly nativeType: string;
readonly typeParams?: Record<string, unknown>;
};
declare function instantiateAuthoringFieldPreset(descriptor: AuthoringFieldPresetDescriptor, args: readonly unknown[]): {
readonly descriptor: {
readonly codecId: string;
readonly nativeType: string;
readonly typeParams?: Record<string, unknown>;
};
readonly nullable: boolean;
readonly default?: {
readonly kind: 'literal';
readonly value: unknown;
} | {
readonly kind: 'function';
readonly expression: string;
};
readonly executionDefault?: unknown;
readonly id: boolean;
readonly unique: boolean;
};
//#endregion
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 };
//# sourceMappingURL=framework-authoring-BybjSfF5.d.mts.map
{"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,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edIds = /* @__PURE__ */ new Set();
for (const id of input.providedComponentIds) providedIds.add(id);
const missingExtensionPackIds = (input.contract.extensionPacks ? Object.keys(input.contract.extensionPacks) : []).filter((id) => !providedIds.has(id));
const expectedTargetFamily = input.expectedTargetFamily;
const contractTargetFamily = input.contract.targetFamily;
const familyMismatch = expectedTargetFamily !== void 0 && contractTargetFamily !== void 0 && contractTargetFamily !== expectedTargetFamily ? {
expected: expectedTargetFamily,
actual: contractTargetFamily
} : void 0;
const expectedTargetId = input.expectedTargetId;
const contractTargetId = input.contract.target;
const targetMismatch = expectedTargetId !== void 0 && contractTargetId !== expectedTargetId ? {
expected: expectedTargetId,
actual: contractTargetId
} : void 0;
return {
...familyMismatch ? { familyMismatch } : {},
...targetMismatch ? { targetMismatch } : {},
missingExtensionPackIds
};
}
//#endregion
export { checkContractComponentRequirements as t };
//# sourceMappingURL=framework-components-Bl3SLyGG.mjs.map
{"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"}
import { i as AuthoringContributions } from "./framework-authoring-BybjSfF5.mjs";
import { t as Codec } from "./codec-types-D9ixsdxw.mjs";
import { t as TypesImportSpec } from "./types-import-spec-BupmVNbx.mjs";
//#region src/framework-components.d.ts
/**
* Declarative fields that describe component metadata.
*/
interface ComponentMetadata {
/** Component version (semver) */
readonly version: string;
/**
* Capabilities this component provides.
*
* For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
* the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
* keep these declarations in sync. Targets are identifiers/descriptors and typically do not
* declare capabilities.
*/
readonly capabilities?: Record<string, unknown>;
/** Type imports for contract.d.ts generation */
readonly types?: {
readonly codecTypes?: {
/**
* Base codec types import spec.
* Optional: adapters typically provide this, extensions usually don't.
*/
readonly import?: TypesImportSpec;
/**
* Additional type-only imports for parameterized codec branded types.
*
* These imports are included in generated `contract.d.ts` but are NOT treated as
* codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).
*
* Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`
*/
readonly typeImports?: ReadonlyArray<TypesImportSpec>;
/**
* Optional control-plane hooks keyed by codecId.
* Used by family-specific planners/verifiers to handle storage types.
*/
readonly controlPlaneHooks?: Record<string, unknown>;
/**
* Codec instances contributed by this component.
* Used to build a CodecLookup for codec-dispatched type rendering during emission.
*/
readonly codecInstances?: ReadonlyArray<Codec>;
};
readonly operationTypes?: {
readonly import: TypesImportSpec;
};
readonly queryOperationTypes?: {
readonly import: TypesImportSpec;
};
readonly storage?: ReadonlyArray<{
readonly typeId: string;
readonly familyId: string;
readonly targetId: string;
readonly nativeType?: string;
}>;
};
/**
* Optional pure-data authoring contributions exposed by this component.
*
* These contributions are safe to include on pack refs and descriptors because
* they contain only declarative metadata. Higher-level authoring packages may
* project them into concrete helper functions for TS-first workflows.
*/
readonly authoring?: AuthoringContributions;
}
/**
* Base descriptor for any framework component.
*
* All component descriptors share these fundamental properties that identify
* the component and provide its metadata. This interface is extended by
* specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
*
* @template Kind - Discriminator literal identifying the component type.
* Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
* but the type accepts any string to allow ecosystem extensions.
*
* @example
* ```ts
* // All descriptors have these properties
* descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)
* descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')
* descriptor.version // Component version (semver)
* ```
*/
interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {
/** Discriminator identifying the component type */
readonly kind: Kind;
/** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */
readonly id: string;
}
interface ContractComponentRequirementsCheckInput {
readonly contract: {
readonly target: string;
readonly targetFamily?: string | undefined;
readonly extensionPacks?: Record<string, unknown> | undefined;
};
readonly expectedTargetFamily?: string | undefined;
readonly expectedTargetId?: string | undefined;
readonly providedComponentIds: Iterable<string>;
}
interface ContractComponentRequirementsCheckResult {
readonly familyMismatch?: {
readonly expected: string;
readonly actual: string;
} | undefined;
readonly targetMismatch?: {
readonly expected: string;
readonly actual: string;
} | undefined;
readonly missingExtensionPackIds: readonly string[];
}
declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult;
/**
* Descriptor for a family component.
*
* A "family" represents a category of data sources with shared semantics
* (e.g., SQL databases, document stores). Families define:
* - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
* - Contract structure (tables vs collections, columns vs fields)
* - Type system and codecs
*
* Families are the top-level grouping. Each family contains multiple targets
* (e.g., SQL family contains Postgres, MySQL, SQLite targets).
*
* Extended by plane-specific descriptors:
* - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations
* - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods
*
* @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
*
* @example
* ```ts
* import sql from '@prisma-next/family-sql/control';
*
* sql.kind // 'family'
* sql.familyId // 'sql'
* sql.id // 'sql'
* ```
*/
interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {
/** The family identifier (e.g., 'sql', 'document') */
readonly familyId: TFamilyId;
}
/**
* Descriptor for a target component.
*
* A "target" represents a specific database or data store within a family
* (e.g., Postgres, MySQL, MongoDB). Targets define:
* - Native type mappings (e.g., Postgres int4 → TypeScript number)
* - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
*
* Targets are bound to a family and provide the target-specific implementation
* details that adapters and drivers use.
*
* Extended by plane-specific descriptors:
* - `ControlTargetDescriptor` - adds optional `migrations` capability
* - `RuntimeTargetDescriptor` - adds runtime factory method
*
* @template TFamilyId - Literal type for the family identifier
* @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
*
* @example
* ```ts
* import postgres from '@prisma-next/target-postgres/control';
*
* postgres.kind // 'target'
* postgres.familyId // 'sql'
* postgres.targetId // 'postgres'
* ```
*/
interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> {
/** The family this target belongs to */
readonly familyId: TFamilyId;
/** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
readonly targetId: TTargetId;
}
/**
* Base shape for any pack reference.
* Pack refs are pure JSON-friendly objects safe to import in authoring flows.
*/
interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
readonly kind: Kind;
readonly id: string;
readonly familyId: TFamilyId;
readonly targetId?: string;
readonly authoring?: AuthoringContributions;
}
type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;
type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & {
readonly targetId: TTargetId;
};
type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & {
readonly targetId: TTargetId;
};
type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & {
readonly targetId: TTargetId;
};
type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & {
readonly targetId: TTargetId;
};
/**
* Descriptor for an adapter component.
*
* An "adapter" provides the protocol and dialect implementation for a target.
* Adapters handle:
* - SQL/query generation (lowering AST to target-specific syntax)
* - Codec registration (encoding/decoding between JS and wire types)
* - Type mappings and coercions
*
* Adapters are bound to a specific family+target combination and work with
* any compatible driver for that target.
*
* Extended by plane-specific descriptors:
* - `ControlAdapterDescriptor` - control-plane factory
* - `RuntimeAdapterDescriptor` - runtime factory
*
* @template TFamilyId - Literal type for the family identifier
* @template TTargetId - Literal type for the target identifier
*
* @example
* ```ts
* import postgresAdapter from '@prisma-next/adapter-postgres/control';
*
* postgresAdapter.kind // 'adapter'
* postgresAdapter.familyId // 'sql'
* postgresAdapter.targetId // 'postgres'
* ```
*/
interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> {
/** The family this adapter belongs to */
readonly familyId: TFamilyId;
/** The target this adapter is designed for */
readonly targetId: TTargetId;
}
/**
* Descriptor for a driver component.
*
* A "driver" provides the connection and execution layer for a target.
* Drivers handle:
* - Connection management (pooling, timeouts, retries)
* - Query execution (sending SQL/commands, receiving results)
* - Transaction management
* - Wire protocol communication
*
* Drivers are bound to a specific family+target and work with any compatible
* adapter. Multiple drivers can exist for the same target (e.g., node-postgres
* vs postgres.js for Postgres).
*
* Extended by plane-specific descriptors:
* - `ControlDriverDescriptor` - creates driver from connection URL
* - `RuntimeDriverDescriptor` - creates driver with runtime options
*
* @template TFamilyId - Literal type for the family identifier
* @template TTargetId - Literal type for the target identifier
*
* @example
* ```ts
* import postgresDriver from '@prisma-next/driver-postgres/control';
*
* postgresDriver.kind // 'driver'
* postgresDriver.familyId // 'sql'
* postgresDriver.targetId // 'postgres'
* ```
*/
interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> {
/** The family this driver belongs to */
readonly familyId: TFamilyId;
/** The target this driver connects to */
readonly targetId: TTargetId;
}
/**
* Descriptor for an extension component.
*
* An "extension" adds optional capabilities to a target. Extensions can provide:
* - Additional operations (e.g., vector similarity search with pgvector)
* - Custom types and codecs (e.g., vector type)
* - Extended query capabilities
*
* Extensions are bound to a specific family+target and are registered in the
* config alongside the core components. Multiple extensions can be used together.
*
* Extended by plane-specific descriptors:
* - `ControlExtensionDescriptor` - control-plane extension factory
* - `RuntimeExtensionDescriptor` - runtime extension factory
*
* @template TFamilyId - Literal type for the family identifier
* @template TTargetId - Literal type for the target identifier
*
* @example
* ```ts
* import pgvector from '@prisma-next/extension-pgvector/control';
*
* pgvector.kind // 'extension'
* pgvector.familyId // 'sql'
* pgvector.targetId // 'postgres'
* ```
*/
interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> {
/** The family this extension belongs to */
readonly familyId: TFamilyId;
/** The target this extension is designed for */
readonly targetId: TTargetId;
}
/** Components bound to a specific family+target combination. */
type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>;
interface FamilyInstance<TFamilyId extends string> {
readonly familyId: TFamilyId;
}
interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
readonly familyId: TFamilyId;
readonly targetId: TTargetId;
}
interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
readonly familyId: TFamilyId;
readonly targetId: TTargetId;
}
interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
readonly familyId: TFamilyId;
readonly targetId: TTargetId;
}
interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
readonly familyId: TFamilyId;
readonly targetId: TTargetId;
}
//#endregion
export { checkContractComponentRequirements as S, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, TargetPackRef as x, TargetDescriptor as y };
//# sourceMappingURL=framework-components-W-TA8p5-.d.mts.map
{"version":3,"file":"framework-components-W-TA8p5-.d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P,0CACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6Dc,mDAAmD;;qBAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,6EACP;;qBAEW;;qBAGA;;;;;;UAOJ,mEACP;iBACO;;qBAEI;;uBAEE;;KAGX,mDAAmD,sBAAsB;KAEzE,sFAGR,sBAAsB;qBACL;;KAGT,uFAGR,uBAAuB;qBACN;;KAGT,yFAGR,yBAAyB;qBACR;;KAGT,sFAGR,sBAAsB;qBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BJ,8EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCJ,6EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,gFACP;;qBAEW;;qBAGA;;;KAIT,qFACR,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB;qBACI;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
//#region src/types-import-spec.d.ts
/**
* Specifies how to import TypeScript types from a package.
* Used in extension pack manifests to declare codec and operation type imports.
*/
interface TypesImportSpec {
readonly package: string;
readonly named: string;
readonly alias: string;
}
//#endregion
export { TypesImportSpec as t };
//# sourceMappingURL=types-import-spec-BupmVNbx.d.mts.map
{"version":3,"file":"types-import-spec-BupmVNbx.d.mts","names":[],"sources":["../src/types-import-spec.ts"],"sourcesContent":[],"mappings":";;AAIA;;;UAAiB,eAAA"}
+4
-4
{
"name": "@prisma-next/framework-components",
"version": "0.0.1",
"version": "0.3.0-dev.146",
"type": "module",

@@ -8,5 +8,5 @@ "sideEffects": false,

"dependencies": {
"@prisma-next/contract": "0.0.1",
"@prisma-next/utils": "0.0.1",
"@prisma-next/operations": "0.0.1"
"@prisma-next/contract": "0.3.0-dev.146",
"@prisma-next/operations": "0.3.0-dev.146",
"@prisma-next/utils": "0.3.0-dev.146"
},

@@ -13,0 +13,0 @@ "devDependencies": {