@fedify/fedify 0.11.0-dev.239 → 0.11.0-dev.241
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 +4 -0
- package/esm/federation/middleware.js +91 -0
- package/esm/vocab/application.yaml +14 -0
- package/esm/vocab/group.yaml +14 -0
- package/esm/vocab/organization.yaml +14 -0
- package/esm/vocab/person.yaml +14 -0
- package/esm/vocab/service.yaml +14 -0
- package/esm/vocab/vocab.js +565 -0
- package/package.json +1 -1
- package/types/federation/context.d.ts +16 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +13 -0
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/testing/context.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +90 -0
- package/types/vocab/vocab.d.ts.map +1 -1
package/esm/vocab/vocab.js
CHANGED
@@ -7011,6 +7011,7 @@ export class Application extends Object {
|
|
7011
7011
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
7012
7012
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
7013
7013
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
7014
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
7014
7015
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
7015
7016
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
7016
7017
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -7169,6 +7170,16 @@ export class Application extends Object {
|
|
7169
7170
|
"Collection | URL" + ".");
|
7170
7171
|
}
|
7171
7172
|
}
|
7173
|
+
if ("featured" in values && values.featured != null) {
|
7174
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
7175
|
+
// @ts-ignore: type is checked above.
|
7176
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
7177
|
+
}
|
7178
|
+
else {
|
7179
|
+
throw new TypeError("The featured must be of type " +
|
7180
|
+
"Collection | URL" + ".");
|
7181
|
+
}
|
7182
|
+
}
|
7172
7183
|
if ("streams" in values && values.streams != null) {
|
7173
7184
|
if (Array.isArray(values.streams) &&
|
7174
7185
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -7395,6 +7406,17 @@ export class Application extends Object {
|
|
7395
7406
|
"Collection | URL" + ".");
|
7396
7407
|
}
|
7397
7408
|
}
|
7409
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
7410
|
+
if ("featured" in values && values.featured != null) {
|
7411
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
7412
|
+
// @ts-ignore: type is checked above.
|
7413
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
7414
|
+
}
|
7415
|
+
else {
|
7416
|
+
throw new TypeError("The featured must be of type " +
|
7417
|
+
"Collection | URL" + ".");
|
7418
|
+
}
|
7419
|
+
}
|
7398
7420
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
7399
7421
|
if ("streams" in values && values.streams != null) {
|
7400
7422
|
if (Array.isArray(values.streams) &&
|
@@ -7968,6 +7990,64 @@ export class Application extends Object {
|
|
7968
7990
|
}
|
7969
7991
|
return v;
|
7970
7992
|
}
|
7993
|
+
async #fetchFeatured(url, options = {}) {
|
7994
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
7995
|
+
fetchDocumentLoader;
|
7996
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
7997
|
+
fetchDocumentLoader;
|
7998
|
+
let fetchResult;
|
7999
|
+
try {
|
8000
|
+
fetchResult = await documentLoader(url.href);
|
8001
|
+
}
|
8002
|
+
catch (error) {
|
8003
|
+
if (options.suppressError) {
|
8004
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
8005
|
+
return null;
|
8006
|
+
}
|
8007
|
+
throw error;
|
8008
|
+
}
|
8009
|
+
const { document } = fetchResult;
|
8010
|
+
try {
|
8011
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
8012
|
+
}
|
8013
|
+
catch (e) {
|
8014
|
+
if (!(e instanceof TypeError))
|
8015
|
+
throw e;
|
8016
|
+
}
|
8017
|
+
throw new TypeError("Expected an object of any type of: " +
|
8018
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
8019
|
+
}
|
8020
|
+
/**
|
8021
|
+
* Similar to
|
8022
|
+
* {@link Application.getFeatured},
|
8023
|
+
* but returns its `@id` URL instead of the object itself.
|
8024
|
+
*/
|
8025
|
+
get featuredId() {
|
8026
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
8027
|
+
return null;
|
8028
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
8029
|
+
if (v instanceof URL)
|
8030
|
+
return v;
|
8031
|
+
return v.id;
|
8032
|
+
}
|
8033
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
8034
|
+
* featured at the top of people's profiles, is implemented using an extra
|
8035
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
8036
|
+
* of objects.
|
8037
|
+
*/
|
8038
|
+
async getFeatured(options = {}) {
|
8039
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
8040
|
+
return null;
|
8041
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
8042
|
+
if (v instanceof URL) {
|
8043
|
+
const fetched = await this.#fetchFeatured(v, options);
|
8044
|
+
if (fetched == null)
|
8045
|
+
return null;
|
8046
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
8047
|
+
return fetched;
|
8048
|
+
}
|
8049
|
+
return v;
|
8050
|
+
}
|
7971
8051
|
async #fetchStream(url, options = {}) {
|
7972
8052
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
7973
8053
|
fetchDocumentLoader;
|
@@ -8166,6 +8246,15 @@ export class Application extends Object {
|
|
8166
8246
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
8167
8247
|
}
|
8168
8248
|
array = [];
|
8249
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
8250
|
+
const element = v instanceof URL
|
8251
|
+
? { "@id": v.href }
|
8252
|
+
: await v.toJsonLd(options);
|
8253
|
+
array.push(element);
|
8254
|
+
}
|
8255
|
+
if (array.length > 0)
|
8256
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
8257
|
+
array = [];
|
8169
8258
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
8170
8259
|
const element = v instanceof URL
|
8171
8260
|
? { "@id": v.href }
|
@@ -8230,6 +8319,7 @@ export class Application extends Object {
|
|
8230
8319
|
{
|
8231
8320
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
8232
8321
|
"toot": "http://joinmastodon.org/ns#",
|
8322
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
8233
8323
|
"discoverable": "toot:discoverable",
|
8234
8324
|
"suspended": "toot:suspended",
|
8235
8325
|
"memorial": "toot:memorial",
|
@@ -8389,6 +8479,18 @@ export class Application extends Object {
|
|
8389
8479
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
8390
8480
|
}
|
8391
8481
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
8482
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
8483
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
8484
|
+
if (v == null)
|
8485
|
+
continue;
|
8486
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
8487
|
+
globalThis.Object.keys(v).length === 1) {
|
8488
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
8489
|
+
continue;
|
8490
|
+
}
|
8491
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
8492
|
+
}
|
8493
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
8392
8494
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
8393
8495
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
8394
8496
|
if (v == null)
|
@@ -8554,6 +8656,17 @@ export class Application extends Object {
|
|
8554
8656
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
8555
8657
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
8556
8658
|
}
|
8659
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
8660
|
+
// deno-lint-ignore no-explicit-any
|
8661
|
+
.map((v) => v instanceof URL
|
8662
|
+
? {
|
8663
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
8664
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
8665
|
+
}
|
8666
|
+
: v);
|
8667
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
8668
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
8669
|
+
}
|
8557
8670
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
8558
8671
|
// deno-lint-ignore no-explicit-any
|
8559
8672
|
.map((v) => v instanceof URL
|
@@ -12083,6 +12196,7 @@ export class Group extends Object {
|
|
12083
12196
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
12084
12197
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
12085
12198
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
12199
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
12086
12200
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
12087
12201
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
12088
12202
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -12241,6 +12355,16 @@ export class Group extends Object {
|
|
12241
12355
|
"Collection | URL" + ".");
|
12242
12356
|
}
|
12243
12357
|
}
|
12358
|
+
if ("featured" in values && values.featured != null) {
|
12359
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
12360
|
+
// @ts-ignore: type is checked above.
|
12361
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
12362
|
+
}
|
12363
|
+
else {
|
12364
|
+
throw new TypeError("The featured must be of type " +
|
12365
|
+
"Collection | URL" + ".");
|
12366
|
+
}
|
12367
|
+
}
|
12244
12368
|
if ("streams" in values && values.streams != null) {
|
12245
12369
|
if (Array.isArray(values.streams) &&
|
12246
12370
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -12467,6 +12591,17 @@ export class Group extends Object {
|
|
12467
12591
|
"Collection | URL" + ".");
|
12468
12592
|
}
|
12469
12593
|
}
|
12594
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
12595
|
+
if ("featured" in values && values.featured != null) {
|
12596
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
12597
|
+
// @ts-ignore: type is checked above.
|
12598
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
12599
|
+
}
|
12600
|
+
else {
|
12601
|
+
throw new TypeError("The featured must be of type " +
|
12602
|
+
"Collection | URL" + ".");
|
12603
|
+
}
|
12604
|
+
}
|
12470
12605
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
12471
12606
|
if ("streams" in values && values.streams != null) {
|
12472
12607
|
if (Array.isArray(values.streams) &&
|
@@ -13040,6 +13175,64 @@ export class Group extends Object {
|
|
13040
13175
|
}
|
13041
13176
|
return v;
|
13042
13177
|
}
|
13178
|
+
async #fetchFeatured(url, options = {}) {
|
13179
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
13180
|
+
fetchDocumentLoader;
|
13181
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
13182
|
+
fetchDocumentLoader;
|
13183
|
+
let fetchResult;
|
13184
|
+
try {
|
13185
|
+
fetchResult = await documentLoader(url.href);
|
13186
|
+
}
|
13187
|
+
catch (error) {
|
13188
|
+
if (options.suppressError) {
|
13189
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
13190
|
+
return null;
|
13191
|
+
}
|
13192
|
+
throw error;
|
13193
|
+
}
|
13194
|
+
const { document } = fetchResult;
|
13195
|
+
try {
|
13196
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
13197
|
+
}
|
13198
|
+
catch (e) {
|
13199
|
+
if (!(e instanceof TypeError))
|
13200
|
+
throw e;
|
13201
|
+
}
|
13202
|
+
throw new TypeError("Expected an object of any type of: " +
|
13203
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
13204
|
+
}
|
13205
|
+
/**
|
13206
|
+
* Similar to
|
13207
|
+
* {@link Group.getFeatured},
|
13208
|
+
* but returns its `@id` URL instead of the object itself.
|
13209
|
+
*/
|
13210
|
+
get featuredId() {
|
13211
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
13212
|
+
return null;
|
13213
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
13214
|
+
if (v instanceof URL)
|
13215
|
+
return v;
|
13216
|
+
return v.id;
|
13217
|
+
}
|
13218
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
13219
|
+
* featured at the top of people's profiles, is implemented using an extra
|
13220
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
13221
|
+
* of objects.
|
13222
|
+
*/
|
13223
|
+
async getFeatured(options = {}) {
|
13224
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
13225
|
+
return null;
|
13226
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
13227
|
+
if (v instanceof URL) {
|
13228
|
+
const fetched = await this.#fetchFeatured(v, options);
|
13229
|
+
if (fetched == null)
|
13230
|
+
return null;
|
13231
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
13232
|
+
return fetched;
|
13233
|
+
}
|
13234
|
+
return v;
|
13235
|
+
}
|
13043
13236
|
async #fetchStream(url, options = {}) {
|
13044
13237
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
13045
13238
|
fetchDocumentLoader;
|
@@ -13238,6 +13431,15 @@ export class Group extends Object {
|
|
13238
13431
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
13239
13432
|
}
|
13240
13433
|
array = [];
|
13434
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
13435
|
+
const element = v instanceof URL
|
13436
|
+
? { "@id": v.href }
|
13437
|
+
: await v.toJsonLd(options);
|
13438
|
+
array.push(element);
|
13439
|
+
}
|
13440
|
+
if (array.length > 0)
|
13441
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
13442
|
+
array = [];
|
13241
13443
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
13242
13444
|
const element = v instanceof URL
|
13243
13445
|
? { "@id": v.href }
|
@@ -13302,6 +13504,7 @@ export class Group extends Object {
|
|
13302
13504
|
{
|
13303
13505
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
13304
13506
|
"toot": "http://joinmastodon.org/ns#",
|
13507
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
13305
13508
|
"discoverable": "toot:discoverable",
|
13306
13509
|
"suspended": "toot:suspended",
|
13307
13510
|
"memorial": "toot:memorial",
|
@@ -13461,6 +13664,18 @@ export class Group extends Object {
|
|
13461
13664
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
13462
13665
|
}
|
13463
13666
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
13667
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
13668
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
13669
|
+
if (v == null)
|
13670
|
+
continue;
|
13671
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
13672
|
+
globalThis.Object.keys(v).length === 1) {
|
13673
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
13674
|
+
continue;
|
13675
|
+
}
|
13676
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
13677
|
+
}
|
13678
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
13464
13679
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
13465
13680
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
13466
13681
|
if (v == null)
|
@@ -13626,6 +13841,17 @@ export class Group extends Object {
|
|
13626
13841
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
13627
13842
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
13628
13843
|
}
|
13844
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
13845
|
+
// deno-lint-ignore no-explicit-any
|
13846
|
+
.map((v) => v instanceof URL
|
13847
|
+
? {
|
13848
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
13849
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
13850
|
+
}
|
13851
|
+
: v);
|
13852
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
13853
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
13854
|
+
}
|
13629
13855
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
13630
13856
|
// deno-lint-ignore no-explicit-any
|
13631
13857
|
.map((v) => v instanceof URL
|
@@ -15495,6 +15721,7 @@ export class Organization extends Object {
|
|
15495
15721
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
15496
15722
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
15497
15723
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
15724
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
15498
15725
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
15499
15726
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
15500
15727
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -15653,6 +15880,16 @@ export class Organization extends Object {
|
|
15653
15880
|
"Collection | URL" + ".");
|
15654
15881
|
}
|
15655
15882
|
}
|
15883
|
+
if ("featured" in values && values.featured != null) {
|
15884
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
15885
|
+
// @ts-ignore: type is checked above.
|
15886
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
15887
|
+
}
|
15888
|
+
else {
|
15889
|
+
throw new TypeError("The featured must be of type " +
|
15890
|
+
"Collection | URL" + ".");
|
15891
|
+
}
|
15892
|
+
}
|
15656
15893
|
if ("streams" in values && values.streams != null) {
|
15657
15894
|
if (Array.isArray(values.streams) &&
|
15658
15895
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -15879,6 +16116,17 @@ export class Organization extends Object {
|
|
15879
16116
|
"Collection | URL" + ".");
|
15880
16117
|
}
|
15881
16118
|
}
|
16119
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
16120
|
+
if ("featured" in values && values.featured != null) {
|
16121
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
16122
|
+
// @ts-ignore: type is checked above.
|
16123
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
16124
|
+
}
|
16125
|
+
else {
|
16126
|
+
throw new TypeError("The featured must be of type " +
|
16127
|
+
"Collection | URL" + ".");
|
16128
|
+
}
|
16129
|
+
}
|
15882
16130
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
15883
16131
|
if ("streams" in values && values.streams != null) {
|
15884
16132
|
if (Array.isArray(values.streams) &&
|
@@ -16452,6 +16700,64 @@ export class Organization extends Object {
|
|
16452
16700
|
}
|
16453
16701
|
return v;
|
16454
16702
|
}
|
16703
|
+
async #fetchFeatured(url, options = {}) {
|
16704
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
16705
|
+
fetchDocumentLoader;
|
16706
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
16707
|
+
fetchDocumentLoader;
|
16708
|
+
let fetchResult;
|
16709
|
+
try {
|
16710
|
+
fetchResult = await documentLoader(url.href);
|
16711
|
+
}
|
16712
|
+
catch (error) {
|
16713
|
+
if (options.suppressError) {
|
16714
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
16715
|
+
return null;
|
16716
|
+
}
|
16717
|
+
throw error;
|
16718
|
+
}
|
16719
|
+
const { document } = fetchResult;
|
16720
|
+
try {
|
16721
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
16722
|
+
}
|
16723
|
+
catch (e) {
|
16724
|
+
if (!(e instanceof TypeError))
|
16725
|
+
throw e;
|
16726
|
+
}
|
16727
|
+
throw new TypeError("Expected an object of any type of: " +
|
16728
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
16729
|
+
}
|
16730
|
+
/**
|
16731
|
+
* Similar to
|
16732
|
+
* {@link Organization.getFeatured},
|
16733
|
+
* but returns its `@id` URL instead of the object itself.
|
16734
|
+
*/
|
16735
|
+
get featuredId() {
|
16736
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
16737
|
+
return null;
|
16738
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
16739
|
+
if (v instanceof URL)
|
16740
|
+
return v;
|
16741
|
+
return v.id;
|
16742
|
+
}
|
16743
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
16744
|
+
* featured at the top of people's profiles, is implemented using an extra
|
16745
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
16746
|
+
* of objects.
|
16747
|
+
*/
|
16748
|
+
async getFeatured(options = {}) {
|
16749
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
16750
|
+
return null;
|
16751
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
16752
|
+
if (v instanceof URL) {
|
16753
|
+
const fetched = await this.#fetchFeatured(v, options);
|
16754
|
+
if (fetched == null)
|
16755
|
+
return null;
|
16756
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
16757
|
+
return fetched;
|
16758
|
+
}
|
16759
|
+
return v;
|
16760
|
+
}
|
16455
16761
|
async #fetchStream(url, options = {}) {
|
16456
16762
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
16457
16763
|
fetchDocumentLoader;
|
@@ -16650,6 +16956,15 @@ export class Organization extends Object {
|
|
16650
16956
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
16651
16957
|
}
|
16652
16958
|
array = [];
|
16959
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
16960
|
+
const element = v instanceof URL
|
16961
|
+
? { "@id": v.href }
|
16962
|
+
: await v.toJsonLd(options);
|
16963
|
+
array.push(element);
|
16964
|
+
}
|
16965
|
+
if (array.length > 0)
|
16966
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
16967
|
+
array = [];
|
16653
16968
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
16654
16969
|
const element = v instanceof URL
|
16655
16970
|
? { "@id": v.href }
|
@@ -16714,6 +17029,7 @@ export class Organization extends Object {
|
|
16714
17029
|
{
|
16715
17030
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
16716
17031
|
"toot": "http://joinmastodon.org/ns#",
|
17032
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
16717
17033
|
"discoverable": "toot:discoverable",
|
16718
17034
|
"suspended": "toot:suspended",
|
16719
17035
|
"memorial": "toot:memorial",
|
@@ -16873,6 +17189,18 @@ export class Organization extends Object {
|
|
16873
17189
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
16874
17190
|
}
|
16875
17191
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
17192
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
17193
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
17194
|
+
if (v == null)
|
17195
|
+
continue;
|
17196
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
17197
|
+
globalThis.Object.keys(v).length === 1) {
|
17198
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
17199
|
+
continue;
|
17200
|
+
}
|
17201
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
17202
|
+
}
|
17203
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
16876
17204
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
16877
17205
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
16878
17206
|
if (v == null)
|
@@ -17038,6 +17366,17 @@ export class Organization extends Object {
|
|
17038
17366
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
17039
17367
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
17040
17368
|
}
|
17369
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
17370
|
+
// deno-lint-ignore no-explicit-any
|
17371
|
+
.map((v) => v instanceof URL
|
17372
|
+
? {
|
17373
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
17374
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
17375
|
+
}
|
17376
|
+
: v);
|
17377
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
17378
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
17379
|
+
}
|
17041
17380
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
17042
17381
|
// deno-lint-ignore no-explicit-any
|
17043
17382
|
.map((v) => v instanceof URL
|
@@ -17245,6 +17584,7 @@ export class Person extends Object {
|
|
17245
17584
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
17246
17585
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
17247
17586
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
17587
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
17248
17588
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
17249
17589
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
17250
17590
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -17403,6 +17743,16 @@ export class Person extends Object {
|
|
17403
17743
|
"Collection | URL" + ".");
|
17404
17744
|
}
|
17405
17745
|
}
|
17746
|
+
if ("featured" in values && values.featured != null) {
|
17747
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
17748
|
+
// @ts-ignore: type is checked above.
|
17749
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
17750
|
+
}
|
17751
|
+
else {
|
17752
|
+
throw new TypeError("The featured must be of type " +
|
17753
|
+
"Collection | URL" + ".");
|
17754
|
+
}
|
17755
|
+
}
|
17406
17756
|
if ("streams" in values && values.streams != null) {
|
17407
17757
|
if (Array.isArray(values.streams) &&
|
17408
17758
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -17629,6 +17979,17 @@ export class Person extends Object {
|
|
17629
17979
|
"Collection | URL" + ".");
|
17630
17980
|
}
|
17631
17981
|
}
|
17982
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
17983
|
+
if ("featured" in values && values.featured != null) {
|
17984
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
17985
|
+
// @ts-ignore: type is checked above.
|
17986
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
17987
|
+
}
|
17988
|
+
else {
|
17989
|
+
throw new TypeError("The featured must be of type " +
|
17990
|
+
"Collection | URL" + ".");
|
17991
|
+
}
|
17992
|
+
}
|
17632
17993
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
17633
17994
|
if ("streams" in values && values.streams != null) {
|
17634
17995
|
if (Array.isArray(values.streams) &&
|
@@ -18202,6 +18563,64 @@ export class Person extends Object {
|
|
18202
18563
|
}
|
18203
18564
|
return v;
|
18204
18565
|
}
|
18566
|
+
async #fetchFeatured(url, options = {}) {
|
18567
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
18568
|
+
fetchDocumentLoader;
|
18569
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
18570
|
+
fetchDocumentLoader;
|
18571
|
+
let fetchResult;
|
18572
|
+
try {
|
18573
|
+
fetchResult = await documentLoader(url.href);
|
18574
|
+
}
|
18575
|
+
catch (error) {
|
18576
|
+
if (options.suppressError) {
|
18577
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
18578
|
+
return null;
|
18579
|
+
}
|
18580
|
+
throw error;
|
18581
|
+
}
|
18582
|
+
const { document } = fetchResult;
|
18583
|
+
try {
|
18584
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
18585
|
+
}
|
18586
|
+
catch (e) {
|
18587
|
+
if (!(e instanceof TypeError))
|
18588
|
+
throw e;
|
18589
|
+
}
|
18590
|
+
throw new TypeError("Expected an object of any type of: " +
|
18591
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
18592
|
+
}
|
18593
|
+
/**
|
18594
|
+
* Similar to
|
18595
|
+
* {@link Person.getFeatured},
|
18596
|
+
* but returns its `@id` URL instead of the object itself.
|
18597
|
+
*/
|
18598
|
+
get featuredId() {
|
18599
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
18600
|
+
return null;
|
18601
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
18602
|
+
if (v instanceof URL)
|
18603
|
+
return v;
|
18604
|
+
return v.id;
|
18605
|
+
}
|
18606
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
18607
|
+
* featured at the top of people's profiles, is implemented using an extra
|
18608
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
18609
|
+
* of objects.
|
18610
|
+
*/
|
18611
|
+
async getFeatured(options = {}) {
|
18612
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
18613
|
+
return null;
|
18614
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
18615
|
+
if (v instanceof URL) {
|
18616
|
+
const fetched = await this.#fetchFeatured(v, options);
|
18617
|
+
if (fetched == null)
|
18618
|
+
return null;
|
18619
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
18620
|
+
return fetched;
|
18621
|
+
}
|
18622
|
+
return v;
|
18623
|
+
}
|
18205
18624
|
async #fetchStream(url, options = {}) {
|
18206
18625
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
18207
18626
|
fetchDocumentLoader;
|
@@ -18400,6 +18819,15 @@ export class Person extends Object {
|
|
18400
18819
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
18401
18820
|
}
|
18402
18821
|
array = [];
|
18822
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
18823
|
+
const element = v instanceof URL
|
18824
|
+
? { "@id": v.href }
|
18825
|
+
: await v.toJsonLd(options);
|
18826
|
+
array.push(element);
|
18827
|
+
}
|
18828
|
+
if (array.length > 0)
|
18829
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
18830
|
+
array = [];
|
18403
18831
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
18404
18832
|
const element = v instanceof URL
|
18405
18833
|
? { "@id": v.href }
|
@@ -18464,6 +18892,7 @@ export class Person extends Object {
|
|
18464
18892
|
{
|
18465
18893
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
18466
18894
|
"toot": "http://joinmastodon.org/ns#",
|
18895
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
18467
18896
|
"discoverable": "toot:discoverable",
|
18468
18897
|
"suspended": "toot:suspended",
|
18469
18898
|
"memorial": "toot:memorial",
|
@@ -18623,6 +19052,18 @@ export class Person extends Object {
|
|
18623
19052
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
18624
19053
|
}
|
18625
19054
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
19055
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
19056
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
19057
|
+
if (v == null)
|
19058
|
+
continue;
|
19059
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
19060
|
+
globalThis.Object.keys(v).length === 1) {
|
19061
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
19062
|
+
continue;
|
19063
|
+
}
|
19064
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
19065
|
+
}
|
19066
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
18626
19067
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
18627
19068
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
18628
19069
|
if (v == null)
|
@@ -18788,6 +19229,17 @@ export class Person extends Object {
|
|
18788
19229
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
18789
19230
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
18790
19231
|
}
|
19232
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
19233
|
+
// deno-lint-ignore no-explicit-any
|
19234
|
+
.map((v) => v instanceof URL
|
19235
|
+
? {
|
19236
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
19237
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
19238
|
+
}
|
19239
|
+
: v);
|
19240
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
19241
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
19242
|
+
}
|
18791
19243
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
18792
19244
|
// deno-lint-ignore no-explicit-any
|
18793
19245
|
.map((v) => v instanceof URL
|
@@ -20745,6 +21197,7 @@ export class Service extends Object {
|
|
20745
21197
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
20746
21198
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
20747
21199
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
21200
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
20748
21201
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
20749
21202
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
20750
21203
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -20903,6 +21356,16 @@ export class Service extends Object {
|
|
20903
21356
|
"Collection | URL" + ".");
|
20904
21357
|
}
|
20905
21358
|
}
|
21359
|
+
if ("featured" in values && values.featured != null) {
|
21360
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
21361
|
+
// @ts-ignore: type is checked above.
|
21362
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
21363
|
+
}
|
21364
|
+
else {
|
21365
|
+
throw new TypeError("The featured must be of type " +
|
21366
|
+
"Collection | URL" + ".");
|
21367
|
+
}
|
21368
|
+
}
|
20906
21369
|
if ("streams" in values && values.streams != null) {
|
20907
21370
|
if (Array.isArray(values.streams) &&
|
20908
21371
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -21129,6 +21592,17 @@ export class Service extends Object {
|
|
21129
21592
|
"Collection | URL" + ".");
|
21130
21593
|
}
|
21131
21594
|
}
|
21595
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
21596
|
+
if ("featured" in values && values.featured != null) {
|
21597
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
21598
|
+
// @ts-ignore: type is checked above.
|
21599
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
21600
|
+
}
|
21601
|
+
else {
|
21602
|
+
throw new TypeError("The featured must be of type " +
|
21603
|
+
"Collection | URL" + ".");
|
21604
|
+
}
|
21605
|
+
}
|
21132
21606
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
21133
21607
|
if ("streams" in values && values.streams != null) {
|
21134
21608
|
if (Array.isArray(values.streams) &&
|
@@ -21702,6 +22176,64 @@ export class Service extends Object {
|
|
21702
22176
|
}
|
21703
22177
|
return v;
|
21704
22178
|
}
|
22179
|
+
async #fetchFeatured(url, options = {}) {
|
22180
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
22181
|
+
fetchDocumentLoader;
|
22182
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
22183
|
+
fetchDocumentLoader;
|
22184
|
+
let fetchResult;
|
22185
|
+
try {
|
22186
|
+
fetchResult = await documentLoader(url.href);
|
22187
|
+
}
|
22188
|
+
catch (error) {
|
22189
|
+
if (options.suppressError) {
|
22190
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
22191
|
+
return null;
|
22192
|
+
}
|
22193
|
+
throw error;
|
22194
|
+
}
|
22195
|
+
const { document } = fetchResult;
|
22196
|
+
try {
|
22197
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
22198
|
+
}
|
22199
|
+
catch (e) {
|
22200
|
+
if (!(e instanceof TypeError))
|
22201
|
+
throw e;
|
22202
|
+
}
|
22203
|
+
throw new TypeError("Expected an object of any type of: " +
|
22204
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
22205
|
+
}
|
22206
|
+
/**
|
22207
|
+
* Similar to
|
22208
|
+
* {@link Service.getFeatured},
|
22209
|
+
* but returns its `@id` URL instead of the object itself.
|
22210
|
+
*/
|
22211
|
+
get featuredId() {
|
22212
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
22213
|
+
return null;
|
22214
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
22215
|
+
if (v instanceof URL)
|
22216
|
+
return v;
|
22217
|
+
return v.id;
|
22218
|
+
}
|
22219
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
22220
|
+
* featured at the top of people's profiles, is implemented using an extra
|
22221
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
22222
|
+
* of objects.
|
22223
|
+
*/
|
22224
|
+
async getFeatured(options = {}) {
|
22225
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
22226
|
+
return null;
|
22227
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
22228
|
+
if (v instanceof URL) {
|
22229
|
+
const fetched = await this.#fetchFeatured(v, options);
|
22230
|
+
if (fetched == null)
|
22231
|
+
return null;
|
22232
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
22233
|
+
return fetched;
|
22234
|
+
}
|
22235
|
+
return v;
|
22236
|
+
}
|
21705
22237
|
async #fetchStream(url, options = {}) {
|
21706
22238
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
21707
22239
|
fetchDocumentLoader;
|
@@ -21900,6 +22432,15 @@ export class Service extends Object {
|
|
21900
22432
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
21901
22433
|
}
|
21902
22434
|
array = [];
|
22435
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
22436
|
+
const element = v instanceof URL
|
22437
|
+
? { "@id": v.href }
|
22438
|
+
: await v.toJsonLd(options);
|
22439
|
+
array.push(element);
|
22440
|
+
}
|
22441
|
+
if (array.length > 0)
|
22442
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
22443
|
+
array = [];
|
21903
22444
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
21904
22445
|
const element = v instanceof URL
|
21905
22446
|
? { "@id": v.href }
|
@@ -21964,6 +22505,7 @@ export class Service extends Object {
|
|
21964
22505
|
{
|
21965
22506
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
21966
22507
|
"toot": "http://joinmastodon.org/ns#",
|
22508
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
21967
22509
|
"discoverable": "toot:discoverable",
|
21968
22510
|
"suspended": "toot:suspended",
|
21969
22511
|
"memorial": "toot:memorial",
|
@@ -22123,6 +22665,18 @@ export class Service extends Object {
|
|
22123
22665
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
22124
22666
|
}
|
22125
22667
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
22668
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
22669
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
22670
|
+
if (v == null)
|
22671
|
+
continue;
|
22672
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
22673
|
+
globalThis.Object.keys(v).length === 1) {
|
22674
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
22675
|
+
continue;
|
22676
|
+
}
|
22677
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
22678
|
+
}
|
22679
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
22126
22680
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
22127
22681
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
22128
22682
|
if (v == null)
|
@@ -22288,6 +22842,17 @@ export class Service extends Object {
|
|
22288
22842
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
22289
22843
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
22290
22844
|
}
|
22845
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
22846
|
+
// deno-lint-ignore no-explicit-any
|
22847
|
+
.map((v) => v instanceof URL
|
22848
|
+
? {
|
22849
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
22850
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
22851
|
+
}
|
22852
|
+
: v);
|
22853
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
22854
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
22855
|
+
}
|
22291
22856
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
22292
22857
|
// deno-lint-ignore no-explicit-any
|
22293
22858
|
.map((v) => v instanceof URL
|