@fedify/fedify 2.3.0-dev.1131 → 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 (104) 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-DckAhD27.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-Cq18Gplu.d.ts → context-DCtsSHDv.d.ts} +2 -86
  15. package/dist/{context-tc6VOOOL.d.cts → context-DI2gRbyN.d.cts} +1 -87
  16. package/dist/{context-BAE7AKLA.mjs → context-DVoTs_wM.mjs} +1 -1
  17. package/dist/{deno--CS-SBS9.mjs → deno-B_9yJW3w.mjs} +1 -1
  18. package/dist/{docloader-k6huZLQL.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 +4 -4
  27. package/dist/federation/middleware.test.mjs +30 -18
  28. package/dist/federation/mod.cjs +155 -3
  29. package/dist/federation/mod.d.cts +2 -2
  30. package/dist/federation/mod.d.ts +2 -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-cqujdCRz.js → http-CToqG5ap.js} +1 -1
  42. package/dist/{http-CJfvRL7D.cjs → http-CWoeyogl.cjs} +1 -1
  43. package/dist/{http-IywnQdiX.mjs → http-Cyx5SNuu.mjs} +4 -4
  44. package/dist/{key-Df3tMleh.mjs → key-CkkMJBjF.mjs} +2 -2
  45. package/dist/{kv-cache-pEejzYq4.js → kv-cache-CuCn2xvM.js} +1 -1
  46. package/dist/{kv-cache-L0SMQkcd.cjs → kv-cache-DuEwFYcN.cjs} +1 -1
  47. package/dist/{kv-cache-q9Ec2ryS.mjs → kv-cache-VHFP42vY.mjs} +1 -1
  48. package/dist/{ld-BGwiJpl3.mjs → ld-k8yqD2a-.mjs} +3 -3
  49. package/dist/{metrics-BTOMkW8C.mjs → metrics-iRBg8jTk.mjs} +1 -1
  50. package/dist/{middleware-B2rtdpFV.cjs → middleware-BWLUrbS9.cjs} +95 -196
  51. package/dist/{middleware-Dnql59Y8.mjs → middleware-CztxpARM.mjs} +1 -1
  52. package/dist/{middleware-DtOddSVg.js → middleware-D7FrhN9q.js} +59 -148
  53. package/dist/{middleware-BB0IbDow.mjs → middleware-DQEgdr83.mjs} +21 -21
  54. package/dist/mod-C504qevA.d.cts +173 -0
  55. package/dist/mod-wYfuXeDE.d.ts +173 -0
  56. package/dist/mod.cjs +6 -6
  57. package/dist/mod.d.cts +2 -2
  58. package/dist/mod.d.ts +2 -2
  59. package/dist/mod.js +5 -5
  60. package/dist/nodeinfo/client.test.mjs +4 -4
  61. package/dist/nodeinfo/handler.test.mjs +5 -5
  62. package/dist/nodeinfo/types.test.mjs +4 -4
  63. package/dist/otel/exporter.test.mjs +3 -3
  64. package/dist/{outgoing-jsonld-BNL8AC14.mjs → outgoing-jsonld-BgFLCJQ_.mjs} +1 -1
  65. package/dist/{owner-CIt4hvmM.mjs → owner-nmXdvXpc.mjs} +2 -2
  66. package/dist/{proof-B1_u25UV.cjs → proof-CcsIJLTn.cjs} +1 -1
  67. package/dist/{proof-BYlrRSmZ.mjs → proof-DpwO1T4S.mjs} +5 -5
  68. package/dist/{proof-DMGIjHYH.js → proof-NRmtrTDu.js} +1 -1
  69. package/dist/{send-DJFpze7B.mjs → send-DvX2tYyZ.mjs} +3 -3
  70. package/dist/sig/accept.test.mjs +1 -1
  71. package/dist/sig/http.test.mjs +9 -9
  72. package/dist/sig/key.test.mjs +6 -6
  73. package/dist/sig/ld.test.mjs +7 -7
  74. package/dist/sig/mod.cjs +2 -2
  75. package/dist/sig/mod.js +2 -2
  76. package/dist/sig/owner.test.mjs +6 -6
  77. package/dist/sig/proof.test.mjs +8 -8
  78. package/dist/{std__assert-BTEgfoJo.mjs → std__assert-BBjXFNOb.mjs} +4 -4
  79. package/dist/testing/mod.d.mts +1 -0
  80. package/dist/testing/mod.mjs +1 -1
  81. package/dist/utils/docloader.test.mjs +7 -7
  82. package/dist/utils/kv-cache.test.mjs +1 -1
  83. package/dist/utils/mod.cjs +1 -1
  84. package/dist/utils/mod.js +1 -1
  85. package/package.json +7 -8
  86. package/dist/mod-CajNYYkt.d.ts +0 -63
  87. package/dist/mod-DnzgcPcy.d.cts +0 -63
  88. package/dist/router-BT_F5748.mjs +0 -114
  89. /package/dist/{accept-CgDcxvjV.mjs → accept-CceiKpCy.mjs} +0 -0
  90. /package/dist/{activity-listener-BeTGV3wc.mjs → activity-listener-tztVvlNb.mjs} +0 -0
  91. /package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
  92. /package/dist/{client-Bneh_DYR.mjs → client-B_A6mfn3.mjs} +0 -0
  93. /package/dist/{collection-Cc3DVAhE.mjs → collection-CA3V5zyK.mjs} +0 -0
  94. /package/dist/{esm-sdtqOUPu.mjs → esm-BQRw925N.mjs} +0 -0
  95. /package/dist/{execAsync-Dxb7rNf3.mjs → execAsync-DCBrgFiV.mjs} +0 -0
  96. /package/dist/{getMachineId-linux-Bbhofx-s.mjs → getMachineId-linux-ObI47Hql.mjs} +0 -0
  97. /package/dist/{getMachineId-unsupported-dIOte2Ct.mjs → getMachineId-unsupported-Ddu-PFeh.mjs} +0 -0
  98. /package/dist/{keycache-BeU0LCII.mjs → keycache-BYMd8q7F.mjs} +0 -0
  99. /package/dist/{keys-CSYsOMFG.mjs → keys-C3kae-6B.mjs} +0 -0
  100. /package/dist/{kv-QHE0oeM3.mjs → kv-x2IvBUyq.mjs} +0 -0
  101. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-CDW-_gUU.mjs} +0 -0
  102. /package/dist/{public-audience-c9zmYKgA.mjs → public-audience-N3pyOx2p.mjs} +0 -0
  103. /package/dist/{retry-_VvV0h9f.mjs → retry-v_sGLH1d.mjs} +0 -0
  104. /package/dist/{types-D09GN0uZ.mjs → types-BFowWFTT.mjs} +0 -0
