@fedify/fedify 2.4.0-dev.1951 → 2.4.0-dev.1962

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 (70) hide show
  1. package/README.md +2 -0
  2. package/dist/{builder-P44yYQ5Z.mjs → builder-CWYQXC2W.mjs} +2 -2
  3. package/dist/compat/mod.d.cts +1 -1
  4. package/dist/compat/mod.d.ts +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/{context-BOnn653X.d.cts → context-COLwHogJ.d.cts} +27 -0
  7. package/dist/{context-CmjP-cgJ.d.ts → context-DiiCt4S7.d.ts} +27 -0
  8. package/dist/{deno-U6Pe1U6h.mjs → deno-CfLMX4HF.mjs} +1 -1
  9. package/dist/{docloader-DantBD_9.mjs → docloader-CDmmYxYb.mjs} +2 -2
  10. package/dist/federation/builder.test.mjs +1 -1
  11. package/dist/federation/handler.test.mjs +3 -3
  12. package/dist/federation/idempotency.test.mjs +2 -2
  13. package/dist/federation/keycache.test.mjs +30 -4
  14. package/dist/federation/metrics.test.mjs +1 -1
  15. package/dist/federation/middleware.test.mjs +195 -8
  16. package/dist/federation/mod.cjs +1 -1
  17. package/dist/federation/mod.d.cts +2 -2
  18. package/dist/federation/mod.d.ts +2 -2
  19. package/dist/federation/mod.js +1 -1
  20. package/dist/federation/send.test.mjs +3 -3
  21. package/dist/federation/tasks/enqueue.test.mjs +3 -2
  22. package/dist/federation/tasks/tasks.test.mjs +4 -3
  23. package/dist/federation/temporal.test.mjs +1 -1
  24. package/dist/federation/webfinger.test.mjs +1 -1
  25. package/dist/{federation-BAtfz-C3.cjs → federation-CIeDMHxZ.cjs} +32 -13
  26. package/dist/{http-Cssq59HU.mjs → http-BR190IDB.mjs} +3 -3
  27. package/dist/{http-BTD1L4Sv.cjs → http-C3kkrvAE.cjs} +1 -1
  28. package/dist/{http-CnBZmc4J.js → http-DWZZicb2.js} +1 -1
  29. package/dist/{key-GeKuVU-k.mjs → key-BcA-AzPp.mjs} +2 -2
  30. package/dist/{keycache-0Jk78XmB.mjs → keycache-ZLqIfrkL.mjs} +3 -1
  31. package/dist/kv-DBRWVx3Q.mjs +104 -0
  32. package/dist/{kv-cache-CMUnx7rx.js → kv-cache-5d2HgB_-.js} +1 -1
  33. package/dist/{kv-cache-D3gKJwUK.cjs → kv-cache-DCItgZUM.cjs} +1 -1
  34. package/dist/{kv-cache-CoMnysg5.mjs → kv-cache-m962_cok.mjs} +1 -1
  35. package/dist/{ld-BLl_mzo2.mjs → ld-QpPkmUjy.mjs} +3 -3
  36. package/dist/{metrics-KDlQIBxX.mjs → metrics-Dkyzq7ml.mjs} +1 -1
  37. package/dist/{middleware-aheUmEPU.js → middleware-BNktRUnj.js} +32 -13
  38. package/dist/{middleware-D-vIOT8Y.mjs → middleware-BaZ32nCi.mjs} +39 -22
  39. package/dist/{middleware-CIlcGav-.mjs → middleware-BdKtWJK1.mjs} +1 -1
  40. package/dist/{mod-kUSY5n3f.d.cts → mod-BZldCEU0.d.cts} +1 -1
  41. package/dist/{mod-BYuZ0WXt.d.ts → mod-CSH1Ee-I.d.ts} +1 -1
  42. package/dist/mod.cjs +4 -4
  43. package/dist/mod.d.cts +2 -2
  44. package/dist/mod.d.ts +2 -2
  45. package/dist/mod.js +4 -4
  46. package/dist/nodeinfo/handler.test.mjs +1 -1
  47. package/dist/{owner-C111mU7b.mjs → owner-B795xXwU.mjs} +2 -2
  48. package/dist/{proof-B_yPn2BI.cjs → proof-CYdLcTFg.cjs} +1 -1
  49. package/dist/{proof-CLZurGKe.js → proof-DrWB_vel.js} +1 -1
  50. package/dist/{proof-B_5-ezjh.mjs → proof-Mov6-gSw.mjs} +4 -4
  51. package/dist/{send-r_mRJ1qS.mjs → send-DB1mkFKO.mjs} +3 -3
  52. package/dist/sig/http.test.mjs +2 -2
  53. package/dist/sig/key.test.mjs +1 -1
  54. package/dist/sig/ld.test.mjs +2 -2
  55. package/dist/sig/mod.cjs +2 -2
  56. package/dist/sig/mod.js +2 -2
  57. package/dist/sig/owner.test.mjs +1 -1
  58. package/dist/sig/proof.test.mjs +1 -1
  59. package/dist/{testing-D13ymFKy.mjs → tasks-dbCShlCb.mjs} +0 -1
  60. package/dist/{temporal-CIBMJUty.mjs → temporal-Yi0JAV9z.mjs} +1 -1
  61. package/dist/testing/kv.test.d.mts +2 -0
  62. package/dist/testing/kv.test.mjs +101 -0
  63. package/dist/testing/mod.d.mts +70 -1
  64. package/dist/testing/mod.mjs +4 -2
  65. package/dist/testing-hbky2gMN.mjs +8 -0
  66. package/dist/utils/docloader.test.mjs +2 -2
  67. package/dist/utils/kv-cache.test.mjs +1 -1
  68. package/dist/utils/mod.cjs +1 -1
  69. package/dist/utils/mod.js +1 -1
  70. package/package.json +6 -6
