@prisma/orm-target-postgres 8.0.0-rc.20-dev.1 → 8.0.0-rc.20-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/adapter__runtime.mjs +1 -1
  2. package/dist/{authoring-SbdvmVJh-nQ7YliD_.mjs → authoring-P5nKuHp1-DPQfTSM8.mjs} +3 -6
  3. package/dist/{authoring-SbdvmVJh-nQ7YliD_.mjs.map → authoring-P5nKuHp1-DPQfTSM8.mjs.map} +1 -1
  4. package/dist/{control-CQEjh4P7.d.mts → control-BH4LNVQK.d.mts} +2 -2
  5. package/dist/control-BH4LNVQK.d.mts.map +1 -0
  6. package/dist/{control-DZQwENIP.mjs → control-CYMqxaFZ.mjs} +8 -8
  7. package/dist/control-CYMqxaFZ.mjs.map +1 -0
  8. package/dist/{descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs → descriptor-meta-15Dhylpt-BlJRsuMJ.mjs} +3 -3
  9. package/dist/{descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs.map → descriptor-meta-15Dhylpt-BlJRsuMJ.mjs.map} +1 -1
  10. package/dist/driver.d.mts +2 -2
  11. package/dist/driver.mjs +2 -2
  12. package/dist/driver__control.d.mts +1 -1
  13. package/dist/driver__control.mjs +1 -1
  14. package/dist/driver__runtime.d.mts +1 -1
  15. package/dist/driver__runtime.mjs +1 -1
  16. package/dist/{infer-psl-contract-BSSHcuRi-ChdFSviw.mjs → infer-psl-contract-CdGGwxP3-JfIJ81cu.mjs} +3 -3
  17. package/dist/{infer-psl-contract-BSSHcuRi-ChdFSviw.mjs.map → infer-psl-contract-CdGGwxP3-JfIJ81cu.mjs.map} +1 -1
  18. package/dist/migration-Be_iuIpn.mjs.map +1 -1
  19. package/dist/{planner-VuR6URu3-CCUT2Osx.mjs → planner-BYD9uL95-BYETKJX3.mjs} +4 -4
  20. package/dist/{planner-VuR6URu3-CCUT2Osx.mjs.map → planner-BYD9uL95-BYETKJX3.mjs.map} +1 -1
  21. package/dist/{planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs → planner-produced-postgres-migration-BFJVBalB-DoWrL1oX.mjs} +3 -3
  22. package/dist/{planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs.map → planner-produced-postgres-migration-BFJVBalB-DoWrL1oX.mjs.map} +1 -1
  23. package/dist/{postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs → postgres-contract-view-DgBsbRyj-CWrgmyHg.mjs} +3 -3
  24. package/dist/{postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs.map → postgres-contract-view-DgBsbRyj-CWrgmyHg.mjs.map} +1 -1
  25. package/dist/{postgres-migration-BSWmeRLo-CUfVTUf0.mjs → postgres-migration-DG6SF-aU-DjRMnDmA.mjs} +3 -3
  26. package/dist/{postgres-migration-BSWmeRLo-CUfVTUf0.mjs.map → postgres-migration-DG6SF-aU-DjRMnDmA.mjs.map} +1 -1
  27. package/dist/{prisma7-binding-BjiLA9F7.mjs → prisma7-binding-VHjZ983n.mjs} +4 -4
  28. package/dist/{prisma7-binding-BjiLA9F7.mjs.map → prisma7-binding-VHjZ983n.mjs.map} +1 -1
  29. package/dist/{runtime-CXfxy5ED.mjs → runtime-B1WvyyiV.mjs} +121 -66
  30. package/dist/runtime-B1WvyyiV.mjs.map +1 -0
  31. package/dist/{runtime-C0VXuM0b.d.mts → runtime-OMKUJYSn.d.mts} +9 -3
  32. package/dist/runtime-OMKUJYSn.d.mts.map +1 -0
  33. package/dist/server-text-types-DiGLNzzU-DZ13qVS2.mjs +221 -0
  34. package/dist/server-text-types-DiGLNzzU-DZ13qVS2.mjs.map +1 -0
  35. package/dist/target.mjs +6 -6
  36. package/dist/target__control.mjs +36 -14
  37. package/dist/target__control.mjs.map +1 -1
  38. package/dist/target__migration.mjs +1 -1
  39. package/dist/target__pack.mjs +1 -1
  40. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  41. package/dist/target__planner.mjs +1 -1
  42. package/dist/target__prisma7-binding.mjs +1 -1
  43. package/dist/target__runtime.mjs +2 -2
  44. package/dist/target__runtime.mjs.map +1 -1
  45. package/package.json +9 -9
  46. package/dist/control-CQEjh4P7.d.mts.map +0 -1
  47. package/dist/control-DZQwENIP.mjs.map +0 -1
  48. package/dist/runtime-C0VXuM0b.d.mts.map +0 -1
  49. package/dist/runtime-CXfxy5ED.mjs.map +0 -1
  50. package/dist/server-text-types-DeNPQpv5-DqX0h8WF.mjs +0 -163
  51. package/dist/server-text-types-DeNPQpv5-DqX0h8WF.mjs.map +0 -1
