@fedify/mysql 2.1.0 → 2.1.2
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/kv.cjs +6 -12
- package/dist/kv.js +3 -8
- package/dist/mod.cjs +5 -7
- package/dist/mod.d.cts +1 -1
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +2 -5
- package/dist/mq.cjs +6 -11
- package/dist/mq.d.cts +1 -1
- package/dist/mq.d.ts +1 -1
- package/dist/mq.js +4 -8
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.cjs +0 -33
package/dist/kv.cjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
const es_toolkit = require_rolldown_runtime.__toESM(require("es-toolkit"));
|
|
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
|
+
let es_toolkit = require("es-toolkit");
|
|
8
4
|
//#region src/kv.ts
|
|
9
|
-
const logger = (0,
|
|
5
|
+
const logger = (0, require("@logtape/logtape").getLogger)([
|
|
10
6
|
"fedify",
|
|
11
7
|
"mysql",
|
|
12
8
|
"kv"
|
|
@@ -127,8 +123,7 @@ var MysqlKvStore = class {
|
|
|
127
123
|
WHERE \`key\` = ?
|
|
128
124
|
FOR UPDATE`, [serializedKey]);
|
|
129
125
|
const row = rows[0];
|
|
130
|
-
|
|
131
|
-
if (!(0, es_toolkit.isEqual)(currentValue, expectedValue)) {
|
|
126
|
+
if (!(0, es_toolkit.isEqual)(!row || row.is_expired ? void 0 : row.value, expectedValue)) {
|
|
132
127
|
await conn.rollback();
|
|
133
128
|
return false;
|
|
134
129
|
}
|
|
@@ -230,6 +225,5 @@ function durationToSeconds(duration) {
|
|
|
230
225
|
relativeTo: Temporal.Now.plainDateTimeISO()
|
|
231
226
|
});
|
|
232
227
|
}
|
|
233
|
-
|
|
234
228
|
//#endregion
|
|
235
|
-
exports.MysqlKvStore = MysqlKvStore;
|
|
229
|
+
exports.MysqlKvStore = MysqlKvStore;
|
package/dist/kv.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
4
2
|
import { isEqual } from "es-toolkit";
|
|
5
3
|
import { getLogger } from "@logtape/logtape";
|
|
6
|
-
|
|
7
4
|
//#region src/kv.ts
|
|
8
5
|
const logger = getLogger([
|
|
9
6
|
"fedify",
|
|
@@ -126,8 +123,7 @@ var MysqlKvStore = class {
|
|
|
126
123
|
WHERE \`key\` = ?
|
|
127
124
|
FOR UPDATE`, [serializedKey]);
|
|
128
125
|
const row = rows[0];
|
|
129
|
-
|
|
130
|
-
if (!isEqual(currentValue, expectedValue)) {
|
|
126
|
+
if (!isEqual(!row || row.is_expired ? void 0 : row.value, expectedValue)) {
|
|
131
127
|
await conn.rollback();
|
|
132
128
|
return false;
|
|
133
129
|
}
|
|
@@ -229,6 +225,5 @@ function durationToSeconds(duration) {
|
|
|
229
225
|
relativeTo: Temporal.Now.plainDateTimeISO()
|
|
230
226
|
});
|
|
231
227
|
}
|
|
232
|
-
|
|
233
228
|
//#endregion
|
|
234
|
-
export { MysqlKvStore };
|
|
229
|
+
export { MysqlKvStore };
|
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.MysqlKvStore = require_kv.MysqlKvStore;
|
|
8
|
-
exports.MysqlMessageQueue = require_mq.MysqlMessageQueue;
|
|
6
|
+
exports.MysqlMessageQueue = require_mq.MysqlMessageQueue;
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MysqlKvStore, MysqlKvStoreOptions } from "./kv.cjs";
|
|
2
2
|
import { MysqlMessageQueue, MysqlMessageQueueOptions } from "./mq.cjs";
|
|
3
|
-
export { MysqlKvStore, MysqlKvStoreOptions, MysqlMessageQueue, MysqlMessageQueueOptions };
|
|
3
|
+
export { MysqlKvStore, type MysqlKvStoreOptions, MysqlMessageQueue, type MysqlMessageQueueOptions };
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { MysqlKvStore, MysqlKvStoreOptions } from "./kv.js";
|
|
3
3
|
import { MysqlMessageQueue, MysqlMessageQueueOptions } from "./mq.js";
|
|
4
|
-
export { MysqlKvStore, MysqlKvStoreOptions, MysqlMessageQueue, MysqlMessageQueueOptions };
|
|
4
|
+
export { MysqlKvStore, type MysqlKvStoreOptions, MysqlMessageQueue, type MysqlMessageQueueOptions };
|
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 { MysqlKvStore } from "./kv.js";
|
|
5
3
|
import { MysqlMessageQueue } from "./mq.js";
|
|
6
|
-
|
|
7
|
-
export { MysqlKvStore, MysqlMessageQueue };
|
|
4
|
+
export { MysqlKvStore, MysqlMessageQueue };
|
package/dist/mq.cjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
const __logtape_logtape = require_rolldown_runtime.__toESM(require("@logtape/logtape"));
|
|
6
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
3
|
//#region src/mq.ts
|
|
8
|
-
const logger = (0,
|
|
4
|
+
const logger = (0, require("@logtape/logtape").getLogger)([
|
|
9
5
|
"fedify",
|
|
10
6
|
"mysql",
|
|
11
7
|
"mq"
|
|
@@ -267,7 +263,7 @@ var MysqlMessageQueue = class {
|
|
|
267
263
|
FOR UPDATE SKIP LOCKED`);
|
|
268
264
|
if (rows.length === 0) {
|
|
269
265
|
await conn.rollback();
|
|
270
|
-
return
|
|
266
|
+
return;
|
|
271
267
|
}
|
|
272
268
|
const { id, message } = rows[0];
|
|
273
269
|
await conn.query(`DELETE FROM \`${this.#tableName}\` WHERE \`id\` = ?`, [id]);
|
|
@@ -312,7 +308,7 @@ var MysqlMessageQueue = class {
|
|
|
312
308
|
LIMIT 1`, [orderingKey]);
|
|
313
309
|
if (rows.length === 0) {
|
|
314
310
|
await conn.rollback();
|
|
315
|
-
return
|
|
311
|
+
return;
|
|
316
312
|
}
|
|
317
313
|
const { id, message } = rows[0];
|
|
318
314
|
await conn.query(`DELETE FROM \`${this.#tableName}\` WHERE \`id\` = ?`, [id]);
|
|
@@ -390,6 +386,5 @@ var MysqlMessageQueue = class {
|
|
|
390
386
|
this.#initPromise = void 0;
|
|
391
387
|
}
|
|
392
388
|
};
|
|
393
|
-
|
|
394
389
|
//#endregion
|
|
395
|
-
exports.MysqlMessageQueue = MysqlMessageQueue;
|
|
390
|
+
exports.MysqlMessageQueue = MysqlMessageQueue;
|
package/dist/mq.d.cts
CHANGED
|
@@ -83,7 +83,7 @@ declare class MysqlMessageQueue implements MessageQueue {
|
|
|
83
83
|
* retries itself.
|
|
84
84
|
* @since 2.1.0
|
|
85
85
|
*/
|
|
86
|
-
readonly nativeRetrial
|
|
86
|
+
readonly nativeRetrial = false;
|
|
87
87
|
/**
|
|
88
88
|
* Creates a new MySQL message queue.
|
|
89
89
|
* @param pool The MySQL connection pool to use.
|
package/dist/mq.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ declare class MysqlMessageQueue implements MessageQueue {
|
|
|
84
84
|
* retries itself.
|
|
85
85
|
* @since 2.1.0
|
|
86
86
|
*/
|
|
87
|
-
readonly nativeRetrial
|
|
87
|
+
readonly nativeRetrial = false;
|
|
88
88
|
/**
|
|
89
89
|
* Creates a new MySQL message queue.
|
|
90
90
|
* @param pool The MySQL connection pool to use.
|
package/dist/mq.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
4
2
|
import { getLogger } from "@logtape/logtape";
|
|
5
|
-
|
|
6
3
|
//#region src/mq.ts
|
|
7
4
|
const logger = getLogger([
|
|
8
5
|
"fedify",
|
|
@@ -266,7 +263,7 @@ var MysqlMessageQueue = class {
|
|
|
266
263
|
FOR UPDATE SKIP LOCKED`);
|
|
267
264
|
if (rows.length === 0) {
|
|
268
265
|
await conn.rollback();
|
|
269
|
-
return
|
|
266
|
+
return;
|
|
270
267
|
}
|
|
271
268
|
const { id, message } = rows[0];
|
|
272
269
|
await conn.query(`DELETE FROM \`${this.#tableName}\` WHERE \`id\` = ?`, [id]);
|
|
@@ -311,7 +308,7 @@ var MysqlMessageQueue = class {
|
|
|
311
308
|
LIMIT 1`, [orderingKey]);
|
|
312
309
|
if (rows.length === 0) {
|
|
313
310
|
await conn.rollback();
|
|
314
|
-
return
|
|
311
|
+
return;
|
|
315
312
|
}
|
|
316
313
|
const { id, message } = rows[0];
|
|
317
314
|
await conn.query(`DELETE FROM \`${this.#tableName}\` WHERE \`id\` = ?`, [id]);
|
|
@@ -389,6 +386,5 @@ var MysqlMessageQueue = class {
|
|
|
389
386
|
this.#initPromise = void 0;
|
|
390
387
|
}
|
|
391
388
|
};
|
|
392
|
-
|
|
393
389
|
//#endregion
|
|
394
|
-
export { MysqlMessageQueue };
|
|
390
|
+
export { MysqlMessageQueue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/mysql",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "MySQL/MariaDB drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"mysql2": "^3.18.0",
|
|
78
|
-
"@fedify/fedify": "^2.1.
|
|
78
|
+
"@fedify/fedify": "^2.1.2"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
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.1.
|
|
84
|
+
"@fedify/testing": "^2.1.2"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build:self": "tsdown",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
-
|
|
4
|
-
//#region rolldown:runtime
|
|
5
|
-
var __create = Object.create;
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
-
key = keys[i];
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
-
get: ((k) => from[k]).bind(null, key),
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
value: mod,
|
|
23
|
-
enumerable: true
|
|
24
|
-
}) : target, mod));
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, '__toESM', {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
return __toESM;
|
|
32
|
-
}
|
|
33
|
-
});
|