@fedify/fedify 2.1.0-dev.405 → 2.1.0-dev.408

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 (97) hide show
  1. package/dist/{builder-BWjjqZUb.js → builder-DqJQtxW4.js} +3 -3
  2. package/dist/client-BxMZiQaD.d.ts +224 -0
  3. package/dist/client-C97KOq3x.d.cts +222 -0
  4. package/dist/compat/mod.d.cts +6 -6
  5. package/dist/compat/mod.d.ts +6 -6
  6. package/dist/compat/transformers.test.js +11 -11
  7. package/dist/context-Dy5ro7zD.d.ts +2515 -0
  8. package/dist/context-o4OhjMHe.d.cts +2513 -0
  9. package/dist/{deno-CPzYQsYM.js → deno-D_VnPW-Y.js} +1 -1
  10. package/dist/{docloader-Cd_GiG4f.js → docloader-D7xSU1xb.js} +2 -2
  11. package/dist/federation/builder.test.js +3 -3
  12. package/dist/federation/handler.test.js +11 -11
  13. package/dist/federation/idempotency.test.js +11 -11
  14. package/dist/federation/inbox.test.js +2 -2
  15. package/dist/federation/middleware.test.js +11 -11
  16. package/dist/federation/mod.cjs +4 -4
  17. package/dist/federation/mod.d.cts +6 -6
  18. package/dist/federation/mod.d.ts +6 -6
  19. package/dist/federation/mod.js +4 -4
  20. package/dist/federation/send.test.js +5 -5
  21. package/dist/federation/webfinger.test.js +11 -11
  22. package/dist/{http-CEU_3RKK.cjs → http-B-epypwc.cjs} +1 -1
  23. package/dist/{http-CQ_YeeLl.js → http-C3oMHumD.js} +1 -1
  24. package/dist/{http-Du61KL0a.js → http-CFILUWFj.js} +2 -2
  25. package/dist/http-Cz3MlXAZ.d.cts +244 -0
  26. package/dist/http-DkHdFfrc.d.ts +246 -0
  27. package/dist/{inbox-DtFkWTEQ.js → inbox-FsU-ifET.js} +1 -1
  28. package/dist/{key-BzVQ8XYL.js → key-Cw2GXzkv.js} +1 -1
  29. package/dist/kv-BL4nlICN.d.cts +110 -0
  30. package/dist/kv-DXEUEP6z.d.ts +113 -0
  31. package/dist/{kv-cache-C8OMhVH8.js → kv-cache-K6GW8-uS.js} +1 -1
  32. package/dist/{kv-cache-DBmcvmxf.cjs → kv-cache-YG3yAJRb.cjs} +1 -1
  33. package/dist/{ld-CwNrP01q.js → ld-D4-RbyP8.js} +2 -2
  34. package/dist/{middleware-CRWZ3XGF.js → middleware-ByN4qQt0.js} +4 -4
  35. package/dist/{middleware-HEyCssxh.js → middleware-CVGms5AS.js} +11 -11
  36. package/dist/{middleware-Cw6aAfgI.js → middleware-Co3x1vLV.js} +10 -10
  37. package/dist/{middleware-C6hCNOnW.cjs → middleware-CzNcdhiV.cjs} +4 -4
  38. package/dist/middleware-DWhDjC7Z.cjs +12 -0
  39. package/dist/{middleware-BcNc3Cp1.js → middleware-D_wNj9p6.js} +4 -4
  40. package/dist/mod-Bm_GwNTL.d.cts +80 -0
  41. package/dist/mod-CIR7gJW8.d.ts +64 -0
  42. package/dist/mod-CwZXZJ9d.d.ts +91 -0
  43. package/dist/mod-DPkRU3EK.d.cts +266 -0
  44. package/dist/mod-DQWhp0xs.d.ts +82 -0
  45. package/dist/mod-DUWcVv49.d.ts +268 -0
  46. package/dist/mod-DXsQakeS.d.cts +89 -0
  47. package/dist/mod-DwqZ5l67.d.cts +62 -0
  48. package/dist/mod.cjs +4 -4
  49. package/dist/mod.d.cts +9 -9
  50. package/dist/mod.d.ts +9 -9
  51. package/dist/mod.js +4 -4
  52. package/dist/nodeinfo/handler.test.js +11 -11
  53. package/dist/nodeinfo/mod.d.cts +1 -1
  54. package/dist/nodeinfo/mod.d.ts +1 -1
  55. package/dist/otel/mod.d.cts +145 -145
  56. package/dist/otel/mod.d.ts +145 -145
  57. package/dist/owner-1AbPBOOZ.d.cts +66 -0
  58. package/dist/{owner-BuJ3B1oy.js → owner-BJOuHY_S.js} +1 -1
  59. package/dist/owner-gd0Q9FuU.d.ts +68 -0
  60. package/dist/{proof-B0VK41oO.js → proof-BNcJ_Sa_.js} +1 -1
  61. package/dist/{proof-B_ndUlKU.cjs → proof-BmYdRz_f.cjs} +1 -1
  62. package/dist/{proof-BjgSTnKs.js → proof-VvmjtuyP.js} +2 -2
  63. package/dist/{send-CsYzNMCy.js → send-DYC2LvJZ.js} +2 -2
  64. package/dist/sig/http.test.js +3 -3
  65. package/dist/sig/key.test.js +2 -2
  66. package/dist/sig/ld.test.js +3 -3
  67. package/dist/sig/mod.cjs +2 -2
  68. package/dist/sig/mod.d.cts +3 -3
  69. package/dist/sig/mod.d.ts +3 -3
  70. package/dist/sig/mod.js +2 -2
  71. package/dist/sig/owner.test.js +3 -3
  72. package/dist/sig/proof.test.js +3 -3
  73. package/dist/utils/docloader.test.js +4 -4
  74. package/dist/utils/mod.cjs +2 -2
  75. package/dist/utils/mod.d.cts +3 -3
  76. package/dist/utils/mod.d.ts +3 -3
  77. package/dist/utils/mod.js +2 -2
  78. package/package.json +5 -5
  79. package/dist/client-CwkOPN13.d.cts +0 -222
  80. package/dist/client-a7NwzhA2.d.ts +0 -224
  81. package/dist/context-BdNW_8a3.d.cts +0 -2554
  82. package/dist/context-C-GVKcJR.d.ts +0 -2556
  83. package/dist/http-CCEu-x1_.d.cts +0 -253
  84. package/dist/http-CODSJcKx.d.ts +0 -255
  85. package/dist/kv-g9jFc34-.d.cts +0 -110
  86. package/dist/kv-jg_8SMc1.d.ts +0 -113
  87. package/dist/middleware-DAtmZEMk.cjs +0 -12
  88. package/dist/mod-5PNty1K9.d.cts +0 -80
  89. package/dist/mod-BcpEGTWV.d.cts +0 -62
  90. package/dist/mod-COO7VMcm.d.cts +0 -266
  91. package/dist/mod-CevNbUol.d.ts +0 -91
  92. package/dist/mod-CtO31FCx.d.ts +0 -64
  93. package/dist/mod-Da9fNDyC.d.ts +0 -82
  94. package/dist/mod-ErTjUJs9.d.cts +0 -89
  95. package/dist/mod-q2IR8UiH.d.ts +0 -268
  96. package/dist/owner-9yZ5Ibsb.d.cts +0 -66
  97. package/dist/owner-DQYAbVmX.d.ts +0 -68
