@rotorsoft/act-pg 1.13.4 → 1.13.6
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/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/postgres-store.d.ts.map +1 -1
- package/dist/index.cjs +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -53,10 +53,13 @@ var dateReviver = (_key, value) => {
|
|
|
53
53
|
var logger = (0, import_act.log)();
|
|
54
54
|
var SOURCE_METACHARACTER_CLASS = "[]^$.*+?()[{}|\\\\]";
|
|
55
55
|
var { Pool, types } = import_pg.default;
|
|
56
|
-
types.
|
|
57
|
-
|
|
58
|
-
(val) => JSON.parse(val, dateReviver)
|
|
59
|
-
|
|
56
|
+
var JSONB_OID = types.builtins.JSONB;
|
|
57
|
+
var scopedTypes = {
|
|
58
|
+
getTypeParser: ((oid, format) => oid === JSONB_OID ? (val) => JSON.parse(val, dateReviver) : types.getTypeParser(
|
|
59
|
+
oid,
|
|
60
|
+
format
|
|
61
|
+
))
|
|
62
|
+
};
|
|
60
63
|
var SAFE_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
61
64
|
var PG_UNIQUE_VIOLATION = "23505";
|
|
62
65
|
var NOTIFY_CHANNEL_PREFIX = "act_commit";
|
|
@@ -198,7 +201,7 @@ var PostgresStore = class {
|
|
|
198
201
|
pii_encryption: ___,
|
|
199
202
|
...poolConfig
|
|
200
203
|
} = this.config;
|
|
201
|
-
this._pool = new Pool(poolConfig);
|
|
204
|
+
this._pool = new Pool({ ...poolConfig, types: scopedTypes });
|
|
202
205
|
this._fqt = `"${this.config.schema}"."${this.config.table}"`;
|
|
203
206
|
this._fqs = `"${this.config.schema}"."${this.config.table}_streams"`;
|
|
204
207
|
this._channel = notify_channel(this.config.schema, this.config.table);
|
|
@@ -446,11 +449,11 @@ var PostgresStore = class {
|
|
|
446
449
|
query.stream_exact ? `stream = $${values.length}` : `stream ~ $${values.length}`
|
|
447
450
|
);
|
|
448
451
|
}
|
|
449
|
-
if (names
|
|
452
|
+
if (names !== void 0) {
|
|
450
453
|
values.push(names);
|
|
451
454
|
conditions.push(`name = ANY($${values.length})`);
|
|
452
455
|
}
|
|
453
|
-
if (before) {
|
|
456
|
+
if (before !== void 0) {
|
|
454
457
|
values.push(before);
|
|
455
458
|
conditions.push(`id<$${values.length}`);
|
|
456
459
|
}
|
|
@@ -1022,7 +1025,7 @@ var PostgresStore = class {
|
|
|
1022
1025
|
values.push(query.after);
|
|
1023
1026
|
conditions.push(`stream > $${values.length}`);
|
|
1024
1027
|
}
|
|
1025
|
-
let sql = `SELECT stream, source, at, retry, blocked, error, leased_by, leased_until, priority, lane FROM ${this._fqs}`;
|
|
1028
|
+
let sql = `SELECT stream, source, at, retry, blocked, error, leased_by, leased_until, priority, lane, deferred_at FROM ${this._fqs}`;
|
|
1026
1029
|
if (conditions.length) sql += " WHERE " + conditions.join(" AND ");
|
|
1027
1030
|
values.push(limit);
|
|
1028
1031
|
sql += ` ORDER BY stream LIMIT $${values.length}`;
|
|
@@ -1046,7 +1049,10 @@ var PostgresStore = class {
|
|
|
1046
1049
|
priority: row.priority,
|
|
1047
1050
|
leased_by: row.leased_by ?? void 0,
|
|
1048
1051
|
leased_until: row.leased_until ?? void 0,
|
|
1049
|
-
lane: row.lane
|
|
1052
|
+
lane: row.lane,
|
|
1053
|
+
// Persisted as timestamptz; surface as ms since epoch (#1221) so
|
|
1054
|
+
// the cold-start re-seed can re-arm the drain at the due-time.
|
|
1055
|
+
deferred_at: row.deferred_at ? row.deferred_at.getTime() : void 0
|
|
1050
1056
|
});
|
|
1051
1057
|
count++;
|
|
1052
1058
|
}
|