@prisma-next/contract 0.3.0-pr.96.1 → 0.3.0-pr.96.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,12 @@ function interpolateTypeTemplate(template, params, ctx) {
3
3
  return template.replace(/\{\{(\w+)\}\}/g, (_, key) => {
4
4
  if (key === "CodecTypes") return ctx.codecTypesName;
5
5
  const value = params[key];
6
- return value !== void 0 ? String(value) : "";
6
+ if (value === void 0) {
7
+ throw new Error(
8
+ `Missing template parameter "${key}" in template "${template}". Available params: ${Object.keys(params).join(", ") || "(none)"}`
9
+ );
10
+ }
11
+ return String(value);
7
12
  });
8
13
  }
9
14
  function normalizeRenderer(codecId, renderer) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/framework-components.ts"],"sourcesContent":["import type { OperationManifest, TypesImportSpec } from './types';\n\n// ============================================================================\n// Type Renderer Types (for parameterized codec emission)\n// ============================================================================\n//\n// TypeRenderer supports author-friendly authoring (template strings) that are\n// normalized to functions during pack assembly. The emitter only receives\n// normalized (function-form) renderers.\n//\n// Lifecycle:\n// 1. Authoring: Descriptor author uses template string or function\n// 2. Assembly: Templates are compiled to functions via normalizeRenderer()\n// 3. Emission: Emitter calls normalized render functions\n//\n// ============================================================================\n\n/**\n * Context passed to type renderers during contract.d.ts generation.\n */\nexport interface RenderTypeContext {\n /** The name of the CodecTypes type alias (typically 'CodecTypes') */\n readonly codecTypesName: string;\n}\n\n/**\n * A template-based type renderer (structured form).\n * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are\n * replaced with typeParams values during rendering.\n *\n * @example\n * ```ts\n * { kind: 'template', template: 'Vector<{{length}}>' }\n * // With typeParams { length: 1536 }, renders: 'Vector<1536>'\n * ```\n */\nexport interface TypeRendererTemplate {\n readonly kind: 'template';\n /** Template string with `{{key}}` placeholders for typeParams values */\n readonly template: string;\n}\n\n/**\n * A function-based type renderer for full control over type expression generation.\n *\n * @example\n * ```ts\n * {\n * kind: 'function',\n * render: (params, ctx) => `Vector<${params.length}>`\n * }\n * ```\n */\nexport interface TypeRendererFunction {\n readonly kind: 'function';\n /** Render function that produces a TypeScript type expression */\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * A raw template string type renderer (convenience form).\n * Shorthand for TypeRendererTemplate - just the template string without wrapper.\n *\n * @example\n * ```ts\n * 'Vector<{{length}}>'\n * // Equivalent to: { kind: 'template', template: 'Vector<{{length}}>' }\n * ```\n */\nexport type TypeRendererString = string;\n\n/**\n * A raw function type renderer (convenience form).\n * Shorthand for TypeRendererFunction - just the function without wrapper.\n *\n * @example\n * ```ts\n * (params, ctx) => `Vector<${params.length}>`\n * // Equivalent to: { kind: 'function', render: ... }\n * ```\n */\nexport type TypeRendererRawFunction = (\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n) => string;\n\n/**\n * Union of type renderer formats.\n *\n * Supports both structured forms (with `kind` discriminator) and convenience forms:\n * - `string` - Template string with `{{key}}` placeholders (manifest-safe, JSON-serializable)\n * - `function` - Render function for full control (requires runtime execution)\n * - `{ kind: 'template', template: string }` - Structured template form\n * - `{ kind: 'function', render: fn }` - Structured function form\n *\n * Templates are normalized to functions during pack assembly.\n * **Prefer template strings** for most cases - they are JSON-serializable.\n */\nexport type TypeRenderer =\n | TypeRendererString\n | TypeRendererRawFunction\n | TypeRendererTemplate\n | TypeRendererFunction;\n\n/**\n * Normalized type renderer - always a function after assembly.\n * This is the form received by the emitter.\n */\nexport interface NormalizedTypeRenderer {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * Interpolates a template string with params values.\n * Used internally by normalizeRenderer to compile templates to functions.\n */\nexport function interpolateTypeTemplate(\n template: string,\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n): string {\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (_, key: string) => {\n if (key === 'CodecTypes') return ctx.codecTypesName;\n const value = params[key];\n return value !== undefined ? String(value) : '';\n });\n}\n\n/**\n * Normalizes a TypeRenderer to function form.\n * Called during pack assembly, not at emission time.\n *\n * Handles all TypeRenderer forms:\n * - Raw string template: `'Vector<{{length}}>'`\n * - Raw function: `(params, ctx) => ...`\n * - Structured template: `{ kind: 'template', template: '...' }`\n * - Structured function: `{ kind: 'function', render: fn }`\n */\nexport function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer {\n // Handle raw string (template shorthand)\n if (typeof renderer === 'string') {\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(renderer, params, ctx),\n };\n }\n\n // Handle raw function (function shorthand)\n if (typeof renderer === 'function') {\n return { codecId, render: renderer };\n }\n\n // Handle structured function form\n if (renderer.kind === 'function') {\n return { codecId, render: renderer.render };\n }\n\n // Handle structured template form\n const { template } = renderer;\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(template, params, ctx),\n };\n}\n\n// ============================================================================\n// Framework Component Descriptor Base Types\n// ============================================================================\n//\n// Prisma Next uses a modular architecture where functionality is composed from\n// discrete \"components\". Each component has a descriptor that identifies it and\n// provides metadata. These base types define the shared structure for all\n// component descriptors across both control-plane (CLI/tooling) and runtime-plane.\n//\n// Component Hierarchy:\n//\n// Family (e.g., 'sql', 'document')\n// └── Target (e.g., 'postgres', 'mysql', 'mongodb')\n// ├── Adapter (protocol/dialect implementation)\n// ├── Driver (connection/execution layer)\n// └── Extension (optional capabilities like pgvector)\n//\n// Key design decisions:\n// - \"Component\" terminology separates framework building blocks from delivery\n// mechanism (\"pack\" refers to how components are packaged/distributed)\n// - `kind` is extensible (Kind extends string) - no closed union, allowing\n// ecosystem authors to define new component kinds\n// - Target-bound descriptors are generic in TFamilyId and TTargetId for type-safe\n// composition (e.g., TypeScript rejects Postgres adapter with MySQL target)\n// - Descriptors own declarative fields directly (version, types, operations, etc.)\n// rather than nesting them under a `manifest` property\n//\n// ============================================================================\n\n/**\n * Declarative fields that describe component metadata.\n * These fields are owned directly by descriptors (not nested under a manifest).\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\n * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);\n * keep these declarations in sync. Targets are identifiers/descriptors and typically do not\n * declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n readonly import: TypesImportSpec;\n /**\n * Optional renderers for parameterized codecs owned by this component.\n * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.\n *\n * Templates are normalized to functions during pack assembly.\n * Duplicate codecId across descriptors is a hard error.\n */\n readonly parameterized?: Record<string, TypeRenderer>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /** Operation manifests for building operation registries */\n readonly operations?: ReadonlyArray<OperationManifest>;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\n * the component and provide its metadata. This interface is extended by\n * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type.\n * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',\n * but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics\n * (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets\n * (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\n * (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation\n * details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference.\n * Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n}\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target.\n * Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with\n * any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target.\n * Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible\n * adapter. Multiple drivers can exist for the same target (e.g., node-postgres\n * vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the\n * config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Union type for target-bound component descriptors.\n *\n * Target-bound components are those that must be compatible with a specific\n * family+target combination. This includes targets, adapters, drivers, and\n * extensions. Families are not target-bound.\n *\n * This type is used in migration and verification interfaces to enforce\n * type-level compatibility between components.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * // All these components must have matching familyId and targetId\n * const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [\n * postgresTarget,\n * postgresAdapter,\n * postgresDriver,\n * pgvectorExtension,\n * ];\n * ```\n */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\n// ============================================================================\n// Framework Component Instance Base Types\n// ============================================================================\n//\n// These are minimal, identity-only interfaces for component instances.\n// They carry the component's identity (familyId, targetId) without any\n// behavior methods. Plane-specific interfaces (ControlFamilyInstance,\n// RuntimeFamilyInstance, etc.) extend these bases and add domain actions.\n//\n// ============================================================================\n\n/**\n * Base interface for family instances.\n *\n * A family instance is created by a family descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * const instance = sql.create({ target, adapter, driver, extensions });\n * instance.familyId // 'sql'\n * ```\n */\nexport interface FamilyInstance<TFamilyId extends string> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Base interface for target instances.\n *\n * A target instance is created by a target descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add target-specific behavior.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * const instance = postgres.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for adapter instances.\n *\n * An adapter instance is created by an adapter descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add adapter-specific behavior (e.g., codec registration, query lowering).\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = postgresAdapter.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for driver instances.\n *\n * A driver instance is created by a driver descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = postgresDriver.create({ databaseUrl });\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for extension instances.\n *\n * An extension instance is created by an extension descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add extension-specific behavior.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = pgvector.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n"],"mappings":";AAqHO,SAAS,wBACd,UACA,QACA,KACQ;AACR,SAAO,SAAS,QAAQ,kBAAkB,CAAC,GAAG,QAAgB;AAC5D,QAAI,QAAQ,aAAc,QAAO,IAAI;AACrC,UAAM,QAAQ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AAA,IAC3C,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/framework-components.ts"],"sourcesContent":["import type { OperationManifest, TypesImportSpec } from './types';\n\n// ============================================================================\n// Type Renderer Types (for parameterized codec emission)\n// ============================================================================\n//\n// TypeRenderer supports author-friendly authoring (template strings) that are\n// normalized to functions during pack assembly. The emitter only receives\n// normalized (function-form) renderers.\n//\n// Lifecycle:\n// 1. Authoring: Descriptor author uses template string or function\n// 2. Assembly: Templates are compiled to functions via normalizeRenderer()\n// 3. Emission: Emitter calls normalized render functions\n//\n// ============================================================================\n\n/**\n * Context passed to type renderers during contract.d.ts generation.\n */\nexport interface RenderTypeContext {\n /** The name of the CodecTypes type alias (typically 'CodecTypes') */\n readonly codecTypesName: string;\n}\n\n/**\n * A template-based type renderer (structured form).\n * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are\n * replaced with typeParams values during rendering.\n *\n * @example\n * ```ts\n * { kind: 'template', template: 'Vector<{{length}}>' }\n * // With typeParams { length: 1536 }, renders: 'Vector<1536>'\n * ```\n */\nexport interface TypeRendererTemplate {\n readonly kind: 'template';\n /** Template string with `{{key}}` placeholders for typeParams values */\n readonly template: string;\n}\n\n/**\n * A function-based type renderer for full control over type expression generation.\n *\n * @example\n * ```ts\n * {\n * kind: 'function',\n * render: (params, ctx) => `Vector<${params.length}>`\n * }\n * ```\n */\nexport interface TypeRendererFunction {\n readonly kind: 'function';\n /** Render function that produces a TypeScript type expression */\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * A raw template string type renderer (convenience form).\n * Shorthand for TypeRendererTemplate - just the template string without wrapper.\n *\n * @example\n * ```ts\n * 'Vector<{{length}}>'\n * // Equivalent to: { kind: 'template', template: 'Vector<{{length}}>' }\n * ```\n */\nexport type TypeRendererString = string;\n\n/**\n * A raw function type renderer (convenience form).\n * Shorthand for TypeRendererFunction - just the function without wrapper.\n *\n * @example\n * ```ts\n * (params, ctx) => `Vector<${params.length}>`\n * // Equivalent to: { kind: 'function', render: ... }\n * ```\n */\nexport type TypeRendererRawFunction = (\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n) => string;\n\n/**\n * Union of type renderer formats.\n *\n * Supports both structured forms (with `kind` discriminator) and convenience forms:\n * - `string` - Template string with `{{key}}` placeholders (manifest-safe, JSON-serializable)\n * - `function` - Render function for full control (requires runtime execution)\n * - `{ kind: 'template', template: string }` - Structured template form\n * - `{ kind: 'function', render: fn }` - Structured function form\n *\n * Templates are normalized to functions during pack assembly.\n * **Prefer template strings** for most cases - they are JSON-serializable.\n */\nexport type TypeRenderer =\n | TypeRendererString\n | TypeRendererRawFunction\n | TypeRendererTemplate\n | TypeRendererFunction;\n\n/**\n * Normalized type renderer - always a function after assembly.\n * This is the form received by the emitter.\n */\nexport interface NormalizedTypeRenderer {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * Interpolates a template string with params values.\n * Used internally by normalizeRenderer to compile templates to functions.\n *\n * @throws Error if a placeholder key is not found in params (except 'CodecTypes')\n */\nexport function interpolateTypeTemplate(\n template: string,\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n): string {\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (_, key: string) => {\n if (key === 'CodecTypes') return ctx.codecTypesName;\n const value = params[key];\n if (value === undefined) {\n throw new Error(\n `Missing template parameter \"${key}\" in template \"${template}\". ` +\n `Available params: ${Object.keys(params).join(', ') || '(none)'}`,\n );\n }\n return String(value);\n });\n}\n\n/**\n * Normalizes a TypeRenderer to function form.\n * Called during pack assembly, not at emission time.\n *\n * Handles all TypeRenderer forms:\n * - Raw string template: `'Vector<{{length}}>'`\n * - Raw function: `(params, ctx) => ...`\n * - Structured template: `{ kind: 'template', template: '...' }`\n * - Structured function: `{ kind: 'function', render: fn }`\n */\nexport function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer {\n // Handle raw string (template shorthand)\n if (typeof renderer === 'string') {\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(renderer, params, ctx),\n };\n }\n\n // Handle raw function (function shorthand)\n if (typeof renderer === 'function') {\n return { codecId, render: renderer };\n }\n\n // Handle structured function form\n if (renderer.kind === 'function') {\n return { codecId, render: renderer.render };\n }\n\n // Handle structured template form\n const { template } = renderer;\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(template, params, ctx),\n };\n}\n\n// ============================================================================\n// Framework Component Descriptor Base Types\n// ============================================================================\n//\n// Prisma Next uses a modular architecture where functionality is composed from\n// discrete \"components\". Each component has a descriptor that identifies it and\n// provides metadata. These base types define the shared structure for all\n// component descriptors across both control-plane (CLI/tooling) and runtime-plane.\n//\n// Component Hierarchy:\n//\n// Family (e.g., 'sql', 'document')\n// └── Target (e.g., 'postgres', 'mysql', 'mongodb')\n// ├── Adapter (protocol/dialect implementation)\n// ├── Driver (connection/execution layer)\n// └── Extension (optional capabilities like pgvector)\n//\n// Key design decisions:\n// - \"Component\" terminology separates framework building blocks from delivery\n// mechanism (\"pack\" refers to how components are packaged/distributed)\n// - `kind` is extensible (Kind extends string) - no closed union, allowing\n// ecosystem authors to define new component kinds\n// - Target-bound descriptors are generic in TFamilyId and TTargetId for type-safe\n// composition (e.g., TypeScript rejects Postgres adapter with MySQL target)\n// - Descriptors own declarative fields directly (version, types, operations, etc.)\n// rather than nesting them under a `manifest` property\n//\n// ============================================================================\n\n/**\n * Declarative fields that describe component metadata.\n * These fields are owned directly by descriptors (not nested under a manifest).\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\n * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);\n * keep these declarations in sync. Targets are identifiers/descriptors and typically do not\n * declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n readonly import: TypesImportSpec;\n /**\n * Optional renderers for parameterized codecs owned by this component.\n * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.\n *\n * Templates are normalized to functions during pack assembly.\n * Duplicate codecId across descriptors is a hard error.\n */\n readonly parameterized?: Record<string, TypeRenderer>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /** Operation manifests for building operation registries */\n readonly operations?: ReadonlyArray<OperationManifest>;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\n * the component and provide its metadata. This interface is extended by\n * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type.\n * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',\n * but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics\n * (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets\n * (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\n * (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation\n * details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference.\n * Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n}\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target.\n * Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with\n * any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target.\n * Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible\n * adapter. Multiple drivers can exist for the same target (e.g., node-postgres\n * vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the\n * config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Union type for target-bound component descriptors.\n *\n * Target-bound components are those that must be compatible with a specific\n * family+target combination. This includes targets, adapters, drivers, and\n * extensions. Families are not target-bound.\n *\n * This type is used in migration and verification interfaces to enforce\n * type-level compatibility between components.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * // All these components must have matching familyId and targetId\n * const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [\n * postgresTarget,\n * postgresAdapter,\n * postgresDriver,\n * pgvectorExtension,\n * ];\n * ```\n */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\n// ============================================================================\n// Framework Component Instance Base Types\n// ============================================================================\n//\n// These are minimal, identity-only interfaces for component instances.\n// They carry the component's identity (familyId, targetId) without any\n// behavior methods. Plane-specific interfaces (ControlFamilyInstance,\n// RuntimeFamilyInstance, etc.) extend these bases and add domain actions.\n//\n// ============================================================================\n\n/**\n * Base interface for family instances.\n *\n * A family instance is created by a family descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * const instance = sql.create({ target, adapter, driver, extensions });\n * instance.familyId // 'sql'\n * ```\n */\nexport interface FamilyInstance<TFamilyId extends string> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Base interface for target instances.\n *\n * A target instance is created by a target descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add target-specific behavior.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * const instance = postgres.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for adapter instances.\n *\n * An adapter instance is created by an adapter descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add adapter-specific behavior (e.g., codec registration, query lowering).\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = postgresAdapter.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for driver instances.\n *\n * A driver instance is created by a driver descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = postgresDriver.create({ databaseUrl });\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for extension instances.\n *\n * An extension instance is created by an extension descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add extension-specific behavior.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = pgvector.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n"],"mappings":";AAuHO,SAAS,wBACd,UACA,QACA,KACQ;AACR,SAAO,SAAS,QAAQ,kBAAkB,CAAC,GAAG,QAAgB;AAC5D,QAAI,QAAQ,aAAc,QAAO,IAAI;AACrC,UAAM,QAAQ,OAAO,GAAG;AACxB,QAAI,UAAU,QAAW;AACvB,YAAM,IAAI;AAAA,QACR,+BAA+B,GAAG,kBAAkB,QAAQ,wBACrC,OAAO,KAAK,MAAM,EAAE,KAAK,IAAI,KAAK,QAAQ;AAAA,MACnE;AAAA,IACF;AACA,WAAO,OAAO,KAAK;AAAA,EACrB,CAAC;AACH;AAYO,SAAS,kBAAkB,SAAiB,UAAgD;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edTypeRenderer {
