@fedify/postgres 2.0.8 → 2.0.9
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/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +3 -12
- package/dist/kv.cjs +6 -10
- package/dist/kv.js +2 -6
- package/dist/mod.cjs +5 -7
- package/dist/mod.js +2 -5
- package/dist/mq.cjs +12 -16
- package/dist/mq.js +5 -11
- package/dist/utils.cjs +3 -8
- package/dist/utils.js +3 -7
- package/package.json +5 -5
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region rolldown:runtime
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
5
3
|
var __create = Object.create;
|
|
6
4
|
var __defProp = Object.defineProperty;
|
|
7
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -22,12 +20,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
20
|
value: mod,
|
|
23
21
|
enumerable: true
|
|
24
22
|
}) : target, mod));
|
|
25
|
-
|
|
26
23
|
//#endregion
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, '__toESM', {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
return __toESM;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
24
|
+
exports.__toESM = __toESM;
|
package/dist/kv.cjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const require_utils = require('./utils.cjs');
|
|
6
|
-
const __logtape_logtape = require_rolldown_runtime.__toESM(require("@logtape/logtape"));
|
|
7
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_utils = require("./utils.cjs");
|
|
8
5
|
//#region src/kv.ts
|
|
9
|
-
const logger = (0,
|
|
6
|
+
const logger = (0, require("@logtape/logtape").getLogger)([
|
|
10
7
|
"fedify",
|
|
11
8
|
"postgres",
|
|
12
9
|
"kv"
|
|
@@ -140,6 +137,5 @@ var PostgresKvStore = class {
|
|
|
140
137
|
return this.#sql.json(JSON.stringify(value));
|
|
141
138
|
}
|
|
142
139
|
};
|
|
143
|
-
|
|
144
140
|
//#endregion
|
|
145
|
-
exports.PostgresKvStore = PostgresKvStore;
|
|
141
|
+
exports.PostgresKvStore = PostgresKvStore;
|
package/dist/kv.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
import { driverSerializesJson } from "./utils.js";
|
|
5
3
|
import { getLogger } from "@logtape/logtape";
|
|
6
|
-
|
|
7
4
|
//#region src/kv.ts
|
|
8
5
|
const logger = getLogger([
|
|
9
6
|
"fedify",
|
|
@@ -139,6 +136,5 @@ var PostgresKvStore = class {
|
|
|
139
136
|
return this.#sql.json(JSON.stringify(value));
|
|
140
137
|
}
|
|
141
138
|
};
|
|
142
|
-
|
|
143
139
|
//#endregion
|
|
144
|
-
export { PostgresKvStore };
|
|
140
|
+
export { PostgresKvStore };
|
package/dist/mod.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const require_mq = require('./mq.cjs');
|
|
6
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_kv = require("./kv.cjs");
|
|
4
|
+
const require_mq = require("./mq.cjs");
|
|
7
5
|
exports.PostgresKvStore = require_kv.PostgresKvStore;
|
|
8
|
-
exports.PostgresMessageQueue = require_mq.PostgresMessageQueue;
|
|
6
|
+
exports.PostgresMessageQueue = require_mq.PostgresMessageQueue;
|
package/dist/mod.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
import { PostgresKvStore } from "./kv.js";
|
|
5
3
|
import { PostgresMessageQueue } from "./mq.js";
|
|
6
|
-
|
|
7
|
-
export { PostgresKvStore, PostgresMessageQueue };
|
|
4
|
+
export { PostgresKvStore, PostgresMessageQueue };
|
package/dist/mq.cjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_utils = require("./utils.cjs");
|
|
5
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
6
|
+
let postgres = require("postgres");
|
|
7
|
+
postgres = require_runtime.__toESM(postgres);
|
|
9
8
|
//#region src/mq.ts
|
|
10
|
-
const logger = (0,
|
|
9
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
11
10
|
"fedify",
|
|
12
11
|
"postgres",
|
|
13
12
|
"mq"
|
|
@@ -176,13 +175,12 @@ var PostgresMessageQueue = class {
|
|
|
176
175
|
attemptedOrderingKeys.add(orderingKey);
|
|
177
176
|
const reserved = await this.#sql.reserve();
|
|
178
177
|
try {
|
|
179
|
-
|
|
178
|
+
if ((await reserved`
|
|
180
179
|
SELECT pg_try_advisory_lock(
|
|
181
180
|
hashtext(${this.#tableName}),
|
|
182
181
|
hashtext(${orderingKey})
|
|
183
182
|
) AS acquired
|
|
184
|
-
|
|
185
|
-
if (lockResult[0].acquired) {
|
|
183
|
+
`)[0].acquired) {
|
|
186
184
|
try {
|
|
187
185
|
const deleteResult = await reserved`
|
|
188
186
|
DELETE FROM ${reserved(this.#tableName)}
|
|
@@ -231,8 +229,7 @@ var PostgresMessageQueue = class {
|
|
|
231
229
|
const timeouts = /* @__PURE__ */ new Set();
|
|
232
230
|
const listen = await this.#sql.listen(this.#channelName, async (delay) => {
|
|
233
231
|
try {
|
|
234
|
-
const
|
|
235
|
-
const durationMs = duration.total("millisecond");
|
|
232
|
+
const durationMs = Temporal.Duration.from(delay).total("millisecond");
|
|
236
233
|
if (durationMs < 1) await safeSerializedPoll("notify-immediate");
|
|
237
234
|
else {
|
|
238
235
|
const timeout = setTimeout(() => {
|
|
@@ -330,6 +327,5 @@ var PostgresMessageQueue = class {
|
|
|
330
327
|
return this.#sql.json(JSON.stringify(value));
|
|
331
328
|
}
|
|
332
329
|
};
|
|
333
|
-
|
|
334
330
|
//#endregion
|
|
335
|
-
exports.PostgresMessageQueue = PostgresMessageQueue;
|
|
331
|
+
exports.PostgresMessageQueue = PostgresMessageQueue;
|
package/dist/mq.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
4
2
|
import { driverSerializesJson } from "./utils.js";
|
|
5
3
|
import { getLogger } from "@logtape/logtape";
|
|
6
4
|
import postgres from "postgres";
|
|
7
|
-
|
|
8
5
|
//#region src/mq.ts
|
|
9
6
|
const logger = getLogger([
|
|
10
7
|
"fedify",
|
|
@@ -175,13 +172,12 @@ var PostgresMessageQueue = class {
|
|
|
175
172
|
attemptedOrderingKeys.add(orderingKey);
|
|
176
173
|
const reserved = await this.#sql.reserve();
|
|
177
174
|
try {
|
|
178
|
-
|
|
175
|
+
if ((await reserved`
|
|
179
176
|
SELECT pg_try_advisory_lock(
|
|
180
177
|
hashtext(${this.#tableName}),
|
|
181
178
|
hashtext(${orderingKey})
|
|
182
179
|
) AS acquired
|
|
183
|
-
|
|
184
|
-
if (lockResult[0].acquired) {
|
|
180
|
+
`)[0].acquired) {
|
|
185
181
|
try {
|
|
186
182
|
const deleteResult = await reserved`
|
|
187
183
|
DELETE FROM ${reserved(this.#tableName)}
|
|
@@ -230,8 +226,7 @@ var PostgresMessageQueue = class {
|
|
|
230
226
|
const timeouts = /* @__PURE__ */ new Set();
|
|
231
227
|
const listen = await this.#sql.listen(this.#channelName, async (delay) => {
|
|
232
228
|
try {
|
|
233
|
-
const
|
|
234
|
-
const durationMs = duration.total("millisecond");
|
|
229
|
+
const durationMs = Temporal.Duration.from(delay).total("millisecond");
|
|
235
230
|
if (durationMs < 1) await safeSerializedPoll("notify-immediate");
|
|
236
231
|
else {
|
|
237
232
|
const timeout = setTimeout(() => {
|
|
@@ -329,6 +324,5 @@ var PostgresMessageQueue = class {
|
|
|
329
324
|
return this.#sql.json(JSON.stringify(value));
|
|
330
325
|
}
|
|
331
326
|
};
|
|
332
|
-
|
|
333
327
|
//#endregion
|
|
334
|
-
export { PostgresMessageQueue };
|
|
328
|
+
export { PostgresMessageQueue };
|
package/dist/utils.cjs
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
5
2
|
//#region src/utils.ts
|
|
6
3
|
async function driverSerializesJson(sql) {
|
|
7
|
-
|
|
8
|
-
return result[0].test === "{\"foo\":1}";
|
|
4
|
+
return (await sql`SELECT ${sql.json("{\"foo\":1}")}::jsonb AS test;`)[0].test === "{\"foo\":1}";
|
|
9
5
|
}
|
|
10
|
-
|
|
11
6
|
//#endregion
|
|
12
|
-
exports.driverSerializesJson = driverSerializesJson;
|
|
7
|
+
exports.driverSerializesJson = driverSerializesJson;
|
package/dist/utils.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
//#region src/utils.ts
|
|
5
3
|
async function driverSerializesJson(sql) {
|
|
6
|
-
|
|
7
|
-
return result[0].test === "{\"foo\":1}";
|
|
4
|
+
return (await sql`SELECT ${sql.json("{\"foo\":1}")}::jsonb AS test;`)[0].test === "{\"foo\":1}";
|
|
8
5
|
}
|
|
9
|
-
|
|
10
6
|
//#endregion
|
|
11
|
-
export { driverSerializesJson };
|
|
7
|
+
export { driverSerializesJson };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/postgres",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "PostgreSQL drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"postgres": "^3.4.7",
|
|
77
|
-
"@fedify/fedify": "^2.0.
|
|
77
|
+
"@fedify/fedify": "^2.0.9"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@std/async": "npm:@jsr/std__async@^1.0.13",
|
|
81
|
-
"tsdown": "^0.
|
|
82
|
-
"typescript": "^5.9.
|
|
81
|
+
"tsdown": "^0.21.6",
|
|
82
|
+
"typescript": "^5.9.2",
|
|
83
83
|
"@fedify/fixture": "^2.0.0",
|
|
84
|
-
"@fedify/testing": "^2.0.
|
|
84
|
+
"@fedify/testing": "^2.0.9"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build:self": "tsdown",
|