@prisma-next/sql-contract 0.12.0-dev.62 → 0.12.0-dev.63
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/factories.d.mts +3 -2
- package/dist/factories.d.mts.map +1 -1
- package/dist/foreign-key-BATxB95l.d.mts +121 -0
- package/dist/foreign-key-BATxB95l.d.mts.map +1 -0
- package/dist/index-type-validation.d.mts +1 -1
- package/dist/referential-action-sql.d.mts +12 -0
- package/dist/referential-action-sql.d.mts.map +1 -0
- package/dist/referential-action-sql.mjs +17 -0
- package/dist/referential-action-sql.mjs.map +1 -0
- package/dist/resolve-storage-table.d.mts +1 -1
- package/dist/{sql-storage-CaAh0nd3.d.mts → sql-storage-BWj6r2Dy.d.mts} +5 -120
- package/dist/sql-storage-BWj6r2Dy.d.mts.map +1 -0
- package/dist/{types-CZZASopP.d.mts → types-B4EPjXjQ.d.mts} +3 -2
- package/dist/types-B4EPjXjQ.d.mts.map +1 -0
- package/dist/types.d.mts +3 -2
- package/dist/validators.d.mts +2 -1
- package/dist/validators.d.mts.map +1 -1
- package/package.json +8 -7
- package/src/exports/referential-action-sql.ts +1 -0
- package/src/referential-action-sql.ts +14 -0
- package/dist/sql-storage-CaAh0nd3.d.mts.map +0 -1
- package/dist/types-CZZASopP.d.mts.map +0 -1
package/dist/factories.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as
|
|
1
|
+
import { t as ForeignKey } from "./foreign-key-BATxB95l.mjs";
|
|
2
|
+
import { S as PrimaryKey, b as Index, g as UniqueConstraint, m as StorageTable, v as StorageColumn, y as StorageColumnInput } from "./sql-storage-BWj6r2Dy.mjs";
|
|
3
|
+
import { b as SqlModelFieldStorage, f as ForeignKeyOptions, x as SqlModelStorage } from "./types-B4EPjXjQ.mjs";
|
|
3
4
|
import { ScalarFieldType } from "@prisma-next/contract/types";
|
|
4
5
|
|
|
5
6
|
//#region src/factories.d.ts
|
package/dist/factories.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.mts","names":[],"sources":["../src/factories.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"factories.d.mts","names":[],"sources":["../src/factories.ts"],"mappings":";;;;;;iBAgBgB,GAAA,CAAI,UAAA,UAAoB,OAAA,UAAiB,QAAA,aAAmB,aAAa;AAAA,iBAIzE,EAAA,IAAM,OAAA,sBAA6B,UAAU;AAAA,iBAI7C,MAAA,IAAU,OAAA,sBAA6B,gBAAgB;AAAA,iBAIvD,KAAA,IAAS,OAAA,sBAA6B,KAAK;AAAA,iBAI3C,EAAA,CACd,YAAA,UACA,UAAA,qBACA,eAAA,UACA,aAAA,qBACA,IAAA,GAAO,iBAAA;EAAsB,UAAA;EAAsB,KAAA;EAAiB,WAAA;AAAA,IACnE,UAAU;AAAA,iBAcG,KAAA,CACd,OAAA,EAAS,MAAA,SAAe,aAAA,GAAgB,kBAAA,GACxC,IAAA;EACE,EAAA,GAAK,UAAA;EACL,OAAA,YAAmB,gBAAA;EACnB,OAAA,YAAmB,KAAA;EACnB,GAAA,YAAe,UAAA;AAAA,IAEhB,YAAA;AAAA,iBAUa,KAAA,CACd,SAAA,UACA,MAAA,EAAQ,MAAA,SAAe,oBAAA,GACvB,SAAA,GAAW,MAAA,mBACX,WAAA;EAEA,OAAA,EAAS,eAAA;EACT,MAAA,EAAQ,MAAA;IAAA,SAA0B,QAAA;IAAA,SAA4B,IAAA,EAAM,eAAA;EAAA;EACpE,SAAA,EAAW,MAAA;AAAA"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { IRNodeBase } from "@prisma-next/framework-components/ir";
|
|
2
|
+
import { NamespaceId } from "@prisma-next/contract/types";
|
|
3
|
+
|
|
4
|
+
//#region src/ir/sql-node.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* SQL family IR node base. Carries the family-level `kind` discriminator
|
|
7
|
+
* `'sql'` and inherits the framework's `freezeNode` affordance.
|
|
8
|
+
*
|
|
9
|
+
* Single family-level discriminator (not per-leaf) reflects the fact that
|
|
10
|
+
* SQL IR has no polymorphic dispatch today — verifiers and serializers
|
|
11
|
+
* walk by structural position (`storage.tables[name].columns[name]`),
|
|
12
|
+
* not by inspecting `kind`. The abstract bar for per-leaf discriminators
|
|
13
|
+
* isn't earned until a future polymorphic consumer arrives.
|
|
14
|
+
*
|
|
15
|
+
* `kind` is installed as a non-enumerable own property on every instance,
|
|
16
|
+
* which keeps three things clean simultaneously:
|
|
17
|
+
*
|
|
18
|
+
* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope
|
|
19
|
+
* shape (no `kind` field), so emitted contract.json files and the
|
|
20
|
+
* `validateSqlContractFully` arktype schemas stay unchanged.
|
|
21
|
+
* - Test assertions that use `toEqual({...})` against the pre-lift flat
|
|
22
|
+
* shape continue to pass — only enumerable own properties are
|
|
23
|
+
* compared.
|
|
24
|
+
* - Direct access (`node.kind`) and runtime narrowing
|
|
25
|
+
* (`if (node.kind === 'sql')`) still work, so future polymorphic
|
|
26
|
+
* dispatch can begin reading `kind` without a runtime change.
|
|
27
|
+
*
|
|
28
|
+
* Future per-leaf overrides land cleanly: a class that gains a
|
|
29
|
+
* polymorphic-dispatch consumer (e.g. an enum type instance walked
|
|
30
|
+
* alongside other types) overrides `kind` with its narrower literal
|
|
31
|
+
* at that leaf level. Per-leaf overrides will use enumerable kind
|
|
32
|
+
* (matching the Mongo per-class-discriminator precedent) because they
|
|
33
|
+
* encode dispatch-relevant information that callers need to see in
|
|
34
|
+
* JSON envelopes; the family-level `'sql'` is uniform across all SQL
|
|
35
|
+
* IR and carries no dispatch-relevant information.
|
|
36
|
+
*/
|
|
37
|
+
declare abstract class SqlNode extends IRNodeBase {
|
|
38
|
+
readonly kind?: string;
|
|
39
|
+
constructor();
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/ir/foreign-key-reference.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* Input for a foreign-key reference (one side of a foreign-key declaration).
|
|
45
|
+
*
|
|
46
|
+
* When `spaceId` is absent the reference is local — the referenced table lives
|
|
47
|
+
* in the same contract-space. When `spaceId` is present the reference is
|
|
48
|
+
* cross-space — the referenced table lives in a different contract-space
|
|
49
|
+
* identified by `spaceId`.
|
|
50
|
+
*
|
|
51
|
+
* Presence-based discrimination keeps local FK JSON byte-identical to
|
|
52
|
+
* contracts authored before cross-space support was added.
|
|
53
|
+
*/
|
|
54
|
+
interface ForeignKeyReferenceInput {
|
|
55
|
+
readonly namespaceId: string;
|
|
56
|
+
readonly tableName: string;
|
|
57
|
+
readonly columns: readonly string[];
|
|
58
|
+
readonly spaceId?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* SQL Contract IR node for one side (source or target) of a foreign-key
|
|
62
|
+
* declaration. Carries the full coordinate: namespace, table, and columns.
|
|
63
|
+
*
|
|
64
|
+
* Cross-space discrimination is based on `spaceId` presence: absent means
|
|
65
|
+
* local (same contract-space); present means cross-space (the referenced
|
|
66
|
+
* table lives in the contract-space identified by `spaceId`).
|
|
67
|
+
*
|
|
68
|
+
* For local references `spaceId` is absent from JSON, keeping the serialized
|
|
69
|
+
* shape byte-identical to contracts authored before cross-space support was
|
|
70
|
+
* added. For cross-space references `spaceId` appears in JSON so round-trips
|
|
71
|
+
* are lossless.
|
|
72
|
+
*
|
|
73
|
+
* Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`
|
|
74
|
+
* as the sentinel `namespaceId` for single-namespace (unbound) references.
|
|
75
|
+
*/
|
|
76
|
+
declare class ForeignKeyReference extends SqlNode {
|
|
77
|
+
readonly namespaceId: NamespaceId;
|
|
78
|
+
readonly tableName: string;
|
|
79
|
+
readonly columns: readonly string[];
|
|
80
|
+
readonly spaceId?: string;
|
|
81
|
+
constructor(input: ForeignKeyReferenceInput);
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/ir/foreign-key.d.ts
|
|
85
|
+
type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';
|
|
86
|
+
interface ForeignKeyInput {
|
|
87
|
+
readonly source: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
88
|
+
readonly target: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
89
|
+
readonly name?: string;
|
|
90
|
+
readonly onDelete?: ReferentialAction;
|
|
91
|
+
readonly onUpdate?: ReferentialAction;
|
|
92
|
+
/** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */
|
|
93
|
+
readonly constraint: boolean;
|
|
94
|
+
/** Whether to emit a backing index for the FK columns. */
|
|
95
|
+
readonly index: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* SQL Contract IR node for a table-level foreign-key declaration.
|
|
99
|
+
*
|
|
100
|
+
* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}
|
|
101
|
+
* coordinates (namespace, table, columns). For single-namespace contracts the
|
|
102
|
+
* sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.
|
|
103
|
+
*
|
|
104
|
+
* The nested references are normalised to {@link ForeignKeyReference}
|
|
105
|
+
* instances inside the constructor so downstream walks see a uniform AST
|
|
106
|
+
* regardless of whether the input was a JSON literal or an already-constructed
|
|
107
|
+
* class instance.
|
|
108
|
+
*/
|
|
109
|
+
declare class ForeignKey extends SqlNode {
|
|
110
|
+
readonly source: ForeignKeyReference;
|
|
111
|
+
readonly target: ForeignKeyReference;
|
|
112
|
+
readonly constraint: boolean;
|
|
113
|
+
readonly index: boolean;
|
|
114
|
+
readonly name?: string;
|
|
115
|
+
readonly onDelete?: ReferentialAction;
|
|
116
|
+
readonly onUpdate?: ReferentialAction;
|
|
117
|
+
constructor(input: ForeignKeyInput);
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
export { ForeignKeyReferenceInput as a, ForeignKeyReference as i, ForeignKeyInput as n, SqlNode as o, ReferentialAction as r, ForeignKey as t };
|
|
121
|
+
//# sourceMappingURL=foreign-key-BATxB95l.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreign-key-BATxB95l.d.mts","names":[],"sources":["../src/ir/sql-node.ts","../src/ir/foreign-key-reference.ts","../src/ir/foreign-key.ts"],"mappings":";;;;;;;AAkCA;;;;;;;;;;;;ACnBA;;;;;;;;;AAIkB;AAmBlB;;;;;;;uBDJsB,OAAA,SAAgB,UAAU;EAAA,SACrC,IAAA;;;;;;;AADX;;;;;;;;;UCnBiB,wBAAA;EAAA,SACN,WAAA;EAAA,SACA,SAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;AAAA;;;;;;;AAAO;AAmBlB;;;;;;;;;cAAa,mBAAA,SAA4B,OAAA;EAAA,SAC9B,WAAA,EAAa,WAAA;EAAA,SACb,SAAA;EAAA,SACA,OAAA;EAAA,SACQ,OAAA;cAEL,KAAA,EAAO,wBAAA;AAAA;;;KCxCT,iBAAA;AAAA,UAEK,eAAA;EAAA,SACN,MAAA,EAAQ,mBAAA,GAAsB,wBAAA;EAAA,SAC9B,MAAA,EAAQ,mBAAA,GAAsB,wBAAA;EAAA,SAC9B,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAA;EFwBX;EAAA,SEtBA,UAAA;;WAEA,KAAA;AAAA;;;ADAX;;;;;;;;;AAIkB;cCWL,UAAA,SAAmB,OAAA;EAAA,SACrB,MAAA,EAAQ,mBAAA;EAAA,SACR,MAAA,EAAQ,mBAAA;EAAA,SACR,UAAA;EAAA,SACA,KAAA;EAAA,SACQ,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAA;cAEhB,KAAA,EAAO,eAAA;AAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { r as ReferentialAction } from "./foreign-key-BATxB95l.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/referential-action-sql.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Maps each `ReferentialAction` value to the SQL keyword used in ON DELETE /
|
|
6
|
+
* ON UPDATE clauses. Shared across the migration planner and adapter DDL
|
|
7
|
+
* renderers — single source of truth for the action → SQL mapping.
|
|
8
|
+
*/
|
|
9
|
+
declare const REFERENTIAL_ACTION_SQL: Record<ReferentialAction, string>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { REFERENTIAL_ACTION_SQL };
|
|
12
|
+
//# sourceMappingURL=referential-action-sql.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referential-action-sql.d.mts","names":[],"sources":["../src/referential-action-sql.ts"],"mappings":";;;;;AAOA;;;cAAa,sBAAA,EAAwB,MAAM,CAAC,iBAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/referential-action-sql.ts
|
|
2
|
+
/**
|
|
3
|
+
* Maps each `ReferentialAction` value to the SQL keyword used in ON DELETE /
|
|
4
|
+
* ON UPDATE clauses. Shared across the migration planner and adapter DDL
|
|
5
|
+
* renderers — single source of truth for the action → SQL mapping.
|
|
6
|
+
*/
|
|
7
|
+
const REFERENTIAL_ACTION_SQL = {
|
|
8
|
+
noAction: "NO ACTION",
|
|
9
|
+
restrict: "RESTRICT",
|
|
10
|
+
cascade: "CASCADE",
|
|
11
|
+
setNull: "SET NULL",
|
|
12
|
+
setDefault: "SET DEFAULT"
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { REFERENTIAL_ACTION_SQL };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=referential-action-sql.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referential-action-sql.mjs","names":[],"sources":["../src/referential-action-sql.ts"],"sourcesContent":["import type { ReferentialAction } from './ir/foreign-key';\n\n/**\n * Maps each `ReferentialAction` value to the SQL keyword used in ON DELETE /\n * ON UPDATE clauses. Shared across the migration planner and adapter DDL\n * renderers — single source of truth for the action → SQL mapping.\n */\nexport const REFERENTIAL_ACTION_SQL: Record<ReferentialAction, string> = {\n noAction: 'NO ACTION',\n restrict: 'RESTRICT',\n cascade: 'CASCADE',\n setNull: 'SET NULL',\n setDefault: 'SET DEFAULT',\n};\n"],"mappings":";;;;;;AAOA,MAAa,yBAA4D;CACvE,UAAU;CACV,UAAU;CACV,SAAS;CACT,SAAS;CACT,YAAY;AACd"}
|
|
@@ -1,122 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as ForeignKeyInput, o as SqlNode, t as ForeignKey } from "./foreign-key-BATxB95l.mjs";
|
|
2
|
+
import { Namespace, Storage, StorageType } from "@prisma-next/framework-components/ir";
|
|
3
|
+
import { ColumnDefault, ControlPolicy, StorageHashBase, ValueSetRef } from "@prisma-next/contract/types";
|
|
3
4
|
|
|
4
|
-
//#region src/ir/sql-node.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* SQL family IR node base. Carries the family-level `kind` discriminator
|
|
7
|
-
* `'sql'` and inherits the framework's `freezeNode` affordance.
|
|
8
|
-
*
|
|
9
|
-
* Single family-level discriminator (not per-leaf) reflects the fact that
|
|
10
|
-
* SQL IR has no polymorphic dispatch today — verifiers and serializers
|
|
11
|
-
* walk by structural position (`storage.tables[name].columns[name]`),
|
|
12
|
-
* not by inspecting `kind`. The abstract bar for per-leaf discriminators
|
|
13
|
-
* isn't earned until a future polymorphic consumer arrives.
|
|
14
|
-
*
|
|
15
|
-
* `kind` is installed as a non-enumerable own property on every instance,
|
|
16
|
-
* which keeps three things clean simultaneously:
|
|
17
|
-
*
|
|
18
|
-
* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope
|
|
19
|
-
* shape (no `kind` field), so emitted contract.json files and the
|
|
20
|
-
* `validateSqlContractFully` arktype schemas stay unchanged.
|
|
21
|
-
* - Test assertions that use `toEqual({...})` against the pre-lift flat
|
|
22
|
-
* shape continue to pass — only enumerable own properties are
|
|
23
|
-
* compared.
|
|
24
|
-
* - Direct access (`node.kind`) and runtime narrowing
|
|
25
|
-
* (`if (node.kind === 'sql')`) still work, so future polymorphic
|
|
26
|
-
* dispatch can begin reading `kind` without a runtime change.
|
|
27
|
-
*
|
|
28
|
-
* Future per-leaf overrides land cleanly: a class that gains a
|
|
29
|
-
* polymorphic-dispatch consumer (e.g. an enum type instance walked
|
|
30
|
-
* alongside other types) overrides `kind` with its narrower literal
|
|
31
|
-
* at that leaf level. Per-leaf overrides will use enumerable kind
|
|
32
|
-
* (matching the Mongo per-class-discriminator precedent) because they
|
|
33
|
-
* encode dispatch-relevant information that callers need to see in
|
|
34
|
-
* JSON envelopes; the family-level `'sql'` is uniform across all SQL
|
|
35
|
-
* IR and carries no dispatch-relevant information.
|
|
36
|
-
*/
|
|
37
|
-
declare abstract class SqlNode extends IRNodeBase {
|
|
38
|
-
readonly kind?: string;
|
|
39
|
-
constructor();
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/ir/foreign-key-reference.d.ts
|
|
43
|
-
/**
|
|
44
|
-
* Input for a foreign-key reference (one side of a foreign-key declaration).
|
|
45
|
-
*
|
|
46
|
-
* When `spaceId` is absent the reference is local — the referenced table lives
|
|
47
|
-
* in the same contract-space. When `spaceId` is present the reference is
|
|
48
|
-
* cross-space — the referenced table lives in a different contract-space
|
|
49
|
-
* identified by `spaceId`.
|
|
50
|
-
*
|
|
51
|
-
* Presence-based discrimination keeps local FK JSON byte-identical to
|
|
52
|
-
* contracts authored before cross-space support was added.
|
|
53
|
-
*/
|
|
54
|
-
interface ForeignKeyReferenceInput {
|
|
55
|
-
readonly namespaceId: string;
|
|
56
|
-
readonly tableName: string;
|
|
57
|
-
readonly columns: readonly string[];
|
|
58
|
-
readonly spaceId?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* SQL Contract IR node for one side (source or target) of a foreign-key
|
|
62
|
-
* declaration. Carries the full coordinate: namespace, table, and columns.
|
|
63
|
-
*
|
|
64
|
-
* Cross-space discrimination is based on `spaceId` presence: absent means
|
|
65
|
-
* local (same contract-space); present means cross-space (the referenced
|
|
66
|
-
* table lives in the contract-space identified by `spaceId`).
|
|
67
|
-
*
|
|
68
|
-
* For local references `spaceId` is absent from JSON, keeping the serialized
|
|
69
|
-
* shape byte-identical to contracts authored before cross-space support was
|
|
70
|
-
* added. For cross-space references `spaceId` appears in JSON so round-trips
|
|
71
|
-
* are lossless.
|
|
72
|
-
*
|
|
73
|
-
* Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`
|
|
74
|
-
* as the sentinel `namespaceId` for single-namespace (unbound) references.
|
|
75
|
-
*/
|
|
76
|
-
declare class ForeignKeyReference extends SqlNode {
|
|
77
|
-
readonly namespaceId: NamespaceId;
|
|
78
|
-
readonly tableName: string;
|
|
79
|
-
readonly columns: readonly string[];
|
|
80
|
-
readonly spaceId?: string;
|
|
81
|
-
constructor(input: ForeignKeyReferenceInput);
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/ir/foreign-key.d.ts
|
|
85
|
-
type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';
|
|
86
|
-
interface ForeignKeyInput {
|
|
87
|
-
readonly source: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
88
|
-
readonly target: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
89
|
-
readonly name?: string;
|
|
90
|
-
readonly onDelete?: ReferentialAction;
|
|
91
|
-
readonly onUpdate?: ReferentialAction;
|
|
92
|
-
/** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */
|
|
93
|
-
readonly constraint: boolean;
|
|
94
|
-
/** Whether to emit a backing index for the FK columns. */
|
|
95
|
-
readonly index: boolean;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* SQL Contract IR node for a table-level foreign-key declaration.
|
|
99
|
-
*
|
|
100
|
-
* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}
|
|
101
|
-
* coordinates (namespace, table, columns). For single-namespace contracts the
|
|
102
|
-
* sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.
|
|
103
|
-
*
|
|
104
|
-
* The nested references are normalised to {@link ForeignKeyReference}
|
|
105
|
-
* instances inside the constructor so downstream walks see a uniform AST
|
|
106
|
-
* regardless of whether the input was a JSON literal or an already-constructed
|
|
107
|
-
* class instance.
|
|
108
|
-
*/
|
|
109
|
-
declare class ForeignKey extends SqlNode {
|
|
110
|
-
readonly source: ForeignKeyReference;
|
|
111
|
-
readonly target: ForeignKeyReference;
|
|
112
|
-
readonly constraint: boolean;
|
|
113
|
-
readonly index: boolean;
|
|
114
|
-
readonly name?: string;
|
|
115
|
-
readonly onDelete?: ReferentialAction;
|
|
116
|
-
readonly onUpdate?: ReferentialAction;
|
|
117
|
-
constructor(input: ForeignKeyInput);
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
5
|
//#region src/ir/primary-key.d.ts
|
|
121
6
|
interface PrimaryKeyInput {
|
|
122
7
|
readonly columns: readonly string[];
|
|
@@ -389,5 +274,5 @@ declare class SqlStorage<THash extends string = string> extends SqlNode implemen
|
|
|
389
274
|
}
|
|
390
275
|
declare function storageTableAt(storage: SqlStorage, namespaceId: string, tableName: string): StorageTable | undefined;
|
|
391
276
|
//#endregion
|
|
392
|
-
export { PrimaryKeyInput as C,
|
|
393
|
-
//# sourceMappingURL=sql-storage-
|
|
277
|
+
export { PrimaryKeyInput as C, PrimaryKey as S, UniqueConstraintInput as _, SqlStorageTypeEntry as a, Index as b, StorageValueSetInput as c, StorageTypeInstanceInput as d, isStorageTypeInstance as f, UniqueConstraint as g, StorageTableInput as h, SqlStorageInput as i, CODEC_INSTANCE_KIND as l, StorageTable as m, SqlNamespaceTablesInput as n, storageTableAt as o, toStorageTypeInstance as p, SqlStorage as r, StorageValueSet as s, SqlNamespace as t, StorageTypeInstance as u, StorageColumn as v, IndexInput as x, StorageColumnInput as y };
|
|
278
|
+
//# sourceMappingURL=sql-storage-BWj6r2Dy.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-storage-BWj6r2Dy.d.mts","names":[],"sources":["../src/ir/primary-key.ts","../src/ir/sql-index.ts","../src/ir/storage-column.ts","../src/ir/unique-constraint.ts","../src/ir/storage-table.ts","../src/ir/storage-type-instance.ts","../src/ir/storage-value-set.ts","../src/ir/sql-storage.ts"],"mappings":";;;;;UAGiB,eAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAI;AAAA;AAFf;;;AAAA,cAQa,UAAA,SAAmB,OAAO;EAAA,SAC5B,OAAA;EAAA,SACQ,IAAA;cAEL,KAAA,EAAO,eAAA;AAAA;;;UCZJ,UAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA,GAAU,MAAM;AAAA;;;ADFZ;AAMf;;;;;cCOa,KAAA,SAAc,OAAA;EAAA,SAChB,OAAA;EAAA,SACQ,IAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA,GAAU,MAAA;cAEf,KAAA,EAAO,UAAA;AAAA;;;;;;ADrBrB;;;;AAEe;AAMf;;UEGiB,kBAAA;EAAA,SACN,UAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACA,UAAA,GAAa,MAAA;EAAA,SACb,OAAA;EAAA,SACA,OAAA,GAAU,aAAA;EAAA,SACV,OAAA,GAAU,aAAA;EAAA,SACV,QAAA,GAAW,WAAA;AAAA;;;;ADnBtB;;;;;;;;;;cCmCa,aAAA,SAAsB,OAAA;EAAA,SACxB,UAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACQ,UAAA,GAAa,MAAA;EAAA,SACb,OAAA;EAAA,SACA,OAAA,GAAU,aAAA;EAAA,SACV,OAAA,GAAU,aAAA;EAAA,SACV,QAAA,GAAW,WAAA;cAEhB,KAAA,EAAO,kBAAA;AAAA;;;UC7CJ,qB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
+
import { r as ReferentialAction } from "./foreign-key-BATxB95l.mjs";
|
|
2
|
+
import { m as StorageTable, n as SqlNamespaceTablesInput, t as SqlNamespace } from "./sql-storage-BWj6r2Dy.mjs";
|
|
2
3
|
import { Namespace, NamespaceBase, StorageType } from "@prisma-next/framework-components/ir";
|
|
3
4
|
import { ControlPolicy } from "@prisma-next/contract/types";
|
|
4
5
|
import { CodecTrait } from "@prisma-next/framework-components/codec";
|
|
@@ -204,4 +205,4 @@ type ExtractFieldInputTypes<T> = FieldInputTypesOf<ExtractTypeMapsFromContract<T
|
|
|
204
205
|
type ResolveCodecTypes<TContract, TTypeMaps> = [TTypeMaps] extends [never] ? ExtractCodecTypes<TContract> : CodecTypesOf<TTypeMaps>;
|
|
205
206
|
//#endregion
|
|
206
207
|
export { buildSqlNamespace as A, TypeMaps as C, POSTGRES_ENUM_KIND as D, SqlUnboundNamespace as E, PostgresEnumStorageEntry as O, SqlQueryOperationTypes as S, applyFkDefaults as T, QueryOperationTypesOf as _, ExtractCodecTypes as a, SqlModelFieldStorage as b, ExtractQueryOperationTypes as c, FieldOutputTypesOf as d, ForeignKeyOptions as f, QueryOperationTypesBase as g, QueryOperationTypeEntry as h, DEFAULT_FK_INDEX as i, buildSqlNamespaceMap as j, isPostgresEnumStorageEntry as k, ExtractTypeMapsFromContract as l, QueryOperationSelfSpec as m, ContractWithTypeMaps as n, ExtractFieldInputTypes as o, QueryOperationReturn as p, DEFAULT_FK_CONSTRAINT as r, ExtractFieldOutputTypes as s, CodecTypesOf as t, FieldInputTypesOf as u, ResolveCodecTypes as v, TypeMapsPhantomKey as w, SqlModelStorage as x, SqlControlDriverInstance as y };
|
|
207
|
-
//# sourceMappingURL=types-
|
|
208
|
+
//# sourceMappingURL=types-B4EPjXjQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-B4EPjXjQ.d.mts","names":[],"sources":["../src/ir/build-sql-namespace.ts","../src/ir/postgres-enum-storage-entry.ts","../src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BACA,CAAA;EAAA,SAAqB,mBAAA;AAAA,IACnB,CAAA,SAAU,MAAA,oBACR,CAAA,GACA,MAAA,kBACF,MAAA;AAAA,KAEM,kBAAA;AAAA,KAEA,oBAAA,yBAA6C,SAAA,oBACxC,kBAAA,IAAsB,SAAA;AAAA,KAG3B,2BAAA,MAAiC,kBAAA,eAAiC,CAAA,GAC1E,WAAA,CAAY,CAAA,CAAE,kBAAA,SAA2B,CAAA;AAAA,KAGjC,kBAAA,OAAyB,CAAA,oBACjC,MAAA,kBACA,CAAA;EAAA,SAAqB,gBAAA;AAAA,IACnB,CAAA,SAAU,MAAA,SAAe,MAAA,qBACvB,CAAA,GACA,MAAA,kBACF,MAAA;AAAA,KAEM,iBAAA,OAAwB,CAAA,oBAChC,MAAA,kBACA,CAAA;EAAA,SAAqB,eAAA;AAAA,IACnB,CAAA,SAAU,MAAA,SAAe,MAAA,qBACvB,CAAA,GACA,MAAA,kBACF,MAAA;AAAA,KAEM,iBAAA,MAAuB,YAAA,CAAa,2BAAA,CAA4B,CAAA;AAAA,KAChE,0BAAA,MAAgC,qBAAA,CAAsB,2BAAA,CAA4B,CAAA;AAAA,KAClF,uBAAA,MAA6B,kBAAA,CAAmB,2BAAA,CAA4B,CAAA;AAAA,KAC5E,sBAAA,MAA4B,iBAAA,CAAkB,2BAAA,CAA4B,CAAA;AAAA,KAE1E,iBAAA,0BAA2C,SAAA,oBACnD,iBAAA,CAAkB,SAAA,IAClB,YAAA,CAAa,SAAA"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as ForeignKeyReferenceInput, i as ForeignKeyReference, n as ForeignKeyInput, o as SqlNode, r as ReferentialAction, t as ForeignKey } from "./foreign-key-BATxB95l.mjs";
|
|
2
|
+
import { C as PrimaryKeyInput, S as PrimaryKey, _ as UniqueConstraintInput, a as SqlStorageTypeEntry, b as Index, c as StorageValueSetInput, d as StorageTypeInstanceInput, f as isStorageTypeInstance, g as UniqueConstraint, h as StorageTableInput, i as SqlStorageInput, l as CODEC_INSTANCE_KIND, m as StorageTable, n as SqlNamespaceTablesInput, o as storageTableAt, p as toStorageTypeInstance, r as SqlStorage, s as StorageValueSet, u as StorageTypeInstance, v as StorageColumn, x as IndexInput, y as StorageColumnInput } from "./sql-storage-BWj6r2Dy.mjs";
|
|
3
|
+
import { A as buildSqlNamespace, C as TypeMaps, D as POSTGRES_ENUM_KIND, E as SqlUnboundNamespace, O as PostgresEnumStorageEntry, S as SqlQueryOperationTypes, T as applyFkDefaults, _ as QueryOperationTypesOf, a as ExtractCodecTypes, b as SqlModelFieldStorage, c as ExtractQueryOperationTypes, d as FieldOutputTypesOf, f as ForeignKeyOptions, g as QueryOperationTypesBase, h as QueryOperationTypeEntry, i as DEFAULT_FK_INDEX, j as buildSqlNamespaceMap, k as isPostgresEnumStorageEntry, l as ExtractTypeMapsFromContract, m as QueryOperationSelfSpec, n as ContractWithTypeMaps, o as ExtractFieldInputTypes, p as QueryOperationReturn, r as DEFAULT_FK_CONSTRAINT, s as ExtractFieldOutputTypes, t as CodecTypesOf, u as FieldInputTypesOf, v as ResolveCodecTypes, w as TypeMapsPhantomKey, x as SqlModelStorage, y as SqlControlDriverInstance } from "./types-B4EPjXjQ.mjs";
|
|
3
4
|
export { CODEC_INSTANCE_KIND, type CodecTypesOf, type ContractWithTypeMaps, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, type ExtractCodecTypes, type ExtractFieldInputTypes, type ExtractFieldOutputTypes, type ExtractQueryOperationTypes, type ExtractTypeMapsFromContract, type FieldInputTypesOf, type FieldOutputTypesOf, ForeignKey, type ForeignKeyInput, type ForeignKeyOptions, ForeignKeyReference, type ForeignKeyReferenceInput, Index, type IndexInput, POSTGRES_ENUM_KIND, type PostgresEnumStorageEntry, PrimaryKey, type PrimaryKeyInput, type QueryOperationReturn, type QueryOperationSelfSpec, type QueryOperationTypeEntry, type QueryOperationTypesBase, type QueryOperationTypesOf, type ReferentialAction, type ResolveCodecTypes, type SqlControlDriverInstance, type SqlModelFieldStorage, type SqlModelStorage, type SqlNamespaceTablesInput, SqlNode, type SqlQueryOperationTypes, SqlStorage, type SqlStorageInput, type SqlStorageTypeEntry, SqlUnboundNamespace, StorageColumn, type StorageColumnInput, StorageTable, type StorageTableInput, type StorageTypeInstance, type StorageTypeInstanceInput, StorageValueSet, type StorageValueSetInput, type TypeMaps, type TypeMapsPhantomKey, UniqueConstraint, type UniqueConstraintInput, applyFkDefaults, buildSqlNamespace, buildSqlNamespaceMap, isPostgresEnumStorageEntry, isStorageTypeInstance, storageTableAt, toStorageTypeInstance };
|
package/dist/validators.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as ForeignKeyInput, r as ReferentialAction } from "./foreign-key-BATxB95l.mjs";
|
|
2
|
+
import { r as SqlStorage } from "./sql-storage-BWj6r2Dy.mjs";
|
|
2
3
|
import { Contract } from "@prisma-next/contract/types";
|
|
3
4
|
import { Type } from "arktype";
|
|
4
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","names":[],"sources":["../src/validators.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"validators.d.mts","names":[],"sources":["../src/validators.ts"],"mappings":";;;;;;KA2BK,oBAAA;EAAA,SACM,IAAA;EAAA,SACA,KAAA,8BAAmC,MAAM;AAAA;AAAA,KAE/C,qBAAA;EAAA,SAAmC,IAAA;EAAA,SAA2B,UAAU;AAAA;AAAA,cAShE,0BAAA,gDAA0B,UAAA,CAAA,oBAAA;AAAA,cAK1B,2BAAA,gDAA2B,UAAA,CAAA,qBAAA;AAAA,cAK3B,mBAAA,gDAAmB,UAAA,CAAA,oBAAA,GAAA,qBAAA;;AArBoB;AAAA;;;cA+F9C,sBAAA,gDAAsB,UAAA;;;;;;;AA/E5B;;;;AAAwC;AAAxC,cA+Fa,qBAAA,gDAAqB,UAAA;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"description": "SQL contract types, validators, and IR factories for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/contract": "0.12.0-dev.
|
|
10
|
-
"@prisma-next/framework-components": "0.12.0-dev.
|
|
11
|
-
"@prisma-next/utils": "0.12.0-dev.
|
|
9
|
+
"@prisma-next/contract": "0.12.0-dev.63",
|
|
10
|
+
"@prisma-next/framework-components": "0.12.0-dev.63",
|
|
11
|
+
"@prisma-next/utils": "0.12.0-dev.63",
|
|
12
12
|
"arktype": "^2.2.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@prisma-next/test-utils": "0.12.0-dev.
|
|
16
|
-
"@prisma-next/tsconfig": "0.12.0-dev.
|
|
17
|
-
"@prisma-next/tsdown": "0.12.0-dev.
|
|
15
|
+
"@prisma-next/test-utils": "0.12.0-dev.63",
|
|
16
|
+
"@prisma-next/tsconfig": "0.12.0-dev.63",
|
|
17
|
+
"@prisma-next/tsdown": "0.12.0-dev.63",
|
|
18
18
|
"tsdown": "0.22.1",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"vitest": "4.1.7"
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"./index-type-validation": "./dist/index-type-validation.mjs",
|
|
38
38
|
"./index-types": "./dist/index-types.mjs",
|
|
39
39
|
"./pack-types": "./dist/pack-types.mjs",
|
|
40
|
+
"./referential-action-sql": "./dist/referential-action-sql.mjs",
|
|
40
41
|
"./resolve-storage-table": "./dist/resolve-storage-table.mjs",
|
|
41
42
|
"./types": "./dist/types.mjs",
|
|
42
43
|
"./validators": "./dist/validators.mjs",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { REFERENTIAL_ACTION_SQL } from '../referential-action-sql';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReferentialAction } from './ir/foreign-key';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Maps each `ReferentialAction` value to the SQL keyword used in ON DELETE /
|
|
5
|
+
* ON UPDATE clauses. Shared across the migration planner and adapter DDL
|
|
6
|
+
* renderers — single source of truth for the action → SQL mapping.
|
|
7
|
+
*/
|
|
8
|
+
export const REFERENTIAL_ACTION_SQL: Record<ReferentialAction, string> = {
|
|
9
|
+
noAction: 'NO ACTION',
|
|
10
|
+
restrict: 'RESTRICT',
|
|
11
|
+
cascade: 'CASCADE',
|
|
12
|
+
setNull: 'SET NULL',
|
|
13
|
+
setDefault: 'SET DEFAULT',
|
|
14
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sql-storage-CaAh0nd3.d.mts","names":[],"sources":["../src/ir/sql-node.ts","../src/ir/foreign-key-reference.ts","../src/ir/foreign-key.ts","../src/ir/primary-key.ts","../src/ir/sql-index.ts","../src/ir/storage-column.ts","../src/ir/unique-constraint.ts","../src/ir/storage-table.ts","../src/ir/storage-type-instance.ts","../src/ir/storage-value-set.ts","../src/ir/sql-storage.ts"],"mappings":";;;;;;;AAkCA;;;;;;;;;;;;ACnBA;;;;;;;;;AAIkB;AAmBlB;;;;;;;uBDJsB,OAAA,SAAgB,UAAU;EAAA,SACrC,IAAA;;;;;;;AADX;;;;;;;;;UCnBiB,wBAAA;EAAA,SACN,WAAA;EAAA,SACA,SAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;AAAA;;;;;;;AAAO;AAmBlB;;;;;;;;;cAAa,mBAAA,SAA4B,OAAA;EAAA,SAC9B,WAAA,EAAa,WAAA;EAAA,SACb,SAAA;EAAA,SACA,OAAA;EAAA,SACQ,OAAA;cAEL,KAAA,EAAO,wBAAA;AAAA;;;KCxCT,iBAAA;AAAA,UAEK,eAAA;EAAA,SACN,MAAA,EAAQ,mBAAA,GAAsB,wBAAA;EAAA,SAC9B,MAAA,EAAQ,mBAAA,GAAsB,wBAAA;EAAA,SAC9B,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAA;EFwBX;EAAA,SEtBA,UAA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