@fedify/fedify 2.2.0-dev.613 → 2.2.0-dev.622
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/{accept-D7sAxyNa.js → accept-Dd__NiUL.mjs} +10 -8
- package/dist/{assert-MZs1qjMx.js → assert-ddO5KLpe.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-0h7I2Esa.js → assert_rejects-B-qJtC9Z.mjs} +6 -11
- package/dist/{assert_throws-rjdMBf31.js → assert_throws-4NwKEy2q.mjs} +5 -10
- package/dist/{builder-OscY92PK.js → builder-DcSpny3g.mjs} +32 -41
- package/dist/{chunk-CGaQZ11T.cjs → chunk-DDcVe30Y.cjs} +23 -24
- package/dist/{chunk-DJNbSFdH.js → chunk-nlSIicah.js} +8 -8
- package/dist/{client-BxMZiQaD.d.ts → client-AtlibPOU.d.ts} +1 -1
- package/dist/{client-CoCIaTNO.js → client-DEpOVgY1.mjs} +9 -13
- package/dist/{client-C97KOq3x.d.cts → client-z-8dc-e1.d.cts} +1 -1
- package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -6
- package/dist/compat/mod.d.ts +78 -6
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-DyJjQQ_H.d.ts → context-BOiMZBu5.d.ts} +9 -18
- package/dist/{context-BcqA-0BL.d.cts → context-BhZVy7RB.d.cts} +9 -18
- package/dist/{context-Aqenou7c.js → context-Juj6bdHC.mjs} +7 -11
- package/dist/deno-D682wzlW.mjs +8 -0
- package/dist/{docloader-JiZmL7BP.js → docloader-CCWf4tNV.mjs} +8 -14
- package/dist/{esm-nLm00z9V.js → esm-DVILvP5e.mjs} +50 -89
- package/dist/federation/builder.test.d.mts +2 -0
- package/dist/federation/{builder.test.js → builder.test.mjs} +21 -44
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +69 -131
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +31 -63
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +8 -12
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -19
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +11 -22
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +173 -262
- package/dist/federation/mod.cjs +327 -16
- package/dist/federation/mod.d.cts +3 -6
- package/dist/federation/mod.d.ts +3 -6
- package/dist/federation/mod.js +322 -13
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +21 -35
- package/dist/federation/negotiation.test.d.mts +2 -0
- package/dist/federation/{negotiation.test.js → negotiation.test.mjs} +9 -16
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +8 -11
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +11 -16
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +22 -30
- package/dist/federation/webfinger.test.d.mts +2 -0
- package/dist/federation/{webfinger.test.js → webfinger.test.mjs} +22 -56
- package/dist/{http-BnsR906R.cjs → http-BQccxQlj.cjs} +177 -302
- package/dist/{http-CKaqhjvP.js → http-CNsnyqrO.mjs} +23 -43
- package/dist/{http-BudnHZE2.d.cts → http-CrGuipxe.d.cts} +1 -6
- package/dist/{http-IFqEftoZ.js → http-DhwEMhtv.js} +53 -184
- package/dist/{http-Dax_FIBo.d.ts → http-aQzN9Ayi.d.ts} +1 -6
- package/dist/{inbox-Bd91CVJP.js → inbox-DegXbbbS.mjs} +18 -26
- package/dist/{key-DFLFXKER.js → key-vL60OvqM.mjs} +29 -37
- package/dist/{keycache-CpGWAUbj.js → keycache-CCSwkQcY.mjs} +5 -10
- package/dist/{keys-BFve7QQv.js → keys-BAK-tUlf.mjs} +5 -9
- package/dist/{kv-BL4nlICN.d.cts → kv-CbLNp3zQ.d.cts} +1 -1
- package/dist/{kv-DXEUEP6z.d.ts → kv-GFYnFoOl.d.ts} +1 -1
- package/dist/{kv-cache-Bw2F2ABq.js → kv-cache-B01V7s3h.mjs} +4 -8
- package/dist/{kv-cache-Drlz6O_Y.js → kv-cache-CTj3iCix.js} +6 -13
- package/dist/{kv-cache-BLXcQvyb.cjs → kv-cache-DxdXJNbj.cjs} +27 -34
- package/dist/{kv-QzKcOQgP.js → kv-tL2TOE9X.mjs} +6 -10
- package/dist/{ld-CGGXZJK0.js → ld-C3CO00YY.mjs} +17 -31
- package/dist/{middleware-DcpBikad.js → middleware-BmsVSOeS.js} +335 -382
- package/dist/middleware-C7shNcsp.cjs +4 -0
- package/dist/{middleware-B51dB75z.cjs → middleware-Cx0Ny6_7.cjs} +532 -587
- package/dist/middleware-DqVGYk56.mjs +5 -0
- package/dist/{middleware-B53r4pdM.js → middleware-Du-vh7I_.mjs} +282 -317
- package/dist/{mod-em2Il1eD.d.cts → mod-Bp_CzKd4.d.cts} +2 -2
- package/dist/{mod-DCbh1JQ5.d.ts → mod-CLgIXe9w.d.ts} +3 -3
- package/dist/{mod-jfnweK2w.d.cts → mod-CMEbIaNh.d.cts} +3 -3
- package/dist/{mod-D6MdymW7.d.ts → mod-DKOAow7a.d.ts} +2 -2
- package/dist/{mod-Coe7KEgX.d.cts → mod-DoJBjjnO.d.cts} +2 -2
- package/dist/{mod-D6dOd--H.d.ts → mod-DvxszxXC.d.ts} +2 -2
- package/dist/mod.cjs +29 -74
- package/dist/mod.d.cts +11 -14
- package/dist/mod.d.ts +11 -15
- package/dist/mod.js +17 -71
- package/dist/{negotiation-BlAuS_nr.js → negotiation-DnsfFF8I.mjs} +7 -11
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +22 -40
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +13 -43
- package/dist/nodeinfo/mod.cjs +5 -8
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +4 -8
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +9 -16
- package/dist/otel/exporter.test.d.mts +2 -0
- package/dist/otel/{exporter.test.js → exporter.test.mjs} +124 -178
- package/dist/otel/mod.cjs +15 -20
- package/dist/otel/mod.d.cts +2 -2
- package/dist/otel/mod.d.ts +2 -2
- package/dist/otel/mod.js +8 -14
- package/dist/{owner-gd0Q9FuU.d.ts → owner-74ARJ5TL.d.ts} +1 -1
- package/dist/{owner-1AbPBOOZ.d.cts → owner-CptqhsOy.d.cts} +1 -1
- package/dist/{owner-Cye0yQB_.js → owner-DF320w6K.mjs} +11 -16
- package/dist/{proof-DdGGXVWM.js → proof-BCWk5oas.js} +32 -58
- package/dist/{proof-DV5lC_Bw.js → proof-IyDwwmzL.mjs} +21 -33
- package/dist/{proof-CN5iR1tW.cjs → proof-WhNxSv_N.cjs} +133 -157
- package/dist/{retry-mqLf4b-R.js → retry-B_E3V_Dx.mjs} +4 -7
- package/dist/{router-D9eI0s4b.js → router-CrMLXoOr.mjs} +4 -8
- package/dist/runtime/mod.cjs +11 -13
- package/dist/runtime/mod.d.cts +6 -2
- package/dist/runtime/mod.d.ts +0 -1
- package/dist/runtime/mod.js +4 -7
- package/dist/{send-C2a_3YAF.js → send-CJQubr5t.mjs} +8 -13
- package/dist/sig/accept.test.d.mts +2 -0
- package/dist/sig/{accept.test.js → accept.test.mjs} +35 -70
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +166 -280
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +11 -18
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +22 -35
- package/dist/sig/mod.cjs +6 -9
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +5 -9
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/{owner.test.js → owner.test.mjs} +19 -34
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +16 -27
- package/dist/{std__assert-X-_kMxKM.js → std__assert-Duiq_YC9.mjs} +12 -24
- package/dist/testing/{mod.d.ts → mod.d.mts} +26 -90
- package/dist/testing/mod.mjs +6 -0
- package/dist/{transformers-3g8GZwkZ.cjs → transformers-NeAONrAq.cjs} +20 -25
- package/dist/{transformers-C3FLHUd6.js → transformers-ve6e2xcg.js} +3 -7
- package/dist/{types-CPz01LGH.js → types-DCP0WLdt.mjs} +4 -7
- package/dist/{types-Cd_hszr_.cjs → types-KC4QAoxe.cjs} +29 -34
- package/dist/{types-C93Ob9cU.js → types-hvL8ElAs.js} +8 -13
- package/dist/utils/docloader.test.d.mts +2 -0
- package/dist/utils/{docloader.test.js → docloader.test.mjs} +14 -25
- package/dist/utils/kv-cache.test.d.mts +2 -0
- package/dist/utils/{kv-cache.test.js → kv-cache.test.mjs} +25 -40
- package/dist/utils/mod.cjs +5 -9
- package/dist/utils/mod.d.cts +1 -3
- package/dist/utils/mod.d.ts +1 -3
- package/dist/utils/mod.js +4 -9
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/mod.cjs +10 -12
- package/dist/vocab/mod.js +3 -5
- package/package.json +8 -8
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -88
- package/dist/compat-Bb4NuTUO.js +0 -4
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/deno-CnMqla6T.js +0 -121
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -32
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/negotiation.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation/webfinger.test.d.ts +0 -3
- package/dist/federation-Bp3HI26G.cjs +0 -350
- package/dist/federation-DaMfqRm4.js +0 -332
- package/dist/middleware-B0kNQMO0.js +0 -27
- package/dist/middleware-BYQL9cdV.js +0 -12
- package/dist/middleware-DfNqksSs.cjs +0 -12
- package/dist/mod-B7QkWzrL.d.cts +0 -80
- package/dist/mod-Bh8mqlYw.d.cts +0 -9
- package/dist/mod-D6HodEq7.d.ts +0 -7
- package/dist/mod-SMHOMNpZ.d.ts +0 -82
- package/dist/mod-gq_Xfdz8.d.cts +0 -1
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-DoESQxq5.js +0 -4
- package/dist/nodeinfo-DuMYTpbZ.cjs +0 -4
- package/dist/otel/exporter.test.d.ts +0 -3
- package/dist/runtime-c2Njxsry.cjs +0 -17
- package/dist/runtime-poamPCMb.js +0 -13
- package/dist/sig/accept.test.d.ts +0 -3
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-BNhspNOf.js +0 -4
- package/dist/sig-vX39WyWI.cjs +0 -4
- package/dist/testing/mod.js +0 -10
- package/dist/utils/docloader.test.d.ts +0 -3
- package/dist/utils/kv-cache.test.d.ts +0 -3
- package/dist/utils-BQ9KqEK9.cjs +0 -4
- package/dist/utils-Dn5OPdSW.js +0 -4
- /package/dist/{mod-AGjRfPjT.d.ts → compat/transformers.test.d.mts} +0 -0
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { validateCryptoKey } from "./key-DFLFXKER.js";
|
|
7
|
-
import { doubleKnock } from "./http-CKaqhjvP.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { o as validateCryptoKey } from "./key-vL60OvqM.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-CNsnyqrO.mjs";
|
|
8
6
|
import { curry } from "es-toolkit";
|
|
9
7
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
10
8
|
import { getLogger } from "@logtape/logtape";
|
|
11
|
-
|
|
12
9
|
//#region src/utils/docloader.ts
|
|
13
10
|
const logger = getLogger([
|
|
14
11
|
"fedify",
|
|
@@ -38,18 +35,15 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, maxRedi
|
|
|
38
35
|
});
|
|
39
36
|
throw error;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
const response = await doubleKnock(originalRequest, identity, {
|
|
38
|
+
return getRemoteDocument(url, await doubleKnock(createActivityPubRequest(url, { userAgent }), identity, {
|
|
43
39
|
maxRedirection,
|
|
44
40
|
specDeterminer,
|
|
45
41
|
log: curry(logRequest)(logger),
|
|
46
42
|
tracerProvider,
|
|
47
43
|
signal: options?.signal
|
|
48
|
-
});
|
|
49
|
-
return getRemoteDocument(url, response, load);
|
|
44
|
+
}), load);
|
|
50
45
|
}
|
|
51
46
|
return load;
|
|
52
47
|
}
|
|
53
|
-
|
|
54
48
|
//#endregion
|
|
55
|
-
export { getAuthenticatedDocumentLoader };
|
|
49
|
+
export { getAuthenticatedDocumentLoader as t };
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
6
4
|
import "node:module";
|
|
7
|
-
|
|
8
|
-
//#region rolldown:runtime
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
9
6
|
var __create = Object.create;
|
|
10
7
|
var __defProp = Object.defineProperty;
|
|
11
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
14
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
-
var
|
|
16
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
-
};
|
|
12
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
13
|
var __copyProps = (to, from, except, desc) => {
|
|
19
14
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
15
|
key = keys[i];
|
|
@@ -29,13 +24,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
24
|
value: mod,
|
|
30
25
|
enumerable: true
|
|
31
26
|
}) : target, mod));
|
|
32
|
-
|
|
33
27
|
//#endregion
|
|
34
28
|
//#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
|
|
35
|
-
var require_glob_to_regexp =
|
|
36
|
-
module.exports = function(glob
|
|
37
|
-
if (typeof glob
|
|
38
|
-
var str = String(glob
|
|
29
|
+
var require_glob_to_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30
|
+
module.exports = function(glob, opts) {
|
|
31
|
+
if (typeof glob !== "string") throw new TypeError("Expected a string");
|
|
32
|
+
var str = String(glob);
|
|
39
33
|
var reStr = "";
|
|
40
34
|
var extended = opts ? !!opts.extended : false;
|
|
41
35
|
var globstar = opts ? !!opts.globstar : false;
|
|
@@ -92,13 +86,10 @@ var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-rege
|
|
|
92
86
|
}
|
|
93
87
|
var nextChar = str[i + 1];
|
|
94
88
|
if (!globstar) reStr += ".*";
|
|
95
|
-
else {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
i++;
|
|
100
|
-
} else reStr += "([^/]*)";
|
|
101
|
-
}
|
|
89
|
+
else if (starCount > 1 && (prevChar === "/" || prevChar === void 0) && (nextChar === "/" || nextChar === void 0)) {
|
|
90
|
+
reStr += "((?:[^/]*(?:/|$))*)";
|
|
91
|
+
i++;
|
|
92
|
+
} else reStr += "([^/]*)";
|
|
102
93
|
break;
|
|
103
94
|
default: reStr += c;
|
|
104
95
|
}
|
|
@@ -106,8 +97,7 @@ var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-rege
|
|
|
106
97
|
if (!flags || !~flags.indexOf("g")) reStr = "^" + reStr + "$";
|
|
107
98
|
return new RegExp(reStr, flags);
|
|
108
99
|
};
|
|
109
|
-
}
|
|
110
|
-
|
|
100
|
+
}));
|
|
111
101
|
//#endregion
|
|
112
102
|
//#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
|
|
113
103
|
/**
|
|
@@ -139,7 +129,6 @@ function parse(input, loose) {
|
|
|
139
129
|
pattern: new RegExp("^" + pattern + (loose ? "(?=$|/)" : "/?$"), "i")
|
|
140
130
|
};
|
|
141
131
|
}
|
|
142
|
-
|
|
143
132
|
//#endregion
|
|
144
133
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
|
|
145
134
|
const valueTypes = new Set([
|
|
@@ -231,7 +220,6 @@ var TypeDescriptor = class TypeDescriptor {
|
|
|
231
220
|
return TypeDescriptor.of(value) === "undefined";
|
|
232
221
|
}
|
|
233
222
|
};
|
|
234
|
-
|
|
235
223
|
//#endregion
|
|
236
224
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
|
|
237
225
|
const allowedTypes = new Set([
|
|
@@ -258,7 +246,7 @@ const isSubsetOf = function(subset, superset, visited = []) {
|
|
|
258
246
|
switch (subsetItemType) {
|
|
259
247
|
case "array":
|
|
260
248
|
case "object":
|
|
261
|
-
case "function":
|
|
249
|
+
case "function":
|
|
262
250
|
if (visited.includes(subsetItem)) continue;
|
|
263
251
|
visited.push(subsetItem);
|
|
264
252
|
isItemInSuperset = superset.some((supersetItem) => {
|
|
@@ -269,7 +257,6 @@ const isSubsetOf = function(subset, superset, visited = []) {
|
|
|
269
257
|
}
|
|
270
258
|
});
|
|
271
259
|
break;
|
|
272
|
-
}
|
|
273
260
|
default: isItemInSuperset = superset.includes(subsetItem);
|
|
274
261
|
}
|
|
275
262
|
if (!isItemInSuperset) return false;
|
|
@@ -281,21 +268,18 @@ const isSubsetOf = function(subset, superset, visited = []) {
|
|
|
281
268
|
if (Object.keys(subset).length > Object.keys(superset).length) return false;
|
|
282
269
|
for (const [subsetKey, subsetValue] of Object.entries(subset)) {
|
|
283
270
|
const supersetValue = superset[subsetKey];
|
|
284
|
-
|
|
285
|
-
switch (subsetValueType) {
|
|
271
|
+
switch (TypeDescriptor.of(subsetValue)) {
|
|
286
272
|
case "array":
|
|
287
273
|
case "object":
|
|
288
|
-
case "function":
|
|
274
|
+
case "function":
|
|
289
275
|
if (visited.includes(subsetValue)) continue;
|
|
290
276
|
visited.push(subsetValue);
|
|
291
277
|
try {
|
|
292
|
-
|
|
293
|
-
if (!isInSuperset) return false;
|
|
278
|
+
if (!isSubsetOf(subsetValue, supersetValue, visited)) return false;
|
|
294
279
|
} catch {
|
|
295
280
|
return false;
|
|
296
281
|
}
|
|
297
282
|
break;
|
|
298
|
-
}
|
|
299
283
|
default: if (subsetValue !== supersetValue) return false;
|
|
300
284
|
}
|
|
301
285
|
}
|
|
@@ -318,8 +302,7 @@ isSubsetOf.structural = function(subset, superset, visited = []) {
|
|
|
318
302
|
if (visited.includes(subsetValue)) continue;
|
|
319
303
|
visited.push(subsetValue);
|
|
320
304
|
try {
|
|
321
|
-
|
|
322
|
-
if (!isInSuperset) return false;
|
|
305
|
+
if (!isSubsetOf.structural(subsetValue, supersetValue, visited)) return false;
|
|
323
306
|
} catch {
|
|
324
307
|
return false;
|
|
325
308
|
}
|
|
@@ -327,7 +310,6 @@ isSubsetOf.structural = function(subset, superset, visited = []) {
|
|
|
327
310
|
}
|
|
328
311
|
return true;
|
|
329
312
|
};
|
|
330
|
-
|
|
331
313
|
//#endregion
|
|
332
314
|
//#region ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.mjs
|
|
333
315
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -390,11 +372,10 @@ function dequal(foo, bar) {
|
|
|
390
372
|
}
|
|
391
373
|
return foo !== foo && bar !== bar;
|
|
392
374
|
}
|
|
393
|
-
|
|
394
375
|
//#endregion
|
|
395
376
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/RequestUtils.js
|
|
396
|
-
const absoluteUrlRX = new RegExp("^[a-z]+://|^data:", "i");
|
|
397
|
-
const protocolRelativeUrlRX = new RegExp("^//", "i");
|
|
377
|
+
const absoluteUrlRX = /* @__PURE__ */ new RegExp("^[a-z]+://|^data:", "i");
|
|
378
|
+
const protocolRelativeUrlRX = /* @__PURE__ */ new RegExp("^//", "i");
|
|
398
379
|
function hasCredentialsInUrl(url) {
|
|
399
380
|
const urlObject = new URL(url, !absoluteUrlRX.test(url) ? "http://dummy" : void 0);
|
|
400
381
|
return Boolean(urlObject.username || urlObject.password);
|
|
@@ -442,7 +423,7 @@ async function createCallLogFromRequest(request, options) {
|
|
|
442
423
|
} catch {}
|
|
443
424
|
if (request.headers) derivedOptions.headers = normalizeHeaders(request.headers);
|
|
444
425
|
const url = normalizeUrl(request.url, true);
|
|
445
|
-
|
|
426
|
+
return {
|
|
446
427
|
args: [request, options],
|
|
447
428
|
url,
|
|
448
429
|
queryParams: new URLSearchParams(getQuery(url)),
|
|
@@ -451,11 +432,9 @@ async function createCallLogFromRequest(request, options) {
|
|
|
451
432
|
signal: options && options.signal || request.signal,
|
|
452
433
|
pendingPromises
|
|
453
434
|
};
|
|
454
|
-
return callLog;
|
|
455
435
|
}
|
|
456
436
|
function getPath(url) {
|
|
457
|
-
|
|
458
|
-
return u.pathname;
|
|
437
|
+
return (absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy")).pathname;
|
|
459
438
|
}
|
|
460
439
|
function getHost(url) {
|
|
461
440
|
if (absoluteUrlRX.test(url)) return new URL(url).host;
|
|
@@ -473,10 +452,9 @@ function normalizeHeaders(headers) {
|
|
|
473
452
|
else entries = Object.entries(headers);
|
|
474
453
|
return Object.fromEntries(entries.map(([key, val]) => [key.toLowerCase(), String(val).valueOf()]));
|
|
475
454
|
}
|
|
476
|
-
|
|
477
455
|
//#endregion
|
|
478
456
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Matchers.js
|
|
479
|
-
var import_glob_to_regexp = __toESM(require_glob_to_regexp(), 1);
|
|
457
|
+
var import_glob_to_regexp = /* @__PURE__ */ __toESM(require_glob_to_regexp(), 1);
|
|
480
458
|
const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
|
|
481
459
|
const isFunctionMatcher = (matcher) => typeof matcher === "function";
|
|
482
460
|
const stringMatchers = {
|
|
@@ -530,8 +508,7 @@ const getMissingHeaderMatcher = ({ missingHeaders: expectedMissingHeaders }) =>
|
|
|
530
508
|
const getMethodMatcher = ({ method: expectedMethod }) => {
|
|
531
509
|
if (!expectedMethod) return;
|
|
532
510
|
return ({ options: { method } = {} }) => {
|
|
533
|
-
|
|
534
|
-
return expectedMethod === actualMethod;
|
|
511
|
+
return expectedMethod === (method ? method.toLowerCase() : "get");
|
|
535
512
|
};
|
|
536
513
|
};
|
|
537
514
|
const getQueryParamsMatcher = ({ query: passedQuery }) => {
|
|
@@ -610,7 +587,7 @@ const getUrlMatcher = (route) => {
|
|
|
610
587
|
}
|
|
611
588
|
if (typeof matcherUrl === "string") {
|
|
612
589
|
for (const shorthand in stringMatchers) if (matcherUrl.indexOf(`${shorthand}:`) === 0) {
|
|
613
|
-
const urlFragment = matcherUrl.replace(
|
|
590
|
+
const urlFragment = matcherUrl.replace(new RegExp(`^${shorthand}:`), "");
|
|
614
591
|
return stringMatchers[shorthand](urlFragment);
|
|
615
592
|
}
|
|
616
593
|
return getFullUrlMatcher(route, matcherUrl, query);
|
|
@@ -621,7 +598,7 @@ const getUrlMatcher = (route) => {
|
|
|
621
598
|
else if (key in stringMatchers) return stringMatchers[key](pattern);
|
|
622
599
|
else throw new Error(`unrecognised url matching pattern: ${key}`);
|
|
623
600
|
});
|
|
624
|
-
return (route
|
|
601
|
+
return (route) => matchers.every((matcher) => matcher(route));
|
|
625
602
|
}
|
|
626
603
|
};
|
|
627
604
|
const builtInMatchers = [
|
|
@@ -659,7 +636,6 @@ const builtInMatchers = [
|
|
|
659
636
|
matcher: getFunctionMatcher
|
|
660
637
|
}
|
|
661
638
|
];
|
|
662
|
-
|
|
663
639
|
//#endregion
|
|
664
640
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/StatusTextMap.js
|
|
665
641
|
const statusTextMap = {
|
|
@@ -726,17 +702,15 @@ const statusTextMap = {
|
|
|
726
702
|
510: "Not Extended",
|
|
727
703
|
511: "Network Authentication Required"
|
|
728
704
|
};
|
|
729
|
-
var StatusTextMap_default = statusTextMap;
|
|
730
|
-
|
|
731
705
|
//#endregion
|
|
732
706
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Route.js
|
|
733
|
-
var __classPrivateFieldSet =
|
|
707
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
734
708
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
735
709
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
736
710
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
737
711
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
738
712
|
};
|
|
739
|
-
var __classPrivateFieldGet =
|
|
713
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
740
714
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
741
715
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
742
716
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -797,14 +771,13 @@ var Route = class {
|
|
|
797
771
|
constructResponseOptions(responseInput) {
|
|
798
772
|
const options = responseInput.options || {};
|
|
799
773
|
options.status = sanitizeStatus(responseInput.status);
|
|
800
|
-
options.statusText =
|
|
774
|
+
options.statusText = statusTextMap[options.status];
|
|
801
775
|
options.headers = new this.config.Headers(responseInput.headers);
|
|
802
776
|
return options;
|
|
803
777
|
}
|
|
804
778
|
constructResponseBody(responseInput, responseOptions) {
|
|
805
779
|
let body = responseInput.body;
|
|
806
|
-
|
|
807
|
-
if (!bodyIsBodyInit) if (typeof body === "undefined") body = null;
|
|
780
|
+
if (!isBodyInit(body)) if (typeof body === "undefined") body = null;
|
|
808
781
|
else if (typeof body === "object") {
|
|
809
782
|
body = JSON.stringify(body);
|
|
810
783
|
if (!responseOptions.headers.has("Content-Type")) responseOptions.headers.set("Content-Type", "application/json");
|
|
@@ -823,26 +796,25 @@ var Route = class {
|
|
|
823
796
|
_a.registeredMatchers.push(matcher);
|
|
824
797
|
}
|
|
825
798
|
};
|
|
826
|
-
_a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate
|
|
799
|
+
_a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate() {
|
|
827
800
|
if (["matched", "unmatched"].includes(this.config.name)) throw new Error(`fetch-mock: Routes cannot use the reserved name \`${this.config.name}\``);
|
|
828
801
|
if (!("response" in this.config)) throw new Error("fetch-mock: Each route must define a response");
|
|
829
802
|
if (!_a.registeredMatchers.some(({ name }) => name in this.config)) throw new Error("fetch-mock: Each route must specify some criteria for matching calls to fetch. To match all calls use '*'");
|
|
830
|
-
}, _Route_sanitize = function _Route_sanitize
|
|
803
|
+
}, _Route_sanitize = function _Route_sanitize() {
|
|
831
804
|
if (this.config.method) this.config.method = this.config.method.toLowerCase();
|
|
832
|
-
}, _Route_generateMatcher = function _Route_generateMatcher
|
|
805
|
+
}, _Route_generateMatcher = function _Route_generateMatcher() {
|
|
833
806
|
const activeMatchers = _a.registeredMatchers.filter(({ name }) => name in this.config).map(({ matcher, usesBody }) => ({
|
|
834
807
|
matcher: matcher(this.config),
|
|
835
808
|
usesBody
|
|
836
809
|
}));
|
|
837
810
|
this.config.usesBody = activeMatchers.some(({ usesBody }) => usesBody);
|
|
838
811
|
this.matcher = (normalizedRequest) => activeMatchers.every(({ matcher }) => matcher(normalizedRequest));
|
|
839
|
-
}, _Route_limit = function _Route_limit
|
|
812
|
+
}, _Route_limit = function _Route_limit() {
|
|
840
813
|
if (!this.config.repeat) return;
|
|
841
814
|
const originalMatcher = this.matcher;
|
|
842
815
|
let timesLeft = this.config.repeat;
|
|
843
816
|
this.matcher = (callLog) => {
|
|
844
|
-
|
|
845
|
-
if (match) {
|
|
817
|
+
if (timesLeft && originalMatcher(callLog)) {
|
|
846
818
|
timesLeft--;
|
|
847
819
|
return true;
|
|
848
820
|
}
|
|
@@ -850,7 +822,7 @@ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route
|
|
|
850
822
|
this.reset = () => {
|
|
851
823
|
timesLeft = this.config.repeat;
|
|
852
824
|
};
|
|
853
|
-
}, _Route_delayResponse = function _Route_delayResponse
|
|
825
|
+
}, _Route_delayResponse = function _Route_delayResponse() {
|
|
854
826
|
if (this.config.delay) {
|
|
855
827
|
const { response } = this.config;
|
|
856
828
|
this.config.response = () => {
|
|
@@ -860,8 +832,6 @@ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route
|
|
|
860
832
|
};
|
|
861
833
|
Route.registeredMatchers = [];
|
|
862
834
|
builtInMatchers.forEach(Route.defineMatcher);
|
|
863
|
-
var Route_default = Route;
|
|
864
|
-
|
|
865
835
|
//#endregion
|
|
866
836
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Router.js
|
|
867
837
|
const responseConfigProps = [
|
|
@@ -934,8 +904,7 @@ var Router = class {
|
|
|
934
904
|
});
|
|
935
905
|
}
|
|
936
906
|
if (this.needsToReadBody(request)) options.body = await options.body;
|
|
937
|
-
const
|
|
938
|
-
const route = routesToTry.find((route$1) => route$1.matcher(callLog));
|
|
907
|
+
const route = (this.fallbackRoute ? [...this.routes, this.fallbackRoute] : this.routes).find((route) => route.matcher(callLog));
|
|
939
908
|
if (route) try {
|
|
940
909
|
callLog.route = route;
|
|
941
910
|
const { response, responseOptions, responseInput } = await this.generateResponse(callLog);
|
|
@@ -990,7 +959,7 @@ var Router = class {
|
|
|
990
959
|
else Object.assign(config, matcher);
|
|
991
960
|
if (typeof response !== "undefined") config.response = response;
|
|
992
961
|
if (nameOrOptions) Object.assign(config, typeof nameOrOptions === "string" ? nameToOptions(nameOrOptions) : nameOrOptions);
|
|
993
|
-
const route = new
|
|
962
|
+
const route = new Route({
|
|
994
963
|
...this.config,
|
|
995
964
|
...config
|
|
996
965
|
});
|
|
@@ -1009,7 +978,7 @@ var Router = class {
|
|
|
1009
978
|
}
|
|
1010
979
|
setFallback(response) {
|
|
1011
980
|
if (this.fallbackRoute) console.warn("calling fetchMock.catch() twice - are you sure you want to overwrite the previous fallback response");
|
|
1012
|
-
this.fallbackRoute = new
|
|
981
|
+
this.fallbackRoute = new Route({
|
|
1013
982
|
matcherFunction: () => true,
|
|
1014
983
|
response: response || "ok",
|
|
1015
984
|
...this.config
|
|
@@ -1041,7 +1010,6 @@ var Router = class {
|
|
|
1041
1010
|
route.init(newConfig);
|
|
1042
1011
|
}
|
|
1043
1012
|
};
|
|
1044
|
-
|
|
1045
1013
|
//#endregion
|
|
1046
1014
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/CallHistory.js
|
|
1047
1015
|
const isName = (filter) => typeof filter === "string" && /^[\da-zA-Z-]+$/.test(filter) && !["matched", "unmatched"].includes(filter);
|
|
@@ -1087,12 +1055,12 @@ var CallHistory = class {
|
|
|
1087
1055
|
...filter,
|
|
1088
1056
|
...options || {}
|
|
1089
1057
|
};
|
|
1090
|
-
const { matcher } = new
|
|
1058
|
+
const { matcher } = new Route({
|
|
1091
1059
|
response: "ok",
|
|
1092
1060
|
...options
|
|
1093
1061
|
});
|
|
1094
|
-
calls = calls.filter(({ url, options
|
|
1095
|
-
return matcher(createCallLogFromUrlAndOptions(url, options
|
|
1062
|
+
calls = calls.filter(({ url, options }) => {
|
|
1063
|
+
return matcher(createCallLogFromUrlAndOptions(url, options));
|
|
1096
1064
|
});
|
|
1097
1065
|
return calls;
|
|
1098
1066
|
}
|
|
@@ -1125,8 +1093,6 @@ var CallHistory = class {
|
|
|
1125
1093
|
}).every((isDone) => isDone);
|
|
1126
1094
|
}
|
|
1127
1095
|
};
|
|
1128
|
-
var CallHistory_default = CallHistory;
|
|
1129
|
-
|
|
1130
1096
|
//#endregion
|
|
1131
1097
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/FetchMock.js
|
|
1132
1098
|
const defaultFetchMockConfig = {
|
|
@@ -1148,7 +1114,9 @@ const defineGreedyShorthand = (shorthandOptions) => {
|
|
|
1148
1114
|
return this.route("*", response, Object.assign(options || {}, shorthandOptions));
|
|
1149
1115
|
};
|
|
1150
1116
|
};
|
|
1151
|
-
|
|
1117
|
+
//#endregion
|
|
1118
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
|
|
1119
|
+
var esm_default = new class FetchMock {
|
|
1152
1120
|
constructor(config, router) {
|
|
1153
1121
|
this.sticky = defineShorthand({ sticky: true });
|
|
1154
1122
|
this.once = defineShorthand({ repeat: 1 });
|
|
@@ -1189,7 +1157,7 @@ var FetchMock = class FetchMock {
|
|
|
1189
1157
|
routes: router ? [...router.routes] : [],
|
|
1190
1158
|
fallbackRoute: router ? router.fallbackRoute : null
|
|
1191
1159
|
});
|
|
1192
|
-
this.callHistory = new
|
|
1160
|
+
this.callHistory = new CallHistory(this.config, this.router);
|
|
1193
1161
|
this.fetchHandler = this.fetchHandler.bind(this);
|
|
1194
1162
|
Object.assign(this.fetchHandler, { fetchMock: this });
|
|
1195
1163
|
}
|
|
@@ -1214,7 +1182,7 @@ var FetchMock = class FetchMock {
|
|
|
1214
1182
|
return this;
|
|
1215
1183
|
}
|
|
1216
1184
|
defineMatcher(matcher) {
|
|
1217
|
-
|
|
1185
|
+
Route.defineMatcher(matcher);
|
|
1218
1186
|
}
|
|
1219
1187
|
removeRoutes(options) {
|
|
1220
1188
|
this.router.removeRoutes(options);
|
|
@@ -1256,13 +1224,6 @@ var FetchMock = class FetchMock {
|
|
|
1256
1224
|
this.mockGlobal();
|
|
1257
1225
|
return this.spy();
|
|
1258
1226
|
}
|
|
1259
|
-
};
|
|
1260
|
-
const fetchMock = new FetchMock({ ...defaultFetchMockConfig });
|
|
1261
|
-
var FetchMock_default = fetchMock;
|
|
1262
|
-
|
|
1263
|
-
//#endregion
|
|
1264
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
|
|
1265
|
-
var esm_default = FetchMock_default;
|
|
1266
|
-
|
|
1227
|
+
}({ ...defaultFetchMockConfig });
|
|
1267
1228
|
//#endregion
|
|
1268
|
-
export { esm_default };
|
|
1229
|
+
export { esm_default as t };
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
10
|
-
import "../deno-CnMqla6T.js";
|
|
11
|
-
import "../router-D9eI0s4b.js";
|
|
12
|
-
import "../inbox-Bd91CVJP.js";
|
|
13
|
-
import { createFederationBuilder } from "../builder-OscY92PK.js";
|
|
14
|
-
import { assertExists } from "../std__assert-X-_kMxKM.js";
|
|
15
|
-
import "../assert_rejects-0h7I2Esa.js";
|
|
16
|
-
import { assertThrows } from "../assert_throws-rjdMBf31.js";
|
|
17
|
-
import "../assert_not_equals-f3m3epl3.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import { a as assertExists } from "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
|
|
8
|
+
import { n as createFederationBuilder } from "../builder-DcSpny3g.mjs";
|
|
18
9
|
import { test } from "@fedify/fixture";
|
|
19
10
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
20
|
-
|
|
21
11
|
//#region src/federation/builder.test.ts
|
|
22
12
|
test("FederationBuilder", async (t) => {
|
|
23
13
|
await t.step("should build a Federation object with registered components", async () => {
|
|
@@ -28,8 +18,7 @@ test("FederationBuilder", async (t) => {
|
|
|
28
18
|
};
|
|
29
19
|
builder.setActorDispatcher("/users/{identifier}", actorDispatcher);
|
|
30
20
|
const inboxListener = (_ctx, _activity) => {};
|
|
31
|
-
|
|
32
|
-
listeners.on(Activity, inboxListener);
|
|
21
|
+
builder.setInboxListeners("/users/{identifier}/inbox").on(Activity, inboxListener);
|
|
33
22
|
const objectDispatcher = (_ctx, _values) => {
|
|
34
23
|
return null;
|
|
35
24
|
};
|
|
@@ -69,8 +58,7 @@ test("FederationBuilder", async (t) => {
|
|
|
69
58
|
assertExists(inboxListeners);
|
|
70
59
|
assertExists(impl.objectCallbacks[Note.typeId.href]);
|
|
71
60
|
assertExists(impl.nodeInfoDispatcher);
|
|
72
|
-
|
|
73
|
-
assertEquals(notePaths, "/notes/123");
|
|
61
|
+
assertEquals(impl.router.build(`object:${Note.typeId.href}`, { id: "123" }), "/notes/123");
|
|
74
62
|
assertEquals(impl.router.build("actor", { identifier: "user1" }), "/users/user1");
|
|
75
63
|
assertEquals(impl.router.build("inbox", { identifier: "user1" }), "/users/user1/inbox");
|
|
76
64
|
await builder.build({ kv });
|
|
@@ -80,8 +68,7 @@ test("FederationBuilder", async (t) => {
|
|
|
80
68
|
const kv = new MemoryKvStore();
|
|
81
69
|
const federation = await builder.build({ kv });
|
|
82
70
|
assertExists(federation);
|
|
83
|
-
|
|
84
|
-
assertEquals(impl.kv, kv);
|
|
71
|
+
assertEquals(federation.kv, kv);
|
|
85
72
|
});
|
|
86
73
|
await t.step("should pass build options correctly", async () => {
|
|
87
74
|
const builder = createFederationBuilder();
|
|
@@ -106,33 +93,26 @@ test("FederationBuilder", async (t) => {
|
|
|
106
93
|
const kv = new MemoryKvStore();
|
|
107
94
|
const federationDefault = await builder.build({ kv });
|
|
108
95
|
assertExists(federationDefault);
|
|
109
|
-
|
|
110
|
-
assertEquals(implDefault.firstKnock, void 0);
|
|
96
|
+
assertEquals(federationDefault.firstKnock, void 0);
|
|
111
97
|
const federationCustom = await builder.build({
|
|
112
98
|
kv,
|
|
113
99
|
firstKnock: "draft-cavage-http-signatures-12"
|
|
114
100
|
});
|
|
115
101
|
assertExists(federationCustom);
|
|
116
|
-
|
|
117
|
-
assertEquals(implCustom.firstKnock, "draft-cavage-http-signatures-12");
|
|
102
|
+
assertEquals(federationCustom.firstKnock, "draft-cavage-http-signatures-12");
|
|
118
103
|
const federationRfc = await builder.build({
|
|
119
104
|
kv,
|
|
120
105
|
firstKnock: "rfc9421"
|
|
121
106
|
});
|
|
122
107
|
assertExists(federationRfc);
|
|
123
|
-
|
|
124
|
-
assertEquals(implRfc.firstKnock, "rfc9421");
|
|
108
|
+
assertEquals(federationRfc.firstKnock, "rfc9421");
|
|
125
109
|
});
|
|
126
110
|
await t.step("should copy unverified activity handler into built federation", async () => {
|
|
127
111
|
const builder = createFederationBuilder();
|
|
128
112
|
const kv = new MemoryKvStore();
|
|
129
|
-
const handler = (_ctx, _activity, _reason) => {
|
|
130
|
-
return;
|
|
131
|
-
};
|
|
113
|
+
const handler = (_ctx, _activity, _reason) => {};
|
|
132
114
|
builder.setInboxListeners("/users/{identifier}/inbox").onUnverifiedActivity(handler);
|
|
133
|
-
|
|
134
|
-
const impl = federation;
|
|
135
|
-
assertEquals(impl.unverifiedActivityHandler, handler);
|
|
115
|
+
assertEquals((await builder.build({ kv })).unverifiedActivityHandler, handler);
|
|
136
116
|
});
|
|
137
117
|
await t.step("should register multiple object dispatchers and verify them", async () => {
|
|
138
118
|
const builder = createFederationBuilder();
|
|
@@ -145,14 +125,11 @@ test("FederationBuilder", async (t) => {
|
|
|
145
125
|
};
|
|
146
126
|
builder.setObjectDispatcher(Note, "/notes/{id}", noteDispatcher);
|
|
147
127
|
builder.setObjectDispatcher(Person, "/people/{id}", personDispatcher);
|
|
148
|
-
const
|
|
149
|
-
const impl = federation;
|
|
128
|
+
const impl = await builder.build({ kv });
|
|
150
129
|
assertExists(impl.objectCallbacks[Note.typeId.href]);
|
|
151
130
|
assertExists(impl.objectCallbacks[Person.typeId.href]);
|
|
152
|
-
|
|
153
|
-
assertEquals(
|
|
154
|
-
const personPath = impl.router.build(`object:${Person.typeId.href}`, { id: "456" });
|
|
155
|
-
assertEquals(personPath, "/people/456");
|
|
131
|
+
assertEquals(impl.router.build(`object:${Note.typeId.href}`, { id: "123" }), "/notes/123");
|
|
132
|
+
assertEquals(impl.router.build(`object:${Person.typeId.href}`, { id: "456" }), "/people/456");
|
|
156
133
|
const noteRoute = impl.router.route("/notes/789");
|
|
157
134
|
assertEquals(noteRoute?.name, `object:${Note.typeId.href}`);
|
|
158
135
|
assertEquals(noteRoute?.values.id, "789");
|
|
@@ -180,5 +157,5 @@ test("FederationBuilder", async (t) => {
|
|
|
180
157
|
builder.setCollectionDispatcher(strId, Note, "/string-id/{id}", dispatcher);
|
|
181
158
|
});
|
|
182
159
|
});
|
|
183
|
-
|
|
184
|
-
|
|
160
|
+
//#endregion
|
|
161
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-BD6-SZ6O.mjs";
|
|
7
|
+
import { test } from "@fedify/fixture";
|
|
8
|
+
import { decodeHex } from "byte-encodings/hex";
|
|
9
|
+
//#region src/federation/collection.test.ts
|
|
10
|
+
test("digest()", async () => {
|
|
11
|
+
assertEquals(await digest([
|
|
12
|
+
new URL("https://testing.example.org/users/1"),
|
|
13
|
+
new URL("https://testing.example.org/users/2"),
|
|
14
|
+
new URL("https://testing.example.org/users/2")
|
|
15
|
+
]), decodeHex("c33f48cd341ef046a206b8a72ec97af65079f9a3a9b90eef79c5920dce45c61f"));
|
|
16
|
+
});
|
|
17
|
+
test("buildCollectionSynchronizationHeader()", async () => {
|
|
18
|
+
assertEquals(await buildCollectionSynchronizationHeader("https://testing.example.org/users/1/followers", ["https://testing.example.org/users/2", "https://testing.example.org/users/1"]), "collectionId=\"https://testing.example.org/users/1/followers\", url=\"https://testing.example.org/users/1/followers?base-url=https%3A%2F%2Ftesting.example.org%2F\", digest=\"c33f48cd341ef046a206b8a72ec97af65079f9a3a9b90eef79c5920dce45c61f\"");
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export {};
|