@event-driven-io/dumbo 0.13.0-beta.34 → 0.13.0-beta.36
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/cloudflare.cjs +379 -434
- package/dist/cloudflare.cjs.map +1 -1
- package/dist/cloudflare.d.cts +36 -29
- package/dist/cloudflare.d.ts +36 -29
- package/dist/cloudflare.js +343 -434
- package/dist/cloudflare.js.map +1 -1
- package/dist/core-BeyC5tHn.js +519 -0
- package/dist/core-BeyC5tHn.js.map +1 -0
- package/dist/core-Bf2ujUFy.js +379 -0
- package/dist/core-Bf2ujUFy.js.map +1 -0
- package/dist/core-BgYtAxCm.cjs +3237 -0
- package/dist/core-BgYtAxCm.cjs.map +1 -0
- package/dist/core-DDo4m0Z_.js +2262 -0
- package/dist/core-DDo4m0Z_.js.map +1 -0
- package/dist/core-DmbB4qMn.cjs +656 -0
- package/dist/core-DmbB4qMn.cjs.map +1 -0
- package/dist/core-Go_IA78L.cjs +450 -0
- package/dist/core-Go_IA78L.cjs.map +1 -0
- package/dist/{connectionString-Dch_MIRU.d.cts → index-BDSQvDH2.d.cts} +1010 -922
- package/dist/index-BdWFmDhJ.d.cts +68 -0
- package/dist/index-D1jryNqo.d.ts +198 -0
- package/dist/index-DaP2fTEX.d.ts +67 -0
- package/dist/index-DqVvUav9.d.cts +198 -0
- package/dist/index-S_wp0Eaf.d.cts +67 -0
- package/dist/index-cxtbLiju.d.ts +68 -0
- package/dist/{connectionString-Dch_MIRU.d.ts → index-zkszkJqP.d.ts} +1010 -922
- package/dist/index.cjs +212 -359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -132
- package/dist/index.d.ts +3 -132
- package/dist/index.js +52 -361
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +366 -431
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +83 -72
- package/dist/pg.d.ts +83 -72
- package/dist/pg.js +320 -431
- package/dist/pg.js.map +1 -1
- package/dist/postgreSQLMetadata-LqX-Z_wo.cjs +118 -0
- package/dist/postgreSQLMetadata-LqX-Z_wo.cjs.map +1 -0
- package/dist/postgreSQLMetadata-zMq8yJo_.js +65 -0
- package/dist/postgreSQLMetadata-zMq8yJo_.js.map +1 -0
- package/dist/postgresql.cjs +25 -50
- package/dist/postgresql.d.cts +3 -61
- package/dist/postgresql.d.ts +3 -61
- package/dist/postgresql.js +4 -50
- package/dist/sqlite.cjs +30 -60
- package/dist/sqlite.d.cts +3 -190
- package/dist/sqlite.d.ts +3 -190
- package/dist/sqlite.js +4 -60
- package/dist/sqlite3.cjs +312 -380
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +79 -77
- package/dist/sqlite3.d.ts +79 -77
- package/dist/sqlite3.js +276 -378
- package/dist/sqlite3.js.map +1 -1
- package/dist/sqliteMetadata-BoQ7Sc9I.js +29 -0
- package/dist/sqliteMetadata-BoQ7Sc9I.js.map +1 -0
- package/dist/sqliteMetadata-D_2pKeCC.cjs +46 -0
- package/dist/sqliteMetadata-D_2pKeCC.cjs.map +1 -0
- package/package.json +12 -12
- package/dist/chunk-33P5766L.js +0 -83
- package/dist/chunk-33P5766L.js.map +0 -1
- package/dist/chunk-4MMMEDQ7.cjs +0 -2944
- package/dist/chunk-4MMMEDQ7.cjs.map +0 -1
- package/dist/chunk-6HAHSSPW.js +0 -701
- package/dist/chunk-6HAHSSPW.js.map +0 -1
- package/dist/chunk-GNH5XC6D.cjs +0 -481
- package/dist/chunk-GNH5XC6D.cjs.map +0 -1
- package/dist/chunk-H2JBS7HM.js +0 -2944
- package/dist/chunk-H2JBS7HM.js.map +0 -1
- package/dist/chunk-JIZGCEPE.cjs +0 -701
- package/dist/chunk-JIZGCEPE.cjs.map +0 -1
- package/dist/chunk-NJI6PJFZ.cjs +0 -83
- package/dist/chunk-NJI6PJFZ.cjs.map +0 -1
- package/dist/chunk-RQ3KKMTP.cjs +0 -34
- package/dist/chunk-RQ3KKMTP.cjs.map +0 -1
- package/dist/chunk-UK7MXVS2.js +0 -34
- package/dist/chunk-UK7MXVS2.js.map +0 -1
- package/dist/chunk-Y5TD53QE.js +0 -481
- package/dist/chunk-Y5TD53QE.js.map +0 -1
- package/dist/columnProcessors-Be2uMYjS.d.cts +0 -8
- package/dist/columnProcessors-D0ivj_SU.d.ts +0 -8
- package/dist/postgresql.cjs.map +0 -1
- package/dist/postgresql.js.map +0 -1
- package/dist/sqlite.cjs.map +0 -1
- package/dist/sqlite.js.map +0 -1
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { B as LockNotAvailableError, Et as SQLProcessorsRegistry, F as ExclusionViolationError, Gt as SQLArray, H as QueryCanceledError, I as ForeignKeyViolationError, K as UniqueConstraintError, L as InsufficientResourcesError, M as DataError, N as DeadlockError, O as AdminShutdownError, P as DumboError, R as IntegrityConstraintViolationError, Tt as mapDefaultSQLColumnProcessors, U as SerializationError, V as NotNullViolationError, W as SystemError, X as registerDefaultMigratorOptions, bt as SQL, dn as single, gt as mapSQLIdentifier, j as ConnectionError, jt as SQLProcessor, k as CheckViolationError, mn as defaultDatabaseLockOptions, ot as SQLFormatter, ut as registerFormatter, wt as defaultProcessorsRegistry, z as InvalidOperationError } from "./core-DDo4m0Z_.js";
|
|
2
|
+
import "./postgreSQLMetadata-zMq8yJo_.js";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/postgresql/core/errors/errorMapper.ts
|
|
5
|
+
/**
|
|
6
|
+
* Checks whether the given error looks like a PostgreSQL DatabaseError
|
|
7
|
+
* from the `pg` driver (has a string `code` property with a SQLSTATE value).
|
|
8
|
+
*/
|
|
9
|
+
const getPostgresErrorCode = (error) => {
|
|
10
|
+
if (error instanceof Error && "code" in error && typeof error.code === "string") return error.code;
|
|
11
|
+
};
|
|
12
|
+
const getErrorMessage = (error) => error instanceof Error ? error.message : void 0;
|
|
13
|
+
const asError = (error) => error instanceof Error ? error : void 0;
|
|
14
|
+
/**
|
|
15
|
+
* Maps a PostgreSQL error (from the `pg` driver) to a typed DumboError
|
|
16
|
+
* based on the SQLSTATE code.
|
|
17
|
+
*
|
|
18
|
+
* SQLSTATE reference: https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
19
|
+
* Transient classification based on Npgsql's PostgresException.IsTransient.
|
|
20
|
+
*
|
|
21
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized PostgreSQL error.
|
|
22
|
+
*/
|
|
23
|
+
const mapPostgresError = (error) => {
|
|
24
|
+
if (DumboError.isInstanceOf(error)) return error;
|
|
25
|
+
const code = getPostgresErrorCode(error);
|
|
26
|
+
if (!code) return new DumboError({
|
|
27
|
+
errorCode: 500,
|
|
28
|
+
message: getErrorMessage(error),
|
|
29
|
+
innerError: asError(error)
|
|
30
|
+
});
|
|
31
|
+
const message = getErrorMessage(error);
|
|
32
|
+
const innerError = asError(error);
|
|
33
|
+
switch (code) {
|
|
34
|
+
case "23505": return new UniqueConstraintError(message, innerError);
|
|
35
|
+
case "23503": return new ForeignKeyViolationError(message, innerError);
|
|
36
|
+
case "23502": return new NotNullViolationError(message, innerError);
|
|
37
|
+
case "23514": return new CheckViolationError(message, innerError);
|
|
38
|
+
case "23P01": return new ExclusionViolationError(message, innerError);
|
|
39
|
+
case "40001": return new SerializationError(message, innerError);
|
|
40
|
+
case "40P01": return new DeadlockError(message, innerError);
|
|
41
|
+
case "55P03":
|
|
42
|
+
case "55006": return new LockNotAvailableError(message, innerError);
|
|
43
|
+
case "57014": return new QueryCanceledError(message, innerError);
|
|
44
|
+
case "57P01":
|
|
45
|
+
case "57P02": return new AdminShutdownError(message, innerError);
|
|
46
|
+
case "57P03":
|
|
47
|
+
case "57P05": return new ConnectionError(message, innerError);
|
|
48
|
+
}
|
|
49
|
+
switch (code.slice(0, 2)) {
|
|
50
|
+
case "08": return new ConnectionError(message, innerError);
|
|
51
|
+
case "22": return new DataError(message, innerError);
|
|
52
|
+
case "23": return new IntegrityConstraintViolationError(message, innerError);
|
|
53
|
+
case "42": return new InvalidOperationError(message, innerError);
|
|
54
|
+
case "53": return new InsufficientResourcesError(message, innerError);
|
|
55
|
+
case "57": return new ConnectionError(message, innerError);
|
|
56
|
+
case "58": return new SystemError(message, innerError);
|
|
57
|
+
}
|
|
58
|
+
return new DumboError({
|
|
59
|
+
errorCode: 500,
|
|
60
|
+
message,
|
|
61
|
+
innerError
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/storage/postgresql/core/locks/advisoryLocks.ts
|
|
67
|
+
const tryAcquireAdvisoryLock = async (execute, options) => {
|
|
68
|
+
const timeoutMs = options.timeoutMs ?? defaultDatabaseLockOptions.timeoutMs;
|
|
69
|
+
const advisoryLock = options.mode === "Permanent" ? "pg_advisory_lock" : "pg_advisory_xact_lock";
|
|
70
|
+
try {
|
|
71
|
+
await single(execute.query(SQL`SELECT ${SQL.plain(advisoryLock)}(${options.lockId}) AS locked`, { timeoutMs }));
|
|
72
|
+
return true;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error instanceof QueryCanceledError || DumboError.isInstanceOf(error, { errorType: QueryCanceledError.ErrorType })) return false;
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const releaseAdvisoryLock = async (execute, options) => {
|
|
79
|
+
const timeoutMs = options.timeoutMs ?? defaultDatabaseLockOptions.timeoutMs;
|
|
80
|
+
try {
|
|
81
|
+
await single(execute.query(SQL`SELECT pg_advisory_unlock(${options.lockId}) AS locked`, { timeoutMs }));
|
|
82
|
+
return true;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (error instanceof QueryCanceledError || DumboError.isInstanceOf(error, { errorType: QueryCanceledError.ErrorType })) return false;
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const acquireAdvisoryLock = async (execute, options) => {
|
|
89
|
+
if (!await tryAcquireAdvisoryLock(execute, options)) throw new Error("Failed to acquire advisory lock within the specified timeout. Migration aborted.");
|
|
90
|
+
};
|
|
91
|
+
const AdvisoryLock = {
|
|
92
|
+
acquire: acquireAdvisoryLock,
|
|
93
|
+
tryAcquire: tryAcquireAdvisoryLock,
|
|
94
|
+
release: releaseAdvisoryLock,
|
|
95
|
+
withAcquire: async (execute, handle, options) => {
|
|
96
|
+
await acquireAdvisoryLock(execute, options);
|
|
97
|
+
try {
|
|
98
|
+
return await handle();
|
|
99
|
+
} finally {
|
|
100
|
+
if (options.mode === "Permanent") await releaseAdvisoryLock(execute, options);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const advisoryLock = (execute, options) => ({
|
|
105
|
+
acquire: (acquireOptions) => acquireAdvisoryLock(execute, {
|
|
106
|
+
...options,
|
|
107
|
+
...acquireOptions ?? {}
|
|
108
|
+
}),
|
|
109
|
+
tryAcquire: (acquireOptions) => tryAcquireAdvisoryLock(execute, {
|
|
110
|
+
...options,
|
|
111
|
+
...acquireOptions ?? {}
|
|
112
|
+
}),
|
|
113
|
+
release: () => releaseAdvisoryLock(execute, options),
|
|
114
|
+
withAcquire: async (handle, acquireOptions) => {
|
|
115
|
+
await acquireAdvisoryLock(execute, {
|
|
116
|
+
...options,
|
|
117
|
+
...acquireOptions ?? {}
|
|
118
|
+
});
|
|
119
|
+
try {
|
|
120
|
+
return await handle();
|
|
121
|
+
} finally {
|
|
122
|
+
await releaseAdvisoryLock(execute, options);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/storage/postgresql/core/schema/migrations.ts
|
|
129
|
+
const DefaultPostgreSQLMigratorOptions = { lock: { databaseLock: AdvisoryLock } };
|
|
130
|
+
registerDefaultMigratorOptions("PostgreSQL", DefaultPostgreSQLMigratorOptions);
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/storage/postgresql/core/sql/processors/arrayProcessors.ts
|
|
134
|
+
const PostgreSQLArrayProcessor = SQLProcessor({
|
|
135
|
+
canHandle: "SQL_ARRAY",
|
|
136
|
+
handle: (token, { builder, mapper, serializer }) => {
|
|
137
|
+
if (token.value.length === 0) throw new Error("Empty arrays are not supported. If you're using it with SELECT IN statement Use SQL.in(column, array) helper instead.");
|
|
138
|
+
const mappedValue = mapper.mapValue(token.value, serializer);
|
|
139
|
+
if (token.mode === "params") builder.addParams(mappedValue);
|
|
140
|
+
else builder.addParam(mappedValue);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const PostgreSQLExpandSQLInProcessor = SQLProcessor({
|
|
144
|
+
canHandle: "SQL_IN",
|
|
145
|
+
handle: (token, context) => {
|
|
146
|
+
const { builder, mapper, processorsRegistry } = context;
|
|
147
|
+
const { values: inValues, column, mode } = token;
|
|
148
|
+
if (inValues.value.length === 0) {
|
|
149
|
+
builder.addParam(mapper.mapValue(false, context.serializer));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
builder.addSQL(mapper.mapValue(column.value, context.serializer));
|
|
153
|
+
const arrayProcessor = processorsRegistry.get(SQLArray.type);
|
|
154
|
+
if (!arrayProcessor) throw new Error("No sql processor registered for an array. Cannot expand IN statement");
|
|
155
|
+
if (mode === "params") {
|
|
156
|
+
builder.addSQL(` IN (`);
|
|
157
|
+
const expandedArray = {
|
|
158
|
+
...inValues,
|
|
159
|
+
mode: "params"
|
|
160
|
+
};
|
|
161
|
+
arrayProcessor.handle(expandedArray, context);
|
|
162
|
+
builder.addSQL(`)`);
|
|
163
|
+
} else {
|
|
164
|
+
builder.addSQL(` = ANY (`);
|
|
165
|
+
arrayProcessor.handle(inValues, context);
|
|
166
|
+
builder.addSQL(`)`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/storage/postgresql/core/sql/processors/columProcessors.ts
|
|
173
|
+
const mapColumnType = (token, { builder }) => {
|
|
174
|
+
let columnSQL;
|
|
175
|
+
const { sqlTokenType } = token;
|
|
176
|
+
switch (sqlTokenType) {
|
|
177
|
+
case "SQL_COLUMN_AUTO_INCREMENT":
|
|
178
|
+
columnSQL = `${token.bigint ? "BIGSERIAL" : "SERIAL"} ${token.primaryKey ? "PRIMARY KEY" : ""}`;
|
|
179
|
+
break;
|
|
180
|
+
case "SQL_COLUMN_BIGINT":
|
|
181
|
+
columnSQL = "BIGINT";
|
|
182
|
+
break;
|
|
183
|
+
case "SQL_COLUMN_SERIAL":
|
|
184
|
+
columnSQL = "SERIAL";
|
|
185
|
+
break;
|
|
186
|
+
case "SQL_COLUMN_INTEGER":
|
|
187
|
+
columnSQL = "INTEGER";
|
|
188
|
+
break;
|
|
189
|
+
case "SQL_COLUMN_JSONB":
|
|
190
|
+
columnSQL = "JSONB";
|
|
191
|
+
break;
|
|
192
|
+
case "SQL_COLUMN_BIGSERIAL":
|
|
193
|
+
columnSQL = "BIGSERIAL";
|
|
194
|
+
break;
|
|
195
|
+
case "SQL_COLUMN_TIMESTAMP":
|
|
196
|
+
columnSQL = "TIMESTAMP";
|
|
197
|
+
break;
|
|
198
|
+
case "SQL_COLUMN_TIMESTAMPTZ":
|
|
199
|
+
columnSQL = "TIMESTAMPTZ";
|
|
200
|
+
break;
|
|
201
|
+
case "SQL_COLUMN_VARCHAR":
|
|
202
|
+
columnSQL = `VARCHAR ${Number.isNaN(token.length) ? "" : `(${token.length})`}`;
|
|
203
|
+
break;
|
|
204
|
+
default: throw new Error(`Unknown column type: ${sqlTokenType}`);
|
|
205
|
+
}
|
|
206
|
+
builder.addSQL(columnSQL);
|
|
207
|
+
};
|
|
208
|
+
const postgreSQLColumnProcessors = mapDefaultSQLColumnProcessors(mapColumnType);
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/storage/postgresql/core/sql/formatter/reserved.ts
|
|
212
|
+
const reservedMap = {
|
|
213
|
+
AES128: true,
|
|
214
|
+
AES256: true,
|
|
215
|
+
ALL: true,
|
|
216
|
+
ALLOWOVERWRITE: true,
|
|
217
|
+
ANALYSE: true,
|
|
218
|
+
ANALYZE: true,
|
|
219
|
+
AND: true,
|
|
220
|
+
ANY: true,
|
|
221
|
+
ARRAY: true,
|
|
222
|
+
AS: true,
|
|
223
|
+
ASC: true,
|
|
224
|
+
AUTHORIZATION: true,
|
|
225
|
+
BACKUP: true,
|
|
226
|
+
BETWEEN: true,
|
|
227
|
+
BINARY: true,
|
|
228
|
+
BLANKSASNULL: true,
|
|
229
|
+
BOTH: true,
|
|
230
|
+
BYTEDICT: true,
|
|
231
|
+
CASE: true,
|
|
232
|
+
CAST: true,
|
|
233
|
+
CHECK: true,
|
|
234
|
+
COLLATE: true,
|
|
235
|
+
COLUMN: true,
|
|
236
|
+
CONSTRAINT: true,
|
|
237
|
+
CREATE: true,
|
|
238
|
+
CREDENTIALS: true,
|
|
239
|
+
CROSS: true,
|
|
240
|
+
CURRENT_DATE: true,
|
|
241
|
+
CURRENT_TIME: true,
|
|
242
|
+
CURRENT_TIMESTAMP: true,
|
|
243
|
+
CURRENT_USER: true,
|
|
244
|
+
CURRENT_USER_ID: true,
|
|
245
|
+
DEFAULT: true,
|
|
246
|
+
DEFERRABLE: true,
|
|
247
|
+
DEFLATE: true,
|
|
248
|
+
DEFRAG: true,
|
|
249
|
+
DELTA: true,
|
|
250
|
+
DELTA32K: true,
|
|
251
|
+
DESC: true,
|
|
252
|
+
DISABLE: true,
|
|
253
|
+
DISTINCT: true,
|
|
254
|
+
DO: true,
|
|
255
|
+
ELSE: true,
|
|
256
|
+
EMPTYASNULL: true,
|
|
257
|
+
ENABLE: true,
|
|
258
|
+
ENCODE: true,
|
|
259
|
+
ENCRYPT: true,
|
|
260
|
+
ENCRYPTION: true,
|
|
261
|
+
END: true,
|
|
262
|
+
EXCEPT: true,
|
|
263
|
+
EXPLICIT: true,
|
|
264
|
+
FALSE: true,
|
|
265
|
+
FOR: true,
|
|
266
|
+
FOREIGN: true,
|
|
267
|
+
FREEZE: true,
|
|
268
|
+
FROM: true,
|
|
269
|
+
FULL: true,
|
|
270
|
+
GLOBALDICT256: true,
|
|
271
|
+
GLOBALDICT64K: true,
|
|
272
|
+
GRANT: true,
|
|
273
|
+
GROUP: true,
|
|
274
|
+
GZIP: true,
|
|
275
|
+
HAVING: true,
|
|
276
|
+
IDENTITY: true,
|
|
277
|
+
IGNORE: true,
|
|
278
|
+
ILIKE: true,
|
|
279
|
+
IN: true,
|
|
280
|
+
INITIALLY: true,
|
|
281
|
+
INNER: true,
|
|
282
|
+
INTERSECT: true,
|
|
283
|
+
INTO: true,
|
|
284
|
+
IS: true,
|
|
285
|
+
ISNULL: true,
|
|
286
|
+
JOIN: true,
|
|
287
|
+
LEADING: true,
|
|
288
|
+
LEFT: true,
|
|
289
|
+
LIKE: true,
|
|
290
|
+
LIMIT: true,
|
|
291
|
+
LOCALTIME: true,
|
|
292
|
+
LOCALTIMESTAMP: true,
|
|
293
|
+
LUN: true,
|
|
294
|
+
LUNS: true,
|
|
295
|
+
LZO: true,
|
|
296
|
+
LZOP: true,
|
|
297
|
+
MINUS: true,
|
|
298
|
+
MOSTLY13: true,
|
|
299
|
+
MOSTLY32: true,
|
|
300
|
+
MOSTLY8: true,
|
|
301
|
+
NATURAL: true,
|
|
302
|
+
NEW: true,
|
|
303
|
+
NOT: true,
|
|
304
|
+
NOTNULL: true,
|
|
305
|
+
NULL: true,
|
|
306
|
+
NULLS: true,
|
|
307
|
+
OFF: true,
|
|
308
|
+
OFFLINE: true,
|
|
309
|
+
OFFSET: true,
|
|
310
|
+
OLD: true,
|
|
311
|
+
ON: true,
|
|
312
|
+
ONLY: true,
|
|
313
|
+
OPEN: true,
|
|
314
|
+
OR: true,
|
|
315
|
+
ORDER: true,
|
|
316
|
+
OUTER: true,
|
|
317
|
+
OVERLAPS: true,
|
|
318
|
+
PARALLEL: true,
|
|
319
|
+
PARTITION: true,
|
|
320
|
+
PERCENT: true,
|
|
321
|
+
PLACING: true,
|
|
322
|
+
PRIMARY: true,
|
|
323
|
+
RAW: true,
|
|
324
|
+
READRATIO: true,
|
|
325
|
+
RECOVER: true,
|
|
326
|
+
REFERENCES: true,
|
|
327
|
+
REJECTLOG: true,
|
|
328
|
+
RESORT: true,
|
|
329
|
+
RESTORE: true,
|
|
330
|
+
RIGHT: true,
|
|
331
|
+
SELECT: true,
|
|
332
|
+
SESSION_USER: true,
|
|
333
|
+
SIMILAR: true,
|
|
334
|
+
SOME: true,
|
|
335
|
+
SYSDATE: true,
|
|
336
|
+
SYSTEM: true,
|
|
337
|
+
TABLE: true,
|
|
338
|
+
TAG: true,
|
|
339
|
+
TDES: true,
|
|
340
|
+
TEXT255: true,
|
|
341
|
+
TEXT32K: true,
|
|
342
|
+
THEN: true,
|
|
343
|
+
TO: true,
|
|
344
|
+
TOP: true,
|
|
345
|
+
TRAILING: true,
|
|
346
|
+
TRUE: true,
|
|
347
|
+
TRUNCATECOLUMNS: true,
|
|
348
|
+
UNION: true,
|
|
349
|
+
UNIQUE: true,
|
|
350
|
+
USER: true,
|
|
351
|
+
USING: true,
|
|
352
|
+
VERBOSE: true,
|
|
353
|
+
WALLET: true,
|
|
354
|
+
WHEN: true,
|
|
355
|
+
WHERE: true,
|
|
356
|
+
WITH: true,
|
|
357
|
+
WITHOUT: true
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/storage/postgresql/core/sql/formatter/index.ts
|
|
362
|
+
const pgFormatter = SQLFormatter({
|
|
363
|
+
processorsRegistry: SQLProcessorsRegistry({ from: defaultProcessorsRegistry }).register(postgreSQLColumnProcessors).register(PostgreSQLArrayProcessor, PostgreSQLExpandSQLInProcessor),
|
|
364
|
+
valueMapper: {
|
|
365
|
+
mapDate: (value) => value.toISOString().replace("T", " ").replace("Z", "+00"),
|
|
366
|
+
mapPlaceholder: (index) => `$${index + 1}`,
|
|
367
|
+
mapIdentifier: (value) => mapSQLIdentifier(value, { reservedWords: reservedMap }),
|
|
368
|
+
mapArray: (values) => values
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
registerFormatter("PostgreSQL", pgFormatter);
|
|
372
|
+
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/storage/postgresql/core/index.ts
|
|
375
|
+
const PostgreSQLDatabaseName = "PostgreSQL";
|
|
376
|
+
|
|
377
|
+
//#endregion
|
|
378
|
+
export { PostgreSQLExpandSQLInProcessor as a, acquireAdvisoryLock as c, tryAcquireAdvisoryLock as d, mapPostgresError as f, PostgreSQLArrayProcessor as i, advisoryLock as l, pgFormatter as n, DefaultPostgreSQLMigratorOptions as o, postgreSQLColumnProcessors as r, AdvisoryLock as s, PostgreSQLDatabaseName as t, releaseAdvisoryLock as u };
|
|
379
|
+
//# sourceMappingURL=core-Bf2ujUFy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-Bf2ujUFy.js","names":[],"sources":["../src/storage/postgresql/core/errors/errorMapper.ts","../src/storage/postgresql/core/locks/advisoryLocks.ts","../src/storage/postgresql/core/schema/migrations.ts","../src/storage/postgresql/core/sql/processors/arrayProcessors.ts","../src/storage/postgresql/core/sql/processors/columProcessors.ts","../src/storage/postgresql/core/sql/formatter/reserved.ts","../src/storage/postgresql/core/sql/formatter/index.ts","../src/storage/postgresql/core/index.ts"],"sourcesContent":["import {\n AdminShutdownError,\n CheckViolationError,\n ConnectionError,\n DataError,\n DeadlockError,\n DumboError,\n ExclusionViolationError,\n ForeignKeyViolationError,\n InsufficientResourcesError,\n IntegrityConstraintViolationError,\n InvalidOperationError,\n LockNotAvailableError,\n NotNullViolationError,\n QueryCanceledError,\n SerializationError,\n SystemError,\n UniqueConstraintError,\n} from '../../../../core/errors';\n\n/**\n * Checks whether the given error looks like a PostgreSQL DatabaseError\n * from the `pg` driver (has a string `code` property with a SQLSTATE value).\n */\nconst getPostgresErrorCode = (error: unknown): string | undefined => {\n if (\n error instanceof Error &&\n 'code' in error &&\n typeof (error as Record<string, unknown>).code === 'string'\n ) {\n return (error as Record<string, unknown>).code as string;\n }\n return undefined;\n};\n\nconst getErrorMessage = (error: unknown): string | undefined =>\n error instanceof Error ? error.message : undefined;\n\nconst asError = (error: unknown): Error | undefined =>\n error instanceof Error ? error : undefined;\n\n/**\n * Maps a PostgreSQL error (from the `pg` driver) to a typed DumboError\n * based on the SQLSTATE code.\n *\n * SQLSTATE reference: https://www.postgresql.org/docs/current/errcodes-appendix.html\n * Transient classification based on Npgsql's PostgresException.IsTransient.\n *\n * Falls back to a generic DumboError (500) if the error is not a recognized PostgreSQL error.\n */\nexport const mapPostgresError = (error: unknown): DumboError => {\n if (DumboError.isInstanceOf<DumboError>(error)) return error;\n\n const code = getPostgresErrorCode(error);\n if (!code)\n return new DumboError({\n errorCode: 500,\n message: getErrorMessage(error),\n innerError: asError(error),\n });\n\n const message = getErrorMessage(error);\n const innerError = asError(error);\n\n // Exact SQLSTATE matches first, then class prefix fallbacks\n\n switch (code) {\n // ── Class 23: Integrity Constraint Violations ──\n case '23505':\n return new UniqueConstraintError(message, innerError);\n case '23503':\n return new ForeignKeyViolationError(message, innerError);\n case '23502':\n return new NotNullViolationError(message, innerError);\n case '23514':\n return new CheckViolationError(message, innerError);\n case '23P01':\n return new ExclusionViolationError(message, innerError);\n\n // ── Class 40: Transaction Rollback ──\n case '40001':\n return new SerializationError(message, innerError);\n case '40P01':\n return new DeadlockError(message, innerError);\n\n // ── Class 55: Object Not In Prerequisite State ──\n case '55P03':\n case '55006':\n return new LockNotAvailableError(message, innerError);\n\n // ── Class 57: Operator Intervention ──\n case '57014': // query_canceled (e.g. statement timeout)\n return new QueryCanceledError(message, innerError);\n case '57P01': // admin shutdown\n case '57P02': // crash shutdown\n return new AdminShutdownError(message, innerError);\n case '57P03': // cannot connect now\n case '57P05': // idle session timeout\n return new ConnectionError(message, innerError);\n }\n\n // Class prefix fallbacks (first 2 characters of the SQLSTATE code)\n const sqlClass = code.slice(0, 2);\n\n switch (sqlClass) {\n // ── Class 08: Connection Exception ──\n case '08':\n return new ConnectionError(message, innerError);\n\n // ── Class 22: Data Exception ──\n case '22':\n return new DataError(message, innerError);\n\n // ── Class 23: Integrity Constraint (fallback for unknown codes) ──\n case '23':\n return new IntegrityConstraintViolationError(message, innerError);\n\n // ── Class 42: Syntax Error or Access Rule Violation ──\n case '42':\n return new InvalidOperationError(message, innerError);\n\n // ── Class 53: Insufficient Resources ──\n case '53':\n return new InsufficientResourcesError(message, innerError);\n\n // ── Class 57: Operator Intervention (fallback) ──\n case '57':\n return new ConnectionError(message, innerError);\n\n // ── Class 58: System Error ──\n case '58':\n return new SystemError(message, innerError);\n }\n\n return new DumboError({\n errorCode: 500,\n message,\n innerError,\n });\n};\n","import {\n defaultDatabaseLockOptions,\n single,\n SQL,\n type AcquireDatabaseLockMode,\n type AcquireDatabaseLockOptions,\n type DatabaseLock,\n type DatabaseLockOptions,\n type ReleaseDatabaseLockOptions,\n type SQLExecutor,\n} from '../../../../core';\nimport { DumboError, QueryCanceledError } from '../../../../core/errors';\n\nexport const tryAcquireAdvisoryLock = async (\n execute: SQLExecutor,\n options: AcquireDatabaseLockOptions,\n): Promise<boolean> => {\n const timeoutMs = options.timeoutMs ?? defaultDatabaseLockOptions.timeoutMs;\n\n const advisoryLock =\n options.mode === 'Permanent' ? 'pg_advisory_lock' : 'pg_advisory_xact_lock';\n\n try {\n await single(\n execute.query<{ locked: boolean }>(\n SQL`SELECT ${SQL.plain(advisoryLock)}(${options.lockId}) AS locked`,\n { timeoutMs },\n ),\n );\n return true;\n } catch (error) {\n if (\n error instanceof QueryCanceledError ||\n DumboError.isInstanceOf(error, {\n errorType: QueryCanceledError.ErrorType,\n })\n )\n return false;\n\n throw error;\n }\n};\n\nexport const releaseAdvisoryLock = async (\n execute: SQLExecutor,\n options: ReleaseDatabaseLockOptions,\n): Promise<boolean> => {\n const timeoutMs = options.timeoutMs ?? defaultDatabaseLockOptions.timeoutMs;\n\n try {\n await single(\n execute.query<{ locked: boolean }>(\n SQL`SELECT pg_advisory_unlock(${options.lockId}) AS locked`,\n { timeoutMs },\n ),\n );\n return true;\n } catch (error) {\n if (\n error instanceof QueryCanceledError ||\n DumboError.isInstanceOf(error, {\n errorType: QueryCanceledError.ErrorType,\n })\n )\n return false;\n\n throw error;\n }\n};\n\nexport const acquireAdvisoryLock = async (\n execute: SQLExecutor,\n options: AcquireDatabaseLockOptions,\n) => {\n const lockAcquired = await tryAcquireAdvisoryLock(execute, options);\n if (!lockAcquired) {\n throw new Error(\n 'Failed to acquire advisory lock within the specified timeout. Migration aborted.',\n );\n }\n};\n\nexport const AdvisoryLock: DatabaseLock = {\n acquire: acquireAdvisoryLock,\n tryAcquire: tryAcquireAdvisoryLock,\n release: releaseAdvisoryLock,\n withAcquire: async <Result>(\n execute: SQLExecutor,\n handle: () => Promise<Result>,\n options: AcquireDatabaseLockOptions,\n ) => {\n await acquireAdvisoryLock(execute, options);\n try {\n return await handle();\n } finally {\n if (options.mode === 'Permanent')\n await releaseAdvisoryLock(execute, options);\n }\n },\n};\n\nexport const advisoryLock = (\n execute: SQLExecutor,\n options: DatabaseLockOptions,\n) => ({\n acquire: (acquireOptions?: { mode: AcquireDatabaseLockMode }) =>\n acquireAdvisoryLock(execute, {\n ...options,\n ...(acquireOptions ?? {}),\n }),\n tryAcquire: (acquireOptions?: { mode: AcquireDatabaseLockMode }) =>\n tryAcquireAdvisoryLock(execute, {\n ...options,\n ...(acquireOptions ?? {}),\n }),\n release: () => releaseAdvisoryLock(execute, options),\n withAcquire: async <Result>(\n handle: () => Promise<Result>,\n acquireOptions?: { mode: AcquireDatabaseLockMode },\n ) => {\n await acquireAdvisoryLock(execute, {\n ...options,\n ...(acquireOptions ?? {}),\n });\n try {\n return await handle();\n } finally {\n await releaseAdvisoryLock(execute, options);\n }\n },\n});\n","import {\n type MigratorOptions,\n registerDefaultMigratorOptions,\n} from '../../../../core';\nimport { AdvisoryLock } from '../locks';\n\nexport const DefaultPostgreSQLMigratorOptions: MigratorOptions = {\n lock: {\n databaseLock: AdvisoryLock,\n },\n};\n\nregisterDefaultMigratorOptions('PostgreSQL', DefaultPostgreSQLMigratorOptions);\n","import type { SQLIn } from '../../../../../core';\nimport {\n SQLArray,\n SQLProcessor,\n type SQLProcessorContext,\n} from '../../../../../core';\n\nexport const PostgreSQLArrayProcessor: SQLProcessor<SQLArray> = SQLProcessor({\n canHandle: 'SQL_ARRAY',\n handle: (\n token: SQLArray,\n { builder, mapper, serializer }: SQLProcessorContext,\n ) => {\n if (token.value.length === 0) {\n throw new Error(\n \"Empty arrays are not supported. If you're using it with SELECT IN statement Use SQL.in(column, array) helper instead.\",\n );\n }\n const mappedValue = mapper.mapValue(token.value, serializer) as unknown[];\n\n if (token.mode === 'params') {\n builder.addParams(mappedValue);\n } else {\n builder.addParam(mappedValue);\n }\n },\n});\n\nexport const PostgreSQLExpandSQLInProcessor: SQLProcessor<SQLIn> = SQLProcessor(\n {\n canHandle: 'SQL_IN',\n handle: (token: SQLIn, context: SQLProcessorContext) => {\n const { builder, mapper, processorsRegistry } = context;\n const { values: inValues, column, mode } = token;\n\n if (inValues.value.length === 0) {\n builder.addParam(mapper.mapValue(false, context.serializer));\n return;\n }\n\n builder.addSQL(\n mapper.mapValue(column.value, context.serializer) as string,\n );\n const arrayProcessor = processorsRegistry.get(SQLArray.type);\n\n if (!arrayProcessor) {\n throw new Error(\n 'No sql processor registered for an array. Cannot expand IN statement',\n );\n }\n\n if (mode === 'params') {\n builder.addSQL(` IN (`);\n const expandedArray = { ...inValues, mode: 'params' as const };\n arrayProcessor.handle(expandedArray, context);\n builder.addSQL(`)`);\n } else {\n builder.addSQL(` = ANY (`);\n arrayProcessor.handle(inValues, context);\n builder.addSQL(`)`);\n }\n },\n },\n);\n","import {\n mapDefaultSQLColumnProcessors,\n type DefaultSQLColumnProcessors,\n type DefaultSQLColumnToken,\n type SQLProcessorContext,\n} from '../../../../../core';\n\nconst mapColumnType = (\n token: DefaultSQLColumnToken,\n { builder }: SQLProcessorContext,\n): void => {\n let columnSQL: string;\n const { sqlTokenType } = token;\n switch (sqlTokenType) {\n case 'SQL_COLUMN_AUTO_INCREMENT':\n columnSQL = `${token.bigint ? 'BIGSERIAL' : 'SERIAL'} ${token.primaryKey ? 'PRIMARY KEY' : ''}`;\n break;\n case 'SQL_COLUMN_BIGINT':\n columnSQL = 'BIGINT';\n break;\n case 'SQL_COLUMN_SERIAL':\n columnSQL = 'SERIAL';\n break;\n case 'SQL_COLUMN_INTEGER':\n columnSQL = 'INTEGER';\n break;\n case 'SQL_COLUMN_JSONB':\n columnSQL = 'JSONB';\n break;\n case 'SQL_COLUMN_BIGSERIAL':\n columnSQL = 'BIGSERIAL';\n break;\n case 'SQL_COLUMN_TIMESTAMP':\n columnSQL = 'TIMESTAMP';\n break;\n case 'SQL_COLUMN_TIMESTAMPTZ':\n columnSQL = 'TIMESTAMPTZ';\n break;\n case 'SQL_COLUMN_VARCHAR':\n columnSQL = `VARCHAR ${Number.isNaN(token.length) ? '' : `(${token.length})`}`;\n break;\n default: {\n const exhaustiveCheck: never = sqlTokenType;\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n throw new Error(`Unknown column type: ${exhaustiveCheck}`);\n }\n }\n builder.addSQL(columnSQL);\n};\n\nexport const postgreSQLColumnProcessors: DefaultSQLColumnProcessors =\n mapDefaultSQLColumnProcessors(mapColumnType);\n","// Ported from: https://github.com/datalanche/node-pg-format/blob/master/lib/reserved.js\n//\n// PostgreSQL reserved words\n//\nconst reservedMap: { [key: string]: boolean } = {\n AES128: true,\n AES256: true,\n ALL: true,\n ALLOWOVERWRITE: true,\n ANALYSE: true,\n ANALYZE: true,\n AND: true,\n ANY: true,\n ARRAY: true,\n AS: true,\n ASC: true,\n AUTHORIZATION: true,\n BACKUP: true,\n BETWEEN: true,\n BINARY: true,\n BLANKSASNULL: true,\n BOTH: true,\n BYTEDICT: true,\n CASE: true,\n CAST: true,\n CHECK: true,\n COLLATE: true,\n COLUMN: true,\n CONSTRAINT: true,\n CREATE: true,\n CREDENTIALS: true,\n CROSS: true,\n CURRENT_DATE: true,\n CURRENT_TIME: true,\n CURRENT_TIMESTAMP: true,\n CURRENT_USER: true,\n CURRENT_USER_ID: true,\n DEFAULT: true,\n DEFERRABLE: true,\n DEFLATE: true,\n DEFRAG: true,\n DELTA: true,\n DELTA32K: true,\n DESC: true,\n DISABLE: true,\n DISTINCT: true,\n DO: true,\n ELSE: true,\n EMPTYASNULL: true,\n ENABLE: true,\n ENCODE: true,\n ENCRYPT: true,\n ENCRYPTION: true,\n END: true,\n EXCEPT: true,\n EXPLICIT: true,\n FALSE: true,\n FOR: true,\n FOREIGN: true,\n FREEZE: true,\n FROM: true,\n FULL: true,\n GLOBALDICT256: true,\n GLOBALDICT64K: true,\n GRANT: true,\n GROUP: true,\n GZIP: true,\n HAVING: true,\n IDENTITY: true,\n IGNORE: true,\n ILIKE: true,\n IN: true,\n INITIALLY: true,\n INNER: true,\n INTERSECT: true,\n INTO: true,\n IS: true,\n ISNULL: true,\n JOIN: true,\n LEADING: true,\n LEFT: true,\n LIKE: true,\n LIMIT: true,\n LOCALTIME: true,\n LOCALTIMESTAMP: true,\n LUN: true,\n LUNS: true,\n LZO: true,\n LZOP: true,\n MINUS: true,\n MOSTLY13: true,\n MOSTLY32: true,\n MOSTLY8: true,\n NATURAL: true,\n NEW: true,\n NOT: true,\n NOTNULL: true,\n NULL: true,\n NULLS: true,\n OFF: true,\n OFFLINE: true,\n OFFSET: true,\n OLD: true,\n ON: true,\n ONLY: true,\n OPEN: true,\n OR: true,\n ORDER: true,\n OUTER: true,\n OVERLAPS: true,\n PARALLEL: true,\n PARTITION: true,\n PERCENT: true,\n PLACING: true,\n PRIMARY: true,\n RAW: true,\n READRATIO: true,\n RECOVER: true,\n REFERENCES: true,\n REJECTLOG: true,\n RESORT: true,\n RESTORE: true,\n RIGHT: true,\n SELECT: true,\n SESSION_USER: true,\n SIMILAR: true,\n SOME: true,\n SYSDATE: true,\n SYSTEM: true,\n TABLE: true,\n TAG: true,\n TDES: true,\n TEXT255: true,\n TEXT32K: true,\n THEN: true,\n TO: true,\n TOP: true,\n TRAILING: true,\n TRUE: true,\n TRUNCATECOLUMNS: true,\n UNION: true,\n UNIQUE: true,\n USER: true,\n USING: true,\n VERBOSE: true,\n WALLET: true,\n WHEN: true,\n WHERE: true,\n WITH: true,\n WITHOUT: true,\n};\n\nexport default reservedMap;\n","import {\n defaultProcessorsRegistry,\n mapSQLIdentifier,\n registerFormatter,\n SQLFormatter,\n SQLProcessorsRegistry,\n} from '../../../../../core';\nimport {\n PostgreSQLArrayProcessor,\n postgreSQLColumnProcessors,\n PostgreSQLExpandSQLInProcessor,\n} from '../processors';\nimport reservedMap from './reserved';\n\nconst postgreSQLProcessorsRegistry = SQLProcessorsRegistry({\n from: defaultProcessorsRegistry,\n})\n .register(postgreSQLColumnProcessors)\n .register(PostgreSQLArrayProcessor, PostgreSQLExpandSQLInProcessor);\n\nconst pgFormatter: SQLFormatter = SQLFormatter({\n processorsRegistry: postgreSQLProcessorsRegistry,\n valueMapper: {\n mapDate: (value: Date): unknown =>\n value.toISOString().replace('T', ' ').replace('Z', '+00'),\n mapPlaceholder: (index: number): string => `$${index + 1}`,\n mapIdentifier: (value: string): string =>\n mapSQLIdentifier(value, { reservedWords: reservedMap }),\n mapArray: (values: unknown[]): unknown[] => values,\n },\n});\n\nregisterFormatter('PostgreSQL', pgFormatter);\n\n// Export the original functions if needed\nexport { pgFormatter };\n","import type { DatabaseDriverType } from '../../../core';\n\nexport * from './connections';\nexport * from './errors';\nexport * from './locks';\nexport * from './schema';\nexport * from './sql';\n\nexport type PostgreSQLDatabaseName = 'PostgreSQL';\nexport const PostgreSQLDatabaseName = 'PostgreSQL';\n\nexport type PostgreSQLDriverType<DriverName extends string = string> =\n DatabaseDriverType<PostgreSQLDatabaseName, DriverName>;\n"],"mappings":";;;;;;;;AAwBA,MAAM,wBAAwB,UAAuC;AACnE,KACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAAkC,SAAS,SAEnD,QAAQ,MAAkC;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