@fedify/fedify 2.3.0-dev.1119 → 2.3.0-dev.1137

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 (116) hide show
  1. package/README.md +3 -0
  2. package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
  3. package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
  4. package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
  5. package/dist/{assert_rejects-DQP-q39h.mjs → assert_rejects-DN60FHPX.mjs} +2 -2
  6. package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
  7. package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
  8. package/dist/{builder-Ond_h57y.mjs → builder-BCkBXxky.mjs} +60 -41
  9. package/dist/compat/mod.d.cts +1 -1
  10. package/dist/compat/mod.d.ts +1 -1
  11. package/dist/compat/outgoing-jsonld.test.mjs +3 -3
  12. package/dist/compat/public-audience.test.mjs +3 -3
  13. package/dist/compat/transformers.test.mjs +5 -5
  14. package/dist/{context-cSUMk2da.d.ts → context-DCtsSHDv.d.ts} +4 -293
  15. package/dist/{context-Ch-ZLyTQ.d.cts → context-DI2gRbyN.d.cts} +3 -294
  16. package/dist/{context-BAE7AKLA.mjs → context-DVoTs_wM.mjs} +1 -1
  17. package/dist/{deno-DVsHS7rA.mjs → deno-B_9yJW3w.mjs} +1 -1
  18. package/dist/{docloader-WsWfKaE5.mjs → docloader-BT89tyFr.mjs} +3 -3
  19. package/dist/federation/builder.test.mjs +138 -10
  20. package/dist/federation/collection.test.mjs +3 -3
  21. package/dist/federation/handler.test.mjs +12 -12
  22. package/dist/federation/idempotency.test.mjs +6 -6
  23. package/dist/federation/inbox.test.mjs +3 -3
  24. package/dist/federation/keycache.test.mjs +5 -5
  25. package/dist/federation/kv.test.mjs +3 -3
  26. package/dist/federation/metrics.test.mjs +231 -3
  27. package/dist/federation/middleware.test.mjs +88 -18
  28. package/dist/federation/mod.cjs +155 -3
  29. package/dist/federation/mod.d.cts +3 -2
  30. package/dist/federation/mod.d.ts +3 -2
  31. package/dist/federation/mod.js +153 -1
  32. package/dist/federation/mq.test.mjs +5 -5
  33. package/dist/federation/negotiation.test.mjs +4 -4
  34. package/dist/federation/retry.test.mjs +3 -3
  35. package/dist/federation/router.test.mjs +190 -9
  36. package/dist/federation/send.test.mjs +16 -16
  37. package/dist/federation/webfinger.test.mjs +5 -5
  38. package/dist/{getMachineId-bsd-BY01PL1n.mjs → getMachineId-bsd-etIyxDet.mjs} +1 -1
  39. package/dist/{getMachineId-darwin-Dr1gkBkp.mjs → getMachineId-darwin-D23zTf4g.mjs} +1 -1
  40. package/dist/{getMachineId-win-QEYwcJiy.mjs → getMachineId-win-Dpap6v5i.mjs} +1 -1
  41. package/dist/{http-CouJSFVK.js → http-CToqG5ap.js} +252 -20
  42. package/dist/{http-CubOB9wq.cjs → http-CWoeyogl.cjs} +263 -19
  43. package/dist/{http-DUV8ysti.mjs → http-Cyx5SNuu.mjs} +8 -6
  44. package/dist/{http-D6LP89UO.d.ts → http-VyDTd4G3.d.cts} +8 -1
  45. package/dist/{http-D6aw3j2U.d.cts → http-lf8Hsd91.d.ts} +8 -1
  46. package/dist/{key-BoWaYRHm.mjs → key-CkkMJBjF.mjs} +42 -17
  47. package/dist/{kv-cache-DBNpsneh.js → kv-cache-CuCn2xvM.js} +19 -2
  48. package/dist/{kv-cache-Dz31ATUT.cjs → kv-cache-DuEwFYcN.cjs} +19 -2
  49. package/dist/{kv-cache-DihufyAQ.mjs → kv-cache-VHFP42vY.mjs} +19 -1
  50. package/dist/{ld-B5K1mSuG.mjs → ld-k8yqD2a-.mjs} +3 -3
  51. package/dist/{metrics-C4attqv0.mjs → metrics-iRBg8jTk.mjs} +209 -2
  52. package/dist/{middleware-CmsDtIHI.cjs → middleware-BWLUrbS9.cjs} +137 -210
  53. package/dist/{middleware-BDKFRjue.mjs → middleware-CztxpARM.mjs} +1 -1
  54. package/dist/{middleware-Dtjz-hSk.js → middleware-D7FrhN9q.js} +101 -162
  55. package/dist/{middleware-t0jC8I99.mjs → middleware-DQEgdr83.mjs} +64 -36
  56. package/dist/{mod-BDhgfjP7.d.cts → mod-B0hW12_O.d.cts} +1 -1
  57. package/dist/mod-C504qevA.d.cts +173 -0
  58. package/dist/{mod-B-Lin9Sy.d.ts → mod-COIAjwRS.d.ts} +1 -1
  59. package/dist/{mod-DLrRb0dx.d.ts → mod-DFvNJcNb.d.ts} +54 -3
  60. package/dist/mod-wYfuXeDE.d.ts +173 -0
  61. package/dist/{mod-BR_BB0bh.d.cts → mod-yvIXFAEi.d.cts} +54 -3
  62. package/dist/mod.cjs +6 -6
  63. package/dist/mod.d.cts +6 -5
  64. package/dist/mod.d.ts +6 -5
  65. package/dist/mod.js +5 -5
  66. package/dist/mq-D-nlpY04.d.ts +208 -0
  67. package/dist/mq-D8uSFzxe.d.cts +208 -0
  68. package/dist/nodeinfo/client.test.mjs +4 -4
  69. package/dist/nodeinfo/handler.test.mjs +5 -5
  70. package/dist/nodeinfo/types.test.mjs +4 -4
  71. package/dist/otel/exporter.test.mjs +3 -3
  72. package/dist/{outgoing-jsonld-BNL8AC14.mjs → outgoing-jsonld-BgFLCJQ_.mjs} +1 -1
  73. package/dist/{owner-hDxI0ufu.mjs → owner-nmXdvXpc.mjs} +2 -2
  74. package/dist/{proof-BUWfVr6Q.cjs → proof-CcsIJLTn.cjs} +1 -1
  75. package/dist/{proof-DhVuz4bc.mjs → proof-DpwO1T4S.mjs} +5 -5
  76. package/dist/{proof-n60t8o9P.js → proof-NRmtrTDu.js} +1 -1
  77. package/dist/{send-BPhyR5Oo.mjs → send-DvX2tYyZ.mjs} +3 -3
  78. package/dist/sig/accept.test.mjs +1 -1
  79. package/dist/sig/http.test.mjs +13 -9
  80. package/dist/sig/key.test.mjs +104 -7
  81. package/dist/sig/ld.test.mjs +7 -7
  82. package/dist/sig/mod.cjs +2 -2
  83. package/dist/sig/mod.d.cts +2 -2
  84. package/dist/sig/mod.d.ts +2 -2
  85. package/dist/sig/mod.js +2 -2
  86. package/dist/sig/owner.test.mjs +6 -6
  87. package/dist/sig/proof.test.mjs +8 -8
  88. package/dist/{std__assert-BTEgfoJo.mjs → std__assert-BBjXFNOb.mjs} +4 -4
  89. package/dist/testing/mod.d.mts +1 -0
  90. package/dist/testing/mod.mjs +1 -1
  91. package/dist/utils/docloader.test.mjs +7 -7
  92. package/dist/utils/kv-cache.test.mjs +67 -2
  93. package/dist/utils/mod.cjs +1 -1
  94. package/dist/utils/mod.d.cts +1 -1
  95. package/dist/utils/mod.d.ts +1 -1
  96. package/dist/utils/mod.js +1 -1
  97. package/package.json +6 -7
  98. package/dist/mod-C6E8rkcz.d.ts +0 -63
  99. package/dist/mod-P9tE2WmM.d.cts +0 -63
  100. package/dist/router-BT_F5748.mjs +0 -114
  101. /package/dist/{accept-CgDcxvjV.mjs → accept-CceiKpCy.mjs} +0 -0
  102. /package/dist/{activity-listener-BeTGV3wc.mjs → activity-listener-tztVvlNb.mjs} +0 -0
  103. /package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
  104. /package/dist/{client-Bneh_DYR.mjs → client-B_A6mfn3.mjs} +0 -0
  105. /package/dist/{collection-Cc3DVAhE.mjs → collection-CA3V5zyK.mjs} +0 -0
  106. /package/dist/{esm-sdtqOUPu.mjs → esm-BQRw925N.mjs} +0 -0
  107. /package/dist/{execAsync-Dxb7rNf3.mjs → execAsync-DCBrgFiV.mjs} +0 -0
  108. /package/dist/{getMachineId-linux-Bbhofx-s.mjs → getMachineId-linux-ObI47Hql.mjs} +0 -0
  109. /package/dist/{getMachineId-unsupported-dIOte2Ct.mjs → getMachineId-unsupported-Ddu-PFeh.mjs} +0 -0
  110. /package/dist/{keycache-BeU0LCII.mjs → keycache-BYMd8q7F.mjs} +0 -0
  111. /package/dist/{keys-CSYsOMFG.mjs → keys-C3kae-6B.mjs} +0 -0
  112. /package/dist/{kv-QHE0oeM3.mjs → kv-x2IvBUyq.mjs} +0 -0
  113. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-CDW-_gUU.mjs} +0 -0
  114. /package/dist/{public-audience-c9zmYKgA.mjs → public-audience-N3pyOx2p.mjs} +0 -0
  115. /package/dist/{retry-_VvV0h9f.mjs → retry-v_sGLH1d.mjs} +0 -0
  116. /package/dist/{types-D09GN0uZ.mjs → types-BFowWFTT.mjs} +0 -0
