@fedify/fedify 2.0.0-pr.433.1603 → 2.0.0-pr.434.1659

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.
Files changed (171) hide show
  1. package/dist/actor-BODH8--e.cjs +37786 -0
  2. package/dist/{actor-CY-MF2fp.js → actor-DJS2ne1f.js} +200 -200
  3. package/dist/actor-DMgu-ZjT.d.cts +128 -0
  4. package/dist/{actor-DFlEHCQA.js → actor-WgMDAZc5.js} +1 -1
  5. package/dist/{assert_rejects-7UF4R_Qs.js → assert_rejects-DiIiJbZn.js} +1 -1
  6. package/dist/{assert_throws-53_pKeP3.js → assert_throws-BOO88avQ.js} +1 -1
  7. package/dist/authdocloader-C8Eqv2Kg.cjs +58 -0
  8. package/dist/{authdocloader-CQBXQkJb.js → authdocloader-FA-VNPvw.js} +3 -3
  9. package/dist/{authdocloader-Dh8orZQs.js → authdocloader-SW1oQJ7q.js} +6 -6
  10. package/dist/{builder-Cmx9eExq.js → builder-Cp2PpvmH.js} +4 -4
  11. package/dist/chunk-DqRYRqnO.cjs +34 -0
  12. package/dist/client-CegPX0Rn.d.cts +222 -0
  13. package/dist/{client-DXKgLzk4.js → client-D_BQdihX.js} +1 -1
  14. package/dist/compat/mod.cjs +10 -0
  15. package/dist/compat/mod.d.cts +13 -0
  16. package/dist/compat/mod.d.ts +2 -2
  17. package/dist/compat/mod.js +5 -5
  18. package/dist/compat/transformers.test.js +18 -17
  19. package/dist/compat-DmDDELst.cjs +4 -0
  20. package/dist/compat-nxUqe4Z-.js +4 -0
  21. package/dist/{context-CDSZdQHD.d.ts → context-CQsAT7xk.d.ts} +0 -1
  22. package/dist/context-tVOQ76fi.d.cts +2254 -0
  23. package/dist/docloader-D-MrRyHl.d.cts +219 -0
  24. package/dist/{docloader-D4sbvvPM.js → docloader-DrPHprgh.js} +188 -8
  25. package/dist/docloader-dZO9fPIT.cjs +4861 -0
  26. package/dist/{esm-D6i4YQ2_.js → esm-CjcCcZ6s.js} +1 -1
  27. package/dist/federation/builder.test.js +10 -10
  28. package/dist/federation/collection.test.js +8 -8
  29. package/dist/federation/handler.test.js +26 -145
  30. package/dist/federation/inbox.test.js +6 -6
  31. package/dist/federation/keycache.test.js +4 -4
  32. package/dist/federation/kv.test.js +9 -8
  33. package/dist/federation/middleware.test.js +255 -38
  34. package/dist/federation/mod.cjs +29 -0
  35. package/dist/federation/mod.d.cts +13 -0
  36. package/dist/federation/mod.d.ts +1 -1
  37. package/dist/federation/mod.js +15 -15
  38. package/dist/federation/mq.test.js +10 -10
  39. package/dist/federation/negotiation.test.d.ts +3 -0
  40. package/dist/federation/negotiation.test.js +28 -0
  41. package/dist/federation/retry.test.js +5 -5
  42. package/dist/federation/router.test.js +8 -8
  43. package/dist/federation/send.test.js +15 -15
  44. package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
  45. package/dist/federation-H2_En3j5.cjs +244 -0
  46. package/dist/{http-mimmGwH8.js → http-BPkuNd26.js} +2 -2
  47. package/dist/http-BS6766zs.d.cts +253 -0
  48. package/dist/{http-az-I4DFF.js → http-BgQ07Ja_.js} +6 -6
  49. package/dist/http-CZJRJ0Pv.cjs +826 -0
  50. package/dist/{inbox--bLOiwUO.js → inbox-CCB1CbWJ.js} +1 -1
  51. package/dist/{key-DaaSDiCV.js → key-B_P3wH2F.js} +5 -5
  52. package/dist/{key-Gjnnnh5S.js → key-BstbqwrH.js} +3 -3
  53. package/dist/{key-C6ojpFqZ.js → key-C0k2A_bI.js} +2 -2
  54. package/dist/key-C8TOf6mh.cjs +290 -0
  55. package/dist/key-CtA7xiw_.js +10 -0
  56. package/dist/key-hknDPZ-z.cjs +10 -0
  57. package/dist/{keycache-DZnNO-JV.js → keycache-DvDW8JPA.js} +1 -1
  58. package/dist/{keys-BU2fip9w.js → keys-DzXrG_sX.js} +1 -1
  59. package/dist/kv-63Cil1MD.d.cts +81 -0
  60. package/dist/{ld-tLocOQ6q.js → ld-BcKcM_o9.js} +2 -2
  61. package/dist/{lookup-DG0T7i6q.js → lookup-C3BC8XO-.js} +4 -4
  62. package/dist/lookup-C3BGNQTz.cjs +137 -0
  63. package/dist/{lookup-1CBMmJ3_.js → lookup-DbTBDJcT.js} +1 -1
  64. package/dist/{middleware-BJn2g4ay.js → middleware-B3crRaK-.js} +50 -81
  65. package/dist/middleware-BWXHJSkY.cjs +17 -0
  66. package/dist/middleware-C4A4GTtX.cjs +4204 -0
  67. package/dist/middleware-CGlIdSyy.js +17 -0
  68. package/dist/middleware-CUWXMbGt.js +26 -0
  69. package/dist/{middleware-CU2GpLYi.js → middleware-CXRqw8n4.js} +49 -144
  70. package/dist/{mod-RI3-KvUI.d.ts → mod-B26zRlH1.d.ts} +1 -1
  71. package/dist/mod-BClfg3ej.d.cts +266 -0
  72. package/dist/mod-C2tOeRkN.d.cts +1 -0
  73. package/dist/mod-DBQAI4v9.d.cts +80 -0
  74. package/dist/mod-Dc_-mf8s.d.cts +102 -0
  75. package/dist/mod-FZd39qVq.d.cts +1 -0
  76. package/dist/mod-evzlRVZq.d.cts +289 -0
  77. package/dist/mod-jQ4OODsl.d.cts +113 -0
  78. package/dist/mod.cjs +150 -0
  79. package/dist/mod.d.cts +17 -0
  80. package/dist/mod.d.ts +2 -2
  81. package/dist/mod.js +20 -20
  82. package/dist/mq-B7R1Q-M5.d.cts +140 -0
  83. package/dist/negotiation-5NPJL6zp.js +71 -0
  84. package/dist/nodeinfo/client.test.js +10 -10
  85. package/dist/nodeinfo/handler.test.js +23 -22
  86. package/dist/nodeinfo/mod.cjs +11 -0
  87. package/dist/nodeinfo/mod.d.cts +5 -0
  88. package/dist/nodeinfo/mod.js +6 -6
  89. package/dist/nodeinfo/types.test.js +8 -8
  90. package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
  91. package/dist/nodeinfo-DfycQ8Wf.js +4 -0
  92. package/dist/owner-B-7Ptt_m.d.cts +67 -0
  93. package/dist/{owner-qDh_g_5C.js → owner-BcEciLTD.js} +2 -2
  94. package/dist/{proof-aGjI96QA.js → proof-DAEfR6xA.js} +6 -6
  95. package/dist/proof-ZBmKo2zb.cjs +673 -0
  96. package/dist/{proof-DimUFDOB.js → proof-vGquXXR6.js} +2 -2
  97. package/dist/runtime/authdocloader.test.js +14 -14
  98. package/dist/runtime/docloader.test.js +9 -9
  99. package/dist/runtime/key.test.js +10 -10
  100. package/dist/runtime/langstr.test.js +8 -8
  101. package/dist/runtime/link.test.d.ts +3 -0
  102. package/dist/runtime/link.test.js +61 -0
  103. package/dist/runtime/mod.cjs +25 -0
  104. package/dist/runtime/mod.d.cts +6 -0
  105. package/dist/runtime/mod.js +10 -10
  106. package/dist/runtime/multibase/multibase.test.js +8 -8
  107. package/dist/runtime/url.test.js +5 -5
  108. package/dist/runtime-C58AJWSv.cjs +4 -0
  109. package/dist/runtime-DPYEDf-o.js +4 -0
  110. package/dist/{send-BDoLPO28.js → send-svmMjAUr.js} +2 -2
  111. package/dist/sig/http.test.js +13 -13
  112. package/dist/sig/key.test.js +11 -11
  113. package/dist/sig/ld.test.js +10 -10
  114. package/dist/sig/mod.cjs +30 -0
  115. package/dist/sig/mod.d.cts +8 -0
  116. package/dist/sig/mod.js +10 -10
  117. package/dist/sig/owner.test.js +12 -12
  118. package/dist/sig/proof.test.js +12 -12
  119. package/dist/sig-ByHXzqUi.cjs +4 -0
  120. package/dist/sig-Cj3tk-ig.js +4 -0
  121. package/dist/testing/docloader.test.js +8 -8
  122. package/dist/testing/mod.js +3 -3
  123. package/dist/{testing-BtAnu4dJ.js → testing-y9ueu9Aj.js} +2 -2
  124. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  125. package/dist/transformers-CoBS-oFG.cjs +116 -0
  126. package/dist/{type-CGIBxLsG.js → type-9o78PXlX.js} +381 -201
  127. package/dist/{types-DiMJWG0f.js → types-DTCqX5HE.js} +4 -4
  128. package/dist/types-K5btoOl6.cjs +315 -0
  129. package/dist/vocab/actor.test.js +10 -10
  130. package/dist/vocab/lookup.test.js +9 -9
  131. package/dist/vocab/mod.cjs +87 -0
  132. package/dist/vocab/mod.d.cts +6 -0
  133. package/dist/vocab/mod.js +7 -7
  134. package/dist/vocab/type.test.js +3 -3
  135. package/dist/vocab/vocab.test.js +45 -10
  136. package/dist/vocab-CJ0jQMQV.cjs +282 -0
  137. package/dist/{vocab-Br3OfNTW.js → vocab-C_Pm3NG3.js} +6 -6
  138. package/dist/vocab-DJTYMqyU.d.cts +14632 -0
  139. package/dist/webfinger/handler.test.js +23 -22
  140. package/dist/webfinger/lookup.test.js +9 -9
  141. package/dist/webfinger/mod.cjs +9 -0
  142. package/dist/webfinger/mod.d.cts +4 -0
  143. package/dist/webfinger/mod.js +6 -6
  144. package/dist/webfinger-BjOEdFPs.cjs +4 -0
  145. package/dist/webfinger-De_bU0iE.js +4 -0
  146. package/dist/x/cfworkers.cjs +100 -0
  147. package/dist/x/cfworkers.d.cts +59 -0
  148. package/dist/x/cfworkers.js +3 -3
  149. package/dist/x/cfworkers.test.js +8 -8
  150. package/dist/x/hono.cjs +61 -0
  151. package/dist/x/hono.d.cts +54 -0
  152. package/dist/x/hono.d.ts +1 -1
  153. package/dist/x/hono.js +3 -3
  154. package/dist/x/sveltekit.cjs +69 -0
  155. package/dist/x/sveltekit.d.cts +46 -0
  156. package/dist/x/sveltekit.d.ts +1 -1
  157. package/dist/x/sveltekit.js +3 -3
  158. package/package.json +68 -13
  159. package/dist/compat-Bb5myD13.js +0 -4
  160. package/dist/key-BFfeDCSU.js +0 -10
  161. package/dist/middleware-aYHOiG0n.js +0 -17
  162. package/dist/middleware-u5BtkYWm.js +0 -25
  163. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  164. package/dist/runtime-BSkOVUWM.js +0 -4
  165. package/dist/sig-BXJO--F9.js +0 -4
  166. package/dist/webfinger-C3GIyXIg.js +0 -4
  167. /package/dist/{assert_is_error-B035L3om.js → assert_is_error-BPGph1Jx.js} +0 -0
  168. /package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals-f3m3epl3.js} +0 -0
  169. /package/dist/{denokv-jZ0Z2h0M.js → denokv-Bv33Xxea.js} +0 -0
  170. /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
  171. /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-CGIBxLsG.js";
