@fedify/fedify 2.3.0-dev.1119 → 2.3.0-dev.1131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builder-Ond_h57y.mjs → builder-DckAhD27.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-cSUMk2da.d.ts → context-Cq18Gplu.d.ts} +3 -208
- package/dist/{context-Ch-ZLyTQ.d.cts → context-tc6VOOOL.d.cts} +3 -208
- package/dist/{deno-DVsHS7rA.mjs → deno--CS-SBS9.mjs} +1 -1
- package/dist/{docloader-WsWfKaE5.mjs → docloader-k6huZLQL.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +229 -1
- package/dist/federation/middleware.test.mjs +64 -6
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -2
- package/dist/federation/mod.d.ts +3 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-CubOB9wq.cjs → http-CJfvRL7D.cjs} +263 -19
- package/dist/{http-DUV8ysti.mjs → http-IywnQdiX.mjs} +7 -5
- package/dist/{http-D6LP89UO.d.ts → http-VyDTd4G3.d.cts} +8 -1
- package/dist/{http-CouJSFVK.js → http-cqujdCRz.js} +252 -20
- package/dist/{http-D6aw3j2U.d.cts → http-lf8Hsd91.d.ts} +8 -1
- package/dist/{key-BoWaYRHm.mjs → key-Df3tMleh.mjs} +42 -17
- package/dist/{kv-cache-Dz31ATUT.cjs → kv-cache-L0SMQkcd.cjs} +19 -2
- package/dist/{kv-cache-DBNpsneh.js → kv-cache-pEejzYq4.js} +19 -2
- package/dist/{kv-cache-DihufyAQ.mjs → kv-cache-q9Ec2ryS.mjs} +19 -1
- package/dist/{ld-B5K1mSuG.mjs → ld-BGwiJpl3.mjs} +3 -3
- package/dist/{metrics-C4attqv0.mjs → metrics-BTOMkW8C.mjs} +209 -2
- package/dist/{middleware-CmsDtIHI.cjs → middleware-B2rtdpFV.cjs} +45 -17
- package/dist/{middleware-t0jC8I99.mjs → middleware-BB0IbDow.mjs} +54 -26
- package/dist/{middleware-BDKFRjue.mjs → middleware-Dnql59Y8.mjs} +1 -1
- package/dist/{middleware-Dtjz-hSk.js → middleware-DtOddSVg.js} +45 -17
- package/dist/{mod-BDhgfjP7.d.cts → mod-B0hW12_O.d.cts} +1 -1
- package/dist/{mod-B-Lin9Sy.d.ts → mod-COIAjwRS.d.ts} +1 -1
- package/dist/{mod-C6E8rkcz.d.ts → mod-CajNYYkt.d.ts} +1 -1
- package/dist/{mod-DLrRb0dx.d.ts → mod-DFvNJcNb.d.ts} +54 -3
- package/dist/{mod-P9tE2WmM.d.cts → mod-DnzgcPcy.d.cts} +1 -1
- package/dist/{mod-BR_BB0bh.d.cts → mod-yvIXFAEi.d.cts} +54 -3
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +6 -5
- package/dist/mod.d.ts +6 -5
- package/dist/mod.js +4 -4
- package/dist/mq-D-nlpY04.d.ts +208 -0
- package/dist/mq-D8uSFzxe.d.cts +208 -0
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-hDxI0ufu.mjs → owner-CIt4hvmM.mjs} +2 -2
- package/dist/{proof-BUWfVr6Q.cjs → proof-B1_u25UV.cjs} +1 -1
- package/dist/{proof-DhVuz4bc.mjs → proof-BYlrRSmZ.mjs} +3 -3
- package/dist/{proof-n60t8o9P.js → proof-DMGIjHYH.js} +1 -1
- package/dist/{send-BPhyR5Oo.mjs → send-DJFpze7B.mjs} +3 -3
- package/dist/sig/http.test.mjs +6 -2
- package/dist/sig/key.test.mjs +99 -2
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +67 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
|
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError, t as Router } from "./router-BT_F5748.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
+
import { n as version, t as name } from "./deno--CS-SBS9.mjs";
|
|
6
6
|
import { t as ActivityListenerSet } from "./activity-listener-BeTGV3wc.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { Tombstone, getTypeId } from "@fedify/vocab";
|
|
@@ -59,7 +59,7 @@ var FederationBuilderImpl = class {
|
|
|
59
59
|
this.collectionTypeIds = {};
|
|
60
60
|
}
|
|
61
61
|
async build(options) {
|
|
62
|
-
const { FederationImpl } = await import("./middleware-
|
|
62
|
+
const { FederationImpl } = await import("./middleware-Dnql59Y8.mjs");
|
|
63
63
|
const f = new FederationImpl(options);
|
|
64
64
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
65
65
|
f.router = this.router.clone();
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
2
|
+
import { St as ActivityTransformer, n as Context } from "../context-tc6VOOOL.cjs";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
2
|
+
import { St as ActivityTransformer, n as Context } from "../context-Cq18Gplu.js";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
|
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
|
5
5
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
6
6
|
import { t as assert } from "../assert-DikXweDx.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
8
|
-
import { n as FederationImpl, v as actorDehydrator, y as autoIdAssigner } from "../middleware-
|
|
8
|
+
import { n as FederationImpl, v as actorDehydrator, y as autoIdAssigner } from "../middleware-BB0IbDow.mjs";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CSddvgWN.js";
|
|
3
|
-
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-
|
|
3
|
+
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-lf8Hsd91.js";
|
|
4
4
|
import { n as GetKeyOwnerOptions } from "./owner-CnngXDNJ.js";
|
|
5
5
|
import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
6
|
+
import { r as MessageQueue } from "./mq-D-nlpY04.js";
|
|
6
7
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
7
8
|
import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
8
9
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
@@ -381,212 +382,6 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
|
|
|
381
382
|
*/
|
|
382
383
|
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
383
384
|
//#endregion
|
|
384
|
-
//#region src/federation/mq.d.ts
|
|
385
|
-
/**
|
|
386
|
-
* Additional options for enqueuing a message in a queue.
|
|
387
|
-
*
|
|
388
|
-
* @since 0.5.0
|
|
389
|
-
*/
|
|
390
|
-
interface MessageQueueEnqueueOptions {
|
|
391
|
-
/**
|
|
392
|
-
* The delay before the message is enqueued. No delay by default.
|
|
393
|
-
*
|
|
394
|
-
* It must not be negative.
|
|
395
|
-
*/
|
|
396
|
-
readonly delay?: Temporal.Duration;
|
|
397
|
-
/**
|
|
398
|
-
* An optional key that ensures messages with the same ordering key are
|
|
399
|
-
* processed sequentially (one at a time). Messages with different ordering
|
|
400
|
-
* keys (or no ordering key) may be processed in parallel.
|
|
401
|
-
*
|
|
402
|
-
* This is useful for ensuring that related messages are processed in order,
|
|
403
|
-
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
404
|
-
* activity for the same object.
|
|
405
|
-
*
|
|
406
|
-
* @since 2.0.0
|
|
407
|
-
*/
|
|
408
|
-
readonly orderingKey?: string;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Additional options for listening to a message queue.
|
|
412
|
-
*
|
|
413
|
-
* @since 1.0.0
|
|
414
|
-
*/
|
|
415
|
-
interface MessageQueueListenOptions {
|
|
416
|
-
/**
|
|
417
|
-
* The signal to abort listening to the message queue.
|
|
418
|
-
*/
|
|
419
|
-
signal?: AbortSignal;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* The number of messages waiting in a message queue.
|
|
423
|
-
*
|
|
424
|
-
* @since 2.3.0
|
|
425
|
-
*/
|
|
426
|
-
interface MessageQueueDepth {
|
|
427
|
-
/**
|
|
428
|
-
* The total number of messages still waiting in the backend queue.
|
|
429
|
-
*
|
|
430
|
-
* This does not include messages that have already been handed to a worker
|
|
431
|
-
* for processing.
|
|
432
|
-
*/
|
|
433
|
-
readonly queued: number;
|
|
434
|
-
/**
|
|
435
|
-
* The number of queued messages eligible for immediate processing.
|
|
436
|
-
*
|
|
437
|
-
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
438
|
-
* may omit this field.
|
|
439
|
-
*/
|
|
440
|
-
readonly ready?: number;
|
|
441
|
-
/**
|
|
442
|
-
* The number of queued messages scheduled for later delivery.
|
|
443
|
-
*
|
|
444
|
-
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
445
|
-
* may omit this field.
|
|
446
|
-
*/
|
|
447
|
-
readonly delayed?: number;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* An abstract interface for a message queue.
|
|
451
|
-
*
|
|
452
|
-
* @since 0.5.0
|
|
453
|
-
*/
|
|
454
|
-
interface MessageQueue {
|
|
455
|
-
/**
|
|
456
|
-
* Whether the message queue backend provides native retry mechanisms.
|
|
457
|
-
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
458
|
-
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
459
|
-
* using its own retry policies.
|
|
460
|
-
*
|
|
461
|
-
* @default `false`
|
|
462
|
-
* @since 1.7.0
|
|
463
|
-
*/
|
|
464
|
-
readonly nativeRetrial?: boolean;
|
|
465
|
-
/**
|
|
466
|
-
* Enqueues a message in the queue.
|
|
467
|
-
* @param message The message to enqueue.
|
|
468
|
-
* @param options Additional options for enqueuing the message.
|
|
469
|
-
*/
|
|
470
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
471
|
-
/**
|
|
472
|
-
* Enqueues multiple messages in the queue. This operation is optional,
|
|
473
|
-
* and may not be supported by all implementations. If not supported,
|
|
474
|
-
* Fedify will invoke {@link enqueue} for each message.
|
|
475
|
-
*
|
|
476
|
-
* @param messages The messages to enqueue.
|
|
477
|
-
* @param options Additional options for enqueuing the messages.
|
|
478
|
-
*/
|
|
479
|
-
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
480
|
-
/**
|
|
481
|
-
* Listens for messages in the queue.
|
|
482
|
-
* @param handler The handler for messages in the queue.
|
|
483
|
-
* @param options Additional options for listening to the message queue.
|
|
484
|
-
* @returns A promise that resolves when the listening is done. It never
|
|
485
|
-
* rejects, and is resolved when the signal is aborted. If no
|
|
486
|
-
* signal is provided, it never resolves.
|
|
487
|
-
*/
|
|
488
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
489
|
-
/**
|
|
490
|
-
* Gets the number of messages waiting in the queue.
|
|
491
|
-
*
|
|
492
|
-
* This operation is optional, and may not be supported by all
|
|
493
|
-
* implementations. The returned counts exclude messages currently being
|
|
494
|
-
* handled by a worker.
|
|
495
|
-
*
|
|
496
|
-
* @since 2.3.0
|
|
497
|
-
*/
|
|
498
|
-
getDepth?(): Promise<MessageQueueDepth>;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Additional options for {@link InProcessMessageQueue}.
|
|
502
|
-
* @since 1.0.0
|
|
503
|
-
*/
|
|
504
|
-
interface InProcessMessageQueueOptions {
|
|
505
|
-
/**
|
|
506
|
-
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
507
|
-
* @default `{ seconds: 5 }`
|
|
508
|
-
*/
|
|
509
|
-
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* A message queue that processes messages in the same process.
|
|
513
|
-
* Do not use this in production as it does neither persist messages nor
|
|
514
|
-
* distribute them across multiple processes.
|
|
515
|
-
*
|
|
516
|
-
* @since 0.5.0
|
|
517
|
-
*/
|
|
518
|
-
declare class InProcessMessageQueue implements MessageQueue {
|
|
519
|
-
#private;
|
|
520
|
-
/**
|
|
521
|
-
* In-process message queue does not provide native retry mechanisms.
|
|
522
|
-
* @since 1.7.0
|
|
523
|
-
*/
|
|
524
|
-
readonly nativeRetrial = false;
|
|
525
|
-
/**
|
|
526
|
-
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
527
|
-
* @param options Additional options for the in-process message queue.
|
|
528
|
-
*/
|
|
529
|
-
constructor(options?: InProcessMessageQueueOptions);
|
|
530
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
531
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
532
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
533
|
-
getDepth(): Promise<MessageQueueDepth>;
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* A message queue that processes messages in parallel. It takes another
|
|
537
|
-
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
538
|
-
* number of workers.
|
|
539
|
-
*
|
|
540
|
-
* Actually, it's rather a decorator than a queue itself.
|
|
541
|
-
*
|
|
542
|
-
* Note that the workers do not run in truly parallel, in the sense that they
|
|
543
|
-
* are not running in separate threads or processes. They are running in the
|
|
544
|
-
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
545
|
-
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
546
|
-
* workloads.
|
|
547
|
-
*
|
|
548
|
-
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
549
|
-
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
550
|
-
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
551
|
-
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
552
|
-
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
553
|
-
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
554
|
-
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
555
|
-
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
556
|
-
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
557
|
-
*
|
|
558
|
-
* Messages with the same ordering key will never be processed concurrently
|
|
559
|
-
* by different workers, ensuring sequential processing within each key.
|
|
560
|
-
* Messages with different ordering keys (or no ordering key) can still be
|
|
561
|
-
* processed in parallel.
|
|
562
|
-
*
|
|
563
|
-
* @since 1.0.0
|
|
564
|
-
*/
|
|
565
|
-
declare class ParallelMessageQueue implements MessageQueue {
|
|
566
|
-
#private;
|
|
567
|
-
readonly queue: MessageQueue;
|
|
568
|
-
readonly workers: number;
|
|
569
|
-
/**
|
|
570
|
-
* Inherits the native retry capability from the wrapped queue.
|
|
571
|
-
* @since 1.7.0
|
|
572
|
-
*/
|
|
573
|
-
readonly nativeRetrial?: boolean;
|
|
574
|
-
readonly getDepth?: () => Promise<MessageQueueDepth>;
|
|
575
|
-
/**
|
|
576
|
-
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
577
|
-
* number of workers.
|
|
578
|
-
* @param queue The message queue to use under the hood. Note that
|
|
579
|
-
* {@link ParallelMessageQueue} cannot be nested.
|
|
580
|
-
* @param workers The number of workers to process messages in parallel.
|
|
581
|
-
* @throws {TypeError} If the given queue is an instance of
|
|
582
|
-
* {@link ParallelMessageQueue}.
|
|
583
|
-
*/
|
|
584
|
-
constructor(queue: MessageQueue, workers: number);
|
|
585
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
586
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
587
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
588
|
-
}
|
|
589
|
-
//#endregion
|
|
590
385
|
//#region src/federation/handler.d.ts
|
|
591
386
|
/**
|
|
592
387
|
* Options for the {@link respondWithObject} and
|
|
@@ -2870,4 +2665,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2870
2665
|
readonly multikey: Multikey;
|
|
2871
2666
|
}
|
|
2872
2667
|
//#endregion
|
|
2873
|
-
export {
|
|
2668
|
+
export { CollectionCursor as $, FederationKvPrefixes as A, Router as B, IdempotencyKeyCallback as C, ObjectCallbackSetters as D, InboxListenerSetters as E, RetryContext as F, respondWithObject as G, RouterOptions as H, RetryPolicy as I, ActorDispatcher as J, respondWithObjectIfAcceptable as K, createExponentialBackoffPolicy as L, FederationQueueOptions as M, createFederation as N, OutboxListenerSetters as O, CreateExponentialBackoffPolicyOptions as P, CollectionCounter as Q, Message as R, FederationStartQueueOptions as S, ActivityTransformer as St, InboxChallengePolicy as T, RouterRouteResult as U, RouterError as V, RespondWithObjectOptions as W, ActorKeyPairsDispatcher as X, ActorHandleMapper as Y, AuthorizePredicate as Z, Federatable as _, SendActivityError as _t, GetSignedKeyOptions as a, InboxListener as at, FederationFetchOptions as b, buildCollectionSynchronizationHeader as bt, ParseUriResult as c, ObjectDispatcher as ct, SendActivityOptions as d, OutboxListenerErrorHandler as dt, CollectionDispatcher as et, SendActivityOptionsForCollection as f, OutboxPermanentFailureHandler as ft, CustomCollectionCallbackSetters as g, WebFingerLinksDispatcher as gt, ConstructorWithTypeId as h, UnverifiedActivityReason as ht, GetActorOptions as i, InboxErrorHandler as it, FederationOrigin as j, Rfc6570Expression as k, RequestContext as l, OutboxErrorHandler as lt, CollectionCallbackSetters as m, UnverifiedActivityHandler as mt, Context as n, CustomCollectionCursor as nt, InboxContext as o, NodeInfoDispatcher as ot, ActorCallbackSetters as p, SharedInboxKeyDispatcher as pt, ActorAliasMapper as q, ForwardActivityOptions as r, CustomCollectionDispatcher as rt, OutboxContext as s, ObjectAuthorizePredicate as st, ActorKeyPair as t, CustomCollectionCounter as tt, RouteActivityOptions as u, OutboxListener as ut, Federation as v, SenderKeyPair as vt, IdempotencyStrategy as w, FederationOptions as x, digest as xt, FederationBuilder as y, PageItems as yt, createFederationBuilder as z };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CAM_bQXx.cjs";
|
|
3
|
-
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-
|
|
3
|
+
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-VyDTd4G3.cjs";
|
|
4
4
|
import { n as GetKeyOwnerOptions } from "./owner-DEvZuyOE.cjs";
|
|
5
5
|
import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
6
|
+
import { r as MessageQueue } from "./mq-D8uSFzxe.cjs";
|
|
6
7
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
7
8
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
8
9
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
@@ -381,212 +382,6 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
|
|
|
381
382
|
*/
|
|
382
383
|
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
383
384
|
//#endregion
|
|
384
|
-
//#region src/federation/mq.d.ts
|
|
385
|
-
/**
|
|
386
|
-
* Additional options for enqueuing a message in a queue.
|
|
387
|
-
*
|
|
388
|
-
* @since 0.5.0
|
|
389
|
-
*/
|
|
390
|
-
interface MessageQueueEnqueueOptions {
|
|
391
|
-
/**
|
|
392
|
-
* The delay before the message is enqueued. No delay by default.
|
|
393
|
-
*
|
|
394
|
-
* It must not be negative.
|
|
395
|
-
*/
|
|
396
|
-
readonly delay?: Temporal.Duration;
|
|
397
|
-
/**
|
|
398
|
-
* An optional key that ensures messages with the same ordering key are
|
|
399
|
-
* processed sequentially (one at a time). Messages with different ordering
|
|
400
|
-
* keys (or no ordering key) may be processed in parallel.
|
|
401
|
-
*
|
|
402
|
-
* This is useful for ensuring that related messages are processed in order,
|
|
403
|
-
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
404
|
-
* activity for the same object.
|
|
405
|
-
*
|
|
406
|
-
* @since 2.0.0
|
|
407
|
-
*/
|
|
408
|
-
readonly orderingKey?: string;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Additional options for listening to a message queue.
|
|
412
|
-
*
|
|
413
|
-
* @since 1.0.0
|
|
414
|
-
*/
|
|
415
|
-
interface MessageQueueListenOptions {
|
|
416
|
-
/**
|
|
417
|
-
* The signal to abort listening to the message queue.
|
|
418
|
-
*/
|
|
419
|
-
signal?: AbortSignal;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* The number of messages waiting in a message queue.
|
|
423
|
-
*
|
|
424
|
-
* @since 2.3.0
|
|
425
|
-
*/
|
|
426
|
-
interface MessageQueueDepth {
|
|
427
|
-
/**
|
|
428
|
-
* The total number of messages still waiting in the backend queue.
|
|
429
|
-
*
|
|
430
|
-
* This does not include messages that have already been handed to a worker
|
|
431
|
-
* for processing.
|
|
432
|
-
*/
|
|
433
|
-
readonly queued: number;
|
|
434
|
-
/**
|
|
435
|
-
* The number of queued messages eligible for immediate processing.
|
|
436
|
-
*
|
|
437
|
-
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
438
|
-
* may omit this field.
|
|
439
|
-
*/
|
|
440
|
-
readonly ready?: number;
|
|
441
|
-
/**
|
|
442
|
-
* The number of queued messages scheduled for later delivery.
|
|
443
|
-
*
|
|
444
|
-
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
445
|
-
* may omit this field.
|
|
446
|
-
*/
|
|
447
|
-
readonly delayed?: number;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* An abstract interface for a message queue.
|
|
451
|
-
*
|
|
452
|
-
* @since 0.5.0
|
|
453
|
-
*/
|
|
454
|
-
interface MessageQueue {
|
|
455
|
-
/**
|
|
456
|
-
* Whether the message queue backend provides native retry mechanisms.
|
|
457
|
-
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
458
|
-
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
459
|
-
* using its own retry policies.
|
|
460
|
-
*
|
|
461
|
-
* @default `false`
|
|
462
|
-
* @since 1.7.0
|
|
463
|
-
*/
|
|
464
|
-
readonly nativeRetrial?: boolean;
|
|
465
|
-
/**
|
|
466
|
-
* Enqueues a message in the queue.
|
|
467
|
-
* @param message The message to enqueue.
|
|
468
|
-
* @param options Additional options for enqueuing the message.
|
|
469
|
-
*/
|
|
470
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
471
|
-
/**
|
|
472
|
-
* Enqueues multiple messages in the queue. This operation is optional,
|
|
473
|
-
* and may not be supported by all implementations. If not supported,
|
|
474
|
-
* Fedify will invoke {@link enqueue} for each message.
|
|
475
|
-
*
|
|
476
|
-
* @param messages The messages to enqueue.
|
|
477
|
-
* @param options Additional options for enqueuing the messages.
|
|
478
|
-
*/
|
|
479
|
-
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
480
|
-
/**
|
|
481
|
-
* Listens for messages in the queue.
|
|
482
|
-
* @param handler The handler for messages in the queue.
|
|
483
|
-
* @param options Additional options for listening to the message queue.
|
|
484
|
-
* @returns A promise that resolves when the listening is done. It never
|
|
485
|
-
* rejects, and is resolved when the signal is aborted. If no
|
|
486
|
-
* signal is provided, it never resolves.
|
|
487
|
-
*/
|
|
488
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
489
|
-
/**
|
|
490
|
-
* Gets the number of messages waiting in the queue.
|
|
491
|
-
*
|
|
492
|
-
* This operation is optional, and may not be supported by all
|
|
493
|
-
* implementations. The returned counts exclude messages currently being
|
|
494
|
-
* handled by a worker.
|
|
495
|
-
*
|
|
496
|
-
* @since 2.3.0
|
|
497
|
-
*/
|
|
498
|
-
getDepth?(): Promise<MessageQueueDepth>;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Additional options for {@link InProcessMessageQueue}.
|
|
502
|
-
* @since 1.0.0
|
|
503
|
-
*/
|
|
504
|
-
interface InProcessMessageQueueOptions {
|
|
505
|
-
/**
|
|
506
|
-
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
507
|
-
* @default `{ seconds: 5 }`
|
|
508
|
-
*/
|
|
509
|
-
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* A message queue that processes messages in the same process.
|
|
513
|
-
* Do not use this in production as it does neither persist messages nor
|
|
514
|
-
* distribute them across multiple processes.
|
|
515
|
-
*
|
|
516
|
-
* @since 0.5.0
|
|
517
|
-
*/
|
|
518
|
-
declare class InProcessMessageQueue implements MessageQueue {
|
|
519
|
-
#private;
|
|
520
|
-
/**
|
|
521
|
-
* In-process message queue does not provide native retry mechanisms.
|
|
522
|
-
* @since 1.7.0
|
|
523
|
-
*/
|
|
524
|
-
readonly nativeRetrial = false;
|
|
525
|
-
/**
|
|
526
|
-
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
527
|
-
* @param options Additional options for the in-process message queue.
|
|
528
|
-
*/
|
|
529
|
-
constructor(options?: InProcessMessageQueueOptions);
|
|
530
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
531
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
532
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
533
|
-
getDepth(): Promise<MessageQueueDepth>;
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* A message queue that processes messages in parallel. It takes another
|
|
537
|
-
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
538
|
-
* number of workers.
|
|
539
|
-
*
|
|
540
|
-
* Actually, it's rather a decorator than a queue itself.
|
|
541
|
-
*
|
|
542
|
-
* Note that the workers do not run in truly parallel, in the sense that they
|
|
543
|
-
* are not running in separate threads or processes. They are running in the
|
|
544
|
-
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
545
|
-
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
546
|
-
* workloads.
|
|
547
|
-
*
|
|
548
|
-
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
549
|
-
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
550
|
-
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
551
|
-
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
552
|
-
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
553
|
-
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
554
|
-
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
555
|
-
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
556
|
-
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
557
|
-
*
|
|
558
|
-
* Messages with the same ordering key will never be processed concurrently
|
|
559
|
-
* by different workers, ensuring sequential processing within each key.
|
|
560
|
-
* Messages with different ordering keys (or no ordering key) can still be
|
|
561
|
-
* processed in parallel.
|
|
562
|
-
*
|
|
563
|
-
* @since 1.0.0
|
|
564
|
-
*/
|
|
565
|
-
declare class ParallelMessageQueue implements MessageQueue {
|
|
566
|
-
#private;
|
|
567
|
-
readonly queue: MessageQueue;
|
|
568
|
-
readonly workers: number;
|
|
569
|
-
/**
|
|
570
|
-
* Inherits the native retry capability from the wrapped queue.
|
|
571
|
-
* @since 1.7.0
|
|
572
|
-
*/
|
|
573
|
-
readonly nativeRetrial?: boolean;
|
|
574
|
-
readonly getDepth?: () => Promise<MessageQueueDepth>;
|
|
575
|
-
/**
|
|
576
|
-
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
577
|
-
* number of workers.
|
|
578
|
-
* @param queue The message queue to use under the hood. Note that
|
|
579
|
-
* {@link ParallelMessageQueue} cannot be nested.
|
|
580
|
-
* @param workers The number of workers to process messages in parallel.
|
|
581
|
-
* @throws {TypeError} If the given queue is an instance of
|
|
582
|
-
* {@link ParallelMessageQueue}.
|
|
583
|
-
*/
|
|
584
|
-
constructor(queue: MessageQueue, workers: number);
|
|
585
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
586
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
587
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
588
|
-
}
|
|
589
|
-
//#endregion
|
|
590
385
|
//#region src/federation/handler.d.ts
|
|
591
386
|
/**
|
|
592
387
|
* Options for the {@link respondWithObject} and
|
|
@@ -2870,4 +2665,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2870
2665
|
readonly multikey: Multikey;
|
|
2871
2666
|
}
|
|
2872
2667
|
//#endregion
|
|
2873
|
-
export {
|
|
2668
|
+
export { CollectionCursor as $, FederationKvPrefixes as A, Router as B, IdempotencyKeyCallback as C, ObjectCallbackSetters as D, InboxListenerSetters as E, RetryContext as F, respondWithObject as G, RouterOptions as H, RetryPolicy as I, ActorDispatcher as J, respondWithObjectIfAcceptable as K, createExponentialBackoffPolicy as L, FederationQueueOptions as M, createFederation as N, OutboxListenerSetters as O, CreateExponentialBackoffPolicyOptions as P, CollectionCounter as Q, Message as R, FederationStartQueueOptions as S, ActivityTransformer as St, InboxChallengePolicy as T, RouterRouteResult as U, RouterError as V, RespondWithObjectOptions as W, ActorKeyPairsDispatcher as X, ActorHandleMapper as Y, AuthorizePredicate as Z, Federatable as _, SendActivityError as _t, GetSignedKeyOptions as a, InboxListener as at, FederationFetchOptions as b, buildCollectionSynchronizationHeader as bt, ParseUriResult as c, ObjectDispatcher as ct, SendActivityOptions as d, OutboxListenerErrorHandler as dt, CollectionDispatcher as et, SendActivityOptionsForCollection as f, OutboxPermanentFailureHandler as ft, CustomCollectionCallbackSetters as g, WebFingerLinksDispatcher as gt, ConstructorWithTypeId as h, UnverifiedActivityReason as ht, GetActorOptions as i, InboxErrorHandler as it, FederationOrigin as j, Rfc6570Expression as k, RequestContext as l, OutboxErrorHandler as lt, CollectionCallbackSetters as m, UnverifiedActivityHandler as mt, Context as n, CustomCollectionCursor as nt, InboxContext as o, NodeInfoDispatcher as ot, ActorCallbackSetters as p, SharedInboxKeyDispatcher as pt, ActorAliasMapper as q, ForwardActivityOptions as r, CustomCollectionDispatcher as rt, OutboxContext as s, ObjectAuthorizePredicate as st, ActorKeyPair as t, CustomCollectionCounter as tt, RouteActivityOptions as u, OutboxListener as ut, Federation as v, SenderKeyPair as vt, IdempotencyStrategy as w, FederationOptions as x, digest as xt, FederationBuilder as y, PageItems as yt, createFederationBuilder as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { o as validateCryptoKey } from "./key-
|
|
5
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { o as validateCryptoKey } from "./key-Df3tMleh.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-IywnQdiX.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { curry } from "es-toolkit";
|
|
8
8
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -6,7 +6,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
|
6
6
|
import { r as assertExists } from "../std__assert-BTEgfoJo.mjs";
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
8
8
|
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
9
|
-
import { r as createFederationBuilder } from "../builder-
|
|
9
|
+
import { r as createFederationBuilder } from "../builder-DckAhD27.mjs";
|
|
10
10
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
11
11
|
import { test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/builder.test.ts
|
|
@@ -8,10 +8,10 @@ import { n as assertGreaterOrEqual } from "../assert_rejects-DQP-q39h.mjs";
|
|
|
8
8
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
9
9
|
import { t as assert } from "../assert-DikXweDx.mjs";
|
|
10
10
|
import { r as parseAcceptSignature } from "../accept-CgDcxvjV.mjs";
|
|
11
|
-
import { s as signRequest } from "../http-
|
|
11
|
+
import { s as signRequest } from "../http-IywnQdiX.mjs";
|
|
12
12
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CSYsOMFG.mjs";
|
|
13
13
|
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
14
|
-
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-
|
|
14
|
+
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-BB0IbDow.mjs";
|
|
15
15
|
import { t as ActivityListenerSet } from "../activity-listener-BeTGV3wc.mjs";
|
|
16
16
|
import { Activity, Create, Note, Person, Tombstone } from "@fedify/vocab";
|
|
17
17
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-BTEgfoJo.mjs";
|
|
6
6
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
|
|
7
|
-
import { r as signObject } from "../proof-
|
|
7
|
+
import { r as signObject } from "../proof-BYlrRSmZ.mjs";
|
|
8
8
|
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
9
|
-
import { o as createFederation } from "../middleware-
|
|
9
|
+
import { o as createFederation } from "../middleware-BB0IbDow.mjs";
|
|
10
10
|
import { Create, Follow, Person } from "@fedify/vocab";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/idempotency.test.ts
|