@@ -1,8 +1,10 @@
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-D6LP89UO.js";
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";
7
+ import { Router } from "@fedify/uri-template";
6
8
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
7
9
  import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
8
10
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
@@ -381,212 +383,6 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
381
383
  */
382
384
  type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
383
385
  //#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
386
  //#region src/federation/handler.d.ts
591
387
  /**
592
388
  * Options for the {@link respondWithObject} and
@@ -619,91 +415,6 @@ declare function respondWithObject(object: Object$1, options?: RespondWithObject
619
415
  */
620
416
  declare function respondWithObjectIfAcceptable(object: Object$1, request: Request, options?: RespondWithObjectOptions): Promise<Response | null>;
621
417
  //#endregion
622
- //#region src/federation/router.d.ts
623
- /**
624
- * Options for the {@link Router}.
625
- * @since 0.12.0
626
- */
627
- interface RouterOptions {
628
- /**
629
- * Whether to ignore trailing slashes when matching paths.
630
- */
631
- trailingSlashInsensitive?: boolean;
632
- }
633
- /**
634
- * The result of {@link Router.route} method.
635
- * @since 1.3.0
636
- */
637
- interface RouterRouteResult {
638
- /**
639
- * The matched route name.
640
- */
641
- name: string;
642
- /**
643
- * The URL template of the matched route.
644
- */
645
- template: string;
646
- /**
647
- * The values extracted from the URL.
648
- */
649
- values: Record<string, string>;
650
- }
651
- /**
652
- * URL router and constructor based on URI Template
653
- * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
654
- */
655
- declare class Router {
656
- #private;
657
- /**
658
- * Whether to ignore trailing slashes when matching paths.
659
- * @since 1.6.0
660
- */
661
- trailingSlashInsensitive: boolean;
662
- /**
663
- * Create a new {@link Router}.
664
- * @param options Options for the router.
665
- */
666
- constructor(options?: RouterOptions);
667
- clone(): Router;
668
- /**
669
- * Checks if a path name exists in the router.
670
- * @param name The name of the path.
671
- * @returns `true` if the path name exists, otherwise `false`.
672
- */
673
- has(name: string): boolean;
674
- /**
675
- * Adds a new path rule to the router.
676
- * @param template The path pattern.
677
- * @param name The name of the path.
678
- * @returns The names of the variables in the path pattern.
679
- */
680
- add(template: string, name: string): Set<string>;
681
- /**
682
- * Resolves a path name and values from a URL, if any match.
683
- * @param url The URL to resolve.
684
- * @returns The name of the path and its values, if any match. Otherwise,
685
- * `null`.
686
- */
687
- route(url: string): RouterRouteResult | null;
688
- /**
689
- * Constructs a URL/path from a path name and values.
690
- * @param name The name of the path.
691
- * @param values The values to expand the path with.
692
- * @returns The URL/path, if the name exists. Otherwise, `null`.
693
- */
694
- build(name: string, values: Record<string, string>): string | null;
695
- }
696
- /**
697
- * An error thrown by the {@link Router}.
698
- */
699
- declare class RouterError extends Error {
700
- /**
701
- * Create a new {@link RouterError}.
702
- * @param message The error message.
703
- */
704
- constructor(message: string);
705
- }
706
- //#endregion
707
418
  //#region src/federation/builder.d.ts