@@ -1,6 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-DtOddSVg.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-D7FrhN9q.js";
4
+ import { getLogger } from "@logtape/logtape";
5
+ import { Router as Router$1, RouterError as RouterError$1, assertPath, isPath } from "@fedify/uri-template";
4
6
  import { isEqual } from "es-toolkit";
5
7
  //#region src/federation/kv.ts
6
8
  /**
@@ -345,4 +347,154 @@ var ParallelMessageQueue = class ParallelMessageQueue {
345
347
  }
346
348
  };
347
349
  //#endregion
350
+ //#region src/federation/router.ts
351
+ const logger = getLogger([
352
+ "fedify",
353
+ "federation",
354
+ "router",
355
+ "deprecated"
356
+ ]);
357
+ let deprecationWarned = false;
358
+ function warnDeprecated() {
359
+ if (deprecationWarned) return;
360
+ deprecationWarned = true;
361
+ logger.warn("The `Router` and `RouterError` classes from `@fedify/fedify` are deprecated. Please use `Router` from `@fedify/uri-template` instead.");
362
+ }
363
+ /**
364
+ * URL router and constructor based on URI Template
365
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
366
+ *
367
+ * @deprecated Import `Router` from `@fedify/uri-template` instead. This class
368
+ * remains only for compatibility with older Fedify code. The
369
+ * `@fedify/uri-template` router is the replacement implementation
370
+ * and should be used directly in new code.
371
+ */
372
+ var Router = class Router {
373
+ #router;
374
+ /**
375
+ * Create a new {@link Router}.
376
+ * @param options Options for the router.
377
+ * @deprecated Use `new Router(options)` from `@fedify/uri-template`
378
+ * instead.
379
+ */
380
+ constructor(options) {
381
+ this.#router = convertRouterError(() => new Router$1(options));
382
+ }
383
+ /**
384
+ * Whether to ignore trailing slashes when matching paths.
385
+ * @deprecated Use `Router` from `@fedify/uri-template` instead. This
386
+ * accessor forwards to the underlying `@fedify/uri-template`
387
+ * router so that post-construction mutation keeps working as
388
+ * in older Fedify code.
389
+ */
390
+ get trailingSlashInsensitive() {
391
+ return this.#router.trailingSlashInsensitive;
392
+ }
393
+ set trailingSlashInsensitive(value) {
394
+ this.#router.trailingSlashInsensitive = value;
395
+ }
396
+ /**
397
+ * Clones this router.
398
+ * @deprecated Use `Router` from `@fedify/uri-template` instead.
399
+ */
400
+ clone() {
401
+ return convertRouterError(() => {
402
+ const clone = new Router();
403
+ clone.#router = this.#router.clone();
404
+ return clone;
405
+ });
406
+ }
407
+ /**
408
+ * Checks if a path name exists in the router.
409
+ * @param name The name of the path.
410
+ * @returns `true` if the path name exists, otherwise `false`.
411
+ * @deprecated Use `Router` from `@fedify/uri-template` instead.
412
+ */
413
+ has(name) {
414
+ return convertRouterError(() => this.#router.has(name));
415
+ }
416
+ /**
417
+ * Adds a new path rule to the router.
418
+ * @param template The path pattern.
419
+ * @param name The name of the path.
420
+ * @returns The names of the variables in the path pattern.
421
+ * @deprecated Use `Router` from `@fedify/uri-template` instead. In this
422
+ * compatibility class, `add()` both registers the route and
423
+ * returns the variables in the path pattern. In
424
+ * `@fedify/uri-template`, these two responsibilities are split:
425
+ * `router.add(template, name)` registers the route and returns
426
+ * `void`, while the pure static method
427
+ * `Router.variables(template)` returns the variable names. To
428
+ * migrate, call `Router.variables(template)` when variables are
429
+ * needed, then call `router.add(template, name)` to register the
430
+ * route.
431
+ */
432
+ add(template, name) {
433
+ return convertRouterError(() => {
434
+ assertPath(template);
435
+ this.#router.add(template, name);
436
+ return Router$1.variables(template);
437
+ });
438
+ }
439
+ /**
440
+ * Resolves a path name and values from a URL, if any match.
441
+ * @param url The URL to resolve.
442
+ * @returns The name of the path and its values, if any match. Otherwise,
443
+ * `null`.
444
+ * @deprecated Use `Router` from `@fedify/uri-template` instead. Unlike the
445
+ * stricter `@fedify/uri-template` router, this compatibility
446
+ * method keeps the old Fedify 2.x contract of returning `null`
447
+ * (rather than throwing) for inputs that are not router paths.
448
+ */
449
+ route(url) {
450
+ return convertRouterError(() => {
451
+ if (!isPath(url)) return null;
452
+ return this.#router.route(url);
453
+ });
454
+ }
455
+ /**
456
+ * Constructs a URL/path from a path name and values.
457
+ * @param name The name of the path.
458
+ * @param values The values to expand the path with.
459
+ * @returns The URL/path, if the name exists. Otherwise, `null`.
460
+ * @deprecated Use `Router` from `@fedify/uri-template` instead.
461
+ */
462
+ build(name, values) {
463
+ return convertRouterError(() => this.#router.build(name, values));
464
+ }
465
+ };
466
+ /**
467
+ * An error thrown by the {@link Router}.
468
+ * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
469
+ */
470
+ var RouterError = class extends RouterError$1 {
471
+ /**
472
+ * Treats every `RouterError` from `@fedify/uri-template` as an instance of
473
+ * this deprecated class.
474
+ *
475
+ * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
476
+ */
477
+ static [Symbol.hasInstance](instance) {
478
+ return instance instanceof RouterError$1;
479
+ }
480
+ /**
481
+ * Create a new {@link RouterError}.
482
+ * @param message The error message.
483
+ * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
484
+ */
485
+ constructor(message) {
486
+ super(message);
487
+ warnDeprecated();
488
+ }
489
+ };
490
+ function convertRouterError(func) {
491
+ try {
492
+ warnDeprecated();
493
+ return func();
494
+ } catch (error) {
495
+ if (error instanceof RouterError$1) throw new RouterError(error.message);
496
+ throw error;
497
+ }
498
+ }
499
+ //#endregion
348
500
  export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, SendActivityError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,12 +1,12 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { n as assertGreater } from "../std__assert-BTEgfoJo.mjs";
6
- import { n as assertGreaterOrEqual, r as assertFalse } from "../assert_rejects-DQP-q39h.mjs";
7
- import { t as assert } from "../assert-DikXweDx.mjs";
8
- import { delay } from "es-toolkit";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import { n as assertGreater } from "../std__assert-BBjXFNOb.mjs";
6
+ import { n as assertGreaterOrEqual, r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as assert } from "../assert-OguE97r2.mjs";
9
8
  import { test } from "@fedify/fixture";
9
+ import { delay } from "es-toolkit";
10
10
  //#region src/federation/mq.ts
11
11
  /**
12
12
  * A message queue that processes messages in the same process.
@@ -1,10 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import "../std__assert-BTEgfoJo.mjs";
5
- import { r as assertFalse } from "../assert_rejects-DQP-q39h.mjs";
6
- import { t as assert } from "../assert-DikXweDx.mjs";
7
- import { t as acceptsJsonLd } from "../negotiation-DDstyBvc.mjs";
4
+ import "../std__assert-BBjXFNOb.mjs";
5
+ import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
6
+ import { t as assert } from "../assert-OguE97r2.mjs";
7
+ import { t as acceptsJsonLd } from "../negotiation-CDW-_gUU.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/negotiation.test.ts
10
10
  test("acceptsJsonLd()", () => {
@@ -1,9 +1,9 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError, t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
6
- import { t as createExponentialBackoffPolicy } from "../retry-_VvV0h9f.mjs";
4
+ import { l as AssertionError, t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
6
+ import { t as createExponentialBackoffPolicy } from "../retry-v_sGLH1d.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  //#region src/federation/retry.test.ts
9
9
  test("createExponentialBackoffPolicy()", () => {
@@ -1,16 +1,167 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as RouterError, t as Router } from "../router-BT_F5748.mjs";
5
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import "../std__assert-BTEgfoJo.mjs";
7
- import { r as assertFalse } from "../assert_rejects-DQP-q39h.mjs";
8
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
9
- import { t as assert } from "../assert-DikXweDx.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import "../std__assert-BBjXFNOb.mjs";
6
+ import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
8
+ import { t as assert } from "../assert-OguE97r2.mjs";
9
+ import { getLogger } from "@logtape/logtape";
10
+ import { Router, RouterError, assertPath, isPath } from "@fedify/uri-template";
10
11
  import { test } from "@fedify/fixture";
12
+ //#region src/federation/router.ts
13
+ const logger = getLogger([
14
+ "fedify",
15
+ "federation",
16
+ "router",
17
+ "deprecated"
18
+ ]);
19
+ let deprecationWarned = false;
20
+ function warnDeprecated() {
21
+ if (deprecationWarned) return;
22
+ deprecationWarned = true;
23
+ logger.warn("The `Router` and `RouterError` classes from `@fedify/fedify` are deprecated. Please use `Router` from `@fedify/uri-template` instead.");
24
+ }
25
+ /**
26
+ * URL router and constructor based on URI Template
27
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
28
+ *
29
+ * @deprecated Import `Router` from `@fedify/uri-template` instead. This class
30
+ * remains only for compatibility with older Fedify code. The
31
+ * `@fedify/uri-template` router is the replacement implementation
32
+ * and should be used directly in new code.
33
+ */
34
+ var Router$1 = class Router$1 {
35
+ #router;
36
+ /**
37
+ * Create a new {@link Router}.
38
+ * @param options Options for the router.
39
+ * @deprecated Use `new Router(options)` from `@fedify/uri-template`
40
+ * instead.
41
+ */
42
+ constructor(options) {
43
+ this.#router = convertRouterError(() => new Router(options));
44
+ }
45
+ /**
46
+ * Whether to ignore trailing slashes when matching paths.
47
+ * @deprecated Use `Router` from `@fedify/uri-template` instead. This
48
+ * accessor forwards to the underlying `@fedify/uri-template`
49
+ * router so that post-construction mutation keeps working as
50
+ * in older Fedify code.
51
+ */
52
+ get trailingSlashInsensitive() {
53
+ return this.#router.trailingSlashInsensitive;
54
+ }
55
+ set trailingSlashInsensitive(value) {
56
+ this.#router.trailingSlashInsensitive = value;
57
+ }
58
+ /**
59
+ * Clones this router.
60
+ * @deprecated Use `Router` from `@fedify/uri-template` instead.
61
+ */
62
+ clone() {
63
+ return convertRouterError(() => {
64
+ const clone = new Router$1();
65
+ clone.#router = this.#router.clone();
66
+ return clone;
67
+ });
68
+ }
69
+ /**
70
+ * Checks if a path name exists in the router.
71
+ * @param name The name of the path.
72
+ * @returns `true` if the path name exists, otherwise `false`.
73
+ * @deprecated Use `Router` from `@fedify/uri-template` instead.
74
+ */
75
+ has(name) {
76
+ return convertRouterError(() => this.#router.has(name));
77
+ }
78
+ /**
79
+ * Adds a new path rule to the router.
80
+ * @param template The path pattern.
81
+ * @param name The name of the path.
82
+ * @returns The names of the variables in the path pattern.
83
+ * @deprecated Use `Router` from `@fedify/uri-template` instead. In this
84
+ * compatibility class, `add()` both registers the route and
85
+ * returns the variables in the path pattern. In
86
+ * `@fedify/uri-template`, these two responsibilities are split:
87
+ * `router.add(template, name)` registers the route and returns
88
+ * `void`, while the pure static method
89
+ * `Router.variables(template)` returns the variable names. To
90
+ * migrate, call `Router.variables(template)` when variables are
91
+ * needed, then call `router.add(template, name)` to register the
92
+ * route.
93
+ */
94
+ add(template, name) {
95
+ return convertRouterError(() => {
96
+ assertPath(template);
97
+ this.#router.add(template, name);
98
+ return Router.variables(template);
99
+ });
100
+ }
101
+ /**
102
+ * Resolves a path name and values from a URL, if any match.
103
+ * @param url The URL to resolve.
104
+ * @returns The name of the path and its values, if any match. Otherwise,
105
+ * `null`.
106
+ * @deprecated Use `Router` from `@fedify/uri-template` instead. Unlike the
107
+ * stricter `@fedify/uri-template` router, this compatibility
108
+ * method keeps the old Fedify 2.x contract of returning `null`
109
+ * (rather than throwing) for inputs that are not router paths.
110
+ */
111
+ route(url) {
112
+ return convertRouterError(() => {
113
+ if (!isPath(url)) return null;
114
+ return this.#router.route(url);
115
+ });
116
+ }
117
+ /**
118
+ * Constructs a URL/path from a path name and values.
119
+ * @param name The name of the path.
120
+ * @param values The values to expand the path with.
121
+ * @returns The URL/path, if the name exists. Otherwise, `null`.
122
+ * @deprecated Use `Router` from `@fedify/uri-template` instead.
123
+ */
124
+ build(name, values) {
125
+ return convertRouterError(() => this.#router.build(name, values));
126
+ }
127
+ };
128
+ /**
129
+ * An error thrown by the {@link Router}.
130
+ * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
131
+ */
132
+ var RouterError$1 = class extends RouterError {
133
+ /**
134
+ * Treats every `RouterError` from `@fedify/uri-template` as an instance of
135
+ * this deprecated class.
136
+ *
137
+ * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
138
+ */
139
+ static [Symbol.hasInstance](instance) {
140
+ return instance instanceof RouterError;
141
+ }
142
+ /**
143
+ * Create a new {@link RouterError}.
144
+ * @param message The error message.
145
+ * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
146
+ */
147
+ constructor(message) {
148
+ super(message);
149
+ warnDeprecated();
150
+ }
151
+ };
152
+ function convertRouterError(func) {
153
+ try {
154
+ warnDeprecated();
155
+ return func();
156
+ } catch (error) {
157
+ if (error instanceof RouterError) throw new RouterError$1(error.message);
158
+ throw error;
159
+ }
160
+ }
161
+ //#endregion
11
162
  //#region src/federation/router.test.ts
12
163
  function setUp(options = {}) {
13
- const router = new Router(options);
164
+ const router = new Router$1(options);
14
165
  router.add("/users/{name}", "user");
15
166
  router.add("/users/{name}/posts/{postId}" + (options.trailingSlashInsensitive ? "/" : ""), "post");
16
167
  return router;
@@ -29,11 +180,11 @@ test("Router.clone()", () => {
29
180
  assertEquals(original.route("/users/alice/friends"), null);
30
181
  });
31
182
  test("Router.add()", () => {
32
- const router = new Router();
183
+ const router = new Router$1();
33
184
  assertEquals(router.add("/users", "users"), /* @__PURE__ */ new Set());
34
185
  assertEquals(router.add("/users/{name}", "user"), new Set(["name"]));
35
186
  assertEquals(router.add("/users/{name}/posts/{postId}", "post"), new Set(["name", "postId"]));
36
- assertThrows(() => router.add("foo", "name"), RouterError);
187
+ assertThrows(() => router.add("foo", "name"), RouterError$1);
37
188
  });
38
189
  test("Router.route()", () => {
39
190
  let router = setUp();
@@ -80,6 +231,21 @@ test("Router.route()", () => {
80
231
  }
81
232
  });
82
233
  });
234
+ test("Router.trailingSlashInsensitive (post-construction mutation)", () => {
235
+ const router = setUp();
236
+ assertFalse(router.trailingSlashInsensitive);
237
+ assertEquals(router.route("/users/bob/"), null);
238
+ router.trailingSlashInsensitive = true;
239
+ assert(router.trailingSlashInsensitive);
240
+ assertEquals(router.route("/users/bob/"), {
241
+ name: "user",
242
+ template: "/users/{name}",
243
+ values: { name: "bob" }
244
+ });
245
+ router.trailingSlashInsensitive = false;
246
+ assertFalse(router.trailingSlashInsensitive);
247
+ assertEquals(router.route("/users/bob/"), null);
248
+ });
83
249
  test("Router.build()", () => {
84
250
  const router = setUp();
85
251
  assertEquals(router.build("user", { name: "alice" }), "/users/alice");
@@ -88,5 +254,20 @@ test("Router.build()", () => {
88
254
  postId: "123"
89
255
  }), "/users/alice/posts/123");
90
256
  });
257
+ test("Router.route() returns null for non-path inputs", () => {
258
+ const router = setUp();
259
+ assertEquals(router.route("https://example.com/users/alice"), null);
260
+ assertEquals(router.route("users/alice"), null);
261
+ assertEquals(router.route("not a path"), null);
262
+ assertEquals(router.route("/unknown"), null);
263
+ });
264
+ test("Compatibility between RouterErrors", () => {
265
+ const newError = new RouterError("boom");
266
+ assert(newError instanceof RouterError);
267
+ assert(newError instanceof RouterError$1);
268
+ const previousError = new RouterError$1("boom");
269
+ assert(previousError instanceof RouterError$1);
270
+ assert(previousError instanceof RouterError);
271
+ });
91
272
  //#endregion
92
273
  export {};
@@ -2,17 +2,17 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, r as __toESM, t as __commonJSMin } from "../chunk-DNRtMIoB.mjs";
5
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import "../std__assert-BTEgfoJo.mjs";
7
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
8
- import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
9
- import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
10
- import { t as assert } from "../assert-DikXweDx.mjs";
11
- import { t as esm_default } from "../esm-sdtqOUPu.mjs";
12
- import { l as verifyRequest } from "../http-IywnQdiX.mjs";
13
- import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
14
- import { t as doesActorOwnKey } from "../owner-CIt4hvmM.mjs";
15
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-DJFpze7B.mjs";
5
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
+ import "../std__assert-BBjXFNOb.mjs";
7
+ import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
8
+ import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
9
+ import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
10
+ import { t as assert } from "../assert-OguE97r2.mjs";
11
+ import { t as esm_default } from "../esm-BQRw925N.mjs";
12
+ import { l as verifyRequest } from "../http-Cyx5SNuu.mjs";
13
+ import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
14
+ import { t as doesActorOwnKey } from "../owner-nmXdvXpc.mjs";
15
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-DvX2tYyZ.mjs";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
18
  //#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationTemporality.js
@@ -2525,19 +2525,19 @@ var require_getMachineId = /* @__PURE__ */ __commonJSMin(((exports) => {
2525
2525
  async function getMachineId() {
2526
2526
  if (!getMachineIdImpl) switch (process$1.platform) {
2527
2527
  case "darwin":
2528
- getMachineIdImpl = (await import("../getMachineId-darwin-Dr1gkBkp.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2528
+ getMachineIdImpl = (await import("../getMachineId-darwin-D23zTf4g.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2529
2529
  break;
2530
2530
  case "linux":
2531
- getMachineIdImpl = (await import("../getMachineId-linux-Bbhofx-s.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2531
+ getMachineIdImpl = (await import("../getMachineId-linux-ObI47Hql.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2532
2532
  break;
2533
2533
  case "freebsd":
2534
- getMachineIdImpl = (await import("../getMachineId-bsd-BY01PL1n.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2534
+ getMachineIdImpl = (await import("../getMachineId-bsd-etIyxDet.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2535
2535
  break;
2536
2536
  case "win32":
2537
- getMachineIdImpl = (await import("../getMachineId-win-QEYwcJiy.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2537
+ getMachineIdImpl = (await import("../getMachineId-win-Dpap6v5i.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2538
2538
  break;
2539
2539
  default:
2540
- getMachineIdImpl = (await import("../getMachineId-unsupported-dIOte2Ct.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2540
+ getMachineIdImpl = (await import("../getMachineId-unsupported-Ddu-PFeh.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2541
2541
  break;
2542
2542
  }
2543
2543
  return getMachineIdImpl();
@@ -1,11 +1,11 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { r as createRequestContext } from "../context-BAE7AKLA.mjs";
5
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import "../std__assert-BTEgfoJo.mjs";
7
- import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
8
- import { o as createFederation, s as handleWebFinger } from "../middleware-BB0IbDow.mjs";
4
+ import { r as createRequestContext } from "../context-DVoTs_wM.mjs";
5
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
+ import "../std__assert-BBjXFNOb.mjs";
7
+ import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
8
+ import { o as createFederation, s as handleWebFinger } from "../middleware-DQEgdr83.mjs";
9
9
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
10
10
  import { test } from "@fedify/fixture";
11
11
  //#region src/federation/webfinger.test.ts
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
- import { t as require_execAsync } from "./execAsync-Dxb7rNf3.mjs";
5
+ import { t as require_execAsync } from "./execAsync-DCBrgFiV.mjs";
6
6
  //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js
7
7
  var require_getMachineId_bsd = /* @__PURE__ */ __commonJSMin(((exports) => {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
- import { t as require_execAsync } from "./execAsync-Dxb7rNf3.mjs";
5
+ import { t as require_execAsync } from "./execAsync-DCBrgFiV.mjs";
6
6
  //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js
7
7
  var require_getMachineId_darwin = /* @__PURE__ */ __commonJSMin(((exports) => {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
- import { t as require_execAsync } from "./execAsync-Dxb7rNf3.mjs";
5
+ import { t as require_execAsync } from "./execAsync-DCBrgFiV.mjs";
6
6
  //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-win.js
7
7
  var require_getMachineId_win = /* @__PURE__ */ __commonJSMin(((exports) => {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
10
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.3.0-dev.1131+553b59b8";
13
+ var version = "2.3.0-dev.1137+53a1f26d";
14
14
  //#endregion
15
15
  //#region src/sig/accept.ts
16
16
  /**
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
11
11
  let byte_encodings_base64 = require("byte-encodings/base64");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.3.0-dev.1131+553b59b8";
14
+ var version = "2.3.0-dev.1137+53a1f26d";
15
15
  //#endregion
16
16
  //#region src/sig/accept.ts
17
17
  /**
@@ -1,10 +1,10 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno--CS-SBS9.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-BTOMkW8C.mjs";
6
- import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CgDcxvjV.mjs";
7
- import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-Df3tMleh.mjs";
4
+ import { n as version, t as name } from "./deno-B_9yJW3w.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-iRBg8jTk.mjs";
6
+ import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CceiKpCy.mjs";
7
+ import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-CkkMJBjF.mjs";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { CryptographicKey } from "@fedify/vocab";
10
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno--CS-SBS9.mjs";
5
- import { f as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-BTOMkW8C.mjs";
4
+ import { n as version, t as name } from "./deno-B_9yJW3w.mjs";
5
+ import { f as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-iRBg8jTk.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { d as validateCryptoKey, t as doubleKnock, v as recordDocumentCache } from "./http-cqujdCRz.js";
3
+ import { d as validateCryptoKey, t as doubleKnock, v as recordDocumentCache } from "./http-CToqG5ap.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-CJfvRL7D.cjs");
4
+ const require_http = require("./http-CWoeyogl.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as recordDocumentCache } from "./metrics-BTOMkW8C.mjs";
4
+ import { c as recordDocumentCache } from "./metrics-iRBg8jTk.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
7
  //#region src/utils/kv-cache.ts
@@ -1,9 +1,9 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno--CS-SBS9.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-BTOMkW8C.mjs";
6
- import { n as fetchKey, o as validateCryptoKey } from "./key-Df3tMleh.mjs";
4
+ import { n as version, t as name } from "./deno-B_9yJW3w.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-iRBg8jTk.mjs";
6
+ import { n as fetchKey, o as validateCryptoKey } from "./key-CkkMJBjF.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno--CS-SBS9.mjs";
4
+ import { n as version, t as name } from "./deno-B_9yJW3w.mjs";
5
5
  import { metrics } from "@opentelemetry/api";
6
6
  import { FetchError } from "@fedify/vocab-runtime";
7
7
  //#region src/federation/metrics.ts