@prisma-next/contract 0.3.0-dev.23 → 0.3.0-dev.25

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.
@@ -1,3 +1,3 @@
1
- export type { AdapterDescriptor, AdapterInstance, AdapterPackRef, ComponentDescriptor, ComponentMetadata, ContractComponentRequirementsCheckInput, ContractComponentRequirementsCheckResult, DriverDescriptor, DriverInstance, DriverPackRef, ExtensionDescriptor, ExtensionInstance, ExtensionPackRef, FamilyDescriptor, FamilyInstance, PackRefBase, TargetBoundComponentDescriptor, TargetDescriptor, TargetInstance, TargetPackRef, } from '../framework-components';
2
- export { checkContractComponentRequirements } from '../framework-components';
1
+ export type { AdapterDescriptor, AdapterInstance, AdapterPackRef, ComponentDescriptor, ComponentMetadata, ContractComponentRequirementsCheckInput, ContractComponentRequirementsCheckResult, DriverDescriptor, DriverInstance, DriverPackRef, ExtensionDescriptor, ExtensionInstance, ExtensionPackRef, FamilyDescriptor, FamilyInstance, NormalizedTypeRenderer, PackRefBase, RenderTypeContext, TargetBoundComponentDescriptor, TargetDescriptor, TargetInstance, TargetPackRef, TypeRenderer, TypeRendererFunction, TypeRendererTemplate, } from '../framework-components';
2
+ export { checkContractComponentRequirements, interpolateTypeTemplate, normalizeRenderer, } from '../framework-components';
3
3
  //# sourceMappingURL=framework-components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-components.d.ts","sourceRoot":"","sources":["../../src/exports/framework-components.ts"],"names":[],"mappings":"AAAA,YAAY,EAEV,iBAAiB,EAEjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,uCAAuC,EACvC,wCAAwC,EACxC,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,8BAA8B,EAC9B,gBAAgB,EAChB,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"framework-components.d.ts","sourceRoot":"","sources":["../../src/exports/framework-components.ts"],"names":[],"mappings":"AAAA,YAAY,EAEV,iBAAiB,EAEjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,uCAAuC,EACvC,wCAAwC,EACxC,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EAEd,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,8BAA8B,EAC9B,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC"}
@@ -1,4 +1,26 @@
1
1
  // src/framework-components.ts
