@fedify/fedify 1.9.0-dev.1605 → 1.9.0-dev.1668

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 (155) hide show
  1. package/dist/{actor-Bp5E1_uo.js → actor-BHAPrCDB.js} +1 -1
  2. package/dist/actor-CHOM_AN3.d.cts +128 -0
  3. package/dist/{actor-Bi2qvBSd.js → actor-ChSW_rBk.js} +200 -200
  4. package/dist/actor-fGD4yb1K.cjs +37783 -0
  5. package/dist/{authdocloader-BE3rMpjB.js → authdocloader-CgrKtaQg.js} +3 -3
  6. package/dist/{authdocloader-CtNUOc_o.js → authdocloader-ChsJ9FJN.js} +6 -6
  7. package/dist/authdocloader-eSrbn3wM.cjs +58 -0
  8. package/dist/{builder-i_bWHUua.js → builder-DI4-Kpdg.js} +4 -4
  9. package/dist/chunk-DqRYRqnO.cjs +34 -0
  10. package/dist/{client-DzL0DiuM.js → client-B8gJ1cw8.js} +1 -1
  11. package/dist/client-DjT_tegg.d.cts +294 -0
  12. package/dist/compat/mod.cjs +10 -0
  13. package/dist/compat/mod.d.cts +13 -0
  14. package/dist/compat/mod.js +5 -5
  15. package/dist/compat/transformers.test.js +16 -16
  16. package/dist/compat-DmDDELst.cjs +4 -0
  17. package/dist/compat-nxUqe4Z-.js +4 -0
  18. package/dist/context-KXVF2AhH.d.cts +2261 -0
  19. package/dist/{docloader-OJ23BINE.js → docloader-Bqh-eFNP.js} +188 -8
  20. package/dist/docloader-CSB8cAnw.cjs +4862 -0
  21. package/dist/docloader-D-MrRyHl.d.cts +219 -0
  22. package/dist/{esm-CyuitQYP.js → esm-DTi75ew2.js} +1 -1
  23. package/dist/federation/builder.test.js +5 -5
  24. package/dist/federation/collection.test.js +3 -3
  25. package/dist/federation/handler.test.js +17 -17
  26. package/dist/federation/inbox.test.js +4 -4
  27. package/dist/federation/keycache.test.js +4 -4
  28. package/dist/federation/kv.test.js +4 -3
  29. package/dist/federation/middleware.test.js +18 -18
  30. package/dist/federation/mod.cjs +29 -0
  31. package/dist/federation/mod.d.cts +13 -0
  32. package/dist/federation/mod.js +15 -15
  33. package/dist/federation/mq.test.js +3 -3
  34. package/dist/federation/retry.test.js +3 -3
  35. package/dist/federation/router.test.js +3 -3
  36. package/dist/federation/send.test.js +10 -10
  37. package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
  38. package/dist/federation-H2_En3j5.cjs +244 -0
  39. package/dist/http-BDErrXSN.cjs +826 -0
  40. package/dist/http-B_zBcsai.d.cts +253 -0
  41. package/dist/{http-BptJ8gzr.js → http-BpAVdmaR.js} +2 -2
  42. package/dist/{http-CGKESoOD.js → http-DBHpjcjo.js} +6 -6
  43. package/dist/{inbox-D5YFCsS2.js → inbox-BA9sYsBf.js} +1 -1
  44. package/dist/key-2rIHnPaA.js +10 -0
  45. package/dist/{key-C_beSXh2.js → key-B27QtSbc.js} +2 -2
  46. package/dist/key-CYpTUnwf.cjs +290 -0
  47. package/dist/key-Ck4-GNm0.cjs +10 -0
  48. package/dist/{key-D7obyu6i.js → key-DSOJOcRH.js} +3 -3
  49. package/dist/{key-UR9dBv1x.js → key-sCE-TgxY.js} +5 -5
  50. package/dist/{keycache-Ocm3x-aO.js → keycache-CiW2SvJu.js} +1 -1
  51. package/dist/{keys-C0sHgFeh.js → keys-5cHW76LQ.js} +1 -1
  52. package/dist/kv-63Cil1MD.d.cts +81 -0
  53. package/dist/{ld-BP8uv8u-.js → ld-upnKn3yw.js} +2 -2
  54. package/dist/{lookup-DmESd_mM.js → lookup-B61sZAOY.js} +4 -4
  55. package/dist/lookup-BrrOs_g1.cjs +137 -0
  56. package/dist/{lookup-BrGv9cks.js → lookup-CZBG-vCx.js} +1 -1
  57. package/dist/{middleware-Sfxf2Vmo.js → middleware-CfP7UhQy.js} +28 -28
  58. package/dist/{middleware-CZ-uRVbW.js → middleware-CyUVZG3t.js} +27 -27
  59. package/dist/middleware-D8O6iKhr.js +26 -0
  60. package/dist/middleware-DI4sIaI4.js +17 -0
  61. package/dist/middleware-P3jCWk4K.cjs +4240 -0
  62. package/dist/middleware-lw0MLhVG.cjs +17 -0
  63. package/dist/mod-C2tOeRkN.d.cts +1 -0
  64. package/dist/mod-C3CGxYoF.d.cts +102 -0
  65. package/dist/mod-COw_caPC.d.cts +266 -0
  66. package/dist/mod-FZd39qVq.d.cts +1 -0
  67. package/dist/mod-NKH_G-IY.d.cts +289 -0
  68. package/dist/mod-YfAcrVbP.d.cts +80 -0
  69. package/dist/mod-jQ4OODsl.d.cts +113 -0
  70. package/dist/mod.cjs +152 -0
  71. package/dist/mod.d.cts +17 -0
  72. package/dist/mod.js +20 -20
  73. package/dist/mq-B7R1Q-M5.d.cts +140 -0
  74. package/dist/nodeinfo/client.test.js +5 -5
  75. package/dist/nodeinfo/handler.test.js +16 -16
  76. package/dist/nodeinfo/mod.cjs +13 -0
  77. package/dist/nodeinfo/mod.d.cts +5 -0
  78. package/dist/nodeinfo/mod.js +6 -6
  79. package/dist/nodeinfo/semver.test.js +3 -3
  80. package/dist/nodeinfo/types.test.js +3 -3
  81. package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
  82. package/dist/nodeinfo-DfycQ8Wf.js +4 -0
  83. package/dist/owner-C9Ry0TOI.d.cts +67 -0
  84. package/dist/{owner-C3KvPNTd.js → owner-zvsMGYzc.js} +2 -2
  85. package/dist/{proof-DmROl-2J.js → proof-BgKYSJ00.js} +2 -2
  86. package/dist/{proof-vAK-PfOK.js → proof-Bt6yHsMN.js} +6 -6
  87. package/dist/proof-CC_7UV_j.cjs +673 -0
  88. package/dist/runtime/authdocloader.test.js +9 -9
  89. package/dist/runtime/docloader.test.js +4 -4
  90. package/dist/runtime/key.test.js +5 -5
  91. package/dist/runtime/langstr.test.js +3 -3
  92. package/dist/runtime/link.test.d.ts +3 -0
  93. package/dist/runtime/link.test.js +61 -0
  94. package/dist/runtime/mod.cjs +25 -0
  95. package/dist/runtime/mod.d.cts +6 -0
  96. package/dist/runtime/mod.js +10 -10
  97. package/dist/runtime/multibase/multibase.test.js +3 -3
  98. package/dist/runtime/url.test.js +3 -3
  99. package/dist/runtime-C58AJWSv.cjs +4 -0
  100. package/dist/runtime-DPYEDf-o.js +4 -0
  101. package/dist/{send-D7brJLC6.js → send-DlqdAGHP.js} +2 -2
  102. package/dist/sig/http.test.js +8 -8
  103. package/dist/sig/key.test.js +6 -6
  104. package/dist/sig/ld.test.js +7 -7
  105. package/dist/sig/mod.cjs +30 -0
  106. package/dist/sig/mod.d.cts +8 -0
  107. package/dist/sig/mod.js +10 -10
  108. package/dist/sig/owner.test.js +7 -7
  109. package/dist/sig/proof.test.js +7 -7
  110. package/dist/sig-ByHXzqUi.cjs +4 -0
  111. package/dist/sig-Cj3tk-ig.js +4 -0
  112. package/dist/testing/docloader.test.js +3 -3
  113. package/dist/testing/mod.js +3 -3
  114. package/dist/{testing-B3ZGdVhe.js → testing-CAAJTPCt.js} +2 -2
  115. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  116. package/dist/transformers-CoBS-oFG.cjs +116 -0
  117. package/dist/{type-CrcgcFC3.js → type-BRNRL3aj.js} +381 -201
  118. package/dist/{types-DiyuYWAI.js → types-C8yjtF5A.js} +4 -4
  119. package/dist/types-Dz0NMslg.cjs +488 -0
  120. package/dist/vocab/actor.test.js +5 -5
  121. package/dist/vocab/lookup.test.js +4 -4
  122. package/dist/vocab/mod.cjs +87 -0
  123. package/dist/vocab/mod.d.cts +6 -0
  124. package/dist/vocab/mod.js +7 -7
  125. package/dist/vocab/type.test.js +3 -3
  126. package/dist/vocab/vocab.test.js +40 -5
  127. package/dist/vocab-BDMmyzZA.cjs +282 -0
  128. package/dist/vocab-BzGg7ltX.d.cts +14629 -0
  129. package/dist/{vocab-Dk0L2c9M.js → vocab-WpDLcZH7.js} +6 -6
  130. package/dist/webfinger/handler.test.js +16 -16
  131. package/dist/webfinger/lookup.test.js +4 -4
  132. package/dist/webfinger/mod.cjs +9 -0
  133. package/dist/webfinger/mod.d.cts +4 -0
  134. package/dist/webfinger/mod.js +6 -6
  135. package/dist/webfinger-BjOEdFPs.cjs +4 -0
  136. package/dist/webfinger-De_bU0iE.js +4 -0
  137. package/dist/x/cfworkers.cjs +100 -0
  138. package/dist/x/cfworkers.d.cts +59 -0
  139. package/dist/x/cfworkers.js +3 -3
  140. package/dist/x/cfworkers.test.js +3 -3
  141. package/dist/x/hono.cjs +61 -0
  142. package/dist/x/hono.d.cts +54 -0
  143. package/dist/x/hono.js +3 -3
  144. package/dist/x/sveltekit.cjs +69 -0
  145. package/dist/x/sveltekit.d.cts +46 -0
  146. package/dist/x/sveltekit.js +3 -3
  147. package/package.json +68 -13
  148. package/dist/compat-Bb5myD13.js +0 -4
  149. package/dist/key-D7gEThPA.js +0 -10
  150. package/dist/middleware-CtLDRgUg.js +0 -26
  151. package/dist/middleware-ww6ZuicB.js +0 -17
  152. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  153. package/dist/runtime-BSkOVUWM.js +0 -4
  154. package/dist/sig-BXJO--F9.js +0 -4
  155. package/dist/webfinger-C3GIyXIg.js +0 -4
