@fedify/redis 1.10.5 → 1.10.7
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/codec.cjs +4 -8
- package/dist/codec.js +2 -6
- package/dist/kv.cjs +6 -11
- package/dist/kv.js +3 -8
- package/dist/mod.cjs +6 -8
- package/dist/mod.js +2 -5
- package/dist/mq.cjs +6 -12
- package/dist/mq.js +3 -8
- package/package.json +3 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -33
package/dist/codec.cjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
const node_buffer = require_rolldown_runtime.__toESM(require("node:buffer"));
|
|
6
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
let node_buffer = require("node:buffer");
|
|
7
4
|
//#region src/codec.ts
|
|
8
5
|
/**
|
|
9
6
|
* An error that occurs when encoding or decoding data.
|
|
@@ -58,9 +55,8 @@ var JsonCodec = class {
|
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
};
|
|
61
|
-
|
|
62
58
|
//#endregion
|
|
63
59
|
exports.CodecError = CodecError;
|
|
64
60
|
exports.DecodingError = DecodingError;
|
|
65
61
|
exports.EncodingError = EncodingError;
|
|
66
|
-
exports.JsonCodec = JsonCodec;
|
|
62
|
+
exports.JsonCodec = JsonCodec;
|
package/dist/codec.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
import { Buffer } from "node:buffer";
|
|
5
|
-
|
|
6
3
|
//#region src/codec.ts
|
|
7
4
|
/**
|
|
8
5
|
* An error that occurs when encoding or decoding data.
|
|
@@ -57,6 +54,5 @@ var JsonCodec = class {
|
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
};
|
|
60
|
-
|
|
61
57
|
//#endregion
|
|
62
|
-
export { CodecError, DecodingError, EncodingError, JsonCodec };
|
|
58
|
+
export { CodecError, DecodingError, EncodingError, JsonCodec };
|
package/dist/kv.cjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const require_codec = require('./codec.cjs');
|
|
6
|
-
const node_buffer = require_rolldown_runtime.__toESM(require("node:buffer"));
|
|
7
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_codec = require("./codec.cjs");
|
|
4
|
+
let node_buffer = require("node:buffer");
|
|
8
5
|
//#region src/kv.ts
|
|
9
6
|
/**
|
|
10
7
|
* A key–value store that uses Redis as the underlying storage.
|
|
@@ -73,8 +70,7 @@ var RedisKvStore = class {
|
|
|
73
70
|
await this.#redis.del(serializedKey);
|
|
74
71
|
}
|
|
75
72
|
#deserializeKey(redisKey) {
|
|
76
|
-
|
|
77
|
-
return suffix.split("::").map((p) => p.replaceAll("_:", ":"));
|
|
73
|
+
return redisKey.slice(this.#keyPrefixStr.length).split("::").map((p) => p.replaceAll("_:", ":"));
|
|
78
74
|
}
|
|
79
75
|
/**
|
|
80
76
|
* {@inheritDoc KvStore.list}
|
|
@@ -112,6 +108,5 @@ var RedisKvStore = class {
|
|
|
112
108
|
} while (cursor !== "0");
|
|
113
109
|
}
|
|
114
110
|
};
|
|
115
|
-
|
|
116
111
|
//#endregion
|
|
117
|
-
exports.RedisKvStore = RedisKvStore;
|
|
112
|
+
exports.RedisKvStore = RedisKvStore;
|
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 { JsonCodec } from "./codec.js";
|
|
5
3
|
import { Buffer } from "node:buffer";
|
|
6
|
-
|
|
7
4
|
//#region src/kv.ts
|
|
8
5
|
/**
|
|
9
6
|
* A key–value store that uses Redis as the underlying storage.
|
|
@@ -72,8 +69,7 @@ var RedisKvStore = class {
|
|
|
72
69
|
await this.#redis.del(serializedKey);
|
|
73
70
|
}
|
|
74
71
|
#deserializeKey(redisKey) {
|
|
75
|
-
|
|
76
|
-
return suffix.split("::").map((p) => p.replaceAll("_:", ":"));
|
|
72
|
+
return redisKey.slice(this.#keyPrefixStr.length).split("::").map((p) => p.replaceAll("_:", ":"));
|
|
77
73
|
}
|
|
78
74
|
/**
|
|
79
75
|
* {@inheritDoc KvStore.list}
|
|
@@ -111,6 +107,5 @@ var RedisKvStore = class {
|
|
|
111
107
|
} while (cursor !== "0");
|
|
112
108
|
}
|
|
113
109
|
};
|
|
114
|
-
|
|
115
110
|
//#endregion
|
|
116
|
-
export { RedisKvStore };
|
|
111
|
+
export { RedisKvStore };
|
package/dist/mod.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_mq = require('./mq.cjs');
|
|
7
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_codec = require("./codec.cjs");
|
|
4
|
+
const require_kv = require("./kv.cjs");
|
|
5
|
+
const require_mq = require("./mq.cjs");
|
|
8
6
|
exports.CodecError = require_codec.CodecError;
|
|
9
7
|
exports.DecodingError = require_codec.DecodingError;
|
|
10
8
|
exports.EncodingError = require_codec.EncodingError;
|
|
11
9
|
exports.JsonCodec = require_codec.JsonCodec;
|
|
12
10
|
exports.RedisKvStore = require_kv.RedisKvStore;
|
|
13
|
-
exports.RedisMessageQueue = require_mq.RedisMessageQueue;
|
|
11
|
+
exports.RedisMessageQueue = require_mq.RedisMessageQueue;
|
package/dist/mod.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
import { CodecError, DecodingError, EncodingError, JsonCodec } from "./codec.js";
|
|
5
3
|
import { RedisKvStore } from "./kv.js";
|
|
6
4
|
import { RedisMessageQueue } from "./mq.js";
|
|
7
|
-
|
|
8
|
-
export { CodecError, DecodingError, EncodingError, JsonCodec, RedisKvStore, RedisMessageQueue };
|
|
5
|
+
export { CodecError, DecodingError, EncodingError, JsonCodec, RedisKvStore, RedisMessageQueue };
|
package/dist/mq.cjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
const require_codec = require('./codec.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
|
+
const require_codec = require("./codec.cjs");
|
|
8
4
|
//#region src/mq.ts
|
|
9
|
-
const logger = (0,
|
|
5
|
+
const logger = (0, require("@logtape/logtape").getLogger)([
|
|
10
6
|
"fedify",
|
|
11
7
|
"redis",
|
|
12
8
|
"mq"
|
|
@@ -81,8 +77,7 @@ var RedisMessageQueue = class {
|
|
|
81
77
|
}
|
|
82
78
|
async #poll() {
|
|
83
79
|
logger.debug("Polling for messages...");
|
|
84
|
-
|
|
85
|
-
if (result == null) {
|
|
80
|
+
if (await this.#redis.set(this.#lockKey, this.#workerId, "EX", Math.floor(this.#pollIntervalMs / 1e3 * 2), "NX") == null) {
|
|
86
81
|
logger.debug("Another worker is already processing messages; skipping...");
|
|
87
82
|
return;
|
|
88
83
|
}
|
|
@@ -166,6 +161,5 @@ var RedisMessageQueue = class {
|
|
|
166
161
|
this.#subRedis.disconnect();
|
|
167
162
|
}
|
|
168
163
|
};
|
|
169
|
-
|
|
170
164
|
//#endregion
|
|
171
|
-
exports.RedisMessageQueue = RedisMessageQueue;
|
|
165
|
+
exports.RedisMessageQueue = RedisMessageQueue;
|
package/dist/mq.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 { JsonCodec } from "./codec.js";
|
|
5
3
|
import { getLogger } from "@logtape/logtape";
|
|
6
|
-
|
|
7
4
|
//#region src/mq.ts
|
|
8
5
|
const logger = getLogger([
|
|
9
6
|
"fedify",
|
|
@@ -80,8 +77,7 @@ var RedisMessageQueue = class {
|
|
|
80
77
|
}
|
|
81
78
|
async #poll() {
|
|
82
79
|
logger.debug("Polling for messages...");
|
|
83
|
-
|
|
84
|
-
if (result == null) {
|
|
80
|
+
if (await this.#redis.set(this.#lockKey, this.#workerId, "EX", Math.floor(this.#pollIntervalMs / 1e3 * 2), "NX") == null) {
|
|
85
81
|
logger.debug("Another worker is already processing messages; skipping...");
|
|
86
82
|
return;
|
|
87
83
|
}
|
|
@@ -165,6 +161,5 @@ var RedisMessageQueue = class {
|
|
|
165
161
|
this.#subRedis.disconnect();
|
|
166
162
|
}
|
|
167
163
|
};
|
|
168
|
-
|
|
169
164
|
//#endregion
|
|
170
|
-
export { RedisMessageQueue };
|
|
165
|
+
export { RedisMessageQueue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/redis",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.7",
|
|
4
4
|
"description": "Redis drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"ioredis": "^5.6.1",
|
|
85
|
-
"@fedify/fedify": "^1.10.
|
|
85
|
+
"@fedify/fedify": "^1.10.7"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@std/async": "npm:@jsr/std__async@^1.0.13",
|
|
89
89
|
"@types/node": "^22.16.0",
|
|
90
|
-
"tsdown": "^0.
|
|
90
|
+
"tsdown": "^0.21.6",
|
|
91
91
|
"typescript": "^5.9.2"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
@@ -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
|
-
});
|