@fedify/fedify 2.0.0-pr.445.1694 → 2.0.0-pr.451.1730
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/{actor-T6RyhRgk.d.ts → actor-Cd2CREO0.d.ts} +2 -2
- package/dist/{actor-D8gCwLzv.js → actor-Cg8ZhoVF.js} +1 -1
- package/dist/{actor-CwZ2m5rG.cjs → actor-D020hlx3.cjs} +922 -1451
- package/dist/{actor-D6K058Tb.d.cts → actor-DDhZuMGl.d.cts} +2 -2
- package/dist/{actor-DoMcqXsW.js → actor-DPD6Gbdn.js} +190 -677
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-1_skw-d2.js → builder-Dn87hy75.js} +7 -8
- package/dist/{client-bgSdkFa2.d.ts → client-Bkaw0_PR.d.ts} +1 -1
- package/dist/{client-CegPX0Rn.d.cts → client-Cle5j1T1.d.cts} +1 -1
- package/dist/{client-D5CBsPrc.js → client-D6-5okV1.js} +1 -1
- package/dist/compat/mod.d.cts +11 -11
- package/dist/compat/mod.d.ts +12 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-DiqjMRef.d.cts → context-BOYzcFSe.d.cts} +130 -97
- package/dist/{context-DBKpNBnc.d.ts → context-DqFifMwj.d.ts} +131 -98
- package/dist/{authdocloader-DYTNpaMA.js → docloader-B2BFBGqv.js} +18 -8
- package/dist/{esm-Dl5T1RNE.js → esm-CU0Dnk7T.js} +11 -11
- package/dist/federation/builder.test.js +8 -10
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +25 -26
- package/dist/federation/idempotency.test.js +25 -26
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +26 -27
- package/dist/federation/mod.cjs +10 -11
- package/dist/federation/mod.d.cts +11 -11
- package/dist/federation/mod.d.ts +13 -13
- package/dist/federation/mod.js +10 -11
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +7 -9
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/{http-D-e6AFwR.d.cts → http-B6SKO6NJ.d.cts} +2 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-BE7aFuqn.d.ts} +2 -2
- package/dist/{http-CAusBl_3.cjs → http-DMsjudj8.cjs} +289 -9
- package/dist/{http-CuS-d4U0.js → http-DN0v2zoF.js} +2 -2
- package/dist/{http-C_Qc2neP.js → http-DcDb8r1W.js} +256 -6
- package/dist/{inbox-IETv_Qez.js → inbox-CgGy7Hzc.js} +1 -1
- package/dist/{key-DnqhSgAv.js → key-jSvnymAk.js} +3 -2
- package/dist/{keycache-CSBkusP8.js → keycache-IVLjlAK9.js} +1 -1
- package/dist/{keys-D3_MDK7n.js → keys-BKM2Mqu2.js} +2 -1
- package/dist/{docloader-CYnQRIXv.cjs → kv-cache-BHIupktM.cjs} +69 -651
- package/dist/kv-cache-DNvS-egZ.js +4236 -0
- package/dist/{docloader-Czl3xV10.js → kv-cache-ydIs4Ul6.js} +68 -596
- package/dist/{ld-Isot0tiW.js → ld-CcsryBo0.js} +3 -2
- package/dist/{lookup-Dhm78GlK.js → lookup-BV3A9Zbc.js} +63 -2
- package/dist/{type-DaUr3Il7.js → lookup-BbEekiru.js} +588 -5303
- package/dist/{lookup-D6dro5Au.cjs → lookup-CMAGfQ1Q.cjs} +78 -5
- package/dist/{middleware-BuHr2fzh.js → middleware-D-vPitR-.js} +37 -38
- package/dist/{middleware-DQYscW90.js → middleware-Dm8sXYUr.js} +40 -40
- package/dist/middleware-DzA970CF.js +16 -0
- package/dist/middleware-VpoC5jyA.js +26 -0
- package/dist/middleware-W_-inBoE.cjs +16 -0
- package/dist/{middleware-Dgmdgrvb.cjs → middleware-ekn2KaOw.cjs} +57 -58
- package/dist/{mod-CxkWO3Mg.d.cts → mod--K7l84wp.d.cts} +3 -2
- package/dist/{mod-DBzN0aCM.d.ts → mod-CB80AlIA.d.ts} +1 -1
- package/dist/mod-CLKu6Uo_.d.cts +107 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-COlOrmr9.d.cts} +3 -3
- package/dist/{mod-DlU8ISoa.d.ts → mod-CRENK2dd.d.ts} +3 -2
- package/dist/{mod-D_y2y32N.d.ts → mod-CaWbCg0N.d.ts} +2 -2
- package/dist/mod-Cm97bAiT.d.ts +109 -0
- package/dist/{mod-Bpb5QLaZ.d.cts → mod-D9XZsft2.d.cts} +2 -2
- package/dist/{mod-BhUKmBJD.d.ts → mod-DLIidI_j.d.ts} +3 -3
- package/dist/{mod-jQ4OODsl.d.cts → mod-DuclhZjh.d.cts} +1 -1
- package/dist/mod.cjs +21 -32
- package/dist/mod.d.cts +14 -14
- package/dist/mod.d.ts +17 -17
- package/dist/mod.js +15 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +3 -3
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +3 -4
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-hd9lvQcP.d.ts → owner-CktUdA0h.d.ts} +3 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-dkg5OpSC.d.cts} +3 -3
- package/dist/{owner-ChSL4aJ7.js → owner-n5c_oZ_M.js} +3 -2
- package/dist/{proof-BiSCuwyA.js → proof-CLwByIT1.js} +5 -4
- package/dist/{proof-ONNmhInb.cjs → proof-CZfrp13P.cjs} +17 -16
- package/dist/{proof-x3IBewan.js → proof-CsFR7fiS.js} +2 -2
- package/dist/request-BbHkedIU.d.cts +35 -0
- package/dist/request-DKGQaofB.js +184 -0
- package/dist/request-U1t6zZtk.d.ts +39 -0
- package/dist/request-XHWUW2bi.cjs +208 -0
- package/dist/{send-D5fjmUEj.js → send-eW9JIzQV.js} +2 -2
- package/dist/sig/http.test.js +12 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +10 -11
- package/dist/sig/mod.d.cts +6 -7
- package/dist/sig/mod.d.ts +6 -7
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +122 -148
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-tWr1VQxx.js → testing-ClYSmXdi.js} +1 -2
- package/dist/{types-D2Nyz0tR.cjs → types-BT0xc4-R.cjs} +3 -3
- package/dist/{types-DQuSDtDg.js → types-DaPoJTSc.js} +1 -1
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +208 -0
- package/dist/utils/mod.cjs +14 -0
- package/dist/utils/mod.d.cts +6 -0
- package/dist/utils/mod.d.ts +8 -0
- package/dist/utils/mod.js +12 -0
- package/dist/utils/request.test.js +48 -0
- package/dist/utils/url.test.js +41 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.d.cts +4 -5
- package/dist/vocab/mod.d.ts +4 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-Dd4VMrr0.cjs → vocab-CxTuoEVd.cjs} +6 -5
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-DCBw44JZ.d.cts} +2 -21
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-ivDKb439.d.ts} +2 -21
- package/dist/{vocab-w--qk7HF.js → vocab-yFT-fQBj.js} +4 -3
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +3 -3
- package/dist/webfinger/mod.d.cts +2 -3
- package/dist/webfinger/mod.d.ts +2 -3
- package/dist/webfinger/mod.js +3 -3
- package/dist/x/cfworkers.d.cts +1 -1
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -10
- package/dist/x/hono.d.ts +11 -11
- package/dist/x/sveltekit.d.cts +10 -10
- package/dist/x/sveltekit.d.ts +11 -11
- package/package.json +16 -14
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Cv_qEn1G.js +0 -52
- package/dist/authdocloader-bsmVF6eO.cjs +0 -58
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-BNJQQm3h.js +0 -260
- package/dist/key-C_ruQbbl.js +0 -10
- package/dist/key-DIMJMxf4.cjs +0 -10
- package/dist/key-DpFjiItf.js +0 -10
- package/dist/key-DuXv64tg.cjs +0 -290
- package/dist/lookup-CbtuFbtg.js +0 -331
- package/dist/middleware-BpR6186a.js +0 -26
- package/dist/middleware-DDMxdtWM.cjs +0 -17
- package/dist/middleware-T-knSMwl.js +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.js +0 -45
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CcnIw1qY.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{federation-H2_En3j5.cjs → federation-DOuZpcAw.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-pZJsapBn.js} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-BMKIFXNW.d.cts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-Dt06smFt.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-B-ZQqbGe.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-CjsiSl7_.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CPRJk4mZ.d.ts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-B0UefMXO.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-ByTd7HpT.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DE_NC_VQ.cjs} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-Dx59zAgn.js} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{types-BSuWJsOm.js → types-C2XVl6gj.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/request.test.d.ts} +0 -0
- /package/dist/{runtime → utils}/url.test.d.ts +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-B6yXfxAQ.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-BXMGcmqK.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-C949bxcD.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-qG8R5jc3.js} +0 -0
@@ -0,0 +1,208 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import "../lookup-BbEekiru.js";
|
7
|
+
import { MockKvStore, kvCache, preloadedContexts } from "../kv-cache-DNvS-egZ.js";
|
8
|
+
import { mockDocumentLoader, test } from "../testing-ClYSmXdi.js";
|
9
|
+
import { deepStrictEqual, throws } from "node:assert";
|
10
|
+
|
11
|
+
//#region src/utils/kv-cache.test.ts
|
12
|
+
test("kvCache()", async (t) => {
|
13
|
+
const kv = new MockKvStore();
|
14
|
+
await t.step("cached", async () => {
|
15
|
+
const loader = kvCache({
|
16
|
+
kv,
|
17
|
+
loader: mockDocumentLoader,
|
18
|
+
rules: [
|
19
|
+
["https://example.org/", Temporal.Duration.from({ days: 1 })],
|
20
|
+
[new URL("https://example.net/"), Temporal.Duration.from({ days: 1 })],
|
21
|
+
[new URLPattern("https://example.com/*"), Temporal.Duration.from({ days: 30 })]
|
22
|
+
],
|
23
|
+
prefix: ["_test", "cached"]
|
24
|
+
});
|
25
|
+
const result = await loader("https://example.com/object");
|
26
|
+
deepStrictEqual(result, {
|
27
|
+
contextUrl: null,
|
28
|
+
documentUrl: "https://example.com/object",
|
29
|
+
document: {
|
30
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
31
|
+
id: "https://example.com/object",
|
32
|
+
name: "Fetched object",
|
33
|
+
type: "Object"
|
34
|
+
}
|
35
|
+
});
|
36
|
+
const cache = await kv.get([
|
37
|
+
"_test",
|
38
|
+
"cached",
|
39
|
+
"https://example.com/object"
|
40
|
+
]);
|
41
|
+
deepStrictEqual(cache, result);
|
42
|
+
await kv.set([
|
43
|
+
"_test",
|
44
|
+
"cached",
|
45
|
+
"https://example.org/"
|
46
|
+
], {
|
47
|
+
contextUrl: null,
|
48
|
+
documentUrl: "https://example.org/",
|
49
|
+
document: { "id": "https://example.org/" }
|
50
|
+
});
|
51
|
+
const result2 = await loader("https://example.org/");
|
52
|
+
deepStrictEqual(result2, {
|
53
|
+
contextUrl: null,
|
54
|
+
documentUrl: "https://example.org/",
|
55
|
+
document: { "id": "https://example.org/" }
|
56
|
+
});
|
57
|
+
await kv.set([
|
58
|
+
"_test",
|
59
|
+
"cached",
|
60
|
+
"https://example.net/"
|
61
|
+
], {
|
62
|
+
contextUrl: null,
|
63
|
+
documentUrl: "https://example.net/",
|
64
|
+
document: { "id": "https://example.net/" }
|
65
|
+
});
|
66
|
+
const result3 = await loader("https://example.net/");
|
67
|
+
deepStrictEqual(result3, {
|
68
|
+
contextUrl: null,
|
69
|
+
documentUrl: "https://example.net/",
|
70
|
+
document: { "id": "https://example.net/" }
|
71
|
+
});
|
72
|
+
});
|
73
|
+
await t.step("not cached", async () => {
|
74
|
+
const loader = kvCache({
|
75
|
+
kv,
|
76
|
+
loader: mockDocumentLoader,
|
77
|
+
rules: [],
|
78
|
+
prefix: ["_test", "not cached"]
|
79
|
+
});
|
80
|
+
const result = await loader("https://example.com/object");
|
81
|
+
deepStrictEqual(result, {
|
82
|
+
contextUrl: null,
|
83
|
+
documentUrl: "https://example.com/object",
|
84
|
+
document: {
|
85
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
86
|
+
id: "https://example.com/object",
|
87
|
+
name: "Fetched object",
|
88
|
+
type: "Object"
|
89
|
+
}
|
90
|
+
});
|
91
|
+
const cache = await kv.get([
|
92
|
+
"test2",
|
93
|
+
"not cached",
|
94
|
+
"https://example.com/object"
|
95
|
+
]);
|
96
|
+
deepStrictEqual(cache, void 0);
|
97
|
+
});
|
98
|
+
await t.step("maximum cache duration", () => {
|
99
|
+
throws(() => kvCache({
|
100
|
+
kv,
|
101
|
+
loader: mockDocumentLoader,
|
102
|
+
rules: [["https://example.com/", Temporal.Duration.from({
|
103
|
+
days: 30,
|
104
|
+
seconds: 1
|
105
|
+
})]]
|
106
|
+
}), TypeError, "The maximum cache duration is 30 days");
|
107
|
+
throws(() => kvCache({
|
108
|
+
kv,
|
109
|
+
loader: mockDocumentLoader,
|
110
|
+
rules: [[new URLPattern("https://example.com/*"), Temporal.Duration.from({
|
111
|
+
days: 30,
|
112
|
+
seconds: 1
|
113
|
+
})]]
|
114
|
+
}), TypeError, "The maximum cache duration is 30 days");
|
115
|
+
});
|
116
|
+
await t.step("on kv store exception", async () => {
|
117
|
+
class KvStoreThrowsException {
|
118
|
+
get(_key) {
|
119
|
+
throw new Error("Failed to get key");
|
120
|
+
}
|
121
|
+
set(_key, _value, _options) {
|
122
|
+
throw new Error("Failed to set key");
|
123
|
+
}
|
124
|
+
delete(_key) {
|
125
|
+
throw new Error("Failed to delete key");
|
126
|
+
}
|
127
|
+
}
|
128
|
+
const loader = kvCache({
|
129
|
+
kv: new KvStoreThrowsException(),
|
130
|
+
loader: mockDocumentLoader,
|
131
|
+
rules: [
|
132
|
+
["https://example.org/", Temporal.Duration.from({ days: 1 })],
|
133
|
+
[new URL("https://example.net/"), Temporal.Duration.from({ days: 1 })],
|
134
|
+
[new URLPattern("https://example.com/*"), Temporal.Duration.from({ days: 30 })]
|
135
|
+
],
|
136
|
+
prefix: ["_test", "not cached"]
|
137
|
+
});
|
138
|
+
const result = await loader("https://example.com/object");
|
139
|
+
deepStrictEqual(result, {
|
140
|
+
contextUrl: null,
|
141
|
+
documentUrl: "https://example.com/object",
|
142
|
+
document: {
|
143
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
144
|
+
id: "https://example.com/object",
|
145
|
+
name: "Fetched object",
|
146
|
+
type: "Object"
|
147
|
+
}
|
148
|
+
});
|
149
|
+
});
|
150
|
+
await t.step("preloaded contexts bypass cache", async () => {
|
151
|
+
const kv$1 = new MockKvStore();
|
152
|
+
let loaderCalled = false;
|
153
|
+
const mockLoader = (url) => {
|
154
|
+
loaderCalled = true;
|
155
|
+
return Promise.resolve({
|
156
|
+
contextUrl: null,
|
157
|
+
documentUrl: url,
|
158
|
+
document: { "mock": "document" }
|
159
|
+
});
|
160
|
+
};
|
161
|
+
const loader = kvCache({
|
162
|
+
kv: kv$1,
|
163
|
+
loader: mockLoader,
|
164
|
+
prefix: ["_test", "preloaded"]
|
165
|
+
});
|
166
|
+
const activityStreamsUrl = "https://www.w3.org/ns/activitystreams";
|
167
|
+
loaderCalled = false;
|
168
|
+
const result = await loader(activityStreamsUrl);
|
169
|
+
deepStrictEqual(result, {
|
170
|
+
contextUrl: null,
|
171
|
+
documentUrl: activityStreamsUrl,
|
172
|
+
document: preloadedContexts[activityStreamsUrl]
|
173
|
+
});
|
174
|
+
deepStrictEqual(loaderCalled, false, "Loader should not be called for preloaded contexts");
|
175
|
+
const cachedValue = await kv$1.get([
|
176
|
+
"_test",
|
177
|
+
"preloaded",
|
178
|
+
activityStreamsUrl
|
179
|
+
]);
|
180
|
+
deepStrictEqual(cachedValue, void 0, "Preloaded contexts should not be cached in KV store");
|
181
|
+
const securityUrl = "https://w3id.org/security/v1";
|
182
|
+
loaderCalled = false;
|
183
|
+
const result2 = await loader(securityUrl);
|
184
|
+
deepStrictEqual(result2, {
|
185
|
+
contextUrl: null,
|
186
|
+
documentUrl: securityUrl,
|
187
|
+
document: preloadedContexts[securityUrl]
|
188
|
+
});
|
189
|
+
deepStrictEqual(loaderCalled, false, "Loader should not be called for preloaded contexts");
|
190
|
+
const nonPreloadedUrl = "https://example.com/not-preloaded";
|
191
|
+
loaderCalled = false;
|
192
|
+
const result3 = await loader(nonPreloadedUrl);
|
193
|
+
deepStrictEqual(result3, {
|
194
|
+
contextUrl: null,
|
195
|
+
documentUrl: nonPreloadedUrl,
|
196
|
+
document: { "mock": "document" }
|
197
|
+
});
|
198
|
+
deepStrictEqual(loaderCalled, true, "Loader should be called for non-preloaded URLs");
|
199
|
+
const cachedValue2 = await kv$1.get([
|
200
|
+
"_test",
|
201
|
+
"preloaded",
|
202
|
+
nonPreloadedUrl
|
203
|
+
]);
|
204
|
+
deepStrictEqual(cachedValue2, result3, "Non-preloaded URLs should be cached");
|
205
|
+
});
|
206
|
+
});
|
207
|
+
|
208
|
+
//#endregion
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_request = require('../request-XHWUW2bi.cjs');
|
6
|
+
require('../actor-D020hlx3.cjs');
|
7
|
+
require('../lookup-CMAGfQ1Q.cjs');
|
8
|
+
require('../http-DMsjudj8.cjs');
|
9
|
+
const require_kv_cache = require('../kv-cache-BHIupktM.cjs');
|
10
|
+
require('../utils-B6yXfxAQ.cjs');
|
11
|
+
|
12
|
+
exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
|
13
|
+
exports.getUserAgent = require_request.getUserAgent;
|
14
|
+
exports.kvCache = require_kv_cache.kvCache;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { getUserAgent } from "../request-BbHkedIU.cjs";
|
2
|
+
import "../vocab-DCBw44JZ.cjs";
|
3
|
+
import "../http-B6SKO6NJ.cjs";
|
4
|
+
import "../kv-BMKIFXNW.cjs";
|
5
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "../mod-CLKu6Uo_.cjs";
|
6
|
+
export { getAuthenticatedDocumentLoader, getUserAgent, kvCache };
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
3
|
+
import { getUserAgent } from "../request-U1t6zZtk.js";
|
4
|
+
import "../vocab-ivDKb439.js";
|
5
|
+
import "../http-BE7aFuqn.js";
|
6
|
+
import "../kv-Dt06smFt.js";
|
7
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "../mod-Cm97bAiT.js";
|
8
|
+
export { getAuthenticatedDocumentLoader, getUserAgent, kvCache };
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import { getUserAgent } from "../request-DKGQaofB.js";
|
6
|
+
import "../actor-DPD6Gbdn.js";
|
7
|
+
import "../lookup-BV3A9Zbc.js";
|
8
|
+
import "../http-DcDb8r1W.js";
|
9
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "../kv-cache-ydIs4Ul6.js";
|
10
|
+
import "../utils-BXMGcmqK.js";
|
11
|
+
|
12
|
+
export { getAuthenticatedDocumentLoader, getUserAgent, kvCache };
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import { deno_default, getUserAgent } from "../lookup-BbEekiru.js";
|
7
|
+
import { test } from "../testing-ClYSmXdi.js";
|
8
|
+
import process from "node:process";
|
9
|
+
import { deepStrictEqual } from "node:assert";
|
10
|
+
|
11
|
+
//#region src/utils/request.test.ts
|
12
|
+
test("getUserAgent()", () => {
|
13
|
+
if ("Deno" in globalThis) {
|
14
|
+
deepStrictEqual(getUserAgent(), `Fedify/${deno_default.version} (Deno/${Deno.version.deno})`);
|
15
|
+
deepStrictEqual(getUserAgent({ software: "MyApp/1.0.0" }), `MyApp/1.0.0 (Fedify/${deno_default.version}; Deno/${Deno.version.deno})`);
|
16
|
+
deepStrictEqual(getUserAgent({ url: "https://example.com/" }), `Fedify/${deno_default.version} (Deno/${Deno.version.deno}; +https://example.com/)`);
|
17
|
+
deepStrictEqual(getUserAgent({
|
18
|
+
software: "MyApp/1.0.0",
|
19
|
+
url: new URL("https://example.com/")
|
20
|
+
}), `MyApp/1.0.0 (Fedify/${deno_default.version}; Deno/${Deno.version.deno}; +https://example.com/)`);
|
21
|
+
} else if ("Bun" in globalThis) {
|
22
|
+
deepStrictEqual(getUserAgent(), `Fedify/${deno_default.version} (Bun/${Bun.version})`);
|
23
|
+
deepStrictEqual(getUserAgent({ software: "MyApp/1.0.0" }), `MyApp/1.0.0 (Fedify/${deno_default.version}; Bun/${Bun.version})`);
|
24
|
+
deepStrictEqual(getUserAgent({ url: "https://example.com/" }), `Fedify/${deno_default.version} (Bun/${Bun.version}; +https://example.com/)`);
|
25
|
+
deepStrictEqual(getUserAgent({
|
26
|
+
software: "MyApp/1.0.0",
|
27
|
+
url: new URL("https://example.com/")
|
28
|
+
}), `MyApp/1.0.0 (Fedify/${deno_default.version}; Bun/${Bun.version}; +https://example.com/)`);
|
29
|
+
} else if (navigator.userAgent === "Cloudflare-Workers") {
|
30
|
+
deepStrictEqual(getUserAgent(), `Fedify/${deno_default.version} (Cloudflare-Workers)`);
|
31
|
+
deepStrictEqual(getUserAgent({ software: "MyApp/1.0.0" }), `MyApp/1.0.0 (Fedify/${deno_default.version}; Cloudflare-Workers)`);
|
32
|
+
deepStrictEqual(getUserAgent({ url: "https://example.com/" }), `Fedify/${deno_default.version} (Cloudflare-Workers; +https://example.com/)`);
|
33
|
+
deepStrictEqual(getUserAgent({
|
34
|
+
software: "MyApp/1.0.0",
|
35
|
+
url: new URL("https://example.com/")
|
36
|
+
}), `MyApp/1.0.0 (Fedify/${deno_default.version}; Cloudflare-Workers; +https://example.com/)`);
|
37
|
+
} else {
|
38
|
+
deepStrictEqual(getUserAgent(), `Fedify/${deno_default.version} (Node.js/${process.versions.node})`);
|
39
|
+
deepStrictEqual(getUserAgent({ software: "MyApp/1.0.0" }), `MyApp/1.0.0 (Fedify/${deno_default.version}; Node.js/${process.versions.node})`);
|
40
|
+
deepStrictEqual(getUserAgent({ url: "https://example.com/" }), `Fedify/${deno_default.version} (Node.js/${process.versions.node}; +https://example.com/)`);
|
41
|
+
deepStrictEqual(getUserAgent({
|
42
|
+
software: "MyApp/1.0.0",
|
43
|
+
url: new URL("https://example.com/")
|
44
|
+
}), `MyApp/1.0.0 (Fedify/${deno_default.version}; Node.js/${process.versions.node}; +https://example.com/)`);
|
45
|
+
}
|
46
|
+
});
|
47
|
+
|
48
|
+
//#endregion
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import { UrlError, expandIPv6Address, isValidPublicIPv4Address, isValidPublicIPv6Address, validatePublicUrl } from "../lookup-BbEekiru.js";
|
7
|
+
import { test } from "../testing-ClYSmXdi.js";
|
8
|
+
import { deepStrictEqual, ok, rejects } from "node:assert";
|
9
|
+
|
10
|
+
//#region src/utils/url.test.ts
|
11
|
+
test("validatePublicUrl()", async () => {
|
12
|
+
await rejects(() => validatePublicUrl("ftp://localhost"), UrlError);
|
13
|
+
await rejects(() => validatePublicUrl("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="), UrlError);
|
14
|
+
await rejects(() => validatePublicUrl("https://localhost"), UrlError);
|
15
|
+
await rejects(() => validatePublicUrl("https://127.0.0.1"), UrlError);
|
16
|
+
await rejects(() => validatePublicUrl("https://[::1]"), UrlError);
|
17
|
+
});
|
18
|
+
test("isValidPublicIPv4Address()", () => {
|
19
|
+
ok(isValidPublicIPv4Address("8.8.8.8"));
|
20
|
+
ok(!isValidPublicIPv4Address("192.168.1.1"));
|
21
|
+
ok(!isValidPublicIPv4Address("127.0.0.1"));
|
22
|
+
ok(!isValidPublicIPv4Address("10.0.0.1"));
|
23
|
+
ok(!isValidPublicIPv4Address("127.16.0.1"));
|
24
|
+
ok(!isValidPublicIPv4Address("169.254.0.1"));
|
25
|
+
});
|
26
|
+
test("isValidPublicIPv6Address()", () => {
|
27
|
+
ok(isValidPublicIPv6Address("2001:db8::1"));
|
28
|
+
ok(!isValidPublicIPv6Address("::1"));
|
29
|
+
ok(!isValidPublicIPv6Address("fc00::1"));
|
30
|
+
ok(!isValidPublicIPv6Address("fe80::1"));
|
31
|
+
ok(!isValidPublicIPv6Address("ff00::1"));
|
32
|
+
ok(!isValidPublicIPv6Address("::"));
|
33
|
+
});
|
34
|
+
test("expandIPv6Address()", () => {
|
35
|
+
deepStrictEqual(expandIPv6Address("::"), "0000:0000:0000:0000:0000:0000:0000:0000");
|
36
|
+
deepStrictEqual(expandIPv6Address("::1"), "0000:0000:0000:0000:0000:0000:0000:0001");
|
37
|
+
deepStrictEqual(expandIPv6Address("2001:db8::"), "2001:0db8:0000:0000:0000:0000:0000:0000");
|
38
|
+
deepStrictEqual(expandIPv6Address("2001:db8::1"), "2001:0db8:0000:0000:0000:0000:0000:0001");
|
39
|
+
});
|
40
|
+
|
41
|
+
//#endregion
|
package/dist/vocab/actor.test.js
CHANGED
@@ -3,19 +3,17 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Application, Group, Organization, Person, Service, __export } from "../
|
6
|
+
import { Application, Group, Organization, Person, Service, __export } from "../lookup-BbEekiru.js";
|
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 "../
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import "../
|
16
|
-
import "../
|
17
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
18
|
-
import { esm_default } from "../esm-Dl5T1RNE.js";
|
10
|
+
import { getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-Cg8ZhoVF.js";
|
11
|
+
import { test } from "../testing-ClYSmXdi.js";
|
12
|
+
import { assertStrictEquals } from "../std__assert-DWivtrGR.js";
|
13
|
+
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
14
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
15
|
+
import "../assert_not_equals-C80BG-_5.js";
|
16
|
+
import { esm_default } from "../esm-CU0Dnk7T.js";
|
19
17
|
|
20
18
|
//#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
|
21
19
|
var PreconditionFailure = class PreconditionFailure extends Error {
|
@@ -3,18 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Collection, Note, Object as Object$1, Person } from "../
|
6
|
+
import { Collection, Note, Object as Object$1, Person, lookupObject, traverseCollection } from "../lookup-BbEekiru.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 {
|
11
|
-
import
|
12
|
-
import "../
|
13
|
-
import
|
14
|
-
import "../
|
15
|
-
import "../
|
16
|
-
import "../assert_throws-BOO88avQ.js";
|
17
|
-
import { esm_default } from "../esm-Dl5T1RNE.js";
|
10
|
+
import { mockDocumentLoader, test } from "../testing-ClYSmXdi.js";
|
11
|
+
import "../std__assert-DWivtrGR.js";
|
12
|
+
import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
13
|
+
import "../assert_throws-BNXdRGWP.js";
|
14
|
+
import "../assert_not_equals-C80BG-_5.js";
|
15
|
+
import { esm_default } from "../esm-CU0Dnk7T.js";
|
18
16
|
|
19
17
|
//#region src/vocab/lookup.test.ts
|
20
18
|
test("lookupObject()", {
|
package/dist/vocab/mod.cjs
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
4
4
|
|
5
|
-
require('../
|
6
|
-
const require_actor = require('../actor-
|
7
|
-
require('../lookup-
|
8
|
-
const require_vocab = require('../vocab-
|
5
|
+
require('../request-XHWUW2bi.cjs');
|
6
|
+
const require_actor = require('../actor-D020hlx3.cjs');
|
7
|
+
require('../lookup-CMAGfQ1Q.cjs');
|
8
|
+
const require_vocab = require('../vocab-CxTuoEVd.cjs');
|
9
9
|
|
10
10
|
exports.Accept = require_actor.Accept;
|
11
11
|
exports.Activity = require_actor.Activity;
|
package/dist/vocab/mod.d.cts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import "../
|
2
|
-
import "../
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-CxkWO3Mg.cjs";
|
1
|
+
import "../request-BbHkedIU.cjs";
|
2
|
+
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View } from "../vocab-DCBw44JZ.cjs";
|
3
|
+
import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-DDhZuMGl.cjs";
|
4
|
+
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod--K7l84wp.cjs";
|
6
5
|
export { Accept, Activity, Actor, ActorTypeName, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, FediverseHandle, Flag, Follow, GetActorHandleOptions, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, LookupObjectOptions, Mention, Move, Multikey, NormalizeActorHandleOptions, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Question, Read, Recipient, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, TraverseCollectionOptions, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, isFediverseHandle, lookupObject, normalizeActorHandle, parseFediverseHandle, toAcctUrl, traverseCollection };
|
package/dist/vocab/mod.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import "../
|
4
|
-
import "../
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-DlU8ISoa.js";
|
3
|
+
import "../request-U1t6zZtk.js";
|
4
|
+
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View } from "../vocab-ivDKb439.js";
|
5
|
+
import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-Cd2CREO0.js";
|
6
|
+
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-CRENK2dd.js";
|
8
7
|
export { Accept, Activity, Actor, ActorTypeName, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, FediverseHandle, Flag, Follow, GetActorHandleOptions, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, LookupObjectOptions, Mention, Move, Multikey, NormalizeActorHandleOptions, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Question, Read, Recipient, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, TraverseCollectionOptions, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, isFediverseHandle, lookupObject, normalizeActorHandle, parseFediverseHandle, toAcctUrl, traverseCollection };
|
package/dist/vocab/mod.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import "../
|
6
|
-
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, normalizeActorHandle } from "../actor-
|
7
|
-
import "../lookup-
|
8
|
-
import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../vocab-
|
5
|
+
import "../request-DKGQaofB.js";
|
6
|
+
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, normalizeActorHandle } from "../actor-DPD6Gbdn.js";
|
7
|
+
import "../lookup-BV3A9Zbc.js";
|
8
|
+
import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../vocab-yFT-fQBj.js";
|
9
9
|
|
10
10
|
export { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, isFediverseHandle, lookupObject, normalizeActorHandle, parseFediverseHandle, toAcctUrl, traverseCollection };
|
package/dist/vocab/type.test.js
CHANGED
@@ -3,10 +3,9 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Person, getTypeId } from "../
|
6
|
+
import { Person, getTypeId } from "../lookup-BbEekiru.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
|
-
import "../
|
9
|
-
import { test } from "../testing-tWr1VQxx.js";
|
8
|
+
import { test } from "../testing-ClYSmXdi.js";
|
10
9
|
|
11
10
|
//#region src/vocab/type.test.ts
|
12
11
|
test("getTypeId()", () => {
|
package/dist/vocab/vocab.test.js
CHANGED
@@ -3,19 +3,18 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Announce, Collection, Create, CryptographicKey, Follow, Hashtag,
|
6
|
+
import { Activity, Announce, Collection, Create, CryptographicKey, Follow, Hashtag, Link, Note, Object as Object$1, OrderedCollectionPage, Person, Place, Question, Source, vocab_exports } from "../lookup-BbEekiru.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../
|
11
|
-
import
|
12
|
-
import "../
|
13
|
-
import {
|
14
|
-
import "../
|
15
|
-
import {
|
16
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
17
|
-
import { ed25519PublicKey, rsaPublicKey1 } from "../keys-D3_MDK7n.js";
|
10
|
+
import { mockDocumentLoader, test } from "../testing-ClYSmXdi.js";
|
11
|
+
import "../std__assert-DWivtrGR.js";
|
12
|
+
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
13
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
14
|
+
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
15
|
+
import { ed25519PublicKey, rsaPublicKey1 } from "../keys-BKM2Mqu2.js";
|
18
16
|
import { pascalCase } from "es-toolkit";
|
17
|
+
import { LanguageString, decodeMultibase } from "@fedify/vocab-runtime";
|
19
18
|
import { Validator } from "@cfworker/json-schema";
|
20
19
|
import { readFile, readdir } from "node:fs/promises";
|
21
20
|
import { join } from "node:path";
|
@@ -2734,7 +2733,7 @@ test("Activity.fromJsonLd()", async () => {
|
|
2734
2733
|
assertEquals(proofs[0].cryptosuite, "eddsa-jcs-2022");
|
2735
2734
|
assertEquals(proofs[0].verificationMethodId, new URL("https://server.example/users/alice#ed25519-key"));
|
2736
2735
|
assertEquals(proofs[0].proofPurpose, "assertionMethod");
|
2737
|
-
assertEquals(proofs[0].proofValue,
|
2736
|
+
assertEquals(proofs[0].proofValue, decodeMultibase("z3sXaxjKs4M3BRicwWA9peyNPJvJqxtGsDmpt1jjoHCjgeUf71TRFz56osPSfDErszyLp5Ks1EhYSgpDaNM977Rg2"));
|
2738
2737
|
assertEquals(proofs[0].created, Temporal.Instant.from("2023-02-24T23:36:38Z"));
|
2739
2738
|
});
|
2740
2739
|
test({
|
@@ -3,11 +3,12 @@
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
|
-
const
|
7
|
-
const require_actor = require('./actor-
|
8
|
-
const require_lookup = require('./lookup-
|
6
|
+
const require_request = require('./request-XHWUW2bi.cjs');
|
7
|
+
const require_actor = require('./actor-D020hlx3.cjs');
|
8
|
+
const require_lookup = require('./lookup-CMAGfQ1Q.cjs');
|
9
9
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
10
10
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
11
|
+
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
11
12
|
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
12
13
|
|
13
14
|
//#region src/vocab/handle.ts
|
@@ -128,7 +129,7 @@ const logger = (0, __logtape_logtape.getLogger)([
|
|
128
129
|
*/
|
129
130
|
async function lookupObject(identifier, options = {}) {
|
130
131
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
131
|
-
const tracer = tracerProvider.getTracer(
|
132
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
132
133
|
return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
|
133
134
|
try {
|
134
135
|
const result = await lookupObjectInternal(identifier, options);
|
@@ -151,7 +152,7 @@ async function lookupObject(identifier, options = {}) {
|
|
151
152
|
});
|
152
153
|
}
|
153
154
|
async function lookupObjectInternal(identifier, options = {}) {
|
154
|
-
const documentLoader = options.documentLoader ??
|
155
|
+
const documentLoader = options.documentLoader ?? (0, __fedify_vocab_runtime.getDocumentLoader)({ userAgent: options.userAgent });
|
155
156
|
if (typeof identifier === "string") identifier = toAcctUrl(identifier) ?? new URL(identifier);
|
156
157
|
let remoteDoc = null;
|
157
158
|
if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
|
@@ -1,25 +1,6 @@
|
|
1
|
-
import { DocumentLoader } from "
|
1
|
+
import { DocumentLoader, LanguageString } from "@fedify/vocab-runtime";
|
2
2
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
3
3
|
|
4
|
-
//#region src/runtime/langstr.d.ts
|
5
|
-
/**
|
6
|
-
* A language-tagged string which corresponds to the `rdf:langString` type.
|
7
|
-
*/
|
8
|
-
declare class LanguageString extends String {
|
9
|
-
/**
|
10
|
-
* The locale of the string.
|
11
|
-
* @since 2.0.0
|
12
|
-
*/
|
13
|
-
readonly locale: Intl.Locale;
|
14
|
-
/**
|
15
|
-
* Constructs a new `LanguageString`.
|
16
|
-
* @param value A string value written in the given language.
|
17
|
-
* @param locale The language of the string. If a string is given, it will
|
18
|
-
* be parsed as a `Intl.Locale` object.
|
19
|
-
*/
|
20
|
-
constructor(value: string, language: Intl.Locale | string);
|
21
|
-
}
|
22
|
-
//#endregion
|
23
4
|
//#region src/vocab/vocab.d.ts
|
24
5
|
/** Describes an object of any kind. The Object type serves as the base type for
|
25
6
|
* most of the other kinds of objects defined in the Activity Vocabulary,
|
@@ -14919,4 +14900,4 @@ declare class View extends Activity {
|
|
14919
14900
|
protected _getCustomInspectProxy(): Record<string, unknown>;
|
14920
14901
|
}
|
14921
14902
|
//#endregion
|
14922
|
-
export { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join,
|
14903
|
+
export { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View };
|
@@ -1,27 +1,8 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { DocumentLoader } from "./docloader-CxWcuWqQ.js";
|
4
3
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
4
|
+
import { DocumentLoader, LanguageString } from "@fedify/vocab-runtime";
|
5
5
|
|
6
|
-
//#region src/runtime/langstr.d.ts
|
7
|
-
/**
|
8
|
-
* A language-tagged string which corresponds to the `rdf:langString` type.
|
9
|
-
*/
|
10
|
-
declare class LanguageString extends String {
|
11
|
-
/**
|
12
|
-
* The locale of the string.
|
13
|
-
* @since 2.0.0
|
14
|
-
*/
|
15
|
-
readonly locale: Intl.Locale;
|
16
|
-
/**
|
17
|
-
* Constructs a new `LanguageString`.
|
18
|
-
* @param value A string value written in the given language.
|
19
|
-
* @param locale The language of the string. If a string is given, it will
|
20
|
-
* be parsed as a `Intl.Locale` object.
|
21
|
-
*/
|
22
|
-
constructor(value: string, language: Intl.Locale | string);
|
23
|
-
}
|
24
|
-
//#endregion
|
25
6
|
//#region src/vocab/vocab.d.ts
|
26
7
|
/** Describes an object of any kind. The Object type serves as the base type for
|
27
8
|
* most of the other kinds of objects defined in the Activity Vocabulary,
|
@@ -14921,4 +14902,4 @@ declare class View extends Activity {
|
|
14921
14902
|
protected _getCustomInspectProxy(): Record<string, unknown>;
|
14922
14903
|
}
|
14923
14904
|
//#endregion
|
14924
|
-
export { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join,
|
14905
|
+
export { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View };
|