@fedify/fedify 1.7.11 → 1.7.13
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-2ENhJMd7.js → actor-BVilnhZ3.js} +6 -9
- package/dist/{actor-DgWryCk8.js → actor-CsmPeeHG.js} +1059 -2276
- package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
- package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
- package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
- package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
- package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
- package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
- package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
- package/dist/{authdocloader-CK17fG7y.js → authdocloader-9g6RkEcR.js} +4 -4
- package/dist/{authdocloader-BUJAQQAE.js → authdocloader-DqCINL6u.js} +3 -3
- package/dist/{builder-CZM8EtHh.js → builder-CKUAOfcL.js} +7 -10
- package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
- package/dist/{client-D83KwIk4.js → client-C5xUY491.js} +6 -6
- package/dist/compat/transformers.test.js +27 -28
- package/dist/{context-MUHrGcK9.js → context-aglzx1Ww.js} +2 -2
- package/dist/{docloader-BcyuO_kK.js → docloader-CchlnLWb.js} +5 -9
- package/dist/{docloader-D4wl8z_4.js → docloader-Qfs9nPiy.js} +4 -6
- package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
- package/dist/federation/builder.test.js +23 -29
- package/dist/federation/collection.test.js +9 -9
- package/dist/federation/handler.test.js +33 -33
- package/dist/federation/inbox.test.js +10 -10
- package/dist/federation/keycache.test.js +9 -9
- package/dist/federation/kv.test.js +10 -9
- package/dist/federation/middleware.test.js +76 -99
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +10 -11
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +22 -22
- package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
- package/dist/{http-DFHfa9tA.js → http-CP3h1SLi.js} +8 -15
- package/dist/{http-Dsj_eYDw.js → http-CjDwMreH.js} +8 -15
- package/dist/{inbox-CltmHpHc.js → inbox-ApPO50Ma.js} +5 -7
- package/dist/{key-qFVeObG1.js → key--l6NVKdl.js} +5 -8
- package/dist/key-1Fv7reaM.js +16 -0
- package/dist/{key-bttcdrh5.js → key-BPUM0v_S.js} +6 -9
- package/dist/{key-bBurC_PZ.js → key-DD37RpoD.js} +4 -4
- package/dist/{keycache-DijbBawF.js → keycache-B7Urghlu.js} +2 -2
- package/dist/{keys-DJ5t4jB4.js → keys-DGJec4-R.js} +1 -1
- package/dist/{ld-U-lGfuzj.js → ld-DJTavNY3.js} +9 -16
- package/dist/{lookup-BlPHJ-Ff.js → lookup-CN-LpF5e.js} +2 -4
- package/dist/{lookup-BGqnk7rW.js → lookup-CkOdKyYR.js} +3 -5
- package/dist/{lookup-C8ZpflGI.js → lookup-CnkkF4Rf.js} +7 -11
- package/dist/middleware-BQHe0X6Y.js +17 -0
- package/dist/{middleware-D66R1UZl.js → middleware-BxHcZC4p.js} +34 -52
- package/dist/middleware-C3TZ3P-v.js +33 -0
- package/dist/{middleware-BRzqW-QG.js → middleware-CEpilAEY.js} +34 -58
- package/dist/mod.js +11 -11
- package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
- package/dist/nodeinfo/client.test.js +20 -23
- package/dist/nodeinfo/handler.test.js +32 -32
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +23 -30
- package/dist/nodeinfo/types.test.js +11 -11
- package/dist/{owner-2zho-3Ew.js → owner-qKULzrkx.js} +3 -3
- package/dist/{proof-3J23UdVg.js → proof-BfeWBNrY.js} +12 -25
- package/dist/{proof-BYHc1mMr.js → proof-d5P09-xk.js} +8 -14
- package/dist/runtime/authdocloader.test.js +21 -21
- package/dist/runtime/docloader.test.js +16 -18
- package/dist/runtime/key.test.js +17 -17
- package/dist/runtime/langstr.test.js +9 -9
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +11 -12
- package/dist/runtime/url.test.js +6 -6
- package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
- package/dist/{send-CW7iJ-b9.js → send-BnMY3Qxa.js} +3 -4
- package/dist/sig/http.test.js +40 -54
- package/dist/sig/key.test.js +18 -18
- package/dist/sig/ld.test.js +20 -22
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +20 -20
- package/dist/sig/proof.test.js +19 -19
- package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
- package/dist/testing/docloader.test.js +9 -9
- package/dist/testing/mod.js +1 -1
- package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
- package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
- package/dist/{types-DXmLob1B.js → types-BZUzjGS0.js} +6 -8
- package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
- package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
- package/dist/vocab/actor.test.js +104 -156
- package/dist/vocab/lookup.test.js +17 -17
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +11 -15
- package/dist/vocab/vocab.test.js +68 -49
- package/dist/{vocab-Cy9XhW_T.js → vocab-C_pE4SvE.js} +6 -10
- package/dist/{vocab-BojAnGjI.js → vocab-S7fEn6XO.js} +1057 -2270
- package/dist/webfinger/handler.test.js +33 -34
- package/dist/webfinger/lookup.test.js +13 -13
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +9 -9
- package/package.json +1 -1
- package/dist/key-BROjrzkW.js +0 -16
- package/dist/middleware-BhqeOJrC.js +0 -17
- package/dist/middleware-DFra19vb.js +0 -33
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import "../assert-
|
|
8
|
-
import { assertInstanceOf } from "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import "../multibase-
|
|
12
|
-
import { Collection, Note, Object as Object$1, Person } from "../vocab-
|
|
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-Qfs9nPiy.js";
|
|
10
|
+
import "../url-C2xuoQD1.js";
|
|
11
|
+
import "../multibase-CnLHszip.js";
|
|
12
|
+
import { Collection, Note, Object as Object$1, Person } from "../vocab-S7fEn6XO.js";
|
|
13
13
|
import "../langstr-DbWheeIS.js";
|
|
14
|
-
import "../lookup-
|
|
15
|
-
import "../type-
|
|
16
|
-
import { lookupObject, traverseCollection } from "../lookup-
|
|
17
|
-
import { test } from "../testing-
|
|
18
|
-
import "../std__assert-
|
|
19
|
-
import "../assert_rejects-
|
|
20
|
-
import "../assert_is_error-
|
|
21
|
-
import "../assert_not_equals-
|
|
22
|
-
import "../assert_throws-
|
|
14
|
+
import "../lookup-CkOdKyYR.js";
|
|
15
|
+
import "../type-CFuiGLz9.js";
|
|
16
|
+
import { lookupObject, traverseCollection } from "../lookup-CnkkF4Rf.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-
|
|
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-
|
|
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, lookupObject, traverseCollection } from "../vocab-
|
|
5
|
+
import "../docloader-CchlnLWb.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-CsmPeeHG.js";
|
|
7
|
+
import "../lookup-CN-LpF5e.js";
|
|
8
|
+
import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "../vocab-C_pE4SvE.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 };
|
package/dist/vocab/type.test.js
CHANGED
|
@@ -3,27 +3,23 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import "../docloader-
|
|
8
|
-
import "../url-
|
|
9
|
-
import "../multibase-
|
|
10
|
-
import { Person } from "../vocab-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import "../docloader-Qfs9nPiy.js";
|
|
8
|
+
import "../url-C2xuoQD1.js";
|
|
9
|
+
import "../multibase-CnLHszip.js";
|
|
10
|
+
import { Person } from "../vocab-S7fEn6XO.js";
|
|
11
11
|
import "../langstr-DbWheeIS.js";
|
|
12
|
-
import { getTypeId } from "../type-
|
|
13
|
-
import { test } from "../testing-
|
|
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
|
-
|
|
20
|
-
assertEquals(getTypeId(
|
|
21
|
-
|
|
22
|
-
assertEquals(getTypeId(
|
|
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
|
package/dist/vocab/vocab.test.js
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals, isWindows } from "../assert_equals-
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import { assertInstanceOf } from "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import { decode } from "../multibase-
|
|
12
|
-
import { Activity, Announce, Create, CryptographicKey, Follow, Hashtag, Note, Object as Object$1, OrderedCollectionPage, Person, Place, Question, Source, vocab_exports } from "../vocab-
|
|
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-Qfs9nPiy.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-S7fEn6XO.js";
|
|
13
13
|
import { LanguageString } from "../langstr-DbWheeIS.js";
|
|
14
|
-
import { test } from "../testing-
|
|
15
|
-
import "../std__assert-
|
|
16
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
|
17
|
-
import "../assert_is_error-
|
|
18
|
-
import { assertNotEquals } from "../assert_not_equals-
|
|
19
|
-
import { assertThrows } from "../assert_throws-
|
|
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-
|
|
21
|
+
import { ed25519PublicKey, rsaPublicKey1 } from "../keys-DGJec4-R.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
|
-
|
|
552
|
-
return value ? "true" : "false";
|
|
551
|
+
return (object instanceof Boolean ? object.valueOf() : object) ? "true" : "false";
|
|
553
552
|
},
|
|
554
553
|
uppercase: (object) => {
|
|
555
|
-
|
|
556
|
-
return value ? "TRUE" : "FALSE";
|
|
554
|
+
return (object instanceof Boolean ? object.valueOf() : object) ? "TRUE" : "FALSE";
|
|
557
555
|
},
|
|
558
556
|
camelcase: (object) => {
|
|
559
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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,20 @@ const scalarTypes = {
|
|
|
2208
2196
|
&& ${v}["@id"] !== "" && ${v}["@id"] !== "/"`;
|
|
2209
2197
|
},
|
|
2210
2198
|
decoder(v) {
|
|
2211
|
-
return
|
|
2199
|
+
return `${v}["@id"].startsWith("at://")
|
|
2200
|
+
? new URL("at://" +
|
|
2201
|
+
encodeURIComponent(
|
|
2202
|
+
${v}["@id"].includes("/", 5)
|
|
2203
|
+
? ${v}["@id"].slice(5, ${v}["@id"].indexOf("/", 5))
|
|
2204
|
+
: ${v}["@id"].slice(5)
|
|
2205
|
+
) +
|
|
2206
|
+
(
|
|
2207
|
+
${v}["@id"].includes("/", 5)
|
|
2208
|
+
? ${v}["@id"].slice(${v}["@id"].indexOf("/", 5))
|
|
2209
|
+
: ""
|
|
2210
|
+
)
|
|
2211
|
+
)
|
|
2212
|
+
: new URL(${v}["@id"])`;
|
|
2212
2213
|
}
|
|
2213
2214
|
},
|
|
2214
2215
|
"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString": {
|
|
@@ -2722,7 +2723,7 @@ test("Activity.getObject()", async () => {
|
|
|
2722
2723
|
});
|
|
2723
2724
|
const activity2 = new Activity({ object: new URL("https://example.com/not-found") });
|
|
2724
2725
|
assertEquals(await activity2.getObject({ suppressError: true }), null);
|
|
2725
|
-
const
|
|
2726
|
+
const object3 = await (await Activity.fromJsonLd({
|
|
2726
2727
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
2727
2728
|
type: "Create",
|
|
2728
2729
|
object: {
|
|
@@ -2730,8 +2731,7 @@ test("Activity.getObject()", async () => {
|
|
|
2730
2731
|
type: "Note",
|
|
2731
2732
|
content: "Hello world"
|
|
2732
2733
|
}
|
|
2733
|
-
});
|
|
2734
|
-
const object3 = await activity3.getObject();
|
|
2734
|
+
})).getObject();
|
|
2735
2735
|
assertInstanceOf(object3, Note);
|
|
2736
2736
|
assertEquals(await object3.toJsonLd(), {
|
|
2737
2737
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
@@ -2782,8 +2782,7 @@ test("Activity.clone()", async () => {
|
|
|
2782
2782
|
}), TypeError, "Cannot update both summary and summaries at the same time.");
|
|
2783
2783
|
});
|
|
2784
2784
|
test("Question.voters", async () => {
|
|
2785
|
-
const
|
|
2786
|
-
const json = await question.toJsonLd({ format: "compact" });
|
|
2785
|
+
const json = await new Question({ voters: 123 }).toJsonLd({ format: "compact" });
|
|
2787
2786
|
assert(typeof json === "object" && json != null);
|
|
2788
2787
|
assert("votersCount" in json);
|
|
2789
2788
|
assertEquals(json["votersCount"], 123);
|
|
@@ -2936,11 +2935,10 @@ test("Key.publicKey", async () => {
|
|
|
2936
2935
|
key_ops: ["verify"],
|
|
2937
2936
|
ext: true
|
|
2938
2937
|
};
|
|
2939
|
-
const
|
|
2938
|
+
const jsonLd = await new CryptographicKey({ publicKey: await crypto.subtle.importKey("jwk", jwk, {
|
|
2940
2939
|
name: "RSASSA-PKCS1-v1_5",
|
|
2941
2940
|
hash: "SHA-256"
|
|
2942
|
-
}, true, ["verify"]) });
|
|
2943
|
-
const jsonLd = await key.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2941
|
+
}, true, ["verify"]) }).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2944
2942
|
assertEquals(jsonLd, {
|
|
2945
2943
|
"@context": "https://w3id.org/security/v1",
|
|
2946
2944
|
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 +2995,32 @@ test("Place.fromJsonLd()", async () => {
|
|
|
2997
2995
|
});
|
|
2998
2996
|
});
|
|
2999
2997
|
test("Actor.getOutbox()", async () => {
|
|
3000
|
-
const
|
|
3001
|
-
const outbox = await person.getOutbox({ documentLoader: mockDocumentLoader });
|
|
2998
|
+
const outbox = await new Person({ outbox: new URL("https://example.com/orderedcollectionpage") }).getOutbox({ documentLoader: mockDocumentLoader });
|
|
3002
2999
|
assertInstanceOf(outbox, OrderedCollectionPage);
|
|
3003
3000
|
assertEquals(outbox.totalItems, 1);
|
|
3004
3001
|
});
|
|
3002
|
+
test("Link.fromJsonLd()", async () => {
|
|
3003
|
+
const link = await Link.fromJsonLd({
|
|
3004
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
3005
|
+
"type": "Link",
|
|
3006
|
+
"rel": "canonical",
|
|
3007
|
+
"href": "at://did:plc:ia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3lyxjjs27jkqg"
|
|
3008
|
+
});
|
|
3009
|
+
assertEquals(link.rel, "canonical");
|
|
3010
|
+
assertEquals(link.href, new URL("at://did%3Aplc%3Aia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3lyxjjs27jkqg"));
|
|
3011
|
+
const link2 = await Link.fromJsonLd({
|
|
3012
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
3013
|
+
"type": "Link",
|
|
3014
|
+
"href": "at://bnewbold.bsky.team/app.bsky.feed.post/3jwdwj2ctlk26"
|
|
3015
|
+
});
|
|
3016
|
+
assertEquals(link2.href, new URL("at://bnewbold.bsky.team/app.bsky.feed.post/3jwdwj2ctlk26"));
|
|
3017
|
+
const link3 = await Link.fromJsonLd({
|
|
3018
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
3019
|
+
"type": "Link",
|
|
3020
|
+
"href": "at://did:plc:ia76kvnndjutgedggx2ibrem"
|
|
3021
|
+
});
|
|
3022
|
+
assertEquals(link3.href, new URL("at://did%3Aplc%3Aia76kvnndjutgedggx2ibrem"));
|
|
3023
|
+
});
|
|
3005
3024
|
function getAllProperties(type, types$1) {
|
|
3006
3025
|
const props = type.properties;
|
|
3007
3026
|
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-
|
|
6
|
-
import { Object as Object$1, getTypeId } from "./actor-
|
|
7
|
-
import { lookupWebFinger } from "./lookup-
|
|
5
|
+
import { deno_default, getDocumentLoader } from "./docloader-CchlnLWb.js";
|
|
6
|
+
import { Object as Object$1, getTypeId } from "./actor-CsmPeeHG.js";
|
|
7
|
+
import { lookupWebFinger } from "./lookup-CN-LpF5e.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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 });
|