@fedify/fedify 2.0.0-pr.410.1558 → 2.0.0-pr.412.1692
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-CrTGiTZd.cjs +42609 -0
- package/dist/{actor-CkjTCNqi.js → actor-D5S46edz.js} +1 -1
- package/dist/actor-D6K058Tb.d.cts +128 -0
- package/dist/{actor-DmsbGzXS.js → actor-G2S5sPEA.js} +6951 -2127
- package/dist/{actor-C22bXuuC.d.ts → actor-T6RyhRgk.d.ts} +1 -1
- package/dist/{authdocloader-BwV2NPfz.js → authdocloader-C5AvdCCi.js} +6 -6
- package/dist/authdocloader-CQMPmpaO.cjs +58 -0
- package/dist/{authdocloader-BJxkviIL.js → authdocloader-SjwloJUA.js} +3 -3
- package/dist/{builder-DbOVAz8i.js → builder-OA47XRft.js} +10 -4
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/{client-DrNZd6r_.js → client-Bmd-i8x8.js} +3 -22
- package/dist/client-CegPX0Rn.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-bgSdkFa2.d.ts} +2 -74
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +13 -0
- package/dist/compat/mod.d.ts +8 -8
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +19 -19
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-9gCpIkiz.d.ts → context-ByZprN0S.d.ts} +67 -7
- package/dist/context-C5BsZkDr.d.cts +2315 -0
- package/dist/docloader-7Ey7wNHx.cjs +4861 -0
- package/dist/{docloader-DnepZfu_.js → docloader-CkweNhUH.js} +189 -9
- package/dist/docloader-D-MrRyHl.d.cts +219 -0
- package/dist/{esm-D1HqBE3n.js → esm-CwHz8Y8t.js} +1 -1
- package/dist/federation/builder.test.js +6 -7
- package/dist/federation/collection.test.js +4 -4
- package/dist/federation/handler.test.js +23 -143
- package/dist/federation/idempotency.test.js +202 -0
- package/dist/federation/inbox.test.js +4 -4
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +4 -3
- package/dist/federation/middleware.test.js +231 -52
- package/dist/federation/mod.cjs +29 -0
- package/dist/federation/mod.d.cts +13 -0
- package/dist/federation/mod.d.ts +8 -8
- package/dist/federation/mod.js +15 -15
- package/dist/federation/mq.test.js +3 -3
- package/dist/federation/negotiation.test.d.ts +3 -0
- package/dist/federation/negotiation.test.js +28 -0
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +3 -3
- package/dist/federation/send.test.js +10 -10
- package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
- package/dist/federation-H2_En3j5.cjs +244 -0
- package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
- package/dist/http-BiBofurJ.cjs +826 -0
- package/dist/{http-BEJUSX6j.js → http-C5tC93Hn.js} +7 -7
- package/dist/http-D-e6AFwR.d.cts +253 -0
- package/dist/{http-DqSNLFNY.d.ts → http-D6Uj2x2y.d.ts} +1 -1
- package/dist/{http-BgCF3jDs.js → http-DGjdMiLc.js} +3 -3
- package/dist/{inbox-Bq4EChoK.js → inbox-BoDY3z8G.js} +24 -7
- package/dist/key-CZR7QraT.cjs +290 -0
- package/dist/key-Cf8MffVe.cjs +10 -0
- package/dist/{key-D-0OLe9C.js → key-CkxrAIyp.js} +5 -5
- package/dist/key-Dk0j88Jo.js +10 -0
- package/dist/{key-BD3lpBWw.js → key-Epcl5jpz.js} +3 -3
- package/dist/{key-BYNqWXyu.js → key-IxRhZpOF.js} +2 -2
- package/dist/{keycache-yZDAc3-e.js → keycache-TEniXNel.js} +1 -1
- package/dist/{keys-Dtc-g6xq.js → keys-bZxcrZ9Z.js} +1 -1
- package/dist/kv-63Cil1MD.d.cts +81 -0
- package/dist/{ld-BJ484qSg.js → ld-DW7A0uIc.js} +4 -4
- package/dist/{lookup-Cj0sX50U.js → lookup-DhQCVVja.js} +21 -12
- package/dist/lookup-DiV4LFBg.cjs +137 -0
- package/dist/{lookup-BzogF2gp.js → lookup-cVRa2QM-.js} +4 -4
- package/dist/middleware-Be1JStOx.js +17 -0
- package/dist/middleware-CDOK7WOb.js +26 -0
- package/dist/{middleware-CiH0ptqy.js → middleware-Cgr3PtaJ.js} +58 -149
- package/dist/{middleware-DIZ1dnwT.js → middleware-DvvYAIsd.js} +87 -91
- package/dist/middleware-EjIW2mZB.cjs +17 -0
- package/dist/middleware-TfuVoceY.cjs +4231 -0
- package/dist/mod-8DMWKtQE.d.cts +80 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-BhUKmBJD.d.ts} +2 -2
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/{mod-TFoH2Ql8.d.ts → mod-CerN_Sza.d.ts} +1 -1
- package/dist/mod-Cj1tHXBR.d.cts +102 -0
- package/dist/mod-CxkWO3Mg.d.cts +307 -0
- package/dist/{mod-Bqxcp7eN.d.ts → mod-D6hQoxC5.d.ts} +2 -2
- package/dist/mod-Djzcw2ry.d.cts +266 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-DlU8ISoa.d.ts} +19 -1
- package/dist/mod-FZd39qVq.d.cts +1 -0
- package/dist/mod-jQ4OODsl.d.cts +113 -0
- package/dist/mod.cjs +150 -0
- package/dist/mod.d.cts +17 -0
- package/dist/mod.d.ts +11 -11
- package/dist/mod.js +21 -21
- package/dist/mq-B7R1Q-M5.d.cts +140 -0
- package/dist/negotiation-5NPJL6zp.js +71 -0
- package/dist/nodeinfo/client.test.js +27 -106
- package/dist/nodeinfo/handler.test.js +20 -20
- package/dist/nodeinfo/mod.cjs +11 -0
- package/dist/nodeinfo/mod.d.cts +5 -0
- package/dist/nodeinfo/mod.d.ts +2 -2
- package/dist/nodeinfo/mod.js +7 -7
- package/dist/nodeinfo/types.test.js +5 -10
- package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
- package/dist/nodeinfo-DfycQ8Wf.js +4 -0
- package/dist/{owner-9FMX4wQT.js → owner-6Vc3UXXE.js} +2 -2
- package/dist/owner-BN_tO3cY.d.cts +67 -0
- package/dist/{owner-CQPnQVtf.d.ts → owner-hd9lvQcP.d.ts} +2 -2
- package/dist/{proof-Arx4Q9Q6.js → proof-C1jhbeNv.js} +3 -3
- package/dist/proof-CRJWXFfT.cjs +673 -0
- package/dist/{proof-DnTD0avk.js → proof-Chi90OXv.js} +9 -9
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +4 -4
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/langstr.test.js +3 -3
- package/dist/runtime/link.test.d.ts +3 -0
- package/dist/runtime/link.test.js +61 -0
- package/dist/runtime/mod.cjs +25 -0
- package/dist/runtime/mod.d.cts +6 -0
- package/dist/runtime/mod.d.ts +3 -3
- package/dist/runtime/mod.js +10 -10
- package/dist/runtime/multibase/multibase.test.js +3 -3
- package/dist/runtime/url.test.js +3 -3
- package/dist/runtime-C58AJWSv.cjs +4 -0
- package/dist/runtime-DPYEDf-o.js +4 -0
- package/dist/{send-CcxHe0p3.js → send-DjATl6i3.js} +2 -2
- package/dist/sig/http.test.js +9 -9
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.cjs +30 -0
- package/dist/sig/mod.d.cts +8 -0
- package/dist/sig/mod.d.ts +5 -5
- package/dist/sig/mod.js +10 -10
- package/dist/sig/owner.test.js +7 -7
- package/dist/sig/proof.test.js +7 -7
- package/dist/sig-ByHXzqUi.cjs +4 -0
- package/dist/sig-Cj3tk-ig.js +4 -0
- package/dist/testing/docloader.test.js +3 -3
- package/dist/testing/mod.d.ts +273 -28
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-DFgpNAI6.js → testing-BnfPB5T-.js} +2 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{type-B2h-NRAo.js → type-NEA09tSC.js} +7262 -2258
- package/dist/{types-BIgY6c-l.js → types-BSuWJsOm.js} +1 -3
- package/dist/types-CmmUQisS.cjs +315 -0
- package/dist/{types-B1QuBj5L.js → types-dLXLjVLf.js} +8 -169
- package/dist/vocab/actor.test.js +5 -5
- package/dist/vocab/lookup.test.js +255 -5
- package/dist/vocab/mod.cjs +87 -0
- package/dist/vocab/mod.d.cts +6 -0
- package/dist/vocab/mod.d.ts +3 -3
- package/dist/vocab/mod.js +7 -7
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +433 -9
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BI0Ak5lL.d.ts} +290 -0
- package/dist/vocab-C5Y-0fGj.cjs +291 -0
- package/dist/vocab-Dw1-yVGg.d.cts +14922 -0
- package/dist/{vocab-BREfYr1a.js → vocab-rWbHpc2J.js} +26 -17
- package/dist/webfinger/handler.test.js +19 -19
- package/dist/webfinger/lookup.test.js +4 -4
- package/dist/webfinger/mod.cjs +9 -0
- package/dist/webfinger/mod.d.cts +4 -0
- package/dist/webfinger/mod.js +6 -6
- package/dist/webfinger-BjOEdFPs.cjs +4 -0
- package/dist/webfinger-De_bU0iE.js +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +3 -3
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +54 -0
- package/dist/x/hono.d.ts +7 -7
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +46 -0
- package/dist/x/sveltekit.d.ts +7 -7
- package/dist/x/sveltekit.js +3 -3
- package/package.json +68 -13
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/key-BmFoI4_J.js +0 -10
- package/dist/middleware-D2W4gwdv.js +0 -17
- package/dist/middleware-LmK3pQ2z.js +0 -26
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/{collection-CSzG2j1P.js → collection-CcnIw1qY.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
@@ -3,18 +3,18 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Collection, Note, Object as Object$1, Person } from "../type-
|
6
|
+
import { Collection, Note, Object as Object$1, Person } from "../type-NEA09tSC.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 { lookupObject, traverseCollection } from "../lookup-
|
11
|
-
import { mockDocumentLoader, test } from "../testing-
|
10
|
+
import { lookupObject, traverseCollection } from "../lookup-DhQCVVja.js";
|
11
|
+
import { mockDocumentLoader, test } from "../testing-BnfPB5T-.js";
|
12
12
|
import "../std__assert-X-_kMxKM.js";
|
13
|
-
import "../assert_rejects-DiIiJbZn.js";
|
13
|
+
import { assertRejects } from "../assert_rejects-DiIiJbZn.js";
|
14
14
|
import "../assert_is_error-BPGph1Jx.js";
|
15
15
|
import "../assert_not_equals-f3m3epl3.js";
|
16
16
|
import "../assert_throws-BOO88avQ.js";
|
17
|
-
import { esm_default } from "../esm-
|
17
|
+
import { esm_default } from "../esm-CwHz8Y8t.js";
|
18
18
|
|
19
19
|
//#region src/vocab/lookup.test.ts
|
20
20
|
test("lookupObject()", {
|
@@ -202,5 +202,255 @@ test("traverseCollection()", {
|
|
202
202
|
new Note({ content: "This is a third simple note" })
|
203
203
|
]);
|
204
204
|
});
|
205
|
+
test("FEP-fe34: lookupObject() cross-origin security", {
|
206
|
+
sanitizeResources: false,
|
207
|
+
sanitizeOps: false
|
208
|
+
}, async (t) => {
|
209
|
+
await t.step("crossOrigin: ignore (default) - returns null for cross-origin objects", async () => {
|
210
|
+
const crossOriginDocumentLoader = async (url) => {
|
211
|
+
if (url === "https://example.com/note") return {
|
212
|
+
documentUrl: url,
|
213
|
+
contextUrl: null,
|
214
|
+
document: {
|
215
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
216
|
+
type: "Note",
|
217
|
+
id: "https://malicious.com/fake-note",
|
218
|
+
content: "This is a spoofed note from a different origin"
|
219
|
+
}
|
220
|
+
};
|
221
|
+
throw new Error(`Unexpected URL: ${url}`);
|
222
|
+
};
|
223
|
+
const result = await lookupObject("https://example.com/note", {
|
224
|
+
documentLoader: crossOriginDocumentLoader,
|
225
|
+
contextLoader: mockDocumentLoader
|
226
|
+
});
|
227
|
+
assertEquals(result, null);
|
228
|
+
});
|
229
|
+
await t.step("crossOrigin: throw - throws error for cross-origin objects", async () => {
|
230
|
+
const crossOriginDocumentLoader = async (url) => {
|
231
|
+
if (url === "https://example.com/note") return {
|
232
|
+
documentUrl: url,
|
233
|
+
contextUrl: null,
|
234
|
+
document: {
|
235
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
236
|
+
type: "Note",
|
237
|
+
id: "https://malicious.com/fake-note",
|
238
|
+
content: "This is a spoofed note from a different origin"
|
239
|
+
}
|
240
|
+
};
|
241
|
+
throw new Error(`Unexpected URL: ${url}`);
|
242
|
+
};
|
243
|
+
await assertRejects(() => lookupObject("https://example.com/note", {
|
244
|
+
documentLoader: crossOriginDocumentLoader,
|
245
|
+
contextLoader: mockDocumentLoader,
|
246
|
+
crossOrigin: "throw"
|
247
|
+
}), Error, "The object's @id (https://malicious.com/fake-note) has a different origin than the document URL (https://example.com/note)");
|
248
|
+
});
|
249
|
+
await t.step("crossOrigin: trust - allows cross-origin objects", async () => {
|
250
|
+
const crossOriginDocumentLoader = async (url) => {
|
251
|
+
if (url === "https://example.com/note") return {
|
252
|
+
documentUrl: url,
|
253
|
+
contextUrl: null,
|
254
|
+
document: {
|
255
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
256
|
+
type: "Note",
|
257
|
+
id: "https://malicious.com/fake-note",
|
258
|
+
content: "This is a spoofed note from a different origin"
|
259
|
+
}
|
260
|
+
};
|
261
|
+
throw new Error(`Unexpected URL: ${url}`);
|
262
|
+
};
|
263
|
+
const result = await lookupObject("https://example.com/note", {
|
264
|
+
documentLoader: crossOriginDocumentLoader,
|
265
|
+
contextLoader: mockDocumentLoader,
|
266
|
+
crossOrigin: "trust"
|
267
|
+
});
|
268
|
+
assertInstanceOf(result, Note);
|
269
|
+
assertEquals(result.id, new URL("https://malicious.com/fake-note"));
|
270
|
+
assertEquals(result.content, "This is a spoofed note from a different origin");
|
271
|
+
});
|
272
|
+
await t.step("same-origin objects are always trusted", async () => {
|
273
|
+
const sameOriginDocumentLoader = async (url) => {
|
274
|
+
if (url === "https://example.com/note") return {
|
275
|
+
documentUrl: url,
|
276
|
+
contextUrl: null,
|
277
|
+
document: {
|
278
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
279
|
+
type: "Note",
|
280
|
+
id: "https://example.com/note",
|
281
|
+
content: "This is a legitimate note from the same origin"
|
282
|
+
}
|
283
|
+
};
|
284
|
+
throw new Error(`Unexpected URL: ${url}`);
|
285
|
+
};
|
286
|
+
const result = await lookupObject("https://example.com/note", {
|
287
|
+
documentLoader: sameOriginDocumentLoader,
|
288
|
+
contextLoader: mockDocumentLoader
|
289
|
+
});
|
290
|
+
assertInstanceOf(result, Note);
|
291
|
+
assertEquals(result.id, new URL("https://example.com/note"));
|
292
|
+
assertEquals(result.content, "This is a legitimate note from the same origin");
|
293
|
+
});
|
294
|
+
await t.step("objects without @id are trusted", async () => {
|
295
|
+
const noIdDocumentLoader = async (url) => {
|
296
|
+
if (url === "https://example.com/note") return {
|
297
|
+
documentUrl: url,
|
298
|
+
contextUrl: null,
|
299
|
+
document: {
|
300
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
301
|
+
type: "Note",
|
302
|
+
content: "This is a note without an ID"
|
303
|
+
}
|
304
|
+
};
|
305
|
+
throw new Error(`Unexpected URL: ${url}`);
|
306
|
+
};
|
307
|
+
const result = await lookupObject("https://example.com/note", {
|
308
|
+
documentLoader: noIdDocumentLoader,
|
309
|
+
contextLoader: mockDocumentLoader
|
310
|
+
});
|
311
|
+
assertInstanceOf(result, Note);
|
312
|
+
assertEquals(result.id, null);
|
313
|
+
assertEquals(result.content, "This is a note without an ID");
|
314
|
+
});
|
315
|
+
await t.step("WebFinger lookup with cross-origin actor URL", async () => {
|
316
|
+
esm_default.spyGlobal();
|
317
|
+
esm_default.get("begin:https://example.com/.well-known/webfinger", {
|
318
|
+
subject: "acct:user@example.com",
|
319
|
+
links: [{
|
320
|
+
rel: "self",
|
321
|
+
href: "https://different-origin.com/actor",
|
322
|
+
type: "application/activity+json"
|
323
|
+
}]
|
324
|
+
});
|
325
|
+
const webfingerDocumentLoader = async (url) => {
|
326
|
+
if (url === "https://different-origin.com/actor") return {
|
327
|
+
documentUrl: url,
|
328
|
+
contextUrl: null,
|
329
|
+
document: {
|
330
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
331
|
+
type: "Person",
|
332
|
+
id: "https://malicious.com/fake-actor",
|
333
|
+
name: "Fake Actor"
|
334
|
+
}
|
335
|
+
};
|
336
|
+
throw new Error(`Unexpected URL: ${url}`);
|
337
|
+
};
|
338
|
+
const result1 = await lookupObject("@user@example.com", {
|
339
|
+
documentLoader: webfingerDocumentLoader,
|
340
|
+
contextLoader: mockDocumentLoader
|
341
|
+
});
|
342
|
+
assertEquals(result1, null);
|
343
|
+
await assertRejects(() => lookupObject("@user@example.com", {
|
344
|
+
documentLoader: webfingerDocumentLoader,
|
345
|
+
contextLoader: mockDocumentLoader,
|
346
|
+
crossOrigin: "throw"
|
347
|
+
}), Error, "The object's @id (https://malicious.com/fake-actor) has a different origin than the document URL (https://different-origin.com/actor)");
|
348
|
+
const result2 = await lookupObject("@user@example.com", {
|
349
|
+
documentLoader: webfingerDocumentLoader,
|
350
|
+
contextLoader: mockDocumentLoader,
|
351
|
+
crossOrigin: "trust"
|
352
|
+
});
|
353
|
+
assertInstanceOf(result2, Person);
|
354
|
+
assertEquals(result2.id, new URL("https://malicious.com/fake-actor"));
|
355
|
+
esm_default.removeRoutes();
|
356
|
+
esm_default.hardReset();
|
357
|
+
});
|
358
|
+
await t.step("subdomain same-origin check", async () => {
|
359
|
+
const subdomainDocumentLoader = async (url) => {
|
360
|
+
if (url === "https://api.example.com/note") return {
|
361
|
+
documentUrl: url,
|
362
|
+
contextUrl: null,
|
363
|
+
document: {
|
364
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
365
|
+
type: "Note",
|
366
|
+
id: "https://www.example.com/note",
|
367
|
+
content: "Cross-subdomain note"
|
368
|
+
}
|
369
|
+
};
|
370
|
+
throw new Error(`Unexpected URL: ${url}`);
|
371
|
+
};
|
372
|
+
const result = await lookupObject("https://api.example.com/note", {
|
373
|
+
documentLoader: subdomainDocumentLoader,
|
374
|
+
contextLoader: mockDocumentLoader
|
375
|
+
});
|
376
|
+
assertEquals(result, null);
|
377
|
+
});
|
378
|
+
await t.step("different port same-origin check", async () => {
|
379
|
+
const differentPortDocumentLoader = async (url) => {
|
380
|
+
if (url === "https://example.com:8080/note") return {
|
381
|
+
documentUrl: url,
|
382
|
+
contextUrl: null,
|
383
|
+
document: {
|
384
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
385
|
+
type: "Note",
|
386
|
+
id: "https://example.com:9090/note",
|
387
|
+
content: "Cross-port note"
|
388
|
+
}
|
389
|
+
};
|
390
|
+
throw new Error(`Unexpected URL: ${url}`);
|
391
|
+
};
|
392
|
+
const result = await lookupObject("https://example.com:8080/note", {
|
393
|
+
documentLoader: differentPortDocumentLoader,
|
394
|
+
contextLoader: mockDocumentLoader
|
395
|
+
});
|
396
|
+
assertEquals(result, null);
|
397
|
+
});
|
398
|
+
await t.step("protocol difference same-origin check", async () => {
|
399
|
+
const differentProtocolDocumentLoader = async (url) => {
|
400
|
+
if (url === "https://example.com/note") return {
|
401
|
+
documentUrl: url,
|
402
|
+
contextUrl: null,
|
403
|
+
document: {
|
404
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
405
|
+
type: "Note",
|
406
|
+
id: "http://example.com/note",
|
407
|
+
content: "Cross-protocol note"
|
408
|
+
}
|
409
|
+
};
|
410
|
+
throw new Error(`Unexpected URL: ${url}`);
|
411
|
+
};
|
412
|
+
const result = await lookupObject("https://example.com/note", {
|
413
|
+
documentLoader: differentProtocolDocumentLoader,
|
414
|
+
contextLoader: mockDocumentLoader
|
415
|
+
});
|
416
|
+
assertEquals(result, null);
|
417
|
+
});
|
418
|
+
await t.step("error handling with crossOrigin throw option", async () => {
|
419
|
+
const errorDocumentLoader = async (_url) => {
|
420
|
+
throw new Error("Network error");
|
421
|
+
};
|
422
|
+
const result = await lookupObject("https://example.com/note", {
|
423
|
+
documentLoader: errorDocumentLoader,
|
424
|
+
contextLoader: mockDocumentLoader,
|
425
|
+
crossOrigin: "throw"
|
426
|
+
});
|
427
|
+
assertEquals(result, null);
|
428
|
+
});
|
429
|
+
await t.step("malformed JSON handling with cross-origin policy", async () => {
|
430
|
+
const malformedJsonDocumentLoader = async (url) => {
|
431
|
+
if (url === "https://example.com/note") return {
|
432
|
+
documentUrl: url,
|
433
|
+
contextUrl: null,
|
434
|
+
document: "invalid json"
|
435
|
+
};
|
436
|
+
throw new Error(`Unexpected URL: ${url}`);
|
437
|
+
};
|
438
|
+
assertEquals(await lookupObject("https://example.com/note", {
|
439
|
+
documentLoader: malformedJsonDocumentLoader,
|
440
|
+
contextLoader: mockDocumentLoader,
|
441
|
+
crossOrigin: "ignore"
|
442
|
+
}), null);
|
443
|
+
assertEquals(await lookupObject("https://example.com/note", {
|
444
|
+
documentLoader: malformedJsonDocumentLoader,
|
445
|
+
contextLoader: mockDocumentLoader,
|
446
|
+
crossOrigin: "throw"
|
447
|
+
}), null);
|
448
|
+
assertEquals(await lookupObject("https://example.com/note", {
|
449
|
+
documentLoader: malformedJsonDocumentLoader,
|
450
|
+
contextLoader: mockDocumentLoader,
|
451
|
+
crossOrigin: "trust"
|
452
|
+
}), null);
|
453
|
+
});
|
454
|
+
});
|
205
455
|
|
206
456
|
//#endregion
|
@@ -0,0 +1,87 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('../docloader-7Ey7wNHx.cjs');
|
6
|
+
const require_actor = require('../actor-CrTGiTZd.cjs');
|
7
|
+
require('../lookup-DiV4LFBg.cjs');
|
8
|
+
const require_vocab = require('../vocab-C5Y-0fGj.cjs');
|
9
|
+
|
10
|
+
exports.Accept = require_actor.Accept;
|
11
|
+
exports.Activity = require_actor.Activity;
|
12
|
+
exports.Add = require_actor.Add;
|
13
|
+
exports.Announce = require_actor.Announce;
|
14
|
+
exports.Application = require_actor.Application;
|
15
|
+
exports.Arrive = require_actor.Arrive;
|
16
|
+
exports.Article = require_actor.Article;
|
17
|
+
exports.Audio = require_actor.Audio;
|
18
|
+
exports.Block = require_actor.Block;
|
19
|
+
exports.ChatMessage = require_actor.ChatMessage;
|
20
|
+
exports.Collection = require_actor.Collection;
|
21
|
+
exports.CollectionPage = require_actor.CollectionPage;
|
22
|
+
exports.Create = require_actor.Create;
|
23
|
+
exports.CryptographicKey = require_actor.CryptographicKey;
|
24
|
+
exports.DataIntegrityProof = require_actor.DataIntegrityProof;
|
25
|
+
exports.Delete = require_actor.Delete;
|
26
|
+
exports.DidService = require_actor.DidService;
|
27
|
+
exports.Dislike = require_actor.Dislike;
|
28
|
+
exports.Document = require_actor.Document;
|
29
|
+
exports.Emoji = require_actor.Emoji;
|
30
|
+
exports.EmojiReact = require_actor.EmojiReact;
|
31
|
+
exports.Endpoints = require_actor.Endpoints;
|
32
|
+
exports.Event = require_actor.Event;
|
33
|
+
exports.Export = require_actor.Export;
|
34
|
+
exports.Flag = require_actor.Flag;
|
35
|
+
exports.Follow = require_actor.Follow;
|
36
|
+
exports.Group = require_actor.Group;
|
37
|
+
exports.Hashtag = require_actor.Hashtag;
|
38
|
+
exports.Ignore = require_actor.Ignore;
|
39
|
+
exports.Image = require_actor.Image;
|
40
|
+
exports.IntransitiveActivity = require_actor.IntransitiveActivity;
|
41
|
+
exports.Invite = require_actor.Invite;
|
42
|
+
exports.Join = require_actor.Join;
|
43
|
+
exports.Leave = require_actor.Leave;
|
44
|
+
exports.Like = require_actor.Like;
|
45
|
+
exports.Link = require_actor.Link;
|
46
|
+
exports.Listen = require_actor.Listen;
|
47
|
+
exports.Mention = require_actor.Mention;
|
48
|
+
exports.Move = require_actor.Move;
|
49
|
+
exports.Multikey = require_actor.Multikey;
|
50
|
+
exports.Note = require_actor.Note;
|
51
|
+
exports.Object = require_actor.Object$1;
|
52
|
+
exports.Offer = require_actor.Offer;
|
53
|
+
exports.OrderedCollection = require_actor.OrderedCollection;
|
54
|
+
exports.OrderedCollectionPage = require_actor.OrderedCollectionPage;
|
55
|
+
exports.Organization = require_actor.Organization;
|
56
|
+
exports.PUBLIC_COLLECTION = require_vocab.PUBLIC_COLLECTION;
|
57
|
+
exports.Page = require_actor.Page;
|
58
|
+
exports.Person = require_actor.Person;
|
59
|
+
exports.Place = require_actor.Place;
|
60
|
+
exports.Profile = require_actor.Profile;
|
61
|
+
exports.PropertyValue = require_actor.PropertyValue;
|
62
|
+
exports.Question = require_actor.Question;
|
63
|
+
exports.Read = require_actor.Read;
|
64
|
+
exports.Reject = require_actor.Reject;
|
65
|
+
exports.Relationship = require_actor.Relationship;
|
66
|
+
exports.Remove = require_actor.Remove;
|
67
|
+
exports.Service = require_actor.Service;
|
68
|
+
exports.Source = require_actor.Source;
|
69
|
+
exports.TentativeAccept = require_actor.TentativeAccept;
|
70
|
+
exports.TentativeReject = require_actor.TentativeReject;
|
71
|
+
exports.Tombstone = require_actor.Tombstone;
|
72
|
+
exports.Travel = require_actor.Travel;
|
73
|
+
exports.Undo = require_actor.Undo;
|
74
|
+
exports.Update = require_actor.Update;
|
75
|
+
exports.Video = require_actor.Video;
|
76
|
+
exports.View = require_actor.View;
|
77
|
+
exports.getActorClassByTypeName = require_actor.getActorClassByTypeName;
|
78
|
+
exports.getActorHandle = require_actor.getActorHandle;
|
79
|
+
exports.getActorTypeName = require_actor.getActorTypeName;
|
80
|
+
exports.getTypeId = require_actor.getTypeId;
|
81
|
+
exports.isActor = require_actor.isActor;
|
82
|
+
exports.isFediverseHandle = require_vocab.isFediverseHandle;
|
83
|
+
exports.lookupObject = require_vocab.lookupObject;
|
84
|
+
exports.normalizeActorHandle = require_actor.normalizeActorHandle;
|
85
|
+
exports.parseFediverseHandle = require_vocab.parseFediverseHandle;
|
86
|
+
exports.toAcctUrl = require_vocab.toAcctUrl;
|
87
|
+
exports.traverseCollection = require_vocab.traverseCollection;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import "../kv-63Cil1MD.cjs";
|
2
|
+
import "../docloader-D-MrRyHl.cjs";
|
3
|
+
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-Dw1-yVGg.cjs";
|
4
|
+
import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-D6K058Tb.cjs";
|
5
|
+
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-CxkWO3Mg.cjs";
|
6
|
+
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
@@ -2,7 +2,7 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
3
|
import "../kv-C7sopW2E.js";
|
4
4
|
import "../docloader-CxWcuWqQ.js";
|
5
|
-
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-
|
6
|
-
import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-
|
7
|
-
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-
|
5
|
+
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-BI0Ak5lL.js";
|
6
|
+
import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-T6RyhRgk.js";
|
7
|
+
import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-DlU8ISoa.js";
|
8
8
|
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
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
import "../docloader-
|
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-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "../docloader-CkweNhUH.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-G2S5sPEA.js";
|
7
|
+
import "../lookup-cVRa2QM-.js";
|
8
|
+
import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../vocab-rWbHpc2J.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,10 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Person, getTypeId } from "../type-
|
6
|
+
import { Person, getTypeId } from "../type-NEA09tSC.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
|
-
import "../lookup-
|
9
|
-
import { test } from "../testing-
|
8
|
+
import "../lookup-DhQCVVja.js";
|
9
|
+
import { test } from "../testing-BnfPB5T-.js";
|
10
10
|
|
11
11
|
//#region src/vocab/type.test.ts
|
12
12
|
test("getTypeId()", () => {
|