@fedify/fedify 2.4.0-dev.1959 → 2.4.0-pr.1006.44
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 +2 -0
- package/dist/{builder-sMkz-MdT.mjs → builder-BdcA_1Rt.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-COLwHogJ.d.cts → context-BOnn653X.d.cts} +0 -27
- package/dist/{context-DiiCt4S7.d.ts → context-CmjP-cgJ.d.ts} +0 -27
- package/dist/{deno-Xg7DR4LS.mjs → deno-tSRHKXbU.mjs} +1 -1
- package/dist/{docloader-4YqMWBpt.mjs → docloader-BAO-cgto.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +3 -3
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/keycache.test.mjs +4 -30
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +8 -195
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +2 -3
- package/dist/federation/tasks/tasks.test.mjs +3 -4
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-BNJgxgH6.cjs → federation-BzLBT04I.cjs} +13 -32
- package/dist/{http-Bh37_81O.js → http-CcFURGbR.js} +1 -1
- package/dist/{http-DyXZdUng.mjs → http-Cp_Byhf8.mjs} +3 -3
- package/dist/{http-BuOvqNbW.cjs → http-DBbZNv2i.cjs} +1 -1
- package/dist/{key-CXsAkAt6.mjs → key-CEDlSMK7.mjs} +2 -2
- package/dist/{keycache-ZLqIfrkL.mjs → keycache-0Jk78XmB.mjs} +1 -3
- package/dist/{kv-cache-Btl0s7i7.cjs → kv-cache-B-JFZafn.cjs} +1 -1
- package/dist/{kv-cache-BubmP7z9.mjs → kv-cache-C7qYJ4To.mjs} +1 -1
- package/dist/{kv-cache-DjFxdXjk.js → kv-cache-CocB_ME8.js} +1 -1
- package/dist/{ld-C5Qv0_xn.mjs → ld-B8k-089e.mjs} +3 -3
- package/dist/{metrics-B7-JxJSv.mjs → metrics-CIK7ZY_B.mjs} +1 -1
- package/dist/{middleware-DB_evWhA.mjs → middleware--nGmJXXx.mjs} +22 -39
- package/dist/{middleware-CF539vn2.js → middleware-CBO16r56.js} +13 -32
- package/dist/{middleware-BfRUvR8e.mjs → middleware-Dx9byvw-.mjs} +1 -1
- package/dist/{mod-CSH1Ee-I.d.ts → mod-BYuZ0WXt.d.ts} +1 -1
- package/dist/{mod-BZldCEU0.d.cts → mod-kUSY5n3f.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-DFzwGoyv.mjs → owner-Cf55GD32.mjs} +2 -2
- package/dist/{proof-DJGBYtRT.mjs → proof-BAVwiUPt.mjs} +4 -4
- package/dist/{proof-3rlJfM0Z.js → proof-CqV_aPhu.js} +1 -1
- package/dist/{proof-BVpjHUMS.cjs → proof-DSohcbCt.cjs} +1 -1
- package/dist/{send-BOXP7DyW.mjs → send-DL5nBv54.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-D6yzxQ23.mjs → temporal-C_3AI99D.mjs} +1 -1
- package/dist/testing/mod.d.mts +1 -70
- package/dist/testing/mod.mjs +2 -4
- package/dist/{tasks-dbCShlCb.mjs → testing-D13ymFKy.mjs} +1 -0
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/dist/kv-DBRWVx3Q.mjs +0 -104
- package/dist/testing/kv.test.d.mts +0 -2
- package/dist/testing/kv.test.mjs +0 -101
- package/dist/testing-hbky2gMN.mjs +0 -8
package/dist/testing/kv.test.mjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Temporal } from "temporal-polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
3
|
-
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as test } from "../dist-BQvArojP.mjs";
|
|
5
|
-
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
6
|
-
import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
|
|
7
|
-
import { n as baseOptions, o as stringSchema, t as MockQueue } from "../tasks-dbCShlCb.mjs";
|
|
8
|
-
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
9
|
-
import { o as createFederation } from "../middleware-DB_evWhA.mjs";
|
|
10
|
-
//#region src/testing/kv.test.ts
|
|
11
|
-
test("ManualClockKvStore keeps an entry at its exact expiration instant", async () => {
|
|
12
|
-
const kv = new ManualClockKvStore();
|
|
13
|
-
const ttl = Temporal.Duration.from({ minutes: 10 });
|
|
14
|
-
await kv.set(["k"], "v", { ttl });
|
|
15
|
-
kv.advance(ttl);
|
|
16
|
-
assertEquals(kv.now, Temporal.Instant.fromEpochMilliseconds(6e5));
|
|
17
|
-
assertEquals(await kv.get(["k"]), "v");
|
|
18
|
-
kv.advance({ nanoseconds: 1 });
|
|
19
|
-
assertEquals(await kv.get(["k"]), void 0);
|
|
20
|
-
});
|
|
21
|
-
test("ManualClockKvStore.list() applies the same boundary", async () => {
|
|
22
|
-
const kv = new ManualClockKvStore();
|
|
23
|
-
const ttl = Temporal.Duration.from({ minutes: 10 });
|
|
24
|
-
await kv.set(["k"], "v", { ttl });
|
|
25
|
-
kv.advance(ttl);
|
|
26
|
-
assertEquals(await Array.fromAsync(kv.list()), [{
|
|
27
|
-
key: ["k"],
|
|
28
|
-
value: "v"
|
|
29
|
-
}]);
|
|
30
|
-
kv.advance({ nanoseconds: 1 });
|
|
31
|
-
assertEquals(await Array.fromAsync(kv.list()), []);
|
|
32
|
-
});
|
|
33
|
-
test("ManualClockKvStore.cas() applies the same boundary", async () => {
|
|
34
|
-
const ttl = Temporal.Duration.from({ minutes: 10 });
|
|
35
|
-
const atBoundary = new ManualClockKvStore();
|
|
36
|
-
await atBoundary.set(["k"], "v", { ttl });
|
|
37
|
-
atBoundary.advance(ttl);
|
|
38
|
-
assertEquals(await atBoundary.cas?.(["k"], "v", "w"), true);
|
|
39
|
-
const pastBoundary = new ManualClockKvStore();
|
|
40
|
-
await pastBoundary.set(["k"], "v", { ttl });
|
|
41
|
-
pastBoundary.advance(ttl);
|
|
42
|
-
pastBoundary.advance({ nanoseconds: 1 });
|
|
43
|
-
assertEquals(await pastBoundary.cas?.(["k"], "v", "w"), false);
|
|
44
|
-
assertEquals(await pastBoundary.get(["k"]), void 0);
|
|
45
|
-
});
|
|
46
|
-
test("ManualClockKvStore.cas() without a TTL clears the expiration", async () => {
|
|
47
|
-
const kv = new ManualClockKvStore();
|
|
48
|
-
const ttl = Temporal.Duration.from({ minutes: 10 });
|
|
49
|
-
await kv.set(["k"], "v", { ttl });
|
|
50
|
-
assertEquals(await kv.cas?.(["k"], "v", "w"), true);
|
|
51
|
-
kv.advance({ hours: 1 });
|
|
52
|
-
assertEquals(await kv.get(["k"]), "w");
|
|
53
|
-
});
|
|
54
|
-
test("ManualClockKvStore withholds the TTL from the wrapped store", async () => {
|
|
55
|
-
const inner = new MemoryKvStore();
|
|
56
|
-
const kv = new ManualClockKvStore(inner);
|
|
57
|
-
await kv.set(["k"], "v", { ttl: Temporal.Duration.from({ nanoseconds: 1 }) });
|
|
58
|
-
assertEquals(await inner.get(["k"]), "v");
|
|
59
|
-
assertEquals(await kv.get(["k"]), "v");
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* A {@link KvStore} without `cas()`, standing in for backends that offer no
|
|
63
|
-
* conditional write.
|
|
64
|
-
*/
|
|
65
|
-
var CaslessKvStore = class {
|
|
66
|
-
#inner = new MemoryKvStore();
|
|
67
|
-
get(key) {
|
|
68
|
-
return this.#inner.get(key);
|
|
69
|
-
}
|
|
70
|
-
set(key, value, options) {
|
|
71
|
-
return this.#inner.set(key, value, options);
|
|
72
|
-
}
|
|
73
|
-
delete(key) {
|
|
74
|
-
return this.#inner.delete(key);
|
|
75
|
-
}
|
|
76
|
-
list(prefix) {
|
|
77
|
-
return this.#inner.list(prefix);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
test("ManualClockKvStore exposes cas() only when the wrapped store does", () => {
|
|
81
|
-
assertEquals(new ManualClockKvStore(new CaslessKvStore()).cas, void 0);
|
|
82
|
-
assertEquals(typeof new ManualClockKvStore(new MemoryKvStore()).cas, "function");
|
|
83
|
-
});
|
|
84
|
-
test("ManualClockKvStore over a store without cas() keeps the open deduplication fallback", async () => {
|
|
85
|
-
const queue = new MockQueue();
|
|
86
|
-
const federation = createFederation({
|
|
87
|
-
...baseOptions,
|
|
88
|
-
kv: new ManualClockKvStore(new CaslessKvStore()),
|
|
89
|
-
queue: { task: queue },
|
|
90
|
-
taskDeduplicationFallback: "open"
|
|
91
|
-
});
|
|
92
|
-
const task = federation.defineTask("casless-open-fallback", {
|
|
93
|
-
schema: stringSchema,
|
|
94
|
-
handler: () => {}
|
|
95
|
-
});
|
|
96
|
-
await federation.createContext(new URL("https://example.com/"), void 0).enqueueTask(task, "payload", { deduplicationKey: "k" });
|
|
97
|
-
assertEquals(queue.enqueued.length, 1);
|
|
98
|
-
assertEquals(queue.enqueued[0].options?.deduplicationKey, void 0);
|
|
99
|
-
});
|
|
100
|
-
//#endregion
|
|
101
|
-
export {};
|