@prisma-next/framework-components
Advanced tools
| 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'; | ||
| /** | ||
| * A PSL diagnostic code contributed by a family or target package (e.g. an | ||
| * attribute-spec refine in a family's authoring layer). The framework union | ||
| * above stays the parser's own vocabulary; contributed codes share the | ||
| * `PSL_` pattern but their names are owned by the contributing package — | ||
| * no family or target vocabulary enters this module. Contributed codes | ||
| * must not reuse a framework code name; pick a domain-scoped prefix | ||
| * segment (e.g. `PSL_INDEX_`, `PSL_POLICY_`) to keep the namespaces | ||
| * collision-free. | ||
| */ | ||
| type ContributedPslDiagnosticCode = `PSL_${string}`; | ||
| /** | ||
| * 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 { PslExtensionBlockAttribute as $, collectScalarTypeConstructors as A, isAuthoringTypeConstructorDescriptor as B, AuthoringTypeConstructorDescriptor as C, assertNoCrossRegistryCollisions as D, ScalarTypeConstructorOutput as E, isAuthoringArgRef as F, ContributedPslDiagnosticCode as G, resolveAuthoringTemplateValue as H, isAuthoringEntityTypeDescriptor as I, PslBlockParamOption as J, PslBlockParam as K, isAuthoringFieldPresetDescriptor as L, instantiateAuthoringEntityType as M, instantiateAuthoringFieldPreset as N, assertResolvableTypeConstructorTemplates as O, instantiateAuthoringTypeConstructor as P, PslExtensionBlock as Q, isAuthoringModelAttributeDescriptor as R, AuthoringTemplateValue as S, AuthoringTypeNamespace as T, resolveEnumCodecId as U, mergeAuthoringNamespaces as V, validateAuthoringHelperArguments as W, PslBlockParamValue as X, PslBlockParamRef as Y, PslDiagnosticCode as Z, AuthoringModelAttributeLoweringOutput as _, AuthoringDiagnosticSink as a, PslExtensionBlockParamScalarValue as at, AuthoringSelectRef as b, AuthoringEntityTypeFactoryOutput as c, PslSpan as ct, AuthoringFieldNamespace as d, PslExtensionBlockAttributeArg as et, AuthoringFieldPresetDescriptor as f, AuthoringModelAttributeDescriptorNamespace as g, AuthoringModelAttributeDescriptor as h, AuthoringContributions as i, PslExtensionBlockParamRef as it, hasRegisteredFieldNamespace as j, classifyEnumMemberType as k, AuthoringEntityTypeNamespace as l, AuthoringOption as lt, AuthoringModelAttributeContext as m, AuthoringArgumentDescriptor as n, PslExtensionBlockParamList as nt, AuthoringEntityContext as o, PslExtensionBlockParamValue as ot, AuthoringFieldPresetOutput as p, PslBlockParamList as q, AuthoringColumnDefaultTemplate as r, PslExtensionBlockParamOption as rt, AuthoringEntityTypeDescriptor as s, PslPosition as st, AuthoringArgRef as t, PslExtensionBlockParamBare as tt, AuthoringEntityTypeTemplateOutput as u, AuthoringPslBlockDescriptor as v, AuthoringTypeConstructorEntityRef as w, AuthoringStorageTypeTemplate as x, AuthoringPslBlockDescriptorNamespace as y, isAuthoringPslBlockDescriptor as z }; | ||
| //# sourceMappingURL=framework-authoring-CY3yoVmL.d.mts.map |
| {"version":3,"file":"framework-authoring-CY3yoVmL.d.mts","names":[],"sources":["../src/shared/option-descriptor.ts","../src/shared/psl-extension-block.ts","../src/shared/framework-authoring.ts"],"mappings":"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"} |
| import { f as AnyCodecDescriptor } from "./codec-types-4tPB4m_G.mjs"; | ||
| import { i as AuthoringContributions } from "./framework-authoring-CY3yoVmL.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 extensions?: 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-m-avL0az.d.mts.map |
| {"version":3,"file":"framework-components-m-avL0az.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,aAAa;;WAEf;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 { G as ContributedPslDiagnosticCode, Q as PslExtensionBlock, Z as PslDiagnosticCode, ct as PslSpan, y as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-CY3yoVmL.mjs"; | ||
| //#region src/control/psl-ast.d.ts | ||
| interface PslDiagnostic { | ||
| /** | ||
| * The closed {@link PslDiagnosticCode} set exists for IDE completion and | ||
| * as documentation of the framework's own codes; the | ||
| * {@link ContributedPslDiagnosticCode} pattern arm is the seam for | ||
| * package-contributed codes, minted where the domain vocabulary lives | ||
| * (e.g. contract-psl). The two arms are extensionally equal — every | ||
| * framework code matches the pattern — and nothing switches | ||
| * exhaustively over the union, deliberately: consumers treat the code | ||
| * as an opaque identifier. | ||
| */ | ||
| readonly code: PslDiagnosticCode | ContributedPslDiagnosticCode; | ||
| 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-0qL2o8RS.d.mts.map |
| {"version":3,"file":"psl-ast-0qL2o8RS.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";;;UAgCiB;;;;;;;;;;;WAWN,MAAM,oBAAoB;WAC1B;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"} |
@@ -1,2 +0,2 @@ | ||
| 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"; | ||
| import { A as collectScalarTypeConstructors, B as isAuthoringTypeConstructorDescriptor, C as AuthoringTypeConstructorDescriptor, D as assertNoCrossRegistryCollisions, E as ScalarTypeConstructorOutput, F as isAuthoringArgRef, H as resolveAuthoringTemplateValue, I as isAuthoringEntityTypeDescriptor, J as PslBlockParamOption, K as PslBlockParam, L as isAuthoringFieldPresetDescriptor, M as instantiateAuthoringEntityType, N as instantiateAuthoringFieldPreset, O as assertResolvableTypeConstructorTemplates, P as instantiateAuthoringTypeConstructor, Q as PslExtensionBlock, R as isAuthoringModelAttributeDescriptor, S as AuthoringTemplateValue, T as AuthoringTypeNamespace, U as resolveEnumCodecId, V as mergeAuthoringNamespaces, W as validateAuthoringHelperArguments, X as PslBlockParamValue, Y as PslBlockParamRef, _ as AuthoringModelAttributeLoweringOutput, a as AuthoringDiagnosticSink, at as PslExtensionBlockParamScalarValue, b as AuthoringSelectRef, c as AuthoringEntityTypeFactoryOutput, d as AuthoringFieldNamespace, f as AuthoringFieldPresetDescriptor, g as AuthoringModelAttributeDescriptorNamespace, h as AuthoringModelAttributeDescriptor, i as AuthoringContributions, it as PslExtensionBlockParamRef, j as hasRegisteredFieldNamespace, k as classifyEnumMemberType, l as AuthoringEntityTypeNamespace, lt as AuthoringOption, m as AuthoringModelAttributeContext, n as AuthoringArgumentDescriptor, nt as PslExtensionBlockParamList, o as AuthoringEntityContext, ot as PslExtensionBlockParamValue, p as AuthoringFieldPresetOutput, q as PslBlockParamList, r as AuthoringColumnDefaultTemplate, rt as PslExtensionBlockParamOption, s as AuthoringEntityTypeDescriptor, t as AuthoringArgRef, u as AuthoringEntityTypeTemplateOutput, v as AuthoringPslBlockDescriptor, w as AuthoringTypeConstructorEntityRef, x as AuthoringStorageTypeTemplate, y as AuthoringPslBlockDescriptorNamespace, z as isAuthoringPslBlockDescriptor } from "./framework-authoring-CY3yoVmL.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 }; |
| 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-Crm97b5Y.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-m-avL0az.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,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-Crm97b5Y.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-m-avL0az.mjs"; | ||
| //#region src/execution/execution-instances.d.ts | ||
@@ -3,0 +3,0 @@ interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {} |
| import { r as CodecLookup } from "./codec-types-4tPB4m_G.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"; | ||
| import { $ as PslExtensionBlockAttribute, G as ContributedPslDiagnosticCode, J as PslBlockParamOption, K as PslBlockParam, Q as PslExtensionBlock, X as PslBlockParamValue, Y as PslBlockParamRef, Z as PslDiagnosticCode, at as PslExtensionBlockParamScalarValue, ct as PslSpan, et as PslExtensionBlockAttributeArg, it as PslExtensionBlockParamRef, nt as PslExtensionBlockParamList, ot as PslExtensionBlockParamValue, q as PslBlockParamList, rt as PslExtensionBlockParamOption, st as PslPosition, tt as PslExtensionBlockParamBare, v as AuthoringPslBlockDescriptor, y as AuthoringPslBlockDescriptorNamespace } from "./framework-authoring-CY3yoVmL.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-0qL2o8RS.mjs"; | ||
| //#region src/control/psl-extension-block-validator.d.ts | ||
@@ -35,3 +35,3 @@ /** | ||
| //#endregion | ||
| export { type AuthoringPslBlockDescriptorNamespace, BUILTIN_PSL_KIND_KEYS, type ExtensionBlockRefResolutionContext, ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, type PslDiagnosticCode, PslDocumentAst, type PslExtensionBlock, type PslExtensionBlockAttribute, type PslExtensionBlockAttributeArg, type PslExtensionBlockParamBare, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, PslField, PslFieldAttribute, PslIndexConstraint, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslNamespace, PslNamespaceEntry, type PslPosition, PslReferentialAction, type PslSpan, PslTypeConstructorCall, PslTypesBlock, PslUniqueConstraint, UNSPECIFIED_PSL_NAMESPACE_ID, flatPslCompositeTypes, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock }; | ||
| export { type AuthoringPslBlockDescriptorNamespace, BUILTIN_PSL_KIND_KEYS, type ContributedPslDiagnosticCode, type ExtensionBlockRefResolutionContext, ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, type PslDiagnosticCode, PslDocumentAst, type PslExtensionBlock, type PslExtensionBlockAttribute, type PslExtensionBlockAttributeArg, type PslExtensionBlockParamBare, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, PslField, PslFieldAttribute, PslIndexConstraint, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslNamespace, PslNamespaceEntry, type PslPosition, PslReferentialAction, type PslSpan, PslTypeConstructorCall, PslTypesBlock, PslUniqueConstraint, UNSPECIFIED_PSL_NAMESPACE_ID, flatPslCompositeTypes, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock }; | ||
| //# sourceMappingURL=psl-ast.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"psl-ast.mjs","names":[],"sources":["../src/control/psl-ast.ts","../src/control/psl-extension-block-validator.ts"],"sourcesContent":["export type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nexport type {\n PslBlockParam,\n PslBlockParamList,\n PslBlockParamOption,\n PslBlockParamRef,\n PslBlockParamValue,\n PslDiagnosticCode,\n PslExtensionBlock,\n PslExtensionBlockAttribute,\n PslExtensionBlockAttributeArg,\n PslExtensionBlockParamBare,\n PslExtensionBlockParamList,\n PslExtensionBlockParamOption,\n PslExtensionBlockParamRef,\n PslExtensionBlockParamScalarValue,\n PslExtensionBlockParamValue,\n PslPosition,\n PslSpan,\n} from '../shared/psl-extension-block';\n\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nimport type { PslDiagnosticCode, PslExtensionBlock, PslSpan } from '../shared/psl-extension-block';\n\nexport interface PslDiagnostic {\n readonly code: PslDiagnosticCode;\n readonly message: string;\n readonly sourceId: string;\n readonly span: PslSpan;\n}\n\nexport interface PslDefaultFunctionValue {\n readonly kind: 'function';\n readonly name: 'autoincrement' | 'now';\n}\n\nexport interface PslDefaultLiteralValue {\n readonly kind: 'literal';\n readonly value: string | number | boolean;\n}\n\nexport type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;\n\nexport type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';\n\nexport interface PslAttributePositionalArgument {\n readonly kind: 'positional';\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport interface PslAttributeNamedArgument {\n readonly kind: 'named';\n readonly name: string;\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;\n\nexport interface PslTypeConstructorCall {\n readonly kind: 'typeConstructor';\n readonly path: readonly string[];\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport interface PslAttribute {\n readonly kind: 'attribute';\n readonly target: PslAttributeTarget;\n readonly name: string;\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport type PslReferentialAction = string;\n\nexport type PslFieldAttribute = PslAttribute;\n\nexport interface PslField {\n readonly kind: 'field';\n readonly name: string;\n /** Unqualified type name, e.g. `\"User\"` for both `User`, `auth.User`, and `supabase:auth.User`. */\n readonly typeName: string;\n /** Namespace qualifier from a dot-qualified type reference, e.g. `\"auth\"` for `auth.User` or `supabase:auth.User`. Absent for unqualified types. */\n readonly typeNamespaceId?: string;\n /**\n * Contract-space qualifier from a colon-prefix type reference, e.g. `\"supabase\"` for\n * `supabase:auth.User` or `supabase:User`. Absent for local (same-space) type references.\n *\n * When present, the field references a model from a different contract space. The namespace\n * (`typeNamespaceId`) and model name (`typeName`) identify the target within that space.\n * Physical table resolution against the extension contract is deferred to the aggregate stage (M3).\n */\n readonly typeContractSpaceId?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly optional: boolean;\n readonly list: boolean;\n readonly typeRef?: string;\n readonly attributes: readonly PslFieldAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslUniqueConstraint {\n readonly kind: 'unique';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport interface PslIndexConstraint {\n readonly kind: 'index';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport type PslModelAttribute = PslAttribute;\n\nexport interface PslModel {\n readonly kind: 'model';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslModelAttribute[];\n readonly span: PslSpan;\n /**\n * Optional leading comment line emitted above the `model` keyword by the\n * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection\n * advisories such as \"// WARNING: This table has no primary key in the\n * database\" here. The parser leaves this field unset; round-tripping a\n * parsed schema does not re-attach comments.\n */\n readonly comment?: string;\n}\n\n/**\n * A reusable group of fields embedded in a model (a `type Name { … }` block) —\n * e.g. a MongoDB embedded document or a Postgres composite type. Unlike\n * {@link PslModel} it has no storage or identity of its own.\n */\nexport interface PslCompositeType {\n readonly kind: 'compositeType';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslNamedTypeDeclaration {\n readonly kind: 'namedType';\n readonly name: string;\n /**\n * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.\n * Expressing this as a discriminated union trips TypeScript narrowing when\n * the declaration flows through helpers that accept the full union.\n */\n readonly baseType?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslTypesBlock {\n readonly kind: 'types';\n readonly declarations: readonly PslNamedTypeDeclaration[];\n readonly span: PslSpan;\n}\n\n/**\n * Name of the synthesised namespace bucket the framework parser uses for\n * top-level declarations that appear outside any `namespace { … }` block.\n * The double-underscore decoration signals that the identifier is parser-\n * synthesised and never appears in user-authored PSL source — writing\n * `namespace __unspecified__ { … }` is a parse error.\n *\n * Distinct from the IR sentinel `__unbound__`: the PSL bucket describes\n * syntactic absence at the parser layer; the IR sentinel describes a late-\n * bound storage slot at the IR layer. Per-target interpreters decide how\n * (or whether) to map the PSL bucket to the IR sentinel.\n */\nexport const UNSPECIFIED_PSL_NAMESPACE_ID = '__unspecified__';\n\n/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */\nexport type PslNamespaceEntry = PslModel | PslCompositeType | PslExtensionBlock;\n\n/**\n * A namespace block, or the parser's synthesised `__unspecified__` bucket for\n * declarations outside any `namespace { … }`. Same-name blocks reopen-merge;\n * `span` points at the first opening.\n *\n * Entities are stored canonically (ADR 224) in `entries[kind][name]`, where\n * `kind` is the PSL keyword for built-ins or the block discriminator for\n * extension kinds, e.g. `entries['policy']['ReadPosts']` (the discriminator,\n * not the PSL keyword — a `policy_select` block lands under `'policy'` per\n * ADR 225).\n */\nexport interface PslNamespace {\n readonly kind: 'namespace';\n readonly name: string;\n /** Canonical store: a frozen container of frozen per-kind maps. The accessors below derive from it. */\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n /** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */\n readonly models: readonly PslModel[];\n /** Built-in composite types, from `entries['compositeType']`. */\n readonly compositeTypes: readonly PslCompositeType[];\n readonly span: PslSpan;\n}\n\n/**\n * Stores `entries`; exposes `models`/`enums`/`compositeTypes` as getters over\n * it. The getters are prototype members (non-enumerable), so spreading or\n * `JSON.stringify`-ing a namespace copies only `entries`, never a duplicate view.\n */\nclass PslNamespaceNode implements PslNamespace {\n readonly kind = 'namespace' as const;\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n\n constructor(init: {\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n }) {\n this.name = init.name;\n this.entries = init.entries;\n this.span = init.span;\n Object.freeze(this);\n }\n\n get models(): readonly PslModel[] {\n return blindCast<readonly PslModel[], 'entries[model] holds only PslModel by construction'>(\n Object.values(this.entries['model'] ?? {}),\n );\n }\n\n get compositeTypes(): readonly PslCompositeType[] {\n return blindCast<\n readonly PslCompositeType[],\n 'entries[compositeType] holds only PslCompositeType by construction'\n >(Object.values(this.entries['compositeType'] ?? {}));\n }\n}\n\n/** Constructs a {@link PslNamespace}. Use this, never a namespace literal — the accessors must derive from `entries`. */\nexport function makePslNamespace(init: {\n readonly kind: 'namespace';\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n}): PslNamespace {\n return new PslNamespaceNode(init);\n}\n\n/**\n * Builds the frozen `entries[kind][name]` container from per-kind arrays.\n * Built-ins key on their PSL keyword; extension blocks key on their `kind`\n * discriminator. Call this rather than hand-building the literal.\n */\nexport function makePslNamespaceEntries(\n models: readonly PslModel[],\n compositeTypes: readonly PslCompositeType[],\n extensionBlocks: readonly PslExtensionBlock[],\n): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>> {\n const container: Record<string, Readonly<Record<string, PslNamespaceEntry>>> = {};\n\n if (models.length > 0) {\n const map: Record<string, PslModel> = {};\n for (const m of models) {\n map[m.name] = m;\n }\n container['model'] = Object.freeze(map);\n }\n\n if (compositeTypes.length > 0) {\n const map: Record<string, PslCompositeType> = {};\n for (const ct of compositeTypes) {\n map[ct.name] = ct;\n }\n container['compositeType'] = Object.freeze(map);\n }\n\n for (const block of extensionBlocks) {\n const existing = container[block.kind];\n const newMap: Record<string, PslExtensionBlock> = existing\n ? blindCast<Record<string, PslExtensionBlock>, 'kind map holds only PslExtensionBlock'>({\n ...existing,\n })\n : {};\n newMap[block.name] = block;\n container[block.kind] = Object.freeze(newMap);\n }\n\n return Object.freeze(container);\n}\n\nexport interface PslDocumentAst {\n readonly kind: 'document';\n readonly sourceId: string;\n readonly namespaces: readonly PslNamespace[];\n readonly types?: PslTypesBlock;\n readonly span: PslSpan;\n}\n\n/**\n * Returns all models from every namespace in document order. Convenience\n * for consumers that don't (yet) need namespace-awareness.\n */\nexport function flatPslModels(ast: PslDocumentAst): readonly PslModel[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<PslModel[], 'model kind map contains only PslModel by construction'>(\n Object.values(ns.entries['model'] ?? {}),\n ),\n );\n}\n\n/**\n * Returns all composite types from every namespace in document order.\n */\nexport function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslCompositeType[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<\n PslCompositeType[],\n 'compositeType kind map contains only PslCompositeType by construction'\n >(Object.values(ns.entries['compositeType'] ?? {})),\n );\n}\n\n/**\n * The set of `entries` kind keys that the framework parser reserves for\n * built-in PSL entity kinds. Any own-enumerable key on `PslNamespace.entries`\n * that is **not** in this set was contributed by an extension-block descriptor.\n *\n * Built-in keys match the PSL keyword used on each block type:\n * `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the\n * extension-block grammar via a registered descriptor, so `entries['enum']`\n * holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.\n */\nexport const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string> = new Set(['model', 'compositeType']);\n\n/**\n * Returns all extension-contributed blocks in the given namespace, in\n * insertion order (the order the parser encountered them in the source).\n *\n * Reads from `namespace.entries`, skipping the built-in kind keys\n * (`'model'`, `'compositeType'`). All remaining kind maps contain\n * only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).\n */\nexport function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[] {\n const result: PslExtensionBlock[] = [];\n for (const [kindKey, kindMap] of Object.entries(ns.entries)) {\n if (BUILTIN_PSL_KIND_KEYS.has(kindKey)) continue;\n for (const entry of Object.values(kindMap)) {\n result.push(\n blindCast<\n PslExtensionBlock,\n 'non-builtin kind maps contain only PslExtensionBlock by construction'\n >(entry),\n );\n }\n }\n return result;\n}\n\nexport interface ParsePslDocumentInput {\n readonly schema: string;\n readonly sourceId: string;\n /**\n * Registry of declarative block descriptors, keyed by arbitrary path\n * segments with {@link AuthoringPslBlockDescriptor} leaves. The registry\n * teaches the parser which top-level keywords belong to extension\n * contributions: when the parser encounters an unknown keyword, it looks\n * it up here and, when found, reads the block generically into a\n * {@link PslExtensionBlock} node. Absent or undefined means no extension\n * blocks are registered and any unknown keyword yields\n * `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`.\n *\n * Contrast with the parsed block nodes themselves, which live in\n * {@link PslNamespace.entries} under their discriminator key (read them with\n * {@link namespacePslExtensionBlocks}); this field holds the registry of\n * descriptors that teach the parser how to read those blocks.\n */\n readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;\n /**\n * Codec lookup for validating `value`-kind extension block parameters.\n * When provided alongside `pslBlockDescriptors`, the generic validator runs\n * over every parsed extension block after the full AST is assembled,\n * appending any diagnostics to the parse result. Absent or undefined means\n * no codec validation runs; `ref` resolution still runs when namespace\n * context is available (built from the assembled namespaces).\n */\n readonly codecLookup?: CodecLookup;\n}\n\nexport interface ParsePslDocumentResult {\n readonly ast: PslDocumentAst;\n readonly diagnostics: readonly PslDiagnostic[];\n readonly ok: boolean;\n}\n","/**\n * Generic validator for extension-contributed top-level PSL blocks.\n *\n * One function — {@link validateExtensionBlock} — takes a parsed\n * {@link PslExtensionBlock}, its {@link AuthoringPslBlockDescriptor}, a\n * {@link CodecLookup} (for `value` parameters), and the set of\n * {@link PslNamespace} objects from the document (for `ref` resolution), and\n * returns the full list of {@link PslDiagnostic} objects for the block.\n *\n * Detection logic per failure mode:\n *\n * 1. **Unknown parameter** — keys present in `node.parameters` that are absent\n * from `descriptor.parameters` (key-set difference). The parser stores\n * unknown parameters as `kind:'value'` stubs; the validator discovers them\n * by comparing the key sets, not by inspecting the captured kind.\n *\n * 2. **Missing required parameter** — `descriptor.parameters` entries with\n * `required: true` whose key is absent from `node.parameters`.\n *\n * 3. **`option` value outside its set** — the captured `token` is not in\n * `descriptor.values`.\n *\n * 4. **`value` rejected by its codec** — the raw string is first parsed as\n * JSON (`JSON.parse(raw)`). If `JSON.parse` throws, the literal is not valid\n * JSON and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is emitted. If parsing\n * succeeds but `codec.decodeJson(jsonValue)` throws, the JSON value is not\n * acceptable to the codec and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is\n * emitted. If `codecLookup.get(codecId)` returns `undefined` (unknown codec\n * id), a `PSL_EXTENSION_INVALID_VALUE` diagnostic is also emitted.\n *\n * 5. **`ref` that does not resolve within its scope** — the captured\n * `identifier` is looked up in the PSL document's `PslNamespace` objects\n * according to `param.scope`:\n * - `same-namespace`: the referent must be in the same namespace as the\n * block (the namespace containing the block).\n * - `same-space`: the referent may be in any namespace in the document.\n * - `cross-space`: pass-through — enforcement is scoped to first-consumer\n * need (RLS roles). This case is documented and clearly flagged; the\n * caller is responsible for wiring cross-space resolution when needed.\n *\n * 6. **`list`** — each element is validated against `param.of` recursively.\n *\n * ### `char`/`varchar` length\n * Not enforced. RLS `using`/`check` strings are unbounded text and the codec\n * already rejects structurally invalid literals; length constraints are a\n * database-side concern, not a PSL authoring constraint.\n *\n * ### `cross-space` scope\n * Implemented as a documented pass-through. The spec permits scoping\n * cross-space enforcement to first-consumer need (RLS roles). When RLS roles\n * arrive, wire `cross-space` resolution through the cross-contract-space\n * coordinate model `(spaceId, namespaceId, entityKind, entityName)`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptor } from '../shared/framework-authoring';\nimport type {\n PslBlockParam,\n PslBlockParamRef,\n PslExtensionBlock,\n PslExtensionBlockParamValue,\n PslSpan,\n} from '../shared/psl-extension-block';\nimport type { PslDiagnostic, PslNamespace } from './psl-ast';\n\n/**\n * Context for ref resolution during extension-block validation.\n *\n * - `ownerNamespace` is the `PslNamespace` that contains the block being\n * validated. Used for `same-namespace` scope checks.\n * - `allNamespaces` is every namespace in the document. Used for `same-space`\n * scope checks.\n */\nexport interface ExtensionBlockRefResolutionContext {\n readonly ownerNamespace: PslNamespace;\n readonly allNamespaces: readonly PslNamespace[];\n}\n\n/**\n * Validate a single parsed extension block against its descriptor.\n *\n * Returns an array of {@link PslDiagnostic} objects (possibly empty). The\n * caller is responsible for threading `sourceId` into each returned diagnostic\n * — the returned objects already have `sourceId` set from the `sourceId`\n * parameter.\n *\n * @param node - The parsed block node produced by the generic framework parser.\n * @param descriptor - The descriptor that claims this block's keyword.\n * @param sourceId - The PSL source file identifier (threaded into diagnostics).\n * @param codecLookup - Used to validate `value`-kind parameter literals via\n * `codecLookup.get(codecId)?.decodeJson(JSON.parse(raw))`.\n * @param refCtx - Namespace context for `ref`-kind scope resolution. Required\n * when any descriptor parameter is `kind: 'ref'`; may be omitted if none are.\n */\nexport function validateExtensionBlock(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx?: ExtensionBlockRefResolutionContext,\n): readonly PslDiagnostic[] {\n const diagnostics: PslDiagnostic[] = [];\n\n const descriptorKeys = new Set(Object.keys(descriptor.parameters));\n const nodeKeys = new Set(Object.keys(node.parameters));\n\n // 1. Unknown parameters — keys in the node not in the descriptor.\n if (!descriptor.variadicParameters) {\n for (const key of nodeKeys) {\n if (!descriptorKeys.has(key)) {\n const captured = node.parameters[key];\n diagnostics.push({\n code: 'PSL_EXTENSION_UNKNOWN_PARAMETER',\n message: `Unknown parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\". The descriptor does not declare this parameter.`,\n sourceId,\n span: captured?.span ?? node.span,\n });\n }\n }\n }\n\n // 2. Missing required parameters — required descriptor keys absent from the node.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n if (param.required === true && !nodeKeys.has(key)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_MISSING_REQUIRED_PARAMETER',\n message: `Required parameter \"${key}\" is missing from \"${descriptor.keyword}\" block \"${node.name}\".`,\n sourceId,\n span: node.span,\n });\n }\n }\n\n // 3–5. Per-parameter validation for parameters that are present.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n const captured = node.parameters[key];\n if (captured === undefined) {\n continue;\n }\n validateParam(\n node,\n descriptor,\n key,\n param,\n captured,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n\n return diagnostics;\n}\n\nfunction validateParam(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParam,\n captured: PslExtensionBlockParamValue,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n switch (param.kind) {\n case 'option': {\n if (captured.kind !== 'option') {\n return;\n }\n if (!param.values.includes(captured.token)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_OPTION_OUT_OF_SET',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" has value \"${captured.token}\" which is not one of the allowed values: ${param.values.map((v) => `\"${v}\"`).join(', ')}.`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'value': {\n if (captured.kind !== 'value') {\n return;\n }\n const codec = codecLookup.get(param.codecId);\n if (codec === undefined) {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" references unknown codec \"${param.codecId}\".`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(captured.raw);\n } catch {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" is not a valid JSON literal (expected a JSON string, number, boolean, or null): ${captured.raw}`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n try {\n codec.decodeJson(\n blindCast<JsonValue, 'JSON.parse returns a JsonValue-compatible value'>(jsonValue),\n );\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" was rejected by codec \"${param.codecId}\": ${reason}`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'ref': {\n if (captured.kind !== 'ref') {\n return;\n }\n validateRef(\n node,\n descriptor,\n key,\n param,\n captured.identifier,\n captured.span,\n sourceId,\n refCtx,\n diagnostics,\n );\n return;\n }\n\n case 'list': {\n if (captured.kind !== 'list') {\n return;\n }\n for (const item of captured.items) {\n validateParam(\n node,\n descriptor,\n key,\n param.of,\n item,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n return;\n }\n }\n}\n\nfunction validateRef(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParamRef,\n identifier: string,\n span: PslSpan,\n sourceId: string,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n if (param.scope === 'cross-space') {\n // cross-space enforcement is a documented pass-through. The spec permits\n // scoping cross-space resolution to first-consumer need (RLS roles). When\n // that consumer arrives, wire resolution here through the\n // cross-contract-space coordinate model\n // (spaceId, namespaceId, entityKind, entityName).\n // For now, cross-space refs pass validation unconditionally.\n return;\n }\n\n if (refCtx === undefined) {\n // If no resolution context was provided, skip ref resolution. This matches\n // the closed-grammar invariant: callers that register ref parameters must\n // provide resolution context; callers without namespaces (e.g. unit tests\n // that only exercise other validation modes) can omit it.\n return;\n }\n\n const namespacesToSearch: readonly PslNamespace[] =\n param.scope === 'same-namespace' ? [refCtx.ownerNamespace] : refCtx.allNamespaces;\n\n if (!resolveEntityInNamespaces(identifier, param.refKind, namespacesToSearch)) {\n const scopeLabel =\n param.scope === 'same-namespace' ? 'the same namespace' : 'any namespace in the schema';\n diagnostics.push({\n code: 'PSL_EXTENSION_UNRESOLVED_REF',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" refers to \"${identifier}\" (expected ${param.refKind}), but no entity with that name and kind was found in ${scopeLabel}.`,\n sourceId,\n span,\n });\n }\n}\n\n/**\n * True if an entity named `name` of kind `refKind` exists in any of the given\n * namespaces. Built-in and extension kinds resolve the same way, through\n * `entries[refKind]`.\n */\nfunction resolveEntityInNamespaces(\n name: string,\n refKind: string,\n namespaces: readonly PslNamespace[],\n): boolean {\n for (const ns of namespaces) {\n const kindMap = ns.entries[refKind];\n if (kindMap !== undefined && Object.hasOwn(kindMap, name)) return true;\n }\n return false;\n}\n"],"mappings":"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"} | ||
| {"version":3,"file":"psl-ast.mjs","names":[],"sources":["../src/control/psl-ast.ts","../src/control/psl-extension-block-validator.ts"],"sourcesContent":["export type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nexport type {\n ContributedPslDiagnosticCode,\n PslBlockParam,\n PslBlockParamList,\n PslBlockParamOption,\n PslBlockParamRef,\n PslBlockParamValue,\n PslDiagnosticCode,\n PslExtensionBlock,\n PslExtensionBlockAttribute,\n PslExtensionBlockAttributeArg,\n PslExtensionBlockParamBare,\n PslExtensionBlockParamList,\n PslExtensionBlockParamOption,\n PslExtensionBlockParamRef,\n PslExtensionBlockParamScalarValue,\n PslExtensionBlockParamValue,\n PslPosition,\n PslSpan,\n} from '../shared/psl-extension-block';\n\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nimport type {\n ContributedPslDiagnosticCode,\n PslDiagnosticCode,\n PslExtensionBlock,\n PslSpan,\n} from '../shared/psl-extension-block';\n\nexport interface PslDiagnostic {\n /**\n * The closed {@link PslDiagnosticCode} set exists for IDE completion and\n * as documentation of the framework's own codes; the\n * {@link ContributedPslDiagnosticCode} pattern arm is the seam for\n * package-contributed codes, minted where the domain vocabulary lives\n * (e.g. contract-psl). The two arms are extensionally equal — every\n * framework code matches the pattern — and nothing switches\n * exhaustively over the union, deliberately: consumers treat the code\n * as an opaque identifier.\n */\n readonly code: PslDiagnosticCode | ContributedPslDiagnosticCode;\n readonly message: string;\n readonly sourceId: string;\n readonly span: PslSpan;\n}\n\nexport interface PslDefaultFunctionValue {\n readonly kind: 'function';\n readonly name: 'autoincrement' | 'now';\n}\n\nexport interface PslDefaultLiteralValue {\n readonly kind: 'literal';\n readonly value: string | number | boolean;\n}\n\nexport type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;\n\nexport type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';\n\nexport interface PslAttributePositionalArgument {\n readonly kind: 'positional';\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport interface PslAttributeNamedArgument {\n readonly kind: 'named';\n readonly name: string;\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;\n\nexport interface PslTypeConstructorCall {\n readonly kind: 'typeConstructor';\n readonly path: readonly string[];\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport interface PslAttribute {\n readonly kind: 'attribute';\n readonly target: PslAttributeTarget;\n readonly name: string;\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport type PslReferentialAction = string;\n\nexport type PslFieldAttribute = PslAttribute;\n\nexport interface PslField {\n readonly kind: 'field';\n readonly name: string;\n /** Unqualified type name, e.g. `\"User\"` for both `User`, `auth.User`, and `supabase:auth.User`. */\n readonly typeName: string;\n /** Namespace qualifier from a dot-qualified type reference, e.g. `\"auth\"` for `auth.User` or `supabase:auth.User`. Absent for unqualified types. */\n readonly typeNamespaceId?: string;\n /**\n * Contract-space qualifier from a colon-prefix type reference, e.g. `\"supabase\"` for\n * `supabase:auth.User` or `supabase:User`. Absent for local (same-space) type references.\n *\n * When present, the field references a model from a different contract space. The namespace\n * (`typeNamespaceId`) and model name (`typeName`) identify the target within that space.\n * Physical table resolution against the extension contract is deferred to the aggregate stage (M3).\n */\n readonly typeContractSpaceId?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly optional: boolean;\n readonly list: boolean;\n readonly typeRef?: string;\n readonly attributes: readonly PslFieldAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslUniqueConstraint {\n readonly kind: 'unique';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport interface PslIndexConstraint {\n readonly kind: 'index';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport type PslModelAttribute = PslAttribute;\n\nexport interface PslModel {\n readonly kind: 'model';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslModelAttribute[];\n readonly span: PslSpan;\n /**\n * Optional leading comment line emitted above the `model` keyword by the\n * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection\n * advisories such as \"// WARNING: This table has no primary key in the\n * database\" here. The parser leaves this field unset; round-tripping a\n * parsed schema does not re-attach comments.\n */\n readonly comment?: string;\n}\n\n/**\n * A reusable group of fields embedded in a model (a `type Name { … }` block) —\n * e.g. a MongoDB embedded document or a Postgres composite type. Unlike\n * {@link PslModel} it has no storage or identity of its own.\n */\nexport interface PslCompositeType {\n readonly kind: 'compositeType';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslNamedTypeDeclaration {\n readonly kind: 'namedType';\n readonly name: string;\n /**\n * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.\n * Expressing this as a discriminated union trips TypeScript narrowing when\n * the declaration flows through helpers that accept the full union.\n */\n readonly baseType?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslTypesBlock {\n readonly kind: 'types';\n readonly declarations: readonly PslNamedTypeDeclaration[];\n readonly span: PslSpan;\n}\n\n/**\n * Name of the synthesised namespace bucket the framework parser uses for\n * top-level declarations that appear outside any `namespace { … }` block.\n * The double-underscore decoration signals that the identifier is parser-\n * synthesised and never appears in user-authored PSL source — writing\n * `namespace __unspecified__ { … }` is a parse error.\n *\n * Distinct from the IR sentinel `__unbound__`: the PSL bucket describes\n * syntactic absence at the parser layer; the IR sentinel describes a late-\n * bound storage slot at the IR layer. Per-target interpreters decide how\n * (or whether) to map the PSL bucket to the IR sentinel.\n */\nexport const UNSPECIFIED_PSL_NAMESPACE_ID = '__unspecified__';\n\n/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */\nexport type PslNamespaceEntry = PslModel | PslCompositeType | PslExtensionBlock;\n\n/**\n * A namespace block, or the parser's synthesised `__unspecified__` bucket for\n * declarations outside any `namespace { … }`. Same-name blocks reopen-merge;\n * `span` points at the first opening.\n *\n * Entities are stored canonically (ADR 224) in `entries[kind][name]`, where\n * `kind` is the PSL keyword for built-ins or the block discriminator for\n * extension kinds, e.g. `entries['policy']['ReadPosts']` (the discriminator,\n * not the PSL keyword — a `policy_select` block lands under `'policy'` per\n * ADR 225).\n */\nexport interface PslNamespace {\n readonly kind: 'namespace';\n readonly name: string;\n /** Canonical store: a frozen container of frozen per-kind maps. The accessors below derive from it. */\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n /** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */\n readonly models: readonly PslModel[];\n /** Built-in composite types, from `entries['compositeType']`. */\n readonly compositeTypes: readonly PslCompositeType[];\n readonly span: PslSpan;\n}\n\n/**\n * Stores `entries`; exposes `models`/`enums`/`compositeTypes` as getters over\n * it. The getters are prototype members (non-enumerable), so spreading or\n * `JSON.stringify`-ing a namespace copies only `entries`, never a duplicate view.\n */\nclass PslNamespaceNode implements PslNamespace {\n readonly kind = 'namespace' as const;\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n\n constructor(init: {\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n }) {\n this.name = init.name;\n this.entries = init.entries;\n this.span = init.span;\n Object.freeze(this);\n }\n\n get models(): readonly PslModel[] {\n return blindCast<readonly PslModel[], 'entries[model] holds only PslModel by construction'>(\n Object.values(this.entries['model'] ?? {}),\n );\n }\n\n get compositeTypes(): readonly PslCompositeType[] {\n return blindCast<\n readonly PslCompositeType[],\n 'entries[compositeType] holds only PslCompositeType by construction'\n >(Object.values(this.entries['compositeType'] ?? {}));\n }\n}\n\n/** Constructs a {@link PslNamespace}. Use this, never a namespace literal — the accessors must derive from `entries`. */\nexport function makePslNamespace(init: {\n readonly kind: 'namespace';\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n}): PslNamespace {\n return new PslNamespaceNode(init);\n}\n\n/**\n * Builds the frozen `entries[kind][name]` container from per-kind arrays.\n * Built-ins key on their PSL keyword; extension blocks key on their `kind`\n * discriminator. Call this rather than hand-building the literal.\n */\nexport function makePslNamespaceEntries(\n models: readonly PslModel[],\n compositeTypes: readonly PslCompositeType[],\n extensionBlocks: readonly PslExtensionBlock[],\n): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>> {\n const container: Record<string, Readonly<Record<string, PslNamespaceEntry>>> = {};\n\n if (models.length > 0) {\n const map: Record<string, PslModel> = {};\n for (const m of models) {\n map[m.name] = m;\n }\n container['model'] = Object.freeze(map);\n }\n\n if (compositeTypes.length > 0) {\n const map: Record<string, PslCompositeType> = {};\n for (const ct of compositeTypes) {\n map[ct.name] = ct;\n }\n container['compositeType'] = Object.freeze(map);\n }\n\n for (const block of extensionBlocks) {\n const existing = container[block.kind];\n const newMap: Record<string, PslExtensionBlock> = existing\n ? blindCast<Record<string, PslExtensionBlock>, 'kind map holds only PslExtensionBlock'>({\n ...existing,\n })\n : {};\n newMap[block.name] = block;\n container[block.kind] = Object.freeze(newMap);\n }\n\n return Object.freeze(container);\n}\n\nexport interface PslDocumentAst {\n readonly kind: 'document';\n readonly sourceId: string;\n readonly namespaces: readonly PslNamespace[];\n readonly types?: PslTypesBlock;\n readonly span: PslSpan;\n}\n\n/**\n * Returns all models from every namespace in document order. Convenience\n * for consumers that don't (yet) need namespace-awareness.\n */\nexport function flatPslModels(ast: PslDocumentAst): readonly PslModel[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<PslModel[], 'model kind map contains only PslModel by construction'>(\n Object.values(ns.entries['model'] ?? {}),\n ),\n );\n}\n\n/**\n * Returns all composite types from every namespace in document order.\n */\nexport function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslCompositeType[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<\n PslCompositeType[],\n 'compositeType kind map contains only PslCompositeType by construction'\n >(Object.values(ns.entries['compositeType'] ?? {})),\n );\n}\n\n/**\n * The set of `entries` kind keys that the framework parser reserves for\n * built-in PSL entity kinds. Any own-enumerable key on `PslNamespace.entries`\n * that is **not** in this set was contributed by an extension-block descriptor.\n *\n * Built-in keys match the PSL keyword used on each block type:\n * `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the\n * extension-block grammar via a registered descriptor, so `entries['enum']`\n * holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.\n */\nexport const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string> = new Set(['model', 'compositeType']);\n\n/**\n * Returns all extension-contributed blocks in the given namespace, in\n * insertion order (the order the parser encountered them in the source).\n *\n * Reads from `namespace.entries`, skipping the built-in kind keys\n * (`'model'`, `'compositeType'`). All remaining kind maps contain\n * only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).\n */\nexport function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[] {\n const result: PslExtensionBlock[] = [];\n for (const [kindKey, kindMap] of Object.entries(ns.entries)) {\n if (BUILTIN_PSL_KIND_KEYS.has(kindKey)) continue;\n for (const entry of Object.values(kindMap)) {\n result.push(\n blindCast<\n PslExtensionBlock,\n 'non-builtin kind maps contain only PslExtensionBlock by construction'\n >(entry),\n );\n }\n }\n return result;\n}\n\nexport interface ParsePslDocumentInput {\n readonly schema: string;\n readonly sourceId: string;\n /**\n * Registry of declarative block descriptors, keyed by arbitrary path\n * segments with {@link AuthoringPslBlockDescriptor} leaves. The registry\n * teaches the parser which top-level keywords belong to extension\n * contributions: when the parser encounters an unknown keyword, it looks\n * it up here and, when found, reads the block generically into a\n * {@link PslExtensionBlock} node. Absent or undefined means no extension\n * blocks are registered and any unknown keyword yields\n * `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`.\n *\n * Contrast with the parsed block nodes themselves, which live in\n * {@link PslNamespace.entries} under their discriminator key (read them with\n * {@link namespacePslExtensionBlocks}); this field holds the registry of\n * descriptors that teach the parser how to read those blocks.\n */\n readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;\n /**\n * Codec lookup for validating `value`-kind extension block parameters.\n * When provided alongside `pslBlockDescriptors`, the generic validator runs\n * over every parsed extension block after the full AST is assembled,\n * appending any diagnostics to the parse result. Absent or undefined means\n * no codec validation runs; `ref` resolution still runs when namespace\n * context is available (built from the assembled namespaces).\n */\n readonly codecLookup?: CodecLookup;\n}\n\nexport interface ParsePslDocumentResult {\n readonly ast: PslDocumentAst;\n readonly diagnostics: readonly PslDiagnostic[];\n readonly ok: boolean;\n}\n","/**\n * Generic validator for extension-contributed top-level PSL blocks.\n *\n * One function — {@link validateExtensionBlock} — takes a parsed\n * {@link PslExtensionBlock}, its {@link AuthoringPslBlockDescriptor}, a\n * {@link CodecLookup} (for `value` parameters), and the set of\n * {@link PslNamespace} objects from the document (for `ref` resolution), and\n * returns the full list of {@link PslDiagnostic} objects for the block.\n *\n * Detection logic per failure mode:\n *\n * 1. **Unknown parameter** — keys present in `node.parameters` that are absent\n * from `descriptor.parameters` (key-set difference). The parser stores\n * unknown parameters as `kind:'value'` stubs; the validator discovers them\n * by comparing the key sets, not by inspecting the captured kind.\n *\n * 2. **Missing required parameter** — `descriptor.parameters` entries with\n * `required: true` whose key is absent from `node.parameters`.\n *\n * 3. **`option` value outside its set** — the captured `token` is not in\n * `descriptor.values`.\n *\n * 4. **`value` rejected by its codec** — the raw string is first parsed as\n * JSON (`JSON.parse(raw)`). If `JSON.parse` throws, the literal is not valid\n * JSON and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is emitted. If parsing\n * succeeds but `codec.decodeJson(jsonValue)` throws, the JSON value is not\n * acceptable to the codec and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is\n * emitted. If `codecLookup.get(codecId)` returns `undefined` (unknown codec\n * id), a `PSL_EXTENSION_INVALID_VALUE` diagnostic is also emitted.\n *\n * 5. **`ref` that does not resolve within its scope** — the captured\n * `identifier` is looked up in the PSL document's `PslNamespace` objects\n * according to `param.scope`:\n * - `same-namespace`: the referent must be in the same namespace as the\n * block (the namespace containing the block).\n * - `same-space`: the referent may be in any namespace in the document.\n * - `cross-space`: pass-through — enforcement is scoped to first-consumer\n * need (RLS roles). This case is documented and clearly flagged; the\n * caller is responsible for wiring cross-space resolution when needed.\n *\n * 6. **`list`** — each element is validated against `param.of` recursively.\n *\n * ### `char`/`varchar` length\n * Not enforced. RLS `using`/`check` strings are unbounded text and the codec\n * already rejects structurally invalid literals; length constraints are a\n * database-side concern, not a PSL authoring constraint.\n *\n * ### `cross-space` scope\n * Implemented as a documented pass-through. The spec permits scoping\n * cross-space enforcement to first-consumer need (RLS roles). When RLS roles\n * arrive, wire `cross-space` resolution through the cross-contract-space\n * coordinate model `(spaceId, namespaceId, entityKind, entityName)`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptor } from '../shared/framework-authoring';\nimport type {\n PslBlockParam,\n PslBlockParamRef,\n PslExtensionBlock,\n PslExtensionBlockParamValue,\n PslSpan,\n} from '../shared/psl-extension-block';\nimport type { PslDiagnostic, PslNamespace } from './psl-ast';\n\n/**\n * Context for ref resolution during extension-block validation.\n *\n * - `ownerNamespace` is the `PslNamespace` that contains the block being\n * validated. Used for `same-namespace` scope checks.\n * - `allNamespaces` is every namespace in the document. Used for `same-space`\n * scope checks.\n */\nexport interface ExtensionBlockRefResolutionContext {\n readonly ownerNamespace: PslNamespace;\n readonly allNamespaces: readonly PslNamespace[];\n}\n\n/**\n * Validate a single parsed extension block against its descriptor.\n *\n * Returns an array of {@link PslDiagnostic} objects (possibly empty). The\n * caller is responsible for threading `sourceId` into each returned diagnostic\n * — the returned objects already have `sourceId` set from the `sourceId`\n * parameter.\n *\n * @param node - The parsed block node produced by the generic framework parser.\n * @param descriptor - The descriptor that claims this block's keyword.\n * @param sourceId - The PSL source file identifier (threaded into diagnostics).\n * @param codecLookup - Used to validate `value`-kind parameter literals via\n * `codecLookup.get(codecId)?.decodeJson(JSON.parse(raw))`.\n * @param refCtx - Namespace context for `ref`-kind scope resolution. Required\n * when any descriptor parameter is `kind: 'ref'`; may be omitted if none are.\n */\nexport function validateExtensionBlock(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx?: ExtensionBlockRefResolutionContext,\n): readonly PslDiagnostic[] {\n const diagnostics: PslDiagnostic[] = [];\n\n const descriptorKeys = new Set(Object.keys(descriptor.parameters));\n const nodeKeys = new Set(Object.keys(node.parameters));\n\n // 1. Unknown parameters — keys in the node not in the descriptor.\n if (!descriptor.variadicParameters) {\n for (const key of nodeKeys) {\n if (!descriptorKeys.has(key)) {\n const captured = node.parameters[key];\n diagnostics.push({\n code: 'PSL_EXTENSION_UNKNOWN_PARAMETER',\n message: `Unknown parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\". The descriptor does not declare this parameter.`,\n sourceId,\n span: captured?.span ?? node.span,\n });\n }\n }\n }\n\n // 2. Missing required parameters — required descriptor keys absent from the node.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n if (param.required === true && !nodeKeys.has(key)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_MISSING_REQUIRED_PARAMETER',\n message: `Required parameter \"${key}\" is missing from \"${descriptor.keyword}\" block \"${node.name}\".`,\n sourceId,\n span: node.span,\n });\n }\n }\n\n // 3–5. Per-parameter validation for parameters that are present.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n const captured = node.parameters[key];\n if (captured === undefined) {\n continue;\n }\n validateParam(\n node,\n descriptor,\n key,\n param,\n captured,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n\n return diagnostics;\n}\n\nfunction validateParam(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParam,\n captured: PslExtensionBlockParamValue,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n switch (param.kind) {\n case 'option': {\n if (captured.kind !== 'option') {\n return;\n }\n if (!param.values.includes(captured.token)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_OPTION_OUT_OF_SET',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" has value \"${captured.token}\" which is not one of the allowed values: ${param.values.map((v) => `\"${v}\"`).join(', ')}.`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'value': {\n if (captured.kind !== 'value') {\n return;\n }\n const codec = codecLookup.get(param.codecId);\n if (codec === undefined) {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" references unknown codec \"${param.codecId}\".`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(captured.raw);\n } catch {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" is not a valid JSON literal (expected a JSON string, number, boolean, or null): ${captured.raw}`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n try {\n codec.decodeJson(\n blindCast<JsonValue, 'JSON.parse returns a JsonValue-compatible value'>(jsonValue),\n );\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" was rejected by codec \"${param.codecId}\": ${reason}`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'ref': {\n if (captured.kind !== 'ref') {\n return;\n }\n validateRef(\n node,\n descriptor,\n key,\n param,\n captured.identifier,\n captured.span,\n sourceId,\n refCtx,\n diagnostics,\n );\n return;\n }\n\n case 'list': {\n if (captured.kind !== 'list') {\n return;\n }\n for (const item of captured.items) {\n validateParam(\n node,\n descriptor,\n key,\n param.of,\n item,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n return;\n }\n }\n}\n\nfunction validateRef(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParamRef,\n identifier: string,\n span: PslSpan,\n sourceId: string,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n if (param.scope === 'cross-space') {\n // cross-space enforcement is a documented pass-through. The spec permits\n // scoping cross-space resolution to first-consumer need (RLS roles). When\n // that consumer arrives, wire resolution here through the\n // cross-contract-space coordinate model\n // (spaceId, namespaceId, entityKind, entityName).\n // For now, cross-space refs pass validation unconditionally.\n return;\n }\n\n if (refCtx === undefined) {\n // If no resolution context was provided, skip ref resolution. This matches\n // the closed-grammar invariant: callers that register ref parameters must\n // provide resolution context; callers without namespaces (e.g. unit tests\n // that only exercise other validation modes) can omit it.\n return;\n }\n\n const namespacesToSearch: readonly PslNamespace[] =\n param.scope === 'same-namespace' ? [refCtx.ownerNamespace] : refCtx.allNamespaces;\n\n if (!resolveEntityInNamespaces(identifier, param.refKind, namespacesToSearch)) {\n const scopeLabel =\n param.scope === 'same-namespace' ? 'the same namespace' : 'any namespace in the schema';\n diagnostics.push({\n code: 'PSL_EXTENSION_UNRESOLVED_REF',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" refers to \"${identifier}\" (expected ${param.refKind}), but no entity with that name and kind was found in ${scopeLabel}.`,\n sourceId,\n span,\n });\n }\n}\n\n/**\n * True if an entity named `name` of kind `refKind` exists in any of the given\n * namespaces. Built-in and extension kinds resolve the same way, through\n * `entries[refKind]`.\n */\nfunction resolveEntityInNamespaces(\n name: string,\n refKind: string,\n namespaces: readonly PslNamespace[],\n): boolean {\n for (const ns of namespaces) {\n const kindMap = ns.entries[refKind];\n if (kindMap !== undefined && Object.hasOwn(kindMap, name)) return true;\n }\n return false;\n}\n"],"mappings":"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"} |
+7
-7
| { | ||
| "name": "@prisma-next/framework-components", | ||
| "version": "0.16.0-dev.31", | ||
| "version": "0.16.0-dev.32", | ||
| "license": "Apache-2.0", | ||
@@ -9,6 +9,6 @@ "type": "module", | ||
| "dependencies": { | ||
| "@prisma-next/contract": "0.16.0-dev.31", | ||
| "@prisma-next/operations": "0.16.0-dev.31", | ||
| "@prisma-next/ts-render": "0.16.0-dev.31", | ||
| "@prisma-next/utils": "0.16.0-dev.31", | ||
| "@prisma-next/contract": "0.16.0-dev.32", | ||
| "@prisma-next/operations": "0.16.0-dev.32", | ||
| "@prisma-next/ts-render": "0.16.0-dev.32", | ||
| "@prisma-next/utils": "0.16.0-dev.32", | ||
| "@standard-schema/spec": "^1.1.0", | ||
@@ -18,4 +18,4 @@ "arktype": "^2.2.2" | ||
| "devDependencies": { | ||
| "@prisma-next/tsconfig": "0.16.0-dev.31", | ||
| "@prisma-next/tsdown": "0.16.0-dev.31", | ||
| "@prisma-next/tsconfig": "0.16.0-dev.32", | ||
| "@prisma-next/tsdown": "0.16.0-dev.32", | ||
| "tsdown": "0.22.8", | ||
@@ -22,0 +22,0 @@ "typescript": "5.9.3", |
| export type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring'; | ||
| export type { | ||
| ContributedPslDiagnosticCode, | ||
| PslBlockParam, | ||
@@ -25,6 +26,21 @@ PslBlockParamList, | ||
| import type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring'; | ||
| import type { PslDiagnosticCode, PslExtensionBlock, PslSpan } from '../shared/psl-extension-block'; | ||
| import type { | ||
| ContributedPslDiagnosticCode, | ||
| PslDiagnosticCode, | ||
| PslExtensionBlock, | ||
| PslSpan, | ||
| } from '../shared/psl-extension-block'; | ||
| export interface PslDiagnostic { | ||
| readonly code: PslDiagnosticCode; | ||
| /** | ||
| * The closed {@link PslDiagnosticCode} set exists for IDE completion and | ||
| * as documentation of the framework's own codes; the | ||
| * {@link ContributedPslDiagnosticCode} pattern arm is the seam for | ||
| * package-contributed codes, minted where the domain vocabulary lives | ||
| * (e.g. contract-psl). The two arms are extensionally equal — every | ||
| * framework code matches the pattern — and nothing switches | ||
| * exhaustively over the union, deliberately: consumers treat the code | ||
| * as an opaque identifier. | ||
| */ | ||
| readonly code: PslDiagnosticCode | ContributedPslDiagnosticCode; | ||
| readonly message: string; | ||
@@ -31,0 +47,0 @@ readonly sourceId: string; |
@@ -121,2 +121,14 @@ /** | ||
| /** | ||
| * A PSL diagnostic code contributed by a family or target package (e.g. an | ||
| * attribute-spec refine in a family's authoring layer). The framework union | ||
| * above stays the parser's own vocabulary; contributed codes share the | ||
| * `PSL_` pattern but their names are owned by the contributing package — | ||
| * no family or target vocabulary enters this module. Contributed codes | ||
| * must not reuse a framework code name; pick a domain-scoped prefix | ||
| * segment (e.g. `PSL_INDEX_`, `PSL_POLICY_`) to keep the namespaces | ||
| * collision-free. | ||
| */ | ||
| export type ContributedPslDiagnosticCode = `PSL_${string}`; | ||
| /** | ||
| * Descriptor vocabulary for a single parameter on a declared block. | ||
@@ -123,0 +135,0 @@ * |
| 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":"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"} |
| 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 extensions?: 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-Crm97b5Y.d.mts.map |
| {"version":3,"file":"framework-components-Crm97b5Y.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,aAAa;;WAEf;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"} |
Sorry, the diff of this file is too big to display
1151459
0.28%11214
0.24%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed