@fedify/fedify 1.7.10 → 1.7.12

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 (98) hide show
  1. package/dist/{actor-m_MgQ1Da.js → actor-GZRoTRqg.js} +1059 -2276
  2. package/dist/{actor-C9RnX-Fl.js → actor-TYqJGdVq.js} +6 -9
  3. package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
  4. package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
  5. package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
  6. package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
  7. package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
  8. package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
  9. package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
  10. package/dist/{authdocloader-cdK4XSRT.js → authdocloader-BopfyipD.js} +3 -3
  11. package/dist/{authdocloader-7OXAs5XI.js → authdocloader-hiFSyM7V.js} +4 -4
  12. package/dist/{builder-C7nJE1zO.js → builder-mi6RdzNE.js} +7 -10
  13. package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
  14. package/dist/{client-DXIsEekV.js → client-DuUKk4pk.js} +6 -6
  15. package/dist/compat/transformers.test.js +27 -28
  16. package/dist/{context-Bts52fbz.js → context-RMU32mk4.js} +2 -2
  17. package/dist/{docloader-BK2Fp3AJ.js → docloader-DJxET2fN.js} +5 -9
  18. package/dist/{docloader-CgkbWVNz.js → docloader-bgBm1Hd1.js} +4 -6
  19. package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
  20. package/dist/federation/builder.test.js +23 -29
  21. package/dist/federation/collection.test.js +9 -9
  22. package/dist/federation/handler.test.js +33 -33
  23. package/dist/federation/inbox.test.js +10 -10
  24. package/dist/federation/keycache.test.js +9 -9
  25. package/dist/federation/kv.test.js +10 -9
  26. package/dist/federation/middleware.test.js +76 -99
  27. package/dist/federation/mod.js +11 -11
  28. package/dist/federation/mq.test.js +10 -11
  29. package/dist/federation/retry.test.js +3 -3
  30. package/dist/federation/router.test.js +9 -9
  31. package/dist/federation/send.test.js +22 -22
  32. package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
  33. package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +24 -0
  34. package/dist/{http-D1IBucdD.js → http-D2DkwsjA.js} +56 -17
  35. package/dist/{http-CwQqD0nE.js → http-vqMAvOVs.js} +56 -17
  36. package/dist/{inbox-BrMkm2b5.js → inbox-DAAZZl2k.js} +5 -7
  37. package/dist/key-5ssHQ67E.js +16 -0
  38. package/dist/{key-Do-Pud3s.js → key-DSJGnD10.js} +4 -4
  39. package/dist/{key-C6phFgFq.js → key-DmqJj57e.js} +5 -8
  40. package/dist/{key-DtQ4rLnr.js → key-KVhaUM92.js} +6 -9
  41. package/dist/{keycache-B_99o7Nj.js → keycache-C1pEuRyQ.js} +2 -2
  42. package/dist/{keys-BgLpfFXK.js → keys-C4XQHW5_.js} +1 -1
  43. package/dist/{ld-AzOj4-js.js → ld-DzlJ_IpT.js} +9 -16
  44. package/dist/{lookup-DJgGrigh.js → lookup-CSngxuWm.js} +2 -4
  45. package/dist/{lookup-CBbanOdu.js → lookup-D0je8AqR.js} +7 -11
  46. package/dist/{lookup-ChtUDlB-.js → lookup-DL62q3Xh.js} +3 -5
  47. package/dist/{middleware-BS_et69x.js → middleware-3wVT6S9E.js} +34 -52
  48. package/dist/middleware-CxFoFBD8.js +33 -0
  49. package/dist/{middleware-R0UobiAQ.js → middleware-DlDXugwZ.js} +34 -58
  50. package/dist/middleware-w7_U3fFi.js +17 -0
  51. package/dist/mod.js +11 -11
  52. package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
  53. package/dist/nodeinfo/client.test.js +20 -23
  54. package/dist/nodeinfo/handler.test.js +32 -32
  55. package/dist/nodeinfo/mod.js +2 -2
  56. package/dist/nodeinfo/semver.test.js +23 -30
  57. package/dist/nodeinfo/types.test.js +11 -11
  58. package/dist/{owner-Ces3Cs3s.js → owner-81ey_76X.js} +3 -3
  59. package/dist/{proof-BOQF8Trx.js → proof-BlULDH4H.js} +8 -14
  60. package/dist/{proof-BKV4HiE8.js → proof-DlI7QNdn.js} +12 -25
  61. package/dist/runtime/authdocloader.test.js +21 -21
  62. package/dist/runtime/docloader.test.js +16 -18
  63. package/dist/runtime/key.test.js +17 -17
  64. package/dist/runtime/langstr.test.js +9 -9
  65. package/dist/runtime/mod.js +6 -6
  66. package/dist/runtime/multibase/multibase.test.js +11 -12
  67. package/dist/runtime/url.test.js +6 -6
  68. package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
  69. package/dist/{send-aAmnTqe8.js → send-DdxfTHo6.js} +3 -4
  70. package/dist/sig/http.test.js +56 -54
  71. package/dist/sig/key.test.js +18 -18
  72. package/dist/sig/ld.test.js +20 -22
  73. package/dist/sig/mod.js +6 -6
  74. package/dist/sig/owner.test.js +20 -20
  75. package/dist/sig/proof.test.js +19 -19
  76. package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
  77. package/dist/testing/docloader.test.js +9 -9
  78. package/dist/testing/mod.js +1 -1
  79. package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
  80. package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
  81. package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
  82. package/dist/{types-DBIKpLqH.js → types-CmVV9LT1.js} +6 -8
  83. package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
  84. package/dist/vocab/actor.test.js +104 -156
  85. package/dist/vocab/lookup.test.js +17 -17
  86. package/dist/vocab/mod.js +4 -4
  87. package/dist/vocab/type.test.js +11 -15
  88. package/dist/vocab/vocab.test.js +45 -49
  89. package/dist/{vocab-F6vbRsQh.js → vocab-BebR0kAy.js} +6 -10
  90. package/dist/{vocab-BOerhowX.js → vocab-DFlq4Wa6.js} +1057 -2270
  91. package/dist/webfinger/handler.test.js +33 -34
  92. package/dist/webfinger/lookup.test.js +13 -13
  93. package/dist/webfinger/mod.js +2 -2
  94. package/dist/x/cfworkers.test.js +9 -9
  95. package/package.json +1 -1
  96. package/dist/key-ZtjFeVO8.js +0 -16
  97. package/dist/middleware-BVMzYv1x.js +0 -33
  98. package/dist/middleware-CnpuCK_K.js +0 -17
