@fedify/fedify 2.0.0-dev.1593 → 2.0.0-dev.1641

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 (175) hide show
  1. package/dist/actor-CP03csrm.cjs +37786 -0
  2. package/dist/actor-DMgu-ZjT.d.cts +128 -0
  3. package/dist/{actor-DNwcqwPT.js → actor-DU511yTk.js} +200 -200
  4. package/dist/{actor-Bj1Vq2XG.js → actor-DVpsNXhn.js} +1 -1
  5. package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-7UF4R_Qs.js} +1 -1
  6. package/dist/{assert_throws-BOO88avQ.js → assert_throws-53_pKeP3.js} +1 -1
  7. package/dist/{authdocloader-DJtdyVPc.js → authdocloader-BkIZCKQv.js} +3 -3
  8. package/dist/authdocloader-BnsFSERg.cjs +58 -0
  9. package/dist/{authdocloader-qkvj_KZY.js → authdocloader-DCgMyo82.js} +6 -6
  10. package/dist/{builder-BgzJcrpt.js → builder-E2Icrl_a.js} +4 -4
  11. package/dist/chunk-DqRYRqnO.cjs +34 -0
  12. package/dist/{client-CpxFv8ft.js → client-BW4V0OJx.js} +3 -22
  13. package/dist/client-CegPX0Rn.d.cts +222 -0
  14. package/dist/{client-DF8anIB5.d.ts → client-bgSdkFa2.d.ts} +2 -74
  15. package/dist/compat/mod.cjs +10 -0
  16. package/dist/compat/mod.d.cts +13 -0
  17. package/dist/compat/mod.d.ts +3 -3
  18. package/dist/compat/mod.js +5 -5
  19. package/dist/compat/transformers.test.js +19 -20
  20. package/dist/compat-DmDDELst.cjs +4 -0
  21. package/dist/compat-nxUqe4Z-.js +4 -0
  22. package/dist/{context-9gCpIkiz.d.ts → context-CDSZdQHD.d.ts} +1 -1
  23. package/dist/context-Dq8aCtMH.d.cts +2255 -0
  24. package/dist/{docloader-9_osWaaH.js → docloader-BtqIh1OE.js} +188 -8
  25. package/dist/docloader-D-MrRyHl.d.cts +219 -0
  26. package/dist/docloader-kae6M-GI.cjs +4861 -0
  27. package/dist/{esm-5nsZYnVB.js → esm-mtx3XJAD.js} +1 -1
  28. package/dist/federation/builder.test.js +11 -12
  29. package/dist/federation/collection.test.js +9 -9
  30. package/dist/federation/handler.test.js +25 -26
  31. package/dist/federation/inbox.test.js +6 -6
  32. package/dist/federation/keycache.test.js +4 -4
  33. package/dist/federation/kv.test.js +9 -8
  34. package/dist/federation/middleware.test.js +29 -44
  35. package/dist/federation/mod.cjs +29 -0
  36. package/dist/federation/mod.d.cts +13 -0
  37. package/dist/federation/mod.d.ts +2 -2
  38. package/dist/federation/mod.js +15 -15
  39. package/dist/federation/mq.test.js +10 -10
  40. package/dist/federation/retry.test.js +5 -5
  41. package/dist/federation/router.test.js +8 -8
  42. package/dist/federation/send.test.js +15 -15
  43. package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
  44. package/dist/federation-H2_En3j5.cjs +244 -0
  45. package/dist/http-BS6766zs.d.cts +253 -0
  46. package/dist/{http-BqklewFY.js → http-C7uYFcBo.js} +6 -6
  47. package/dist/{http-CQulyTuw.js → http-Cox5GsED.js} +2 -2
  48. package/dist/http-ZhcoaYEa.cjs +826 -0
  49. package/dist/{inbox-B97Wrppe.js → inbox-BDdRbWNI.js} +1 -1
  50. package/dist/key-B9Z5ZuX9.js +10 -0
  51. package/dist/{key-CNCeen0u.js → key-Cc0JlcKe.js} +5 -5
  52. package/dist/{key-D-s3dQbK.js → key-CfiBDu3o.js} +2 -2
  53. package/dist/{key-C3CEOTh7.js → key-CgwCzDC4.js} +3 -3
  54. package/dist/key-D-7DPHNl.cjs +10 -0
  55. package/dist/key-HqzOCwDc.cjs +290 -0
  56. package/dist/{keycache-Br0-hsD5.js → keycache-CVBjz3xi.js} +1 -1
  57. package/dist/{keys-DSk2aqlj.js → keys-CBKbYaJA.js} +1 -1
  58. package/dist/kv-63Cil1MD.d.cts +81 -0
  59. package/dist/{ld-CYUQO1l4.js → ld-CxgmnSO3.js} +2 -2
  60. package/dist/{lookup-CnJK1NUl.js → lookup-CiU3QxQz.js} +1 -1
  61. package/dist/{lookup-BNFlahf3.js → lookup-NuT9cCSl.js} +4 -4
  62. package/dist/lookup-QHjmy4Og.cjs +137 -0
  63. package/dist/middleware-BHboQ4BE.js +25 -0
  64. package/dist/middleware-Bp3I9z8r.js +17 -0
  65. package/dist/{middleware-CovCqg8w.js → middleware-ByPnvMMS.js} +30 -30
  66. package/dist/{middleware-tfSiCl9w.js → middleware-DXidHY4N.js} +28 -28
  67. package/dist/middleware-LyCG_YVM.cjs +4235 -0
  68. package/dist/middleware-oYqSU5ky.cjs +17 -0
  69. package/dist/mod-BClfg3ej.d.cts +266 -0
  70. package/dist/mod-BhMnAkFX.d.cts +80 -0
  71. package/dist/mod-C2tOeRkN.d.cts +1 -0
  72. package/dist/mod-Dc_-mf8s.d.cts +102 -0
  73. package/dist/mod-FZd39qVq.d.cts +1 -0
  74. package/dist/{mod-Bqxcp7eN.d.ts → mod-RI3-KvUI.d.ts} +1 -1
  75. package/dist/mod-evzlRVZq.d.cts +289 -0
  76. package/dist/mod-jQ4OODsl.d.cts +113 -0
  77. package/dist/mod.cjs +150 -0
  78. package/dist/mod.d.cts +17 -0
  79. package/dist/mod.d.ts +4 -4
  80. package/dist/mod.js +21 -21
  81. package/dist/mq-B7R1Q-M5.d.cts +140 -0
  82. package/dist/nodeinfo/client.test.js +32 -111
  83. package/dist/nodeinfo/handler.test.js +25 -26
  84. package/dist/nodeinfo/mod.cjs +11 -0
  85. package/dist/nodeinfo/mod.d.cts +5 -0
  86. package/dist/nodeinfo/mod.d.ts +2 -2
  87. package/dist/nodeinfo/mod.js +7 -7
  88. package/dist/nodeinfo/types.test.js +10 -15
  89. package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
  90. package/dist/nodeinfo-DfycQ8Wf.js +4 -0
  91. package/dist/owner-B-7Ptt_m.d.cts +67 -0
  92. package/dist/{owner-CBeUJR68.js → owner-Cxob5_PK.js} +2 -2
  93. package/dist/proof-2Gcor0_N.cjs +673 -0
  94. package/dist/{proof-CHQnDg0z.js → proof-BiSQNUmQ.js} +2 -2
  95. package/dist/{proof-D436ezTT.js → proof-DkxwMaWE.js} +6 -6
  96. package/dist/runtime/authdocloader.test.js +14 -14
  97. package/dist/runtime/docloader.test.js +9 -9
  98. package/dist/runtime/key.test.js +10 -10
  99. package/dist/runtime/langstr.test.js +8 -8
  100. package/dist/runtime/link.test.js +61 -0
  101. package/dist/runtime/mod.cjs +25 -0
  102. package/dist/runtime/mod.d.cts +6 -0
  103. package/dist/runtime/mod.js +10 -10
  104. package/dist/runtime/multibase/multibase.test.js +8 -8
  105. package/dist/runtime/url.test.js +5 -5
  106. package/dist/runtime-C58AJWSv.cjs +4 -0
  107. package/dist/runtime-DPYEDf-o.js +4 -0
  108. package/dist/{send-Bc0QdRlp.js → send-DSEhWIYD.js} +2 -2
  109. package/dist/sig/http.test.js +13 -13
  110. package/dist/sig/key.test.js +11 -11
  111. package/dist/sig/ld.test.js +10 -10
  112. package/dist/sig/mod.cjs +30 -0
  113. package/dist/sig/mod.d.cts +8 -0
  114. package/dist/sig/mod.js +10 -10
  115. package/dist/sig/owner.test.js +12 -12
  116. package/dist/sig/proof.test.js +12 -12
  117. package/dist/sig-ByHXzqUi.cjs +4 -0
  118. package/dist/sig-Cj3tk-ig.js +4 -0
  119. package/dist/testing/docloader.test.js +8 -8
  120. package/dist/testing/mod.d.ts +1 -28
  121. package/dist/testing/mod.js +3 -3
  122. package/dist/{testing-D4xRiVJV.js → testing-ByQmUvf-.js} +2 -2
  123. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  124. package/dist/transformers-CoBS-oFG.cjs +116 -0
  125. package/dist/{type-qs0mWLTm.js → type-B4NJkfVg.js} +381 -201
  126. package/dist/{types-BIgY6c-l.js → types-BSuWJsOm.js} +1 -3
  127. package/dist/types-Bqt2EgP0.cjs +315 -0
  128. package/dist/{types-RbpvCErq.js → types-l2uh_ZhP.js} +8 -169
  129. package/dist/vocab/actor.test.js +10 -10
  130. package/dist/vocab/lookup.test.js +9 -9
  131. package/dist/vocab/mod.cjs +87 -0
  132. package/dist/vocab/mod.d.cts +6 -0
  133. package/dist/vocab/mod.js +7 -7
  134. package/dist/vocab/type.test.js +3 -3
  135. package/dist/vocab/vocab.test.js +45 -10
  136. package/dist/vocab-B0-5a8pw.cjs +282 -0
  137. package/dist/vocab-DJTYMqyU.d.cts +14632 -0
  138. package/dist/{vocab-r-I1_ZmK.js → vocab-lBFcVxVF.js} +6 -6
  139. package/dist/webfinger/handler.test.js +24 -25
  140. package/dist/webfinger/lookup.test.js +9 -9
  141. package/dist/webfinger/mod.cjs +9 -0
  142. package/dist/webfinger/mod.d.cts +4 -0
  143. package/dist/webfinger/mod.js +6 -6
  144. package/dist/webfinger-BjOEdFPs.cjs +4 -0
  145. package/dist/webfinger-De_bU0iE.js +4 -0
  146. package/dist/x/cfworkers.cjs +100 -0
  147. package/dist/x/cfworkers.d.cts +59 -0
  148. package/dist/x/cfworkers.js +3 -3
  149. package/dist/x/cfworkers.test.js +8 -8
  150. package/dist/x/hono.cjs +61 -0
  151. package/dist/x/hono.d.cts +54 -0
  152. package/dist/x/hono.d.ts +2 -2
  153. package/dist/x/hono.js +3 -3
  154. package/dist/x/sveltekit.cjs +69 -0
  155. package/dist/x/sveltekit.d.cts +46 -0
  156. package/dist/x/sveltekit.d.ts +2 -2
  157. package/dist/x/sveltekit.js +3 -3
  158. package/package.json +68 -13
  159. package/dist/compat-Bb5myD13.js +0 -4
  160. package/dist/key-3jGPh5To.js +0 -10
  161. package/dist/middleware-CJbNYdw9.js +0 -17
  162. package/dist/middleware-zDdNBo-m.js +0 -26
  163. package/dist/nodeinfo/semver.test.js +0 -143
  164. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  165. package/dist/runtime-BSkOVUWM.js +0 -4
  166. package/dist/semver-dArNLkR9.js +0 -149
  167. package/dist/sig-BXJO--F9.js +0 -4
  168. package/dist/webfinger-C3GIyXIg.js +0 -4
  169. /package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-B035L3om.js} +0 -0
  170. /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
  171. /package/dist/{collection-CSzG2j1P.js → collection-CcnIw1qY.js} +0 -0
  172. /package/dist/{denokv-Bv33Xxea.js → denokv-jZ0Z2h0M.js} +0 -0
  173. /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
  174. /package/dist/{nodeinfo/semver.test.d.ts → runtime/link.test.d.ts} +0 -0
  175. /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
