@fedify/fedify 1.9.0-dev.1613 → 1.9.0-dev.1689

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/{actor-Ch5yFYFG.d.ts → actor-C1Euqngb.d.ts} +1 -1
  2. package/dist/{actor-BkOvltE1.cjs → actor-CK94m0Yv.cjs} +7263 -2440
  3. package/dist/{actor-BrhPUG_N.js → actor-Dpkqj5Dv.js} +7263 -2440
  4. package/dist/{actor-Do9KG1O2.js → actor-DzdLVqkJ.js} +1 -1
  5. package/dist/{actor-CHOM_AN3.d.cts → actor-Ydzhc8dj.d.cts} +1 -1
  6. package/dist/{authdocloader-lcfCE1vG.cjs → authdocloader-4iBGWlQw.cjs} +3 -3
  7. package/dist/{authdocloader-CF0X5NR7.js → authdocloader-BVvTFQbi.js} +3 -3
  8. package/dist/{authdocloader-D_pDyzSu.js → authdocloader-DdSBpn11.js} +3 -3
  9. package/dist/{builder-CwFGbC7w.js → builder-BR--hcb8.js} +10 -4
  10. package/dist/{client-CkjMau5E.js → client-BoUqciR8.js} +1 -1
  11. package/dist/compat/mod.d.cts +7 -7
  12. package/dist/compat/mod.d.ts +7 -7
  13. package/dist/compat/transformers.test.js +16 -16
  14. package/dist/{context-DFruNLny.d.ts → context-CZorAkt8.d.ts} +66 -6
  15. package/dist/{context-KXVF2AhH.d.cts → context-DCh96LcF.d.cts} +66 -6
  16. package/dist/{docloader-CCo7N8E2.cjs → docloader-Bui9z8Lb.cjs} +1 -1
  17. package/dist/{docloader-CB-b64F8.js → docloader-DyvW1gbN.js} +1 -1
  18. package/dist/{esm-BeBLf_np.js → esm-DMb2eQXG.js} +1 -1
  19. package/dist/federation/builder.test.js +5 -5
  20. package/dist/federation/collection.test.js +3 -3
  21. package/dist/federation/handler.test.js +17 -17
  22. package/dist/federation/idempotency.test.d.ts +3 -0
  23. package/dist/federation/idempotency.test.js +202 -0
  24. package/dist/federation/inbox.test.js +4 -4
  25. package/dist/federation/keycache.test.js +4 -4
  26. package/dist/federation/kv.test.js +4 -3
  27. package/dist/federation/middleware.test.js +18 -18
  28. package/dist/federation/mod.cjs +10 -10
  29. package/dist/federation/mod.d.cts +7 -7
  30. package/dist/federation/mod.d.ts +7 -7
  31. package/dist/federation/mod.js +10 -10
  32. package/dist/federation/mq.test.js +3 -3
  33. package/dist/federation/retry.test.js +3 -3
  34. package/dist/federation/router.test.js +3 -3
  35. package/dist/federation/send.test.js +10 -10
  36. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
  37. package/dist/{http-B_zBcsai.d.cts → http-B1_DzfAU.d.cts} +1 -1
  38. package/dist/{http-DpcYXIiB.cjs → http-BAaVL480.cjs} +3 -3
  39. package/dist/{http-zgzZkO8A.js → http-C7nvEG1N.js} +2 -2
  40. package/dist/{http-D8Q4xH0d.d.ts → http-wsGR6KkT.d.ts} +1 -1
  41. package/dist/{http-CmDy8xoP.js → http-xsj5Fzwl.js} +3 -3
  42. package/dist/{inbox-CirfyLns.js → inbox-DZNE3Jtq.js} +29 -7
  43. package/dist/{key-CN1jS3_Y.js → key-C25gGlmV.js} +2 -2
  44. package/dist/key-CHU24Npw.cjs +10 -0
  45. package/dist/{key-Dq2ZV4ZW.js → key-CbnQpdZy.js} +2 -2
  46. package/dist/{key-BytDOwJJ.js → key-DOPWTj2e.js} +4 -4
  47. package/dist/{key-DgFXwwZv.js → key-DgZIZVqA.js} +3 -3
  48. package/dist/{key-4EZXrjJw.cjs → key-DqqCoLbc.cjs} +2 -2
  49. package/dist/{keycache-COrk8-eB.js → keycache-CoMI1L_W.js} +1 -1
  50. package/dist/{keys-BieqxHLC.js → keys-CMahfArj.js} +1 -1
  51. package/dist/{ld-o8aGatC0.js → ld-WZpO-MzE.js} +2 -2
  52. package/dist/{lookup-CwHCSBI8.cjs → lookup-D_w567L8.cjs} +1 -1
  53. package/dist/{lookup-DADsKd8V.js → lookup-WoJkw8wY.js} +1 -1
  54. package/dist/{lookup-BkaLctZw.js → lookup-y6-PEpxS.js} +21 -12
  55. package/dist/middleware-BYEKw_OJ.js +17 -0
  56. package/dist/{middleware-BcqldfgB.cjs → middleware-CWlrInU2.cjs} +66 -34
  57. package/dist/{middleware-CuCsnDA9.js → middleware-Cj9WC_iX.js} +66 -34
  58. package/dist/{middleware-B1iLu-jg.js → middleware-CjgR6ayA.js} +35 -31
  59. package/dist/middleware-DbxA0Z6o.js +26 -0
  60. package/dist/middleware-hTlyJu9R.cjs +17 -0
  61. package/dist/{mod-NKH_G-IY.d.cts → mod-BUbqxBev.d.cts} +19 -1
  62. package/dist/{mod-YfAcrVbP.d.cts → mod-BojaEE1l.d.cts} +2 -2
  63. package/dist/{mod-Cy6pkZSn.d.ts → mod-CDObsV1d.d.ts} +19 -1
  64. package/dist/{mod-BAuhKa9d.d.ts → mod-CIbqfZW0.d.ts} +1 -1
  65. package/dist/{mod-B7Pc0I7F.d.ts → mod-DgcYoyZK.d.ts} +2 -2
  66. package/dist/{mod-C3CGxYoF.d.cts → mod-Dt-G9ZOS.d.cts} +1 -1
  67. package/dist/{mod-COw_caPC.d.cts → mod-fjqfsrty.d.cts} +2 -2
  68. package/dist/{mod-CiXjux2r.d.ts → mod-tWXEItkO.d.ts} +2 -2
  69. package/dist/mod.cjs +10 -10
  70. package/dist/mod.d.cts +10 -10
  71. package/dist/mod.d.ts +10 -10
  72. package/dist/mod.js +10 -10
  73. package/dist/nodeinfo/client.test.js +5 -5
  74. package/dist/nodeinfo/handler.test.js +16 -16
  75. package/dist/nodeinfo/mod.cjs +2 -2
  76. package/dist/nodeinfo/mod.js +2 -2
  77. package/dist/nodeinfo/semver.test.js +3 -3
  78. package/dist/nodeinfo/types.test.js +3 -3
  79. package/dist/{owner-C9Ry0TOI.d.cts → owner-6KSEp9eV.d.cts} +2 -2
  80. package/dist/{owner-D38zBIMc.d.ts → owner-BbeUDvOu.d.ts} +2 -2
  81. package/dist/{owner-qeK3HiL9.js → owner-CPBOVM7l.js} +2 -2
  82. package/dist/{proof-DasSZLsd.cjs → proof-BLoRsaYR.cjs} +3 -3
  83. package/dist/{proof-BSqN3lwx.js → proof-CpmDDzvf.js} +3 -3
  84. package/dist/{proof-0MIJ70kC.js → proof-h0JvKPRP.js} +2 -2
  85. package/dist/runtime/authdocloader.test.js +9 -9
  86. package/dist/runtime/docloader.test.js +4 -4
  87. package/dist/runtime/key.test.js +5 -5
  88. package/dist/runtime/langstr.test.js +3 -3
  89. package/dist/runtime/link.test.js +3 -3
  90. package/dist/runtime/mod.cjs +6 -6
  91. package/dist/runtime/mod.d.cts +3 -3
  92. package/dist/runtime/mod.d.ts +3 -3
  93. package/dist/runtime/mod.js +6 -6
  94. package/dist/runtime/multibase/multibase.test.js +3 -3
  95. package/dist/runtime/url.test.js +3 -3
  96. package/dist/{send-CuL-kYv7.js → send-CD-m2vwX.js} +2 -2
  97. package/dist/sig/http.test.js +8 -8
  98. package/dist/sig/key.test.js +6 -6
  99. package/dist/sig/ld.test.js +7 -7
  100. package/dist/sig/mod.cjs +6 -6
  101. package/dist/sig/mod.d.cts +5 -5
  102. package/dist/sig/mod.d.ts +5 -5
  103. package/dist/sig/mod.js +6 -6
  104. package/dist/sig/owner.test.js +7 -7
  105. package/dist/sig/proof.test.js +7 -7
  106. package/dist/testing/docloader.test.js +3 -3
  107. package/dist/testing/mod.d.ts +272 -0
  108. package/dist/testing/mod.js +3 -3
  109. package/dist/{testing-Did3bCyV.js → testing-DvTABhvG.js} +2 -2
  110. package/dist/{type-Bm9mdHQS.js → type-BCazg_Pu.js} +6943 -2120
  111. package/dist/{types-B9ZmKzEm.js → types-BsM0mf3R.js} +1 -1
  112. package/dist/{types-DF88bXyE.cjs → types-F8JMlP-f.cjs} +1 -1
  113. package/dist/vocab/actor.test.js +5 -5
  114. package/dist/vocab/lookup.test.js +255 -5
  115. package/dist/vocab/mod.cjs +4 -4
  116. package/dist/vocab/mod.d.cts +3 -3
  117. package/dist/vocab/mod.d.ts +3 -3
  118. package/dist/vocab/mod.js +4 -4
  119. package/dist/vocab/type.test.js +3 -3
  120. package/dist/vocab/vocab.test.js +433 -9
  121. package/dist/{vocab-DFyEBhSA.cjs → vocab-C-qxDq1m.cjs} +23 -14
  122. package/dist/{vocab-BEEm2I6u.d.ts → vocab-CDHNj5zp.d.ts} +290 -0
  123. package/dist/{vocab-BzGg7ltX.d.cts → vocab-Cfs0937i.d.cts} +290 -0
  124. package/dist/{vocab-BVOFD7iz.js → vocab-DdTdRfBW.js} +23 -14
  125. package/dist/webfinger/handler.test.js +16 -16
  126. package/dist/webfinger/lookup.test.js +4 -4
  127. package/dist/webfinger/mod.cjs +2 -2
  128. package/dist/webfinger/mod.js +2 -2
  129. package/dist/x/cfworkers.test.js +3 -3
  130. package/dist/x/hono.d.cts +6 -6
  131. package/dist/x/hono.d.ts +6 -6
  132. package/dist/x/sveltekit.d.cts +6 -6
  133. package/dist/x/sveltekit.d.ts +6 -6
  134. package/package.json +1 -1
  135. package/dist/key-BSapRu6X.cjs +0 -10
  136. package/dist/middleware-3K0jP9Du.js +0 -26
  137. package/dist/middleware-CZyWbiwd.js +0 -17
  138. package/dist/middleware-T8MY-txY.cjs +0 -17
