@fedify/fedify 2.4.0-dev.2071 → 2.4.0-dev.2073

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 (83) hide show
  1. package/dist/{builder-DVQ0yhKJ.mjs → builder-CVHpPAjK.mjs} +2 -2
  2. package/dist/compat/mod.d.cts +1 -1
  3. package/dist/compat/mod.d.ts +1 -1
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{compound-proof-KmXDfWFp.mjs → compound-proof-B5Skp-vE.mjs} +1 -1
  6. package/dist/{context-DsB9kF6q.d.ts → context-BSywYspi.d.ts} +109 -1
  7. package/dist/{context-DijrgHDe.d.cts → context-CZjZYXFC.d.cts} +109 -1
  8. package/dist/{context-DG5QeQ8W.mjs → context-DlZhxdFT.mjs} +2 -1
  9. package/dist/{deno-B-NtYZVW.mjs → deno-LYTbBhYV.mjs} +1 -1
  10. package/dist/{docloader-C6yOVoaF.mjs → docloader-C0SWQylk.mjs} +2 -2
  11. package/dist/federation/builder.test.mjs +1 -1
  12. package/dist/federation/compound-fanout.test.mjs +3 -3
  13. package/dist/federation/handler-compound-proof.test.mjs +4 -4
  14. package/dist/federation/handler.test.mjs +6 -6
  15. package/dist/federation/hashlink-media.test.mjs +2 -2
  16. package/dist/federation/idempotency.test.mjs +2 -2
  17. package/dist/federation/metrics.test.mjs +1 -1
  18. package/dist/federation/middleware.test.mjs +8 -8
  19. package/dist/federation/mod.cjs +1 -1
  20. package/dist/federation/mod.d.cts +3 -3
  21. package/dist/federation/mod.d.ts +3 -3
  22. package/dist/federation/mod.js +1 -1
  23. package/dist/federation/outgoing-proof.test.mjs +5 -5
  24. package/dist/federation/portable-gateway-keys.test.mjs +4 -4
  25. package/dist/federation/portable-inbox.test.d.mts +2 -0
  26. package/dist/federation/portable-inbox.test.mjs +546 -0
  27. package/dist/federation/portable.test.mjs +3 -3
  28. package/dist/federation/send.test.mjs +3 -3
  29. package/dist/federation/tasks/enqueue.test.mjs +2 -2
  30. package/dist/federation/tasks/tasks.test.mjs +3 -3
  31. package/dist/federation/temporal.test.mjs +1 -1
  32. package/dist/federation/webfinger.test.mjs +2 -2
  33. package/dist/{federation-CUiHc7dP.cjs → federation-B1aeTKKN.cjs} +468 -88
  34. package/dist/{http-DKWi8RjI.mjs → http-C7qHlv-b.mjs} +4 -4
  35. package/dist/{http-CuLWIJdf.cjs → http-DGk8XI38.cjs} +1 -1
  36. package/dist/{http-BoWBwC0g.js → http-vfTpzGEq.js} +1 -1
  37. package/dist/{key-lfcx_NaE.mjs → key-BYXnTGro.mjs} +2 -2
  38. package/dist/{kv-cache-BdnmnAVc.js → kv-cache-DCJuwdnB.js} +1 -1
  39. package/dist/{kv-cache-d8EjO29d.mjs → kv-cache-DEH5jyND.mjs} +1 -1
  40. package/dist/{kv-cache-DE8kSNQU.cjs → kv-cache-DvqkKNIj.cjs} +1 -1
  41. package/dist/{ld-jyjdrWjG.mjs → ld-DT3e2hOv.mjs} +3 -3
  42. package/dist/{metrics-B5Rei-HC.mjs → metrics-DvlvYpq_.mjs} +1 -1
  43. package/dist/{middleware-CdVnCDXD.mjs → middleware-BJcez_E3.mjs} +1 -1
  44. package/dist/{middleware-CAObohey.js → middleware-CCbyUF4c.js} +417 -38
  45. package/dist/{middleware-CPx4ZWwt.mjs → middleware-CpyCNOW_.mjs} +423 -48
  46. package/dist/{mod-DMkflQdF.d.ts → mod-B2h2KY0q.d.ts} +1 -1
  47. package/dist/{mod-DTAaBwiY.d.cts → mod-JzkaEXsi.d.cts} +1 -1
  48. package/dist/mod.cjs +5 -5
  49. package/dist/mod.d.cts +4 -4
  50. package/dist/mod.d.ts +4 -4
  51. package/dist/mod.js +5 -5
  52. package/dist/nodeinfo/handler.test.mjs +2 -2
  53. package/dist/{owner-ByqNQVaa.mjs → owner-CDsVeZI7.mjs} +3 -3
  54. package/dist/{owner-BXufwAzm.cjs → owner-DCIH7Iq0.cjs} +1 -1
  55. package/dist/{owner-1TFakcTF.js → owner-DfGz0cXm.js} +1 -1
  56. package/dist/{portable-key-Cw_ow5vn.mjs → portable-key-DCyKGCQd.mjs} +2 -2
  57. package/dist/{proof-B6gwdhN5.mjs → proof-CxsVG6vM.mjs} +4 -4
  58. package/dist/{send-DsK7xevO.mjs → send-BZJ7NsVV.mjs} +8 -4
  59. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  60. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  61. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  62. package/dist/sig/compound-proof.test.mjs +2 -2
  63. package/dist/sig/http.test.mjs +2 -2
  64. package/dist/sig/key.test.mjs +1 -1
  65. package/dist/sig/ld.test.mjs +2 -2
  66. package/dist/sig/mod.cjs +3 -3
  67. package/dist/sig/mod.js +3 -3
  68. package/dist/sig/owner.test.mjs +1 -1
  69. package/dist/sig/portable-collection.test.mjs +2 -2
  70. package/dist/sig/portable-key.test.mjs +3 -3
  71. package/dist/sig/proof.test.mjs +3 -3
  72. package/dist/{sig-TTn9wYrE.cjs → sig-C6TnADze.cjs} +2 -2
  73. package/dist/{sig-BR_Z6mpY.js → sig-Cs9_ecdh.js} +2 -2
  74. package/dist/{temporal-Bw5jtrBY.mjs → temporal-CLzSfIOV.mjs} +1 -1
  75. package/dist/testing/kv.test.mjs +1 -1
  76. package/dist/testing/mod.d.mts +108 -0
  77. package/dist/testing/mod.mjs +2 -2
  78. package/dist/{testing-By1YYsIK.mjs → testing-CO_cEvQc.mjs} +1 -1
  79. package/dist/utils/docloader.test.mjs +2 -2
  80. package/dist/utils/kv-cache.test.mjs +1 -1
  81. package/dist/utils/mod.cjs +1 -1
  82. package/dist/utils/mod.js +1 -1
  83. package/package.json +6 -6