@@ -0,0 +1,81 @@
1
+ //#region src/federation/kv.d.ts
2
+ /**
3
+ * A key for a key–value store. An array of one or more strings.
4
+ *
5
+ * @since 0.5.0
6
+ */
7
+ type KvKey = readonly [string] | readonly [string, ...string[]];
8
+ /**
9
+ * Additional options for setting a value in a key–value store.
10
+ *
11
+ * @since 0.5.0
12
+ */
13
+ interface KvStoreSetOptions {
14
+ /**
15
+ * The time-to-live (TTL) for the value.
16
+ */
17
+ ttl?: Temporal.Duration;
18
+ }
19
+ /**
20
+ * An abstract interface for a key–value store.
21
+ *
22
+ * @since 0.5.0
23
+ */
24
+ interface KvStore {
25
+ /**
26
+ * Gets the value for the given key.
27
+ * @param key The key to get the value for.
28
+ * @returns The value for the key, or `undefined` if the key does not exist.
29
+ * @template T The type of the value to get.
30
+ */
31
+ get<T = unknown>(key: KvKey): Promise<T | undefined>;
32
+ /**
33
+ * Sets the value for the given key.
34
+ * @param key The key to set the value for.
35
+ * @param value The value to set.
36
+ * @param options Additional options for setting the value.
37
+ */
38
+ set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
39
+ /**
40
+ * Deletes the value for the given key.
41
+ * @param key The key to delete.
42
+ */
43
+ delete(key: KvKey): Promise<void>;
44
+ /**
45
+ * Compare-and-swap (CAS) operation for the key–value store.
46
+ * @param key The key to perform the CAS operation on.
47
+ * @param expectedValue The expected value for the key.
48
+ * @param newValue The new value to set if the expected value matches.
49
+ * @param options Additional options for setting the value.
50
+ * @return `true` if the CAS operation was successful, `false` otherwise.
51
+ * @since 1.8.0
52
+ */
53
+ cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
54
+ }
55
+ /**
56
+ * A key–value store that stores values in memory.
57
+ * Do not use this in production as it does not persist values.
58
+ *
59
+ * @since 0.5.0
60
+ */
61
+ declare class MemoryKvStore implements KvStore {
62
+ #private;
63
+ /**
64
+ * {@inheritDoc KvStore.get}
65
+ */
66
+ get<T = unknown>(key: KvKey): Promise<T | undefined>;
67
+ /**
68
+ * {@inheritDoc KvStore.set}
69
+ */
70
+ set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
71
+ /**
72
+ * {@inheritDoc KvStore.delete}
73
+ */
74
+ delete(key: KvKey): Promise<void>;
75
+ /**
76
+ * {@inheritDoc KvStore.cas}
77
+ */
78
+ cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
79
+ }
80
+ //#endregion
81
+ export { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore };
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, CryptographicKey, Object as Object$1, deno_default, getDocumentLoader, getTypeId } from "./type-CrcgcFC3.js";
7
- import { fetchKey, validateCryptoKey } from "./key-C_beSXh2.js";
6
+ import { Activity, CryptographicKey, Object as Object$1, deno_default, getDocumentLoader, getTypeId } from "./type-BRNRL3aj.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-B27QtSbc.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
@@ -1,8 +1,8 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-OJ23BINE.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-Bqh-eFNP.js";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
 