@@ -7,9 +7,9 @@ import { createTestTracerProvider, mockDocumentLoader, test } from "../dist-B5f6
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import "../deno-CPzYQsYM.js";
11
- import "../key-BzVQ8XYL.js";
12
- import { doesActorOwnKey, getKeyOwner } from "../owner-BuJ3B1oy.js";
10
+ import "../deno-D_VnPW-Y.js";
11
+ import "../key-Cw2GXzkv.js";
12
+ import { doesActorOwnKey, getKeyOwner } from "../owner-BJOuHY_S.js";
13
13
  import "../std__assert-DWivtrGR.js";
14
14
  import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
15
15
  import "../assert_throws-BNXdRGWP.js";
@@ -7,9 +7,9 @@ import { mockDocumentLoader, test } from "../dist-B5f6a8Tt.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
- import "../deno-CPzYQsYM.js";
11
- import "../key-BzVQ8XYL.js";
12
- import { createProof, signObject, verifyObject, verifyProof } from "../proof-BjgSTnKs.js";
10
+ import "../deno-D_VnPW-Y.js";
11
+ import "../key-Cw2GXzkv.js";
12
+ import { createProof, signObject, verifyObject, verifyProof } from "../proof-VvmjtuyP.js";
13
13
  import "../std__assert-DWivtrGR.js";
14
14
  import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
15
15
  import "../assert_throws-BNXdRGWP.js";