@@ -2,7 +2,7 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { getUserAgent } from "./docloader-CB-b64F8.js";
5
+ import { getUserAgent } from "./docloader-DyvW1gbN.js";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
 
8
8
  //#region src/nodeinfo/semver.ts
@@ -3,7 +3,7 @@
3
3
  const { URLPattern } = require("urlpattern-polyfill");
4
4
 
5
5
  const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
- const require_docloader = require('./docloader-CCo7N8E2.cjs');
6
+ const require_docloader = require('./docloader-Bui9z8Lb.cjs');
7
7
  const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
8
8
 
9
9
  //#region src/nodeinfo/semver.ts
@@ -3,19 +3,19 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Application, Group, Organization, Person, Service, __export } from "../type-Bm9mdHQS.js";
6
+ import { Application, Group, Organization, Person, Service, __export } from "../type-BCazg_Pu.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 "../lookup-BkaLctZw.js";
11
- import { getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-Do9KG1O2.js";
12
- import { test } from "../testing-Did3bCyV.js";
10
+ import "../lookup-y6-PEpxS.js";
11
+ import { getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-DzdLVqkJ.js";
12
+ import { test } from "../testing-DvTABhvG.js";
13
13
  import { assertStrictEquals } from "../std__assert-X-_kMxKM.js";
14
14
  import { assertFalse, assertRejects } from "../assert_rejects-DiIiJbZn.js";
15
15
  import "../assert_is_error-BPGph1Jx.js";
16
16
  import "../assert_not_equals-f3m3epl3.js";
17
17
  import { assertThrows } from "../assert_throws-BOO88avQ.js";
18
- import { esm_default } from "../esm-BeBLf_np.js";
18
+ import { esm_default } from "../esm-DMb2eQXG.js";
19
19
 
20
20
  //#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
21
21
  var PreconditionFailure = class PreconditionFailure extends Error {
@@ -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-Bm9mdHQS.js";
6
+ import { Collection, Note, Object as Object$1, Person } from "../type-BCazg_Pu.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-BkaLctZw.js";
11
- import { mockDocumentLoader, test } from "../testing-Did3bCyV.js";
10
+ import { lookupObject, traverseCollection } from "../lookup-y6-PEpxS.js";
11
+ import { mockDocumentLoader, test } from "../testing-DvTABhvG.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-BeBLf_np.js";
17
+ import { esm_default } from "../esm-DMb2eQXG.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
@@ -2,10 +2,10 @@
2
2
  const { Temporal } = require("@js-temporal/polyfill");
3
3
  const { URLPattern } = require("urlpattern-polyfill");
4
4
 
5
- require('../docloader-CCo7N8E2.cjs');
6
- const require_actor = require('../actor-BkOvltE1.cjs');
7
- require('../lookup-CwHCSBI8.cjs');
8
- const require_vocab = require('../vocab-DFyEBhSA.cjs');
5
+ require('../docloader-Bui9z8Lb.cjs');
6
+ const require_actor = require('../actor-CK94m0Yv.cjs');
7
+ require('../lookup-D_w567L8.cjs');
8
+ const require_vocab = require('../vocab-C-qxDq1m.cjs');
9
9
 
10
10
  exports.Accept = require_actor.Accept;
11
11
  exports.Activity = require_actor.Activity;
@@ -1,6 +1,6 @@
1
1
  import "../kv-63Cil1MD.cjs";
2
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-BzGg7ltX.cjs";
4
- import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-CHOM_AN3.cjs";
5
- import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-NKH_G-IY.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-Cfs0937i.cjs";
4
+ import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-Ydzhc8dj.cjs";
5
+ import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-BUbqxBev.cjs";
6
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 };
@@ -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-BEEm2I6u.js";
6
- import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-Ch5yFYFG.js";
7
- import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-Cy6pkZSn.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-CDHNj5zp.js";
6
+ import { Actor, ActorTypeName, GetActorHandleOptions, NormalizeActorHandleOptions, Recipient, getActorClassByTypeName, getActorHandle, getActorTypeName, isActor, normalizeActorHandle } from "../actor-C1Euqngb.js";
7
+ import { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../mod-CDObsV1d.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
@@ -2,9 +2,9 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import "../docloader-CB-b64F8.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-BrhPUG_N.js";
7
- import "../lookup-DADsKd8V.js";
8
- import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../vocab-BVOFD7iz.js";
5
+ import "../docloader-DyvW1gbN.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-Dpkqj5Dv.js";
7
+ import "../lookup-WoJkw8wY.js";
8
+ import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "../vocab-DdTdRfBW.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 };
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Person, getTypeId } from "../type-Bm9mdHQS.js";
6
+ import { Person, getTypeId } from "../type-BCazg_Pu.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
- import "../lookup-BkaLctZw.js";
9
- import { test } from "../testing-Did3bCyV.js";
8
+ import "../lookup-y6-PEpxS.js";
9
+ import { test } from "../testing-DvTABhvG.js";
10
10
 
11
11
  //#region src/vocab/type.test.ts
12
12
  test("getTypeId()", () => {