@@ -70,32 +70,6 @@ interface GetUserAgentOptions {
70
70
  * @since 1.3.0
71
71
  */
72
72
  //#endregion
73
- //#region src/nodeinfo/semver.d.ts
74
- /**
75
- * A SemVer object parsed into its constituent parts.
76
- * @since 1.2.0
77
- */
78
- interface SemVer {
79
- /** The major version */
80
- major: number;
81
- /** The minor version */
82
- minor: number;
83
- /** The patch version */
84
- patch: number;
85
- /**
86
- * The prerelease version
87
- *
88
- * @default {[]}
89
- */
90
- prerelease?: (string | number)[];
91
- /**
92
- * The build metadata
93
- *
94
- * @default {[]}
95
- */
96
- build?: string[];
97
- }
98
- //#endregion
99
73
  //#region src/nodeinfo/types.d.ts
100
74
  /**
101
75
  * The type of the result of parsing JSON.
@@ -145,9 +119,8 @@ interface Software {
145
119
  name: string;
146
120
  /**
147
121
  * The version of this server software.
148
- * @see {@link parseSemVer}
149
122
  */
150
- version: SemVer;
123
+ version: string;
151
124
  /**
152
125
  * The URL of the source code repository of this server software.
153
126
  */
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../type-qs0mWLTm.js";
7
- import "../lookup-CnJK1NUl.js";
8
- import { createInboxContext, createRequestContext, test, testDefinitions } from "../testing-D4xRiVJV.js";
6
+ import "../type-B4NJkfVg.js";
7
+ import "../lookup-CiU3QxQz.js";
8
+ import { createInboxContext, createRequestContext, test, testDefinitions } from "../testing-ByQmUvf-.js";
9
9
 
10
10
  export { createInboxContext, createRequestContext, test, testDefinitions };
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { __require, lookupWebFinger } from "./type-qs0mWLTm.js";
7
- import { RouterError, lookupObject, traverseCollection } from "./lookup-CnJK1NUl.js";
6
+ import { __require, lookupWebFinger } from "./type-B4NJkfVg.js";
7
+ import { RouterError, lookupObject, traverseCollection } from "./lookup-CiU3QxQz.js";
8
8
  import { configure, getConsoleSink, getLogger, reset } from "@logtape/logtape";
9
9
  import { trace } from "@opentelemetry/api";
10
10
 
@@ -1,7 +1,7 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
5
  import { getLogger } from "@logtape/logtape";
6
6
 
7
7
  //#region src/compat/transformers.ts
@@ -0,0 +1,116 @@
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 __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
7
+
8
+ //#region src/compat/transformers.ts
9
+ const logger = (0, __logtape_logtape.getLogger)([
10
+ "fedify",
11
+ "compat",
12
+ "transformers"
13
+ ]);
14
+ /**
15
+ * An activity transformer that assigns a new random ID to an activity if it
16
+ * does not already have one. This is useful for ensuring that activities
17
+ * have an ID before they are sent to other servers.
18
+ *
19
+ * The generated ID is an origin URI with a fragment which contains an activity
20
+ * type name with a random UUID:
21
+ *
22
+ * ```
23
+ * https://example.com/#Follow/12345678-1234-5678-1234-567812345678
24
+ * ```
25
+ *
26
+ * @template TContextData The type of the context data.
27
+ * @param activity The activity to assign an ID to.
28
+ * @param context The context of the activity.
29
+ * @return The activity with an ID assigned.
30
+ * @since 1.4.0
31
+ */
32
+ function autoIdAssigner(activity, context) {
33
+ if (activity.id != null) return activity;
34
+ const id = new URL(`/#${activity.constructor.name}/${crypto.randomUUID()}`, context.origin);
35
+ logger.warn("As the activity to send does not have an id, a new id {id} has been generated for it. However, it is recommended to explicitly set the id for the activity.", { id: id.href });
36
+ return activity.clone({ id });
37
+ }
38
+ /**
39
+ * An activity transformer that dehydrates the actor property of an activity
40
+ * so that it only contains the actor's URI. For example, suppose we have an
41
+ * activity like this:
42
+ *
43
+ * ```typescript
44
+ * import { Follow, Person } from "@fedify/fedify/vocab";
45
+ * const input = new Follow({
46
+ * id: new URL("http://example.com/activities/1"),
47
+ * actor: new Person({
48
+ * id: new URL("http://example.com/actors/1"),
49
+ * name: "Alice",
50
+ * preferredUsername: "alice",
51
+ * }),
52
+ * object: new Person({
53
+ * id: new URL("http://example.com/actors/2"),
54
+ * name: "Bob",
55
+ * preferredUsername: "bob",
56
+ * }),
57
+ * });
58
+ * ```
59
+ *
60
+ * The result of applying this transformer would be:
61
+ *
62
+ * ```typescript
63
+ * import { Follow, Person } from "@fedify/fedify/vocab";
64
+ * const output = new Follow({
65
+ * id: new URL("http://example.com/activities/1"),
66
+ * actor: new URL("http://example.com/actors/1"),
67
+ * object: new Person({
68
+ * id: new URL("http://example.com/actors/2"),
69
+ * name: "Bob",
70
+ * preferredUsername: "bob",
71
+ * }),
72
+ * });
73
+ * ```
74
+ *
75
+ * As some ActivityPub implementations like Threads fail to deal with inlined
76
+ * actor objects, this transformer can be used to work around this issue.
77
+ * @template TContextData The type of the context data.
78
+ * @param activity The activity to dehydrate the actor property of.
79
+ * @param context The context of the activity.
80
+ * @returns The dehydrated activity.
81
+ * @since 1.4.0
82
+ */
83
+ function actorDehydrator(activity, _context) {
84
+ if (activity.actorIds.length < 1) return activity;
85
+ return activity.clone({ actors: activity.actorIds });
86
+ }
87
+ /**
88
+ * Gets the default activity transformers that are applied to all outgoing
89
+ * activities.
90
+ * @template TContextData The type of the context data.
91
+ * @returns The default activity transformers.
92
+ * @since 1.4.0
93
+ */
94
+ function getDefaultActivityTransformers() {
95
+ return [autoIdAssigner, actorDehydrator];
96
+ }
97
+
98
+ //#endregion
99
+ Object.defineProperty(exports, 'actorDehydrator', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return actorDehydrator;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, 'autoIdAssigner', {
106
+ enumerable: true,
107
+ get: function () {
108
+ return autoIdAssigner;
109
+ }
110
+ });
111
+ Object.defineProperty(exports, 'getDefaultActivityTransformers', {
112
+ enumerable: true,
113
+ get: function () {
114
+ return getDefaultActivityTransformers;
115
+ }
116
+ });