2
+ function interpolateTypeTemplate(template, params, ctx) {
3
+ return template.replace(/\{\{(\w+)\}\}/g, (_, key) => {
4
+ if (key === "CodecTypes") return ctx.codecTypesName;
5
+ const value = params[key];
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);
12
+ });
13
+ }
14
+ function normalizeRenderer(codecId, renderer) {
15
+ if (renderer.kind === "function") {
16
+ return { codecId, render: renderer.render };
17
+ }
18
+ const { template } = renderer;
19
+ return {
20
+ codecId,
21
+ render: (params, ctx) => interpolateTypeTemplate(template, params, ctx)
22
+ };
23
+ }
2
24
  function checkContractComponentRequirements(input) {
3
25
  const providedIds = /* @__PURE__ */ new Set();
4
26
  for (const id of input.providedComponentIds) {
@@ -19,6 +41,8 @@ function checkContractComponentRequirements(input) {
19
41
  };
20
42
  }
21
43
  export {
22
- checkContractComponentRequirements
44
+ checkContractComponentRequirements,
45
+ interpolateTypeTemplate,
46
+ normalizeRenderer
23
47
  };
24
48
  //# sourceMappingURL=framework-components.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/framework-components.ts"],"sourcesContent":["import type { OperationManifest, TypesImportSpec } from './types';\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?: { readonly import: TypesImportSpec };\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":";AA6GO,SAAS,mCACd,OAC0C;AAC1C,QAAM,cAAc,oBAAI,IAAY;AACpC,aAAW,MAAM,MAAM,sBAAsB;AAC3C,gBAAY,IAAI,EAAE;AAAA,EACpB;AAEA,QAAM,2BAA2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,cAAc,IACzC,CAAC;AACL,QAAM,0BAA0B,yBAAyB,OAAO,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;AAE5F,QAAM,uBAAuB,MAAM;AACnC,QAAM,uBAAuB,MAAM,SAAS;AAC5C,QAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB,EAAE,UAAU,sBAAsB,QAAQ,qBAAqB,IAC/D;AAEN,QAAM,mBAAmB,MAAM;AAC/B,QAAM,mBAAmB,MAAM,SAAS;AACxC,QAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD,EAAE,UAAU,kBAAkB,QAAQ,iBAAiB,IACvD;AAEN,SAAO;AAAA,IACL,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;AAAA,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.\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 * Union of author-friendly type renderer formats.\n * Templates are normalized to functions during pack assembly.\n */\nexport type TypeRenderer = TypeRendererTemplate | 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 */\nexport function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer {\n if (renderer.kind === 'function') {\n return { codecId, render: renderer.render };\n }\n\n // Compile template to function\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":";AAgFO,SAAS,wBACd,UACA,QACA,KACQ;AACR,SAAO,SAAS,QAAQ,kBAAkB,CAAC,GAAG,QAAgB;AAC5D,QAAI,QAAQ,aAAc,QAAO,IAAI;AACrC,UAAM,QAAQ,OAAO,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@ -1,3 +1,3 @@
1
- export type { ContractBase, ContractMarkerRecord, DocCollection, DocIndex, DocumentContract, DocumentStorage, ExecutionPlan, Expr, FieldType, OperationManifest, ParamDescriptor, PlanMeta, PlanRefs, ResultType, Source, TargetFamilyHook, TypesImportSpec, ValidationContext, } from '../types';
1
+ export type { ContractBase, ContractMarkerRecord, DocCollection, DocIndex, DocumentContract, DocumentStorage, ExecutionPlan, Expr, FieldType, GenerateContractTypesOptions, OperationManifest, ParamDescriptor, PlanMeta, PlanRefs, ResultType, Source, TargetFamilyHook, TypeRenderContext, TypeRenderEntry, TypesImportSpec, ValidationContext, } from '../types';
2
2
  export { isDocumentContract } from '../types';
3
3
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,SAAS,EAET,4BAA4B,EAC5B,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import type { OperationRegistry } from '@prisma-next/operations';\nimport type { ContractIR } from './ir';\n\nexport interface ContractBase {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly coreHash: string;\n readonly profileHash?: string;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, Source>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'cuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface DocumentStorage {\n readonly document: {\n readonly collections: Record<string, DocCollection>;\n };\n}\n\nexport interface DocumentContract extends ContractBase {\n // Accept string to work with JSON imports; runtime validation ensures 'document'\n readonly targetFamily: string;\n readonly storage: DocumentStorage;\n}\n\n// Plan types - target-family agnostic execution types\nexport interface ParamDescriptor {\n readonly index?: number;\n readonly name?: string;\n readonly codecId?: string;\n readonly nativeType?: string;\n readonly nullable?: boolean;\n readonly source: 'dsl' | 'raw';\n readonly refs?: { table: string; column: string };\n}\n\nexport interface PlanRefs {\n readonly tables?: readonly string[];\n readonly columns?: ReadonlyArray<{ table: string; column: string }>;\n readonly indexes?: ReadonlyArray<{\n readonly table: string;\n readonly columns: ReadonlyArray<string>;\n readonly name?: string;\n }>;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly coreHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n codecs?: Record<string, string>; // alias/param → codec id ('ns/name@v')\n [key: string]: unknown;\n };\n readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;\n readonly refs?: PlanRefs;\n readonly projection?: Record<string, string> | ReadonlyArray<string>;\n /**\n * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).\n * Used for codec resolution when AST+refs don't provide enough type info.\n */\n readonly projectionTypes?: Record<string, string>;\n}\n\n/**\n * Canonical execution plan shape used by runtimes.\n *\n * - Row is the inferred result row type (TypeScript-only).\n * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).\n *\n * The payload executed by the runtime is represented by the sql + params pair\n * for now; future families can specialize this via Ast or additional metadata.\n */\nexport interface ExecutionPlan<Row = unknown, Ast = unknown> {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly ast?: Ast;\n readonly meta: PlanMeta;\n /**\n * Phantom property to carry the Row generic for type-level utilities.\n * Not set at runtime; used only for ResultType extraction.\n */\n readonly _row?: Row;\n}\n\n/**\n * Utility type to extract the Row type from an ExecutionPlan.\n * Example: `type Row = ResultType<typeof plan>`\n *\n * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).\n * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter\n * for type extraction.\n */\nexport type ResultType<P> =\n P extends ExecutionPlan<infer R, unknown> ? R : P extends { readonly _Row?: infer R } ? R : never;\n\n/**\n * Type guard to check if a contract is a Document contract\n */\nexport function isDocumentContract(contract: unknown): contract is DocumentContract {\n return (\n typeof contract === 'object' &&\n contract !== null &&\n 'targetFamily' in contract &&\n contract.targetFamily === 'document'\n );\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly coreHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n}\n\n// Emitter types - moved from @prisma-next/emitter to shared location\n/**\n * Specifies how to import TypeScript types from a package.\n * Used in extension pack manifests to declare codec and operation type imports.\n */\nexport interface TypesImportSpec {\n readonly package: string;\n readonly named: string;\n readonly alias: string;\n}\n\n/**\n * Validation context passed to TargetFamilyHook.validateTypes().\n * Contains pre-assembled operation registry, type imports, and extension IDs.\n */\nexport interface ValidationContext {\n readonly operationRegistry?: OperationRegistry;\n readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds?: ReadonlyArray<string>;\n}\n\n/**\n * SPI interface for target family hooks that extend emission behavior.\n * Implemented by family-specific emitter hooks (e.g., SQL family).\n */\nexport interface TargetFamilyHook {\n readonly id: string;\n\n /**\n * Validates that all type IDs in the contract come from referenced extension packs.\n * @param ir - Contract IR to validate\n * @param ctx - Validation context with operation registry and extension IDs\n */\n validateTypes(ir: ContractIR, ctx: ValidationContext): void;\n\n /**\n * Validates family-specific contract structure.\n * @param ir - Contract IR to validate\n */\n validateStructure(ir: ContractIR): void;\n\n /**\n * Generates contract.d.ts file content.\n * @param ir - Contract IR\n * @param codecTypeImports - Array of codec type import specs\n * @param operationTypeImports - Array of operation type import specs\n * @returns Generated TypeScript type definitions as string\n */\n generateContractTypes(\n ir: ContractIR,\n codecTypeImports: ReadonlyArray<TypesImportSpec>,\n operationTypeImports: ReadonlyArray<TypesImportSpec>,\n ): string;\n}\n\n// Extension pack manifest types - moved from @prisma-next/core-control-plane to shared location\nexport type ArgSpecManifest =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'param' }\n | { readonly kind: 'literal' };\n\nexport type ReturnSpecManifest =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'builtin'; readonly type: 'number' | 'boolean' | 'string' };\n\nexport interface LoweringSpecManifest {\n readonly targetFamily: 'sql';\n readonly strategy: 'infix' | 'function';\n readonly template: string;\n}\n\nexport interface OperationManifest {\n readonly for: string;\n readonly method: string;\n readonly args: ReadonlyArray<ArgSpecManifest>;\n readonly returns: ReturnSpecManifest;\n readonly lowering: LoweringSpecManifest;\n readonly capabilities?: ReadonlyArray<string>;\n}\n"],"mappings":";AA2IO,SAAS,mBAAmB,UAAiD;AAClF,SACE,OAAO,aAAa,YACpB,aAAa,QACb,kBAAkB,YAClB,SAAS,iBAAiB;AAE9B;","names":[]}
1
+ {"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import type { OperationRegistry } from '@prisma-next/operations';\nimport type { ContractIR } from './ir';\n\nexport interface ContractBase {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly coreHash: string;\n readonly profileHash?: string;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, Source>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'cuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface DocumentStorage {\n readonly document: {\n readonly collections: Record<string, DocCollection>;\n };\n}\n\nexport interface DocumentContract extends ContractBase {\n // Accept string to work with JSON imports; runtime validation ensures 'document'\n readonly targetFamily: string;\n readonly storage: DocumentStorage;\n}\n\n// Plan types - target-family agnostic execution types\nexport interface ParamDescriptor {\n readonly index?: number;\n readonly name?: string;\n readonly codecId?: string;\n readonly nativeType?: string;\n readonly nullable?: boolean;\n readonly source: 'dsl' | 'raw';\n readonly refs?: { table: string; column: string };\n}\n\nexport interface PlanRefs {\n readonly tables?: readonly string[];\n readonly columns?: ReadonlyArray<{ table: string; column: string }>;\n readonly indexes?: ReadonlyArray<{\n readonly table: string;\n readonly columns: ReadonlyArray<string>;\n readonly name?: string;\n }>;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly coreHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n codecs?: Record<string, string>; // alias/param → codec id ('ns/name@v')\n [key: string]: unknown;\n };\n readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;\n readonly refs?: PlanRefs;\n readonly projection?: Record<string, string> | ReadonlyArray<string>;\n /**\n * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).\n * Used for codec resolution when AST+refs don't provide enough type info.\n */\n readonly projectionTypes?: Record<string, string>;\n}\n\n/**\n * Canonical execution plan shape used by runtimes.\n *\n * - Row is the inferred result row type (TypeScript-only).\n * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).\n *\n * The payload executed by the runtime is represented by the sql + params pair\n * for now; future families can specialize this via Ast or additional metadata.\n */\nexport interface ExecutionPlan<Row = unknown, Ast = unknown> {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly ast?: Ast;\n readonly meta: PlanMeta;\n /**\n * Phantom property to carry the Row generic for type-level utilities.\n * Not set at runtime; used only for ResultType extraction.\n */\n readonly _row?: Row;\n}\n\n/**\n * Utility type to extract the Row type from an ExecutionPlan.\n * Example: `type Row = ResultType<typeof plan>`\n *\n * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).\n * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter\n * for type extraction.\n */\nexport type ResultType<P> =\n P extends ExecutionPlan<infer R, unknown> ? R : P extends { readonly _Row?: infer R } ? R : never;\n\n/**\n * Type guard to check if a contract is a Document contract\n */\nexport function isDocumentContract(contract: unknown): contract is DocumentContract {\n return (\n typeof contract === 'object' &&\n contract !== null &&\n 'targetFamily' in contract &&\n contract.targetFamily === 'document'\n );\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly coreHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n}\n\n// Emitter types - moved from @prisma-next/emitter to shared location\n/**\n * Specifies how to import TypeScript types from a package.\n * Used in extension pack manifests to declare codec and operation type imports.\n */\nexport interface TypesImportSpec {\n readonly package: string;\n readonly named: string;\n readonly alias: string;\n}\n\n/**\n * Validation context passed to TargetFamilyHook.validateTypes().\n * Contains pre-assembled operation registry, type imports, and extension IDs.\n */\nexport interface ValidationContext {\n readonly operationRegistry?: OperationRegistry;\n readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds?: ReadonlyArray<string>;\n}\n\n/**\n * Context for rendering parameterized types during contract.d.ts generation.\n * Passed to type renderers so they can reference CodecTypes by name.\n */\nexport interface TypeRenderContext {\n readonly codecTypesName: string;\n}\n\n/**\n * A normalized type renderer for parameterized codecs.\n * This is the interface expected by TargetFamilyHook.generateContractTypes.\n */\nexport interface TypeRenderEntry {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;\n}\n\n/**\n * Additional options for generateContractTypes.\n */\nexport interface GenerateContractTypesOptions {\n /**\n * Normalized parameterized type renderers, keyed by codecId.\n * When a column has typeParams and a renderer exists for its codecId,\n * the renderer is called to produce the TypeScript type expression.\n */\n readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;\n}\n\n/**\n * SPI interface for target family hooks that extend emission behavior.\n * Implemented by family-specific emitter hooks (e.g., SQL family).\n */\nexport interface TargetFamilyHook {\n readonly id: string;\n\n /**\n * Validates that all type IDs in the contract come from referenced extension packs.\n * @param ir - Contract IR to validate\n * @param ctx - Validation context with operation registry and extension IDs\n */\n validateTypes(ir: ContractIR, ctx: ValidationContext): void;\n\n /**\n * Validates family-specific contract structure.\n * @param ir - Contract IR to validate\n */\n validateStructure(ir: ContractIR): void;\n\n /**\n * Generates contract.d.ts file content.\n * @param ir - Contract IR\n * @param codecTypeImports - Array of codec type import specs\n * @param operationTypeImports - Array of operation type import specs\n * @param options - Additional options including parameterized type renderers\n * @returns Generated TypeScript type definitions as string\n */\n generateContractTypes(\n ir: ContractIR,\n codecTypeImports: ReadonlyArray<TypesImportSpec>,\n operationTypeImports: ReadonlyArray<TypesImportSpec>,\n options?: GenerateContractTypesOptions,\n ): string;\n}\n\n// Extension pack manifest types - moved from @prisma-next/core-control-plane to shared location\nexport type ArgSpecManifest =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'param' }\n | { readonly kind: 'literal' };\n\nexport type ReturnSpecManifest =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'builtin'; readonly type: 'number' | 'boolean' | 'string' };\n\nexport interface LoweringSpecManifest {\n readonly targetFamily: 'sql';\n readonly strategy: 'infix' | 'function';\n readonly template: string;\n}\n\nexport interface OperationManifest {\n readonly for: string;\n readonly method: string;\n readonly args: ReadonlyArray<ArgSpecManifest>;\n readonly returns: ReturnSpecManifest;\n readonly lowering: LoweringSpecManifest;\n readonly capabilities?: ReadonlyArray<string>;\n}\n"],"mappings":";AA2IO,SAAS,mBAAmB,UAAiD;AAClF,SACE,OAAO,aAAa,YACpB,aAAa,QACb,kBAAkB,YAClB,SAAS,iBAAiB;AAE9B;","names":[]}
@@ -1,4 +1,68 @@
1
1
  import type { OperationManifest, TypesImportSpec } from './types';