708
419
  /**
709
420
  * Creates a new {@link FederationBuilder} instance.
@@ -2870,4 +2581,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2870
2581
  readonly multikey: Multikey;
2871
2582
  }
2872
2583
  //#endregion
2873
- export { ParallelMessageQueue as $, FederationKvPrefixes as A, Router as B, IdempotencyKeyCallback as C, WebFingerLinksDispatcher as Ct, ObjectCallbackSetters as D, buildCollectionSynchronizationHeader as Dt, InboxListenerSetters as E, PageItems as Et, RetryContext as F, respondWithObject as G, RouterOptions as H, RetryPolicy as I, InProcessMessageQueueOptions as J, respondWithObjectIfAcceptable as K, createExponentialBackoffPolicy as L, FederationQueueOptions as M, createFederation as N, OutboxListenerSetters as O, digest as Ot, CreateExponentialBackoffPolicyOptions as P, MessageQueueListenOptions as Q, Message as R, FederationStartQueueOptions as S, UnverifiedActivityReason as St, InboxChallengePolicy as T, SenderKeyPair as Tt, RouterRouteResult as U, RouterError as V, RespondWithObjectOptions as W, MessageQueueDepth as X, MessageQueue as Y, MessageQueueEnqueueOptions as Z, Federatable as _, OutboxListener as _t, GetSignedKeyOptions as a, CollectionCounter as at, FederationFetchOptions as b, SharedInboxKeyDispatcher as bt, ParseUriResult as c, CustomCollectionCounter as ct, SendActivityOptions as d, InboxErrorHandler as dt, ActorAliasMapper as et, SendActivityOptionsForCollection as f, InboxListener as ft, CustomCollectionCallbackSetters as g, OutboxErrorHandler as gt, ConstructorWithTypeId as h, ObjectDispatcher as ht, GetActorOptions as i, AuthorizePredicate as it, FederationOrigin as j, Rfc6570Expression as k, ActivityTransformer as kt, RequestContext as l, CustomCollectionCursor as lt, CollectionCallbackSetters as m, ObjectAuthorizePredicate as mt, Context as n, ActorHandleMapper as nt, InboxContext as o, CollectionCursor as ot, ActorCallbackSetters as p, NodeInfoDispatcher as pt, InProcessMessageQueue as q, ForwardActivityOptions as r, ActorKeyPairsDispatcher as rt, OutboxContext as s, CollectionDispatcher as st, ActorKeyPair as t, ActorDispatcher as tt, RouteActivityOptions as u, CustomCollectionDispatcher as ut, Federation as v, OutboxListenerErrorHandler as vt, IdempotencyStrategy as w, SendActivityError as wt, FederationOptions as x, UnverifiedActivityHandler as xt, FederationBuilder as y, OutboxPermanentFailureHandler as yt, createFederationBuilder as z };
2584
+ export { CustomCollectionDispatcher as $, FederationKvPrefixes as A, RespondWithObjectOptions as B, IdempotencyKeyCallback as C, ObjectCallbackSetters as D, InboxListenerSetters as E, RetryContext as F, ActorHandleMapper as G, respondWithObjectIfAcceptable as H, RetryPolicy as I, CollectionCounter as J, ActorKeyPairsDispatcher as K, createExponentialBackoffPolicy as L, FederationQueueOptions as M, createFederation as N, OutboxListenerSetters as O, CreateExponentialBackoffPolicyOptions as P, CustomCollectionCursor as Q, Message as R, FederationStartQueueOptions as S, InboxChallengePolicy as T, ActorAliasMapper as U, respondWithObject as V, ActorDispatcher as W, CollectionDispatcher as X, CollectionCursor as Y, CustomCollectionCounter as Z, Federatable as _, digest as _t, GetSignedKeyOptions as a, OutboxErrorHandler as at, FederationFetchOptions as b, ParseUriResult as c, OutboxPermanentFailureHandler as ct, SendActivityOptions as d, UnverifiedActivityReason as dt, InboxErrorHandler as et, SendActivityOptionsForCollection as f, WebFingerLinksDispatcher as ft, CustomCollectionCallbackSetters as g, buildCollectionSynchronizationHeader as gt, ConstructorWithTypeId as h, PageItems as ht, GetActorOptions as i, ObjectDispatcher as it, FederationOrigin as j, Rfc6570Expression as k, RequestContext as l, SharedInboxKeyDispatcher as lt, CollectionCallbackSetters as m, SenderKeyPair as mt, Context as n, NodeInfoDispatcher as nt, InboxContext as o, OutboxListener as ot, ActorCallbackSetters as p, SendActivityError as pt, AuthorizePredicate as q, ForwardActivityOptions as r, ObjectAuthorizePredicate as rt, OutboxContext as s, OutboxListenerErrorHandler as st, ActorKeyPair as t, InboxListener as tt, RouteActivityOptions as u, UnverifiedActivityHandler as ut, Federation as v, ActivityTransformer as vt, IdempotencyStrategy as w, FederationOptions as x, FederationBuilder as y, createFederationBuilder as z };
@@ -1,13 +1,13 @@
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-D6aw3j2U.cjs";
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";
9
10
  import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
10
-
11
11
  //#region src/compat/types.d.ts
12
12
  /**
13
13
  * A function that transforms an activity object.
@@ -381,212 +381,6 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
381
381
  */