@@ -3,25 +3,25 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import { assertInstanceOf } from "../assert_instance_of-CF09JHYM.js";
9
- import "../docloader-CgkbWVNz.js";
10
- import "../url-kTAI6_KP.js";
11
- import "../multibase-DeCHcK8L.js";
12
- import { Collection, Note, Object as Object$1, Person } from "../vocab-BOerhowX.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import { assertInstanceOf } from "../assert_instance_of-XtuFevV_.js";
9
+ import "../docloader-bgBm1Hd1.js";
10
+ import "../url-C2xuoQD1.js";
11
+ import "../multibase-CnLHszip.js";
12
+ import { Collection, Note, Object as Object$1, Person } from "../vocab-DFlq4Wa6.js";
13
13
  import "../langstr-DbWheeIS.js";
14
- import "../lookup-ChtUDlB-.js";
15
- import "../type-D2s5lmbZ.js";
16
- import { lookupObject, traverseCollection } from "../lookup-CBbanOdu.js";
17
- import { test } from "../testing-BZ0dJ4qn.js";
18
- import "../std__assert-vp0TKMS1.js";
19
- import "../assert_rejects-C-sxEMM5.js";
20
- import "../assert_is_error-nrwA1GeT.js";
21
- import "../assert_not_equals-Dc7y-V5Q.js";
22
- import "../assert_throws-Cn9C6Jur.js";
14
+ import "../lookup-DL62q3Xh.js";
15
+ import "../type-CFuiGLz9.js";
16
+ import { lookupObject, traverseCollection } from "../lookup-D0je8AqR.js";
17
+ import { test } from "../testing-DLyvtiiW.js";
18
+ import "../std__assert-o_r9vqm1.js";
19
+ import "../assert_rejects-DWQ4jaf9.js";
20
+ import "../assert_is_error-BTlryvT0.js";
21
+ import "../assert_not_equals-C685gKx6.js";
22
+ import "../assert_throws-YetpVSc-.js";
23
23
  import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
24
- import { esm_default } from "../esm-Db4De7AS.js";
24
+ import { esm_default } from "../esm-DO9PrujO.js";
25
25
 
26
26
  //#region vocab/lookup.test.ts