6
+ import { Image, Link, Person } from "../type-9o78PXlX.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-CU2GpLYi.js";
12
- import "../client-DXKgLzk4.js";
13
- import "../lookup-1CBMmJ3_.js";
11
+ import { createFederation, handleWebFinger } from "../middleware-CXRqw8n4.js";
12
+ import "../client-D_BQdihX.js";
13
+ import "../lookup-DbTBDJcT.js";
14
14
  import "../types-BSuWJsOm.js";
15
- import "../actor-DFlEHCQA.js";
16
- import "../key-C6ojpFqZ.js";
17
- import "../http-mimmGwH8.js";
18
- import "../authdocloader-CQBXQkJb.js";
19
- import "../ld-tLocOQ6q.js";
20
- import "../owner-qDh_g_5C.js";
21
- import "../proof-DimUFDOB.js";
22
- import "../inbox--bLOiwUO.js";
23
- import "../builder-Cmx9eExq.js";
15
+ import "../actor-WgMDAZc5.js";
16
+ import "../key-C0k2A_bI.js";
17
+ import "../http-BPkuNd26.js";
18
+ import "../authdocloader-FA-VNPvw.js";
19
+ import "../ld-BcKcM_o9.js";
20
+ import "../owner-BcEciLTD.js";
21
+ import "../proof-vGquXXR6.js";
22
+ import "../inbox-CCB1CbWJ.js";
23
+ import "../builder-Cp2PpvmH.js";
24
24
  import "../collection-CcnIw1qY.js";