@@ -0,0 +1,137 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
5
+ const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
+ const require_docloader = require('./docloader-CSB8cAnw.cjs');
7
+ const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
8
+ const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
9
+
10
+ //#region src/webfinger/lookup.ts
11
+ const logger = (0, __logtape_logtape.getLogger)([
12
+ "fedify",
13
+ "webfinger",
14
+ "lookup"
15
+ ]);
16
+ const DEFAULT_MAX_REDIRECTION = 5;
17
+ /**
18
+ * Looks up a WebFinger resource.
19
+ * @param resource The resource URL to look up.
20
+ * @param options Extra options for looking up the resource.
21
+ * @returns The resource descriptor, or `null` if not found.
22
+ * @since 0.2.0
23
+ */
24
+ async function lookupWebFinger(resource, options = {}) {
25
+ const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
26
+ const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
27
+ return await tracer.startActiveSpan("webfinger.lookup", {
28
+ kind: __opentelemetry_api.SpanKind.CLIENT,
29
+ attributes: {
30
+ "webfinger.resource": resource.toString(),
31
+ "webfinger.resource.scheme": typeof resource === "string" ? resource.replace(/:.*$/, "") : resource.protocol.replace(/:$/, "")
32
+ }
33
+ }, async (span) => {
34
+ try {
35
+ const result = await lookupWebFingerInternal(resource, options);
36
+ span.setStatus({ code: result === null ? __opentelemetry_api.SpanStatusCode.ERROR : __opentelemetry_api.SpanStatusCode.OK });
37
+ return result;
38
+ } catch (error) {
39
+ span.setStatus({
40
+ code: __opentelemetry_api.SpanStatusCode.ERROR,
41
+ message: String(error)
42
+ });
43
+ throw error;
44
+ } finally {
45
+ span.end();
46
+ }
47
+ });
48
+ }
49
+ async function lookupWebFingerInternal(resource, options = {}) {
50
+ if (typeof resource === "string") resource = new URL(resource);
51
+ let protocol = "https:";
52
+ let server;
53
+ if (resource.protocol === "acct:") {
54
+ const atPos = resource.pathname.lastIndexOf("@");
55
+ if (atPos < 0) return null;
56
+ server = resource.pathname.substring(atPos + 1);
57
+ if (server === "") return null;
58
+ } else {
59
+ protocol = resource.protocol;
60
+ server = resource.host;
61
+ }
62
+ let url = new URL(`${protocol}//${server}/.well-known/webfinger`);
63
+ url.searchParams.set("resource", resource.href);
64
+ let redirected = 0;
65
+ while (true) {
66
+ logger.debug("Fetching WebFinger resource descriptor from {url}...", { url: url.href });
67
+ let response;
68
+ if (options.allowPrivateAddress !== true) try {
69
+ await require_docloader.validatePublicUrl(url.href);
70
+ } catch (e) {
71
+ if (e instanceof require_docloader.UrlError) {
72
+ logger.error("Invalid URL for WebFinger resource descriptor: {error}", { error: e });
73
+ return null;
74
+ }
75
+ throw e;
76
+ }
77
+ try {
78
+ response = await fetch(url, {
79
+ headers: {
80
+ Accept: "application/jrd+json",
81
+ "User-Agent": typeof options.userAgent === "string" ? options.userAgent : require_docloader.getUserAgent(options.userAgent)
82
+ },
83
+ redirect: "manual",
84
+ signal: options.signal
85
+ });
86
+ } catch (error) {
87
+ logger.debug("Failed to fetch WebFinger resource descriptor: {error}", {
88
+ url: url.href,
89
+ error
90
+ });
91
+ return null;
92
+ }
93
+ if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
94
+ redirected++;
95
+ const maxRedirection = options.maxRedirection ?? DEFAULT_MAX_REDIRECTION;
96
+ if (redirected >= maxRedirection) {
97
+ logger.error("Too many redirections ({redirections}) while fetching WebFinger resource descriptor.", { redirections: redirected });
98
+ return null;
99
+ }
100
+ const redirectedUrl = new URL(response.headers.get("Location"), response.url == null || response.url === "" ? url : response.url);
101
+ if (redirectedUrl.protocol !== url.protocol) {
102
+ logger.error("Redirected to a different protocol ({protocol} to {redirectedProtocol}) while fetching WebFinger resource descriptor.", {
103
+ protocol: url.protocol,
104
+ redirectedProtocol: redirectedUrl.protocol
105
+ });
106
+ return null;
107
+ }
108
+ url = redirectedUrl;
109
+ continue;
110
+ }
111
+ if (!response.ok) {
112
+ logger.debug("Failed to fetch WebFinger resource descriptor: {status} {statusText}.", {
113
+ url: url.href,
114
+ status: response.status,
115
+ statusText: response.statusText
116
+ });
117
+ return null;
118
+ }
119
+ try {
120
+ return await response.json();
121
+ } catch (e) {
122
+ if (e instanceof SyntaxError) {
123
+ logger.debug("Failed to parse WebFinger resource descriptor as JSON: {error}", { error: e });
124
+ return null;
125
+ }
126
+ throw e;
127
+ }
128
+ }
129
+ }
130
+
131
+ //#endregion
132
+ Object.defineProperty(exports, 'lookupWebFinger', {
133
+ enumerable: true,
134
+ get: function () {
135
+ return lookupWebFinger;
136
+ }
137
+ });
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Object as Object$1, deno_default, getDocumentLoader, getTypeId, lookupWebFinger } from "./type-CrcgcFC3.js";
6
+ import { Object as Object$1, deno_default, getDocumentLoader, getTypeId, lookupWebFinger } from "./type-BRNRL3aj.js";
7
7
  import { cloneDeep, delay } from "es-toolkit";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,17 +1,17 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { getDefaultActivityTransformers } from "./transformers-Dna8Fg7k.js";
