@fedify/fedify 2.0.0-dev.161 → 2.0.0-dev.166
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.
- package/dist/{builder-CulJ6Oa9.js → builder-Khy2m25E.js} +3 -3
- package/dist/{client-BivSNrEg.d.ts → client-CUTUGgvJ.d.ts} +18 -18
- package/dist/{client-CgMTXmAD.js → client-Dg7OfUDA.js} +27 -22
- package/dist/{client-94iWEfQa.d.cts → client-by-PEGAJ.d.cts} +18 -18
- package/dist/compat/mod.d.cts +4 -4
- package/dist/compat/mod.d.ts +4 -4
- package/dist/compat/transformers.test.js +13 -13
- package/dist/{context-CYZ2i00R.d.ts → context-C7vzWilY.d.ts} +58 -58
- package/dist/{context-D2MrtLch.d.cts → context-CrB9RFy5.d.cts} +58 -58
- package/dist/{deno-DIwNGswC.js → deno-Cif1-iL_.js} +1 -1
- package/dist/{docloader-D2992pGD.js → docloader-CVaWaEcp.js} +2 -2
- package/dist/federation/builder.test.js +3 -3
- package/dist/federation/handler.test.js +13 -13
- package/dist/federation/idempotency.test.js +13 -13
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/middleware.test.js +13 -13
- package/dist/federation/mod.cjs +5 -5
- package/dist/federation/mod.d.cts +4 -4
- package/dist/federation/mod.d.ts +4 -4
- package/dist/federation/mod.js +5 -5
- package/dist/federation/send.test.js +5 -5
- package/dist/federation/webfinger.test.js +13 -13
- package/dist/{http-BV9SKFK0.js → http-B99rtXjf.js} +2 -2
- package/dist/{http-3fEbsHa0.js → http-CY-Bbe9s.js} +1 -1
- package/dist/{http-C06iL_Qv.cjs → http-DfyrqzT4.cjs} +1 -1
- package/dist/{inbox-DCV2fS3F.js → inbox-BC3B2xqc.js} +1 -1
- package/dist/{key-Bdc11xlQ.js → key-Bw4eVboO.js} +1 -1
- package/dist/{kv-D8q9fLkA.d.cts → kv-B4vFhIYL.d.cts} +2 -2
- package/dist/{kv-CtOmTRNc.d.ts → kv-CYySNrsn.d.ts} +2 -2
- package/dist/{kv-cache-B4-ASVht.js → kv-cache-BCsLgQXU.js} +1 -1
- package/dist/{kv-cache-CQjPwWHu.cjs → kv-cache-Cerg94jw.cjs} +1 -1
- package/dist/{ld-C7be04RF.js → ld-1OEVoX2N.js} +2 -2
- package/dist/{middleware-C4_a2DNI.js → middleware-7qNi2Qwp.js} +9 -10
- package/dist/{middleware-9RlUwILK.js → middleware-B7mdNwwo.js} +5 -5
- package/dist/{middleware-C3xnTI2Z.js → middleware-CQv0UNYy.js} +16 -17
- package/dist/{middleware-B_mOdzoC.cjs → middleware-CvNusBTn.cjs} +9 -10
- package/dist/middleware-Dem4kH_q.js +26 -0
- package/dist/middleware-TgcMW8QT.cjs +12 -0
- package/dist/{mod-DcPRcifg.d.cts → mod-0p9zUdzg.d.cts} +5 -5
- package/dist/{mod-CS-MS7gZ.d.cts → mod-0qnPv4EC.d.cts} +1 -1
- package/dist/{mod-DqFSzJA0.d.ts → mod-C3SOvTD1.d.ts} +1 -1
- package/dist/{mod-CNNTHyBC.d.cts → mod-D6pS5_xJ.d.cts} +1 -1
- package/dist/{mod-D_cmv2il.d.ts → mod-waqu-BL_.d.ts} +1 -1
- package/dist/{mod-CJgbdSqb.d.ts → mod-xc20HhMD.d.ts} +5 -5
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.js +1 -1
- package/dist/nodeinfo/handler.test.js +13 -13
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/nodeinfo/types.test.js +1 -1
- package/dist/otel/exporter.test.js +7 -13
- package/dist/otel/mod.cjs +7 -13
- package/dist/otel/mod.d.cts +22 -22
- package/dist/otel/mod.d.ts +22 -22
- package/dist/otel/mod.js +7 -13
- package/dist/{owner-Bs5Y5twE.js → owner-w_YNARRI.js} +1 -1
- package/dist/{proof-CFwktc0B.js → proof-C8vStykH.js} +2 -2
- package/dist/{proof-CaA7ysDp.cjs → proof-CJZ5gNjq.cjs} +1 -1
- package/dist/{proof-C-751PeN.js → proof-aPT2G2bY.js} +1 -1
- package/dist/{send-C288Vw8b.js → send-C77cZsvd.js} +2 -2
- package/dist/sig/http.test.js +3 -3
- package/dist/sig/key.test.js +2 -2
- package/dist/sig/ld.test.js +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/testing/mod.d.ts +64 -64
- package/dist/{types-hKTi53FO.js → types-8l28uC8o.js} +30 -25
- package/dist/{types-Q-qkJXBV.cjs → types-B6z6CqIz.cjs} +30 -25
- package/dist/{types-BEdCLHqP.js → types-CPz01LGH.js} +3 -3
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +2 -2
- package/dist/utils/mod.d.cts +2 -2
- package/dist/utils/mod.d.ts +2 -2
- package/dist/utils/mod.js +2 -2
- package/package.json +6 -6
- package/dist/middleware-C9iGBAP1.cjs +0 -12
- package/dist/middleware-CYlahvpt.js +0 -26
package/dist/testing/mod.d.ts
CHANGED
|
@@ -21,29 +21,29 @@ interface NodeInfo {
|
|
|
21
21
|
/**
|
|
22
22
|
* Metadata about server software in use.
|
|
23
23
|
*/
|
|
24
|
-
software: Software;
|
|
24
|
+
readonly software: Software;
|
|
25
25
|
/**
|
|
26
26
|
* The protocols supported on this server. At least one protocol must be
|
|
27
27
|
* supported.
|
|
28
28
|
*/
|
|
29
|
-
protocols: Protocol[];
|
|
29
|
+
readonly protocols: readonly Protocol[];
|
|
30
30
|
/**
|
|
31
31
|
* The third party sites this server can connect to via their application API.
|
|
32
32
|
*/
|
|
33
|
-
services?: Services;
|
|
33
|
+
readonly services?: Services;
|
|
34
34
|
/**
|
|
35
35
|
* Whether this server allows open self-registration. Defaults to `false`.
|
|
36
36
|
*/
|
|
37
|
-
openRegistrations?: boolean;
|
|
37
|
+
readonly openRegistrations?: boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Usage statistics for this server.
|
|
40
40
|
*/
|
|
41
|
-
usage: Usage;
|
|
41
|
+
readonly usage: Usage;
|
|
42
42
|
/**
|
|
43
43
|
* Free form key value pairs for software specific values.
|
|
44
44
|
* Clients should not rely on any specific key present.
|
|
45
45
|
*/
|
|
46
|
-
metadata?: Record<string, JsonValue
|
|
46
|
+
readonly metadata?: Readonly<Record<string, JsonValue>>;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Metadata about server software in use.
|
|
@@ -53,19 +53,19 @@ interface Software {
|
|
|
53
53
|
* The canonical name of this server software. This must comply with
|
|
54
54
|
* pattern `/^[a-z0-9-]+$/`.
|
|
55
55
|
*/
|
|
56
|
-
name: string;
|
|
56
|
+
readonly name: string;
|
|
57
57
|
/**
|
|
58
58
|
* The version of this server software.
|
|
59
59
|
*/
|
|
60
|
-
version: string;
|
|
60
|
+
readonly version: string;
|
|
61
61
|
/**
|
|
62
62
|
* The URL of the source code repository of this server software.
|
|
63
63
|
*/
|
|
64
|
-
repository?: URL;
|
|
64
|
+
readonly repository?: URL;
|
|
65
65
|
/**
|
|
66
66
|
* The URL of the homepage of this server software.
|
|
67
67
|
*/
|
|
68
|
-
homepage?: URL;
|
|
68
|
+
readonly homepage?: URL;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* The protocols supported on this server.
|
|
@@ -79,12 +79,12 @@ interface Services {
|
|
|
79
79
|
* The third party sites this server can retrieve messages from for combined
|
|
80
80
|
* display with regular traffic.
|
|
81
81
|
*/
|
|
82
|
-
inbound?: InboundService[];
|
|
82
|
+
readonly inbound?: readonly InboundService[];
|
|
83
83
|
/**
|
|
84
84
|
* The third party sites this server can publish messages to on the behalf
|
|
85
85
|
* of a user.
|
|
86
86
|
*/
|
|
87
|
-
outbound?: OutboundService[];
|
|
87
|
+
readonly outbound?: readonly OutboundService[];
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* The third party sites this server can retrieve messages from for combined
|
|
@@ -103,33 +103,33 @@ interface Usage {
|
|
|
103
103
|
/**
|
|
104
104
|
* Statistics about the users of this server.
|
|
105
105
|
*/
|
|
106
|
-
users: {
|
|
106
|
+
readonly users: {
|
|
107
107
|
/**
|
|
108
108
|
* The total amount of on this server registered users. This number
|
|
109
109
|
* has to be an integer greater than or equal to zero.
|
|
110
110
|
*/
|
|
111
|
-
total?: number;
|
|
111
|
+
readonly total?: number;
|
|
112
112
|
/**
|
|
113
113
|
* The amount of users that signed in at least once in the last 180 days.
|
|
114
114
|
* This number has to be an integer greater than or equal to zero.
|
|
115
115
|
*/
|
|
116
|
-
activeHalfyear?: number;
|
|
116
|
+
readonly activeHalfyear?: number;
|
|
117
117
|
/**
|
|
118
118
|
* The amount of users that signed in at least once in the last 30 days.
|
|
119
119
|
* This number has to be an integer greater than or equal to zero.
|
|
120
120
|
*/
|
|
121
|
-
activeMonth?: number;
|
|
121
|
+
readonly activeMonth?: number;
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* The amount of posts that were made by users that are registered on this
|
|
125
125
|
* server. This number has to be an integer greater than or equal to zero.
|
|
126
126
|
*/
|
|
127
|
-
localPosts: number;
|
|
127
|
+
readonly localPosts: number;
|
|
128
128
|
/**
|
|
129
129
|
* The amount of comments that were made by users that are registered on this
|
|
130
130
|
* server. This number has to be an integer greater than or equal to zero.
|
|
131
131
|
*/
|
|
132
|
-
localComments: number;
|
|
132
|
+
readonly localComments: number;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
135
|
* Converts a {@link NodeInfo} object to a JSON value.
|
|
@@ -222,9 +222,9 @@ interface GetKeyOwnerOptions {
|
|
|
222
222
|
* A page of items.
|
|
223
223
|
*/
|
|
224
224
|
interface PageItems<TItem> {
|
|
225
|
-
prevCursor?: string | null;
|
|
226
|
-
nextCursor?: string | null;
|
|
227
|
-
items: TItem[];
|
|
225
|
+
readonly prevCursor?: string | null;
|
|
226
|
+
readonly nextCursor?: string | null;
|
|
227
|
+
readonly items: readonly TItem[];
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* Calculates the [partial follower collection digest][1].
|
|
@@ -244,11 +244,11 @@ interface SenderKeyPair {
|
|
|
244
244
|
/**
|
|
245
245
|
* The actor's private key to sign the request.
|
|
246
246
|
*/
|
|
247
|
-
privateKey: CryptoKey;
|
|
247
|
+
readonly privateKey: CryptoKey;
|
|
248
248
|
/**
|
|
249
249
|
* The public key ID that corresponds to the private key.
|
|
250
250
|
*/
|
|
251
|
-
keyId: URL;
|
|
251
|
+
readonly keyId: URL;
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Parameters for {@link sendActivity}.
|
|
@@ -498,8 +498,8 @@ type CustomCollectionCursor<TParam extends string, TContext extends Context<TCon
|
|
|
498
498
|
//#endregion
|
|
499
499
|
//#region src/federation/queue.d.ts
|
|
500
500
|
interface SenderKeyJwkPair {
|
|
501
|
-
keyId: string;
|
|
502
|
-
privateKey: JsonWebKey;
|
|
501
|
+
readonly keyId: string;
|
|
502
|
+
readonly privateKey: JsonWebKey;
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
505
|
* A message that represents a task to be processed by the background worker.
|
|
@@ -512,44 +512,44 @@ interface SenderKeyJwkPair {
|
|
|
512
512
|
*/
|
|
513
513
|
type Message = FanoutMessage | OutboxMessage | InboxMessage;
|
|
514
514
|
interface FanoutMessage {
|
|
515
|
-
type: "fanout";
|
|
516
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
517
|
-
baseUrl: string;
|
|
518
|
-
keys: SenderKeyJwkPair[];
|
|
519
|
-
inboxes: Record<string, {
|
|
520
|
-
actorIds: string[];
|
|
521
|
-
sharedInbox: boolean;
|
|
522
|
-
}
|
|
523
|
-
activity: unknown;
|
|
524
|
-
activityId?: string;
|
|
525
|
-
activityType: string;
|
|
526
|
-
collectionSync?: string;
|
|
527
|
-
traceContext: Record<string, string
|
|
515
|
+
readonly type: "fanout";
|
|
516
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
517
|
+
readonly baseUrl: string;
|
|
518
|
+
readonly keys: readonly SenderKeyJwkPair[];
|
|
519
|
+
readonly inboxes: Readonly<Record<string, {
|
|
520
|
+
readonly actorIds: readonly string[];
|
|
521
|
+
readonly sharedInbox: boolean;
|
|
522
|
+
}>>;
|
|
523
|
+
readonly activity: unknown;
|
|
524
|
+
readonly activityId?: string;
|
|
525
|
+
readonly activityType: string;
|
|
526
|
+
readonly collectionSync?: string;
|
|
527
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
528
528
|
}
|
|
529
529
|
interface OutboxMessage {
|
|
530
|
-
type: "outbox";
|
|
531
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
532
|
-
baseUrl: string;
|
|
533
|
-
keys: SenderKeyJwkPair[];
|
|
534
|
-
activity: unknown;
|
|
535
|
-
activityId?: string;
|
|
536
|
-
activityType: string;
|
|
537
|
-
inbox: string;
|
|
538
|
-
sharedInbox: boolean;
|
|
539
|
-
started: string;
|
|
540
|
-
attempt: number;
|
|
541
|
-
headers: Record<string, string
|
|
542
|
-
traceContext: Record<string, string
|
|
530
|
+
readonly type: "outbox";
|
|
531
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
532
|
+
readonly baseUrl: string;
|
|
533
|
+
readonly keys: readonly SenderKeyJwkPair[];
|
|
534
|
+
readonly activity: unknown;
|
|
535
|
+
readonly activityId?: string;
|
|
536
|
+
readonly activityType: string;
|
|
537
|
+
readonly inbox: string;
|
|
538
|
+
readonly sharedInbox: boolean;
|
|
539
|
+
readonly started: string;
|
|
540
|
+
readonly attempt: number;
|
|
541
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
542
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
543
543
|
}
|
|
544
544
|
interface InboxMessage {
|
|
545
|
-
type: "inbox";
|
|
546
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
547
|
-
baseUrl: string;
|
|
548
|
-
activity: unknown;
|
|
549
|
-
started: string;
|
|
550
|
-
attempt: number;
|
|
551
|
-
identifier: string | null;
|
|
552
|
-
traceContext: Record<string, string
|
|
545
|
+
readonly type: "inbox";
|
|
546
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
547
|
+
readonly baseUrl: string;
|
|
548
|
+
readonly activity: unknown;
|
|
549
|
+
readonly started: string;
|
|
550
|
+
readonly attempt: number;
|
|
551
|
+
readonly identifier: string | null;
|
|
552
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
553
553
|
}
|
|
554
554
|
//#endregion
|
|
555
555
|
//#region src/federation/federation.d.ts
|
|
@@ -1765,7 +1765,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
1765
1765
|
* inbox, it is `null`.
|
|
1766
1766
|
* @since 1.2.0
|
|
1767
1767
|
*/
|
|
1768
|
-
recipient: string | null;
|
|
1768
|
+
readonly recipient: string | null;
|
|
1769
1769
|
/**
|
|
1770
1770
|
* Creates a new context with the same properties as this one,
|
|
1771
1771
|
* but with the given data.
|
|
@@ -1955,7 +1955,7 @@ interface SendActivityOptions {
|
|
|
1955
1955
|
*
|
|
1956
1956
|
* @since 0.9.0
|
|
1957
1957
|
*/
|
|
1958
|
-
excludeBaseUris?: URL[];
|
|
1958
|
+
readonly excludeBaseUris?: readonly URL[];
|
|
1959
1959
|
}
|
|
1960
1960
|
/**
|
|
1961
1961
|
* Options for {@link Context.sendActivity} method when sending to a collection.
|
|
@@ -2038,15 +2038,15 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2038
2038
|
/**
|
|
2039
2039
|
* The URI of the public key, which is used for verifying HTTP Signatures.
|
|
2040
2040
|
*/
|
|
2041
|
-
keyId: URL;
|
|
2041
|
+
readonly keyId: URL;
|
|
2042
2042
|
/**
|
|
2043
2043
|
* A {@link CryptographicKey} instance of the public key.
|
|
2044
2044
|
*/
|
|
2045
|
-
cryptographicKey: CryptographicKey;
|
|
2045
|
+
readonly cryptographicKey: CryptographicKey;
|
|
2046
2046
|
/**
|
|
2047
2047
|
* A {@link Multikey} instance of the public key.
|
|
2048
2048
|
*/
|
|
2049
|
-
multikey: Multikey;
|
|
2049
|
+
readonly multikey: Multikey;
|
|
2050
2050
|
}
|
|
2051
2051
|
//#endregion
|
|
2052
2052
|
//#region src/testing/context.d.ts
|
|
@@ -110,15 +110,14 @@ function parseNodeInfo(data, options = {}) {
|
|
|
110
110
|
if (typeof data.metadata === "object" && data.metadata != null) metadata = Object.fromEntries(Object.entries(data.metadata));
|
|
111
111
|
else if (!options.tryBestEffort) return null;
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
return {
|
|
114
114
|
software,
|
|
115
115
|
protocols,
|
|
116
|
-
usage
|
|
116
|
+
usage,
|
|
117
|
+
...services != null && { services },
|
|
118
|
+
...openRegistrations != null && { openRegistrations },
|
|
119
|
+
...metadata != null && { metadata }
|
|
117
120
|
};
|
|
118
|
-
if (services != null) result.services = services;
|
|
119
|
-
if (openRegistrations != null) result.openRegistrations = openRegistrations;
|
|
120
|
-
if (metadata != null) result.metadata = metadata;
|
|
121
|
-
return result;
|
|
122
121
|
}
|
|
123
122
|
function parseSoftware(data, options = {}) {
|
|
124
123
|
if (typeof data !== "object" || data == null) {
|
|
@@ -154,13 +153,12 @@ function parseSoftware(data, options = {}) {
|
|
|
154
153
|
}
|
|
155
154
|
else if (!options.tryBestEffort) return null;
|
|
156
155
|
}
|
|
157
|
-
|
|
156
|
+
return {
|
|
158
157
|
name,
|
|
159
|
-
version
|
|
158
|
+
version,
|
|
159
|
+
...repository != null && { repository },
|
|
160
|
+
...homepage != null && { homepage }
|
|
160
161
|
};
|
|
161
|
-
if (repository != null) result.repository = repository;
|
|
162
|
-
if (homepage != null) result.homepage = homepage;
|
|
163
|
-
return result;
|
|
164
162
|
}
|
|
165
163
|
function parseProtocol(data) {
|
|
166
164
|
if (data === "activitypub" || data === "buddycloud" || data === "dfrn" || data === "diaspora" || data === "libertree" || data === "ostatus" || data === "pumpio" || data === "tent" || data === "xmpp" || data === "zot") return data;
|
|
@@ -183,10 +181,10 @@ function parseServices(data, options = {}) {
|
|
|
183
181
|
outbound = os.filter((o) => o != null);
|
|
184
182
|
if (os.length > outbound.length && !options.tryBestEffort) return null;
|
|
185
183
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
return {
|
|
185
|
+
...inbound != null && { inbound },
|
|
186
|
+
...outbound != null && { outbound }
|
|
187
|
+
};
|
|
190
188
|
}
|
|
191
189
|
function parseInboundService(data) {
|
|
192
190
|
if (data === "atom1.0" || data === "gnusocial" || data === "imap" || data === "pnut" || data === "pop3" || data === "pumpio" || data === "rss2.0" || data === "twitter") return data;
|
|
@@ -198,33 +196,40 @@ function parseOutboundService(data) {
|
|
|
198
196
|
}
|
|
199
197
|
function parseUsage(data, options = {}) {
|
|
200
198
|
if (typeof data !== "object" || data == null) return null;
|
|
201
|
-
|
|
199
|
+
let total;
|
|
200
|
+
let activeHalfyear;
|
|
201
|
+
let activeMonth;
|
|
202
202
|
if ("users" in data && typeof data.users === "object" && data.users != null) {
|
|
203
|
-
if ("total" in data.users) if (typeof data.users.total === "number")
|
|
203
|
+
if ("total" in data.users) if (typeof data.users.total === "number") total = data.users.total;
|
|
204
204
|
else {
|
|
205
205
|
if (!options.tryBestEffort) return null;
|
|
206
206
|
if (typeof data.users.total === "string") {
|
|
207
207
|
const n = parseInt(data.users.total);
|
|
208
|
-
if (!isNaN(n))
|
|
208
|
+
if (!isNaN(n)) total = n;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
if ("activeHalfyear" in data.users) if (typeof data.users.activeHalfyear === "number")
|
|
211
|
+
if ("activeHalfyear" in data.users) if (typeof data.users.activeHalfyear === "number") activeHalfyear = data.users.activeHalfyear;
|
|
212
212
|
else {
|
|
213
213
|
if (!options.tryBestEffort) return null;
|
|
214
214
|
if (typeof data.users.activeHalfyear === "string") {
|
|
215
215
|
const n = parseInt(data.users.activeHalfyear);
|
|
216
|
-
if (!isNaN(n))
|
|
216
|
+
if (!isNaN(n)) activeHalfyear = n;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
if ("activeMonth" in data.users) if (typeof data.users.activeMonth === "number")
|
|
219
|
+
if ("activeMonth" in data.users) if (typeof data.users.activeMonth === "number") activeMonth = data.users.activeMonth;
|
|
220
220
|
else {
|
|
221
221
|
if (!options.tryBestEffort) return null;
|
|
222
222
|
if (typeof data.users.activeMonth === "string") {
|
|
223
223
|
const n = parseInt(data.users.activeMonth);
|
|
224
|
-
if (!isNaN(n))
|
|
224
|
+
if (!isNaN(n)) activeMonth = n;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
} else if (!options.tryBestEffort) return null;
|
|
228
|
+
const users = {
|
|
229
|
+
...total != null && { total },
|
|
230
|
+
...activeHalfyear != null && { activeHalfyear },
|
|
231
|
+
...activeMonth != null && { activeMonth }
|
|
232
|
+
};
|
|
228
233
|
let localPosts = 0;
|
|
229
234
|
if ("localPosts" in data) if (typeof data.localPosts === "number") localPosts = data.localPosts;
|
|
230
235
|
else {
|
|
@@ -275,13 +280,13 @@ function nodeInfoToJson(nodeInfo) {
|
|
|
275
280
|
repository: nodeInfo.software.repository?.href,
|
|
276
281
|
homepage: nodeInfo.software.homepage?.href
|
|
277
282
|
},
|
|
278
|
-
protocols: nodeInfo.protocols,
|
|
283
|
+
protocols: [...nodeInfo.protocols],
|
|
279
284
|
services: nodeInfo.services == null ? {
|
|
280
285
|
inbound: [],
|
|
281
286
|
outbound: []
|
|
282
287
|
} : {
|
|
283
|
-
inbound: nodeInfo.services.inbound
|
|
284
|
-
outbound: nodeInfo.services.outbound
|
|
288
|
+
inbound: nodeInfo.services.inbound ? [...nodeInfo.services.inbound] : [],
|
|
289
|
+
outbound: nodeInfo.services.outbound ? [...nodeInfo.services.outbound] : []
|
|
285
290
|
},
|
|
286
291
|
openRegistrations: nodeInfo.openRegistrations ?? false,
|
|
287
292
|
usage: {
|
|
@@ -111,15 +111,14 @@ function parseNodeInfo(data, options = {}) {
|
|
|
111
111
|
if (typeof data.metadata === "object" && data.metadata != null) metadata = Object.fromEntries(Object.entries(data.metadata));
|
|
112
112
|
else if (!options.tryBestEffort) return null;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
return {
|
|
115
115
|
software,
|
|
116
116
|
protocols,
|
|
117
|
-
usage
|
|
117
|
+
usage,
|
|
118
|
+
...services != null && { services },
|
|
119
|
+
...openRegistrations != null && { openRegistrations },
|
|
120
|
+
...metadata != null && { metadata }
|
|
118
121
|
};
|
|
119
|
-
if (services != null) result.services = services;
|
|
120
|
-
if (openRegistrations != null) result.openRegistrations = openRegistrations;
|
|
121
|
-
if (metadata != null) result.metadata = metadata;
|
|
122
|
-
return result;
|
|
123
122
|
}
|
|
124
123
|
function parseSoftware(data, options = {}) {
|
|
125
124
|
if (typeof data !== "object" || data == null) {
|
|
@@ -155,13 +154,12 @@ function parseSoftware(data, options = {}) {
|
|
|
155
154
|
}
|
|
156
155
|
else if (!options.tryBestEffort) return null;
|
|
157
156
|
}
|
|
158
|
-
|
|
157
|
+
return {
|
|
159
158
|
name,
|
|
160
|
-
version
|
|
159
|
+
version,
|
|
160
|
+
...repository != null && { repository },
|
|
161
|
+
...homepage != null && { homepage }
|
|
161
162
|
};
|
|
162
|
-
if (repository != null) result.repository = repository;
|
|
163
|
-
if (homepage != null) result.homepage = homepage;
|
|
164
|
-
return result;
|
|
165
163
|
}
|
|
166
164
|
function parseProtocol(data) {
|
|
167
165
|
if (data === "activitypub" || data === "buddycloud" || data === "dfrn" || data === "diaspora" || data === "libertree" || data === "ostatus" || data === "pumpio" || data === "tent" || data === "xmpp" || data === "zot") return data;
|
|
@@ -184,10 +182,10 @@ function parseServices(data, options = {}) {
|
|
|
184
182
|
outbound = os.filter((o) => o != null);
|
|
185
183
|
if (os.length > outbound.length && !options.tryBestEffort) return null;
|
|
186
184
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
return {
|
|
186
|
+
...inbound != null && { inbound },
|
|
187
|
+
...outbound != null && { outbound }
|
|
188
|
+
};
|
|
191
189
|
}
|
|
192
190
|
function parseInboundService(data) {
|
|
193
191
|
if (data === "atom1.0" || data === "gnusocial" || data === "imap" || data === "pnut" || data === "pop3" || data === "pumpio" || data === "rss2.0" || data === "twitter") return data;
|
|
@@ -199,33 +197,40 @@ function parseOutboundService(data) {
|
|
|
199
197
|
}
|
|
200
198
|
function parseUsage(data, options = {}) {
|
|
201
199
|
if (typeof data !== "object" || data == null) return null;
|
|
202
|
-
|
|
200
|
+
let total;
|
|
201
|
+
let activeHalfyear;
|
|
202
|
+
let activeMonth;
|
|
203
203
|
if ("users" in data && typeof data.users === "object" && data.users != null) {
|
|
204
|
-
if ("total" in data.users) if (typeof data.users.total === "number")
|
|
204
|
+
if ("total" in data.users) if (typeof data.users.total === "number") total = data.users.total;
|
|
205
205
|
else {
|
|
206
206
|
if (!options.tryBestEffort) return null;
|
|
207
207
|
if (typeof data.users.total === "string") {
|
|
208
208
|
const n = parseInt(data.users.total);
|
|
209
|
-
if (!isNaN(n))
|
|
209
|
+
if (!isNaN(n)) total = n;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
if ("activeHalfyear" in data.users) if (typeof data.users.activeHalfyear === "number")
|
|
212
|
+
if ("activeHalfyear" in data.users) if (typeof data.users.activeHalfyear === "number") activeHalfyear = data.users.activeHalfyear;
|
|
213
213
|
else {
|
|
214
214
|
if (!options.tryBestEffort) return null;
|
|
215
215
|
if (typeof data.users.activeHalfyear === "string") {
|
|
216
216
|
const n = parseInt(data.users.activeHalfyear);
|
|
217
|
-
if (!isNaN(n))
|
|
217
|
+
if (!isNaN(n)) activeHalfyear = n;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
if ("activeMonth" in data.users) if (typeof data.users.activeMonth === "number")
|
|
220
|
+
if ("activeMonth" in data.users) if (typeof data.users.activeMonth === "number") activeMonth = data.users.activeMonth;
|
|
221
221
|
else {
|
|
222
222
|
if (!options.tryBestEffort) return null;
|
|
223
223
|
if (typeof data.users.activeMonth === "string") {
|
|
224
224
|
const n = parseInt(data.users.activeMonth);
|
|
225
|
-
if (!isNaN(n))
|
|
225
|
+
if (!isNaN(n)) activeMonth = n;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
} else if (!options.tryBestEffort) return null;
|
|
229
|
+
const users = {
|
|
230
|
+
...total != null && { total },
|
|
231
|
+
...activeHalfyear != null && { activeHalfyear },
|
|
232
|
+
...activeMonth != null && { activeMonth }
|
|
233
|
+
};
|
|
229
234
|
let localPosts = 0;
|
|
230
235
|
if ("localPosts" in data) if (typeof data.localPosts === "number") localPosts = data.localPosts;
|
|
231
236
|
else {
|
|
@@ -276,13 +281,13 @@ function nodeInfoToJson(nodeInfo) {
|
|
|
276
281
|
repository: nodeInfo.software.repository?.href,
|
|
277
282
|
homepage: nodeInfo.software.homepage?.href
|
|
278
283
|
},
|
|
279
|
-
protocols: nodeInfo.protocols,
|
|
284
|
+
protocols: [...nodeInfo.protocols],
|
|
280
285
|
services: nodeInfo.services == null ? {
|
|
281
286
|
inbound: [],
|
|
282
287
|
outbound: []
|
|
283
288
|
} : {
|
|
284
|
-
inbound: nodeInfo.services.inbound
|
|
285
|
-
outbound: nodeInfo.services.outbound
|
|
289
|
+
inbound: nodeInfo.services.inbound ? [...nodeInfo.services.inbound] : [],
|
|
290
|
+
outbound: nodeInfo.services.outbound ? [...nodeInfo.services.outbound] : []
|
|
286
291
|
},
|
|
287
292
|
openRegistrations: nodeInfo.openRegistrations ?? false,
|
|
288
293
|
usage: {
|
|
@@ -27,13 +27,13 @@ function nodeInfoToJson(nodeInfo) {
|
|
|
27
27
|
repository: nodeInfo.software.repository?.href,
|
|
28
28
|
homepage: nodeInfo.software.homepage?.href
|
|
29
29
|
},
|
|
30
|
-
protocols: nodeInfo.protocols,
|
|
30
|
+
protocols: [...nodeInfo.protocols],
|
|
31
31
|
services: nodeInfo.services == null ? {
|
|
32
32
|
inbound: [],
|
|
33
33
|
outbound: []
|
|
34
34
|
} : {
|
|
35
|
-
inbound: nodeInfo.services.inbound
|
|
36
|
-
outbound: nodeInfo.services.outbound
|
|
35
|
+
inbound: nodeInfo.services.inbound ? [...nodeInfo.services.inbound] : [],
|
|
36
|
+
outbound: nodeInfo.services.outbound ? [...nodeInfo.services.outbound] : []
|
|
37
37
|
},
|
|
38
38
|
openRegistrations: nodeInfo.openRegistrations ?? false,
|
|
39
39
|
usage: {
|
|
@@ -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-
|
|
11
|
-
import "../key-
|
|
12
|
-
import { verifyRequest } from "../http-
|
|
13
|
-
import { getAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import "../deno-Cif1-iL_.js";
|
|
11
|
+
import "../key-Bw4eVboO.js";
|
|
12
|
+
import { verifyRequest } from "../http-B99rtXjf.js";
|
|
13
|
+
import { getAuthenticatedDocumentLoader } from "../docloader-CVaWaEcp.js";
|
|
14
14
|
import "../std__assert-DWivtrGR.js";
|
|
15
15
|
import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
16
16
|
import "../assert_throws-BNXdRGWP.js";
|
package/dist/utils/mod.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
|
-
require('../http-
|
|
6
|
-
const require_kv_cache = require('../kv-cache-
|
|
5
|
+
require('../http-DfyrqzT4.cjs');
|
|
6
|
+
const require_kv_cache = require('../kv-cache-Cerg94jw.cjs');
|
|
7
7
|
require('../utils-Db0ZmjcD.cjs');
|
|
8
8
|
|
|
9
9
|
exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
|
package/dist/utils/mod.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "../http-ClB3pLcL.cjs";
|
|
2
|
-
import "../kv-
|
|
3
|
-
import { getAuthenticatedDocumentLoader, kvCache } from "../mod-
|
|
2
|
+
import "../kv-B4vFhIYL.cjs";
|
|
3
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "../mod-0p9zUdzg.cjs";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|
package/dist/utils/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import "../http-DLBDPal9.js";
|
|
4
|
-
import "../kv-
|
|
5
|
-
import { getAuthenticatedDocumentLoader, kvCache } from "../mod-
|
|
4
|
+
import "../kv-CYySNrsn.js";
|
|
5
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "../mod-xc20HhMD.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-
|
|
6
|
-
import { getAuthenticatedDocumentLoader, kvCache } from "../kv-cache-
|
|
5
|
+
import "../http-CY-Bbe9s.js";
|
|
6
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "../kv-cache-BCsLgQXU.js";
|
|
7
7
|
import "../utils-Wranxuoe.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.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.166+15dea3c0",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -125,9 +125,9 @@
|
|
|
125
125
|
"uri-template-router": "^1.0.0",
|
|
126
126
|
"url-template": "^3.1.1",
|
|
127
127
|
"urlpattern-polyfill": "^10.1.0",
|
|
128
|
-
"@fedify/vocab": "2.0.0-dev.
|
|
129
|
-
"@fedify/
|
|
130
|
-
"@fedify/
|
|
128
|
+
"@fedify/vocab": "2.0.0-dev.166+15dea3c0",
|
|
129
|
+
"@fedify/vocab-runtime": "2.0.0-dev.166+15dea3c0",
|
|
130
|
+
"@fedify/webfinger": "2.0.0-dev.166+15dea3c0"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": {
|
|
133
133
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"tsx": "^4.19.4",
|
|
140
140
|
"typescript": "^5.9.3",
|
|
141
141
|
"wrangler": "^4.17.0",
|
|
142
|
-
"@fedify/
|
|
143
|
-
"@fedify/
|
|
142
|
+
"@fedify/fixture": "2.0.0",
|
|
143
|
+
"@fedify/vocab-tools": "^2.0.0-dev.166+15dea3c0"
|
|
144
144
|
},
|
|
145
145
|
"scripts": {
|
|
146
146
|
"build": "tsdown",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
-
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
-
|
|
5
|
-
require('./transformers-BjBg6Lag.cjs');
|
|
6
|
-
require('./http-C06iL_Qv.cjs');
|
|
7
|
-
const require_middleware = require('./middleware-B_mOdzoC.cjs');
|
|
8
|
-
require('./proof-CaA7ysDp.cjs');
|
|
9
|
-
require('./types-Q-qkJXBV.cjs');
|
|
10
|
-
require('./kv-cache-CQjPwWHu.cjs');
|
|
11
|
-
|
|
12
|
-
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
6
|
-
import "./deno-DIwNGswC.js";
|
|
7
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-C3xnTI2Z.js";
|
|
8
|
-
import "./client-CgMTXmAD.js";
|
|
9
|
-
import "./router-D9eI0s4b.js";
|
|
10
|
-
import "./types-BEdCLHqP.js";
|
|
11
|
-
import "./key-Bdc11xlQ.js";
|
|
12
|
-
import "./http-BV9SKFK0.js";
|
|
13
|
-
import "./ld-C7be04RF.js";
|
|
14
|
-
import "./owner-Bs5Y5twE.js";
|
|
15
|
-
import "./proof-CFwktc0B.js";
|
|
16
|
-
import "./docloader-D2992pGD.js";
|
|
17
|
-
import "./kv-cache-BEeqyGER.js";
|
|
18
|
-
import "./inbox-DCV2fS3F.js";
|
|
19
|
-
import "./builder-CulJ6Oa9.js";
|
|
20
|
-
import "./collection-CcnIw1qY.js";
|
|
21
|
-
import "./keycache-DRxpZ5r9.js";
|
|
22
|
-
import "./negotiation-5NPJL6zp.js";
|
|
23
|
-
import "./retry-D4GJ670a.js";
|
|
24
|
-
import "./send-C288Vw8b.js";
|
|
25
|
-
|
|
26
|
-
export { FederationImpl };
|