@@ -1418,6 +1418,16 @@ interface FederationKvPrefixes {
1418
1418
  * @since 2.4.0
1419
1419
  */
1420
1420
  readonly taskDeduplication: KvKey;
1421
+ /**
1422
+ * The key prefix used for remembering which activities received in
1423
+ * [FEP-ef61] portable inboxes have been forwarded to which gateways, so that
1424
+ * each activity is forwarded at most once.
1425
+ *
1426
+ * [FEP-ef61]: https://w3id.org/fep/ef61
1427
+ * @default `["_fedify", "portableInboxForwarding"]`
1428
+ * @since 2.4.0
1429
+ */
1430
+ readonly portableInboxForwarding: KvKey;
1421
1431
  }
1422
1432
  /**
1423
1433
  * Options for {@link FederationOptions.origin} when it is not a string.
@@ -1996,6 +2006,44 @@ interface Federation<TContextData> extends Federatable<TContextData> {
1996
2006
  */
1997
2007
  fetch(request: Request, options: FederationFetchOptions<TContextData>): Promise<Response>;
1998
2008
  }
2009
+ /**
2010
+ * Options for forwarding activities received in [FEP-ef61] portable inboxes to
2011
+ * the other gateways of their actors. See
2012
+ * {@link FederationOptions.portableInboxForwarding}.
2013
+ *
2014
+ * [FEP-ef61]: https://w3id.org/fep/ef61
2015
+ * @since 2.4.0
2016
+ */
2017
+ interface PortableInboxForwardingOptions {
2018
+ /**
2019
+ * The maximum number of other gateways that a single delivery is forwarded
2020
+ * to. Gateways beyond it are skipped with a warning. `0` turns off
2021
+ * forwarding.
2022
+ * @default `10`
2023
+ */
2024
+ maxTargets?: number;
2025
+ /**
2026
+ * How long Fedify remembers that it has forwarded an activity from
2027
+ * a portable inbox to a gateway, under
2028
+ * {@link FederationKvPrefixes.portableInboxForwarding}. Within it, the same
2029
+ * activity is never forwarded to the same gateway again; once it expires,
2030
+ * a redelivery of the activity may be forwarded again. It cannot have
2031
+ * calendar units, i.e., weeks, months, or years.
2032
+ * @default `{ days: 30 }`
2033
+ */
2034
+ ttl?: Temporal.DurationLike;
2035
+ /**
2036
+ * How long a delivery waits for forwarding requests made immediately, i.e.,
2037
+ * when no outbox queue is configured, before Fedify responds to it.
2038
+ * Requests still running afterwards continue in the background. It does
2039
+ * not apply when forwarding is queued. It cannot have calendar units,
2040
+ * i.e., weeks, months, or years, and cannot be longer than
2041
+ * 2,147,483,647 milliseconds (about 24.8 days), the longest delay timers
2042
+ * support.
2043
+ * @default `{ seconds: 10 }`
2044
+ */
2045
+ deadline?: Temporal.DurationLike;
2046
+ }
1999
2047
  /**
2000
2048
  * Policy for emitting `Accept-Signature` challenges on inbox `401`
2001
2049
  * responses, as defined in
@@ -2090,6 +2138,14 @@ interface FederationOptions<TContextData> {
2090
2138
  * @since 2.4.0
2091
2139
  */