6
- import { deno_default, getDocumentLoader, kvCache } from "./docloader-OJ23BINE.js";
7
- import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-Bi2qvBSd.js";
8
- import { lookupWebFinger } from "./lookup-DmESd_mM.js";
9
- import { exportJwk, importJwk, validateCryptoKey } from "./key-UR9dBv1x.js";
10
- import { doubleKnock, verifyRequest } from "./http-CGKESoOD.js";
11
- import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-vAK-PfOK.js";
12
- import { getNodeInfo, nodeInfoToJson } from "./types-DiyuYWAI.js";
13
- import { getAuthenticatedDocumentLoader } from "./authdocloader-CtNUOc_o.js";
14
- import { lookupObject, traverseCollection } from "./vocab-Dk0L2c9M.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
6
+ import { deno_default, getDocumentLoader, kvCache } from "./docloader-Bqh-eFNP.js";
7
+ import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-ChSW_rBk.js";
8
+ import { lookupWebFinger } from "./lookup-B61sZAOY.js";
9
+ import { exportJwk, importJwk, validateCryptoKey } from "./key-sCE-TgxY.js";
10
+ import { doubleKnock, verifyRequest } from "./http-DBHpjcjo.js";
11
+ import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-Bt6yHsMN.js";
12
+ import { getNodeInfo, nodeInfoToJson } from "./types-C8yjtF5A.js";
13
+ import { getAuthenticatedDocumentLoader } from "./authdocloader-ChsJ9FJN.js";
14
+ import { lookupObject, traverseCollection } from "./vocab-WpDLcZH7.js";
15
15
  import { getLogger, withContext } from "@logtape/logtape";
