🎩 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
4
Versions
544
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.16.0-dev.11
to
0.16.0-dev.12
+671
dist/framework-authoring-DfnkbOVh.mjs
import { n as runtimeError } from "./runtime-error-BA9d7XjZ.mjs";
import { blindCast } from "@prisma-next/utils/casts";
import { isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue } from "@prisma-next/contract/types";
import { ifDefined } from "@prisma-next/utils/defined";
//#region src/shared/framework-authoring.ts
/**
* Classifies an `enum` block's members (before codec decoding, which needs
* the codec chosen first) into which default codec an omitted `@@type`
* should resolve to:
*
* - every member is `bare`, or a `value` whose raw JSON is a string → `'text'`
* - every member is a `value` whose raw JSON is an integer → `'int'`
* - anything else (float, bigint, boolean, mixed, or a `ref`/`option`/`list`
* parameter) → `null`, meaning the caller must require an explicit `@@type`.
*/
function classifyEnumMemberType(block) {
let sawText = false;
let sawInt = false;
for (const paramValue of Object.values(block.parameters)) {
if (paramValue.kind === "bare") {
sawText = true;
continue;
}
if (paramValue.kind !== "value") return null;
let jsonValue;
try {
jsonValue = JSON.parse(paramValue.raw);
} catch {
return null;
}
if (typeof jsonValue === "string") sawText = true;
else if (typeof jsonValue === "number" && Number.isInteger(jsonValue)) sawInt = true;
else return null;
}
if (sawText && sawInt) return null;
if (sawText) return "text";
if (sawInt) return "int";
return null;
}
/**
* Resolves the codec id for an `enum` block. When `@@type` is absent, the codec
* is inferred from the members via {@link classifyEnumMemberType}; otherwise the
* explicit `@@type("codec")` argument is parsed. Pushes the appropriate
* diagnostic and returns `undefined` when neither yields a codec. `codecSpan` is
* the span downstream codec-validation diagnostics should anchor to. Shared by
* every family's enum factory so inference and the explicit path stay identical.
*/
function resolveEnumCodecId(block, ctx) {
const sourceId = ctx.sourceId ?? "unknown";
const typeAttr = block.blockAttributes.find((a) => a.name === "type");
if (typeAttr === void 0) {
const inferredKind = classifyEnumMemberType(block);
if (inferredKind === null || ctx.enumInferenceCodecs === void 0) {
ctx.diagnostics?.push({
code: "PSL_ENUM_CANNOT_INFER_TYPE",
message: `cannot infer @@type for enum "${block.name}"; add an explicit @@type(...)`,
sourceId,
span: block.span
});
return;
}
return {
codecId: ctx.enumInferenceCodecs[inferredKind],
codecSpan: block.span
};
}
const rawCodecArg = typeAttr.args[0]?.value;
const codecId = rawCodecArg?.startsWith("\"") && rawCodecArg.endsWith("\"") && rawCodecArg.length >= 2 ? rawCodecArg.slice(1, -1) : void 0;
if (codecId === void 0) {
ctx.diagnostics?.push({
code: "PSL_ENUM_MISSING_TYPE",
message: `enum "${block.name}" @@type attribute must have a quoted codec id argument`,
sourceId,
span: typeAttr.span
});
return;
}
return {
codecId,
codecSpan: typeAttr.args[0]?.span ?? typeAttr.span
};
}
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 isAuthoringSelectRef(value) {
if (!isAuthoringTemplateRecord(value) || value["kind"] !== "select") return false;
const index = value["index"];
const path = value["path"];
const cases = value["cases"];
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 typeof cases === "object" && cases !== null && !Array.isArray(cases);
}
function isAuthoringTemplateRecord(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function readTemplateArgumentValue(args, index, path) {
let value = args[index];
for (const segment of path ?? []) {
if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) return;
value = value[segment];
}
return value;
}
function isAuthoringTypeConstructorDescriptor(value) {
return "kind" in value && value.kind === "typeConstructor";
}
function isAuthoringFieldPresetDescriptor(value) {
return "kind" in value && value.kind === "fieldPreset";
}
function isAuthoringEntityTypeDescriptor(value) {
return "kind" in value && value.kind === "entity";
}
function isAuthoringPslBlockDescriptor(value) {
return "kind" in value && value.kind === "pslBlock";
}
function isAuthoringModelAttributeDescriptor(value) {
return "kind" in value && value.kind === "modelAttribute";
}
/**
* Returns true when `namespace` is a non-leaf key in `contributions.field`.
*
* `AuthoringFieldNamespace` permits a leaf descriptor at any depth — including
* the root — so a top-level `field: { Foo: { kind: 'fieldPreset', ... } }`
* registration must NOT be treated as a "namespace" with sub-paths. Callers
* use this predicate to gate dot-namespaced lookups (e.g. PSL `@Foo.bar`).
*/
function hasRegisteredFieldNamespace(contributions, namespace) {
if (contributions?.field === void 0 || !Object.hasOwn(contributions.field, namespace)) return false;
const value = contributions.field[namespace];
return value !== void 0 && !isAuthoringFieldPresetDescriptor(value);
}
function isCopyableNamespaceObject(value) {
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
const proto = Object.getPrototypeOf(value);
return proto === Object.prototype || proto === null;
}
/**
* Deep structural check run only at the composition boundary (the merge and
* collect walkers) to classify a raw namespace-tree node as a leaf descriptor.
* A node counts as a leaf iff its `kind` matches `descriptorKind` AND it
* carries that kind's required fields.
*
* This is boundary validation over `unknown`, NOT a type-predicate: the four
* exported `isAuthoring*Descriptor` predicates deliberately narrow on `kind`
* alone and trust the static types. The walkers, by contrast, also receive
* type-bypassing packs (`as unknown as never` in tests, untyped JS at runtime)
* whose descriptor-shaped-but-incomplete nodes must be rejected rather than
* silently treated as sub-namespaces — so the well-formedness check lives here.
*/
function isWellFormedDescriptor(value, descriptorKind) {
if (typeof value !== "object" || value === null) return false;
if (!("kind" in value) || value.kind !== descriptorKind) return false;
switch (descriptorKind) {
case "typeConstructor":
case "fieldPreset": {
if (!("output" in value)) return false;
const output = value.output;
return typeof output === "object" && output !== null;
}
case "entity": {
if (!("discriminator" in value) || typeof value.discriminator !== "string") return false;
if (value.discriminator.length === 0) return false;
if (!("output" in value)) return false;
const output = value.output;
if (typeof output !== "object" || output === null) return false;
const factory = "factory" in output ? output.factory : void 0;
const template = "template" in output ? output.template : void 0;
return typeof factory === "function" || template !== void 0;
}
case "pslBlock": {
if (!("keyword" in value) || typeof value.keyword !== "string" || value.keyword.length === 0) return false;
if (!("discriminator" in value) || typeof value.discriminator !== "string" || value.discriminator.length === 0) return false;
if (!("name" in value)) return false;
const name = value.name;
if (typeof name !== "object" || name === null) return false;
if (!("required" in name) || typeof name.required !== "boolean") return false;
if (!("parameters" in value)) return false;
const parameters = value.parameters;
return typeof parameters === "object" && parameters !== null && !Array.isArray(parameters);
}
case "modelAttribute":
if (!("attribute" in value) || typeof value.attribute !== "string" || value.attribute.length === 0) return false;
if (!("spec" in value)) return false;
return "lower" in value && typeof value.lower === "function";
default: return false;
}
}
function deepCopyNamespace(source, descriptorKind) {
const copy = {};
for (const [key, value] of Object.entries(source)) copy[key] = isCopyableNamespaceObject(value) && !isWellFormedDescriptor(value, descriptorKind) ? deepCopyNamespace(value, descriptorKind) : value;
return copy;
}
/**
* Merges `source` into `target` recursively at the descriptor-namespace
* level. `descriptorKind` is the `kind` value ('typeConstructor',
* 'fieldPreset', 'entity', or 'pslBlock') that identifies a descriptor
* (terminal merge point; same-path registrations across components are
* reported as duplicates) as opposed to a sub-namespace (recursion target).
*
* Path segments are validated against prototype-pollution names
* (`__proto__`, `constructor`, `prototype`). A value that is neither a
* recognized leaf nor a plain object — e.g. a malformed descriptor
* where the canonical leaf guard rejected it for missing `output` —
* is reported as an invalid contribution rather than recursed into,
* which would either silently mangle state or infinite-loop on
* primitive properties.
*
* Within-registry duplicate detection is this walker's job;
* cross-registry detection runs separately via
* `assertNoCrossRegistryCollisions` after merging completes.
*/
function mergeAuthoringNamespaces(target, source, path, descriptorKind, 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] = isCopyableNamespaceObject(sourceValue) && !isWellFormedDescriptor(sourceValue, descriptorKind) ? deepCopyNamespace(sourceValue, descriptorKind) : sourceValue;
continue;
}
const existingIsLeaf = isWellFormedDescriptor(existingValue, descriptorKind);
const sourceIsLeaf = isWellFormedDescriptor(sourceValue, descriptorKind);
if (existingIsLeaf || sourceIsLeaf) throw new Error(`Duplicate authoring ${label} helper "${currentPath.join(".")}". Helper names must be unique across composed packs.`);
if (!isCopyableNamespaceObject(existingValue) || !isCopyableNamespaceObject(sourceValue)) throw new Error(`Invalid authoring ${label} helper "${currentPath.join(".")}". Expected a sub-namespace object or a recognized descriptor; received a malformed value.`);
mergeAuthoringNamespaces(existingValue, sourceValue, currentPath, descriptorKind, label);
}
}
/**
* Collects the full dotted paths of every well-formed descriptor of
* `descriptorKind` in a raw contribution tree, using the same boundary
* classification as {@link mergeAuthoringNamespaces}. Lets assembly-level
* callers attribute each contributed path to its contributing component
* before merging, so a same-path collision can be reported naming both
* contributors.
*/
function collectContributedDescriptorPaths(namespace, descriptorKind, path = []) {
const paths = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isWellFormedDescriptor(value, descriptorKind)) {
paths.push(currentPath.join("."));
continue;
}
if (isCopyableNamespaceObject(value)) paths.push(...collectContributedDescriptorPaths(value, descriptorKind, currentPath));
}
return paths;
}
/**
* Derives the scalar view of an assembled authoring type namespace: every
* **top-level** type constructor that is instantiable with an empty argument
* list — all declared args optional and no entity-ref argument. A bare type
* name `T` in a schema is semantically the zero-arg instantiation `T()`, so
* each entry is exactly what that call produces (defaulted template values
* applied, absent optional-arg typeParams keys omitted). Constructors
* registered under a namespace segment, constructors with required args, and
* entity-ref constructors are not scalars and are excluded.
*
* Eligibility needs no template inspection: templates that cannot resolve
* for their legal call shapes are rejected at the composition boundary by
* {@link assertResolvableTypeConstructorTemplates}, so the zero-arg
* instantiation below cannot fail for an eligible constructor.
*/
function collectScalarTypeConstructors(namespace) {
const result = /* @__PURE__ */ new Map();
for (const [name, value] of Object.entries(namespace)) {
if (!isAuthoringTypeConstructorDescriptor(value)) continue;
if (value.entityRefArg !== void 0) continue;
if (value.args?.some((arg) => arg.optional !== true)) continue;
result.set(name, instantiateAuthoringTypeConstructor(value, []));
}
return result;
}
function visitTemplateArgRefs(template, visit) {
if (template === void 0) return;
if (isAuthoringArgRef(template)) {
visit(template);
visitTemplateArgRefs(template.default, visit);
return;
}
if (Array.isArray(template)) {
for (const value of template) visitTemplateArgRefs(value, visit);
return;
}
if (typeof template === "object" && template !== null) for (const value of Object.values(template)) visitTemplateArgRefs(value, visit);
}
/**
* Boundary validation for a contributed authoring type namespace, called
* per contributing component at assembly (which supplies `contributedBy`
* for attribution). Rejects what the types cannot express — entity-ref
* constructors are skipped (their output derives from the referenced
* entity): a plain constructor must declare its output storage type name,
* and every `typeParams` arg-ref (including refs inside arg-ref defaults)
* must point at a declared argument index.
*/
function assertResolvableTypeConstructorTemplates(namespace, contributedBy, path = []) {
for (const [name, value] of Object.entries(namespace)) {
const currentPath = [...path, name];
if (!isAuthoringTypeConstructorDescriptor(value)) {
assertResolvableTypeConstructorTemplates(value, contributedBy, currentPath);
continue;
}
if (value.entityRefArg !== void 0) continue;
const args = value.args ?? [];
const invalid = (detail) => /* @__PURE__ */ new Error(`Invalid authoring type constructor "${currentPath.join(".")}" contributed by descriptor "${contributedBy}". ${detail}`);
if (value.output.nativeType === void 0) throw invalid("The output declares no storage type template and no entityRefArg; a plain constructor must declare one.");
for (const [key, template] of Object.entries(value.output.typeParams ?? {})) visitTemplateArgRefs(template, (ref) => {
if (args[ref.index] === void 0) throw invalid(`output.typeParams.${key} references argument ${ref.index}, but the constructor declares ${args.length} argument(s). Declare the argument or correct the reference index.`);
});
}
}
function collectDescriptorPaths(namespace, isLeaf, path = []) {
const paths = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isLeaf(value)) {
paths.push(currentPath.join("."));
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) paths.push(...collectDescriptorPaths(value, isLeaf, currentPath));
}
return paths;
}
function collectDescriptorEntries(namespace, isLeaf, descriptorKind, label, path = []) {
const entries = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isLeaf(value)) {
if (!isWellFormedDescriptor(value, descriptorKind)) throw new Error(`Malformed authoring ${label} contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the ${label} descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
if (value.discriminator.length > 0) entries.push({
path: currentPath.join("."),
discriminator: value.discriminator
});
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = blindCast(value);
if ((record["kind"] !== void 0 || record["keyword"] !== void 0 || record["discriminator"] !== void 0) && !isLeaf(value)) {
const hasKind = record["kind"] === "pslBlock";
const hasKeyword = typeof record["keyword"] === "string";
const hasDiscriminator = typeof record["discriminator"] === "string";
if (hasKind || hasKeyword && hasDiscriminator) throw new Error(`Malformed authoring ${label} contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the ${label} descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
}
entries.push(...collectDescriptorEntries(value, isLeaf, descriptorKind, label, currentPath));
}
}
return entries;
}
/**
* Throws when two or more entries in the same namespace share a key. A
* duplicate key makes dispatch ambiguous — the caller's lookup dispatches by
* this key, so one entry would silently shadow the other. Catch duplicates
* before building any dispatch map.
*
* `label` (e.g. `'pslBlock'`, `'entityType'`) names which namespace the
* duplicate was found in and is carried in the structured error metadata;
* the key itself is always called `key` in both the message and the
* metadata, since what it semantically represents (a discriminator for
* `entityType`, the parser's dispatch keyword for `pslBlock`) is the
* caller's concern, not this function's.
*/
function assertUniqueDiscriminators(entries, label) {
const seen = /* @__PURE__ */ new Map();
for (const { path, discriminator: key } of entries) {
const existing = seen.get(key);
if (existing !== void 0) throw runtimeError("RUNTIME.DUPLICATE_AUTHORING_DISCRIMINATOR", `Duplicate ${label} key "${key}" registered at both "${existing}" and "${path}". Each ${label} contribution must use a unique key.`, {
label,
key,
existingPath: existing,
path
});
seen.set(key, path);
}
}
function collectPslBlockDescriptorEntries(namespace, path = []) {
const entries = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isAuthoringPslBlockDescriptor(value)) {
if (!isWellFormedDescriptor(value, "pslBlock")) throw new Error(`Malformed authoring pslBlock contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the pslBlock descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push({
path: currentPath.join("."),
discriminator: value.discriminator,
keyword: value.keyword
});
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = blindCast(value);
const hasKind = record["kind"] === "pslBlock";
const hasKeyword = typeof record["keyword"] === "string";
const hasDiscriminator = typeof record["discriminator"] === "string";
if (hasKind || hasKeyword && hasDiscriminator) throw new Error(`Malformed authoring pslBlock contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the pslBlock descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push(...collectPslBlockDescriptorEntries(value, currentPath));
}
}
return entries;
}
/**
* Every `pslBlockDescriptors` entry requires a matching `entityTypes` factory
* with the same discriminator. An `entityTypes` factory may stand alone (e.g.
* `enum`, reachable from the TypeScript builder without any PSL block).
*
* Uniqueness for pslBlock entries is keyed on **keyword**, not discriminator:
* several keywords (e.g. `policy_select`/`policy_insert`) may legitimately
* share one discriminator, routing to the same `entityTypes` factory and the
* same `entries[discriminator]` slot — that N:1 shape is exactly what lets
* one entity kind be authored through several PSL keywords. What must stay
* unique is the keyword itself, since that's what the parser dispatches on.
*/
function assertPslBlocksHaveFactories(entityTypeNamespace, pslBlockNamespace) {
const blockEntries = collectPslBlockDescriptorEntries(pslBlockNamespace);
const entityEntries = collectDescriptorEntries(entityTypeNamespace, isAuthoringEntityTypeDescriptor, "entity", "entityType");
assertUniqueDiscriminators(blockEntries.map((entry) => ({
path: entry.path,
discriminator: entry.keyword
})), "pslBlock");
assertUniqueDiscriminators(entityEntries, "entityType");
const entityDiscriminators = new Set(entityEntries.map((entry) => entry.discriminator));
for (const block of blockEntries) if (!entityDiscriminators.has(block.discriminator)) throw new Error(`Incomplete extension contribution: pslBlock helper "${block.path}" registers discriminator "${block.discriminator}" but no entityType contribution shares that discriminator. An extension-contributed PSL block requires a matching entityType factory so the parsed AST node can lower to an IR class instance; add an entityType helper with discriminator "${block.discriminator}".`);
}
function collectModelAttributeEntries(namespace, path = []) {
const entries = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isAuthoringModelAttributeDescriptor(value)) {
if (!isWellFormedDescriptor(value, "modelAttribute")) throw new Error(`Malformed authoring modelAttribute contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/attribute) but does not satisfy the modelAttribute descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push({
path: currentPath.join("."),
discriminator: value.attribute
});
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = blindCast(value);
if (typeof record["attribute"] === "string" && "spec" in record) throw new Error(`Malformed authoring modelAttribute contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/attribute) but does not satisfy the modelAttribute descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push(...collectModelAttributeEntries(value, currentPath));
}
}
return entries;
}
/**
* Throws when two modelAttribute contributions — at any paths, even
* different ones — claim the same bare `@@` attribute name. The family
* interpreter dispatches by attribute name, not by registration path, so
* two descriptors claiming the same name would have one silently shadow
* the other.
*/
function assertUniqueModelAttributeNames(entries) {
const seen = /* @__PURE__ */ new Map();
for (const { path, discriminator: attribute } of entries) {
const existing = seen.get(attribute);
if (existing !== void 0) throw new Error(`Duplicate modelAttribute "${attribute}" registered at both "${existing}" and "${path}". Each modelAttribute contribution must claim a unique attribute name.`);
seen.set(attribute, path);
}
}
function assertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityTypeNamespace = {}, pslBlockNamespace = {}, modelAttributeNamespace = {}) {
const typePaths = new Set(collectDescriptorPaths(typeNamespace, isAuthoringTypeConstructorDescriptor));
const fieldPaths = new Set(collectDescriptorPaths(fieldNamespace, isAuthoringFieldPresetDescriptor));
const entityPaths = new Set(collectDescriptorPaths(entityTypeNamespace, isAuthoringEntityTypeDescriptor));
const ambiguityHint = "Register each path in only one of authoringContributions.field / authoringContributions.type / authoringContributions.entityTypes.";
for (const fieldPath of fieldPaths) if (typePaths.has(fieldPath)) throw new Error(`Ambiguous authoring registry path "${fieldPath}". The same path is registered as both a type constructor and a field preset; PSL resolution would be ambiguous. ${ambiguityHint}`);
for (const entityPath of entityPaths) if (typePaths.has(entityPath) || fieldPaths.has(entityPath)) throw new Error(`Ambiguous authoring registry path "${entityPath}". The same path is registered as an entity contribution AND as a type constructor or field preset; PSL resolution would be ambiguous. ${ambiguityHint}`);
assertPslBlocksHaveFactories(entityTypeNamespace, pslBlockNamespace);
assertUniqueModelAttributeNames(collectModelAttributeEntries(modelAttributeNamespace));
assertSelectTemplatesMatchOptionArgs(typeNamespace, fieldNamespace, entityTypeNamespace);
}
function collectDescriptorNodes(namespace, isLeaf, path = []) {
const nodes = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isLeaf(value)) {
nodes.push([currentPath.join("."), value]);
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) nodes.push(...collectDescriptorNodes(value, isLeaf, currentPath));
}
return nodes;
}
function collectSelectRefs(value, found) {
if (typeof value !== "object" || value === null) return;
if (isAuthoringSelectRef(value)) {
found.push(value);
for (const caseTemplate of Object.values(value.cases)) collectSelectRefs(caseTemplate, found);
return;
}
if (isAuthoringArgRef(value)) {
collectSelectRefs(value.default, found);
return;
}
if (Array.isArray(value)) {
for (const entry of value) collectSelectRefs(entry, found);
return;
}
for (const entry of Object.values(value)) collectSelectRefs(entry, found);
}
function validateSelectRefsAgainstArgs(label, helperPath, args, templateRoot) {
const selects = [];
collectSelectRefs(templateRoot, selects);
for (const select of selects) {
const position = `#${select.index + 1}`;
let descriptor = args?.[select.index];
if (descriptor === void 0) throw new Error(`Authoring ${label} helper "${helperPath}" select template references argument ${position}, but the helper declares no argument at that position.`);
for (const segment of select.path ?? []) {
descriptor = descriptor.kind === "object" ? descriptor.properties[segment] : void 0;
if (descriptor === void 0) throw new Error(`Authoring ${label} helper "${helperPath}" select template references argument ${position} at path "${(select.path ?? []).join(".")}", which does not resolve to a declared argument property.`);
}
if (descriptor.kind !== "option") throw new Error(`Authoring ${label} helper "${helperPath}" select template references argument ${position}, which is kind "${descriptor.kind}"; select requires an option argument.`);
const argumentLabel = descriptor.name !== void 0 ? `"${descriptor.name}"` : position;
const missing = descriptor.values.filter((value) => !Object.hasOwn(select.cases, value));
if (missing.length > 0) throw new Error(`Authoring ${label} helper "${helperPath}" option argument ${argumentLabel} allows [${descriptor.values.join(", ")}] but the select template has no case for: ${missing.join(", ")}.`);
const values = descriptor.values;
const unreachable = Object.keys(select.cases).filter((key) => !values.includes(key));
if (unreachable.length > 0) throw new Error(`Authoring ${label} helper "${helperPath}" select template has case(s) not allowed by option argument ${argumentLabel}: ${unreachable.join(", ")}. Allowed values: [${values.join(", ")}].`);
}
}
/**
* Every `select` template node must target an option argument whose `values`
* exactly cover the node's `cases` — a legal token with no case and a case no
* token can reach are both declaration bugs, caught here at pack-registration
* time rather than at first resolution.
*/
function assertSelectTemplatesMatchOptionArgs(typeNamespace, fieldNamespace, entityTypeNamespace) {
for (const [helperPath, descriptor] of collectDescriptorNodes(fieldNamespace, isAuthoringFieldPresetDescriptor)) validateSelectRefsAgainstArgs("field", helperPath, descriptor.args, descriptor.output);
for (const [helperPath, descriptor] of collectDescriptorNodes(typeNamespace, isAuthoringTypeConstructorDescriptor)) validateSelectRefsAgainstArgs("type", helperPath, descriptor.args, descriptor.output);
for (const [helperPath, descriptor] of collectDescriptorNodes(entityTypeNamespace, isAuthoringEntityTypeDescriptor)) if ("template" in descriptor.output) validateSelectRefsAgainstArgs("entityType", helperPath, descriptor.args, descriptor.output.template);
}
function resolveAuthoringTemplateValue(template, args) {
if (template === void 0) return;
if (isAuthoringArgRef(template)) {
const value = readTemplateArgumentValue(args, template.index, template.path);
if (value === void 0 && template.default !== void 0) return resolveAuthoringTemplateValue(template.default, args);
return value;
}
if (isAuthoringSelectRef(template)) {
const value = readTemplateArgumentValue(args, template.index, template.path);
if (value === void 0) return;
if (typeof value !== "string" || !Object.hasOwn(template.cases, value)) throw new Error(`Authoring template select has no case for value "${String(value)}"`);
return resolveAuthoringTemplateValue(template.cases[value], args);
}
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 === "boolean") {
if (typeof value !== "boolean") throw new Error(`Authoring helper argument at ${path} must be a boolean`);
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 (descriptor.kind === "option") {
if (typeof value !== "string" || !descriptor.values.includes(value)) throw new Error(`Authoring helper argument at ${path} must be one of: ${descriptor.values.join(", ")}`);
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 = template.nativeType;
if (nativeType === void 0) throw new Error(`Authoring output template for codec "${template.codecId}" declares no nativeType; only entity-ref constructors may omit it`);
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)}`);
const normalizedTypeParams = typeParams !== void 0 && Object.keys(typeParams).length === 0 ? void 0 : typeParams;
return {
codecId: template.codecId,
nativeType,
...ifDefined("typeParams", normalizedTypeParams)
};
}
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");
if (!isColumnDefaultLiteralInputValue(value)) throw new Error(`Resolved authoring literal default must be a JSON-serializable value or Date, received ${String(value)}`);
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 resolveExecutionMutationDefaultPhase(phase, template, args) {
const value = resolveAuthoringTemplateValue(template, args);
if (value === void 0) return;
if (!isExecutionMutationDefaultValue(value)) throw new Error(`Authoring preset executionDefaults.${phase} did not resolve to a valid generator descriptor (kind: 'generator', id: string).`);
return value;
}
function resolveAuthoringExecutionDefaultsTemplate(template, args) {
const phases = {
...ifDefined("onCreate", template.onCreate !== void 0 ? resolveExecutionMutationDefaultPhase("onCreate", template.onCreate, args) : void 0),
...ifDefined("onUpdate", template.onUpdate !== void 0 ? resolveExecutionMutationDefaultPhase("onUpdate", template.onUpdate, args) : void 0)
};
return Object.keys(phases).length === 0 ? void 0 : phases;
}
function instantiateAuthoringTypeConstructor(descriptor, args) {
return resolveAuthoringStorageTypeTemplate(descriptor.output, args);
}
function instantiateAuthoringEntityType(helperPath, descriptor, args, ctx) {
if ("factory" in descriptor.output) {
const input = args[0];
return blindCast(descriptor.output.factory)(input, ctx);
}
validateAuthoringHelperArguments(helperPath, descriptor.args, args);
return blindCast(resolveAuthoringTemplateValue(descriptor.output.template, 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("executionDefaults", descriptor.output.executionDefaults !== void 0 ? resolveAuthoringExecutionDefaultsTemplate(descriptor.output.executionDefaults, args) : void 0),
id: descriptor.output.id ?? false,
unique: descriptor.output.unique ?? false
};
}
//#endregion
export { resolveAuthoringTemplateValue as _, collectScalarTypeConstructors as a, instantiateAuthoringFieldPreset as c, isAuthoringEntityTypeDescriptor as d, isAuthoringFieldPresetDescriptor as f, mergeAuthoringNamespaces as g, isAuthoringTypeConstructorDescriptor as h, collectContributedDescriptorPaths as i, instantiateAuthoringTypeConstructor as l, isAuthoringPslBlockDescriptor as m, assertResolvableTypeConstructorTemplates as n, hasRegisteredFieldNamespace as o, isAuthoringModelAttributeDescriptor as p, classifyEnumMemberType as r, instantiateAuthoringEntityType as s, assertNoCrossRegistryCollisions as t, isAuthoringArgRef as u, resolveEnumCodecId as v, validateAuthoringHelperArguments as y };
//# sourceMappingURL=framework-authoring-DfnkbOVh.mjs.map

Sorry, the diff of this file is too big to display

import { r as CodecLookup } from "./codec-types-4tPB4m_G.mjs";
import { ColumnDefault, ExecutionMutationDefaultPhases } from "@prisma-next/contract/types";
import { Type } from "arktype";
//#region src/shared/option-descriptor.d.ts
/**
* An enumerated-value parameter: the author supplies one of `values`, spelled
* as a bare token in PSL and a string literal in TypeScript. Shared by the
* extension-block parameter vocabulary (`PslBlockParamOption`) and the helper
* argument vocabulary (`AuthoringArgumentDescriptor`) so the option concept is
* declared once. See ADR 239.
*/
interface AuthoringOption {
readonly kind: 'option';
readonly values: readonly string[];
}
//#endregion
//#region src/shared/psl-extension-block.d.ts
interface PslPosition {
readonly offset: number;
readonly line: number;
readonly column: number;
}
interface PslSpan {
readonly start: PslPosition;
readonly end: PslPosition;
}
type PslDiagnosticCode = 'PSL_UNTERMINATED_BLOCK' | 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK' | 'PSL_INVALID_NAMESPACE_BLOCK' | 'PSL_INVALID_ATTRIBUTE_SYNTAX' | 'PSL_INVALID_MODEL_MEMBER' | 'PSL_UNSUPPORTED_MODEL_ATTRIBUTE' | 'PSL_UNSUPPORTED_FIELD_ATTRIBUTE' | 'PSL_INVALID_RELATION_ATTRIBUTE' | 'PSL_INVALID_REFERENTIAL_ACTION' | 'PSL_INVALID_DEFAULT_VALUE' | 'PSL_INVALID_ENUM_MEMBER' | 'PSL_INVALID_TYPES_MEMBER' | 'PSL_INVALID_QUALIFIED_TYPE' |
/**
* A qualified name (e.g. a dotted type or attribute reference) is structurally
* invalid, such as an over-qualified or trailing-separator name.
*/
'PSL_INVALID_QUALIFIED_NAME' |
/**
* A reserved declaration keyword (`model`/`enum`/`namespace`/`type`) that
* committed the declaration kind on the keyword alone but is missing its name
* and/or opening brace. The recursive-descent parser produces a best-effort
* typed node for the malformed header and reports this code rather than
* `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`, which is reserved for a genuinely unknown
* top-level keyword.
*/
'PSL_INVALID_DECLARATION' |
/**
* A malformed line inside an extension-contributed top-level block body, or
* a structurally invalid element inside a `list` parameter value.
*
* Replaces the overloaded `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK` code that the
* generic framework parser previously used for these two parse-error sites
* inside extension blocks — keeping `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK` for
* its original meaning (an unknown keyword at the top level) and giving
* extension-block parse errors their own code.
*/
'PSL_INVALID_EXTENSION_BLOCK_MEMBER' |
/**
* A malformed JS-like object literal `{ key: value, … }` in value/argument
* position — a field missing its `:`, a field missing its value, or an
* unterminated `{`. The recursive-descent parser still produces a best-effort
* `ObjectLiteralExpr` node (preserving the lossless round-trip) and reports
* this code anchored on the offending token.
*/
'PSL_INVALID_OBJECT_LITERAL' |
/**
* A string literal with no closing quote — the tokenizer stops the literal at
* a newline or at EOF when no terminating `"` is found, and the
* recursive-descent parser still consumes the token (preserving the lossless
* round-trip) but reports this code anchored on the string token's span.
*/
'PSL_UNTERMINATED_STRING' |
/**
* An unknown parameter key in an extension-contributed block — a key present
* in the source block but absent from the descriptor's `parameters` map.
*/
'PSL_EXTENSION_UNKNOWN_PARAMETER' |
/**
* A required parameter declared in the descriptor is absent from the parsed block.
*/
'PSL_EXTENSION_MISSING_REQUIRED_PARAMETER' |
/**
* An `option`-kind parameter value is not one of the allowed tokens listed
* in the descriptor's `values` array.
*/
'PSL_EXTENSION_OPTION_OUT_OF_SET' |
/**
* A `value`-kind parameter's raw text is not a valid JSON literal, or the
* parsed JSON value was rejected by the codec's `decodeJson` method, or the
* codec id is not registered in the lookup.
*/
'PSL_EXTENSION_INVALID_VALUE' |
/**
* A `ref`-kind parameter identifier does not resolve to a declared entity of
* the required `refKind` within the declared scope.
*/
'PSL_EXTENSION_UNRESOLVED_REF' |
/**
* A parameter key appears more than once in an extension block body.
* The first occurrence is kept; subsequent occurrences emit this diagnostic.
*/
'PSL_EXTENSION_DUPLICATE_PARAMETER' |
/**
* A `@@`-prefixed block-attribute line inside an extension block has invalid syntax.
*/
'PSL_INVALID_EXTENSION_BLOCK_ATTRIBUTE' |
/**
* Duplicate scopes are top level, namespace body, or block fields; diagnostics
* are first-wins and anchored on later name spans.
*/
'PSL_DUPLICATE_DECLARATION';
/**
* Descriptor vocabulary for a single parameter on a declared block.
*
* Four kinds:
* - `ref` — the parameter value is an identifier that must resolve to a
* declared entity of `refKind` within the declared `scope`.
* - `value` — the parameter value is a PSL literal parsed and printed
* through the codec identified by `codecId`.
* - `option` — the parameter value is one of the literal tokens in `values`.
* Not a codec; not persisted data. A closed authoring-time constraint only.
* - `list` — a bracketed list whose elements each match the `of` descriptor.
*/
type PslBlockParam = PslBlockParamRef | PslBlockParamValue | PslBlockParamOption | PslBlockParamList;
interface PslBlockParamRef {
readonly kind: 'ref';
readonly refKind: string;
readonly scope: 'same-namespace' | 'same-space' | 'cross-space';
readonly required?: boolean;
}
interface PslBlockParamValue {
readonly kind: 'value';
readonly codecId: string;
readonly required?: boolean;
}
interface PslBlockParamOption extends AuthoringOption {
readonly required?: boolean;
}
interface PslBlockParamList {
readonly kind: 'list';
readonly of: PslBlockParam;
readonly required?: boolean;
}
/**
* The parsed representation of a single parameter value on a uniform
* extension-block AST node. Mirrors the `PslBlockParam` descriptor
* vocabulary, plus `bare` for keyonly entries:
*
* - `ref` → `PslExtensionBlockParamRef` — a raw identifier string
* (resolution runs in the validator, not the parser).
* - `value` → `PslExtensionBlockParamScalarValue` — a raw PSL literal string
* (codec validation runs in the validator).
* - `option` → `PslExtensionBlockParamOption` — the chosen token.
* - `list` → `PslExtensionBlockParamList` — ordered list of the above.
* - `bare` → `PslExtensionBlockParamBare` — a bare identifier line with no
* `= value` (e.g. `Low` in an enum block). The name is the key in
* `parameters`; the interpreting consumer decides the default value.
*
* These shapes are intentionally minimal. The validator and lowering refine
* and consume them; the generic framework parser produces them.
*/
type PslExtensionBlockParamValue = PslExtensionBlockParamRef | PslExtensionBlockParamScalarValue | PslExtensionBlockParamOption | PslExtensionBlockParamList | PslExtensionBlockParamBare;
interface PslExtensionBlockParamRef {
readonly kind: 'ref';
readonly identifier: string;
readonly span: PslSpan;
}
interface PslExtensionBlockParamScalarValue {
readonly kind: 'value';
readonly raw: string;
readonly span: PslSpan;
}
interface PslExtensionBlockParamOption {
readonly kind: 'option';
readonly token: string;
readonly span: PslSpan;
}
interface PslExtensionBlockParamList {
readonly kind: 'list';
readonly items: readonly PslExtensionBlockParamValue[];
readonly span: PslSpan;
}
/**
* A bare identifier line inside an extension block — a key with no `= value`.
* Emitted when a line matches `/^[A-Za-z_]\w*$/` with no assignment. The
* consumer decides what default value (if any) to apply.
*/
interface PslExtensionBlockParamBare {
readonly kind: 'bare';
readonly span: PslSpan;
}
/**
* A positional argument on a block attribute, e.g. the `"pg/text@1"` in
* `@@type("pg/text@1")`.
*/
interface PslExtensionBlockAttributeArg {
readonly kind: 'positional';
readonly value: string;
readonly span: PslSpan;
}
/**
* A `@@`-prefixed block-level attribute parsed inside an extension block,
* e.g. `@@type("pg/text@1")`. Block attributes are captured generically
* — the parser does not validate attribute names or argument shapes; that
* is a concern of the block's interpreter.
*/
interface PslExtensionBlockAttribute {
readonly name: string;
readonly args: readonly PslExtensionBlockAttributeArg[];
readonly span: PslSpan;
}
/**
* Base shape for a uniform extension-contributed top-level PSL block
* node, as produced by the generic framework parser and consumed by the
* validator, printer, and lowering factory.
*
* - `kind` is the routing discriminant, equal to the descriptor's
* `discriminator`. The framework parser sets this to
* `descriptor.discriminator` for every block it parses. Several keywords
* may share one discriminator (e.g. `policy_select`/`policy_insert` both
* route to `kind: 'policy'`) — `kind` identifies the entity/storage kind,
* not the source syntax.
* - `keyword` is the source PSL keyword the block was declared with
* (`policy_select`, `policy_insert`, …) — the parse-dispatch identity.
* Distinct from `kind` precisely when a discriminator is shared by more
* than one keyword; a lowering factory that contributes several keywords
* under one discriminator reads `keyword` to tell its blocks apart, and
* the printer re-emits each block under its own `keyword` regardless of
* how many other keywords share its `kind`.
* - `name` is the block's declared name (the identifier after the keyword).
* - `parameters` is the descriptor-driven parameter map. Keys are
* parameter names from the descriptor; values are the parsed parameter
* representations. Only parameters present in the source are included
* — absence of a required parameter is a validator concern, not a
* parser concern. Insertion order is preserved; the first occurrence of a
* duplicate key is retained and subsequent occurrences emit
* `PSL_EXTENSION_DUPLICATE_PARAMETER`.
* - `blockAttributes` are `@@`-prefixed attribute lines inside the block, in
* declaration order. Captured generically — names and args are not validated
* by the parser.
* - `span` covers the full block from keyword to closing brace.
*/
interface PslExtensionBlock {
readonly kind: string;
/**
* The block's parse identity — the source PSL keyword it was declared
* with. `kind`/`discriminator` is its storage identity; several keywords
* can share one. E.g. the five `policy_*` keywords all lower to the
* `policy` entity kind.
*/
readonly keyword: string;
readonly name: string;
readonly parameters: Record<string, PslExtensionBlockParamValue>;
readonly blockAttributes: readonly PslExtensionBlockAttribute[];
readonly span: PslSpan;
}
//#endregion
//#region src/shared/framework-authoring.d.ts
type AuthoringArgRef = {
readonly kind: 'arg';
readonly index: number;
readonly path?: readonly string[];
readonly default?: AuthoringTemplateValue;
};
/**
* Selects among `cases` by the value of the referenced argument: the resolved
* value must be one of the case keys, and the node resolves to that case's
* recursively resolved template. An absent argument resolves to `undefined`,
* which the enclosing object template omits entirely.
*
* Case coverage is validated against the referenced option argument's
* `values` at pack-registration time, so the runtime miss-throw is an
* assertion for type-bypassing callers, not a user-facing diagnostic.
*
* Must not be used in the `codecId`/`nullable`/`id`/`unique` positions of a
* preset output: the type-level `ResolveTemplateValue` does not implement
* select, and those fields feed TS builder-state inference. See ADR 239.
*/
interface AuthoringSelectRef {
readonly kind: 'select';
readonly index: number;
readonly path?: readonly string[];
readonly cases: Readonly<Record<string, AuthoringTemplateValue>>;
}
type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | AuthoringSelectRef | readonly AuthoringTemplateValue[] | {
readonly [key: string]: AuthoringTemplateValue;
};
interface AuthoringArgumentDescriptorCommon {
readonly name?: string;
readonly optional?: boolean;
}
type AuthoringArgumentDescriptor = AuthoringArgumentDescriptorCommon & ({
readonly kind: 'string';
} | {
readonly kind: 'boolean';
} | {
readonly kind: 'number';
readonly integer?: boolean;
readonly minimum?: number;
readonly maximum?: number;
} | {
readonly kind: 'stringArray';
} | {
readonly kind: 'object';
readonly properties: Record<string, AuthoringArgumentDescriptor>;
} | AuthoringOption);
interface AuthoringStorageTypeTemplate {
readonly codecId: string;
/**
* The storage type's base name — a plain string, never a template:
* parameters live in `typeParams` and the DDL renderer composes them.
* Optional so a type constructor whose {@link AuthoringTypeConstructorDescriptor.entityRefArg}
* names another entity can omit it entirely — its output for that case is
* derived by the codec at `codecId`. Every other consumer of this shape
* (field presets, plain type constructors) always supplies it.
*/
readonly nativeType?: string;
readonly typeParams?: Record<string, AuthoringTemplateValue>;
}
/**
* Declares that one positional argument of a
* {@link AuthoringTypeConstructorDescriptor} call names another entity
* parsed from the same document, rather than carrying a literal value (e.g.
* `pg.enum(AalLevel)` naming a `native_enum` entity). `index` is the
* argument's position in the call; `entityKind` is the entries-slot
* discriminator the interpreter looks the named entity up under (the same
* shape {@link AuthoringEntityTypeFactoryOutput.factory} output is collected
* into, keyed by discriminator then block name).
*
* The interpreter resolves the named argument to the entity instance
* generically, driven only by this declaration — it has no target-specific
* knowledge of which type constructors carry one. Converting the resolved
* entity into the constructor's params is a separate, codec-owned concern:
* the codec descriptor registered for `output.codecId` supplies that
* conversion, not this framework type.
*/
interface AuthoringTypeConstructorEntityRef {
readonly index: number;
readonly entityKind: string;
}
interface AuthoringTypeConstructorDescriptor {
readonly kind: 'typeConstructor';
readonly args?: readonly AuthoringArgumentDescriptor[];
readonly output: AuthoringStorageTypeTemplate;
/** Present when one of this constructor's positional arguments names another document-local entity instead of carrying a literal value. Absent for ordinary literal-argument constructors. */
readonly entityRefArg?: AuthoringTypeConstructorEntityRef;
}
interface AuthoringColumnDefaultTemplateLiteral {
readonly kind: 'literal';
readonly value: AuthoringTemplateValue;
}
interface AuthoringColumnDefaultTemplateFunction {
readonly kind: 'function';
readonly expression: AuthoringTemplateValue;
}
type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction;
interface AuthoringExecutionDefaultsTemplate {
readonly onCreate?: AuthoringTemplateValue;
readonly onUpdate?: AuthoringTemplateValue;
}
interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {
readonly nullable?: boolean;
readonly default?: AuthoringColumnDefaultTemplate;
readonly executionDefaults?: AuthoringExecutionDefaultsTemplate;
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;
};
/**
* Context surfaced to entity-type factories at call time. Currently a
* placeholder — sharpened as concrete consumers (enum, namespace, …)
* discover what the factory actually needs to read (codec lookup,
* namespace registry, …).
*/
/**
* A write-only sink that a factory may push authoring-time diagnostics into.
* The concrete type pushed must be structurally compatible with whatever the
* consumer accumulates (typically `ContractSourceDiagnostic[]`); the framework
* layer deliberately does not depend on that concrete type.
*/
interface AuthoringDiagnosticSink {
push(d: {
readonly code: string;
readonly message: string;
readonly sourceId: string;
readonly span?: unknown;
}): void;
}
interface AuthoringEntityContext {
readonly family: string;
readonly target: string;
/** Codec registry available to factories that need to validate or decode values. */
readonly codecLookup?: CodecLookup;
/** Source file identifier threaded into diagnostics emitted by the factory. */
readonly sourceId?: string;
/** Push channel for authoring-time diagnostics emitted by the factory. */
readonly diagnostics?: AuthoringDiagnosticSink;
/**
* The target's default codec ids for an `enum` block that omits `@@type`.
* `text` is used when every member is a bare name or a string value;
* `int` is used when every member is an integer value. Every target pack
* populates this so `@@type` omission can be inferred consistently.
*/
readonly enumInferenceCodecs?: {
readonly text: string;
readonly int: string;
};
}
/**
* Classifies an `enum` block's members (before codec decoding, which needs
* the codec chosen first) into which default codec an omitted `@@type`
* should resolve to:
*
* - every member is `bare`, or a `value` whose raw JSON is a string → `'text'`
* - every member is a `value` whose raw JSON is an integer → `'int'`
* - anything else (float, bigint, boolean, mixed, or a `ref`/`option`/`list`
* parameter) → `null`, meaning the caller must require an explicit `@@type`.
*/
declare function classifyEnumMemberType(block: PslExtensionBlock): 'text' | 'int' | null;
/**
* Resolves the codec id for an `enum` block. When `@@type` is absent, the codec
* is inferred from the members via {@link classifyEnumMemberType}; otherwise the
* explicit `@@type("codec")` argument is parsed. Pushes the appropriate
* diagnostic and returns `undefined` when neither yields a codec. `codecSpan` is
* the span downstream codec-validation diagnostics should anchor to. Shared by
* every family's enum factory so inference and the explicit path stay identical.
*/
declare function resolveEnumCodecId(block: PslExtensionBlock, ctx: AuthoringEntityContext): {
readonly codecId: string;
readonly codecSpan: PslSpan;
} | undefined;
interface AuthoringEntityTypeTemplateOutput {
readonly template: AuthoringTemplateValue;
}
/**
* Default `Input = never` is load-bearing for pack-bag-driven type
* narrowing. Factory parameter positions are contravariant, so a pack
* literal declaring `factory: (input: DemoEntityInput) => DemoEntity`
* is only assignable to the base descriptor's factory shape if the
* base's input is `never` (the bottom of the contravariant position).
* The concrete input/output types are recovered at the helper-derivation
* site via `EntityHelperFunction<Descriptor>`'s conditional inference,
* which reads them from the pack's `as const` literal factory signature
* — the base widening does not erase the literal because `satisfies`
* does not widen the declared type.
*/
interface AuthoringEntityTypeFactoryOutput<Input = never, Output = unknown> {
readonly factory: (input: Input, ctx: AuthoringEntityContext) => Output;
}
interface AuthoringEntityTypeDescriptor<Input = never, Output = unknown> {
readonly kind: 'entity';
readonly discriminator: string;
readonly args?: readonly AuthoringArgumentDescriptor[];
readonly output: AuthoringEntityTypeTemplateOutput | AuthoringEntityTypeFactoryOutput<Input, Output>;
/**
* arktype schema fragment for one entry whose envelope `kind` matches
* this descriptor's {@link discriminator}. The family validator composes
* contributed fragments into the per-namespace entry schema at
* validator construction time so the structural check covers
* pack-introduced kinds without the family core hard-coding the schema.
*
* Hydration uses {@link AuthoringEntityTypeFactoryOutput.factory}
* directly — the wire shape conforms structurally to the factory's
* `Input` after `validatorSchema` validates it.
*/
readonly validatorSchema?: Type<unknown>;
}
type AuthoringEntityTypeNamespace = {
readonly [name: string]: AuthoringEntityTypeDescriptor | AuthoringEntityTypeNamespace;
};
/**
* Declarative descriptor for an extension-contributed top-level PSL block.
*
* An extension registers one of these per keyword it contributes. The
* framework owns the generic parser, validator, and printer — no
* parsing or printing code runs from the extension.
*
* - `keyword` is the PSL top-level identifier this descriptor claims
* (`policy_select`, `role`, …).
* - `discriminator` is the routing key used by the printer dispatch and
* the `entityTypes` lowering factory lookup. Convention:
* `<target-or-family>-<kind>` (`postgres-policy-select`).
* - `name.required` declares whether the block must have a name token
* after the keyword. Currently always `true` — anonymous blocks are
* not part of the closed-grammar premise — but the field is explicit
* so the type can evolve without a breaking change.
* - `parameters` maps parameter names to their value-kind descriptors
* (`ref` / `value` / `option` / `list`). The generic parser and
* validator interpret these; the extension supplies no parser or
* printer function.
*/
interface AuthoringPslBlockDescriptor {
readonly kind: 'pslBlock';
readonly keyword: string;
readonly discriminator: string;
readonly name: {
readonly required: boolean;
};
readonly parameters: Record<string, PslBlockParam>;
/**
* When `true`, the block body accepts a variadic tail of parameters beyond
* the declared set. The block body may contain: fields (model-style),
* `key = value` parameters, and `@@` attributes. With `variadicParameters`,
* bare identifiers (keys without a `= value`) and undeclared `key = value`
* pairs flow into the variadic tail — their semantics belong to the
* lowering, not the parser.
*
* A key that IS declared in `parameters` must still be supplied as
* `key = value`; a bare occurrence of a declared key is a diagnostic.
*
* When `false` (default), the validator emits `PSL_EXTENSION_UNKNOWN_PARAMETER`
* for keys absent from `parameters`.
*/
readonly variadicParameters?: boolean;
/**
* Declares that the model named by the block's ref parameter `parameter`
* must carry the bare `@@` model attribute `attribute`. The family
* interpreter enforces this generically over the whole parsed document —
* declaration order of the block and the model does not matter — and
* emits `PSL_EXTENSION_TARGET_MODEL_MISSING_ATTRIBUTE` naming the block
* and the model when the attribute is absent. A parameter that is
* missing or does not resolve to a model is not this rule's concern
* (missing-parameter and unresolved-ref diagnostics own those cases).
*/
readonly requiresModelAttribute?: {
readonly parameter: string;
readonly attribute: string;
};
}
type AuthoringPslBlockDescriptorNamespace = {
readonly [name: string]: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace;
};
/**
* Context surfaced to a model-attribute lowering at call time: the entity
* context shared with entity-type factories, plus the declaring model's
* name, its mapped storage name (the name of the storage object the model
* maps to; which kind of object that is belongs to the family, not the
* framework), and the namespace id the lowered entity should be filed
* under.
*/
interface AuthoringModelAttributeContext extends AuthoringEntityContext {
readonly modelName: string;
readonly storageName: string;
readonly namespaceId: string;
}
/**
* What a model-attribute lowering returns when it produces an entity: `key`
* is the identity the entity is stored under within its `entries` slot
* (`entries[attribute][key]`); `entity` is the value stored there. A
* lowering that instead pushed a diagnostic through
* {@link AuthoringModelAttributeContext.diagnostics} returns `undefined` —
* the same convention {@link AuthoringEntityTypeFactoryOutput} uses.
*/
interface AuthoringModelAttributeLoweringOutput {
readonly key: string;
readonly entity: unknown;
}
/**
* Declarative descriptor for an extension-contributed `@@` model attribute.
*
* An extension registers one of these per bare attribute name it
* contributes. The framework owns the generic consult in the interpreter's
* model-attribute loop; the contribution supplies only `spec` and `lower`.
*
* - `attribute` is the bare `@@` attribute name this descriptor claims and,
* by the one-string rule, the `entries` slot its lowered entities are
* grouped under (`entries[attribute][key]`).
* - `spec` is opaque to the framework core: an ADR-231 attribute-spec kit
* `AttributeSpec<Out>` value (`modelAttribute(name, {...})` from
* `@prisma-next/psl-parser`). Framework core does not depend on
* psl-parser and never inspects this field; the family interpreter,
* which does depend on psl-parser, parses the attribute's arguments
* against it.
* - `lower` receives the parsed arguments and the declaring model's
* context, and returns the entity to file into `entries`, or `undefined`
* after pushing a diagnostic via `ctx.diagnostics`.
*
* `Out` defaults to `never` — not `unknown` — for the same contravariance
* reason documented on {@link AuthoringEntityTypeFactoryOutput}: a concrete
* pack literal's narrower `lower(parsed: ConcreteOut, ctx)` is only
* assignable to this base shape when the base parameter is the bottom type.
*/
interface AuthoringModelAttributeDescriptor<Out = never> {
readonly kind: 'modelAttribute';
readonly attribute: string;
readonly spec: unknown;
readonly lower: (parsed: Out, ctx: AuthoringModelAttributeContext) => AuthoringModelAttributeLoweringOutput | undefined;
}
type AuthoringModelAttributeDescriptorNamespace = {
readonly [name: string]: AuthoringModelAttributeDescriptor | AuthoringModelAttributeDescriptorNamespace;
};
interface AuthoringContributions {
readonly type?: AuthoringTypeNamespace;
readonly field?: AuthoringFieldNamespace;
readonly entityTypes?: AuthoringEntityTypeNamespace;
/**
* Registry of declarative block descriptors this contribution registers,
* keyed by arbitrary path segments. Each leaf is an
* {@link AuthoringPslBlockDescriptor} that claims a PSL top-level keyword.
* The framework owns the generic parser, validator, and printer; the
* contribution supplies only these declarative descriptors.
*
* Contrast with the parsed block nodes themselves, which live in a
* namespace's `entries` under their discriminator key; this field holds the
* registry of descriptors that teach the parser how to read those blocks.
*/
readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;
/**
* Registry of declarative `@@` model attribute descriptors this
* contribution registers, keyed by arbitrary path segments. Each leaf is
* an {@link AuthoringModelAttributeDescriptor} that claims a bare model
* attribute name. The framework owns the generic consult in the family
* interpreter's model-attribute loop; the contribution supplies only the
* declarative spec and the lowering.
*/
readonly modelAttributes?: AuthoringModelAttributeDescriptorNamespace;
/**
* Names the top-level type constructor that stores embedded value-object
* fields (fields typed as a value-object `type` block). A single named
* slot per component makes within-component ambiguity impossible by
* shape. Assembly rejects two components both declaring it, validates
* that the assembled namespace carries the named constructor as a
* top-level bare-eligible entry (see
* {@link collectScalarTypeConstructors}), and exposes the single value to
* family interpreters — so family layers never hardcode a target's type
* names.
*/
readonly valueObjectStorageType?: string;
}
declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef;
declare function isAuthoringTypeConstructorDescriptor(value: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace): value is AuthoringTypeConstructorDescriptor;
declare function isAuthoringFieldPresetDescriptor(value: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace): value is AuthoringFieldPresetDescriptor;
declare function isAuthoringEntityTypeDescriptor(value: AuthoringEntityTypeDescriptor | AuthoringEntityTypeNamespace): value is AuthoringEntityTypeDescriptor;
declare function isAuthoringPslBlockDescriptor(value: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace): value is AuthoringPslBlockDescriptor;
declare function isAuthoringModelAttributeDescriptor(value: AuthoringModelAttributeDescriptor | AuthoringModelAttributeDescriptorNamespace): value is AuthoringModelAttributeDescriptor;
/**
* Returns true when `namespace` is a non-leaf key in `contributions.field`.
*
* `AuthoringFieldNamespace` permits a leaf descriptor at any depth — including
* the root — so a top-level `field: { Foo: { kind: 'fieldPreset', ... } }`
* registration must NOT be treated as a "namespace" with sub-paths. Callers
* use this predicate to gate dot-namespaced lookups (e.g. PSL `@Foo.bar`).
*/
declare function hasRegisteredFieldNamespace(contributions: AuthoringContributions | undefined, namespace: string): boolean;
/**
* Merges `source` into `target` recursively at the descriptor-namespace
* level. `descriptorKind` is the `kind` value ('typeConstructor',
* 'fieldPreset', 'entity', or 'pslBlock') that identifies a descriptor
* (terminal merge point; same-path registrations across components are
* reported as duplicates) as opposed to a sub-namespace (recursion target).
*
* Path segments are validated against prototype-pollution names
* (`__proto__`, `constructor`, `prototype`). A value that is neither a
* recognized leaf nor a plain object — e.g. a malformed descriptor
* where the canonical leaf guard rejected it for missing `output` —
* is reported as an invalid contribution rather than recursed into,
* which would either silently mangle state or infinite-loop on
* primitive properties.
*
* Within-registry duplicate detection is this walker's job;
* cross-registry detection runs separately via
* `assertNoCrossRegistryCollisions` after merging completes.
*/
declare function mergeAuthoringNamespaces(target: Record<string, unknown>, source: Record<string, unknown>, path: readonly string[], descriptorKind: string, label: string): void;
interface ScalarTypeConstructorOutput {
readonly codecId: string;
readonly nativeType: string;
readonly typeParams?: Record<string, unknown>;
}
/**
* Derives the scalar view of an assembled authoring type namespace: every
* **top-level** type constructor that is instantiable with an empty argument
* list — all declared args optional and no entity-ref argument. A bare type
* name `T` in a schema is semantically the zero-arg instantiation `T()`, so
* each entry is exactly what that call produces (defaulted template values
* applied, absent optional-arg typeParams keys omitted). Constructors
* registered under a namespace segment, constructors with required args, and
* entity-ref constructors are not scalars and are excluded.
*
* Eligibility needs no template inspection: templates that cannot resolve
* for their legal call shapes are rejected at the composition boundary by
* {@link assertResolvableTypeConstructorTemplates}, so the zero-arg
* instantiation below cannot fail for an eligible constructor.
*/
declare function collectScalarTypeConstructors(namespace: AuthoringTypeNamespace): ReadonlyMap<string, ScalarTypeConstructorOutput>;
/**
* Boundary validation for a contributed authoring type namespace, called
* per contributing component at assembly (which supplies `contributedBy`
* for attribution). Rejects what the types cannot express — entity-ref
* constructors are skipped (their output derives from the referenced
* entity): a plain constructor must declare its output storage type name,
* and every `typeParams` arg-ref (including refs inside arg-ref defaults)
* must point at a declared argument index.
*/
declare function assertResolvableTypeConstructorTemplates(namespace: AuthoringTypeNamespace, contributedBy: string, path?: readonly string[]): void;
declare function assertNoCrossRegistryCollisions(typeNamespace: AuthoringTypeNamespace, fieldNamespace: AuthoringFieldNamespace, entityTypeNamespace?: AuthoringEntityTypeNamespace, pslBlockNamespace?: AuthoringPslBlockDescriptorNamespace, modelAttributeNamespace?: AuthoringModelAttributeDescriptorNamespace): void;
declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue | undefined, 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 instantiateAuthoringEntityType<TOutput = unknown>(helperPath: string, descriptor: AuthoringEntityTypeDescriptor, args: readonly unknown[], ctx: AuthoringEntityContext): TOutput;
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?: ColumnDefault;
readonly executionDefaults?: ExecutionMutationDefaultPhases;
readonly id: boolean;
readonly unique: boolean;
};
//#endregion
export { PslExtensionBlockAttributeArg as $, collectScalarTypeConstructors as A, isAuthoringTypeConstructorDescriptor as B, AuthoringTypeConstructorDescriptor as C, assertNoCrossRegistryCollisions as D, ScalarTypeConstructorOutput as E, isAuthoringArgRef as F, PslBlockParam as G, resolveAuthoringTemplateValue as H, isAuthoringEntityTypeDescriptor as I, PslBlockParamRef as J, PslBlockParamList as K, isAuthoringFieldPresetDescriptor as L, instantiateAuthoringEntityType as M, instantiateAuthoringFieldPreset as N, assertResolvableTypeConstructorTemplates as O, instantiateAuthoringTypeConstructor as P, PslExtensionBlockAttribute as Q, isAuthoringModelAttributeDescriptor as R, AuthoringTemplateValue as S, AuthoringTypeNamespace as T, resolveEnumCodecId as U, mergeAuthoringNamespaces as V, validateAuthoringHelperArguments as W, PslDiagnosticCode as X, PslBlockParamValue as Y, PslExtensionBlock as Z, AuthoringModelAttributeLoweringOutput as _, AuthoringDiagnosticSink as a, PslExtensionBlockParamValue as at, AuthoringSelectRef as b, AuthoringEntityTypeFactoryOutput as c, AuthoringOption as ct, AuthoringFieldNamespace as d, PslExtensionBlockParamBare as et, AuthoringFieldPresetDescriptor as f, AuthoringModelAttributeDescriptorNamespace as g, AuthoringModelAttributeDescriptor as h, AuthoringContributions as i, PslExtensionBlockParamScalarValue as it, hasRegisteredFieldNamespace as j, classifyEnumMemberType as k, AuthoringEntityTypeNamespace as l, AuthoringModelAttributeContext as m, AuthoringArgumentDescriptor as n, PslExtensionBlockParamOption as nt, AuthoringEntityContext as o, PslPosition as ot, AuthoringFieldPresetOutput as p, PslBlockParamOption as q, AuthoringColumnDefaultTemplate as r, PslExtensionBlockParamRef as rt, AuthoringEntityTypeDescriptor as s, PslSpan as st, AuthoringArgRef as t, PslExtensionBlockParamList as tt, AuthoringEntityTypeTemplateOutput as u, AuthoringPslBlockDescriptor as v, AuthoringTypeConstructorEntityRef as w, AuthoringStorageTypeTemplate as x, AuthoringPslBlockDescriptorNamespace as y, isAuthoringPslBlockDescriptor as z };
//# sourceMappingURL=framework-authoring-DT8QRvDv.d.mts.map
{"version":3,"file":"framework-authoring-DT8QRvDv.d.mts","names":[],"sources":["../src/shared/option-descriptor.ts","../src/shared/psl-extension-block.ts","../src/shared/framework-authoring.ts"],"mappings":";;;;;;;;;;;UAOiB;WACN;WACA;;;;UCKM;WACN;WACA;WACA;;UAGM;WACN,OAAO;WACP,KAAK;;KAGJ;;;;;;;;;;;;;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,QAAQ,yBACR,QAAQ,yBACR,yBACA,wBACA;UA8Ee;WACN;WACA;WACA,aAAa;;;;;;;;;;;;;;;;;iBAkBR,8BACd,WAAW,yBACV,oBAAoB;;;;;;;;;;iBA6CP,yCACd,WAAW,wBACX,uBACA;iBA2Sc,gCACd,eAAe,wBACf,gBAAgB,yBAChB,sBAAqB,8BACrB,oBAAmB,sCACnB,0BAAyB;iBAyKX,8BACd,UAAU,oCACV;iBAgIc,iCACd,oBACA,sBAAsB,2CACtB;iBAyHc,oCACd,YAAY,oCACZ;WAES;WACA;WACA,aAAa;;iBAKR,+BAA+B,mBAC7C,oBACA,YAAY,+BACZ,0BACA,KAAK,yBACJ;iBA2Ba,gCACd,YAAY,gCACZ;WAES;aACE;aACA;aACA,aAAa;;WAEf;WACA,UAAU;WACV,oBAAoB;WACpB;WACA"}
import { f as AnyCodecDescriptor } from "./codec-types-4tPB4m_G.mjs";
import { i as AuthoringContributions } from "./framework-authoring-DT8QRvDv.mjs";
import { t as TypesImportSpec } from "./types-import-spec-DRKzrJ20.mjs";
import { ColumnDefault, ExecutionMutationDefaultPhases, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
//#region src/shared/mutation-default-types.d.ts
interface SourcePosition {
readonly offset: number;
readonly line: number;
readonly column: number;
}
interface SourceSpan {
readonly start: SourcePosition;
readonly end: SourcePosition;
}
interface SourceDiagnostic {
readonly code: string;
readonly message: string;
readonly sourceId?: string;
readonly span?: SourceSpan;
readonly data?: Readonly<Record<string, unknown>>;
}
interface DefaultFunctionLoweringContext {
readonly sourceId: string;
readonly modelName: string;
readonly fieldName: string;
readonly columnCodecId?: string;
}
type LoweredDefaultValue = {
readonly kind: 'storage';
readonly defaultValue: ColumnDefault;
} | {
readonly kind: 'execution';
readonly generated: ExecutionMutationDefaultValue;
};
type LoweredDefaultResult = {
readonly ok: true;
readonly value: LoweredDefaultValue;
} | {
readonly ok: false;
readonly diagnostic: SourceDiagnostic;
};
interface MutationDefaultGeneratorDescriptor {
readonly id: string;
/**
* Codec ids the generator is compatible with when the codec choice
* and the generator choice are made independently by the contract
* author. Set when the registry-coherence check is meaningful
* (the codec and the generator can be paired arbitrarily by the
* caller); omitted when the generator is only reachable through a
* descriptor that co-registers a fixed codec, so coherence is
* structural and the list would be tautological.
*/
readonly applicableCodecIds?: readonly string[];
/**
* Construct the `onCreate`/`onUpdate` phases value owned by this
* generator. Authoring layers (PSL `temporal.updatedAt()`, TS field presets) call
* this instead of building the literal inline so PSL/TS-authored
* contracts stay byte-equivalent for any future params-bearing generator.
*/
readonly buildPhases?: (args?: Record<string, unknown>) => ExecutionMutationDefaultPhases;
}
interface TypedDefaultFunctionCall {
readonly fn: string;
readonly span: SourceSpan;
readonly args: Readonly<Record<string, unknown>>;
}
interface ControlMutationDefaultEntry {
readonly signature?: unknown;
readonly lower: (input: {
readonly call: TypedDefaultFunctionCall;
readonly context: DefaultFunctionLoweringContext;
}) => LoweredDefaultResult;
readonly usageSignatures?: readonly string[];
}
type ControlMutationDefaultRegistry = ReadonlyMap<string, ControlMutationDefaultEntry>;
interface ControlMutationDefaults {
readonly defaultFunctionRegistry: ControlMutationDefaultRegistry;
readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[];
}
//#endregion
//#region src/shared/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 descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.
*/
readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;
};
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;
/**
* Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.
*/
readonly controlMutationDefaults?: ControlMutationDefaults;
}
/**
* 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;
/** The namespace a bare (un-namespaced) entity name resolves to for this target (e.g. Postgres `'public'`). */
readonly defaultNamespaceId: string;
};
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 { SourceDiagnostic as A, ControlMutationDefaultEntry as C, LoweredDefaultResult as D, DefaultFunctionLoweringContext as E, TypedDefaultFunctionCall as M, LoweredDefaultValue as O, checkContractComponentRequirements as S, ControlMutationDefaults as T, 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, SourceSpan as j, MutationDefaultGeneratorDescriptor as k, 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, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
//# sourceMappingURL=framework-components-CDWIpbwD.d.mts.map
{"version":3,"file":"framework-components-CDWIpbwD.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"mappings":";;;;;UAMU;WACC;WACA;WACA;;UAGM;WACN,OAAO;WACP,KAAK;;UAGC;WACN;WACA;WACA;WACA,OAAO;WACP,OAAO,SAAS;;UAGV;WACN;WACA;WACA;WACA;;KAGC;WACG;WAA0B,cAAc;;WACxC;WAA4B,WAAW;;KAE1C;WACG;WAAmB,OAAO;;WAC1B;WAAoB,YAAY;;UAE9B;WACN;;;;;;;;;;WAUA;;;;;;;WAOA,eAAe,OAAO,4BAA4B;;UAK5C;WACN;WACA,MAAM;WACN,MAAM,SAAS;;UAGT;WAIN;WACA,QAAQ;aACN,MAAM;aACN,SAAS;QACd;WACG;;KAGC,iCAAiC,oBAAoB;UAEhD;WACN,yBAAyB;WACzB,+BAA+B;;;;;;;UC7EzB;;WAEN;;;;;;WAOA,eAAe;;WAGf;aACE;;;;eAIE,SAAS;;;;;;;;eAQT,cAAc,cAAc;;;;eAI5B,oBAAoB;;;;eAIpB,mBAAmB,cAAc;;aAEnC;eAAiC,QAAQ;;aACzC,UAAU;eACR;eACA;eACA;eACA;;;;;;;;WASJ,YAAY;;;;WAKZ,0BAA0B;;;;;;;;;;;;;;;;;UAkBpB,oBAAoB,6BAA6B;;WAEvD,MAAM;;WAGN;;UAGM;WACN;aACE;aACA;aACA,iBAAiB;;WAEnB;WACA;WACA,sBAAsB;;UAGhB;WACN;aAA4B;aAA2B;;WACvD;aAA4B;aAA2B;;WACvD;;iBAGK,mCACd,OAAO,0CACN;;;;;;;;;;;;;;;;;;;;;;;;;;UA2Dc,iBAAiB,kCAAkC;;WAEzD,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;UA4BJ,iBAAiB,0BAA0B,kCAClD;;WAEC,UAAU;;WAGV,UAAU;;;;;UAMJ,YAAY,qBAAqB,kCACxC;WACC,MAAM;WACN;WACA,UAAU;WACV;WACA,YAAY;;KAGX,cAAc,qCAAqC,sBAAsB;KAEzE,cACV,mCACA,qCACE,sBAAsB;WACf,UAAU;;WAEV;;KAGC,eACV,mCACA,qCACE,uBAAuB;WAChB,UAAU;;KAGT,iBACV,mCACA,qCACE,yBAAyB;WAClB,UAAU;;KAGT,cACV,mCACA,qCACE,sBAAsB;WACf,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BJ,kBAAkB,0BAA0B,kCACnD;;WAEC,UAAU;;WAGV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,iBAAiB,0BAA0B,kCAClD;;WAEC,UAAU;;WAGV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BJ,oBAAoB,0BAA0B,kCACrD;;WAEC,UAAU;;WAGV,UAAU;;;KAIT,+BAA+B,0BAA0B,4BACjE,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB,eAAe;WACrB,UAAU;;UAGJ,eAAe,0BAA0B;WAC/C,UAAU;WACV,UAAU;;UAGJ,gBAAgB,0BAA0B;WAChD,UAAU;WACV,UAAU;;UAGJ,eAAe,0BAA0B;WAC/C,UAAU;WACV,UAAU;;UAGJ,kBAAkB,0BAA0B;WAClD,UAAU;WACV,UAAU"}
import { r as CodecLookup } from "./codec-types-4tPB4m_G.mjs";
import { X as PslDiagnosticCode, Z as PslExtensionBlock, st as PslSpan, y as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-DT8QRvDv.mjs";
//#region src/control/psl-ast.d.ts
interface PslDiagnostic {
readonly code: PslDiagnosticCode;
readonly message: string;
readonly sourceId: string;
readonly span: PslSpan;
}
interface PslDefaultFunctionValue {
readonly kind: 'function';
readonly name: 'autoincrement' | 'now';
}
interface PslDefaultLiteralValue {
readonly kind: 'literal';
readonly value: string | number | boolean;
}
type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;
type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';
interface PslAttributePositionalArgument {
readonly kind: 'positional';
readonly value: string;
readonly span: PslSpan;
}
interface PslAttributeNamedArgument {
readonly kind: 'named';
readonly name: string;
readonly value: string;
readonly span: PslSpan;
}
type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;
interface PslTypeConstructorCall {
readonly kind: 'typeConstructor';
readonly path: readonly string[];
readonly args: readonly PslAttributeArgument[];
readonly span: PslSpan;
}
interface PslAttribute {
readonly kind: 'attribute';
readonly target: PslAttributeTarget;
readonly name: string;
readonly args: readonly PslAttributeArgument[];
readonly span: PslSpan;
}
type PslReferentialAction = string;
type PslFieldAttribute = PslAttribute;
interface PslField {
readonly kind: 'field';
readonly name: string;
/** Unqualified type name, e.g. `"User"` for both `User`, `auth.User`, and `supabase:auth.User`. */
readonly typeName: string;
/** Namespace qualifier from a dot-qualified type reference, e.g. `"auth"` for `auth.User` or `supabase:auth.User`. Absent for unqualified types. */
readonly typeNamespaceId?: string;
/**
* Contract-space qualifier from a colon-prefix type reference, e.g. `"supabase"` for
* `supabase:auth.User` or `supabase:User`. Absent for local (same-space) type references.
*
* When present, the field references a model from a different contract space. The namespace
* (`typeNamespaceId`) and model name (`typeName`) identify the target within that space.
* Physical table resolution against the extension contract is deferred to the aggregate stage (M3).
*/
readonly typeContractSpaceId?: string;
readonly typeConstructor?: PslTypeConstructorCall;
readonly optional: boolean;
readonly list: boolean;
readonly typeRef?: string;
readonly attributes: readonly PslFieldAttribute[];
readonly span: PslSpan;
}
interface PslUniqueConstraint {
readonly kind: 'unique';
readonly fields: readonly string[];
readonly span: PslSpan;
}
interface PslIndexConstraint {
readonly kind: 'index';
readonly fields: readonly string[];
readonly span: PslSpan;
}
type PslModelAttribute = PslAttribute;
interface PslModel {
readonly kind: 'model';
readonly name: string;
readonly fields: readonly PslField[];
readonly attributes: readonly PslModelAttribute[];
readonly span: PslSpan;
/**
* Optional leading comment line emitted above the `model` keyword by the
* printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection
* advisories such as "// WARNING: This table has no primary key in the
* database" here. The parser leaves this field unset; round-tripping a
* parsed schema does not re-attach comments.
*/
readonly comment?: string;
}
/**
* A reusable group of fields embedded in a model (a `type Name { … }` block) —
* e.g. a MongoDB embedded document or a Postgres composite type. Unlike
* {@link PslModel} it has no storage or identity of its own.
*/
interface PslCompositeType {
readonly kind: 'compositeType';
readonly name: string;
readonly fields: readonly PslField[];
readonly attributes: readonly PslAttribute[];
readonly span: PslSpan;
}
interface PslNamedTypeDeclaration {
readonly kind: 'namedType';
readonly name: string;
/**
* Parser invariant: exactly one of `baseType` and `typeConstructor` is set.
* Expressing this as a discriminated union trips TypeScript narrowing when
* the declaration flows through helpers that accept the full union.
*/
readonly baseType?: string;
readonly typeConstructor?: PslTypeConstructorCall;
readonly attributes: readonly PslAttribute[];
readonly span: PslSpan;
}
interface PslTypesBlock {
readonly kind: 'types';
readonly declarations: readonly PslNamedTypeDeclaration[];
readonly span: PslSpan;
}
/**
* Name of the synthesised namespace bucket the framework parser uses for
* top-level declarations that appear outside any `namespace { … }` block.
* The double-underscore decoration signals that the identifier is parser-
* synthesised and never appears in user-authored PSL source — writing
* `namespace __unspecified__ { … }` is a parse error.
*
* Distinct from the IR sentinel `__unbound__`: the PSL bucket describes
* syntactic absence at the parser layer; the IR sentinel describes a late-
* bound storage slot at the IR layer. Per-target interpreters decide how
* (or whether) to map the PSL bucket to the IR sentinel.
*/
declare const UNSPECIFIED_PSL_NAMESPACE_ID = "__unspecified__";
/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */
type PslNamespaceEntry = PslModel | PslCompositeType | PslExtensionBlock;
/**
* A namespace block, or the parser's synthesised `__unspecified__` bucket for
* declarations outside any `namespace { … }`. Same-name blocks reopen-merge;
* `span` points at the first opening.
*
* Entities are stored canonically (ADR 224) in `entries[kind][name]`, where
* `kind` is the PSL keyword for built-ins or the block discriminator for
* extension kinds, e.g. `entries['policy']['ReadPosts']` (the discriminator,
* not the PSL keyword — a `policy_select` block lands under `'policy'` per
* ADR 225).
*/
interface PslNamespace {
readonly kind: 'namespace';
readonly name: string;
/** Canonical store: a frozen container of frozen per-kind maps. The accessors below derive from it. */
readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
/** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */
readonly models: readonly PslModel[];
/** Built-in composite types, from `entries['compositeType']`. */
readonly compositeTypes: readonly PslCompositeType[];
readonly span: PslSpan;
}
/** Constructs a {@link PslNamespace}. Use this, never a namespace literal — the accessors must derive from `entries`. */
declare function makePslNamespace(init: {
readonly kind: 'namespace';
readonly name: string;
readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
readonly span: PslSpan;
}): PslNamespace;
/**
* Builds the frozen `entries[kind][name]` container from per-kind arrays.
* Built-ins key on their PSL keyword; extension blocks key on their `kind`
* discriminator. Call this rather than hand-building the literal.
*/
declare function makePslNamespaceEntries(models: readonly PslModel[], compositeTypes: readonly PslCompositeType[], extensionBlocks: readonly PslExtensionBlock[]): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
interface PslDocumentAst {
readonly kind: 'document';
readonly sourceId: string;
readonly namespaces: readonly PslNamespace[];
readonly types?: PslTypesBlock;
readonly span: PslSpan;
}
/**
* Returns all models from every namespace in document order. Convenience
* for consumers that don't (yet) need namespace-awareness.
*/
declare function flatPslModels(ast: PslDocumentAst): readonly PslModel[];
/**
* Returns all composite types from every namespace in document order.
*/
declare function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslCompositeType[];
/**
* The set of `entries` kind keys that the framework parser reserves for
* built-in PSL entity kinds. Any own-enumerable key on `PslNamespace.entries`
* that is **not** in this set was contributed by an extension-block descriptor.
*
* Built-in keys match the PSL keyword used on each block type:
* `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the
* extension-block grammar via a registered descriptor, so `entries['enum']`
* holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.
*/
declare const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string>;
/**
* Returns all extension-contributed blocks in the given namespace, in
* insertion order (the order the parser encountered them in the source).
*
* Reads from `namespace.entries`, skipping the built-in kind keys
* (`'model'`, `'compositeType'`). All remaining kind maps contain
* only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).
*/
declare function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[];
interface ParsePslDocumentInput {
readonly schema: string;
readonly sourceId: string;
/**
* Registry of declarative block descriptors, keyed by arbitrary path
* segments with {@link AuthoringPslBlockDescriptor} leaves. The registry
* teaches the parser which top-level keywords belong to extension
* contributions: when the parser encounters an unknown keyword, it looks
* it up here and, when found, reads the block generically into a
* {@link PslExtensionBlock} node. Absent or undefined means no extension
* blocks are registered and any unknown keyword yields
* `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`.
*
* Contrast with the parsed block nodes themselves, which live in
* {@link PslNamespace.entries} under their discriminator key (read them with
* {@link namespacePslExtensionBlocks}); this field holds the registry of
* descriptors that teach the parser how to read those blocks.
*/
readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;
/**
* Codec lookup for validating `value`-kind extension block parameters.
* When provided alongside `pslBlockDescriptors`, the generic validator runs
* over every parsed extension block after the full AST is assembled,
* appending any diagnostics to the parse result. Absent or undefined means
* no codec validation runs; `ref` resolution still runs when namespace
* context is available (built from the assembled namespaces).
*/
readonly codecLookup?: CodecLookup;
}
interface ParsePslDocumentResult {
readonly ast: PslDocumentAst;
readonly diagnostics: readonly PslDiagnostic[];
readonly ok: boolean;
}
//#endregion
export { makePslNamespace as A, PslReferentialAction as C, UNSPECIFIED_PSL_NAMESPACE_ID as D, PslUniqueConstraint as E, namespacePslExtensionBlocks as M, flatPslCompositeTypes as O, PslNamespaceEntry as S, PslTypesBlock as T, PslIndexConstraint as _, PslAttributeArgument as a, PslNamedTypeDeclaration as b, PslAttributeTarget as c, PslDefaultLiteralValue as d, PslDefaultValue as f, PslFieldAttribute as g, PslField as h, PslAttribute as i, makePslNamespaceEntries as j, flatPslModels as k, PslCompositeType as l, PslDocumentAst as m, ParsePslDocumentInput as n, PslAttributeNamedArgument as o, PslDiagnostic as p, ParsePslDocumentResult as r, PslAttributePositionalArgument as s, BUILTIN_PSL_KIND_KEYS as t, PslDefaultFunctionValue as u, PslModel as v, PslTypeConstructorCall as w, PslNamespace as x, PslModelAttribute as y };
//# sourceMappingURL=psl-ast-DQxniZNi.d.mts.map
{"version":3,"file":"psl-ast-DQxniZNi.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";;;UA0BiB;WACN,MAAM;WACN;WACA;WACA,MAAM;;UAGA;WACN;WACA;;UAGM;WACN;WACA;;KAGC,kBAAkB,0BAA0B;KAE5C;UAEK;WACN;WACA;WACA,MAAM;;UAGA;WACN;WACA;WACA;WACA,MAAM;;KAGL,uBAAuB,iCAAiC;UAEnD;WACN;WACA;WACA,eAAe;WACf,MAAM;;UAGA;WACN;WACA,QAAQ;WACR;WACA,eAAe;WACf,MAAM;;KAGL;KAEA,oBAAoB;UAEf;WACN;WACA;;WAEA;;WAEA;;;;;;;;;WASA;WACA,kBAAkB;WAClB;WACA;WACA;WACA,qBAAqB;WACrB,MAAM;;UAGA;WACN;WACA;WACA,MAAM;;UAGA;WACN;WACA;WACA,MAAM;;KAGL,oBAAoB;UAEf;WACN;WACA;WACA,iBAAiB;WACjB,qBAAqB;WACrB,MAAM;;;;;;;;WAQN;;;;;;;UAQM;WACN;WACA;WACA,iBAAiB;WACjB,qBAAqB;WACrB,MAAM;;UAGA;WACN;WACA;;;;;;WAMA;WACA,kBAAkB;WAClB,qBAAqB;WACrB,MAAM;;UAGA;WACN;WACA,uBAAuB;WACvB,MAAM;;;;;;;;;;;;;;cAeJ;;KAGD,oBAAoB,WAAW,mBAAmB;;;;;;;;;;;;UAa7C;WACN;WACA;;WAEA,SAAS,SAAS,eAAe,SAAS,eAAe;;WAEzD,iBAAiB;;WAEjB,yBAAyB;WACzB,MAAM;;;iBAwCD,iBAAiB;WACtB;WACA;WACA,SAAS,SAAS,eAAe,SAAS,eAAe;WACzD,MAAM;IACb;;;;;;iBASY,wBACd,iBAAiB,YACjB,yBAAyB,oBACzB,0BAA0B,sBACzB,SAAS,eAAe,SAAS,eAAe;UAiClC;WACN;WACA;WACA,qBAAqB;WACrB,QAAQ;WACR,MAAM;;;;;;iBAOD,cAAc,KAAK,0BAA0B;;;;iBAW7C,sBAAsB,KAAK,0BAA0B;;;;;;;;;;;cAmBxD,uBAAuB;;;;;;;;;iBAUpB,4BAA4B,IAAI,wBAAwB;UAgBvD;WACN;WACA;;;;;;;;;;;;;;;;WAgBA,sBAAsB;;;;;;;;;WAStB,cAAc;;UAGR;WACN,KAAK;WACL,sBAAsB;WACtB"}
+2
-2

@@ -1,2 +0,2 @@

import { $ as PslExtensionBlockParamOption, A as instantiateAuthoringFieldPreset, B as resolveEnumCodecId, C as AuthoringTypeConstructorDescriptor, D as classifyEnumMemberType, E as assertNoCrossRegistryCollisions, F as isAuthoringModelAttributeDescriptor, G as PslBlockParamRef, H as PslBlockParam, I as isAuthoringPslBlockDescriptor, J as PslExtensionBlock, K as PslBlockParamValue, L as isAuthoringTypeConstructorDescriptor, M as isAuthoringArgRef, N as isAuthoringEntityTypeDescriptor, O as hasRegisteredFieldNamespace, P as isAuthoringFieldPresetDescriptor, Q as PslExtensionBlockParamList, R as mergeAuthoringNamespaces, S as AuthoringTemplateValue, T as AuthoringTypeNamespace, U as PslBlockParamList, V as validateAuthoringHelperArguments, W as PslBlockParamOption, _ as AuthoringModelAttributeLoweringOutput, a as AuthoringDiagnosticSink, at as AuthoringOption, b as AuthoringSelectRef, c as AuthoringEntityTypeFactoryOutput, d as AuthoringFieldNamespace, et as PslExtensionBlockParamRef, f as AuthoringFieldPresetDescriptor, g as AuthoringModelAttributeDescriptorNamespace, h as AuthoringModelAttributeDescriptor, i as AuthoringContributions, j as instantiateAuthoringTypeConstructor, k as instantiateAuthoringEntityType, l as AuthoringEntityTypeNamespace, m as AuthoringModelAttributeContext, n as AuthoringArgumentDescriptor, nt as PslExtensionBlockParamValue, o as AuthoringEntityContext, p as AuthoringFieldPresetOutput, r as AuthoringColumnDefaultTemplate, s as AuthoringEntityTypeDescriptor, t as AuthoringArgRef, tt as PslExtensionBlockParamScalarValue, u as AuthoringEntityTypeTemplateOutput, v as AuthoringPslBlockDescriptor, w as AuthoringTypeConstructorEntityRef, x as AuthoringStorageTypeTemplate, y as AuthoringPslBlockDescriptorNamespace, z as resolveAuthoringTemplateValue } from "./framework-authoring-Bv5QKca9.mjs";
export { type AuthoringArgRef, type AuthoringArgumentDescriptor, type AuthoringColumnDefaultTemplate, type AuthoringContributions, type AuthoringDiagnosticSink, type AuthoringEntityContext, type AuthoringEntityTypeDescriptor, type AuthoringEntityTypeFactoryOutput, type AuthoringEntityTypeNamespace, type AuthoringEntityTypeTemplateOutput, type AuthoringFieldNamespace, type AuthoringFieldPresetDescriptor, type AuthoringFieldPresetOutput, type AuthoringModelAttributeContext, type AuthoringModelAttributeDescriptor, type AuthoringModelAttributeDescriptorNamespace, type AuthoringModelAttributeLoweringOutput, type AuthoringOption, type AuthoringPslBlockDescriptor, type AuthoringPslBlockDescriptorNamespace, type AuthoringSelectRef, type AuthoringStorageTypeTemplate, type AuthoringTemplateValue, type AuthoringTypeConstructorDescriptor, type AuthoringTypeConstructorEntityRef, type AuthoringTypeNamespace, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, type PslExtensionBlock, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, assertNoCrossRegistryCollisions, classifyEnumMemberType, hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, resolveAuthoringTemplateValue, resolveEnumCodecId, validateAuthoringHelperArguments };
import { A as collectScalarTypeConstructors, B as isAuthoringTypeConstructorDescriptor, C as AuthoringTypeConstructorDescriptor, D as assertNoCrossRegistryCollisions, E as ScalarTypeConstructorOutput, F as isAuthoringArgRef, G as PslBlockParam, H as resolveAuthoringTemplateValue, I as isAuthoringEntityTypeDescriptor, J as PslBlockParamRef, K as PslBlockParamList, L as isAuthoringFieldPresetDescriptor, M as instantiateAuthoringEntityType, N as instantiateAuthoringFieldPreset, O as assertResolvableTypeConstructorTemplates, P as instantiateAuthoringTypeConstructor, R as isAuthoringModelAttributeDescriptor, S as AuthoringTemplateValue, T as AuthoringTypeNamespace, U as resolveEnumCodecId, V as mergeAuthoringNamespaces, W as validateAuthoringHelperArguments, Y as PslBlockParamValue, Z as PslExtensionBlock, _ as AuthoringModelAttributeLoweringOutput, a as AuthoringDiagnosticSink, at as PslExtensionBlockParamValue, b as AuthoringSelectRef, c as AuthoringEntityTypeFactoryOutput, ct as AuthoringOption, d as AuthoringFieldNamespace, f as AuthoringFieldPresetDescriptor, g as AuthoringModelAttributeDescriptorNamespace, h as AuthoringModelAttributeDescriptor, i as AuthoringContributions, it as PslExtensionBlockParamScalarValue, j as hasRegisteredFieldNamespace, k as classifyEnumMemberType, l as AuthoringEntityTypeNamespace, m as AuthoringModelAttributeContext, n as AuthoringArgumentDescriptor, nt as PslExtensionBlockParamOption, o as AuthoringEntityContext, p as AuthoringFieldPresetOutput, q as PslBlockParamOption, r as AuthoringColumnDefaultTemplate, rt as PslExtensionBlockParamRef, s as AuthoringEntityTypeDescriptor, t as AuthoringArgRef, tt as PslExtensionBlockParamList, u as AuthoringEntityTypeTemplateOutput, v as AuthoringPslBlockDescriptor, w as AuthoringTypeConstructorEntityRef, x as AuthoringStorageTypeTemplate, y as AuthoringPslBlockDescriptorNamespace, z as isAuthoringPslBlockDescriptor } from "./framework-authoring-DT8QRvDv.mjs";
export { type AuthoringArgRef, type AuthoringArgumentDescriptor, type AuthoringColumnDefaultTemplate, type AuthoringContributions, type AuthoringDiagnosticSink, type AuthoringEntityContext, type AuthoringEntityTypeDescriptor, type AuthoringEntityTypeFactoryOutput, type AuthoringEntityTypeNamespace, type AuthoringEntityTypeTemplateOutput, type AuthoringFieldNamespace, type AuthoringFieldPresetDescriptor, type AuthoringFieldPresetOutput, type AuthoringModelAttributeContext, type AuthoringModelAttributeDescriptor, type AuthoringModelAttributeDescriptorNamespace, type AuthoringModelAttributeLoweringOutput, type AuthoringOption, type AuthoringPslBlockDescriptor, type AuthoringPslBlockDescriptorNamespace, type AuthoringSelectRef, type AuthoringStorageTypeTemplate, type AuthoringTemplateValue, type AuthoringTypeConstructorDescriptor, type AuthoringTypeConstructorEntityRef, type AuthoringTypeNamespace, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, type PslExtensionBlock, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, type ScalarTypeConstructorOutput, assertNoCrossRegistryCollisions, assertResolvableTypeConstructorTemplates, classifyEnumMemberType, collectScalarTypeConstructors, hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, resolveAuthoringTemplateValue, resolveEnumCodecId, validateAuthoringHelperArguments };

@@ -1,2 +0,2 @@

import { a as instantiateAuthoringFieldPreset, c as isAuthoringEntityTypeDescriptor, d as isAuthoringPslBlockDescriptor, f as isAuthoringTypeConstructorDescriptor, g as validateAuthoringHelperArguments, h as resolveEnumCodecId, i as instantiateAuthoringEntityType, l as isAuthoringFieldPresetDescriptor, m as resolveAuthoringTemplateValue, n as classifyEnumMemberType, o as instantiateAuthoringTypeConstructor, p as mergeAuthoringNamespaces, r as hasRegisteredFieldNamespace, s as isAuthoringArgRef, t as assertNoCrossRegistryCollisions, u as isAuthoringModelAttributeDescriptor } from "./framework-authoring-Rn5Cr8fF.mjs";
export { assertNoCrossRegistryCollisions, classifyEnumMemberType, hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, resolveAuthoringTemplateValue, resolveEnumCodecId, validateAuthoringHelperArguments };
import { _ as resolveAuthoringTemplateValue, a as collectScalarTypeConstructors, c as instantiateAuthoringFieldPreset, d as isAuthoringEntityTypeDescriptor, f as isAuthoringFieldPresetDescriptor, g as mergeAuthoringNamespaces, h as isAuthoringTypeConstructorDescriptor, l as instantiateAuthoringTypeConstructor, m as isAuthoringPslBlockDescriptor, n as assertResolvableTypeConstructorTemplates, o as hasRegisteredFieldNamespace, p as isAuthoringModelAttributeDescriptor, r as classifyEnumMemberType, s as instantiateAuthoringEntityType, t as assertNoCrossRegistryCollisions, u as isAuthoringArgRef, v as resolveEnumCodecId, y as validateAuthoringHelperArguments } from "./framework-authoring-DfnkbOVh.mjs";
export { assertNoCrossRegistryCollisions, assertResolvableTypeConstructorTemplates, classifyEnumMemberType, collectScalarTypeConstructors, hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, resolveAuthoringTemplateValue, resolveEnumCodecId, validateAuthoringHelperArguments };
import { n as mergeCapabilityMatrices, t as CapabilityMatrix } from "./capabilities-Cupq4-1-.mjs";
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-B8P4PTgH.mjs";
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-CDWIpbwD.mjs";
export { type AdapterDescriptor, type AdapterInstance, type AdapterPackRef, type CapabilityMatrix, 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, mergeCapabilityMatrices };

@@ -1,1 +0,1 @@

{"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/contract-serializer.ts","../src/control/contract-snapshot-layout.ts","../src/control/schema-diff.ts","../src/control/control-operation-results.ts","../src/control/control-instances.ts","../src/control/control-migration-types.ts","../src/control/control-spaces.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts","../src/control/order-issues-by-dependencies.ts","../src/control/schema-verifier.ts","../src/control/verifier-disposition.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmBiB,mBAAmB;;;;;;;;;;;;EAYlC,oBAAoB,UAAU,YAAY,WAAW,gBAAgB;;;;;;;;;;EAWrE,kBAAkB,UAAU,YAAY;;;;;;;;WAS/B,sBAAsB;;;;;;;;WAStB,cAAc;;;;cC1DZ;;iBAKG,eAAe;;iBAUf,8BACd,6BACA;;iBAMc,+BACd,6BACA;;;;;;;;;;KCpBU;WAAoC;WAA2B;;UAE1D,gBAAgB,cAAc,eAAe;;WAEnD;;WAEA,WAAW;;WAEX,SAAS;;;;;;;;WAQT;;;;;;;;;;;;;;;;KAiBC;;;;;;;iBAQI,aAAa,OAAO,kBAAkB;;;;;;;;;;;;;;;UAyBrC;WACN;WACA;;;;;;;WAOA,qBAAqB;EAC9B,UAAU,OAAO;EACjB,qBAAqB;;;;;;;;;;;iBAiDP,YACd,UAAU,cACV,QAAQ,wBACE;;;;;;;;;;;;cAiIC,WAAW,cAAc,eAAe;WAC1C,iBAAiB,gBAAgB;cAE9B,iBAAiB,gBAAgB;;EAK7C,OAAO,OAAO,OAAO,gBAAgB,qBAAqB,WAAW;;;;cC/Q1D;cACA;cACA;cACA;UAEI;WACN;WACA;WACA,OAAO,SAAS;;UAGV;WACN;WACA;WACA;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE;aACA;;WAEF;WACA;WACA;aACE;aACA;;WAEF;aACE;;;;;;;;;;;;;;;UAgBI;WACN;WACA;WACA;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE,iBAAiB;aACjB;eACE,iBAAiB;;;WAGrB;aACE;aACA;aACA;;WAEF;aACE;;;UAII;WACN;WACA;WACA;WACA;WACA;;UA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sources":["../src/control/contract-serializer.ts","../src/control/contract-snapshot-layout.ts","../src/control/schema-diff.ts","../src/control/control-operation-results.ts","../src/control/control-instances.ts","../src/control/control-migration-types.ts","../src/control/control-spaces.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts","../src/control/order-issues-by-dependencies.ts","../src/control/schema-verifier.ts","../src/control/verifier-disposition.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmBiB,mBAAmB;;;;;;;;;;;;EAYlC,oBAAoB,UAAU,YAAY,WAAW,gBAAgB;;;;;;;;;;EAWrE,kBAAkB,UAAU,YAAY;;;;;;;;WAS/B,sBAAsB;;;;;;;;WAStB,cAAc;;;;cC1DZ;;iBAKG,eAAe;;iBAUf,8BACd,6BACA;;iBAMc,+BACd,6BACA;;;;;;;;;;KCpBU;WAAoC;WAA2B;;UAE1D,gBAAgB,cAAc,eAAe;;WAEnD;;WAEA,WAAW;;WAEX,SAAS;;;;;;;;WAQT;;;;;;;;;;;;;;;;KAiBC;;;;;;;iBAQI,aAAa,OAAO,kBAAkB;;;;;;;;;;;;;;;UAyBrC;WACN;WACA;;;;;;;WAOA,qBAAqB;EAC9B,UAAU,OAAO;EACjB,qBAAqB;;;;;;;;;;;iBAiDP,YACd,UAAU,cACV,QAAQ,wBACE;;;;;;;;;;;;cAiIC,WAAW,cAAc,eAAe;WAC1C,iBAAiB,gBAAgB;cAE9B,iBAAiB,gBAAgB;;EAK7C,OAAO,OAAO,OAAO,gBAAgB,qBAAqB,WAAW;;;;cC/Q1D;cACA;cACA;cACA;UAEI;WACN;WACA;WACA,OAAO,SAAS;;UAGV;WACN;WACA;WACA;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE;aACA;;WAEF;WACA;WACA;aACE;aACA;;WAEF;aACE;;;;;;;;;;;;;;;UAgBI;WACN;WACA;WACA;WACA;aACE;aACA;;WAEF;aACE;aACA;;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;;;;;;;;;iBAiBI,uBACd,eAAe,eACf,UAAU,wBACT"}
import { n as materializeCodec, r as resolveCodecDescriptorOrThrow, t as CONTRACT_CODEC_DESCRIPTOR_MISSING } from "./resolve-codec-CHARBCXP.mjs";
import { t as mergeCapabilityMatrices } from "./capabilities-BnRAFKP5.mjs";
import { p as mergeAuthoringNamespaces, t as assertNoCrossRegistryCollisions } from "./framework-authoring-Rn5Cr8fF.mjs";
import { a as collectScalarTypeConstructors, g as mergeAuthoringNamespaces, i as collectContributedDescriptorPaths, n as assertResolvableTypeConstructorTemplates, t as assertNoCrossRegistryCollisions } from "./framework-authoring-DfnkbOVh.mjs";
import { blindCast } from "@prisma-next/utils/casts";

@@ -97,3 +97,3 @@ import { InternalError } from "@prisma-next/utils/internal-error";

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}.`);
if (existingOwner !== void 0) throw new InternalError(`Duplicate ${options.entityLabel} for codecId "${options.codecId}". Descriptor "${options.descriptorId}" conflicts with "${existingOwner}". Each codecId can only have one ${options.entityOwnershipLabel}.`);
}

@@ -132,7 +132,39 @@ function extractCodecTypeImports(descriptors) {

const modelAttributes = {};
const pathOwners = /* @__PURE__ */ new Map();
const claimContributedPaths = (namespace, descriptorKind, label, descriptorId) => {
for (const path of collectContributedDescriptorPaths(namespace, descriptorKind)) {
const key = `${label}:${path}`;
const existingOwner = pathOwners.get(key);
if (existingOwner !== void 0) throw new InternalError(`Duplicate authoring ${label} helper "${path}". Descriptor "${descriptorId}" conflicts with "${existingOwner}".`);
pathOwners.set(key, descriptorId);
}
};
let valueObjectStorageDeclaration;
for (const descriptor of descriptors) {
if (descriptor.authoring?.field) mergeAuthoringNamespaces(field, descriptor.authoring.field, [], "fieldPreset", "field");
if (descriptor.authoring?.type) mergeAuthoringNamespaces(type, descriptor.authoring.type, [], "typeConstructor", "type");
if (descriptor.authoring?.entityTypes) mergeAuthoringNamespaces(entityTypes, descriptor.authoring.entityTypes, [], "entity", "entity");
if (descriptor.authoring?.pslBlockDescriptors) mergeAuthoringNamespaces(pslBlockDescriptors, descriptor.authoring.pslBlockDescriptors, [], "pslBlock", "pslBlock");
const descriptorId = descriptor.id ?? "<unknown>";
const declaredValueObjectStorageType = descriptor.authoring?.valueObjectStorageType;
if (declaredValueObjectStorageType !== void 0) {
if (valueObjectStorageDeclaration !== void 0) throw new InternalError(`Duplicate authoring valueObjectStorageType declaration. Descriptor "${descriptorId}" conflicts with "${valueObjectStorageDeclaration.ownerId}". Exactly one composed component may declare the value-object storage type.`);
valueObjectStorageDeclaration = {
name: declaredValueObjectStorageType,
ownerId: descriptorId
};
}
if (descriptor.authoring?.field) {
claimContributedPaths(descriptor.authoring.field, "fieldPreset", "field", descriptorId);
mergeAuthoringNamespaces(field, descriptor.authoring.field, [], "fieldPreset", "field");
}
if (descriptor.authoring?.type) {
claimContributedPaths(descriptor.authoring.type, "typeConstructor", "type", descriptorId);
assertResolvableTypeConstructorTemplates(descriptor.authoring.type, descriptorId);
mergeAuthoringNamespaces(type, descriptor.authoring.type, [], "typeConstructor", "type");
}
if (descriptor.authoring?.entityTypes) {
claimContributedPaths(descriptor.authoring.entityTypes, "entity", "entity", descriptorId);
mergeAuthoringNamespaces(entityTypes, descriptor.authoring.entityTypes, [], "entity", "entity");
}
if (descriptor.authoring?.pslBlockDescriptors) {
claimContributedPaths(descriptor.authoring.pslBlockDescriptors, "pslBlock", "pslBlock", descriptorId);
mergeAuthoringNamespaces(pslBlockDescriptors, descriptor.authoring.pslBlockDescriptors, [], "pslBlock", "pslBlock");
}
if (descriptor.authoring?.modelAttributes) mergeAuthoringNamespaces(modelAttributes, descriptor.authoring.modelAttributes, [], "modelAttribute", "modelAttribute");

@@ -146,2 +178,3 @@ }

assertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityTypeNamespace, pslBlockDescriptorNamespace, modelAttributeNamespace);
if (valueObjectStorageDeclaration !== void 0 && !collectScalarTypeConstructors(typeNamespace).has(valueObjectStorageDeclaration.name)) throw new InternalError(`Invalid authoring valueObjectStorageType "${valueObjectStorageDeclaration.name}" declared by descriptor "${valueObjectStorageDeclaration.ownerId}". The name must be a top-level bare-eligible type constructor in the assembled authoring namespace.`);
return {

@@ -152,21 +185,6 @@ field: fieldNamespace,

pslBlockDescriptors: pslBlockDescriptorNamespace,
modelAttributes: modelAttributeNamespace
modelAttributes: modelAttributeNamespace,
...valueObjectStorageDeclaration !== void 0 ? { valueObjectStorageType: valueObjectStorageDeclaration.name } : {}
};
}
function assembleScalarTypeDescriptors(descriptors) {
const result = /* @__PURE__ */ new Map();
const owners = /* @__PURE__ */ new Map();
for (const descriptor of descriptors) {
const descriptorMap = descriptor.scalarTypeDescriptors;
if (!descriptorMap) continue;
const descriptorId = descriptor.id ?? "<unknown>";
for (const [typeName, codecId] of descriptorMap) {
const existingOwner = owners.get(typeName);
if (existingOwner !== void 0) throw new Error(`Duplicate scalar type descriptor "${typeName}". Descriptor "${descriptorId}" conflicts with "${existingOwner}".`);
result.set(typeName, codecId);
owners.set(typeName, descriptorId);
}
}
return result;
}
function assembleControlMutationDefaults(descriptors) {

@@ -183,3 +201,3 @@ const defaultFunctionRegistry = /* @__PURE__ */ new Map();

const existingOwner = generatorOwners.get(generatorDescriptor.id);
if (existingOwner !== void 0) throw new Error(`Duplicate mutation default generator id "${generatorDescriptor.id}". Descriptor "${descriptorId}" conflicts with "${existingOwner}".`);
if (existingOwner !== void 0) throw new InternalError(`Duplicate mutation default generator id "${generatorDescriptor.id}". Descriptor "${descriptorId}" conflicts with "${existingOwner}".`);
generatorMap.set(generatorDescriptor.id, generatorDescriptor);

@@ -190,3 +208,3 @@ generatorOwners.set(generatorDescriptor.id, descriptorId);

const existingOwner = functionOwners.get(functionName);
if (existingOwner !== void 0) throw new Error(`Duplicate mutation default function "${functionName}". Descriptor "${descriptorId}" conflicts with "${existingOwner}".`);
if (existingOwner !== void 0) throw new InternalError(`Duplicate mutation default function "${functionName}". Descriptor "${descriptorId}" conflicts with "${existingOwner}".`);
defaultFunctionRegistry.set(functionName, handler);

@@ -296,3 +314,3 @@ functionOwners.set(functionName, descriptorId);

for (const ext of extensions) for (const depId of readDeclaredDependencyIds(ext)) {
if (!idSet.has(depId)) throw new Error(`Extension "${ext.id}" declares a dependency on "${depId}", but "${depId}" is not in the provided extension set. Add the missing space to extensionPacks.`);
if (!idSet.has(depId)) throw new InternalError(`Extension "${ext.id}" declares a dependency on "${depId}", but "${depId}" is not in the provided extension set. Add the missing space to extensionPacks.`);
inDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);

@@ -318,6 +336,3 @@ const list = dependents.get(depId);

}
if (result.length < extensions.length) {
const cycleMembers = extensions.map((e) => e.id).filter((id) => !result.includes(id)).sort();
throw new Error(`Extension dependency cycle detected. Cycle members: ${cycleMembers.map((id) => `"${id}"`).join(", ")}.`);
}
if (result.length < extensions.length) throw new InternalError(`Extension dependency cycle detected. Cycle members: ${extensions.map((e) => e.id).filter((id) => !result.includes(id)).sort().map((id) => `"${id}"`).join(", ")}.`);
return result;

@@ -337,3 +352,3 @@ }

const codecLookup = extractCodecLookup(allDescriptors);
const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);
const authoringContributions = assembleAuthoringContributions(allDescriptors);
return {

@@ -350,4 +365,4 @@ family,

codecLookup,
authoringContributions: assembleAuthoringContributions(allDescriptors),
scalarTypeDescriptors,
authoringContributions,
scalarTypes: [...collectScalarTypeConstructors(authoringContributions.type).keys()],
controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),

@@ -642,4 +657,4 @@ capabilities: mergeCapabilityMatrices({}, [

//#endregion
export { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME, SchemaDiff, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_SCHEMA_FAILURE, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleControlMutationDefaults, assembleScalarTypeDescriptors, assertUniqueCodecOwner, buildExtensionLoadOrder, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, createControlStack, diffSchemas, dispositionForCategory, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView, issueOutcome, orderIssuesByDependencies, storageHashHex };
export { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME, SchemaDiff, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_SCHEMA_FAILURE, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleControlMutationDefaults, assertUniqueCodecOwner, buildExtensionLoadOrder, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, createControlStack, diffSchemas, dispositionForCategory, extractCodecLookup, extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView, issueOutcome, orderIssuesByDependencies, storageHashHex };
//# sourceMappingURL=control.mjs.map

@@ -1,2 +0,2 @@

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-B8P4PTgH.mjs";
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-CDWIpbwD.mjs";
//#region src/execution/execution-instances.d.ts

@@ -3,0 +3,0 @@ interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {}

@@ -1,1 +0,1 @@

{"version":3,"file":"framework-components-DbCS57go.mjs","names":[],"sources":["../src/shared/framework-components.ts"],"sourcesContent":["import type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { ControlMutationDefaults } from './mutation-default-types';\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 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.\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. 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 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. Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.\n */\n readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;\n };\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 they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n\n /**\n * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;\n\n /**\n * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly controlMutationDefaults?: ControlMutationDefaults;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * 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.).\n *\n * @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.\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 (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 (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 (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 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. 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 /** The namespace a bare (un-namespaced) entity name resolves to for this target (e.g. Postgres `'public'`). */\n readonly defaultNamespaceId: string;\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. 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 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. 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 adapter. Multiple drivers can exist for the same target (e.g., node-postgres 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 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":";AA8GA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,IAAY;CACpC,KAAK,MAAM,MAAM,MAAM,sBACrB,YAAY,IAAI,EAAE;CAMpB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,cAAc,IACzC,CAAC,EAAA,CACoD,QAAQ,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;CAE5F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,KAAA,KACzB,yBAAyB,KAAA,KACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;CAAqB,IAC/D,KAAA;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,KAAA,KAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;CAAiB,IACvD,KAAA;CAEN,OAAO;EACL,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;EAC3C,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;EAC3C;CACF;AACF"}
{"version":3,"file":"framework-components-DbCS57go.mjs","names":[],"sources":["../src/shared/framework-components.ts"],"sourcesContent":["import type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { ControlMutationDefaults } from './mutation-default-types';\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 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.\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. 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 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. Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.\n */\n readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;\n };\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 they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n\n /**\n * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly controlMutationDefaults?: ControlMutationDefaults;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * 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.).\n *\n * @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.\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 (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 (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 (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 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. 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 /** The namespace a bare (un-namespaced) entity name resolves to for this target (e.g. Postgres `'public'`). */\n readonly defaultNamespaceId: string;\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. 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 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. 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 adapter. Multiple drivers can exist for the same target (e.g., node-postgres 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 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":";AAyGA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,IAAY;CACpC,KAAK,MAAM,MAAM,MAAM,sBACrB,YAAY,IAAI,EAAE;CAMpB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,cAAc,IACzC,CAAC,EAAA,CACoD,QAAQ,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;CAE5F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,KAAA,KACzB,yBAAyB,KAAA,KACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;CAAqB,IAC/D,KAAA;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,KAAA,KAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;CAAiB,IACvD,KAAA;CAEN,OAAO;EACL,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;EAC3C,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;EAC3C;CACF;AACF"}
import { r as CodecLookup } from "./codec-types-4tPB4m_G.mjs";
import { $ as PslExtensionBlockParamOption, G as PslBlockParamRef, H as PslBlockParam, J as PslExtensionBlock, K as PslBlockParamValue, Q as PslExtensionBlockParamList, U as PslBlockParamList, W as PslBlockParamOption, X as PslExtensionBlockAttributeArg, Y as PslExtensionBlockAttribute, Z as PslExtensionBlockParamBare, et as PslExtensionBlockParamRef, it as PslSpan, nt as PslExtensionBlockParamValue, q as PslDiagnosticCode, rt as PslPosition, tt as PslExtensionBlockParamScalarValue, v as AuthoringPslBlockDescriptor, y as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-Bv5QKca9.mjs";
import { A as makePslNamespace, C as PslReferentialAction, D as UNSPECIFIED_PSL_NAMESPACE_ID, E as PslUniqueConstraint, M as namespacePslExtensionBlocks, O as flatPslCompositeTypes, S as PslNamespaceEntry, T as PslTypesBlock, _ as PslIndexConstraint, a as PslAttributeArgument, b as PslNamedTypeDeclaration, c as PslAttributeTarget, d as PslDefaultLiteralValue, f as PslDefaultValue, g as PslFieldAttribute, h as PslField, i as PslAttribute, j as makePslNamespaceEntries, k as flatPslModels, l as PslCompositeType, m as PslDocumentAst, n as ParsePslDocumentInput, o as PslAttributeNamedArgument, p as PslDiagnostic, r as ParsePslDocumentResult, s as PslAttributePositionalArgument, t as BUILTIN_PSL_KIND_KEYS, u as PslDefaultFunctionValue, v as PslModel, w as PslTypeConstructorCall, x as PslNamespace, y as PslModelAttribute } from "./psl-ast-BevxxqLP.mjs";
import { $ as PslExtensionBlockAttributeArg, G as PslBlockParam, J as PslBlockParamRef, K as PslBlockParamList, Q as PslExtensionBlockAttribute, X as PslDiagnosticCode, Y as PslBlockParamValue, Z as PslExtensionBlock, at as PslExtensionBlockParamValue, et as PslExtensionBlockParamBare, it as PslExtensionBlockParamScalarValue, nt as PslExtensionBlockParamOption, ot as PslPosition, q as PslBlockParamOption, rt as PslExtensionBlockParamRef, st as PslSpan, tt as PslExtensionBlockParamList, v as AuthoringPslBlockDescriptor, y as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-DT8QRvDv.mjs";
import { A as makePslNamespace, C as PslReferentialAction, D as UNSPECIFIED_PSL_NAMESPACE_ID, E as PslUniqueConstraint, M as namespacePslExtensionBlocks, O as flatPslCompositeTypes, S as PslNamespaceEntry, T as PslTypesBlock, _ as PslIndexConstraint, a as PslAttributeArgument, b as PslNamedTypeDeclaration, c as PslAttributeTarget, d as PslDefaultLiteralValue, f as PslDefaultValue, g as PslFieldAttribute, h as PslField, i as PslAttribute, j as makePslNamespaceEntries, k as flatPslModels, l as PslCompositeType, m as PslDocumentAst, n as ParsePslDocumentInput, o as PslAttributeNamedArgument, p as PslDiagnostic, r as ParsePslDocumentResult, s as PslAttributePositionalArgument, t as BUILTIN_PSL_KIND_KEYS, u as PslDefaultFunctionValue, v as PslModel, w as PslTypeConstructorCall, x as PslNamespace, y as PslModelAttribute } from "./psl-ast-DQxniZNi.mjs";
//#region src/control/psl-extension-block-validator.d.ts

@@ -5,0 +5,0 @@ /**

{
"name": "@prisma-next/framework-components",
"version": "0.16.0-dev.11",
"version": "0.16.0-dev.12",
"license": "Apache-2.0",

@@ -9,6 +9,6 @@ "type": "module",

"dependencies": {
"@prisma-next/contract": "0.16.0-dev.11",
"@prisma-next/operations": "0.16.0-dev.11",
"@prisma-next/ts-render": "0.16.0-dev.11",
"@prisma-next/utils": "0.16.0-dev.11",
"@prisma-next/contract": "0.16.0-dev.12",
"@prisma-next/operations": "0.16.0-dev.12",
"@prisma-next/ts-render": "0.16.0-dev.12",
"@prisma-next/utils": "0.16.0-dev.12",
"@standard-schema/spec": "^1.1.0",

@@ -18,4 +18,4 @@ "arktype": "^2.2.2"

"devDependencies": {
"@prisma-next/tsconfig": "0.16.0-dev.11",
"@prisma-next/tsdown": "0.16.0-dev.11",
"@prisma-next/tsconfig": "0.16.0-dev.12",
"@prisma-next/tsdown": "0.16.0-dev.12",
"tsdown": "0.22.8",

@@ -22,0 +22,0 @@ "typescript": "5.9.3",

import type { Contract, JsonValue } from '@prisma-next/contract/types';
import { blindCast } from '@prisma-next/utils/casts';
import { InternalError } from '@prisma-next/utils/internal-error';
import type { CapabilityMatrix } from '../shared/capabilities';

@@ -18,2 +19,5 @@ import { mergeCapabilityMatrices } from '../shared/capabilities';

assertNoCrossRegistryCollisions,
assertResolvableTypeConstructorTemplates,
collectContributedDescriptorPaths,
collectScalarTypeConstructors,
mergeAuthoringNamespaces,

@@ -47,2 +51,4 @@ } from '../shared/framework-authoring';

readonly modelAttributes: AuthoringModelAttributeDescriptorNamespace;
/** The single {@link AuthoringContributions.valueObjectStorageType} declared across the composed components, validated at assembly against the merged `type` namespace. */
readonly valueObjectStorageType?: string;
}

@@ -67,3 +73,4 @@

readonly authoringContributions: AssembledAuthoringContributions;
readonly scalarTypeDescriptors: ReadonlyMap<string, string>;
/** Names of the top-level zero-arg type constructors in the assembled authoring namespace — the base scalars of the composed stack. */
readonly scalarTypes: ReadonlyArray<string>;
readonly controlMutationDefaults: ControlMutationDefaults;

@@ -102,3 +109,3 @@ readonly capabilities: CapabilityMatrix;

if (existingOwner !== undefined) {
throw new Error(
throw new InternalError(
`Duplicate ${options.entityLabel} for codecId "${options.codecId}". ` +

@@ -167,3 +174,3 @@ `Descriptor "${options.descriptorId}" conflicts with "${existingOwner}". ` +

export function assembleAuthoringContributions(
descriptors: ReadonlyArray<{ readonly authoring?: AuthoringContributions }>,
descriptors: ReadonlyArray<{ readonly id?: string; readonly authoring?: AuthoringContributions }>,
): AssembledAuthoringContributions {

@@ -176,10 +183,53 @@ const field = {} as Record<string, unknown>;

const pathOwners = new Map<string, string>();
const claimContributedPaths = (
namespace: Record<string, unknown>,
descriptorKind: string,
label: string,
descriptorId: string,
): void => {
for (const path of collectContributedDescriptorPaths(namespace, descriptorKind)) {
const key = `${label}:${path}`;
const existingOwner = pathOwners.get(key);
if (existingOwner !== undefined) {
throw new InternalError(
`Duplicate authoring ${label} helper "${path}". ` +
`Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,
);
}
pathOwners.set(key, descriptorId);
}
};
let valueObjectStorageDeclaration:
| { readonly name: string; readonly ownerId: string }
| undefined;
for (const descriptor of descriptors) {
const descriptorId = descriptor.id ?? '<unknown>';
const declaredValueObjectStorageType = descriptor.authoring?.valueObjectStorageType;
if (declaredValueObjectStorageType !== undefined) {
if (valueObjectStorageDeclaration !== undefined) {
throw new InternalError(
'Duplicate authoring valueObjectStorageType declaration. ' +
`Descriptor "${descriptorId}" conflicts with "${valueObjectStorageDeclaration.ownerId}". ` +
'Exactly one composed component may declare the value-object storage type.',
);
}
valueObjectStorageDeclaration = {
name: declaredValueObjectStorageType,
ownerId: descriptorId,
};
}
if (descriptor.authoring?.field) {
claimContributedPaths(descriptor.authoring.field, 'fieldPreset', 'field', descriptorId);
mergeAuthoringNamespaces(field, descriptor.authoring.field, [], 'fieldPreset', 'field');
}
if (descriptor.authoring?.type) {
claimContributedPaths(descriptor.authoring.type, 'typeConstructor', 'type', descriptorId);
assertResolvableTypeConstructorTemplates(descriptor.authoring.type, descriptorId);
mergeAuthoringNamespaces(type, descriptor.authoring.type, [], 'typeConstructor', 'type');
}
if (descriptor.authoring?.entityTypes) {
claimContributedPaths(descriptor.authoring.entityTypes, 'entity', 'entity', descriptorId);
mergeAuthoringNamespaces(

@@ -194,2 +244,8 @@ entityTypes,

if (descriptor.authoring?.pslBlockDescriptors) {
claimContributedPaths(
descriptor.authoring.pslBlockDescriptors,
'pslBlock',
'pslBlock',
descriptorId,
);
mergeAuthoringNamespaces(

@@ -233,2 +289,12 @@ pslBlockDescriptors,

if (
valueObjectStorageDeclaration !== undefined &&
!collectScalarTypeConstructors(typeNamespace).has(valueObjectStorageDeclaration.name)
) {
throw new InternalError(
`Invalid authoring valueObjectStorageType "${valueObjectStorageDeclaration.name}" declared by descriptor "${valueObjectStorageDeclaration.ownerId}". ` +
'The name must be a top-level bare-eligible type constructor in the assembled authoring namespace.',
);
}
return {

@@ -240,33 +306,8 @@ field: fieldNamespace,

modelAttributes: modelAttributeNamespace,
...(valueObjectStorageDeclaration !== undefined
? { valueObjectStorageType: valueObjectStorageDeclaration.name }
: {}),
};
}
export function assembleScalarTypeDescriptors(
descriptors: ReadonlyArray<
Pick<ComponentMetadata, 'scalarTypeDescriptors'> & { readonly id?: string }
>,
): ReadonlyMap<string, string> {
const result = new Map<string, string>();
const owners = new Map<string, string>();
for (const descriptor of descriptors) {
const descriptorMap = descriptor.scalarTypeDescriptors;
if (!descriptorMap) continue;
const descriptorId = descriptor.id ?? '<unknown>';
for (const [typeName, codecId] of descriptorMap) {
const existingOwner = owners.get(typeName);
if (existingOwner !== undefined) {
throw new Error(
`Duplicate scalar type descriptor "${typeName}". ` +
`Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,
);
}
result.set(typeName, codecId);
owners.set(typeName, descriptorId);
}
}
return result;
}
export function assembleControlMutationDefaults(

@@ -290,3 +331,3 @@ descriptors: ReadonlyArray<

if (existingOwner !== undefined) {
throw new Error(
throw new InternalError(
`Duplicate mutation default generator id "${generatorDescriptor.id}". ` +

@@ -303,3 +344,3 @@ `Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,

if (existingOwner !== undefined) {
throw new Error(
throw new InternalError(
`Duplicate mutation default function "${functionName}". ` +

@@ -424,10 +465,10 @@ `Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,

export function validateScalarTypeCodecIds(
scalarTypeDescriptors: ReadonlyMap<string, string>,
typeNamespace: AuthoringTypeNamespace,
codecLookup: CodecLookup,
): string[] {
const errors: string[] = [];
for (const [typeName, codecId] of scalarTypeDescriptors) {
if (!codecLookup.get(codecId)) {
for (const [typeName, output] of collectScalarTypeConstructors(typeNamespace)) {
if (!codecLookup.get(output.codecId)) {
errors.push(
`Scalar type "${typeName}" references codec "${codecId}" which is not registered by any component.`,
`Scalar type "${typeName}" references codec "${output.codecId}" which is not registered by any component.`,
);

@@ -498,3 +539,3 @@ }

if (!idSet.has(depId)) {
throw new Error(
throw new InternalError(
`Extension "${ext.id}" declares a dependency on "${depId}", but "${depId}" is not in the provided extension set. Add the missing space to extensionPacks.`,

@@ -534,3 +575,3 @@ );

.sort();
throw new Error(
throw new InternalError(
`Extension dependency cycle detected. Cycle members: ${cycleMembers.map((id) => `"${id}"`).join(', ')}.`,

@@ -557,3 +598,3 @@ );

const codecLookup = extractCodecLookup(allDescriptors);
const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);
const authoringContributions = assembleAuthoringContributions(allDescriptors);

@@ -572,4 +613,4 @@ return {

codecLookup,
authoringContributions: assembleAuthoringContributions(allDescriptors),
scalarTypeDescriptors,
authoringContributions,
scalarTypes: [...collectScalarTypeConstructors(authoringContributions.type).keys()],
controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),

@@ -576,0 +617,0 @@ capabilities: mergeCapabilityMatrices({}, [

@@ -27,6 +27,9 @@ export type {

AuthoringTypeNamespace,
ScalarTypeConstructorOutput,
} from '../shared/framework-authoring';
export {
assertNoCrossRegistryCollisions,
assertResolvableTypeConstructorTemplates,
classifyEnumMemberType,
collectScalarTypeConstructors,
hasRegisteredFieldNamespace,

@@ -33,0 +36,0 @@ instantiateAuthoringEntityType,

@@ -102,3 +102,2 @@ export type { ImportRequirement } from '@prisma-next/ts-render';

assembleControlMutationDefaults,
assembleScalarTypeDescriptors,
assertUniqueCodecOwner,

@@ -105,0 +104,0 @@ buildExtensionLoadOrder,

@@ -61,7 +61,2 @@ import type { AnyCodecDescriptor } from './codec-descriptor';

/**
* Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.
*/
readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;
/**
* Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.

@@ -68,0 +63,0 @@ */

@@ -53,12 +53,2 @@ import type {

readonly applicableCodecIds?: readonly string[];
readonly resolveGeneratedColumnDescriptor?: (input: {
readonly generated: ExecutionMutationDefaultValue;
}) =>
| {
readonly codecId: string;
readonly nativeType: string;
readonly typeRef?: string;
readonly typeParams?: Record<string, unknown>;
}
| undefined;
/**

@@ -65,0 +55,0 @@ * Construct the `onCreate`/`onUpdate` phases value owned by this

import { r as CodecLookup } from "./codec-types-4tPB4m_G.mjs";
import { ColumnDefault, ExecutionMutationDefaultPhases } from "@prisma-next/contract/types";
import { Type } from "arktype";
//#region src/shared/option-descriptor.d.ts
/**
* An enumerated-value parameter: the author supplies one of `values`, spelled
* as a bare token in PSL and a string literal in TypeScript. Shared by the
* extension-block parameter vocabulary (`PslBlockParamOption`) and the helper
* argument vocabulary (`AuthoringArgumentDescriptor`) so the option concept is
* declared once. See ADR 239.
*/
interface AuthoringOption {
readonly kind: 'option';
readonly values: readonly string[];
}
//#endregion
//#region src/shared/psl-extension-block.d.ts
interface PslPosition {
readonly offset: number;
readonly line: number;
readonly column: number;
}
interface PslSpan {
readonly start: PslPosition;
readonly end: PslPosition;
}
type PslDiagnosticCode = 'PSL_UNTERMINATED_BLOCK' | 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK' | 'PSL_INVALID_NAMESPACE_BLOCK' | 'PSL_INVALID_ATTRIBUTE_SYNTAX' | 'PSL_INVALID_MODEL_MEMBER' | 'PSL_UNSUPPORTED_MODEL_ATTRIBUTE' | 'PSL_UNSUPPORTED_FIELD_ATTRIBUTE' | 'PSL_INVALID_RELATION_ATTRIBUTE' | 'PSL_INVALID_REFERENTIAL_ACTION' | 'PSL_INVALID_DEFAULT_VALUE' | 'PSL_INVALID_ENUM_MEMBER' | 'PSL_INVALID_TYPES_MEMBER' | 'PSL_INVALID_QUALIFIED_TYPE' |
/**
* A qualified name (e.g. a dotted type or attribute reference) is structurally
* invalid, such as an over-qualified or trailing-separator name.
*/
'PSL_INVALID_QUALIFIED_NAME' |
/**
* A reserved declaration keyword (`model`/`enum`/`namespace`/`type`) that
* committed the declaration kind on the keyword alone but is missing its name
* and/or opening brace. The recursive-descent parser produces a best-effort
* typed node for the malformed header and reports this code rather than
* `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`, which is reserved for a genuinely unknown
* top-level keyword.
*/
'PSL_INVALID_DECLARATION' |
/**
* A malformed line inside an extension-contributed top-level block body, or
* a structurally invalid element inside a `list` parameter value.
*
* Replaces the overloaded `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK` code that the
* generic framework parser previously used for these two parse-error sites
* inside extension blocks — keeping `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK` for
* its original meaning (an unknown keyword at the top level) and giving
* extension-block parse errors their own code.
*/
'PSL_INVALID_EXTENSION_BLOCK_MEMBER' |
/**
* A malformed JS-like object literal `{ key: value, … }` in value/argument
* position — a field missing its `:`, a field missing its value, or an
* unterminated `{`. The recursive-descent parser still produces a best-effort
* `ObjectLiteralExpr` node (preserving the lossless round-trip) and reports
* this code anchored on the offending token.
*/
'PSL_INVALID_OBJECT_LITERAL' |
/**
* A string literal with no closing quote — the tokenizer stops the literal at
* a newline or at EOF when no terminating `"` is found, and the
* recursive-descent parser still consumes the token (preserving the lossless
* round-trip) but reports this code anchored on the string token's span.
*/
'PSL_UNTERMINATED_STRING' |
/**
* An unknown parameter key in an extension-contributed block — a key present
* in the source block but absent from the descriptor's `parameters` map.
*/
'PSL_EXTENSION_UNKNOWN_PARAMETER' |
/**
* A required parameter declared in the descriptor is absent from the parsed block.
*/
'PSL_EXTENSION_MISSING_REQUIRED_PARAMETER' |
/**
* An `option`-kind parameter value is not one of the allowed tokens listed
* in the descriptor's `values` array.
*/
'PSL_EXTENSION_OPTION_OUT_OF_SET' |
/**
* A `value`-kind parameter's raw text is not a valid JSON literal, or the
* parsed JSON value was rejected by the codec's `decodeJson` method, or the
* codec id is not registered in the lookup.
*/
'PSL_EXTENSION_INVALID_VALUE' |
/**
* A `ref`-kind parameter identifier does not resolve to a declared entity of
* the required `refKind` within the declared scope.
*/
'PSL_EXTENSION_UNRESOLVED_REF' |
/**
* A parameter key appears more than once in an extension block body.
* The first occurrence is kept; subsequent occurrences emit this diagnostic.
*/
'PSL_EXTENSION_DUPLICATE_PARAMETER' |
/**
* A `@@`-prefixed block-attribute line inside an extension block has invalid syntax.
*/
'PSL_INVALID_EXTENSION_BLOCK_ATTRIBUTE' |
/**
* Duplicate scopes are top level, namespace body, or block fields; diagnostics
* are first-wins and anchored on later name spans.
*/
'PSL_DUPLICATE_DECLARATION';
/**
* Descriptor vocabulary for a single parameter on a declared block.
*
* Four kinds:
* - `ref` — the parameter value is an identifier that must resolve to a
* declared entity of `refKind` within the declared `scope`.
* - `value` — the parameter value is a PSL literal parsed and printed
* through the codec identified by `codecId`.
* - `option` — the parameter value is one of the literal tokens in `values`.
* Not a codec; not persisted data. A closed authoring-time constraint only.
* - `list` — a bracketed list whose elements each match the `of` descriptor.
*/
type PslBlockParam = PslBlockParamRef | PslBlockParamValue | PslBlockParamOption | PslBlockParamList;
interface PslBlockParamRef {
readonly kind: 'ref';
readonly refKind: string;
readonly scope: 'same-namespace' | 'same-space' | 'cross-space';
readonly required?: boolean;
}
interface PslBlockParamValue {
readonly kind: 'value';
readonly codecId: string;
readonly required?: boolean;
}
interface PslBlockParamOption extends AuthoringOption {
readonly required?: boolean;
}
interface PslBlockParamList {
readonly kind: 'list';
readonly of: PslBlockParam;
readonly required?: boolean;
}
/**
* The parsed representation of a single parameter value on a uniform
* extension-block AST node. Mirrors the `PslBlockParam` descriptor
* vocabulary, plus `bare` for keyonly entries:
*
* - `ref` → `PslExtensionBlockParamRef` — a raw identifier string
* (resolution runs in the validator, not the parser).
* - `value` → `PslExtensionBlockParamScalarValue` — a raw PSL literal string
* (codec validation runs in the validator).
* - `option` → `PslExtensionBlockParamOption` — the chosen token.
* - `list` → `PslExtensionBlockParamList` — ordered list of the above.
* - `bare` → `PslExtensionBlockParamBare` — a bare identifier line with no
* `= value` (e.g. `Low` in an enum block). The name is the key in
* `parameters`; the interpreting consumer decides the default value.
*
* These shapes are intentionally minimal. The validator and lowering refine
* and consume them; the generic framework parser produces them.
*/
type PslExtensionBlockParamValue = PslExtensionBlockParamRef | PslExtensionBlockParamScalarValue | PslExtensionBlockParamOption | PslExtensionBlockParamList | PslExtensionBlockParamBare;
interface PslExtensionBlockParamRef {
readonly kind: 'ref';
readonly identifier: string;
readonly span: PslSpan;
}
interface PslExtensionBlockParamScalarValue {
readonly kind: 'value';
readonly raw: string;
readonly span: PslSpan;
}
interface PslExtensionBlockParamOption {
readonly kind: 'option';
readonly token: string;
readonly span: PslSpan;
}
interface PslExtensionBlockParamList {
readonly kind: 'list';
readonly items: readonly PslExtensionBlockParamValue[];
readonly span: PslSpan;
}
/**
* A bare identifier line inside an extension block — a key with no `= value`.
* Emitted when a line matches `/^[A-Za-z_]\w*$/` with no assignment. The
* consumer decides what default value (if any) to apply.
*/
interface PslExtensionBlockParamBare {
readonly kind: 'bare';
readonly span: PslSpan;
}
/**
* A positional argument on a block attribute, e.g. the `"pg/text@1"` in
* `@@type("pg/text@1")`.
*/
interface PslExtensionBlockAttributeArg {
readonly kind: 'positional';
readonly value: string;
readonly span: PslSpan;
}
/**
* A `@@`-prefixed block-level attribute parsed inside an extension block,
* e.g. `@@type("pg/text@1")`. Block attributes are captured generically
* — the parser does not validate attribute names or argument shapes; that
* is a concern of the block's interpreter.
*/
interface PslExtensionBlockAttribute {
readonly name: string;
readonly args: readonly PslExtensionBlockAttributeArg[];
readonly span: PslSpan;
}
/**
* Base shape for a uniform extension-contributed top-level PSL block
* node, as produced by the generic framework parser and consumed by the
* validator, printer, and lowering factory.
*
* - `kind` is the routing discriminant, equal to the descriptor's
* `discriminator`. The framework parser sets this to
* `descriptor.discriminator` for every block it parses. Several keywords
* may share one discriminator (e.g. `policy_select`/`policy_insert` both
* route to `kind: 'policy'`) — `kind` identifies the entity/storage kind,
* not the source syntax.
* - `keyword` is the source PSL keyword the block was declared with
* (`policy_select`, `policy_insert`, …) — the parse-dispatch identity.
* Distinct from `kind` precisely when a discriminator is shared by more
* than one keyword; a lowering factory that contributes several keywords
* under one discriminator reads `keyword` to tell its blocks apart, and
* the printer re-emits each block under its own `keyword` regardless of
* how many other keywords share its `kind`.
* - `name` is the block's declared name (the identifier after the keyword).
* - `parameters` is the descriptor-driven parameter map. Keys are
* parameter names from the descriptor; values are the parsed parameter
* representations. Only parameters present in the source are included
* — absence of a required parameter is a validator concern, not a
* parser concern. Insertion order is preserved; the first occurrence of a
* duplicate key is retained and subsequent occurrences emit
* `PSL_EXTENSION_DUPLICATE_PARAMETER`.
* - `blockAttributes` are `@@`-prefixed attribute lines inside the block, in
* declaration order. Captured generically — names and args are not validated
* by the parser.
* - `span` covers the full block from keyword to closing brace.
*/
interface PslExtensionBlock {
readonly kind: string;
/**
* The block's parse identity — the source PSL keyword it was declared
* with. `kind`/`discriminator` is its storage identity; several keywords
* can share one. E.g. the five `policy_*` keywords all lower to the
* `policy` entity kind.
*/
readonly keyword: string;
readonly name: string;
readonly parameters: Record<string, PslExtensionBlockParamValue>;
readonly blockAttributes: readonly PslExtensionBlockAttribute[];
readonly span: PslSpan;
}
//#endregion
//#region src/shared/framework-authoring.d.ts
type AuthoringArgRef = {
readonly kind: 'arg';
readonly index: number;
readonly path?: readonly string[];
readonly default?: AuthoringTemplateValue;
};
/**
* Selects among `cases` by the value of the referenced argument: the resolved
* value must be one of the case keys, and the node resolves to that case's
* recursively resolved template. An absent argument resolves to `undefined`,
* which the enclosing object template omits entirely.
*
* Case coverage is validated against the referenced option argument's
* `values` at pack-registration time, so the runtime miss-throw is an
* assertion for type-bypassing callers, not a user-facing diagnostic.
*
* Must not be used in the `codecId`/`nullable`/`id`/`unique` positions of a
* preset output: the type-level `ResolveTemplateValue` does not implement
* select, and those fields feed TS builder-state inference. See ADR 239.
*/
interface AuthoringSelectRef {
readonly kind: 'select';
readonly index: number;
readonly path?: readonly string[];
readonly cases: Readonly<Record<string, AuthoringTemplateValue>>;
}
type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | AuthoringSelectRef | readonly AuthoringTemplateValue[] | {
readonly [key: string]: AuthoringTemplateValue;
};
interface AuthoringArgumentDescriptorCommon {
readonly name?: string;
readonly optional?: boolean;
}
type AuthoringArgumentDescriptor = AuthoringArgumentDescriptorCommon & ({
readonly kind: 'string';
} | {
readonly kind: 'boolean';
} | {
readonly kind: 'number';
readonly integer?: boolean;
readonly minimum?: number;
readonly maximum?: number;
} | {
readonly kind: 'stringArray';
} | {
readonly kind: 'object';
readonly properties: Record<string, AuthoringArgumentDescriptor>;
} | AuthoringOption);
interface AuthoringStorageTypeTemplate {
readonly codecId: string;
/**
* Optional so a type constructor whose {@link AuthoringTypeConstructorDescriptor.entityRefArg}
* names another entity can omit this template entirely — its output for
* that case is derived by the codec at `codecId`, not by resolving a
* literal here. Every other consumer of this shape (field presets, plain
* type constructors) always supplies it.
*/
readonly nativeType?: AuthoringTemplateValue;
readonly typeParams?: Record<string, AuthoringTemplateValue>;
}
/**
* Declares that one positional argument of a
* {@link AuthoringTypeConstructorDescriptor} call names another entity
* parsed from the same document, rather than carrying a literal value (e.g.
* `pg.enum(AalLevel)` naming a `native_enum` entity). `index` is the
* argument's position in the call; `entityKind` is the entries-slot
* discriminator the interpreter looks the named entity up under (the same
* shape {@link AuthoringEntityTypeFactoryOutput.factory} output is collected
* into, keyed by discriminator then block name).
*
* The interpreter resolves the named argument to the entity instance
* generically, driven only by this declaration — it has no target-specific
* knowledge of which type constructors carry one. Converting the resolved
* entity into the constructor's params is a separate, codec-owned concern:
* the codec descriptor registered for `output.codecId` supplies that
* conversion, not this framework type.
*/
interface AuthoringTypeConstructorEntityRef {
readonly index: number;
readonly entityKind: string;
}
interface AuthoringTypeConstructorDescriptor {
readonly kind: 'typeConstructor';
readonly args?: readonly AuthoringArgumentDescriptor[];
readonly output: AuthoringStorageTypeTemplate;
/** Present when one of this constructor's positional arguments names another document-local entity instead of carrying a literal value. Absent for ordinary literal-argument constructors. */
readonly entityRefArg?: AuthoringTypeConstructorEntityRef;
}
interface AuthoringColumnDefaultTemplateLiteral {
readonly kind: 'literal';
readonly value: AuthoringTemplateValue;
}
interface AuthoringColumnDefaultTemplateFunction {
readonly kind: 'function';
readonly expression: AuthoringTemplateValue;
}
type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction;
interface AuthoringExecutionDefaultsTemplate {
readonly onCreate?: AuthoringTemplateValue;
readonly onUpdate?: AuthoringTemplateValue;
}
interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {
readonly nullable?: boolean;
readonly default?: AuthoringColumnDefaultTemplate;
readonly executionDefaults?: AuthoringExecutionDefaultsTemplate;
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;
};
/**
* Context surfaced to entity-type factories at call time. Currently a
* placeholder — sharpened as concrete consumers (enum, namespace, …)
* discover what the factory actually needs to read (codec lookup,
* namespace registry, …).
*/
/**
* A write-only sink that a factory may push authoring-time diagnostics into.
* The concrete type pushed must be structurally compatible with whatever the
* consumer accumulates (typically `ContractSourceDiagnostic[]`); the framework
* layer deliberately does not depend on that concrete type.
*/
interface AuthoringDiagnosticSink {
push(d: {
readonly code: string;
readonly message: string;
readonly sourceId: string;
readonly span?: unknown;
}): void;
}
interface AuthoringEntityContext {
readonly family: string;
readonly target: string;
/** Codec registry available to factories that need to validate or decode values. */
readonly codecLookup?: CodecLookup;
/** Source file identifier threaded into diagnostics emitted by the factory. */
readonly sourceId?: string;
/** Push channel for authoring-time diagnostics emitted by the factory. */
readonly diagnostics?: AuthoringDiagnosticSink;
/**
* The target's default codec ids for an `enum` block that omits `@@type`.
* `text` is used when every member is a bare name or a string value;
* `int` is used when every member is an integer value. Every target pack
* populates this so `@@type` omission can be inferred consistently.
*/
readonly enumInferenceCodecs?: {
readonly text: string;
readonly int: string;
};
}
/**
* Classifies an `enum` block's members (before codec decoding, which needs
* the codec chosen first) into which default codec an omitted `@@type`
* should resolve to:
*
* - every member is `bare`, or a `value` whose raw JSON is a string → `'text'`
* - every member is a `value` whose raw JSON is an integer → `'int'`
* - anything else (float, bigint, boolean, mixed, or a `ref`/`option`/`list`
* parameter) → `null`, meaning the caller must require an explicit `@@type`.
*/
declare function classifyEnumMemberType(block: PslExtensionBlock): 'text' | 'int' | null;
/**
* Resolves the codec id for an `enum` block. When `@@type` is absent, the codec
* is inferred from the members via {@link classifyEnumMemberType}; otherwise the
* explicit `@@type("codec")` argument is parsed. Pushes the appropriate
* diagnostic and returns `undefined` when neither yields a codec. `codecSpan` is
* the span downstream codec-validation diagnostics should anchor to. Shared by
* every family's enum factory so inference and the explicit path stay identical.
*/
declare function resolveEnumCodecId(block: PslExtensionBlock, ctx: AuthoringEntityContext): {
readonly codecId: string;
readonly codecSpan: PslSpan;
} | undefined;
interface AuthoringEntityTypeTemplateOutput {
readonly template: AuthoringTemplateValue;
}
/**
* Default `Input = never` is load-bearing for pack-bag-driven type
* narrowing. Factory parameter positions are contravariant, so a pack
* literal declaring `factory: (input: DemoEntityInput) => DemoEntity`
* is only assignable to the base descriptor's factory shape if the
* base's input is `never` (the bottom of the contravariant position).
* The concrete input/output types are recovered at the helper-derivation
* site via `EntityHelperFunction<Descriptor>`'s conditional inference,
* which reads them from the pack's `as const` literal factory signature
* — the base widening does not erase the literal because `satisfies`
* does not widen the declared type.
*/
interface AuthoringEntityTypeFactoryOutput<Input = never, Output = unknown> {
readonly factory: (input: Input, ctx: AuthoringEntityContext) => Output;
}
interface AuthoringEntityTypeDescriptor<Input = never, Output = unknown> {
readonly kind: 'entity';
readonly discriminator: string;
readonly args?: readonly AuthoringArgumentDescriptor[];
readonly output: AuthoringEntityTypeTemplateOutput | AuthoringEntityTypeFactoryOutput<Input, Output>;
/**
* arktype schema fragment for one entry whose envelope `kind` matches
* this descriptor's {@link discriminator}. The family validator composes
* contributed fragments into the per-namespace entry schema at
* validator construction time so the structural check covers
* pack-introduced kinds without the family core hard-coding the schema.
*
* Hydration uses {@link AuthoringEntityTypeFactoryOutput.factory}
* directly — the wire shape conforms structurally to the factory's
* `Input` after `validatorSchema` validates it.
*/
readonly validatorSchema?: Type<unknown>;
}
type AuthoringEntityTypeNamespace = {
readonly [name: string]: AuthoringEntityTypeDescriptor | AuthoringEntityTypeNamespace;
};
/**
* Declarative descriptor for an extension-contributed top-level PSL block.
*
* An extension registers one of these per keyword it contributes. The
* framework owns the generic parser, validator, and printer — no
* parsing or printing code runs from the extension.
*
* - `keyword` is the PSL top-level identifier this descriptor claims
* (`policy_select`, `role`, …).
* - `discriminator` is the routing key used by the printer dispatch and
* the `entityTypes` lowering factory lookup. Convention:
* `<target-or-family>-<kind>` (`postgres-policy-select`).
* - `name.required` declares whether the block must have a name token
* after the keyword. Currently always `true` — anonymous blocks are
* not part of the closed-grammar premise — but the field is explicit
* so the type can evolve without a breaking change.
* - `parameters` maps parameter names to their value-kind descriptors
* (`ref` / `value` / `option` / `list`). The generic parser and
* validator interpret these; the extension supplies no parser or
* printer function.
*/
interface AuthoringPslBlockDescriptor {
readonly kind: 'pslBlock';
readonly keyword: string;
readonly discriminator: string;
readonly name: {
readonly required: boolean;
};
readonly parameters: Record<string, PslBlockParam>;
/**
* When `true`, the block body accepts a variadic tail of parameters beyond
* the declared set. The block body may contain: fields (model-style),
* `key = value` parameters, and `@@` attributes. With `variadicParameters`,
* bare identifiers (keys without a `= value`) and undeclared `key = value`
* pairs flow into the variadic tail — their semantics belong to the
* lowering, not the parser.
*
* A key that IS declared in `parameters` must still be supplied as
* `key = value`; a bare occurrence of a declared key is a diagnostic.
*
* When `false` (default), the validator emits `PSL_EXTENSION_UNKNOWN_PARAMETER`
* for keys absent from `parameters`.
*/
readonly variadicParameters?: boolean;
/**
* Declares that the model named by the block's ref parameter `parameter`
* must carry the bare `@@` model attribute `attribute`. The family
* interpreter enforces this generically over the whole parsed document —
* declaration order of the block and the model does not matter — and
* emits `PSL_EXTENSION_TARGET_MODEL_MISSING_ATTRIBUTE` naming the block
* and the model when the attribute is absent. A parameter that is
* missing or does not resolve to a model is not this rule's concern
* (missing-parameter and unresolved-ref diagnostics own those cases).
*/
readonly requiresModelAttribute?: {
readonly parameter: string;
readonly attribute: string;
};
}
type AuthoringPslBlockDescriptorNamespace = {
readonly [name: string]: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace;
};
/**
* Context surfaced to a model-attribute lowering at call time: the entity
* context shared with entity-type factories, plus the declaring model's
* name, its mapped storage name (the name of the storage object the model
* maps to; which kind of object that is belongs to the family, not the
* framework), and the namespace id the lowered entity should be filed
* under.
*/
interface AuthoringModelAttributeContext extends AuthoringEntityContext {
readonly modelName: string;
readonly storageName: string;
readonly namespaceId: string;
}
/**
* What a model-attribute lowering returns when it produces an entity: `key`
* is the identity the entity is stored under within its `entries` slot
* (`entries[attribute][key]`); `entity` is the value stored there. A
* lowering that instead pushed a diagnostic through
* {@link AuthoringModelAttributeContext.diagnostics} returns `undefined` —
* the same convention {@link AuthoringEntityTypeFactoryOutput} uses.
*/
interface AuthoringModelAttributeLoweringOutput {
readonly key: string;
readonly entity: unknown;
}
/**
* Declarative descriptor for an extension-contributed `@@` model attribute.
*
* An extension registers one of these per bare attribute name it
* contributes. The framework owns the generic consult in the interpreter's
* model-attribute loop; the contribution supplies only `spec` and `lower`.
*
* - `attribute` is the bare `@@` attribute name this descriptor claims and,
* by the one-string rule, the `entries` slot its lowered entities are
* grouped under (`entries[attribute][key]`).
* - `spec` is opaque to the framework core: an ADR-231 attribute-spec kit
* `AttributeSpec<Out>` value (`modelAttribute(name, {...})` from
* `@prisma-next/psl-parser`). Framework core does not depend on
* psl-parser and never inspects this field; the family interpreter,
* which does depend on psl-parser, parses the attribute's arguments
* against it.
* - `lower` receives the parsed arguments and the declaring model's
* context, and returns the entity to file into `entries`, or `undefined`
* after pushing a diagnostic via `ctx.diagnostics`.
*
* `Out` defaults to `never` — not `unknown` — for the same contravariance
* reason documented on {@link AuthoringEntityTypeFactoryOutput}: a concrete
* pack literal's narrower `lower(parsed: ConcreteOut, ctx)` is only
* assignable to this base shape when the base parameter is the bottom type.
*/
interface AuthoringModelAttributeDescriptor<Out = never> {
readonly kind: 'modelAttribute';
readonly attribute: string;
readonly spec: unknown;
readonly lower: (parsed: Out, ctx: AuthoringModelAttributeContext) => AuthoringModelAttributeLoweringOutput | undefined;
}
type AuthoringModelAttributeDescriptorNamespace = {
readonly [name: string]: AuthoringModelAttributeDescriptor | AuthoringModelAttributeDescriptorNamespace;
};
interface AuthoringContributions {
readonly type?: AuthoringTypeNamespace;
readonly field?: AuthoringFieldNamespace;
readonly entityTypes?: AuthoringEntityTypeNamespace;
/**
* Registry of declarative block descriptors this contribution registers,
* keyed by arbitrary path segments. Each leaf is an
* {@link AuthoringPslBlockDescriptor} that claims a PSL top-level keyword.
* The framework owns the generic parser, validator, and printer; the
* contribution supplies only these declarative descriptors.
*
* Contrast with the parsed block nodes themselves, which live in a
* namespace's `entries` under their discriminator key; this field holds the
* registry of descriptors that teach the parser how to read those blocks.
*/
readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;
/**
* Registry of declarative `@@` model attribute descriptors this
* contribution registers, keyed by arbitrary path segments. Each leaf is
* an {@link AuthoringModelAttributeDescriptor} that claims a bare model
* attribute name. The framework owns the generic consult in the family
* interpreter's model-attribute loop; the contribution supplies only the
* declarative spec and the lowering.
*/
readonly modelAttributes?: AuthoringModelAttributeDescriptorNamespace;
}
declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef;
declare function isAuthoringTypeConstructorDescriptor(value: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace): value is AuthoringTypeConstructorDescriptor;
declare function isAuthoringFieldPresetDescriptor(value: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace): value is AuthoringFieldPresetDescriptor;
declare function isAuthoringEntityTypeDescriptor(value: AuthoringEntityTypeDescriptor | AuthoringEntityTypeNamespace): value is AuthoringEntityTypeDescriptor;
declare function isAuthoringPslBlockDescriptor(value: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace): value is AuthoringPslBlockDescriptor;
declare function isAuthoringModelAttributeDescriptor(value: AuthoringModelAttributeDescriptor | AuthoringModelAttributeDescriptorNamespace): value is AuthoringModelAttributeDescriptor;
/**
* Returns true when `namespace` is a non-leaf key in `contributions.field`.
*
* `AuthoringFieldNamespace` permits a leaf descriptor at any depth — including
* the root — so a top-level `field: { Foo: { kind: 'fieldPreset', ... } }`
* registration must NOT be treated as a "namespace" with sub-paths. Callers
* use this predicate to gate dot-namespaced lookups (e.g. PSL `@Foo.bar`).
*/
declare function hasRegisteredFieldNamespace(contributions: AuthoringContributions | undefined, namespace: string): boolean;
/**
* Merges `source` into `target` recursively at the descriptor-namespace
* level. `descriptorKind` is the `kind` value ('typeConstructor',
* 'fieldPreset', 'entity', or 'pslBlock') that identifies a descriptor
* (terminal merge point; same-path registrations across components are
* reported as duplicates) as opposed to a sub-namespace (recursion target).
*
* Path segments are validated against prototype-pollution names
* (`__proto__`, `constructor`, `prototype`). A value that is neither a
* recognized leaf nor a plain object — e.g. a malformed descriptor
* where the canonical leaf guard rejected it for missing `output` —
* is reported as an invalid contribution rather than recursed into,
* which would either silently mangle state or infinite-loop on
* primitive properties.
*
* Within-registry duplicate detection is this walker's job;
* cross-registry detection runs separately via
* `assertNoCrossRegistryCollisions` after merging completes.
*/
declare function mergeAuthoringNamespaces(target: Record<string, unknown>, source: Record<string, unknown>, path: readonly string[], descriptorKind: string, label: string): void;
declare function assertNoCrossRegistryCollisions(typeNamespace: AuthoringTypeNamespace, fieldNamespace: AuthoringFieldNamespace, entityTypeNamespace?: AuthoringEntityTypeNamespace, pslBlockNamespace?: AuthoringPslBlockDescriptorNamespace, modelAttributeNamespace?: AuthoringModelAttributeDescriptorNamespace): void;
declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue | undefined, 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 instantiateAuthoringEntityType<TOutput = unknown>(helperPath: string, descriptor: AuthoringEntityTypeDescriptor, args: readonly unknown[], ctx: AuthoringEntityContext): TOutput;
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?: ColumnDefault;
readonly executionDefaults?: ExecutionMutationDefaultPhases;
readonly id: boolean;
readonly unique: boolean;
};
//#endregion
export { PslExtensionBlockParamOption as $, instantiateAuthoringFieldPreset as A, resolveEnumCodecId as B, AuthoringTypeConstructorDescriptor as C, classifyEnumMemberType as D, assertNoCrossRegistryCollisions as E, isAuthoringModelAttributeDescriptor as F, PslBlockParamRef as G, PslBlockParam as H, isAuthoringPslBlockDescriptor as I, PslExtensionBlock as J, PslBlockParamValue as K, isAuthoringTypeConstructorDescriptor as L, isAuthoringArgRef as M, isAuthoringEntityTypeDescriptor as N, hasRegisteredFieldNamespace as O, isAuthoringFieldPresetDescriptor as P, PslExtensionBlockParamList as Q, mergeAuthoringNamespaces as R, AuthoringTemplateValue as S, AuthoringTypeNamespace as T, PslBlockParamList as U, validateAuthoringHelperArguments as V, PslBlockParamOption as W, PslExtensionBlockAttributeArg as X, PslExtensionBlockAttribute as Y, PslExtensionBlockParamBare as Z, AuthoringModelAttributeLoweringOutput as _, AuthoringDiagnosticSink as a, AuthoringOption as at, AuthoringSelectRef as b, AuthoringEntityTypeFactoryOutput as c, AuthoringFieldNamespace as d, PslExtensionBlockParamRef as et, AuthoringFieldPresetDescriptor as f, AuthoringModelAttributeDescriptorNamespace as g, AuthoringModelAttributeDescriptor as h, AuthoringContributions as i, PslSpan as it, instantiateAuthoringTypeConstructor as j, instantiateAuthoringEntityType as k, AuthoringEntityTypeNamespace as l, AuthoringModelAttributeContext as m, AuthoringArgumentDescriptor as n, PslExtensionBlockParamValue as nt, AuthoringEntityContext as o, AuthoringFieldPresetOutput as p, PslDiagnosticCode as q, AuthoringColumnDefaultTemplate as r, PslPosition as rt, AuthoringEntityTypeDescriptor as s, AuthoringArgRef as t, PslExtensionBlockParamScalarValue as tt, AuthoringEntityTypeTemplateOutput as u, AuthoringPslBlockDescriptor as v, AuthoringTypeConstructorEntityRef as w, AuthoringStorageTypeTemplate as x, AuthoringPslBlockDescriptorNamespace as y, resolveAuthoringTemplateValue as z };
//# sourceMappingURL=framework-authoring-Bv5QKca9.d.mts.map
{"version":3,"file":"framework-authoring-Bv5QKca9.d.mts","names":[],"sources":["../src/shared/option-descriptor.ts","../src/shared/psl-extension-block.ts","../src/shared/framework-authoring.ts"],"mappings":";;;;;;;;;;;UAOiB;WACN;WACA;;;;UCKM;WACN;WACA;WACA;;UAGM;WACN,OAAO;WACP,KAAK;;KAGJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0GA,gBACR,mBACA,qBACA,sBACA;UAEa;WACN;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;;UAGM,4BAA4B;WAClC;;UAGM;WACN;WACA,IAAI;WACJ;;;;;;;;;;;;;;;;;;;;KAqBC,8BACR,4BACA,oCACA,+BACA,6BACA;UAE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Ba,gCACd,YAAY,gCACZ;WAES;aACE;aACA;aACA,aAAa;;WAEf;WACA,UAAU;WACV,oBAAoB;WACpB;WACA"}
import { n as runtimeError } from "./runtime-error-BA9d7XjZ.mjs";
import { blindCast } from "@prisma-next/utils/casts";
import { isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue } from "@prisma-next/contract/types";
import { ifDefined } from "@prisma-next/utils/defined";
//#region src/shared/framework-authoring.ts
/**
* Classifies an `enum` block's members (before codec decoding, which needs
* the codec chosen first) into which default codec an omitted `@@type`
* should resolve to:
*
* - every member is `bare`, or a `value` whose raw JSON is a string → `'text'`
* - every member is a `value` whose raw JSON is an integer → `'int'`
* - anything else (float, bigint, boolean, mixed, or a `ref`/`option`/`list`
* parameter) → `null`, meaning the caller must require an explicit `@@type`.
*/
function classifyEnumMemberType(block) {
let sawText = false;
let sawInt = false;
for (const paramValue of Object.values(block.parameters)) {
if (paramValue.kind === "bare") {
sawText = true;
continue;
}
if (paramValue.kind !== "value") return null;
let jsonValue;
try {
jsonValue = JSON.parse(paramValue.raw);
} catch {
return null;
}
if (typeof jsonValue === "string") sawText = true;
else if (typeof jsonValue === "number" && Number.isInteger(jsonValue)) sawInt = true;
else return null;
}
if (sawText && sawInt) return null;
if (sawText) return "text";
if (sawInt) return "int";
return null;
}
/**
* Resolves the codec id for an `enum` block. When `@@type` is absent, the codec
* is inferred from the members via {@link classifyEnumMemberType}; otherwise the
* explicit `@@type("codec")` argument is parsed. Pushes the appropriate
* diagnostic and returns `undefined` when neither yields a codec. `codecSpan` is
* the span downstream codec-validation diagnostics should anchor to. Shared by
* every family's enum factory so inference and the explicit path stay identical.
*/
function resolveEnumCodecId(block, ctx) {
const sourceId = ctx.sourceId ?? "unknown";
const typeAttr = block.blockAttributes.find((a) => a.name === "type");
if (typeAttr === void 0) {
const inferredKind = classifyEnumMemberType(block);
if (inferredKind === null || ctx.enumInferenceCodecs === void 0) {
ctx.diagnostics?.push({
code: "PSL_ENUM_CANNOT_INFER_TYPE",
message: `cannot infer @@type for enum "${block.name}"; add an explicit @@type(...)`,
sourceId,
span: block.span
});
return;
}
return {
codecId: ctx.enumInferenceCodecs[inferredKind],
codecSpan: block.span
};
}
const rawCodecArg = typeAttr.args[0]?.value;
const codecId = rawCodecArg?.startsWith("\"") && rawCodecArg.endsWith("\"") && rawCodecArg.length >= 2 ? rawCodecArg.slice(1, -1) : void 0;
if (codecId === void 0) {
ctx.diagnostics?.push({
code: "PSL_ENUM_MISSING_TYPE",
message: `enum "${block.name}" @@type attribute must have a quoted codec id argument`,
sourceId,
span: typeAttr.span
});
return;
}
return {
codecId,
codecSpan: typeAttr.args[0]?.span ?? typeAttr.span
};
}
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 isAuthoringSelectRef(value) {
if (!isAuthoringTemplateRecord(value) || value["kind"] !== "select") return false;
const index = value["index"];
const path = value["path"];
const cases = value["cases"];
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 typeof cases === "object" && cases !== null && !Array.isArray(cases);
}
function isAuthoringTemplateRecord(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function readTemplateArgumentValue(args, index, path) {
let value = args[index];
for (const segment of path ?? []) {
if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) return;
value = value[segment];
}
return value;
}
function isAuthoringTypeConstructorDescriptor(value) {
return "kind" in value && value.kind === "typeConstructor";
}
function isAuthoringFieldPresetDescriptor(value) {
return "kind" in value && value.kind === "fieldPreset";
}
function isAuthoringEntityTypeDescriptor(value) {
return "kind" in value && value.kind === "entity";
}
function isAuthoringPslBlockDescriptor(value) {
return "kind" in value && value.kind === "pslBlock";
}
function isAuthoringModelAttributeDescriptor(value) {
return "kind" in value && value.kind === "modelAttribute";
}
/**
* Returns true when `namespace` is a non-leaf key in `contributions.field`.
*
* `AuthoringFieldNamespace` permits a leaf descriptor at any depth — including
* the root — so a top-level `field: { Foo: { kind: 'fieldPreset', ... } }`
* registration must NOT be treated as a "namespace" with sub-paths. Callers
* use this predicate to gate dot-namespaced lookups (e.g. PSL `@Foo.bar`).
*/
function hasRegisteredFieldNamespace(contributions, namespace) {
if (contributions?.field === void 0 || !Object.hasOwn(contributions.field, namespace)) return false;
const value = contributions.field[namespace];
return value !== void 0 && !isAuthoringFieldPresetDescriptor(value);
}
function isCopyableNamespaceObject(value) {
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
const proto = Object.getPrototypeOf(value);
return proto === Object.prototype || proto === null;
}
/**
* Deep structural check run only at the composition boundary (the merge and
* collect walkers) to classify a raw namespace-tree node as a leaf descriptor.
* A node counts as a leaf iff its `kind` matches `descriptorKind` AND it
* carries that kind's required fields.
*
* This is boundary validation over `unknown`, NOT a type-predicate: the four
* exported `isAuthoring*Descriptor` predicates deliberately narrow on `kind`
* alone and trust the static types. The walkers, by contrast, also receive
* type-bypassing packs (`as unknown as never` in tests, untyped JS at runtime)
* whose descriptor-shaped-but-incomplete nodes must be rejected rather than
* silently treated as sub-namespaces — so the well-formedness check lives here.
*/
function isWellFormedDescriptor(value, descriptorKind) {
if (typeof value !== "object" || value === null) return false;
if (!("kind" in value) || value.kind !== descriptorKind) return false;
switch (descriptorKind) {
case "typeConstructor":
case "fieldPreset": {
if (!("output" in value)) return false;
const output = value.output;
return typeof output === "object" && output !== null;
}
case "entity": {
if (!("discriminator" in value) || typeof value.discriminator !== "string") return false;
if (value.discriminator.length === 0) return false;
if (!("output" in value)) return false;
const output = value.output;
if (typeof output !== "object" || output === null) return false;
const factory = "factory" in output ? output.factory : void 0;
const template = "template" in output ? output.template : void 0;
return typeof factory === "function" || template !== void 0;
}
case "pslBlock": {
if (!("keyword" in value) || typeof value.keyword !== "string" || value.keyword.length === 0) return false;
if (!("discriminator" in value) || typeof value.discriminator !== "string" || value.discriminator.length === 0) return false;
if (!("name" in value)) return false;
const name = value.name;
if (typeof name !== "object" || name === null) return false;
if (!("required" in name) || typeof name.required !== "boolean") return false;
if (!("parameters" in value)) return false;
const parameters = value.parameters;
return typeof parameters === "object" && parameters !== null && !Array.isArray(parameters);
}
case "modelAttribute":
if (!("attribute" in value) || typeof value.attribute !== "string" || value.attribute.length === 0) return false;
if (!("spec" in value)) return false;
return "lower" in value && typeof value.lower === "function";
default: return false;
}
}
function deepCopyNamespace(source, descriptorKind) {
const copy = {};
for (const [key, value] of Object.entries(source)) copy[key] = isCopyableNamespaceObject(value) && !isWellFormedDescriptor(value, descriptorKind) ? deepCopyNamespace(value, descriptorKind) : value;
return copy;
}
/**
* Merges `source` into `target` recursively at the descriptor-namespace
* level. `descriptorKind` is the `kind` value ('typeConstructor',
* 'fieldPreset', 'entity', or 'pslBlock') that identifies a descriptor
* (terminal merge point; same-path registrations across components are
* reported as duplicates) as opposed to a sub-namespace (recursion target).
*
* Path segments are validated against prototype-pollution names
* (`__proto__`, `constructor`, `prototype`). A value that is neither a
* recognized leaf nor a plain object — e.g. a malformed descriptor
* where the canonical leaf guard rejected it for missing `output` —
* is reported as an invalid contribution rather than recursed into,
* which would either silently mangle state or infinite-loop on
* primitive properties.
*
* Within-registry duplicate detection is this walker's job;
* cross-registry detection runs separately via
* `assertNoCrossRegistryCollisions` after merging completes.
*/
function mergeAuthoringNamespaces(target, source, path, descriptorKind, 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] = isCopyableNamespaceObject(sourceValue) && !isWellFormedDescriptor(sourceValue, descriptorKind) ? deepCopyNamespace(sourceValue, descriptorKind) : sourceValue;
continue;
}
const existingIsLeaf = isWellFormedDescriptor(existingValue, descriptorKind);
const sourceIsLeaf = isWellFormedDescriptor(sourceValue, descriptorKind);
if (existingIsLeaf || sourceIsLeaf) throw new Error(`Duplicate authoring ${label} helper "${currentPath.join(".")}". Helper names must be unique across composed packs.`);
if (!isCopyableNamespaceObject(existingValue) || !isCopyableNamespaceObject(sourceValue)) throw new Error(`Invalid authoring ${label} helper "${currentPath.join(".")}". Expected a sub-namespace object or a recognized descriptor; received a malformed value.`);
mergeAuthoringNamespaces(existingValue, sourceValue, currentPath, descriptorKind, label);
}
}
function collectDescriptorPaths(namespace, isLeaf, path = []) {
const paths = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isLeaf(value)) {
paths.push(currentPath.join("."));
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) paths.push(...collectDescriptorPaths(value, isLeaf, currentPath));
}
return paths;
}
function collectDescriptorEntries(namespace, isLeaf, descriptorKind, label, path = []) {
const entries = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isLeaf(value)) {
if (!isWellFormedDescriptor(value, descriptorKind)) throw new Error(`Malformed authoring ${label} contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the ${label} descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
if (value.discriminator.length > 0) entries.push({
path: currentPath.join("."),
discriminator: value.discriminator
});
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = blindCast(value);
if ((record["kind"] !== void 0 || record["keyword"] !== void 0 || record["discriminator"] !== void 0) && !isLeaf(value)) {
const hasKind = record["kind"] === "pslBlock";
const hasKeyword = typeof record["keyword"] === "string";
const hasDiscriminator = typeof record["discriminator"] === "string";
if (hasKind || hasKeyword && hasDiscriminator) throw new Error(`Malformed authoring ${label} contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the ${label} descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
}
entries.push(...collectDescriptorEntries(value, isLeaf, descriptorKind, label, currentPath));
}
}
return entries;
}
/**
* Throws when two or more entries in the same namespace share a key. A
* duplicate key makes dispatch ambiguous — the caller's lookup dispatches by
* this key, so one entry would silently shadow the other. Catch duplicates
* before building any dispatch map.
*
* `label` (e.g. `'pslBlock'`, `'entityType'`) names which namespace the
* duplicate was found in and is carried in the structured error metadata;
* the key itself is always called `key` in both the message and the
* metadata, since what it semantically represents (a discriminator for
* `entityType`, the parser's dispatch keyword for `pslBlock`) is the
* caller's concern, not this function's.
*/
function assertUniqueDiscriminators(entries, label) {
const seen = /* @__PURE__ */ new Map();
for (const { path, discriminator: key } of entries) {
const existing = seen.get(key);
if (existing !== void 0) throw runtimeError("RUNTIME.DUPLICATE_AUTHORING_DISCRIMINATOR", `Duplicate ${label} key "${key}" registered at both "${existing}" and "${path}". Each ${label} contribution must use a unique key.`, {
label,
key,
existingPath: existing,
path
});
seen.set(key, path);
}
}
function collectPslBlockDescriptorEntries(namespace, path = []) {
const entries = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isAuthoringPslBlockDescriptor(value)) {
if (!isWellFormedDescriptor(value, "pslBlock")) throw new Error(`Malformed authoring pslBlock contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the pslBlock descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push({
path: currentPath.join("."),
discriminator: value.discriminator,
keyword: value.keyword
});
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = blindCast(value);
const hasKind = record["kind"] === "pslBlock";
const hasKeyword = typeof record["keyword"] === "string";
const hasDiscriminator = typeof record["discriminator"] === "string";
if (hasKind || hasKeyword && hasDiscriminator) throw new Error(`Malformed authoring pslBlock contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/keyword/discriminator) but does not satisfy the pslBlock descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push(...collectPslBlockDescriptorEntries(value, currentPath));
}
}
return entries;
}
/**
* Every `pslBlockDescriptors` entry requires a matching `entityTypes` factory
* with the same discriminator. An `entityTypes` factory may stand alone (e.g.
* `enum`, reachable from the TypeScript builder without any PSL block).
*
* Uniqueness for pslBlock entries is keyed on **keyword**, not discriminator:
* several keywords (e.g. `policy_select`/`policy_insert`) may legitimately
* share one discriminator, routing to the same `entityTypes` factory and the
* same `entries[discriminator]` slot — that N:1 shape is exactly what lets
* one entity kind be authored through several PSL keywords. What must stay
* unique is the keyword itself, since that's what the parser dispatches on.
*/
function assertPslBlocksHaveFactories(entityTypeNamespace, pslBlockNamespace) {
const blockEntries = collectPslBlockDescriptorEntries(pslBlockNamespace);
const entityEntries = collectDescriptorEntries(entityTypeNamespace, isAuthoringEntityTypeDescriptor, "entity", "entityType");
assertUniqueDiscriminators(blockEntries.map((entry) => ({
path: entry.path,
discriminator: entry.keyword
})), "pslBlock");
assertUniqueDiscriminators(entityEntries, "entityType");
const entityDiscriminators = new Set(entityEntries.map((entry) => entry.discriminator));
for (const block of blockEntries) if (!entityDiscriminators.has(block.discriminator)) throw new Error(`Incomplete extension contribution: pslBlock helper "${block.path}" registers discriminator "${block.discriminator}" but no entityType contribution shares that discriminator. An extension-contributed PSL block requires a matching entityType factory so the parsed AST node can lower to an IR class instance; add an entityType helper with discriminator "${block.discriminator}".`);
}
function collectModelAttributeEntries(namespace, path = []) {
const entries = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isAuthoringModelAttributeDescriptor(value)) {
if (!isWellFormedDescriptor(value, "modelAttribute")) throw new Error(`Malformed authoring modelAttribute contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/attribute) but does not satisfy the modelAttribute descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push({
path: currentPath.join("."),
discriminator: value.attribute
});
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = blindCast(value);
if (typeof record["attribute"] === "string" && "spec" in record) throw new Error(`Malformed authoring modelAttribute contribution at "${currentPath.join(".")}". The value carries descriptor keys (kind/attribute) but does not satisfy the modelAttribute descriptor shape. Fix the contribution so it is a complete descriptor, or remove the stray keys if it was meant to be a sub-namespace.`);
entries.push(...collectModelAttributeEntries(value, currentPath));
}
}
return entries;
}
/**
* Throws when two modelAttribute contributions — at any paths, even
* different ones — claim the same bare `@@` attribute name. The family
* interpreter dispatches by attribute name, not by registration path, so
* two descriptors claiming the same name would have one silently shadow
* the other.
*/
function assertUniqueModelAttributeNames(entries) {
const seen = /* @__PURE__ */ new Map();
for (const { path, discriminator: attribute } of entries) {
const existing = seen.get(attribute);
if (existing !== void 0) throw new Error(`Duplicate modelAttribute "${attribute}" registered at both "${existing}" and "${path}". Each modelAttribute contribution must claim a unique attribute name.`);
seen.set(attribute, path);
}
}
function assertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityTypeNamespace = {}, pslBlockNamespace = {}, modelAttributeNamespace = {}) {
const typePaths = new Set(collectDescriptorPaths(typeNamespace, isAuthoringTypeConstructorDescriptor));
const fieldPaths = new Set(collectDescriptorPaths(fieldNamespace, isAuthoringFieldPresetDescriptor));
const entityPaths = new Set(collectDescriptorPaths(entityTypeNamespace, isAuthoringEntityTypeDescriptor));
const ambiguityHint = "Register each path in only one of authoringContributions.field / authoringContributions.type / authoringContributions.entityTypes.";
for (const fieldPath of fieldPaths) if (typePaths.has(fieldPath)) throw new Error(`Ambiguous authoring registry path "${fieldPath}". The same path is registered as both a type constructor and a field preset; PSL resolution would be ambiguous. ${ambiguityHint}`);
for (const entityPath of entityPaths) if (typePaths.has(entityPath) || fieldPaths.has(entityPath)) throw new Error(`Ambiguous authoring registry path "${entityPath}". The same path is registered as an entity contribution AND as a type constructor or field preset; PSL resolution would be ambiguous. ${ambiguityHint}`);
assertPslBlocksHaveFactories(entityTypeNamespace, pslBlockNamespace);
assertUniqueModelAttributeNames(collectModelAttributeEntries(modelAttributeNamespace));
assertSelectTemplatesMatchOptionArgs(typeNamespace, fieldNamespace, entityTypeNamespace);
}
function collectDescriptorNodes(namespace, isLeaf, path = []) {
const nodes = [];
for (const [key, value] of Object.entries(namespace)) {
const currentPath = [...path, key];
if (isLeaf(value)) {
nodes.push([currentPath.join("."), value]);
continue;
}
if (typeof value === "object" && value !== null && !Array.isArray(value)) nodes.push(...collectDescriptorNodes(value, isLeaf, currentPath));
}
return nodes;
}
function collectSelectRefs(value, found) {
if (typeof value !== "object" || value === null) return;
if (isAuthoringSelectRef(value)) {
found.push(value);
for (const caseTemplate of Object.values(value.cases)) collectSelectRefs(caseTemplate, found);
return;
}
if (isAuthoringArgRef(value)) {
collectSelectRefs(value.default, found);
return;
}
if (Array.isArray(value)) {
for (const entry of value) collectSelectRefs(entry, found);
return;
}
for (const entry of Object.values(value)) collectSelectRefs(entry, found);
}
function validateSelectRefsAgainstArgs(label, helperPath, args, templateRoot) {
const selects = [];
collectSelectRefs(templateRoot, selects);
for (const select of selects) {
const position = `#${select.index + 1}`;
let descriptor = args?.[select.index];
if (descriptor === void 0) throw new Error(`Authoring ${label} helper "${helperPath}" select template references argument ${position}, but the helper declares no argument at that position.`);
for (const segment of select.path ?? []) {
descriptor = descriptor.kind === "object" ? descriptor.properties[segment] : void 0;
if (descriptor === void 0) throw new Error(`Authoring ${label} helper "${helperPath}" select template references argument ${position} at path "${(select.path ?? []).join(".")}", which does not resolve to a declared argument property.`);
}
if (descriptor.kind !== "option") throw new Error(`Authoring ${label} helper "${helperPath}" select template references argument ${position}, which is kind "${descriptor.kind}"; select requires an option argument.`);
const argumentLabel = descriptor.name !== void 0 ? `"${descriptor.name}"` : position;
const missing = descriptor.values.filter((value) => !Object.hasOwn(select.cases, value));
if (missing.length > 0) throw new Error(`Authoring ${label} helper "${helperPath}" option argument ${argumentLabel} allows [${descriptor.values.join(", ")}] but the select template has no case for: ${missing.join(", ")}.`);
const values = descriptor.values;
const unreachable = Object.keys(select.cases).filter((key) => !values.includes(key));
if (unreachable.length > 0) throw new Error(`Authoring ${label} helper "${helperPath}" select template has case(s) not allowed by option argument ${argumentLabel}: ${unreachable.join(", ")}. Allowed values: [${values.join(", ")}].`);
}
}
/**
* Every `select` template node must target an option argument whose `values`
* exactly cover the node's `cases` — a legal token with no case and a case no
* token can reach are both declaration bugs, caught here at pack-registration
* time rather than at first resolution.
*/
function assertSelectTemplatesMatchOptionArgs(typeNamespace, fieldNamespace, entityTypeNamespace) {
for (const [helperPath, descriptor] of collectDescriptorNodes(fieldNamespace, isAuthoringFieldPresetDescriptor)) validateSelectRefsAgainstArgs("field", helperPath, descriptor.args, descriptor.output);
for (const [helperPath, descriptor] of collectDescriptorNodes(typeNamespace, isAuthoringTypeConstructorDescriptor)) validateSelectRefsAgainstArgs("type", helperPath, descriptor.args, descriptor.output);
for (const [helperPath, descriptor] of collectDescriptorNodes(entityTypeNamespace, isAuthoringEntityTypeDescriptor)) if ("template" in descriptor.output) validateSelectRefsAgainstArgs("entityType", helperPath, descriptor.args, descriptor.output.template);
}
function resolveAuthoringTemplateValue(template, args) {
if (template === void 0) return;
if (isAuthoringArgRef(template)) {
const value = readTemplateArgumentValue(args, template.index, template.path);
if (value === void 0 && template.default !== void 0) return resolveAuthoringTemplateValue(template.default, args);
return value;
}
if (isAuthoringSelectRef(template)) {
const value = readTemplateArgumentValue(args, template.index, template.path);
if (value === void 0) return;
if (typeof value !== "string" || !Object.hasOwn(template.cases, value)) throw new Error(`Authoring template select has no case for value "${String(value)}"`);
return resolveAuthoringTemplateValue(template.cases[value], args);
}
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 === "boolean") {
if (typeof value !== "boolean") throw new Error(`Authoring helper argument at ${path} must be a boolean`);
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 (descriptor.kind === "option") {
if (typeof value !== "string" || !descriptor.values.includes(value)) throw new Error(`Authoring helper argument at ${path} must be one of: ${descriptor.values.join(", ")}`);
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)}`);
const normalizedTypeParams = typeParams !== void 0 && Object.keys(typeParams).length === 0 ? void 0 : typeParams;
return {
codecId: template.codecId,
nativeType,
...ifDefined("typeParams", normalizedTypeParams)
};
}
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");
if (!isColumnDefaultLiteralInputValue(value)) throw new Error(`Resolved authoring literal default must be a JSON-serializable value or Date, received ${String(value)}`);
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 resolveExecutionMutationDefaultPhase(phase, template, args) {
const value = resolveAuthoringTemplateValue(template, args);
if (value === void 0) return;
if (!isExecutionMutationDefaultValue(value)) throw new Error(`Authoring preset executionDefaults.${phase} did not resolve to a valid generator descriptor (kind: 'generator', id: string).`);
return value;
}
function resolveAuthoringExecutionDefaultsTemplate(template, args) {
const phases = {
...ifDefined("onCreate", template.onCreate !== void 0 ? resolveExecutionMutationDefaultPhase("onCreate", template.onCreate, args) : void 0),
...ifDefined("onUpdate", template.onUpdate !== void 0 ? resolveExecutionMutationDefaultPhase("onUpdate", template.onUpdate, args) : void 0)
};
return Object.keys(phases).length === 0 ? void 0 : phases;
}
function instantiateAuthoringTypeConstructor(descriptor, args) {
return resolveAuthoringStorageTypeTemplate(descriptor.output, args);
}
function instantiateAuthoringEntityType(helperPath, descriptor, args, ctx) {
if ("factory" in descriptor.output) {
const input = args[0];
return blindCast(descriptor.output.factory)(input, ctx);
}
validateAuthoringHelperArguments(helperPath, descriptor.args, args);
return blindCast(resolveAuthoringTemplateValue(descriptor.output.template, 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("executionDefaults", descriptor.output.executionDefaults !== void 0 ? resolveAuthoringExecutionDefaultsTemplate(descriptor.output.executionDefaults, args) : void 0),
id: descriptor.output.id ?? false,
unique: descriptor.output.unique ?? false
};
}
//#endregion
export { instantiateAuthoringFieldPreset as a, isAuthoringEntityTypeDescriptor as c, isAuthoringPslBlockDescriptor as d, isAuthoringTypeConstructorDescriptor as f, validateAuthoringHelperArguments as g, resolveEnumCodecId as h, instantiateAuthoringEntityType as i, isAuthoringFieldPresetDescriptor as l, resolveAuthoringTemplateValue as m, classifyEnumMemberType as n, instantiateAuthoringTypeConstructor as o, mergeAuthoringNamespaces as p, hasRegisteredFieldNamespace as r, isAuthoringArgRef as s, assertNoCrossRegistryCollisions as t, isAuthoringModelAttributeDescriptor as u };
//# sourceMappingURL=framework-authoring-Rn5Cr8fF.mjs.map

Sorry, the diff of this file is too big to display

import { f as AnyCodecDescriptor } from "./codec-types-4tPB4m_G.mjs";
import { i as AuthoringContributions } from "./framework-authoring-Bv5QKca9.mjs";
import { t as TypesImportSpec } from "./types-import-spec-DRKzrJ20.mjs";
import { ColumnDefault, ExecutionMutationDefaultPhases, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
//#region src/shared/mutation-default-types.d.ts
interface SourcePosition {
readonly offset: number;
readonly line: number;
readonly column: number;
}
interface SourceSpan {
readonly start: SourcePosition;
readonly end: SourcePosition;
}
interface SourceDiagnostic {
readonly code: string;
readonly message: string;
readonly sourceId?: string;
readonly span?: SourceSpan;
readonly data?: Readonly<Record<string, unknown>>;
}
interface DefaultFunctionLoweringContext {
readonly sourceId: string;
readonly modelName: string;
readonly fieldName: string;
readonly columnCodecId?: string;
}
type LoweredDefaultValue = {
readonly kind: 'storage';
readonly defaultValue: ColumnDefault;
} | {
readonly kind: 'execution';
readonly generated: ExecutionMutationDefaultValue;
};
type LoweredDefaultResult = {
readonly ok: true;
readonly value: LoweredDefaultValue;
} | {
readonly ok: false;
readonly diagnostic: SourceDiagnostic;
};
interface MutationDefaultGeneratorDescriptor {
readonly id: string;
/**
* Codec ids the generator is compatible with when the codec choice
* and the generator choice are made independently by the contract
* author. Set when the registry-coherence check is meaningful
* (the codec and the generator can be paired arbitrarily by the
* caller); omitted when the generator is only reachable through a
* descriptor that co-registers a fixed codec, so coherence is
* structural and the list would be tautological.
*/
readonly applicableCodecIds?: readonly string[];
readonly resolveGeneratedColumnDescriptor?: (input: {
readonly generated: ExecutionMutationDefaultValue;
}) => {
readonly codecId: string;
readonly nativeType: string;
readonly typeRef?: string;
readonly typeParams?: Record<string, unknown>;
} | undefined;
/**
* Construct the `onCreate`/`onUpdate` phases value owned by this
* generator. Authoring layers (PSL `temporal.updatedAt()`, TS field presets) call
* this instead of building the literal inline so PSL/TS-authored
* contracts stay byte-equivalent for any future params-bearing generator.
*/
readonly buildPhases?: (args?: Record<string, unknown>) => ExecutionMutationDefaultPhases;
}
interface TypedDefaultFunctionCall {
readonly fn: string;
readonly span: SourceSpan;
readonly args: Readonly<Record<string, unknown>>;
}
interface ControlMutationDefaultEntry {
readonly signature?: unknown;
readonly lower: (input: {
readonly call: TypedDefaultFunctionCall;
readonly context: DefaultFunctionLoweringContext;
}) => LoweredDefaultResult;
readonly usageSignatures?: readonly string[];
}
type ControlMutationDefaultRegistry = ReadonlyMap<string, ControlMutationDefaultEntry>;
interface ControlMutationDefaults {
readonly defaultFunctionRegistry: ControlMutationDefaultRegistry;
readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[];
}
//#endregion
//#region src/shared/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 descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.
*/
readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;
};
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;
/**
* Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.
*/
readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;
/**
* Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.
*/
readonly controlMutationDefaults?: ControlMutationDefaults;
}
/**
* 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;
/** The namespace a bare (un-namespaced) entity name resolves to for this target (e.g. Postgres `'public'`). */
readonly defaultNamespaceId: string;
};
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 { SourceDiagnostic as A, ControlMutationDefaultEntry as C, LoweredDefaultResult as D, DefaultFunctionLoweringContext as E, TypedDefaultFunctionCall as M, LoweredDefaultValue as O, checkContractComponentRequirements as S, ControlMutationDefaults as T, 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, SourceSpan as j, MutationDefaultGeneratorDescriptor as k, 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, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
//# sourceMappingURL=framework-components-B8P4PTgH.d.mts.map
{"version":3,"file":"framework-components-B8P4PTgH.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"mappings":";;;;;UAMU;WACC;WACA;WACA;;UAGM;WACN,OAAO;WACP,KAAK;;UAGC;WACN;WACA;WACA;WACA,OAAO;WACP,OAAO,SAAS;;UAGV;WACN;WACA;WACA;WACA;;KAGC;WACG;WAA0B,cAAc;;WACxC;WAA4B,WAAW;;KAE1C;WACG;WAAmB,OAAO;;WAC1B;WAAoB,YAAY;;UAE9B;WACN;;;;;;;;;;WAUA;WACA,oCAAoC;aAClC,WAAW;;aAGP;aACA;aACA;aACA,aAAa;;;;;;;;WASnB,eAAe,OAAO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CAClD;;WAEC,UAAU;;WAGV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BJ,oBAAoB,0BAA0B,kCACrD;;WAEC,UAAU;;WAGV,UAAU;;;KAIT,+BAA+B,0BAA0B,4BACjE,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB,eAAe;WACrB,UAAU;;UAGJ,eAAe,0BAA0B;WAC/C,UAAU;WACV,UAAU;;UAGJ,gBAAgB,0BAA0B;WAChD,UAAU;WACV,UAAU;;UAGJ,eAAe,0BAA0B;WAC/C,UAAU;WACV,UAAU;;UAGJ,kBAAkB,0BAA0B;WAClD,UAAU;WACV,UAAU"}
import { r as CodecLookup } from "./codec-types-4tPB4m_G.mjs";
import { J as PslExtensionBlock, it as PslSpan, q as PslDiagnosticCode, y as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-Bv5QKca9.mjs";
//#region src/control/psl-ast.d.ts
interface PslDiagnostic {
readonly code: PslDiagnosticCode;
readonly message: string;
readonly sourceId: string;
readonly span: PslSpan;
}
interface PslDefaultFunctionValue {
readonly kind: 'function';
readonly name: 'autoincrement' | 'now';
}
interface PslDefaultLiteralValue {
readonly kind: 'literal';
readonly value: string | number | boolean;
}
type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;
type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';
interface PslAttributePositionalArgument {
readonly kind: 'positional';
readonly value: string;
readonly span: PslSpan;
}
interface PslAttributeNamedArgument {
readonly kind: 'named';
readonly name: string;
readonly value: string;
readonly span: PslSpan;
}
type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;
interface PslTypeConstructorCall {
readonly kind: 'typeConstructor';
readonly path: readonly string[];
readonly args: readonly PslAttributeArgument[];
readonly span: PslSpan;
}
interface PslAttribute {
readonly kind: 'attribute';
readonly target: PslAttributeTarget;
readonly name: string;
readonly args: readonly PslAttributeArgument[];
readonly span: PslSpan;
}
type PslReferentialAction = string;
type PslFieldAttribute = PslAttribute;
interface PslField {
readonly kind: 'field';
readonly name: string;
/** Unqualified type name, e.g. `"User"` for both `User`, `auth.User`, and `supabase:auth.User`. */
readonly typeName: string;
/** Namespace qualifier from a dot-qualified type reference, e.g. `"auth"` for `auth.User` or `supabase:auth.User`. Absent for unqualified types. */
readonly typeNamespaceId?: string;
/**
* Contract-space qualifier from a colon-prefix type reference, e.g. `"supabase"` for
* `supabase:auth.User` or `supabase:User`. Absent for local (same-space) type references.
*
* When present, the field references a model from a different contract space. The namespace
* (`typeNamespaceId`) and model name (`typeName`) identify the target within that space.
* Physical table resolution against the extension contract is deferred to the aggregate stage (M3).
*/
readonly typeContractSpaceId?: string;
readonly typeConstructor?: PslTypeConstructorCall;
readonly optional: boolean;
readonly list: boolean;
readonly typeRef?: string;
readonly attributes: readonly PslFieldAttribute[];
readonly span: PslSpan;
}
interface PslUniqueConstraint {
readonly kind: 'unique';
readonly fields: readonly string[];
readonly span: PslSpan;
}
interface PslIndexConstraint {
readonly kind: 'index';
readonly fields: readonly string[];
readonly span: PslSpan;
}
type PslModelAttribute = PslAttribute;
interface PslModel {
readonly kind: 'model';
readonly name: string;
readonly fields: readonly PslField[];
readonly attributes: readonly PslModelAttribute[];
readonly span: PslSpan;
/**
* Optional leading comment line emitted above the `model` keyword by the
* printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection
* advisories such as "// WARNING: This table has no primary key in the
* database" here. The parser leaves this field unset; round-tripping a
* parsed schema does not re-attach comments.
*/
readonly comment?: string;
}
/**
* A reusable group of fields embedded in a model (a `type Name { … }` block) —
* e.g. a MongoDB embedded document or a Postgres composite type. Unlike
* {@link PslModel} it has no storage or identity of its own.
*/
interface PslCompositeType {
readonly kind: 'compositeType';
readonly name: string;
readonly fields: readonly PslField[];
readonly attributes: readonly PslAttribute[];
readonly span: PslSpan;
}
interface PslNamedTypeDeclaration {
readonly kind: 'namedType';
readonly name: string;
/**
* Parser invariant: exactly one of `baseType` and `typeConstructor` is set.
* Expressing this as a discriminated union trips TypeScript narrowing when
* the declaration flows through helpers that accept the full union.
*/
readonly baseType?: string;
readonly typeConstructor?: PslTypeConstructorCall;
readonly attributes: readonly PslAttribute[];
readonly span: PslSpan;
}
interface PslTypesBlock {
readonly kind: 'types';
readonly declarations: readonly PslNamedTypeDeclaration[];
readonly span: PslSpan;
}
/**
* Name of the synthesised namespace bucket the framework parser uses for
* top-level declarations that appear outside any `namespace { … }` block.
* The double-underscore decoration signals that the identifier is parser-
* synthesised and never appears in user-authored PSL source — writing
* `namespace __unspecified__ { … }` is a parse error.
*
* Distinct from the IR sentinel `__unbound__`: the PSL bucket describes
* syntactic absence at the parser layer; the IR sentinel describes a late-
* bound storage slot at the IR layer. Per-target interpreters decide how
* (or whether) to map the PSL bucket to the IR sentinel.
*/
declare const UNSPECIFIED_PSL_NAMESPACE_ID = "__unspecified__";
/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */
type PslNamespaceEntry = PslModel | PslCompositeType | PslExtensionBlock;
/**
* A namespace block, or the parser's synthesised `__unspecified__` bucket for
* declarations outside any `namespace { … }`. Same-name blocks reopen-merge;
* `span` points at the first opening.
*
* Entities are stored canonically (ADR 224) in `entries[kind][name]`, where
* `kind` is the PSL keyword for built-ins or the block discriminator for
* extension kinds, e.g. `entries['policy']['ReadPosts']` (the discriminator,
* not the PSL keyword — a `policy_select` block lands under `'policy'` per
* ADR 225).
*/
interface PslNamespace {
readonly kind: 'namespace';
readonly name: string;
/** Canonical store: a frozen container of frozen per-kind maps. The accessors below derive from it. */
readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
/** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */
readonly models: readonly PslModel[];
/** Built-in composite types, from `entries['compositeType']`. */
readonly compositeTypes: readonly PslCompositeType[];
readonly span: PslSpan;
}
/** Constructs a {@link PslNamespace}. Use this, never a namespace literal — the accessors must derive from `entries`. */
declare function makePslNamespace(init: {
readonly kind: 'namespace';
readonly name: string;
readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
readonly span: PslSpan;
}): PslNamespace;
/**
* Builds the frozen `entries[kind][name]` container from per-kind arrays.
* Built-ins key on their PSL keyword; extension blocks key on their `kind`
* discriminator. Call this rather than hand-building the literal.
*/
declare function makePslNamespaceEntries(models: readonly PslModel[], compositeTypes: readonly PslCompositeType[], extensionBlocks: readonly PslExtensionBlock[]): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
interface PslDocumentAst {
readonly kind: 'document';
readonly sourceId: string;
readonly namespaces: readonly PslNamespace[];
readonly types?: PslTypesBlock;
readonly span: PslSpan;
}
/**
* Returns all models from every namespace in document order. Convenience
* for consumers that don't (yet) need namespace-awareness.
*/
declare function flatPslModels(ast: PslDocumentAst): readonly PslModel[];
/**
* Returns all composite types from every namespace in document order.
*/
declare function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslCompositeType[];
/**
* The set of `entries` kind keys that the framework parser reserves for
* built-in PSL entity kinds. Any own-enumerable key on `PslNamespace.entries`
* that is **not** in this set was contributed by an extension-block descriptor.
*
* Built-in keys match the PSL keyword used on each block type:
* `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the
* extension-block grammar via a registered descriptor, so `entries['enum']`
* holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.
*/
declare const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string>;
/**
* Returns all extension-contributed blocks in the given namespace, in
* insertion order (the order the parser encountered them in the source).
*
* Reads from `namespace.entries`, skipping the built-in kind keys
* (`'model'`, `'compositeType'`). All remaining kind maps contain
* only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).
*/
declare function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[];
interface ParsePslDocumentInput {
readonly schema: string;
readonly sourceId: string;
/**
* Registry of declarative block descriptors, keyed by arbitrary path
* segments with {@link AuthoringPslBlockDescriptor} leaves. The registry
* teaches the parser which top-level keywords belong to extension
* contributions: when the parser encounters an unknown keyword, it looks
* it up here and, when found, reads the block generically into a
* {@link PslExtensionBlock} node. Absent or undefined means no extension
* blocks are registered and any unknown keyword yields
* `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`.
*
* Contrast with the parsed block nodes themselves, which live in
* {@link PslNamespace.entries} under their discriminator key (read them with
* {@link namespacePslExtensionBlocks}); this field holds the registry of
* descriptors that teach the parser how to read those blocks.
*/
readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;
/**
* Codec lookup for validating `value`-kind extension block parameters.
* When provided alongside `pslBlockDescriptors`, the generic validator runs
* over every parsed extension block after the full AST is assembled,
* appending any diagnostics to the parse result. Absent or undefined means
* no codec validation runs; `ref` resolution still runs when namespace
* context is available (built from the assembled namespaces).
*/
readonly codecLookup?: CodecLookup;
}
interface ParsePslDocumentResult {
readonly ast: PslDocumentAst;
readonly diagnostics: readonly PslDiagnostic[];
readonly ok: boolean;
}
//#endregion
export { makePslNamespace as A, PslReferentialAction as C, UNSPECIFIED_PSL_NAMESPACE_ID as D, PslUniqueConstraint as E, namespacePslExtensionBlocks as M, flatPslCompositeTypes as O, PslNamespaceEntry as S, PslTypesBlock as T, PslIndexConstraint as _, PslAttributeArgument as a, PslNamedTypeDeclaration as b, PslAttributeTarget as c, PslDefaultLiteralValue as d, PslDefaultValue as f, PslFieldAttribute as g, PslField as h, PslAttribute as i, makePslNamespaceEntries as j, flatPslModels as k, PslCompositeType as l, PslDocumentAst as m, ParsePslDocumentInput as n, PslAttributeNamedArgument as o, PslDiagnostic as p, ParsePslDocumentResult as r, PslAttributePositionalArgument as s, BUILTIN_PSL_KIND_KEYS as t, PslDefaultFunctionValue as u, PslModel as v, PslTypeConstructorCall as w, PslNamespace as x, PslModelAttribute as y };
//# sourceMappingURL=psl-ast-BevxxqLP.d.mts.map
{"version":3,"file":"psl-ast-BevxxqLP.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";;;UA0BiB;WACN,MAAM;WACN;WACA;WACA,MAAM;;UAGA;WACN;WACA;;UAGM;WACN;WACA;;KAGC,kBAAkB,0BAA0B;KAE5C;UAEK;WACN;WACA;WACA,MAAM;;UAGA;WACN;WACA;WACA;WACA,MAAM;;KAGL,uBAAuB,iCAAiC;UAEnD;WACN;WACA;WACA,eAAe;WACf,MAAM;;UAGA;WACN;WACA,QAAQ;WACR;WACA,eAAe;WACf,MAAM;;KAGL;KAEA,oBAAoB;UAEf;WACN;WACA;;WAEA;;WAEA;;;;;;;;;WASA;WACA,kBAAkB;WAClB;WACA;WACA;WACA,qBAAqB;WACrB,MAAM;;UAGA;WACN;WACA;WACA,MAAM;;UAGA;WACN;WACA;WACA,MAAM;;KAGL,oBAAoB;UAEf;WACN;WACA;WACA,iBAAiB;WACjB,qBAAqB;WACrB,MAAM;;;;;;;;WAQN;;;;;;;UAQM;WACN;WACA;WACA,iBAAiB;WACjB,qBAAqB;WACrB,MAAM;;UAGA;WACN;WACA;;;;;;WAMA;WACA,kBAAkB;WAClB,qBAAqB;WACrB,MAAM;;UAGA;WACN;WACA,uBAAuB;WACvB,MAAM;;;;;;;;;;;;;;cAeJ;;KAGD,oBAAoB,WAAW,mBAAmB;;;;;;;;;;;;UAa7C;WACN;WACA;;WAEA,SAAS,SAAS,eAAe,SAAS,eAAe;;WAEzD,iBAAiB;;WAEjB,yBAAyB;WACzB,MAAM;;;iBAwCD,iBAAiB;WACtB;WACA;WACA,SAAS,SAAS,eAAe,SAAS,eAAe;WACzD,MAAM;IACb;;;;;;iBASY,wBACd,iBAAiB,YACjB,yBAAyB,oBACzB,0BAA0B,sBACzB,SAAS,eAAe,SAAS,eAAe;UAiClC;WACN;WACA;WACA,qBAAqB;WACrB,QAAQ;WACR,MAAM;;;;;;iBAOD,cAAc,KAAK,0BAA0B;;;;iBAW7C,sBAAsB,KAAK,0BAA0B;;;;;;;;;;;cAmBxD,uBAAuB;;;;;;;;;iBAUpB,4BAA4B,IAAI,wBAAwB;UAgBvD;WACN;WACA;;;;;;;;;;;;;;;;WAgBA,sBAAsB;;;;;;;;;WAStB,cAAc;;UAGR;WACN,KAAK;WACL,sBAAsB;WACtB"}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display