2092
2140
  httpMessageSignaturesSpecTtl?: Temporal.DurationLike;
2141
+ /**
2142
+ * Options for forwarding activities received in [FEP-ef61] portable inboxes
2143
+ * to the other gateways of their actors.
2144
+ *
2145
+ * [FEP-ef61]: https://w3id.org/fep/ef61
2146
+ * @since 2.4.0
2147
+ */
2148
+ portableInboxForwarding?: PortableInboxForwardingOptions;
2093
2149
  /**
2094
2150
  * The message queue for sending and receiving activities. If not provided,
2095
2151
  * activities will not be queued and will be processed immediately.
@@ -2873,6 +2929,35 @@ interface Context<TContextData> {
2873
2929
  * @since 2.4.0
2874
2930
  */
2875
2931
  getPortableObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, authority: string): URL;
2932
+ /**
2933
+ * Builds the [FEP-ef61] portable ID of an actor's inbox with the given
2934
+ * identifier under the given DID authority.
2935
+ *
2936
+ * The path is the same as the one {@link Context.getInboxUri} builds from
2937
+ * the inbox path, but the result is an `ap+ef61:` URI whose authority is
2938
+ * the DID, e.g., `ap+ef61://did:key:z6Mk.../users/alice/inbox`. If
2939
+ * a portable actor has it as its `inbox` and lists this server in its
2940
+ * `gateways`, this server accepts deliveries to the inbox through
2941
+ * the FEP-ef61 gateway endpoint, e.g.,
2942
+ * `POST /.well-known/apgateway/did:key:z6Mk.../users/alice/inbox`, and
2943
+ * dispatches them to the inbox listeners.
2944
+ *
2945
+ * The returned `URL` keeps the DID authority percent-encoded, because
2946
+ * the `URL` class cannot represent the canonical form. Use `formatIri()`
2947
+ * from `@fedify/vocab-runtime` to get the canonical string.
2948
+ *
2949
+ * [FEP-ef61]: https://w3id.org/fep/ef61
2950
+ *
2951
+ * @param identifier The actor's identifier.
2952
+ * @param authority The DID that controls the actor, e.g.,
2953
+ * `did:key:z6Mk...`. It must be a bare DID, without
2954
+ * a path, query, or fragment.
2955
+ * @returns The inbox's portable ID.
2956
+ * @throws {RouterError} If no inbox path is registered.
2957
+ * @throws {TypeError} If the authority is not a DID.
2958
+ * @since 2.4.0
2959
+ */
2960
+ getPortableInboxUri(identifier: string, authority: string): URL;
2876
2961
  /**
2877
2962
  * Builds the URI of an actor's outbox with the given identifier.
2878
2963
  * @param identifier The actor's identifier.
@@ -3287,6 +3372,29 @@ interface RequestContext<TContextData> extends Context<TContextData> {
3287
3372
  * @since 2.4.0
3288
3373
  */
3289
3374
  getPortableObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, authority?: string): URL;