382
382
  type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
383
383
  //#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
384
  //#region src/federation/handler.d.ts
591
385
  /**
592
386
  * Options for the {@link respondWithObject} and
@@ -619,91 +413,6 @@ declare function respondWithObject(object: Object$1, options?: RespondWithObject
619
413
  */
620
414
  declare function respondWithObjectIfAcceptable(object: Object$1, request: Request, options?: RespondWithObjectOptions): Promise<Response | null>;
621
415
  //#endregion
622
- //#region src/federation/router.d.ts
623
- /**
624
- * Options for the {@link Router}.
625
- * @since 0.12.0
626
- */
627
- interface RouterOptions {
628
- /**
629
- * Whether to ignore trailing slashes when matching paths.
630
- */
631
- trailingSlashInsensitive?: boolean;
632
- }
633
- /**
634
- * The result of {@link Router.route} method.
635
- * @since 1.3.0
636
- */
637
- interface RouterRouteResult {
638
- /**
639
- * The matched route name.
640
- */
641
- name: string;
642
- /**
643
- * The URL template of the matched route.
644
- */
645
- template: string;
646
- /**
647
- * The values extracted from the URL.
648
- */
649
- values: Record<string, string>;
650
- }
651
- /**
652
- * URL router and constructor based on URI Template
653
- * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
654
- */
655
- declare class Router {
656
- #private;
657
- /**
658
- * Whether to ignore trailing slashes when matching paths.
659
- * @since 1.6.0
660
- */
661
- trailingSlashInsensitive: boolean;
662
- /**
663
- * Create a new {@link Router}.
664
- * @param options Options for the router.
665
- */
666
- constructor(options?: RouterOptions);
667
- clone(): Router;
668
- /**
669
- * Checks if a path name exists in the router.
670
- * @param name The name of the path.
671
- * @returns `true` if the path name exists, otherwise `false`.
672
- */
673
- has(name: string): boolean;
674
- /**
675
- * Adds a new path rule to the router.
676
- * @param template The path pattern.
677
- * @param name The name of the path.
678
- * @returns The names of the variables in the path pattern.
679
- */
680
- add(template: string, name: string): Set<string>;
681
- /**
682
- * Resolves a path name and values from a URL, if any match.
683
- * @param url The URL to resolve.
684
- * @returns The name of the path and its values, if any match. Otherwise,
685
- * `null`.
686
- */
687
- route(url: string): RouterRouteResult | null;
688
- /**
689
- * Constructs a URL/path from a path name and values.
690
- * @param name The name of the path.
691
- * @param values The values to expand the path with.
692
- * @returns The URL/path, if the name exists. Otherwise, `null`.
693
- */
694
- build(name: string, values: Record<string, string>): string | null;
695
- }
696
- /**
697
- * An error thrown by the {@link Router}.
698
- */
699
- declare class RouterError extends Error {
700
- /**
701
- * Create a new {@link RouterError}.
702
- * @param message The error message.
703
- */
704
- constructor(message: string);
705
- }
706
- //#endregion
707
416
  //#region src/federation/builder.d.ts