25
- import "../keycache-DZnNO-JV.js";
26
- import "../retry-CfF8Gn4d.js";
27
- import "../send-BDoLPO28.js";
28
- import { createRequestContext, test } from "../testing-BtAnu4dJ.js";
29
- import "../std__assert-DWivtrGR.js";
30
- import "../assert_rejects-7UF4R_Qs.js";
31
- import "../assert_is_error-B035L3om.js";
32
- import "../assert_not_equals-C80BG-_5.js";
33
- import "../assert_throws-53_pKeP3.js";
25
+ import "../keycache-DvDW8JPA.js";
26
+ import "../negotiation-5NPJL6zp.js";
27
+ import "../retry-D4GJ670a.js";
28
+ import "../send-svmMjAUr.js";
29
+ import { createRequestContext, test } from "../testing-y9ueu9Aj.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-CGIBxLsG.js";
6
+ import { lookupWebFinger } from "../type-9o78PXlX.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-1CBMmJ3_.js";
11
- import { test } from "../testing-BtAnu4dJ.js";
12
- import "../std__assert-DWivtrGR.js";
13
- import "../assert_rejects-7UF4R_Qs.js";
14
- import "../assert_is_error-B035L3om.js";
15
- import "../assert_not_equals-C80BG-_5.js";
16
- import "../assert_throws-53_pKeP3.js";
17
- import { esm_default } from "../esm-D6i4YQ2_.js";
10
+ import "../lookup-DbTBDJcT.js";
11
+ import { test } from "../testing-y9ueu9Aj.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-CjcCcZ6s.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-dZO9fPIT.cjs');
6
+ const require_lookup = require('../lookup-C3BGNQTz.cjs');
7
+ require('../webfinger-BjOEdFPs.cjs');
8
+
9
+ exports.lookupWebFinger = require_lookup.lookupWebFinger;
@@ -0,0 +1,4 @@
1
+ import "../kv-63Cil1MD.cjs";
2
+ import "../docloader-D-MrRyHl.cjs";
3
+ import { Link, LookupWebFingerOptions, ResourceDescriptor, lookupWebFinger } from "../mod-jQ4OODsl.cjs";
4
+ export { Link, LookupWebFingerOptions, ResourceDescriptor, lookupWebFinger };
@@ -1,9 +1,9 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import "../docloader-D4sbvvPM.js";
6
- import { lookupWebFinger } from "../lookup-DG0T7i6q.js";
7
- import "../webfinger-C3GIyXIg.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import "../docloader-DrPHprgh.js";
6
+ import { lookupWebFinger } from "../lookup-C3BC8XO-.js";
7
+ import "../webfinger-De_bU0iE.js";
8
8
 
9
9
  export { lookupWebFinger };
@@ -0,0 +1,4 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
@@ -0,0 +1,4 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
@@ -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 };
@@ -1,7 +1,7 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
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
@@ -3,17 +3,17 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../type-CGIBxLsG.js";
6
+ import "../type-9o78PXlX.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-1CBMmJ3_.js";
11
- import { test } from "../testing-BtAnu4dJ.js";
12
- import "../std__assert-DWivtrGR.js";
13
- import "../assert_rejects-7UF4R_Qs.js";
14
- import "../assert_is_error-B035L3om.js";
15
- import "../assert_not_equals-C80BG-_5.js";
16
- import "../assert_throws-53_pKeP3.js";
10
+ import "../lookup-DbTBDJcT.js";
11
+ import { test } from "../testing-y9ueu9Aj.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
 
@@ -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-CDSZdQHD.js";
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
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
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 };
@@ -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-CDSZdQHD.js";
12
+ import { Federation } from "../context-CQsAT7xk.js";
13
13
  import "../mq-CRGm1e_F.js";
14
14
 
15
15
  //#region src/x/sveltekit.d.ts
@@ -1,7 +1,7 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
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