@@ -7,10 +7,10 @@ import { mockDocumentLoader, test } from "../dist-B5f6a8Tt.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import "../deno-CPzYQsYM.js";
11
- import "../key-BzVQ8XYL.js";
12
- import { verifyRequest } from "../http-Du61KL0a.js";
13
- import { getAuthenticatedDocumentLoader } from "../docloader-Cd_GiG4f.js";
10
+ import "../deno-D_VnPW-Y.js";
11
+ import "../key-Cw2GXzkv.js";
12
+ import { verifyRequest } from "../http-CFILUWFj.js";
13
+ import { getAuthenticatedDocumentLoader } from "../docloader-D7xSU1xb.js";
14
14
  import "../std__assert-DWivtrGR.js";
15
15
  import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
16
16
  import "../assert_throws-BNXdRGWP.js";
@@ -2,8 +2,8 @@
2
2
  const { Temporal } = require("@js-temporal/polyfill");
3
3
  const { URLPattern } = require("urlpattern-polyfill");
4
4
 
5
- require('../http-CEU_3RKK.cjs');
6
- const require_kv_cache = require('../kv-cache-DBmcvmxf.cjs');
5
+ require('../http-B-epypwc.cjs');
6
+ const require_kv_cache = require('../kv-cache-YG3yAJRb.cjs');
7
7
  require('../utils-BQ9KqEK9.cjs');
8
8
 
9
9
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
@@ -1,4 +1,4 @@
1
- import "../http-CCEu-x1_.cjs";
2
- import "../kv-g9jFc34-.cjs";
3
- import { getAuthenticatedDocumentLoader, kvCache } from "../mod-ErTjUJs9.cjs";
1
+ import "../http-Cz3MlXAZ.cjs";
2
+ import "../kv-BL4nlICN.cjs";
3
+ import { getAuthenticatedDocumentLoader, kvCache } from "../mod-DXsQakeS.cjs";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import "../http-CODSJcKx.js";
4
- import "../kv-jg_8SMc1.js";
5
- import { getAuthenticatedDocumentLoader, kvCache } from "../mod-CevNbUol.js";
3
+ import "../http-DkHdFfrc.js";
4
+ import "../kv-DXEUEP6z.js";
5
+ import { getAuthenticatedDocumentLoader, kvCache } from "../mod-CwZXZJ9d.js";
6
6
  export { getAuthenticatedDocumentLoader, kvCache };
package/dist/utils/mod.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import "../http-CQ_YeeLl.js";
6
- import { getAuthenticatedDocumentLoader, kvCache } from "../kv-cache-C8OMhVH8.js";
5
+ import "../http-C3oMHumD.js";
6
+ import { getAuthenticatedDocumentLoader, kvCache } from "../kv-cache-K6GW8-uS.js";
7
7
  import "../utils-Dn5OPdSW.js";
8
8
 
9
9
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.1.0-dev.405+f4e278ae",
3
+ "version": "2.1.0-dev.408+5c3c9d78",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -145,9 +145,9 @@
145
145
  "uri-template-router": "^1.0.0",
146
146
  "url-template": "^3.1.1",
147
147
  "urlpattern-polyfill": "^10.1.0",
148
- "@fedify/vocab": "2.1.0-dev.405+f4e278ae",
149
- "@fedify/webfinger": "2.1.0-dev.405+f4e278ae",
150
- "@fedify/vocab-runtime": "2.1.0-dev.405+f4e278ae"
148
+ "@fedify/vocab": "2.1.0-dev.408+5c3c9d78",
149
+ "@fedify/vocab-runtime": "2.1.0-dev.408+5c3c9d78",
150
+ "@fedify/webfinger": "2.1.0-dev.408+5c3c9d78"
151
151
  },
152
152
  "devDependencies": {
153
153
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -160,7 +160,7 @@
160
160
  "typescript": "^5.9.3",
161
161
  "wrangler": "^4.17.0",
162
162
  "@fedify/fixture": "2.0.0",
163
- "@fedify/vocab-tools": "^2.1.0-dev.405+f4e278ae"
163
+ "@fedify/vocab-tools": "^2.1.0-dev.408+5c3c9d78"
164
164
  },
