@fedify/fedify 2.0.0-dev.1875 → 2.0.0-dev.1961
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/{actor-BQuDqoKQ.cjs → actor-DhgrrgXz.cjs} +185 -185
- package/dist/{actor-CtTW_fTc.js → actor-DiKHxw_H.js} +185 -185
- package/dist/{actor-CmPnJ0G7.js → actor-Kqyoic-M.js} +1 -1
- package/dist/{builder-CLT_zIyw.js → builder-BrqBKkVi.js} +3 -3
- package/dist/compat/mod.d.cts +2 -3
- package/dist/compat/mod.d.ts +2 -3
- package/dist/compat/transformers.test.js +14 -14
- package/dist/{context-DJ8aSy2Q.d.cts → context-PxGADCsD.d.cts} +140 -3
- package/dist/{context-DG0huGW-.d.ts → context-V-XS2_6O.d.ts} +140 -3
- package/dist/{docloader-BkhI_RcC.js → docloader-HB61Uc88.js} +2 -2
- package/dist/{esm-DOqAYjlY.js → esm-DaZiDvFW.js} +32 -17
- package/dist/federation/builder.test.js +4 -4
- package/dist/federation/collection.test.js +2 -2
- package/dist/federation/handler.test.js +15 -15
- package/dist/federation/idempotency.test.js +15 -15
- package/dist/federation/inbox.test.js +3 -3
- package/dist/federation/keycache.test.js +3 -3
- package/dist/federation/kv.test.js +2 -2
- package/dist/federation/middleware.test.js +16 -16
- package/dist/federation/mod.cjs +7 -7
- package/dist/federation/mod.d.cts +2 -3
- package/dist/federation/mod.d.ts +2 -3
- package/dist/federation/mod.js +7 -7
- package/dist/federation/mq.test.js +6 -4
- package/dist/federation/negotiation.test.js +2 -2
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +2 -2
- package/dist/federation/send.test.js +9 -9
- package/dist/{http-BIYwcgTd.js → http-B2bao4EB.js} +2 -2
- package/dist/{http-DarlEN23.cjs → http-BxgYWxTY.cjs} +2 -2
- package/dist/{http-DmUiHemJ.js → http-CUsGQiwU.js} +2 -2
- package/dist/{inbox-Dbt8hLxb.js → inbox-CAojlSWc.js} +1 -1
- package/dist/{key-BcT6cdMK.js → key-Dz-KWCap.js} +2 -2
- package/dist/{keycache-B8aIeTgt.js → keycache-Czcf33al.js} +1 -1
- package/dist/{keys-Bs-0Hapk.js → keys-BN4nelft.js} +1 -1
- package/dist/{kv-cache-BWWu8RyL.cjs → kv-cache-5j5Pb-V6.cjs} +1 -1
- package/dist/{kv-cache-B5TLf2fI.js → kv-cache-Bq6kUUoG.js} +1 -1
- package/dist/{ld-DR6mmQjt.js → ld-CEJHYq8u.js} +2 -2
- package/dist/{lookup-Bhv7efZB.js → lookup-D8hvtZHY.js} +187 -192
- package/dist/{lookup-EHJhdA8l.cjs → lookup-_Hap2IXS.cjs} +3 -8
- package/dist/{lookup-DdpqU9Gb.js → lookup-gMu_9ZKY.js} +3 -8
- package/dist/middleware-19QFZj7b.js +26 -0
- package/dist/middleware-BbbcXY4w.cjs +15 -0
- package/dist/middleware-CSTK543z.js +15 -0
- package/dist/{middleware-B09KVcU4.cjs → middleware-DW3rJHWy.cjs} +7 -7
- package/dist/{middleware-B_rzGWsn.js → middleware-Df9OWALM.js} +7 -7
- package/dist/{middleware-Aqt52eK0.js → middleware-DgrceAHB.js} +11 -11
- package/dist/{mod-DJcZDvjA.d.cts → mod-BoRKfJPE.d.cts} +1 -1
- package/dist/{mod-BoHnwOCs.d.ts → mod-Cdo6SYlJ.d.ts} +1 -1
- package/dist/mod.cjs +7 -7
- package/dist/mod.d.cts +5 -6
- package/dist/mod.d.ts +5 -6
- package/dist/mod.js +7 -7
- package/dist/nodeinfo/client.test.js +3 -3
- package/dist/nodeinfo/handler.test.js +14 -14
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/types.test.js +2 -2
- package/dist/{owner-DEgLiB7Z.js → owner-JwI-WzF-.js} +2 -2
- package/dist/{proof-CbB_yXKu.cjs → proof-CObJuclI.cjs} +3 -3
- package/dist/{proof-p3cmdfis.js → proof-Dhqndmfg.js} +2 -2
- package/dist/{proof-AhMjXzru.js → proof-xH0V1mdD.js} +3 -3
- package/dist/{send-CcKJ-npK.js → send-1o7D-GGL.js} +2 -2
- package/dist/sig/http.test.js +7 -7
- package/dist/sig/key.test.js +5 -5
- package/dist/sig/ld.test.js +6 -6
- package/dist/sig/mod.cjs +4 -4
- package/dist/sig/mod.d.cts +1 -1
- package/dist/sig/mod.d.ts +1 -1
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.js +6 -6
- package/dist/sig/proof.test.js +6 -6
- package/dist/testing/docloader.test.js +2 -2
- package/dist/testing/mod.js +2 -2
- package/dist/{testing-CW4N8vgf.js → testing-DpRy1YTU.js} +1 -1
- package/dist/utils/docloader.test.js +8 -8
- package/dist/utils/kv-cache.test.js +2 -2
- package/dist/utils/mod.cjs +4 -4
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +4 -4
- package/dist/vocab/actor.test.js +4 -4
- package/dist/vocab/lookup.test.js +3 -3
- package/dist/vocab/mod.cjs +3 -3
- package/dist/vocab/mod.js +3 -3
- package/dist/vocab/type.test.js +2 -2
- package/dist/vocab/vocab.test.js +3 -3
- package/dist/{vocab-CuAJ4Tbh.js → vocab-CAwj263k.js} +2 -2
- package/dist/{vocab-DCYaqGPG.cjs → vocab-DgHGCFcw.cjs} +2 -2
- package/dist/webfinger/handler.test.js +14 -14
- package/dist/webfinger/lookup.test.js +3 -3
- package/dist/webfinger/mod.cjs +1 -1
- package/dist/webfinger/mod.js +1 -1
- package/package.json +4 -35
- package/dist/denokv-CCssOzMJ.js +0 -57
- package/dist/middleware-C_Sa9J23.cjs +0 -15
- package/dist/middleware-DGwP3i-w.js +0 -15
- package/dist/middleware-Xyxj43cy.js +0 -26
- package/dist/mq-CUKlBw08.d.ts +0 -143
- package/dist/mq-DcJPkXD5.d.cts +0 -140
- package/dist/x/cfworkers.cjs +0 -100
- package/dist/x/cfworkers.d.cts +0 -59
- package/dist/x/cfworkers.d.ts +0 -61
- package/dist/x/cfworkers.js +0 -98
- package/dist/x/cfworkers.test.d.ts +0 -3
- package/dist/x/cfworkers.test.js +0 -177
- package/dist/x/hono.cjs +0 -61
- package/dist/x/hono.d.cts +0 -53
- package/dist/x/hono.d.ts +0 -55
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.cjs +0 -69
- package/dist/x/sveltekit.d.cts +0 -45
- package/dist/x/sveltekit.d.ts +0 -47
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{mod-C2tOeRkN.d.cts → mod-CcDPcLJW.d.cts} +0 -0
- /package/dist/{mod-B2iOw50L.d.ts → mod-D5Z2tISD.d.ts} +0 -0
- /package/dist/{mod-0noXw66R.d.cts → mod-DMpuiKXi.d.cts} +0 -0
- /package/dist/{mod-DgdBYYa0.d.cts → mod-DgxG-byT.d.cts} +0 -0
- /package/dist/{mod-B9M-8jm2.d.ts → mod-aAE2wOWV.d.ts} +0 -0
- /package/dist/{mod-xIj-IT58.d.ts → mod-bjzj5QIb.d.ts} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Application, Group, Organization, Person, Service, deno_default, getTypeId, lookupWebFinger } from "./lookup-
|
|
6
|
+
import { Application, Group, Organization, Person, Service, deno_default, getTypeId, lookupWebFinger } from "./lookup-D8hvtZHY.js";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { domainToASCII, domainToUnicode } from "node:url";
|
|
9
9
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Router, RouterError, deno_default, getTypeId } from "./lookup-
|
|
7
|
-
import { InboxListenerSet } from "./inbox-
|
|
6
|
+
import { Router, RouterError, deno_default, getTypeId } from "./lookup-D8hvtZHY.js";
|
|
7
|
+
import { InboxListenerSet } from "./inbox-CAojlSWc.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
@@ -42,7 +42,7 @@ var FederationBuilderImpl = class {
|
|
|
42
42
|
this.collectionTypeIds = {};
|
|
43
43
|
}
|
|
44
44
|
async build(options) {
|
|
45
|
-
const { FederationImpl } = await import("./middleware-
|
|
45
|
+
const { FederationImpl } = await import("./middleware-19QFZj7b.js");
|
|
46
46
|
const f = new FederationImpl(options);
|
|
47
47
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
48
48
|
f.router = this.router.clone();
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -5,8 +5,7 @@ import "../http-M8k5mKc0.cjs";
|
|
|
5
5
|
import "../owner-B4HbyP8s.cjs";
|
|
6
6
|
import "../mod-BxRCHTz-.cjs";
|
|
7
7
|
import "../mod-C58MZ7Wx.cjs";
|
|
8
|
-
import { ActivityTransformer } from "../context-
|
|
8
|
+
import { ActivityTransformer } from "../context-PxGADCsD.cjs";
|
|
9
9
|
import "../kv-Bxr0Q87_.cjs";
|
|
10
|
-
import "../
|
|
11
|
-
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-DJcZDvjA.cjs";
|
|
10
|
+
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-BoRKfJPE.cjs";
|
|
12
11
|
export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -7,8 +7,7 @@ import "../http-BbO0ejuk.js";
|
|
|
7
7
|
import "../owner-kQRGVXG1.js";
|
|
8
8
|
import "../mod-BlVovdcy.js";
|
|
9
9
|
import "../mod-Ds0mpFZU.js";
|
|
10
|
-
import { ActivityTransformer } from "../context-
|
|
10
|
+
import { ActivityTransformer } from "../context-V-XS2_6O.js";
|
|
11
11
|
import "../kv-BKNZ-Tb-.js";
|
|
12
|
-
import "../
|
|
13
|
-
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-BoHnwOCs.js";
|
|
12
|
+
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-Cdo6SYlJ.js";
|
|
14
13
|
export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
|
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Follow, Person } from "../lookup-
|
|
6
|
+
import { Follow, Person } from "../lookup-D8hvtZHY.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
|
11
|
-
import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-
|
|
11
|
+
import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-DgrceAHB.js";
|
|
12
12
|
import "../client-pY7-3icS.js";
|
|
13
13
|
import "../types-C2XVl6gj.js";
|
|
14
|
-
import "../actor-
|
|
15
|
-
import "../key-
|
|
16
|
-
import "../http-
|
|
17
|
-
import "../ld-
|
|
18
|
-
import "../owner-
|
|
19
|
-
import "../proof-
|
|
20
|
-
import "../docloader-
|
|
14
|
+
import "../actor-Kqyoic-M.js";
|
|
15
|
+
import "../key-Dz-KWCap.js";
|
|
16
|
+
import "../http-B2bao4EB.js";
|
|
17
|
+
import "../ld-CEJHYq8u.js";
|
|
18
|
+
import "../owner-JwI-WzF-.js";
|
|
19
|
+
import "../proof-Dhqndmfg.js";
|
|
20
|
+
import "../docloader-HB61Uc88.js";
|
|
21
21
|
import "../kv-cache-DN9pfMBe.js";
|
|
22
|
-
import "../inbox-
|
|
23
|
-
import "../builder-
|
|
22
|
+
import "../inbox-CAojlSWc.js";
|
|
23
|
+
import "../builder-BrqBKkVi.js";
|
|
24
24
|
import "../collection-BzWsN9pB.js";
|
|
25
|
-
import "../keycache-
|
|
25
|
+
import "../keycache-Czcf33al.js";
|
|
26
26
|
import "../negotiation-C4nFufNk.js";
|
|
27
27
|
import "../retry-CfF8Gn4d.js";
|
|
28
|
-
import "../send-
|
|
29
|
-
import { test } from "../testing-
|
|
28
|
+
import "../send-1o7D-GGL.js";
|
|
29
|
+
import { test } from "../testing-DpRy1YTU.js";
|
|
30
30
|
|
|
31
31
|
//#region src/compat/transformers.test.ts
|
|
32
32
|
const federation = new FederationImpl({ kv: new MemoryKvStore() });
|
|
@@ -6,7 +6,6 @@ import { GetKeyOwnerOptions } from "./owner-B4HbyP8s.cjs";
|
|
|
6
6
|
import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-BxRCHTz-.cjs";
|
|
7
7
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-C58MZ7Wx.cjs";
|
|
8
8
|
import { KvKey, KvStore } from "./kv-Bxr0Q87_.cjs";
|
|
9
|
-
import { MessageQueue } from "./mq-DcJPkXD5.cjs";
|
|
10
9
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
11
10
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
12
11
|
|
|
@@ -306,8 +305,146 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
|
|
|
306
305
|
*/
|
|
307
306
|
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
308
307
|
//#endregion
|
|
308
|
+
//#region src/federation/mq.d.ts
|
|
309
|
+
/**
|
|
310
|
+
* Additional options for enqueuing a message in a queue.
|
|
311
|
+
*
|
|
312
|
+
* @since 0.5.0
|
|
313
|
+
*/
|
|
314
|
+
interface MessageQueueEnqueueOptions {
|
|
315
|
+
/**
|
|
316
|
+
* The delay before the message is enqueued. No delay by default.
|
|
317
|
+
*
|
|
318
|
+
* It must not be negative.
|
|
319
|
+
*/
|
|
320
|
+
delay?: Temporal.Duration;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Additional options for listening to a message queue.
|
|
324
|
+
*
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
*/
|
|
327
|
+
interface MessageQueueListenOptions {
|
|
328
|
+
/**
|
|
329
|
+
* The signal to abort listening to the message queue.
|
|
330
|
+
*/
|
|
331
|
+
signal?: AbortSignal;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* An abstract interface for a message queue.
|
|
335
|
+
*
|
|
336
|
+
* @since 0.5.0
|
|
337
|
+
*/
|
|
338
|
+
interface MessageQueue {
|
|
339
|
+
/**
|
|
340
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
341
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
342
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
343
|
+
* using its own retry policies.
|
|
344
|
+
*
|
|
345
|
+
* @default `false`
|
|
346
|
+
* @since 1.7.0
|
|
347
|
+
*/
|
|
348
|
+
readonly nativeRetrial?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Enqueues a message in the queue.
|
|
351
|
+
* @param message The message to enqueue.
|
|
352
|
+
* @param options Additional options for enqueuing the message.
|
|
353
|
+
*/
|
|
354
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
357
|
+
* and may not be supported by all implementations. If not supported,
|
|
358
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
359
|
+
*
|
|
360
|
+
* @param messages The messages to enqueue.
|
|
361
|
+
* @param options Additional options for enqueuing the messages.
|
|
362
|
+
*/
|
|
363
|
+
enqueueMany?: (messages: any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* Listens for messages in the queue.
|
|
366
|
+
* @param handler The handler for messages in the queue.
|
|
367
|
+
* @param options Additional options for listening to the message queue.
|
|
368
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
369
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
370
|
+
* signal is provided, it never resolves.
|
|
371
|
+
*/
|
|
372
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
376
|
+
* @since 1.0.0
|
|
377
|
+
*/
|
|
378
|
+
interface InProcessMessageQueueOptions {
|
|
379
|
+
/**
|
|
380
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
381
|
+
* @default `{ seconds: 5 }`
|
|
382
|
+
*/
|
|
383
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* A message queue that processes messages in the same process.
|
|
387
|
+
* Do not use this in production as it does neither persist messages nor
|
|
388
|
+
* distribute them across multiple processes.
|
|
389
|
+
*
|
|
390
|
+
* @since 0.5.0
|
|
391
|
+
*/
|
|
392
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
393
|
+
#private;
|
|
394
|
+
/**
|
|
395
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
396
|
+
* @since 1.7.0
|
|
397
|
+
*/
|
|
398
|
+
readonly nativeRetrial = false;
|
|
399
|
+
/**
|
|
400
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
401
|
+
* @param options Additional options for the in-process message queue.
|
|
402
|
+
*/
|
|
403
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
404
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
405
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
406
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* A message queue that processes messages in parallel. It takes another
|
|
410
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
411
|
+
* number of workers.
|
|
412
|
+
*
|
|
413
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
414
|
+
*
|
|
415
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
416
|
+
* are not running in separate threads or processes. They are running in the
|
|
417
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
418
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
419
|
+
* workloads.
|
|
420
|
+
*
|
|
421
|
+
* @since 1.0.0
|
|
422
|
+
*/
|
|
423
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
424
|
+
#private;
|
|
425
|
+
readonly queue: MessageQueue;
|
|
426
|
+
readonly workers: number;
|
|
427
|
+
/**
|
|
428
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
429
|
+
* @since 1.7.0
|
|
430
|
+
*/
|
|
431
|
+
readonly nativeRetrial?: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
434
|
+
* number of workers.
|
|
435
|
+
* @param queue The message queue to use under the hood. Note that
|
|
436
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
437
|
+
* @param workers The number of workers to process messages in parallel.
|
|
438
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
439
|
+
* {@link ParallelMessageQueue}.
|
|
440
|
+
*/
|
|
441
|
+
constructor(queue: MessageQueue, workers: number);
|
|
442
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
443
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
444
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
309
447
|
//#region src/federation/handler.d.ts
|
|
310
|
-
|
|
311
448
|
/**
|
|
312
449
|
* Options for the {@link respondWithObject} and
|
|
313
450
|
* {@link respondWithObjectIfAcceptable} functions.
|
|
@@ -2309,4 +2446,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2309
2446
|
multikey: Multikey;
|
|
2310
2447
|
}
|
|
2311
2448
|
//#endregion
|
|
2312
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
2449
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -8,7 +8,6 @@ import { GetKeyOwnerOptions } from "./owner-kQRGVXG1.js";
|
|
|
8
8
|
import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-BlVovdcy.js";
|
|
9
9
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-Ds0mpFZU.js";
|
|
10
10
|
import { KvKey, KvStore } from "./kv-BKNZ-Tb-.js";
|
|
11
|
-
import { MessageQueue } from "./mq-CUKlBw08.js";
|
|
12
11
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
13
12
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
14
13
|
|
|
@@ -308,8 +307,146 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
|
|
|
308
307
|
*/
|
|
309
308
|
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
310
309
|
//#endregion
|
|
310
|
+
//#region src/federation/mq.d.ts
|
|
311
|
+
/**
|
|
312
|
+
* Additional options for enqueuing a message in a queue.
|
|
313
|
+
*
|
|
314
|
+
* @since 0.5.0
|
|
315
|
+
*/
|
|
316
|
+
interface MessageQueueEnqueueOptions {
|
|
317
|
+
/**
|
|
318
|
+
* The delay before the message is enqueued. No delay by default.
|
|
319
|
+
*
|
|
320
|
+
* It must not be negative.
|
|
321
|
+
*/
|
|
322
|
+
delay?: Temporal.Duration;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Additional options for listening to a message queue.
|
|
326
|
+
*
|
|
327
|
+
* @since 1.0.0
|
|
328
|
+
*/
|
|
329
|
+
interface MessageQueueListenOptions {
|
|
330
|
+
/**
|
|
331
|
+
* The signal to abort listening to the message queue.
|
|
332
|
+
*/
|
|
333
|
+
signal?: AbortSignal;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* An abstract interface for a message queue.
|
|
337
|
+
*
|
|
338
|
+
* @since 0.5.0
|
|
339
|
+
*/
|
|
340
|
+
interface MessageQueue {
|
|
341
|
+
/**
|
|
342
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
343
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
344
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
345
|
+
* using its own retry policies.
|
|
346
|
+
*
|
|
347
|
+
* @default `false`
|
|
348
|
+
* @since 1.7.0
|
|
349
|
+
*/
|
|
350
|
+
readonly nativeRetrial?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Enqueues a message in the queue.
|
|
353
|
+
* @param message The message to enqueue.
|
|
354
|
+
* @param options Additional options for enqueuing the message.
|
|
355
|
+
*/
|
|
356
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
357
|
+
/**
|
|
358
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
359
|
+
* and may not be supported by all implementations. If not supported,
|
|
360
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
361
|
+
*
|
|
362
|
+
* @param messages The messages to enqueue.
|
|
363
|
+
* @param options Additional options for enqueuing the messages.
|
|
364
|
+
*/
|
|
365
|
+
enqueueMany?: (messages: any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Listens for messages in the queue.
|
|
368
|
+
* @param handler The handler for messages in the queue.
|
|
369
|
+
* @param options Additional options for listening to the message queue.
|
|
370
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
371
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
372
|
+
* signal is provided, it never resolves.
|
|
373
|
+
*/
|
|
374
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
378
|
+
* @since 1.0.0
|
|
379
|
+
*/
|
|
380
|
+
interface InProcessMessageQueueOptions {
|
|
381
|
+
/**
|
|
382
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
383
|
+
* @default `{ seconds: 5 }`
|
|
384
|
+
*/
|
|
385
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* A message queue that processes messages in the same process.
|
|
389
|
+
* Do not use this in production as it does neither persist messages nor
|
|
390
|
+
* distribute them across multiple processes.
|
|
391
|
+
*
|
|
392
|
+
* @since 0.5.0
|
|
393
|
+
*/
|
|
394
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
395
|
+
#private;
|
|
396
|
+
/**
|
|
397
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
398
|
+
* @since 1.7.0
|
|
399
|
+
*/
|
|
400
|
+
readonly nativeRetrial = false;
|
|
401
|
+
/**
|
|
402
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
403
|
+
* @param options Additional options for the in-process message queue.
|
|
404
|
+
*/
|
|
405
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
406
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
407
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
408
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* A message queue that processes messages in parallel. It takes another
|
|
412
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
413
|
+
* number of workers.
|
|
414
|
+
*
|
|
415
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
416
|
+
*
|
|
417
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
418
|
+
* are not running in separate threads or processes. They are running in the
|
|
419
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
420
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
421
|
+
* workloads.
|
|
422
|
+
*
|
|
423
|
+
* @since 1.0.0
|
|
424
|
+
*/
|
|
425
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
426
|
+
#private;
|
|
427
|
+
readonly queue: MessageQueue;
|
|
428
|
+
readonly workers: number;
|
|
429
|
+
/**
|
|
430
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
431
|
+
* @since 1.7.0
|
|
432
|
+
*/
|
|
433
|
+
readonly nativeRetrial?: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
436
|
+
* number of workers.
|
|
437
|
+
* @param queue The message queue to use under the hood. Note that
|
|
438
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
439
|
+
* @param workers The number of workers to process messages in parallel.
|
|
440
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
441
|
+
* {@link ParallelMessageQueue}.
|
|
442
|
+
*/
|
|
443
|
+
constructor(queue: MessageQueue, workers: number);
|
|
444
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
445
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
446
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
311
449
|
//#region src/federation/handler.d.ts
|
|
312
|
-
|
|
313
450
|
/**
|
|
314
451
|
* Options for the {@link respondWithObject} and
|
|
315
452
|
* {@link respondWithObjectIfAcceptable} functions.
|
|
@@ -2311,4 +2448,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2311
2448
|
multikey: Multikey;
|
|
2312
2449
|
}
|
|
2313
2450
|
//#endregion
|
|
2314
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
2451
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { validateCryptoKey } from "./key-
|
|
7
|
-
import { doubleKnock } from "./http-
|
|
6
|
+
import { validateCryptoKey } from "./key-Dz-KWCap.js";
|
|
7
|
+
import { doubleKnock } from "./http-B2bao4EB.js";
|
|
8
8
|
import { curry } from "es-toolkit";
|
|
9
9
|
import { UrlError, createActivityPubRequest, getDocumentLoader, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
10
10
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { __commonJS, __toESM } from "./lookup-
|
|
6
|
+
import { __commonJS, __toESM } from "./lookup-D8hvtZHY.js";
|
|
7
7
|
|
|
8
8
|
//#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
|
|
9
9
|
var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js"(exports, module) {
|
|
@@ -115,7 +115,7 @@ function parse(input, loose) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
//#endregion
|
|
118
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
118
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
|
|
119
119
|
const valueTypes = new Set([
|
|
120
120
|
"boolean",
|
|
121
121
|
"number",
|
|
@@ -207,7 +207,7 @@ var TypeDescriptor = class TypeDescriptor {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
//#endregion
|
|
210
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
210
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
|
|
211
211
|
const allowedTypes = new Set([
|
|
212
212
|
"array",
|
|
213
213
|
"object",
|
|
@@ -366,7 +366,7 @@ function dequal(foo, bar) {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
//#endregion
|
|
369
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
369
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/RequestUtils.js
|
|
370
370
|
const absoluteUrlRX = new RegExp("^[a-z]+://|^data:", "i");
|
|
371
371
|
const protocolRelativeUrlRX = new RegExp("^//", "i");
|
|
372
372
|
function hasCredentialsInUrl(url) {
|
|
@@ -431,6 +431,11 @@ function getPath(url) {
|
|
|
431
431
|
const u = absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy");
|
|
432
432
|
return u.pathname;
|
|
433
433
|
}
|
|
434
|
+
function getHost(url) {
|
|
435
|
+
if (absoluteUrlRX.test(url)) return new URL(url).host;
|
|
436
|
+
else if ("location" in globalThis) return globalThis.location.host;
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
434
439
|
function getQuery(url) {
|
|
435
440
|
const u = absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy");
|
|
436
441
|
return u.search ? u.search.substr(1) : "";
|
|
@@ -444,7 +449,7 @@ function normalizeHeaders(headers) {
|
|
|
444
449
|
}
|
|
445
450
|
|
|
446
451
|
//#endregion
|
|
447
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
452
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Matchers.js
|
|
448
453
|
var import_glob_to_regexp = __toESM(require_glob_to_regexp(), 1);
|
|
449
454
|
const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
|
|
450
455
|
const isFunctionMatcher = (matcher) => typeof matcher === "function";
|
|
@@ -475,6 +480,9 @@ const stringMatchers = {
|
|
|
475
480
|
const path = getPath(url);
|
|
476
481
|
return path === targetString || path === dotlessTargetString;
|
|
477
482
|
};
|
|
483
|
+
},
|
|
484
|
+
host: (targetString) => {
|
|
485
|
+
return ({ url }) => targetString === getHost(url);
|
|
478
486
|
}
|
|
479
487
|
};
|
|
480
488
|
const getHeaderMatcher = ({ headers: expectedHeaders }) => {
|
|
@@ -627,7 +635,7 @@ const builtInMatchers = [
|
|
|
627
635
|
];
|
|
628
636
|
|
|
629
637
|
//#endregion
|
|
630
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
638
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/StatusTextMap.js
|
|
631
639
|
const statusTextMap = {
|
|
632
640
|
100: "Continue",
|
|
633
641
|
101: "Switching Protocols",
|
|
@@ -695,7 +703,7 @@ const statusTextMap = {
|
|
|
695
703
|
var StatusTextMap_default = statusTextMap;
|
|
696
704
|
|
|
697
705
|
//#endregion
|
|
698
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
706
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Route.js
|
|
699
707
|
var __classPrivateFieldSet = void 0 && (void 0).__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
700
708
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
701
709
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -829,7 +837,7 @@ builtInMatchers.forEach(Route.defineMatcher);
|
|
|
829
837
|
var Route_default = Route;
|
|
830
838
|
|
|
831
839
|
//#endregion
|
|
832
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
840
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Router.js
|
|
833
841
|
const responseConfigProps = [
|
|
834
842
|
"body",
|
|
835
843
|
"headers",
|
|
@@ -881,18 +889,23 @@ var Router = class {
|
|
|
881
889
|
throwSpecExceptions(callLog);
|
|
882
890
|
return new Promise(async (resolve, reject) => {
|
|
883
891
|
const { url, options, request, pendingPromises } = callLog;
|
|
892
|
+
let eventListenerAbortController;
|
|
884
893
|
if (callLog.signal) {
|
|
885
894
|
const abort = () => {
|
|
886
895
|
const error = new DOMException("The operation was aborted.", "AbortError");
|
|
887
896
|
const requestBody = request?.body || options?.body;
|
|
888
|
-
if (requestBody instanceof ReadableStream) if (requestBody.locked)
|
|
897
|
+
if (requestBody instanceof ReadableStream) if (requestBody.locked) console.warn("fetch-mock: Locked request body can't be cancelled");
|
|
889
898
|
else requestBody.cancel(error);
|
|
890
|
-
if (callLog?.response?.body) if (callLog.response.body.locked)
|
|
899
|
+
if (callLog?.response?.body) if (callLog.response.body.locked) console.warn("fetch-mock: Locked response body can't be cancelled");
|
|
891
900
|
else callLog.response.body.cancel(error);
|
|
892
901
|
reject(error);
|
|
893
902
|
};
|
|
894
903
|
if (callLog.signal.aborted) abort();
|
|
895
|
-
|
|
904
|
+
eventListenerAbortController = new AbortController();
|
|
905
|
+
callLog.signal.addEventListener("abort", abort, {
|
|
906
|
+
once: true,
|
|
907
|
+
signal: eventListenerAbortController.signal
|
|
908
|
+
});
|
|
896
909
|
}
|
|
897
910
|
if (this.needsToReadBody(request)) options.body = await options.body;
|
|
898
911
|
const routesToTry = this.fallbackRoute ? [...this.routes, this.fallbackRoute] : this.routes;
|
|
@@ -905,6 +918,8 @@ var Router = class {
|
|
|
905
918
|
resolve(observableResponse);
|
|
906
919
|
} catch (err) {
|
|
907
920
|
reject(err);
|
|
921
|
+
} finally {
|
|
922
|
+
eventListenerAbortController?.abort();
|
|
908
923
|
}
|
|
909
924
|
else reject(/* @__PURE__ */ new Error(`fetch-mock: No response or fallback rule to cover ${options && options.method || "GET"} to ${url}`));
|
|
910
925
|
});
|
|
@@ -1002,7 +1017,7 @@ var Router = class {
|
|
|
1002
1017
|
};
|
|
1003
1018
|
|
|
1004
1019
|
//#endregion
|
|
1005
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
1020
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/CallHistory.js
|
|
1006
1021
|
const isName = (filter) => typeof filter === "string" && /^[\da-zA-Z-]+$/.test(filter) && !["matched", "unmatched"].includes(filter);
|
|
1007
1022
|
const isMatchedOrUnmatched = (filter) => typeof filter === "boolean" || ["matched", "unmatched"].includes(filter);
|
|
1008
1023
|
var CallHistory = class {
|
|
@@ -1032,11 +1047,11 @@ var CallHistory = class {
|
|
|
1032
1047
|
let calls = [...this.callLogs];
|
|
1033
1048
|
if (typeof filter === "undefined" && !options) return calls;
|
|
1034
1049
|
if (isMatchedOrUnmatched(filter)) {
|
|
1035
|
-
if ([true, "matched"].includes(filter)) calls = calls.filter(({ route }) => !route.config.isFallback);
|
|
1036
|
-
else if ([false, "unmatched"].includes(filter)) calls = calls.filter(({ route }) => Boolean(route.config.isFallback));
|
|
1050
|
+
if ([true, "matched"].includes(filter)) calls = calls.filter(({ route }) => !route?.config || !route.config.isFallback);
|
|
1051
|
+
else if ([false, "unmatched"].includes(filter)) calls = calls.filter(({ route }) => Boolean(route?.config && route.config.isFallback));
|
|
1037
1052
|
if (!options) return calls;
|
|
1038
1053
|
} else if (isName(filter)) {
|
|
1039
|
-
calls = calls.filter(({ route
|
|
1054
|
+
calls = calls.filter(({ route }) => route?.config?.name === filter);
|
|
1040
1055
|
if (!options) return calls;
|
|
1041
1056
|
} else if (isUrlMatcher(filter)) options = {
|
|
1042
1057
|
url: filter,
|
|
@@ -1087,7 +1102,7 @@ var CallHistory = class {
|
|
|
1087
1102
|
var CallHistory_default = CallHistory;
|
|
1088
1103
|
|
|
1089
1104
|
//#endregion
|
|
1090
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
1105
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/FetchMock.js
|
|
1091
1106
|
const defaultFetchMockConfig = {
|
|
1092
1107
|
includeContentLength: true,
|
|
1093
1108
|
matchPartialBody: false,
|
|
@@ -1220,7 +1235,7 @@ const fetchMock = new FetchMock({ ...defaultFetchMockConfig });
|
|
|
1220
1235
|
var FetchMock_default = fetchMock;
|
|
1221
1236
|
|
|
1222
1237
|
//#endregion
|
|
1223
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.
|
|
1238
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
|
|
1224
1239
|
var esm_default = FetchMock_default;
|
|
1225
1240
|
|
|
1226
1241
|
//#endregion
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, Note, Person } from "../lookup-
|
|
6
|
+
import { Activity, Note, Person } from "../lookup-D8hvtZHY.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 "../inbox-
|
|
12
|
-
import { createFederationBuilder } from "../builder-
|
|
13
|
-
import { test } from "../testing-
|
|
11
|
+
import "../inbox-CAojlSWc.js";
|
|
12
|
+
import { createFederationBuilder } from "../builder-BrqBKkVi.js";
|
|
13
|
+
import { test } from "../testing-DpRy1YTU.js";
|
|
14
14
|
import { assertExists } from "../std__assert-DWivtrGR.js";
|
|
15
15
|
import "../assert_rejects-Ce45JcFg.js";
|
|
16
16
|
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../lookup-
|
|
6
|
+
import "../lookup-D8hvtZHY.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 { buildCollectionSynchronizationHeader, digest } from "../collection-BzWsN9pB.js";
|
|
11
|
-
import { test } from "../testing-
|
|
11
|
+
import { test } from "../testing-DpRy1YTU.js";
|
|
12
12
|
import "../std__assert-DWivtrGR.js";
|
|
13
13
|
import "../assert_rejects-Ce45JcFg.js";
|
|
14
14
|
import "../assert_throws-BNXdRGWP.js";
|