@@ -1943,6 +1943,33 @@ interface FederationOptions<TContextData> {
1943
1943
  * are prefixed with `["_fedify"]`.
1944
1944
  */
1945
1945
  kvPrefixes?: Partial<FederationKvPrefixes>;
1946
+ /**
1947
+ * The time-to-live for a remote actor's public key cached under
1948
+ * {@link FederationKvPrefixes.publicKey}. Once it expires, the next
1949
+ * signature verification that needs the key refetches it from the remote
1950
+ * server and caches it again.
1951
+ *
1952
+ * Shortening it bounds how long a revoked or rotated key stays in the cache,
1953
+ * at the cost of more requests to remote servers; refetching an expired key
1954
+ * fails while the peer is unavailable, so a very short value makes
1955
+ * verification depend on the peer being reachable.
1956
+ * @default `{ days: 30 }`
1957
+ * @since 2.4.0
1958
+ */
1959
+ publicKeyTtl?: Temporal.DurationLike;
1960
+ /**
1961
+ * The time-to-live for a remote origin's remembered HTTP Message Signatures
1962
+ * spec cached under {@link FederationKvPrefixes.httpMessageSignaturesSpec}.
1963
+ * Once it expires, the next delivery to that origin relearns the spec by
1964
+ * double-knocking and remembers it again.
1965
+ *
1966
+ * Shortening it makes Fedify notice a peer's spec upgrade sooner, at the
1967
+ * cost of an extra signed request per delivery whenever the first spec tried
1968
+ * is rejected.
1969
+ * @default `{ days: 90 }`
1970
+ * @since 2.4.0
1971
+ */
1972
+ httpMessageSignaturesSpecTtl?: Temporal.DurationLike;
1946
1973
  /**
1947
1974
  * The message queue for sending and receiving activities. If not provided,
1948
1975
  * activities will not be queued and will be processed immediately.
@@ -3564,6 +3591,48 @@ declare function createOutboxContext<TContextData>(args: Partial<OutboxContext<T
3564
3591
  federation: Federation<TContextData>;
3565
3592
  }): OutboxContext<TContextData>;
3566
3593
  //#endregion
3594
+ //#region src/testing/kv.d.ts
3595
+ /**
3596
+ * A {@link KvStore} decorator whose entry expiry is driven by a virtual clock
3597
+ * instead of wall-clock time.
3598
+ *
3599
+ * {@link MemoryKvStore} decides expiry by comparing timestamps rather than by
3600
+ * scheduling timers, so a test that wants to observe a TTL elapsing would
3601
+ * otherwise have to sleep for longer than the TTL and hope the runner keeps
3602
+ * up. That makes such tests both slow and load-sensitive.
3603
+ *
3604
+ * This decorator keeps the TTLs itself and never passes them to the store it
3605
+ * wraps, so nothing expires until {@link advance} moves the clock. Cache
3606
+ * hits, expiry, and repopulation therefore all become deterministic, without
3607
+ * patching any global and without a test-only entry point in the library
3608
+ * itself. The clock starts at the Unix epoch and only ever moves forward.
3609
+ */
3610
+ declare class ManualClockKvStore implements KvStore {
3611
+ #private;
3612
+ /**
3613
+ * Present only when the wrapped store has its own `cas()`. Callers such as
3614
+ * the task deduplication planner test `kv.cas != null` to decide whether a
3615
+ * conditional write is available, so the decorator must not advertise a
3616
+ * capability the wrapped store lacks.
3617
+ */
3618
+ readonly cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
3619
+ constructor(inner?: KvStore);
3620
+ /**
3621
+ * The current reading of the virtual clock.
3622
+ */
3623
+ get now(): Temporal.Instant;
3624
+ /**
3625
+ * Moves the virtual clock forward. Any entry whose TTL has elapsed by the
3626
+ * new time reads as missing from this point on, exactly as it would once a
3627
+ * real `KvStore` had let it expire.
3628
+ */
3629
+ advance(duration: Temporal.DurationLike): void;
3630
+ get<T = unknown>(key: KvKey): Promise<T | undefined>;
3631
+ set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
3632
+ delete(key: KvKey): Promise<void>;
3633
+ list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
3634
+ }
3635
+ //#endregion
3567
3636
  //#region src/testing/tasks.d.ts
3568
3637
  /** Federation options (sans `queue`) shared by the task suites. */
3569
3638
  declare const baseOptions: Omit<FederationOptions<void>, "queue">;
@@ -3650,4 +3719,4 @@ interface TestDefinition {
3650
3719
  }
3651
3720
  declare const testDefinitions: TestDefinition[];
3652
3721
  //#endregion
3653
- export { type Envelope, MockQueue, type MockQueueOptions, baseOptions, createInboxContext, createOutboxContext, createRequestContext, envelopeSchema, makeSchema, numberSchema, stringSchema, testDefinitions };
3722
+ export { type Envelope, ManualClockKvStore, MockQueue, type MockQueueOptions, baseOptions, createInboxContext, createOutboxContext, createRequestContext, envelopeSchema, makeSchema, numberSchema, stringSchema, testDefinitions };
@@ -3,5 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { r as testDefinitions } from "../dist-BQvArojP.mjs";
5
5
  import { n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-CbS35fLr.mjs";
6
- import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, r as envelopeSchema, t as MockQueue } from "../testing-D13ymFKy.mjs";
7
- export { MockQueue, baseOptions, createInboxContext, createOutboxContext, createRequestContext, envelopeSchema, makeSchema, numberSchema, stringSchema, testDefinitions };
6
+ import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
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-hbky2gMN.mjs";
9
+ export { ManualClockKvStore, MockQueue, baseOptions, createInboxContext, createOutboxContext, createRequestContext, envelopeSchema, makeSchema, numberSchema, stringSchema, testDefinitions };
@@ -0,0 +1,8 @@
1
+ import "temporal-polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import "./dist-BQvArojP.mjs";
5
+ import "./context-CbS35fLr.mjs";
6
+ import "./kv-DBRWVx3Q.mjs";
7
+ import "./tasks-dbCShlCb.mjs";
8
+ export {};
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
6
6
  import "../std__assert-CxFT0MNt.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
8
- import { l as verifyRequest } from "../http-Cssq59HU.mjs";
8
+ import { l as verifyRequest } from "../http-BR190IDB.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-DIJNHW-Y.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-DantBD_9.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CDmmYxYb.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { 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-CoMnysg5.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-m962_cok.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-D3gKJwUK.cjs");
3
+ const require_kv_cache = require("../kv-cache-DCItgZUM.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-CMUnx7rx.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-5d2HgB_-.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.1951+5c417eb8",
3
+ "version": "2.4.0-dev.1962+8aaa5348",
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.1951+5c417eb8",
155
- "@fedify/vocab": "2.4.0-dev.1951+5c417eb8",
156
- "@fedify/vocab-runtime": "2.4.0-dev.1951+5c417eb8",
157
- "@fedify/webfinger": "2.4.0-dev.1951+5c417eb8"
154
+ "@fedify/uri-template": "2.4.0-dev.1962+8aaa5348",
155
+ "@fedify/vocab": "2.4.0-dev.1962+8aaa5348",
156
+ "@fedify/vocab-runtime": "2.4.0-dev.1962+8aaa5348",
157
+ "@fedify/webfinger": "2.4.0-dev.1962+8aaa5348"
158
158
  },
159
159
  "devDependencies": {
160
160
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -166,7 +166,7 @@
166
166
  "tsx": "^4.21.0",
167
167
  "typescript": "^6.0.0",
168
168
  "wrangler": "^4.17.0",
169
- "@fedify/vocab-tools": "^2.4.0-dev.1951+5c417eb8",
169
+ "@fedify/vocab-tools": "^2.4.0-dev.1962+8aaa5348",
170
170
  "@fedify/fixture": "2.0.0"
171
171
  },
172
172
  "scripts": {