@prisma-next/family-sql 0.3.0-dev.4 → 0.3.0-dev.40

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.
Files changed (74) hide show
  1. package/README.md +11 -6
  2. package/dist/assembly-BVS641kd.mjs +106 -0
  3. package/dist/assembly-BVS641kd.mjs.map +1 -0
  4. package/dist/control-adapter.d.mts +60 -0
  5. package/dist/control-adapter.d.mts.map +1 -0
  6. package/dist/control-adapter.mjs +1 -0
  7. package/dist/control-instance-Cvmn5zpn.d.mts +292 -0
  8. package/dist/control-instance-Cvmn5zpn.d.mts.map +1 -0
  9. package/dist/control.d.mts +64 -0
  10. package/dist/control.d.mts.map +1 -0
  11. package/dist/control.mjs +534 -0
  12. package/dist/control.mjs.map +1 -0
  13. package/dist/runtime.d.mts +27 -0
  14. package/dist/runtime.d.mts.map +1 -0
  15. package/dist/runtime.mjs +38 -0
  16. package/dist/runtime.mjs.map +1 -0
  17. package/dist/schema-verify.d.mts +48 -0
  18. package/dist/schema-verify.d.mts.map +1 -0
  19. package/dist/schema-verify.mjs +4 -0
  20. package/dist/test-utils.d.mts +2 -0
  21. package/dist/test-utils.mjs +3 -0
  22. package/dist/verify-BfMETJcM.mjs +108 -0
  23. package/dist/verify-BfMETJcM.mjs.map +1 -0
  24. package/dist/verify-sql-schema-B4T5MEuz.mjs +934 -0
  25. package/dist/verify-sql-schema-B4T5MEuz.mjs.map +1 -0
  26. package/dist/verify-sql-schema-CvQoGm2Q.d.mts +67 -0
  27. package/dist/verify-sql-schema-CvQoGm2Q.d.mts.map +1 -0
  28. package/dist/{exports/verify.d.ts → verify.d.mts} +8 -5
  29. package/dist/verify.d.mts.map +1 -0
  30. package/dist/verify.mjs +3 -0
  31. package/package.json +38 -48
  32. package/src/core/assembly.ts +216 -0
  33. package/src/core/control-adapter.ts +67 -0
  34. package/src/core/control-descriptor.ts +37 -0
  35. package/src/core/control-instance.ts +750 -0
  36. package/src/core/migrations/plan-helpers.ts +164 -0
  37. package/src/core/migrations/policies.ts +8 -0
  38. package/src/core/migrations/types.ts +279 -0
  39. package/src/core/runtime-descriptor.ts +23 -0
  40. package/src/core/runtime-instance.ts +22 -0
  41. package/src/core/schema-verify/verify-helpers.ts +532 -0
  42. package/src/core/schema-verify/verify-sql-schema.ts +1011 -0
  43. package/src/core/verify.ts +168 -0
  44. package/src/exports/control-adapter.ts +1 -0
  45. package/src/exports/control.ts +59 -0
  46. package/src/exports/runtime.ts +3 -0
  47. package/src/exports/schema-verify.ts +19 -0
  48. package/src/exports/test-utils.ts +10 -0
  49. package/src/exports/verify.ts +1 -0
  50. package/dist/exports/chunk-6P44BVZ4.js +0 -580
  51. package/dist/exports/chunk-6P44BVZ4.js.map +0 -1
  52. package/dist/exports/chunk-C3GKWCKA.js +0 -96
  53. package/dist/exports/chunk-C3GKWCKA.js.map +0 -1
  54. package/dist/exports/chunk-F252JMEU.js +0 -772
  55. package/dist/exports/chunk-F252JMEU.js.map +0 -1
  56. package/dist/exports/control-adapter.d.ts +0 -44
  57. package/dist/exports/control-adapter.js +0 -1
  58. package/dist/exports/control-adapter.js.map +0 -1
  59. package/dist/exports/control.d.ts +0 -75
  60. package/dist/exports/control.js +0 -149
  61. package/dist/exports/control.js.map +0 -1
  62. package/dist/exports/instance-DiZi2k_2.d.ts +0 -127
  63. package/dist/exports/runtime.d.ts +0 -66
  64. package/dist/exports/runtime.js +0 -64
  65. package/dist/exports/runtime.js.map +0 -1
  66. package/dist/exports/schema-verify.d.ts +0 -75
  67. package/dist/exports/schema-verify.js +0 -11
  68. package/dist/exports/schema-verify.js.map +0 -1
  69. package/dist/exports/test-utils.d.ts +0 -33
  70. package/dist/exports/test-utils.js +0 -17
  71. package/dist/exports/test-utils.js.map +0 -1
  72. package/dist/exports/types-Bh7ftf0Q.d.ts +0 -275
  73. package/dist/exports/verify.js +0 -11
  74. package/dist/exports/verify.js.map +0 -1