3375
+ /**
3376
+ * Builds the [FEP-ef61] portable ID of an actor's inbox with the given
3377
+ * identifier. It works the same as {@link Context.getPortableInboxUri},
3378
+ * except that the authority can be omitted while handling a portable object
3379
+ * request, i.e., when {@link RequestContext.portableRequest} is set. In
3380
+ * that case, its DID is used. Deliveries to portable inboxes do not set
3381
+ * {@link RequestContext.portableRequest}, so pass the authority explicitly
3382
+ * while handling them.
3383
+ *
3384
+ * [FEP-ef61]: https://w3id.org/fep/ef61
3385
+ *
3386
+ * @param identifier The actor's identifier.
3387
+ * @param authority The DID that controls the actor, e.g.,
3388
+ * `did:key:z6Mk...`. It must be a bare DID, without
3389
+ * a path, query, or fragment. Defaults to the DID of
3390
+ * the requested portable object, if any.
3391
+ * @returns The inbox's portable ID.
3392
+ * @throws {RouterError} If no inbox path is registered.
3393
+ * @throws {TypeError} If the authority is not a DID, or the authority is
3394
+ * omitted outside a portable gateway request.
3395
+ * @since 2.4.0
3396
+ */
3397
+ getPortableInboxUri(identifier: string, authority?: string): URL;
3290
3398
  /**
3291
3399
  * Creates a new context with the same properties as this one,
3292
3400
  * but with the given data.
@@ -2,8 +2,8 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { r as testDefinitions } from "../dist-BQvArojP.mjs";
5
- import { n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-DG5QeQ8W.mjs";
5
+ import { n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-DlZhxdFT.mjs";
6
6
  import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
7
7
  import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, r as envelopeSchema, t as MockQueue } from "../tasks-dbCShlCb.mjs";
8
- import "../testing-By1YYsIK.mjs";
8
+ import "../testing-CO_cEvQc.mjs";
9
9
  export { ManualClockKvStore, MockQueue, baseOptions, createInboxContext, createOutboxContext, createRequestContext, envelopeSchema, makeSchema, numberSchema, stringSchema, testDefinitions };
@@ -2,7 +2,7 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import "./dist-BQvArojP.mjs";
5
- import "./context-DG5QeQ8W.mjs";
5
+ import "./context-DlZhxdFT.mjs";
6
6
  import "./kv-DBRWVx3Q.mjs";
7
7
  import "./tasks-dbCShlCb.mjs";
8
8
  export {};
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
8
- import { l as verifyRequest } from "../http-DKWi8RjI.mjs";
8
+ import { l as verifyRequest } from "../http-C7qHlv-b.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-DIJNHW-Y.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-C6yOVoaF.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-C0SWQylk.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
13
13
  //#region src/utils/docloader.test.ts
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as kvCache, t as MockKvStore } from "../kv-cache-d8EjO29d.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-DEH5jyND.mjs";
5
5
  import { deepStrictEqual, throws } from "node:assert";
6
6
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
7
7
  import { preloadedContexts } from "@fedify/vocab-runtime";
@@ -1,5 +1,5 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_kv_cache = require("../kv-cache-DE8kSNQU.cjs");
3
+ const require_kv_cache = require("../kv-cache-DvqkKNIj.cjs");
4
4
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
5
5
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-BdnmnAVc.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DCJuwdnB.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.4.0-dev.2071+8b9dccb9",
3
+ "version": "2.4.0-dev.2073+2152dfc6",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -151,10 +151,10 @@
151
151
  "structured-field-values": "^2.0.4",
152
152
  "temporal-polyfill": "^1.0.1",
153
153
  "urlpattern-polyfill": "^10.1.0",
154
- "@fedify/uri-template": "2.4.0-dev.2071+8b9dccb9",
155
- "@fedify/vocab": "2.4.0-dev.2071+8b9dccb9",
156
- "@fedify/vocab-runtime": "2.4.0-dev.2071+8b9dccb9",
157
- "@fedify/webfinger": "2.4.0-dev.2071+8b9dccb9"
154
+ "@fedify/uri-template": "2.4.0-dev.2073+2152dfc6",
155
+ "@fedify/vocab": "2.4.0-dev.2073+2152dfc6",
156
+ "@fedify/webfinger": "2.4.0-dev.2073+2152dfc6",
157
+ "@fedify/vocab-runtime": "2.4.0-dev.2073+2152dfc6"
158
158
  },
159
159
  "devDependencies": {
160
160
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -167,7 +167,7 @@
167
167
  "typescript": "^6.0.0",
168
168
  "wrangler": "^4.17.0",
169
169
  "@fedify/fixture": "2.0.0",
170
- "@fedify/vocab-tools": "^2.4.0-dev.2071+8b9dccb9"
170
+ "@fedify/vocab-tools": "^2.4.0-dev.2073+2152dfc6"
171
171
  },
172
172
  "scripts": {
173
173
  "build:self": "tsdown",