165
165
  "scripts": {
166
166
  "build:self": "tsdown",
@@ -1,222 +0,0 @@
1
- import { GetUserAgentOptions } from "@fedify/vocab-runtime";
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
- readonly software: Software;
18
- /**
19
- * The protocols supported on this server. At least one protocol must be
20
- * supported.
21
- */
22
- readonly protocols: readonly Protocol[];
23
- /**
24
- * The third party sites this server can connect to via their application API.
25
- */
26
- readonly services?: Services;
27
- /**
28
- * Whether this server allows open self-registration. Defaults to `false`.
29
- */
30
- readonly openRegistrations?: boolean;
31
- /**
32
- * Usage statistics for this server.
33
- */
34
- readonly 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
- readonly metadata?: Readonly<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
- readonly name: string;
50
- /**
51
- * The version of this server software.
52
- */
53
- readonly version: string;
54
- /**
55
- * The URL of the source code repository of this server software.
56
- */
57
- readonly repository?: URL;
58
- /**
59
- * The URL of the homepage of this server software.
60
- */
61
- readonly 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
- readonly inbound?: readonly InboundService[];
76
- /**
77
- * The third party sites this server can publish messages to on the behalf
78
- * of a user.
79
- */
80
- readonly outbound?: readonly 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
- readonly 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
- readonly 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
- readonly 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
- readonly 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
- readonly 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
- readonly 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 };
@@ -1,224 +0,0 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { GetUserAgentOptions } from "@fedify/vocab-runtime";
4
-
5
- //#region src/nodeinfo/types.d.ts
6
- /**
7
- * The type of the result of parsing JSON.
8
- */
9
- type JsonValue = {
10
- [key: string]: JsonValue | undefined;
11
- } | JsonValue[] | string | number | boolean | null;
12
- /**
13
- * A NodeInfo object as defined in the NodeInfo 2.1 schema.
14
- */
15
- interface NodeInfo {
16
- /**
17
- * Metadata about server software in use.
18
- */
19
- readonly software: Software;
20
- /**
21
- * The protocols supported on this server. At least one protocol must be
22
- * supported.
23
- */
24
- readonly protocols: readonly Protocol[];
25
- /**
26
- * The third party sites this server can connect to via their application API.
27
- */
28
- readonly services?: Services;
29
- /**
30
- * Whether this server allows open self-registration. Defaults to `false`.
31
- */
32
- readonly openRegistrations?: boolean;
33
- /**
34
- * Usage statistics for this server.
35
- */
36
- readonly usage: Usage;
37
- /**
38
- * Free form key value pairs for software specific values.
39
- * Clients should not rely on any specific key present.
40
- */
41
- readonly metadata?: Readonly<Record<string, JsonValue>>;
42
- }
43
- /**
44
- * Metadata about server software in use.
45
- */
46
- interface Software {
47
- /**
48
- * The canonical name of this server software. This must comply with
49
- * pattern `/^[a-z0-9-]+$/`.
50
- */
51
- readonly name: string;
52
- /**
53
- * The version of this server software.
54
- */
55
- readonly version: string;
56
- /**
57
- * The URL of the source code repository of this server software.
58
- */
59
- readonly repository?: URL;
60
- /**
61
- * The URL of the homepage of this server software.
62
- */
63
- readonly homepage?: URL;
64
- }
65
- /**
66
- * The protocols supported on this server.
67
- */
68
- type Protocol = "activitypub" | "buddycloud" | "dfrn" | "diaspora" | "libertree" | "ostatus" | "pumpio" | "tent" | "xmpp" | "zot";
69
- /**
70
- * The third party sites this server can connect to via their application API.
71
- */
72
- interface Services {
73
- /**
74
- * The third party sites this server can retrieve messages from for combined
75
- * display with regular traffic.
76
- */
77
- readonly inbound?: readonly InboundService[];
78
- /**
79
- * The third party sites this server can publish messages to on the behalf
80
- * of a user.
81
- */
82
- readonly outbound?: readonly OutboundService[];
83
- }
84
- /**
85
- * The third party sites this server can retrieve messages from for combined
86
- * display with regular traffic.
87
- */
88
- type InboundService = "atom1.0" | "gnusocial" | "imap" | "pnut" | "pop3" | "pumpio" | "rss2.0" | "twitter";
89
- /**
90
- * The third party sites this server can publish messages to on the behalf
91
- * of a user.
92
- */
93
- 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";
94
- /**
95
- * Usage statistics for this server.
96
- */
97
- interface Usage {
98
- /**
99
- * Statistics about the users of this server.
100
- */
101
- readonly users: {
102
- /**
103
- * The total amount of on this server registered users. This number
104
- * has to be an integer greater than or equal to zero.
105
- */
106
- readonly total?: number;
107
- /**
108
- * The amount of users that signed in at least once in the last 180 days.
109
- * This number has to be an integer greater than or equal to zero.
110
- */
111
- readonly activeHalfyear?: number;
112
- /**
113
- * The amount of users that signed in at least once in the last 30 days.
114
- * This number has to be an integer greater than or equal to zero.
115
- */
116
- readonly activeMonth?: number;
117
- };
118
- /**
119
- * The amount of posts that were made by users that are registered on this
120
- * server. This number has to be an integer greater than or equal to zero.
121
- */
122
- readonly localPosts: number;
123
- /**
124
- * The amount of comments that were made by users that are registered on this
125
- * server. This number has to be an integer greater than or equal to zero.
126
- */
127
- readonly localComments: number;
128
- }
129
- /**
130
- * Converts a {@link NodeInfo} object to a JSON value.
131
- * @param nodeInfo The {@link NodeInfo} object to convert.
132
- * @returns The JSON value that complies with the NodeInfo schema.
133
- * @throws {TypeError} If the {@link NodeInfo} object is invalid.
134
- */
135
- declare function nodeInfoToJson(nodeInfo: NodeInfo): JsonValue;
136
- //#endregion
137
- //#region src/nodeinfo/client.d.ts
138
- /**
139
- * Options for {@link getNodeInfo} function.
140
- * @since 1.2.0
141
- */
142
- interface GetNodeInfoOptions {
143
- /**
144
- * Whether to directly fetch the NodeInfo document from the given URL.
145
- * Otherwise, the NodeInfo document will be fetched from the `.well-known`
146
- * location of the given URL.
147
- *
148
- * Turned off by default.
149
- */
150
- direct?: boolean;
151
- /**
152
- * How strictly to parse the NodeInfo document.
153
- *
154
- * - `"strict"`: Parse the NodeInfo document strictly. If the document is
155
- * invalid, `undefined` is returned. This is the default.
156
- * - `"best-effort"`: Try to parse the NodeInfo document even if it is
157
- * invalid.
158
- * - `"none"`: Do not parse the NodeInfo document. The function will return
159
- * the raw JSON value.
160
- */
161
- parse?: "strict" | "best-effort" | "none";
162
- /**
163
- * The options for making `User-Agent` header.
164
- * If a string is given, it is used as the `User-Agent` header value.
165
- * If an object is given, it is passed to {@link getUserAgent} to generate
166
- * the `User-Agent` header value.
167
- * @since 1.3.0
168
- */
169
- userAgent?: GetUserAgentOptions | string;
170
- }
171
- /**
172
- * Fetches a NodeInfo document from the given URL.
173
- * @param url The base URL of the server. If `options.direct` is turned off
174
- * (default), the NodeInfo document will be fetched from
175
- * the `.well-known` location of this URL (hence the only origin
176
- * of the URL is used). If `options.direct` is turned on,
177
- * the NodeInfo document will be fetched from the given URL.
178
- * @param options Options for fetching the NodeInfo document.
179
- * @returns The NodeInfo document if it could be fetched successfully.
180
- * Otherwise, `undefined` is returned.
181
- * @since 1.2.0
182
- */
183
- declare function getNodeInfo(url: URL | string, options?: GetNodeInfoOptions & {
184
- parse?: "strict" | "best-effort";
185
- }): Promise<NodeInfo | undefined>;
186
- /**
187
- * Fetches a NodeInfo document from the given URL.
188
- * @param url The base URL of the server. If `options.direct` is turned off
189
- * (default), the NodeInfo document will be fetched from
190
- * the `.well-known` location of this URL (hence the only origin
191
- * of the URL is used). If `options.direct` is turned on,
192
- * the NodeInfo document will be fetched from the given URL.
193
- * @param options Options for fetching the NodeInfo document.
194
- * @returns The NodeInfo document if it could be fetched successfully.
195
- * Otherwise, `undefined` is returned.
196
- * @since 1.2.0
197
- */
198
- declare function getNodeInfo(url: URL | string, options: GetNodeInfoOptions & {
199
- parse: "none";
200
- }): Promise<JsonValue | undefined>;
201
- /**
202
- * Options for {@link parseNodeInfo} function.
203
- * @since 1.2.0
204
- */
205
- interface ParseNodeInfoOptions {
206
- /**
207
- * Whether to try to parse the NodeInfo document even if it is invalid.
208
- * If turned on, the function will return a best-effort result.
209
- *
210
- * Turned off by default.
211
- */
212
- tryBestEffort?: boolean;
213
- }
214
- /**
215
- * Parses a NodeInfo document.
216
- * @param data A JSON value that complies with the NodeInfo schema.
217
- * @param options Options for parsing the NodeInfo document.
218
- * @returns The parsed NodeInfo document if it is valid. Otherwise, `null`
219
- * is returned.
220
- * @since 1.2.0
221
- */
222
- declare function parseNodeInfo(data: unknown, options?: ParseNodeInfoOptions): NodeInfo | null;
223
- //#endregion
224
- export { GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };