@fedify/fedify 2.0.0-pr.433.1603 → 2.0.0-pr.434.1662
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/{actor-DFlEHCQA.js → actor-By5NMImS.js} +1 -1
- package/dist/actor-DMgu-ZjT.d.cts +128 -0
- package/dist/actor-Dd2E4F9C.cjs +37786 -0
- package/dist/{actor-CY-MF2fp.js → actor-Dsla85Uq.js} +200 -200
- package/dist/{assert_rejects-7UF4R_Qs.js → assert_rejects-DiIiJbZn.js} +1 -1
- package/dist/{assert_throws-53_pKeP3.js → assert_throws-BOO88avQ.js} +1 -1
- package/dist/authdocloader-B28UEZlz.cjs +58 -0
- package/dist/{authdocloader-Dh8orZQs.js → authdocloader-CpmdBiRe.js} +6 -6
- package/dist/{authdocloader-CQBXQkJb.js → authdocloader-lhbaj4KA.js} +3 -3
- package/dist/{builder-Cmx9eExq.js → builder-B6AupxqD.js} +4 -4
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/client-CegPX0Rn.d.cts +222 -0
- package/dist/{client-DXKgLzk4.js → client-KUXReLjS.js} +1 -1
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +13 -0
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +18 -17
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-CDSZdQHD.d.ts → context-CQsAT7xk.d.ts} +0 -1
- package/dist/context-tVOQ76fi.d.cts +2254 -0
- package/dist/docloader-D-MrRyHl.d.cts +219 -0
- package/dist/docloader-NJZ5ADV3.cjs +4861 -0
- package/dist/{docloader-D4sbvvPM.js → docloader-ZGKS1Zy-.js} +189 -9
- package/dist/{esm-D6i4YQ2_.js → esm-CIFbziGC.js} +1 -1
- package/dist/federation/builder.test.js +10 -10
- package/dist/federation/collection.test.js +8 -8
- package/dist/federation/handler.test.js +26 -145
- package/dist/federation/inbox.test.js +6 -6
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +9 -8
- package/dist/federation/middleware.test.js +255 -38
- package/dist/federation/mod.cjs +29 -0
- package/dist/federation/mod.d.cts +13 -0
- package/dist/federation/mod.d.ts +1 -1
- package/dist/federation/mod.js +15 -15
- package/dist/federation/mq.test.js +10 -10
- package/dist/federation/negotiation.test.d.ts +3 -0
- package/dist/federation/negotiation.test.js +28 -0
- package/dist/federation/retry.test.js +5 -5
- package/dist/federation/router.test.js +8 -8
- package/dist/federation/send.test.js +15 -15
- package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
- package/dist/federation-H2_En3j5.cjs +244 -0
- package/dist/http-BS6766zs.d.cts +253 -0
- package/dist/{http-az-I4DFF.js → http-BqSkbrGv.js} +6 -6
- package/dist/{http-mimmGwH8.js → http-CCydyMoV.js} +2 -2
- package/dist/http-DH8DQz2-.cjs +826 -0
- package/dist/{inbox--bLOiwUO.js → inbox-DH8TXk1f.js} +1 -1
- package/dist/{key-Gjnnnh5S.js → key-3cqchRKs.js} +3 -3
- package/dist/{key-C6ojpFqZ.js → key-B057bXm0.js} +2 -2
- package/dist/key-Bom4W546.cjs +10 -0
- package/dist/key-CYrKbGH0.cjs +290 -0
- package/dist/key-HjvDY-QJ.js +10 -0
- package/dist/{key-DaaSDiCV.js → key-cn3BcQaB.js} +5 -5
- package/dist/{keycache-DZnNO-JV.js → keycache-CB_VjDe0.js} +1 -1
- package/dist/{keys-BU2fip9w.js → keys-Dz9o2VwW.js} +1 -1
- package/dist/kv-63Cil1MD.d.cts +81 -0
- package/dist/{ld-tLocOQ6q.js → ld-CxJe2x7_.js} +2 -2
- package/dist/lookup-BZzUCUat.cjs +137 -0
- package/dist/{lookup-DG0T7i6q.js → lookup-Cc-KXO2K.js} +4 -4
- package/dist/{lookup-1CBMmJ3_.js → lookup-q8DeFAjR.js} +1 -1
- package/dist/middleware-B7yi4Uls.cjs +17 -0
- package/dist/{middleware-BJn2g4ay.js → middleware-BvEwDOJ5.js} +50 -81
- package/dist/middleware-DCdrZPxz.js +17 -0
- package/dist/middleware-DGvzxKjo.cjs +4204 -0
- package/dist/middleware-DTjhpVrj.js +26 -0
- package/dist/{middleware-CU2GpLYi.js → middleware-DxS7Csvz.js} +49 -144
- package/dist/{mod-RI3-KvUI.d.ts → mod-B26zRlH1.d.ts} +1 -1
- package/dist/mod-BClfg3ej.d.cts +266 -0
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/mod-DBQAI4v9.d.cts +80 -0
- package/dist/mod-Dc_-mf8s.d.cts +102 -0
- package/dist/mod-FZd39qVq.d.cts +1 -0
- package/dist/mod-evzlRVZq.d.cts +289 -0
- package/dist/mod-jQ4OODsl.d.cts +113 -0
- package/dist/mod.cjs +150 -0
- package/dist/mod.d.cts +17 -0
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +20 -20
- package/dist/mq-B7R1Q-M5.d.cts +140 -0
- package/dist/negotiation-5NPJL6zp.js +71 -0
- package/dist/nodeinfo/client.test.js +10 -10
- package/dist/nodeinfo/handler.test.js +23 -22
- package/dist/nodeinfo/mod.cjs +11 -0
- package/dist/nodeinfo/mod.d.cts +5 -0
- package/dist/nodeinfo/mod.js +6 -6
- package/dist/nodeinfo/types.test.js +8 -8
- package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
- package/dist/nodeinfo-DfycQ8Wf.js +4 -0
- package/dist/owner-B-7Ptt_m.d.cts +67 -0
- package/dist/{owner-qDh_g_5C.js → owner-jwXilm3L.js} +2 -2
- package/dist/{proof-aGjI96QA.js → proof-BE1A6Ct1.js} +6 -6
- package/dist/proof-BzKiLsN7.cjs +673 -0
- package/dist/{proof-DimUFDOB.js → proof-CHi36V0T.js} +2 -2
- package/dist/runtime/authdocloader.test.js +14 -14
- package/dist/runtime/docloader.test.js +9 -9
- package/dist/runtime/key.test.js +10 -10
- package/dist/runtime/langstr.test.js +8 -8
- package/dist/runtime/link.test.d.ts +3 -0
- package/dist/runtime/link.test.js +61 -0
- package/dist/runtime/mod.cjs +25 -0
- package/dist/runtime/mod.d.cts +6 -0
- package/dist/runtime/mod.js +10 -10
- package/dist/runtime/multibase/multibase.test.js +8 -8
- package/dist/runtime/url.test.js +5 -5
- package/dist/runtime-C58AJWSv.cjs +4 -0
- package/dist/runtime-DPYEDf-o.js +4 -0
- package/dist/{send-BDoLPO28.js → send-CwVrwo7j.js} +2 -2
- package/dist/sig/http.test.js +13 -13
- package/dist/sig/key.test.js +11 -11
- package/dist/sig/ld.test.js +10 -10
- package/dist/sig/mod.cjs +30 -0
- package/dist/sig/mod.d.cts +8 -0
- package/dist/sig/mod.js +10 -10
- package/dist/sig/owner.test.js +12 -12
- package/dist/sig/proof.test.js +12 -12
- package/dist/sig-ByHXzqUi.cjs +4 -0
- package/dist/sig-Cj3tk-ig.js +4 -0
- package/dist/testing/docloader.test.js +8 -8
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-BtAnu4dJ.js → testing-Cqwzq9nj.js} +2 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{type-CGIBxLsG.js → type-BSR-vRXo.js} +382 -202
- package/dist/{types-DiMJWG0f.js → types-XMA_ABYQ.js} +4 -4
- package/dist/types-zwVAf9LF.cjs +315 -0
- package/dist/vocab/actor.test.js +10 -10
- package/dist/vocab/lookup.test.js +9 -9
- package/dist/vocab/mod.cjs +87 -0
- package/dist/vocab/mod.d.cts +6 -0
- package/dist/vocab/mod.js +7 -7
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +45 -10
- package/dist/vocab-Bj8iyEkG.cjs +282 -0
- package/dist/{vocab-Br3OfNTW.js → vocab-BlOQWNvd.js} +6 -6
- package/dist/vocab-DJTYMqyU.d.cts +14632 -0
- package/dist/webfinger/handler.test.js +23 -22
- package/dist/webfinger/lookup.test.js +9 -9
- package/dist/webfinger/mod.cjs +9 -0
- package/dist/webfinger/mod.d.cts +4 -0
- package/dist/webfinger/mod.js +6 -6
- package/dist/webfinger-BjOEdFPs.cjs +4 -0
- package/dist/webfinger-De_bU0iE.js +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +8 -8
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +54 -0
- package/dist/x/hono.d.ts +1 -1
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +46 -0
- package/dist/x/sveltekit.d.ts +1 -1
- package/dist/x/sveltekit.js +3 -3
- package/package.json +68 -13
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/key-BFfeDCSU.js +0 -10
- package/dist/middleware-aYHOiG0n.js +0 -17
- package/dist/middleware-u5BtkYWm.js +0 -25
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/{assert_is_error-B035L3om.js → assert_is_error-BPGph1Jx.js} +0 -0
- /package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals-f3m3epl3.js} +0 -0
- /package/dist/{denokv-jZ0Z2h0M.js → denokv-Bv33Xxea.js} +0 -0
- /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
- /package/dist/{std__assert-DWivtrGR.js → std__assert-X-_kMxKM.js} +0 -0
@@ -3,34 +3,35 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Image, Link, Person } from "../type-
|
6
|
+
import { Image, Link, Person } from "../type-BSR-vRXo.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
-
import { createFederation, handleWebFinger } from "../middleware-
|
12
|
-
import "../client-
|
13
|
-
import "../lookup-
|
11
|
+
import { createFederation, handleWebFinger } from "../middleware-DxS7Csvz.js";
|
12
|
+
import "../client-KUXReLjS.js";
|
13
|
+
import "../lookup-q8DeFAjR.js";
|
14
14
|
import "../types-BSuWJsOm.js";
|
15
|
-
import "../actor-
|
16
|
-
import "../key-
|
17
|
-
import "../http-
|
18
|
-
import "../authdocloader-
|
19
|
-
import "../ld-
|
20
|
-
import "../owner-
|
21
|
-
import "../proof-
|
22
|
-
import "../inbox
|
23
|
-
import "../builder-
|
15
|
+
import "../actor-By5NMImS.js";
|
16
|
+
import "../key-B057bXm0.js";
|
17
|
+
import "../http-CCydyMoV.js";
|
18
|
+
import "../authdocloader-lhbaj4KA.js";
|
19
|
+
import "../ld-CxJe2x7_.js";
|
20
|
+
import "../owner-jwXilm3L.js";
|
21
|
+
import "../proof-CHi36V0T.js";
|
22
|
+
import "../inbox-DH8TXk1f.js";
|
23
|
+
import "../builder-B6AupxqD.js";
|
24
24
|
import "../collection-CcnIw1qY.js";
|
25
|
-
import "../keycache-
|
26
|
-
import "../
|
27
|
-
import "../
|
28
|
-
import
|
29
|
-
import "../
|
30
|
-
import "../
|
31
|
-
import "../
|
32
|
-
import "../
|
33
|
-
import "../
|
25
|
+
import "../keycache-CB_VjDe0.js";
|
26
|
+
import "../negotiation-5NPJL6zp.js";
|
27
|
+
import "../retry-D4GJ670a.js";
|
28
|
+
import "../send-CwVrwo7j.js";
|
29
|
+
import { createRequestContext, test } from "../testing-Cqwzq9nj.js";
|
30
|
+
import "../std__assert-X-_kMxKM.js";
|
31
|
+
import "../assert_rejects-DiIiJbZn.js";
|
32
|
+
import "../assert_is_error-BPGph1Jx.js";
|
33
|
+
import "../assert_not_equals-f3m3epl3.js";
|
34
|
+
import "../assert_throws-BOO88avQ.js";
|
34
35
|
|
35
36
|
//#region src/webfinger/handler.test.ts
|
36
37
|
test("handleWebFinger()", async (t) => {
|
@@ -3,18 +3,18 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { lookupWebFinger } from "../type-
|
6
|
+
import { lookupWebFinger } from "../type-BSR-vRXo.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../lookup-
|
11
|
-
import { test } from "../testing-
|
12
|
-
import "../std__assert-
|
13
|
-
import "../assert_rejects-
|
14
|
-
import "../assert_is_error-
|
15
|
-
import "../assert_not_equals-
|
16
|
-
import "../assert_throws-
|
17
|
-
import { esm_default } from "../esm-
|
10
|
+
import "../lookup-q8DeFAjR.js";
|
11
|
+
import { test } from "../testing-Cqwzq9nj.js";
|
12
|
+
import "../std__assert-X-_kMxKM.js";
|
13
|
+
import "../assert_rejects-DiIiJbZn.js";
|
14
|
+
import "../assert_is_error-BPGph1Jx.js";
|
15
|
+
import "../assert_not_equals-f3m3epl3.js";
|
16
|
+
import "../assert_throws-BOO88avQ.js";
|
17
|
+
import { esm_default } from "../esm-CIFbziGC.js";
|
18
18
|
import { withTimeout } from "es-toolkit";
|
19
19
|
|
20
20
|
//#region src/webfinger/lookup.test.ts
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('../docloader-NJZ5ADV3.cjs');
|
6
|
+
const require_lookup = require('../lookup-BZzUCUat.cjs');
|
7
|
+
require('../webfinger-BjOEdFPs.cjs');
|
8
|
+
|
9
|
+
exports.lookupWebFinger = require_lookup.lookupWebFinger;
|
package/dist/webfinger/mod.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
import "../docloader-
|
6
|
-
import { lookupWebFinger } from "../lookup-
|
7
|
-
import "../webfinger-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "../docloader-ZGKS1Zy-.js";
|
6
|
+
import { lookupWebFinger } from "../lookup-Cc-KXO2K.js";
|
7
|
+
import "../webfinger-De_bU0iE.js";
|
8
8
|
|
9
9
|
export { lookupWebFinger };
|
@@ -0,0 +1,100 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_chunk = require('../chunk-DqRYRqnO.cjs');
|
6
|
+
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
7
|
+
|
8
|
+
//#region src/x/cfworkers.ts
|
9
|
+
/**
|
10
|
+
* Implementation of the {@link KvStore} interface for Cloudflare Workers KV
|
11
|
+
* binding. This class provides a wrapper around Cloudflare's KV namespace to
|
12
|
+
* store and retrieve JSON-serializable values using structured keys.
|
13
|
+
*
|
14
|
+
* Note that this implementation does not support the {@link KvStore.cas}
|
15
|
+
* operation, as Cloudflare Workers KV does not support atomic compare-and-swap
|
16
|
+
* operations. If you need this functionality, consider using a different
|
17
|
+
* key–value store that supports atomic operations.
|
18
|
+
*
|
19
|
+
* @deprecated This class has been moved to `@fedify/cfworkers` package.
|
20
|
+
* Import `WorkersKvStore` from `@fedify/cfworkers` instead.
|
21
|
+
* This class will be removed in Fedify v2.0.
|
22
|
+
* @since 1.6.0
|
23
|
+
*/
|
24
|
+
var WorkersKvStore = class {
|
25
|
+
#namespace;
|
26
|
+
constructor(namespace) {
|
27
|
+
const logger = (0, __logtape_logtape.getLogger)(["fedify", "cfworkers"]);
|
28
|
+
logger.warn("The `@fedify/fedify/x/cfworkers` module is deprecated; use `WorkersKvStore` from `@fedify/cfworkers` package instead.");
|
29
|
+
this.#namespace = namespace;
|
30
|
+
}
|
31
|
+
#encodeKey(key) {
|
32
|
+
return JSON.stringify(key);
|
33
|
+
}
|
34
|
+
async get(key) {
|
35
|
+
const encodedKey = this.#encodeKey(key);
|
36
|
+
const { value, metadata } = await this.#namespace.getWithMetadata(encodedKey, "json");
|
37
|
+
return metadata == null || metadata.expires < Date.now() ? void 0 : value;
|
38
|
+
}
|
39
|
+
async set(key, value, options) {
|
40
|
+
const encodedKey = this.#encodeKey(key);
|
41
|
+
const metadata = options?.ttl == null ? {} : { expires: Date.now() + options.ttl.total("milliseconds") };
|
42
|
+
await this.#namespace.put(encodedKey, JSON.stringify(value), options?.ttl == null ? { metadata } : {
|
43
|
+
expirationTtl: Math.max(options.ttl.total("seconds"), 60),
|
44
|
+
metadata
|
45
|
+
});
|
46
|
+
}
|
47
|
+
delete(key) {
|
48
|
+
return this.#namespace.delete(this.#encodeKey(key));
|
49
|
+
}
|
50
|
+
};
|
51
|
+
/**
|
52
|
+
* Implementation of the {@link MessageQueue} interface for Cloudflare
|
53
|
+
* Workers Queues binding. This class provides a wrapper around Cloudflare's
|
54
|
+
* Queues to send messages to a queue.
|
55
|
+
*
|
56
|
+
* Note that this implementation does not support the `listen()` method,
|
57
|
+
* as Cloudflare Workers Queues do not support message consumption in the same
|
58
|
+
* way as other message queue systems. Instead, you should use
|
59
|
+
* the {@link Federation.processQueuedTask} method to process messages
|
60
|
+
* passed to the queue.
|
61
|
+
*
|
62
|
+
* @deprecated This class has been moved to `@fedify/cfworkers` package.
|
63
|
+
* Import `WorkersMessageQueue` from `@fedify/cfworkers` instead.
|
64
|
+
* This class will be removed in Fedify v2.0.
|
65
|
+
* @since 1.6.0
|
66
|
+
*/
|
67
|
+
var WorkersMessageQueue = class {
|
68
|
+
#queue;
|
69
|
+
/**
|
70
|
+
* Cloudflare Queues provide automatic retry with exponential backoff
|
71
|
+
* and Dead Letter Queues.
|
72
|
+
* @since 1.7.0
|
73
|
+
*/
|
74
|
+
nativeRetrial = true;
|
75
|
+
constructor(queue) {
|
76
|
+
const logger = (0, __logtape_logtape.getLogger)(["fedify", "cfworkers"]);
|
77
|
+
logger.warn("The `@fedify/fedify/x/cfworkers` module is deprecated; use `WorkersMessageQueue` from `@fedify/cfworkers` package instead.");
|
78
|
+
this.#queue = queue;
|
79
|
+
}
|
80
|
+
enqueue(message, options) {
|
81
|
+
return this.#queue.send(message, {
|
82
|
+
contentType: "json",
|
83
|
+
delaySeconds: options?.delay?.total("seconds") ?? 0
|
84
|
+
});
|
85
|
+
}
|
86
|
+
enqueueMany(messages, options) {
|
87
|
+
const requests = messages.map((msg) => ({
|
88
|
+
body: msg,
|
89
|
+
contentType: "json"
|
90
|
+
}));
|
91
|
+
return this.#queue.sendBatch(requests, { delaySeconds: options?.delay?.total("seconds") ?? 0 });
|
92
|
+
}
|
93
|
+
listen(_handler, _options) {
|
94
|
+
throw new TypeError("WorkersMessageQueue does not support listen(). Use Federation.processQueuedTask() method instead.");
|
95
|
+
}
|
96
|
+
};
|
97
|
+
|
98
|
+
//#endregion
|
99
|
+
exports.WorkersKvStore = WorkersKvStore;
|
100
|
+
exports.WorkersMessageQueue = WorkersMessageQueue;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { KvKey, KvStore, KvStoreSetOptions } from "../kv-63Cil1MD.cjs";
|
2
|
+
import { MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "../mq-B7R1Q-M5.cjs";
|
3
|
+
import { KVNamespace, Queue } from "@cloudflare/workers-types/experimental";
|
4
|
+
|
5
|
+
//#region src/x/cfworkers.d.ts
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Implementation of the {@link KvStore} interface for Cloudflare Workers KV
|
9
|
+
* binding. This class provides a wrapper around Cloudflare's KV namespace to
|
10
|
+
* store and retrieve JSON-serializable values using structured keys.
|
11
|
+
*
|
12
|
+
* Note that this implementation does not support the {@link KvStore.cas}
|
13
|
+
* operation, as Cloudflare Workers KV does not support atomic compare-and-swap
|
14
|
+
* operations. If you need this functionality, consider using a different
|
15
|
+
* key–value store that supports atomic operations.
|
16
|
+
*
|
17
|
+
* @deprecated This class has been moved to `@fedify/cfworkers` package.
|
18
|
+
* Import `WorkersKvStore` from `@fedify/cfworkers` instead.
|
19
|
+
* This class will be removed in Fedify v2.0.
|
20
|
+
* @since 1.6.0
|
21
|
+
*/
|
22
|
+
declare class WorkersKvStore implements KvStore {
|
23
|
+
#private;
|
24
|
+
constructor(namespace: KVNamespace<string>);
|
25
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
26
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
27
|
+
delete(key: KvKey): Promise<void>;
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Implementation of the {@link MessageQueue} interface for Cloudflare
|
31
|
+
* Workers Queues binding. This class provides a wrapper around Cloudflare's
|
32
|
+
* Queues to send messages to a queue.
|
33
|
+
*
|
34
|
+
* Note that this implementation does not support the `listen()` method,
|
35
|
+
* as Cloudflare Workers Queues do not support message consumption in the same
|
36
|
+
* way as other message queue systems. Instead, you should use
|
37
|
+
* the {@link Federation.processQueuedTask} method to process messages
|
38
|
+
* passed to the queue.
|
39
|
+
*
|
40
|
+
* @deprecated This class has been moved to `@fedify/cfworkers` package.
|
41
|
+
* Import `WorkersMessageQueue` from `@fedify/cfworkers` instead.
|
42
|
+
* This class will be removed in Fedify v2.0.
|
43
|
+
* @since 1.6.0
|
44
|
+
*/
|
45
|
+
declare class WorkersMessageQueue implements MessageQueue {
|
46
|
+
#private;
|
47
|
+
/**
|
48
|
+
* Cloudflare Queues provide automatic retry with exponential backoff
|
49
|
+
* and Dead Letter Queues.
|
50
|
+
* @since 1.7.0
|
51
|
+
*/
|
52
|
+
readonly nativeRetrial = true;
|
53
|
+
constructor(queue: Queue);
|
54
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
55
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
56
|
+
listen(_handler: (message: any) => Promise<void> | void, _options?: MessageQueueListenOptions): Promise<void>;
|
57
|
+
}
|
58
|
+
//#endregion
|
59
|
+
export { WorkersKvStore, WorkersMessageQueue };
|
package/dist/x/cfworkers.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
6
6
|
|
7
7
|
//#region src/x/cfworkers.ts
|
package/dist/x/cfworkers.test.js
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../type-
|
6
|
+
import "../type-BSR-vRXo.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../lookup-
|
11
|
-
import { test } from "../testing-
|
12
|
-
import "../std__assert-
|
13
|
-
import "../assert_rejects-
|
14
|
-
import "../assert_is_error-
|
15
|
-
import "../assert_not_equals-
|
16
|
-
import "../assert_throws-
|
10
|
+
import "../lookup-q8DeFAjR.js";
|
11
|
+
import { test } from "../testing-Cqwzq9nj.js";
|
12
|
+
import "../std__assert-X-_kMxKM.js";
|
13
|
+
import "../assert_rejects-DiIiJbZn.js";
|
14
|
+
import "../assert_is_error-BPGph1Jx.js";
|
15
|
+
import "../assert_not_equals-f3m3epl3.js";
|
16
|
+
import "../assert_throws-BOO88avQ.js";
|
17
17
|
import { delay } from "es-toolkit";
|
18
18
|
import { getLogger } from "@logtape/logtape";
|
19
19
|
|
package/dist/x/hono.cjs
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_chunk = require('../chunk-DqRYRqnO.cjs');
|
6
|
+
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
7
|
+
|
8
|
+
//#region src/x/hono.ts
|
9
|
+
/**
|
10
|
+
* Create a Hono middleware to integrate with the {@link Federation} object.
|
11
|
+
*
|
12
|
+
* @deprecated This function has been moved to `@fedify/hono` package.
|
13
|
+
* Import `federation` from `@fedify/hono` instead.
|
14
|
+
* This function will be removed in Fedify v2.0.
|
15
|
+
*
|
16
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
17
|
+
* object.
|
18
|
+
* @template THonoContext A type of the Hono context.
|
19
|
+
* @param federation A {@link Federation} object to integrate with Hono.
|
20
|
+
* @param contextDataFactory A function to create a context data for the
|
21
|
+
* {@link Federation} object.
|
22
|
+
* @returns A Hono middleware.
|
23
|
+
*/
|
24
|
+
function federation(federation$1, contextDataFactory) {
|
25
|
+
const logger = (0, __logtape_logtape.getLogger)([
|
26
|
+
"fedify",
|
27
|
+
"federation",
|
28
|
+
"hono"
|
29
|
+
]);
|
30
|
+
logger.warn("The `@fedify/fedify/x/hono` module is deprecated; use `federation` from `@fedify/hono` package instead.");
|
31
|
+
return async (ctx, next) => {
|
32
|
+
let contextData = contextDataFactory(ctx);
|
33
|
+
if (contextData instanceof Promise) contextData = await contextData;
|
34
|
+
return await federation$1.fetch(ctx.req.raw, {
|
35
|
+
contextData,
|
36
|
+
...integrateFetchOptions(ctx, next)
|
37
|
+
});
|
38
|
+
};
|
39
|
+
}
|
40
|
+
function integrateFetchOptions(ctx, next) {
|
41
|
+
return {
|
42
|
+
async onNotFound(_req) {
|
43
|
+
await next();
|
44
|
+
return ctx.res;
|
45
|
+
},
|
46
|
+
async onNotAcceptable(_req) {
|
47
|
+
await next();
|
48
|
+
if (ctx.res.status !== 404) return ctx.res;
|
49
|
+
return new Response("Not acceptable", {
|
50
|
+
status: 406,
|
51
|
+
headers: {
|
52
|
+
"Content-Type": "text/plain",
|
53
|
+
Vary: "Accept"
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
};
|
58
|
+
}
|
59
|
+
|
60
|
+
//#endregion
|
61
|
+
exports.federation = federation;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import "../kv-63Cil1MD.cjs";
|
2
|
+
import "../docloader-D-MrRyHl.cjs";
|
3
|
+
import "../client-CegPX0Rn.cjs";
|
4
|
+
import "../vocab-DJTYMqyU.cjs";
|
5
|
+
import "../actor-DMgu-ZjT.cjs";
|
6
|
+
import "../http-BS6766zs.cjs";
|
7
|
+
import "../owner-B-7Ptt_m.cjs";
|
8
|
+
import "../mod-evzlRVZq.cjs";
|
9
|
+
import "../mod-jQ4OODsl.cjs";
|
10
|
+
import { Federation } from "../context-tVOQ76fi.cjs";
|
11
|
+
import "../mq-B7R1Q-M5.cjs";
|
12
|
+
|
13
|
+
//#region src/x/hono.d.ts
|
14
|
+
interface HonoRequest {
|
15
|
+
raw: Request;
|
16
|
+
}
|
17
|
+
interface HonoContext {
|
18
|
+
req: HonoRequest;
|
19
|
+
res: Response;
|
20
|
+
}
|
21
|
+
type HonoMiddleware<THonoContext extends HonoContext> = (ctx: THonoContext, next: () => Promise<void>) => Promise<Response | void>;
|
22
|
+
/**
|
23
|
+
* A factory function to create a context data for the {@link Federation}
|
24
|
+
* object.
|
25
|
+
*
|
26
|
+
* @deprecated This type has been moved to `@fedify/hono` package.
|
27
|
+
* Import `ContextDataFactory` from `@fedify/hono` instead.
|
28
|
+
* This type will be removed in Fedify v2.0.
|
29
|
+
*
|
30
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
31
|
+
* object.
|
32
|
+
* @template THonoContext A type of the Hono context.
|
33
|
+
* @param context A Hono context object.
|
34
|
+
* @returns A context data for the {@link Federation} object.
|
35
|
+
*/
|
36
|
+
type ContextDataFactory<TContextData, THonoContext> = (context: THonoContext) => TContextData | Promise<TContextData>;
|
37
|
+
/**
|
38
|
+
* Create a Hono middleware to integrate with the {@link Federation} object.
|
39
|
+
*
|
40
|
+
* @deprecated This function has been moved to `@fedify/hono` package.
|
41
|
+
* Import `federation` from `@fedify/hono` instead.
|
42
|
+
* This function will be removed in Fedify v2.0.
|
43
|
+
*
|
44
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
45
|
+
* object.
|
46
|
+
* @template THonoContext A type of the Hono context.
|
47
|
+
* @param federation A {@link Federation} object to integrate with Hono.
|
48
|
+
* @param contextDataFactory A function to create a context data for the
|
49
|
+
* {@link Federation} object.
|
50
|
+
* @returns A Hono middleware.
|
51
|
+
*/
|
52
|
+
declare function federation<TContextData, THonoContext extends HonoContext>(federation: Federation<TContextData>, contextDataFactory: ContextDataFactory<TContextData, THonoContext>): HonoMiddleware<THonoContext>;
|
53
|
+
//#endregion
|
54
|
+
export { ContextDataFactory, federation };
|
package/dist/x/hono.d.ts
CHANGED
@@ -9,7 +9,7 @@ import "../http-DqSNLFNY.js";
|
|
9
9
|
import "../owner-CQPnQVtf.js";
|
10
10
|
import "../mod-Cxt4Kpf6.js";
|
11
11
|
import "../mod-DBzN0aCM.js";
|
12
|
-
import { Federation } from "../context-
|
12
|
+
import { Federation } from "../context-CQsAT7xk.js";
|
13
13
|
import "../mq-CRGm1e_F.js";
|
14
14
|
|
15
15
|
//#region src/x/hono.d.ts
|
package/dist/x/hono.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
6
6
|
|
7
7
|
//#region src/x/hono.ts
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_chunk = require('../chunk-DqRYRqnO.cjs');
|
6
|
+
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
7
|
+
|
8
|
+
//#region src/x/sveltekit.ts
|
9
|
+
/**
|
10
|
+
* Create a SvelteKit hook handler to integrate with the {@link Federation}
|
11
|
+
* object.
|
12
|
+
*
|
13
|
+
* @deprecated This function has been moved to `@fedify/sveltekit` package.
|
14
|
+
* Import `fedifyHook` from `@fedify/sveltekit` instead.
|
15
|
+
* This function will be removed in Fedify v2.0.
|
16
|
+
*
|
17
|
+
* @example hooks.server.ts
|
18
|
+
* ``` typescript
|
19
|
+
* import { federation } from "./federation"; // Import the `Federation` object
|
20
|
+
*
|
21
|
+
* export const handle = fedifyHook(federation, () => undefined);
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
25
|
+
* object.
|
26
|
+
* @param federation A {@link Federation} object to integrate with SvelteKit.
|
27
|
+
* @param createContextData A function to create a context data for the
|
28
|
+
* {@link Federation} object.
|
29
|
+
* @returns A SvelteKit hook handler.
|
30
|
+
* @since 1.3.0
|
31
|
+
*/
|
32
|
+
function fedifyHook(federation, createContextData) {
|
33
|
+
const logger = (0, __logtape_logtape.getLogger)([
|
34
|
+
"fedify",
|
35
|
+
"federation",
|
36
|
+
"sveltekit"
|
37
|
+
]);
|
38
|
+
logger.warn("The `@fedify/fedify/x/sveltekit` module is deprecated; use `fedifyHook` from `@fedify/sveltekit` package instead.");
|
39
|
+
return async ({ event, resolve }) => {
|
40
|
+
return await federation.fetch(event.request, {
|
41
|
+
contextData: await createContextData(event),
|
42
|
+
...integrateFetchOptions({
|
43
|
+
event,
|
44
|
+
resolve
|
45
|
+
})
|
46
|
+
});
|
47
|
+
};
|
48
|
+
}
|
49
|
+
function integrateFetchOptions({ event, resolve }) {
|
50
|
+
return {
|
51
|
+
async onNotFound() {
|
52
|
+
return await resolve(event);
|
53
|
+
},
|
54
|
+
async onNotAcceptable() {
|
55
|
+
const res = await resolve(event);
|
56
|
+
if (res.status !== 404) return res;
|
57
|
+
return new Response("Not acceptable", {
|
58
|
+
status: 406,
|
59
|
+
headers: {
|
60
|
+
"Content-Type": "text/plain",
|
61
|
+
Vary: "Accept"
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
};
|
66
|
+
}
|
67
|
+
|
68
|
+
//#endregion
|
69
|
+
exports.fedifyHook = fedifyHook;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import "../kv-63Cil1MD.cjs";
|
2
|
+
import "../docloader-D-MrRyHl.cjs";
|
3
|
+
import "../client-CegPX0Rn.cjs";
|
4
|
+
import "../vocab-DJTYMqyU.cjs";
|
5
|
+
import "../actor-DMgu-ZjT.cjs";
|
6
|
+
import "../http-BS6766zs.cjs";
|
7
|
+
import "../owner-B-7Ptt_m.cjs";
|
8
|
+
import "../mod-evzlRVZq.cjs";
|
9
|
+
import "../mod-jQ4OODsl.cjs";
|
10
|
+
import { Federation } from "../context-tVOQ76fi.cjs";
|
11
|
+
import "../mq-B7R1Q-M5.cjs";
|
12
|
+
|
13
|
+
//#region src/x/sveltekit.d.ts
|
14
|
+
type RequestEvent = {
|
15
|
+
request: Request;
|
16
|
+
};
|
17
|
+
type HookParams = {
|
18
|
+
event: RequestEvent;
|
19
|
+
resolve: (event: RequestEvent) => Promise<Response>;
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* Create a SvelteKit hook handler to integrate with the {@link Federation}
|
23
|
+
* object.
|
24
|
+
*
|
25
|
+
* @deprecated This function has been moved to `@fedify/sveltekit` package.
|
26
|
+
* Import `fedifyHook` from `@fedify/sveltekit` instead.
|
27
|
+
* This function will be removed in Fedify v2.0.
|
28
|
+
*
|
29
|
+
* @example hooks.server.ts
|
30
|
+
* ``` typescript
|
31
|
+
* import { federation } from "./federation"; // Import the `Federation` object
|
32
|
+
*
|
33
|
+
* export const handle = fedifyHook(federation, () => undefined);
|
34
|
+
* ```
|
35
|
+
*
|
36
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
37
|
+
* object.
|
38
|
+
* @param federation A {@link Federation} object to integrate with SvelteKit.
|
39
|
+
* @param createContextData A function to create a context data for the
|
40
|
+
* {@link Federation} object.
|
41
|
+
* @returns A SvelteKit hook handler.
|
42
|
+
* @since 1.3.0
|
43
|
+
*/
|
44
|
+
declare function fedifyHook<TContextData>(federation: Federation<TContextData>, createContextData: (event: RequestEvent) => TContextData | Promise<TContextData>): (params: HookParams) => Promise<Response>;
|
45
|
+
//#endregion
|
46
|
+
export { fedifyHook };
|
package/dist/x/sveltekit.d.ts
CHANGED
@@ -9,7 +9,7 @@ import "../http-DqSNLFNY.js";
|
|
9
9
|
import "../owner-CQPnQVtf.js";
|
10
10
|
import "../mod-Cxt4Kpf6.js";
|
11
11
|
import "../mod-DBzN0aCM.js";
|
12
|
-
import { Federation } from "../context-
|
12
|
+
import { Federation } from "../context-CQsAT7xk.js";
|
13
13
|
import "../mq-CRGm1e_F.js";
|
14
14
|
|
15
15
|
//#region src/x/sveltekit.d.ts
|
package/dist/x/sveltekit.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
6
6
|
|
7
7
|
//#region src/x/sveltekit.ts
|