@fedify/fedify 2.0.0-pr.410.1558 → 2.0.0-pr.412.1692

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 (184) hide show
  1. package/dist/actor-CrTGiTZd.cjs +42609 -0
  2. package/dist/{actor-CkjTCNqi.js → actor-D5S46edz.js} +1 -1
  3. package/dist/actor-D6K058Tb.d.cts +128 -0
  4. package/dist/{actor-DmsbGzXS.js → actor-G2S5sPEA.js} +6951 -2127
  5. package/dist/{actor-C22bXuuC.d.ts → actor-T6RyhRgk.d.ts} +1 -1
  6. package/dist/{authdocloader-BwV2NPfz.js → authdocloader-C5AvdCCi.js} +6 -6
  7. package/dist/authdocloader-CQMPmpaO.cjs +58 -0
  8. package/dist/{authdocloader-BJxkviIL.js → authdocloader-SjwloJUA.js} +3 -3
  9. package/dist/{builder-DbOVAz8i.js → builder-OA47XRft.js} +10 -4
  10. package/dist/chunk-DqRYRqnO.cjs +34 -0
  11. package/dist/{client-DrNZd6r_.js → client-Bmd-i8x8.js} +3 -22
  12. package/dist/client-CegPX0Rn.d.cts +222 -0
  13. package/dist/{client-DF8anIB5.d.ts → client-bgSdkFa2.d.ts} +2 -74
  14. package/dist/compat/mod.cjs +10 -0
  15. package/dist/compat/mod.d.cts +13 -0
  16. package/dist/compat/mod.d.ts +8 -8
  17. package/dist/compat/mod.js +5 -5
  18. package/dist/compat/transformers.test.js +19 -19
  19. package/dist/compat-DmDDELst.cjs +4 -0
  20. package/dist/compat-nxUqe4Z-.js +4 -0
  21. package/dist/{context-9gCpIkiz.d.ts → context-ByZprN0S.d.ts} +67 -7
  22. package/dist/context-C5BsZkDr.d.cts +2315 -0
  23. package/dist/docloader-7Ey7wNHx.cjs +4861 -0
  24. package/dist/{docloader-DnepZfu_.js → docloader-CkweNhUH.js} +189 -9
  25. package/dist/docloader-D-MrRyHl.d.cts +219 -0
  26. package/dist/{esm-D1HqBE3n.js → esm-CwHz8Y8t.js} +1 -1
  27. package/dist/federation/builder.test.js +6 -7
  28. package/dist/federation/collection.test.js +4 -4
  29. package/dist/federation/handler.test.js +23 -143
  30. package/dist/federation/idempotency.test.js +202 -0
  31. package/dist/federation/inbox.test.js +4 -4
  32. package/dist/federation/keycache.test.js +4 -4
  33. package/dist/federation/kv.test.js +4 -3
  34. package/dist/federation/middleware.test.js +231 -52
  35. package/dist/federation/mod.cjs +29 -0
  36. package/dist/federation/mod.d.cts +13 -0
  37. package/dist/federation/mod.d.ts +8 -8
  38. package/dist/federation/mod.js +15 -15
  39. package/dist/federation/mq.test.js +3 -3
  40. package/dist/federation/negotiation.test.d.ts +3 -0
  41. package/dist/federation/negotiation.test.js +28 -0
  42. package/dist/federation/retry.test.js +3 -3
  43. package/dist/federation/router.test.js +3 -3
  44. package/dist/federation/send.test.js +10 -10
  45. package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
  46. package/dist/federation-H2_En3j5.cjs +244 -0
  47. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
  48. package/dist/http-BiBofurJ.cjs +826 -0
  49. package/dist/{http-BEJUSX6j.js → http-C5tC93Hn.js} +7 -7
  50. package/dist/http-D-e6AFwR.d.cts +253 -0
  51. package/dist/{http-DqSNLFNY.d.ts → http-D6Uj2x2y.d.ts} +1 -1
  52. package/dist/{http-BgCF3jDs.js → http-DGjdMiLc.js} +3 -3
  53. package/dist/{inbox-Bq4EChoK.js → inbox-BoDY3z8G.js} +24 -7
  54. package/dist/key-CZR7QraT.cjs +290 -0
  55. package/dist/key-Cf8MffVe.cjs +10 -0
  56. package/dist/{key-D-0OLe9C.js → key-CkxrAIyp.js} +5 -5
  57. package/dist/key-Dk0j88Jo.js +10 -0
  58. package/dist/{key-BD3lpBWw.js → key-Epcl5jpz.js} +3 -3
  59. package/dist/{key-BYNqWXyu.js → key-IxRhZpOF.js} +2 -2
  60. package/dist/{keycache-yZDAc3-e.js → keycache-TEniXNel.js} +1 -1
  61. package/dist/{keys-Dtc-g6xq.js → keys-bZxcrZ9Z.js} +1 -1
  62. package/dist/kv-63Cil1MD.d.cts +81 -0
  63. package/dist/{ld-BJ484qSg.js → ld-DW7A0uIc.js} +4 -4
  64. package/dist/{lookup-Cj0sX50U.js → lookup-DhQCVVja.js} +21 -12
  65. package/dist/lookup-DiV4LFBg.cjs +137 -0
  66. package/dist/{lookup-BzogF2gp.js → lookup-cVRa2QM-.js} +4 -4
  67. package/dist/middleware-Be1JStOx.js +17 -0
  68. package/dist/middleware-CDOK7WOb.js +26 -0
  69. package/dist/{middleware-CiH0ptqy.js → middleware-Cgr3PtaJ.js} +58 -149
  70. package/dist/{middleware-DIZ1dnwT.js → middleware-DvvYAIsd.js} +87 -91
  71. package/dist/middleware-EjIW2mZB.cjs +17 -0
  72. package/dist/middleware-TfuVoceY.cjs +4231 -0
  73. package/dist/mod-8DMWKtQE.d.cts +80 -0
  74. package/dist/{mod-Drmz72EK.d.ts → mod-BhUKmBJD.d.ts} +2 -2
  75. package/dist/mod-C2tOeRkN.d.cts +1 -0
  76. package/dist/{mod-TFoH2Ql8.d.ts → mod-CerN_Sza.d.ts} +1 -1
  77. package/dist/mod-Cj1tHXBR.d.cts +102 -0
  78. package/dist/mod-CxkWO3Mg.d.cts +307 -0
  79. package/dist/{mod-Bqxcp7eN.d.ts → mod-D6hQoxC5.d.ts} +2 -2
  80. package/dist/mod-Djzcw2ry.d.cts +266 -0
  81. package/dist/{mod-Cxt4Kpf6.d.ts → mod-DlU8ISoa.d.ts} +19 -1
  82. package/dist/mod-FZd39qVq.d.cts +1 -0
  83. package/dist/mod-jQ4OODsl.d.cts +113 -0
  84. package/dist/mod.cjs +150 -0
  85. package/dist/mod.d.cts +17 -0
  86. package/dist/mod.d.ts +11 -11
  87. package/dist/mod.js +21 -21
  88. package/dist/mq-B7R1Q-M5.d.cts +140 -0
  89. package/dist/negotiation-5NPJL6zp.js +71 -0
  90. package/dist/nodeinfo/client.test.js +27 -106
  91. package/dist/nodeinfo/handler.test.js +20 -20
  92. package/dist/nodeinfo/mod.cjs +11 -0
  93. package/dist/nodeinfo/mod.d.cts +5 -0
  94. package/dist/nodeinfo/mod.d.ts +2 -2
  95. package/dist/nodeinfo/mod.js +7 -7
  96. package/dist/nodeinfo/types.test.js +5 -10
  97. package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
  98. package/dist/nodeinfo-DfycQ8Wf.js +4 -0
  99. package/dist/{owner-9FMX4wQT.js → owner-6Vc3UXXE.js} +2 -2
  100. package/dist/owner-BN_tO3cY.d.cts +67 -0
  101. package/dist/{owner-CQPnQVtf.d.ts → owner-hd9lvQcP.d.ts} +2 -2
  102. package/dist/{proof-Arx4Q9Q6.js → proof-C1jhbeNv.js} +3 -3
  103. package/dist/proof-CRJWXFfT.cjs +673 -0
  104. package/dist/{proof-DnTD0avk.js → proof-Chi90OXv.js} +9 -9
  105. package/dist/runtime/authdocloader.test.js +9 -9
  106. package/dist/runtime/docloader.test.js +4 -4
  107. package/dist/runtime/key.test.js +5 -5
  108. package/dist/runtime/langstr.test.js +3 -3
  109. package/dist/runtime/link.test.d.ts +3 -0
  110. package/dist/runtime/link.test.js +61 -0
  111. package/dist/runtime/mod.cjs +25 -0
  112. package/dist/runtime/mod.d.cts +6 -0
  113. package/dist/runtime/mod.d.ts +3 -3
  114. package/dist/runtime/mod.js +10 -10
  115. package/dist/runtime/multibase/multibase.test.js +3 -3
  116. package/dist/runtime/url.test.js +3 -3
  117. package/dist/runtime-C58AJWSv.cjs +4 -0
  118. package/dist/runtime-DPYEDf-o.js +4 -0
  119. package/dist/{send-CcxHe0p3.js → send-DjATl6i3.js} +2 -2
  120. package/dist/sig/http.test.js +9 -9
  121. package/dist/sig/key.test.js +6 -6
  122. package/dist/sig/ld.test.js +7 -7
  123. package/dist/sig/mod.cjs +30 -0
  124. package/dist/sig/mod.d.cts +8 -0
  125. package/dist/sig/mod.d.ts +5 -5
  126. package/dist/sig/mod.js +10 -10
  127. package/dist/sig/owner.test.js +7 -7
  128. package/dist/sig/proof.test.js +7 -7
  129. package/dist/sig-ByHXzqUi.cjs +4 -0
  130. package/dist/sig-Cj3tk-ig.js +4 -0
  131. package/dist/testing/docloader.test.js +3 -3
  132. package/dist/testing/mod.d.ts +273 -28
  133. package/dist/testing/mod.js +3 -3
  134. package/dist/{testing-DFgpNAI6.js → testing-BnfPB5T-.js} +2 -2
  135. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  136. package/dist/transformers-CoBS-oFG.cjs +116 -0
  137. package/dist/{type-B2h-NRAo.js → type-NEA09tSC.js} +7262 -2258
  138. package/dist/{types-BIgY6c-l.js → types-BSuWJsOm.js} +1 -3
  139. package/dist/types-CmmUQisS.cjs +315 -0
  140. package/dist/{types-B1QuBj5L.js → types-dLXLjVLf.js} +8 -169
  141. package/dist/vocab/actor.test.js +5 -5
  142. package/dist/vocab/lookup.test.js +255 -5
  143. package/dist/vocab/mod.cjs +87 -0
  144. package/dist/vocab/mod.d.cts +6 -0
  145. package/dist/vocab/mod.d.ts +3 -3
  146. package/dist/vocab/mod.js +7 -7
  147. package/dist/vocab/type.test.js +3 -3
  148. package/dist/vocab/vocab.test.js +433 -9
  149. package/dist/{vocab-SOE1ifCr.d.ts → vocab-BI0Ak5lL.d.ts} +290 -0
  150. package/dist/vocab-C5Y-0fGj.cjs +291 -0
  151. package/dist/vocab-Dw1-yVGg.d.cts +14922 -0
  152. package/dist/{vocab-BREfYr1a.js → vocab-rWbHpc2J.js} +26 -17
  153. package/dist/webfinger/handler.test.js +19 -19
  154. package/dist/webfinger/lookup.test.js +4 -4
  155. package/dist/webfinger/mod.cjs +9 -0
  156. package/dist/webfinger/mod.d.cts +4 -0
  157. package/dist/webfinger/mod.js +6 -6
  158. package/dist/webfinger-BjOEdFPs.cjs +4 -0
  159. package/dist/webfinger-De_bU0iE.js +4 -0
  160. package/dist/x/cfworkers.cjs +100 -0
  161. package/dist/x/cfworkers.d.cts +59 -0
  162. package/dist/x/cfworkers.js +3 -3
  163. package/dist/x/cfworkers.test.js +3 -3
  164. package/dist/x/hono.cjs +61 -0
  165. package/dist/x/hono.d.cts +54 -0
  166. package/dist/x/hono.d.ts +7 -7
  167. package/dist/x/hono.js +3 -3
  168. package/dist/x/sveltekit.cjs +69 -0
  169. package/dist/x/sveltekit.d.cts +46 -0
  170. package/dist/x/sveltekit.d.ts +7 -7
  171. package/dist/x/sveltekit.js +3 -3
  172. package/package.json +68 -13
  173. package/dist/compat-Bb5myD13.js +0 -4
  174. package/dist/key-BmFoI4_J.js +0 -10
  175. package/dist/middleware-D2W4gwdv.js +0 -17
  176. package/dist/middleware-LmK3pQ2z.js +0 -26
  177. package/dist/nodeinfo/semver.test.js +0 -143
  178. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  179. package/dist/runtime-BSkOVUWM.js +0 -4
  180. package/dist/semver-dArNLkR9.js +0 -149
  181. package/dist/sig-BXJO--F9.js +0 -4
  182. package/dist/webfinger-C3GIyXIg.js +0 -4
  183. /package/dist/{collection-CSzG2j1P.js → collection-CcnIw1qY.js} +0 -0
  184. /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