2
+ /**
3
+ * Context passed to type renderers during contract.d.ts generation.
4
+ */
5
+ export interface RenderTypeContext {
6
+ /** The name of the CodecTypes type alias (typically 'CodecTypes') */
7
+ readonly codecTypesName: string;
8
+ }
9
+ /**
10
+ * A template-based type renderer.
11
+ * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are
12
+ * replaced with typeParams values during rendering.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * { kind: 'template', template: 'Vector<{{length}}>' }
17
+ * // With typeParams { length: 1536 }, renders: 'Vector<1536>'
18
+ * ```
19
+ */
20
+ export interface TypeRendererTemplate {
21
+ readonly kind: 'template';
22
+ /** Template string with `{{key}}` placeholders for typeParams values */
23
+ readonly template: string;
24
+ }
25
+ /**
26
+ * A function-based type renderer for full control over type expression generation.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * {
31
+ * kind: 'function',
32
+ * render: (params, ctx) => `Vector<${params.length}>`
33
+ * }
34
+ * ```
35
+ */
36
+ export interface TypeRendererFunction {
37
+ readonly kind: 'function';
38
+ /** Render function that produces a TypeScript type expression */
39
+ readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
40
+ }
41
+ /**
42
+ * Union of author-friendly type renderer formats.
43
+ * Templates are normalized to functions during pack assembly.
44
+ */
45
+ export type TypeRenderer = TypeRendererTemplate | TypeRendererFunction;
46
+ /**
47
+ * Normalized type renderer - always a function after assembly.
48
+ * This is the form received by the emitter.
49
+ */
50
+ export interface NormalizedTypeRenderer {
51
+ readonly codecId: string;
52
+ readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
53
+ }
54
+ /**
55
+ * Interpolates a template string with params values.
56
+ * Used internally by normalizeRenderer to compile templates to functions.
57
+ *
58
+ * @throws Error if a placeholder key is not found in params (except 'CodecTypes')
59
+ */
60
+ export declare function interpolateTypeTemplate(template: string, params: Record<string, unknown>, ctx: RenderTypeContext): string;
61
+ /**
62
+ * Normalizes a TypeRenderer to function form.
63
+ * Called during pack assembly, not at emission time.
64
+ */
65
+ export declare function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer;
2
66
  /**
3
67
  * Declarative fields that describe component metadata.
4
68
  * These fields are owned directly by descriptors (not nested under a manifest).
@@ -19,6 +83,14 @@ export interface ComponentMetadata {
19
83
  readonly types?: {
20
84
  readonly codecTypes?: {
21
85
  readonly import: TypesImportSpec;
86
+ /**
87
+ * Optional renderers for parameterized codecs owned by this component.
88
+ * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.
89
+ *
90
+ * Templates are normalized to functions during pack assembly.
91
+ * Duplicate codecId across descriptors is a hard error.
92
+ */
93
+ readonly parameterized?: Record<string, TypeRenderer>;
22
94
  };