708
417
  /**
709
418
  * Creates a new {@link FederationBuilder} instance.
@@ -2870,4 +2579,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2870
2579
  readonly multikey: Multikey;
2871
2580
  }
2872
2581
  //#endregion
2873
- export { ParallelMessageQueue as $, FederationKvPrefixes as A, Router as B, IdempotencyKeyCallback as C, WebFingerLinksDispatcher as Ct, ObjectCallbackSetters as D, buildCollectionSynchronizationHeader as Dt, InboxListenerSetters as E, PageItems as Et, RetryContext as F, respondWithObject as G, RouterOptions as H, RetryPolicy as I, InProcessMessageQueueOptions as J, respondWithObjectIfAcceptable as K, createExponentialBackoffPolicy as L, FederationQueueOptions as M, createFederation as N, OutboxListenerSetters as O, digest as Ot, CreateExponentialBackoffPolicyOptions as P, MessageQueueListenOptions as Q, Message as R, FederationStartQueueOptions as S, UnverifiedActivityReason as St, InboxChallengePolicy as T, SenderKeyPair as Tt, RouterRouteResult as U, RouterError as V, RespondWithObjectOptions as W, MessageQueueDepth as X, MessageQueue as Y, MessageQueueEnqueueOptions as Z, Federatable as _, OutboxListener as _t, GetSignedKeyOptions as a, CollectionCounter as at, FederationFetchOptions as b, SharedInboxKeyDispatcher as bt, ParseUriResult as c, CustomCollectionCounter as ct, SendActivityOptions as d, InboxErrorHandler as dt, ActorAliasMapper as et, SendActivityOptionsForCollection as f, InboxListener as ft, CustomCollectionCallbackSetters as g, OutboxErrorHandler as gt, ConstructorWithTypeId as h, ObjectDispatcher as ht, GetActorOptions as i, AuthorizePredicate as it, FederationOrigin as j, Rfc6570Expression as k, ActivityTransformer as kt, RequestContext as l, CustomCollectionCursor as lt, CollectionCallbackSetters as m, ObjectAuthorizePredicate as mt, Context as n, ActorHandleMapper as nt, InboxContext as o, CollectionCursor as ot, ActorCallbackSetters as p, NodeInfoDispatcher as pt, InProcessMessageQueue as q, ForwardActivityOptions as r, ActorKeyPairsDispatcher as rt, OutboxContext as s, CollectionDispatcher as st, ActorKeyPair as t, ActorDispatcher as tt, RouteActivityOptions as u, CustomCollectionDispatcher as ut, Federation as v, OutboxListenerErrorHandler as vt, IdempotencyStrategy as w, SendActivityError as wt, FederationOptions as x, UnverifiedActivityHandler as xt, FederationBuilder as y, OutboxPermanentFailureHandler as yt, createFederationBuilder as z };
2582
+ export { CustomCollectionDispatcher as $, FederationKvPrefixes as A, RespondWithObjectOptions as B, IdempotencyKeyCallback as C, ObjectCallbackSetters as D, InboxListenerSetters as E, RetryContext as F, ActorHandleMapper as G, respondWithObjectIfAcceptable as H, RetryPolicy as I, CollectionCounter as J, ActorKeyPairsDispatcher as K, createExponentialBackoffPolicy as L, FederationQueueOptions as M, createFederation as N, OutboxListenerSetters as O, CreateExponentialBackoffPolicyOptions as P, CustomCollectionCursor as Q, Message as R, FederationStartQueueOptions as S, InboxChallengePolicy as T, ActorAliasMapper as U, respondWithObject as V, ActorDispatcher as W, CollectionDispatcher as X, CollectionCursor as Y, CustomCollectionCounter as Z, Federatable as _, digest as _t, GetSignedKeyOptions as a, OutboxErrorHandler as at, FederationFetchOptions as b, ParseUriResult as c, OutboxPermanentFailureHandler as ct, SendActivityOptions as d, UnverifiedActivityReason as dt, InboxErrorHandler as et, SendActivityOptionsForCollection as f, WebFingerLinksDispatcher as ft, CustomCollectionCallbackSetters as g, buildCollectionSynchronizationHeader as gt, ConstructorWithTypeId as h, PageItems as ht, GetActorOptions as i, ObjectDispatcher as it, FederationOrigin as j, Rfc6570Expression as k, RequestContext as l, SharedInboxKeyDispatcher as lt, CollectionCallbackSetters as m, SenderKeyPair as mt, Context as n, NodeInfoDispatcher as nt, InboxContext as o, OutboxListener as ot, ActorCallbackSetters as p, SendActivityError as pt, AuthorizePredicate as q, ForwardActivityOptions as r, ObjectAuthorizePredicate as rt, OutboxContext as s, OutboxListenerErrorHandler as st, ActorKeyPair as t, InboxListener as tt, RouteActivityOptions as u, UnverifiedActivityHandler as ut, Federation as v, ActivityTransformer as vt, IdempotencyStrategy as w, FederationOptions as x, FederationBuilder as y, createFederationBuilder as z };
@@ -1,10 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as RouterError } from "./router-BT_F5748.mjs";
5
4
  import { getLogger } from "@logtape/logtape";
6
5
  import "@opentelemetry/sdk-trace-base";
7
6
  import "@opentelemetry/core";
7
+ import { RouterError } from "@fedify/uri-template";
8
8
  import { lookupObject, traverseCollection } from "@fedify/vocab";
9
9
  import { lookupWebFinger } from "@fedify/webfinger";
10
10
  import { metrics, trace } from "@opentelemetry/api";
@@ -3,6 +3,6 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  //#region deno.json
5
5
  var name = "@fedify/fedify";
6
- var version = "2.3.0-dev.1119+6cc02662";
6
+ var version = "2.3.0-dev.1137+53a1f26d";
7
7
  //#endregion
8
8
  export { version as n, name as t };