@prisma-next/target-postgres 0.14.0-dev.39 → 0.14.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.
- package/dist/{authoring-CZmSQriw.mjs → authoring-BX1WHIdN.mjs} +2 -2
- package/dist/authoring-BX1WHIdN.mjs.map +1 -0
- package/dist/contract-free.mjs +2 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +633 -16
- package/dist/control.mjs.map +1 -1
- package/dist/{ddl-CGf6UABz.mjs → ddl-BmLIe1z_.mjs} +2 -2
- package/dist/{ddl-CGf6UABz.mjs.map → ddl-BmLIe1z_.mjs.map} +1 -1
- package/dist/{descriptor-meta-Du6olWQI.mjs → descriptor-meta-tjatyhtZ.mjs} +3 -3
- package/dist/{descriptor-meta-Du6olWQI.mjs.map → descriptor-meta-tjatyhtZ.mjs.map} +1 -1
- package/dist/{issue-planner-C-CwZd8D.mjs → issue-planner-DbFvaAgu.mjs} +5 -5
- package/dist/issue-planner-DbFvaAgu.mjs.map +1 -0
- package/dist/issue-planner.d.mts +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +2 -2
- package/dist/migration.mjs +2 -2
- package/dist/{op-factory-call-DPJR7tJc.d.mts → op-factory-call-CJWUxyUW.d.mts} +2 -2
- package/dist/{op-factory-call-DPJR7tJc.d.mts.map → op-factory-call-CJWUxyUW.d.mts.map} +1 -1
- package/dist/{op-factory-call-DArx_1HM.mjs → op-factory-call-t65c4jyY.mjs} +3 -3
- package/dist/op-factory-call-t65c4jyY.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +1 -1
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.d.mts +2 -2
- package/dist/pack.mjs +1 -1
- package/dist/{planner-BQ7lSqbm.mjs → planner-CG2pLHk-.mjs} +310 -126
- package/dist/planner-CG2pLHk-.mjs.map +1 -0
- package/dist/{planner-produced-postgres-migration-3ppG0t3i.mjs → planner-produced-postgres-migration-BolD0Mvc.mjs} +2 -2
- package/dist/{planner-produced-postgres-migration-3ppG0t3i.mjs.map → planner-produced-postgres-migration-BolD0Mvc.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-BauTSigX.d.mts → planner-produced-postgres-migration-Cz9--XOT.d.mts} +2 -2
- package/dist/{planner-produced-postgres-migration-BauTSigX.d.mts.map → planner-produced-postgres-migration-Cz9--XOT.d.mts.map} +1 -1
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/{planner-sql-checks-CyjaoKhm.mjs → planner-sql-checks-DE9c4519.mjs} +2 -2
- package/dist/{planner-sql-checks-CyjaoKhm.mjs.map → planner-sql-checks-DE9c4519.mjs.map} +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/planner.d.mts +73 -22
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +2 -2
- package/dist/{postgres-contract-view-CoRZewAp.mjs → postgres-contract-view-BegduLr6.mjs} +3 -3
- package/dist/{postgres-contract-view-CoRZewAp.mjs.map → postgres-contract-view-BegduLr6.mjs.map} +1 -1
- package/dist/postgres-database-schema-node-os8ogEap.d.mts +183 -0
- package/dist/postgres-database-schema-node-os8ogEap.d.mts.map +1 -0
- package/dist/{postgres-migration-BVjq0iFW.mjs → postgres-migration-BfMmK6tv.mjs} +3 -3
- package/dist/{postgres-migration-BVjq0iFW.mjs.map → postgres-migration-BfMmK6tv.mjs.map} +1 -1
- package/dist/{postgres-migration-UtGCjw5j.d.mts → postgres-migration-D7kNVWVG.d.mts} +2 -2
- package/dist/{postgres-migration-UtGCjw5j.d.mts.map → postgres-migration-D7kNVWVG.d.mts.map} +1 -1
- package/dist/{postgres-rls-policy-12wAEQhs.d.mts → postgres-rls-policy--CSddvMR.d.mts} +8 -16
- package/dist/postgres-rls-policy--CSddvMR.d.mts.map +1 -0
- package/dist/{postgres-schema-DLcc3W2-.mjs → postgres-schema-BLIHBEfX.mjs} +34 -64
- package/dist/postgres-schema-BLIHBEfX.mjs.map +1 -0
- package/dist/{postgres-schema-DJUEkWg-.d.mts → postgres-schema-BywoeKlt.d.mts} +9 -10
- package/dist/postgres-schema-BywoeKlt.d.mts.map +1 -0
- package/dist/postgres-table-schema-node-1nNc8XDT.mjs +248 -0
- package/dist/postgres-table-schema-node-1nNc8XDT.mjs.map +1 -0
- package/dist/resolve-ddl-schema-CL1RR1mx.mjs +20 -0
- package/dist/resolve-ddl-schema-CL1RR1mx.mjs.map +1 -0
- package/dist/runtime.mjs +1 -1
- package/dist/schema-ir-annotations.d.mts +9 -3
- package/dist/schema-ir-annotations.d.mts.map +1 -1
- package/dist/schema-ir-annotations.mjs +1 -1
- package/dist/types.d.mts +4 -4
- package/dist/types.mjs +3 -3
- package/package.json +20 -19
- package/src/core/authoring.ts +2 -2
- package/src/core/entity-kinds.ts +2 -2
- package/src/core/migrations/contract-to-postgres-database-schema-node.ts +125 -0
- package/src/core/migrations/diff-database-schema.ts +191 -0
- package/src/core/migrations/issue-planner.ts +1 -1
- package/src/core/migrations/op-factory-call.ts +1 -1
- package/src/core/migrations/operations/rls.ts +1 -1
- package/src/core/migrations/planner.ts +117 -68
- package/src/core/{schema-ir/postgres-schema-ir-annotations.ts → migrations/resolve-ddl-schema.ts} +8 -6
- package/src/core/migrations/runner.ts +13 -16
- package/src/core/migrations/verify-postgres-namespaces.ts +22 -14
- package/src/core/{schema-ir/postgres-rls-policy.ts → postgres-rls-policy.ts} +6 -43
- package/src/core/{schema-ir/postgres-role.ts → postgres-role.ts} +6 -21
- package/src/core/postgres-schema.ts +2 -2
- package/src/core/psl-infer/infer-psl-contract.ts +834 -0
- package/src/core/psl-infer/postgres-default-mapping.ts +16 -0
- package/src/core/psl-infer/postgres-type-map.ts +157 -0
- package/src/core/schema-ir/postgres-database-schema-node.ts +63 -0
- package/src/core/schema-ir/postgres-namespace-schema-node.ts +61 -0
- package/src/core/schema-ir/postgres-policy-schema-node.ts +93 -0
- package/src/core/schema-ir/postgres-role-schema-node.ts +66 -0
- package/src/core/schema-ir/{postgres-table-ir.ts → postgres-table-schema-node.ts} +29 -18
- package/src/core/schema-ir/schema-node-kinds.ts +28 -0
- package/src/exports/control.ts +30 -2
- package/src/exports/planner.ts +2 -5
- package/src/exports/schema-ir-annotations.ts +1 -1
- package/src/exports/types.ts +23 -15
- package/dist/authoring-CZmSQriw.mjs.map +0 -1
- package/dist/issue-planner-C-CwZd8D.mjs.map +0 -1
- package/dist/op-factory-call-DArx_1HM.mjs.map +0 -1
- package/dist/planner-BQ7lSqbm.mjs.map +0 -1
- package/dist/postgres-rls-policy-12wAEQhs.d.mts.map +0 -1
- package/dist/postgres-schema-DJUEkWg-.d.mts.map +0 -1
- package/dist/postgres-schema-DLcc3W2-.mjs.map +0 -1
- package/dist/postgres-schema-ir-BJl_a3J7.d.mts +0 -102
- package/dist/postgres-schema-ir-BJl_a3J7.d.mts.map +0 -1
- package/dist/postgres-schema-ir-I_FiUndw.mjs +0 -133
- package/dist/postgres-schema-ir-I_FiUndw.mjs.map +0 -1
- package/dist/postgres-schema-ir-annotations-BbDSiwx2.mjs +0 -14
- package/dist/postgres-schema-ir-annotations-BbDSiwx2.mjs.map +0 -1
- package/src/core/migrations/contract-to-postgres-schema-ir.ts +0 -91
- package/src/core/migrations/diff-postgres-schema.ts +0 -55
- package/src/core/schema-ir/postgres-schema-ir.ts +0 -138
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { blindCast } from "@prisma-next/utils/casts";
|
|
2
|
+
import { freezeNode } from "@prisma-next/framework-components/ir";
|
|
3
|
+
import { PrimaryKey, SqlCheckConstraintIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIRNode, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
|
|
4
|
+
//#region src/core/schema-ir/schema-node-kinds.ts
|
|
5
|
+
/**
|
|
6
|
+
* The `nodeKind` discriminant for each Postgres schema-diff node. Each node
|
|
7
|
+
* carries a unique value; the static `is`/`assert` guards compare against these
|
|
8
|
+
* identifiers rather than spelling the string inline or using `instanceof`. The
|
|
9
|
+
* field is an enumerable own property carried on every node instance.
|
|
10
|
+
*/
|
|
11
|
+
const PostgresSchemaNodeKind = {
|
|
12
|
+
database: "postgres-database",
|
|
13
|
+
namespace: "postgres-namespace",
|
|
14
|
+
table: "postgres-table",
|
|
15
|
+
policy: "postgres-policy",
|
|
16
|
+
role: "postgres-role"
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/core/schema-ir/postgres-database-schema-node.ts
|
|
20
|
+
/**
|
|
21
|
+
* The root of the Postgres schema-diff tree: one node per database.
|
|
22
|
+
*
|
|
23
|
+
* `id` is the fixed sentinel `'database'` — the root has no siblings and
|
|
24
|
+
* the value is never emitted into migration paths. `isEqualTo` is identity
|
|
25
|
+
* (roots always share the `'database'` id). `children()` returns namespace
|
|
26
|
+
* nodes only; roles are held on the root but not yielded (role diffing is a
|
|
27
|
+
* later slice).
|
|
28
|
+
*/
|
|
29
|
+
var PostgresDatabaseSchemaNode = class PostgresDatabaseSchemaNode extends SqlSchemaIRNode {
|
|
30
|
+
nodeKind = PostgresSchemaNodeKind.database;
|
|
31
|
+
namespaces;
|
|
32
|
+
roles;
|
|
33
|
+
existingSchemas;
|
|
34
|
+
pgVersion;
|
|
35
|
+
constructor(input) {
|
|
36
|
+
super();
|
|
37
|
+
this.namespaces = Object.freeze({ ...input.namespaces });
|
|
38
|
+
this.roles = Object.freeze([...input.roles]);
|
|
39
|
+
this.existingSchemas = Object.freeze([...input.existingSchemas]);
|
|
40
|
+
this.pgVersion = input.pgVersion;
|
|
41
|
+
freezeNode(this);
|
|
42
|
+
}
|
|
43
|
+
get id() {
|
|
44
|
+
return "database";
|
|
45
|
+
}
|
|
46
|
+
isEqualTo(other) {
|
|
47
|
+
return this.id === other.id;
|
|
48
|
+
}
|
|
49
|
+
children() {
|
|
50
|
+
return Object.values(this.namespaces);
|
|
51
|
+
}
|
|
52
|
+
static is(node) {
|
|
53
|
+
return node.nodeKind === PostgresSchemaNodeKind.database;
|
|
54
|
+
}
|
|
55
|
+
static assert(node) {
|
|
56
|
+
if (!PostgresDatabaseSchemaNode.is(node)) throw new Error(`Expected a PostgresDatabaseSchemaNode but got nodeKind=${node.nodeKind ?? "undefined"}`);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/core/schema-ir/postgres-namespace-schema-node.ts
|
|
61
|
+
/**
|
|
62
|
+
* One-per-Postgres-schema diff-tree node. Groups the tables belonging to a
|
|
63
|
+
* single namespace and satisfies the `SqlSchemaIR` shape so legacy per-schema
|
|
64
|
+
* consumers (verifySqlSchema, the relational planner, toSchemaView) can
|
|
65
|
+
* accept it unchanged in Unit 6.
|
|
66
|
+
*
|
|
67
|
+
* `id` is the schema name. `isEqualTo` is identity — two namespace nodes are
|
|
68
|
+
* equal iff their ids (schema names) match. `children()` returns the table
|
|
69
|
+
* nodes. Per-schema metadata is carried on the typed `nativeEnumTypeNames`
|
|
70
|
+
* field, not an annotations bag.
|
|
71
|
+
*/
|
|
72
|
+
var PostgresNamespaceSchemaNode = class PostgresNamespaceSchemaNode extends SqlSchemaIRNode {
|
|
73
|
+
nodeKind = PostgresSchemaNodeKind.namespace;
|
|
74
|
+
schemaName;
|
|
75
|
+
tables;
|
|
76
|
+
nativeEnumTypeNames;
|
|
77
|
+
constructor(input) {
|
|
78
|
+
super();
|
|
79
|
+
this.schemaName = input.schemaName;
|
|
80
|
+
this.tables = Object.freeze({ ...input.tables });
|
|
81
|
+
this.nativeEnumTypeNames = Object.freeze([...input.nativeEnumTypeNames]);
|
|
82
|
+
freezeNode(this);
|
|
83
|
+
}
|
|
84
|
+
get id() {
|
|
85
|
+
return this.schemaName;
|
|
86
|
+
}
|
|
87
|
+
isEqualTo(other) {
|
|
88
|
+
return this.id === other.id;
|
|
89
|
+
}
|
|
90
|
+
children() {
|
|
91
|
+
return Object.values(this.tables);
|
|
92
|
+
}
|
|
93
|
+
static is(node) {
|
|
94
|
+
return node.nodeKind === PostgresSchemaNodeKind.namespace;
|
|
95
|
+
}
|
|
96
|
+
static assert(node) {
|
|
97
|
+
if (!PostgresNamespaceSchemaNode.is(node)) throw new Error(`Expected a PostgresNamespaceSchemaNode but got nodeKind=${node.nodeKind ?? "undefined"}`);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/core/schema-ir/postgres-policy-schema-node.ts
|
|
102
|
+
/**
|
|
103
|
+
* Schema-diff leaf node for a Postgres row-level security policy.
|
|
104
|
+
*
|
|
105
|
+
* This is a derived, transient node walked by the differ — it is NEVER serialized.
|
|
106
|
+
* Built by project-from-contract and project-from-database from their respective
|
|
107
|
+
* `PostgresRlsPolicy` contract entities / introspected rows.
|
|
108
|
+
*
|
|
109
|
+
* `id` is the wire name (`<prefix>_<sha256(body)[0..8]>`), so name-equality is
|
|
110
|
+
* body-equality. `isEqualTo` compares names only — never byte-compare predicate
|
|
111
|
+
* bodies, because Postgres reprints them.
|
|
112
|
+
*/
|
|
113
|
+
var PostgresPolicySchemaNode = class PostgresPolicySchemaNode extends SqlSchemaIRNode {
|
|
114
|
+
nodeKind = PostgresSchemaNodeKind.policy;
|
|
115
|
+
name;
|
|
116
|
+
prefix;
|
|
117
|
+
tableName;
|
|
118
|
+
namespaceId;
|
|
119
|
+
operation;
|
|
120
|
+
roles;
|
|
121
|
+
permissive;
|
|
122
|
+
constructor(input) {
|
|
123
|
+
super();
|
|
124
|
+
this.name = input.name;
|
|
125
|
+
this.prefix = input.prefix;
|
|
126
|
+
this.tableName = input.tableName;
|
|
127
|
+
this.namespaceId = input.namespaceId;
|
|
128
|
+
this.operation = input.operation;
|
|
129
|
+
this.roles = Object.freeze([...input.roles]);
|
|
130
|
+
if (input.using !== void 0) this.using = input.using;
|
|
131
|
+
if (input.withCheck !== void 0) this.withCheck = input.withCheck;
|
|
132
|
+
this.permissive = input.permissive;
|
|
133
|
+
freezeNode(this);
|
|
134
|
+
}
|
|
135
|
+
get id() {
|
|
136
|
+
return this.name;
|
|
137
|
+
}
|
|
138
|
+
children() {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
isEqualTo(other) {
|
|
142
|
+
const node = blindCast(other);
|
|
143
|
+
PostgresPolicySchemaNode.assert(node);
|
|
144
|
+
return this.id === node.id;
|
|
145
|
+
}
|
|
146
|
+
static is(node) {
|
|
147
|
+
return node.nodeKind === PostgresSchemaNodeKind.policy;
|
|
148
|
+
}
|
|
149
|
+
static assert(node) {
|
|
150
|
+
if (node === void 0 || !PostgresPolicySchemaNode.is(node)) throw new Error(`Expected a PostgresPolicySchemaNode but got nodeKind=${node?.nodeKind ?? "undefined"}`);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/core/schema-ir/postgres-role-schema-node.ts
|
|
155
|
+
/**
|
|
156
|
+
* Schema-diff leaf node for a Postgres database role.
|
|
157
|
+
*
|
|
158
|
+
* This is a derived, transient node walked by the differ — it is NEVER serialized.
|
|
159
|
+
* Built by project-from-contract and project-from-database from their respective
|
|
160
|
+
* `PostgresRole` contract entities / introspected rows.
|
|
161
|
+
*
|
|
162
|
+
* Roles are cluster-scoped, so `id` is the role name alone. `isEqualTo` compares
|
|
163
|
+
* names — name-equality is role-equality for cluster-scoped objects.
|
|
164
|
+
*/
|
|
165
|
+
var PostgresRoleSchemaNode = class PostgresRoleSchemaNode extends SqlSchemaIRNode {
|
|
166
|
+
nodeKind = PostgresSchemaNodeKind.role;
|
|
167
|
+
name;
|
|
168
|
+
namespaceId;
|
|
169
|
+
constructor(input) {
|
|
170
|
+
super();
|
|
171
|
+
this.name = input.name;
|
|
172
|
+
this.namespaceId = input.namespaceId;
|
|
173
|
+
freezeNode(this);
|
|
174
|
+
}
|
|
175
|
+
get id() {
|
|
176
|
+
return this.name;
|
|
177
|
+
}
|
|
178
|
+
children() {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
isEqualTo(other) {
|
|
182
|
+
const node = blindCast(other);
|
|
183
|
+
PostgresRoleSchemaNode.assert(node);
|
|
184
|
+
return this.id === node.id;
|
|
185
|
+
}
|
|
186
|
+
static is(node) {
|
|
187
|
+
return node.nodeKind === PostgresSchemaNodeKind.role;
|
|
188
|
+
}
|
|
189
|
+
static assert(node) {
|
|
190
|
+
if (!PostgresRoleSchemaNode.is(node)) throw new Error(`Expected a PostgresRoleSchemaNode but got nodeKind=${node.nodeKind ?? "undefined"}`);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/core/schema-ir/postgres-table-schema-node.ts
|
|
195
|
+
/**
|
|
196
|
+
* Postgres-specific table schema-diff node. Carries all `SqlTableIR` fields
|
|
197
|
+
* plus `policies`, and implements `DiffableNode` so the table instance is
|
|
198
|
+
* directly the diff-tree node — no separate wrapper needed.
|
|
199
|
+
*
|
|
200
|
+
* Extends `SqlSchemaIRNode` directly rather than `SqlTableIR` because
|
|
201
|
+
* `SqlTableIR` calls `freezeNode` in its own constructor, which prevents
|
|
202
|
+
* subclass field initialisation.
|
|
203
|
+
*
|
|
204
|
+
* `id` is the table name. `children()` returns the policy nodes on this table.
|
|
205
|
+
* `isEqualTo` is identity — two table nodes are equal iff their ids (names)
|
|
206
|
+
* match. Columns are not compared here; they become child nodes later.
|
|
207
|
+
*/
|
|
208
|
+
var PostgresTableSchemaNode = class PostgresTableSchemaNode extends SqlSchemaIRNode {
|
|
209
|
+
nodeKind = PostgresSchemaNodeKind.table;
|
|
210
|
+
name;
|
|
211
|
+
columns;
|
|
212
|
+
foreignKeys;
|
|
213
|
+
uniques;
|
|
214
|
+
indexes;
|
|
215
|
+
policies;
|
|
216
|
+
constructor(input) {
|
|
217
|
+
super();
|
|
218
|
+
this.name = input.name;
|
|
219
|
+
this.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));
|
|
220
|
+
this.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));
|
|
221
|
+
this.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));
|
|
222
|
+
this.indexes = Object.freeze(input.indexes.map((i) => i instanceof SqlIndexIR ? i : new SqlIndexIR(i)));
|
|
223
|
+
if (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);
|
|
224
|
+
if (input.annotations !== void 0) this.annotations = input.annotations;
|
|
225
|
+
if (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((c) => c instanceof SqlCheckConstraintIR ? c : new SqlCheckConstraintIR(c)));
|
|
226
|
+
this.policies = Object.freeze([...input.policies ?? []]);
|
|
227
|
+
freezeNode(this);
|
|
228
|
+
}
|
|
229
|
+
get id() {
|
|
230
|
+
return this.name;
|
|
231
|
+
}
|
|
232
|
+
isEqualTo(other) {
|
|
233
|
+
return this.id === other.id;
|
|
234
|
+
}
|
|
235
|
+
children() {
|
|
236
|
+
return this.policies;
|
|
237
|
+
}
|
|
238
|
+
static is(node) {
|
|
239
|
+
return node.nodeKind === PostgresSchemaNodeKind.table;
|
|
240
|
+
}
|
|
241
|
+
static assert(node) {
|
|
242
|
+
if (!PostgresTableSchemaNode.is(node)) throw new Error(`Expected a PostgresTableSchemaNode but got nodeKind=${node.nodeKind ?? "undefined"}`);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
//#endregion
|
|
246
|
+
export { PostgresDatabaseSchemaNode as a, PostgresNamespaceSchemaNode as i, PostgresRoleSchemaNode as n, PostgresPolicySchemaNode as r, PostgresTableSchemaNode as t };
|
|
247
|
+
|
|
248
|
+
//# sourceMappingURL=postgres-table-schema-node-1nNc8XDT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-table-schema-node-1nNc8XDT.mjs","names":[],"sources":["../src/core/schema-ir/schema-node-kinds.ts","../src/core/schema-ir/postgres-database-schema-node.ts","../src/core/schema-ir/postgres-namespace-schema-node.ts","../src/core/schema-ir/postgres-policy-schema-node.ts","../src/core/schema-ir/postgres-role-schema-node.ts","../src/core/schema-ir/postgres-table-schema-node.ts"],"sourcesContent":["import type { DiffableNode } from '@prisma-next/framework-components/control';\nimport type { SqlSchemaIRNode } from '@prisma-next/sql-schema-ir/types';\n\n/**\n * A Postgres schema-diff-tree node: a `SqlSchemaIRNode` that also implements\n * `DiffableNode` (the five `Postgres*SchemaNode` classes). `SqlSchemaIRNode`\n * alone is not a `DiffableNode` — its relational subclasses (`SqlColumnIR`, …)\n * carry no `id`/`isEqualTo`/`children` — so this intersection is the honest node\n * type the differ produces and the planner consumes (`SchemaDiff<SqlSchemaDiffNode>`).\n */\nexport type SqlSchemaDiffNode = SqlSchemaIRNode & DiffableNode;\n\n/**\n * The `nodeKind` discriminant for each Postgres schema-diff node. Each node\n * carries a unique value; the static `is`/`assert` guards compare against these\n * identifiers rather than spelling the string inline or using `instanceof`. The\n * field is an enumerable own property carried on every node instance.\n */\nexport const PostgresSchemaNodeKind = {\n database: 'postgres-database',\n namespace: 'postgres-namespace',\n table: 'postgres-table',\n policy: 'postgres-policy',\n role: 'postgres-role',\n} as const;\n\nexport type PostgresSchemaNodeKind =\n (typeof PostgresSchemaNodeKind)[keyof typeof PostgresSchemaNodeKind];\n","import type { DiffableNode } from '@prisma-next/framework-components/control';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlSchemaIRNode } from '@prisma-next/sql-schema-ir/types';\nimport type { PostgresNamespaceSchemaNode } from './postgres-namespace-schema-node';\nimport type { PostgresRoleSchemaNode } from './postgres-role-schema-node';\nimport { PostgresSchemaNodeKind } from './schema-node-kinds';\n\nexport interface PostgresDatabaseSchemaNodeInput {\n readonly namespaces: Readonly<Record<string, PostgresNamespaceSchemaNode>>;\n readonly roles: readonly PostgresRoleSchemaNode[];\n readonly existingSchemas: readonly string[];\n readonly pgVersion: string;\n}\n\n/**\n * The root of the Postgres schema-diff tree: one node per database.\n *\n * `id` is the fixed sentinel `'database'` — the root has no siblings and\n * the value is never emitted into migration paths. `isEqualTo` is identity\n * (roots always share the `'database'` id). `children()` returns namespace\n * nodes only; roles are held on the root but not yielded (role diffing is a\n * later slice).\n */\nexport class PostgresDatabaseSchemaNode extends SqlSchemaIRNode implements DiffableNode {\n override readonly nodeKind = PostgresSchemaNodeKind.database;\n readonly namespaces: Readonly<Record<string, PostgresNamespaceSchemaNode>>;\n readonly roles: readonly PostgresRoleSchemaNode[];\n readonly existingSchemas: readonly string[];\n readonly pgVersion: string;\n\n constructor(input: PostgresDatabaseSchemaNodeInput) {\n super();\n this.namespaces = Object.freeze({ ...input.namespaces });\n this.roles = Object.freeze([...input.roles]);\n this.existingSchemas = Object.freeze([...input.existingSchemas]);\n this.pgVersion = input.pgVersion;\n freezeNode(this);\n }\n\n get id(): string {\n return 'database';\n }\n\n isEqualTo(other: DiffableNode): boolean {\n return this.id === other.id;\n }\n\n children(): readonly DiffableNode[] {\n return Object.values(this.namespaces);\n }\n\n static is(node: SqlSchemaIRNode): node is PostgresDatabaseSchemaNode {\n return node.nodeKind === PostgresSchemaNodeKind.database;\n }\n\n static assert(node: SqlSchemaIRNode): asserts node is PostgresDatabaseSchemaNode {\n if (!PostgresDatabaseSchemaNode.is(node)) {\n throw new Error(\n `Expected a PostgresDatabaseSchemaNode but got nodeKind=${node.nodeKind ?? 'undefined'}`,\n );\n }\n }\n}\n","import type { DiffableNode } from '@prisma-next/framework-components/control';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlSchemaIRNode } from '@prisma-next/sql-schema-ir/types';\nimport type { PostgresTableSchemaNode } from './postgres-table-schema-node';\nimport { PostgresSchemaNodeKind } from './schema-node-kinds';\n\nexport interface PostgresNamespaceSchemaNodeInput {\n readonly schemaName: string;\n readonly tables: Readonly<Record<string, PostgresTableSchemaNode>>;\n readonly nativeEnumTypeNames: readonly string[];\n}\n\n/**\n * One-per-Postgres-schema diff-tree node. Groups the tables belonging to a\n * single namespace and satisfies the `SqlSchemaIR` shape so legacy per-schema\n * consumers (verifySqlSchema, the relational planner, toSchemaView) can\n * accept it unchanged in Unit 6.\n *\n * `id` is the schema name. `isEqualTo` is identity — two namespace nodes are\n * equal iff their ids (schema names) match. `children()` returns the table\n * nodes. Per-schema metadata is carried on the typed `nativeEnumTypeNames`\n * field, not an annotations bag.\n */\nexport class PostgresNamespaceSchemaNode extends SqlSchemaIRNode implements DiffableNode {\n override readonly nodeKind = PostgresSchemaNodeKind.namespace;\n readonly schemaName: string;\n readonly tables: Readonly<Record<string, PostgresTableSchemaNode>>;\n readonly nativeEnumTypeNames: readonly string[];\n\n constructor(input: PostgresNamespaceSchemaNodeInput) {\n super();\n this.schemaName = input.schemaName;\n this.tables = Object.freeze({ ...input.tables });\n this.nativeEnumTypeNames = Object.freeze([...input.nativeEnumTypeNames]);\n freezeNode(this);\n }\n\n get id(): string {\n return this.schemaName;\n }\n\n isEqualTo(other: DiffableNode): boolean {\n return this.id === other.id;\n }\n\n children(): readonly DiffableNode[] {\n return Object.values(this.tables);\n }\n\n static is(node: SqlSchemaIRNode): node is PostgresNamespaceSchemaNode {\n return node.nodeKind === PostgresSchemaNodeKind.namespace;\n }\n\n static assert(node: SqlSchemaIRNode): asserts node is PostgresNamespaceSchemaNode {\n if (!PostgresNamespaceSchemaNode.is(node)) {\n throw new Error(\n `Expected a PostgresNamespaceSchemaNode but got nodeKind=${node.nodeKind ?? 'undefined'}`,\n );\n }\n }\n}\n","import type { DiffableNode } from '@prisma-next/framework-components/control';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlSchemaIRNode } from '@prisma-next/sql-schema-ir/types';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { RlsPolicyOperation } from '../postgres-rls-policy';\nimport { PostgresSchemaNodeKind } from './schema-node-kinds';\n\nexport interface PostgresPolicySchemaNodeInput {\n /** Full wire name: `<prefix>_<8hex>`. */\n readonly name: string;\n /** User-supplied prefix (the part before the `_<8hex>` suffix). */\n readonly prefix: string;\n /** Name of the table this policy attaches to, by name within the same schema. */\n readonly tableName: string;\n /** Namespace coordinate (schema name). */\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n /** Sorted role names rendered in `TO <roles>`. */\n readonly roles: readonly string[];\n /** USING predicate SQL string, if present. */\n readonly using?: string;\n /** WITH CHECK predicate SQL string, if present. */\n readonly withCheck?: string;\n /** `true` = `AS PERMISSIVE`, `false` = `AS RESTRICTIVE`. */\n readonly permissive: boolean;\n}\n\n/**\n * Schema-diff leaf node for a Postgres row-level security policy.\n *\n * This is a derived, transient node walked by the differ — it is NEVER serialized.\n * Built by project-from-contract and project-from-database from their respective\n * `PostgresRlsPolicy` contract entities / introspected rows.\n *\n * `id` is the wire name (`<prefix>_<sha256(body)[0..8]>`), so name-equality is\n * body-equality. `isEqualTo` compares names only — never byte-compare predicate\n * bodies, because Postgres reprints them.\n */\nexport class PostgresPolicySchemaNode extends SqlSchemaIRNode implements DiffableNode {\n override readonly nodeKind = PostgresSchemaNodeKind.policy;\n readonly name: string;\n readonly prefix: string;\n readonly tableName: string;\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n readonly roles: readonly string[];\n declare readonly using?: string;\n declare readonly withCheck?: string;\n readonly permissive: boolean;\n\n constructor(input: PostgresPolicySchemaNodeInput) {\n super();\n this.name = input.name;\n this.prefix = input.prefix;\n this.tableName = input.tableName;\n this.namespaceId = input.namespaceId;\n this.operation = input.operation;\n this.roles = Object.freeze([...input.roles]);\n if (input.using !== undefined) this.using = input.using;\n if (input.withCheck !== undefined) this.withCheck = input.withCheck;\n this.permissive = input.permissive;\n freezeNode(this);\n }\n\n get id(): string {\n return this.name;\n }\n\n children(): readonly DiffableNode[] {\n return [];\n }\n\n isEqualTo(other: DiffableNode): boolean {\n const node = blindCast<\n SqlSchemaIRNode,\n 'every diff-tree node the differ pairs is a SqlSchemaIRNode; the guard rejects non-policy kinds'\n >(other);\n PostgresPolicySchemaNode.assert(node);\n return this.id === node.id;\n }\n\n static is(node: SqlSchemaIRNode): node is PostgresPolicySchemaNode {\n return node.nodeKind === PostgresSchemaNodeKind.policy;\n }\n\n static assert(node: SqlSchemaIRNode | undefined): asserts node is PostgresPolicySchemaNode {\n if (node === undefined || !PostgresPolicySchemaNode.is(node)) {\n throw new Error(\n `Expected a PostgresPolicySchemaNode but got nodeKind=${node?.nodeKind ?? 'undefined'}`,\n );\n }\n }\n}\n","import type { DiffableNode } from '@prisma-next/framework-components/control';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlSchemaIRNode } from '@prisma-next/sql-schema-ir/types';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { PostgresSchemaNodeKind } from './schema-node-kinds';\n\nexport interface PostgresRoleSchemaNodeInput {\n readonly name: string;\n /**\n * Namespace coordinate. Roles are cluster-scoped; callers pass\n * `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`.\n */\n readonly namespaceId: string;\n}\n\n/**\n * Schema-diff leaf node for a Postgres database role.\n *\n * This is a derived, transient node walked by the differ — it is NEVER serialized.\n * Built by project-from-contract and project-from-database from their respective\n * `PostgresRole` contract entities / introspected rows.\n *\n * Roles are cluster-scoped, so `id` is the role name alone. `isEqualTo` compares\n * names — name-equality is role-equality for cluster-scoped objects.\n */\nexport class PostgresRoleSchemaNode extends SqlSchemaIRNode implements DiffableNode {\n override readonly nodeKind = PostgresSchemaNodeKind.role;\n readonly name: string;\n readonly namespaceId: string;\n\n constructor(input: PostgresRoleSchemaNodeInput) {\n super();\n this.name = input.name;\n this.namespaceId = input.namespaceId;\n freezeNode(this);\n }\n\n get id(): string {\n return this.name;\n }\n\n children(): readonly DiffableNode[] {\n return [];\n }\n\n isEqualTo(other: DiffableNode): boolean {\n const node = blindCast<\n SqlSchemaIRNode,\n 'every diff-tree node the differ pairs is a SqlSchemaIRNode; the guard rejects non-role kinds'\n >(other);\n PostgresRoleSchemaNode.assert(node);\n return this.id === node.id;\n }\n\n static is(node: SqlSchemaIRNode): node is PostgresRoleSchemaNode {\n return node.nodeKind === PostgresSchemaNodeKind.role;\n }\n\n static assert(node: SqlSchemaIRNode): asserts node is PostgresRoleSchemaNode {\n if (!PostgresRoleSchemaNode.is(node)) {\n throw new Error(\n `Expected a PostgresRoleSchemaNode but got nodeKind=${node.nodeKind ?? 'undefined'}`,\n );\n }\n }\n}\n","import type { DiffableNode } from '@prisma-next/framework-components/control';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport {\n PrimaryKey,\n type SqlAnnotations,\n SqlCheckConstraintIR,\n SqlColumnIR,\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIRNode,\n type SqlTableIRInput,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport type { PostgresPolicySchemaNode } from './postgres-policy-schema-node';\nimport { PostgresSchemaNodeKind } from './schema-node-kinds';\n\nexport interface PostgresTableSchemaNodeInput extends SqlTableIRInput {\n readonly policies?: readonly PostgresPolicySchemaNode[];\n}\n\n/**\n * Postgres-specific table schema-diff node. Carries all `SqlTableIR` fields\n * plus `policies`, and implements `DiffableNode` so the table instance is\n * directly the diff-tree node — no separate wrapper needed.\n *\n * Extends `SqlSchemaIRNode` directly rather than `SqlTableIR` because\n * `SqlTableIR` calls `freezeNode` in its own constructor, which prevents\n * subclass field initialisation.\n *\n * `id` is the table name. `children()` returns the policy nodes on this table.\n * `isEqualTo` is identity — two table nodes are equal iff their ids (names)\n * match. Columns are not compared here; they become child nodes later.\n */\nexport class PostgresTableSchemaNode extends SqlSchemaIRNode implements DiffableNode {\n override readonly nodeKind = PostgresSchemaNodeKind.table;\n readonly name: string;\n readonly columns: Readonly<Record<string, SqlColumnIR>>;\n readonly foreignKeys: ReadonlyArray<SqlForeignKeyIR>;\n readonly uniques: ReadonlyArray<SqlUniqueIR>;\n readonly indexes: ReadonlyArray<SqlIndexIR>;\n declare readonly primaryKey?: PrimaryKey;\n declare readonly annotations?: SqlAnnotations;\n declare readonly checks?: ReadonlyArray<SqlCheckConstraintIR>;\n readonly policies: readonly PostgresPolicySchemaNode[];\n\n constructor(input: PostgresTableSchemaNodeInput) {\n super();\n this.name = input.name;\n this.columns = Object.freeze(\n Object.fromEntries(\n Object.entries(input.columns).map(([key, col]) => [\n key,\n col instanceof SqlColumnIR ? col : new SqlColumnIR(col),\n ]),\n ),\n );\n this.foreignKeys = Object.freeze(\n input.foreignKeys.map((fk) => (fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk))),\n );\n this.uniques = Object.freeze(\n input.uniques.map((u) => (u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u))),\n );\n this.indexes = Object.freeze(\n input.indexes.map((i) => (i instanceof SqlIndexIR ? i : new SqlIndexIR(i))),\n );\n if (input.primaryKey !== undefined) {\n this.primaryKey =\n input.primaryKey instanceof PrimaryKey\n ? input.primaryKey\n : new PrimaryKey(input.primaryKey);\n }\n if (input.annotations !== undefined) this.annotations = input.annotations;\n if (input.checks !== undefined && input.checks.length > 0) {\n this.checks = Object.freeze(\n input.checks.map((c) =>\n c instanceof SqlCheckConstraintIR ? c : new SqlCheckConstraintIR(c),\n ),\n );\n }\n this.policies = Object.freeze([...(input.policies ?? [])]);\n freezeNode(this);\n }\n\n get id(): string {\n return this.name;\n }\n\n isEqualTo(other: DiffableNode): boolean {\n return this.id === other.id;\n }\n\n children(): readonly DiffableNode[] {\n return this.policies;\n }\n\n static is(node: SqlSchemaIRNode): node is PostgresTableSchemaNode {\n return node.nodeKind === PostgresSchemaNodeKind.table;\n }\n\n static assert(node: SqlSchemaIRNode): asserts node is PostgresTableSchemaNode {\n if (!PostgresTableSchemaNode.is(node)) {\n throw new Error(\n `Expected a PostgresTableSchemaNode but got nodeKind=${node.nodeKind ?? 'undefined'}`,\n );\n }\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { r as isPostgresSchema } from "./postgres-schema-BLIHBEfX.mjs";
|
|
2
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
3
|
+
//#region src/core/migrations/resolve-ddl-schema.ts
|
|
4
|
+
/**
|
|
5
|
+
* Given the contract's storage and a namespace id, returns the live Postgres
|
|
6
|
+
* DDL schema name that namespace maps to. A named Postgres namespace dispatches
|
|
7
|
+
* to its `ddlSchemaName(storage)`; the unbound sentinel resolves to `public`
|
|
8
|
+
* (the search-path default for offline planning); a bare object payload (used
|
|
9
|
+
* by some tests) falls back to the namespace id itself.
|
|
10
|
+
*/
|
|
11
|
+
function resolveDdlSchemaForNamespaceStorage(storage, namespaceId) {
|
|
12
|
+
if (namespaceId === UNBOUND_NAMESPACE_ID) return "public";
|
|
13
|
+
const namespace = storage.namespaces[namespaceId];
|
|
14
|
+
if (namespace && isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);
|
|
15
|
+
return namespaceId;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { resolveDdlSchemaForNamespaceStorage as t };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=resolve-ddl-schema-CL1RR1mx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-ddl-schema-CL1RR1mx.mjs","names":[],"sources":["../src/core/migrations/resolve-ddl-schema.ts"],"sourcesContent":["import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { isPostgresSchema } from '../postgres-schema';\n\n/**\n * Given the contract's storage and a namespace id, returns the live Postgres\n * DDL schema name that namespace maps to. A named Postgres namespace dispatches\n * to its `ddlSchemaName(storage)`; the unbound sentinel resolves to `public`\n * (the search-path default for offline planning); a bare object payload (used\n * by some tests) falls back to the namespace id itself.\n */\nexport function resolveDdlSchemaForNamespaceStorage(\n storage: SqlStorage,\n namespaceId: string,\n): string {\n if (namespaceId === UNBOUND_NAMESPACE_ID) {\n return 'public';\n }\n const namespace = storage.namespaces[namespaceId];\n if (namespace && isPostgresSchema(namespace)) {\n return namespace.ddlSchemaName(storage);\n }\n return namespaceId;\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,oCACd,SACA,aACQ;CACR,IAAI,gBAAgB,sBAClB,OAAO;CAET,MAAM,YAAY,QAAQ,WAAW;CACrC,IAAI,aAAa,iBAAiB,SAAS,GACzC,OAAO,UAAU,cAAc,OAAO;CAExC,OAAO;AACT"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as postgresTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-UwYdV8fD.mjs";
|
|
2
|
-
import { n as PostgresContractSerializer, t as PostgresContractView } from "./postgres-contract-view-
|
|
2
|
+
import { n as PostgresContractSerializer, t as PostgresContractView } from "./postgres-contract-view-BegduLr6.mjs";
|
|
3
3
|
//#region src/exports/runtime.ts
|
|
4
4
|
/**
|
|
5
5
|
* Target-postgres deliberately does NOT import `SqlRuntimeTargetDescriptor` from `@prisma-next/sql-runtime`. The target package is a control-plane residence and must not pull the SQL execution-plane package into its dependency closure. The runtime descriptor here is shaped to satisfy the framework's `RuntimeTargetDescriptor` plus the structural `SqlStaticContributions` (`codecs:` returning a descriptor list) that
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
2
|
-
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
3
2
|
|
|
4
|
-
//#region src/core/
|
|
5
|
-
|
|
3
|
+
//#region src/core/migrations/resolve-ddl-schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Given the contract's storage and a namespace id, returns the live Postgres
|
|
6
|
+
* DDL schema name that namespace maps to. A named Postgres namespace dispatches
|
|
7
|
+
* to its `ddlSchemaName(storage)`; the unbound sentinel resolves to `public`
|
|
8
|
+
* (the search-path default for offline planning); a bare object payload (used
|
|
9
|
+
* by some tests) falls back to the namespace id itself.
|
|
10
|
+
*/
|
|
11
|
+
declare function resolveDdlSchemaForNamespaceStorage(storage: SqlStorage, namespaceId: string): string;
|
|
6
12
|
//#endregion
|
|
7
13
|
export { resolveDdlSchemaForNamespaceStorage };
|
|
8
14
|
//# sourceMappingURL=schema-ir-annotations.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-ir-annotations.d.mts","names":[],"sources":["../src/core/
|
|
1
|
+
{"version":3,"file":"schema-ir-annotations.d.mts","names":[],"sources":["../src/core/migrations/resolve-ddl-schema.ts"],"mappings":";;;;;AAWA;;;;;iBAAgB,mCAAA,CACd,OAAA,EAAS,UAAU,EACnB,WAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as resolveDdlSchemaForNamespaceStorage } from "./
|
|
1
|
+
import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-CL1RR1mx.mjs";
|
|
2
2
|
export { resolveDdlSchemaForNamespaceStorage };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as PostgresRlsPolicyInput, r as RlsPolicyOperation, t as PostgresRlsPolicy } from "./postgres-rls-policy
|
|
1
|
+
import { n as PostgresRlsPolicyInput, r as RlsPolicyOperation, t as PostgresRlsPolicy } from "./postgres-rls-policy--CSddvMR.mjs";
|
|
2
2
|
import { t as PostgresColumnDefault } from "./types-BDKkx8MA.mjs";
|
|
3
|
-
import { a as postgresCreateNamespace, i as isPostgresSchema, n as PostgresSchema, o as PostgresRole, r as PostgresUnboundSchema, s as PostgresRoleInput, t as PostgresContract } from "./postgres-schema-
|
|
4
|
-
import { a as
|
|
5
|
-
export { type PostgresColumnDefault, type PostgresContract,
|
|
3
|
+
import { a as postgresCreateNamespace, i as isPostgresSchema, n as PostgresSchema, o as PostgresRole, r as PostgresUnboundSchema, s as PostgresRoleInput, t as PostgresContract } from "./postgres-schema-BywoeKlt.mjs";
|
|
4
|
+
import { a as PostgresNamespaceSchemaNode, c as PostgresTableSchemaNodeInput, i as PostgresRoleSchemaNodeInput, l as PostgresPolicySchemaNode, n as PostgresDatabaseSchemaNodeInput, o as PostgresNamespaceSchemaNodeInput, r as PostgresRoleSchemaNode, s as PostgresTableSchemaNode, t as PostgresDatabaseSchemaNode, u as PostgresPolicySchemaNodeInput } from "./postgres-database-schema-node-os8ogEap.mjs";
|
|
5
|
+
export { type PostgresColumnDefault, type PostgresContract, PostgresDatabaseSchemaNode, type PostgresDatabaseSchemaNodeInput, PostgresNamespaceSchemaNode, type PostgresNamespaceSchemaNodeInput, PostgresPolicySchemaNode, type PostgresPolicySchemaNodeInput, PostgresRlsPolicy, type PostgresRlsPolicyInput, PostgresRole, type PostgresRoleInput, PostgresRoleSchemaNode, type PostgresRoleSchemaNodeInput, PostgresSchema, PostgresTableSchemaNode, type PostgresTableSchemaNodeInput, PostgresUnboundSchema, type RlsPolicyOperation, isPostgresSchema, postgresCreateNamespace };
|
package/dist/types.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
export {
|
|
1
|
+
import { d as PostgresRlsPolicy, i as postgresCreateNamespace, n as PostgresUnboundSchema, r as isPostgresSchema, t as PostgresSchema, u as PostgresRole } from "./postgres-schema-BLIHBEfX.mjs";
|
|
2
|
+
import { a as PostgresDatabaseSchemaNode, i as PostgresNamespaceSchemaNode, n as PostgresRoleSchemaNode, r as PostgresPolicySchemaNode, t as PostgresTableSchemaNode } from "./postgres-table-schema-node-1nNc8XDT.mjs";
|
|
3
|
+
export { PostgresDatabaseSchemaNode, PostgresNamespaceSchemaNode, PostgresPolicySchemaNode, PostgresRlsPolicy, PostgresRole, PostgresRoleSchemaNode, PostgresSchema, PostgresTableSchemaNode, PostgresUnboundSchema, isPostgresSchema, postgresCreateNamespace };
|
package/package.json
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/target-postgres",
|
|
3
|
-
"version": "0.14.0-dev.
|
|
3
|
+
"version": "0.14.0-dev.40",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "Postgres target pack for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/cli": "0.14.0-dev.
|
|
10
|
-
"@prisma-next/contract": "0.14.0-dev.
|
|
11
|
-
"@prisma-next/errors": "0.14.0-dev.
|
|
12
|
-
"@prisma-next/family-sql": "0.14.0-dev.
|
|
13
|
-
"@prisma-next/framework-components": "0.14.0-dev.
|
|
14
|
-
"@prisma-next/migration-tools": "0.14.0-dev.
|
|
15
|
-
"@prisma-next/
|
|
16
|
-
"@prisma-next/sql-
|
|
17
|
-
"@prisma-next/sql-
|
|
18
|
-
"@prisma-next/sql-
|
|
19
|
-
"@prisma-next/sql-
|
|
20
|
-
"@prisma-next/
|
|
21
|
-
"@prisma-next/utils": "0.14.0-dev.
|
|
9
|
+
"@prisma-next/cli": "0.14.0-dev.40",
|
|
10
|
+
"@prisma-next/contract": "0.14.0-dev.40",
|
|
11
|
+
"@prisma-next/errors": "0.14.0-dev.40",
|
|
12
|
+
"@prisma-next/family-sql": "0.14.0-dev.40",
|
|
13
|
+
"@prisma-next/framework-components": "0.14.0-dev.40",
|
|
14
|
+
"@prisma-next/migration-tools": "0.14.0-dev.40",
|
|
15
|
+
"@prisma-next/sql-contract": "0.14.0-dev.40",
|
|
16
|
+
"@prisma-next/sql-errors": "0.14.0-dev.40",
|
|
17
|
+
"@prisma-next/sql-operations": "0.14.0-dev.40",
|
|
18
|
+
"@prisma-next/sql-relational-core": "0.14.0-dev.40",
|
|
19
|
+
"@prisma-next/sql-schema-ir": "0.14.0-dev.40",
|
|
20
|
+
"@prisma-next/ts-render": "0.14.0-dev.40",
|
|
21
|
+
"@prisma-next/utils": "0.14.0-dev.40",
|
|
22
22
|
"@standard-schema/spec": "^1.1.0",
|
|
23
23
|
"arktype": "^2.2.0",
|
|
24
24
|
"pathe": "^2.0.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@prisma-next/psl-parser": "0.14.0-dev.
|
|
28
|
-
"@prisma-next/
|
|
29
|
-
"@prisma-next/
|
|
30
|
-
"@prisma-next/
|
|
31
|
-
"@prisma-next/
|
|
27
|
+
"@prisma-next/psl-parser": "0.14.0-dev.40",
|
|
28
|
+
"@prisma-next/psl-printer": "0.14.0-dev.40",
|
|
29
|
+
"@prisma-next/sql-contract-psl": "0.14.0-dev.40",
|
|
30
|
+
"@prisma-next/test-utils": "0.14.0-dev.40",
|
|
31
|
+
"@prisma-next/tsconfig": "0.14.0-dev.40",
|
|
32
|
+
"@prisma-next/tsdown": "0.14.0-dev.40",
|
|
32
33
|
"tsdown": "0.22.1",
|
|
33
34
|
"typescript": "5.9.3",
|
|
34
35
|
"vitest": "4.1.8"
|
package/src/core/authoring.ts
CHANGED
|
@@ -7,10 +7,10 @@ import type {
|
|
|
7
7
|
AuthoringTypeNamespace,
|
|
8
8
|
PslExtensionBlock,
|
|
9
9
|
} from '@prisma-next/framework-components/authoring';
|
|
10
|
+
import { PostgresRlsPolicy } from './postgres-rls-policy';
|
|
11
|
+
import { PostgresRole, type PostgresRoleInput } from './postgres-role';
|
|
10
12
|
import { PostgresRlsPolicySchema, PostgresRoleSchema } from './postgres-validators';
|
|
11
13
|
import { computeContentHash, normalizePredicate } from './rls/canonicalize';
|
|
12
|
-
import { PostgresRlsPolicy } from './schema-ir/postgres-rls-policy';
|
|
13
|
-
import { PostgresRole, type PostgresRoleInput } from './schema-ir/postgres-role';
|
|
14
14
|
|
|
15
15
|
export const postgresAuthoringTypes = {} as const satisfies AuthoringTypeNamespace;
|
|
16
16
|
|
package/src/core/entity-kinds.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EntityKindDescriptor } from '@prisma-next/framework-components/ir';
|
|
2
|
+
import { PostgresRlsPolicy, type PostgresRlsPolicyInput } from './postgres-rls-policy';
|
|
3
|
+
import { PostgresRole, type PostgresRoleInput } from './postgres-role';
|
|
2
4
|
import { PostgresRlsPolicySchema, PostgresRoleSchema } from './postgres-validators';
|
|
3
|
-
import { PostgresRlsPolicy, type PostgresRlsPolicyInput } from './schema-ir/postgres-rls-policy';
|
|
4
|
-
import { PostgresRole, type PostgresRoleInput } from './schema-ir/postgres-role';
|
|
5
5
|
|
|
6
6
|
export const policyEntityKind: EntityKindDescriptor<PostgresRlsPolicyInput, PostgresRlsPolicy> = {
|
|
7
7
|
kind: 'policy',
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { ContractToSchemaIROptions } from '@prisma-next/family-sql/control';
|
|
2
|
+
import { contractNamespaceToSchemaIR } from '@prisma-next/family-sql/control';
|
|
3
|
+
import { ifDefined } from '@prisma-next/utils/defined';
|
|
4
|
+
import type { PostgresRlsPolicy } from '../postgres-rls-policy';
|
|
5
|
+
import type { PostgresContract } from '../postgres-schema';
|
|
6
|
+
import { isPostgresSchema } from '../postgres-schema';
|
|
7
|
+
import { PostgresDatabaseSchemaNode } from '../schema-ir/postgres-database-schema-node';
|
|
8
|
+
import { PostgresNamespaceSchemaNode } from '../schema-ir/postgres-namespace-schema-node';
|
|
9
|
+
import { PostgresPolicySchemaNode } from '../schema-ir/postgres-policy-schema-node';
|
|
10
|
+
import { PostgresRoleSchemaNode } from '../schema-ir/postgres-role-schema-node';
|
|
11
|
+
import { PostgresTableSchemaNode } from '../schema-ir/postgres-table-schema-node';
|
|
12
|
+
import { resolveDdlSchemaForNamespaceStorage } from './resolve-ddl-schema';
|
|
13
|
+
|
|
14
|
+
function toPolicyNode(policy: PostgresRlsPolicy, namespaceId: string): PostgresPolicySchemaNode {
|
|
15
|
+
return new PostgresPolicySchemaNode({
|
|
16
|
+
name: policy.name,
|
|
17
|
+
prefix: policy.prefix,
|
|
18
|
+
tableName: policy.tableName,
|
|
19
|
+
namespaceId,
|
|
20
|
+
operation: policy.operation,
|
|
21
|
+
roles: [...policy.roles],
|
|
22
|
+
...ifDefined('using', policy.using),
|
|
23
|
+
...ifDefined('withCheck', policy.withCheck),
|
|
24
|
+
permissive: policy.permissive,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Projects a Postgres contract into the expected schema-diff tree: a
|
|
30
|
+
* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`
|
|
31
|
+
* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with
|
|
32
|
+
* their `PostgresPolicySchemaNode`s, plus the database roles on the root.
|
|
33
|
+
*
|
|
34
|
+
* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,
|
|
35
|
+
* single `{ tables }` map (and throws on cross-namespace name collisions, with
|
|
36
|
+
* no RLS/role concept) for SQLite's single-schema world. This is the
|
|
37
|
+
* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.
|
|
38
|
+
* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)
|
|
39
|
+
* for column/FK/index building and only adds the Postgres tree/policy/role shape.
|
|
40
|
+
*
|
|
41
|
+
* Tables are grouped by their owning namespace (resolved DDL schema name) so
|
|
42
|
+
* the tree mirrors Postgres's object hierarchy. The DDL schema name is
|
|
43
|
+
* resolved once per namespace.
|
|
44
|
+
*
|
|
45
|
+
* A policy that references a table absent from its namespace is a malformed
|
|
46
|
+
* contract — the loop throws rather than fabricating a stub table.
|
|
47
|
+
*/
|
|
48
|
+
export function contractToPostgresDatabaseSchemaNode(
|
|
49
|
+
contract: PostgresContract | null,
|
|
50
|
+
options: ContractToSchemaIROptions,
|
|
51
|
+
): PostgresDatabaseSchemaNode {
|
|
52
|
+
if (contract === null) {
|
|
53
|
+
return new PostgresDatabaseSchemaNode({
|
|
54
|
+
namespaces: {},
|
|
55
|
+
roles: [],
|
|
56
|
+
existingSchemas: [],
|
|
57
|
+
pgVersion: '',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const namespaces: Record<string, PostgresNamespaceSchemaNode> = {};
|
|
62
|
+
const roles: PostgresRoleSchemaNode[] = [];
|
|
63
|
+
const ownedSchemas: string[] = [];
|
|
64
|
+
|
|
65
|
+
for (const ns of Object.values(contract.storage.namespaces)) {
|
|
66
|
+
if (!isPostgresSchema(ns)) continue;
|
|
67
|
+
const ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);
|
|
68
|
+
ownedSchemas.push(ddlSchema);
|
|
69
|
+
|
|
70
|
+
// Convert only THIS namespace's tables (passing the full storage for
|
|
71
|
+
// type/value-set/enum resolution that spans namespaces), so the same table
|
|
72
|
+
// name can exist in two schemas without colliding in a bare-keyed record.
|
|
73
|
+
const sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;
|
|
74
|
+
|
|
75
|
+
const policiesByTable = new Map<string, PostgresPolicySchemaNode[]>();
|
|
76
|
+
for (const policy of Object.values(ns.policy)) {
|
|
77
|
+
const list = policiesByTable.get(policy.tableName) ?? [];
|
|
78
|
+
list.push(toPolicyNode(policy, ddlSchema));
|
|
79
|
+
policiesByTable.set(policy.tableName, list);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const tables: Record<string, PostgresTableSchemaNode> = {};
|
|
83
|
+
for (const tableName of Object.keys(ns.table)) {
|
|
84
|
+
const sqlTable = sqlTables[tableName];
|
|
85
|
+
if (sqlTable === undefined) continue;
|
|
86
|
+
tables[tableName] = new PostgresTableSchemaNode({
|
|
87
|
+
name: sqlTable.name,
|
|
88
|
+
columns: sqlTable.columns,
|
|
89
|
+
foreignKeys: sqlTable.foreignKeys,
|
|
90
|
+
uniques: sqlTable.uniques,
|
|
91
|
+
indexes: sqlTable.indexes,
|
|
92
|
+
...ifDefined('primaryKey', sqlTable.primaryKey),
|
|
93
|
+
...ifDefined('annotations', sqlTable.annotations),
|
|
94
|
+
...ifDefined('checks', sqlTable.checks),
|
|
95
|
+
policies: policiesByTable.get(tableName) ?? [],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
for (const [tableName, tablePolicies] of policiesByTable) {
|
|
100
|
+
if (!(tableName in tables)) {
|
|
101
|
+
const policyName = tablePolicies[0]?.name ?? '(unknown)';
|
|
102
|
+
throw new Error(
|
|
103
|
+
`contract-to-postgres-database-schema-node: policy "${policyName}" references table "${tableName}" not present in namespace "${ddlSchema}"`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
namespaces[ddlSchema] = new PostgresNamespaceSchemaNode({
|
|
109
|
+
schemaName: ddlSchema,
|
|
110
|
+
tables,
|
|
111
|
+
nativeEnumTypeNames: [],
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
for (const role of Object.values(ns.role)) {
|
|
115
|
+
roles.push(new PostgresRoleSchemaNode({ name: role.name, namespaceId: role.namespaceId }));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return new PostgresDatabaseSchemaNode({
|
|
120
|
+
namespaces,
|
|
121
|
+
roles,
|
|
122
|
+
existingSchemas: ownedSchemas,
|
|
123
|
+
pgVersion: '',
|
|
124
|
+
});
|
|
125
|
+
}
|