@fedify/fedify 2.0.0-pr.469.1873 → 2.0.0-pr.474.1879

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 (122) hide show
  1. package/dist/{actor-Bo3uuvwH.js → actor-BYv3E3MI.js} +185 -185
  2. package/dist/{actor-DoaVs0vL.cjs → actor-CjcnBLTk.cjs} +185 -185
  3. package/dist/{actor-DhFfLv7K.js → actor-DM_mczcz.js} +1 -1
  4. package/dist/{builder-DFaO3_4-.js → builder-CpW45hts.js} +3 -3
  5. package/dist/compat/mod.d.cts +2 -3
  6. package/dist/compat/mod.d.ts +2 -3
  7. package/dist/compat/transformers.test.js +14 -14
  8. package/dist/{context-DG0huGW-.d.ts → context-DXV-2IZN.d.ts} +146 -3
  9. package/dist/{context-DJ8aSy2Q.d.cts → context-Nt2rAqjj.d.cts} +146 -3
  10. package/dist/{docloader-B1AZ1LMA.js → docloader-DPQnUMPZ.js} +2 -2
  11. package/dist/{esm-CbckHird.js → esm-CHBTY23R.js} +1 -1
  12. package/dist/federation/builder.test.js +4 -4
  13. package/dist/federation/collection.test.js +2 -2
  14. package/dist/federation/handler.test.js +15 -15
  15. package/dist/federation/handler_requirehttpsig.test.js +138 -0
  16. package/dist/federation/idempotency.test.js +15 -15
  17. package/dist/federation/inbox.test.js +3 -3
  18. package/dist/federation/keycache.test.js +3 -3
  19. package/dist/federation/kv.test.js +2 -2
  20. package/dist/federation/middleware.test.js +16 -16
  21. package/dist/federation/mod.cjs +7 -7
  22. package/dist/federation/mod.d.cts +2 -3
  23. package/dist/federation/mod.d.ts +2 -3
  24. package/dist/federation/mod.js +7 -7
  25. package/dist/federation/mq.test.js +6 -4
  26. package/dist/federation/negotiation.test.js +2 -2
  27. package/dist/federation/retry.test.js +2 -2
  28. package/dist/federation/router.test.js +2 -2
  29. package/dist/federation/send.test.js +9 -9
  30. package/dist/{http-D27ZccIJ.cjs → http-B1cyhAOR.cjs} +2 -2
  31. package/dist/{http-D8SvAGVC.js → http-CNbh6Bgj.js} +2 -2
  32. package/dist/{http-nnaaa9xj.js → http-Di-WAayg.js} +2 -2
  33. package/dist/{inbox-C5M1_a0k.js → inbox-CKpjNIIw.js} +1 -1
  34. package/dist/{key-bc3A8THw.js → key-Bm6xoWJ9.js} +2 -2
  35. package/dist/{keycache-CpTjHRpy.js → keycache-BoIUmk-X.js} +1 -1
  36. package/dist/{keys-D6W2Pnoh.js → keys-BJSEmAMh.js} +1 -1
  37. package/dist/{kv-cache-B_RVzls5.js → kv-cache-BCfbzWvV.js} +1 -1
  38. package/dist/{kv-cache-CZcZLaEo.cjs → kv-cache-ugHk-g8V.cjs} +1 -1
  39. package/dist/{ld-D5Vg307g.js → ld-CFrblqOy.js} +2 -2
  40. package/dist/{lookup-DO7ZeFb2.cjs → lookup-BKHMnItE.cjs} +2 -7
  41. package/dist/{lookup-BBrk-_5k.js → lookup-CjRKAy5i.js} +186 -191
  42. package/dist/{lookup-BXY5QJif.js → lookup-CovW5HO7.js} +2 -7
  43. package/dist/{middleware-CU0RJROn.js → middleware-BCCuNXoU.js} +17 -15
  44. package/dist/middleware-CaQFohcx.js +26 -0
  45. package/dist/middleware-CqJTYvui.cjs +15 -0
  46. package/dist/{middleware-RgDZByG7.js → middleware-DFP98BrZ.js} +13 -11
  47. package/dist/middleware-cA6uI21b.js +15 -0
  48. package/dist/{middleware-Dy7xPuu-.cjs → middleware-fxZRXc2R.cjs} +13 -11
  49. package/dist/{mod-DJcZDvjA.d.cts → mod-CKRSFzK_.d.cts} +1 -1
  50. package/dist/{mod-BoHnwOCs.d.ts → mod-C_6Uxusd.d.ts} +1 -1
  51. package/dist/mod.cjs +7 -7
  52. package/dist/mod.d.cts +5 -6
  53. package/dist/mod.d.ts +5 -6
  54. package/dist/mod.js +7 -7
  55. package/dist/nodeinfo/client.test.js +3 -3
  56. package/dist/nodeinfo/handler.test.js +14 -14
  57. package/dist/nodeinfo/mod.d.cts +1 -1
  58. package/dist/nodeinfo/mod.d.ts +1 -1
  59. package/dist/nodeinfo/types.test.js +2 -2
  60. package/dist/{owner-DSDpCSms.js → owner-8cgMngcR.js} +2 -2
  61. package/dist/{proof-Bvu8zaM1.js → proof-BbhNICOW.js} +2 -2
  62. package/dist/{proof-C1-VSUNW.cjs → proof-C3woq5fl.cjs} +3 -3
  63. package/dist/{proof-4L3D-iT4.js → proof-OnfETSbB.js} +3 -3
  64. package/dist/{send-Cr3PSs0N.js → send-zlaQ6fqY.js} +2 -2
  65. package/dist/sig/http.test.js +7 -7
  66. package/dist/sig/key.test.js +5 -5
  67. package/dist/sig/ld.test.js +6 -6
  68. package/dist/sig/mod.cjs +4 -4
  69. package/dist/sig/mod.d.cts +1 -1
  70. package/dist/sig/mod.d.ts +1 -1
  71. package/dist/sig/mod.js +4 -4
  72. package/dist/sig/owner.test.js +6 -6
  73. package/dist/sig/proof.test.js +6 -6
  74. package/dist/testing/docloader.test.js +2 -2
  75. package/dist/testing/mod.d.ts +6 -0
  76. package/dist/testing/mod.js +2 -2
  77. package/dist/{testing-Bw9AfLxQ.js → testing-DHsP4t6k.js} +1 -1
  78. package/dist/utils/docloader.test.js +8 -8
  79. package/dist/utils/kv-cache.test.js +2 -2
  80. package/dist/utils/mod.cjs +4 -4
  81. package/dist/utils/mod.d.cts +1 -1
  82. package/dist/utils/mod.d.ts +1 -1
  83. package/dist/utils/mod.js +4 -4
  84. package/dist/vocab/actor.test.js +4 -4
  85. package/dist/vocab/lookup.test.js +3 -3
  86. package/dist/vocab/mod.cjs +3 -3
  87. package/dist/vocab/mod.js +3 -3
  88. package/dist/vocab/type.test.js +2 -2
  89. package/dist/vocab/vocab.test.js +3 -3
  90. package/dist/{vocab-B74bq08l.js → vocab-DMGCHMXF.js} +2 -2
  91. package/dist/{vocab-HJLl6-1F.cjs → vocab-YXPM77QO.cjs} +2 -2
  92. package/dist/webfinger/handler.test.js +14 -14
  93. package/dist/webfinger/lookup.test.js +3 -3
  94. package/dist/webfinger/mod.cjs +1 -1
  95. package/dist/webfinger/mod.js +1 -1
  96. package/package.json +3 -34
  97. package/dist/denokv-CCssOzMJ.js +0 -57
  98. package/dist/middleware-BU2XnCCI.js +0 -15
  99. package/dist/middleware-D4qQ6MLq.cjs +0 -15
  100. package/dist/middleware-DEu9Xuza.js +0 -26
  101. package/dist/mq-CUKlBw08.d.ts +0 -143
  102. package/dist/mq-DcJPkXD5.d.cts +0 -140
  103. package/dist/x/cfworkers.cjs +0 -100
  104. package/dist/x/cfworkers.d.cts +0 -59
  105. package/dist/x/cfworkers.d.ts +0 -61
  106. package/dist/x/cfworkers.js +0 -98
  107. package/dist/x/cfworkers.test.js +0 -177
  108. package/dist/x/hono.cjs +0 -61
  109. package/dist/x/hono.d.cts +0 -53
  110. package/dist/x/hono.d.ts +0 -55
  111. package/dist/x/hono.js +0 -60
  112. package/dist/x/sveltekit.cjs +0 -69
  113. package/dist/x/sveltekit.d.cts +0 -45
  114. package/dist/x/sveltekit.d.ts +0 -47
  115. package/dist/x/sveltekit.js +0 -68
  116. /package/dist/{x/cfworkers.test.d.ts → federation/handler_requirehttpsig.test.d.ts} +0 -0
  117. /package/dist/{mod-C2tOeRkN.d.cts → mod-CcDPcLJW.d.cts} +0 -0
  118. /package/dist/{mod-B2iOw50L.d.ts → mod-D5Z2tISD.d.ts} +0 -0
  119. /package/dist/{mod-0noXw66R.d.cts → mod-DMpuiKXi.d.cts} +0 -0
  120. /package/dist/{mod-DgdBYYa0.d.cts → mod-DgxG-byT.d.cts} +0 -0
  121. /package/dist/{mod-B9M-8jm2.d.ts → mod-aAE2wOWV.d.ts} +0 -0
  122. /package/dist/{mod-xIj-IT58.d.ts → mod-bjzj5QIb.d.ts} +0 -0
