@prisma-next/framework-components 0.4.0-dev.1 → 0.4.0-dev.10
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.
- package/README.md +4 -0
- package/dist/components.d.mts +1 -1
- package/dist/control.d.mts +130 -9
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +50 -3
- package/dist/control.mjs.map +1 -1
- package/dist/{emission-types-B3UblxTu.d.mts → emission-types-BPAALJbF.d.mts} +2 -2
- package/dist/{emission-types-B3UblxTu.d.mts.map → emission-types-BPAALJbF.d.mts.map} +1 -1
- package/dist/emission.d.mts +2 -2
- package/dist/execution.d.mts +1 -1
- package/dist/framework-components-C8ZhSwXe.mjs.map +1 -1
- package/dist/{framework-components-DoWmh6GH.d.mts → framework-components-EJXe-pum.d.mts} +95 -4
- package/dist/framework-components-EJXe-pum.d.mts.map +1 -0
- package/dist/{types-import-spec-Ddp4fNmt.d.mts → types-import-spec-C4sc7wbb.d.mts} +1 -1
- package/dist/types-import-spec-C4sc7wbb.d.mts.map +1 -0
- package/package.json +4 -4
- package/src/control-migration-types.ts +132 -5
- package/src/control-stack.ts +102 -1
- package/src/exports/control.ts +19 -0
- package/src/framework-components.ts +13 -0
- package/src/mutation-default-types.ts +89 -0
- package/dist/framework-components-DoWmh6GH.d.mts.map +0 -1
- package/dist/types-import-spec-Ddp4fNmt.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-components-C8ZhSwXe.mjs","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":["import type { Codec } from './codec-types';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { TypesImportSpec } from './types-import-spec';\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\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 /**\n * Base codec types import spec.\n * Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Additional type-only imports for parameterized codec branded types.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as\n * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId.\n * Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec instances contributed by this component.\n * Used to build a CodecLookup for codec-dispatched type rendering during emission.\n */\n readonly codecInstances?: ReadonlyArray<Codec>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly queryOperationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because\n * they contain only declarative metadata. Higher-level authoring packages may\n * project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\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 `emission` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\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 readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\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/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";AAiHA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAK,MAAM,MAAM,MAAM,qBACrB,aAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD;AAEN,QAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
|
|
1
|
+
{"version":3,"file":"framework-components-C8ZhSwXe.mjs","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":["import type { Codec } from './codec-types';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { ControlMutationDefaults } from './mutation-default-types';\nimport type { TypesImportSpec } from './types-import-spec';\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\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 /**\n * Base codec types import spec.\n * Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Additional type-only imports for parameterized codec branded types.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as\n * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId.\n * Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec instances contributed by this component.\n * Used to build a CodecLookup for codec-dispatched type rendering during emission.\n */\n readonly codecInstances?: ReadonlyArray<Codec>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly queryOperationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because\n * they contain only declarative metadata. Higher-level authoring packages may\n * project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n\n /**\n * Scalar type name to codec ID mapping contributed by this component.\n * Assembled by `createControlStack` with duplicate detection.\n */\n readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;\n\n /**\n * Mutation default function handlers and generator descriptors contributed\n * by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly controlMutationDefaults?: ControlMutationDefaults;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\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 `emission` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\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 readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\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/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";AA8HA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAK,MAAM,MAAM,MAAM,qBACrB,aAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD;AAEN,QAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
|
|
@@ -1,9 +1,90 @@
|
|
|
1
1
|
import { i as AuthoringContributions } from "./framework-authoring-D1-JZ37B.mjs";
|
|
2
2
|
import { t as Codec } from "./codec-types-B58nCJiu.mjs";
|
|
3
|
-
import { t as TypesImportSpec } from "./types-import-spec-
|
|
3
|
+
import { t as TypesImportSpec } from "./types-import-spec-C4sc7wbb.mjs";
|
|
4
|
+
import { ColumnDefault, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
|
|
4
5
|
|
|
6
|
+
//#region src/mutation-default-types.d.ts
|
|
7
|
+
interface SourcePosition {
|
|
8
|
+
readonly offset: number;
|
|
9
|
+
readonly line: number;
|
|
10
|
+
readonly column: number;
|
|
11
|
+
}
|
|
12
|
+
interface SourceSpan {
|
|
13
|
+
readonly start: SourcePosition;
|
|
14
|
+
readonly end: SourcePosition;
|
|
15
|
+
}
|
|
16
|
+
interface SourceDiagnostic {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
readonly sourceId?: string;
|
|
20
|
+
readonly span?: SourceSpan;
|
|
21
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
22
|
+
}
|
|
23
|
+
interface DefaultFunctionArgument {
|
|
24
|
+
readonly raw: string;
|
|
25
|
+
readonly span: SourceSpan;
|
|
26
|
+
}
|
|
27
|
+
interface ParsedDefaultFunctionCall {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly raw: string;
|
|
30
|
+
readonly args: readonly DefaultFunctionArgument[];
|
|
31
|
+
readonly span: SourceSpan;
|
|
32
|
+
}
|
|
33
|
+
interface DefaultFunctionLoweringContext {
|
|
34
|
+
readonly sourceId: string;
|
|
35
|
+
readonly modelName: string;
|
|
36
|
+
readonly fieldName: string;
|
|
37
|
+
readonly columnCodecId?: string;
|
|
38
|
+
}
|
|
39
|
+
type LoweredDefaultValue = {
|
|
40
|
+
readonly kind: 'storage';
|
|
41
|
+
readonly defaultValue: ColumnDefault;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'execution';
|
|
44
|
+
readonly generated: ExecutionMutationDefaultValue;
|
|
45
|
+
};
|
|
46
|
+
type LoweredDefaultResult = {
|
|
47
|
+
readonly ok: true;
|
|
48
|
+
readonly value: LoweredDefaultValue;
|
|
49
|
+
} | {
|
|
50
|
+
readonly ok: false;
|
|
51
|
+
readonly diagnostic: SourceDiagnostic;
|
|
52
|
+
};
|
|
53
|
+
type DefaultFunctionLoweringHandler = (input: {
|
|
54
|
+
readonly call: ParsedDefaultFunctionCall;
|
|
55
|
+
readonly context: DefaultFunctionLoweringContext;
|
|
56
|
+
}) => LoweredDefaultResult;
|
|
57
|
+
interface DefaultFunctionRegistryEntry {
|
|
58
|
+
readonly lower: DefaultFunctionLoweringHandler;
|
|
59
|
+
readonly usageSignatures?: readonly string[];
|
|
60
|
+
}
|
|
61
|
+
type DefaultFunctionRegistry = ReadonlyMap<string, DefaultFunctionRegistryEntry>;
|
|
62
|
+
interface MutationDefaultGeneratorDescriptor {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly applicableCodecIds: readonly string[];
|
|
65
|
+
readonly resolveGeneratedColumnDescriptor?: (input: {
|
|
66
|
+
readonly generated: ExecutionMutationDefaultValue;
|
|
67
|
+
}) => {
|
|
68
|
+
readonly codecId: string;
|
|
69
|
+
readonly nativeType: string;
|
|
70
|
+
readonly typeRef?: string;
|
|
71
|
+
readonly typeParams?: Record<string, unknown>;
|
|
72
|
+
} | undefined;
|
|
73
|
+
}
|
|
74
|
+
interface ControlMutationDefaultEntry {
|
|
75
|
+
readonly lower: (input: {
|
|
76
|
+
readonly call: ParsedDefaultFunctionCall;
|
|
77
|
+
readonly context: DefaultFunctionLoweringContext;
|
|
78
|
+
}) => LoweredDefaultResult;
|
|
79
|
+
readonly usageSignatures?: readonly string[];
|
|
80
|
+
}
|
|
81
|
+
type ControlMutationDefaultRegistry = ReadonlyMap<string, ControlMutationDefaultEntry>;
|
|
82
|
+
interface ControlMutationDefaults {
|
|
83
|
+
readonly defaultFunctionRegistry: ControlMutationDefaultRegistry;
|
|
84
|
+
readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[];
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
5
87
|
//#region src/framework-components.d.ts
|
|
6
|
-
|
|
7
88
|
/**
|
|
8
89
|
* Declarative fields that describe component metadata.
|
|
9
90
|
*/
|
|
@@ -68,6 +149,16 @@ interface ComponentMetadata {
|
|
|
68
149
|
* project them into concrete helper functions for TS-first workflows.
|
|
69
150
|
*/
|
|
70
151
|
readonly authoring?: AuthoringContributions;
|
|
152
|
+
/**
|
|
153
|
+
* Scalar type name to codec ID mapping contributed by this component.
|
|
154
|
+
* Assembled by `createControlStack` with duplicate detection.
|
|
155
|
+
*/
|
|
156
|
+
readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;
|
|
157
|
+
/**
|
|
158
|
+
* Mutation default function handlers and generator descriptors contributed
|
|
159
|
+
* by this component. Assembled by `createControlStack` with duplicate detection.
|
|
160
|
+
*/
|
|
161
|
+
readonly controlMutationDefaults?: ControlMutationDefaults;
|
|
71
162
|
}
|
|
72
163
|
/**
|
|
73
164
|
* Base descriptor for any framework component.
|
|
@@ -329,5 +420,5 @@ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string>
|
|
|
329
420
|
readonly targetId: TTargetId;
|
|
330
421
|
}
|
|
331
422
|
//#endregion
|
|
332
|
-
export { checkContractComponentRequirements as S, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, TargetPackRef as x, TargetDescriptor as y };
|
|
333
|
-
//# sourceMappingURL=framework-components-
|
|
423
|
+
export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, checkContractComponentRequirements as S, ControlMutationDefaults as T, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, LoweredDefaultValue as j, DefaultFunctionRegistryEntry as k, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
|
|
424
|
+
//# sourceMappingURL=framework-components-EJXe-pum.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-components-EJXe-pum.d.mts","names":[],"sources":["../src/mutation-default-types.ts","../src/framework-components.ts"],"sourcesContent":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-import-spec-C4sc7wbb.d.mts","names":[],"sources":["../src/types-import-spec.ts"],"sourcesContent":[],"mappings":";;AAIA;;;UAAiB,eAAA"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/framework-components",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Framework component types, assembly logic, and stack creation for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@prisma-next/operations": "0.4.0-dev.
|
|
9
|
-
"@prisma-next/utils": "0.4.0-dev.
|
|
10
|
-
"@prisma-next/contract": "0.4.0-dev.
|
|
8
|
+
"@prisma-next/operations": "0.4.0-dev.10",
|
|
9
|
+
"@prisma-next/utils": "0.4.0-dev.10",
|
|
10
|
+
"@prisma-next/contract": "0.4.0-dev.10"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"tsdown": "0.18.4",
|
|
@@ -145,6 +145,32 @@ export interface MigrationPlan {
|
|
|
145
145
|
readonly operations: readonly MigrationPlanOperation[];
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* A migration plan that can also render itself back to user-editable
|
|
150
|
+
* TypeScript source (a `migration.ts` file).
|
|
151
|
+
*
|
|
152
|
+
* Planners produce this richer shape so that CLI commands can both:
|
|
153
|
+
* - hand the plan to the runner for execution (via `MigrationPlan`), and
|
|
154
|
+
* - materialize the plan as an editable source file via `renderTypeScript()`.
|
|
155
|
+
*
|
|
156
|
+
* User-authored migrations (class-flow `Migration` subclasses) satisfy
|
|
157
|
+
* `MigrationPlan` but not this interface: they are already the source.
|
|
158
|
+
*
|
|
159
|
+
* Descriptor-flow targets (e.g. Postgres) that do not materialize their
|
|
160
|
+
* planner plans back to TypeScript provide a throwing stub so that
|
|
161
|
+
* `MigrationPlannerSuccessResult.plan` has a uniform type at the framework
|
|
162
|
+
* level. In practice the CLI only calls `renderTypeScript()` in the
|
|
163
|
+
* class-flow branch of `migration plan`.
|
|
164
|
+
*/
|
|
165
|
+
export interface MigrationPlanWithAuthoringSurface extends MigrationPlan {
|
|
166
|
+
/**
|
|
167
|
+
* Render this plan back to TypeScript source suitable for writing to
|
|
168
|
+
* `migration.ts`. Output may start with a shebang; when it does, the caller
|
|
169
|
+
* should make the resulting file executable.
|
|
170
|
+
*/
|
|
171
|
+
renderTypeScript(): string;
|
|
172
|
+
}
|
|
173
|
+
|
|
148
174
|
// ============================================================================
|
|
149
175
|
// Planner Result Types
|
|
150
176
|
// ============================================================================
|
|
@@ -163,10 +189,16 @@ export interface MigrationPlannerConflict {
|
|
|
163
189
|
|
|
164
190
|
/**
|
|
165
191
|
* Successful planner result with the migration plan.
|
|
192
|
+
*
|
|
193
|
+
* The plan is typed as `MigrationPlanWithAuthoringSurface` so the CLI can
|
|
194
|
+
* uniformly ask any plan to render itself to TypeScript. Targets whose
|
|
195
|
+
* planners do not support that (descriptor-flow targets like Postgres)
|
|
196
|
+
* supply a throwing `renderTypeScript()` stub — the CLI only calls it in
|
|
197
|
+
* the class-flow branch of `migration plan`.
|
|
166
198
|
*/
|
|
167
199
|
export interface MigrationPlannerSuccessResult {
|
|
168
200
|
readonly kind: 'success';
|
|
169
|
-
readonly plan:
|
|
201
|
+
readonly plan: MigrationPlanWithAuthoringSurface;
|
|
170
202
|
}
|
|
171
203
|
|
|
172
204
|
/**
|
|
@@ -258,6 +290,13 @@ export interface MigrationPlanner<
|
|
|
258
290
|
readonly contract: unknown;
|
|
259
291
|
readonly schema: unknown;
|
|
260
292
|
readonly policy: MigrationOperationPolicy;
|
|
293
|
+
/**
|
|
294
|
+
* Storage hash of the "from" contract (the state the planner assumes the
|
|
295
|
+
* database starts at). Class-flow planners use this to populate
|
|
296
|
+
* `describe()` on the produced plan so the rendered `migration.ts` has
|
|
297
|
+
* correct `from`/`to` metadata.
|
|
298
|
+
*/
|
|
299
|
+
readonly fromHash: string;
|
|
261
300
|
/**
|
|
262
301
|
* Active framework components participating in this composition.
|
|
263
302
|
* Families/targets can interpret this list to derive family-specific metadata.
|
|
@@ -267,6 +306,16 @@ export interface MigrationPlanner<
|
|
|
267
306
|
TargetBoundComponentDescriptor<TFamilyId, TTargetId>
|
|
268
307
|
>;
|
|
269
308
|
}): MigrationPlannerResult;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Produce an empty migration with the target's authoring conventions.
|
|
312
|
+
*
|
|
313
|
+
* Used by `migration new` to scaffold a fresh `migration.ts` without the
|
|
314
|
+
* CLI needing to know whether the target uses descriptor-flow or class-flow
|
|
315
|
+
* authoring. The returned plan has no operations; its `renderTypeScript()`
|
|
316
|
+
* yields a stub the user can edit.
|
|
317
|
+
*/
|
|
318
|
+
emptyMigration(context: MigrationScaffoldContext): MigrationPlanWithAuthoringSurface;
|
|
270
319
|
}
|
|
271
320
|
|
|
272
321
|
/**
|
|
@@ -343,8 +392,10 @@ export interface TargetMigrationsCapability<
|
|
|
343
392
|
|
|
344
393
|
/**
|
|
345
394
|
* Plans a migration using the descriptor-based planner.
|
|
346
|
-
* Returns operation descriptors
|
|
347
|
-
*
|
|
395
|
+
* Returns operation descriptors that the caller scaffolds into a
|
|
396
|
+
* `migration.ts` file. Whether the resulting migration can be emitted
|
|
397
|
+
* end-to-end is determined at emit time (via `placeholder()` errors
|
|
398
|
+
* thrown for unfilled slots), not by the planner.
|
|
348
399
|
*/
|
|
349
400
|
planWithDescriptors?(context: {
|
|
350
401
|
readonly fromContract: Contract | null;
|
|
@@ -356,7 +407,6 @@ export interface TargetMigrationsCapability<
|
|
|
356
407
|
| {
|
|
357
408
|
readonly ok: true;
|
|
358
409
|
readonly descriptors: readonly OperationDescriptor[];
|
|
359
|
-
readonly needsDataMigration: boolean;
|
|
360
410
|
}
|
|
361
411
|
| {
|
|
362
412
|
readonly ok: false;
|
|
@@ -365,7 +415,7 @@ export interface TargetMigrationsCapability<
|
|
|
365
415
|
|
|
366
416
|
/**
|
|
367
417
|
* Resolves operation descriptors into target-specific migration plan operations
|
|
368
|
-
* with SQL/DDL, prechecks, and postchecks. Called by `migration
|
|
418
|
+
* with SQL/DDL, prechecks, and postchecks. Called by `migration emit` to
|
|
369
419
|
* serialize migration.ts into ops.json.
|
|
370
420
|
*/
|
|
371
421
|
resolveDescriptors?(
|
|
@@ -379,4 +429,81 @@ export interface TargetMigrationsCapability<
|
|
|
379
429
|
>;
|
|
380
430
|
},
|
|
381
431
|
): readonly MigrationPlanOperation[];
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Optional: render a descriptor list back to a populated `migration.ts`
|
|
435
|
+
* source string.
|
|
436
|
+
*
|
|
437
|
+
* Descriptor-flow targets (e.g. Postgres) implement this so that
|
|
438
|
+
* `migration plan` can hand the user an editable authoring surface that
|
|
439
|
+
* already captures the planner's decisions. Class-flow targets do not
|
|
440
|
+
* implement it — their planner already returns a renderable plan via
|
|
441
|
+
* `MigrationPlannerSuccessResult.plan.renderTypeScript()`.
|
|
442
|
+
*/
|
|
443
|
+
renderDescriptorTypeScript?(
|
|
444
|
+
descriptors: readonly OperationDescriptor[],
|
|
445
|
+
context: MigrationScaffoldContext,
|
|
446
|
+
): string;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Optional: in-process emit capability for class-flow migration files.
|
|
450
|
+
*
|
|
451
|
+
* Targets that author `migration.ts` as an executable class (rather than
|
|
452
|
+
* an array of descriptors) implement `emit` to produce `ops.json` from
|
|
453
|
+
* the source file directly. The framework dispatches to `emit` whenever
|
|
454
|
+
* `resolveDescriptors` is not present on the target.
|
|
455
|
+
*
|
|
456
|
+
* The capability runs in the same Node process as the CLI:
|
|
457
|
+
* - The target dynamically imports `<dir>/migration.ts`, locates the
|
|
458
|
+
* authored class on the module's default export, and invokes whatever
|
|
459
|
+
* runtime machinery it needs to obtain the operations list.
|
|
460
|
+
* - Structured errors thrown during evaluation (notably
|
|
461
|
+
* `errorUnfilledPlaceholder` with code `PN-MIG-2001`) propagate as
|
|
462
|
+
* real JS exceptions so the CLI's normal error envelope can render
|
|
463
|
+
* them with full structured metadata. No subprocess is spawned.
|
|
464
|
+
* - The target is responsible for calling `writeMigrationOps(dir, ops)`
|
|
465
|
+
* so that `ops.json` ends up on disk before `emit` returns. The
|
|
466
|
+
* framework's `emitMigration` helper is the single owner of
|
|
467
|
+
* `attestMigration(dir)` — the target MUST NOT call
|
|
468
|
+
* `attestMigration` itself.
|
|
469
|
+
* - The returned `MigrationPlanOperation[]` is the display-oriented
|
|
470
|
+
* shape the CLI uses for output (id, label, operationClass).
|
|
471
|
+
*/
|
|
472
|
+
emit?(options: {
|
|
473
|
+
readonly dir: string;
|
|
474
|
+
readonly frameworkComponents: ReadonlyArray<
|
|
475
|
+
TargetBoundComponentDescriptor<TFamilyId, TTargetId>
|
|
476
|
+
>;
|
|
477
|
+
}): Promise<readonly MigrationPlanOperation[]>;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// ============================================================================
|
|
481
|
+
// Migration Scaffolding SPI
|
|
482
|
+
// ============================================================================
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Context for rendering migration source files.
|
|
486
|
+
*
|
|
487
|
+
* Kept minimal: only the paths a target might need to compute relative imports
|
|
488
|
+
* (e.g. the contract `.d.ts` import for typed-contract builders). Passed to
|
|
489
|
+
* `MigrationPlanner.emptyMigration(context)` and to
|
|
490
|
+
* `TargetMigrationsCapability.renderDescriptorTypeScript(descriptors, context)`.
|
|
491
|
+
*/
|
|
492
|
+
export interface MigrationScaffoldContext {
|
|
493
|
+
/** Absolute path to the migration package directory. Used by targets to compute relative imports. */
|
|
494
|
+
readonly packageDir: string;
|
|
495
|
+
/** Absolute path to the contract.json file, if one exists. Used by targets that emit typed-contract imports. */
|
|
496
|
+
readonly contractJsonPath?: string;
|
|
497
|
+
/**
|
|
498
|
+
* Storage hash of the "from" contract. Class-flow targets (e.g. Mongo) use
|
|
499
|
+
* this to populate `describe()` on the rendered empty migration so that
|
|
500
|
+
* `migration.json` generated at emit time has correct identity metadata.
|
|
501
|
+
*/
|
|
502
|
+
readonly fromHash: string;
|
|
503
|
+
/**
|
|
504
|
+
* Storage hash of the "to" contract. Same purpose as `fromHash` — threaded
|
|
505
|
+
* through so the rendered class's `describe()` declares the correct
|
|
506
|
+
* destination identity.
|
|
507
|
+
*/
|
|
508
|
+
readonly toHash: string;
|
|
382
509
|
}
|
package/src/control-stack.ts
CHANGED
|
@@ -14,6 +14,11 @@ import type {
|
|
|
14
14
|
AuthoringTypeNamespace,
|
|
15
15
|
} from './framework-authoring';
|
|
16
16
|
import type { ComponentMetadata } from './framework-components';
|
|
17
|
+
import type {
|
|
18
|
+
ControlMutationDefaultEntry,
|
|
19
|
+
ControlMutationDefaults,
|
|
20
|
+
MutationDefaultGeneratorDescriptor,
|
|
21
|
+
} from './mutation-default-types';
|
|
17
22
|
import type { TypesImportSpec } from './types-import-spec';
|
|
18
23
|
|
|
19
24
|
export interface AssembledAuthoringContributions {
|
|
@@ -37,6 +42,8 @@ export interface ControlStack<
|
|
|
37
42
|
readonly extensionIds: ReadonlyArray<string>;
|
|
38
43
|
readonly codecLookup: CodecLookup;
|
|
39
44
|
readonly authoringContributions: AssembledAuthoringContributions;
|
|
45
|
+
readonly scalarTypeDescriptors: ReadonlyMap<string, string>;
|
|
46
|
+
readonly controlMutationDefaults: ControlMutationDefaults;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
export interface CreateControlStackInput<
|
|
@@ -244,6 +251,80 @@ export function assembleAuthoringContributions(
|
|
|
244
251
|
};
|
|
245
252
|
}
|
|
246
253
|
|
|
254
|
+
export function assembleScalarTypeDescriptors(
|
|
255
|
+
descriptors: ReadonlyArray<
|
|
256
|
+
Pick<ComponentMetadata, 'scalarTypeDescriptors'> & { readonly id?: string }
|
|
257
|
+
>,
|
|
258
|
+
): ReadonlyMap<string, string> {
|
|
259
|
+
const result = new Map<string, string>();
|
|
260
|
+
const owners = new Map<string, string>();
|
|
261
|
+
|
|
262
|
+
for (const descriptor of descriptors) {
|
|
263
|
+
const descriptorMap = descriptor.scalarTypeDescriptors;
|
|
264
|
+
if (!descriptorMap) continue;
|
|
265
|
+
const descriptorId = descriptor.id ?? '<unknown>';
|
|
266
|
+
for (const [typeName, codecId] of descriptorMap) {
|
|
267
|
+
const existingOwner = owners.get(typeName);
|
|
268
|
+
if (existingOwner !== undefined) {
|
|
269
|
+
throw new Error(
|
|
270
|
+
`Duplicate scalar type descriptor "${typeName}". ` +
|
|
271
|
+
`Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
result.set(typeName, codecId);
|
|
275
|
+
owners.set(typeName, descriptorId);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function assembleControlMutationDefaults(
|
|
283
|
+
descriptors: ReadonlyArray<
|
|
284
|
+
Pick<ComponentMetadata, 'controlMutationDefaults'> & { readonly id?: string }
|
|
285
|
+
>,
|
|
286
|
+
): ControlMutationDefaults {
|
|
287
|
+
const defaultFunctionRegistry = new Map<string, ControlMutationDefaultEntry>();
|
|
288
|
+
const functionOwners = new Map<string, string>();
|
|
289
|
+
const generatorMap = new Map<string, MutationDefaultGeneratorDescriptor>();
|
|
290
|
+
const generatorOwners = new Map<string, string>();
|
|
291
|
+
|
|
292
|
+
for (const descriptor of descriptors) {
|
|
293
|
+
const contributions = descriptor.controlMutationDefaults;
|
|
294
|
+
if (!contributions) continue;
|
|
295
|
+
const descriptorId = descriptor.id ?? '<unknown>';
|
|
296
|
+
|
|
297
|
+
for (const generatorDescriptor of contributions.generatorDescriptors) {
|
|
298
|
+
const existingOwner = generatorOwners.get(generatorDescriptor.id);
|
|
299
|
+
if (existingOwner !== undefined) {
|
|
300
|
+
throw new Error(
|
|
301
|
+
`Duplicate mutation default generator id "${generatorDescriptor.id}". ` +
|
|
302
|
+
`Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
generatorMap.set(generatorDescriptor.id, generatorDescriptor);
|
|
306
|
+
generatorOwners.set(generatorDescriptor.id, descriptorId);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
for (const [functionName, handler] of contributions.defaultFunctionRegistry) {
|
|
310
|
+
const existingOwner = functionOwners.get(functionName);
|
|
311
|
+
if (existingOwner !== undefined) {
|
|
312
|
+
throw new Error(
|
|
313
|
+
`Duplicate mutation default function "${functionName}". ` +
|
|
314
|
+
`Descriptor "${descriptorId}" conflicts with "${existingOwner}".`,
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
defaultFunctionRegistry.set(functionName, handler);
|
|
318
|
+
functionOwners.set(functionName, descriptorId);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return {
|
|
323
|
+
defaultFunctionRegistry,
|
|
324
|
+
generatorDescriptors: Array.from(generatorMap.values()),
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
247
328
|
export function extractCodecLookup(
|
|
248
329
|
descriptors: ReadonlyArray<Pick<ComponentMetadata & { id?: string }, 'types' | 'id'>>,
|
|
249
330
|
): CodecLookup {
|
|
@@ -268,6 +349,21 @@ export function extractCodecLookup(
|
|
|
268
349
|
return { get: (id) => byId.get(id) };
|
|
269
350
|
}
|
|
270
351
|
|
|
352
|
+
export function validateScalarTypeCodecIds(
|
|
353
|
+
scalarTypeDescriptors: ReadonlyMap<string, string>,
|
|
354
|
+
codecLookup: CodecLookup,
|
|
355
|
+
): string[] {
|
|
356
|
+
const errors: string[] = [];
|
|
357
|
+
for (const [typeName, codecId] of scalarTypeDescriptors) {
|
|
358
|
+
if (!codecLookup.get(codecId)) {
|
|
359
|
+
errors.push(
|
|
360
|
+
`Scalar type "${typeName}" references codec "${codecId}" which is not registered by any component.`,
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return errors;
|
|
365
|
+
}
|
|
366
|
+
|
|
271
367
|
export function createControlStack<TFamilyId extends string, TTargetId extends string>(
|
|
272
368
|
input: CreateControlStackInput<TFamilyId, TTargetId>,
|
|
273
369
|
): ControlStack<TFamilyId, TTargetId> {
|
|
@@ -275,6 +371,9 @@ export function createControlStack<TFamilyId extends string, TTargetId extends s
|
|
|
275
371
|
|
|
276
372
|
const allDescriptors = [family, target, ...(adapter ? [adapter] : []), ...extensionPacks];
|
|
277
373
|
|
|
374
|
+
const codecLookup = extractCodecLookup(allDescriptors);
|
|
375
|
+
const scalarTypeDescriptors = assembleScalarTypeDescriptors(allDescriptors);
|
|
376
|
+
|
|
278
377
|
return {
|
|
279
378
|
family,
|
|
280
379
|
target,
|
|
@@ -286,7 +385,9 @@ export function createControlStack<TFamilyId extends string, TTargetId extends s
|
|
|
286
385
|
operationTypeImports: extractOperationTypeImports(allDescriptors),
|
|
287
386
|
queryOperationTypeImports: extractQueryOperationTypeImports(allDescriptors),
|
|
288
387
|
extensionIds: extractComponentIds(family, target, adapter, extensionPacks),
|
|
289
|
-
codecLookup
|
|
388
|
+
codecLookup,
|
|
290
389
|
authoringContributions: assembleAuthoringContributions(allDescriptors),
|
|
390
|
+
scalarTypeDescriptors,
|
|
391
|
+
controlMutationDefaults: assembleControlMutationDefaults(allDescriptors),
|
|
291
392
|
};
|
|
292
393
|
}
|
package/src/exports/control.ts
CHANGED
|
@@ -25,11 +25,13 @@ export type {
|
|
|
25
25
|
MigrationPlannerResult,
|
|
26
26
|
MigrationPlannerSuccessResult,
|
|
27
27
|
MigrationPlanOperation,
|
|
28
|
+
MigrationPlanWithAuthoringSurface,
|
|
28
29
|
MigrationRunner,
|
|
29
30
|
MigrationRunnerExecutionChecks,
|
|
30
31
|
MigrationRunnerFailure,
|
|
31
32
|
MigrationRunnerResult,
|
|
32
33
|
MigrationRunnerSuccessValue,
|
|
34
|
+
MigrationScaffoldContext,
|
|
33
35
|
OperationDescriptor,
|
|
34
36
|
SerializedQueryPlan,
|
|
35
37
|
TargetMigrationsCapability,
|
|
@@ -66,6 +68,8 @@ export type {
|
|
|
66
68
|
} from '../control-stack';
|
|
67
69
|
export {
|
|
68
70
|
assembleAuthoringContributions,
|
|
71
|
+
assembleControlMutationDefaults,
|
|
72
|
+
assembleScalarTypeDescriptors,
|
|
69
73
|
assertUniqueCodecOwner,
|
|
70
74
|
createControlStack,
|
|
71
75
|
extractCodecLookup,
|
|
@@ -74,3 +78,18 @@ export {
|
|
|
74
78
|
extractOperationTypeImports,
|
|
75
79
|
extractQueryOperationTypeImports,
|
|
76
80
|
} from '../control-stack';
|
|
81
|
+
export type {
|
|
82
|
+
ControlMutationDefaultEntry,
|
|
83
|
+
ControlMutationDefaultRegistry,
|
|
84
|
+
ControlMutationDefaults,
|
|
85
|
+
DefaultFunctionLoweringContext,
|
|
86
|
+
DefaultFunctionLoweringHandler,
|
|
87
|
+
DefaultFunctionRegistry,
|
|
88
|
+
DefaultFunctionRegistryEntry,
|
|
89
|
+
LoweredDefaultResult,
|
|
90
|
+
LoweredDefaultValue,
|
|
91
|
+
MutationDefaultGeneratorDescriptor,
|
|
92
|
+
ParsedDefaultFunctionCall,
|
|
93
|
+
SourceDiagnostic,
|
|
94
|
+
SourceSpan,
|
|
95
|
+
} from '../mutation-default-types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Codec } from './codec-types';
|
|
2
2
|
import type { AuthoringContributions } from './framework-authoring';
|
|
3
|
+
import type { ControlMutationDefaults } from './mutation-default-types';
|
|
3
4
|
import type { TypesImportSpec } from './types-import-spec';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -65,6 +66,18 @@ export interface ComponentMetadata {
|
|
|
65
66
|
* project them into concrete helper functions for TS-first workflows.
|
|
66
67
|
*/
|
|
67
68
|
readonly authoring?: AuthoringContributions;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Scalar type name to codec ID mapping contributed by this component.
|
|
72
|
+
* Assembled by `createControlStack` with duplicate detection.
|
|
73
|
+
*/
|
|
74
|
+
readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Mutation default function handlers and generator descriptors contributed
|
|
78
|
+
* by this component. Assembled by `createControlStack` with duplicate detection.
|
|
79
|
+
*/
|
|
80
|
+
readonly controlMutationDefaults?: ControlMutationDefaults;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
/**
|