16
16
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
17
17
  import { encodeHex } from "byte-encodings/hex";
@@ -321,7 +321,7 @@ var FederationBuilderImpl = class {
321
321
  this.collectionTypeIds = {};
322
322
  }
323
323
  async build(options) {
324
- const { FederationImpl: FederationImpl$1 } = await import("./middleware-ww6ZuicB.js");
324
+ const { FederationImpl: FederationImpl$1 } = await import("./middleware-DI4sIaI4.js");
325
325
  const f = new FederationImpl$1(options);
326
326
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
327
327
  f.router = this.router.clone();
@@ -3486,15 +3486,16 @@ var ContextImpl = class ContextImpl {
3486
3486
  "actor"
3487
3487
  ]);
3488
3488
  if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
3489
- const path = this.federation.router.build("actor", {
3490
- identifier,
3491
- handle: identifier
3492
- });
3493
- if (path == null) {
3494
- logger$1.warn("No actor dispatcher registered.");
3495
- return [];
3489
+ let actorUri;
3490
+ try {
3491
+ actorUri = this.getActorUri(identifier);
3492
+ } catch (error) {
3493
+ if (error instanceof RouterError) {
3494
+ logger$1.warn(error.message);
3495
+ return [];
3496
+ }
3497
+ throw error;
3496
3498
  }
3497
- const actorUri = new URL(path, this.canonicalOrigin);
3498
3499
  const keyPairs = await this.federation.actorCallbacks?.keyPairsDispatcher(new ContextImpl({
3499
3500
  ...this,
3500
3501
  invokedFromActorKeyPairsDispatcher: { identifier }
@@ -3655,12 +3656,11 @@ var ContextImpl = class ContextImpl {
3655
3656
  if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
3656
3657
  expandedRecipients = [];
3657
3658
  for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
3658
- if (options.syncCollection) {
3659
- const collectionId = this.federation.router.build("followers", {
3660
- identifier,
3661
- handle: identifier
3662
- });
3663
- opts.collectionSync = collectionId == null ? void 0 : new URL(collectionId, this.canonicalOrigin).href;
3659
+ if (options.syncCollection) try {
3660
+ opts.collectionSync = this.getFollowersUri(identifier).href;
3661
+ } catch (error) {
3662
+ if (error instanceof RouterError) opts.collectionSync = void 0;
3663
+ else throw error;
3664
3664
  }
3665
3665
  } else expandedRecipients = [recipients];
3666
3666
  span.setAttribute("activitypub.inboxes", expandedRecipients.length);
@@ -3,22 +3,22 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-CrcgcFC3.js";
7
- import { getNodeInfo } from "./client-DzL0DiuM.js";
8
- import { RouterError, lookupObject, traverseCollection } from "./lookup-BrGv9cks.js";
6
+ import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-BRNRL3aj.js";
7
+ import { getNodeInfo } from "./client-B8gJ1cw8.js";
8
+ import { RouterError, lookupObject, traverseCollection } from "./lookup-CZBG-vCx.js";
9
9
  import { nodeInfoToJson } from "./types-BIgY6c-l.js";
10
- import { exportJwk, importJwk, validateCryptoKey } from "./key-C_beSXh2.js";
11
- import { verifyRequest } from "./http-BptJ8gzr.js";
12
- import { getAuthenticatedDocumentLoader } from "./authdocloader-BE3rMpjB.js";
13
- import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-BP8uv8u-.js";
14
- import { doesActorOwnKey, getKeyOwner } from "./owner-C3KvPNTd.js";
15
- import { signObject, verifyObject } from "./proof-DmROl-2J.js";
16
- import { routeActivity } from "./inbox-D5YFCsS2.js";
17
- import { FederationBuilderImpl } from "./builder-i_bWHUua.js";
10
+ import { exportJwk, importJwk, validateCryptoKey } from "./key-B27QtSbc.js";
11
+ import { verifyRequest } from "./http-BpAVdmaR.js";
12
+ import { getAuthenticatedDocumentLoader } from "./authdocloader-CgrKtaQg.js";
13
+ import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-upnKn3yw.js";
14
+ import { doesActorOwnKey, getKeyOwner } from "./owner-zvsMGYzc.js";
15
+ import { signObject, verifyObject } from "./proof-BgKYSJ00.js";
16
+ import { routeActivity } from "./inbox-BA9sYsBf.js";
17
+ import { FederationBuilderImpl } from "./builder-DI4-Kpdg.js";
18
18
  import { buildCollectionSynchronizationHeader } from "./collection-CSzG2j1P.js";
19
- import { KvKeyCache } from "./keycache-Ocm3x-aO.js";
19
+ import { KvKeyCache } from "./keycache-CiW2SvJu.js";
20
20
  import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
21
- import { extractInboxes, sendActivity } from "./send-D7brJLC6.js";
21
+ import { extractInboxes, sendActivity } from "./send-DlqdAGHP.js";
22
22
  import { getLogger, withContext } from "@logtape/logtape";
23
23
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
24
24
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
@@ -2542,15 +2542,16 @@ var ContextImpl = class ContextImpl {
2542
2542
  "actor"
2543
2543
  ]);
2544
2544
  if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
2545
- const path = this.federation.router.build("actor", {
2546
- identifier,
2547
- handle: identifier
2548
- });
2549
- if (path == null) {
2550
- logger$2.warn("No actor dispatcher registered.");
2551
- return [];
2545
+ let actorUri;
2546
+ try {
2547
+ actorUri = this.getActorUri(identifier);
2548
+ } catch (error) {
2549
+ if (error instanceof RouterError) {
2550
+ logger$2.warn(error.message);
2551
+ return [];
2552
+ }
2553
+ throw error;
2552
2554
  }
2553
- const actorUri = new URL(path, this.canonicalOrigin);
2554
2555
  const keyPairs = await this.federation.actorCallbacks?.keyPairsDispatcher(new ContextImpl({
2555
2556
  ...this,
2556
2557
  invokedFromActorKeyPairsDispatcher: { identifier }
@@ -2711,12 +2712,11 @@ var ContextImpl = class ContextImpl {
2711
2712
  if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
2712
2713
  expandedRecipients = [];
2713
2714
  for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
2714
- if (options.syncCollection) {
2715
- const collectionId = this.federation.router.build("followers", {
2716
- identifier,
2717
- handle: identifier
2718
- });
2719
- opts.collectionSync = collectionId == null ? void 0 : new URL(collectionId, this.canonicalOrigin).href;
2715
+ if (options.syncCollection) try {
2716
+ opts.collectionSync = this.getFollowersUri(identifier).href;
2717
+ } catch (error) {
2718
+ if (error instanceof RouterError) opts.collectionSync = void 0;
2719
+ else throw error;
2720
2720
  }
2721
2721
  } else expandedRecipients = [recipients];
2722
2722
  span.setAttribute("activitypub.inboxes", expandedRecipients.length);
@@ -0,0 +1,26 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+ globalThis.addEventListener = () => {};
5
+
6
+ import "./type-BRNRL3aj.js";
7
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-CyUVZG3t.js";
8
+ import "./semver-dArNLkR9.js";
9
+ import "./client-B8gJ1cw8.js";
10
+ import "./lookup-CZBG-vCx.js";
11
+ import "./types-BIgY6c-l.js";
12
+ import "./actor-BHAPrCDB.js";
13
+ import "./key-B27QtSbc.js";
14
+ import "./http-BpAVdmaR.js";
15
+ import "./authdocloader-CgrKtaQg.js";
16
+ import "./ld-upnKn3yw.js";
17
+ import "./owner-zvsMGYzc.js";
18
+ import "./proof-BgKYSJ00.js";
19
+ import "./inbox-BA9sYsBf.js";
20
+ import "./builder-DI4-Kpdg.js";
21
+ import "./collection-CSzG2j1P.js";
22
+ import "./keycache-CiW2SvJu.js";
23
+ import "./retry-D4GJ670a.js";
24
+ import "./send-DlqdAGHP.js";
25
+
26
+ export { FederationImpl };
@@ -0,0 +1,17 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import "./transformers-BFT6d7J5.js";
6
+ import "./docloader-Bqh-eFNP.js";
7
+ import "./actor-ChSW_rBk.js";
8
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-CfP7UhQy.js";
9
+ import "./lookup-B61sZAOY.js";
10
+ import "./key-sCE-TgxY.js";
11
+ import "./http-DBHpjcjo.js";
12
+ import "./proof-Bt6yHsMN.js";
13
+ import "./types-C8yjtF5A.js";
14
+ import "./authdocloader-ChsJ9FJN.js";
15
+ import "./vocab-WpDLcZH7.js";
16
+
17
+ export { FederationImpl };