84
84
  /**
85
85
  * Interpolates a template string with params values.
86
86
  * Used internally by normalizeRenderer to compile templates to functions.
87
+ *
88
+ * @throws Error if a placeholder key is not found in params (except 'CodecTypes')
87
89
  */
88
90
  export declare function interpolateTypeTemplate(template: string, params: Record<string, unknown>, ctx: RenderTypeContext): string;
89
91
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"framework-components.d.ts","sourceRoot":"","sources":["../src/framework-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiBlE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC;CACtF;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAAG,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,iBAAiB,KACnB,MAAM,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,uBAAuB,GACvB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,sBAAs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7B,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B"}
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.3.0-pr.96.1",
3
+ "version": "0.3.0-pr.96.3",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Data contract type definitions and JSON schema for Prisma Next",
7
7
  "dependencies": {
8
- "@prisma-next/operations": "0.3.0-pr.96.1"
8
+ "@prisma-next/operations": "0.3.0-pr.96.3"
9
9
  },
10
10
  "devDependencies": {
11
11
  "tsup": "8.5.1",
12
12
  "typescript": "5.9.3",
13
13
  "vitest": "4.0.16",
14
- "@prisma-next/tsconfig": "0.0.0",
15
- "@prisma-next/test-utils": "0.0.1"
14
+ "@prisma-next/test-utils": "0.0.1",
15
+ "@prisma-next/tsconfig": "0.0.0"
16
16
  },
17
17
  "files": [
18
18
  "dist",
@@ -114,6 +114,8 @@ export interface NormalizedTypeRenderer {
114
114
  /**
115
115
  * Interpolates a template string with params values.
116
116
  * Used internally by normalizeRenderer to compile templates to functions.
117
+ *
118
+ * @throws Error if a placeholder key is not found in params (except 'CodecTypes')
117
119
  */
118
120
  export function interpolateTypeTemplate(
119
121
  template: string,
@@ -123,7 +125,13 @@ export function interpolateTypeTemplate(
123
125
  return template.replace(/\{\{(\w+)\}\}/g, (_, key: string) => {
124
126
  if (key === 'CodecTypes') return ctx.codecTypesName;
125
127
  const value = params[key];
126
- return value !== undefined ? String(value) : '';
128
+ if (value === undefined) {
129
+ throw new Error(
130
+ `Missing template parameter "${key}" in template "${template}". ` +
131
+ `Available params: ${Object.keys(params).join(', ') || '(none)'}`,
132
+ );
133
+ }
134
+ return String(value);
127
135
  });
128
136
  }
129
137