23
95
  readonly operationTypes?: {
24
96
  readonly import: TypesImportSpec;
@@ -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;AA+BlE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhD,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,UAAU,CAAC,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;SAAE,CAAC;QAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;SAAE,CAAC;QAC/D,QAAQ,C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,QAAQ,EAAE,SAAS,CAAC;CAC9B"}
package/dist/types.d.ts CHANGED
@@ -165,6 +165,32 @@ export interface ValidationContext {
165
165
  readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
166
166
  readonly extensionIds?: ReadonlyArray<string>;
167
167
  }
168
+ /**
169
+ * Context for rendering parameterized types during contract.d.ts generation.
170
+ * Passed to type renderers so they can reference CodecTypes by name.
171
+ */
172
+ export interface TypeRenderContext {
173
+ readonly codecTypesName: string;
174
+ }
175
+ /**
176
+ * A normalized type renderer for parameterized codecs.
177
+ * This is the interface expected by TargetFamilyHook.generateContractTypes.
178
+ */
179
+ export interface TypeRenderEntry {
180
+ readonly codecId: string;
181
+ readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;
182
+ }
183
+ /**
184
+ * Additional options for generateContractTypes.
185
+ */
186
+ export interface GenerateContractTypesOptions {
187
+ /**
188
+ * Normalized parameterized type renderers, keyed by codecId.
189
+ * When a column has typeParams and a renderer exists for its codecId,
190
+ * the renderer is called to produce the TypeScript type expression.
191
+ */
192
+ readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;
193
+ }
168
194
  /**
169
195
  * SPI interface for target family hooks that extend emission behavior.
170
196
  * Implemented by family-specific emitter hooks (e.g., SQL family).
@@ -187,9 +213,10 @@ export interface TargetFamilyHook {
187
213
  * @param ir - Contract IR
188
214
  * @param codecTypeImports - Array of codec type import specs
189
215
  * @param operationTypeImports - Array of operation type import specs
216
+ * @param options - Additional options including parameterized type renderers
190
217
  * @returns Generated TypeScript type definitions as string
191
218
  */
192
- generateContractTypes(ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>): string;
219
+ generateContractTypes(ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>, options?: GenerateContractTypesOptions): string;
193
220
  }