27
27
  test("lookupObject()", async (t) => {
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-BK2Fp3AJ.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-m_MgQ1Da.js";
7
- import "../lookup-DJgGrigh.js";
8
- import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "../vocab-F6vbRsQh.js";
5
+ import "../docloader-DJxET2fN.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-GZRoTRqg.js";
7
+ import "../lookup-CSngxuWm.js";
8
+ import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "../vocab-BebR0kAy.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, lookupObject, normalizeActorHandle, traverseCollection };
@@ -3,27 +3,23 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../docloader-CgkbWVNz.js";
8
- import "../url-kTAI6_KP.js";
9
- import "../multibase-DeCHcK8L.js";
10
- import { Person } from "../vocab-BOerhowX.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../docloader-bgBm1Hd1.js";
8
+ import "../url-C2xuoQD1.js";
9
+ import "../multibase-CnLHszip.js";
10
+ import { Person } from "../vocab-DFlq4Wa6.js";
11
11
  import "../langstr-DbWheeIS.js";
12
- import { getTypeId } from "../type-D2s5lmbZ.js";
13
- import { test } from "../testing-BZ0dJ4qn.js";
12
+ import { getTypeId } from "../type-CFuiGLz9.js";
13
+ import { test } from "../testing-DLyvtiiW.js";
14
14
 
15
15
  //#region vocab/type.test.ts
16
16
  test("getTypeId()", () => {
17
17
  const obj = new Person({});
18
18
  assertEquals(getTypeId(obj), new URL("https://www.w3.org/ns/activitystreams#Person"));
19
- const obj2 = null;
20
- assertEquals(getTypeId(obj2), null);
21
- const obj3 = void 0;
22
- assertEquals(getTypeId(obj3), void 0);
23
- const obj4 = null;
24
- assertEquals(getTypeId(obj4), null);
25
- const obj5 = void 0;
26
- assertEquals(getTypeId(obj5), void 0);
19
+ assertEquals(getTypeId(null), null);
20
+ assertEquals(getTypeId(void 0), void 0);
21
+ assertEquals(getTypeId(null), null);
22
+ assertEquals(getTypeId(void 0), void 0);
27
23
  });
28
24
 
29
25
  //#endregion
@@ -3,22 +3,22 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals, isWindows } from "../assert_equals-CTYbeopb.js";
7
- import { assert } from "../assert-DmFG7ppO.js";
8
- import { assertInstanceOf } from "../assert_instance_of-CF09JHYM.js";
9
- import "../docloader-CgkbWVNz.js";
10
- import "../url-kTAI6_KP.js";
11
- import { decode } from "../multibase-DeCHcK8L.js";
12
- import { Activity, Announce, Create, CryptographicKey, Follow, Hashtag, Note, Object as Object$1, OrderedCollectionPage, Person, Place, Question, Source, vocab_exports } from "../vocab-BOerhowX.js";
6
+ import { assertEquals, isWindows } from "../assert_equals-B44MxcIj.js";
7
+ import { assert } from "../assert-LOEeCUK5.js";
8
+ import { assertInstanceOf } from "../assert_instance_of-XtuFevV_.js";
9
+ import "../docloader-bgBm1Hd1.js";
10
+ import "../url-C2xuoQD1.js";
11
+ import { decode } from "../multibase-CnLHszip.js";
12
+ import { Activity, Announce, Create, CryptographicKey, Follow, Hashtag, Link, Note, Object as Object$1, OrderedCollectionPage, Person, Place, Question, Source, vocab_exports } from "../vocab-DFlq4Wa6.js";
13
13
  import { LanguageString } from "../langstr-DbWheeIS.js";
14
- import { test } from "../testing-BZ0dJ4qn.js";
15
- import "../std__assert-vp0TKMS1.js";
16
- import { assertFalse, assertRejects } from "../assert_rejects-C-sxEMM5.js";
17
- import "../assert_is_error-nrwA1GeT.js";
18
- import { assertNotEquals } from "../assert_not_equals-Dc7y-V5Q.js";
19
- import { assertThrows } from "../assert_throws-Cn9C6Jur.js";
14
+ import { test } from "../testing-DLyvtiiW.js";
15
+ import "../std__assert-o_r9vqm1.js";
16
+ import { assertFalse, assertRejects } from "../assert_rejects-DWQ4jaf9.js";
17
+ import "../assert_is_error-BTlryvT0.js";
18
+ import { assertNotEquals } from "../assert_not_equals-C685gKx6.js";
19
+ import { assertThrows } from "../assert_throws-YetpVSc-.js";
20
20
  import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
21
- import { ed25519PublicKey, rsaPublicKey1 } from "../keys-BgLpfFXK.js";
21
+ import { ed25519PublicKey, rsaPublicKey1 } from "../keys-C4XQHW5_.js";
22
22
  import { pascalCase } from "@es-toolkit/es-toolkit";
23
23
  import { parseLanguageTag } from "@phensley/language-tag";
24
24
  import { Validator } from "@cfworker/json-schema";
@@ -548,16 +548,13 @@ const bool = {
548
548
  resolve: (data) => YAML_BOOLEANS.includes(data),
549
549
  represent: {
550
550
  lowercase: (object) => {
551
- const value = object instanceof Boolean ? object.valueOf() : object;
552
- return value ? "true" : "false";
551
+ return (object instanceof Boolean ? object.valueOf() : object) ? "true" : "false";
553
552
  },
554
553
  uppercase: (object) => {
555
- const value = object instanceof Boolean ? object.valueOf() : object;
556
- return value ? "TRUE" : "FALSE";
554
+ return (object instanceof Boolean ? object.valueOf() : object) ? "TRUE" : "FALSE";
557
555
  },
558
556
  camelcase: (object) => {
559
- const value = object instanceof Boolean ? object.valueOf() : object;
560
- return value ? "True" : "False";
557
+ return (object instanceof Boolean ? object.valueOf() : object) ? "True" : "False";
561
558
  }
562
559
  }
563
560
  };
@@ -725,8 +722,7 @@ const int = {
725
722
  return value >= 0 ? `0${value.toString(8)}` : `-0${value.toString(8).slice(1)}`;
726
723
  },
727
724
  decimal(object) {
728
- const value = object instanceof Number ? object.valueOf() : object;
729
- return value.toString(10);
725
+ return (object instanceof Number ? object.valueOf() : object).toString(10);
730
726
  },
731
727
  hexadecimal(object) {
732
728
  const value = object instanceof Number ? object.valueOf() : object;
@@ -929,9 +925,7 @@ const undefinedType = {
929
925
  resolve() {
930
926
  return true;
931
927
  },
932
- construct() {
933
- return void 0;
934
- },
928
+ construct() {},
935
929
  predicate(object) {
936
930
  return typeof object === "undefined";
937
931
  },
@@ -951,8 +945,7 @@ function createTypeMap(implicitTypes, explicitTypes) {
951
945
  };
952
946
  const fallbackMap = result.fallback;
953
947
  for (const type of [...implicitTypes, ...explicitTypes]) {
954
- const map$1 = result[type.kind];
955
- map$1.set(type.tag, type);
948
+ result[type.kind].set(type.tag, type);
956
949
  fallbackMap.set(type.tag, type);
957
950
  }
958
951
  return result;
@@ -1835,8 +1828,7 @@ var LoaderState = class {
1835
1828
  } else allowBlockCollections = false;
1836
1829
  if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
1837
1830
  if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1838
- const cond = CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext;
1839
- const flowIndent = cond ? parentIndent : parentIndent + 1;
1831
+ const flowIndent = CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext ? parentIndent : parentIndent + 1;
1840
1832
  const blockIndent = this.position - this.lineStart;
1841
1833
  if (indentStatus === 1) if (allowBlockCollections && (this.readBlockSequence(blockIndent) || this.readBlockMapping(blockIndent, flowIndent)) || this.readFlowCollection(flowIndent)) hasContent = true;
1842
1834
  else {
@@ -1862,8 +1854,7 @@ var LoaderState = class {
1862
1854
  }
1863
1855
  }
1864
1856
  else if (this.typeMap[this.kind ?? "fallback"].has(this.tag)) {
1865
- const map$1 = this.typeMap[this.kind ?? "fallback"];
1866
- type = map$1.get(this.tag);
1857
+ type = this.typeMap[this.kind ?? "fallback"].get(this.tag);
1867
1858
  if (this.result !== null && type.kind !== this.kind) throw this.#createError(`Unacceptable node kind for !<${this.tag}> tag: it should be "${type.kind}", not "${this.kind}"`);
1868
1859
  if (!type.resolve(this.result)) throw this.#createError(`Cannot resolve a node with !<${this.tag}> explicit tag`);
1869
1860
  else {
@@ -1981,11 +1972,10 @@ function sanitizeInput(input) {
1981
1972
  * @returns Parsed document.
1982
1973
  */ function parse(content, options = {}) {
1983
1974
  content = sanitizeInput(content);
1984
- const state = new LoaderState(content, {
1975
+ const documentGenerator = new LoaderState(content, {
1985
1976
  ...options,
1986
1977
  schema: SCHEMA_MAP.get(options.schema)
1987
- });
1988
- const documentGenerator = state.readDocuments();
1978
+ }).readDocuments();
1989
1979
  const document = documentGenerator.next().value;
1990
1980
  if (!documentGenerator.next().done) throw new SyntaxError("Found more than 1 document in the stream: expected a single document");
1991
1981
  return document ?? null;
@@ -2030,10 +2020,8 @@ async function loadSchemaValidator() {
2030
2020
  const thisFile = new URL(import.meta.url);
2031
2021
  const schemaFile = join$2(dirname$1(thisFile), "schema.yaml");
2032
2022
  let content;
2033
- if (schemaFile.protocol !== "file:") {
2034
- const response = await fetch(schemaFile);
2035
- content = await response.text();
2036
- } else content = await readFile(fromFileUrl(schemaFile), { encoding: "utf-8" });
2023
+ if (schemaFile.protocol !== "file:") content = await (await fetch(schemaFile)).text();
2024
+ else content = await readFile(fromFileUrl(schemaFile), { encoding: "utf-8" });
2037
2025
  const schemaObject = parse(content);
2038
2026
  return new Validator(schemaObject);
2039
2027
  }
@@ -2208,7 +2196,9 @@ const scalarTypes = {
2208
2196
  && ${v}["@id"] !== "" && ${v}["@id"] !== "/"`;
2209
2197
  },
2210
2198
  decoder(v) {
2211
- return `new URL(${v}["@id"])`;
2199
+ return `${v}["@id"].startsWith("at://did:plc:")
2200
+ ? new URL("at://did%3Aplc%3A" + ${v}["@id"].slice(13))
2201
+ : new URL(${v}["@id"])`;
2212
2202
  }
2213
2203
  },
2214
2204
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString": {
@@ -2722,7 +2712,7 @@ test("Activity.getObject()", async () => {
2722
2712
  });
2723
2713
  const activity2 = new Activity({ object: new URL("https://example.com/not-found") });
2724
2714
  assertEquals(await activity2.getObject({ suppressError: true }), null);
2725
- const activity3 = await Activity.fromJsonLd({
2715
+ const object3 = await (await Activity.fromJsonLd({
2726
2716
  "@context": "https://www.w3.org/ns/activitystreams",
2727
2717
  type: "Create",
2728
2718
  object: {
@@ -2730,8 +2720,7 @@ test("Activity.getObject()", async () => {
2730
2720
  type: "Note",
2731
2721
  content: "Hello world"
2732
2722
  }
2733
- });
2734
- const object3 = await activity3.getObject();
2723
+ })).getObject();
2735
2724
  assertInstanceOf(object3, Note);
2736
2725
  assertEquals(await object3.toJsonLd(), {
2737
2726
  "@context": "https://www.w3.org/ns/activitystreams",
@@ -2782,8 +2771,7 @@ test("Activity.clone()", async () => {
2782
2771
  }), TypeError, "Cannot update both summary and summaries at the same time.");
2783
2772
  });
2784
2773
  test("Question.voters", async () => {
2785
- const question = new Question({ voters: 123 });
2786
- const json = await question.toJsonLd({ format: "compact" });
2774
+ const json = await new Question({ voters: 123 }).toJsonLd({ format: "compact" });
2787
2775
  assert(typeof json === "object" && json != null);
2788
2776
  assert("votersCount" in json);
2789
2777
  assertEquals(json["votersCount"], 123);
@@ -2936,11 +2924,10 @@ test("Key.publicKey", async () => {
2936
2924
  key_ops: ["verify"],
2937
2925
  ext: true
2938
2926
  };
2939
- const key = new CryptographicKey({ publicKey: await crypto.subtle.importKey("jwk", jwk, {
2927
+ const jsonLd = await new CryptographicKey({ publicKey: await crypto.subtle.importKey("jwk", jwk, {
2940
2928
  name: "RSASSA-PKCS1-v1_5",
2941
2929
  hash: "SHA-256"
2942
- }, true, ["verify"]) });
2943
- const jsonLd = await key.toJsonLd({ contextLoader: mockDocumentLoader });
2930
+ }, true, ["verify"]) }).toJsonLd({ contextLoader: mockDocumentLoader });
2944
2931
  assertEquals(jsonLd, {
2945
2932
  "@context": "https://w3id.org/security/v1",
2946
2933
  publicKeyPem: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxsRuvCkgJtflBTl4OVsm\nnt/J1mQfZasfJtN33dcZ3d1lJroxmgmMu69zjGEAwkNbMQaWNLqC4eogkJaeJ4RR\n5MHYXkL9nNilVoTkjX5BVit3puzs7XJ7WQnKQgQMI+ezn24GHsZ/v1JIo77lerX5\nk4HNwTNVt+yaZVQWaOMR3+6FwziQR6kd0VuG9/a9dgAnz2cEoORRC1i4W7IZaB1s\nZnh1WbHbevlGd72HSXll5rocPIHn8gq6xpBgpHwRphlRsgn4KHaJ6brXDIJjrnQh\nIe/YUBOGj/ImSEXhRwlFerKsoAVnZ0Hwbfa46qk44TAt8CyoPMWmpK6pt0ng4pQ2\nuwIDAQAB\n-----END PUBLIC KEY-----\n",
@@ -2997,11 +2984,20 @@ test("Place.fromJsonLd()", async () => {
2997
2984
  });
2998
2985
  });
2999
2986
  test("Actor.getOutbox()", async () => {
3000
- const person = new Person({ outbox: new URL("https://example.com/orderedcollectionpage") });
3001
- const outbox = await person.getOutbox({ documentLoader: mockDocumentLoader });
2987
+ const outbox = await new Person({ outbox: new URL("https://example.com/orderedcollectionpage") }).getOutbox({ documentLoader: mockDocumentLoader });
3002
2988
  assertInstanceOf(outbox, OrderedCollectionPage);
3003
2989
  assertEquals(outbox.totalItems, 1);
3004
2990
  });
2991
+ test("Link.fromJsonLd()", async () => {
2992
+ const link = await Link.fromJsonLd({
2993
+ "@context": "https://www.w3.org/ns/activitystreams",
2994
+ "type": "Link",
2995
+ "rel": "canonical",
2996
+ "href": "at://did:plc:ia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3lyxjjs27jkqg"
2997
+ });
2998
+ assertEquals(link.rel, "canonical");
2999
+ assertEquals(link.href, new URL("at://did%3Aplc%3Aia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3lyxjjs27jkqg"));
3000
+ });
3005
3001
  function getAllProperties(type, types$1) {
3006
3002
  const props = type.properties;
3007
3003
  if (type.extends != null) props.push(...getAllProperties(types$1[type.extends], types$1));
@@ -2,9 +2,9 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { deno_default, getDocumentLoader } from "./docloader-BK2Fp3AJ.js";
6
- import { Object as Object$1, getTypeId } from "./actor-m_MgQ1Da.js";
7
- import { lookupWebFinger } from "./lookup-DJgGrigh.js";
5
+ import { deno_default, getDocumentLoader } from "./docloader-DJxET2fN.js";
6
+ import { Object as Object$1, getTypeId } from "./actor-GZRoTRqg.js";
7
+ import { lookupWebFinger } from "./lookup-CSngxuWm.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import { delay } from "@es-toolkit/es-toolkit";
@@ -49,9 +49,7 @@ const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]
49
49
  * @since 0.2.0
50
50
  */
51
51
  async function lookupObject(identifier, options = {}) {
52
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
53
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
54
- return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
52
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.lookup_object", async (span) => {
55
53
  try {
56
54
  const result = await lookupObjectInternal(identifier, options);
57
55
  if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
@@ -81,8 +79,7 @@ async function lookupObjectInternal(identifier, options = {}) {
81
79
  }
82
80
  let document = null;
83
81
  if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
84
- const remoteDoc = await documentLoader(identifier.href);
85
- document = remoteDoc.document;
82
+ document = (await documentLoader(identifier.href)).document;
86
83
  } catch (error) {
87
84
  logger.debug("Failed to fetch remote document:\n{error}", { error });
88
85
  }
@@ -96,8 +93,7 @@ async function lookupObjectInternal(identifier, options = {}) {
96
93
  for (const l of jrd.links) {
97
94
  if (l.type !== "application/activity+json" && !l.type?.match(/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/) || l.rel !== "self") continue;
98
95
  try {
99
- const remoteDoc = await documentLoader(l.href);
100
- document = remoteDoc.document;
96
+ document = (await documentLoader(l.href)).document;
101
97
  break;
102
98
  } catch (error) {
103
99
  logger.debug("Failed to fetch remote document:\n{error}", { error });