@prisma-next/family-sql 0.3.0-dev.2 → 0.3.0-dev.21
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/dist/{exports/chunk-6P44BVZ4.js → chunk-F27CR6XZ.js} +12 -3
- package/dist/chunk-F27CR6XZ.js.map +1 -0
- package/dist/{exports/chunk-C3GKWCKA.js → chunk-SU7LN2UH.js} +1 -1
- package/dist/chunk-SU7LN2UH.js.map +1 -0
- package/dist/{exports/chunk-F252JMEU.js → chunk-XH2Y5NTD.js} +59 -116
- package/dist/chunk-XH2Y5NTD.js.map +1 -0
- package/dist/core/assembly.d.ts +25 -0
- package/dist/core/assembly.d.ts.map +1 -0
- package/dist/core/control-adapter.d.ts +42 -0
- package/dist/core/control-adapter.d.ts.map +1 -0
- package/dist/core/descriptor.d.ts +24 -0
- package/dist/core/descriptor.d.ts.map +1 -0
- package/dist/{exports/instance-DiZi2k_2.d.ts → core/instance.d.ts} +28 -15
- package/dist/core/instance.d.ts.map +1 -0
- package/dist/core/migrations/plan-helpers.d.ts +20 -0
- package/dist/core/migrations/plan-helpers.d.ts.map +1 -0
- package/dist/core/migrations/policies.d.ts +6 -0
- package/dist/core/migrations/policies.d.ts.map +1 -0
- package/dist/{exports/types-Bh7ftf0Q.d.ts → core/migrations/types.d.ts} +41 -36
- package/dist/core/migrations/types.d.ts.map +1 -0
- package/dist/core/runtime-descriptor.d.ts +19 -0
- package/dist/core/runtime-descriptor.d.ts.map +1 -0
- package/dist/core/runtime-instance.d.ts +54 -0
- package/dist/core/runtime-instance.d.ts.map +1 -0
- package/dist/core/schema-verify/verify-helpers.d.ts +96 -0
- package/dist/core/schema-verify/verify-helpers.d.ts.map +1 -0
- package/dist/core/schema-verify/verify-sql-schema.d.ts +45 -0
- package/dist/core/schema-verify/verify-sql-schema.d.ts.map +1 -0
- package/dist/core/verify.d.ts +39 -0
- package/dist/core/verify.d.ts.map +1 -0
- package/dist/exports/control-adapter.d.ts +2 -44
- package/dist/exports/control-adapter.d.ts.map +1 -0
- package/dist/exports/control.d.ts +8 -160
- package/dist/exports/control.d.ts.map +1 -0
- package/dist/exports/control.js +7 -7
- package/dist/exports/control.js.map +1 -1
- package/dist/exports/runtime.d.ts +3 -61
- package/dist/exports/runtime.d.ts.map +1 -0
- package/dist/exports/schema-verify.d.ts +8 -72
- package/dist/exports/schema-verify.d.ts.map +1 -0
- package/dist/exports/schema-verify.js +5 -1
- package/dist/exports/test-utils.d.ts +5 -31
- package/dist/exports/test-utils.d.ts.map +1 -0
- package/dist/exports/test-utils.js +3 -3
- package/dist/exports/verify.d.ts +2 -28
- package/dist/exports/verify.d.ts.map +1 -0
- package/dist/exports/verify.js +1 -1
- package/package.json +24 -25
- package/src/core/assembly.ts +117 -0
- package/src/core/control-adapter.ts +52 -0
- package/src/core/descriptor.ts +33 -0
- package/src/core/instance.ts +903 -0
- package/src/core/migrations/plan-helpers.ts +164 -0
- package/src/core/migrations/policies.ts +8 -0
- package/src/core/migrations/types.ts +380 -0
- package/src/core/runtime-descriptor.ts +45 -0
- package/src/core/runtime-instance.ts +144 -0
- package/src/core/schema-verify/verify-helpers.ts +532 -0
- package/src/core/schema-verify/verify-sql-schema.ts +588 -0
- package/src/core/verify.ts +177 -0
- package/src/exports/control-adapter.ts +1 -0
- package/src/exports/control.ts +56 -0
- package/src/exports/runtime.ts +7 -0
- package/src/exports/schema-verify.ts +16 -0
- package/src/exports/test-utils.ts +11 -0
- package/src/exports/verify.ts +1 -0
- package/dist/exports/chunk-6P44BVZ4.js.map +0 -1
- package/dist/exports/chunk-C3GKWCKA.js.map +0 -1
- package/dist/exports/chunk-F252JMEU.js.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure verification helper functions for SQL schema verification.
|
|
3
|
+
* These functions verify schema IR against contract requirements.
|
|
4
|
+
*/
|
|
5
|
+
import type { SchemaIssue, SchemaVerificationNode } from '@prisma-next/core-control-plane/types';
|
|
6
|
+
import type { ForeignKey, Index, PrimaryKey, UniqueConstraint } from '@prisma-next/sql-contract/types';
|
|
7
|
+
import type { SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from '@prisma-next/sql-schema-ir/types';
|
|
8
|
+
import type { ComponentDatabaseDependency } from '../migrations/types';
|
|
9
|
+
/**
|
|
10
|
+
* Compares two arrays of strings for equality (order-sensitive).
|
|
11
|
+
*/
|
|
12
|
+
export declare function arraysEqual(a: readonly string[], b: readonly string[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if a unique constraint requirement is satisfied by the given columns.
|
|
15
|
+
*
|
|
16
|
+
* Semantic satisfaction: a unique constraint requirement can be satisfied by:
|
|
17
|
+
* - A unique constraint with the same columns, OR
|
|
18
|
+
* - A unique index with the same columns
|
|
19
|
+
*
|
|
20
|
+
* @param uniques - The unique constraints in the schema table
|
|
21
|
+
* @param indexes - The indexes in the schema table
|
|
22
|
+
* @param columns - The columns required by the unique constraint
|
|
23
|
+
* @returns true if the requirement is satisfied
|
|
24
|
+
*/
|
|
25
|
+
export declare function isUniqueConstraintSatisfied(uniques: readonly SqlUniqueIR[], indexes: readonly SqlIndexIR[], columns: readonly string[]): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if an index requirement is satisfied by the given columns.
|
|
28
|
+
*
|
|
29
|
+
* Semantic satisfaction: a non-unique index requirement can be satisfied by:
|
|
30
|
+
* - Any index (unique or non-unique) with the same columns, OR
|
|
31
|
+
* - A unique constraint with the same columns (stronger satisfies weaker)
|
|
32
|
+
*
|
|
33
|
+
* @param indexes - The indexes in the schema table
|
|
34
|
+
* @param uniques - The unique constraints in the schema table
|
|
35
|
+
* @param columns - The columns required by the index
|
|
36
|
+
* @returns true if the requirement is satisfied
|
|
37
|
+
*/
|
|
38
|
+
export declare function isIndexSatisfied(indexes: readonly SqlIndexIR[], uniques: readonly SqlUniqueIR[], columns: readonly string[]): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Verifies primary key matches between contract and schema.
|
|
41
|
+
* Returns 'pass' or 'fail'.
|
|
42
|
+
*
|
|
43
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
44
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
45
|
+
*/
|
|
46
|
+
export declare function verifyPrimaryKey(contractPK: PrimaryKey, schemaPK: PrimaryKey | undefined, tableName: string, issues: SchemaIssue[]): 'pass' | 'fail';
|
|
47
|
+
/**
|
|
48
|
+
* Verifies foreign keys match between contract and schema.
|
|
49
|
+
* Returns verification nodes for the tree.
|
|
50
|
+
*
|
|
51
|
+
* Uses semantic satisfaction: identity is based on (table + columns + referenced table + referenced columns).
|
|
52
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
53
|
+
*/
|
|
54
|
+
export declare function verifyForeignKeys(contractFKs: readonly ForeignKey[], schemaFKs: readonly SqlForeignKeyIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
55
|
+
/**
|
|
56
|
+
* Verifies unique constraints match between contract and schema.
|
|
57
|
+
* Returns verification nodes for the tree.
|
|
58
|
+
*
|
|
59
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
60
|
+
* A unique constraint requirement can be satisfied by either:
|
|
61
|
+
* - A unique constraint with the same columns, or
|
|
62
|
+
* - A unique index with the same columns
|
|
63
|
+
*
|
|
64
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
65
|
+
*/
|
|
66
|
+
export declare function verifyUniqueConstraints(contractUniques: readonly UniqueConstraint[], schemaUniques: readonly SqlUniqueIR[], schemaIndexes: readonly SqlIndexIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
67
|
+
/**
|
|
68
|
+
* Verifies indexes match between contract and schema.
|
|
69
|
+
* Returns verification nodes for the tree.
|
|
70
|
+
*
|
|
71
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
72
|
+
* A non-unique index requirement can be satisfied by either:
|
|
73
|
+
* - A non-unique index with the same columns, or
|
|
74
|
+
* - A unique index with the same columns (stronger satisfies weaker)
|
|
75
|
+
*
|
|
76
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
77
|
+
*/
|
|
78
|
+
export declare function verifyIndexes(contractIndexes: readonly Index[], schemaIndexes: readonly SqlIndexIR[], schemaUniques: readonly SqlUniqueIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
79
|
+
/**
|
|
80
|
+
* Verifies database dependencies are installed using component-owned verification hooks.
|
|
81
|
+
* Each dependency provides a pure verifyDatabaseDependencyInstalled function that checks
|
|
82
|
+
* whether the dependency is satisfied based on the in-memory schema IR (no DB I/O).
|
|
83
|
+
*
|
|
84
|
+
* Returns verification nodes for the tree.
|
|
85
|
+
*/
|
|
86
|
+
export declare function verifyDatabaseDependencies(dependencies: ReadonlyArray<ComponentDatabaseDependency<unknown>>, schema: SqlSchemaIR, issues: SchemaIssue[]): SchemaVerificationNode[];
|
|
87
|
+
/**
|
|
88
|
+
* Computes counts of pass/warn/fail nodes by traversing the tree.
|
|
89
|
+
*/
|
|
90
|
+
export declare function computeCounts(node: SchemaVerificationNode): {
|
|
91
|
+
pass: number;
|
|
92
|
+
warn: number;
|
|
93
|
+
fail: number;
|
|
94
|
+
totalNodes: number;
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=verify-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-helpers.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;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jB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,OAAO,GACd,sBAAsB,EAAE,CAiF1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,eAAe,EAAE,SAAS,KAAK,EAAE,EACjC,aAAa,EAAE,SAAS,UAAU,EAAE,EACpC,aAAa,EAAE,SAAS,WAAW,EAAE,EACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,OAAO,GACd,sBAAsB,EAAE,CAsF1B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,aAAa,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,EACjE,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EAAE,GACpB,sBAAsB,EAAE,CAwC1B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,sBAAsB,GAAG;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CA6BA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure SQL schema verification function.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a pure function that verifies a SqlSchemaIR against
|
|
5
|
+
* a SqlContract without requiring a database connection. It can be reused
|
|
6
|
+
* by migration planners and other tools that need to compare schema states.
|
|
7
|
+
*/
|
|
8
|
+
import type { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
|
|
9
|
+
import type { OperationContext, VerifyDatabaseSchemaResult } from '@prisma-next/core-control-plane/types';
|
|
10
|
+
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
11
|
+
import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
|
|
12
|
+
/**
|
|
13
|
+
* Options for the pure schema verification function.
|
|
14
|
+
*/
|
|
15
|
+
export interface VerifySqlSchemaOptions {
|
|
16
|
+
/** The validated SQL contract to verify against */
|
|
17
|
+
readonly contract: SqlContract<SqlStorage>;
|
|
18
|
+
/** The schema IR from introspection (or another source) */
|
|
19
|
+
readonly schema: SqlSchemaIR;
|
|
20
|
+
/** Whether to run in strict mode (detects extra tables/columns) */
|
|
21
|
+
readonly strict: boolean;
|
|
22
|
+
/** Optional operation context for metadata */
|
|
23
|
+
readonly context?: OperationContext;
|
|
24
|
+
/** Type metadata registry for codec consistency warnings */
|
|
25
|
+
readonly typeMetadataRegistry: ReadonlyMap<string, {
|
|
26
|
+
nativeType?: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Active framework components participating in this composition.
|
|
30
|
+
* All components must have matching familyId ('sql') and targetId.
|
|
31
|
+
*/
|
|
32
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Verifies that a SqlSchemaIR matches a SqlContract.
|
|
36
|
+
*
|
|
37
|
+
* This is a pure function that does NOT perform any database I/O.
|
|
38
|
+
* It takes an already-introspected schema IR and compares it against
|
|
39
|
+
* the contract requirements.
|
|
40
|
+
*
|
|
41
|
+
* @param options - Verification options
|
|
42
|
+
* @returns VerifyDatabaseSchemaResult with verification tree and issues
|
|
43
|
+
*/
|
|
44
|
+
export declare function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult;
|
|
45
|
+
//# sourceMappingURL=verify-sql-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-sql-schema.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-sql-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAGhB,0BAA0B,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAYpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,0BAA0B,CAye3F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
2
|
+
import type { ControlAdapterDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlTargetDescriptor } from '@prisma-next/core-control-plane/types';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a contract marker row from database query result.
|
|
5
|
+
* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseContractMarkerRow(row: unknown): ContractMarkerRecord;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the SQL statement to read the contract marker.
|
|
10
|
+
* This is a migration-plane helper (no runtime imports).
|
|
11
|
+
* @internal - Used internally by readMarker(). Prefer readMarker() for Control Plane usage.
|
|
12
|
+
*/
|
|
13
|
+
export declare function readMarkerSql(): {
|
|
14
|
+
readonly sql: string;
|
|
15
|
+
readonly params: readonly unknown[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reads the contract marker from the database using the provided driver.
|
|
19
|
+
* Returns the parsed marker record or null if no marker is found.
|
|
20
|
+
* This abstracts SQL-specific details from the Control Plane.
|
|
21
|
+
*
|
|
22
|
+
* @param driver - ControlDriverInstance instance for executing queries
|
|
23
|
+
* @returns Promise resolving to ContractMarkerRecord or null if marker not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function readMarker(driver: ControlDriverInstance<'sql', string>): Promise<ContractMarkerRecord | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Collects supported codec type IDs from adapter and extension manifests.
|
|
28
|
+
* Returns a sorted, unique array of type IDs that are declared in the manifests.
|
|
29
|
+
* This enables coverage checks by comparing contract column types against supported types.
|
|
30
|
+
*
|
|
31
|
+
* Note: This extracts type IDs from manifest type imports, not from runtime codec registries.
|
|
32
|
+
* The manifests declare which codec types are available, but the actual type IDs
|
|
33
|
+
* are defined in the codec-types TypeScript modules that are imported.
|
|
34
|
+
*
|
|
35
|
+
* For MVP, we return an empty array since extracting type IDs from TypeScript modules
|
|
36
|
+
* would require runtime evaluation or static analysis. This can be enhanced later.
|
|
37
|
+
*/
|
|
38
|
+
export declare function collectSupportedCodecTypeIds<TFamilyId extends string, TTargetId extends string>(descriptors: ReadonlyArray<ControlTargetDescriptor<TFamilyId, TTargetId> | ControlAdapterDescriptor<TFamilyId, TTargetId> | ControlExtensionDescriptor<TFamilyId, TTargetId>>): readonly string[];
|
|
39
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/core/verify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAuC/C;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAgCzE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,CAc7F;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAoCtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM,EAC7F,WAAW,EAAE,aAAa,CACtB,uBAAuB,CAAC,SAAS,EAAE,SAAS,CAAC,GAC7C,wBAAwB,CAAC,SAAS,EAAE,SAAS,CAAC,GAC9C,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CACnD,GACA,SAAS,MAAM,EAAE,CAMnB"}
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* SQL control adapter interface for control-plane operations.
|
|
6
|
-
* Implemented by target-specific adapters (e.g., Postgres, MySQL).
|
|
7
|
-
*
|
|
8
|
-
* @template TTarget - The target ID (e.g., 'postgres', 'mysql')
|
|
9
|
-
*/
|
|
10
|
-
interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget> {
|
|
11
|
-
/**
|
|
12
|
-
* The target ID this adapter implements.
|
|
13
|
-
* Used for type tracking and runtime validation.
|
|
14
|
-
* @deprecated Use targetId from ControlAdapterInstance instead
|
|
15
|
-
*/
|
|
16
|
-
readonly target: TTarget;
|
|
17
|
-
/**
|
|
18
|
-
* Introspects a database schema and returns a raw SqlSchemaIR.
|
|
19
|
-
*
|
|
20
|
-
* This is a pure schema discovery operation that queries the database catalog
|
|
21
|
-
* and returns the schema structure without type mapping or contract enrichment.
|
|
22
|
-
* Type mapping and enrichment are handled separately by enrichment helpers.
|
|
23
|
-
*
|
|
24
|
-
* @param driver - ControlDriverInstance instance for executing queries (target-specific)
|
|
25
|
-
* @param contractIR - Optional contract IR for contract-guided introspection (filtering, optimization)
|
|
26
|
-
* @param schema - Schema name to introspect (defaults to 'public')
|
|
27
|
-
* @returns Promise resolving to SqlSchemaIR representing the live database schema
|
|
28
|
-
*/
|
|
29
|
-
introspect(driver: ControlDriverInstance<'sql', TTarget>, contractIR?: unknown, schema?: string): Promise<SqlSchemaIR>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* SQL control adapter descriptor interface.
|
|
33
|
-
* Provides a factory method to create control adapter instances.
|
|
34
|
-
*
|
|
35
|
-
* @template TTarget - The target ID (e.g., 'postgres', 'mysql')
|
|
36
|
-
*/
|
|
37
|
-
interface SqlControlAdapterDescriptor<TTarget extends string = string> {
|
|
38
|
-
/**
|
|
39
|
-
* Creates a SQL control adapter instance for control-plane operations.
|
|
40
|
-
*/
|
|
41
|
-
create(): SqlControlAdapter<TTarget>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type { SqlControlAdapter, SqlControlAdapterDescriptor };
|
|
1
|
+
export type { SqlControlAdapter, SqlControlAdapterDescriptor } from '../core/control-adapter';
|
|
2
|
+
//# sourceMappingURL=control-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-adapter.d.ts","sourceRoot":"","sources":["../../src/exports/control-adapter.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,165 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
import { S as SqlControlTargetDescriptor, C as CreateSqlMigrationPlanOptions, a as SqlMigrationPlan, b as SqlPlannerConflict, c as SqlPlannerFailureResult, d as SqlPlannerSuccessResult, e as SqlMigrationRunnerErrorCode, A as AnyRecord, f as SqlMigrationRunnerFailure, g as SqlMigrationRunnerSuccessValue } from './types-Bh7ftf0Q.js';
|
|
8
|
-
export { h as ComponentDatabaseDependencies, i as ComponentDatabaseDependency, j as SqlControlExtensionDescriptor, k as SqlMigrationPlanContractInfo, n as SqlMigrationPlanOperation, o as SqlMigrationPlanOperationStep, p as SqlMigrationPlanOperationTarget, l as SqlMigrationPlanner, m as SqlMigrationPlannerPlanOptions, q as SqlMigrationRunner, r as SqlMigrationRunnerExecuteCallbacks, s as SqlMigrationRunnerExecuteOptions, t as SqlMigrationRunnerResult, u as SqlPlannerConflictKind, v as SqlPlannerConflictLocation, w as SqlPlannerResult } from './types-Bh7ftf0Q.js';
|
|
9
|
-
import { NotOk, Ok } from '@prisma-next/utils/result';
|
|
10
|
-
import '@prisma-next/sql-schema-ir/types';
|
|
11
|
-
import '@prisma-next/contract/framework-components';
|
|
12
|
-
import '@prisma-next/contract/ir';
|
|
13
|
-
import '@prisma-next/contract/pack-manifest-types';
|
|
14
|
-
import '@prisma-next/contract/types';
|
|
15
|
-
import '@prisma-next/core-control-plane/schema-view';
|
|
16
|
-
import '@prisma-next/sql-operations';
|
|
17
|
-
import '@prisma-next/sql-contract/types';
|
|
18
|
-
|
|
19
|
-
type StorageColumn = {
|
|
20
|
-
readonly nativeType: string;
|
|
21
|
-
readonly codecId: string;
|
|
22
|
-
readonly nullable: boolean;
|
|
23
|
-
};
|
|
24
|
-
type PrimaryKey = {
|
|
25
|
-
readonly columns: readonly string[];
|
|
26
|
-
readonly name?: string;
|
|
27
|
-
};
|
|
28
|
-
type UniqueConstraint = {
|
|
29
|
-
readonly columns: readonly string[];
|
|
30
|
-
readonly name?: string;
|
|
31
|
-
};
|
|
32
|
-
type Index = {
|
|
33
|
-
readonly columns: readonly string[];
|
|
34
|
-
readonly name?: string;
|
|
35
|
-
};
|
|
36
|
-
type ForeignKeyReferences = {
|
|
37
|
-
readonly table: string;
|
|
38
|
-
readonly columns: readonly string[];
|
|
39
|
-
};
|
|
40
|
-
type ForeignKey = {
|
|
41
|
-
readonly columns: readonly string[];
|
|
42
|
-
readonly references: ForeignKeyReferences;
|
|
43
|
-
readonly name?: string;
|
|
44
|
-
};
|
|
45
|
-
type StorageTable = {
|
|
46
|
-
readonly columns: Record<string, StorageColumn>;
|
|
47
|
-
readonly primaryKey?: PrimaryKey;
|
|
48
|
-
readonly uniques: ReadonlyArray<UniqueConstraint>;
|
|
49
|
-
readonly indexes: ReadonlyArray<Index>;
|
|
50
|
-
readonly foreignKeys: ReadonlyArray<ForeignKey>;
|
|
51
|
-
};
|
|
52
|
-
type SqlStorage = {
|
|
53
|
-
readonly tables: Record<string, StorageTable>;
|
|
54
|
-
};
|
|
55
|
-
type ModelField = {
|
|
56
|
-
readonly column: string;
|
|
57
|
-
};
|
|
58
|
-
type ModelStorage = {
|
|
59
|
-
readonly table: string;
|
|
60
|
-
};
|
|
61
|
-
type ModelDefinition = {
|
|
62
|
-
readonly storage: ModelStorage;
|
|
63
|
-
readonly fields: Record<string, ModelField>;
|
|
64
|
-
readonly relations: Record<string, unknown>;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* ContractIR types and factories for building contract intermediate representation.
|
|
69
|
-
* ContractIR is family-agnostic and used by authoring, emitter, and no-emit runtime.
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* ContractIR represents the intermediate representation of a contract.
|
|
73
|
-
* It is family-agnostic and contains generic storage, models, and relations.
|
|
74
|
-
* Note: coreHash and profileHash are computed by the emitter, not part of the IR.
|
|
75
|
-
*/
|
|
76
|
-
interface ContractIR<TStorage extends Record<string, unknown> = Record<string, unknown>, TModels extends Record<string, unknown> = Record<string, unknown>, TRelations extends Record<string, unknown> = Record<string, unknown>> {
|
|
77
|
-
readonly schemaVersion: string;
|
|
78
|
-
readonly targetFamily: string;
|
|
79
|
-
readonly target: string;
|
|
80
|
-
readonly models: TModels;
|
|
81
|
-
readonly relations: TRelations;
|
|
82
|
-
readonly storage: TStorage;
|
|
83
|
-
readonly extensionPacks: Record<string, unknown>;
|
|
84
|
-
readonly capabilities: Record<string, Record<string, boolean>>;
|
|
85
|
-
readonly meta: Record<string, unknown>;
|
|
86
|
-
readonly sources: Record<string, unknown>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Specifies how to import TypeScript types from a package.
|
|
91
|
-
* Used in extension pack manifests to declare codec and operation type imports.
|
|
92
|
-
*/
|
|
93
|
-
interface TypesImportSpec {
|
|
94
|
-
readonly package: string;
|
|
95
|
-
readonly named: string;
|
|
96
|
-
readonly alias: string;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Validation context passed to TargetFamilyHook.validateTypes().
|
|
100
|
-
* Contains pre-assembled operation registry, type imports, and extension IDs.
|
|
101
|
-
*/
|
|
102
|
-
interface ValidationContext {
|
|
103
|
-
readonly operationRegistry?: OperationRegistry;
|
|
104
|
-
readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
105
|
-
readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
106
|
-
readonly extensionIds?: ReadonlyArray<string>;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* SQL family descriptor implementation.
|
|
111
|
-
* Provides the SQL family hook and factory method.
|
|
112
|
-
*/
|
|
113
|
-
declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance> {
|
|
114
|
-
readonly kind: "family";
|
|
115
|
-
readonly id = "sql";
|
|
116
|
-
readonly familyId: "sql";
|
|
117
|
-
readonly version = "0.0.1";
|
|
118
|
-
readonly hook: {
|
|
119
|
-
readonly id: "sql";
|
|
120
|
-
readonly validateTypes: (ir: ContractIR, _ctx: ValidationContext) => void;
|
|
121
|
-
readonly validateStructure: (ir: ContractIR) => void;
|
|
122
|
-
readonly generateContractTypes: (ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>) => string;
|
|
123
|
-
readonly generateStorageType: (storage: SqlStorage) => string;
|
|
124
|
-
readonly generateModelsType: (models: Record<string, ModelDefinition> | undefined, storage: SqlStorage) => string;
|
|
125
|
-
readonly generateRelationsType: (relations: Record<string, unknown> | undefined) => string;
|
|
126
|
-
readonly generateMappingsType: (models: Record<string, ModelDefinition> | undefined, storage: SqlStorage, codecTypes: string, operationTypes: string) => string;
|
|
127
|
-
};
|
|
128
|
-
create<TTargetId extends string, TTargetDetails>(options: {
|
|
129
|
-
readonly target: SqlControlTargetDescriptor<TTargetId, TTargetDetails>;
|
|
130
|
-
readonly adapter: ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>>;
|
|
131
|
-
readonly driver: ControlDriverDescriptor<'sql', TTargetId>;
|
|
132
|
-
readonly extensionPacks: readonly ControlExtensionDescriptor<'sql', TTargetId>[];
|
|
133
|
-
}): SqlControlFamilyInstance;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
declare function createMigrationPlan<TTargetDetails>(options: CreateSqlMigrationPlanOptions<TTargetDetails>): SqlMigrationPlan<TTargetDetails>;
|
|
137
|
-
declare function plannerSuccess<TTargetDetails>(plan: SqlMigrationPlan<TTargetDetails>): SqlPlannerSuccessResult<TTargetDetails>;
|
|
138
|
-
declare function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult;
|
|
139
|
-
/**
|
|
140
|
-
* Creates a successful migration runner result.
|
|
141
|
-
*/
|
|
142
|
-
declare function runnerSuccess(value: {
|
|
143
|
-
operationsPlanned: number;
|
|
144
|
-
operationsExecuted: number;
|
|
145
|
-
}): Ok<SqlMigrationRunnerSuccessValue>;
|
|
146
|
-
/**
|
|
147
|
-
* Creates a failed migration runner result.
|
|
148
|
-
*/
|
|
149
|
-
declare function runnerFailure(code: SqlMigrationRunnerErrorCode, summary: string, options?: {
|
|
150
|
-
why?: string;
|
|
151
|
-
meta?: AnyRecord;
|
|
152
|
-
}): NotOk<SqlMigrationRunnerFailure>;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Policy used by `db init`: additive-only operations, no widening/destructive steps.
|
|
156
|
-
*/
|
|
157
|
-
declare const INIT_ADDITIVE_POLICY: MigrationOperationPolicy;
|
|
158
|
-
|
|
1
|
+
import { SqlFamilyDescriptor } from '../core/descriptor';
|
|
2
|
+
export type { MigrationOperationClass, MigrationOperationPolicy, MigrationPlan, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationPlanOperation, TargetMigrationsCapability, } from '@prisma-next/core-control-plane/types';
|
|
3
|
+
export type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/instance';
|
|
4
|
+
export { createMigrationPlan, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, } from '../core/migrations/plan-helpers';
|
|
5
|
+
export { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';
|
|
6
|
+
export type { ComponentDatabaseDependencies, ComponentDatabaseDependency, CreateSqlMigrationPlanOptions, SqlControlExtensionDescriptor, SqlControlTargetDescriptor, SqlMigrationPlan, SqlMigrationPlanContractInfo, SqlMigrationPlanner, SqlMigrationPlannerPlanOptions, SqlMigrationPlanOperation, SqlMigrationPlanOperationStep, SqlMigrationPlanOperationTarget, SqlMigrationRunner, SqlMigrationRunnerErrorCode, SqlMigrationRunnerExecuteCallbacks, SqlMigrationRunnerExecuteOptions, SqlMigrationRunnerFailure, SqlMigrationRunnerResult, SqlMigrationRunnerSuccessValue, SqlPlannerConflict, SqlPlannerConflictKind, SqlPlannerConflictLocation, SqlPlannerFailureResult, SqlPlannerResult, SqlPlannerSuccessResult, } from '../core/migrations/types';
|
|
159
7
|
/**
|
|
160
8
|
* SQL family descriptor for control plane (CLI/config).
|
|
161
9
|
* Provides the SQL family hook and conversion helpers.
|
|
162
10
|
*/
|
|
163
11
|
declare const _default: SqlFamilyDescriptor;
|
|
164
|
-
|
|
165
|
-
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/exports/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,YAAY,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,gBAAgB,EAChB,4BAA4B,EAC5B,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,EAC/B,kBAAkB,EAClB,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAElC;;;GAGG;;AACH,wBAAyC"}
|
package/dist/exports/control.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSqlFamilyInstance
|
|
3
|
-
} from "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
3
|
+
} from "../chunk-F27CR6XZ.js";
|
|
4
|
+
import "../chunk-SU7LN2UH.js";
|
|
5
|
+
import "../chunk-XH2Y5NTD.js";
|
|
6
6
|
|
|
7
7
|
// src/core/descriptor.ts
|
|
8
8
|
import { sqlTargetFamilyHook } from "@prisma-next/sql-contract-emitter";
|
|
@@ -12,11 +12,11 @@ var SqlFamilyDescriptor = class {
|
|
|
12
12
|
familyId = "sql";
|
|
13
13
|
version = "0.0.1";
|
|
14
14
|
hook = sqlTargetFamilyHook;
|
|
15
|
-
create(
|
|
15
|
+
create(stack) {
|
|
16
16
|
return createSqlFamilyInstance({
|
|
17
|
-
target:
|
|
18
|
-
adapter:
|
|
19
|
-
extensionPacks:
|
|
17
|
+
target: stack.target,
|
|
18
|
+
adapter: stack.adapter,
|
|
19
|
+
extensionPacks: stack.extensionPacks
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/descriptor.ts","../../src/core/migrations/plan-helpers.ts","../../src/core/migrations/policies.ts","../../src/exports/control.ts"],"sourcesContent":["import type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n} from '@prisma-next/core-control-plane/types';\nimport { sqlTargetFamilyHook } from '@prisma-next/sql-contract-emitter';\nimport type { SqlControlAdapter } from './control-adapter';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './instance';\nimport type { SqlControlTargetDescriptor } from './migrations/types';\n\n/**\n * SQL family descriptor implementation.\n * Provides the SQL family hook and factory method.\n */\nexport class SqlFamilyDescriptor\n implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly version = '0.0.1';\n readonly hook = sqlTargetFamilyHook;\n\n create<TTargetId extends string, TTargetDetails>(options: {\n readonly target: SqlControlTargetDescriptor<TTargetId, TTargetDetails>;\n readonly adapter: ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>>;\n readonly driver: ControlDriverDescriptor<'sql', TTargetId>;\n readonly extensionPacks: readonly ControlExtensionDescriptor<'sql', TTargetId>[];\n }): SqlControlFamilyInstance {\n return createSqlFamilyInstance({\n target: options.target,\n adapter: options.adapter,\n extensionPacks: options.extensionPacks,\n });\n }\n}\n","import type { NotOk, Ok } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type {\n AnyRecord,\n CreateSqlMigrationPlanOptions,\n SqlMigrationPlan,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerFailureResult,\n SqlPlannerSuccessResult,\n} from './types';\n\nconst readOnlyEmptyObject: Record<string, never> = Object.freeze({});\n\nfunction cloneRecord<T extends AnyRecord>(value: T): T {\n if (value === readOnlyEmptyObject) {\n return value;\n }\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeSteps(\n steps: readonly SqlMigrationPlanOperationStep[],\n): readonly SqlMigrationPlanOperationStep[] {\n if (steps.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(\n steps.map((step) =>\n Object.freeze({\n description: step.description,\n sql: step.sql,\n ...(step.meta ? { meta: cloneRecord(step.meta) } : {}),\n }),\n ),\n );\n}\n\nfunction freezeDetailsValue<T>(value: T): T {\n // Primitives and null/undefined are already immutable, return as-is\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n return value;\n }\n // Arrays: shallow clone and freeze\n if (Array.isArray(value)) {\n return Object.freeze([...value]) as T;\n }\n // Objects: shallow clone and freeze (matching cloneRecord pattern)\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeTargetDetails<TTargetDetails>(\n target: SqlMigrationPlanOperationTarget<TTargetDetails>,\n): SqlMigrationPlanOperationTarget<TTargetDetails> {\n return Object.freeze({\n id: target.id,\n ...(target.details !== undefined ? { details: freezeDetailsValue(target.details) } : {}),\n });\n}\n\nfunction freezeOperation<TTargetDetails>(\n operation: SqlMigrationPlanOperation<TTargetDetails>,\n): SqlMigrationPlanOperation<TTargetDetails> {\n return Object.freeze({\n id: operation.id,\n label: operation.label,\n ...(operation.summary ? { summary: operation.summary } : {}),\n operationClass: operation.operationClass,\n target: freezeTargetDetails(operation.target),\n precheck: freezeSteps(operation.precheck),\n execute: freezeSteps(operation.execute),\n postcheck: freezeSteps(operation.postcheck),\n ...(operation.meta ? { meta: cloneRecord(operation.meta) } : {}),\n });\n}\n\nfunction freezeOperations<TTargetDetails>(\n operations: readonly SqlMigrationPlanOperation<TTargetDetails>[],\n): readonly SqlMigrationPlanOperation<TTargetDetails>[] {\n if (operations.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\n\nexport function createMigrationPlan<TTargetDetails>(\n options: CreateSqlMigrationPlanOptions<TTargetDetails>,\n): SqlMigrationPlan<TTargetDetails> {\n return Object.freeze({\n targetId: options.targetId,\n ...(options.origin !== undefined\n ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null }\n : {}),\n destination: Object.freeze({ ...options.destination }),\n operations: freezeOperations(options.operations),\n ...(options.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n}\n\nexport function plannerSuccess<TTargetDetails>(\n plan: SqlMigrationPlan<TTargetDetails>,\n): SqlPlannerSuccessResult<TTargetDetails> {\n return Object.freeze({\n kind: 'success',\n plan,\n });\n}\n\nexport function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult {\n return Object.freeze({\n kind: 'failure' as const,\n conflicts: Object.freeze(\n conflicts.map((conflict) =>\n Object.freeze({\n kind: conflict.kind,\n summary: conflict.summary,\n ...(conflict.why ? { why: conflict.why } : {}),\n ...(conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {}),\n ...(conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}),\n }),\n ),\n ),\n });\n}\n\n/**\n * Creates a successful migration runner result.\n */\nexport function runnerSuccess(value: {\n operationsPlanned: number;\n operationsExecuted: number;\n}): Ok<SqlMigrationRunnerSuccessValue> {\n return ok(\n Object.freeze({\n operationsPlanned: value.operationsPlanned,\n operationsExecuted: value.operationsExecuted,\n }),\n );\n}\n\n/**\n * Creates a failed migration runner result.\n */\nexport function runnerFailure(\n code: SqlMigrationRunnerErrorCode,\n summary: string,\n options?: { why?: string; meta?: AnyRecord },\n): NotOk<SqlMigrationRunnerFailure> {\n const failure: SqlMigrationRunnerFailure = Object.freeze({\n code,\n summary,\n ...(options?.why ? { why: options.why } : {}),\n ...(options?.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n return notOk(failure);\n}\n","import type { MigrationOperationPolicy } from '@prisma-next/core-control-plane/types';\n\n/**\n * Policy used by `db init`: additive-only operations, no widening/destructive steps.\n */\nexport const INIT_ADDITIVE_POLICY: MigrationOperationPolicy = Object.freeze({\n allowedOperationClasses: Object.freeze(['additive'] as const),\n});\n","import { SqlFamilyDescriptor } from '../core/descriptor';\n\n// Re-export core types from canonical source\nexport type {\n MigrationOperationClass,\n MigrationOperationPolicy,\n MigrationPlan,\n MigrationPlanner,\n MigrationPlannerConflict,\n MigrationPlannerResult,\n MigrationPlanOperation,\n TargetMigrationsCapability,\n} from '@prisma-next/core-control-plane/types';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/instance';\nexport {\n createMigrationPlan,\n plannerFailure,\n plannerSuccess,\n runnerFailure,\n runnerSuccess,\n} from '../core/migrations/plan-helpers';\nexport { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';\n// SQL-specific types\nexport type {\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n CreateSqlMigrationPlanOptions,\n SqlControlExtensionDescriptor,\n SqlControlTargetDescriptor,\n SqlMigrationPlan,\n SqlMigrationPlanContractInfo,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunner,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerExecuteCallbacks,\n SqlMigrationRunnerExecuteOptions,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerResult,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerConflictKind,\n SqlPlannerConflictLocation,\n SqlPlannerFailureResult,\n SqlPlannerResult,\n SqlPlannerSuccessResult,\n} from '../core/migrations/types';\n\n/**\n * SQL family descriptor for control plane (CLI/config).\n * Provides the SQL family hook and conversion helpers.\n */\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;AAMA,SAAS,2BAA2B;AAS7B,IAAM,sBAAN,MAEP;AAAA,EACW,OAAO;AAAA,EACP,KAAK;AAAA,EACL,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EAEhB,OAAiD,SAKpB;AAC3B,WAAO,wBAAwB;AAAA,MAC7B,QAAQ,QAAQ;AAAA,MAChB,SAAS,QAAQ;AAAA,MACjB,gBAAgB,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH;AACF;;;ACnCA,SAAS,OAAO,UAAU;AAgB1B,IAAM,sBAA6C,OAAO,OAAO,CAAC,CAAC;AAEnE,SAAS,YAAiC,OAAa;AACrD,MAAI,UAAU,qBAAqB;AACjC,WAAO;AAAA,EACT;AACA,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AACnC;AAEA,SAAS,YACP,OAC0C;AAC1C,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,OAAO,OAAO,CAAC,C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oBAAoB,MAAM;AAAA,IAC5B,CAAC;AAAA,EACH;AACF;AAKO,SAAS,cACd,MACA,SACA,SACkC;AAClC,QAAM,UAAqC,OAAO,OAAO;AAAA,IACvD;AAAA,IACA;AAAA,IACA,GAAI,SAAS,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;AAAA,IAC3C,GAAI,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,IAAI,EAAE,IAAI,CAAC;AAAA,EAC7D,CAAC;AACD,SAAO,MAAM,OAAO;AACtB;;;AC9JO,IAAM,uBAAiD,OAAO,OAAO;AAAA,EAC1E,yBAAyB,OAAO,OAAO,CAAC,UAAU,CAAU;AAC9D,CAAC;;;ACgDD,IAAO,kBAAQ,IAAI,oBAAoB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/descriptor.ts","../../src/core/migrations/plan-helpers.ts","../../src/core/migrations/policies.ts","../../src/exports/control.ts"],"sourcesContent":["import type {\n ControlFamilyDescriptor,\n ControlPlaneStack,\n} from '@prisma-next/core-control-plane/types';\nimport { sqlTargetFamilyHook } from '@prisma-next/sql-contract-emitter';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './instance';\n\n/**\n * SQL family descriptor implementation.\n * Provides the SQL family hook and factory method.\n */\nexport class SqlFamilyDescriptor\n implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly version = '0.0.1';\n readonly hook = sqlTargetFamilyHook;\n\n create<TTargetId extends string>(\n stack: ControlPlaneStack<'sql', TTargetId>,\n ): SqlControlFamilyInstance {\n // Note: driver is not passed here because SqlFamilyInstance operations\n // (validate, emit, etc.) don't require DB connectivity. Commands that\n // need the driver (verify, introspect) get it directly from the stack.\n return createSqlFamilyInstance({\n target: stack.target,\n adapter: stack.adapter,\n extensionPacks: stack.extensionPacks,\n });\n }\n}\n","import type { NotOk, Ok } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type {\n AnyRecord,\n CreateSqlMigrationPlanOptions,\n SqlMigrationPlan,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerFailureResult,\n SqlPlannerSuccessResult,\n} from './types';\n\nconst readOnlyEmptyObject: Record<string, never> = Object.freeze({});\n\nfunction cloneRecord<T extends AnyRecord>(value: T): T {\n if (value === readOnlyEmptyObject) {\n return value;\n }\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeSteps(\n steps: readonly SqlMigrationPlanOperationStep[],\n): readonly SqlMigrationPlanOperationStep[] {\n if (steps.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(\n steps.map((step) =>\n Object.freeze({\n description: step.description,\n sql: step.sql,\n ...(step.meta ? { meta: cloneRecord(step.meta) } : {}),\n }),\n ),\n );\n}\n\nfunction freezeDetailsValue<T>(value: T): T {\n // Primitives and null/undefined are already immutable, return as-is\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n return value;\n }\n // Arrays: shallow clone and freeze\n if (Array.isArray(value)) {\n return Object.freeze([...value]) as T;\n }\n // Objects: shallow clone and freeze (matching cloneRecord pattern)\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeTargetDetails<TTargetDetails>(\n target: SqlMigrationPlanOperationTarget<TTargetDetails>,\n): SqlMigrationPlanOperationTarget<TTargetDetails> {\n return Object.freeze({\n id: target.id,\n ...(target.details !== undefined ? { details: freezeDetailsValue(target.details) } : {}),\n });\n}\n\nfunction freezeOperation<TTargetDetails>(\n operation: SqlMigrationPlanOperation<TTargetDetails>,\n): SqlMigrationPlanOperation<TTargetDetails> {\n return Object.freeze({\n id: operation.id,\n label: operation.label,\n ...(operation.summary ? { summary: operation.summary } : {}),\n operationClass: operation.operationClass,\n target: freezeTargetDetails(operation.target),\n precheck: freezeSteps(operation.precheck),\n execute: freezeSteps(operation.execute),\n postcheck: freezeSteps(operation.postcheck),\n ...(operation.meta ? { meta: cloneRecord(operation.meta) } : {}),\n });\n}\n\nfunction freezeOperations<TTargetDetails>(\n operations: readonly SqlMigrationPlanOperation<TTargetDetails>[],\n): readonly SqlMigrationPlanOperation<TTargetDetails>[] {\n if (operations.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\n\nexport function createMigrationPlan<TTargetDetails>(\n options: CreateSqlMigrationPlanOptions<TTargetDetails>,\n): SqlMigrationPlan<TTargetDetails> {\n return Object.freeze({\n targetId: options.targetId,\n ...(options.origin !== undefined\n ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null }\n : {}),\n destination: Object.freeze({ ...options.destination }),\n operations: freezeOperations(options.operations),\n ...(options.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n}\n\nexport function plannerSuccess<TTargetDetails>(\n plan: SqlMigrationPlan<TTargetDetails>,\n): SqlPlannerSuccessResult<TTargetDetails> {\n return Object.freeze({\n kind: 'success',\n plan,\n });\n}\n\nexport function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult {\n return Object.freeze({\n kind: 'failure' as const,\n conflicts: Object.freeze(\n conflicts.map((conflict) =>\n Object.freeze({\n kind: conflict.kind,\n summary: conflict.summary,\n ...(conflict.why ? { why: conflict.why } : {}),\n ...(conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {}),\n ...(conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}),\n }),\n ),\n ),\n });\n}\n\n/**\n * Creates a successful migration runner result.\n */\nexport function runnerSuccess(value: {\n operationsPlanned: number;\n operationsExecuted: number;\n}): Ok<SqlMigrationRunnerSuccessValue> {\n return ok(\n Object.freeze({\n operationsPlanned: value.operationsPlanned,\n operationsExecuted: value.operationsExecuted,\n }),\n );\n}\n\n/**\n * Creates a failed migration runner result.\n */\nexport function runnerFailure(\n code: SqlMigrationRunnerErrorCode,\n summary: string,\n options?: { why?: string; meta?: AnyRecord },\n): NotOk<SqlMigrationRunnerFailure> {\n const failure: SqlMigrationRunnerFailure = Object.freeze({\n code,\n summary,\n ...(options?.why ? { why: options.why } : {}),\n ...(options?.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n return notOk(failure);\n}\n","import type { MigrationOperationPolicy } from '@prisma-next/core-control-plane/types';\n\n/**\n * Policy used by `db init`: additive-only operations, no widening/destructive steps.\n */\nexport const INIT_ADDITIVE_POLICY: MigrationOperationPolicy = Object.freeze({\n allowedOperationClasses: Object.freeze(['additive'] as const),\n});\n","import { SqlFamilyDescriptor } from '../core/descriptor';\n\n// Re-export core types from canonical source\nexport type {\n MigrationOperationClass,\n MigrationOperationPolicy,\n MigrationPlan,\n MigrationPlanner,\n MigrationPlannerConflict,\n MigrationPlannerResult,\n MigrationPlanOperation,\n TargetMigrationsCapability,\n} from '@prisma-next/core-control-plane/types';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/instance';\nexport {\n createMigrationPlan,\n plannerFailure,\n plannerSuccess,\n runnerFailure,\n runnerSuccess,\n} from '../core/migrations/plan-helpers';\nexport { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';\n// SQL-specific types\nexport type {\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n CreateSqlMigrationPlanOptions,\n SqlControlExtensionDescriptor,\n SqlControlTargetDescriptor,\n SqlMigrationPlan,\n SqlMigrationPlanContractInfo,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunner,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerExecuteCallbacks,\n SqlMigrationRunnerExecuteOptions,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerResult,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerConflictKind,\n SqlPlannerConflictLocation,\n SqlPlannerFailureResult,\n SqlPlannerResult,\n SqlPlannerSuccessResult,\n} from '../core/migrations/types';\n\n/**\n * SQL family descriptor for control plane (CLI/config).\n * Provides the SQL family hook and conversion helpers.\n */\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;AAIA,SAAS,2BAA2B;AAO7B,IAAM,sBAAN,MAEP;AAAA,EACW,OAAO;AAAA,EACP,KAAK;AAAA,EACL,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EAEhB,OACE,OAC0B;AAI1B,WAAO,wBAAwB;AAAA,MAC7B,QAAQ,MAAM;AAAA,MACd,SAAS,MAAM;AAAA,MACf,gBAAgB,MAAM;AAAA,IACxB,CAAC;AAAA,EACH;AACF;;;AC/BA,SAAS,OAAO,UAAU;AAgB1B,IAAM,sBAA6C,OAAO,OAAO,CAAC,CAAC;AAEnE,SAAS,YAAiC,OAAa;AACrD,MAAI,UAAU,qBAAqB;AACjC,WAAO;AAAA,EACT;AACA,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AACnC;AAEA,SAAS,YACP,OAC0C;AAC1C,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,OAAO,OAAO,CAAC,CAAC;AAAA,EACzB;AACA,SAAO,OAAO;AAAA,IACZ,MAAM;AAAA,MAAI,CAAC,SACT,OAAO,OAAO;AAAA,QACZ,aAAa,KAAK;AAAA,QAClB,KAAK,KAAK;AAAA,QACV,GAAI,KAAK,OAAO,EAAE,MAAM,YAAY,KAAK,IAAI,EAAE,IAAI,CAAC;AAAA,MACtD,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,SAAS,mBAAsB,OAAa;AAE1C,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,OAAO,O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,IAAI,oBAAoB;","names":[]}
|
|
@@ -1,66 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RuntimeVerifyOptions, Plugin, Log } from '@prisma-next/runtime-executor';
|
|
3
|
-
import { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
4
|
-
import { Adapter, SelectAst, LoweredStatement, SqlDriver } from '@prisma-next/sql-relational-core/ast';
|
|
5
|
-
import { Runtime, SqlRuntimeAdapterInstance } from '@prisma-next/sql-runtime';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* SQL runtime driver instance type.
|
|
9
|
-
* Combines identity properties with SQL-specific behavior methods.
|
|
10
|
-
*/
|
|
11
|
-
type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<'sql', TTargetId> & SqlDriver;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* SQL runtime family instance interface.
|
|
15
|
-
* Extends base RuntimeFamilyInstance with SQL-specific runtime creation method.
|
|
16
|
-
*/
|
|
17
|
-
interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {
|
|
18
|
-
/**
|
|
19
|
-
* Creates a SQL runtime from contract, driver options, and verification settings.
|
|
20
|
-
*
|
|
21
|
-
* Extension packs are routed through composition (at instance creation time),
|
|
22
|
-
* not through this method. This aligns with control-plane composition patterns.
|
|
23
|
-
*
|
|
24
|
-
* @param options - Runtime creation options
|
|
25
|
-
* @param options.contract - SQL contract
|
|
26
|
-
* @param options.driverOptions - Driver options (e.g., PostgresDriverOptions)
|
|
27
|
-
* @param options.verify - Runtime verification options
|
|
28
|
-
* @param options.plugins - Optional plugins
|
|
29
|
-
* @param options.mode - Optional runtime mode
|
|
30
|
-
* @param options.log - Optional log instance
|
|
31
|
-
* @returns Runtime instance
|
|
32
|
-
*/
|
|
33
|
-
createRuntime<TContract extends SqlContract<SqlStorage>>(options: {
|
|
34
|
-
readonly contract: TContract;
|
|
35
|
-
readonly driverOptions: unknown;
|
|
36
|
-
readonly verify: RuntimeVerifyOptions;
|
|
37
|
-
readonly plugins?: readonly Plugin<TContract, Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>, SqlDriver>[];
|
|
38
|
-
readonly mode?: 'strict' | 'permissive';
|
|
39
|
-
readonly log?: Log;
|
|
40
|
-
}): Runtime;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* SQL runtime family descriptor implementation.
|
|
45
|
-
* Provides factory method to create SQL runtime family instance.
|
|
46
|
-
*/
|
|
47
|
-
declare class SqlRuntimeFamilyDescriptor implements RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance> {
|
|
48
|
-
readonly kind: "family";
|
|
49
|
-
readonly id = "sql";
|
|
50
|
-
readonly familyId: "sql";
|
|
51
|
-
readonly version = "0.0.1";
|
|
52
|
-
create<TTargetId extends string>(options: {
|
|
53
|
-
readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;
|
|
54
|
-
readonly adapter: RuntimeAdapterDescriptor<'sql', TTargetId, SqlRuntimeAdapterInstance<TTargetId>>;
|
|
55
|
-
readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, SqlRuntimeDriverInstance<TTargetId>>;
|
|
56
|
-
readonly extensionPacks: readonly RuntimeExtensionDescriptor<'sql', TTargetId>[];
|
|
57
|
-
}): SqlRuntimeFamilyInstance;
|
|
58
|
-
}
|
|
59
|
-
|
|
1
|
+
import { SqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';
|
|
60
2
|
/**
|
|
61
3
|
* SQL runtime family descriptor for execution/runtime plane.
|
|
62
4
|
* Provides factory method to create SQL runtime family instance.
|
|
63
5
|
*/
|
|
64
6
|
declare const _default: SqlRuntimeFamilyDescriptor;
|
|
65
|
-
|
|
66
|
-
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/exports/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;GAGG;;AACH,wBAAgD"}
|