@@ -1,64 +0,0 @@
1
- // src/core/runtime-instance.ts
2
- import { assertRuntimeContractRequirementsSatisfied } from "@prisma-next/core-execution-plane/framework-components";
3
- import { createRuntime, createRuntimeContext } from "@prisma-next/sql-runtime";
4
- function createSqlRuntimeFamilyInstance(options) {
5
- const {
6
- family: familyDescriptor,
7
- target: targetDescriptor,
8
- adapter: adapterDescriptor,
9
- driver: driverDescriptor,
10
- extensionPacks: extensionDescriptors = []
11
- } = options;
12
- return {
13
- familyId: "sql",
14
- createRuntime(runtimeOptions) {
15
- assertRuntimeContractRequirementsSatisfied({
16
- contract: runtimeOptions.contract,
17
- family: familyDescriptor,
18
- target: targetDescriptor,
19
- adapter: adapterDescriptor,
20
- extensionPacks: extensionDescriptors
21
- });
22
- const driverInstance = driverDescriptor.create(runtimeOptions.driverOptions);
23
- const context = createRuntimeContext({
24
- contract: runtimeOptions.contract,
25
- target: targetDescriptor,
26
- adapter: adapterDescriptor,
27
- extensionPacks: extensionDescriptors
28
- });
29
- const runtimeOptions_ = {
30
- driver: driverInstance,
31
- verify: runtimeOptions.verify,
32
- context,
33
- ...runtimeOptions.plugins ? { plugins: runtimeOptions.plugins } : {},
34
- ...runtimeOptions.mode ? { mode: runtimeOptions.mode } : {},
35
- ...runtimeOptions.log ? { log: runtimeOptions.log } : {}
36
- };
37
- return createRuntime(runtimeOptions_);
38
- }
39
- };
40
- }
41
-
42
- // src/core/runtime-descriptor.ts
43
- var SqlRuntimeFamilyDescriptor = class {
44
- kind = "family";
45
- id = "sql";
46
- familyId = "sql";
47
- version = "0.0.1";
48
- create(options) {
49
- return createSqlRuntimeFamilyInstance({
50
- family: this,
51
- target: options.target,
52
- adapter: options.adapter,
53
- driver: options.driver,
54
- extensionPacks: options.extensionPacks
55
- });
56
- }
57
- };
58
-
59
- // src/exports/runtime.ts
60
- var runtime_default = new SqlRuntimeFamilyDescriptor();
61
- export {
62
- runtime_default as default
63
- };
64
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/runtime-instance.ts","../../src/core/runtime-descriptor.ts","../../src/exports/runtime.ts"],"sourcesContent":["import { assertRuntimeContractRequirementsSatisfied } from '@prisma-next/core-execution-plane/framework-components';\nimport type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeDriverInstance,\n RuntimeFamilyDescriptor,\n RuntimeFamilyInstance,\n RuntimeTargetDescriptor,\n} from '@prisma-next/core-execution-plane/types';\nimport type { Log, Plugin, RuntimeVerifyOptions } from '@prisma-next/runtime-executor';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport type {\n Adapter,\n LoweredStatement,\n SelectAst,\n SqlDriver,\n} from '@prisma-next/sql-relational-core/ast';\nimport type {\n Runtime,\n RuntimeOptions,\n SqlRuntimeAdapterInstance,\n SqlRuntimeExtensionDescriptor,\n} from '@prisma-next/sql-runtime';\nimport { createRuntime, createRuntimeContext } from '@prisma-next/sql-runtime';\n\n/**\n * SQL runtime driver instance type.\n * Combines identity properties with SQL-specific behavior methods.\n */\nexport type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<\n 'sql',\n TTargetId\n> &\n SqlDriver;\n\n// Re-export SqlRuntimeAdapterInstance from sql-runtime for consumers\nexport type { SqlRuntimeAdapterInstance } from '@prisma-next/sql-runtime';\n\n/**\n * SQL runtime family instance interface.\n * Extends base RuntimeFamilyInstance with SQL-specific runtime creation method.\n */\nexport interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {\n /**\n * Creates a SQL runtime from contract, driver options, and verification settings.\n *\n * Extension packs are routed through composition (at instance creation time),\n * not through this method. This aligns with control-plane composition patterns.\n *\n * @param options - Runtime creation options\n * @param options.contract - SQL contract\n * @param options.driverOptions - Driver options (e.g., PostgresDriverOptions)\n * @param options.verify - Runtime verification options\n * @param options.plugins - Optional plugins\n * @param options.mode - Optional runtime mode\n * @param options.log - Optional log instance\n * @returns Runtime instance\n */\n createRuntime<TContract extends SqlContract<SqlStorage>>(options: {\n readonly contract: TContract;\n readonly driverOptions: unknown;\n readonly verify: RuntimeVerifyOptions;\n readonly plugins?: readonly Plugin<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n }): Runtime;\n}\n\n/**\n * Creates a SQL runtime family instance from runtime descriptors.\n *\n * Routes the same framework composition as control-plane:\n * family, target, adapter, driver, extensionPacks (all as descriptors with IDs).\n */\nexport function createSqlRuntimeFamilyInstance<TTargetId extends string>(options: {\n readonly family: RuntimeFamilyDescriptor<'sql'>;\n readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<\n 'sql',\n TTargetId,\n SqlRuntimeAdapterInstance<TTargetId>\n >;\n readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, SqlRuntimeDriverInstance<TTargetId>>;\n readonly extensionPacks?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];\n}): SqlRuntimeFamilyInstance {\n const {\n family: familyDescriptor,\n target: targetDescriptor,\n adapter: adapterDescriptor,\n driver: driverDescriptor,\n extensionPacks: extensionDescriptors = [],\n } = options;\n\n return {\n familyId: 'sql' as const,\n createRuntime<TContract extends SqlContract<SqlStorage>>(runtimeOptions: {\n readonly contract: TContract;\n readonly driverOptions: unknown;\n readonly verify: RuntimeVerifyOptions;\n readonly plugins?: readonly Plugin<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n }): Runtime {\n // Validate contract requirements against provided descriptors\n assertRuntimeContractRequirementsSatisfied({\n contract: runtimeOptions.contract,\n family: familyDescriptor,\n target: targetDescriptor,\n adapter: adapterDescriptor,\n extensionPacks: extensionDescriptors,\n });\n\n // Create driver instance\n const driverInstance = driverDescriptor.create(runtimeOptions.driverOptions);\n\n // Create context via descriptor-first API\n const context = createRuntimeContext<TContract, TTargetId>({\n contract: runtimeOptions.contract,\n target: targetDescriptor,\n adapter: adapterDescriptor,\n extensionPacks: extensionDescriptors,\n });\n\n const runtimeOptions_: RuntimeOptions<TContract> = {\n driver: driverInstance,\n verify: runtimeOptions.verify,\n context,\n ...(runtimeOptions.plugins ? { plugins: runtimeOptions.plugins } : {}),\n ...(runtimeOptions.mode ? { mode: runtimeOptions.mode } : {}),\n ...(runtimeOptions.log ? { log: runtimeOptions.log } : {}),\n };\n\n return createRuntime(runtimeOptions_);\n },\n };\n}\n","import type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from '@prisma-next/core-execution-plane/types';\nimport {\n createSqlRuntimeFamilyInstance,\n type SqlRuntimeAdapterInstance,\n type SqlRuntimeDriverInstance,\n type SqlRuntimeFamilyInstance,\n} from './runtime-instance';\n\n/**\n * SQL runtime family descriptor implementation.\n * Provides factory method to create SQL runtime family instance.\n */\nexport class SqlRuntimeFamilyDescriptor\n implements RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly version = '0.0.1';\n\n create<TTargetId extends string>(options: {\n readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<\n 'sql',\n TTargetId,\n SqlRuntimeAdapterInstance<TTargetId>\n >;\n readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, SqlRuntimeDriverInstance<TTargetId>>;\n readonly extensionPacks: readonly RuntimeExtensionDescriptor<'sql', TTargetId>[];\n }): SqlRuntimeFamilyInstance {\n return createSqlRuntimeFamilyInstance({\n family: this,\n target: options.target,\n adapter: options.adapter,\n driver: options.driver,\n extensionPacks: options.extensionPacks,\n });\n }\n}\n","import { SqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\n/**\n * SQL runtime family descriptor for execution/runtime plane.\n * Provides factory method to create SQL runtime family instance.\n */\nexport default new SqlRuntimeFamilyDescriptor();\n"],"mappings":";AAAA,SAAS,kDAAkD;AAuB3D,SAAS,eAAe,4BAA4B;AAuD7C,SAAS,+BAAyD,SAU5C;AAC3B,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB,uBAAuB,CAAC;AAAA,EAC1C,IAAI;AAEJ,SAAO;AAAA,IACL,UAAU;AAAA,IACV,cAAyD,gBAW7C;AAEV,iDAA2C;AAAA,QACzC,UAAU,eAAe;AAAA,QACzB,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,gBAAgB;AAAA,MAClB,CAAC;AAGD,YAAM,iBAAiB,iBAAiB,OAAO,eAAe,aAAa;AAG3E,YAAM,UAAU,qBAA2C;AAAA,QACzD,UAAU,eAAe;AAAA,QACzB,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,gBAAgB;AAAA,MAClB,CAAC;AAED,YAAM,kBAA6C;AAAA,QACjD,QAAQ;AAAA,QACR,QAAQ,eAAe;AAAA,QACvB;AAAA,QACA,GAAI,eAAe,UAAU,EAAE,SAAS,eAAe,QAAQ,IAAI,CAAC;AAAA,QACpE,GAAI,eAAe,OAAO,EAAE,MAAM,eAAe,KAAK,IAAI,CAAC;AAAA,QAC3D,GAAI,eAAe,MAAM,EAAE,KAAK,eAAe,IAAI,IAAI,CAAC;AAAA,MAC1D;AAEA,aAAO,cAAc,eAAe;AAAA,IACtC;AAAA,EACF;AACF;;;AC7HO,IAAM,6BAAN,MAEP;AAAA,EACW,OAAO;AAAA,EACP,KAAK;AAAA,EACL,WAAW;AAAA,EACX,UAAU;AAAA,EAEnB,OAAiC,SASJ;AAC3B,WAAO,+BAA+B;AAAA,MACpC,QAAQ;AAAA,MACR,QAAQ,QAAQ;AAAA,MAChB,SAAS,QAAQ;AAAA,MACjB,QAAQ,QAAQ;AAAA,MAChB,gBAAgB,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH;AACF;;;ACtCA,IAAO,kBAAQ,IAAI,2BAA2B;","names":[]}
@@ -1,75 +0,0 @@
1
- import { SchemaIssue, SchemaVerificationNode, OperationContext, VerifyDatabaseSchemaResult } from '@prisma-next/core-control-plane/types';
2
- import { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
3
- import { i as ComponentDatabaseDependency } from './types-Bh7ftf0Q.js';
4
- import { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
5
- import { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
6
- import '@prisma-next/utils/result';
7
- import './instance-DiZi2k_2.js';
8
- import '@prisma-next/contract/ir';
9
- import '@prisma-next/contract/pack-manifest-types';
10
- import '@prisma-next/contract/types';
11
- import '@prisma-next/core-control-plane/schema-view';
12
- import '@prisma-next/operations';
13
- import '@prisma-next/sql-operations';
14
-
15
- /**
16
- * Pure verification helper functions for SQL schema verification.
17
- * These functions verify schema IR against contract requirements.
18
- */
19
-
20
- /**
21
- * Compares two arrays of strings for equality (order-sensitive).
22
- */
23
- declare function arraysEqual(a: readonly string[], b: readonly string[]): boolean;
24
- /**
25
- * Verifies database dependencies are installed using component-owned verification hooks.
26
- * Each dependency provides a pure verifyDatabaseDependencyInstalled function that checks
27
- * whether the dependency is satisfied based on the in-memory schema IR (no DB I/O).
28
- *
29
- * Returns verification nodes for the tree.
30
- */
31
- declare function verifyDatabaseDependencies(dependencies: ReadonlyArray<ComponentDatabaseDependency<unknown>>, schema: SqlSchemaIR, issues: SchemaIssue[]): SchemaVerificationNode[];
32
-
33
- /**
34
- * Pure SQL schema verification function.
35
- *
36
- * This module provides a pure function that verifies a SqlSchemaIR against
37
- * a SqlContract without requiring a database connection. It can be reused
38
- * by migration planners and other tools that need to compare schema states.
39
- */
40
-
41
- /**
42
- * Options for the pure schema verification function.
43
- */
44
- interface VerifySqlSchemaOptions {
45
- /** The validated SQL contract to verify against */
46
- readonly contract: SqlContract<SqlStorage>;
47
- /** The schema IR from introspection (or another source) */
48
- readonly schema: SqlSchemaIR;
49
- /** Whether to run in strict mode (detects extra tables/columns) */
50
- readonly strict: boolean;
51
- /** Optional operation context for metadata */
52
- readonly context?: OperationContext;
53
- /** Type metadata registry for codec consistency warnings */
54
- readonly typeMetadataRegistry: ReadonlyMap<string, {
55
- nativeType?: string;
56
- }>;
57
- /**
58
- * Active framework components participating in this composition.
59
- * All components must have matching familyId ('sql') and targetId.
60
- */
61
- readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
62
- }
63
- /**
64
- * Verifies that a SqlSchemaIR matches a SqlContract.
65
- *
66
- * This is a pure function that does NOT perform any database I/O.
67
- * It takes an already-introspected schema IR and compares it against
68
- * the contract requirements.
69
- *
70
- * @param options - Verification options
71
- * @returns VerifyDatabaseSchemaResult with verification tree and issues
72
- */
73
- declare function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult;
74
-
75
- export { type VerifySqlSchemaOptions, arraysEqual, verifyDatabaseDependencies, verifySqlSchema };
@@ -1,11 +0,0 @@
1
- import {
2
- arraysEqual,
3
- verifyDatabaseDependencies,
4
- verifySqlSchema
5
- } from "./chunk-F252JMEU.js";
6
- export {
7
- arraysEqual,
8
- verifyDatabaseDependencies,
9
- verifySqlSchema
10
- };
11
- //# sourceMappingURL=schema-verify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,33 +0,0 @@
1
- import { OperationManifest } from '@prisma-next/contract/pack-manifest-types';
2
- import { TypesImportSpec } from '@prisma-next/contract/types';
3
- import { ControlTargetDescriptor, ControlAdapterDescriptor, ControlExtensionDescriptor } from '@prisma-next/core-control-plane/types';
4
- import { OperationSignature, OperationRegistry } from '@prisma-next/operations';
5
- export { c as convertOperationManifest } from './instance-DiZi2k_2.js';
6
- import '@prisma-next/contract/framework-components';
7
- import '@prisma-next/contract/ir';
8
- import '@prisma-next/core-control-plane/schema-view';
9
- import '@prisma-next/sql-operations';
10
- import '@prisma-next/sql-schema-ir/types';
11
-
12
- /**
13
- * Assembles an operation registry from descriptors (adapter, target, extensions).
14
- * Loops over descriptors, extracts operations, converts them using the provided
15
- * conversion function, and registers them in a new registry.
16
- */
17
- declare function assembleOperationRegistry(descriptors: ReadonlyArray<ControlTargetDescriptor<'sql', string> | ControlAdapterDescriptor<'sql', string> | ControlExtensionDescriptor<'sql', string>>, convertOperationManifest: (manifest: OperationManifest) => OperationSignature): OperationRegistry;
18
- /**
19
- * Extracts codec type imports from descriptors for contract.d.ts generation.
20
- */
21
- declare function extractCodecTypeImports(descriptors: ReadonlyArray<ControlTargetDescriptor<'sql', string> | ControlAdapterDescriptor<'sql', string> | ControlExtensionDescriptor<'sql', string>>): ReadonlyArray<TypesImportSpec>;
22
- /**
23
- * Extracts operation type imports from descriptors for contract.d.ts generation.
24
- */
25
- declare function extractOperationTypeImports(descriptors: ReadonlyArray<ControlTargetDescriptor<'sql', string> | ControlAdapterDescriptor<'sql', string> | ControlExtensionDescriptor<'sql', string>>): ReadonlyArray<TypesImportSpec>;
26
- /**
27
- * Extracts extension IDs from descriptors in deterministic order:
28
- * [adapter.id, target.id, ...extensions.map(e => e.id)]
29
- * Deduplicates while preserving stable order.
30
- */
31
- declare function extractExtensionIds(adapter: ControlAdapterDescriptor<'sql', string>, target: ControlTargetDescriptor<'sql', string>, extensions: ReadonlyArray<ControlExtensionDescriptor<'sql', string>>): ReadonlyArray<string>;
32
-
33
- export { assembleOperationRegistry, extractCodecTypeImports, extractExtensionIds, extractOperationTypeImports };
@@ -1,17 +0,0 @@
1
- import {
2
- assembleOperationRegistry,
3
- convertOperationManifest,
4
- extractCodecTypeImports,
5
- extractExtensionIds,
6
- extractOperationTypeImports
7
- } from "./chunk-6P44BVZ4.js";
8
- import "./chunk-C3GKWCKA.js";
9
- import "./chunk-F252JMEU.js";
10
- export {
11
- assembleOperationRegistry,
12
- convertOperationManifest,
13
- extractCodecTypeImports,
14
- extractExtensionIds,
15
- extractOperationTypeImports
16
- };
17
- //# sourceMappingURL=test-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,275 +0,0 @@
1
- import { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
2
- import { ControlTargetDescriptor, ControlTargetInstance, MigrationOperationPolicy, MigrationPlannerSuccessResult, MigrationPlan, MigrationPlanOperation, MigrationPlannerFailureResult, MigrationPlannerConflict, ControlDriverInstance, OperationContext, MigrationRunnerExecutionChecks, MigrationRunnerSuccessValue, MigrationRunnerFailure, SchemaIssue, ControlExtensionDescriptor } from '@prisma-next/core-control-plane/types';
3
- import { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
4
- import { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
5
- import { Result } from '@prisma-next/utils/result';
6
- import { S as SqlControlFamilyInstance } from './instance-DiZi2k_2.js';
7
-
8
- /**
9
- * SQL-specific migration types.
10
- *
11
- * These types extend the canonical migration types from the framework control plane
12
- * with SQL-specific fields for execution (precheck SQL, execute SQL, etc.).
13
- */
14
-
15
- type AnyRecord = Readonly<Record<string, unknown>>;
16
- /**
17
- * A single database dependency declared by a framework component.
18
- * Uses SqlMigrationPlanOperation so we inherit the existing precheck/execute/postcheck contract.
19
- *
20
- * Database dependencies allow components (extensions, adapters) to declare what database-side
21
- * persistence structures they require (e.g., Postgres extensions, schemas, functions).
22
- * The planner emits these as migration operations, and the verifier uses the pure verification
23
- * hook to check satisfaction against the schema IR.
24
- */
25
- interface ComponentDatabaseDependency<TTargetDetails> {
26
- /** Stable identifier for the dependency (e.g. 'postgres.extension.vector') */
27
- readonly id: string;
28
- /** Human label for output (e.g. 'Enable vector extension') */
29
- readonly label: string;
30
- /**
31
- * Operations that install/ensure the dependency.
32
- * Use SqlMigrationPlanOperation so we inherit the existing precheck/execute/postcheck contract.
33
- */
34
- readonly install: readonly SqlMigrationPlanOperation<TTargetDetails>[];
35
- /**
36
- * Pure verification hook: checks whether this dependency is already installed
37
- * based on the in-memory schema IR (no DB I/O).
38
- *
39
- * This must return structured issues suitable for CLI and tree output, not just a boolean.
40
- */
41
- readonly verifyDatabaseDependencyInstalled: (schema: SqlSchemaIR) => readonly SchemaIssue[];
42
- }
43
- /**
44
- * Database dependencies declared by a framework component.
45
- */
46
- interface ComponentDatabaseDependencies<TTargetDetails> {
47
- /**
48
- * Dependencies required for db init.
49
- * Future: update dependencies can be added later (e.g. widening/destructive).
50
- */
51
- readonly init?: readonly ComponentDatabaseDependency<TTargetDetails>[];
52
- }
53
- /**
54
- * SQL-specific extension descriptor with optional database dependencies.
55
- * Extends the core ControlExtensionDescriptor with SQL-specific metadata.
56
- *
57
- * Database dependencies are attached to the descriptor (not the instance) because
58
- * they are declarative metadata that planner/verifier need without constructing instances.
59
- */
60
- interface SqlControlExtensionDescriptor<TTargetId extends string> extends ControlExtensionDescriptor<'sql', TTargetId> {
61
- /** Optional database dependencies this extension requires. */
62
- readonly databaseDependencies?: ComponentDatabaseDependencies<unknown>;
63
- }
64
- /**
65
- * A single step in a SQL migration operation (precheck, execute, or postcheck).
66
- */
67
- interface SqlMigrationPlanOperationStep {
68
- readonly description: string;
69
- readonly sql: string;
70
- readonly meta?: AnyRecord;
71
- }
72
- /**
73
- * Target details for a SQL migration operation (table, column, index, etc.).
74
- */
75
- interface SqlMigrationPlanOperationTarget<TTargetDetails> {
76
- readonly id: string;
77
- readonly details?: TTargetDetails;
78
- }
79
- /**
80
- * A single SQL migration operation with SQL-specific fields.
81
- * Extends the core MigrationPlanOperation with SQL execution details.
82
- */
83
- interface SqlMigrationPlanOperation<TTargetDetails> extends MigrationPlanOperation {
84
- /** Optional detailed explanation of what this operation does and why. */
85
- readonly summary?: string;
86
- readonly target: SqlMigrationPlanOperationTarget<TTargetDetails>;
87
- readonly precheck: readonly SqlMigrationPlanOperationStep[];
88
- readonly execute: readonly SqlMigrationPlanOperationStep[];
89
- readonly postcheck: readonly SqlMigrationPlanOperationStep[];
90
- readonly meta?: AnyRecord;
91
- }
92
- /**
93
- * Contract identity information for SQL migrations.
94
- */
95
- interface SqlMigrationPlanContractInfo {
96
- readonly coreHash: string;
97
- readonly profileHash?: string;
98
- }
99
- /**
100
- * A SQL migration plan with SQL-specific fields.
101
- * Extends the core MigrationPlan with origin tracking and metadata.
102
- */
103
- interface SqlMigrationPlan<TTargetDetails> extends MigrationPlan {
104
- /**
105
- * Origin contract identity that the plan expects the database to currently be at.
106
- * If omitted, the runner treats the origin as "no marker present" (empty database),
107
- * and will only proceed if no marker exists (or if the marker already matches destination).
108
- */
109
- readonly origin?: SqlMigrationPlanContractInfo | null;
110
- /**
111
- * Destination contract identity that the plan intends to reach.
112
- */
113
- readonly destination: SqlMigrationPlanContractInfo;
114
- readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
115
- readonly meta?: AnyRecord;
116
- }
117
- /**
118
- * Specific conflict kinds for SQL migrations.
119
- */
120
- type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedExtension' | 'extensionMissing' | 'unsupportedOperation';
121
- /**
122
- * Location information for SQL planner conflicts.
123
- */
124
- interface SqlPlannerConflictLocation {
125
- readonly table?: string;
126
- readonly column?: string;
127
- readonly index?: string;
128
- readonly constraint?: string;
129
- readonly extension?: string;
130
- }
131
- /**
132
- * A SQL-specific planner conflict with additional location information.
133
- * Extends the core MigrationPlannerConflict.
134
- */
135
- interface SqlPlannerConflict extends MigrationPlannerConflict {
136
- readonly kind: SqlPlannerConflictKind;
137
- readonly location?: SqlPlannerConflictLocation;
138
- readonly meta?: AnyRecord;
139
- }
140
- /**
141
- * Successful SQL planner result with the migration plan.
142
- */
143
- interface SqlPlannerSuccessResult<TTargetDetails> extends Omit<MigrationPlannerSuccessResult, 'plan'> {
144
- readonly kind: 'success';
145
- readonly plan: SqlMigrationPlan<TTargetDetails>;
146
- }
147
- /**
148
- * Failed SQL planner result with the list of conflicts.
149
- */
150
- interface SqlPlannerFailureResult extends Omit<MigrationPlannerFailureResult, 'conflicts'> {
151
- readonly kind: 'failure';
152
- readonly conflicts: readonly SqlPlannerConflict[];
153
- }
154
- /**
155
- * Union type for SQL planner results.
156
- */
157
- type SqlPlannerResult<TTargetDetails> = SqlPlannerSuccessResult<TTargetDetails> | SqlPlannerFailureResult;
158
- /**
159
- * Options for SQL migration planner.
160
- */
161
- interface SqlMigrationPlannerPlanOptions {
162
- readonly contract: SqlContract<SqlStorage>;
163
- readonly schema: SqlSchemaIR;
164
- readonly policy: MigrationOperationPolicy;
165
- readonly schemaName?: string;
166
- /**
167
- * Active framework components participating in this composition.
168
- * SQL targets can interpret this list to derive database dependencies.
169
- * All components must have matching familyId ('sql') and targetId.
170
- */
171
- readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
172
- }
173
- /**
174
- * SQL migration planner interface.
175
- * Extends the core MigrationPlanner with SQL-specific types.
176
- */
177
- interface SqlMigrationPlanner<TTargetDetails> {
178
- plan(options: SqlMigrationPlannerPlanOptions): SqlPlannerResult<TTargetDetails>;
179
- }
180
- /**
181
- * Callbacks for SQL migration runner execution.
182
- */
183
- interface SqlMigrationRunnerExecuteCallbacks<TTargetDetails> {
184
- onOperationStart?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
185
- onOperationComplete?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
186
- }
187
- /**
188
- * Options for SQL migration runner execution.
189
- */
190
- interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
191
- readonly plan: SqlMigrationPlan<TTargetDetails>;
192
- readonly driver: ControlDriverInstance<'sql', string>;
193
- /**
194
- * Destination contract IR.
195
- * Must correspond to `plan.destination` and is used for schema verification and marker/ledger writes.
196
- */
197
- readonly destinationContract: SqlContract<SqlStorage>;
198
- /**
199
- * Execution-time policy that defines which operation classes are allowed.
200
- * The runner validates each operation against this policy before execution.
201
- */
202
- readonly policy: MigrationOperationPolicy;
203
- readonly schemaName?: string;
204
- readonly strictVerification?: boolean;
205
- readonly callbacks?: SqlMigrationRunnerExecuteCallbacks<TTargetDetails>;
206
- readonly context?: OperationContext;
207
- /**
208
- * Execution-time checks configuration.
209
- * All checks default to `true` (enabled) when omitted.
210
- */
211
- readonly executionChecks?: MigrationRunnerExecutionChecks;
212
- /**
213
- * Active framework components participating in this composition.
214
- * SQL targets can interpret this list to derive database dependencies.
215
- * All components must have matching familyId ('sql') and targetId.
216
- */
217
- readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
218
- }
219
- /**
220
- * Error codes for SQL migration runner failures.
221
- */
222
- type SqlMigrationRunnerErrorCode = 'DESTINATION_CONTRACT_MISMATCH' | 'MARKER_ORIGIN_MISMATCH' | 'POLICY_VIOLATION' | 'PRECHECK_FAILED' | 'POSTCHECK_FAILED' | 'SCHEMA_VERIFY_FAILED' | 'EXECUTION_FAILED';
223
- /**
224
- * Detailed information about a SQL migration runner failure.
225
- * Extends the core MigrationRunnerFailure with SQL-specific error codes.
226
- */
227
- interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
228
- readonly code: SqlMigrationRunnerErrorCode;
229
- readonly meta?: AnyRecord;
230
- }
231
- /**
232
- * Success value for SQL migration runner execution.
233
- * Extends core type for type branding and potential SQL-specific extensions.
234
- */
235
- interface SqlMigrationRunnerSuccessValue extends MigrationRunnerSuccessValue {
236
- }
237
- /**
238
- * Result type for SQL migration runner execution.
239
- */
240
- type SqlMigrationRunnerResult = Result<SqlMigrationRunnerSuccessValue, SqlMigrationRunnerFailure>;
241
- /**
242
- * SQL migration runner interface.
243
- * Extends the core MigrationRunner with SQL-specific types.
244
- */
245
- interface SqlMigrationRunner<TTargetDetails> {
246
- execute(options: SqlMigrationRunnerExecuteOptions<TTargetDetails>): Promise<SqlMigrationRunnerResult>;
247
- }
248
- /**
249
- * SQL control target descriptor with migration support.
250
- * Extends the core ControlTargetDescriptor with SQL-specific migration methods.
251
- */
252
- interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails> extends ControlTargetDescriptor<'sql', TTargetId, ControlTargetInstance<'sql', TTargetId>, SqlControlFamilyInstance> {
253
- /**
254
- * Creates a SQL migration planner for this target.
255
- * Direct method for SQL-specific usage.
256
- */
257
- createPlanner(family: SqlControlFamilyInstance): SqlMigrationPlanner<TTargetDetails>;
258
- /**
259
- * Creates a SQL migration runner for this target.
260
- * Direct method for SQL-specific usage.
261
- */
262
- createRunner(family: SqlControlFamilyInstance): SqlMigrationRunner<TTargetDetails>;
263
- }
264
- /**
265
- * Options for creating a SQL migration plan.
266
- */
267
- interface CreateSqlMigrationPlanOptions<TTargetDetails> {
268
- readonly targetId: string;
269
- readonly origin?: SqlMigrationPlanContractInfo | null;
270
- readonly destination: SqlMigrationPlanContractInfo;
271
- readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
272
- readonly meta?: AnyRecord;
273
- }
274
-
275
- export type { AnyRecord as A, CreateSqlMigrationPlanOptions as C, SqlControlTargetDescriptor as S, SqlMigrationPlan as a, SqlPlannerConflict as b, SqlPlannerFailureResult as c, SqlPlannerSuccessResult as d, SqlMigrationRunnerErrorCode as e, SqlMigrationRunnerFailure as f, SqlMigrationRunnerSuccessValue as g, ComponentDatabaseDependencies as h, ComponentDatabaseDependency as i, SqlControlExtensionDescriptor as j, SqlMigrationPlanContractInfo as k, SqlMigrationPlanner as l, SqlMigrationPlannerPlanOptions as m, SqlMigrationPlanOperation as n, SqlMigrationPlanOperationStep as o, SqlMigrationPlanOperationTarget as p, SqlMigrationRunner as q, SqlMigrationRunnerExecuteCallbacks as r, SqlMigrationRunnerExecuteOptions as s, SqlMigrationRunnerResult as t, SqlPlannerConflictKind as u, SqlPlannerConflictLocation as v, SqlPlannerResult as w };
@@ -1,11 +0,0 @@
1
- import {
2
- parseContractMarkerRow,
3
- readMarker,
4
- readMarkerSql
5
- } from "./chunk-C3GKWCKA.js";
6
- export {
7
- parseContractMarkerRow,
8
- readMarker,
9
- readMarkerSql
10
- };
11
- //# sourceMappingURL=verify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}