@fedify/fedify 0.14.0-dev.333 → 0.14.0-dev.335
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/CHANGES.md +11 -0
- package/esm/federation/middleware.js +2 -2
- package/esm/vocab/object.yaml +13 -0
- package/esm/vocab/source.yaml +26 -0
- package/esm/vocab/vocab.js +607 -198
- package/package.json +1 -1
- package/types/federation/collection.d.ts +0 -1
- package/types/federation/collection.d.ts.map +1 -1
- package/types/federation/context.d.ts +0 -2
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/handler.d.ts +0 -2
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +0 -2
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/federation/send.d.ts +0 -2
- package/types/federation/send.d.ts.map +1 -1
- package/types/nodeinfo/handler.d.ts +0 -1
- package/types/nodeinfo/handler.d.ts.map +1 -1
- package/types/nodeinfo/types.d.ts +0 -1
- package/types/nodeinfo/types.d.ts.map +1 -1
- package/types/runtime/docloader.d.ts +0 -1
- package/types/runtime/docloader.d.ts.map +1 -1
- package/types/sig/http.d.ts +0 -2
- package/types/sig/http.d.ts.map +1 -1
- package/types/sig/key.d.ts +0 -1
- package/types/sig/key.d.ts.map +1 -1
- package/types/sig/owner.d.ts +0 -1
- package/types/sig/owner.d.ts.map +1 -1
- package/types/sig/proof.d.ts +0 -1
- package/types/sig/proof.d.ts.map +1 -1
- package/types/vocab/actor.d.ts +0 -1
- package/types/vocab/actor.d.ts.map +1 -1
- package/types/vocab/constants.d.ts +0 -1
- package/types/vocab/constants.d.ts.map +1 -1
- package/types/vocab/lookup.d.ts +0 -1
- package/types/vocab/lookup.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +191 -1
- package/types/vocab/vocab.d.ts.map +1 -1
- package/types/webfinger/handler.d.ts +0 -1
- package/types/webfinger/handler.d.ts.map +1 -1
- package/types/webfinger/lookup.d.ts +0 -1
- package/types/webfinger/lookup.d.ts.map +1 -1
- package/types/x/hono.d.ts +0 -1
- package/types/x/hono.d.ts.map +1 -1
package/esm/vocab/vocab.js
CHANGED
@@ -59,6 +59,7 @@ export class Object {
|
|
59
59
|
#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [];
|
60
60
|
#_3bNvLMBN1bCJETiTihM3wvi1B2JX = [];
|
61
61
|
#_u8gdcDTtChQ4tbSQMXc4cYWyum7 = [];
|
62
|
+
#_2ZwCFoS787v8y8bXKjMoE6MAbrEB = [];
|
62
63
|
#_42rPnotok1ivQ2RNCKNbeFJgx8b8 = [];
|
63
64
|
/**
|
64
65
|
* Constructs a new instance of Object with the given values.
|
@@ -601,6 +602,16 @@ export class Object {
|
|
601
602
|
"boolean" + ".");
|
602
603
|
}
|
603
604
|
}
|
605
|
+
if ("source" in values && values.source != null) {
|
606
|
+
if (values.source instanceof Source) {
|
607
|
+
// @ts-ignore: type is checked above.
|
608
|
+
this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB = [values.source];
|
609
|
+
}
|
610
|
+
else {
|
611
|
+
throw new TypeError("The source must be of type " +
|
612
|
+
"Source" + ".");
|
613
|
+
}
|
614
|
+
}
|
604
615
|
if ("proof" in values && values.proof != null) {
|
605
616
|
if (values.proof instanceof DataIntegrityProof ||
|
606
617
|
values.proof instanceof URL) {
|
@@ -1192,6 +1203,17 @@ export class Object {
|
|
1192
1203
|
"boolean" + ".");
|
1193
1204
|
}
|
1194
1205
|
}
|
1206
|
+
clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB;
|
1207
|
+
if ("source" in values && values.source != null) {
|
1208
|
+
if (values.source instanceof Source) {
|
1209
|
+
// @ts-ignore: type is checked above.
|
1210
|
+
clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB = [values.source];
|
1211
|
+
}
|
1212
|
+
else {
|
1213
|
+
throw new TypeError("The source must be of type " +
|
1214
|
+
"Source" + ".");
|
1215
|
+
}
|
1216
|
+
}
|
1195
1217
|
clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8 = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8;
|
1196
1218
|
if ("proof" in values && values.proof != null) {
|
1197
1219
|
if (values.proof instanceof DataIntegrityProof ||
|
@@ -2638,6 +2660,16 @@ export class Object {
|
|
2638
2660
|
return null;
|
2639
2661
|
return this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7[0];
|
2640
2662
|
}
|
2663
|
+
/** The `source` property is intended to convey some sort of source from which
|
2664
|
+
* the `content` markup was derived, as a form of provenance, or to support
|
2665
|
+
* future editing by clients. In general, clients do the conversion from
|
2666
|
+
* `source` to `content`, not the other way around.
|
2667
|
+
*/
|
2668
|
+
get source() {
|
2669
|
+
if (this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB.length < 1)
|
2670
|
+
return null;
|
2671
|
+
return this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB[0];
|
2672
|
+
}
|
2641
2673
|
async #fetchProof(url, options = {}) {
|
2642
2674
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
2643
2675
|
fetchDocumentLoader;
|
@@ -3223,6 +3255,21 @@ export class Object {
|
|
3223
3255
|
result["sensitive"] = compactItems[0];
|
3224
3256
|
}
|
3225
3257
|
compactItems = [];
|
3258
|
+
for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB) {
|
3259
|
+
const item = await v.toJsonLd({
|
3260
|
+
...options,
|
3261
|
+
format: undefined,
|
3262
|
+
context: undefined,
|
3263
|
+
});
|
3264
|
+
compactItems.push(item);
|
3265
|
+
}
|
3266
|
+
if (compactItems.length > 1) {
|
3267
|
+
result["source"] = compactItems;
|
3268
|
+
}
|
3269
|
+
else if (compactItems.length === 1) {
|
3270
|
+
result["source"] = compactItems[0];
|
3271
|
+
}
|
3272
|
+
compactItems = [];
|
3226
3273
|
for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8) {
|
3227
3274
|
const item = v instanceof URL ? v.href : await v.toJsonLd({
|
3228
3275
|
...options,
|
@@ -3549,6 +3596,14 @@ export class Object {
|
|
3549
3596
|
values["https://www.w3.org/ns/activitystreams#sensitive"] = array;
|
3550
3597
|
}
|
3551
3598
|
array = [];
|
3599
|
+
for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB) {
|
3600
|
+
const element = await v.toJsonLd(options);
|
3601
|
+
array.push(element);
|
3602
|
+
}
|
3603
|
+
if (array.length > 0) {
|
3604
|
+
values["https://www.w3.org/ns/activitystreams#source"] = array;
|
3605
|
+
}
|
3606
|
+
array = [];
|
3552
3607
|
for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8) {
|
3553
3608
|
const element = v instanceof URL
|
3554
3609
|
? { "@id": v.href }
|
@@ -3620,216 +3675,163 @@ export class Object {
|
|
3620
3675
|
}
|
3621
3676
|
if ("@type" in values) {
|
3622
3677
|
if (values["@type"].includes("http://joinmastodon.org/ns#Emoji")) {
|
3623
|
-
|
3624
|
-
return await Emoji.fromJsonLd(values, options);
|
3678
|
+
return await Emoji.fromJsonLd(json, options);
|
3625
3679
|
}
|
3626
3680
|
if (values["@type"].includes("http://litepub.social/ns#ChatMessage")) {
|
3627
|
-
|
3628
|
-
return await ChatMessage.fromJsonLd(values, options);
|
3681
|
+
return await ChatMessage.fromJsonLd(json, options);
|
3629
3682
|
}
|
3630
3683
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) {
|
3631
|
-
|
3632
|
-
return await Activity.fromJsonLd(values, options);
|
3684
|
+
return await Activity.fromJsonLd(json, options);
|
3633
3685
|
}
|
3634
3686
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) {
|
3635
|
-
|
3636
|
-
return await Accept.fromJsonLd(values, options);
|
3687
|
+
return await Accept.fromJsonLd(json, options);
|
3637
3688
|
}
|
3638
3689
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeAccept")) {
|
3639
|
-
|
3640
|
-
return await TentativeAccept.fromJsonLd(values, options);
|
3690
|
+
return await TentativeAccept.fromJsonLd(json, options);
|
3641
3691
|
}
|
3642
3692
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Add")) {
|
3643
|
-
|
3644
|
-
return await Add.fromJsonLd(values, options);
|
3693
|
+
return await Add.fromJsonLd(json, options);
|
3645
3694
|
}
|
3646
3695
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Announce")) {
|
3647
|
-
|
3648
|
-
return await Announce.fromJsonLd(values, options);
|
3696
|
+
return await Announce.fromJsonLd(json, options);
|
3649
3697
|
}
|
3650
3698
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Create")) {
|
3651
|
-
|
3652
|
-
return await Create.fromJsonLd(values, options);
|
3699
|
+
return await Create.fromJsonLd(json, options);
|
3653
3700
|
}
|
3654
3701
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Delete")) {
|
3655
|
-
|
3656
|
-
return await Delete.fromJsonLd(values, options);
|
3702
|
+
return await Delete.fromJsonLd(json, options);
|
3657
3703
|
}
|
3658
3704
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Dislike")) {
|
3659
|
-
|
3660
|
-
return await Dislike.fromJsonLd(values, options);
|
3705
|
+
return await Dislike.fromJsonLd(json, options);
|
3661
3706
|
}
|
3662
3707
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Flag")) {
|
3663
|
-
|
3664
|
-
return await Flag.fromJsonLd(values, options);
|
3708
|
+
return await Flag.fromJsonLd(json, options);
|
3665
3709
|
}
|
3666
3710
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Follow")) {
|
3667
|
-
|
3668
|
-
return await Follow.fromJsonLd(values, options);
|
3711
|
+
return await Follow.fromJsonLd(json, options);
|
3669
3712
|
}
|
3670
3713
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) {
|
3671
|
-
|
3672
|
-
return await Ignore.fromJsonLd(values, options);
|
3714
|
+
return await Ignore.fromJsonLd(json, options);
|
3673
3715
|
}
|
3674
3716
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) {
|
3675
|
-
|
3676
|
-
return await Block.fromJsonLd(values, options);
|
3717
|
+
return await Block.fromJsonLd(json, options);
|
3677
3718
|
}
|
3678
3719
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#IntransitiveActivity")) {
|
3679
|
-
|
3680
|
-
return await IntransitiveActivity.fromJsonLd(values, options);
|
3720
|
+
return await IntransitiveActivity.fromJsonLd(json, options);
|
3681
3721
|
}
|
3682
3722
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Arrive")) {
|
3683
|
-
|
3684
|
-
return await Arrive.fromJsonLd(values, options);
|
3723
|
+
return await Arrive.fromJsonLd(json, options);
|
3685
3724
|
}
|
3686
3725
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Question")) {
|
3687
|
-
|
3688
|
-
return await Question.fromJsonLd(values, options);
|
3726
|
+
return await Question.fromJsonLd(json, options);
|
3689
3727
|
}
|
3690
3728
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Travel")) {
|
3691
|
-
|
3692
|
-
return await Travel.fromJsonLd(values, options);
|
3729
|
+
return await Travel.fromJsonLd(json, options);
|
3693
3730
|
}
|
3694
3731
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Join")) {
|
3695
|
-
|
3696
|
-
return await Join.fromJsonLd(values, options);
|
3732
|
+
return await Join.fromJsonLd(json, options);
|
3697
3733
|
}
|
3698
3734
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Leave")) {
|
3699
|
-
|
3700
|
-
return await Leave.fromJsonLd(values, options);
|
3735
|
+
return await Leave.fromJsonLd(json, options);
|
3701
3736
|
}
|
3702
3737
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Like")) {
|
3703
|
-
|
3704
|
-
return await Like.fromJsonLd(values, options);
|
3738
|
+
return await Like.fromJsonLd(json, options);
|
3705
3739
|
}
|
3706
3740
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Listen")) {
|
3707
|
-
|
3708
|
-
return await Listen.fromJsonLd(values, options);
|
3741
|
+
return await Listen.fromJsonLd(json, options);
|
3709
3742
|
}
|
3710
3743
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Move")) {
|
3711
|
-
|
3712
|
-
return await Move.fromJsonLd(values, options);
|
3744
|
+
return await Move.fromJsonLd(json, options);
|
3713
3745
|
}
|
3714
3746
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Offer")) {
|
3715
|
-
|
3716
|
-
return await Offer.fromJsonLd(values, options);
|
3747
|
+
return await Offer.fromJsonLd(json, options);
|
3717
3748
|
}
|
3718
3749
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Invite")) {
|
3719
|
-
|
3720
|
-
return await Invite.fromJsonLd(values, options);
|
3750
|
+
return await Invite.fromJsonLd(json, options);
|
3721
3751
|
}
|
3722
3752
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Read")) {
|
3723
|
-
|
3724
|
-
return await Read.fromJsonLd(values, options);
|
3753
|
+
return await Read.fromJsonLd(json, options);
|
3725
3754
|
}
|
3726
3755
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Reject")) {
|
3727
|
-
|
3728
|
-
return await Reject.fromJsonLd(values, options);
|
3756
|
+
return await Reject.fromJsonLd(json, options);
|
3729
3757
|
}
|
3730
3758
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeReject")) {
|
3731
|
-
|
3732
|
-
return await TentativeReject.fromJsonLd(values, options);
|
3759
|
+
return await TentativeReject.fromJsonLd(json, options);
|
3733
3760
|
}
|
3734
3761
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Remove")) {
|
3735
|
-
|
3736
|
-
return await Remove.fromJsonLd(values, options);
|
3762
|
+
return await Remove.fromJsonLd(json, options);
|
3737
3763
|
}
|
3738
3764
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Undo")) {
|
3739
|
-
|
3740
|
-
return await Undo.fromJsonLd(values, options);
|
3765
|
+
return await Undo.fromJsonLd(json, options);
|
3741
3766
|
}
|
3742
3767
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Update")) {
|
3743
|
-
|
3744
|
-
return await Update.fromJsonLd(values, options);
|
3768
|
+
return await Update.fromJsonLd(json, options);
|
3745
3769
|
}
|
3746
3770
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#View")) {
|
3747
|
-
|
3748
|
-
return await View.fromJsonLd(values, options);
|
3771
|
+
return await View.fromJsonLd(json, options);
|
3749
3772
|
}
|
3750
3773
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Application")) {
|
3751
|
-
|
3752
|
-
return await Application.fromJsonLd(values, options);
|
3774
|
+
return await Application.fromJsonLd(json, options);
|
3753
3775
|
}
|
3754
3776
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Article")) {
|
3755
|
-
|
3756
|
-
return await Article.fromJsonLd(values, options);
|
3777
|
+
return await Article.fromJsonLd(json, options);
|
3757
3778
|
}
|
3758
3779
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Collection")) {
|
3759
|
-
|
3760
|
-
return await Collection.fromJsonLd(values, options);
|
3780
|
+
return await Collection.fromJsonLd(json, options);
|
3761
3781
|
}
|
3762
3782
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#CollectionPage")) {
|
3763
|
-
|
3764
|
-
return await CollectionPage.fromJsonLd(values, options);
|
3783
|
+
return await CollectionPage.fromJsonLd(json, options);
|
3765
3784
|
}
|
3766
3785
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollectionPage")) {
|
3767
|
-
|
3768
|
-
return await OrderedCollectionPage.fromJsonLd(values, options);
|
3786
|
+
return await OrderedCollectionPage.fromJsonLd(json, options);
|
3769
3787
|
}
|
3770
3788
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollection")) {
|
3771
|
-
|
3772
|
-
return await OrderedCollection.fromJsonLd(values, options);
|
3789
|
+
return await OrderedCollection.fromJsonLd(json, options);
|
3773
3790
|
}
|
3774
3791
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Document")) {
|
3775
|
-
|
3776
|
-
return await Document.fromJsonLd(values, options);
|
3792
|
+
return await Document.fromJsonLd(json, options);
|
3777
3793
|
}
|
3778
3794
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Audio")) {
|
3779
|
-
|
3780
|
-
return await Audio.fromJsonLd(values, options);
|
3795
|
+
return await Audio.fromJsonLd(json, options);
|
3781
3796
|
}
|
3782
3797
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Image")) {
|
3783
|
-
|
3784
|
-
return await Image.fromJsonLd(values, options);
|
3798
|
+
return await Image.fromJsonLd(json, options);
|
3785
3799
|
}
|
3786
3800
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Page")) {
|
3787
|
-
|
3788
|
-
return await Page.fromJsonLd(values, options);
|
3801
|
+
return await Page.fromJsonLd(json, options);
|
3789
3802
|
}
|
3790
3803
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Video")) {
|
3791
|
-
|
3792
|
-
return await Video.fromJsonLd(values, options);
|
3804
|
+
return await Video.fromJsonLd(json, options);
|
3793
3805
|
}
|
3794
3806
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Event")) {
|
3795
|
-
|
3796
|
-
return await Event.fromJsonLd(values, options);
|
3807
|
+
return await Event.fromJsonLd(json, options);
|
3797
3808
|
}
|
3798
3809
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Group")) {
|
3799
|
-
|
3800
|
-
return await Group.fromJsonLd(values, options);
|
3810
|
+
return await Group.fromJsonLd(json, options);
|
3801
3811
|
}
|
3802
3812
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Note")) {
|
3803
|
-
|
3804
|
-
return await Note.fromJsonLd(values, options);
|
3813
|
+
return await Note.fromJsonLd(json, options);
|
3805
3814
|
}
|
3806
3815
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Organization")) {
|
3807
|
-
|
3808
|
-
return await Organization.fromJsonLd(values, options);
|
3816
|
+
return await Organization.fromJsonLd(json, options);
|
3809
3817
|
}
|
3810
3818
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Person")) {
|
3811
|
-
|
3812
|
-
return await Person.fromJsonLd(values, options);
|
3819
|
+
return await Person.fromJsonLd(json, options);
|
3813
3820
|
}
|
3814
3821
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Place")) {
|
3815
|
-
|
3816
|
-
return await Place.fromJsonLd(values, options);
|
3822
|
+
return await Place.fromJsonLd(json, options);
|
3817
3823
|
}
|
3818
3824
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Profile")) {
|
3819
|
-
|
3820
|
-
return await Profile.fromJsonLd(values, options);
|
3825
|
+
return await Profile.fromJsonLd(json, options);
|
3821
3826
|
}
|
3822
3827
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Relationship")) {
|
3823
|
-
|
3824
|
-
return await Relationship.fromJsonLd(values, options);
|
3828
|
+
return await Relationship.fromJsonLd(json, options);
|
3825
3829
|
}
|
3826
3830
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Service")) {
|
3827
|
-
|
3828
|
-
return await Service.fromJsonLd(values, options);
|
3831
|
+
return await Service.fromJsonLd(json, options);
|
3829
3832
|
}
|
3830
3833
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Tombstone")) {
|
3831
|
-
|
3832
|
-
return await Tombstone.fromJsonLd(values, options);
|
3834
|
+
return await Tombstone.fromJsonLd(json, options);
|
3833
3835
|
}
|
3834
3836
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Object")) {
|
3835
3837
|
throw new TypeError("Invalid type: " + values["@type"]);
|
@@ -4828,6 +4830,19 @@ export class Object {
|
|
4828
4830
|
_u8gdcDTtChQ4tbSQMXc4cYWyum7.push(v["@value"]);
|
4829
4831
|
}
|
4830
4832
|
instance.#_u8gdcDTtChQ4tbSQMXc4cYWyum7 = _u8gdcDTtChQ4tbSQMXc4cYWyum7;
|
4833
|
+
const _2ZwCFoS787v8y8bXKjMoE6MAbrEB = [];
|
4834
|
+
const _2ZwCFoS787v8y8bXKjMoE6MAbrEB__array = values["https://www.w3.org/ns/activitystreams#source"];
|
4835
|
+
for (const v of _2ZwCFoS787v8y8bXKjMoE6MAbrEB__array == null
|
4836
|
+
? []
|
4837
|
+
: _2ZwCFoS787v8y8bXKjMoE6MAbrEB__array.length === 1 &&
|
4838
|
+
"@list" in _2ZwCFoS787v8y8bXKjMoE6MAbrEB__array[0]
|
4839
|
+
? _2ZwCFoS787v8y8bXKjMoE6MAbrEB__array[0]["@list"]
|
4840
|
+
: _2ZwCFoS787v8y8bXKjMoE6MAbrEB__array) {
|
4841
|
+
if (v == null)
|
4842
|
+
continue;
|
4843
|
+
_2ZwCFoS787v8y8bXKjMoE6MAbrEB.push(await Source.fromJsonLd(v, options));
|
4844
|
+
}
|
4845
|
+
instance.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB = _2ZwCFoS787v8y8bXKjMoE6MAbrEB;
|
4831
4846
|
const _42rPnotok1ivQ2RNCKNbeFJgx8b8 = [];
|
4832
4847
|
const _42rPnotok1ivQ2RNCKNbeFJgx8b8__array = values["https://w3id.org/security#proof"];
|
4833
4848
|
for (const v of _42rPnotok1ivQ2RNCKNbeFJgx8b8__array == null
|
@@ -5244,6 +5259,17 @@ export class Object {
|
|
5244
5259
|
if (_u8gdcDTtChQ4tbSQMXc4cYWyum7.length == 1) {
|
5245
5260
|
proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7[0];
|
5246
5261
|
}
|
5262
|
+
const _2ZwCFoS787v8y8bXKjMoE6MAbrEB = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB
|
5263
|
+
// deno-lint-ignore no-explicit-any
|
5264
|
+
.map((v) => v instanceof URL
|
5265
|
+
? {
|
5266
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
5267
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
5268
|
+
}
|
5269
|
+
: v);
|
5270
|
+
if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB.length == 1) {
|
5271
|
+
proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB[0];
|
5272
|
+
}
|
5247
5273
|
const _42rPnotok1ivQ2RNCKNbeFJgx8b8 = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8
|
5248
5274
|
// deno-lint-ignore no-explicit-any
|
5249
5275
|
.map((v) => v instanceof URL
|
@@ -5419,6 +5445,7 @@ export class Emoji extends Object {
|
|
5419
5445
|
throw new TypeError("Invalid type: " + values["@type"]);
|
5420
5446
|
}
|
5421
5447
|
}
|
5448
|
+
delete values["@type"];
|
5422
5449
|
const instance = await super.fromJsonLd(values, {
|
5423
5450
|
...options,
|
5424
5451
|
// @ts-ignore: an internal option
|
@@ -5611,6 +5638,7 @@ export class ChatMessage extends Object {
|
|
5611
5638
|
throw new TypeError("Invalid type: " + values["@type"]);
|
5612
5639
|
}
|
5613
5640
|
}
|
5641
|
+
delete values["@type"];
|
5614
5642
|
const instance = await super.fromJsonLd(values, {
|
5615
5643
|
...options,
|
5616
5644
|
// @ts-ignore: an internal option
|
@@ -8719,125 +8747,97 @@ export class Activity extends Object {
|
|
8719
8747
|
}
|
8720
8748
|
if ("@type" in values) {
|
8721
8749
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) {
|
8722
|
-
|
8723
|
-
return await Accept.fromJsonLd(values, options);
|
8750
|
+
return await Accept.fromJsonLd(json, options);
|
8724
8751
|
}
|
8725
8752
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeAccept")) {
|
8726
|
-
|
8727
|
-
return await TentativeAccept.fromJsonLd(values, options);
|
8753
|
+
return await TentativeAccept.fromJsonLd(json, options);
|
8728
8754
|
}
|
8729
8755
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Add")) {
|
8730
|
-
|
8731
|
-
return await Add.fromJsonLd(values, options);
|
8756
|
+
return await Add.fromJsonLd(json, options);
|
8732
8757
|
}
|
8733
8758
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Announce")) {
|
8734
|
-
|
8735
|
-
return await Announce.fromJsonLd(values, options);
|
8759
|
+
return await Announce.fromJsonLd(json, options);
|
8736
8760
|
}
|
8737
8761
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Create")) {
|
8738
|
-
|
8739
|
-
return await Create.fromJsonLd(values, options);
|
8762
|
+
return await Create.fromJsonLd(json, options);
|
8740
8763
|
}
|
8741
8764
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Delete")) {
|
8742
|
-
|
8743
|
-
return await Delete.fromJsonLd(values, options);
|
8765
|
+
return await Delete.fromJsonLd(json, options);
|
8744
8766
|
}
|
8745
8767
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Dislike")) {
|
8746
|
-
|
8747
|
-
return await Dislike.fromJsonLd(values, options);
|
8768
|
+
return await Dislike.fromJsonLd(json, options);
|
8748
8769
|
}
|
8749
8770
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Flag")) {
|
8750
|
-
|
8751
|
-
return await Flag.fromJsonLd(values, options);
|
8771
|
+
return await Flag.fromJsonLd(json, options);
|
8752
8772
|
}
|
8753
8773
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Follow")) {
|
8754
|
-
|
8755
|
-
return await Follow.fromJsonLd(values, options);
|
8774
|
+
return await Follow.fromJsonLd(json, options);
|
8756
8775
|
}
|
8757
8776
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) {
|
8758
|
-
|
8759
|
-
return await Ignore.fromJsonLd(values, options);
|
8777
|
+
return await Ignore.fromJsonLd(json, options);
|
8760
8778
|
}
|
8761
8779
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) {
|
8762
|
-
|
8763
|
-
return await Block.fromJsonLd(values, options);
|
8780
|
+
return await Block.fromJsonLd(json, options);
|
8764
8781
|
}
|
8765
8782
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#IntransitiveActivity")) {
|
8766
|
-
|
8767
|
-
return await IntransitiveActivity.fromJsonLd(values, options);
|
8783
|
+
return await IntransitiveActivity.fromJsonLd(json, options);
|
8768
8784
|
}
|
8769
8785
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Arrive")) {
|
8770
|
-
|
8771
|
-
return await Arrive.fromJsonLd(values, options);
|
8786
|
+
return await Arrive.fromJsonLd(json, options);
|
8772
8787
|
}
|
8773
8788
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Question")) {
|
8774
|
-
|
8775
|
-
return await Question.fromJsonLd(values, options);
|
8789
|
+
return await Question.fromJsonLd(json, options);
|
8776
8790
|
}
|
8777
8791
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Travel")) {
|
8778
|
-
|
8779
|
-
return await Travel.fromJsonLd(values, options);
|
8792
|
+
return await Travel.fromJsonLd(json, options);
|
8780
8793
|
}
|
8781
8794
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Join")) {
|
8782
|
-
|
8783
|
-
return await Join.fromJsonLd(values, options);
|
8795
|
+
return await Join.fromJsonLd(json, options);
|
8784
8796
|
}
|
8785
8797
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Leave")) {
|
8786
|
-
|
8787
|
-
return await Leave.fromJsonLd(values, options);
|
8798
|
+
return await Leave.fromJsonLd(json, options);
|
8788
8799
|
}
|
8789
8800
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Like")) {
|
8790
|
-
|
8791
|
-
return await Like.fromJsonLd(values, options);
|
8801
|
+
return await Like.fromJsonLd(json, options);
|
8792
8802
|
}
|
8793
8803
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Listen")) {
|
8794
|
-
|
8795
|
-
return await Listen.fromJsonLd(values, options);
|
8804
|
+
return await Listen.fromJsonLd(json, options);
|
8796
8805
|
}
|
8797
8806
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Move")) {
|
8798
|
-
|
8799
|
-
return await Move.fromJsonLd(values, options);
|
8807
|
+
return await Move.fromJsonLd(json, options);
|
8800
8808
|
}
|
8801
8809
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Offer")) {
|
8802
|
-
|
8803
|
-
return await Offer.fromJsonLd(values, options);
|
8810
|
+
return await Offer.fromJsonLd(json, options);
|
8804
8811
|
}
|
8805
8812
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Invite")) {
|
8806
|
-
|
8807
|
-
return await Invite.fromJsonLd(values, options);
|
8813
|
+
return await Invite.fromJsonLd(json, options);
|
8808
8814
|
}
|
8809
8815
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Read")) {
|
8810
|
-
|
8811
|
-
return await Read.fromJsonLd(values, options);
|
8816
|
+
return await Read.fromJsonLd(json, options);
|
8812
8817
|
}
|
8813
8818
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Reject")) {
|
8814
|
-
|
8815
|
-
return await Reject.fromJsonLd(values, options);
|
8819
|
+
return await Reject.fromJsonLd(json, options);
|
8816
8820
|
}
|
8817
8821
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeReject")) {
|
8818
|
-
|
8819
|
-
return await TentativeReject.fromJsonLd(values, options);
|
8822
|
+
return await TentativeReject.fromJsonLd(json, options);
|
8820
8823
|
}
|
8821
8824
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Remove")) {
|
8822
|
-
|
8823
|
-
return await Remove.fromJsonLd(values, options);
|
8825
|
+
return await Remove.fromJsonLd(json, options);
|
8824
8826
|
}
|
8825
8827
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Undo")) {
|
8826
|
-
|
8827
|
-
return await Undo.fromJsonLd(values, options);
|
8828
|
+
return await Undo.fromJsonLd(json, options);
|
8828
8829
|
}
|
8829
8830
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Update")) {
|
8830
|
-
|
8831
|
-
return await Update.fromJsonLd(values, options);
|
8831
|
+
return await Update.fromJsonLd(json, options);
|
8832
8832
|
}
|
8833
8833
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#View")) {
|
8834
|
-
|
8835
|
-
return await View.fromJsonLd(values, options);
|
8834
|
+
return await View.fromJsonLd(json, options);
|
8836
8835
|
}
|
8837
8836
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) {
|
8838
8837
|
throw new TypeError("Invalid type: " + values["@type"]);
|
8839
8838
|
}
|
8840
8839
|
}
|
8840
|
+
delete values["@type"];
|
8841
8841
|
const instance = await super.fromJsonLd(values, {
|
8842
8842
|
...options,
|
8843
8843
|
// @ts-ignore: an internal option
|
@@ -9242,13 +9242,13 @@ export class Accept extends Activity {
|
|
9242
9242
|
}
|
9243
9243
|
if ("@type" in values) {
|
9244
9244
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeAccept")) {
|
9245
|
-
|
9246
|
-
return await TentativeAccept.fromJsonLd(values, options);
|
9245
|
+
return await TentativeAccept.fromJsonLd(json, options);
|
9247
9246
|
}
|
9248
9247
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) {
|
9249
9248
|
throw new TypeError("Invalid type: " + values["@type"]);
|
9250
9249
|
}
|
9251
9250
|
}
|
9251
|
+
delete values["@type"];
|
9252
9252
|
const instance = await super.fromJsonLd(values, {
|
9253
9253
|
...options,
|
9254
9254
|
// @ts-ignore: an internal option
|
@@ -9430,6 +9430,7 @@ export class Add extends Activity {
|
|
9430
9430
|
throw new TypeError("Invalid type: " + values["@type"]);
|
9431
9431
|
}
|
9432
9432
|
}
|
9433
|
+
delete values["@type"];
|
9433
9434
|
const instance = await super.fromJsonLd(values, {
|
9434
9435
|
...options,
|
9435
9436
|
// @ts-ignore: an internal option
|
@@ -9624,6 +9625,7 @@ export class Announce extends Activity {
|
|
9624
9625
|
throw new TypeError("Invalid type: " + values["@type"]);
|
9625
9626
|
}
|
9626
9627
|
}
|
9628
|
+
delete values["@type"];
|
9627
9629
|
const instance = await super.fromJsonLd(values, {
|
9628
9630
|
...options,
|
9629
9631
|
// @ts-ignore: an internal option
|
@@ -11433,6 +11435,7 @@ export class Application extends Object {
|
|
11433
11435
|
throw new TypeError("Invalid type: " + values["@type"]);
|
11434
11436
|
}
|
11435
11437
|
}
|
11438
|
+
delete values["@type"];
|
11436
11439
|
const instance = await super.fromJsonLd(values, {
|
11437
11440
|
...options,
|
11438
11441
|
// @ts-ignore: an internal option
|
@@ -12097,21 +12100,19 @@ export class IntransitiveActivity extends Activity {
|
|
12097
12100
|
}
|
12098
12101
|
if ("@type" in values) {
|
12099
12102
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Arrive")) {
|
12100
|
-
|
12101
|
-
return await Arrive.fromJsonLd(values, options);
|
12103
|
+
return await Arrive.fromJsonLd(json, options);
|
12102
12104
|
}
|
12103
12105
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Question")) {
|
12104
|
-
|
12105
|
-
return await Question.fromJsonLd(values, options);
|
12106
|
+
return await Question.fromJsonLd(json, options);
|
12106
12107
|
}
|
12107
12108
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Travel")) {
|
12108
|
-
|
12109
|
-
return await Travel.fromJsonLd(values, options);
|
12109
|
+
return await Travel.fromJsonLd(json, options);
|
12110
12110
|
}
|
12111
12111
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#IntransitiveActivity")) {
|
12112
12112
|
throw new TypeError("Invalid type: " + values["@type"]);
|
12113
12113
|
}
|
12114
12114
|
}
|
12115
|
+
delete values["@type"];
|
12115
12116
|
const instance = await super.fromJsonLd(values, {
|
12116
12117
|
...options,
|
12117
12118
|
// @ts-ignore: an internal option
|
@@ -12275,6 +12276,7 @@ export class Arrive extends IntransitiveActivity {
|
|
12275
12276
|
throw new TypeError("Invalid type: " + values["@type"]);
|
12276
12277
|
}
|
12277
12278
|
}
|
12279
|
+
delete values["@type"];
|
12278
12280
|
const instance = await super.fromJsonLd(values, {
|
12279
12281
|
...options,
|
12280
12282
|
// @ts-ignore: an internal option
|
@@ -12465,6 +12467,7 @@ export class Article extends Object {
|
|
12465
12467
|
throw new TypeError("Invalid type: " + values["@type"]);
|
12466
12468
|
}
|
12467
12469
|
}
|
12470
|
+
delete values["@type"];
|
12468
12471
|
const instance = await super.fromJsonLd(values, {
|
12469
12472
|
...options,
|
12470
12473
|
// @ts-ignore: an internal option
|
@@ -12748,25 +12751,22 @@ export class Document extends Object {
|
|
12748
12751
|
}
|
12749
12752
|
if ("@type" in values) {
|
12750
12753
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Audio")) {
|
12751
|
-
|
12752
|
-
return await Audio.fromJsonLd(values, options);
|
12754
|
+
return await Audio.fromJsonLd(json, options);
|
12753
12755
|
}
|
12754
12756
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Image")) {
|
12755
|
-
|
12756
|
-
return await Image.fromJsonLd(values, options);
|
12757
|
+
return await Image.fromJsonLd(json, options);
|
12757
12758
|
}
|
12758
12759
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Page")) {
|
12759
|
-
|
12760
|
-
return await Page.fromJsonLd(values, options);
|
12760
|
+
return await Page.fromJsonLd(json, options);
|
12761
12761
|
}
|
12762
12762
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Video")) {
|
12763
|
-
|
12764
|
-
return await Video.fromJsonLd(values, options);
|
12763
|
+
return await Video.fromJsonLd(json, options);
|
12765
12764
|
}
|
12766
12765
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Document")) {
|
12767
12766
|
throw new TypeError("Invalid type: " + values["@type"]);
|
12768
12767
|
}
|
12769
12768
|
}
|
12769
|
+
delete values["@type"];
|
12770
12770
|
const instance = await super.fromJsonLd(values, {
|
12771
12771
|
...options,
|
12772
12772
|
// @ts-ignore: an internal option
|
@@ -12993,6 +12993,7 @@ export class Audio extends Document {
|
|
12993
12993
|
throw new TypeError("Invalid type: " + values["@type"]);
|
12994
12994
|
}
|
12995
12995
|
}
|
12996
|
+
delete values["@type"];
|
12996
12997
|
const instance = await super.fromJsonLd(values, {
|
12997
12998
|
...options,
|
12998
12999
|
// @ts-ignore: an internal option
|
@@ -13169,13 +13170,13 @@ export class Ignore extends Activity {
|
|
13169
13170
|
}
|
13170
13171
|
if ("@type" in values) {
|
13171
13172
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) {
|
13172
|
-
|
13173
|
-
return await Block.fromJsonLd(values, options);
|
13173
|
+
return await Block.fromJsonLd(json, options);
|
13174
13174
|
}
|
13175
13175
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) {
|
13176
13176
|
throw new TypeError("Invalid type: " + values["@type"]);
|
13177
13177
|
}
|
13178
13178
|
}
|
13179
|
+
delete values["@type"];
|
13179
13180
|
const instance = await super.fromJsonLd(values, {
|
13180
13181
|
...options,
|
13181
13182
|
// @ts-ignore: an internal option
|
@@ -13357,6 +13358,7 @@ export class Block extends Ignore {
|
|
13357
13358
|
throw new TypeError("Invalid type: " + values["@type"]);
|
13358
13359
|
}
|
13359
13360
|
}
|
13361
|
+
delete values["@type"];
|
13360
13362
|
const instance = await super.fromJsonLd(values, {
|
13361
13363
|
...options,
|
13362
13364
|
// @ts-ignore: an internal option
|
@@ -14036,21 +14038,19 @@ export class Collection extends Object {
|
|
14036
14038
|
}
|
14037
14039
|
if ("@type" in values) {
|
14038
14040
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#CollectionPage")) {
|
14039
|
-
|
14040
|
-
return await CollectionPage.fromJsonLd(values, options);
|
14041
|
+
return await CollectionPage.fromJsonLd(json, options);
|
14041
14042
|
}
|
14042
14043
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollectionPage")) {
|
14043
|
-
|
14044
|
-
return await OrderedCollectionPage.fromJsonLd(values, options);
|
14044
|
+
return await OrderedCollectionPage.fromJsonLd(json, options);
|
14045
14045
|
}
|
14046
14046
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollection")) {
|
14047
|
-
|
14048
|
-
return await OrderedCollection.fromJsonLd(values, options);
|
14047
|
+
return await OrderedCollection.fromJsonLd(json, options);
|
14049
14048
|
}
|
14050
14049
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Collection")) {
|
14051
14050
|
throw new TypeError("Invalid type: " + values["@type"]);
|
14052
14051
|
}
|
14053
14052
|
}
|
14053
|
+
delete values["@type"];
|
14054
14054
|
const instance = await super.fromJsonLd(values, {
|
14055
14055
|
...options,
|
14056
14056
|
// @ts-ignore: an internal option
|
@@ -14759,13 +14759,13 @@ export class CollectionPage extends Collection {
|
|
14759
14759
|
}
|
14760
14760
|
if ("@type" in values) {
|
14761
14761
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollectionPage")) {
|
14762
|
-
|
14763
|
-
return await OrderedCollectionPage.fromJsonLd(values, options);
|
14762
|
+
return await OrderedCollectionPage.fromJsonLd(json, options);
|
14764
14763
|
}
|
14765
14764
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#CollectionPage")) {
|
14766
14765
|
throw new TypeError("Invalid type: " + values["@type"]);
|
14767
14766
|
}
|
14768
14767
|
}
|
14768
|
+
delete values["@type"];
|
14769
14769
|
const instance = await super.fromJsonLd(values, {
|
14770
14770
|
...options,
|
14771
14771
|
// @ts-ignore: an internal option
|
@@ -15048,6 +15048,7 @@ export class Create extends Activity {
|
|
15048
15048
|
throw new TypeError("Invalid type: " + values["@type"]);
|
15049
15049
|
}
|
15050
15050
|
}
|
15051
|
+
delete values["@type"];
|
15051
15052
|
const instance = await super.fromJsonLd(values, {
|
15052
15053
|
...options,
|
15053
15054
|
// @ts-ignore: an internal option
|
@@ -15243,6 +15244,7 @@ export class Delete extends Activity {
|
|
15243
15244
|
throw new TypeError("Invalid type: " + values["@type"]);
|
15244
15245
|
}
|
15245
15246
|
}
|
15247
|
+
delete values["@type"];
|
15246
15248
|
const instance = await super.fromJsonLd(values, {
|
15247
15249
|
...options,
|
15248
15250
|
// @ts-ignore: an internal option
|
@@ -15421,6 +15423,7 @@ export class Dislike extends Activity {
|
|
15421
15423
|
throw new TypeError("Invalid type: " + values["@type"]);
|
15422
15424
|
}
|
15423
15425
|
}
|
15426
|
+
delete values["@type"];
|
15424
15427
|
const instance = await super.fromJsonLd(values, {
|
15425
15428
|
...options,
|
15426
15429
|
// @ts-ignore: an internal option
|
@@ -16229,6 +16232,7 @@ export class Event extends Object {
|
|
16229
16232
|
throw new TypeError("Invalid type: " + values["@type"]);
|
16230
16233
|
}
|
16231
16234
|
}
|
16235
|
+
delete values["@type"];
|
16232
16236
|
const instance = await super.fromJsonLd(values, {
|
16233
16237
|
...options,
|
16234
16238
|
// @ts-ignore: an internal option
|
@@ -16409,6 +16413,7 @@ export class Flag extends Activity {
|
|
16409
16413
|
throw new TypeError("Invalid type: " + values["@type"]);
|
16410
16414
|
}
|
16411
16415
|
}
|
16416
|
+
delete values["@type"];
|
16412
16417
|
const instance = await super.fromJsonLd(values, {
|
16413
16418
|
...options,
|
16414
16419
|
// @ts-ignore: an internal option
|
@@ -16590,6 +16595,7 @@ export class Follow extends Activity {
|
|
16590
16595
|
throw new TypeError("Invalid type: " + values["@type"]);
|
16591
16596
|
}
|
16592
16597
|
}
|
16598
|
+
delete values["@type"];
|
16593
16599
|
const instance = await super.fromJsonLd(values, {
|
16594
16600
|
...options,
|
16595
16601
|
// @ts-ignore: an internal option
|
@@ -18399,6 +18405,7 @@ export class Group extends Object {
|
|
18399
18405
|
throw new TypeError("Invalid type: " + values["@type"]);
|
18400
18406
|
}
|
18401
18407
|
}
|
18408
|
+
delete values["@type"];
|
18402
18409
|
const instance = await super.fromJsonLd(values, {
|
18403
18410
|
...options,
|
18404
18411
|
// @ts-ignore: an internal option
|
@@ -19624,12 +19631,10 @@ export class Link {
|
|
19624
19631
|
}
|
19625
19632
|
if ("@type" in values) {
|
19626
19633
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Hashtag")) {
|
19627
|
-
|
19628
|
-
return await Hashtag.fromJsonLd(values, options);
|
19634
|
+
return await Hashtag.fromJsonLd(json, options);
|
19629
19635
|
}
|
19630
19636
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Mention")) {
|
19631
|
-
|
19632
|
-
return await Mention.fromJsonLd(values, options);
|
19637
|
+
return await Mention.fromJsonLd(json, options);
|
19633
19638
|
}
|
19634
19639
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Link")) {
|
19635
19640
|
throw new TypeError("Invalid type: " + values["@type"]);
|
@@ -20089,6 +20094,7 @@ export class Hashtag extends Link {
|
|
20089
20094
|
throw new TypeError("Invalid type: " + values["@type"]);
|
20090
20095
|
}
|
20091
20096
|
}
|
20097
|
+
delete values["@type"];
|
20092
20098
|
const instance = await super.fromJsonLd(values, {
|
20093
20099
|
...options,
|
20094
20100
|
// @ts-ignore: an internal option
|
@@ -20261,6 +20267,7 @@ export class Image extends Document {
|
|
20261
20267
|
throw new TypeError("Invalid type: " + values["@type"]);
|
20262
20268
|
}
|
20263
20269
|
}
|
20270
|
+
delete values["@type"];
|
20264
20271
|
const instance = await super.fromJsonLd(values, {
|
20265
20272
|
...options,
|
20266
20273
|
// @ts-ignore: an internal option
|
@@ -20438,13 +20445,13 @@ export class Offer extends Activity {
|
|
20438
20445
|
}
|
20439
20446
|
if ("@type" in values) {
|
20440
20447
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Invite")) {
|
20441
|
-
|
20442
|
-
return await Invite.fromJsonLd(values, options);
|
20448
|
+
return await Invite.fromJsonLd(json, options);
|
20443
20449
|
}
|
20444
20450
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Offer")) {
|
20445
20451
|
throw new TypeError("Invalid type: " + values["@type"]);
|
20446
20452
|
}
|
20447
20453
|
}
|
20454
|
+
delete values["@type"];
|
20448
20455
|
const instance = await super.fromJsonLd(values, {
|
20449
20456
|
...options,
|
20450
20457
|
// @ts-ignore: an internal option
|
@@ -20624,6 +20631,7 @@ export class Invite extends Offer {
|
|
20624
20631
|
throw new TypeError("Invalid type: " + values["@type"]);
|
20625
20632
|
}
|
20626
20633
|
}
|
20634
|
+
delete values["@type"];
|
20627
20635
|
const instance = await super.fromJsonLd(values, {
|
20628
20636
|
...options,
|
20629
20637
|
// @ts-ignore: an internal option
|
@@ -20803,6 +20811,7 @@ export class Join extends Activity {
|
|
20803
20811
|
throw new TypeError("Invalid type: " + values["@type"]);
|
20804
20812
|
}
|
20805
20813
|
}
|
20814
|
+
delete values["@type"];
|
20806
20815
|
const instance = await super.fromJsonLd(values, {
|
20807
20816
|
...options,
|
20808
20817
|
// @ts-ignore: an internal option
|
@@ -20982,6 +20991,7 @@ export class Leave extends Activity {
|
|
20982
20991
|
throw new TypeError("Invalid type: " + values["@type"]);
|
20983
20992
|
}
|
20984
20993
|
}
|
20994
|
+
delete values["@type"];
|
20985
20995
|
const instance = await super.fromJsonLd(values, {
|
20986
20996
|
...options,
|
20987
20997
|
// @ts-ignore: an internal option
|
@@ -21161,6 +21171,7 @@ export class Like extends Activity {
|
|
21161
21171
|
throw new TypeError("Invalid type: " + values["@type"]);
|
21162
21172
|
}
|
21163
21173
|
}
|
21174
|
+
delete values["@type"];
|
21164
21175
|
const instance = await super.fromJsonLd(values, {
|
21165
21176
|
...options,
|
21166
21177
|
// @ts-ignore: an internal option
|
@@ -21339,6 +21350,7 @@ export class Listen extends Activity {
|
|
21339
21350
|
throw new TypeError("Invalid type: " + values["@type"]);
|
21340
21351
|
}
|
21341
21352
|
}
|
21353
|
+
delete values["@type"];
|
21342
21354
|
const instance = await super.fromJsonLd(values, {
|
21343
21355
|
...options,
|
21344
21356
|
// @ts-ignore: an internal option
|
@@ -21500,6 +21512,7 @@ export class Mention extends Link {
|
|
21500
21512
|
throw new TypeError("Invalid type: " + values["@type"]);
|
21501
21513
|
}
|
21502
21514
|
}
|
21515
|
+
delete values["@type"];
|
21503
21516
|
const instance = await super.fromJsonLd(values, {
|
21504
21517
|
...options,
|
21505
21518
|
// @ts-ignore: an internal option
|
@@ -21680,6 +21693,7 @@ export class Move extends Activity {
|
|
21680
21693
|
throw new TypeError("Invalid type: " + values["@type"]);
|
21681
21694
|
}
|
21682
21695
|
}
|
21696
|
+
delete values["@type"];
|
21683
21697
|
const instance = await super.fromJsonLd(values, {
|
21684
21698
|
...options,
|
21685
21699
|
// @ts-ignore: an internal option
|
@@ -21871,6 +21885,7 @@ export class Note extends Object {
|
|
21871
21885
|
throw new TypeError("Invalid type: " + values["@type"]);
|
21872
21886
|
}
|
21873
21887
|
}
|
21888
|
+
delete values["@type"];
|
21874
21889
|
const instance = await super.fromJsonLd(values, {
|
21875
21890
|
...options,
|
21876
21891
|
// @ts-ignore: an internal option
|
@@ -22186,6 +22201,7 @@ export class OrderedCollection extends Collection {
|
|
22186
22201
|
throw new TypeError("Invalid type: " + values["@type"]);
|
22187
22202
|
}
|
22188
22203
|
}
|
22204
|
+
delete values["@type"];
|
22189
22205
|
const instance = await super.fromJsonLd(values, {
|
22190
22206
|
...options,
|
22191
22207
|
// @ts-ignore: an internal option
|
@@ -22657,6 +22673,7 @@ export class OrderedCollectionPage extends CollectionPage {
|
|
22657
22673
|
throw new TypeError("Invalid type: " + values["@type"]);
|
22658
22674
|
}
|
22659
22675
|
}
|
22676
|
+
delete values["@type"];
|
22660
22677
|
const instance = await super.fromJsonLd(values, {
|
22661
22678
|
...options,
|
22662
22679
|
// @ts-ignore: an internal option
|
@@ -24591,6 +24608,7 @@ export class Organization extends Object {
|
|
24591
24608
|
throw new TypeError("Invalid type: " + values["@type"]);
|
24592
24609
|
}
|
24593
24610
|
}
|
24611
|
+
delete values["@type"];
|
24594
24612
|
const instance = await super.fromJsonLd(values, {
|
24595
24613
|
...options,
|
24596
24614
|
// @ts-ignore: an internal option
|
@@ -25254,6 +25272,7 @@ export class Page extends Document {
|
|
25254
25272
|
throw new TypeError("Invalid type: " + values["@type"]);
|
25255
25273
|
}
|
25256
25274
|
}
|
25275
|
+
delete values["@type"];
|
25257
25276
|
const instance = await super.fromJsonLd(values, {
|
25258
25277
|
...options,
|
25259
25278
|
// @ts-ignore: an internal option
|
@@ -27063,6 +27082,7 @@ export class Person extends Object {
|
|
27063
27082
|
throw new TypeError("Invalid type: " + values["@type"]);
|
27064
27083
|
}
|
27065
27084
|
}
|
27085
|
+
delete values["@type"];
|
27066
27086
|
const instance = await super.fromJsonLd(values, {
|
27067
27087
|
...options,
|
27068
27088
|
// @ts-ignore: an internal option
|
@@ -28051,6 +28071,7 @@ export class Place extends Object {
|
|
28051
28071
|
throw new TypeError("Invalid type: " + values["@type"]);
|
28052
28072
|
}
|
28053
28073
|
}
|
28074
|
+
delete values["@type"];
|
28054
28075
|
const instance = await super.fromJsonLd(values, {
|
28055
28076
|
...options,
|
28056
28077
|
// @ts-ignore: an internal option
|
@@ -28491,6 +28512,7 @@ export class Profile extends Object {
|
|
28491
28512
|
throw new TypeError("Invalid type: " + values["@type"]);
|
28492
28513
|
}
|
28493
28514
|
}
|
28515
|
+
delete values["@type"];
|
28494
28516
|
const instance = await super.fromJsonLd(values, {
|
28495
28517
|
...options,
|
28496
28518
|
// @ts-ignore: an internal option
|
@@ -29035,6 +29057,7 @@ export class Question extends IntransitiveActivity {
|
|
29035
29057
|
throw new TypeError("Invalid type: " + values["@type"]);
|
29036
29058
|
}
|
29037
29059
|
}
|
29060
|
+
delete values["@type"];
|
29038
29061
|
const instance = await super.fromJsonLd(values, {
|
29039
29062
|
...options,
|
29040
29063
|
// @ts-ignore: an internal option
|
@@ -29333,6 +29356,7 @@ export class Read extends Activity {
|
|
29333
29356
|
throw new TypeError("Invalid type: " + values["@type"]);
|
29334
29357
|
}
|
29335
29358
|
}
|
29359
|
+
delete values["@type"];
|
29336
29360
|
const instance = await super.fromJsonLd(values, {
|
29337
29361
|
...options,
|
29338
29362
|
// @ts-ignore: an internal option
|
@@ -29509,13 +29533,13 @@ export class Reject extends Activity {
|
|
29509
29533
|
}
|
29510
29534
|
if ("@type" in values) {
|
29511
29535
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeReject")) {
|
29512
|
-
|
29513
|
-
return await TentativeReject.fromJsonLd(values, options);
|
29536
|
+
return await TentativeReject.fromJsonLd(json, options);
|
29514
29537
|
}
|
29515
29538
|
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Reject")) {
|
29516
29539
|
throw new TypeError("Invalid type: " + values["@type"]);
|
29517
29540
|
}
|
29518
29541
|
}
|
29542
|
+
delete values["@type"];
|
29519
29543
|
const instance = await super.fromJsonLd(values, {
|
29520
29544
|
...options,
|
29521
29545
|
// @ts-ignore: an internal option
|
@@ -30129,6 +30153,7 @@ export class Relationship extends Object {
|
|
30129
30153
|
throw new TypeError("Invalid type: " + values["@type"]);
|
30130
30154
|
}
|
30131
30155
|
}
|
30156
|
+
delete values["@type"];
|
30132
30157
|
const instance = await super.fromJsonLd(values, {
|
30133
30158
|
...options,
|
30134
30159
|
// @ts-ignore: an internal option
|
@@ -30405,6 +30430,7 @@ export class Remove extends Activity {
|
|
30405
30430
|
throw new TypeError("Invalid type: " + values["@type"]);
|
30406
30431
|
}
|
30407
30432
|
}
|
30433
|
+
delete values["@type"];
|
30408
30434
|
const instance = await super.fromJsonLd(values, {
|
30409
30435
|
...options,
|
30410
30436
|
// @ts-ignore: an internal option
|
@@ -32214,6 +32240,7 @@ export class Service extends Object {
|
|
32214
32240
|
throw new TypeError("Invalid type: " + values["@type"]);
|
32215
32241
|
}
|
32216
32242
|
}
|
32243
|
+
delete values["@type"];
|
32217
32244
|
const instance = await super.fromJsonLd(values, {
|
32218
32245
|
...options,
|
32219
32246
|
// @ts-ignore: an internal option
|
@@ -32730,6 +32757,380 @@ export class Service extends Object {
|
|
32730
32757
|
return "Service " + inspect(proxy, options);
|
32731
32758
|
}
|
32732
32759
|
}
|
32760
|
+
/** Contents of {@link Object}'s `source`.
|
32761
|
+
*/
|
32762
|
+
export class Source {
|
32763
|
+
#documentLoader;
|
32764
|
+
#contextLoader;
|
32765
|
+
id;
|
32766
|
+
get _documentLoader() {
|
32767
|
+
return this.#documentLoader;
|
32768
|
+
}
|
32769
|
+
get _contextLoader() {
|
32770
|
+
return this.#contextLoader;
|
32771
|
+
}
|
32772
|
+
#cachedJsonLd;
|
32773
|
+
/**
|
32774
|
+
* The type URI of {@link Source}: `https://www.w3.org/ns/activitystreams#Source`.
|
32775
|
+
*/
|
32776
|
+
static get typeId() {
|
32777
|
+
return new URL("https://www.w3.org/ns/activitystreams#Source");
|
32778
|
+
}
|
32779
|
+
#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = [];
|
32780
|
+
#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [];
|
32781
|
+
/**
|
32782
|
+
* Constructs a new instance of Source with the given values.
|
32783
|
+
* @param values The values to initialize the instance with.
|
32784
|
+
* @param options The options to use for initialization.
|
32785
|
+
*/
|
32786
|
+
constructor(values, { documentLoader, contextLoader, } = {}) {
|
32787
|
+
this.#documentLoader = documentLoader;
|
32788
|
+
this.#contextLoader = contextLoader;
|
32789
|
+
if (values.id == null || values.id instanceof URL) {
|
32790
|
+
this.id = values.id ?? null;
|
32791
|
+
}
|
32792
|
+
else {
|
32793
|
+
throw new TypeError("The id must be a URL.");
|
32794
|
+
}
|
32795
|
+
if ("content" in values && values.content != null) {
|
32796
|
+
if (typeof values.content === "string" ||
|
32797
|
+
values.content instanceof LanguageString) {
|
32798
|
+
// @ts-ignore: type is checked above.
|
32799
|
+
this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = [values.content];
|
32800
|
+
}
|
32801
|
+
else {
|
32802
|
+
throw new TypeError("The content must be of type " +
|
32803
|
+
"string | LanguageString" + ".");
|
32804
|
+
}
|
32805
|
+
}
|
32806
|
+
if ("contents" in values && values.contents != null) {
|
32807
|
+
if ("content" in values &&
|
32808
|
+
values.content != null) {
|
32809
|
+
throw new TypeError("Cannot initialize both content and " +
|
32810
|
+
"contents at the same time.");
|
32811
|
+
}
|
32812
|
+
if (Array.isArray(values.contents) &&
|
32813
|
+
values.contents.every((v) => typeof v === "string" || v instanceof LanguageString)) {
|
32814
|
+
// @ts-ignore: type is checked above.
|
32815
|
+
this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = values.contents;
|
32816
|
+
}
|
32817
|
+
else {
|
32818
|
+
throw new TypeError("The contents must be an array of type " +
|
32819
|
+
"string | LanguageString" + ".");
|
32820
|
+
}
|
32821
|
+
}
|
32822
|
+
if ("mediaType" in values && values.mediaType != null) {
|
32823
|
+
if (typeof values.mediaType === "string") {
|
32824
|
+
// @ts-ignore: type is checked above.
|
32825
|
+
this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [values.mediaType];
|
32826
|
+
}
|
32827
|
+
else {
|
32828
|
+
throw new TypeError("The mediaType must be of type " +
|
32829
|
+
"string" + ".");
|
32830
|
+
}
|
32831
|
+
}
|
32832
|
+
}
|
32833
|
+
/**
|
32834
|
+
* Clones this instance, optionally updating it with the given values.
|
32835
|
+
* @param values The values to update the clone with.
|
32836
|
+
* @options The options to use for cloning.
|
32837
|
+
* @returns The cloned instance.
|
32838
|
+
*/
|
32839
|
+
clone(values = {}, options = {}) {
|
32840
|
+
// @ts-ignore: this.constructor is not recognized as a constructor, but it is.
|
32841
|
+
const clone = new this.constructor({ id: values.id ?? this.id }, options);
|
32842
|
+
clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz;
|
32843
|
+
if ("content" in values && values.content != null) {
|
32844
|
+
if (typeof values.content === "string" ||
|
32845
|
+
values.content instanceof LanguageString) {
|
32846
|
+
// @ts-ignore: type is checked above.
|
32847
|
+
clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = [values.content];
|
32848
|
+
}
|
32849
|
+
else {
|
32850
|
+
throw new TypeError("The content must be of type " +
|
32851
|
+
"string | LanguageString" + ".");
|
32852
|
+
}
|
32853
|
+
}
|
32854
|
+
if ("contents" in values && values.contents != null) {
|
32855
|
+
if ("content" in values &&
|
32856
|
+
values.content != null) {
|
32857
|
+
throw new TypeError("Cannot update both content and " +
|
32858
|
+
"contents at the same time.");
|
32859
|
+
}
|
32860
|
+
if (Array.isArray(values.contents) &&
|
32861
|
+
values.contents.every((v) => typeof v === "string" || v instanceof LanguageString)) {
|
32862
|
+
// @ts-ignore: type is checked above.
|
32863
|
+
clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = values.contents;
|
32864
|
+
}
|
32865
|
+
else {
|
32866
|
+
throw new TypeError("The contents must be an array of type " +
|
32867
|
+
"string | LanguageString" + ".");
|
32868
|
+
}
|
32869
|
+
}
|
32870
|
+
clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8;
|
32871
|
+
if ("mediaType" in values && values.mediaType != null) {
|
32872
|
+
if (typeof values.mediaType === "string") {
|
32873
|
+
// @ts-ignore: type is checked above.
|
32874
|
+
clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [values.mediaType];
|
32875
|
+
}
|
32876
|
+
else {
|
32877
|
+
throw new TypeError("The mediaType must be of type " +
|
32878
|
+
"string" + ".");
|
32879
|
+
}
|
32880
|
+
}
|
32881
|
+
return clone;
|
32882
|
+
}
|
32883
|
+
/** The source content.
|
32884
|
+
*/
|
32885
|
+
get content() {
|
32886
|
+
if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length < 1)
|
32887
|
+
return null;
|
32888
|
+
return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz[0];
|
32889
|
+
}
|
32890
|
+
/** The source content.
|
32891
|
+
*/
|
32892
|
+
get contents() {
|
32893
|
+
return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz;
|
32894
|
+
}
|
32895
|
+
/** The MIME media type of the source content.
|
32896
|
+
*/
|
32897
|
+
get mediaType() {
|
32898
|
+
if (this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8.length < 1)
|
32899
|
+
return null;
|
32900
|
+
return this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8[0];
|
32901
|
+
}
|
32902
|
+
/**
|
32903
|
+
* Converts this object to a JSON-LD structure.
|
32904
|
+
* @param options The options to use.
|
32905
|
+
* - `format`: The format of the output: `compact` or
|
32906
|
+
`expand`.
|
32907
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
32908
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
32909
|
+
when `format` is set to `'expand'`.
|
32910
|
+
* @returns The JSON-LD representation of this object.
|
32911
|
+
*/
|
32912
|
+
async toJsonLd(options = {}) {
|
32913
|
+
if (options.expand != null) {
|
32914
|
+
if (options.format != null) {
|
32915
|
+
throw new TypeError("The expand option, which is deprecated, cannot be used together " +
|
32916
|
+
"with the format option.");
|
32917
|
+
}
|
32918
|
+
getLogger(["fedify", "vocab"]).warn("The expand option is deprecated; use format: 'expand' instead.");
|
32919
|
+
options = { ...options, format: "expand", expand: undefined };
|
32920
|
+
}
|
32921
|
+
if (options.format == null && this.#cachedJsonLd != null) {
|
32922
|
+
return this.#cachedJsonLd;
|
32923
|
+
}
|
32924
|
+
if (options.format !== "compact" && options.context != null) {
|
32925
|
+
throw new TypeError("The context option can only be used when the format option is set " +
|
32926
|
+
"to 'compact'.");
|
32927
|
+
}
|
32928
|
+
options = {
|
32929
|
+
...options,
|
32930
|
+
contextLoader: options.contextLoader ?? fetchDocumentLoader,
|
32931
|
+
};
|
32932
|
+
if (options.format == null &&
|
32933
|
+
(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz == null ||
|
32934
|
+
this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length < 1)) {
|
32935
|
+
const result = {};
|
32936
|
+
// deno-lint-ignore no-unused-vars
|
32937
|
+
let compactItems;
|
32938
|
+
compactItems = [];
|
32939
|
+
for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz) {
|
32940
|
+
const item = typeof v === "string" ? v : {
|
32941
|
+
"@value": v.toString(),
|
32942
|
+
"@language": v.language.compact(),
|
32943
|
+
};
|
32944
|
+
compactItems.push(item);
|
32945
|
+
}
|
32946
|
+
if (compactItems.length > 1) {
|
32947
|
+
result["content"] = compactItems;
|
32948
|
+
}
|
32949
|
+
else if (compactItems.length === 1) {
|
32950
|
+
result["content"] = compactItems[0];
|
32951
|
+
}
|
32952
|
+
compactItems = [];
|
32953
|
+
for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8) {
|
32954
|
+
const item = v;
|
32955
|
+
compactItems.push(item);
|
32956
|
+
}
|
32957
|
+
if (compactItems.length > 1) {
|
32958
|
+
result["mediaType"] = compactItems;
|
32959
|
+
}
|
32960
|
+
else if (compactItems.length === 1) {
|
32961
|
+
result["mediaType"] = compactItems[0];
|
32962
|
+
}
|
32963
|
+
result["type"] = "as:Source";
|
32964
|
+
if (this.id != null)
|
32965
|
+
result["id"] = this.id.href;
|
32966
|
+
result["@context"] = "https://www.w3.org/ns/activitystreams";
|
32967
|
+
return result;
|
32968
|
+
}
|
32969
|
+
// deno-lint-ignore no-unused-vars prefer-const
|
32970
|
+
let array;
|
32971
|
+
const values = {};
|
32972
|
+
array = [];
|
32973
|
+
for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz) {
|
32974
|
+
const element = typeof v === "string" ? { "@value": v } : {
|
32975
|
+
"@value": v.toString(),
|
32976
|
+
"@language": v.language.compact(),
|
32977
|
+
};
|
32978
|
+
array.push(element);
|
32979
|
+
}
|
32980
|
+
if (array.length > 0) {
|
32981
|
+
values["https://www.w3.org/ns/activitystreams#content"] = array;
|
32982
|
+
}
|
32983
|
+
array = [];
|
32984
|
+
for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8) {
|
32985
|
+
const element = { "@value": v };
|
32986
|
+
array.push(element);
|
32987
|
+
}
|
32988
|
+
if (array.length > 0) {
|
32989
|
+
values["https://www.w3.org/ns/activitystreams#mediaType"] = array;
|
32990
|
+
}
|
32991
|
+
values["@type"] = ["https://www.w3.org/ns/activitystreams#Source"];
|
32992
|
+
if (this.id != null)
|
32993
|
+
values["@id"] = this.id.href;
|
32994
|
+
if (options.format === "expand") {
|
32995
|
+
return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
32996
|
+
}
|
32997
|
+
const docContext = options.context ??
|
32998
|
+
"https://www.w3.org/ns/activitystreams";
|
32999
|
+
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
33000
|
+
if (docContext != null) {
|
33001
|
+
// Embed context
|
33002
|
+
}
|
33003
|
+
return compacted;
|
33004
|
+
}
|
33005
|
+
/**
|
33006
|
+
* Converts a JSON-LD structure to an object of this type.
|
33007
|
+
* @param json The JSON-LD structure to convert.
|
33008
|
+
* @returns The object of this type.
|
33009
|
+
* @throws {TypeError} If the given `json` is invalid.
|
33010
|
+
*/
|
33011
|
+
static async fromJsonLd(json, options = {}) {
|
33012
|
+
if (typeof json === "undefined") {
|
33013
|
+
throw new TypeError("Invalid JSON-LD: undefined.");
|
33014
|
+
}
|
33015
|
+
else if (json === null)
|
33016
|
+
throw new TypeError("Invalid JSON-LD: null.");
|
33017
|
+
options = {
|
33018
|
+
...options,
|
33019
|
+
documentLoader: options.documentLoader ?? fetchDocumentLoader,
|
33020
|
+
contextLoader: options.contextLoader ?? fetchDocumentLoader,
|
33021
|
+
};
|
33022
|
+
// deno-lint-ignore no-explicit-any
|
33023
|
+
let values;
|
33024
|
+
if (globalThis.Object.keys(json).length == 0) {
|
33025
|
+
values = {};
|
33026
|
+
}
|
33027
|
+
else {
|
33028
|
+
const expanded = await jsonld.expand(json, {
|
33029
|
+
documentLoader: options.contextLoader,
|
33030
|
+
keepFreeFloatingNodes: true,
|
33031
|
+
});
|
33032
|
+
values =
|
33033
|
+
// deno-lint-ignore no-explicit-any
|
33034
|
+
(expanded[0] ?? {});
|
33035
|
+
}
|
33036
|
+
if ("@type" in values) {
|
33037
|
+
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Source")) {
|
33038
|
+
throw new TypeError("Invalid type: " + values["@type"]);
|
33039
|
+
}
|
33040
|
+
}
|
33041
|
+
const instance = new this({ id: "@id" in values ? new URL(values["@id"]) : undefined }, options);
|
33042
|
+
const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = [];
|
33043
|
+
const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz__array = values["https://www.w3.org/ns/activitystreams#content"];
|
33044
|
+
for (const v of _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz__array == null
|
33045
|
+
? []
|
33046
|
+
: _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz__array.length === 1 &&
|
33047
|
+
"@list" in _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz__array[0]
|
33048
|
+
? _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz__array[0]["@list"]
|
33049
|
+
: _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz__array) {
|
33050
|
+
if (v == null)
|
33051
|
+
continue;
|
33052
|
+
const decoded = typeof v === "object" && "@value" in v &&
|
33053
|
+
typeof v["@value"] === "string" && !("@language" in v)
|
33054
|
+
? v["@value"]
|
33055
|
+
: typeof v === "object" && "@language" in v && "@value" in v &&
|
33056
|
+
typeof v["@language"] === "string" &&
|
33057
|
+
typeof v["@value"] === "string"
|
33058
|
+
? new LanguageString(v["@value"], v["@language"])
|
33059
|
+
: undefined;
|
33060
|
+
if (typeof decoded === "undefined")
|
33061
|
+
continue;
|
33062
|
+
_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.push(decoded);
|
33063
|
+
}
|
33064
|
+
instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz;
|
33065
|
+
const _3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [];
|
33066
|
+
const _3BLrzmscsjHCw8TF5BHRW9WkPnX8__array = values["https://www.w3.org/ns/activitystreams#mediaType"];
|
33067
|
+
for (const v of _3BLrzmscsjHCw8TF5BHRW9WkPnX8__array == null
|
33068
|
+
? []
|
33069
|
+
: _3BLrzmscsjHCw8TF5BHRW9WkPnX8__array.length === 1 &&
|
33070
|
+
"@list" in _3BLrzmscsjHCw8TF5BHRW9WkPnX8__array[0]
|
33071
|
+
? _3BLrzmscsjHCw8TF5BHRW9WkPnX8__array[0]["@list"]
|
33072
|
+
: _3BLrzmscsjHCw8TF5BHRW9WkPnX8__array) {
|
33073
|
+
if (v == null)
|
33074
|
+
continue;
|
33075
|
+
_3BLrzmscsjHCw8TF5BHRW9WkPnX8.push(v["@value"]);
|
33076
|
+
}
|
33077
|
+
instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = _3BLrzmscsjHCw8TF5BHRW9WkPnX8;
|
33078
|
+
if (!("_fromSubclass" in options) || !options._fromSubclass) {
|
33079
|
+
try {
|
33080
|
+
instance.#cachedJsonLd = structuredClone(json);
|
33081
|
+
}
|
33082
|
+
catch {
|
33083
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
33084
|
+
}
|
33085
|
+
}
|
33086
|
+
return instance;
|
33087
|
+
}
|
33088
|
+
_getCustomInspectProxy() {
|
33089
|
+
const proxy = {};
|
33090
|
+
if (this.id != null) {
|
33091
|
+
proxy.id = {
|
33092
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
|
33093
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options),
|
33094
|
+
};
|
33095
|
+
}
|
33096
|
+
const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz
|
33097
|
+
// deno-lint-ignore no-explicit-any
|
33098
|
+
.map((v) => v instanceof URL
|
33099
|
+
? {
|
33100
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
33101
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
33102
|
+
}
|
33103
|
+
: v);
|
33104
|
+
if (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length == 1) {
|
33105
|
+
proxy.content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz[0];
|
33106
|
+
}
|
33107
|
+
if (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length > 1 ||
|
33108
|
+
!("content" in proxy) &&
|
33109
|
+
_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length > 0) {
|
33110
|
+
proxy.contents = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz;
|
33111
|
+
}
|
33112
|
+
const _3BLrzmscsjHCw8TF5BHRW9WkPnX8 = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8
|
33113
|
+
// deno-lint-ignore no-explicit-any
|
33114
|
+
.map((v) => v instanceof URL
|
33115
|
+
? {
|
33116
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
33117
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
33118
|
+
}
|
33119
|
+
: v);
|
33120
|
+
if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8.length == 1) {
|
33121
|
+
proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8[0];
|
33122
|
+
}
|
33123
|
+
return proxy;
|
33124
|
+
}
|
33125
|
+
[Symbol.for("Deno.customInspect")](inspect, options) {
|
33126
|
+
const proxy = this._getCustomInspectProxy();
|
33127
|
+
return "Source " + inspect(proxy, options);
|
33128
|
+
}
|
33129
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
|
33130
|
+
const proxy = this._getCustomInspectProxy();
|
33131
|
+
return "Source " + inspect(proxy, options);
|
33132
|
+
}
|
33133
|
+
}
|
32733
33134
|
/** A specialization of {@link Accept} indicating that
|
32734
33135
|
* the acceptance is tentative.
|
32735
33136
|
*/
|
@@ -32878,6 +33279,7 @@ export class TentativeAccept extends Accept {
|
|
32878
33279
|
throw new TypeError("Invalid type: " + values["@type"]);
|
32879
33280
|
}
|
32880
33281
|
}
|
33282
|
+
delete values["@type"];
|
32881
33283
|
const instance = await super.fromJsonLd(values, {
|
32882
33284
|
...options,
|
32883
33285
|
// @ts-ignore: an internal option
|
@@ -33057,6 +33459,7 @@ export class TentativeReject extends Reject {
|
|
33057
33459
|
throw new TypeError("Invalid type: " + values["@type"]);
|
33058
33460
|
}
|
33059
33461
|
}
|
33462
|
+
delete values["@type"];
|
33060
33463
|
const instance = await super.fromJsonLd(values, {
|
33061
33464
|
...options,
|
33062
33465
|
// @ts-ignore: an internal option
|
@@ -33289,6 +33692,7 @@ export class Tombstone extends Object {
|
|
33289
33692
|
throw new TypeError("Invalid type: " + values["@type"]);
|
33290
33693
|
}
|
33291
33694
|
}
|
33695
|
+
delete values["@type"];
|
33292
33696
|
const instance = await super.fromJsonLd(values, {
|
33293
33697
|
...options,
|
33294
33698
|
// @ts-ignore: an internal option
|
@@ -33494,6 +33898,7 @@ export class Travel extends IntransitiveActivity {
|
|
33494
33898
|
throw new TypeError("Invalid type: " + values["@type"]);
|
33495
33899
|
}
|
33496
33900
|
}
|
33901
|
+
delete values["@type"];
|
33497
33902
|
const instance = await super.fromJsonLd(values, {
|
33498
33903
|
...options,
|
33499
33904
|
// @ts-ignore: an internal option
|
@@ -33678,6 +34083,7 @@ export class Undo extends Activity {
|
|
33678
34083
|
throw new TypeError("Invalid type: " + values["@type"]);
|
33679
34084
|
}
|
33680
34085
|
}
|
34086
|
+
delete values["@type"];
|
33681
34087
|
const instance = await super.fromJsonLd(values, {
|
33682
34088
|
...options,
|
33683
34089
|
// @ts-ignore: an internal option
|
@@ -33876,6 +34282,7 @@ export class Update extends Activity {
|
|
33876
34282
|
throw new TypeError("Invalid type: " + values["@type"]);
|
33877
34283
|
}
|
33878
34284
|
}
|
34285
|
+
delete values["@type"];
|
33879
34286
|
const instance = await super.fromJsonLd(values, {
|
33880
34287
|
...options,
|
33881
34288
|
// @ts-ignore: an internal option
|
@@ -34054,6 +34461,7 @@ export class Video extends Document {
|
|
34054
34461
|
throw new TypeError("Invalid type: " + values["@type"]);
|
34055
34462
|
}
|
34056
34463
|
}
|
34464
|
+
delete values["@type"];
|
34057
34465
|
const instance = await super.fromJsonLd(values, {
|
34058
34466
|
...options,
|
34059
34467
|
// @ts-ignore: an internal option
|
@@ -34232,6 +34640,7 @@ export class View extends Activity {
|
|
34232
34640
|
throw new TypeError("Invalid type: " + values["@type"]);
|
34233
34641
|
}
|
34234
34642
|
}
|
34643
|
+
delete values["@type"];
|
34235
34644
|
const instance = await super.fromJsonLd(values, {
|
34236
34645
|
...options,
|
34237
34646
|
// @ts-ignore: an internal option
|