194
221
  export type ArgSpecManifest = {
195
222
  readonly kind: 'typeId';
@@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,aAAa,CAAC,eAAe,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/C"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.3.0-dev.23",
3
+ "version": "0.3.0-dev.25",
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-dev.23"
8
+ "@prisma-next/operations": "0.3.0-dev.25"
9
9
  },
10
10
  "devDependencies": {
11
11
  "tsup": "8.5.1",
@@ -16,11 +16,21 @@ export type {
16
16
  ExtensionPackRef,
17
17
  FamilyDescriptor,
18
18
  FamilyInstance,
19
+ // Type renderers for parameterized codec emission
20
+ NormalizedTypeRenderer,
19
21
  PackRefBase,
22
+ RenderTypeContext,
20
23
  TargetBoundComponentDescriptor,
21
24
  TargetDescriptor,
22
25
  TargetInstance,
23
26
  TargetPackRef,
27
+ TypeRenderer,
28
+ TypeRendererFunction,
29
+ TypeRendererTemplate,
24
30
  } from '../framework-components';
25
31
 
26
- export { checkContractComponentRequirements } from '../framework-components';
32
+ export {
33
+ checkContractComponentRequirements,
34
+ interpolateTypeTemplate,
35
+ normalizeRenderer,
36
+ } from '../framework-components';
@@ -12,6 +12,8 @@ export type {
12
12
  ExecutionPlan,
13
13
  Expr,
14
14
  FieldType,
15
+ // Type generation options for parameterized codecs
16
+ GenerateContractTypesOptions,
15
17
  OperationManifest,
16
18
  ParamDescriptor,
17
19
  PlanMeta,
@@ -19,6 +21,8 @@ export type {
19
21
  ResultType,
20
22
  Source,
21
23
  TargetFamilyHook,
24
+ TypeRenderContext,
25
+ TypeRenderEntry,
22
26
  TypesImportSpec,
23
27
  ValidationContext,
24
28
  } from '../types';
@@ -1,5 +1,118 @@
1
1
  import type { OperationManifest, TypesImportSpec } from './types';
2
2
 
3
+ // ============================================================================
4
+ // Type Renderer Types (for parameterized codec emission)
5
+ // ============================================================================
6
+ //
7
+ // TypeRenderer supports author-friendly authoring (template strings) that are
8
+ // normalized to functions during pack assembly. The emitter only receives
9
+ // normalized (function-form) renderers.
10
+ //
11
+ // Lifecycle:
12
+ // 1. Authoring: Descriptor author uses template string or function
13
+ // 2. Assembly: Templates are compiled to functions via normalizeRenderer()
14
+ // 3. Emission: Emitter calls normalized render functions
15
+ //
16
+ // ============================================================================
17
+
18
+ /**
19
+ * Context passed to type renderers during contract.d.ts generation.
20
+ */
21
+ export interface RenderTypeContext {
22
+ /** The name of the CodecTypes type alias (typically 'CodecTypes') */
23
+ readonly codecTypesName: string;
24
+ }
25
+
26
+ /**
27
+ * A template-based type renderer.
28
+ * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are
29
+ * replaced with typeParams values during rendering.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * { kind: 'template', template: 'Vector<{{length}}>' }
34
+ * // With typeParams { length: 1536 }, renders: 'Vector<1536>'
35
+ * ```
36
+ */
37
+ export interface TypeRendererTemplate {
38
+ readonly kind: 'template';
39
+ /** Template string with `{{key}}` placeholders for typeParams values */
40
+ readonly template: string;
41
+ }
42
+
43
+ /**
44
+ * A function-based type renderer for full control over type expression generation.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * {
49
+ * kind: 'function',
50
+ * render: (params, ctx) => `Vector<${params.length}>`
51
+ * }
52
+ * ```
53
+ */
54
+ export interface TypeRendererFunction {
55
+ readonly kind: 'function';
56
+ /** Render function that produces a TypeScript type expression */
57
+ readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
58
+ }
59
+
60
+ /**
61
+ * Union of author-friendly type renderer formats.
62
+ * Templates are normalized to functions during pack assembly.
63
+ */
64
+ export type TypeRenderer = TypeRendererTemplate | TypeRendererFunction;
65
+
66
+ /**
67
+ * Normalized type renderer - always a function after assembly.
68
+ * This is the form received by the emitter.
69
+ */
70
+ export interface NormalizedTypeRenderer {
71
+ readonly codecId: string;
72
+ readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;
73
+ }
74
+
75
+ /**
76
+ * Interpolates a template string with params values.
77
+ * Used internally by normalizeRenderer to compile templates to functions.
78
+ *
79
+ * @throws Error if a placeholder key is not found in params (except 'CodecTypes')
80
+ */
81
+ export function interpolateTypeTemplate(
82
+ template: string,
83
+ params: Record<string, unknown>,
84
+ ctx: RenderTypeContext,
85
+ ): string {
86
+ return template.replace(/\{\{(\w+)\}\}/g, (_, key: string) => {
87
+ if (key === 'CodecTypes') return ctx.codecTypesName;
88
+ const value = params[key];
89
+ if (value === undefined) {
90
+ throw new Error(
91
+ `Missing template parameter "${key}" in template "${template}". ` +
92
+ `Available params: ${Object.keys(params).join(', ') || '(none)'}`,
93
+ );
94
+ }
95
+ return String(value);
96
+ });
97
+ }
98
+
99
+ /**
100
+ * Normalizes a TypeRenderer to function form.
101
+ * Called during pack assembly, not at emission time.
102
+ */
103
+ export function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer {
104
+ if (renderer.kind === 'function') {
105
+ return { codecId, render: renderer.render };
106
+ }
107
+
108
+ // Compile template to function
109
+ const { template } = renderer;
110
+ return {
111
+ codecId,
112
+ render: (params, ctx) => interpolateTypeTemplate(template, params, ctx),
113
+ };
114
+ }
115
+
3
116
  // ============================================================================
4
117
  // Framework Component Descriptor Base Types
5
118
  // ============================================================================
@@ -49,7 +162,17 @@ export interface ComponentMetadata {
49
162
 
50
163
  /** Type imports for contract.d.ts generation */
51
164
  readonly types?: {
52
- readonly codecTypes?: { readonly import: TypesImportSpec };
165
+ readonly codecTypes?: {
166
+ readonly import: TypesImportSpec;
167
+ /**
168
+ * Optional renderers for parameterized codecs owned by this component.
169
+ * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.
170
+ *
171
+ * Templates are normalized to functions during pack assembly.
172
+ * Duplicate codecId across descriptors is a hard error.
173
+ */
174
+ readonly parameterized?: Record<string, TypeRenderer>;
175
+ };
53
176
  readonly operationTypes?: { readonly import: TypesImportSpec };
54
177
  readonly storage?: ReadonlyArray<{
55
178
  readonly typeId: string;
package/src/types.ts CHANGED
@@ -182,6 +182,35 @@ export interface ValidationContext {
182
182
  readonly extensionIds?: ReadonlyArray<string>;
183
183
  }
184
184
 
185
+ /**
186
+ * Context for rendering parameterized types during contract.d.ts generation.
187
+ * Passed to type renderers so they can reference CodecTypes by name.
188
+ */
189
+ export interface TypeRenderContext {
190
+ readonly codecTypesName: string;
191
+ }
192
+
193
+ /**
194
+ * A normalized type renderer for parameterized codecs.
195
+ * This is the interface expected by TargetFamilyHook.generateContractTypes.
196
+ */
197
+ export interface TypeRenderEntry {
198
+ readonly codecId: string;
199
+ readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;
200
+ }
201
+
202
+ /**
203
+ * Additional options for generateContractTypes.
204
+ */
205
+ export interface GenerateContractTypesOptions {
206
+ /**
207
+ * Normalized parameterized type renderers, keyed by codecId.
208
+ * When a column has typeParams and a renderer exists for its codecId,
209
+ * the renderer is called to produce the TypeScript type expression.
210
+ */
211
+ readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;
212
+ }
213
+
185
214
  /**
186
215
  * SPI interface for target family hooks that extend emission behavior.
187
216
  * Implemented by family-specific emitter hooks (e.g., SQL family).
@@ -207,12 +236,14 @@ export interface TargetFamilyHook {
207
236
  * @param ir - Contract IR
208
237
  * @param codecTypeImports - Array of codec type import specs
209
238
  * @param operationTypeImports - Array of operation type import specs
239
+ * @param options - Additional options including parameterized type renderers
210
240
  * @returns Generated TypeScript type definitions as string
211
241
  */
212
242
  generateContractTypes(
213
243
  ir: ContractIR,
214
244
  codecTypeImports: ReadonlyArray<TypesImportSpec>,
215
245
  operationTypeImports: ReadonlyArray<TypesImportSpec>,
246
+ options?: GenerateContractTypesOptions,
216
247
  ): string;
217
248
  }
218
249