@prisma-next/framework-components
Advanced tools
| import { JsonValue } from "@prisma-next/contract/types"; | ||
| import { StandardSchemaV1 } from "@standard-schema/spec"; | ||
| //#region src/shared/codec-descriptor.d.ts | ||
| /** | ||
| * Unified codec descriptor. Every codec in the framework registers through this shape — non-parameterized codecs use `P = void` and a constant factory that returns the same shared codec instance for every column; parameterized codecs use a non-empty `P` and a curried higher-order factory that returns a per-instance codec. | ||
| * | ||
| * The descriptor is the codec-id-keyed source of truth for static metadata (`traits`, `targetTypes`, `meta`) and registration concerns (`paramsSchema` for JSON-boundary validation; optional `renderOutputType` for the `contract.d.ts` emit path). The runtime `Codec` instance returned by `factory(params)(ctx)` carries only the conversion behavior. | ||
| * | ||
| * Whether a codec id "is parameterized" stops being a registration-time distinction — it's a property of `P` on the descriptor. The descriptor map indexes every descriptor by `codecId`; both `descriptorFor(codecId)` and `forColumn(table, column)` resolve through the same map without branching on parameterization. | ||
| * | ||
| * @template P - The shape of the params accepted by the factory (`void` for non-parameterized codecs; a record like `{ length: number }` for parameterized codecs). | ||
| * | ||
| * Codec-registry-unification project § Decision. | ||
| */ | ||
| interface CodecDescriptor<P = void> { | ||
| /** The codec ID this descriptor applies to (e.g. `pg/vector@1`, `pg/text@1`). */ | ||
| readonly codecId: string; | ||
| /** Semantic traits for operator gating (e.g. equality, order, numeric). */ | ||
| readonly traits: readonly CodecTrait[]; | ||
| /** Database-native type names this codec handles (e.g. `['timestamptz']`). */ | ||
| readonly targetTypes: readonly string[]; | ||
| /** Optional family-specific metadata (e.g. SQL-side `db.sql.postgres.nativeType`). */ | ||
| readonly meta?: CodecMeta; | ||
| /** Standard Schema validator for the factory's params. Validates JSON-sourced params at the contract boundary (PSL → IR; `contract.json` → runtime). For non-parameterized codecs (`P = void`), the schema validates `void`/`undefined` — the framework supplies no params at the call boundary. */ | ||
| readonly paramsSchema: StandardSchemaV1<P>; | ||
| /** Whether this descriptor is parameterized — i.e. its `paramsSchema` is something other than the singleton `voidParamsSchema`. Consumers that need to gate column-aware dispatch read this directly rather than threading a free-floating `(codecId) => boolean` callback. */ | ||
| readonly isParameterized: boolean; | ||
| /** Emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for given params (e.g. `Vector<1536>`). Optional; absent renderers cause the emitter to fall back to the codec's base output type. Non-parameterized codecs typically omit it. */ | ||
| readonly renderOutputType?: (params: P) => string | undefined; | ||
| /** The curried higher-order codec. For non-parameterized codecs, the factory is constant — every call returns the same shared codec instance. For parameterized codecs, the factory is called once per `storage.types` instance (or once per inline-`typeParams` column), with `ctx` carrying the column set the resulting codec serves. */ | ||
| readonly factory: (params: P) => (ctx: CodecInstanceContext) => Codec; | ||
| } | ||
| /** | ||
| * Variance-erased {@link CodecDescriptor} alias. `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly), so `CodecDescriptor<P>` does not extend `CodecDescriptor<unknown>` for specific `P`. Heterogeneous descriptor collections — e.g. `SqlStaticContributions.codecs:` returning a list that mixes parameterized and non-parameterized descriptors — type against this alias and narrow per codec id at the consumer. | ||
| * | ||
| * Codec-registry-unification spec § Decision: every codec resolves through one descriptor map; reads are non-branching. | ||
| */ | ||
| type AnyCodecDescriptor = CodecDescriptor<any>; | ||
| /** | ||
| * Abstract base class for concrete codec descriptors. | ||
| * | ||
| * Codec authors extend this class with their typed `TParams` and declare `codecId`, `traits`, `targetTypes`, `paramsSchema`, the curried `factory(params)`, and (optionally) `renderOutputType`. | ||
| * | ||
| * Implements the {@link CodecDescriptor} interface so a concrete subclass instance is directly usable wherever the framework expects a `CodecDescriptor<P>`. | ||
| */ | ||
| declare abstract class CodecDescriptorImpl<TParams = void> implements CodecDescriptor<TParams> { | ||
| abstract readonly codecId: string; | ||
| abstract readonly traits: readonly CodecTrait[]; | ||
| abstract readonly targetTypes: readonly string[]; | ||
| readonly meta?: CodecMeta; | ||
| abstract readonly paramsSchema: StandardSchemaV1<TParams>; | ||
| /** Boolean derived from `paramsSchema`: `true` whenever the schema is not the singleton `voidParamsSchema`. */ | ||
| get isParameterized(): boolean; | ||
| /** Optional emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for the given params (e.g. `Vector<1536>`). Non-parameterized codecs typically omit it. */ | ||
| renderOutputType?(params: TParams): string | undefined; | ||
| /** | ||
| * Materialize a curried codec factory for the given params. Concrete subclasses override with a typed return type (e.g. `factory<N>(params: { length: N }): (ctx) => VectorCodec<N>`); per-codec helpers read the typed return at the *direct* call site, which is what preserves method-level generics. Type extraction (e.g. `ReturnType<D['factory']>`) widens method generics to their constraint — that's why the column-helper surface is per-codec, not polymorphic. | ||
| */ | ||
| abstract factory(params: TParams): (ctx: CodecInstanceContext) => Codec<string, readonly CodecTrait[], unknown, unknown>; | ||
| } | ||
| //#endregion | ||
| //#region src/shared/codec.d.ts | ||
| /** | ||
| * A codec is the contract between an application value and its on-wire and on-contract-disk representations. | ||
| * | ||
| * The author's mental model is two JS-side types — `TInput` (the application JS type) and `TWire` (the database driver wire format) — plus `JsonValue` for build-time contract artifacts. The codec translates `TInput` to `TWire` on writes and back on reads, and to/from `JsonValue` during contract emission and loading. | ||
| * | ||
| * Three representations participate: | ||
| * - **Input** (`TInput`): the JS type at the application boundary. | ||
| * - **Wire** (`TWire`): the format exchanged with the database driver. | ||
| * - **JSON** (`JsonValue`): a JSON-safe form used in contract artifacts. | ||
| * | ||
| * The runtime instance carries only its `id` (the descriptor's `codecId`, set by the factory) and the four conversion methods. Static metadata (`traits`, `targetTypes`, `meta`) and the build-time `renderOutputType` renderer live on the {@link CodecDescriptor} keyed by `codecId` — the read-surface single source of truth. Consumers that need them resolve through `descriptorFor(codecId)`. | ||
| * | ||
| * Codec methods split into two groups: | ||
| * | ||
| * - **Query-time** methods (`encode`, `decode`) run per row/parameter at the IO boundary; they are required and Promise-returning. The per-family codec factory accepts sync or async author functions and lifts sync ones to Promise-shaped methods automatically. | ||
| * - **Build-time** methods (`encodeJson`, `decodeJson`) run when the contract is serialized or loaded. They stay synchronous so contract validation and client construction are synchronous. | ||
| * | ||
| * Target-family codec interfaces extend this base; family-specific concerns (e.g. the SQL `column?` per-call context) layer on through the `CodecCallContext` extension pattern. | ||
| */ | ||
| interface Codec<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown> { | ||
| /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). The factory sets this to the descriptor's `codecId`; consumers use it as a back-reference for descriptor lookups and for decode-error diagnostics. */ | ||
| readonly id: Id; | ||
| /** Phantom carrier for the `TTraits` generic; type-only, undefined at runtime. Runtime traits live on {@link CodecDescriptor.traits}. Implemented as a string-key phantom (`__codecTraits`) rather than `unique symbol` so bundlers that split `.d.ts` chunks do not strand symbol identity on chunk-private paths (the same `TS2742` family that the public re-export of `CodecTypes` works around). */ | ||
| readonly __codecTraits?: TTraits; | ||
| /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */ | ||
| encode(value: TInput, ctx: CodecCallContext): Promise<TWire>; | ||
| /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */ | ||
| decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>; | ||
| /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */ | ||
| encodeJson(value: TInput): JsonValue; | ||
| /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `family.deserializeContract`. */ | ||
| decodeJson(json: JsonValue): TInput; | ||
| } | ||
| /** | ||
| * Abstract base class for concrete codec implementations. | ||
| * | ||
| * Codec authors extend this class with their typed `Id`, `TTraits`, `TWire`, `TInput` and override `encode`/`decode` (and optionally `encodeJson`/`decodeJson`). The runtime instance carries only its `id` (proxied through the descriptor so alias subclasses inherit the descriptor's id automatically) and the conversion methods — static metadata lives on the {@link CodecDescriptor}. | ||
| */ | ||
| declare abstract class CodecImpl<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown> implements Codec<Id, TTraits, TWire, TInput> { | ||
| readonly descriptor: CodecDescriptor<any>; | ||
| /** | ||
| * Variance-erased descriptor reference. Concrete codec subclasses receive the typed descriptor in their own constructors and forward it via `super(descriptor)`; the variance erasure lives at this base because the abstract surface can't carry the concrete `TParams`. | ||
| */ | ||
| constructor(descriptor: CodecDescriptor<any>); | ||
| get id(): Id; | ||
| abstract encode(value: TInput, ctx: CodecCallContext): Promise<TWire>; | ||
| abstract decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>; | ||
| abstract encodeJson(value: TInput): JsonValue; | ||
| abstract decodeJson(json: JsonValue): TInput; | ||
| } | ||
| //#endregion | ||
| //#region src/shared/codec-types.d.ts | ||
| type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual'; | ||
| /** | ||
| * Serializable codec identity carried by every codec-bearing AST node. | ||
| * | ||
| * `(codecId, typeParams?)` is the single fact the runtime needs to materialize a codec via `descriptorFor(codecId).factory(typeParams)(ctx)`. The pair is content-keyed: two refs with the same `codecId` and structurally equal `typeParams` (regardless of object key ordering) resolve to the same memoized {@link Codec} instance. | ||
| * | ||
| * `typeParams` is `JsonValue`-constrained so the ref survives JSON serialization (relevant for AST-embedded migration ops). Non-parameterized codecs leave `typeParams` undefined; the descriptor's `paramsSchema` validates the value at the JSON boundary. | ||
| * | ||
| * Family-agnostic by design — both SQL and Mongo AST nodes carry `codec: CodecRef | undefined`, and the resolver is the only dispatch path that survives serialization. | ||
| */ | ||
| interface CodecRef { | ||
| readonly codecId: string; | ||
| readonly typeParams?: JsonValue; | ||
| } | ||
| /** | ||
| * Per-call context the runtime threads to every `codec.encode` / `codec.decode` invocation for a single `runtime.execute()` call. | ||
| * | ||
| * The framework-level shape is family-agnostic and carries one field: | ||
| * | ||
| * - `signal?: AbortSignal` — per-query cancellation. The runtime returns a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors who forward `signal` to their underlying SDK get true cancellation of in-flight network calls. | ||
| * | ||
| * Family layers extend this base with their own shape-of-call metadata: the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext` (see `@prisma-next/sql-relational-core`). Mongo currently uses this framework type unchanged. Column metadata is intentionally **not** on the framework type — it is a SQL-family concept rooted in SQL's `(table, column)` addressing model and would not generalise to other families. | ||
| * | ||
| * The interface is named explicitly (not inlined) so future framework fields and family extensions can land additively without breaking codec author signatures. | ||
| */ | ||
| interface CodecCallContext { | ||
| readonly signal?: AbortSignal; | ||
| } | ||
| /** | ||
| * Codec-id-keyed read surface threaded into emit and authoring paths. | ||
| * | ||
| * - `get(id)` returns a representative {@link Codec} instance for the codec id (used by `family.deserializeContract` for `decodeJson` of literal column defaults). For parameterized codecs whose factory requires concrete params, this may return `undefined` — use `CodecRegistry.forCodecRef` instead. | ||
| * - `targetTypesFor(id)` exposes the codec-id-keyed `targetTypes` metadata the runtime instance no longer carries (TML-2357). Returns the same array `CodecDescriptor.targetTypes` would; for Mongo (whose registration doesn't yet resolve through the unified descriptor map — TML-2324) the family-side assembly populates this directly from the contributor's codec metadata. | ||
| * - `metaFor(id)` exposes the codec-id-keyed `meta` (e.g. SQL-side `db.sql.postgres.nativeType`) the runtime instance no longer carries. | ||
| * - `renderOutputTypeFor(id, params)` exposes the codec-id-keyed `renderOutputType` renderer the runtime instance no longer carries. Returns `undefined` when the codec doesn't render a custom type or when the codec id is unknown. | ||
| */ | ||
| interface CodecLookup { | ||
| get(id: string): Codec | undefined; | ||
| targetTypesFor(id: string): readonly string[] | undefined; | ||
| metaFor(id: string): CodecMeta | undefined; | ||
| renderOutputTypeFor(id: string, params: Record<string, unknown>): string | undefined; | ||
| } | ||
| /** | ||
| * Full codec registry — the read surface of {@link CodecLookup} plus codec resolution by ref or | ||
| * column coordinate. Built once by `extractCodecLookup` and passed by reference to adapters and | ||
| * other consumers that need to materialise codecs at runtime. | ||
| * | ||
| * - `forCodecRef(ref)` materialises a codec from a {@link CodecRef}. Throws | ||
| * `RUNTIME.CODEC_DESCRIPTOR_MISSING` for unknown ids and `RUNTIME.TYPE_PARAMS_INVALID` on param | ||
| * schema rejection. | ||
| * - `forColumn(namespaceId, table, column)` returns the codec for a specific column coordinate, or | ||
| * `undefined` when no column-to-codec mapping is present. This registry is contract-free so it | ||
| * always returns `undefined` — the method exists so the object structurally satisfies the SQL | ||
| * `ContractCodecRegistry` interface. | ||
| */ | ||
| interface CodecRegistry extends CodecLookup { | ||
| forCodecRef(ref: CodecRef): Codec; | ||
| forColumn(namespaceId: string, table: string, column: string): Codec | undefined; | ||
| } | ||
| declare const emptyCodecLookup: CodecLookup; | ||
| /** | ||
| * Family-agnostic per-instance context supplied by the framework when applying a higher-order codec factory. Allows stateful codecs (e.g. column-scoped encryption) to derive per-instance state from the materialization site. | ||
| * | ||
| * - `name` — the family-agnostic instance identity. For SQL, the runtime populates this as the `storage.types` instance name (e.g. `Embedding1536`) for typeRef-shaped columns, an inline-column sentinel (`<col:Document.embedding>`) for inline-`typeParams` columns, a shared codec-id sentinel (`<codec:pg/text@1>`) for non-parameterized codec ids, or the canonical cache key (`<codecId>:<canonicalizeJson(typeParams)>`) for ad-hoc refs the contract walk did not pre-populate. Other families pick the analogous identity for their materialization sites. | ||
| * | ||
| * Family-specific extensions (e.g. {@link import('@prisma-next/sql-relational-core/ast').SqlCodecInstanceContext} in the SQL layer) augment this base with domain-shaped column-set metadata. Codec authors target the base when they don't read family-specific metadata; they target the family extension when they do. | ||
| */ | ||
| interface CodecInstanceContext { | ||
| readonly name: string; | ||
| } | ||
| /** | ||
| * Family-agnostic codec metadata. Family-specific extensions augment the base `db.<family>.<target>` block with native-type information; the base shape is an empty object so non-relational codecs can carry no metadata. | ||
| */ | ||
| interface CodecMeta { | ||
| readonly db?: Record<string, unknown>; | ||
| } | ||
| /** | ||
| * Standard Schema validator for `void` params. Accepts only `undefined` (or absent input); rejects any other value so a contract that tries to thread `typeParams` through a non-parameterized codec id fails fast at the JSON boundary instead of silently coercing the value away. Used by the framework-supplied non-parameterized descriptor synthesizer. | ||
| */ | ||
| declare const voidParamsSchema: StandardSchemaV1<void>; | ||
| //#endregion | ||
| export { CodecRef as a, emptyCodecLookup as c, CodecImpl as d, AnyCodecDescriptor as f, CodecMeta as i, voidParamsSchema as l, CodecDescriptorImpl as m, CodecInstanceContext as n, CodecRegistry as o, CodecDescriptor as p, CodecLookup as r, CodecTrait as s, CodecCallContext as t, Codec as u }; | ||
| //# sourceMappingURL=codec-types-29q8imKF.d.mts.map |
| {"version":3,"file":"codec-types-29q8imKF.d.mts","names":[],"sources":["../src/shared/codec-descriptor.ts","../src/shared/codec.ts","../src/shared/codec-types.ts"],"mappings":";;;;;;;;;;;;;;;UA8BiB,eAAA;EAUN;EAAA,SARA,OAAA;EAQ+B;EAAA,SAN/B,MAAA,WAAiB,UAAA;EAUjB;EAAA,SARA,WAAA;EAQoB;EAAA,SANpB,IAAA,GAAO,SAAA;EAQW;EAAA,SANlB,YAAA,EAAc,gBAAA,CAAiB,CAAA;EAMD;EAAA,SAJ9B,eAAA;EAIuD;EAAA,SAFvD,gBAAA,IAAoB,MAAA,EAAQ,CAAA;EAEgC;EAAA,SAA5D,OAAA,GAAU,MAAA,EAAQ,CAAA,MAAO,GAAA,EAAK,oBAAA,KAAyB,KAAA;AAAA;;;AASlB;AAShD;;KATY,kBAAA,GAAqB,eAAe;;;;;;;;uBAS1B,mBAAA,4BAA+C,eAAA,CAAgB,OAAA;EAAA,kBACjE,OAAA;EAAA,kBACA,MAAA,WAAiB,UAAA;EAAA,kBACjB,WAAA;EAAA,SACT,IAAA,GAAO,SAAA;EAAA,kBAEE,YAAA,EAAc,gBAAA,CAAiB,OAAA;EANT;EAA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;AAAA;;;;;;;;;;;;UAchB,gBAAA;EAAA,SACN,MAAA,GAAS,WAAW;AAAA;;;;;;;;AFcwC;UEHtD,WAAA;EACf,GAAA,CAAI,EAAA,WAAa,KAAA;EACjB,cAAA,CAAe,EAAA;EACf,OAAA,CAAQ,EAAA,WAAa,SAAA;EACrB,mBAAA,CAAoB,EAAA,UAAY,MAAA,EAAQ,MAAA;AAAA;;;;;;;;;;;;;;UAgBzB,aAAA,SAAsB,WAAA;EACrC,WAAA,CAAY,GAAA,EAAK,QAAA,GAAW,KAAA;EAC5B,SAAA,CAAU,WAAA,UAAqB,KAAA,UAAe,MAAA,WAAiB,KAAA;AAAA;AAAA,cAGpD,gBAAA,EAAkB,WAK9B;;;;;;;;UASgB,oBAAA;EAAA,SACN,IAAI;AAAA;;;;UAME,SAAA;EAAA,SACN,EAAA,GAAK,MAAM;AAAA;;;;cAMT,gBAAA,EAAkB,gBAAgB"} |
| import { r as CodecLookup } from "./codec-types-29q8imKF.mjs"; | ||
| import { ColumnDefault, ExecutionMutationDefaultPhases } from "@prisma-next/contract/types"; | ||
| import { Type } from "arktype"; | ||
| //#region src/shared/psl-extension-block.d.ts | ||
| /** | ||
| * Shape-only types for the PSL source-position primitives, diagnostic | ||
| * codes, extension-block descriptor vocabulary, and the uniform | ||
| * extension-block AST node base. | ||
| * | ||
| * These live in the shared plane so an extension's authoring descriptor | ||
| * (`AuthoringPslBlockDescriptor` in `framework-authoring`) can reference | ||
| * them without crossing the shared → migration-plane boundary. The | ||
| * migration-plane `psl-ast.ts` re-exports everything here for consumers | ||
| * that import PSL AST types from the control entrypoint. | ||
| */ | ||
| 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 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' | ||
| /** | ||
| * 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'; | ||
| /** | ||
| * 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 { | ||
| readonly kind: 'option'; | ||
| readonly values: readonly string[]; | ||
| 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 enum2 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 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. | ||
| * - `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; | ||
| 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; | ||
| }; | ||
| type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | 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>; | ||
| }); | ||
| interface AuthoringStorageTypeTemplate { | ||
| readonly codecId: string; | ||
| readonly nativeType: AuthoringTemplateValue; | ||
| readonly typeParams?: Record<string, AuthoringTemplateValue>; | ||
| } | ||
| interface AuthoringTypeConstructorDescriptor { | ||
| readonly kind: 'typeConstructor'; | ||
| readonly args?: readonly AuthoringArgumentDescriptor[]; | ||
| readonly output: AuthoringStorageTypeTemplate; | ||
| } | ||
| interface AuthoringColumnDefaultTemplateLiteral { | ||
| readonly kind: 'literal'; | ||
| readonly value: AuthoringTemplateValue; | ||
| } | ||
| interface AuthoringColumnDefaultTemplateFunction { | ||
| readonly kind: 'function'; | ||
| readonly expression: AuthoringTemplateValue; | ||
| } | ||
| type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction; | ||
| interface 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; | ||
| } | ||
| 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; | ||
| } | ||
| type AuthoringPslBlockDescriptorNamespace = { | ||
| readonly [name: string]: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace; | ||
| }; | ||
| 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; | ||
| } | ||
| declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef; | ||
| declare function isAuthoringTypeConstructorDescriptor(value: unknown): value is AuthoringTypeConstructorDescriptor; | ||
| declare function isAuthoringFieldPresetDescriptor(value: unknown): value is AuthoringFieldPresetDescriptor; | ||
| declare function isAuthoringEntityTypeDescriptor(value: unknown): value is AuthoringEntityTypeDescriptor; | ||
| declare function isAuthoringPslBlockDescriptor(value: unknown): value is AuthoringPslBlockDescriptor; | ||
| /** | ||
| * 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. `isLeafDescriptor` decides which values are descriptors (terminal | ||
| * merge points; same-path registrations across components are reported | ||
| * as duplicates) versus sub-namespaces (recursion targets). | ||
| * | ||
| * 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[], isLeafDescriptor: (value: unknown) => boolean, label: string): void; | ||
| declare function assertNoCrossRegistryCollisions(typeNamespace: AuthoringTypeNamespace, fieldNamespace: AuthoringFieldNamespace, entityTypeNamespace?: AuthoringEntityTypeNamespace, pslBlockNamespace?: AuthoringPslBlockDescriptorNamespace): void; | ||
| declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue, args: readonly unknown[]): unknown; | ||
| declare function validateAuthoringHelperArguments(helperPath: string, descriptors: readonly AuthoringArgumentDescriptor[] | undefined, args: readonly unknown[]): void; | ||
| declare function instantiateAuthoringTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor, args: readonly unknown[]): { | ||
| readonly codecId: string; | ||
| readonly nativeType: string; | ||
| readonly typeParams?: Record<string, unknown>; | ||
| }; | ||
| declare function instantiateAuthoringEntityType(helperPath: string, descriptor: AuthoringEntityTypeDescriptor, args: readonly unknown[], ctx: AuthoringEntityContext): unknown; | ||
| declare function instantiateAuthoringFieldPreset(descriptor: AuthoringFieldPresetDescriptor, args: readonly unknown[]): { | ||
| readonly descriptor: { | ||
| readonly codecId: string; | ||
| readonly nativeType: string; | ||
| readonly typeParams?: Record<string, unknown>; | ||
| }; | ||
| readonly nullable: boolean; | ||
| readonly default?: ColumnDefault; | ||
| readonly executionDefaults?: ExecutionMutationDefaultPhases; | ||
| readonly id: boolean; | ||
| readonly unique: boolean; | ||
| }; | ||
| //#endregion | ||
| export { mergeAuthoringNamespaces as A, PslExtensionBlockAttribute as B, instantiateAuthoringFieldPreset as C, isAuthoringFieldPresetDescriptor as D, isAuthoringEntityTypeDescriptor as E, PslBlockParamOption as F, PslExtensionBlockParamRef as G, PslExtensionBlockParamBare as H, PslBlockParamRef as I, PslPosition as J, PslExtensionBlockParamScalarValue as K, PslBlockParamValue as L, validateAuthoringHelperArguments as M, PslBlockParam as N, isAuthoringPslBlockDescriptor as O, PslBlockParamList as P, PslDiagnosticCode as R, instantiateAuthoringEntityType as S, isAuthoringArgRef as T, PslExtensionBlockParamList as U, PslExtensionBlockAttributeArg as V, PslExtensionBlockParamOption as W, PslSpan as Y, AuthoringTemplateValue as _, AuthoringDiagnosticSink as a, assertNoCrossRegistryCollisions as b, AuthoringEntityTypeFactoryOutput as c, AuthoringFieldNamespace as d, AuthoringFieldPresetDescriptor as f, AuthoringStorageTypeTemplate as g, AuthoringPslBlockDescriptorNamespace as h, AuthoringContributions as i, resolveAuthoringTemplateValue as j, isAuthoringTypeConstructorDescriptor as k, AuthoringEntityTypeNamespace as l, AuthoringPslBlockDescriptor as m, AuthoringArgumentDescriptor as n, AuthoringEntityContext as o, AuthoringFieldPresetOutput as p, PslExtensionBlockParamValue as q, AuthoringColumnDefaultTemplate as r, AuthoringEntityTypeDescriptor as s, AuthoringArgRef as t, AuthoringEntityTypeTemplateOutput as u, AuthoringTypeConstructorDescriptor as v, instantiateAuthoringTypeConstructor as w, hasRegisteredFieldNamespace as x, AuthoringTypeNamespace as y, PslExtensionBlock as z }; | ||
| //# sourceMappingURL=framework-authoring-BXiebZGn.d.mts.map |
| {"version":3,"file":"framework-authoring-BXiebZGn.d.mts","names":[],"sources":["../src/shared/psl-extension-block.ts","../src/shared/framework-authoring.ts"],"mappings":";;;;;;;;;;AAYA;;;;;;UAAiB,WAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,OAAA;EAAA,SACN,KAAA,EAAO,WAAA;EAAA,SACP,GAAA,EAAK,WAAW;AAAA;AAAA,KAGf,iBAAA;;;AAHe;AAG3B;;;;AAA6B;AAwE7B;;;;;;;;;;;;;;AAIqB;AAErB;;;;;;;;;AAImB;AAGnB;;;;;;;;AAGmB;AAGnB;;AAHmB;;;;;;AAMA;AAGnB;;;;;;KAzBY,aAAA,GACR,gBAAA,GACA,kBAAA,GACA,mBAAA,GACA,iBAAA;AAAA,UAEa,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,kBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,mBAAA;EAAA,SACN,IAAA;EAAA,SACA,MAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,iBAAA;EAAA,SACN,IAAA;EAAA,SACA,EAAA,EAAI,aAAa;EAAA,SACjB,QAA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A;EAAA,SACA,MAAA;AAAA"} |
| import { f as AnyCodecDescriptor } from "./codec-types-29q8imKF.mjs"; | ||
| import { i as AuthoringContributions } from "./framework-authoring-BXiebZGn.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 DefaultFunctionArgument { | ||
| readonly raw: string; | ||
| readonly span: SourceSpan; | ||
| } | ||
| interface ParsedDefaultFunctionCall { | ||
| readonly name: string; | ||
| readonly raw: string; | ||
| readonly args: readonly DefaultFunctionArgument[]; | ||
| readonly span: SourceSpan; | ||
| } | ||
| 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; | ||
| }; | ||
| type DefaultFunctionLoweringHandler = (input: { | ||
| readonly call: ParsedDefaultFunctionCall; | ||
| readonly context: DefaultFunctionLoweringContext; | ||
| }) => LoweredDefaultResult; | ||
| interface DefaultFunctionRegistryEntry { | ||
| readonly lower: DefaultFunctionLoweringHandler; | ||
| readonly usageSignatures?: readonly string[]; | ||
| } | ||
| type DefaultFunctionRegistry = ReadonlyMap<string, DefaultFunctionRegistryEntry>; | ||
| interface MutationDefaultGeneratorDescriptor { | ||
| readonly id: string; | ||
| /** | ||
| * Codec ids the generator is compatible with when the codec choice | ||
| * and the generator choice are made independently by the contract | ||
| * author. Set when the registry-coherence check is meaningful | ||
| * (the codec and the generator can be paired arbitrarily by the | ||
| * caller); omitted when the generator is only reachable through a | ||
| * descriptor that co-registers a fixed codec, so coherence is | ||
| * structural and the list would be tautological. | ||
| */ | ||
| readonly applicableCodecIds?: readonly string[]; | ||
| readonly resolveGeneratedColumnDescriptor?: (input: { | ||
| readonly generated: ExecutionMutationDefaultValue; | ||
| }) => { | ||
| readonly codecId: string; | ||
| readonly nativeType: string; | ||
| readonly typeRef?: string; | ||
| readonly typeParams?: Record<string, unknown>; | ||
| } | undefined; | ||
| /** | ||
| * Construct the `onCreate`/`onUpdate` phases value owned by this | ||
| * generator. Authoring layers (PSL `temporal.updatedAt()`, TS field presets) call | ||
| * this instead of building the literal inline so PSL/TS-authored | ||
| * contracts stay byte-equivalent for any future params-bearing generator. | ||
| */ | ||
| readonly buildPhases?: (args?: Record<string, unknown>) => ExecutionMutationDefaultPhases; | ||
| } | ||
| interface ControlMutationDefaultEntry { | ||
| readonly lower: (input: { | ||
| readonly call: ParsedDefaultFunctionCall; | ||
| readonly context: DefaultFunctionLoweringContext; | ||
| }) => LoweredDefaultResult; | ||
| readonly usageSignatures?: readonly string[]; | ||
| } | ||
| type ControlMutationDefaultRegistry = ReadonlyMap<string, ControlMutationDefaultEntry>; | ||
| interface ControlMutationDefaults { | ||
| readonly defaultFunctionRegistry: ControlMutationDefaultRegistry; | ||
| readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[]; | ||
| } | ||
| //#endregion | ||
| //#region src/shared/framework-components.d.ts | ||
| /** | ||
| * Declarative fields that describe component metadata. | ||
| */ | ||
| interface ComponentMetadata { | ||
| /** Component version (semver) */ | ||
| readonly version: string; | ||
| /** | ||
| * Capabilities this component provides. | ||
| * | ||
| * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`); keep these declarations in sync. Targets are identifiers/descriptors and typically do not declare capabilities. | ||
| */ | ||
| readonly capabilities?: Record<string, unknown>; | ||
| /** Type imports for contract.d.ts generation */ | ||
| readonly types?: { | ||
| readonly codecTypes?: { | ||
| /** | ||
| * Base codec types import spec. Optional: adapters typically provide this, extensions usually don't. | ||
| */ | ||
| readonly import?: TypesImportSpec; | ||
| /** | ||
| * Additional type-only imports for parameterized codec branded types. | ||
| * | ||
| * These imports are included in generated `contract.d.ts` but are NOT treated as codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`). | ||
| * | ||
| * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>` | ||
| */ | ||
| readonly typeImports?: ReadonlyArray<TypesImportSpec>; | ||
| /** | ||
| * Optional control-plane hooks keyed by codecId. Used by family-specific planners/verifiers to handle storage types. | ||
| */ | ||
| readonly controlPlaneHooks?: Record<string, unknown>; | ||
| /** | ||
| * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission. | ||
| */ | ||
| readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>; | ||
| }; | ||
| readonly queryOperationTypes?: { | ||
| readonly import: TypesImportSpec; | ||
| }; | ||
| readonly storage?: ReadonlyArray<{ | ||
| readonly typeId: string; | ||
| readonly familyId: string; | ||
| readonly targetId: string; | ||
| readonly nativeType?: string; | ||
| }>; | ||
| }; | ||
| /** | ||
| * Optional pure-data authoring contributions exposed by this component. | ||
| * | ||
| * These contributions are safe to include on pack refs and descriptors because they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows. | ||
| */ | ||
| readonly authoring?: AuthoringContributions; | ||
| /** | ||
| * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection. | ||
| */ | ||
| readonly scalarTypeDescriptors?: ReadonlyMap<string, string>; | ||
| /** | ||
| * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection. | ||
| */ | ||
| readonly controlMutationDefaults?: ControlMutationDefaults; | ||
| } | ||
| /** | ||
| * Base descriptor for any framework component. | ||
| * | ||
| * All component descriptors share these fundamental properties that identify the component and provide its metadata. This interface is extended by specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.). | ||
| * | ||
| * @template Kind - Discriminator literal identifying the component type. Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension', but the type accepts any string to allow ecosystem extensions. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // All descriptors have these properties | ||
| * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds) | ||
| * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres') | ||
| * descriptor.version // Component version (semver) | ||
| * ``` | ||
| */ | ||
| interface ComponentDescriptor<Kind extends string> extends ComponentMetadata { | ||
| /** Discriminator identifying the component type */ | ||
| readonly kind: Kind; | ||
| /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */ | ||
| readonly id: string; | ||
| } | ||
| interface ContractComponentRequirementsCheckInput { | ||
| readonly contract: { | ||
| readonly target: string; | ||
| readonly targetFamily?: string | undefined; | ||
| readonly extensionPacks?: Record<string, unknown> | undefined; | ||
| }; | ||
| readonly expectedTargetFamily?: string | undefined; | ||
| readonly expectedTargetId?: string | undefined; | ||
| readonly providedComponentIds: Iterable<string>; | ||
| } | ||
| interface ContractComponentRequirementsCheckResult { | ||
| readonly familyMismatch?: { | ||
| readonly expected: string; | ||
| readonly actual: string; | ||
| } | undefined; | ||
| readonly targetMismatch?: { | ||
| readonly expected: string; | ||
| readonly actual: string; | ||
| } | undefined; | ||
| readonly missingExtensionPackIds: readonly string[]; | ||
| } | ||
| declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult; | ||
| /** | ||
| * Descriptor for a family component. | ||
| * | ||
| * A "family" represents a category of data sources with shared semantics (e.g., SQL databases, document stores). Families define: | ||
| * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.) | ||
| * - Contract structure (tables vs collections, columns vs fields) | ||
| * - Type system and codecs | ||
| * | ||
| * Families are the top-level grouping. Each family contains multiple targets (e.g., SQL family contains Postgres, MySQL, SQLite targets). | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations | ||
| * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document') | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import sql from '@prisma-next/family-sql/control'; | ||
| * | ||
| * sql.kind // 'family' | ||
| * sql.familyId // 'sql' | ||
| * sql.id // 'sql' | ||
| * ``` | ||
| */ | ||
| interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> { | ||
| /** The family identifier (e.g., 'sql', 'document') */ | ||
| readonly familyId: TFamilyId; | ||
| } | ||
| /** | ||
| * Descriptor for a target component. | ||
| * | ||
| * A "target" represents a specific database or data store within a family (e.g., Postgres, MySQL, MongoDB). Targets define: | ||
| * - Native type mappings (e.g., Postgres int4 → TypeScript number) | ||
| * - Target-specific capabilities (e.g., RETURNING, LATERAL joins) | ||
| * | ||
| * Targets are bound to a family and provide the target-specific implementation details that adapters and drivers use. | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlTargetDescriptor` - adds optional `migrations` capability | ||
| * - `RuntimeTargetDescriptor` - adds runtime factory method | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql') | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import postgres from '@prisma-next/target-postgres/control'; | ||
| * | ||
| * postgres.kind // 'target' | ||
| * postgres.familyId // 'sql' | ||
| * postgres.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> { | ||
| /** The family this target belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** | ||
| * Base shape for any pack reference. Pack refs are pure JSON-friendly objects safe to import in authoring flows. | ||
| */ | ||
| interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata { | ||
| readonly kind: Kind; | ||
| readonly id: string; | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId?: string; | ||
| readonly authoring?: AuthoringContributions; | ||
| } | ||
| type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>; | ||
| type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & { | ||
| readonly targetId: TTargetId; /** The namespace a bare (un-namespaced) entity name resolves to for this target (e.g. Postgres `'public'`). */ | ||
| readonly defaultNamespaceId: string; | ||
| }; | ||
| type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & { | ||
| readonly targetId: TTargetId; | ||
| }; | ||
| type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & { | ||
| readonly targetId: TTargetId; | ||
| }; | ||
| type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & { | ||
| readonly targetId: TTargetId; | ||
| }; | ||
| /** | ||
| * Descriptor for an adapter component. | ||
| * | ||
| * An "adapter" provides the protocol and dialect implementation for a target. Adapters handle: | ||
| * - SQL/query generation (lowering AST to target-specific syntax) | ||
| * - Codec registration (encoding/decoding between JS and wire types) | ||
| * - Type mappings and coercions | ||
| * | ||
| * Adapters are bound to a specific family+target combination and work with any compatible driver for that target. | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlAdapterDescriptor` - control-plane factory | ||
| * - `RuntimeAdapterDescriptor` - runtime factory | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import postgresAdapter from '@prisma-next/adapter-postgres/control'; | ||
| * | ||
| * postgresAdapter.kind // 'adapter' | ||
| * postgresAdapter.familyId // 'sql' | ||
| * postgresAdapter.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> { | ||
| /** The family this adapter belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target this adapter is designed for */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** | ||
| * Descriptor for a driver component. | ||
| * | ||
| * A "driver" provides the connection and execution layer for a target. Drivers handle: | ||
| * - Connection management (pooling, timeouts, retries) | ||
| * - Query execution (sending SQL/commands, receiving results) | ||
| * - Transaction management | ||
| * - Wire protocol communication | ||
| * | ||
| * Drivers are bound to a specific family+target and work with any compatible adapter. Multiple drivers can exist for the same target (e.g., node-postgres vs postgres.js for Postgres). | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlDriverDescriptor` - creates driver from connection URL | ||
| * - `RuntimeDriverDescriptor` - creates driver with runtime options | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import postgresDriver from '@prisma-next/driver-postgres/control'; | ||
| * | ||
| * postgresDriver.kind // 'driver' | ||
| * postgresDriver.familyId // 'sql' | ||
| * postgresDriver.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> { | ||
| /** The family this driver belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target this driver connects to */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** | ||
| * Descriptor for an extension component. | ||
| * | ||
| * An "extension" adds optional capabilities to a target. Extensions can provide: | ||
| * - Additional operations (e.g., vector similarity search with pgvector) | ||
| * - Custom types and codecs (e.g., vector type) | ||
| * - Extended query capabilities | ||
| * | ||
| * Extensions are bound to a specific family+target and are registered in the config alongside the core components. Multiple extensions can be used together. | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlExtensionDescriptor` - control-plane extension factory | ||
| * - `RuntimeExtensionDescriptor` - runtime extension factory | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import pgvector from '@prisma-next/extension-pgvector/control'; | ||
| * | ||
| * pgvector.kind // 'extension' | ||
| * pgvector.familyId // 'sql' | ||
| * pgvector.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> { | ||
| /** The family this extension belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target this extension is designed for */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** Components bound to a specific family+target combination. */ | ||
| type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>; | ||
| interface FamilyInstance<TFamilyId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| } | ||
| interface TargetInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| interface AdapterInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| interface DriverInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| //#endregion | ||
| export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, 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, LoweredDefaultValue as j, DefaultFunctionRegistryEntry 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-B-ABhSOs.d.mts.map |
| {"version":3,"file":"framework-components-B-ABhSOs.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"mappings":";;;;;;UAMU,cAAA;EAAA,SACC,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,UAAA;EAAA,SACN,KAAA,EAAO,cAAA;EAAA,SACP,GAAA,EAAK,cAAc;AAAA;AAAA,UAGb,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,GAAO,UAAA;EAAA,SACP,IAAA,GAAO,QAAA,CAAS,MAAA;AAAA;AAAA,UAGjB,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AU,SAAA;EAhOR;EAAA,SAmOF,QAAA,EAAU,SAAA;AAAA;;;;;;;AA7NoB;AAGzC;;;;;;;;;;;;AAGkC;AAGlC;;;;;;UAiPiB,mBAAA,6DACP,mBAAA;EAhPiC;EAAA,SAkPhC,QAAA,EAAU,SAAA;EAvLJ;EAAA,SA0LN,QAAA,EAAU,SAAA;AAAA;;KAIT,8BAAA,uDACR,gBAAA,CAAiB,SAAA,EAAW,SAAA,IAC5B,iBAAA,CAAkB,SAAA,EAAW,SAAA,IAC7B,gBAAA,CAAiB,SAAA,EAAW,SAAA,IAC5B,mBAAA,CAAoB,SAAA,EAAW,SAAA;AAAA,UAElB,cAAA;EAAA,SACN,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,eAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,iBAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA"} |
| import { r as CodecLookup } from "./codec-types-29q8imKF.mjs"; | ||
| import { R as PslDiagnosticCode, Y as PslSpan, h as AuthoringPslBlockDescriptorNamespace, z as PslExtensionBlock } from "./framework-authoring-BXiebZGn.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; | ||
| } | ||
| interface PslEnumValue { | ||
| readonly kind: 'enumValue'; | ||
| readonly name: string; | ||
| /** | ||
| * Optional storage label for the enum member, captured from a trailing | ||
| * `@map("...")` attribute on the member line. The parser populates this | ||
| * when the source PSL carries an explicit `@map`. Producers (e.g. | ||
| * `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)` | ||
| * automatically when normalisation would change the printed member name | ||
| * (so an enum value `'in-progress'` becomes `inProgress @map("in-progress")` | ||
| * in PSL, preserving the round-trip). | ||
| */ | ||
| readonly mapName?: string; | ||
| readonly span: PslSpan; | ||
| } | ||
| interface PslEnum { | ||
| readonly kind: 'enum'; | ||
| readonly name: string; | ||
| readonly values: readonly PslEnumValue[]; | ||
| readonly attributes: readonly PslAttribute[]; | ||
| readonly span: PslSpan; | ||
| } | ||
| /** | ||
| * 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 | PslEnum | 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_select']['ReadPosts']`. | ||
| */ | ||
| 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 enums, from `entries['enum']`. */ | ||
| readonly enums: readonly PslEnum[]; | ||
| /** 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[], enums: readonly PslEnum[], 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 enums from every namespace in document order. | ||
| */ | ||
| declare function flatPslEnums(ast: PslDocumentAst): readonly PslEnum[]; | ||
| /** | ||
| * 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'`, `'enum'`, `'compositeType'`. | ||
| */ | ||
| 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'`, `'enum'`, `'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 { flatPslCompositeTypes as A, PslNamespace as C, PslTypesBlock as D, PslTypeConstructorCall as E, namespacePslExtensionBlocks as F, flatPslModels as M, makePslNamespace as N, PslUniqueConstraint as O, makePslNamespaceEntries as P, PslNamedTypeDeclaration as S, PslReferentialAction as T, PslField as _, PslAttributeArgument as a, PslModel as b, PslAttributeTarget as c, PslDefaultLiteralValue as d, PslDefaultValue as f, PslEnumValue as g, PslEnum as h, PslAttribute as i, flatPslEnums as j, UNSPECIFIED_PSL_NAMESPACE_ID 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, PslFieldAttribute as v, PslNamespaceEntry as w, PslModelAttribute as x, PslIndexConstraint as y }; | ||
| //# sourceMappingURL=psl-ast-CHgjnZ3h.d.mts.map |
| {"version":3,"file":"psl-ast-CHgjnZ3h.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";;;;UA0BiB,aAAA;EAAA,SACN,IAAA,EAAM,iBAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,EAAM,OAAO;AAAA;AAAA,UAGP,uBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAI;AAAA;AAAA,UAGE,sBAAA;EAAA,SACN,IAAA;EAAA,SACA,KAAK;AAAA;AAAA,KAGJ,eAAA,GAAkB,uBAAA,GAA0B,sBAAsB;AAAA,KAEl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CD,gBAAA,CAAiB,IAAA;EAAA,SACtB,IAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA,EAAS,QAAA,CAAS,MAAA,SAAe,QAAA,CAAS,MAAA,SAAe,iBAAA;EAAA,SACzD,IAAA,EAAM,OAAA;AAAA,IACb,YAAA;;;;;;iBASY,uBAAA,CACd,MAAA,WAAiB,QAAA,IACjB,KAAA,WAAgB,OAAA,IAChB,cAAA,WAAyB,gBAAA,IACzB,eAAA,WAA0B,iBAAA,KACzB,QAAA,CAAS,MAAA,SAAe,QAAA,CAAS,MAAA,SAAe,iBAAA;AAAA,UAyClC,cAAA;EAAA,SACN,IAAA;EAAA,SACA,QAAA;EAAA,SACA,UAAA,WAAqB,YAAA;EAAA,SACrB,KAAA,GAAQ,aAAA;EAAA,SACR,IAAA,EAAM,OAAA;AAAA;;;;;iBAOD,aAAA,CAAc,GAAA,EAAK,cAAA,YAA0B,QAAQ;;;;iBAWrD,YAAA,CAAa,GAAA,EAAK,cAAA,YAA0B,OAAO;;AA7L3C;AAGxB;iBAqMgB,qBAAA,CAAsB,GAAA,EAAK,cAAA,YAA0B,gBAAgB;;;;;;;;;cAiBxE,qBAAA,EAAuB,WAAW;;;;;;;;AA3MvB;iBAyNR,2BAAA,CAA4B,EAAA,EAAI,YAAA,YAAwB,iBAAiB;AAAA,UAgBxE,qBAAA;EAAA,SACN,MAAA;EAAA,SACA,QAAA;EAvOA;;;;;;AAEa;AAexB;;;;AAAyC;AAGzC;;;EApBW,SAuPA,mBAAA,GAAsB,oCAAA;EAnOU;;;;;;;;EAAA,SA4OhC,WAAA,GAAc,WAAW;AAAA;AAAA,UAGnB,sBAAA;EAAA,SACN,GAAA,EAAK,cAAA;EAAA,SACL,WAAA,WAAsB,aAAa;EAAA,SACnC,EAAA;AAAA"} |
| import { n as runtimeError } from "./runtime-error-B2gWOtgH.mjs"; | ||
| import { blindCast } from "@prisma-next/utils/casts"; | ||
| //#region src/shared/resolve-codec.ts | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
| * | ||
| * Parameterized codecs that omit `typeParams` have it normalized to `{}` before | ||
| * validation (mirrors `ast-codec-resolver.ts` semantics). Throws | ||
| * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or | ||
| * reports issues. | ||
| */ | ||
| function validateCodecTypeParams(descriptor, ref) { | ||
| const normalized = descriptor.isParameterized && ref.typeParams === void 0 ? { | ||
| ...ref, | ||
| typeParams: {} | ||
| } : ref; | ||
| const result = blindCast(descriptor.paramsSchema["~standard"].validate(normalized.typeParams)); | ||
| if (result instanceof Promise) throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, { | ||
| codecId: ref.codecId, | ||
| typeParams: ref.typeParams | ||
| }); | ||
| if ("issues" in result && result.issues) { | ||
| const messages = result.issues.map((issue) => issue.message).join("; "); | ||
| throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid typeParams for codec '${ref.codecId}': ${messages}`, { | ||
| codecId: ref.codecId, | ||
| typeParams: ref.typeParams | ||
| }); | ||
| } | ||
| return blindCast(result).value; | ||
| } | ||
| /** | ||
| * Resolves a `Codec` instance: validates `ref.typeParams` via | ||
| * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`. | ||
| * | ||
| * The descriptor's `factory` is typed against its own `P`; the registry erases | ||
| * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec` | ||
| * at the call boundary. The `paramsSchema` validates the input above before we | ||
| * forward it, so the narrowing is safe by construction. | ||
| */ | ||
| function materializeCodec(descriptor, ref, ctx) { | ||
| const validated = validateCodecTypeParams(descriptor, ref); | ||
| return blindCast(descriptor.factory)(validated)(ctx); | ||
| } | ||
| //#endregion | ||
| export { validateCodecTypeParams as n, materializeCodec as t }; | ||
| //# sourceMappingURL=resolve-codec-DR7uyr_c.mjs.map |
| {"version":3,"file":"resolve-codec-DR7uyr_c.mjs","names":[],"sources":["../src/shared/resolve-codec.ts"],"sourcesContent":["import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from './codec';\nimport type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { CodecInstanceContext, CodecRef } from './codec-types';\nimport { runtimeError } from './runtime-error';\n\n/**\n * Validates `ref.typeParams` against `descriptor.paramsSchema`.\n *\n * Parameterized codecs that omit `typeParams` have it normalized to `{}` before\n * validation (mirrors `ast-codec-resolver.ts` semantics). Throws\n * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or\n * reports issues.\n */\nexport function validateCodecTypeParams(descriptor: AnyCodecDescriptor, ref: CodecRef): unknown {\n const normalized =\n descriptor.isParameterized && ref.typeParams === undefined ? { ...ref, typeParams: {} } : ref;\n\n const result = blindCast<\n { value: unknown } | { issues: ReadonlyArray<{ message: string }> } | Promise<unknown>,\n 'Standard Schema validate returns unknown; the spec guarantees this union shape'\n >(descriptor.paramsSchema['~standard'].validate(normalized.typeParams));\n\n if (result instanceof Promise) {\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n if ('issues' in result && result.issues) {\n const messages = result.issues.map((issue) => issue.message).join('; ');\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid typeParams for codec '${ref.codecId}': ${messages}`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n return blindCast<{ value: unknown }, 'issues guard above rules out the issues branch'>(result)\n .value;\n}\n\n/**\n * Resolves a `Codec` instance: validates `ref.typeParams` via\n * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`.\n *\n * The descriptor's `factory` is typed against its own `P`; the registry erases\n * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec`\n * at the call boundary. The `paramsSchema` validates the input above before we\n * forward it, so the narrowing is safe by construction.\n */\nexport function materializeCodec(\n descriptor: AnyCodecDescriptor,\n ref: CodecRef,\n ctx: CodecInstanceContext,\n): Codec {\n const validated = validateCodecTypeParams(descriptor, ref);\n return blindCast<\n (params: unknown) => (ctx: CodecInstanceContext) => Codec,\n 'registry erases P to any; paramsSchema validates input before forwarding'\n >(descriptor.factory)(validated)(ctx);\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAgB,wBAAwB,YAAgC,KAAwB;CAC9F,MAAM,aACJ,WAAW,mBAAmB,IAAI,eAAe,KAAA,IAAY;EAAE,GAAG;EAAK,YAAY,CAAC;CAAE,IAAI;CAE5F,MAAM,SAAS,UAGb,WAAW,aAAa,YAAY,CAAC,SAAS,WAAW,UAAU,CAAC;CAEtE,IAAI,kBAAkB,SACpB,MAAM,aACJ,+BACA,2BAA2B,IAAI,QAAQ,6FACvC;EAAE,SAAS,IAAI;EAAS,YAAY,IAAI;CAAW,CACrD;CAGF,IAAI,YAAY,UAAU,OAAO,QAAQ;EACvC,MAAM,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI;EACtE,MAAM,aACJ,+BACA,iCAAiC,IAAI,QAAQ,KAAK,YAClD;GAAE,SAAS,IAAI;GAAS,YAAY,IAAI;EAAW,CACrD;CACF;CAEA,OAAO,UAAgF,MAAM,CAAC,CAC3F;AACL;;;;;;;;;;AAWA,SAAgB,iBACd,YACA,KACA,KACO;CACP,MAAM,YAAY,wBAAwB,YAAY,GAAG;CACzD,OAAO,UAGL,WAAW,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG;AACtC"} |
| //#region src/shared/runtime-error.ts | ||
| /** | ||
| * Type guard for the runtime-error envelope produced by `runtimeError`. | ||
| * | ||
| * Prefer this over duck-typing on `error.code` directly so consumers stay | ||
| * insulated from the envelope's internal shape. | ||
| */ | ||
| function isRuntimeError(error) { | ||
| return error instanceof Error && "code" in error && typeof error.code === "string" && "category" in error && "severity" in error; | ||
| } | ||
| function runtimeError(code, message, details) { | ||
| const error = Object.assign(new Error(message), { | ||
| code, | ||
| category: resolveCategory(code), | ||
| severity: "error", | ||
| ...details !== void 0 ? { details } : {} | ||
| }); | ||
| Object.defineProperty(error, "name", { | ||
| value: "RuntimeError", | ||
| configurable: true | ||
| }); | ||
| return error; | ||
| } | ||
| function resolveCategory(code) { | ||
| const prefix = code.split(".")[0] ?? "RUNTIME"; | ||
| switch (prefix) { | ||
| case "PLAN": | ||
| case "CONTRACT": | ||
| case "LINT": | ||
| case "BUDGET": return prefix; | ||
| default: return "RUNTIME"; | ||
| } | ||
| } | ||
| //#endregion | ||
| export { runtimeError as n, isRuntimeError as t }; | ||
| //# sourceMappingURL=runtime-error-B2gWOtgH.mjs.map |
| {"version":3,"file":"runtime-error-B2gWOtgH.mjs","names":[],"sources":["../src/shared/runtime-error.ts"],"sourcesContent":["export interface RuntimeErrorEnvelope extends Error {\n readonly code: string;\n readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';\n readonly severity: 'error';\n readonly details?: Record<string, unknown>;\n}\n\n/**\n * Type guard for the runtime-error envelope produced by `runtimeError`.\n *\n * Prefer this over duck-typing on `error.code` directly so consumers stay\n * insulated from the envelope's internal shape.\n */\nexport function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope {\n return (\n error instanceof Error &&\n 'code' in error &&\n typeof (error as { code?: unknown }).code === 'string' &&\n 'category' in error &&\n 'severity' in error\n );\n}\n\nexport function runtimeError(\n code: string,\n message: string,\n details?: Record<string, unknown>,\n): RuntimeErrorEnvelope {\n const error = Object.assign(new Error(message), {\n code,\n category: resolveCategory(code),\n severity: 'error' as const,\n ...(details !== undefined ? { details } : {}),\n });\n Object.defineProperty(error, 'name', { value: 'RuntimeError', configurable: true });\n return error;\n}\n\nfunction resolveCategory(code: string): RuntimeErrorEnvelope['category'] {\n const prefix = code.split('.')[0] ?? 'RUNTIME';\n switch (prefix) {\n case 'PLAN':\n case 'CONTRACT':\n case 'LINT':\n case 'BUDGET':\n return prefix;\n default:\n return 'RUNTIME';\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,eAAe,OAA+C;CAC5E,OACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAA6B,SAAS,YAC9C,cAAc,SACd,cAAc;AAElB;AAEA,SAAgB,aACd,MACA,SACA,SACsB;CACtB,MAAM,QAAQ,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;EAC9C;EACA,UAAU,gBAAgB,IAAI;EAC9B,UAAU;EACV,GAAI,YAAY,KAAA,IAAY,EAAE,QAAQ,IAAI,CAAC;CAC7C,CAAC;CACD,OAAO,eAAe,OAAO,QAAQ;EAAE,OAAO;EAAgB,cAAc;CAAK,CAAC;CAClF,OAAO;AACT;AAEA,SAAS,gBAAgB,MAAgD;CACvE,MAAM,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM;CACrC,QAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF"} |
| import { blindCast } from '@prisma-next/utils/casts'; | ||
| import type { Codec } from './codec'; | ||
| import type { AnyCodecDescriptor } from './codec-descriptor'; | ||
| import type { CodecInstanceContext, CodecRef } from './codec-types'; | ||
| import { runtimeError } from './runtime-error'; | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
| * | ||
| * Parameterized codecs that omit `typeParams` have it normalized to `{}` before | ||
| * validation (mirrors `ast-codec-resolver.ts` semantics). Throws | ||
| * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or | ||
| * reports issues. | ||
| */ | ||
| export function validateCodecTypeParams(descriptor: AnyCodecDescriptor, ref: CodecRef): unknown { | ||
| const normalized = | ||
| descriptor.isParameterized && ref.typeParams === undefined ? { ...ref, typeParams: {} } : ref; | ||
| const result = blindCast< | ||
| { value: unknown } | { issues: ReadonlyArray<{ message: string }> } | Promise<unknown>, | ||
| 'Standard Schema validate returns unknown; the spec guarantees this union shape' | ||
| >(descriptor.paramsSchema['~standard'].validate(normalized.typeParams)); | ||
| if (result instanceof Promise) { | ||
| throw runtimeError( | ||
| 'RUNTIME.TYPE_PARAMS_INVALID', | ||
| `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, | ||
| { codecId: ref.codecId, typeParams: ref.typeParams }, | ||
| ); | ||
| } | ||
| if ('issues' in result && result.issues) { | ||
| const messages = result.issues.map((issue) => issue.message).join('; '); | ||
| throw runtimeError( | ||
| 'RUNTIME.TYPE_PARAMS_INVALID', | ||
| `Invalid typeParams for codec '${ref.codecId}': ${messages}`, | ||
| { codecId: ref.codecId, typeParams: ref.typeParams }, | ||
| ); | ||
| } | ||
| return blindCast<{ value: unknown }, 'issues guard above rules out the issues branch'>(result) | ||
| .value; | ||
| } | ||
| /** | ||
| * Resolves a `Codec` instance: validates `ref.typeParams` via | ||
| * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`. | ||
| * | ||
| * The descriptor's `factory` is typed against its own `P`; the registry erases | ||
| * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec` | ||
| * at the call boundary. The `paramsSchema` validates the input above before we | ||
| * forward it, so the narrowing is safe by construction. | ||
| */ | ||
| export function materializeCodec( | ||
| descriptor: AnyCodecDescriptor, | ||
| ref: CodecRef, | ||
| ctx: CodecInstanceContext, | ||
| ): Codec { | ||
| const validated = validateCodecTypeParams(descriptor, ref); | ||
| return blindCast< | ||
| (params: unknown) => (ctx: CodecInstanceContext) => Codec, | ||
| 'registry erases P to any; paramsSchema validates input before forwarding' | ||
| >(descriptor.factory)(validated)(ctx); | ||
| } |
| export interface RuntimeErrorEnvelope extends Error { | ||
| readonly code: string; | ||
| readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME'; | ||
| readonly severity: 'error'; | ||
| readonly details?: Record<string, unknown>; | ||
| } | ||
| /** | ||
| * Type guard for the runtime-error envelope produced by `runtimeError`. | ||
| * | ||
| * Prefer this over duck-typing on `error.code` directly so consumers stay | ||
| * insulated from the envelope's internal shape. | ||
| */ | ||
| export function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope { | ||
| return ( | ||
| error instanceof Error && | ||
| 'code' in error && | ||
| typeof (error as { code?: unknown }).code === 'string' && | ||
| 'category' in error && | ||
| 'severity' in error | ||
| ); | ||
| } | ||
| export function runtimeError( | ||
| code: string, | ||
| message: string, | ||
| details?: Record<string, unknown>, | ||
| ): RuntimeErrorEnvelope { | ||
| const error = Object.assign(new Error(message), { | ||
| code, | ||
| category: resolveCategory(code), | ||
| severity: 'error' as const, | ||
| ...(details !== undefined ? { details } : {}), | ||
| }); | ||
| Object.defineProperty(error, 'name', { value: 'RuntimeError', configurable: true }); | ||
| return error; | ||
| } | ||
| function resolveCategory(code: string): RuntimeErrorEnvelope['category'] { | ||
| const prefix = code.split('.')[0] ?? 'RUNTIME'; | ||
| switch (prefix) { | ||
| case 'PLAN': | ||
| case 'CONTRACT': | ||
| case 'LINT': | ||
| case 'BUDGET': | ||
| return prefix; | ||
| default: | ||
| return 'RUNTIME'; | ||
| } | ||
| } |
@@ -1,2 +0,2 @@ | ||
| import { A as mergeAuthoringNamespaces, C as instantiateAuthoringFieldPreset, D as isAuthoringFieldPresetDescriptor, E as isAuthoringEntityTypeDescriptor, F as PslBlockParamOption, G as PslExtensionBlockParamRef, I as PslBlockParamRef, K as PslExtensionBlockParamScalarValue, L as PslBlockParamValue, M as validateAuthoringHelperArguments, N as PslBlockParam, O as isAuthoringPslBlockDescriptor, P as PslBlockParamList, S as instantiateAuthoringEntityType, T as isAuthoringArgRef, U as PslExtensionBlockParamList, W as PslExtensionBlockParamOption, _ as AuthoringTemplateValue, a as AuthoringDiagnosticSink, b as assertNoCrossRegistryCollisions, c as AuthoringEntityTypeFactoryOutput, d as AuthoringFieldNamespace, f as AuthoringFieldPresetDescriptor, g as AuthoringStorageTypeTemplate, h as AuthoringPslBlockDescriptorNamespace, i as AuthoringContributions, j as resolveAuthoringTemplateValue, k as isAuthoringTypeConstructorDescriptor, l as AuthoringEntityTypeNamespace, m as AuthoringPslBlockDescriptor, n as AuthoringArgumentDescriptor, o as AuthoringEntityContext, p as AuthoringFieldPresetOutput, q as PslExtensionBlockParamValue, r as AuthoringColumnDefaultTemplate, s as AuthoringEntityTypeDescriptor, t as AuthoringArgRef, u as AuthoringEntityTypeTemplateOutput, v as AuthoringTypeConstructorDescriptor, w as instantiateAuthoringTypeConstructor, x as hasRegisteredFieldNamespace, y as AuthoringTypeNamespace, z as PslExtensionBlock } from "./framework-authoring-qyokbMY7.mjs"; | ||
| import { A as mergeAuthoringNamespaces, C as instantiateAuthoringFieldPreset, D as isAuthoringFieldPresetDescriptor, E as isAuthoringEntityTypeDescriptor, F as PslBlockParamOption, G as PslExtensionBlockParamRef, I as PslBlockParamRef, K as PslExtensionBlockParamScalarValue, L as PslBlockParamValue, M as validateAuthoringHelperArguments, N as PslBlockParam, O as isAuthoringPslBlockDescriptor, P as PslBlockParamList, S as instantiateAuthoringEntityType, T as isAuthoringArgRef, U as PslExtensionBlockParamList, W as PslExtensionBlockParamOption, _ as AuthoringTemplateValue, a as AuthoringDiagnosticSink, b as assertNoCrossRegistryCollisions, c as AuthoringEntityTypeFactoryOutput, d as AuthoringFieldNamespace, f as AuthoringFieldPresetDescriptor, g as AuthoringStorageTypeTemplate, h as AuthoringPslBlockDescriptorNamespace, i as AuthoringContributions, j as resolveAuthoringTemplateValue, k as isAuthoringTypeConstructorDescriptor, l as AuthoringEntityTypeNamespace, m as AuthoringPslBlockDescriptor, n as AuthoringArgumentDescriptor, o as AuthoringEntityContext, p as AuthoringFieldPresetOutput, q as PslExtensionBlockParamValue, r as AuthoringColumnDefaultTemplate, s as AuthoringEntityTypeDescriptor, t as AuthoringArgRef, u as AuthoringEntityTypeTemplateOutput, v as AuthoringTypeConstructorDescriptor, w as instantiateAuthoringTypeConstructor, x as hasRegisteredFieldNamespace, y as AuthoringTypeNamespace, z as PslExtensionBlock } from "./framework-authoring-BXiebZGn.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 AuthoringPslBlockDescriptor, type AuthoringPslBlockDescriptorNamespace, type AuthoringStorageTypeTemplate, type AuthoringTemplateValue, type AuthoringTypeConstructorDescriptor, type AuthoringTypeNamespace, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, type PslExtensionBlock, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, assertNoCrossRegistryCollisions, hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringArgRef, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, resolveAuthoringTemplateValue, validateAuthoringHelperArguments }; |
+23
-2
@@ -1,2 +0,2 @@ | ||
| import { a as CodecRef, c as voidParamsSchema, d as AnyCodecDescriptor, f as CodecDescriptor, i as CodecMeta, l as Codec, n as CodecInstanceContext, o as CodecTrait, p as CodecDescriptorImpl, r as CodecLookup, s as emptyCodecLookup, t as CodecCallContext, u as CodecImpl } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { a as CodecRef, c as emptyCodecLookup, d as CodecImpl, f as AnyCodecDescriptor, i as CodecMeta, l as voidParamsSchema, m as CodecDescriptorImpl, n as CodecInstanceContext, o as CodecRegistry, p as CodecDescriptor, r as CodecLookup, s as CodecTrait, t as CodecCallContext, u as Codec } from "./codec-types-29q8imKF.mjs"; | ||
@@ -47,3 +47,24 @@ //#region src/shared/column-spec.d.ts | ||
| //#endregion | ||
| export { type AnyCodecDescriptor, type Codec, type CodecCallContext, type CodecDescriptor, CodecDescriptorImpl, CodecImpl, type CodecInstanceContext, type CodecLookup, type CodecMeta, type CodecRef, type CodecTrait, type ColumnHelperFor, type ColumnHelperForStrict, type ColumnSpec, type ColumnTypeDescriptor, column, emptyCodecLookup, voidParamsSchema }; | ||
| //#region src/shared/resolve-codec.d.ts | ||
| /** | ||
| * Validates `ref.typeParams` against `descriptor.paramsSchema`. | ||
| * | ||
| * Parameterized codecs that omit `typeParams` have it normalized to `{}` before | ||
| * validation (mirrors `ast-codec-resolver.ts` semantics). Throws | ||
| * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or | ||
| * reports issues. | ||
| */ | ||
| declare function validateCodecTypeParams(descriptor: AnyCodecDescriptor, ref: CodecRef): unknown; | ||
| /** | ||
| * Resolves a `Codec` instance: validates `ref.typeParams` via | ||
| * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`. | ||
| * | ||
| * The descriptor's `factory` is typed against its own `P`; the registry erases | ||
| * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec` | ||
| * at the call boundary. The `paramsSchema` validates the input above before we | ||
| * forward it, so the narrowing is safe by construction. | ||
| */ | ||
| declare function materializeCodec(descriptor: AnyCodecDescriptor, ref: CodecRef, ctx: CodecInstanceContext): Codec; | ||
| //#endregion | ||
| export { type AnyCodecDescriptor, type Codec, type CodecCallContext, type CodecDescriptor, CodecDescriptorImpl, CodecImpl, type CodecInstanceContext, type CodecLookup, type CodecMeta, type CodecRef, type CodecRegistry, type CodecTrait, type ColumnHelperFor, type ColumnHelperForStrict, type ColumnSpec, type ColumnTypeDescriptor, column, emptyCodecLookup, materializeCodec, validateCodecTypeParams, voidParamsSchema }; | ||
| //# sourceMappingURL=codec.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"codec.d.mts","names":[],"sources":["../src/shared/column-spec.ts"],"mappings":";;;;;;;;;AAsBkB;KAJN,oBAAA;EAAA,SACD,OAAA,EAAS,QAAA;EAAA,SACT,UAAA;EAAA,SACA,UAAA,GAAa,MAAM;EAAA,SACnB,OAAA;AAAA;;;;;;UAQM,UAAA,cAAwB,MAAA,uCAC/B,oBAAA;EAAA,SACC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA;EAAA,SAC7C,UAAA,EAAY,CAAA;AAAA;;;;;;iBAQP,MAAA,cAAoB,MAAA,+BAClC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA,EAC7C,OAAA,UACA,UAAA,EAAY,CAAA,EACZ,UAAA,WACC,UAAA,CAAW,CAAA,EAAG,CAAA;AAbO;AAQxB;;;;AARwB,KA4BZ,eAAA,WAA0B,eAAA,aAEjC,IAAA,YACA,UAAA,UAAoB,kBAAA,CAAmB,CAAA;;;;KAMhC,qBAAA,WAAgC,eAAA,aAEvC,IAAA,YACA,UAAA,CAAW,UAAA,CAAW,UAAA,CAAW,CAAA,eAAgB,kBAAA,CAAmB,CAAA;;;;KAMpE,kBAAA,WAA6B,eAAA,SAChC,UAAA,CAAW,CAAA,wBAAyB,MAAA,oBAChC,UAAA,CAAW,CAAA"} | ||
| {"version":3,"file":"codec.d.mts","names":[],"sources":["../src/shared/column-spec.ts","../src/shared/resolve-codec.ts"],"mappings":";;;;;;;;;AAsBkB;KAJN,oBAAA;EAAA,SACD,OAAA,EAAS,QAAA;EAAA,SACT,UAAA;EAAA,SACA,UAAA,GAAa,MAAM;EAAA,SACnB,OAAA;AAAA;;;;;;UAQM,UAAA,cAAwB,MAAA,uCAC/B,oBAAA;EAAA,SACC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA;EAAA,SAC7C,UAAA,EAAY,CAAA;AAAA;;;;;;iBAQP,MAAA,cAAoB,MAAA,+BAClC,YAAA,GAAe,GAAA,EAAK,oBAAA,KAAyB,CAAA,EAC7C,OAAA,UACA,UAAA,EAAY,CAAA,EACZ,UAAA,WACC,UAAA,CAAW,CAAA,EAAG,CAAA;AAbO;AAQxB;;;;AARwB,KA4BZ,eAAA,WAA0B,eAAA,aAEjC,IAAA,YACA,UAAA,UAAoB,kBAAA,CAAmB,CAAA;;;;KAMhC,qBAAA,WAAgC,eAAA,aAEvC,IAAA,YACA,UAAA,CAAW,UAAA,CAAW,UAAA,CAAW,CAAA,eAAgB,kBAAA,CAAmB,CAAA;;;;KAMpE,kBAAA,WAA6B,eAAA,SAChC,UAAA,CAAW,CAAA,wBAAyB,MAAA,oBAChC,UAAA,CAAW,CAAA;;;AA/DjB;;;;;;;;AAAA,iBCJgB,uBAAA,CAAwB,UAAA,EAAY,kBAAA,EAAoB,GAAA,EAAK,QAAQ;;;;ADQnE;AAQlB;;;;;iBCuBgB,gBAAA,CACd,UAAA,EAAY,kBAAA,EACZ,GAAA,EAAK,QAAA,EACL,GAAA,EAAK,oBAAA,GACJ,KAAA"} |
+2
-1
@@ -0,1 +1,2 @@ | ||
| import { n as validateCodecTypeParams, t as materializeCodec } from "./resolve-codec-DR7uyr_c.mjs"; | ||
| //#region src/shared/codec.ts | ||
@@ -67,4 +68,4 @@ /** | ||
| //#endregion | ||
| export { CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, voidParamsSchema }; | ||
| export { CodecDescriptorImpl, CodecImpl, column, emptyCodecLookup, materializeCodec, validateCodecTypeParams, voidParamsSchema }; | ||
| //# sourceMappingURL=codec.mjs.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"codec.mjs","names":[],"sources":["../src/shared/codec.ts","../src/shared/codec-types.ts","../src/shared/codec-descriptor.ts","../src/shared/column-spec.ts"],"sourcesContent":["/**\n * Codec interface (consumer surface) and abstract `CodecImpl` base (codec-author surface).\n *\n * Consumers depend on the {@link Codec} interface — it describes the runtime instance returned by a descriptor's curried factory and is what the framework threads through emit, validate, and execute paths.\n *\n * Codec authors `extend` the {@link CodecImpl} abstract class to declare a typed runtime codec instance. The class carries a variance-erased descriptor reference (`CodecDescriptor<any>`); `id` proxies through the descriptor so one source of truth governs both metadata reads and aliasing semantics (alias subclasses inherit the descriptor's id automatically).\n *\n * Class generic shape: `Id`, `TTraits`, `TWire`, `TInput`. Method generics on the codec subclass's own surface (e.g. arktype-json's schema generic, pgvector's dimension generic) flow through the subclass's constructor and propagate via the descriptor's typed `factory(params)` return at *direct* call sites.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport type { CodecDescriptor } from './codec-descriptor';\nimport type { CodecCallContext, CodecTrait } from './codec-types';\n\n/**\n * A codec is the contract between an application value and its on-wire and on-contract-disk representations.\n *\n * The author's mental model is two JS-side types — `TInput` (the application JS type) and `TWire` (the database driver wire format) — plus `JsonValue` for build-time contract artifacts. The codec translates `TInput` to `TWire` on writes and back on reads, and to/from `JsonValue` during contract emission and loading.\n *\n * Three representations participate:\n * - **Input** (`TInput`): the JS type at the application boundary.\n * - **Wire** (`TWire`): the format exchanged with the database driver.\n * - **JSON** (`JsonValue`): a JSON-safe form used in contract artifacts.\n *\n * The runtime instance carries only its `id` (the descriptor's `codecId`, set by the factory) and the four conversion methods. Static metadata (`traits`, `targetTypes`, `meta`) and the build-time `renderOutputType` renderer live on the {@link CodecDescriptor} keyed by `codecId` — the read-surface single source of truth. Consumers that need them resolve through `descriptorFor(codecId)`.\n *\n * Codec methods split into two groups:\n *\n * - **Query-time** methods (`encode`, `decode`) run per row/parameter at the IO boundary; they are required and Promise-returning. The per-family codec factory accepts sync or async author functions and lifts sync ones to Promise-shaped methods automatically.\n * - **Build-time** methods (`encodeJson`, `decodeJson`) run when the contract is serialized or loaded. They stay synchronous so contract validation and client construction are synchronous.\n *\n * Target-family codec interfaces extend this base; family-specific concerns (e.g. the SQL `column?` per-call context) layer on through the `CodecCallContext` extension pattern.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n> {\n /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). The factory sets this to the descriptor's `codecId`; consumers use it as a back-reference for descriptor lookups and for decode-error diagnostics. */\n readonly id: Id;\n /** Phantom carrier for the `TTraits` generic; type-only, undefined at runtime. Runtime traits live on {@link CodecDescriptor.traits}. Implemented as a string-key phantom (`__codecTraits`) rather than `unique symbol` so bundlers that split `.d.ts` chunks do not strand symbol identity on chunk-private paths (the same `TS2742` family that the public re-export of `CodecTypes` works around). */\n readonly __codecTraits?: TTraits;\n /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */\n encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;\n /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */\n decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;\n /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */\n encodeJson(value: TInput): JsonValue;\n /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `family.deserializeContract`. */\n decodeJson(json: JsonValue): TInput;\n}\n\n/**\n * Abstract base class for concrete codec implementations.\n *\n * Codec authors extend this class with their typed `Id`, `TTraits`, `TWire`, `TInput` and override `encode`/`decode` (and optionally `encodeJson`/`decodeJson`). The runtime instance carries only its `id` (proxied through the descriptor so alias subclasses inherit the descriptor's id automatically) and the conversion methods — static metadata lives on the {@link CodecDescriptor}.\n */\nexport abstract class CodecImpl<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n> implements Codec<Id, TTraits, TWire, TInput>\n{\n /**\n * Variance-erased descriptor reference. Concrete codec subclasses receive the typed descriptor in their own constructors and forward it via `super(descriptor)`; the variance erasure lives at this base because the abstract surface can't carry the concrete `TParams`.\n */\n // biome-ignore lint/suspicious/noExplicitAny: variance-erased descriptor reference; subclasses retain typed access via their own state\n constructor(public readonly descriptor: CodecDescriptor<any>) {}\n\n get id(): Id {\n return this.descriptor.codecId as Id;\n }\n\n abstract encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;\n abstract decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;\n abstract encodeJson(value: TInput): JsonValue;\n abstract decodeJson(json: JsonValue): TInput;\n}\n","import type { JsonValue } from '@prisma-next/contract/types';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Codec } from './codec';\n\nexport type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';\n\n/**\n * Serializable codec identity carried by every codec-bearing AST node.\n *\n * `(codecId, typeParams?)` is the single fact the runtime needs to materialize a codec via `descriptorFor(codecId).factory(typeParams)(ctx)`. The pair is content-keyed: two refs with the same `codecId` and structurally equal `typeParams` (regardless of object key ordering) resolve to the same memoized {@link Codec} instance.\n *\n * `typeParams` is `JsonValue`-constrained so the ref survives JSON serialization (relevant for AST-embedded migration ops). Non-parameterized codecs leave `typeParams` undefined; the descriptor's `paramsSchema` validates the value at the JSON boundary.\n *\n * Family-agnostic by design — both SQL and Mongo AST nodes carry `codec: CodecRef | undefined`, and the resolver is the only dispatch path that survives serialization.\n */\nexport interface CodecRef {\n readonly codecId: string;\n readonly typeParams?: JsonValue;\n}\n\n/**\n * Per-call context the runtime threads to every `codec.encode` / `codec.decode` invocation for a single `runtime.execute()` call.\n *\n * The framework-level shape is family-agnostic and carries one field:\n *\n * - `signal?: AbortSignal` — per-query cancellation. The runtime returns a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors who forward `signal` to their underlying SDK get true cancellation of in-flight network calls.\n *\n * Family layers extend this base with their own shape-of-call metadata: the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext` (see `@prisma-next/sql-relational-core`). Mongo currently uses this framework type unchanged. Column metadata is intentionally **not** on the framework type — it is a SQL-family concept rooted in SQL's `(table, column)` addressing model and would not generalise to other families.\n *\n * The interface is named explicitly (not inlined) so future framework fields and family extensions can land additively without breaking codec author signatures.\n */\nexport interface CodecCallContext {\n readonly signal?: AbortSignal;\n}\n\n/**\n * Codec-id-keyed read surface threaded into emit and authoring paths.\n *\n * - `get(id)` returns the runtime {@link Codec} instance for the codec id (used by `family.deserializeContract` for `decodeJson` of literal column defaults).\n * - `targetTypesFor(id)` exposes the codec-id-keyed `targetTypes` metadata the runtime instance no longer carries (TML-2357). Returns the same array `CodecDescriptor.targetTypes` would; for Mongo (whose registration doesn't yet resolve through the unified descriptor map — TML-2324) the family-side assembly populates this directly from the contributor's codec metadata.\n * - `metaFor(id)` exposes the codec-id-keyed `meta` (e.g. SQL-side `db.sql.postgres.nativeType`) the runtime instance no longer carries.\n * - `renderOutputTypeFor(id, params)` exposes the codec-id-keyed `renderOutputType` renderer the runtime instance no longer carries. Returns `undefined` when the codec doesn't render a custom type or when the codec id is unknown.\n */\nexport interface CodecLookup {\n get(id: string): Codec | undefined;\n targetTypesFor(id: string): readonly string[] | undefined;\n metaFor(id: string): CodecMeta | undefined;\n renderOutputTypeFor(id: string, params: Record<string, unknown>): string | undefined;\n}\n\nexport const emptyCodecLookup: CodecLookup = {\n get: () => undefined,\n targetTypesFor: () => undefined,\n metaFor: () => undefined,\n renderOutputTypeFor: () => undefined,\n};\n\n/**\n * Family-agnostic per-instance context supplied by the framework when applying a higher-order codec factory. Allows stateful codecs (e.g. column-scoped encryption) to derive per-instance state from the materialization site.\n *\n * - `name` — the family-agnostic instance identity. For SQL, the runtime populates this as the `storage.types` instance name (e.g. `Embedding1536`) for typeRef-shaped columns, an inline-column sentinel (`<col:Document.embedding>`) for inline-`typeParams` columns, a shared codec-id sentinel (`<codec:pg/text@1>`) for non-parameterized codec ids, or the canonical cache key (`<codecId>:<canonicalizeJson(typeParams)>`) for ad-hoc refs the contract walk did not pre-populate. Other families pick the analogous identity for their materialization sites.\n *\n * Family-specific extensions (e.g. {@link import('@prisma-next/sql-relational-core/ast').SqlCodecInstanceContext} in the SQL layer) augment this base with domain-shaped column-set metadata. Codec authors target the base when they don't read family-specific metadata; they target the family extension when they do.\n */\nexport interface CodecInstanceContext {\n readonly name: string;\n}\n\n/**\n * Family-agnostic codec metadata. Family-specific extensions augment the base `db.<family>.<target>` block with native-type information; the base shape is an empty object so non-relational codecs can carry no metadata.\n */\nexport interface CodecMeta {\n readonly db?: Record<string, unknown>;\n}\n\n/**\n * Standard Schema validator for `void` params. Accepts only `undefined` (or absent input); rejects any other value so a contract that tries to thread `typeParams` through a non-parameterized codec id fails fast at the JSON boundary instead of silently coercing the value away. Used by the framework-supplied non-parameterized descriptor synthesizer.\n */\nexport const voidParamsSchema: StandardSchemaV1<void> = {\n '~standard': {\n version: 1,\n vendor: 'prisma-next',\n validate: (input) =>\n input === undefined\n ? { value: undefined }\n : {\n issues: [\n {\n message: 'unexpected typeParams for non-parameterized codec (void params expected)',\n },\n ],\n },\n },\n};\n","/**\n * Codec descriptor interface (consumer surface) and abstract `CodecDescriptorImpl` base (codec-author surface).\n *\n * Consumers depend on the {@link CodecDescriptor} interface — it is the codec-id-keyed source of truth for static metadata (`traits`, `targetTypes`, `meta`) and registration concerns (`paramsSchema`; optional `renderOutputType`). The runtime `Codec` instance returned by `factory(params)(ctx)` carries only the conversion behavior.\n *\n * Codec authors `extend` the {@link CodecDescriptorImpl} abstract class to declare their codec id, traits, target types, params schema, the `factory(params)` that materializes a typed `Codec<...>`, and (optionally) a `renderOutputType(params)` for the emit path.\n *\n * The factory's method-level generic is the load-bearing piece for literal preservation: per-codec column helpers invoke `descriptor.factory(...)` *directly*, and the direct call binds the generic at its call site. Type extraction (`ReturnType<D['factory']>`, structural matching) widens method generics to their constraint — that's why the column-helper surface is per-codec, not polymorphic.\n */\n\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Codec } from './codec';\nimport {\n type CodecInstanceContext,\n type CodecMeta,\n type CodecTrait,\n voidParamsSchema,\n} from './codec-types';\n\n/**\n * Unified codec descriptor. Every codec in the framework registers through this shape — non-parameterized codecs use `P = void` and a constant factory that returns the same shared codec instance for every column; parameterized codecs use a non-empty `P` and a curried higher-order factory that returns a per-instance codec.\n *\n * The descriptor is the codec-id-keyed source of truth for static metadata (`traits`, `targetTypes`, `meta`) and registration concerns (`paramsSchema` for JSON-boundary validation; optional `renderOutputType` for the `contract.d.ts` emit path). The runtime `Codec` instance returned by `factory(params)(ctx)` carries only the conversion behavior.\n *\n * Whether a codec id \"is parameterized\" stops being a registration-time distinction — it's a property of `P` on the descriptor. The descriptor map indexes every descriptor by `codecId`; both `descriptorFor(codecId)` and `forColumn(table, column)` resolve through the same map without branching on parameterization.\n *\n * @template P - The shape of the params accepted by the factory (`void` for non-parameterized codecs; a record like `{ length: number }` for parameterized codecs).\n *\n * Codec-registry-unification project § Decision.\n */\nexport interface CodecDescriptor<P = void> {\n /** The codec ID this descriptor applies to (e.g. `pg/vector@1`, `pg/text@1`). */\n readonly codecId: string;\n /** Semantic traits for operator gating (e.g. equality, order, numeric). */\n readonly traits: readonly CodecTrait[];\n /** Database-native type names this codec handles (e.g. `['timestamptz']`). */\n readonly targetTypes: readonly string[];\n /** Optional family-specific metadata (e.g. SQL-side `db.sql.postgres.nativeType`). */\n readonly meta?: CodecMeta;\n /** Standard Schema validator for the factory's params. Validates JSON-sourced params at the contract boundary (PSL → IR; `contract.json` → runtime). For non-parameterized codecs (`P = void`), the schema validates `void`/`undefined` — the framework supplies no params at the call boundary. */\n readonly paramsSchema: StandardSchemaV1<P>;\n /** Whether this descriptor is parameterized — i.e. its `paramsSchema` is something other than the singleton `voidParamsSchema`. Consumers that need to gate column-aware dispatch read this directly rather than threading a free-floating `(codecId) => boolean` callback. */\n readonly isParameterized: boolean;\n /** Emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for given params (e.g. `Vector<1536>`). Optional; absent renderers cause the emitter to fall back to the codec's base output type. Non-parameterized codecs typically omit it. */\n readonly renderOutputType?: (params: P) => string | undefined;\n /** The curried higher-order codec. For non-parameterized codecs, the factory is constant — every call returns the same shared codec instance. For parameterized codecs, the factory is called once per `storage.types` instance (or once per inline-`typeParams` column), with `ctx` carrying the column set the resulting codec serves. */\n readonly factory: (params: P) => (ctx: CodecInstanceContext) => Codec;\n}\n\n/**\n * Variance-erased {@link CodecDescriptor} alias. `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly), so `CodecDescriptor<P>` does not extend `CodecDescriptor<unknown>` for specific `P`. Heterogeneous descriptor collections — e.g. `SqlStaticContributions.codecs:` returning a list that mixes parameterized and non-parameterized descriptors — type against this alias and narrow per codec id at the consumer.\n *\n * Codec-registry-unification spec § Decision: every codec resolves through one descriptor map; reads are non-branching.\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure for heterogeneous descriptor collections\nexport type AnyCodecDescriptor = CodecDescriptor<any>;\n\n/**\n * Abstract base class for concrete codec descriptors.\n *\n * Codec authors extend this class with their typed `TParams` and declare `codecId`, `traits`, `targetTypes`, `paramsSchema`, the curried `factory(params)`, and (optionally) `renderOutputType`.\n *\n * Implements the {@link CodecDescriptor} interface so a concrete subclass instance is directly usable wherever the framework expects a `CodecDescriptor<P>`.\n */\nexport abstract class CodecDescriptorImpl<TParams = void> implements CodecDescriptor<TParams> {\n abstract readonly codecId: string;\n abstract readonly traits: readonly CodecTrait[];\n abstract readonly targetTypes: readonly string[];\n readonly meta?: CodecMeta;\n\n abstract readonly paramsSchema: StandardSchemaV1<TParams>;\n\n /** Boolean derived from `paramsSchema`: `true` whenever the schema is not the singleton `voidParamsSchema`. */\n get isParameterized(): boolean {\n return this.paramsSchema !== voidParamsSchema;\n }\n\n /** Optional emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for the given params (e.g. `Vector<1536>`). Non-parameterized codecs typically omit it. */\n renderOutputType?(params: TParams): string | undefined;\n\n /**\n * Materialize a curried codec factory for the given params. Concrete subclasses override with a typed return type (e.g. `factory<N>(params: { length: N }): (ctx) => VectorCodec<N>`); per-codec helpers read the typed return at the *direct* call site, which is what preserves method-level generics. Type extraction (e.g. `ReturnType<D['factory']>`) widens method generics to their constraint — that's why the column-helper surface is per-codec, not polymorphic.\n */\n abstract factory(\n params: TParams,\n ): (ctx: CodecInstanceContext) => Codec<string, readonly CodecTrait[], unknown, unknown>;\n}\n","/**\n * `column()` packager + `ColumnSpec<R, P>` shape + `ColumnHelperFor<D>` variants for tying per-codec column helpers to their descriptor.\n *\n * `ColumnSpec<R, P>` extends {@link ColumnTypeDescriptor} so it remains a drop-in for contract authoring sites that consume `ColumnTypeDescriptor` shapes — both types live at the framework-components layer so the `extends` clause is real (no structural mirror).\n *\n * `column()` is a trivial, non-polymorphic packager. Generic over `R` (the codec instance type returned by the descriptor's curried factory) and `P` (the typeParams record). The framework does NOT try to infer `R` and `P` from a descriptor — that path is the variance trap. Per-codec helpers absorb the descriptor relationship instead and tie themselves to their descriptor via `satisfies ColumnHelperFor<D>` or `satisfies ColumnHelperForStrict<D>`.\n */\n\nimport type { CodecDescriptor } from './codec-descriptor';\nimport type { CodecInstanceContext } from './codec-types';\n\n/**\n * Authored column-type descriptor — the data shape an authoring site (PSL or TypeScript builders) attaches to a column to identify its codec and its native database type.\n *\n * Lives at the framework-components layer alongside the codec types so codec-author packages (e.g. column-spec / `column()` packagers) can extend it directly without crossing layer boundaries.\n *\n * @template TCodecId Narrowed codec id literal for sites that thread a specific codec id through the type system.\n */\nexport type ColumnTypeDescriptor<TCodecId extends string = string> = {\n readonly codecId: TCodecId;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown> | undefined;\n readonly typeRef?: string;\n};\n\n/**\n * Column spec carrying the codec factory closure alongside the {@link ColumnTypeDescriptor} fields. Codec authors return a `ColumnSpec` from per-codec column helpers; the runtime materializes the codec instance by calling `codecFactory(ctx)` once it knows the column's `CodecInstanceContext`.\n *\n * Extends {@link ColumnTypeDescriptor} so `ColumnSpec` instances flow directly into contract-authoring sites that consume the descriptor shape — no structural mirroring required.\n */\nexport interface ColumnSpec<R, P extends Record<string, unknown> | undefined>\n extends ColumnTypeDescriptor {\n readonly codecFactory: (ctx: CodecInstanceContext) => R;\n readonly typeParams: P;\n}\n\n/**\n * Trivial column packager. Per-codec helpers call this directly with the result of `descriptor.factory(params)` — direct method invocation binds the descriptor's method-level generic at the call site and the literal flows through `R`.\n *\n * `nativeType` is the column's database-native type spelling — the value the postgres adapter's migration planner, the SQL renderer's cast policy, and the contract's `meta.db.<family>.<target>.nativeType` slot read. Per-codec helpers pass the literal native-type string for their codec (e.g. `'text'`, `'int4'`, `'character varying'`); for codecs whose native-type spelling depends on parameters (none today; reserved for future shapes), the helper computes the rendered string before calling `column`. The framework does not derive the value from `codecId` — that mapping is target-specific and lives at the helper.\n */\nexport function column<R, P extends Record<string, unknown> | undefined>(\n codecFactory: (ctx: CodecInstanceContext) => R,\n codecId: string,\n typeParams: P,\n nativeType: string,\n): ColumnSpec<R, P> {\n return {\n codecFactory,\n codecId,\n typeParams,\n nativeType,\n };\n}\n\n/**\n * Coarse `satisfies` shape — checks the helper's typeParams record matches the descriptor's factory params. Catches \"wrong typeParams shape\" wiring mistakes; does NOT catch \"wrong descriptor's factory\" mistakes (the codec slot is left as `unknown`).\n *\n * Use when the codec's `ReturnType<factory>` is unstable (e.g. heavily overloaded factories where extraction widens too much).\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure — `CodecDescriptor<P>` is invariant in P, so concrete subclasses do not extend `CodecDescriptor<unknown>`; matches the existing `AnyCodecDescriptor` pattern\nexport type ColumnHelperFor<D extends CodecDescriptor<any>> = (\n // biome-ignore lint/suspicious/noExplicitAny: helper signature is the verification subject; satisfies clauses can't narrow this without circular inference\n ...args: any[]\n) => ColumnSpec<unknown, ColumnHelperParams<D>>;\n\n/**\n * Strict `satisfies` shape — also checks the helper's codec is at least the *base* codec instance type the descriptor's factory returns. `ReturnType<ReturnType<D['factory']>>` widens method generics to their constraint, so this only sanity-checks the wiring at the base type level. Literal preservation comes from the direct `descriptor.factory(...)` call inside the helper, not from `satisfies`.\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure — `CodecDescriptor<P>` is invariant in P, so concrete subclasses do not extend `CodecDescriptor<unknown>`; matches the existing `AnyCodecDescriptor` pattern\nexport type ColumnHelperForStrict<D extends CodecDescriptor<any>> = (\n // biome-ignore lint/suspicious/noExplicitAny: helper signature is the verification subject; satisfies clauses can't narrow this without circular inference\n ...args: any[]\n) => ColumnSpec<ReturnType<ReturnType<D['factory']>>, ColumnHelperParams<D>>;\n\n/**\n * Coerce a descriptor's `factory` first parameter into the typeParams shape `ColumnSpec` accepts. Non-parameterized descriptors (factory with no params, or `params: void`) collapse to `undefined`; parameterized descriptors keep the params record shape.\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure — see above\ntype ColumnHelperParams<D extends CodecDescriptor<any>> =\n Parameters<D['factory']>[0] extends Record<string, unknown>\n ? Parameters<D['factory']>[0]\n : undefined;\n"],"mappings":";;;;;;AA0DA,IAAsB,YAAtB,MAMA;CAK8B;;;;CAA5B,YAAY,YAAkD;EAAlC,KAAA,aAAA;CAAmC;CAE/D,IAAI,KAAS;EACX,OAAO,KAAK,WAAW;CACzB;AAMF;;;AC7BA,MAAa,mBAAgC;CAC3C,WAAW,KAAA;CACX,sBAAsB,KAAA;CACtB,eAAe,KAAA;CACf,2BAA2B,KAAA;AAC7B;;;;AAuBA,MAAa,mBAA2C,EACtD,aAAa;CACX,SAAS;CACT,QAAQ;CACR,WAAW,UACT,UAAU,KAAA,IACN,EAAE,OAAO,KAAA,EAAU,IACnB,EACE,QAAQ,CACN,EACE,SAAS,2EACX,CACF,EACF;AACR,EACF;;;;;;;;;;AC7BA,IAAsB,sBAAtB,MAA8F;CAI5F;;CAKA,IAAI,kBAA2B;EAC7B,OAAO,KAAK,iBAAiB;CAC/B;AAWF;;;;;;;;AC7CA,SAAgB,OACd,cACA,SACA,YACA,YACkB;CAClB,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"} | ||
| {"version":3,"file":"codec.mjs","names":[],"sources":["../src/shared/codec.ts","../src/shared/codec-types.ts","../src/shared/codec-descriptor.ts","../src/shared/column-spec.ts"],"sourcesContent":["/**\n * Codec interface (consumer surface) and abstract `CodecImpl` base (codec-author surface).\n *\n * Consumers depend on the {@link Codec} interface — it describes the runtime instance returned by a descriptor's curried factory and is what the framework threads through emit, validate, and execute paths.\n *\n * Codec authors `extend` the {@link CodecImpl} abstract class to declare a typed runtime codec instance. The class carries a variance-erased descriptor reference (`CodecDescriptor<any>`); `id` proxies through the descriptor so one source of truth governs both metadata reads and aliasing semantics (alias subclasses inherit the descriptor's id automatically).\n *\n * Class generic shape: `Id`, `TTraits`, `TWire`, `TInput`. Method generics on the codec subclass's own surface (e.g. arktype-json's schema generic, pgvector's dimension generic) flow through the subclass's constructor and propagate via the descriptor's typed `factory(params)` return at *direct* call sites.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport type { CodecDescriptor } from './codec-descriptor';\nimport type { CodecCallContext, CodecTrait } from './codec-types';\n\n/**\n * A codec is the contract between an application value and its on-wire and on-contract-disk representations.\n *\n * The author's mental model is two JS-side types — `TInput` (the application JS type) and `TWire` (the database driver wire format) — plus `JsonValue` for build-time contract artifacts. The codec translates `TInput` to `TWire` on writes and back on reads, and to/from `JsonValue` during contract emission and loading.\n *\n * Three representations participate:\n * - **Input** (`TInput`): the JS type at the application boundary.\n * - **Wire** (`TWire`): the format exchanged with the database driver.\n * - **JSON** (`JsonValue`): a JSON-safe form used in contract artifacts.\n *\n * The runtime instance carries only its `id` (the descriptor's `codecId`, set by the factory) and the four conversion methods. Static metadata (`traits`, `targetTypes`, `meta`) and the build-time `renderOutputType` renderer live on the {@link CodecDescriptor} keyed by `codecId` — the read-surface single source of truth. Consumers that need them resolve through `descriptorFor(codecId)`.\n *\n * Codec methods split into two groups:\n *\n * - **Query-time** methods (`encode`, `decode`) run per row/parameter at the IO boundary; they are required and Promise-returning. The per-family codec factory accepts sync or async author functions and lifts sync ones to Promise-shaped methods automatically.\n * - **Build-time** methods (`encodeJson`, `decodeJson`) run when the contract is serialized or loaded. They stay synchronous so contract validation and client construction are synchronous.\n *\n * Target-family codec interfaces extend this base; family-specific concerns (e.g. the SQL `column?` per-call context) layer on through the `CodecCallContext` extension pattern.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n> {\n /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). The factory sets this to the descriptor's `codecId`; consumers use it as a back-reference for descriptor lookups and for decode-error diagnostics. */\n readonly id: Id;\n /** Phantom carrier for the `TTraits` generic; type-only, undefined at runtime. Runtime traits live on {@link CodecDescriptor.traits}. Implemented as a string-key phantom (`__codecTraits`) rather than `unique symbol` so bundlers that split `.d.ts` chunks do not strand symbol identity on chunk-private paths (the same `TS2742` family that the public re-export of `CodecTypes` works around). */\n readonly __codecTraits?: TTraits;\n /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */\n encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;\n /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */\n decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;\n /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */\n encodeJson(value: TInput): JsonValue;\n /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `family.deserializeContract`. */\n decodeJson(json: JsonValue): TInput;\n}\n\n/**\n * Abstract base class for concrete codec implementations.\n *\n * Codec authors extend this class with their typed `Id`, `TTraits`, `TWire`, `TInput` and override `encode`/`decode` (and optionally `encodeJson`/`decodeJson`). The runtime instance carries only its `id` (proxied through the descriptor so alias subclasses inherit the descriptor's id automatically) and the conversion methods — static metadata lives on the {@link CodecDescriptor}.\n */\nexport abstract class CodecImpl<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n> implements Codec<Id, TTraits, TWire, TInput>\n{\n /**\n * Variance-erased descriptor reference. Concrete codec subclasses receive the typed descriptor in their own constructors and forward it via `super(descriptor)`; the variance erasure lives at this base because the abstract surface can't carry the concrete `TParams`.\n */\n // biome-ignore lint/suspicious/noExplicitAny: variance-erased descriptor reference; subclasses retain typed access via their own state\n constructor(public readonly descriptor: CodecDescriptor<any>) {}\n\n get id(): Id {\n return this.descriptor.codecId as Id;\n }\n\n abstract encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;\n abstract decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;\n abstract encodeJson(value: TInput): JsonValue;\n abstract decodeJson(json: JsonValue): TInput;\n}\n","import type { JsonValue } from '@prisma-next/contract/types';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Codec } from './codec';\n\nexport type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';\n\n/**\n * Serializable codec identity carried by every codec-bearing AST node.\n *\n * `(codecId, typeParams?)` is the single fact the runtime needs to materialize a codec via `descriptorFor(codecId).factory(typeParams)(ctx)`. The pair is content-keyed: two refs with the same `codecId` and structurally equal `typeParams` (regardless of object key ordering) resolve to the same memoized {@link Codec} instance.\n *\n * `typeParams` is `JsonValue`-constrained so the ref survives JSON serialization (relevant for AST-embedded migration ops). Non-parameterized codecs leave `typeParams` undefined; the descriptor's `paramsSchema` validates the value at the JSON boundary.\n *\n * Family-agnostic by design — both SQL and Mongo AST nodes carry `codec: CodecRef | undefined`, and the resolver is the only dispatch path that survives serialization.\n */\nexport interface CodecRef {\n readonly codecId: string;\n readonly typeParams?: JsonValue;\n}\n\n/**\n * Per-call context the runtime threads to every `codec.encode` / `codec.decode` invocation for a single `runtime.execute()` call.\n *\n * The framework-level shape is family-agnostic and carries one field:\n *\n * - `signal?: AbortSignal` — per-query cancellation. The runtime returns a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors who forward `signal` to their underlying SDK get true cancellation of in-flight network calls.\n *\n * Family layers extend this base with their own shape-of-call metadata: the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext` (see `@prisma-next/sql-relational-core`). Mongo currently uses this framework type unchanged. Column metadata is intentionally **not** on the framework type — it is a SQL-family concept rooted in SQL's `(table, column)` addressing model and would not generalise to other families.\n *\n * The interface is named explicitly (not inlined) so future framework fields and family extensions can land additively without breaking codec author signatures.\n */\nexport interface CodecCallContext {\n readonly signal?: AbortSignal;\n}\n\n/**\n * Codec-id-keyed read surface threaded into emit and authoring paths.\n *\n * - `get(id)` returns a representative {@link Codec} instance for the codec id (used by `family.deserializeContract` for `decodeJson` of literal column defaults). For parameterized codecs whose factory requires concrete params, this may return `undefined` — use `CodecRegistry.forCodecRef` instead.\n * - `targetTypesFor(id)` exposes the codec-id-keyed `targetTypes` metadata the runtime instance no longer carries (TML-2357). Returns the same array `CodecDescriptor.targetTypes` would; for Mongo (whose registration doesn't yet resolve through the unified descriptor map — TML-2324) the family-side assembly populates this directly from the contributor's codec metadata.\n * - `metaFor(id)` exposes the codec-id-keyed `meta` (e.g. SQL-side `db.sql.postgres.nativeType`) the runtime instance no longer carries.\n * - `renderOutputTypeFor(id, params)` exposes the codec-id-keyed `renderOutputType` renderer the runtime instance no longer carries. Returns `undefined` when the codec doesn't render a custom type or when the codec id is unknown.\n */\nexport interface CodecLookup {\n get(id: string): Codec | undefined;\n targetTypesFor(id: string): readonly string[] | undefined;\n metaFor(id: string): CodecMeta | undefined;\n renderOutputTypeFor(id: string, params: Record<string, unknown>): string | undefined;\n}\n\n/**\n * Full codec registry — the read surface of {@link CodecLookup} plus codec resolution by ref or\n * column coordinate. Built once by `extractCodecLookup` and passed by reference to adapters and\n * other consumers that need to materialise codecs at runtime.\n *\n * - `forCodecRef(ref)` materialises a codec from a {@link CodecRef}. Throws\n * `RUNTIME.CODEC_DESCRIPTOR_MISSING` for unknown ids and `RUNTIME.TYPE_PARAMS_INVALID` on param\n * schema rejection.\n * - `forColumn(namespaceId, table, column)` returns the codec for a specific column coordinate, or\n * `undefined` when no column-to-codec mapping is present. This registry is contract-free so it\n * always returns `undefined` — the method exists so the object structurally satisfies the SQL\n * `ContractCodecRegistry` interface.\n */\nexport interface CodecRegistry extends CodecLookup {\n forCodecRef(ref: CodecRef): Codec;\n forColumn(namespaceId: string, table: string, column: string): Codec | undefined;\n}\n\nexport const emptyCodecLookup: CodecLookup = {\n get: () => undefined,\n targetTypesFor: () => undefined,\n metaFor: () => undefined,\n renderOutputTypeFor: () => undefined,\n};\n\n/**\n * Family-agnostic per-instance context supplied by the framework when applying a higher-order codec factory. Allows stateful codecs (e.g. column-scoped encryption) to derive per-instance state from the materialization site.\n *\n * - `name` — the family-agnostic instance identity. For SQL, the runtime populates this as the `storage.types` instance name (e.g. `Embedding1536`) for typeRef-shaped columns, an inline-column sentinel (`<col:Document.embedding>`) for inline-`typeParams` columns, a shared codec-id sentinel (`<codec:pg/text@1>`) for non-parameterized codec ids, or the canonical cache key (`<codecId>:<canonicalizeJson(typeParams)>`) for ad-hoc refs the contract walk did not pre-populate. Other families pick the analogous identity for their materialization sites.\n *\n * Family-specific extensions (e.g. {@link import('@prisma-next/sql-relational-core/ast').SqlCodecInstanceContext} in the SQL layer) augment this base with domain-shaped column-set metadata. Codec authors target the base when they don't read family-specific metadata; they target the family extension when they do.\n */\nexport interface CodecInstanceContext {\n readonly name: string;\n}\n\n/**\n * Family-agnostic codec metadata. Family-specific extensions augment the base `db.<family>.<target>` block with native-type information; the base shape is an empty object so non-relational codecs can carry no metadata.\n */\nexport interface CodecMeta {\n readonly db?: Record<string, unknown>;\n}\n\n/**\n * Standard Schema validator for `void` params. Accepts only `undefined` (or absent input); rejects any other value so a contract that tries to thread `typeParams` through a non-parameterized codec id fails fast at the JSON boundary instead of silently coercing the value away. Used by the framework-supplied non-parameterized descriptor synthesizer.\n */\nexport const voidParamsSchema: StandardSchemaV1<void> = {\n '~standard': {\n version: 1,\n vendor: 'prisma-next',\n validate: (input) =>\n input === undefined\n ? { value: undefined }\n : {\n issues: [\n {\n message: 'unexpected typeParams for non-parameterized codec (void params expected)',\n },\n ],\n },\n },\n};\n","/**\n * Codec descriptor interface (consumer surface) and abstract `CodecDescriptorImpl` base (codec-author surface).\n *\n * Consumers depend on the {@link CodecDescriptor} interface — it is the codec-id-keyed source of truth for static metadata (`traits`, `targetTypes`, `meta`) and registration concerns (`paramsSchema`; optional `renderOutputType`). The runtime `Codec` instance returned by `factory(params)(ctx)` carries only the conversion behavior.\n *\n * Codec authors `extend` the {@link CodecDescriptorImpl} abstract class to declare their codec id, traits, target types, params schema, the `factory(params)` that materializes a typed `Codec<...>`, and (optionally) a `renderOutputType(params)` for the emit path.\n *\n * The factory's method-level generic is the load-bearing piece for literal preservation: per-codec column helpers invoke `descriptor.factory(...)` *directly*, and the direct call binds the generic at its call site. Type extraction (`ReturnType<D['factory']>`, structural matching) widens method generics to their constraint — that's why the column-helper surface is per-codec, not polymorphic.\n */\n\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Codec } from './codec';\nimport {\n type CodecInstanceContext,\n type CodecMeta,\n type CodecTrait,\n voidParamsSchema,\n} from './codec-types';\n\n/**\n * Unified codec descriptor. Every codec in the framework registers through this shape — non-parameterized codecs use `P = void` and a constant factory that returns the same shared codec instance for every column; parameterized codecs use a non-empty `P` and a curried higher-order factory that returns a per-instance codec.\n *\n * The descriptor is the codec-id-keyed source of truth for static metadata (`traits`, `targetTypes`, `meta`) and registration concerns (`paramsSchema` for JSON-boundary validation; optional `renderOutputType` for the `contract.d.ts` emit path). The runtime `Codec` instance returned by `factory(params)(ctx)` carries only the conversion behavior.\n *\n * Whether a codec id \"is parameterized\" stops being a registration-time distinction — it's a property of `P` on the descriptor. The descriptor map indexes every descriptor by `codecId`; both `descriptorFor(codecId)` and `forColumn(table, column)` resolve through the same map without branching on parameterization.\n *\n * @template P - The shape of the params accepted by the factory (`void` for non-parameterized codecs; a record like `{ length: number }` for parameterized codecs).\n *\n * Codec-registry-unification project § Decision.\n */\nexport interface CodecDescriptor<P = void> {\n /** The codec ID this descriptor applies to (e.g. `pg/vector@1`, `pg/text@1`). */\n readonly codecId: string;\n /** Semantic traits for operator gating (e.g. equality, order, numeric). */\n readonly traits: readonly CodecTrait[];\n /** Database-native type names this codec handles (e.g. `['timestamptz']`). */\n readonly targetTypes: readonly string[];\n /** Optional family-specific metadata (e.g. SQL-side `db.sql.postgres.nativeType`). */\n readonly meta?: CodecMeta;\n /** Standard Schema validator for the factory's params. Validates JSON-sourced params at the contract boundary (PSL → IR; `contract.json` → runtime). For non-parameterized codecs (`P = void`), the schema validates `void`/`undefined` — the framework supplies no params at the call boundary. */\n readonly paramsSchema: StandardSchemaV1<P>;\n /** Whether this descriptor is parameterized — i.e. its `paramsSchema` is something other than the singleton `voidParamsSchema`. Consumers that need to gate column-aware dispatch read this directly rather than threading a free-floating `(codecId) => boolean` callback. */\n readonly isParameterized: boolean;\n /** Emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for given params (e.g. `Vector<1536>`). Optional; absent renderers cause the emitter to fall back to the codec's base output type. Non-parameterized codecs typically omit it. */\n readonly renderOutputType?: (params: P) => string | undefined;\n /** The curried higher-order codec. For non-parameterized codecs, the factory is constant — every call returns the same shared codec instance. For parameterized codecs, the factory is called once per `storage.types` instance (or once per inline-`typeParams` column), with `ctx` carrying the column set the resulting codec serves. */\n readonly factory: (params: P) => (ctx: CodecInstanceContext) => Codec;\n}\n\n/**\n * Variance-erased {@link CodecDescriptor} alias. `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly), so `CodecDescriptor<P>` does not extend `CodecDescriptor<unknown>` for specific `P`. Heterogeneous descriptor collections — e.g. `SqlStaticContributions.codecs:` returning a list that mixes parameterized and non-parameterized descriptors — type against this alias and narrow per codec id at the consumer.\n *\n * Codec-registry-unification spec § Decision: every codec resolves through one descriptor map; reads are non-branching.\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure for heterogeneous descriptor collections\nexport type AnyCodecDescriptor = CodecDescriptor<any>;\n\n/**\n * Abstract base class for concrete codec descriptors.\n *\n * Codec authors extend this class with their typed `TParams` and declare `codecId`, `traits`, `targetTypes`, `paramsSchema`, the curried `factory(params)`, and (optionally) `renderOutputType`.\n *\n * Implements the {@link CodecDescriptor} interface so a concrete subclass instance is directly usable wherever the framework expects a `CodecDescriptor<P>`.\n */\nexport abstract class CodecDescriptorImpl<TParams = void> implements CodecDescriptor<TParams> {\n abstract readonly codecId: string;\n abstract readonly traits: readonly CodecTrait[];\n abstract readonly targetTypes: readonly string[];\n readonly meta?: CodecMeta;\n\n abstract readonly paramsSchema: StandardSchemaV1<TParams>;\n\n /** Boolean derived from `paramsSchema`: `true` whenever the schema is not the singleton `voidParamsSchema`. */\n get isParameterized(): boolean {\n return this.paramsSchema !== voidParamsSchema;\n }\n\n /** Optional emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for the given params (e.g. `Vector<1536>`). Non-parameterized codecs typically omit it. */\n renderOutputType?(params: TParams): string | undefined;\n\n /**\n * Materialize a curried codec factory for the given params. Concrete subclasses override with a typed return type (e.g. `factory<N>(params: { length: N }): (ctx) => VectorCodec<N>`); per-codec helpers read the typed return at the *direct* call site, which is what preserves method-level generics. Type extraction (e.g. `ReturnType<D['factory']>`) widens method generics to their constraint — that's why the column-helper surface is per-codec, not polymorphic.\n */\n abstract factory(\n params: TParams,\n ): (ctx: CodecInstanceContext) => Codec<string, readonly CodecTrait[], unknown, unknown>;\n}\n","/**\n * `column()` packager + `ColumnSpec<R, P>` shape + `ColumnHelperFor<D>` variants for tying per-codec column helpers to their descriptor.\n *\n * `ColumnSpec<R, P>` extends {@link ColumnTypeDescriptor} so it remains a drop-in for contract authoring sites that consume `ColumnTypeDescriptor` shapes — both types live at the framework-components layer so the `extends` clause is real (no structural mirror).\n *\n * `column()` is a trivial, non-polymorphic packager. Generic over `R` (the codec instance type returned by the descriptor's curried factory) and `P` (the typeParams record). The framework does NOT try to infer `R` and `P` from a descriptor — that path is the variance trap. Per-codec helpers absorb the descriptor relationship instead and tie themselves to their descriptor via `satisfies ColumnHelperFor<D>` or `satisfies ColumnHelperForStrict<D>`.\n */\n\nimport type { CodecDescriptor } from './codec-descriptor';\nimport type { CodecInstanceContext } from './codec-types';\n\n/**\n * Authored column-type descriptor — the data shape an authoring site (PSL or TypeScript builders) attaches to a column to identify its codec and its native database type.\n *\n * Lives at the framework-components layer alongside the codec types so codec-author packages (e.g. column-spec / `column()` packagers) can extend it directly without crossing layer boundaries.\n *\n * @template TCodecId Narrowed codec id literal for sites that thread a specific codec id through the type system.\n */\nexport type ColumnTypeDescriptor<TCodecId extends string = string> = {\n readonly codecId: TCodecId;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown> | undefined;\n readonly typeRef?: string;\n};\n\n/**\n * Column spec carrying the codec factory closure alongside the {@link ColumnTypeDescriptor} fields. Codec authors return a `ColumnSpec` from per-codec column helpers; the runtime materializes the codec instance by calling `codecFactory(ctx)` once it knows the column's `CodecInstanceContext`.\n *\n * Extends {@link ColumnTypeDescriptor} so `ColumnSpec` instances flow directly into contract-authoring sites that consume the descriptor shape — no structural mirroring required.\n */\nexport interface ColumnSpec<R, P extends Record<string, unknown> | undefined>\n extends ColumnTypeDescriptor {\n readonly codecFactory: (ctx: CodecInstanceContext) => R;\n readonly typeParams: P;\n}\n\n/**\n * Trivial column packager. Per-codec helpers call this directly with the result of `descriptor.factory(params)` — direct method invocation binds the descriptor's method-level generic at the call site and the literal flows through `R`.\n *\n * `nativeType` is the column's database-native type spelling — the value the postgres adapter's migration planner, the SQL renderer's cast policy, and the contract's `meta.db.<family>.<target>.nativeType` slot read. Per-codec helpers pass the literal native-type string for their codec (e.g. `'text'`, `'int4'`, `'character varying'`); for codecs whose native-type spelling depends on parameters (none today; reserved for future shapes), the helper computes the rendered string before calling `column`. The framework does not derive the value from `codecId` — that mapping is target-specific and lives at the helper.\n */\nexport function column<R, P extends Record<string, unknown> | undefined>(\n codecFactory: (ctx: CodecInstanceContext) => R,\n codecId: string,\n typeParams: P,\n nativeType: string,\n): ColumnSpec<R, P> {\n return {\n codecFactory,\n codecId,\n typeParams,\n nativeType,\n };\n}\n\n/**\n * Coarse `satisfies` shape — checks the helper's typeParams record matches the descriptor's factory params. Catches \"wrong typeParams shape\" wiring mistakes; does NOT catch \"wrong descriptor's factory\" mistakes (the codec slot is left as `unknown`).\n *\n * Use when the codec's `ReturnType<factory>` is unstable (e.g. heavily overloaded factories where extraction widens too much).\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure — `CodecDescriptor<P>` is invariant in P, so concrete subclasses do not extend `CodecDescriptor<unknown>`; matches the existing `AnyCodecDescriptor` pattern\nexport type ColumnHelperFor<D extends CodecDescriptor<any>> = (\n // biome-ignore lint/suspicious/noExplicitAny: helper signature is the verification subject; satisfies clauses can't narrow this without circular inference\n ...args: any[]\n) => ColumnSpec<unknown, ColumnHelperParams<D>>;\n\n/**\n * Strict `satisfies` shape — also checks the helper's codec is at least the *base* codec instance type the descriptor's factory returns. `ReturnType<ReturnType<D['factory']>>` widens method generics to their constraint, so this only sanity-checks the wiring at the base type level. Literal preservation comes from the direct `descriptor.factory(...)` call inside the helper, not from `satisfies`.\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure — `CodecDescriptor<P>` is invariant in P, so concrete subclasses do not extend `CodecDescriptor<unknown>`; matches the existing `AnyCodecDescriptor` pattern\nexport type ColumnHelperForStrict<D extends CodecDescriptor<any>> = (\n // biome-ignore lint/suspicious/noExplicitAny: helper signature is the verification subject; satisfies clauses can't narrow this without circular inference\n ...args: any[]\n) => ColumnSpec<ReturnType<ReturnType<D['factory']>>, ColumnHelperParams<D>>;\n\n/**\n * Coerce a descriptor's `factory` first parameter into the typeParams shape `ColumnSpec` accepts. Non-parameterized descriptors (factory with no params, or `params: void`) collapse to `undefined`; parameterized descriptors keep the params record shape.\n */\n// biome-ignore lint/suspicious/noExplicitAny: variance erasure — see above\ntype ColumnHelperParams<D extends CodecDescriptor<any>> =\n Parameters<D['factory']>[0] extends Record<string, unknown>\n ? Parameters<D['factory']>[0]\n : undefined;\n"],"mappings":";;;;;;;AA0DA,IAAsB,YAAtB,MAMA;CAK8B;;;;CAA5B,YAAY,YAAkD;EAAlC,KAAA,aAAA;CAAmC;CAE/D,IAAI,KAAS;EACX,OAAO,KAAK,WAAW;CACzB;AAMF;;;ACXA,MAAa,mBAAgC;CAC3C,WAAW,KAAA;CACX,sBAAsB,KAAA;CACtB,eAAe,KAAA;CACf,2BAA2B,KAAA;AAC7B;;;;AAuBA,MAAa,mBAA2C,EACtD,aAAa;CACX,SAAS;CACT,QAAQ;CACR,WAAW,UACT,UAAU,KAAA,IACN,EAAE,OAAO,KAAA,EAAU,IACnB,EACE,QAAQ,CACN,EACE,SAAS,2EACX,CACF,EACF;AACR,EACF;;;;;;;;;;AC/CA,IAAsB,sBAAtB,MAA8F;CAI5F;;CAKA,IAAI,kBAA2B;EAC7B,OAAO,KAAK,iBAAiB;CAC/B;AAWF;;;;;;;;AC7CA,SAAgB,OACd,cACA,SACA,YACA,YACkB;CAClB,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"} |
@@ -1,2 +0,2 @@ | ||
| 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-BLiwDP1D.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-B-ABhSOs.mjs"; | ||
@@ -3,0 +3,0 @@ //#region src/shared/capabilities.d.ts |
@@ -1,7 +0,7 @@ | ||
| import { r as CodecLookup } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { d as AuthoringFieldNamespace, h as AuthoringPslBlockDescriptorNamespace, i as AuthoringContributions, l as AuthoringEntityTypeNamespace, y as AuthoringTypeNamespace } from "./framework-authoring-qyokbMY7.mjs"; | ||
| import { A as LoweredDefaultResult, C as ControlMutationDefaultEntry, D as DefaultFunctionLoweringHandler, E as DefaultFunctionLoweringContext, F as SourceSpan, M as MutationDefaultGeneratorDescriptor, N as ParsedDefaultFunctionCall, O as DefaultFunctionRegistry, P as SourceDiagnostic, T as ControlMutationDefaults, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, j as LoweredDefaultValue, k as DefaultFunctionRegistryEntry, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, v as TargetBoundComponentDescriptor, w as ControlMutationDefaultRegistry, y as TargetDescriptor } from "./framework-components-BLiwDP1D.mjs"; | ||
| import { o as CodecRegistry } from "./codec-types-29q8imKF.mjs"; | ||
| import { d as AuthoringFieldNamespace, h as AuthoringPslBlockDescriptorNamespace, i as AuthoringContributions, l as AuthoringEntityTypeNamespace, y as AuthoringTypeNamespace } from "./framework-authoring-BXiebZGn.mjs"; | ||
| import { A as LoweredDefaultResult, C as ControlMutationDefaultEntry, D as DefaultFunctionLoweringHandler, E as DefaultFunctionLoweringContext, F as SourceSpan, M as MutationDefaultGeneratorDescriptor, N as ParsedDefaultFunctionCall, O as DefaultFunctionRegistry, P as SourceDiagnostic, T as ControlMutationDefaults, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, j as LoweredDefaultValue, k as DefaultFunctionRegistryEntry, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, v as TargetBoundComponentDescriptor, w as ControlMutationDefaultRegistry, y as TargetDescriptor } from "./framework-components-B-ABhSOs.mjs"; | ||
| import { t as TypesImportSpec } from "./types-import-spec-DRKzrJ20.mjs"; | ||
| import { t as EmissionSpi } from "./emission-types-vfpSTe63.mjs"; | ||
| import { m as PslDocumentAst } from "./psl-ast-DjFPjnlM.mjs"; | ||
| import { m as PslDocumentAst } from "./psl-ast-CHgjnZ3h.mjs"; | ||
| import { Contract, ContractMarkerRecord, ControlPolicy, LedgerEntryRecord } from "@prisma-next/contract/types"; | ||
@@ -349,3 +349,3 @@ import { ImportRequirement, ImportRequirement as ImportRequirement$1 } from "@prisma-next/ts-render"; | ||
| readonly extensionIds: ReadonlyArray<string>; | ||
| readonly codecLookup: CodecLookup; | ||
| readonly codecLookup: CodecRegistry; | ||
| readonly authoringContributions: AssembledAuthoringContributions; | ||
@@ -391,3 +391,3 @@ readonly scalarTypeDescriptors: ReadonlyMap<string, string>; | ||
| id: string; | ||
| }, 'types' | 'id'>>): CodecLookup; | ||
| }, 'types' | 'id'>>): CodecRegistry; | ||
| interface DependencyDeclaringDescriptor { | ||
@@ -394,0 +394,0 @@ readonly id: string; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/contract-serializer.ts","../src/control/control-result-types.ts","../src/control/control-instances.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-migration-types.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts","../src/control/control-spaces.ts","../src/control/schema-verifier.ts","../src/control/verifier-disposition.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;UAAiB,kBAAA;EAuBa;;;;;;;;;;;EAX5B,mBAAA,WAA8B,SAAA,GAAY,SAAA,EAAW,IAAA,YAAgB,CAAA;EAAA;;;;;;;;;EAWrE,iBAAA,CAAkB,QAAA,EAAU,SAAA,GAAY,UAAA;EAkBN;;;;AC5DpC;;;ED4DoC,SATzB,mBAAA,GAAsB,sBAAA;ECnDM;AACvC;;;;AAAsC;AACtC;EAFuC,SD4D5B,WAAA,GAAc,WAAA;AAAA;;;cC5DZ,0BAAA;AAAA,cACA,yBAAA;AAAA,cACA,2BAAA;AAAA,cACA,0BAAA;AAAA,UAEI,gBAAA;EAAA,SACN,YAAA;EAAA,SACA,UAAA;EAAA,SACA,IAAA,GAAO,QAAQ,CAAC,MAAA;AAAA;AAAA,UAGV,oBAAA;EAAA,SACN,EAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;IAAA,SACE,WAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,MAAA;IAAA,SACE,WAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,MAAA;IAAA,SACE,QAAA;IAAA,SACA,MAAA;EAAA;EAAA,SAEF,aAA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uC;UQqDtB,gBAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA,EAAU,iBAAA;EAAA,SACV,GAAA,WAAc,sBAAsB;AAAA;ARtD/C;;;;AAAwC;AACxC;;;;AAAuC;AAEvC;;;;;;;AAHA,UQ0EiB,aAAA,mBAAgC,QAAA,GAAW,QAAA;EAAA,SACjD,YAAA,EAAc,SAAA;EAAA,SACd,UAAA,WAAqB,gBAAA;EAAA,SACrB,OAAA,EAAS,oBAAA;AAAA;;;;;;;;;;;;;;;AT5DpB;;;;;;;;;;;UUMiB,cAAA;EACf,YAAA,CAAa,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,IAAW,kBAAA;AAAA;;;;;;;UASjD,mBAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,MAAA,EAAQ,OAAO;AAAA;;;;;AVuBU;;;UUbnB,kBAAA;EAAA,SACN,EAAA;EAAA,SACA,MAAA,WAAiB,WAAW;AAAA;;;KC9C3B,kBAAA,GAAqB,sBAAsB;AAAA,KAE3C,eAAA,GAAkB,kBAAkB;;;;;;;;;;AXchD;;;;;;;KWIY,qBAAA;;;;;;;;;;iBAiBI,sBAAA,CACd,aAAA,EAAe,aAAA,EACf,QAAA,EAAU,qBAAA,GACT,eAAA"} | ||
| {"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/contract-serializer.ts","../src/control/control-result-types.ts","../src/control/control-instances.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-migration-types.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts","../src/control/control-spaces.ts","../src/control/schema-verifier.ts","../src/control/verifier-disposition.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;UAAiB,kBAAA;EAuBa;;;;;;;;;;;EAX5B,mBAAA,WAA8B,SAAA,GAAY,SAAA,EAAW,IAAA,YAAgB,CAAA;EAAA;;;;;;;;;EAWrE,iBAAA,CAAkB,QAAA,EA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GAAkB,kBAAkB;;;;;;;;;;AXchD;;;;;;;KWIY,qBAAA;;;;;;;;;;iBAiBI,sBAAA,CACd,aAAA,EAAe,aAAA,EACf,QAAA,EAAU,qBAAA,GACT,eAAA"} |
+10
-0
@@ -0,1 +1,3 @@ | ||
| import { n as runtimeError } from "./runtime-error-B2gWOtgH.mjs"; | ||
| import { t as materializeCodec } from "./resolve-codec-DR7uyr_c.mjs"; | ||
| import { c as isAuthoringFieldPresetDescriptor, d as mergeAuthoringNamespaces, l as isAuthoringPslBlockDescriptor, s as isAuthoringEntityTypeDescriptor, t as assertNoCrossRegistryCollisions, u as isAuthoringTypeConstructorDescriptor } from "./framework-authoring-Dv5F3EFC.mjs"; | ||
@@ -170,2 +172,3 @@ import { blindCast } from "@prisma-next/utils/casts"; | ||
| const byId = /* @__PURE__ */ new Map(); | ||
| const descriptorsById = /* @__PURE__ */ new Map(); | ||
| const targetTypesById = /* @__PURE__ */ new Map(); | ||
@@ -187,2 +190,3 @@ const metaById = /* @__PURE__ */ new Map(); | ||
| owners.set(codecDescriptor.codecId, descriptorId); | ||
| descriptorsById.set(codecDescriptor.codecId, codecDescriptor); | ||
| if (Array.isArray(codecDescriptor.targetTypes)) targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes); | ||
@@ -203,2 +207,8 @@ if (codecDescriptor.meta !== void 0) metaById.set(codecDescriptor.codecId, codecDescriptor.meta); | ||
| get: (id) => byId.get(id), | ||
| forCodecRef(ref) { | ||
| const d = descriptorsById.get(ref.codecId); | ||
| if (d === void 0) throw runtimeError("RUNTIME.CODEC_DESCRIPTOR_MISSING", `No codec descriptor registered for codecId '${ref.codecId}'.`, { codecId: ref.codecId }); | ||
| return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` }); | ||
| }, | ||
| forColumn: () => void 0, | ||
| targetTypesFor: (id) => targetTypesById.get(id), | ||
@@ -205,0 +215,0 @@ metaFor: (id) => metaById.get(id), |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"control.mjs","names":[],"sources":["../src/control/control-capabilities.ts","../src/control/control-result-types.ts","../src/control/control-schema-view.ts","../src/control/control-spaces.ts","../src/control/control-stack.ts","../src/control/verifier-disposition.ts"],"sourcesContent":["import type { ControlTargetDescriptor } from './control-descriptors';\nimport type { ControlFamilyInstance } from './control-instances';\nimport type { MigrationPlanOperation, TargetMigrationsCapability } from './control-migration-types';\nimport type { OperationPreview } from './control-operation-preview';\nimport type { CoreSchemaView } from './control-schema-view';\nimport type { PslDocumentAst } from './psl-ast';\n\nexport interface MigratableTargetDescriptor<\n TFamilyId extends string,\n TTargetId extends string,\n TFamilyInstance extends ControlFamilyInstance<TFamilyId, unknown> = ControlFamilyInstance<\n TFamilyId,\n unknown\n >,\n> extends ControlTargetDescriptor<TFamilyId, TTargetId> {\n readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>;\n}\n\nexport function hasMigrations<TFamilyId extends string, TTargetId extends string>(\n target: ControlTargetDescriptor<TFamilyId, TTargetId>,\n): target is MigratableTargetDescriptor<TFamilyId, TTargetId> {\n return 'migrations' in target && !!(target as Record<string, unknown>)['migrations'];\n}\n\nexport interface SchemaViewCapable<TSchemaIR = unknown> {\n toSchemaView(schema: TSchemaIR): CoreSchemaView;\n}\n\nexport function hasSchemaView<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & SchemaViewCapable<TSchemaIR> {\n return (\n 'toSchemaView' in instance &&\n typeof (instance as Record<string, unknown>)['toSchemaView'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can infer a PSL contract AST from its\n * opaque introspected schema IR. Consumed by `prisma-next contract infer`.\n */\nexport interface PslContractInferCapable<TSchemaIR = unknown> {\n inferPslContract(schemaIR: TSchemaIR): PslDocumentAst;\n}\n\nexport function hasPslContractInfer<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & PslContractInferCapable<TSchemaIR> {\n return (\n 'inferPslContract' in instance &&\n typeof (instance as Record<string, unknown>)['inferPslContract'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can render a textual preview of migration\n * operations for the CLI's \"DDL preview\" output. SQL families emit\n * `language: 'sql'` statements; Mongo families emit `language: 'mongodb-shell'`.\n */\nexport interface OperationPreviewCapable {\n toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;\n}\n\nexport function hasOperationPreview<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & OperationPreviewCapable {\n return (\n 'toOperationPreview' in instance &&\n typeof (instance as Record<string, unknown>)['toOperationPreview'] === 'function'\n );\n}\n","export const VERIFY_CODE_MARKER_MISSING = 'PN-RUN-3001';\nexport const VERIFY_CODE_HASH_MISMATCH = 'PN-RUN-3002';\nexport const VERIFY_CODE_TARGET_MISMATCH = 'PN-RUN-3003';\nexport const VERIFY_CODE_SCHEMA_FAILURE = 'PN-RUN-3010';\n\nexport interface OperationContext {\n readonly contractPath?: string;\n readonly configPath?: string;\n readonly meta?: Readonly<Record<string, unknown>>;\n}\n\nexport interface VerifyDatabaseResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly marker?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly missingCodecs?: readonly string[];\n readonly codecCoverageSkipped?: boolean;\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface BaseSchemaIssue {\n readonly kind:\n | 'missing_schema'\n | 'missing_table'\n | 'missing_column'\n | 'extra_table'\n | 'extra_column'\n | 'extra_primary_key'\n | 'extra_foreign_key'\n | 'extra_unique_constraint'\n | 'extra_index'\n | 'extra_validator'\n | 'type_mismatch'\n | 'type_missing'\n | 'type_values_mismatch'\n | 'nullability_mismatch'\n | 'primary_key_mismatch'\n | 'foreign_key_mismatch'\n | 'unique_constraint_mismatch'\n | 'index_mismatch'\n | 'default_missing'\n | 'default_mismatch'\n | 'extra_default'\n | 'check_missing'\n | 'check_removed'\n | 'check_mismatch';\n readonly table?: string;\n /**\n * Namespace coordinate of the issue's subject (e.g. the schema a SQL\n * table lives in). Populated by family verifiers that have the\n * coordinate in scope when constructing the issue; absent for issues\n * whose family has no namespace concept (e.g. Mongo collections) or\n * whose subject isn't in any contract namespace (e.g. an extra-table\n * issue raised for a table that exists in the live DB but not in the\n * contract).\n *\n * Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup. A finer-grained\n * structural split between framework-shared and family-specific issue\n * fields is tracked under a follow-up ticket.\n */\n readonly namespaceId?: string;\n readonly column?: string;\n readonly indexOrConstraint?: string;\n readonly typeName?: string;\n readonly expected?: string;\n readonly actual?: string;\n readonly message: string;\n}\n\nexport interface EnumValuesChangedIssue {\n readonly kind: 'enum_values_changed';\n /**\n * Namespace coordinate of the enum type that changed values. Populated by\n * family verifiers that have the coordinate in scope when constructing the\n * issue. Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup.\n */\n readonly namespaceId: string;\n readonly typeName: string;\n readonly addedValues: readonly string[];\n readonly removedValues: readonly string[];\n readonly message: string;\n}\n\nexport type SchemaIssue = BaseSchemaIssue | EnumValuesChangedIssue;\n\nexport interface SchemaVerificationNode {\n readonly status: 'pass' | 'warn' | 'fail';\n readonly kind: string;\n readonly name: string;\n readonly contractPath: string;\n readonly code: string;\n readonly message: string;\n readonly expected: unknown;\n readonly actual: unknown;\n readonly children: readonly SchemaVerificationNode[];\n}\n\nexport interface VerifyDatabaseSchemaResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly schema: {\n readonly issues: readonly SchemaIssue[];\n readonly root: SchemaVerificationNode;\n readonly counts: {\n readonly pass: number;\n readonly warn: number;\n readonly fail: number;\n readonly totalNodes: number;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath?: string;\n readonly strict: boolean;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface EmitContractResult {\n readonly contractJson: string;\n readonly contractDts: string;\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n}\n\nexport interface IntrospectSchemaResult<TSchemaIR> {\n readonly ok: true;\n readonly summary: string;\n readonly target: {\n readonly familyId: string;\n readonly id: string;\n };\n readonly schema: TSchemaIR;\n readonly meta?: {\n readonly configPath?: string;\n readonly dbUrl?: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface SignDatabaseResult {\n readonly ok: boolean;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly marker: {\n readonly created: boolean;\n readonly updated: boolean;\n readonly previous?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n","/**\n * Core schema view types for family-agnostic schema visualization.\n *\n * These types provide a minimal, generic, tree-shaped representation of schemas\n * across families, designed for CLI visualization and lightweight tooling.\n *\n * Families can optionally project their family-specific Schema IR into this\n * core view via the `toSchemaView` method on `FamilyInstance`.\n */\n\nexport type SchemaViewNodeKind =\n | 'root'\n | 'namespace'\n | 'collection'\n | 'entity'\n | 'field'\n | 'index'\n | 'dependency';\n\nexport interface SchemaTreeVisitor<R> {\n visit(node: SchemaTreeNode): R;\n}\n\nexport interface SchemaTreeNodeOptions {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n}\n\nexport class SchemaTreeNode {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n\n constructor(options: SchemaTreeNodeOptions) {\n this.kind = options.kind;\n this.id = options.id;\n this.label = options.label;\n if (options.meta !== undefined) this.meta = options.meta;\n if (options.children !== undefined) this.children = options.children;\n Object.freeze(this);\n }\n\n accept<R>(visitor: SchemaTreeVisitor<R>): R {\n return visitor.visit(this);\n }\n}\n\n/**\n * Core schema view providing a family-agnostic tree representation of a schema.\n * Used by CLI and cross-family tooling for visualization.\n */\nexport interface CoreSchemaView {\n readonly root: SchemaTreeNode;\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type { MigrationMetadata, MigrationPlanOperation } from './control-migration-types';\n\n/**\n * Canonical control-plane identifiers for contract spaces.\n *\n * A contract space is the disjoint `(contract.json, migration-graph)` unit\n * the per-space planner / runner / verifier (project: extension contract\n * spaces, TML-2397) operates on. The application owns one well-known\n * space — the value below — and each loaded extension that contributes\n * schema owns a uniquely-named space.\n *\n * Lives in `framework-components/control` so every layer that has to\n * reason about space identity (the migration tooling, the SQL runtime's\n * marker reader, target-side statement builders, target-side adapters)\n * can import a single value rather than duplicating the literal. Raw\n * `'app'` string literals in framework / target / runtime / adapter\n * source code are forbidden and policed by\n * `scripts/lint-app-space-id.mjs` (wired into `pnpm lint:deps`).\n *\n * @see specs/framework-mechanism.spec.md § 3 — Layout convention (γ).\n */\nexport const APP_SPACE_ID = 'app' as const;\n\n/**\n * Head ref for a contract space — the `(hash, invariants)` tuple\n * a runner targets when applying that space's migration graph. Identical\n * in shape to the on-disk `migrations/<space-id>/refs/head.json` the\n * framework writes per loaded extension, and to the app-space\n * `<projectRoot>/refs/head.json`. Family-agnostic: SQL, Mongo, and any\n * future family share the same head-ref shape.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpaceHeadRef {\n readonly hash: string;\n readonly invariants: readonly string[];\n}\n\n/**\n * Canonical structural shape of a migration package — the unit a planner\n * produces and a runner consumes: a directory name, the metadata\n * envelope, and the operation list.\n *\n * In-memory by default. Readers in `@prisma-next/migration-tools`\n * (`readMigrationPackage` / `readMigrationsDir`) return the augmented\n * {@link import('@prisma-next/migration-tools/package').OnDiskMigrationPackage}\n * variant which adds `dirPath`; everything else operates against the\n * canonical shape so the same value flows through pre-emission\n * authoring, on-disk loading, and runner execution without conversion.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface MigrationPackage {\n readonly dirName: string;\n readonly metadata: MigrationMetadata;\n readonly ops: readonly MigrationPlanOperation[];\n}\n\n/**\n * Canonical structural shape of a contract space — one disjoint\n * `(contractJson, migration-graph)` unit the per-space planner / runner\n * / verifier operates on. The application owns one well-known space\n * ({@link APP_SPACE_ID}); each loaded extension that contributes schema\n * owns a uniquely-named space. Whether a value is the app's space or an\n * extension's space is a control-plane concern; the type carries no\n * such distinction.\n *\n * Generic over the contract so each family pins a typed contract value\n * at consumption time. The SQL family specialises to\n * `ContractSpace<Contract<SqlStorage>>` at the descriptor surface;\n * Mongo's symmetrical `ContractSpace<Contract<MongoStorage>>` will land\n * with that family.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpace<TContract extends Contract = Contract> {\n readonly contractJson: TContract;\n readonly migrations: readonly MigrationPackage[];\n readonly headRef: ContractSpaceHeadRef;\n}\n","import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from '../shared/codec';\nimport type { CodecLookup, CodecMeta } from '../shared/codec-types';\nimport type {\n AuthoringContributions,\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringPslBlockDescriptorNamespace,\n AuthoringTypeNamespace,\n} from '../shared/framework-authoring';\nimport {\n assertNoCrossRegistryCollisions,\n isAuthoringEntityTypeDescriptor,\n isAuthoringFieldPresetDescriptor,\n isAuthoringPslBlockDescriptor,\n isAuthoringTypeConstructorDescriptor,\n mergeAuthoringNamespaces,\n} from '../shared/framework-authoring';\nimport type { ComponentMetadata } from '../shared/framework-components';\nimport type {\n ControlMutationDefaultEntry,\n ControlMutationDefaults,\n MutationDefaultGeneratorDescriptor,\n} from '../shared/mutation-default-types';\nimport type { TypesImportSpec } from '../shared/types-import-spec';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from './control-descriptors';\n\nexport interface AssembledAuthoringContributions {\n readonly field: AuthoringFieldNamespace;\n readonly type: AuthoringTypeNamespace;\n readonly entityTypes: AuthoringEntityTypeNamespace;\n readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;\n}\n\nexport interface ControlStack<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly queryOperationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly codecLookup: CodecLookup;\n readonly authoringContributions: AssembledAuthoringContributions;\n readonly scalarTypeDescriptors: ReadonlyMap<string, string>;\n readonly controlMutationDefaults: ControlMutationDefaults;\n}\n\nexport interface CreateControlStackInput<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks?:\n | ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>\n | undefined;\n}\n\nfunction addUniqueId(ids: string[], seen: Set<string>, id: string): void {\n if (!seen.has(id)) {\n ids.push(id);\n seen.add(id);\n }\n}\n\nexport function assertUniqueCodecOwner(options: {\n readonly codecId: string;\n readonly owners: Map<string, string>;\n readonly descriptorId: string;\n readonly entityLabel: string;\n readonly entityOwnershipLabel: string;\n}): void {\n const existingOwner = options.owners.get(options.codecId);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". ` +\n `Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". ` +\n `Each codecId can only have one ${options.entityOwnershipLabel}.`,\n );\n }\n}\n\nexport function extractCodecTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n if (codecTypes?.import) {\n imports.push(codecTypes.import);\n }\n if (codecTypes?.typeImports) {\n imports.push(...codecTypes.typeImports);\n }\n }\n\n return imports;\n}\n\nexport function extractQueryOperationTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const queryOperationTypes = descriptor.types?.queryOperationTypes;\n if (queryOperationTypes?.import) {\n imports.push(queryOperationTypes.import);\n }\n }\n\n return imports;\n}\n\nexport function extractComponentIds(\n family: { readonly id: string },\n target: { readonly id: string },\n adapter: { readonly id: string } | undefined,\n extensions: ReadonlyArray<{ readonly id: string }>,\n): ReadonlyArray<string> {\n const ids: string[] = [];\n const seen = new Set<string>();\n\n addUniqueId(ids, seen, family.id);\n addUniqueId(ids, seen, target.id);\n if (adapter) {\n addUniqueId(ids, seen, adapter.id);\n }\n\n for (const ext of extensions) {\n addUniqueId(ids, seen, ext.id);\n }\n\n return ids;\n}\n\nexport function assembleAuthoringContributions(\n descriptors: ReadonlyArray<{ readonly authoring?: AuthoringContributions }>,\n): AssembledAuthoringContributions {\n const field = {} as Record<string, unknown>;\n const type = {} as Record<string, unknown>;\n const entityTypes = {} as Record<string, unknown>;\n const pslBlockDescriptors: Record<string, unknown> = {};\n\n for (const descriptor of descriptors) {\n if (descriptor.authoring?.field) {\n mergeAuthoringNamespaces(\n field,\n descriptor.authoring.field,\n [],\n isAuthoringFieldPresetDescriptor,\n 'field',\n );\n }\n if (descriptor.authoring?.type) {\n mergeAuthoringNamespaces(\n type,\n descriptor.authoring.type,\n [],\n isAuthoringTypeConstructorDescriptor,\n 'type',\n );\n }\n if (descriptor.authoring?.entityTypes) {\n mergeAuthoringNamespaces(\n entityTypes,\n descriptor.authoring.entityTypes,\n [],\n isAuthoringEntityTypeDescriptor,\n 'entity',\n );\n }\n if (descriptor.authoring?.pslBlockDescriptors) {\n mergeAuthoringNamespaces(\n pslBlockDescriptors,\n descriptor.authoring.pslBlockDescriptors,\n [],\n isAuthoringPslBlockDescriptor,\n 'pslBlock',\n );\n }\n }\n\n const fieldNamespace = field as AuthoringFieldNamespace;\n const typeNamespace = type as AuthoringTypeNamespace;\n const entityTypeNamespace = entityTypes as AuthoringEntityTypeNamespace;\n const pslBlockDescriptorNamespace = blindCast<\n AuthoringPslBlockDescriptorNamespace,\n 'merge target accumulator narrows to typed namespace post-merge'\n >(pslBlockDescriptors);\n assertNoCrossRegistryCollisions(\n typeNamespace,\n fieldNamespace,\n entityTypeNamespace,\n pslBlockDescriptorNamespace,\n );\n\n return {\n field: fieldNamespace,\n type: typeNamespace,\n entityTypes: entityTypeNamespace,\n pslBlockDescriptors: pslBlockDescriptorNamespace,\n };\n}\n\nexport function assembleScalarTypeDescriptors(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'scalarTypeDescriptors'> & { readonly id?: string }\n >,\n): ReadonlyMap<string, string> {\n const result = new Map<string, string>();\n const owners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const descriptorMap = descriptor.scalarTypeDescriptors;\n if (!descriptorMap) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n for (const [typeName, codecId] of descriptorMap) {\n const existingOwner = owners.get(typeName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate scalar type descriptor \"${typeName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n result.set(typeName, codecId);\n owners.set(typeName, descriptorId);\n }\n }\n\n return result;\n}\n\nexport function assembleControlMutationDefaults(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'controlMutationDefaults'> & { readonly id?: string }\n >,\n): ControlMutationDefaults {\n const defaultFunctionRegistry = new Map<string, ControlMutationDefaultEntry>();\n const functionOwners = new Map<string, string>();\n const generatorMap = new Map<string, MutationDefaultGeneratorDescriptor>();\n const generatorOwners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const contributions = descriptor.controlMutationDefaults;\n if (!contributions) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n\n for (const generatorDescriptor of contributions.generatorDescriptors) {\n const existingOwner = generatorOwners.get(generatorDescriptor.id);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default generator id \"${generatorDescriptor.id}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n generatorMap.set(generatorDescriptor.id, generatorDescriptor);\n generatorOwners.set(generatorDescriptor.id, descriptorId);\n }\n\n for (const [functionName, handler] of contributions.defaultFunctionRegistry) {\n const existingOwner = functionOwners.get(functionName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default function \"${functionName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n defaultFunctionRegistry.set(functionName, handler);\n functionOwners.set(functionName, descriptorId);\n }\n }\n\n return {\n defaultFunctionRegistry,\n generatorDescriptors: Array.from(generatorMap.values()),\n };\n}\n\nexport function extractCodecLookup(\n descriptors: ReadonlyArray<Pick<ComponentMetadata & { id: string }, 'types' | 'id'>>,\n): CodecLookup {\n const byId = new Map<string, Codec>();\n const targetTypesById = new Map<string, readonly string[]>();\n const metaById = new Map<string, CodecMeta>();\n const renderersById = new Map<string, (params: Record<string, unknown>) => string | undefined>();\n const owners = new Map<string, string>();\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n const descriptorId = descriptor.id;\n // Descriptor-side metadata is the single source of truth for `targetTypes` / `meta` / `renderOutputType`. Every contributor ships a `codecDescriptors` list on `types.codecTypes`.\n for (const codecDescriptor of codecTypes?.codecDescriptors ?? []) {\n assertUniqueCodecOwner({\n codecId: codecDescriptor.codecId,\n owners,\n descriptorId,\n entityLabel: 'codec descriptor',\n entityOwnershipLabel: 'codec descriptor provider',\n });\n owners.set(codecDescriptor.codecId, descriptorId);\n if (Array.isArray(codecDescriptor.targetTypes)) {\n targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes);\n }\n if (codecDescriptor.meta !== undefined) {\n metaById.set(codecDescriptor.codecId, codecDescriptor.meta);\n }\n if (typeof codecDescriptor.renderOutputType === 'function') {\n renderersById.set(codecDescriptor.codecId, codecDescriptor.renderOutputType);\n }\n // Materialize a representative `Codec` instance for `byId.get()` so consumers reading the lookup's instance side (e.g. SQL renderer's cast-policy lookup, or the contract emitter's literal-default `encodeJson` resolver) keep finding the codec.\n //\n // Two cohorts:\n // - Non-parameterized descriptors: factory must succeed; any throw is a real bug and we let it propagate (no silent try/catch).\n // - Parameterized descriptors: try with empty params. Many parameterized codecs treat params as advisory (e.g. `pg/timestamptz@1` whose precision is rendered into the `nativeType` only and never read by the runtime codec), so an empty-params construction yields a usable representative for id-keyed lookups (e.g. emit-time literal-default encoding). Codecs whose factory genuinely requires params (e.g. `pg/vector@1` threading `length` into the runtime codec) will throw; for those, per-column instances are materialized at runtime by `buildContractCodecRegistry` and the id-keyed lookup miss is correct (the column-aware path resolves them).\n if (!byId.has(codecDescriptor.codecId)) {\n if (codecDescriptor.isParameterized) {\n try {\n const representative = codecDescriptor.factory({} as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n } catch {\n // Factory requires concrete params; skip representative materialization. Per-column instances are built at runtime; id-keyed lookup miss is the correct outcome here.\n }\n } else {\n const representative = codecDescriptor.factory(undefined as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n }\n }\n }\n }\n return {\n get: (id) => byId.get(id),\n targetTypesFor: (id) => targetTypesById.get(id),\n metaFor: (id) => metaById.get(id),\n renderOutputTypeFor: (id, params) => renderersById.get(id)?.(params),\n };\n}\n\nexport function validateScalarTypeCodecIds(\n scalarTypeDescriptors: ReadonlyMap<string, string>,\n codecLookup: CodecLookup,\n): string[] {\n const errors: string[] = [];\n for (const [typeName, codecId] of scalarTypeDescriptors) {\n if (!codecLookup.get(codecId)) {\n errors.push(\n `Scalar type \"${typeName}\" references codec \"${codecId}\" which is not registered by any component.`,\n );\n }\n }\n return errors;\n}\n\ninterface DependencyDeclaringDescriptor {\n readonly id: string;\n readonly contractSpace?: {\n readonly contractJson?: {\n readonly extensionPacks?: Readonly<Record<string, unknown>>;\n };\n };\n}\n\nfunction readDeclaredDependencyIds(descriptor: DependencyDeclaringDescriptor): readonly string[] {\n const packs = descriptor.contractSpace?.contractJson?.extensionPacks;\n if (packs === null || typeof packs !== 'object') return [];\n return Object.keys(packs);\n}\n\n/**\n * Builds a dependency-respecting load order for the given extension descriptors\n * using Kahn's topological sort algorithm. Dependencies (packs declared in\n * `contractSpace.contractJson.extensionPacks`) are placed before the extensions\n * that depend on them.\n *\n * Throws if the dependency graph contains a cycle, with an error message that\n * names every extension involved in the cycle.\n *\n * Throws if any extension declares a dependency on a pack ID that is not present\n * in the provided list — add the missing pack to the `extensionPacks` list to\n * resolve the error.\n */\n\nexport function buildExtensionLoadOrder(\n extensions: ReadonlyArray<DependencyDeclaringDescriptor>,\n): readonly string[] {\n if (extensions.length === 0) return [];\n\n const idSet = new Set(extensions.map((e) => e.id));\n const inDegree = new Map<string, number>();\n const dependents = new Map<string, string[]>();\n\n for (const ext of extensions) {\n if (!inDegree.has(ext.id)) inDegree.set(ext.id, 0);\n if (!dependents.has(ext.id)) dependents.set(ext.id, []);\n }\n\n for (const ext of extensions) {\n for (const depId of readDeclaredDependencyIds(ext)) {\n if (!idSet.has(depId)) {\n throw new Error(\n `Extension \"${ext.id}\" declares a dependency on \"${depId}\", but \"${depId}\" is not in the provided extension set. Add the missing space to extensionPacks.`,\n );\n }\n inDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);\n const list = dependents.get(depId);\n if (list !== undefined) list.push(ext.id);\n }\n }\n\n const queue: string[] = [];\n for (const [id, deg] of inDegree) {\n if (deg === 0) queue.push(id);\n }\n queue.sort();\n\n const result: string[] = [];\n while (queue.length > 0) {\n const id = queue.shift();\n if (id === undefined) break;\n result.push(id);\n const children = dependents.get(id) ?? [];\n children.sort();\n for (const childId of children) {\n const newDeg = (inDegree.get(childId) ?? 1) - 1;\n inDegree.set(childId, newDeg);\n if (newDeg === 0) queue.push(childId);\n }\n }\n\n if (result.length < extensions.length) {\n const cycleMembers = extensions\n .map((e) => e.id)\n .filter((id) => !result.includes(id))\n .sort();\n throw new Error(\n `Extension dependency cycle detected. Cycle members: ${cycleMembers.map((id) => `\"${id}\"`).join(', ')}.`,\n );\n }\n\n return result;\n}\n\nexport function createControlStack<TFamilyId extends string, TTargetId extends string>(\n input: CreateControlStackInput<TFamilyId, TTargetId>,\n): ControlStack<TFamilyId, TTargetId> {\n const { family, target, adapter, driver, extensionPacks = [] } = input;\n\n const orderedIds = buildExtensionLoadOrder(extensionPacks);\n const extensionById = new Map(extensionPacks.map((ext) => [ext.id, ext]));\n const orderedExtensionPacks = orderedIds\n .map((id) => extensionById.get(id))\n .filter((ext): ext is ControlExtensionDescriptor<TFamilyId, TTargetId> => ext !== undefined);\n\n const allDescriptors = [family, target, ...(adapter ? [adapter] : []), ...orderedExtensionPacks];\n\n const codecLookup = extractCodecLookup(allDescriptors);\n const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);\n\n return {\n family,\n target,\n adapter,\n driver,\n extensionPacks: orderedExtensionPacks,\n\n codecTypeImports: extractCodecTypeImports(allDescriptors),\n queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n extensionIds: extractComponentIds(family, target, adapter, orderedExtensionPacks),\n codecLookup,\n authoringContributions: assembleAuthoringContributions(allDescriptors),\n scalarTypeDescriptors,\n controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),\n };\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type { SchemaVerificationNode } from './control-result-types';\n\nexport type VerificationStatus = SchemaVerificationNode['status'];\n\nexport type VerifierOutcome = VerificationStatus | 'suppress';\n\n/**\n * Target-neutral classification of a verifier finding, abstracted away from any\n * one storage model's vocabulary. Each family classifies its own concrete issue\n * kinds into these categories; the framework only grades the category against a\n * control policy.\n *\n * - `declaredMissing` — a declared object/element is absent from the database.\n * - `declaredIncompatible` — a declared object/element exists but its shape diverges.\n * - `valueDrift` — the value set of an existing type drifted (e.g. enum values).\n * - `extraNestedElement` — an undeclared element nested inside a declared object\n * (a SQL column, a document field).\n * - `extraAuxiliary` — an undeclared auxiliary attached to a declared object\n * (a SQL constraint/index, a Mongo index/validator).\n * - `extraTopLevelObject` — an undeclared top-level object (a SQL table, a\n * Mongo collection).\n */\nexport type VerifierIssueCategory =\n | 'declaredMissing'\n | 'declaredIncompatible'\n | 'valueDrift'\n | 'extraNestedElement'\n | 'extraAuxiliary'\n | 'extraTopLevelObject';\n\n/**\n * Grades a target-neutral issue category against a control policy.\n *\n * - `observed` warns on everything.\n * - `tolerated` suppresses only an extra nested element (everything else fails).\n * - `external` suppresses every extra category and value drift (existence and\n * declared-shape divergences still fail).\n * - `managed` (and any other) fails.\n */\nexport function dispositionForCategory(\n controlPolicy: ControlPolicy,\n category: VerifierIssueCategory,\n): VerifierOutcome {\n if (controlPolicy === 'observed') {\n return 'warn';\n }\n if (controlPolicy === 'tolerated' && category === 'extraNestedElement') {\n return 'suppress';\n }\n if (controlPolicy === 'external') {\n if (\n category === 'extraNestedElement' ||\n category === 'extraAuxiliary' ||\n category === 'extraTopLevelObject' ||\n category === 'valueDrift'\n ) {\n return 'suppress';\n }\n }\n return 'fail';\n}\n"],"mappings":";;;AAkBA,SAAgB,cACd,QAC4D;CAC5D,OAAO,gBAAgB,UAAU,CAAC,CAAE,OAAmC;AACzE;AAMA,SAAgB,cACd,UACwF;CACxF,OACE,kBAAkB,YAClB,OAAQ,SAAqC,oBAAoB;AAErE;AAUA,SAAgB,oBACd,UAC8F;CAC9F,OACE,sBAAsB,YACtB,OAAQ,SAAqC,wBAAwB;AAEzE;AAWA,SAAgB,oBACd,UACmF;CACnF,OACE,wBAAwB,YACxB,OAAQ,SAAqC,0BAA0B;AAE3E;;;ACtEA,MAAa,6BAA6B;AAC1C,MAAa,4BAA4B;AACzC,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;;;AC4B1C,IAAa,iBAAb,MAA4B;CAC1B;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAgC;EAC1C,KAAK,OAAO,QAAQ;EACpB,KAAK,KAAK,QAAQ;EAClB,KAAK,QAAQ,QAAQ;EACrB,IAAI,QAAQ,SAAS,KAAA,GAAW,KAAK,OAAO,QAAQ;EACpD,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;EAC5D,OAAO,OAAO,IAAI;CACpB;CAEA,OAAU,SAAkC;EAC1C,OAAO,QAAQ,MAAM,IAAI;CAC3B;AACF;;;;;;;;;;;;;;;;;;;;;;AC5BA,MAAa,eAAe;;;ACkD5B,SAAS,YAAY,KAAe,MAAmB,IAAkB;C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A,SAAgB,mBACd,OACoC;CACpC,MAAM,EAAE,QAAQ,QAAQ,SAAS,QAAQ,iBAAiB,CAAC,MAAM;CAEjE,MAAM,aAAa,wBAAwB,cAAc;CACzD,MAAM,gBAAgB,IAAI,IAAI,eAAe,KAAK,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;CACxE,MAAM,wBAAwB,WAC3B,KAAK,OAAO,cAAc,IAAI,EAAE,CAAC,CAAC,CAClC,QAAQ,QAAiE,QAAQ,KAAA,CAAS;CAE7F,MAAM,iBAAiB;EAAC;EAAQ;EAAQ,GAAI,UAAU,CAAC,OAAO,IAAI,CAAC;EAAI,GAAG;CAAqB;CAE/F,MAAM,cAAc,mBAAmB,cAAc;CACrD,MAAM,wBAAwB,8BAA8B,cAAc;CAE1E,OAAO;EACL;EACA;EACA;EACA;EACA,gBAAgB;EAEhB,kBAAkB,wBAAwB,cAAc;EACxD,2BAA2B,iCAAiC,cAAc;EAC1E,cAAc,oBAAoB,QAAQ,QAAQ,SAAS,qBAAqB;EAChF;EACA,wBAAwB,+BAA+B,cAAc;EACrE;EACA,yBAAyB,gCAAgC,cAAc;CACzE;AACF;;;;;;;;;;;;ACncA,SAAgB,uBACd,eACA,UACiB;CACjB,IAAI,kBAAkB,YACpB,OAAO;CAET,IAAI,kBAAkB,eAAe,aAAa,sBAChD,OAAO;CAET,IAAI,kBAAkB;MAElB,aAAa,wBACb,aAAa,oBACb,aAAa,yBACb,aAAa,cAEb,OAAO;CAAA;CAGX,OAAO;AACT"} | ||
| {"version":3,"file":"control.mjs","names":[],"sources":["../src/control/control-capabilities.ts","../src/control/control-result-types.ts","../src/control/control-schema-view.ts","../src/control/control-spaces.ts","../src/control/control-stack.ts","../src/control/verifier-disposition.ts"],"sourcesContent":["import type { ControlTargetDescriptor } from './control-descriptors';\nimport type { ControlFamilyInstance } from './control-instances';\nimport type { MigrationPlanOperation, TargetMigrationsCapability } from './control-migration-types';\nimport type { OperationPreview } from './control-operation-preview';\nimport type { CoreSchemaView } from './control-schema-view';\nimport type { PslDocumentAst } from './psl-ast';\n\nexport interface MigratableTargetDescriptor<\n TFamilyId extends string,\n TTargetId extends string,\n TFamilyInstance extends ControlFamilyInstance<TFamilyId, unknown> = ControlFamilyInstance<\n TFamilyId,\n unknown\n >,\n> extends ControlTargetDescriptor<TFamilyId, TTargetId> {\n readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, TFamilyInstance>;\n}\n\nexport function hasMigrations<TFamilyId extends string, TTargetId extends string>(\n target: ControlTargetDescriptor<TFamilyId, TTargetId>,\n): target is MigratableTargetDescriptor<TFamilyId, TTargetId> {\n return 'migrations' in target && !!(target as Record<string, unknown>)['migrations'];\n}\n\nexport interface SchemaViewCapable<TSchemaIR = unknown> {\n toSchemaView(schema: TSchemaIR): CoreSchemaView;\n}\n\nexport function hasSchemaView<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & SchemaViewCapable<TSchemaIR> {\n return (\n 'toSchemaView' in instance &&\n typeof (instance as Record<string, unknown>)['toSchemaView'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can infer a PSL contract AST from its\n * opaque introspected schema IR. Consumed by `prisma-next contract infer`.\n */\nexport interface PslContractInferCapable<TSchemaIR = unknown> {\n inferPslContract(schemaIR: TSchemaIR): PslDocumentAst;\n}\n\nexport function hasPslContractInfer<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & PslContractInferCapable<TSchemaIR> {\n return (\n 'inferPslContract' in instance &&\n typeof (instance as Record<string, unknown>)['inferPslContract'] === 'function'\n );\n}\n\n/**\n * Capability declaring that a family can render a textual preview of migration\n * operations for the CLI's \"DDL preview\" output. SQL families emit\n * `language: 'sql'` statements; Mongo families emit `language: 'mongodb-shell'`.\n */\nexport interface OperationPreviewCapable {\n toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;\n}\n\nexport function hasOperationPreview<TFamilyId extends string, TSchemaIR>(\n instance: ControlFamilyInstance<TFamilyId, TSchemaIR>,\n): instance is ControlFamilyInstance<TFamilyId, TSchemaIR> & OperationPreviewCapable {\n return (\n 'toOperationPreview' in instance &&\n typeof (instance as Record<string, unknown>)['toOperationPreview'] === 'function'\n );\n}\n","export const VERIFY_CODE_MARKER_MISSING = 'PN-RUN-3001';\nexport const VERIFY_CODE_HASH_MISMATCH = 'PN-RUN-3002';\nexport const VERIFY_CODE_TARGET_MISMATCH = 'PN-RUN-3003';\nexport const VERIFY_CODE_SCHEMA_FAILURE = 'PN-RUN-3010';\n\nexport interface OperationContext {\n readonly contractPath?: string;\n readonly configPath?: string;\n readonly meta?: Readonly<Record<string, unknown>>;\n}\n\nexport interface VerifyDatabaseResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly marker?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly missingCodecs?: readonly string[];\n readonly codecCoverageSkipped?: boolean;\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface BaseSchemaIssue {\n readonly kind:\n | 'missing_schema'\n | 'missing_table'\n | 'missing_column'\n | 'extra_table'\n | 'extra_column'\n | 'extra_primary_key'\n | 'extra_foreign_key'\n | 'extra_unique_constraint'\n | 'extra_index'\n | 'extra_validator'\n | 'type_mismatch'\n | 'type_missing'\n | 'type_values_mismatch'\n | 'nullability_mismatch'\n | 'primary_key_mismatch'\n | 'foreign_key_mismatch'\n | 'unique_constraint_mismatch'\n | 'index_mismatch'\n | 'default_missing'\n | 'default_mismatch'\n | 'extra_default'\n | 'check_missing'\n | 'check_removed'\n | 'check_mismatch';\n readonly table?: string;\n /**\n * Namespace coordinate of the issue's subject (e.g. the schema a SQL\n * table lives in). Populated by family verifiers that have the\n * coordinate in scope when constructing the issue; absent for issues\n * whose family has no namespace concept (e.g. Mongo collections) or\n * whose subject isn't in any contract namespace (e.g. an extra-table\n * issue raised for a table that exists in the live DB but not in the\n * contract).\n *\n * Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup. A finer-grained\n * structural split between framework-shared and family-specific issue\n * fields is tracked under a follow-up ticket.\n */\n readonly namespaceId?: string;\n readonly column?: string;\n readonly indexOrConstraint?: string;\n readonly typeName?: string;\n readonly expected?: string;\n readonly actual?: string;\n readonly message: string;\n}\n\nexport interface EnumValuesChangedIssue {\n readonly kind: 'enum_values_changed';\n /**\n * Namespace coordinate of the enum type that changed values. Populated by\n * family verifiers that have the coordinate in scope when constructing the\n * issue. Downstream planners trust this field as the authoritative subject\n * coordinate and do not re-derive it by name lookup.\n */\n readonly namespaceId: string;\n readonly typeName: string;\n readonly addedValues: readonly string[];\n readonly removedValues: readonly string[];\n readonly message: string;\n}\n\nexport type SchemaIssue = BaseSchemaIssue | EnumValuesChangedIssue;\n\nexport interface SchemaVerificationNode {\n readonly status: 'pass' | 'warn' | 'fail';\n readonly kind: string;\n readonly name: string;\n readonly contractPath: string;\n readonly code: string;\n readonly message: string;\n readonly expected: unknown;\n readonly actual: unknown;\n readonly children: readonly SchemaVerificationNode[];\n}\n\nexport interface VerifyDatabaseSchemaResult {\n readonly ok: boolean;\n readonly code?: string;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly schema: {\n readonly issues: readonly SchemaIssue[];\n readonly root: SchemaVerificationNode;\n readonly counts: {\n readonly pass: number;\n readonly warn: number;\n readonly fail: number;\n readonly totalNodes: number;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath?: string;\n readonly strict: boolean;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface EmitContractResult {\n readonly contractJson: string;\n readonly contractDts: string;\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n}\n\nexport interface IntrospectSchemaResult<TSchemaIR> {\n readonly ok: true;\n readonly summary: string;\n readonly target: {\n readonly familyId: string;\n readonly id: string;\n };\n readonly schema: TSchemaIR;\n readonly meta?: {\n readonly configPath?: string;\n readonly dbUrl?: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport interface SignDatabaseResult {\n readonly ok: boolean;\n readonly summary: string;\n readonly contract: {\n readonly storageHash: string;\n readonly profileHash?: string;\n };\n readonly target: {\n readonly expected: string;\n readonly actual?: string;\n };\n readonly marker: {\n readonly created: boolean;\n readonly updated: boolean;\n readonly previous?: {\n readonly storageHash?: string;\n readonly profileHash?: string;\n };\n };\n readonly meta?: {\n readonly configPath?: string;\n readonly contractPath: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n","/**\n * Core schema view types for family-agnostic schema visualization.\n *\n * These types provide a minimal, generic, tree-shaped representation of schemas\n * across families, designed for CLI visualization and lightweight tooling.\n *\n * Families can optionally project their family-specific Schema IR into this\n * core view via the `toSchemaView` method on `FamilyInstance`.\n */\n\nexport type SchemaViewNodeKind =\n | 'root'\n | 'namespace'\n | 'collection'\n | 'entity'\n | 'field'\n | 'index'\n | 'dependency';\n\nexport interface SchemaTreeVisitor<R> {\n visit(node: SchemaTreeNode): R;\n}\n\nexport interface SchemaTreeNodeOptions {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n}\n\nexport class SchemaTreeNode {\n readonly kind: SchemaViewNodeKind;\n readonly id: string;\n readonly label: string;\n readonly meta?: Record<string, unknown>;\n readonly children?: readonly SchemaTreeNode[];\n\n constructor(options: SchemaTreeNodeOptions) {\n this.kind = options.kind;\n this.id = options.id;\n this.label = options.label;\n if (options.meta !== undefined) this.meta = options.meta;\n if (options.children !== undefined) this.children = options.children;\n Object.freeze(this);\n }\n\n accept<R>(visitor: SchemaTreeVisitor<R>): R {\n return visitor.visit(this);\n }\n}\n\n/**\n * Core schema view providing a family-agnostic tree representation of a schema.\n * Used by CLI and cross-family tooling for visualization.\n */\nexport interface CoreSchemaView {\n readonly root: SchemaTreeNode;\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type { MigrationMetadata, MigrationPlanOperation } from './control-migration-types';\n\n/**\n * Canonical control-plane identifiers for contract spaces.\n *\n * A contract space is the disjoint `(contract.json, migration-graph)` unit\n * the per-space planner / runner / verifier (project: extension contract\n * spaces, TML-2397) operates on. The application owns one well-known\n * space — the value below — and each loaded extension that contributes\n * schema owns a uniquely-named space.\n *\n * Lives in `framework-components/control` so every layer that has to\n * reason about space identity (the migration tooling, the SQL runtime's\n * marker reader, target-side statement builders, target-side adapters)\n * can import a single value rather than duplicating the literal. Raw\n * `'app'` string literals in framework / target / runtime / adapter\n * source code are forbidden and policed by\n * `scripts/lint-app-space-id.mjs` (wired into `pnpm lint:deps`).\n *\n * @see specs/framework-mechanism.spec.md § 3 — Layout convention (γ).\n */\nexport const APP_SPACE_ID = 'app' as const;\n\n/**\n * Head ref for a contract space — the `(hash, invariants)` tuple\n * a runner targets when applying that space's migration graph. Identical\n * in shape to the on-disk `migrations/<space-id>/refs/head.json` the\n * framework writes per loaded extension, and to the app-space\n * `<projectRoot>/refs/head.json`. Family-agnostic: SQL, Mongo, and any\n * future family share the same head-ref shape.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpaceHeadRef {\n readonly hash: string;\n readonly invariants: readonly string[];\n}\n\n/**\n * Canonical structural shape of a migration package — the unit a planner\n * produces and a runner consumes: a directory name, the metadata\n * envelope, and the operation list.\n *\n * In-memory by default. Readers in `@prisma-next/migration-tools`\n * (`readMigrationPackage` / `readMigrationsDir`) return the augmented\n * {@link import('@prisma-next/migration-tools/package').OnDiskMigrationPackage}\n * variant which adds `dirPath`; everything else operates against the\n * canonical shape so the same value flows through pre-emission\n * authoring, on-disk loading, and runner execution without conversion.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface MigrationPackage {\n readonly dirName: string;\n readonly metadata: MigrationMetadata;\n readonly ops: readonly MigrationPlanOperation[];\n}\n\n/**\n * Canonical structural shape of a contract space — one disjoint\n * `(contractJson, migration-graph)` unit the per-space planner / runner\n * / verifier operates on. The application owns one well-known space\n * ({@link APP_SPACE_ID}); each loaded extension that contributes schema\n * owns a uniquely-named space. Whether a value is the app's space or an\n * extension's space is a control-plane concern; the type carries no\n * such distinction.\n *\n * Generic over the contract so each family pins a typed contract value\n * at consumption time. The SQL family specialises to\n * `ContractSpace<Contract<SqlStorage>>` at the descriptor surface;\n * Mongo's symmetrical `ContractSpace<Contract<MongoStorage>>` will land\n * with that family.\n *\n * @see specs/framework-mechanism.spec.md § 1.\n */\nexport interface ContractSpace<TContract extends Contract = Contract> {\n readonly contractJson: TContract;\n readonly migrations: readonly MigrationPackage[];\n readonly headRef: ContractSpaceHeadRef;\n}\n","import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from '../shared/codec';\nimport type { AnyCodecDescriptor } from '../shared/codec-descriptor';\nimport type { CodecLookup, CodecMeta, CodecRef, CodecRegistry } from '../shared/codec-types';\nimport type {\n AuthoringContributions,\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringPslBlockDescriptorNamespace,\n AuthoringTypeNamespace,\n} from '../shared/framework-authoring';\nimport {\n assertNoCrossRegistryCollisions,\n isAuthoringEntityTypeDescriptor,\n isAuthoringFieldPresetDescriptor,\n isAuthoringPslBlockDescriptor,\n isAuthoringTypeConstructorDescriptor,\n mergeAuthoringNamespaces,\n} from '../shared/framework-authoring';\nimport type { ComponentMetadata } from '../shared/framework-components';\nimport type {\n ControlMutationDefaultEntry,\n ControlMutationDefaults,\n MutationDefaultGeneratorDescriptor,\n} from '../shared/mutation-default-types';\nimport { materializeCodec } from '../shared/resolve-codec';\nimport { runtimeError } from '../shared/runtime-error';\nimport type { TypesImportSpec } from '../shared/types-import-spec';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from './control-descriptors';\n\nexport interface AssembledAuthoringContributions {\n readonly field: AuthoringFieldNamespace;\n readonly type: AuthoringTypeNamespace;\n readonly entityTypes: AuthoringEntityTypeNamespace;\n readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;\n}\n\nexport interface ControlStack<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly queryOperationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly codecLookup: CodecRegistry;\n readonly authoringContributions: AssembledAuthoringContributions;\n readonly scalarTypeDescriptors: ReadonlyMap<string, string>;\n readonly controlMutationDefaults: ControlMutationDefaults;\n}\n\nexport interface CreateControlStackInput<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter?: ControlAdapterDescriptor<TFamilyId, TTargetId> | undefined;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks?:\n | ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>\n | undefined;\n}\n\nfunction addUniqueId(ids: string[], seen: Set<string>, id: string): void {\n if (!seen.has(id)) {\n ids.push(id);\n seen.add(id);\n }\n}\n\nexport function assertUniqueCodecOwner(options: {\n readonly codecId: string;\n readonly owners: Map<string, string>;\n readonly descriptorId: string;\n readonly entityLabel: string;\n readonly entityOwnershipLabel: string;\n}): void {\n const existingOwner = options.owners.get(options.codecId);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate ${options.entityLabel} for codecId \"${options.codecId}\". ` +\n `Descriptor \"${options.descriptorId}\" conflicts with \"${existingOwner}\". ` +\n `Each codecId can only have one ${options.entityOwnershipLabel}.`,\n );\n }\n}\n\nexport function extractCodecTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n if (codecTypes?.import) {\n imports.push(codecTypes.import);\n }\n if (codecTypes?.typeImports) {\n imports.push(...codecTypes.typeImports);\n }\n }\n\n return imports;\n}\n\nexport function extractQueryOperationTypeImports(\n descriptors: ReadonlyArray<Pick<ComponentMetadata, 'types'>>,\n): ReadonlyArray<TypesImportSpec> {\n const imports: TypesImportSpec[] = [];\n\n for (const descriptor of descriptors) {\n const queryOperationTypes = descriptor.types?.queryOperationTypes;\n if (queryOperationTypes?.import) {\n imports.push(queryOperationTypes.import);\n }\n }\n\n return imports;\n}\n\nexport function extractComponentIds(\n family: { readonly id: string },\n target: { readonly id: string },\n adapter: { readonly id: string } | undefined,\n extensions: ReadonlyArray<{ readonly id: string }>,\n): ReadonlyArray<string> {\n const ids: string[] = [];\n const seen = new Set<string>();\n\n addUniqueId(ids, seen, family.id);\n addUniqueId(ids, seen, target.id);\n if (adapter) {\n addUniqueId(ids, seen, adapter.id);\n }\n\n for (const ext of extensions) {\n addUniqueId(ids, seen, ext.id);\n }\n\n return ids;\n}\n\nexport function assembleAuthoringContributions(\n descriptors: ReadonlyArray<{ readonly authoring?: AuthoringContributions }>,\n): AssembledAuthoringContributions {\n const field = {} as Record<string, unknown>;\n const type = {} as Record<string, unknown>;\n const entityTypes = {} as Record<string, unknown>;\n const pslBlockDescriptors: Record<string, unknown> = {};\n\n for (const descriptor of descriptors) {\n if (descriptor.authoring?.field) {\n mergeAuthoringNamespaces(\n field,\n descriptor.authoring.field,\n [],\n isAuthoringFieldPresetDescriptor,\n 'field',\n );\n }\n if (descriptor.authoring?.type) {\n mergeAuthoringNamespaces(\n type,\n descriptor.authoring.type,\n [],\n isAuthoringTypeConstructorDescriptor,\n 'type',\n );\n }\n if (descriptor.authoring?.entityTypes) {\n mergeAuthoringNamespaces(\n entityTypes,\n descriptor.authoring.entityTypes,\n [],\n isAuthoringEntityTypeDescriptor,\n 'entity',\n );\n }\n if (descriptor.authoring?.pslBlockDescriptors) {\n mergeAuthoringNamespaces(\n pslBlockDescriptors,\n descriptor.authoring.pslBlockDescriptors,\n [],\n isAuthoringPslBlockDescriptor,\n 'pslBlock',\n );\n }\n }\n\n const fieldNamespace = field as AuthoringFieldNamespace;\n const typeNamespace = type as AuthoringTypeNamespace;\n const entityTypeNamespace = entityTypes as AuthoringEntityTypeNamespace;\n const pslBlockDescriptorNamespace = blindCast<\n AuthoringPslBlockDescriptorNamespace,\n 'merge target accumulator narrows to typed namespace post-merge'\n >(pslBlockDescriptors);\n assertNoCrossRegistryCollisions(\n typeNamespace,\n fieldNamespace,\n entityTypeNamespace,\n pslBlockDescriptorNamespace,\n );\n\n return {\n field: fieldNamespace,\n type: typeNamespace,\n entityTypes: entityTypeNamespace,\n pslBlockDescriptors: pslBlockDescriptorNamespace,\n };\n}\n\nexport function assembleScalarTypeDescriptors(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'scalarTypeDescriptors'> & { readonly id?: string }\n >,\n): ReadonlyMap<string, string> {\n const result = new Map<string, string>();\n const owners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const descriptorMap = descriptor.scalarTypeDescriptors;\n if (!descriptorMap) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n for (const [typeName, codecId] of descriptorMap) {\n const existingOwner = owners.get(typeName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate scalar type descriptor \"${typeName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n result.set(typeName, codecId);\n owners.set(typeName, descriptorId);\n }\n }\n\n return result;\n}\n\nexport function assembleControlMutationDefaults(\n descriptors: ReadonlyArray<\n Pick<ComponentMetadata, 'controlMutationDefaults'> & { readonly id?: string }\n >,\n): ControlMutationDefaults {\n const defaultFunctionRegistry = new Map<string, ControlMutationDefaultEntry>();\n const functionOwners = new Map<string, string>();\n const generatorMap = new Map<string, MutationDefaultGeneratorDescriptor>();\n const generatorOwners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n const contributions = descriptor.controlMutationDefaults;\n if (!contributions) continue;\n const descriptorId = descriptor.id ?? '<unknown>';\n\n for (const generatorDescriptor of contributions.generatorDescriptors) {\n const existingOwner = generatorOwners.get(generatorDescriptor.id);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default generator id \"${generatorDescriptor.id}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n generatorMap.set(generatorDescriptor.id, generatorDescriptor);\n generatorOwners.set(generatorDescriptor.id, descriptorId);\n }\n\n for (const [functionName, handler] of contributions.defaultFunctionRegistry) {\n const existingOwner = functionOwners.get(functionName);\n if (existingOwner !== undefined) {\n throw new Error(\n `Duplicate mutation default function \"${functionName}\". ` +\n `Descriptor \"${descriptorId}\" conflicts with \"${existingOwner}\".`,\n );\n }\n defaultFunctionRegistry.set(functionName, handler);\n functionOwners.set(functionName, descriptorId);\n }\n }\n\n return {\n defaultFunctionRegistry,\n generatorDescriptors: Array.from(generatorMap.values()),\n };\n}\n\nexport function extractCodecLookup(\n descriptors: ReadonlyArray<Pick<ComponentMetadata & { id: string }, 'types' | 'id'>>,\n): CodecRegistry {\n const byId = new Map<string, Codec>();\n const descriptorsById = new Map<string, AnyCodecDescriptor>();\n const targetTypesById = new Map<string, readonly string[]>();\n const metaById = new Map<string, CodecMeta>();\n const renderersById = new Map<string, (params: Record<string, unknown>) => string | undefined>();\n const owners = new Map<string, string>();\n for (const descriptor of descriptors) {\n const codecTypes = descriptor.types?.codecTypes;\n const descriptorId = descriptor.id;\n // Descriptor-side metadata is the single source of truth for `targetTypes` / `meta` / `renderOutputType`. Every contributor ships a `codecDescriptors` list on `types.codecTypes`.\n for (const codecDescriptor of codecTypes?.codecDescriptors ?? []) {\n assertUniqueCodecOwner({\n codecId: codecDescriptor.codecId,\n owners,\n descriptorId,\n entityLabel: 'codec descriptor',\n entityOwnershipLabel: 'codec descriptor provider',\n });\n owners.set(codecDescriptor.codecId, descriptorId);\n descriptorsById.set(codecDescriptor.codecId, codecDescriptor);\n if (Array.isArray(codecDescriptor.targetTypes)) {\n targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes);\n }\n if (codecDescriptor.meta !== undefined) {\n metaById.set(codecDescriptor.codecId, codecDescriptor.meta);\n }\n if (typeof codecDescriptor.renderOutputType === 'function') {\n renderersById.set(codecDescriptor.codecId, codecDescriptor.renderOutputType);\n }\n // Materialize a representative `Codec` instance for `byId.get()` so consumers reading the lookup's instance side (e.g. SQL renderer's cast-policy lookup, or the contract emitter's literal-default `encodeJson` resolver) keep finding the codec.\n //\n // Two cohorts:\n // - Non-parameterized descriptors: factory must succeed; any throw is a real bug and we let it propagate (no silent try/catch).\n // - Parameterized descriptors: try with empty params. Many parameterized codecs treat params as advisory (e.g. `pg/timestamptz@1` whose precision is rendered into the `nativeType` only and never read by the runtime codec), so an empty-params construction yields a usable representative for id-keyed lookups (e.g. emit-time literal-default encoding). Codecs whose factory genuinely requires params (e.g. `pg/vector@1` threading `length` into the runtime codec) will throw; for those, per-column instances are materialized at runtime by `buildContractCodecRegistry` and the id-keyed lookup miss is correct (the column-aware path resolves them).\n if (!byId.has(codecDescriptor.codecId)) {\n if (codecDescriptor.isParameterized) {\n try {\n const representative = codecDescriptor.factory({} as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n } catch {\n // Factory requires concrete params; skip representative materialization. Per-column instances are built at runtime; id-keyed lookup miss is the correct outcome here.\n }\n } else {\n const representative = codecDescriptor.factory(undefined as never)({\n name: `<lookup:${codecDescriptor.codecId}>`,\n } as Parameters<ReturnType<typeof codecDescriptor.factory>>[0]);\n byId.set(codecDescriptor.codecId, representative);\n }\n }\n }\n }\n return {\n get: (id) => byId.get(id),\n forCodecRef(ref: CodecRef) {\n const d = descriptorsById.get(ref.codecId);\n if (d === undefined) {\n throw runtimeError(\n 'RUNTIME.CODEC_DESCRIPTOR_MISSING',\n `No codec descriptor registered for codecId '${ref.codecId}'.`,\n { codecId: ref.codecId },\n );\n }\n return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` });\n },\n forColumn: () => undefined,\n targetTypesFor: (id) => targetTypesById.get(id),\n metaFor: (id) => metaById.get(id),\n renderOutputTypeFor: (id, params) => renderersById.get(id)?.(params),\n };\n}\n\nexport function validateScalarTypeCodecIds(\n scalarTypeDescriptors: ReadonlyMap<string, string>,\n codecLookup: CodecLookup,\n): string[] {\n const errors: string[] = [];\n for (const [typeName, codecId] of scalarTypeDescriptors) {\n if (!codecLookup.get(codecId)) {\n errors.push(\n `Scalar type \"${typeName}\" references codec \"${codecId}\" which is not registered by any component.`,\n );\n }\n }\n return errors;\n}\n\ninterface DependencyDeclaringDescriptor {\n readonly id: string;\n readonly contractSpace?: {\n readonly contractJson?: {\n readonly extensionPacks?: Readonly<Record<string, unknown>>;\n };\n };\n}\n\nfunction readDeclaredDependencyIds(descriptor: DependencyDeclaringDescriptor): readonly string[] {\n const packs = descriptor.contractSpace?.contractJson?.extensionPacks;\n if (packs === null || typeof packs !== 'object') return [];\n return Object.keys(packs);\n}\n\n/**\n * Builds a dependency-respecting load order for the given extension descriptors\n * using Kahn's topological sort algorithm. Dependencies (packs declared in\n * `contractSpace.contractJson.extensionPacks`) are placed before the extensions\n * that depend on them.\n *\n * Throws if the dependency graph contains a cycle, with an error message that\n * names every extension involved in the cycle.\n *\n * Throws if any extension declares a dependency on a pack ID that is not present\n * in the provided list — add the missing pack to the `extensionPacks` list to\n * resolve the error.\n */\n\nexport function buildExtensionLoadOrder(\n extensions: ReadonlyArray<DependencyDeclaringDescriptor>,\n): readonly string[] {\n if (extensions.length === 0) return [];\n\n const idSet = new Set(extensions.map((e) => e.id));\n const inDegree = new Map<string, number>();\n const dependents = new Map<string, string[]>();\n\n for (const ext of extensions) {\n if (!inDegree.has(ext.id)) inDegree.set(ext.id, 0);\n if (!dependents.has(ext.id)) dependents.set(ext.id, []);\n }\n\n for (const ext of extensions) {\n for (const depId of readDeclaredDependencyIds(ext)) {\n if (!idSet.has(depId)) {\n throw new Error(\n `Extension \"${ext.id}\" declares a dependency on \"${depId}\", but \"${depId}\" is not in the provided extension set. Add the missing space to extensionPacks.`,\n );\n }\n inDegree.set(ext.id, (inDegree.get(ext.id) ?? 0) + 1);\n const list = dependents.get(depId);\n if (list !== undefined) list.push(ext.id);\n }\n }\n\n const queue: string[] = [];\n for (const [id, deg] of inDegree) {\n if (deg === 0) queue.push(id);\n }\n queue.sort();\n\n const result: string[] = [];\n while (queue.length > 0) {\n const id = queue.shift();\n if (id === undefined) break;\n result.push(id);\n const children = dependents.get(id) ?? [];\n children.sort();\n for (const childId of children) {\n const newDeg = (inDegree.get(childId) ?? 1) - 1;\n inDegree.set(childId, newDeg);\n if (newDeg === 0) queue.push(childId);\n }\n }\n\n if (result.length < extensions.length) {\n const cycleMembers = extensions\n .map((e) => e.id)\n .filter((id) => !result.includes(id))\n .sort();\n throw new Error(\n `Extension dependency cycle detected. Cycle members: ${cycleMembers.map((id) => `\"${id}\"`).join(', ')}.`,\n );\n }\n\n return result;\n}\n\nexport function createControlStack<TFamilyId extends string, TTargetId extends string>(\n input: CreateControlStackInput<TFamilyId, TTargetId>,\n): ControlStack<TFamilyId, TTargetId> {\n const { family, target, adapter, driver, extensionPacks = [] } = input;\n\n const orderedIds = buildExtensionLoadOrder(extensionPacks);\n const extensionById = new Map(extensionPacks.map((ext) => [ext.id, ext]));\n const orderedExtensionPacks = orderedIds\n .map((id) => extensionById.get(id))\n .filter((ext): ext is ControlExtensionDescriptor<TFamilyId, TTargetId> => ext !== undefined);\n\n const allDescriptors = [family, target, ...(adapter ? [adapter] : []), ...orderedExtensionPacks];\n\n const codecLookup = extractCodecLookup(allDescriptors);\n const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);\n\n return {\n family,\n target,\n adapter,\n driver,\n extensionPacks: orderedExtensionPacks,\n\n codecTypeImports: extractCodecTypeImports(allDescriptors),\n queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),\n extensionIds: extractComponentIds(family, target, adapter, orderedExtensionPacks),\n codecLookup,\n authoringContributions: assembleAuthoringContributions(allDescriptors),\n scalarTypeDescriptors,\n controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),\n };\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type { SchemaVerificationNode } from './control-result-types';\n\nexport type VerificationStatus = SchemaVerificationNode['status'];\n\nexport type VerifierOutcome = VerificationStatus | 'suppress';\n\n/**\n * Target-neutral classification of a verifier finding, abstracted away from any\n * one storage model's vocabulary. Each family classifies its own concrete issue\n * kinds into these categories; the framework only grades the category against a\n * control policy.\n *\n * - `declaredMissing` — a declared object/element is absent from the database.\n * - `declaredIncompatible` — a declared object/element exists but its shape diverges.\n * - `valueDrift` — the value set of an existing type drifted (e.g. enum values).\n * - `extraNestedElement` — an undeclared element nested inside a declared object\n * (a SQL column, a document field).\n * - `extraAuxiliary` — an undeclared auxiliary attached to a declared object\n * (a SQL constraint/index, a Mongo index/validator).\n * - `extraTopLevelObject` — an undeclared top-level object (a SQL table, a\n * Mongo collection).\n */\nexport type VerifierIssueCategory =\n | 'declaredMissing'\n | 'declaredIncompatible'\n | 'valueDrift'\n | 'extraNestedElement'\n | 'extraAuxiliary'\n | 'extraTopLevelObject';\n\n/**\n * Grades a target-neutral issue category against a control policy.\n *\n * - `observed` warns on everything.\n * - `tolerated` suppresses only an extra nested element (everything else fails).\n * - `external` suppresses every extra category and value drift (existence and\n * declared-shape divergences still fail).\n * - `managed` (and any other) fails.\n */\nexport function dispositionForCategory(\n controlPolicy: ControlPolicy,\n category: VerifierIssueCategory,\n): VerifierOutcome {\n if (controlPolicy === 'observed') {\n return 'warn';\n }\n if (controlPolicy === 'tolerated' && category === 'extraNestedElement') {\n return 'suppress';\n }\n if (controlPolicy === 'external') {\n if (\n category === 'extraNestedElement' ||\n category === 'extraAuxiliary' ||\n category === 'extraTopLevelObject' ||\n category === 'valueDrift'\n ) {\n return 'suppress';\n }\n }\n return 'fail';\n}\n"],"mappings":";;;;;AAkBA,SAAgB,cACd,QAC4D;CAC5D,OAAO,gBAAgB,UAAU,CAAC,CAAE,OAAmC;AACzE;AAMA,SAAgB,cACd,UACwF;CACxF,OACE,kBAAkB,YAClB,OAAQ,SAAqC,oBAAoB;AAErE;AAUA,SAAgB,oBACd,UAC8F;CAC9F,OACE,sBAAsB,YACtB,OAAQ,SAAqC,wBAAwB;AAEzE;AAWA,SAAgB,oBACd,UACmF;CACnF,OACE,wBAAwB,YACxB,OAAQ,SAAqC,0BAA0B;AAE3E;;;ACtEA,MAAa,6BAA6B;AAC1C,MAAa,4BAA4B;AACzC,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;;;AC4B1C,IAAa,iBAAb,MAA4B;CAC1B;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAgC;EAC1C,KAAK,OAAO,QAAQ;EACpB,KAAK,KAAK,QAAQ;EAClB,KAAK,QAAQ,QAAQ;EACrB,IAAI,QAAQ,SAAS,KAAA,GAAW,KAAK,OAAO,QAAQ;EACpD,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;EAC5D,OAAO,OAAO,IAAI;CACpB;CAEA,OAA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AAgB,uBACd,eACA,UACiB;CACjB,IAAI,kBAAkB,YACpB,OAAO;CAET,IAAI,kBAAkB,eAAe,aAAa,sBAChD,OAAO;CAET,IAAI,kBAAkB;MAElB,aAAa,wBACb,aAAa,oBACb,aAAa,yBACb,aAAa,cAEb,OAAO;CAAA;CAGX,OAAO;AACT"} |
@@ -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-BLiwDP1D.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-B-ABhSOs.mjs"; | ||
@@ -3,0 +3,0 @@ //#region src/execution/execution-instances.d.ts |
@@ -1,4 +0,4 @@ | ||
| import { r as CodecLookup } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { B as PslExtensionBlockAttribute, F as PslBlockParamOption, G as PslExtensionBlockParamRef, H as PslExtensionBlockParamBare, I as PslBlockParamRef, J as PslPosition, K as PslExtensionBlockParamScalarValue, L as PslBlockParamValue, N as PslBlockParam, P as PslBlockParamList, R as PslDiagnosticCode, U as PslExtensionBlockParamList, V as PslExtensionBlockAttributeArg, W as PslExtensionBlockParamOption, Y as PslSpan, h as AuthoringPslBlockDescriptorNamespace, m as AuthoringPslBlockDescriptor, q as PslExtensionBlockParamValue, z as PslExtensionBlock } from "./framework-authoring-qyokbMY7.mjs"; | ||
| import { A as flatPslCompositeTypes, C as PslNamespace, D as PslTypesBlock, E as PslTypeConstructorCall, F as namespacePslExtensionBlocks, M as flatPslModels, N as makePslNamespace, O as PslUniqueConstraint, P as makePslNamespaceEntries, S as PslNamedTypeDeclaration, T as PslReferentialAction, _ as PslField, a as PslAttributeArgument, b as PslModel, c as PslAttributeTarget, d as PslDefaultLiteralValue, f as PslDefaultValue, g as PslEnumValue, h as PslEnum, i as PslAttribute, j as flatPslEnums, k as UNSPECIFIED_PSL_NAMESPACE_ID, 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 PslFieldAttribute, w as PslNamespaceEntry, x as PslModelAttribute, y as PslIndexConstraint } from "./psl-ast-DjFPjnlM.mjs"; | ||
| import { r as CodecLookup } from "./codec-types-29q8imKF.mjs"; | ||
| import { B as PslExtensionBlockAttribute, F as PslBlockParamOption, G as PslExtensionBlockParamRef, H as PslExtensionBlockParamBare, I as PslBlockParamRef, J as PslPosition, K as PslExtensionBlockParamScalarValue, L as PslBlockParamValue, N as PslBlockParam, P as PslBlockParamList, R as PslDiagnosticCode, U as PslExtensionBlockParamList, V as PslExtensionBlockAttributeArg, W as PslExtensionBlockParamOption, Y as PslSpan, h as AuthoringPslBlockDescriptorNamespace, m as AuthoringPslBlockDescriptor, q as PslExtensionBlockParamValue, z as PslExtensionBlock } from "./framework-authoring-BXiebZGn.mjs"; | ||
| import { A as flatPslCompositeTypes, C as PslNamespace, D as PslTypesBlock, E as PslTypeConstructorCall, F as namespacePslExtensionBlocks, M as flatPslModels, N as makePslNamespace, O as PslUniqueConstraint, P as makePslNamespaceEntries, S as PslNamedTypeDeclaration, T as PslReferentialAction, _ as PslField, a as PslAttributeArgument, b as PslModel, c as PslAttributeTarget, d as PslDefaultLiteralValue, f as PslDefaultValue, g as PslEnumValue, h as PslEnum, i as PslAttribute, j as flatPslEnums, k as UNSPECIFIED_PSL_NAMESPACE_ID, 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 PslFieldAttribute, w as PslNamespaceEntry, x as PslModelAttribute, y as PslIndexConstraint } from "./psl-ast-CHgjnZ3h.mjs"; | ||
@@ -5,0 +5,0 @@ //#region src/control/psl-extension-block-validator.d.ts |
+12
-10
@@ -1,2 +0,2 @@ | ||
| import { t as CodecCallContext } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { t as CodecCallContext } from "./codec-types-29q8imKF.mjs"; | ||
| import { PlanMeta } from "@prisma-next/contract/types"; | ||
@@ -620,3 +620,3 @@ | ||
| //#endregion | ||
| //#region src/execution/runtime-error.d.ts | ||
| //#region src/shared/runtime-error.d.ts | ||
| interface RuntimeErrorEnvelope extends Error { | ||
@@ -629,2 +629,12 @@ readonly code: string; | ||
| /** | ||
| * Type guard for the runtime-error envelope produced by `runtimeError`. | ||
| * | ||
| * Prefer this over duck-typing on `error.code` directly so consumers stay | ||
| * insulated from the envelope's internal shape. | ||
| */ | ||
| declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope; | ||
| declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope; | ||
| //#endregion | ||
| //#region src/execution/runtime-error.d.ts | ||
| /** | ||
| * Stable code emitted by the runtime when an in-flight `execute()` | ||
@@ -647,10 +657,2 @@ * is cancelled via the per-query `AbortSignal`. The envelope's | ||
| /** | ||
| * Type guard for the runtime-error envelope produced by `runtimeError`. | ||
| * | ||
| * Prefer this over duck-typing on `error.code` directly so consumers stay | ||
| * insulated from the envelope's internal shape. | ||
| */ | ||
| declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope; | ||
| declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope; | ||
| /** | ||
| * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the | ||
@@ -657,0 +659,0 @@ * abort was observed — codec call sites (`encode` / `decode` / `stream`) |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/annotations.ts","../src/execution/async-iterable-result.ts","../src/execution/query-plan.ts","../src/execution/runtime-middleware.ts","../src/execution/before-execute-chain.ts","../src/execution/runtime-error.ts","../src/execution/race-against-abort.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts","../src/meta-builder.ts"],"mappings":";;;;;;;;AAmBA;;;;AAAyB;AAazB;;;;;;;;KAbY,aAAA;;;;;;;;;;;;UAaK,eAAA,wBAAuC,aAAA;EAAA,SAC7C,YAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA,EAAO,OAAA;EAAA,SACP,YAAA,EAAc,WAAA,CAAY,KAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDxB;AAyBb;;;;;;;;;;AAEuC;AAwCvC;UAzEiB,gBAAA,wBAAwC,aAAA;EAAA,CACtD,KAAA,EAAO,OAAA,GAAU,eAAA,CAAgB,OAAA,EAAS,KAAA;EAAA,SAClC,SAAA;EAAA,SACA,YAAA,EAAc,WAAA,CAAY,KAAA;EACnC,IAAA,CAAK,IAAA;IAAA,SACM,IAAA;MAAA,SAAiB,WAAA,GAAc,MAAA;IAAA;EAAA,IACtC,OAAA;AAAA;;;;;;;;;;;AAqE8B;AA6FpC;;;;;;;;;;;UAzIiB,uBAAA,eAAsC,aAAA;EAAA,SAC5C,SAAA;EAAA,SACA,YAAA,WAAuB,KAAK;AAAA;;;;;;;;;;;;;;;;;;;;AA6IP;AA4BhC;;;;;;;;;;;;;;;AAGsB;;iBApIN,gBAAA,kCAAkD,aAAA,EAChE,OAAA,EAAS,uBAAA,CAAwB,KAAA,MAC9B,gBAAA,CAAiB,OAAA,EAAS,KAAA;;ACzJ/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KDsPY,gBAAA,WACA,aAAA,sBACU,eAAA,UAAyB,aAAA,8BAExB,EAAA,GAAK,EAAA,CAAG,CAAA,UAAW,eAAA,yBACpC,CAAA,SAAU,KAAA,GACR,eAAA,CAA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AA;EAAA,SAEhD,KAAA,IAAS,OAAA;EAElB,OAAA,MACE,IAAA,EAAM,KAAA;IAAA,SAAmB,IAAA,GAAO,GAAA;EAAA,GAChC,OAAA,GAAU,qBAAA,GACT,mBAAA,CAAoB,GAAA;AAAA;;;;;;AR7FzB;;;;AAAyB;AAazB;;;;;;;;;;;;;;;;;;;;AAI0C;AA4C1C;US5CiB,WAAA,WAAsB,aAAA;EACrC,QAAA,kBAA0B,aAAA,EACxB,UAAA,EAAY,CAAA,SAAU,KAAA,GAAQ,eAAA,CAAgB,CAAA,EAAG,KAAA;AAAA;;;;;;;;;;;UAcpC,eAAA,WAA0B,aAAA,UAAuB,WAAA,CAAY,CAAA;EAAA,SACnE,WAAA,EAAa,WAAA,SAAoB,eAAA,UAAyB,aAAA;AAAA;;;;;;;;;;iBA0CrD,iBAAA,WAA4B,aAAA,EAC1C,IAAA,EAAM,CAAA,EACN,YAAA,WACC,eAAA,CAAgB,CAAA"} | ||
| {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/annotations.ts","../src/execution/async-iterable-result.ts","../src/execution/query-plan.ts","../src/execution/runtime-middleware.ts","../src/execution/before-execute-chain.ts","../src/shared/runtime-error.ts","../src/execution/runtime-error.ts","../src/execution/race-against-abort.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts","../src/meta-builder.ts"],"mappings":";;;;;;;;AAmBA;;;;AAAyB;AAazB;;;;;;;;KAbY,aAAA;;;;;;;;;;;;UAaK,eAAA,wBAAuC,aAAA;EAAA,SAC7C,YAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA,EAAO,OAAA;EAAA,SACP,YAAA,EAAc,WAAA,CAAY,KAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDxB;AAyBb;;;;;;;;;;AAEuC;AAwCvC;UAzEiB,gBAAA,wBAAwC,aAAA;EAAA,CACtD,KAAA,EAAO,OAAA,GAAU,eAAA,CAAgB,OAAA,EAAS,KAAA;EAAA,SAClC,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A,EACN,YAAA,WACC,eAAA,CAAgB,CAAA"} |
+1
-33
@@ -0,1 +1,2 @@ | ||
| import { n as runtimeError, t as isRuntimeError } from "./runtime-error-B2gWOtgH.mjs"; | ||
| //#region src/execution/runtime-error.ts | ||
@@ -18,35 +19,2 @@ /** | ||
| /** | ||
| * Type guard for the runtime-error envelope produced by `runtimeError`. | ||
| * | ||
| * Prefer this over duck-typing on `error.code` directly so consumers stay | ||
| * insulated from the envelope's internal shape. | ||
| */ | ||
| function isRuntimeError(error) { | ||
| return error instanceof Error && "code" in error && typeof error.code === "string" && "category" in error && "severity" in error; | ||
| } | ||
| function runtimeError(code, message, details) { | ||
| const error = new Error(message); | ||
| Object.defineProperty(error, "name", { | ||
| value: "RuntimeError", | ||
| configurable: true | ||
| }); | ||
| return Object.assign(error, { | ||
| code, | ||
| category: resolveCategory(code), | ||
| severity: "error", | ||
| message, | ||
| details | ||
| }); | ||
| } | ||
| function resolveCategory(code) { | ||
| const prefix = code.split(".")[0] ?? "RUNTIME"; | ||
| switch (prefix) { | ||
| case "PLAN": | ||
| case "CONTRACT": | ||
| case "LINT": | ||
| case "BUDGET": return prefix; | ||
| default: return "RUNTIME"; | ||
| } | ||
| } | ||
| /** | ||
| * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the | ||
@@ -53,0 +21,0 @@ * abort was observed — codec call sites (`encode` / `decode` / `stream`) |
+7
-7
| { | ||
| "name": "@prisma-next/framework-components", | ||
| "version": "0.13.0-dev.20", | ||
| "version": "0.13.0-dev.21", | ||
| "license": "Apache-2.0", | ||
@@ -9,6 +9,6 @@ "type": "module", | ||
| "dependencies": { | ||
| "@prisma-next/contract": "0.13.0-dev.20", | ||
| "@prisma-next/operations": "0.13.0-dev.20", | ||
| "@prisma-next/ts-render": "0.13.0-dev.20", | ||
| "@prisma-next/utils": "0.13.0-dev.20", | ||
| "@prisma-next/contract": "0.13.0-dev.21", | ||
| "@prisma-next/operations": "0.13.0-dev.21", | ||
| "@prisma-next/ts-render": "0.13.0-dev.21", | ||
| "@prisma-next/utils": "0.13.0-dev.21", | ||
| "@standard-schema/spec": "^1.1.0", | ||
@@ -18,4 +18,4 @@ "arktype": "^2.2.0" | ||
| "devDependencies": { | ||
| "@prisma-next/tsconfig": "0.13.0-dev.20", | ||
| "@prisma-next/tsdown": "0.13.0-dev.20", | ||
| "@prisma-next/tsconfig": "0.13.0-dev.21", | ||
| "@prisma-next/tsdown": "0.13.0-dev.21", | ||
| "tsdown": "0.22.1", | ||
@@ -22,0 +22,0 @@ "typescript": "5.9.3", |
| import { blindCast } from '@prisma-next/utils/casts'; | ||
| import type { Codec } from '../shared/codec'; | ||
| import type { CodecLookup, CodecMeta } from '../shared/codec-types'; | ||
| import type { AnyCodecDescriptor } from '../shared/codec-descriptor'; | ||
| import type { CodecLookup, CodecMeta, CodecRef, CodecRegistry } from '../shared/codec-types'; | ||
| import type { | ||
@@ -25,2 +26,4 @@ AuthoringContributions, | ||
| } from '../shared/mutation-default-types'; | ||
| import { materializeCodec } from '../shared/resolve-codec'; | ||
| import { runtimeError } from '../shared/runtime-error'; | ||
| import type { TypesImportSpec } from '../shared/types-import-spec'; | ||
@@ -55,3 +58,3 @@ import type { | ||
| readonly extensionIds: ReadonlyArray<string>; | ||
| readonly codecLookup: CodecLookup; | ||
| readonly codecLookup: CodecRegistry; | ||
| readonly authoringContributions: AssembledAuthoringContributions; | ||
@@ -299,4 +302,5 @@ readonly scalarTypeDescriptors: ReadonlyMap<string, string>; | ||
| descriptors: ReadonlyArray<Pick<ComponentMetadata & { id: string }, 'types' | 'id'>>, | ||
| ): CodecLookup { | ||
| ): CodecRegistry { | ||
| const byId = new Map<string, Codec>(); | ||
| const descriptorsById = new Map<string, AnyCodecDescriptor>(); | ||
| const targetTypesById = new Map<string, readonly string[]>(); | ||
@@ -319,2 +323,3 @@ const metaById = new Map<string, CodecMeta>(); | ||
| owners.set(codecDescriptor.codecId, descriptorId); | ||
| descriptorsById.set(codecDescriptor.codecId, codecDescriptor); | ||
| if (Array.isArray(codecDescriptor.targetTypes)) { | ||
@@ -355,2 +360,14 @@ targetTypesById.set(codecDescriptor.codecId, codecDescriptor.targetTypes); | ||
| get: (id) => byId.get(id), | ||
| forCodecRef(ref: CodecRef) { | ||
| const d = descriptorsById.get(ref.codecId); | ||
| if (d === undefined) { | ||
| throw runtimeError( | ||
| 'RUNTIME.CODEC_DESCRIPTOR_MISSING', | ||
| `No codec descriptor registered for codecId '${ref.codecId}'.`, | ||
| { codecId: ref.codecId }, | ||
| ); | ||
| } | ||
| return materializeCodec(d, ref, { name: `<ref:${ref.codecId}>` }); | ||
| }, | ||
| forColumn: () => undefined, | ||
| targetTypesFor: (id) => targetTypesById.get(id), | ||
@@ -357,0 +374,0 @@ metaFor: (id) => metaById.get(id), |
@@ -1,8 +0,7 @@ | ||
| export interface RuntimeErrorEnvelope extends Error { | ||
| readonly code: string; | ||
| readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME'; | ||
| readonly severity: 'error'; | ||
| readonly details?: Record<string, unknown>; | ||
| } | ||
| import type { RuntimeErrorEnvelope } from '../shared/runtime-error'; | ||
| import { runtimeError } from '../shared/runtime-error'; | ||
| export type { RuntimeErrorEnvelope } from '../shared/runtime-error'; | ||
| export { isRuntimeError, runtimeError } from '../shared/runtime-error'; | ||
| /** | ||
@@ -34,51 +33,2 @@ * Stable code emitted by the runtime when an in-flight `execute()` | ||
| /** | ||
| * Type guard for the runtime-error envelope produced by `runtimeError`. | ||
| * | ||
| * Prefer this over duck-typing on `error.code` directly so consumers stay | ||
| * insulated from the envelope's internal shape. | ||
| */ | ||
| export function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope { | ||
| return ( | ||
| error instanceof Error && | ||
| 'code' in error && | ||
| typeof (error as { code?: unknown }).code === 'string' && | ||
| 'category' in error && | ||
| 'severity' in error | ||
| ); | ||
| } | ||
| export function runtimeError( | ||
| code: string, | ||
| message: string, | ||
| details?: Record<string, unknown>, | ||
| ): RuntimeErrorEnvelope { | ||
| const error = new Error(message) as RuntimeErrorEnvelope; | ||
| Object.defineProperty(error, 'name', { | ||
| value: 'RuntimeError', | ||
| configurable: true, | ||
| }); | ||
| return Object.assign(error, { | ||
| code, | ||
| category: resolveCategory(code), | ||
| severity: 'error' as const, | ||
| message, | ||
| details, | ||
| }); | ||
| } | ||
| function resolveCategory(code: string): RuntimeErrorEnvelope['category'] { | ||
| const prefix = code.split('.')[0] ?? 'RUNTIME'; | ||
| switch (prefix) { | ||
| case 'PLAN': | ||
| case 'CONTRACT': | ||
| case 'LINT': | ||
| case 'BUDGET': | ||
| return prefix; | ||
| default: | ||
| return 'RUNTIME'; | ||
| } | ||
| } | ||
| /** | ||
| * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the | ||
@@ -85,0 +35,0 @@ * abort was observed — codec call sites (`encode` / `decode` / `stream`) |
@@ -19,2 +19,3 @@ /** | ||
| CodecRef, | ||
| CodecRegistry, | ||
| CodecTrait, | ||
@@ -30,1 +31,2 @@ } from '../shared/codec-types'; | ||
| export { column } from '../shared/column-spec'; | ||
| export { materializeCodec, validateCodecTypeParams } from '../shared/resolve-codec'; |
@@ -39,3 +39,3 @@ import type { JsonValue } from '@prisma-next/contract/types'; | ||
| * | ||
| * - `get(id)` returns the runtime {@link Codec} instance for the codec id (used by `family.deserializeContract` for `decodeJson` of literal column defaults). | ||
| * - `get(id)` returns a representative {@link Codec} instance for the codec id (used by `family.deserializeContract` for `decodeJson` of literal column defaults). For parameterized codecs whose factory requires concrete params, this may return `undefined` — use `CodecRegistry.forCodecRef` instead. | ||
| * - `targetTypesFor(id)` exposes the codec-id-keyed `targetTypes` metadata the runtime instance no longer carries (TML-2357). Returns the same array `CodecDescriptor.targetTypes` would; for Mongo (whose registration doesn't yet resolve through the unified descriptor map — TML-2324) the family-side assembly populates this directly from the contributor's codec metadata. | ||
@@ -52,2 +52,20 @@ * - `metaFor(id)` exposes the codec-id-keyed `meta` (e.g. SQL-side `db.sql.postgres.nativeType`) the runtime instance no longer carries. | ||
| /** | ||
| * Full codec registry — the read surface of {@link CodecLookup} plus codec resolution by ref or | ||
| * column coordinate. Built once by `extractCodecLookup` and passed by reference to adapters and | ||
| * other consumers that need to materialise codecs at runtime. | ||
| * | ||
| * - `forCodecRef(ref)` materialises a codec from a {@link CodecRef}. Throws | ||
| * `RUNTIME.CODEC_DESCRIPTOR_MISSING` for unknown ids and `RUNTIME.TYPE_PARAMS_INVALID` on param | ||
| * schema rejection. | ||
| * - `forColumn(namespaceId, table, column)` returns the codec for a specific column coordinate, or | ||
| * `undefined` when no column-to-codec mapping is present. This registry is contract-free so it | ||
| * always returns `undefined` — the method exists so the object structurally satisfies the SQL | ||
| * `ContractCodecRegistry` interface. | ||
| */ | ||
| export interface CodecRegistry extends CodecLookup { | ||
| forCodecRef(ref: CodecRef): Codec; | ||
| forColumn(namespaceId: string, table: string, column: string): Codec | undefined; | ||
| } | ||
| export const emptyCodecLookup: CodecLookup = { | ||
@@ -54,0 +72,0 @@ get: () => undefined, |
| import { JsonValue } from "@prisma-next/contract/types"; | ||
| import { StandardSchemaV1 } from "@standard-schema/spec"; | ||
| //#region src/shared/codec-descriptor.d.ts | ||
| /** | ||
| * Unified codec descriptor. Every codec in the framework registers through this shape — non-parameterized codecs use `P = void` and a constant factory that returns the same shared codec instance for every column; parameterized codecs use a non-empty `P` and a curried higher-order factory that returns a per-instance codec. | ||
| * | ||
| * The descriptor is the codec-id-keyed source of truth for static metadata (`traits`, `targetTypes`, `meta`) and registration concerns (`paramsSchema` for JSON-boundary validation; optional `renderOutputType` for the `contract.d.ts` emit path). The runtime `Codec` instance returned by `factory(params)(ctx)` carries only the conversion behavior. | ||
| * | ||
| * Whether a codec id "is parameterized" stops being a registration-time distinction — it's a property of `P` on the descriptor. The descriptor map indexes every descriptor by `codecId`; both `descriptorFor(codecId)` and `forColumn(table, column)` resolve through the same map without branching on parameterization. | ||
| * | ||
| * @template P - The shape of the params accepted by the factory (`void` for non-parameterized codecs; a record like `{ length: number }` for parameterized codecs). | ||
| * | ||
| * Codec-registry-unification project § Decision. | ||
| */ | ||
| interface CodecDescriptor<P = void> { | ||
| /** The codec ID this descriptor applies to (e.g. `pg/vector@1`, `pg/text@1`). */ | ||
| readonly codecId: string; | ||
| /** Semantic traits for operator gating (e.g. equality, order, numeric). */ | ||
| readonly traits: readonly CodecTrait[]; | ||
| /** Database-native type names this codec handles (e.g. `['timestamptz']`). */ | ||
| readonly targetTypes: readonly string[]; | ||
| /** Optional family-specific metadata (e.g. SQL-side `db.sql.postgres.nativeType`). */ | ||
| readonly meta?: CodecMeta; | ||
| /** Standard Schema validator for the factory's params. Validates JSON-sourced params at the contract boundary (PSL → IR; `contract.json` → runtime). For non-parameterized codecs (`P = void`), the schema validates `void`/`undefined` — the framework supplies no params at the call boundary. */ | ||
| readonly paramsSchema: StandardSchemaV1<P>; | ||
| /** Whether this descriptor is parameterized — i.e. its `paramsSchema` is something other than the singleton `voidParamsSchema`. Consumers that need to gate column-aware dispatch read this directly rather than threading a free-floating `(codecId) => boolean` callback. */ | ||
| readonly isParameterized: boolean; | ||
| /** Emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for given params (e.g. `Vector<1536>`). Optional; absent renderers cause the emitter to fall back to the codec's base output type. Non-parameterized codecs typically omit it. */ | ||
| readonly renderOutputType?: (params: P) => string | undefined; | ||
| /** The curried higher-order codec. For non-parameterized codecs, the factory is constant — every call returns the same shared codec instance. For parameterized codecs, the factory is called once per `storage.types` instance (or once per inline-`typeParams` column), with `ctx` carrying the column set the resulting codec serves. */ | ||
| readonly factory: (params: P) => (ctx: CodecInstanceContext) => Codec; | ||
| } | ||
| /** | ||
| * Variance-erased {@link CodecDescriptor} alias. `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly), so `CodecDescriptor<P>` does not extend `CodecDescriptor<unknown>` for specific `P`. Heterogeneous descriptor collections — e.g. `SqlStaticContributions.codecs:` returning a list that mixes parameterized and non-parameterized descriptors — type against this alias and narrow per codec id at the consumer. | ||
| * | ||
| * Codec-registry-unification spec § Decision: every codec resolves through one descriptor map; reads are non-branching. | ||
| */ | ||
| type AnyCodecDescriptor = CodecDescriptor<any>; | ||
| /** | ||
| * Abstract base class for concrete codec descriptors. | ||
| * | ||
| * Codec authors extend this class with their typed `TParams` and declare `codecId`, `traits`, `targetTypes`, `paramsSchema`, the curried `factory(params)`, and (optionally) `renderOutputType`. | ||
| * | ||
| * Implements the {@link CodecDescriptor} interface so a concrete subclass instance is directly usable wherever the framework expects a `CodecDescriptor<P>`. | ||
| */ | ||
| declare abstract class CodecDescriptorImpl<TParams = void> implements CodecDescriptor<TParams> { | ||
| abstract readonly codecId: string; | ||
| abstract readonly traits: readonly CodecTrait[]; | ||
| abstract readonly targetTypes: readonly string[]; | ||
| readonly meta?: CodecMeta; | ||
| abstract readonly paramsSchema: StandardSchemaV1<TParams>; | ||
| /** Boolean derived from `paramsSchema`: `true` whenever the schema is not the singleton `voidParamsSchema`. */ | ||
| get isParameterized(): boolean; | ||
| /** Optional emit-path string renderer for `contract.d.ts`. Returns the TypeScript output type expression for the given params (e.g. `Vector<1536>`). Non-parameterized codecs typically omit it. */ | ||
| renderOutputType?(params: TParams): string | undefined; | ||
| /** | ||
| * Materialize a curried codec factory for the given params. Concrete subclasses override with a typed return type (e.g. `factory<N>(params: { length: N }): (ctx) => VectorCodec<N>`); per-codec helpers read the typed return at the *direct* call site, which is what preserves method-level generics. Type extraction (e.g. `ReturnType<D['factory']>`) widens method generics to their constraint — that's why the column-helper surface is per-codec, not polymorphic. | ||
| */ | ||
| abstract factory(params: TParams): (ctx: CodecInstanceContext) => Codec<string, readonly CodecTrait[], unknown, unknown>; | ||
| } | ||
| //#endregion | ||
| //#region src/shared/codec.d.ts | ||
| /** | ||
| * A codec is the contract between an application value and its on-wire and on-contract-disk representations. | ||
| * | ||
| * The author's mental model is two JS-side types — `TInput` (the application JS type) and `TWire` (the database driver wire format) — plus `JsonValue` for build-time contract artifacts. The codec translates `TInput` to `TWire` on writes and back on reads, and to/from `JsonValue` during contract emission and loading. | ||
| * | ||
| * Three representations participate: | ||
| * - **Input** (`TInput`): the JS type at the application boundary. | ||
| * - **Wire** (`TWire`): the format exchanged with the database driver. | ||
| * - **JSON** (`JsonValue`): a JSON-safe form used in contract artifacts. | ||
| * | ||
| * The runtime instance carries only its `id` (the descriptor's `codecId`, set by the factory) and the four conversion methods. Static metadata (`traits`, `targetTypes`, `meta`) and the build-time `renderOutputType` renderer live on the {@link CodecDescriptor} keyed by `codecId` — the read-surface single source of truth. Consumers that need them resolve through `descriptorFor(codecId)`. | ||
| * | ||
| * Codec methods split into two groups: | ||
| * | ||
| * - **Query-time** methods (`encode`, `decode`) run per row/parameter at the IO boundary; they are required and Promise-returning. The per-family codec factory accepts sync or async author functions and lifts sync ones to Promise-shaped methods automatically. | ||
| * - **Build-time** methods (`encodeJson`, `decodeJson`) run when the contract is serialized or loaded. They stay synchronous so contract validation and client construction are synchronous. | ||
| * | ||
| * Target-family codec interfaces extend this base; family-specific concerns (e.g. the SQL `column?` per-call context) layer on through the `CodecCallContext` extension pattern. | ||
| */ | ||
| interface Codec<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown> { | ||
| /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). The factory sets this to the descriptor's `codecId`; consumers use it as a back-reference for descriptor lookups and for decode-error diagnostics. */ | ||
| readonly id: Id; | ||
| /** Phantom carrier for the `TTraits` generic; type-only, undefined at runtime. Runtime traits live on {@link CodecDescriptor.traits}. Implemented as a string-key phantom (`__codecTraits`) rather than `unique symbol` so bundlers that split `.d.ts` chunks do not strand symbol identity on chunk-private paths (the same `TS2742` family that the public re-export of `CodecTypes` works around). */ | ||
| readonly __codecTraits?: TTraits; | ||
| /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */ | ||
| encode(value: TInput, ctx: CodecCallContext): Promise<TWire>; | ||
| /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */ | ||
| decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>; | ||
| /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */ | ||
| encodeJson(value: TInput): JsonValue; | ||
| /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `family.deserializeContract`. */ | ||
| decodeJson(json: JsonValue): TInput; | ||
| } | ||
| /** | ||
| * Abstract base class for concrete codec implementations. | ||
| * | ||
| * Codec authors extend this class with their typed `Id`, `TTraits`, `TWire`, `TInput` and override `encode`/`decode` (and optionally `encodeJson`/`decodeJson`). The runtime instance carries only its `id` (proxied through the descriptor so alias subclasses inherit the descriptor's id automatically) and the conversion methods — static metadata lives on the {@link CodecDescriptor}. | ||
| */ | ||
| declare abstract class CodecImpl<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown> implements Codec<Id, TTraits, TWire, TInput> { | ||
| readonly descriptor: CodecDescriptor<any>; | ||
| /** | ||
| * Variance-erased descriptor reference. Concrete codec subclasses receive the typed descriptor in their own constructors and forward it via `super(descriptor)`; the variance erasure lives at this base because the abstract surface can't carry the concrete `TParams`. | ||
| */ | ||
| constructor(descriptor: CodecDescriptor<any>); | ||
| get id(): Id; | ||
| abstract encode(value: TInput, ctx: CodecCallContext): Promise<TWire>; | ||
| abstract decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>; | ||
| abstract encodeJson(value: TInput): JsonValue; | ||
| abstract decodeJson(json: JsonValue): TInput; | ||
| } | ||
| //#endregion | ||
| //#region src/shared/codec-types.d.ts | ||
| type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual'; | ||
| /** | ||
| * Serializable codec identity carried by every codec-bearing AST node. | ||
| * | ||
| * `(codecId, typeParams?)` is the single fact the runtime needs to materialize a codec via `descriptorFor(codecId).factory(typeParams)(ctx)`. The pair is content-keyed: two refs with the same `codecId` and structurally equal `typeParams` (regardless of object key ordering) resolve to the same memoized {@link Codec} instance. | ||
| * | ||
| * `typeParams` is `JsonValue`-constrained so the ref survives JSON serialization (relevant for AST-embedded migration ops). Non-parameterized codecs leave `typeParams` undefined; the descriptor's `paramsSchema` validates the value at the JSON boundary. | ||
| * | ||
| * Family-agnostic by design — both SQL and Mongo AST nodes carry `codec: CodecRef | undefined`, and the resolver is the only dispatch path that survives serialization. | ||
| */ | ||
| interface CodecRef { | ||
| readonly codecId: string; | ||
| readonly typeParams?: JsonValue; | ||
| } | ||
| /** | ||
| * Per-call context the runtime threads to every `codec.encode` / `codec.decode` invocation for a single `runtime.execute()` call. | ||
| * | ||
| * The framework-level shape is family-agnostic and carries one field: | ||
| * | ||
| * - `signal?: AbortSignal` — per-query cancellation. The runtime returns a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors who forward `signal` to their underlying SDK get true cancellation of in-flight network calls. | ||
| * | ||
| * Family layers extend this base with their own shape-of-call metadata: the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext` (see `@prisma-next/sql-relational-core`). Mongo currently uses this framework type unchanged. Column metadata is intentionally **not** on the framework type — it is a SQL-family concept rooted in SQL's `(table, column)` addressing model and would not generalise to other families. | ||
| * | ||
| * The interface is named explicitly (not inlined) so future framework fields and family extensions can land additively without breaking codec author signatures. | ||
| */ | ||
| interface CodecCallContext { | ||
| readonly signal?: AbortSignal; | ||
| } | ||
| /** | ||
| * Codec-id-keyed read surface threaded into emit and authoring paths. | ||
| * | ||
| * - `get(id)` returns the runtime {@link Codec} instance for the codec id (used by `family.deserializeContract` for `decodeJson` of literal column defaults). | ||
| * - `targetTypesFor(id)` exposes the codec-id-keyed `targetTypes` metadata the runtime instance no longer carries (TML-2357). Returns the same array `CodecDescriptor.targetTypes` would; for Mongo (whose registration doesn't yet resolve through the unified descriptor map — TML-2324) the family-side assembly populates this directly from the contributor's codec metadata. | ||
| * - `metaFor(id)` exposes the codec-id-keyed `meta` (e.g. SQL-side `db.sql.postgres.nativeType`) the runtime instance no longer carries. | ||
| * - `renderOutputTypeFor(id, params)` exposes the codec-id-keyed `renderOutputType` renderer the runtime instance no longer carries. Returns `undefined` when the codec doesn't render a custom type or when the codec id is unknown. | ||
| */ | ||
| interface CodecLookup { | ||
| get(id: string): Codec | undefined; | ||
| targetTypesFor(id: string): readonly string[] | undefined; | ||
| metaFor(id: string): CodecMeta | undefined; | ||
| renderOutputTypeFor(id: string, params: Record<string, unknown>): string | undefined; | ||
| } | ||
| declare const emptyCodecLookup: CodecLookup; | ||
| /** | ||
| * Family-agnostic per-instance context supplied by the framework when applying a higher-order codec factory. Allows stateful codecs (e.g. column-scoped encryption) to derive per-instance state from the materialization site. | ||
| * | ||
| * - `name` — the family-agnostic instance identity. For SQL, the runtime populates this as the `storage.types` instance name (e.g. `Embedding1536`) for typeRef-shaped columns, an inline-column sentinel (`<col:Document.embedding>`) for inline-`typeParams` columns, a shared codec-id sentinel (`<codec:pg/text@1>`) for non-parameterized codec ids, or the canonical cache key (`<codecId>:<canonicalizeJson(typeParams)>`) for ad-hoc refs the contract walk did not pre-populate. Other families pick the analogous identity for their materialization sites. | ||
| * | ||
| * Family-specific extensions (e.g. {@link import('@prisma-next/sql-relational-core/ast').SqlCodecInstanceContext} in the SQL layer) augment this base with domain-shaped column-set metadata. Codec authors target the base when they don't read family-specific metadata; they target the family extension when they do. | ||
| */ | ||
| interface CodecInstanceContext { | ||
| readonly name: string; | ||
| } | ||
| /** | ||
| * Family-agnostic codec metadata. Family-specific extensions augment the base `db.<family>.<target>` block with native-type information; the base shape is an empty object so non-relational codecs can carry no metadata. | ||
| */ | ||
| interface CodecMeta { | ||
| readonly db?: Record<string, unknown>; | ||
| } | ||
| /** | ||
| * Standard Schema validator for `void` params. Accepts only `undefined` (or absent input); rejects any other value so a contract that tries to thread `typeParams` through a non-parameterized codec id fails fast at the JSON boundary instead of silently coercing the value away. Used by the framework-supplied non-parameterized descriptor synthesizer. | ||
| */ | ||
| declare const voidParamsSchema: StandardSchemaV1<void>; | ||
| //#endregion | ||
| export { CodecRef as a, voidParamsSchema as c, AnyCodecDescriptor as d, CodecDescriptor as f, CodecMeta as i, Codec as l, CodecInstanceContext as n, CodecTrait as o, CodecDescriptorImpl as p, CodecLookup as r, emptyCodecLookup as s, CodecCallContext as t, CodecImpl as u }; | ||
| //# sourceMappingURL=codec-types-7Qng7VFc.d.mts.map |
| {"version":3,"file":"codec-types-7Qng7VFc.d.mts","names":[],"sources":["../src/shared/codec-descriptor.ts","../src/shared/codec.ts","../src/shared/codec-types.ts"],"mappings":";;;;;;;;;;;;;;;UA8BiB,eAAA;EAUN;EAAA,SARA,OAAA;EAQ+B;EAAA,SAN/B,MAAA,WAAiB,UAAA;EAUjB;EAAA,SARA,WAAA;EAQoB;EAAA,SANpB,IAAA,GAAO,SAAA;EAQW;EAAA,SANlB,YAAA,EAAc,gBAAA,CAAiB,CAAA;EAMD;EAAA,SAJ9B,eAAA;EAIuD;EAAA,SAFvD,gBAAA,IAAoB,MAAA,EAAQ,CAAA;EAEgC;EAAA,SAA5D,OAAA,GAAU,MAAA,EAAQ,CAAA,MAAO,GAAA,EAAK,oBAAA,KAAyB,KAAA;AAAA;;;AASlB;AAShD;;KATY,kBAAA,GAAqB,eAAe;;;;;;;;uBAS1B,mBAAA,4BAA+C,eAAA,CAAgB,OAAA;EAAA,kBACjE,OAAA;EAAA,kBACA,MAAA,WAAiB,UAAA;EAAA,kBACjB,WAAA;EAAA,SACT,IAAA,GAAO,SAAA;EAAA,kBAEE,YAAA,EAAc,gBAAA,CAAiB,OAAA;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Aa,SAAS;AAAA;;;;;;;;;;;;UAchB,gBAAA;EAAA,SACN,MAAA,GAAS,WAAW;AAAA;;;;;;;;AFcwC;UEHtD,WAAA;EACf,GAAA,CAAI,EAAA,WAAa,KAAA;EACjB,cAAA,CAAe,EAAA;EACf,OAAA,CAAQ,EAAA,WAAa,SAAA;EACrB,mBAAA,CAAoB,EAAA,UAAY,MAAA,EAAQ,MAAA;AAAA;AAAA,cAG7B,gBAAA,EAAkB,WAK9B;;;;;;;;UASgB,oBAAA;EAAA,SACN,IAAI;AAAA;;;;UAME,SAAA;EAAA,SACN,EAAA,GAAK,MAAM;AAAA;;;;cAMT,gBAAA,EAAkB,gBAAgB"} |
| import { r as CodecLookup } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { ColumnDefault, ExecutionMutationDefaultPhases } from "@prisma-next/contract/types"; | ||
| import { Type } from "arktype"; | ||
| //#region src/shared/psl-extension-block.d.ts | ||
| /** | ||
| * Shape-only types for the PSL source-position primitives, diagnostic | ||
| * codes, extension-block descriptor vocabulary, and the uniform | ||
| * extension-block AST node base. | ||
| * | ||
| * These live in the shared plane so an extension's authoring descriptor | ||
| * (`AuthoringPslBlockDescriptor` in `framework-authoring`) can reference | ||
| * them without crossing the shared → migration-plane boundary. The | ||
| * migration-plane `psl-ast.ts` re-exports everything here for consumers | ||
| * that import PSL AST types from the control entrypoint. | ||
| */ | ||
| 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 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' | ||
| /** | ||
| * 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'; | ||
| /** | ||
| * 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 { | ||
| readonly kind: 'option'; | ||
| readonly values: readonly string[]; | ||
| 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 enum2 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 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. | ||
| * - `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; | ||
| 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; | ||
| }; | ||
| type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | 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>; | ||
| }); | ||
| interface AuthoringStorageTypeTemplate { | ||
| readonly codecId: string; | ||
| readonly nativeType: AuthoringTemplateValue; | ||
| readonly typeParams?: Record<string, AuthoringTemplateValue>; | ||
| } | ||
| interface AuthoringTypeConstructorDescriptor { | ||
| readonly kind: 'typeConstructor'; | ||
| readonly args?: readonly AuthoringArgumentDescriptor[]; | ||
| readonly output: AuthoringStorageTypeTemplate; | ||
| } | ||
| interface AuthoringColumnDefaultTemplateLiteral { | ||
| readonly kind: 'literal'; | ||
| readonly value: AuthoringTemplateValue; | ||
| } | ||
| interface AuthoringColumnDefaultTemplateFunction { | ||
| readonly kind: 'function'; | ||
| readonly expression: AuthoringTemplateValue; | ||
| } | ||
| type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction; | ||
| interface 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; | ||
| } | ||
| 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; | ||
| } | ||
| type AuthoringPslBlockDescriptorNamespace = { | ||
| readonly [name: string]: AuthoringPslBlockDescriptor | AuthoringPslBlockDescriptorNamespace; | ||
| }; | ||
| 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; | ||
| } | ||
| declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef; | ||
| declare function isAuthoringTypeConstructorDescriptor(value: unknown): value is AuthoringTypeConstructorDescriptor; | ||
| declare function isAuthoringFieldPresetDescriptor(value: unknown): value is AuthoringFieldPresetDescriptor; | ||
| declare function isAuthoringEntityTypeDescriptor(value: unknown): value is AuthoringEntityTypeDescriptor; | ||
| declare function isAuthoringPslBlockDescriptor(value: unknown): value is AuthoringPslBlockDescriptor; | ||
| /** | ||
| * 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. `isLeafDescriptor` decides which values are descriptors (terminal | ||
| * merge points; same-path registrations across components are reported | ||
| * as duplicates) versus sub-namespaces (recursion targets). | ||
| * | ||
| * 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[], isLeafDescriptor: (value: unknown) => boolean, label: string): void; | ||
| declare function assertNoCrossRegistryCollisions(typeNamespace: AuthoringTypeNamespace, fieldNamespace: AuthoringFieldNamespace, entityTypeNamespace?: AuthoringEntityTypeNamespace, pslBlockNamespace?: AuthoringPslBlockDescriptorNamespace): void; | ||
| declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue, args: readonly unknown[]): unknown; | ||
| declare function validateAuthoringHelperArguments(helperPath: string, descriptors: readonly AuthoringArgumentDescriptor[] | undefined, args: readonly unknown[]): void; | ||
| declare function instantiateAuthoringTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor, args: readonly unknown[]): { | ||
| readonly codecId: string; | ||
| readonly nativeType: string; | ||
| readonly typeParams?: Record<string, unknown>; | ||
| }; | ||
| declare function instantiateAuthoringEntityType(helperPath: string, descriptor: AuthoringEntityTypeDescriptor, args: readonly unknown[], ctx: AuthoringEntityContext): unknown; | ||
| declare function instantiateAuthoringFieldPreset(descriptor: AuthoringFieldPresetDescriptor, args: readonly unknown[]): { | ||
| readonly descriptor: { | ||
| readonly codecId: string; | ||
| readonly nativeType: string; | ||
| readonly typeParams?: Record<string, unknown>; | ||
| }; | ||
| readonly nullable: boolean; | ||
| readonly default?: ColumnDefault; | ||
| readonly executionDefaults?: ExecutionMutationDefaultPhases; | ||
| readonly id: boolean; | ||
| readonly unique: boolean; | ||
| }; | ||
| //#endregion | ||
| export { mergeAuthoringNamespaces as A, PslExtensionBlockAttribute as B, instantiateAuthoringFieldPreset as C, isAuthoringFieldPresetDescriptor as D, isAuthoringEntityTypeDescriptor as E, PslBlockParamOption as F, PslExtensionBlockParamRef as G, PslExtensionBlockParamBare as H, PslBlockParamRef as I, PslPosition as J, PslExtensionBlockParamScalarValue as K, PslBlockParamValue as L, validateAuthoringHelperArguments as M, PslBlockParam as N, isAuthoringPslBlockDescriptor as O, PslBlockParamList as P, PslDiagnosticCode as R, instantiateAuthoringEntityType as S, isAuthoringArgRef as T, PslExtensionBlockParamList as U, PslExtensionBlockAttributeArg as V, PslExtensionBlockParamOption as W, PslSpan as Y, AuthoringTemplateValue as _, AuthoringDiagnosticSink as a, assertNoCrossRegistryCollisions as b, AuthoringEntityTypeFactoryOutput as c, AuthoringFieldNamespace as d, AuthoringFieldPresetDescriptor as f, AuthoringStorageTypeTemplate as g, AuthoringPslBlockDescriptorNamespace as h, AuthoringContributions as i, resolveAuthoringTemplateValue as j, isAuthoringTypeConstructorDescriptor as k, AuthoringEntityTypeNamespace as l, AuthoringPslBlockDescriptor as m, AuthoringArgumentDescriptor as n, AuthoringEntityContext as o, AuthoringFieldPresetOutput as p, PslExtensionBlockParamValue as q, AuthoringColumnDefaultTemplate as r, AuthoringEntityTypeDescriptor as s, AuthoringArgRef as t, AuthoringEntityTypeTemplateOutput as u, AuthoringTypeConstructorDescriptor as v, instantiateAuthoringTypeConstructor as w, hasRegisteredFieldNamespace as x, AuthoringTypeNamespace as y, PslExtensionBlock as z }; | ||
| //# sourceMappingURL=framework-authoring-qyokbMY7.d.mts.map |
| {"version":3,"file":"framework-authoring-qyokbMY7.d.mts","names":[],"sources":["../src/shared/psl-extension-block.ts","../src/shared/framework-authoring.ts"],"mappings":";;;;;;;;;;AAYA;;;;;;UAAiB,WAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,OAAA;EAAA,SACN,KAAA,EAAO,WAAA;EAAA,SACP,GAAA,EAAK,WAAW;AAAA;AAAA,KAGf,iBAAA;;;AAHe;AAG3B;;;;AAA6B;AAwE7B;;;;;;;;;;;;;;AAIqB;AAErB;;;;;;;;;AAImB;AAGnB;;;;;;;;AAGmB;AAGnB;;AAHmB;;;;;;AAMA;AAGnB;;;;;;KAzBY,aAAA,GACR,gBAAA,GACA,kBAAA,GACA,mBAAA,GACA,iBAAA;AAAA,UAEa,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,kBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,mBAAA;EAAA,SACN,IAAA;EAAA,SACA,MAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,iBAAA;EAAA,SACN,IAAA;EAAA,SACA,EAAA,EAAI,aAAa;EAAA,SACjB,QAAA;AAAA;;;;;;;;;AA+Ba;AAGxB;;;;;;;;;KAbY,2BAAA,GACR,yBAAA,GACA,iCAAA,GACA,4BAAA,GACA,0BAAA,GACA,0BAAA;AAAA,UAEa,yBAAA;EAAA,SACN,IAA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AAA,IAAS,8BAA8B;AAAA,iBAU1B,+BAAA,CACd,KAAA,YACC,KAAA,IAAS,6BAA6B;AAAA,iBAqBzB,6BAAA,CACd,KAAA,YACC,KAAA,IAAS,2BAA2B;;;;;;AA/Ra;AAAG;;iBAyUvC,2BAAA,CACd,aAAA,EAAe,sBAAsB,cACrC,SAAA;;AAvUiB;AAGnB;;;;;;;;;;;;;;;;iBAkXgB,wBAAA,CACd,MAAA,EAAQ,MAAA,mBACR,MAAA,EAAQ,MAAM,mBACd,IAAA,qBACA,gBAAA,GAAmB,KAAA,uBACnB,KAAA;AAAA,iBAsNc,+BAAA,CACd,aAAA,EAAe,sBAAA,EACf,cAAA,EAAgB,uBAAA,EAChB,mBAAA,GAAqB,4BAAA,EACrB,iBAAA,GAAmB,oCAAA;AAAA,iBA6CL,6BAAA,CACd,QAAA,EAAU,sBAAsB,EAChC,IAAA;AAAA,iBAiHc,gCAAA,CACd,UAAA,UACA,WAAA,WAAsB,2BAA2B,gBACjD,IAAA;AAAA,iBAmHc,mCAAA,CACd,UAAA,EAAY,kCAAA,EACZ,IAAA;EAAA,SAES,OAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA,GAAa,MAAM;AAAA;AAAA,iBAKd,8BAAA,CACd,UAAA,UACA,UAAA,EAAY,6BAAA,EACZ,IAAA,sBACA,GAAA,EAAK,sBAAsB;AAAA,iBA0Bb,+BAAA,CACd,UAAA,EAAY,8BAAA,EACZ,IAAA;EAAA,SAES,UAAA;IAAA,SACE,OAAA;IAAA,SACA,UAAA;IAAA,SACA,UAAA,GAAa,MAAA;EAAA;EAAA,SAEf,QAAA;EAAA,SACA,OAAA,GAAU,aAAA;EAAA,SACV,iBAAA,GAAoB,8BAAA;EAAA,SACpB,EAAA;EAAA,SACA,MAAA;AAAA"} |
| import { d as AnyCodecDescriptor } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { i as AuthoringContributions } from "./framework-authoring-qyokbMY7.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 DefaultFunctionArgument { | ||
| readonly raw: string; | ||
| readonly span: SourceSpan; | ||
| } | ||
| interface ParsedDefaultFunctionCall { | ||
| readonly name: string; | ||
| readonly raw: string; | ||
| readonly args: readonly DefaultFunctionArgument[]; | ||
| readonly span: SourceSpan; | ||
| } | ||
| 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; | ||
| }; | ||
| type DefaultFunctionLoweringHandler = (input: { | ||
| readonly call: ParsedDefaultFunctionCall; | ||
| readonly context: DefaultFunctionLoweringContext; | ||
| }) => LoweredDefaultResult; | ||
| interface DefaultFunctionRegistryEntry { | ||
| readonly lower: DefaultFunctionLoweringHandler; | ||
| readonly usageSignatures?: readonly string[]; | ||
| } | ||
| type DefaultFunctionRegistry = ReadonlyMap<string, DefaultFunctionRegistryEntry>; | ||
| interface MutationDefaultGeneratorDescriptor { | ||
| readonly id: string; | ||
| /** | ||
| * Codec ids the generator is compatible with when the codec choice | ||
| * and the generator choice are made independently by the contract | ||
| * author. Set when the registry-coherence check is meaningful | ||
| * (the codec and the generator can be paired arbitrarily by the | ||
| * caller); omitted when the generator is only reachable through a | ||
| * descriptor that co-registers a fixed codec, so coherence is | ||
| * structural and the list would be tautological. | ||
| */ | ||
| readonly applicableCodecIds?: readonly string[]; | ||
| readonly resolveGeneratedColumnDescriptor?: (input: { | ||
| readonly generated: ExecutionMutationDefaultValue; | ||
| }) => { | ||
| readonly codecId: string; | ||
| readonly nativeType: string; | ||
| readonly typeRef?: string; | ||
| readonly typeParams?: Record<string, unknown>; | ||
| } | undefined; | ||
| /** | ||
| * Construct the `onCreate`/`onUpdate` phases value owned by this | ||
| * generator. Authoring layers (PSL `temporal.updatedAt()`, TS field presets) call | ||
| * this instead of building the literal inline so PSL/TS-authored | ||
| * contracts stay byte-equivalent for any future params-bearing generator. | ||
| */ | ||
| readonly buildPhases?: (args?: Record<string, unknown>) => ExecutionMutationDefaultPhases; | ||
| } | ||
| interface ControlMutationDefaultEntry { | ||
| readonly lower: (input: { | ||
| readonly call: ParsedDefaultFunctionCall; | ||
| readonly context: DefaultFunctionLoweringContext; | ||
| }) => LoweredDefaultResult; | ||
| readonly usageSignatures?: readonly string[]; | ||
| } | ||
| type ControlMutationDefaultRegistry = ReadonlyMap<string, ControlMutationDefaultEntry>; | ||
| interface ControlMutationDefaults { | ||
| readonly defaultFunctionRegistry: ControlMutationDefaultRegistry; | ||
| readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[]; | ||
| } | ||
| //#endregion | ||
| //#region src/shared/framework-components.d.ts | ||
| /** | ||
| * Declarative fields that describe component metadata. | ||
| */ | ||
| interface ComponentMetadata { | ||
| /** Component version (semver) */ | ||
| readonly version: string; | ||
| /** | ||
| * Capabilities this component provides. | ||
| * | ||
| * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`); keep these declarations in sync. Targets are identifiers/descriptors and typically do not declare capabilities. | ||
| */ | ||
| readonly capabilities?: Record<string, unknown>; | ||
| /** Type imports for contract.d.ts generation */ | ||
| readonly types?: { | ||
| readonly codecTypes?: { | ||
| /** | ||
| * Base codec types import spec. Optional: adapters typically provide this, extensions usually don't. | ||
| */ | ||
| readonly import?: TypesImportSpec; | ||
| /** | ||
| * Additional type-only imports for parameterized codec branded types. | ||
| * | ||
| * These imports are included in generated `contract.d.ts` but are NOT treated as codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`). | ||
| * | ||
| * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>` | ||
| */ | ||
| readonly typeImports?: ReadonlyArray<TypesImportSpec>; | ||
| /** | ||
| * Optional control-plane hooks keyed by codecId. Used by family-specific planners/verifiers to handle storage types. | ||
| */ | ||
| readonly controlPlaneHooks?: Record<string, unknown>; | ||
| /** | ||
| * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission. | ||
| */ | ||
| readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>; | ||
| }; | ||
| readonly queryOperationTypes?: { | ||
| readonly import: TypesImportSpec; | ||
| }; | ||
| readonly storage?: ReadonlyArray<{ | ||
| readonly typeId: string; | ||
| readonly familyId: string; | ||
| readonly targetId: string; | ||
| readonly nativeType?: string; | ||
| }>; | ||
| }; | ||
| /** | ||
| * Optional pure-data authoring contributions exposed by this component. | ||
| * | ||
| * These contributions are safe to include on pack refs and descriptors because they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows. | ||
| */ | ||
| readonly authoring?: AuthoringContributions; | ||
| /** | ||
| * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection. | ||
| */ | ||
| readonly scalarTypeDescriptors?: ReadonlyMap<string, string>; | ||
| /** | ||
| * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection. | ||
| */ | ||
| readonly controlMutationDefaults?: ControlMutationDefaults; | ||
| } | ||
| /** | ||
| * Base descriptor for any framework component. | ||
| * | ||
| * All component descriptors share these fundamental properties that identify the component and provide its metadata. This interface is extended by specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.). | ||
| * | ||
| * @template Kind - Discriminator literal identifying the component type. Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension', but the type accepts any string to allow ecosystem extensions. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // All descriptors have these properties | ||
| * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds) | ||
| * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres') | ||
| * descriptor.version // Component version (semver) | ||
| * ``` | ||
| */ | ||
| interface ComponentDescriptor<Kind extends string> extends ComponentMetadata { | ||
| /** Discriminator identifying the component type */ | ||
| readonly kind: Kind; | ||
| /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */ | ||
| readonly id: string; | ||
| } | ||
| interface ContractComponentRequirementsCheckInput { | ||
| readonly contract: { | ||
| readonly target: string; | ||
| readonly targetFamily?: string | undefined; | ||
| readonly extensionPacks?: Record<string, unknown> | undefined; | ||
| }; | ||
| readonly expectedTargetFamily?: string | undefined; | ||
| readonly expectedTargetId?: string | undefined; | ||
| readonly providedComponentIds: Iterable<string>; | ||
| } | ||
| interface ContractComponentRequirementsCheckResult { | ||
| readonly familyMismatch?: { | ||
| readonly expected: string; | ||
| readonly actual: string; | ||
| } | undefined; | ||
| readonly targetMismatch?: { | ||
| readonly expected: string; | ||
| readonly actual: string; | ||
| } | undefined; | ||
| readonly missingExtensionPackIds: readonly string[]; | ||
| } | ||
| declare function checkContractComponentRequirements(input: ContractComponentRequirementsCheckInput): ContractComponentRequirementsCheckResult; | ||
| /** | ||
| * Descriptor for a family component. | ||
| * | ||
| * A "family" represents a category of data sources with shared semantics (e.g., SQL databases, document stores). Families define: | ||
| * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.) | ||
| * - Contract structure (tables vs collections, columns vs fields) | ||
| * - Type system and codecs | ||
| * | ||
| * Families are the top-level grouping. Each family contains multiple targets (e.g., SQL family contains Postgres, MySQL, SQLite targets). | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations | ||
| * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document') | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import sql from '@prisma-next/family-sql/control'; | ||
| * | ||
| * sql.kind // 'family' | ||
| * sql.familyId // 'sql' | ||
| * sql.id // 'sql' | ||
| * ``` | ||
| */ | ||
| interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> { | ||
| /** The family identifier (e.g., 'sql', 'document') */ | ||
| readonly familyId: TFamilyId; | ||
| } | ||
| /** | ||
| * Descriptor for a target component. | ||
| * | ||
| * A "target" represents a specific database or data store within a family (e.g., Postgres, MySQL, MongoDB). Targets define: | ||
| * - Native type mappings (e.g., Postgres int4 → TypeScript number) | ||
| * - Target-specific capabilities (e.g., RETURNING, LATERAL joins) | ||
| * | ||
| * Targets are bound to a family and provide the target-specific implementation details that adapters and drivers use. | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlTargetDescriptor` - adds optional `migrations` capability | ||
| * - `RuntimeTargetDescriptor` - adds runtime factory method | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql') | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import postgres from '@prisma-next/target-postgres/control'; | ||
| * | ||
| * postgres.kind // 'target' | ||
| * postgres.familyId // 'sql' | ||
| * postgres.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'target'> { | ||
| /** The family this target belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** | ||
| * Base shape for any pack reference. Pack refs are pure JSON-friendly objects safe to import in authoring flows. | ||
| */ | ||
| interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata { | ||
| readonly kind: Kind; | ||
| readonly id: string; | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId?: string; | ||
| readonly authoring?: AuthoringContributions; | ||
| } | ||
| type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>; | ||
| type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & { | ||
| readonly targetId: TTargetId; /** The namespace a bare (un-namespaced) entity name resolves to for this target (e.g. Postgres `'public'`). */ | ||
| readonly defaultNamespaceId: string; | ||
| }; | ||
| type AdapterPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'adapter', TFamilyId> & { | ||
| readonly targetId: TTargetId; | ||
| }; | ||
| type ExtensionPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'extension', TFamilyId> & { | ||
| readonly targetId: TTargetId; | ||
| }; | ||
| type DriverPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'driver', TFamilyId> & { | ||
| readonly targetId: TTargetId; | ||
| }; | ||
| /** | ||
| * Descriptor for an adapter component. | ||
| * | ||
| * An "adapter" provides the protocol and dialect implementation for a target. Adapters handle: | ||
| * - SQL/query generation (lowering AST to target-specific syntax) | ||
| * - Codec registration (encoding/decoding between JS and wire types) | ||
| * - Type mappings and coercions | ||
| * | ||
| * Adapters are bound to a specific family+target combination and work with any compatible driver for that target. | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlAdapterDescriptor` - control-plane factory | ||
| * - `RuntimeAdapterDescriptor` - runtime factory | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import postgresAdapter from '@prisma-next/adapter-postgres/control'; | ||
| * | ||
| * postgresAdapter.kind // 'adapter' | ||
| * postgresAdapter.familyId // 'sql' | ||
| * postgresAdapter.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'adapter'> { | ||
| /** The family this adapter belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target this adapter is designed for */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** | ||
| * Descriptor for a driver component. | ||
| * | ||
| * A "driver" provides the connection and execution layer for a target. Drivers handle: | ||
| * - Connection management (pooling, timeouts, retries) | ||
| * - Query execution (sending SQL/commands, receiving results) | ||
| * - Transaction management | ||
| * - Wire protocol communication | ||
| * | ||
| * Drivers are bound to a specific family+target and work with any compatible adapter. Multiple drivers can exist for the same target (e.g., node-postgres vs postgres.js for Postgres). | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlDriverDescriptor` - creates driver from connection URL | ||
| * - `RuntimeDriverDescriptor` - creates driver with runtime options | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import postgresDriver from '@prisma-next/driver-postgres/control'; | ||
| * | ||
| * postgresDriver.kind // 'driver' | ||
| * postgresDriver.familyId // 'sql' | ||
| * postgresDriver.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'driver'> { | ||
| /** The family this driver belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target this driver connects to */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** | ||
| * Descriptor for an extension component. | ||
| * | ||
| * An "extension" adds optional capabilities to a target. Extensions can provide: | ||
| * - Additional operations (e.g., vector similarity search with pgvector) | ||
| * - Custom types and codecs (e.g., vector type) | ||
| * - Extended query capabilities | ||
| * | ||
| * Extensions are bound to a specific family+target and are registered in the config alongside the core components. Multiple extensions can be used together. | ||
| * | ||
| * Extended by plane-specific descriptors: | ||
| * - `ControlExtensionDescriptor` - control-plane extension factory | ||
| * - `RuntimeExtensionDescriptor` - runtime extension factory | ||
| * | ||
| * @template TFamilyId - Literal type for the family identifier | ||
| * @template TTargetId - Literal type for the target identifier | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import pgvector from '@prisma-next/extension-pgvector/control'; | ||
| * | ||
| * pgvector.kind // 'extension' | ||
| * pgvector.familyId // 'sql' | ||
| * pgvector.targetId // 'postgres' | ||
| * ``` | ||
| */ | ||
| interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string> extends ComponentDescriptor<'extension'> { | ||
| /** The family this extension belongs to */ | ||
| readonly familyId: TFamilyId; | ||
| /** The target this extension is designed for */ | ||
| readonly targetId: TTargetId; | ||
| } | ||
| /** Components bound to a specific family+target combination. */ | ||
| type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>; | ||
| interface FamilyInstance<TFamilyId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| } | ||
| interface TargetInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| interface AdapterInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| interface DriverInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> { | ||
| readonly familyId: TFamilyId; | ||
| readonly targetId: TTargetId; | ||
| } | ||
| //#endregion | ||
| export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, 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, LoweredDefaultValue as j, DefaultFunctionRegistryEntry 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-BLiwDP1D.d.mts.map |
| {"version":3,"file":"framework-components-BLiwDP1D.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"mappings":";;;;;;UAMU,cAAA;EAAA,SACC,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,UAAA;EAAA,SACN,KAAA,EAAO,cAAA;EAAA,SACP,GAAA,EAAK,cAAc;AAAA;AAAA,UAGb,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,GAAO,UAAA;EAAA,SACP,IAAA,GAAO,QAAA,CAAS,MAAA;AAAA;AAAA,UAGjB,uBAAA;EAAA,SACC,GAAA;EAAA,SACA,IAAA,EAAM,UAAU;AAAA;AAAA,UAGV,yBAAA;EAAA,SACN,IAAA;EAAA,SACA,GAAA;EAAA,SACA,IAAA,WAAe,uBAAA;EAAA,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EAAA,SAkPhC,QAAA,EAAU,SAAA;EAvLJ;EAAA,SA0LN,QAAA,EAAU,SAAA;AAAA;;KAIT,8BAAA,uDACR,gBAAA,CAAiB,SAAA,EAAW,SAAA,IAC5B,iBAAA,CAAkB,SAAA,EAAW,SAAA,IAC7B,gBAAA,CAAiB,SAAA,EAAW,SAAA,IAC5B,mBAAA,CAAoB,SAAA,EAAW,SAAA;AAAA,UAElB,cAAA;EAAA,SACN,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,eAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,cAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA;AAAA,UAGb,iBAAA;EAAA,SACN,QAAA,EAAU,SAAA;EAAA,SACV,QAAA,EAAU,SAAS;AAAA"} |
| import { r as CodecLookup } from "./codec-types-7Qng7VFc.mjs"; | ||
| import { R as PslDiagnosticCode, Y as PslSpan, h as AuthoringPslBlockDescriptorNamespace, z as PslExtensionBlock } from "./framework-authoring-qyokbMY7.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; | ||
| } | ||
| interface PslEnumValue { | ||
| readonly kind: 'enumValue'; | ||
| readonly name: string; | ||
| /** | ||
| * Optional storage label for the enum member, captured from a trailing | ||
| * `@map("...")` attribute on the member line. The parser populates this | ||
| * when the source PSL carries an explicit `@map`. Producers (e.g. | ||
| * `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)` | ||
| * automatically when normalisation would change the printed member name | ||
| * (so an enum value `'in-progress'` becomes `inProgress @map("in-progress")` | ||
| * in PSL, preserving the round-trip). | ||
| */ | ||
| readonly mapName?: string; | ||
| readonly span: PslSpan; | ||
| } | ||
| interface PslEnum { | ||
| readonly kind: 'enum'; | ||
| readonly name: string; | ||
| readonly values: readonly PslEnumValue[]; | ||
| readonly attributes: readonly PslAttribute[]; | ||
| readonly span: PslSpan; | ||
| } | ||
| /** | ||
| * 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 | PslEnum | 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_select']['ReadPosts']`. | ||
| */ | ||
| 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 enums, from `entries['enum']`. */ | ||
| readonly enums: readonly PslEnum[]; | ||
| /** 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[], enums: readonly PslEnum[], 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 enums from every namespace in document order. | ||
| */ | ||
| declare function flatPslEnums(ast: PslDocumentAst): readonly PslEnum[]; | ||
| /** | ||
| * 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'`, `'enum'`, `'compositeType'`. | ||
| */ | ||
| 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'`, `'enum'`, `'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 { flatPslCompositeTypes as A, PslNamespace as C, PslTypesBlock as D, PslTypeConstructorCall as E, namespacePslExtensionBlocks as F, flatPslModels as M, makePslNamespace as N, PslUniqueConstraint as O, makePslNamespaceEntries as P, PslNamedTypeDeclaration as S, PslReferentialAction as T, PslField as _, PslAttributeArgument as a, PslModel as b, PslAttributeTarget as c, PslDefaultLiteralValue as d, PslDefaultValue as f, PslEnumValue as g, PslEnum as h, PslAttribute as i, flatPslEnums as j, UNSPECIFIED_PSL_NAMESPACE_ID 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, PslFieldAttribute as v, PslNamespaceEntry as w, PslModelAttribute as x, PslIndexConstraint as y }; | ||
| //# sourceMappingURL=psl-ast-DjFPjnlM.d.mts.map |
| {"version":3,"file":"psl-ast-DjFPjnlM.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";;;;UA0BiB,aAAA;EAAA,SACN,IAAA,EAAM,iBAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,EAAM,OAAO;AAAA;AAAA,UAGP,uBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAI;AAAA;AAAA,UAGE,sBAAA;EAAA,SACN,IAAA;EAAA,SACA,KAAK;AAAA;AAAA,KAGJ,eAAA,GAAkB,uBAAA,GAA0B,sBAAsB;AAAA,KAElE,kBAAA;AAAA,UAEK,8BAAA;EAAA,SACN,IAAA;EAAA,SACA,KAAA;EAAA,SACA,IAAA,EAAM,OAAO;AAAA;AAAA,UAGP,yBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAA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