4
- import { Application, Group, Organization, Person, Service } from "./vocab-SOE1ifCr.js";
4
+ import { Application, Group, Organization, Person, Service } from "./vocab-BI0Ak5lL.js";
5
5
  import { TracerProvider } from "@opentelemetry/api";
6
6
 
7
7
  //#region src/vocab/actor.d.ts
@@ -1,10 +1,10 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-DnepZfu_.js";
6
- import { validateCryptoKey } from "./key-D-0OLe9C.js";
7
- import { doubleKnock } from "./http-BEJUSX6j.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-CkweNhUH.js";
6
+ import { validateCryptoKey } from "./key-CkxrAIyp.js";
7
+ import { doubleKnock } from "./http-C5tC93Hn.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
 
10
10
  //#region src/runtime/authdocloader.ts
@@ -0,0 +1,58 @@
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-7Ey7wNHx.cjs');
7
+ const require_key = require('./key-CZR7QraT.cjs');
8
+ const require_http = require('./http-BiBofurJ.cjs');
9
+ const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
10
+
11
+ //#region src/runtime/authdocloader.ts
12
+ const logger = (0, __logtape_logtape.getLogger)([
13
+ "fedify",
14
+ "runtime",
15
+ "docloader"
16
+ ]);
17
+ /**
18
+ * Gets an authenticated {@link DocumentLoader} for the given identity.
19
+ * Note that an authenticated document loader intentionally does not cache
20
+ * the fetched documents.
21
+ * @param identity The identity to get the document loader for.
22
+ * The actor's key pair.
23
+ * @param options The options for the document loader.
24
+ * @returns The authenticated document loader.
25
+ * @throws {TypeError} If the key is invalid or unsupported.
26
+ * @since 0.4.0
27
+ */
28
+ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
29
+ require_key.validateCryptoKey(identity.privateKey);
30
+ async function load(url, options) {
31
+ if (!allowPrivateAddress) try {
32
+ await require_docloader.validatePublicUrl(url);
33
+ } catch (error) {
34
+ if (error instanceof require_docloader.UrlError) logger.error("Disallowed private URL: {url}", {
35
+ url,
36
+ error
37
+ });
38
+ throw error;
39
+ }
40
+ const originalRequest = require_docloader.createRequest(url, { userAgent });
41
+ const response = await require_http.doubleKnock(originalRequest, identity, {
42
+ specDeterminer,
43
+ log: require_docloader.logRequest,
44
+ tracerProvider,
45
+ signal: options?.signal
46
+ });
47
+ return require_docloader.getRemoteDocument(url, response, load);
48
+ }
49
+ return load;
50
+ }
51
+
52
+ //#endregion
53
+ Object.defineProperty(exports, 'getAuthenticatedDocumentLoader', {
54
+ enumerable: true,
55
+ get: function () {
56
+ return getAuthenticatedDocumentLoader;
57
+ }
58
+ });
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-B2h-NRAo.js";
7
- import { validateCryptoKey } from "./key-BYNqWXyu.js";
8
- import { doubleKnock } from "./http-BgCF3jDs.js";
6
+ import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-NEA09tSC.js";
7
+ import { validateCryptoKey } from "./key-IxRhZpOF.js";
8
+ import { doubleKnock } from "./http-DGjdMiLc.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
 