@@ -1,57 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { isEqual } from "es-toolkit";
7
- import { getLogger } from "@logtape/logtape";
8
-
9
- //#region src/x/denokv.ts
10
- /**
11
- * Represents a message queue adapter that uses Deno KV store.
12
- *
13
- * @deprecated This class has been moved to `@fedify/denokv` package.
14
- * Import `DenoKvMessageQueue` from `@fedify/denokv` instead.
15
- * This class will be removed in Fedify v2.0.
16
- */
17
- var DenoKvMessageQueue = class {
18
- #kv;
19
- /**
20
- * Deno KV queues provide automatic retry with exponential backoff.
21
- * @since 1.7.0
22
- */
23
- nativeRetrial = true;
24
- /**
25
- * Constructs a new {@link DenoKvMessageQueue} adapter with the given Deno KV
26
- * store.
27
- * @param kv The Deno KV store to use.
28
- */
29
- constructor(kv) {
30
- const logger = getLogger(["fedify", "denokv"]);
31
- logger.warn("The `@fedify/fedify/x/denokv` module is deprecated; use `DenoKvMessageQueue` from `@fedify/denokv` package instead.");
32
- this.#kv = kv;
33
- }
34
- async enqueue(message, options) {
35
- await this.#kv.enqueue(message, options?.delay == null ? void 0 : { delay: Math.max(options.delay.total("millisecond"), 0) });
36
- }
37
- listen(handler, options = {}) {
38
- options.signal?.addEventListener("abort", () => {
39
- try {
40
- this.#kv.close();
41
- } catch (e) {
42
- if (!(e instanceof Deno.errors.BadResource)) throw e;
43
- }
44
- }, { once: true });
45
- return this.#kv.listenQueue(handler);
46
- }
47
- [Symbol.dispose]() {
48
- try {
49
- this.#kv.close();
50
- } catch (e) {
51
- if (!(e instanceof Deno.errors.BadResource)) throw e;
52
- }
53
- }
54
- };
55
-
56
- //#endregion
57
- export { DenoKvMessageQueue };
@@ -1,15 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import "./transformers-BFT6d7J5.js";
6
- import "./lookup-BXY5QJif.js";
7
- import "./actor-Bo3uuvwH.js";
8
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-RgDZByG7.js";
9
- import "./http-nnaaa9xj.js";
10
- import "./proof-4L3D-iT4.js";
11
- import "./types-BtUjyi5y.js";
12
- import "./kv-cache-B_RVzls5.js";
13
- import "./vocab-B74bq08l.js";
14
-
15
- export { FederationImpl };
@@ -1,15 +0,0 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
5
- require('./transformers-CoBS-oFG.cjs');
6
- require('./lookup-DO7ZeFb2.cjs');
7
- require('./actor-DoaVs0vL.cjs');
8
- const require_middleware = require('./middleware-Dy7xPuu-.cjs');
9
- require('./http-D27ZccIJ.cjs');
10
- require('./proof-C1-VSUNW.cjs');
11
- require('./types-CWgzGaqk.cjs');
12
- require('./kv-cache-CZcZLaEo.cjs');
13
- require('./vocab-HJLl6-1F.cjs');
14
-
15
- exports.FederationImpl = require_middleware.FederationImpl;
@@ -1,26 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import "./lookup-BBrk-_5k.js";
7
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-CU0RJROn.js";
8
- import "./client-pY7-3icS.js";
9
- import "./types-C2XVl6gj.js";
10
- import "./actor-DhFfLv7K.js";
11
- import "./key-bc3A8THw.js";
12
- import "./http-D8SvAGVC.js";
13
- import "./ld-D5Vg307g.js";
14
- import "./owner-DSDpCSms.js";
15
- import "./proof-Bvu8zaM1.js";
16
- import "./docloader-B1AZ1LMA.js";
17
- import "./kv-cache-DN9pfMBe.js";
18
- import "./inbox-C5M1_a0k.js";
19
- import "./builder-DFaO3_4-.js";
20
- import "./collection-BzWsN9pB.js";
21
- import "./keycache-CpTjHRpy.js";
22
- import "./negotiation-C4nFufNk.js";
23
- import "./retry-CfF8Gn4d.js";
24
- import "./send-Cr3PSs0N.js";
25
-
26
- export { FederationImpl };
@@ -1,143 +0,0 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
-
4
- //#region src/federation/mq.d.ts
5
- /**
6
- * Additional options for enqueuing a message in a queue.
7
- *
8
- * @since 0.5.0
9
- */
10
- interface MessageQueueEnqueueOptions {
11
- /**
12
- * The delay before the message is enqueued. No delay by default.
13
- *
14
- * It must not be negative.
15
- */
16
- delay?: Temporal.Duration;
17
- }
18
- /**
19
- * Additional options for listening to a message queue.
20
- *
21
- * @since 1.0.0
22
- */
23
- interface MessageQueueListenOptions {
24
- /**
25
- * The signal to abort listening to the message queue.
26
- */
27
- signal?: AbortSignal;
28
- }
29
- /**
30
- * An abstract interface for a message queue.
31
- *
32
- * @since 0.5.0
33
- */
34
- interface MessageQueue {
35
- /**
36
- * Whether the message queue backend provides native retry mechanisms.
37
- * When `true`, Fedify will skip its own retry logic and rely on the backend
38
- * to handle retries. When `false` or omitted, Fedify will handle retries
39
- * using its own retry policies.
40
- *
41
- * @default `false`
42
- * @since 1.7.0
43
- */
44
- readonly nativeRetrial?: boolean;
45
- /**
46
- * Enqueues a message in the queue.
47
- * @param message The message to enqueue.
48
- * @param options Additional options for enqueuing the message.
49
- */
50
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
51
- /**
52
- * Enqueues multiple messages in the queue. This operation is optional,
53
- * and may not be supported by all implementations. If not supported,
54
- * Fedify will invoke {@link enqueue} for each message.
55
- *
56
- * @param messages The messages to enqueue.
57
- * @param options Additional options for enqueuing the messages.
58
- */
59
- enqueueMany?: (messages: any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
60
- /**
61
- * Listens for messages in the queue.
62
- * @param handler The handler for messages in the queue.
63
- * @param options Additional options for listening to the message queue.
64
- * @returns A promise that resolves when the listening is done. It never
65
- * rejects, and is resolved when the signal is aborted. If no
66
- * signal is provided, it never resolves.
67
- */
68
- listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
69
- }
70
- /**
71
- * Additional options for {@link InProcessMessageQueue}.
72
- * @since 1.0.0
73
- */
74
- interface InProcessMessageQueueOptions {
75
- /**
76
- * The interval to poll for messages in the queue. 5 seconds by default.
77
- * @default `{ seconds: 5 }`
78
- */
79
- pollInterval?: Temporal.Duration | Temporal.DurationLike;
80
- }
81
- /**
82
- * A message queue that processes messages in the same process.
83
- * Do not use this in production as it does neither persist messages nor
84
- * distribute them across multiple processes.
85
- *
86
- * @since 0.5.0
87
- */
88
- declare class InProcessMessageQueue implements MessageQueue {
89
- #private;
90
- /**
91
- * In-process message queue does not provide native retry mechanisms.
92
- * @since 1.7.0
93
- */
94
- readonly nativeRetrial = false;
95
- /**
96
- * Constructs a new {@link InProcessMessageQueue} with the given options.
97
- * @param options Additional options for the in-process message queue.
98
- */
99
- constructor(options?: InProcessMessageQueueOptions);
100
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
101
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
102
- listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
103
- }
104
- /**
105
- * A message queue that processes messages in parallel. It takes another
106
- * {@link MessageQueue}, and processes messages in parallel up to a certain
107
- * number of workers.
108
- *
109
- * Actually, it's rather a decorator than a queue itself.
110
- *
111
- * Note that the workers do not run in truly parallel, in the sense that they
112
- * are not running in separate threads or processes. They are running in the
113
- * same process, but are scheduled to run in parallel. Hence, this is useful
114
- * for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
115
- * workloads.
116
- *
117
- * @since 1.0.0
118
- */
119
- declare class ParallelMessageQueue implements MessageQueue {
120
- #private;
121
- readonly queue: MessageQueue;
122
- readonly workers: number;
123
- /**
124
- * Inherits the native retry capability from the wrapped queue.
125
- * @since 1.7.0
126
- */
127
- readonly nativeRetrial?: boolean;
128
- /**
129
- * Constructs a new {@link ParallelMessageQueue} with the given queue and
130
- * number of workers.
131
- * @param queue The message queue to use under the hood. Note that
132
- * {@link ParallelMessageQueue} cannot be nested.
133
- * @param workers The number of workers to process messages in parallel.
134
- * @throws {TypeError} If the given queue is an instance of
135
- * {@link ParallelMessageQueue}.
136
- */
137
- constructor(queue: MessageQueue, workers: number);
138
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
139
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
140
- listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
141
- }
142
- //#endregion
143
- export { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue };
@@ -1,140 +0,0 @@
1
- //#region src/federation/mq.d.ts
2
- /**
3
- * Additional options for enqueuing a message in a queue.
4
- *
5
- * @since 0.5.0
6
- */
7
- interface MessageQueueEnqueueOptions {
8
- /**
9
- * The delay before the message is enqueued. No delay by default.
10
- *
11
- * It must not be negative.
12
- */
13
- delay?: Temporal.Duration;
14
- }
15
- /**
16
- * Additional options for listening to a message queue.
17
- *
18
- * @since 1.0.0
19
- */
20
- interface MessageQueueListenOptions {
21
- /**
22
- * The signal to abort listening to the message queue.
23
- */
24
- signal?: AbortSignal;
25
- }
26
- /**
27
- * An abstract interface for a message queue.
28
- *
29
- * @since 0.5.0
30
- */
31
- interface MessageQueue {
32
- /**
33
- * Whether the message queue backend provides native retry mechanisms.
34
- * When `true`, Fedify will skip its own retry logic and rely on the backend
35
- * to handle retries. When `false` or omitted, Fedify will handle retries
36
- * using its own retry policies.
37
- *
38
- * @default `false`
39
- * @since 1.7.0
40
- */
41
- readonly nativeRetrial?: boolean;
42
- /**
43
- * Enqueues a message in the queue.
44
- * @param message The message to enqueue.
45
- * @param options Additional options for enqueuing the message.
46
- */
47
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
48
- /**
49
- * Enqueues multiple messages in the queue. This operation is optional,
50
- * and may not be supported by all implementations. If not supported,
51
- * Fedify will invoke {@link enqueue} for each message.
52
- *
53
- * @param messages The messages to enqueue.
54
- * @param options Additional options for enqueuing the messages.
55
- */
56
- enqueueMany?: (messages: any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
57
- /**
58
- * Listens for messages in the queue.
59
- * @param handler The handler for messages in the queue.
60
- * @param options Additional options for listening to the message queue.
61
- * @returns A promise that resolves when the listening is done. It never
62
- * rejects, and is resolved when the signal is aborted. If no
63
- * signal is provided, it never resolves.
64
- */
65
- listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
66
- }
67
- /**
68
- * Additional options for {@link InProcessMessageQueue}.
69
- * @since 1.0.0
70
- */
71
- interface InProcessMessageQueueOptions {
72
- /**
73
- * The interval to poll for messages in the queue. 5 seconds by default.
74
- * @default `{ seconds: 5 }`
75
- */
76
- pollInterval?: Temporal.Duration | Temporal.DurationLike;
77
- }
78
- /**
79
- * A message queue that processes messages in the same process.
80
- * Do not use this in production as it does neither persist messages nor
81
- * distribute them across multiple processes.
82
- *
83
- * @since 0.5.0
84
- */
85
- declare class InProcessMessageQueue implements MessageQueue {
86
- #private;
87
- /**
88
- * In-process message queue does not provide native retry mechanisms.
89
- * @since 1.7.0
90
- */
91
- readonly nativeRetrial = false;
92
- /**
93
- * Constructs a new {@link InProcessMessageQueue} with the given options.
94
- * @param options Additional options for the in-process message queue.
95
- */
96
- constructor(options?: InProcessMessageQueueOptions);
97
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
98
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
99
- listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
100
- }
101
- /**
102
- * A message queue that processes messages in parallel. It takes another
103
- * {@link MessageQueue}, and processes messages in parallel up to a certain
104
- * number of workers.
105
- *
106
- * Actually, it's rather a decorator than a queue itself.
107
- *
108
- * Note that the workers do not run in truly parallel, in the sense that they
109
- * are not running in separate threads or processes. They are running in the
110
- * same process, but are scheduled to run in parallel. Hence, this is useful
111
- * for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
112
- * workloads.
113
- *
114
- * @since 1.0.0
115
- */
116
- declare class ParallelMessageQueue implements MessageQueue {
117
- #private;
118
- readonly queue: MessageQueue;
119
- readonly workers: number;
120
- /**
121
- * Inherits the native retry capability from the wrapped queue.
122
- * @since 1.7.0
123
- */
124
- readonly nativeRetrial?: boolean;
125
- /**
126
- * Constructs a new {@link ParallelMessageQueue} with the given queue and
127
- * number of workers.
128
- * @param queue The message queue to use under the hood. Note that
129
- * {@link ParallelMessageQueue} cannot be nested.
130
- * @param workers The number of workers to process messages in parallel.
131
- * @throws {TypeError} If the given queue is an instance of
132
- * {@link ParallelMessageQueue}.
133
- */
134
- constructor(queue: MessageQueue, workers: number);
135
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
136
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
137
- listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
138
- }
139
- //#endregion
140
- export { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue };
@@ -1,100 +0,0 @@
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;
@@ -1,59 +0,0 @@
1
- import { KvKey, KvStore, KvStoreSetOptions } from "../kv-Bxr0Q87_.cjs";
2
- import { MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "../mq-DcJPkXD5.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,61 +0,0 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { KvKey, KvStore, KvStoreSetOptions } from "../kv-BKNZ-Tb-.js";
4
- import { MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "../mq-CUKlBw08.js";
5
- import { KVNamespace, Queue } from "@cloudflare/workers-types/experimental";
6
-
7
- //#region src/x/cfworkers.d.ts
8
-
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
- declare class WorkersKvStore implements KvStore {
25
- #private;
26
- constructor(namespace: KVNamespace<string>);
27
- get<T = unknown>(key: KvKey): Promise<T | undefined>;
28
- set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
29
- delete(key: KvKey): Promise<void>;
30
- }
31
- /**
32
- * Implementation of the {@link MessageQueue} interface for Cloudflare
33
- * Workers Queues binding. This class provides a wrapper around Cloudflare's
34
- * Queues to send messages to a queue.
35
- *
36
- * Note that this implementation does not support the `listen()` method,
37
- * as Cloudflare Workers Queues do not support message consumption in the same
38
- * way as other message queue systems. Instead, you should use
39
- * the {@link Federation.processQueuedTask} method to process messages
40
- * passed to the queue.
41
- *
42
- * @deprecated This class has been moved to `@fedify/cfworkers` package.
43
- * Import `WorkersMessageQueue` from `@fedify/cfworkers` instead.
44
- * This class will be removed in Fedify v2.0.
45
- * @since 1.6.0
46
- */
47
- declare class WorkersMessageQueue implements MessageQueue {
48
- #private;
49
- /**
50
- * Cloudflare Queues provide automatic retry with exponential backoff
51
- * and Dead Letter Queues.
52
- * @since 1.7.0
53
- */
54
- readonly nativeRetrial = true;
55
- constructor(queue: Queue);
56
- enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
57
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
58
- listen(_handler: (message: any) => Promise<void> | void, _options?: MessageQueueListenOptions): Promise<void>;
59
- }
60
- //#endregion
61
- export { WorkersKvStore, WorkersMessageQueue };