@@ -0,0 +1,221 @@
1
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
2
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
+ import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
4
+ import { types } from "pg";
5
+ //#region ../../../3-targets/postgres/3-driver/dist/server-text-types-DiGLNzzU.mjs
6
+ const postgresDriverDescriptorMeta = {
7
+ kind: "driver",
8
+ familyId: "sql",
9
+ targetId: "postgres",
10
+ id: "postgres",
11
+ version: "0.0.1",
12
+ capabilities: {}
13
+ };
14
+ const watchedClients = /* @__PURE__ */ new WeakSet();
15
+ const lostClients = /* @__PURE__ */ new WeakSet();
16
+ /**
17
+ * Records when a pg client emits `error` or `end`. pg emits both before the failed query's
18
+ * promise rejects, so a caller handling that rejection already sees the loss.
19
+ */
20
+ function watchClientLoss(client) {
21
+ if (!watchedClients.has(client)) {
22
+ watchedClients.add(client);
23
+ const markLost = () => lostClients.add(client);
24
+ client.on("error", markLost);
25
+ client.on("end", markLost);
26
+ }
27
+ return client;
28
+ }
29
+ /**
30
+ * Whether a client can no longer run queries: it emitted `error` or `end` while watched, a driver
31
+ * gave up on it, or pg's own state says it was ended or broke before the driver saw it.
32
+ */
33
+ function hasLostConnection(client) {
34
+ return lostClients.has(client) || hasEndedOrBroken(client);
35
+ }
36
+ /** Records that a driver gave up on a client it does not own, so no driver uses it again. */
37
+ function markClientAbandoned(client) {
38
+ lostClients.add(client);
39
+ }
40
+ /** Whether a pg `Client` has connected or begun connecting. */
41
+ function hasStartedConnecting(client) {
42
+ return "_connected" in client && client._connected === true || "_connecting" in client && client._connecting === true;
43
+ }
44
+ /** Whether a pg client was ended (`end()` was called) or broke (`error` made it unqueryable). */
45
+ function hasEndedOrBroken(client) {
46
+ return "_ending" in client && client._ending === true || "_queryable" in client && client._queryable === false;
47
+ }
48
+ const NODE_CONNECTION_CODES = /* @__PURE__ */ new Map([
49
+ ["ECONNRESET", true],
50
+ ["ETIMEDOUT", true],
51
+ ["EPIPE", true],
52
+ ["EAI_AGAIN", true],
53
+ ["ECONNREFUSED", false],
54
+ ["ENOTFOUND", false],
55
+ ["EHOSTUNREACH", false]
56
+ ]);
57
+ const TRANSIENT_CLASS_08_SQLSTATES = /* @__PURE__ */ new Set([
58
+ "08000",
59
+ "08001",
60
+ "08003",
61
+ "08006"
62
+ ]);
63
+ /**
64
+ * SQLSTATEs outside class 08 that mean the server ended the session, and whether a retry on a
65
+ * fresh connection can succeed. It cannot after 57P04, whose database is gone, nor after 25P03,
66
+ * which ends a session inside an open transaction.
67
+ */
68
+ const SESSION_ENDED_SQLSTATES = /* @__PURE__ */ new Map([
69
+ ["57P01", true],
70
+ ["57P02", true],
71
+ ["57P03", true],
72
+ ["57P04", false],
73
+ ["57P05", true],
74
+ ["25P03", false]
75
+ ]);
76
+ /** Whether a retry can succeed, for a SQLSTATE that means the connection failed; undefined for any other. */
77
+ function connectionSqlStateTransience(sqlState) {
78
+ if (sqlState.startsWith("08")) return TRANSIENT_CLASS_08_SQLSTATES.has(sqlState);
79
+ return SESSION_ENDED_SQLSTATES.get(sqlState);
80
+ }
81
+ /**
82
+ * PostgreSQL-specific error properties that indicate an error originated from pg library.
83
+ * These properties are not present on Node.js system errors.
84
+ * Excludes generic properties like 'detail', 'file', 'line', and 'position' that could appear on any error.
85
+ */
86
+ const PG_ERROR_PROPERTIES = [
87
+ "constraint",
88
+ "table",
89
+ "column",
90
+ "hint",
91
+ "internalPosition",
92
+ "internalQuery",
93
+ "where",
94
+ "schema",
95
+ "routine"
96
+ ];
97
+ /**
98
+ * Type predicate to check if an error is a Postgres error from the pg library.
99
+ *
100
+ * Distinguishes pg library errors from Node.js system errors by checking for:
101
+ * - SQLSTATE codes (5-character alphanumeric codes like '23505', '42601')
102
+ * - pg-specific properties (constraint, table, column, hint, etc.) that Node.js errors don't have
103
+ *
104
+ * Node.js system errors (ECONNREFUSED, ETIMEDOUT, etc.) are excluded to prevent false positives.
105
+ */
106
+ function isPostgresError(error) {
107
+ if (!(error instanceof Error)) return false;
108
+ const pgError = error;
109
+ if (pgError.code && isPostgresSqlState(pgError.code)) return true;
110
+ return PG_ERROR_PROPERTIES.some((prop) => pgError[prop] !== void 0);
111
+ }
112
+ /**
113
+ * Checks if an error code is a Postgres SQLSTATE (5-character alphanumeric code).
114
+ * SQLSTATE codes are standardized SQL error codes (e.g., '23505' for unique violation).
115
+ */
116
+ function isPostgresSqlState(code) {
117
+ if (!code) return false;
118
+ return /^[A-Z0-9]{5}$/.test(code);
119
+ }
120
+ /**
121
+ * Normalizes a Postgres error into a SQL-shared error type, from its code alone.
122
+ *
123
+ * - Connection SQLSTATEs (class `08`, and those that end the session) and Node socket codes → SqlConnectionError
124
+ * - Other SQLSTATEs → SqlQueryError
125
+ * - Errors already normalized, and errors without a recognized code → returned as-is
126
+ *
127
+ * pg raises some connection failures ("Connection terminated", "timeout expired") as plain
128
+ * errors with no code; {@link normalizePgConnectFailure} classifies those where the caller
129
+ * knows the connection failed.
130
+ */
131
+ function normalizePgErrorByCode(error) {
132
+ if (!(error instanceof Error)) return new Error(String(error));
133
+ if (SqlQueryError.is(error) || SqlConnectionError.is(error)) return error;
134
+ const pgError = blindCast(error);
135
+ const code = pgError.code;
136
+ if (code === void 0) return error;
137
+ const transient = NODE_CONNECTION_CODES.get(code);
138
+ if (transient !== void 0) return new SqlConnectionError(error.message, {
139
+ cause: error,
140
+ transient
141
+ });
142
+ if (isPostgresSqlState(code)) {
143
+ const connectionTransience = connectionSqlStateTransience(code);
144
+ if (connectionTransience !== void 0) return new SqlConnectionError(error.message, {
145
+ cause: error,
146
+ transient: connectionTransience,
147
+ sqlState: code
148
+ });
149
+ return new SqlQueryError(error.message, {
150
+ cause: error,
151
+ sqlState: code,
152
+ ...ifDefined("constraint", pgError.constraint),
153
+ ...ifDefined("table", pgError.table),
154
+ ...ifDefined("column", pgError.column),
155
+ ...ifDefined("detail", pgError.detail)
156
+ });
157
+ }
158
+ return error;
159
+ }
160
+ /**
161
+ * Normalizes an error the caller knows is a connection failure: it came from a `connect()`
162
+ * call, or arrived after the client emitted `error` or `end`. Errors with a SQLSTATE keep
163
+ * their code-based classification; everything else becomes a SqlConnectionError.
164
+ */
165
+ function normalizePgConnectFailure(error) {
166
+ const normalized = normalizePgErrorByCode(error);
167
+ if (SqlQueryError.is(normalized) || SqlConnectionError.is(normalized)) return normalized;
168
+ return new SqlConnectionError(normalized.message, { cause: normalized });
169
+ }
170
+ /**
171
+ * Normalizes an error from a query on `client`. pg raises the failures of a dead connection
172
+ * ("Connection terminated", "not queryable") with no code, so once the client has emitted
173
+ * `error` or `end` its errors are connection errors.
174
+ */
175
+ function normalizePgClientError(client, error) {
176
+ return hasLostConnection(client) ? normalizePgConnectFailure(error) : normalizePgErrorByCode(error);
177
+ }
178
+ const PG_TYPES_ARRAY_OIDS = /* @__PURE__ */ new Set([
179
+ 651,
180
+ 791,
181
+ 199,
182
+ 1e3,
183
+ 1001,
184
+ 1005,
185
+ 1007,
186
+ 1008,
187
+ 1009,
188
+ 1014,
189
+ 1015,
190
+ 1016,
191
+ 1017,
192
+ 1021,
193
+ 1022,
194
+ 1028,
195
+ 1040,
196
+ 1041,
197
+ 1115,
198
+ 1182,
199
+ 1183,
200
+ 1185,
201
+ 1187,
202
+ 1231,
203
+ 1270,
204
+ 2951,
205
+ 3807,
206
+ 3907
207
+ ]);
208
+ function pgTypeParser(oid, format) {
209
+ return blindCast(types.getTypeParser)(oid, format);
210
+ }
211
+ function serverText(value) {
212
+ return value;
213
+ }
214
+ const serverTextTypes = { getTypeParser: () => serverText };
215
+ const controlTextTypes = { getTypeParser(oid, format) {
216
+ return PG_TYPES_ARRAY_OIDS.has(oid) ? serverText : pgTypeParser(oid, format);
217
+ } };
218
+ //#endregion
219
+ export { markClientAbandoned as a, postgresDriverDescriptorMeta as c, isPostgresError as i, serverTextTypes as l, hasLostConnection as n, normalizePgClientError as o, hasStartedConnecting as r, normalizePgConnectFailure as s, controlTextTypes as t, watchClientLoss as u };
220
+
221
+ //# sourceMappingURL=server-text-types-DiGLNzzU-DZ13qVS2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-text-types-DiGLNzzU-DZ13qVS2.mjs","names":[],"sources":["../../../../3-targets/postgres/3-driver/dist/server-text-types-DiGLNzzU.mjs"],"sourcesContent":["import { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { types } from \"pg\";\n//#region src/core/descriptor-meta.ts\nconst postgresDriverDescriptorMeta = {\n\tkind: \"driver\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tid: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: {}\n};\n//#endregion\n//#region src/pg-client-state.ts\nconst watchedClients = /* @__PURE__ */ new WeakSet();\nconst lostClients = /* @__PURE__ */ new WeakSet();\n/**\n* Records when a pg client emits `error` or `end`. pg emits both before the failed query's\n* promise rejects, so a caller handling that rejection already sees the loss.\n*/\nfunction watchClientLoss(client) {\n\tif (!watchedClients.has(client)) {\n\t\twatchedClients.add(client);\n\t\tconst markLost = () => lostClients.add(client);\n\t\tclient.on(\"error\", markLost);\n\t\tclient.on(\"end\", markLost);\n\t}\n\treturn client;\n}\n/**\n* Whether a client can no longer run queries: it emitted `error` or `end` while watched, a driver\n* gave up on it, or pg's own state says it was ended or broke before the driver saw it.\n*/\nfunction hasLostConnection(client) {\n\treturn lostClients.has(client) || hasEndedOrBroken(client);\n}\n/** Records that a driver gave up on a client it does not own, so no driver uses it again. */\nfunction markClientAbandoned(client) {\n\tlostClients.add(client);\n}\n/** Whether a pg `Client` has connected or begun connecting. */\nfunction hasStartedConnecting(client) {\n\treturn \"_connected\" in client && client._connected === true || \"_connecting\" in client && client._connecting === true;\n}\n/** Whether a pg client was ended (`end()` was called) or broke (`error` made it unqueryable). */\nfunction hasEndedOrBroken(client) {\n\treturn \"_ending\" in client && client._ending === true || \"_queryable\" in client && client._queryable === false;\n}\n//#endregion\n//#region src/normalize-error.ts\nconst NODE_CONNECTION_CODES = /* @__PURE__ */ new Map([\n\t[\"ECONNRESET\", true],\n\t[\"ETIMEDOUT\", true],\n\t[\"EPIPE\", true],\n\t[\"EAI_AGAIN\", true],\n\t[\"ECONNREFUSED\", false],\n\t[\"ENOTFOUND\", false],\n\t[\"EHOSTUNREACH\", false]\n]);\nconst TRANSIENT_CLASS_08_SQLSTATES = /* @__PURE__ */ new Set([\n\t\"08000\",\n\t\"08001\",\n\t\"08003\",\n\t\"08006\"\n]);\n/**\n* SQLSTATEs outside class 08 that mean the server ended the session, and whether a retry on a\n* fresh connection can succeed. It cannot after 57P04, whose database is gone, nor after 25P03,\n* which ends a session inside an open transaction.\n*/\nconst SESSION_ENDED_SQLSTATES = /* @__PURE__ */ new Map([\n\t[\"57P01\", true],\n\t[\"57P02\", true],\n\t[\"57P03\", true],\n\t[\"57P04\", false],\n\t[\"57P05\", true],\n\t[\"25P03\", false]\n]);\n/** Whether a retry can succeed, for a SQLSTATE that means the connection failed; undefined for any other. */\nfunction connectionSqlStateTransience(sqlState) {\n\tif (sqlState.startsWith(\"08\")) return TRANSIENT_CLASS_08_SQLSTATES.has(sqlState);\n\treturn SESSION_ENDED_SQLSTATES.get(sqlState);\n}\n/**\n* PostgreSQL-specific error properties that indicate an error originated from pg library.\n* These properties are not present on Node.js system errors.\n* Excludes generic properties like 'detail', 'file', 'line', and 'position' that could appear on any error.\n*/\nconst PG_ERROR_PROPERTIES = [\n\t\"constraint\",\n\t\"table\",\n\t\"column\",\n\t\"hint\",\n\t\"internalPosition\",\n\t\"internalQuery\",\n\t\"where\",\n\t\"schema\",\n\t\"routine\"\n];\n/**\n* Type predicate to check if an error is a Postgres error from the pg library.\n*\n* Distinguishes pg library errors from Node.js system errors by checking for:\n* - SQLSTATE codes (5-character alphanumeric codes like '23505', '42601')\n* - pg-specific properties (constraint, table, column, hint, etc.) that Node.js errors don't have\n*\n* Node.js system errors (ECONNREFUSED, ETIMEDOUT, etc.) are excluded to prevent false positives.\n*/\nfunction isPostgresError(error) {\n\tif (!(error instanceof Error)) return false;\n\tconst pgError = error;\n\tif (pgError.code && isPostgresSqlState(pgError.code)) return true;\n\treturn PG_ERROR_PROPERTIES.some((prop) => pgError[prop] !== void 0);\n}\n/**\n* Checks if an error code is a Postgres SQLSTATE (5-character alphanumeric code).\n* SQLSTATE codes are standardized SQL error codes (e.g., '23505' for unique violation).\n*/\nfunction isPostgresSqlState(code) {\n\tif (!code) return false;\n\treturn /^[A-Z0-9]{5}$/.test(code);\n}\n/**\n* Normalizes a Postgres error into a SQL-shared error type, from its code alone.\n*\n* - Connection SQLSTATEs (class `08`, and those that end the session) and Node socket codes → SqlConnectionError\n* - Other SQLSTATEs → SqlQueryError\n* - Errors already normalized, and errors without a recognized code → returned as-is\n*\n* pg raises some connection failures (\"Connection terminated\", \"timeout expired\") as plain\n* errors with no code; {@link normalizePgConnectFailure} classifies those where the caller\n* knows the connection failed.\n*/\nfunction normalizePgErrorByCode(error) {\n\tif (!(error instanceof Error)) return new Error(String(error));\n\tif (SqlQueryError.is(error) || SqlConnectionError.is(error)) return error;\n\tconst pgError = blindCast(error);\n\tconst code = pgError.code;\n\tif (code === void 0) return error;\n\tconst transient = NODE_CONNECTION_CODES.get(code);\n\tif (transient !== void 0) return new SqlConnectionError(error.message, {\n\t\tcause: error,\n\t\ttransient\n\t});\n\tif (isPostgresSqlState(code)) {\n\t\tconst connectionTransience = connectionSqlStateTransience(code);\n\t\tif (connectionTransience !== void 0) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: connectionTransience,\n\t\t\tsqlState: code\n\t\t});\n\t\treturn new SqlQueryError(error.message, {\n\t\t\tcause: error,\n\t\t\tsqlState: code,\n\t\t\t...ifDefined(\"constraint\", pgError.constraint),\n\t\t\t...ifDefined(\"table\", pgError.table),\n\t\t\t...ifDefined(\"column\", pgError.column),\n\t\t\t...ifDefined(\"detail\", pgError.detail)\n\t\t});\n\t}\n\treturn error;\n}\n/**\n* Normalizes an error the caller knows is a connection failure: it came from a `connect()`\n* call, or arrived after the client emitted `error` or `end`. Errors with a SQLSTATE keep\n* their code-based classification; everything else becomes a SqlConnectionError.\n*/\nfunction normalizePgConnectFailure(error) {\n\tconst normalized = normalizePgErrorByCode(error);\n\tif (SqlQueryError.is(normalized) || SqlConnectionError.is(normalized)) return normalized;\n\treturn new SqlConnectionError(normalized.message, { cause: normalized });\n}\n/**\n* Normalizes an error from a query on `client`. pg raises the failures of a dead connection\n* (\"Connection terminated\", \"not queryable\") with no code, so once the client has emitted\n* `error` or `end` its errors are connection errors.\n*/\nfunction normalizePgClientError(client, error) {\n\treturn hasLostConnection(client) ? normalizePgConnectFailure(error) : normalizePgErrorByCode(error);\n}\n//#endregion\n//#region src/server-text-types.ts\nconst PG_TYPES_ARRAY_OIDS = /* @__PURE__ */ new Set([\n\t651,\n\t791,\n\t199,\n\t1e3,\n\t1001,\n\t1005,\n\t1007,\n\t1008,\n\t1009,\n\t1014,\n\t1015,\n\t1016,\n\t1017,\n\t1021,\n\t1022,\n\t1028,\n\t1040,\n\t1041,\n\t1115,\n\t1182,\n\t1183,\n\t1185,\n\t1187,\n\t1231,\n\t1270,\n\t2951,\n\t3807,\n\t3907\n]);\nfunction pgTypeParser(oid, format) {\n\treturn blindCast(types.getTypeParser)(oid, format);\n}\nfunction serverText(value) {\n\treturn value;\n}\nconst serverTextTypes = { getTypeParser: () => serverText };\nconst controlTextTypes = { getTypeParser(oid, format) {\n\treturn PG_TYPES_ARRAY_OIDS.has(oid) ? serverText : pgTypeParser(oid, format);\n} };\n//#endregion\nexport { normalizePgConnectFailure as a, markClientAbandoned as c, normalizePgClientError as i, watchClientLoss as l, serverTextTypes as n, hasLostConnection as o, isPostgresError as r, hasStartedConnecting as s, controlTextTypes as t, postgresDriverDescriptorMeta as u };\n\n//# sourceMappingURL=server-text-types-DiGLNzzU.mjs.map"],"mappings":";;;;;AAKA,MAAM,+BAA+B;CACpC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;AAChB;AAGA,MAAM,iCAAiC,IAAI,QAAQ;AACnD,MAAM,8BAA8B,IAAI,QAAQ;;;;;AAKhD,SAAS,gBAAgB,QAAQ;CAChC,IAAI,CAAC,eAAe,IAAI,MAAM,GAAG;EAChC,eAAe,IAAI,MAAM;EACzB,MAAM,iBAAiB,YAAY,IAAI,MAAM;EAC7C,OAAO,GAAG,SAAS,QAAQ;EAC3B,OAAO,GAAG,OAAO,QAAQ;CAC1B;CACA,OAAO;AACR;;;;;AAKA,SAAS,kBAAkB,QAAQ;CAClC,OAAO,YAAY,IAAI,MAAM,KAAK,iBAAiB,MAAM;AAC1D;;AAEA,SAAS,oBAAoB,QAAQ;CACpC,YAAY,IAAI,MAAM;AACvB;;AAEA,SAAS,qBAAqB,QAAQ;CACrC,OAAO,gBAAgB,UAAU,OAAO,eAAe,QAAQ,iBAAiB,UAAU,OAAO,gBAAgB;AAClH;;AAEA,SAAS,iBAAiB,QAAQ;CACjC,OAAO,aAAa,UAAU,OAAO,YAAY,QAAQ,gBAAgB,UAAU,OAAO,eAAe;AAC1G;AAGA,MAAM,wCAAwC,IAAI,IAAI;CACrD,CAAC,cAAc,IAAI;CACnB,CAAC,aAAa,IAAI;CAClB,CAAC,SAAS,IAAI;CACd,CAAC,aAAa,IAAI;CAClB,CAAC,gBAAgB,KAAK;CACtB,CAAC,aAAa,KAAK;CACnB,CAAC,gBAAgB,KAAK;AACvB,CAAC;AACD,MAAM,+CAA+C,IAAI,IAAI;CAC5D;CACA;CACA;CACA;AACD,CAAC;;;;;;AAMD,MAAM,0CAA0C,IAAI,IAAI;CACvD,CAAC,SAAS,IAAI;CACd,CAAC,SAAS,IAAI;CACd,CAAC,SAAS,IAAI;CACd,CAAC,SAAS,KAAK;CACf,CAAC,SAAS,IAAI;CACd,CAAC,SAAS,KAAK;AAChB,CAAC;;AAED,SAAS,6BAA6B,UAAU;CAC/C,IAAI,SAAS,WAAW,IAAI,GAAG,OAAO,6BAA6B,IAAI,QAAQ;CAC/E,OAAO,wBAAwB,IAAI,QAAQ;AAC5C;;;;;;AAMA,MAAM,sBAAsB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;;;;;;;AAUA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CACtC,MAAM,UAAU;CAChB,IAAI,QAAQ,QAAQ,mBAAmB,QAAQ,IAAI,GAAG,OAAO;CAC7D,OAAO,oBAAoB,MAAM,SAAS,QAAQ,UAAU,KAAK,CAAC;AACnE;;;;;AAKA,SAAS,mBAAmB,MAAM;CACjC,IAAI,CAAC,MAAM,OAAO;CAClB,OAAO,gBAAgB,KAAK,IAAI;AACjC;;;;;;;;;;;;AAYA,SAAS,uBAAuB,OAAO;CACtC,IAAI,EAAE,iBAAiB,QAAQ,OAAO,IAAI,MAAM,OAAO,KAAK,CAAC;CAC7D,IAAI,cAAc,GAAG,KAAK,KAAK,mBAAmB,GAAG,KAAK,GAAG,OAAO;CACpE,MAAM,UAAU,UAAU,KAAK;CAC/B,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAK,GAAG,OAAO;CAC5B,MAAM,YAAY,sBAAsB,IAAI,IAAI;CAChD,IAAI,cAAc,KAAK,GAAG,OAAO,IAAI,mBAAmB,MAAM,SAAS;EACtE,OAAO;EACP;CACD,CAAC;CACD,IAAI,mBAAmB,IAAI,GAAG;EAC7B,MAAM,uBAAuB,6BAA6B,IAAI;EAC9D,IAAI,yBAAyB,KAAK,GAAG,OAAO,IAAI,mBAAmB,MAAM,SAAS;GACjF,OAAO;GACP,WAAW;GACX,UAAU;EACX,CAAC;EACD,OAAO,IAAI,cAAc,MAAM,SAAS;GACvC,OAAO;GACP,UAAU;GACV,GAAG,UAAU,cAAc,QAAQ,UAAU;GAC7C,GAAG,UAAU,SAAS,QAAQ,KAAK;GACnC,GAAG,UAAU,UAAU,QAAQ,MAAM;GACrC,GAAG,UAAU,UAAU,QAAQ,MAAM;EACtC,CAAC;CACF;CACA,OAAO;AACR;;;;;;AAMA,SAAS,0BAA0B,OAAO;CACzC,MAAM,aAAa,uBAAuB,KAAK;CAC/C,IAAI,cAAc,GAAG,UAAU,KAAK,mBAAmB,GAAG,UAAU,GAAG,OAAO;CAC9E,OAAO,IAAI,mBAAmB,WAAW,SAAS,EAAE,OAAO,WAAW,CAAC;AACxE;;;;;;AAMA,SAAS,uBAAuB,QAAQ,OAAO;CAC9C,OAAO,kBAAkB,MAAM,IAAI,0BAA0B,KAAK,IAAI,uBAAuB,KAAK;AACnG;AAGA,MAAM,sCAAsC,IAAI,IAAI;CACnD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,aAAa,KAAK,QAAQ;CAClC,OAAO,UAAU,MAAM,aAAa,CAAC,CAAC,KAAK,MAAM;AAClD;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO;AACR;AACA,MAAM,kBAAkB,EAAE,qBAAqB,WAAW;AAC1D,MAAM,mBAAmB,EAAE,cAAc,KAAK,QAAQ;CACrD,OAAO,oBAAoB,IAAI,GAAG,IAAI,aAAa,aAAa,KAAK,MAAM;AAC5E,EAAE"}
package/dist/target.mjs CHANGED
@@ -14,7 +14,7 @@ import { G as tablePrimaryKeyAst, I as rlsEnabledAst, K as toRegclass, P as noNu
14
14
  import { a as jsonb, c as textArray, i as int8, l as timestamptz, n as buildSignMarkerBootstrapQueries, o as pgTable, r as int4, s as text, t as buildControlTableBootstrapQueries, u as timestamptzJsDate } from "./contract-free-o7olebm9.mjs";
15
15
  import { t as postgresCodecTraitsOf } from "./postgres-codec-traits-CnP5Bjxp-Dxdgv0TI.mjs";
16
16
  import { i as policyRoleList, n as POLICY_OPERATION_PREDICATES, r as computeContentHash, t as POLICY_COMMAND_SQL } from "./canonicalize-RdxoUHao-FTTkizfe.mjs";
17
- import { c as postgresNativeAuthoringTypes, d as postgresNowGenerators, f as postgresScalarAndNativeTypeConstructors, l as postgresNowGeneratorControlDescriptors, p as postgresScalarAuthoringTypes } from "./authoring-SbdvmVJh-nQ7YliD_.mjs";
17
+ import { c as postgresNativeAuthoringTypes, d as postgresNowGenerators, f as postgresScalarAndNativeTypeConstructors, l as postgresNowGeneratorControlDescriptors, p as postgresScalarAuthoringTypes } from "./authoring-P5nKuHp1-DPQfTSM8.mjs";
18
18
  import { t as postgresRenderCheckExpressions } from "./check-expressions-7uCCP01t-DtX2Vak9.mjs";
19
19
  import { t as postgresDataTypeEntries } from "./data-type-entries-gQW3-KSb-BIl8vgus.mjs";
20
20
  import { n as PostgresSchemaNodeKind, r as PostgresTableSchemaNode, t as PostgresNativeEnumSchemaNode } from "./postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs";
@@ -28,18 +28,18 @@ import { t as buildColumnTypeSql } from "./planner-ddl-builders-cYnH52gC-BWifb_M
28
28
  import { n as resolveIdentityValue, t as buildBuiltinIdentityValue } from "./planner-identity-values-QstrMJ2U-CcpaRVPY.mjs";
29
29
  import { a as planIssues, t as coalesceSubtreeIssues } from "./control-policy-DtU5u9Dm-44r_OF94.mjs";
30
30
  import { n as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from "./diff-database-schema-DAEzWtzU-DoyVgKqh.mjs";
31
- import { n as PostgresContractView, t as PostgresContractSerializer } from "./postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs";
31
+ import { n as PostgresContractView, t as PostgresContractSerializer } from "./postgres-contract-view-DgBsbRyj-CWrgmyHg.mjs";
32
32
  import { t as dataTransform } from "./data-transform-h9agBu_c-RlC5A7aY.mjs";
33
- import { t as PostgresMigration } from "./postgres-migration-BSWmeRLo-CUfVTUf0.mjs";
33
+ import { t as PostgresMigration } from "./postgres-migration-DG6SF-aU-DjRMnDmA.mjs";
34
34
  import { t as renderOps } from "./render-ops-BgqtCw9Z-T8BPTX85.mjs";
35
35
  import { t as renderCallsToTypeScript } from "./render-typescript-Dqp1Spgn-B4mJhuVr.mjs";
36
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs";
37
- import { t as createPostgresMigrationPlanner } from "./planner-VuR6URu3-CCUT2Osx.mjs";
36
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-BFJVBalB-DoWrL1oX.mjs";
37
+ import { t as createPostgresMigrationPlanner } from "./planner-BYD9uL95-BYETKJX3.mjs";
38
38
  import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-BkBKBRE3.mjs";
39
39
  import { c as toTsquery, l as websearchToTsquery, n as fullTextDocument, o as phrasetoTsquery, s as plaintoTsquery, t as FullTextDocument } from "./full-text-parsers-CFFxiOrp-CrZ7VI1m.mjs";
40
40
  import { t as tsquery } from "./full-text-BYg7EVX2.mjs";
41
41
  import { a as foreignKey, c as primaryKey, d as unique, i as fn, l as rawSql, n as checkExpression, o as lit, r as col, s as placeholder, t as MigrationCLI, u as sql } from "./migration-Be_iuIpn.mjs";
42
42
  import { t as introspectedTypeText } from "./native-type-normalizer-Cn-RGt_E.mjs";
43
43
  import { i as hasUniqueConstraint, n as hasForeignKey, r as hasIndex, t as buildSchemaLookupMap } from "./planner-schema-lookup-BbUY9oVy.mjs";
44
- import { t as prisma7PostgresBinding } from "./prisma7-binding-BjiLA9F7.mjs";
44
+ import { t as prisma7PostgresBinding } from "./prisma7-binding-VHjZ983n.mjs";
45
45
  export { AddCheckConstraintCall, AddColumnAction, AddColumnCall, AddColumnWithTemporaryDefaultCall, AddConstraintAction, AddForeignKeyCall, AddNativeEnumValueCall, AddPrimaryKeyCall, AddRequiredColumnToEmptyTableCall, AddUniqueCall, AlterColumnTypeAction, AlterColumnTypeCall, CreateExtensionCall, CreateIndexCall, CreateNativeEnumTypeCall, CreatePostgresRlsPolicyCall, CreateSchemaCall, CreateTableCall, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, DataTransformCall, DisableRowLevelSecurityCall, DropCheckConstraintCall, DropColumnCall, DropConstraintCall, DropDefaultAction, DropDefaultCall, DropIndexCall, DropNativeEnumTypeCall, DropNotNullCall, DropPostgresRlsPolicyCall, DropSchemaCall, DropTableCall, EnableRowLevelSecurityCall, FULL_TEXT_INDEX_TYPE, FullTextDocument, MARKER_LOCK_KEY, MARKER_LOCK_SQL, PostgresMigration as Migration, MigrationCLI, PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_STRING_CODEC_ID, PG_DATE_TEMPORAL_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INT8_NUMBER_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_DATE_CODEC_ID, PG_TIMESTAMPTZ_STRING_CODEC_ID, PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, PG_TIMESTAMP_STRING_CODEC_ID, PG_TIMESTAMP_TEMPORAL_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_STRING_CODEC_ID, PG_TIME_TEMPORAL_CODEC_ID, PG_TSQUERY_CODEC_ID, PG_UNBOUNDED_INT_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, POLICY_COMMAND_SQL, POLICY_OPERATION_PREDICATES, PgTimestamptzDateCodec, PgTimestamptzDateDescriptor, PostgresAlterIndexRename, PostgresAlterPolicyRename, PostgresAlterSchemaRename, PostgresAlterTable, PostgresAlterTableSetSchema, PostgresCodecDescriptor, PostgresContractSerializer, PostgresContractView, PostgresCreateIndex, PostgresCreatePolicy, PostgresCreateSchema, PostgresCreateTable, PostgresCreateType, PostgresDatabaseSchemaNode, PostgresDdlNode, PostgresDisableRowLevelSecurity, PostgresDropIndex, PostgresDropPolicy, PostgresDropSchema, PostgresDropType, PostgresNamespaceSchemaNode, PostgresNativeEnum, PostgresNativeEnumSchemaNode, PostgresPolicySchemaNode, PostgresRlsEnablement, PostgresRlsPolicy, PostgresRole, PostgresRoleSchemaNode, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, PostgresTableSource, PostgresUnboundSchema, RawSqlCall, RenameColumnCall, RenameConstraintCall, RenameIndexCall, RenamePostgresRlsPolicyCall, RenameSchemaCall, RenameTableCall, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_RAW_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SetDefaultCall, SetNotNullCall, SetTableSchemaCall, TypeScriptRenderablePostgresMigration, addColumnAction, addConstraintAction, alterColumnTypeAction, alterTable, alterTypeCheck, assemblePostgresCodecRegistry, assemblePostgresCodecRegistryWithBuiltins, buildBuiltinIdentityValue, buildColumnTypeSql, buildControlTableBootstrapQueries, buildPostgresCodecDescriptorRegistry, buildPostgresPlanDiff, buildSchemaLookupMap, buildSignMarkerBootstrapQueries, checkExpression, coalesceSubtreeIssues, col, columnDefaultAst, columnDefaultSequenceAst, columnExistsAst, columnNullabilityAst, columnTypeAst, computeContentHash, constraintExistsAst, contractToPostgresDatabaseSchemaNode, createExtension, createPostgresBuiltinCodecLookup, createPostgresBuiltinDataTypeLookup, createPostgresCodecRegistryWithBuiltins, createPostgresMigrationPlanner, createSchema, createTable, dataTransform, decodePostgresListText, definePostgresCodecs, describeFullTextIndexProblem, dropDefaultAction, errorPostgresMigrationStackMissing, escapeLiteral, extensionExistsAst, fn, foreignKey, fullTextDocument, fullTextIndexProblems, hasForeignKey, hasIndex, hasUniqueConstraint, indexExistsAst, int4, int8, introspectedTypeText, isPgEnumParams, isPostgresCodecDescriptor, isPostgresSchema, jsonb, lit, noNullValuesAst, parsePostgresListText, pgBit, pgBitColumn, pgBitLengthParams, pgBool, pgBoolColumn, pgBytea, pgChar, pgCharColumn, pgCharacterLengthParams, pgDate, pgDateStoredText, pgEnum, pgEnumDescriptor, pgEnumParams, pgFloat4, pgFloat4Column, pgFloat8, pgFloat8Column, pgFloatColumn, pgInet, pgInetColumn, pgInt2, pgInt2Column, pgInt4, pgInt4Column, pgInt8, pgInt8Column, pgInt8NumberColumn, pgIntColumn, pgInterval, pgIntervalColumn, pgJson, pgJsonColumn, pgJsonb, pgJsonbColumn, pgJsonbEnumRefusal, pgNumeric, pgNumericColumn, pgNumericParams, pgPrecisionParams, pgTable, pgText, pgTextArray, pgTextColumn, pgTime, pgTimeStoredText, pgTimestamp, pgTimestampStoredText, pgTimestamptz, pgTimestamptzDateColumn, pgTimestamptzDateDescriptor, pgTimestamptzStoredText, pgTimetz, pgTimetzColumn, pgTimetzStoredText, pgTsquery, pgUnboundedIntColumn, pgUuid, pgUuidColumn, pgVarbit, pgVarbitColumn, pgVarchar, pgVarcharColumn, phrasetoTsquery, placeholder, plaintoTsquery, planIssues, policyInputFromSerialized, policyRoleList, postgresAggregateDescriptors, postgresCodec, postgresCodecDescriptorRegistry, postgresCodecRegistry, postgresCodecTraitsOf, postgresCreateNamespace, postgresDataTypeEntries, postgresDataTypes, postgresError, postgresNativeAuthoringTypes, postgresNowGeneratorControlDescriptors, postgresNowGenerators, postgresRenderCheckExpressions, postgresResolveDefault, postgresScalarAndNativeTypeConstructors, postgresScalarAuthoringTypes, postgresTextDataTypes, primaryKey, prisma7PostgresBinding, qualifiedEnumName, qualifyName, qualifyTableName, quoteIdentifier, quoteQualifiedName, rawSql, readPostgresDefault, renderCallsToTypeScript, renderFullTextIndexDocument, renderOps, resolveDdlSchemaForNamespaceStorage, resolveIdentityValue, rlsEnabledAst, rlsPolicyExistsAst, sequenceNameAvailableAst, sql, stackDataTypes, tableExistsAst, tableIsEmptyAst, tablePrimaryKeyAst, text, textArray, timestamptz, timestamptzJsDate, toRegclass, toTsquery, tsquery, unique, validateEnumValueLength, websearchToTsquery, weightGroupsOf };
@@ -7,19 +7,19 @@ import { P as setFallbackTemporal, i as decodePostgresListText, o as parsePostgr
7
7
  import { s as fullTextIndexDefinitionOf } from "./full-text-index-definition-BPxQQBuC-VLyQ1kEL.mjs";
8
8
  import { i as PostgresRlsPolicy, n as PostgresRlsEnablement, o as PostgresRole } from "./postgres-schema-C6w1rzOF-D1fdwqRx.mjs";
9
9
  import { r as computeContentHash } from "./canonicalize-RdxoUHao-FTTkizfe.mjs";
10
- import { c as postgresNativeAuthoringTypes, f as postgresScalarAndNativeTypeConstructors, l as postgresNowGeneratorControlDescriptors, p as postgresScalarAuthoringTypes, t as POLICY_BLOCK_KEYWORDS } from "./authoring-SbdvmVJh-nQ7YliD_.mjs";
10
+ import { c as postgresNativeAuthoringTypes, f as postgresScalarAndNativeTypeConstructors, l as postgresNowGeneratorControlDescriptors, p as postgresScalarAuthoringTypes, t as POLICY_BLOCK_KEYWORDS } from "./authoring-P5nKuHp1-DPQfTSM8.mjs";
11
11
  import { t as postgresRenderCheckExpressions } from "./check-expressions-7uCCP01t-DtX2Vak9.mjs";
12
- import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs";
12
+ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-15Dhylpt-BlJRsuMJ.mjs";
13
13
  import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs";
14
14
  import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs";
15
15
  import { i as qualifyTableName } from "./planner-sql-checks-D-K44J19-CzvrqzNB.mjs";
16
16
  import { I as SCHEMA_OBJECTS_SQL, J as schemaContentsOf, Y as schemaObjectsSummary, q as schemaBlockingObjects } from "./op-factory-call-gGX-mZu--0QUG5xH4.mjs";
17
17
  import { r as diffPostgresSchema } from "./diff-database-schema-DAEzWtzU-DoyVgKqh.mjs";
18
- import { t as PostgresContractSerializer } from "./postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs";
19
- import { o as postgresContractToSchema } from "./postgres-migration-BSWmeRLo-CUfVTUf0.mjs";
20
- import { t as createPostgresMigrationPlanner } from "./planner-VuR6URu3-CCUT2Osx.mjs";
18
+ import { t as PostgresContractSerializer } from "./postgres-contract-view-DgBsbRyj-CWrgmyHg.mjs";
19
+ import { o as postgresContractToSchema } from "./postgres-migration-DG6SF-aU-DjRMnDmA.mjs";
20
+ import { t as createPostgresMigrationPlanner } from "./planner-BYD9uL95-BYETKJX3.mjs";
21
21
  import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-BkBKBRE3.mjs";
22
- import { a as buildIndexAttribute, c as buildNativeEnumBlock, d as inferPostgresPslContract, f as namedArg, g as positionalArg, h as parseDefaultAttributeString, i as buildFullTextIndexAttribute, n as buildAttribute, o as buildMapAttribute, r as buildCheckAttribute, s as buildModelConstraintAttribute, t as SYNTHETIC_SPAN } from "./infer-psl-contract-BSSHcuRi-ChdFSviw.mjs";
22
+ import { a as buildIndexAttribute, c as buildNativeEnumBlock, d as inferPostgresPslContract, f as namedArg, g as positionalArg, h as parseDefaultAttributeString, i as buildFullTextIndexAttribute, n as buildAttribute, o as buildMapAttribute, r as buildCheckAttribute, s as buildModelConstraintAttribute, t as SYNTHETIC_SPAN } from "./infer-psl-contract-CdGGwxP3-JfIJ81cu.mjs";
23
23
  import { dataTypeParams, requiredParamKeys, validateCodecTypeParams } from "@prisma/orm-framework/components/codec";
24
24
  import { blindCast } from "@prisma/orm-framework/utils/casts";
25
25
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -41,7 +41,7 @@ import { generatorCallsFor, inferredTypeConstructors, mapDefault, writeDefaultLi
41
41
  import { UNBOUND_PSL_NAMESPACE_NAME, UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from "@prisma/orm-framework/components/psl-ast";
42
42
  import { escapePslString } from "@prisma/orm-family-sql/contract/data-type-support";
43
43
  import { Temporal } from "temporal-polyfill/full/implementation";
44
- import { SqlQueryError } from "@prisma/orm-family-sql/errors";
44
+ import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
45
45
  import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
46
46
  import { pslFieldMapName, pslModelMapName } from "@prisma/orm-family-sql/contract-psl/map-names";
47
47
  import { defaultForeignKeyIndex } from "@prisma/orm-family-sql/contract/foreign-key-materialization";
@@ -225,16 +225,27 @@ var PostgresMigrationRunner = class {
225
225
  const perSpaceOptions = options.perSpaceOptions;
226
226
  if (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });
227
227
  await this.beginTransaction(driver);
228
- let committed = false;
228
+ let result;
229
+ try {
230
+ result = await this.executeSpaces(driver, perSpaceOptions);
231
+ } catch (error) {
232
+ await this.rollbackAfterFailure(driver);
233
+ throw error;
234
+ }
235
+ if (!result.ok) {
236
+ await this.rollbackAfterFailure(driver);
237
+ return notOk(withDatabaseUnchanged(result.failure, true));
238
+ }
229
239
  try {
230
- const result = await this.executeSpaces(driver, perSpaceOptions);
231
- if (!result.ok) return notOk(withDatabaseUnchanged(result.failure, true));
232
240
  await this.commitTransaction(driver);
233
- committed = true;
234
- return result;
235
- } finally {
236
- if (!committed) await this.rollbackTransaction(driver);
241
+ } catch (error) {
242
+ await this.rollbackAfterFailure(driver);
243
+ throw error;
237
244
  }
245
+ return result;
246
+ }
247
+ async rollbackAfterFailure(driver) {
248
+ await this.rollbackTransaction(driver).catch(() => void 0);
238
249
  }
239
250
  async executeSpaces(driver, perSpaceOptions) {
240
251
  const perSpaceResults = [];
@@ -370,6 +381,17 @@ var PostgresMigrationRunner = class {
370
381
  for (const step of operation.execute) try {
371
382
  await driver.query(step.sql, step.params ?? []);
372
383
  } catch (error) {
384
+ if (SqlConnectionError.is(error)) return runnerFailure("MIGRATION.EXECUTION_FAILED", `Operation ${operation.id} failed during execution: ${step.description}`, {
385
+ why: error.message,
386
+ meta: {
387
+ operationId: operation.id,
388
+ stepDescription: step.description,
389
+ sql: step.sql,
390
+ sqlState: error.sqlState,
391
+ connectionLost: true,
392
+ transient: error.transient
393
+ }
394
+ });
373
395
  if (SqlQueryError.is(error)) {
374
396
  const dependents = error.sqlState === "2BP01" ? dependentsOf(error.detail) : [];
375
397
  const details = operation.target.details;