11
11
  //#region src/runtime/authdocloader.ts
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getTypeId } from "./type-B2h-NRAo.js";
7
- import { Router, RouterError } from "./lookup-Cj0sX50U.js";
8
- import { InboxListenerSet } from "./inbox-Bq4EChoK.js";
6
+ import { deno_default, getTypeId } from "./type-NEA09tSC.js";
7
+ import { Router, RouterError } from "./lookup-DhQCVVja.js";
8
+ import { InboxListenerSet } from "./inbox-BoDY3z8G.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
11
11
 
@@ -28,6 +28,7 @@ var FederationBuilderImpl = class {
28
28
  inboxListeners;
29
29
  inboxErrorHandler;
30
30
  sharedInboxKeyDispatcher;
31
+ idempotencyStrategy;
31
32
  collectionTypeIds;
32
33
  collectionCallbacks;
33
34
  /**
@@ -42,7 +43,7 @@ var FederationBuilderImpl = class {
42
43
  this.collectionTypeIds = {};
43
44
  }
44
45
  async build(options) {
45
- const { FederationImpl } = await import("./middleware-LmK3pQ2z.js");
46
+ const { FederationImpl } = await import("./middleware-CDOK7WOb.js");
46
47
  const f = new FederationImpl(options);
47
48
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
48
49
  f.router = this.router.clone();
@@ -64,6 +65,7 @@ var FederationBuilderImpl = class {
64
65
  f.inboxListeners = this.inboxListeners?.clone();
65
66
  f.inboxErrorHandler = this.inboxErrorHandler;
66
67
  f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
68
+ f.idempotencyStrategy = this.idempotencyStrategy;
67
69
  return f;
68
70
  }
69
71
  _getTracer() {
@@ -486,6 +488,10 @@ var FederationBuilderImpl = class {
486
488
  setSharedKeyDispatcher: (dispatcher) => {
487
489
  this.sharedInboxKeyDispatcher = dispatcher;
488
490
  return setters;
491
+ },
492
+ withIdempotency: (strategy) => {
493
+ this.idempotencyStrategy = strategy;
494
+ return setters;
489
495
  }
490
496
  };
491
497
  return setters;
@@ -0,0 +1,34 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
5
+ //#region rolldown:runtime
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ Object.defineProperty(exports, '__toESM', {
30
+ enumerable: true,
31
+ get: function () {
32
+ return __toESM;
33
+ }
34
+ });
@@ -3,8 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { getUserAgent } from "./type-B2h-NRAo.js";
7
- import { parseSemVer } from "./semver-dArNLkR9.js";
6
+ import { getUserAgent } from "./type-NEA09tSC.js";
8
7
  import { getLogger } from "@logtape/logtape";
9
8
 
10
9
  //#region src/nodeinfo/client.ts
@@ -133,28 +132,10 @@ function parseSoftware(data, options = {}) {
133
132
  name = data.name.trim().toLowerCase();
134
133
  } else return null;
135
134
  let version;
136
- if ("version" in data && typeof data.version === "string") try {
137
- version = parseSemVer(data.version);
138
- } catch {
139
- if (!options.tryBestEffort) return null;
140
- const parts = data.version.split(".").map((p) => parseInt(p, 10));
141
- version = {
142
- major: !isNaN(parts[0]) ? parts[0] : 0,
143
- minor: !isNaN(parts[1]) ? parts[1] : 0,
144
- patch: !isNaN(parts[2]) ? parts[2] : 0,
145
- build: [],
146
- prerelease: []
147
- };
148
- }
135
+ if ("version" in data) version = String(data.version);
149
136
  else {
150
137
  if (!options.tryBestEffort) return null;
151
- version = {
152
- major: 0,
153
- minor: 0,
154
- patch: 0,
155
- build: [],
156
- prerelease: []
157
- };
138
+ version = "0.0.0";
158
139
  }
159
140
  let repository;
160
141
  if ("repository" in data) {
@@ -0,0 +1,222 @@
1
+ import { GetUserAgentOptions } from "./docloader-D-MrRyHl.cjs";
2
+
3
+ //#region src/nodeinfo/types.d.ts
4
+ /**
5
+ * The type of the result of parsing JSON.
6
+ */
7
+ type JsonValue = {
8
+ [key: string]: JsonValue | undefined;
9
+ } | JsonValue[] | string | number | boolean | null;
10
+ /**
11
+ * A NodeInfo object as defined in the NodeInfo 2.1 schema.
12
+ */
13
+ interface NodeInfo {
14
+ /**
15
+ * Metadata about server software in use.
16
+ */
17
+ software: Software;
18
+ /**
19
+ * The protocols supported on this server. At least one protocol must be
20
+ * supported.
21
+ */
22
+ protocols: Protocol[];
23
+ /**
24
+ * The third party sites this server can connect to via their application API.
25
+ */
26
+ services?: Services;
27
+ /**
28
+ * Whether this server allows open self-registration. Defaults to `false`.
29
+ */
30
+ openRegistrations?: boolean;
31
+ /**
32
+ * Usage statistics for this server.
33
+ */
34
+ usage: Usage;
35
+ /**
36
+ * Free form key value pairs for software specific values.
37
+ * Clients should not rely on any specific key present.
38
+ */
39
+ metadata?: Record<string, JsonValue>;
40
+ }
41
+ /**
42
+ * Metadata about server software in use.
43
+ */
44
+ interface Software {
45
+ /**
46
+ * The canonical name of this server software. This must comply with
47
+ * pattern `/^[a-z0-9-]+$/`.
48
+ */
49
+ name: string;
50
+ /**
51
+ * The version of this server software.
52
+ */
53
+ version: string;
54
+ /**
55
+ * The URL of the source code repository of this server software.
56
+ */
57
+ repository?: URL;
58
+ /**
59
+ * The URL of the homepage of this server software.
60
+ */
61
+ homepage?: URL;
62
+ }
63
+ /**
64
+ * The protocols supported on this server.
65
+ */
66
+ type Protocol = "activitypub" | "buddycloud" | "dfrn" | "diaspora" | "libertree" | "ostatus" | "pumpio" | "tent" | "xmpp" | "zot";
67
+ /**
68
+ * The third party sites this server can connect to via their application API.
69
+ */
70
+ interface Services {
71
+ /**
72
+ * The third party sites this server can retrieve messages from for combined
73
+ * display with regular traffic.
74
+ */
75
+ inbound?: InboundService[];
76
+ /**
77
+ * The third party sites this server can publish messages to on the behalf
78
+ * of a user.
79
+ */
80
+ outbound?: OutboundService[];
81
+ }
82
+ /**
83
+ * The third party sites this server can retrieve messages from for combined
84
+ * display with regular traffic.
85
+ */
86
+ type InboundService = "atom1.0" | "gnusocial" | "imap" | "pnut" | "pop3" | "pumpio" | "rss2.0" | "twitter";
87
+ /**
88
+ * The third party sites this server can publish messages to on the behalf
89
+ * of a user.
90
+ */
91
+ type OutboundService = "atom1.0" | "blogger" | "buddycloud" | "diaspora" | "dreamwidth" | "drupal" | "facebook" | "friendica" | "gnusocial" | "google" | "insanejournal" | "libertree" | "linkedin" | "livejournal" | "mediagoblin" | "myspace" | "pinterest" | "pnut" | "posterous" | "pumpio" | "redmatrix" | "rss2.0" | "smtp" | "tent" | "tumblr" | "twitter" | "wordpress" | "xmpp";
92
+ /**
93
+ * Usage statistics for this server.
94
+ */
95
+ interface Usage {
96
+ /**
97
+ * Statistics about the users of this server.
98
+ */
99
+ users: {
100
+ /**
101
+ * The total amount of on this server registered users. This number
102
+ * has to be an integer greater than or equal to zero.
103
+ */
104
+ total?: number;
105
+ /**
106
+ * The amount of users that signed in at least once in the last 180 days.
107
+ * This number has to be an integer greater than or equal to zero.
108
+ */
109
+ activeHalfyear?: number;
110
+ /**
111
+ * The amount of users that signed in at least once in the last 30 days.
112
+ * This number has to be an integer greater than or equal to zero.
113
+ */
114
+ activeMonth?: number;
115
+ };
116
+ /**
117
+ * The amount of posts that were made by users that are registered on this
118
+ * server. This number has to be an integer greater than or equal to zero.
119
+ */
120
+ localPosts: number;
121
+ /**
122
+ * The amount of comments that were made by users that are registered on this
123
+ * server. This number has to be an integer greater than or equal to zero.
124
+ */
125
+ localComments: number;
126
+ }
127
+ /**
128
+ * Converts a {@link NodeInfo} object to a JSON value.
129
+ * @param nodeInfo The {@link NodeInfo} object to convert.
130
+ * @returns The JSON value that complies with the NodeInfo schema.
131
+ * @throws {TypeError} If the {@link NodeInfo} object is invalid.
132
+ */
133
+ declare function nodeInfoToJson(nodeInfo: NodeInfo): JsonValue;
134
+ //#endregion
135
+ //#region src/nodeinfo/client.d.ts
136
+ /**
137
+ * Options for {@link getNodeInfo} function.
138
+ * @since 1.2.0
139
+ */
140
+ interface GetNodeInfoOptions {
141
+ /**
142
+ * Whether to directly fetch the NodeInfo document from the given URL.
143
+ * Otherwise, the NodeInfo document will be fetched from the `.well-known`
144
+ * location of the given URL.
145
+ *
146
+ * Turned off by default.
147
+ */
148
+ direct?: boolean;
149
+ /**
150
+ * How strictly to parse the NodeInfo document.
151
+ *
152
+ * - `"strict"`: Parse the NodeInfo document strictly. If the document is
153
+ * invalid, `undefined` is returned. This is the default.
154
+ * - `"best-effort"`: Try to parse the NodeInfo document even if it is
155
+ * invalid.
156
+ * - `"none"`: Do not parse the NodeInfo document. The function will return
157
+ * the raw JSON value.
158
+ */
159
+ parse?: "strict" | "best-effort" | "none";
160
+ /**
161
+ * The options for making `User-Agent` header.
162
+ * If a string is given, it is used as the `User-Agent` header value.
163
+ * If an object is given, it is passed to {@link getUserAgent} to generate
164
+ * the `User-Agent` header value.
165
+ * @since 1.3.0
166
+ */
167
+ userAgent?: GetUserAgentOptions | string;
168
+ }
169
+ /**
170
+ * Fetches a NodeInfo document from the given URL.
171
+ * @param url The base URL of the server. If `options.direct` is turned off
172
+ * (default), the NodeInfo document will be fetched from
173
+ * the `.well-known` location of this URL (hence the only origin
174
+ * of the URL is used). If `options.direct` is turned on,
175
+ * the NodeInfo document will be fetched from the given URL.
176
+ * @param options Options for fetching the NodeInfo document.
177
+ * @returns The NodeInfo document if it could be fetched successfully.
178
+ * Otherwise, `undefined` is returned.
179
+ * @since 1.2.0
180
+ */
181
+ declare function getNodeInfo(url: URL | string, options?: GetNodeInfoOptions & {
182
+ parse?: "strict" | "best-effort";
183
+ }): Promise<NodeInfo | undefined>;
184
+ /**
185
+ * Fetches a NodeInfo document from the given URL.
186
+ * @param url The base URL of the server. If `options.direct` is turned off
187
+ * (default), the NodeInfo document will be fetched from
188
+ * the `.well-known` location of this URL (hence the only origin
189
+ * of the URL is used). If `options.direct` is turned on,
190
+ * the NodeInfo document will be fetched from the given URL.
191
+ * @param options Options for fetching the NodeInfo document.
192
+ * @returns The NodeInfo document if it could be fetched successfully.
193
+ * Otherwise, `undefined` is returned.
194
+ * @since 1.2.0
195
+ */
196
+ declare function getNodeInfo(url: URL | string, options: GetNodeInfoOptions & {
197
+ parse: "none";
198
+ }): Promise<JsonValue | undefined>;
199
+ /**
200
+ * Options for {@link parseNodeInfo} function.
201
+ * @since 1.2.0
202
+ */
203
+ interface ParseNodeInfoOptions {
204
+ /**
205
+ * Whether to try to parse the NodeInfo document even if it is invalid.
206
+ * If turned on, the function will return a best-effort result.
207
+ *
208
+ * Turned off by default.
209
+ */
210
+ tryBestEffort?: boolean;
211
+ }
212
+ /**
213
+ * Parses a NodeInfo document.
214
+ * @param data A JSON value that complies with the NodeInfo schema.
215
+ * @param options Options for parsing the NodeInfo document.
216
+ * @returns The parsed NodeInfo document if it is valid. Otherwise, `null`
217
+ * is returned.
218
+ * @since 1.2.0
219
+ */
220
+ declare function parseNodeInfo(data: unknown, options?: ParseNodeInfoOptions): NodeInfo | null;
221
+ //#endregion
222
+ export { GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -2,77 +2,6 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
4
4
 
5
- //#region src/nodeinfo/semver.d.ts
6
- /**
7
- * A SemVer object parsed into its constituent parts.
8
- * @since 1.2.0
9
- */
10
- interface SemVer {
11
- /** The major version */
12
- major: number;
13
- /** The minor version */
14
- minor: number;
15
- /** The patch version */
16
- patch: number;
17
- /**
18
- * The prerelease version
19
- *
20
- * @default {[]}
21
- */
22
- prerelease?: (string | number)[];
23
- /**
24
- * The build metadata
25
- *
26
- * @default {[]}
27
- */
28
- build?: string[];
29
- }
30
- /**
31
- * Attempt to parse a string as a semantic version, returning a SemVer object.
32
- *
33
- * @example Usage
34
- * ```ts
35
- * import { parseSemVer } from "@fedify/fedify/nodeinfo";
36
- * import { assertEquals } from "@std/assert";
37
- *
38
- * const version = parseSemVer("1.2.3");
39
- * assertEquals(version, {
40
- * major: 1,
41
- * minor: 2,
42
- * patch: 3,
43
- * prerelease: [],
44
- * build: [],
45
- * });
46
- * ```
47
- *
48
- * @throws {TypeError} If the input string is invalid.
49
- * @param value The version string to parse
50
- * @returns A valid SemVer
51
- * @since 1.2.0
52
- */
53
- declare function parseSemVer(value: string): SemVer;
54
- /**
55
- * Format a SemVer object into a string.
56
- *
57
- * @example Usage
58
- * ```ts
59
- * import { formatSemVer } from "@fedify/fedify/nodeinfo";
60
- * import { assertEquals } from "@std/assert";
61
- *
62
- * const semver = {
63
- * major: 1,
64
- * minor: 2,
65
- * patch: 3,
66
- * };
67
- * assertEquals(formatSemVer(semver), "1.2.3");
68
- * ```
69
- *
70
- * @param version The SemVer to format
71
- * @returns The string representation of a semantic version.
72
- * @since 1.2.0
73
- */
74
- declare function formatSemVer(version: SemVer): string;
75
- //#endregion
76
5
  //#region src/nodeinfo/types.d.ts
77
6
  /**
78
7
  * The type of the result of parsing JSON.
@@ -122,9 +51,8 @@ interface Software {
122
51
  name: string;
123
52
  /**
124
53
  * The version of this server software.
125
- * @see {@link parseSemVer}
126
54
  */
127
- version: SemVer;
55
+ version: string;
128
56
  /**
129
57
  * The URL of the source code repository of this server software.
130
58
  */
@@ -293,4 +221,4 @@ interface ParseNodeInfoOptions {
293
221
  */
294
222
  declare function parseNodeInfo(data: unknown, options?: ParseNodeInfoOptions): NodeInfo | null;
295
223
  //#endregion
296
- export { GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, ParseNodeInfoOptions, Protocol, SemVer, Services, Software, Usage, formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
224
+ export { GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -0,0 +1,10 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
5
+ const require_transformers = require('../transformers-CoBS-oFG.cjs');
6
+ require('../compat-DmDDELst.cjs');
7
+
8
+ exports.actorDehydrator = require_transformers.actorDehydrator;
9
+ exports.autoIdAssigner = require_transformers.autoIdAssigner;
10
+ exports.getDefaultActivityTransformers = require_transformers.getDefaultActivityTransformers;
@@ -0,0 +1,13 @@
1
+ import "../kv-63Cil1MD.cjs";
2
+ import "../docloader-D-MrRyHl.cjs";
3
+ import "../client-CegPX0Rn.cjs";
4
+ import "../vocab-Dw1-yVGg.cjs";
5
+ import "../actor-D6K058Tb.cjs";
6
+ import "../http-D-e6AFwR.cjs";
7
+ import "../owner-BN_tO3cY.cjs";
8
+ import "../mod-CxkWO3Mg.cjs";
9
+ import "../mod-jQ4OODsl.cjs";
10
+ import { ActivityTransformer } from "../context-C5BsZkDr.cjs";
11
+ import "../mq-B7R1Q-M5.cjs";
12
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-8DMWKtQE.cjs";
13
+ export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -2,14 +2,14 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import "../kv-C7sopW2E.js";
4
4
  import "../docloader-CxWcuWqQ.js";
5
- import "../client-DF8anIB5.js";
6
- import "../vocab-SOE1ifCr.js";
7
- import "../actor-C22bXuuC.js";
8
- import "../http-DqSNLFNY.js";
9
- import "../owner-CQPnQVtf.js";
10
- import "../mod-Cxt4Kpf6.js";
5
+ import "../client-bgSdkFa2.js";
6
+ import "../vocab-BI0Ak5lL.js";
7
+ import "../actor-T6RyhRgk.js";
8
+ import "../http-D6Uj2x2y.js";
9
+ import "../owner-hd9lvQcP.js";
10
+ import "../mod-DlU8ISoa.js";
11
11
  import "../mod-DBzN0aCM.js";
12
- import { ActivityTransformer } from "../context-9gCpIkiz.js";
12
+ import { ActivityTransformer } from "../context-ByZprN0S.js";
13
13
  import "../mq-CRGm1e_F.js";
14
- import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-Bqxcp7eN.js";
14
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-D6hQoxC5.js";
15
15
  export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -1,8 +1,8 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../transformers-Dna8Fg7k.js";
6
- import "../compat-Bb5myD13.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../transformers-BFT6d7J5.js";
6
+ import "../compat-nxUqe4Z-.js";
7
7
 
8
8
  export { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -3,30 +3,30 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Follow, Person } from "../type-B2h-NRAo.js";
6
+ import { Follow, Person } from "../type-NEA09tSC.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-CiH0ptqy.js";
12
- import "../semver-dArNLkR9.js";
13
- import "../client-DrNZd6r_.js";
14
- import "../lookup-Cj0sX50U.js";
15
- import "../types-BIgY6c-l.js";
16
- import "../actor-CkjTCNqi.js";
17
- import "../key-BYNqWXyu.js";
18
- import "../http-BgCF3jDs.js";
19
- import "../authdocloader-BJxkviIL.js";
20
- import "../ld-BJ484qSg.js";
21
- import "../owner-9FMX4wQT.js";
22
- import "../proof-Arx4Q9Q6.js";
23
- import "../inbox-Bq4EChoK.js";
24
- import "../builder-DbOVAz8i.js";
25
- import "../collection-CSzG2j1P.js";
26
- import "../keycache-yZDAc3-e.js";
11
+ import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-Cgr3PtaJ.js";
12
+ import "../client-Bmd-i8x8.js";
13
+ import "../lookup-DhQCVVja.js";
14
+ import "../types-BSuWJsOm.js";
15
+ import "../actor-D5S46edz.js";
16
+ import "../key-IxRhZpOF.js";
17
+ import "../http-DGjdMiLc.js";
18
+ import "../authdocloader-SjwloJUA.js";
19
+ import "../ld-DW7A0uIc.js";
20
+ import "../owner-6Vc3UXXE.js";
21
+ import "../proof-C1jhbeNv.js";
22
+ import "../inbox-BoDY3z8G.js";
23
+ import "../builder-OA47XRft.js";
24
+ import "../collection-CcnIw1qY.js";
25
+ import "../keycache-TEniXNel.js";
26
+ import "../negotiation-5NPJL6zp.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-CcxHe0p3.js";
29
- import { test } from "../testing-DFgpNAI6.js";
28
+ import "../send-DjATl6i3.js";
29
+ import { test } from "../testing-BnfPB5T-.js";
30
30
 
31
31
  //#region src/compat/transformers.test.ts
32
32
  const federation = new FederationImpl({ kv: new MemoryKvStore() });
@@ -0,0 +1,4 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
@@ -0,0 +1,4 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+