@fedify/fedify 0.11.0-dev.245 → 0.11.0-dev.250
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 +1 -64
- package/esm/federation/handler.js +2 -2
- package/esm/federation/middleware.js +0 -80
- package/esm/sig/proof.js +16 -6
- package/esm/vocab/application.yaml +0 -14
- package/esm/vocab/collection.yaml +1 -8
- package/esm/vocab/collectionpage.yaml +1 -7
- package/esm/vocab/group.yaml +0 -14
- package/esm/vocab/orderedcollection.yaml +1 -8
- package/esm/vocab/orderedcollectionpage.yaml +1 -7
- package/esm/vocab/organization.yaml +0 -14
- package/esm/vocab/person.yaml +0 -14
- package/esm/vocab/service.yaml +0 -14
- package/esm/vocab/vocab.js +22 -814
- package/package.json +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_dumper/dumper.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_dumper/dumper_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_error.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_loader/loader.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_loader/loader_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_mark.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/binary.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/bool.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/float.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/function.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/int.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/map.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/merge.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/nil.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/omap.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/pairs.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/regexp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/seq.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/set.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/str.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/timestamp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_type/undefined.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/_utils.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.3/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/schema/core.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/schema/default.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/schema/extended.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/schema/failsafe.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/schema/json.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.3/schema/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/schema.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.3/stringify.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{0.224.2 → 0.224.3}/type.d.ts.map +1 -1
- package/types/federation/context.d.ts +0 -17
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/handler.d.ts +2 -2
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +1 -14
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/sig/proof.d.ts +1 -1
- package/types/sig/proof.d.ts.map +1 -1
- package/types/testing/context.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +10 -100
- package/types/vocab/vocab.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.2/parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/yaml/0.224.2/schema/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/yaml/0.224.2/stringify.d.ts.map +0 -1
package/esm/vocab/vocab.js
CHANGED
|
@@ -7994,7 +7994,6 @@ export class Application extends Object {
|
|
|
7994
7994
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
|
7995
7995
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
|
7996
7996
|
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
|
7997
|
-
#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
7998
7997
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
7999
7998
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
|
8000
7999
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
|
@@ -8163,17 +8162,6 @@ export class Application extends Object {
|
|
|
8163
8162
|
"Collection | URL" + ".");
|
|
8164
8163
|
}
|
|
8165
8164
|
}
|
|
8166
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
8167
|
-
if (values.featuredTags instanceof Collection ||
|
|
8168
|
-
values.featuredTags instanceof URL) {
|
|
8169
|
-
// @ts-ignore: type is checked above.
|
|
8170
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
8171
|
-
}
|
|
8172
|
-
else {
|
|
8173
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
8174
|
-
"Collection | URL" + ".");
|
|
8175
|
-
}
|
|
8176
|
-
}
|
|
8177
8165
|
if ("streams" in values && values.streams != null) {
|
|
8178
8166
|
if (Array.isArray(values.streams) &&
|
|
8179
8167
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
|
@@ -8411,18 +8399,6 @@ export class Application extends Object {
|
|
|
8411
8399
|
"Collection | URL" + ".");
|
|
8412
8400
|
}
|
|
8413
8401
|
}
|
|
8414
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
8415
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
8416
|
-
if (values.featuredTags instanceof Collection ||
|
|
8417
|
-
values.featuredTags instanceof URL) {
|
|
8418
|
-
// @ts-ignore: type is checked above.
|
|
8419
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
8420
|
-
}
|
|
8421
|
-
else {
|
|
8422
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
8423
|
-
"Collection | URL" + ".");
|
|
8424
|
-
}
|
|
8425
|
-
}
|
|
8426
8402
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
|
8427
8403
|
if ("streams" in values && values.streams != null) {
|
|
8428
8404
|
if (Array.isArray(values.streams) &&
|
|
@@ -9054,64 +9030,6 @@ export class Application extends Object {
|
|
|
9054
9030
|
}
|
|
9055
9031
|
return v;
|
|
9056
9032
|
}
|
|
9057
|
-
async #fetchFeaturedTags(url, options = {}) {
|
|
9058
|
-
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
9059
|
-
fetchDocumentLoader;
|
|
9060
|
-
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
|
9061
|
-
fetchDocumentLoader;
|
|
9062
|
-
let fetchResult;
|
|
9063
|
-
try {
|
|
9064
|
-
fetchResult = await documentLoader(url.href);
|
|
9065
|
-
}
|
|
9066
|
-
catch (error) {
|
|
9067
|
-
if (options.suppressError) {
|
|
9068
|
-
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
|
9069
|
-
return null;
|
|
9070
|
-
}
|
|
9071
|
-
throw error;
|
|
9072
|
-
}
|
|
9073
|
-
const { document } = fetchResult;
|
|
9074
|
-
try {
|
|
9075
|
-
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
|
9076
|
-
}
|
|
9077
|
-
catch (e) {
|
|
9078
|
-
if (!(e instanceof TypeError))
|
|
9079
|
-
throw e;
|
|
9080
|
-
}
|
|
9081
|
-
throw new TypeError("Expected an object of any type of: " +
|
|
9082
|
-
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
|
9083
|
-
}
|
|
9084
|
-
/**
|
|
9085
|
-
* Similar to
|
|
9086
|
-
* {@link Application.getFeaturedTags},
|
|
9087
|
-
* but returns its `@id` URL instead of the object itself.
|
|
9088
|
-
*/
|
|
9089
|
-
get featuredTagsId() {
|
|
9090
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
9091
|
-
return null;
|
|
9092
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
9093
|
-
if (v instanceof URL)
|
|
9094
|
-
return v;
|
|
9095
|
-
return v.id;
|
|
9096
|
-
}
|
|
9097
|
-
/** What is known in Mastodon as "featured hashtags", hashtags that are featured
|
|
9098
|
-
* at people's profiles, is implemented using an extra property `featuredTags`
|
|
9099
|
-
* on the actor object that points to a {@link Collection} of {@link Hashtag}
|
|
9100
|
-
* objects specifically.
|
|
9101
|
-
*/
|
|
9102
|
-
async getFeaturedTags(options = {}) {
|
|
9103
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
9104
|
-
return null;
|
|
9105
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
9106
|
-
if (v instanceof URL) {
|
|
9107
|
-
const fetched = await this.#fetchFeaturedTags(v, options);
|
|
9108
|
-
if (fetched == null)
|
|
9109
|
-
return null;
|
|
9110
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0] = fetched;
|
|
9111
|
-
return fetched;
|
|
9112
|
-
}
|
|
9113
|
-
return v;
|
|
9114
|
-
}
|
|
9115
9033
|
async #fetchStream(url, options = {}) {
|
|
9116
9034
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
9117
9035
|
fetchDocumentLoader;
|
|
@@ -9322,16 +9240,6 @@ export class Application extends Object {
|
|
|
9322
9240
|
values["http://joinmastodon.org/ns#featured"] = array;
|
|
9323
9241
|
}
|
|
9324
9242
|
array = [];
|
|
9325
|
-
for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac) {
|
|
9326
|
-
const element = v instanceof URL
|
|
9327
|
-
? { "@id": v.href }
|
|
9328
|
-
: await v.toJsonLd(options);
|
|
9329
|
-
array.push(element);
|
|
9330
|
-
}
|
|
9331
|
-
if (array.length > 0) {
|
|
9332
|
-
values["http://joinmastodon.org/ns#featuredTags"] = array;
|
|
9333
|
-
}
|
|
9334
|
-
array = [];
|
|
9335
9243
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
|
9336
9244
|
const element = v instanceof URL
|
|
9337
9245
|
? { "@id": v.href }
|
|
@@ -9398,7 +9306,6 @@ export class Application extends Object {
|
|
|
9398
9306
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
|
9399
9307
|
"toot": "http://joinmastodon.org/ns#",
|
|
9400
9308
|
"featured": { "@id": "toot:featured", "@type": "@id" },
|
|
9401
|
-
"featuredTags": { "@id": "toot:featuredTags", "@type": "@id" },
|
|
9402
9309
|
"discoverable": "toot:discoverable",
|
|
9403
9310
|
"suspended": "toot:suspended",
|
|
9404
9311
|
"memorial": "toot:memorial",
|
|
@@ -9629,24 +9536,6 @@ export class Application extends Object {
|
|
|
9629
9536
|
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
|
9630
9537
|
}
|
|
9631
9538
|
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
|
9632
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
9633
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array = values["http://joinmastodon.org/ns#featuredTags"];
|
|
9634
|
-
for (const v of _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array == null
|
|
9635
|
-
? []
|
|
9636
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array.length === 1 &&
|
|
9637
|
-
"@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]
|
|
9638
|
-
? _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]["@list"]
|
|
9639
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array) {
|
|
9640
|
-
if (v == null)
|
|
9641
|
-
continue;
|
|
9642
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
9643
|
-
globalThis.Object.keys(v).length === 1) {
|
|
9644
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(new URL(v["@id"]));
|
|
9645
|
-
continue;
|
|
9646
|
-
}
|
|
9647
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(await Collection.fromJsonLd(v, options));
|
|
9648
|
-
}
|
|
9649
|
-
instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = _2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
9650
9539
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
9651
9540
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array = values["https://www.w3.org/ns/activitystreams#streams"];
|
|
9652
9541
|
for (const v of _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array == null
|
|
@@ -9859,17 +9748,6 @@ export class Application extends Object {
|
|
|
9859
9748
|
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
|
9860
9749
|
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
|
9861
9750
|
}
|
|
9862
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac
|
|
9863
|
-
// deno-lint-ignore no-explicit-any
|
|
9864
|
-
.map((v) => v instanceof URL
|
|
9865
|
-
? {
|
|
9866
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
9867
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
|
9868
|
-
}
|
|
9869
|
-
: v);
|
|
9870
|
-
if (_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length == 1) {
|
|
9871
|
-
proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
9872
|
-
}
|
|
9873
9751
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
|
9874
9752
|
// deno-lint-ignore no-explicit-any
|
|
9875
9753
|
.map((v) => v instanceof URL
|
|
@@ -10966,13 +10844,13 @@ export class Collection extends Object {
|
|
|
10966
10844
|
}
|
|
10967
10845
|
if ("items" in values && values.items != null) {
|
|
10968
10846
|
if (Array.isArray(values.items) &&
|
|
10969
|
-
values.items.every((v) => v instanceof Object || v instanceof
|
|
10847
|
+
values.items.every((v) => v instanceof Object || v instanceof URL)) {
|
|
10970
10848
|
// @ts-ignore: type is checked above.
|
|
10971
10849
|
this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
|
|
10972
10850
|
}
|
|
10973
10851
|
else {
|
|
10974
10852
|
throw new TypeError("The items must be an array of type " +
|
|
10975
|
-
"Object |
|
|
10853
|
+
"Object | URL" + ".");
|
|
10976
10854
|
}
|
|
10977
10855
|
}
|
|
10978
10856
|
}
|
|
@@ -11033,13 +10911,13 @@ export class Collection extends Object {
|
|
|
11033
10911
|
clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
|
|
11034
10912
|
if ("items" in values && values.items != null) {
|
|
11035
10913
|
if (Array.isArray(values.items) &&
|
|
11036
|
-
values.items.every((v) => v instanceof Object || v instanceof
|
|
10914
|
+
values.items.every((v) => v instanceof Object || v instanceof URL)) {
|
|
11037
10915
|
// @ts-ignore: type is checked above.
|
|
11038
10916
|
clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
|
|
11039
10917
|
}
|
|
11040
10918
|
else {
|
|
11041
10919
|
throw new TypeError("The items must be an array of type " +
|
|
11042
|
-
"Object |
|
|
10920
|
+
"Object | URL" + ".");
|
|
11043
10921
|
}
|
|
11044
10922
|
}
|
|
11045
10923
|
return clone;
|
|
@@ -11245,18 +11123,8 @@ export class Collection extends Object {
|
|
|
11245
11123
|
if (!(e instanceof TypeError))
|
|
11246
11124
|
throw e;
|
|
11247
11125
|
}
|
|
11248
|
-
try {
|
|
11249
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
|
11250
|
-
}
|
|
11251
|
-
catch (e) {
|
|
11252
|
-
if (!(e instanceof TypeError))
|
|
11253
|
-
throw e;
|
|
11254
|
-
}
|
|
11255
11126
|
throw new TypeError("Expected an object of any type of: " +
|
|
11256
|
-
[
|
|
11257
|
-
"https://www.w3.org/ns/activitystreams#Object",
|
|
11258
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
|
11259
|
-
].join(", "));
|
|
11127
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
|
11260
11128
|
}
|
|
11261
11129
|
/**
|
|
11262
11130
|
* Similar to
|
|
@@ -11345,9 +11213,7 @@ export class Collection extends Object {
|
|
|
11345
11213
|
for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg) {
|
|
11346
11214
|
const element = v instanceof URL
|
|
11347
11215
|
? { "@id": v.href }
|
|
11348
|
-
: v
|
|
11349
|
-
? await v.toJsonLd(options)
|
|
11350
|
-
: await v.toJsonLd(options);
|
|
11216
|
+
: await v.toJsonLd(options);
|
|
11351
11217
|
array.push(element);
|
|
11352
11218
|
}
|
|
11353
11219
|
if (array.length > 0) {
|
|
@@ -11359,17 +11225,7 @@ export class Collection extends Object {
|
|
|
11359
11225
|
if (options.expand) {
|
|
11360
11226
|
return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
11361
11227
|
}
|
|
11362
|
-
return await jsonld.compact(values, options.context ??
|
|
11363
|
-
[
|
|
11364
|
-
"https://www.w3.org/ns/activitystreams",
|
|
11365
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
11366
|
-
{
|
|
11367
|
-
"toot": "http://joinmastodon.org/ns#",
|
|
11368
|
-
"sensitive": "as:sensitive",
|
|
11369
|
-
"Emoji": "toot:Emoji",
|
|
11370
|
-
"Hashtag": "as:Hashtag",
|
|
11371
|
-
},
|
|
11372
|
-
], { documentLoader: options.contextLoader });
|
|
11228
|
+
return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
|
|
11373
11229
|
}
|
|
11374
11230
|
/**
|
|
11375
11231
|
* Converts a JSON-LD structure to an object of this type.
|
|
@@ -11505,66 +11361,7 @@ export class Collection extends Object {
|
|
|
11505
11361
|
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(new URL(v["@id"]));
|
|
11506
11362
|
continue;
|
|
11507
11363
|
}
|
|
11508
|
-
|
|
11509
|
-
Array.isArray(v["@type"]) &&
|
|
11510
|
-
[
|
|
11511
|
-
"https://www.w3.org/ns/activitystreams#Object",
|
|
11512
|
-
"http://joinmastodon.org/ns#Emoji",
|
|
11513
|
-
"https://www.w3.org/ns/activitystreams#Activity",
|
|
11514
|
-
"https://www.w3.org/ns/activitystreams#Accept",
|
|
11515
|
-
"https://www.w3.org/ns/activitystreams#Add",
|
|
11516
|
-
"https://www.w3.org/ns/activitystreams#Announce",
|
|
11517
|
-
"https://www.w3.org/ns/activitystreams#Create",
|
|
11518
|
-
"https://www.w3.org/ns/activitystreams#Delete",
|
|
11519
|
-
"https://www.w3.org/ns/activitystreams#Dislike",
|
|
11520
|
-
"https://www.w3.org/ns/activitystreams#Flag",
|
|
11521
|
-
"https://www.w3.org/ns/activitystreams#Follow",
|
|
11522
|
-
"https://www.w3.org/ns/activitystreams#Ignore",
|
|
11523
|
-
"https://www.w3.org/ns/activitystreams#Block",
|
|
11524
|
-
"https://www.w3.org/ns/activitystreams#IntransitiveActivity",
|
|
11525
|
-
"https://www.w3.org/ns/activitystreams#Arrive",
|
|
11526
|
-
"https://www.w3.org/ns/activitystreams#Question",
|
|
11527
|
-
"https://www.w3.org/ns/activitystreams#Like",
|
|
11528
|
-
"https://www.w3.org/ns/activitystreams#Offer",
|
|
11529
|
-
"https://www.w3.org/ns/activitystreams#Reject",
|
|
11530
|
-
"https://www.w3.org/ns/activitystreams#Remove",
|
|
11531
|
-
"https://www.w3.org/ns/activitystreams#Undo",
|
|
11532
|
-
"https://www.w3.org/ns/activitystreams#Update",
|
|
11533
|
-
"https://www.w3.org/ns/activitystreams#Application",
|
|
11534
|
-
"https://www.w3.org/ns/activitystreams#Article",
|
|
11535
|
-
"https://www.w3.org/ns/activitystreams#Collection",
|
|
11536
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
|
11537
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
|
11538
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollection",
|
|
11539
|
-
"https://www.w3.org/ns/activitystreams#Document",
|
|
11540
|
-
"https://www.w3.org/ns/activitystreams#Audio",
|
|
11541
|
-
"https://www.w3.org/ns/activitystreams#Image",
|
|
11542
|
-
"https://www.w3.org/ns/activitystreams#Page",
|
|
11543
|
-
"https://www.w3.org/ns/activitystreams#Video",
|
|
11544
|
-
"https://www.w3.org/ns/activitystreams#Event",
|
|
11545
|
-
"https://www.w3.org/ns/activitystreams#Group",
|
|
11546
|
-
"https://www.w3.org/ns/activitystreams#Note",
|
|
11547
|
-
"https://www.w3.org/ns/activitystreams#Organization",
|
|
11548
|
-
"https://www.w3.org/ns/activitystreams#Person",
|
|
11549
|
-
"https://www.w3.org/ns/activitystreams#Place",
|
|
11550
|
-
"https://www.w3.org/ns/activitystreams#Profile",
|
|
11551
|
-
"https://www.w3.org/ns/activitystreams#Relationship",
|
|
11552
|
-
"https://www.w3.org/ns/activitystreams#Service",
|
|
11553
|
-
"https://www.w3.org/ns/activitystreams#Tombstone",
|
|
11554
|
-
].some((t) => v["@type"].includes(t))
|
|
11555
|
-
? await Object.fromJsonLd(v, options)
|
|
11556
|
-
: typeof v === "object" && "@type" in v &&
|
|
11557
|
-
Array.isArray(v["@type"]) &&
|
|
11558
|
-
[
|
|
11559
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
|
11560
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
|
11561
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
|
11562
|
-
].some((t) => v["@type"].includes(t))
|
|
11563
|
-
? await Link.fromJsonLd(v, options)
|
|
11564
|
-
: undefined;
|
|
11565
|
-
if (typeof decoded === "undefined")
|
|
11566
|
-
continue;
|
|
11567
|
-
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(decoded);
|
|
11364
|
+
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(await Object.fromJsonLd(v, options));
|
|
11568
11365
|
}
|
|
11569
11366
|
instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
|
|
11570
11367
|
return instance;
|
|
@@ -11952,17 +11749,7 @@ export class CollectionPage extends Collection {
|
|
|
11952
11749
|
if (options.expand) {
|
|
11953
11750
|
return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
11954
11751
|
}
|
|
11955
|
-
return await jsonld.compact(values, options.context ??
|
|
11956
|
-
[
|
|
11957
|
-
"https://www.w3.org/ns/activitystreams",
|
|
11958
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
11959
|
-
{
|
|
11960
|
-
"toot": "http://joinmastodon.org/ns#",
|
|
11961
|
-
"sensitive": "as:sensitive",
|
|
11962
|
-
"Emoji": "toot:Emoji",
|
|
11963
|
-
"Hashtag": "as:Hashtag",
|
|
11964
|
-
},
|
|
11965
|
-
], { documentLoader: options.contextLoader });
|
|
11752
|
+
return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
|
|
11966
11753
|
}
|
|
11967
11754
|
/**
|
|
11968
11755
|
* Converts a JSON-LD structure to an object of this type.
|
|
@@ -13320,7 +13107,6 @@ export class Group extends Object {
|
|
|
13320
13107
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
|
13321
13108
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
|
13322
13109
|
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
|
13323
|
-
#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
13324
13110
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
13325
13111
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
|
13326
13112
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
|
@@ -13489,17 +13275,6 @@ export class Group extends Object {
|
|
|
13489
13275
|
"Collection | URL" + ".");
|
|
13490
13276
|
}
|
|
13491
13277
|
}
|
|
13492
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
13493
|
-
if (values.featuredTags instanceof Collection ||
|
|
13494
|
-
values.featuredTags instanceof URL) {
|
|
13495
|
-
// @ts-ignore: type is checked above.
|
|
13496
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
13497
|
-
}
|
|
13498
|
-
else {
|
|
13499
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
13500
|
-
"Collection | URL" + ".");
|
|
13501
|
-
}
|
|
13502
|
-
}
|
|
13503
13278
|
if ("streams" in values && values.streams != null) {
|
|
13504
13279
|
if (Array.isArray(values.streams) &&
|
|
13505
13280
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
|
@@ -13737,18 +13512,6 @@ export class Group extends Object {
|
|
|
13737
13512
|
"Collection | URL" + ".");
|
|
13738
13513
|
}
|
|
13739
13514
|
}
|
|
13740
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
13741
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
13742
|
-
if (values.featuredTags instanceof Collection ||
|
|
13743
|
-
values.featuredTags instanceof URL) {
|
|
13744
|
-
// @ts-ignore: type is checked above.
|
|
13745
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
13746
|
-
}
|
|
13747
|
-
else {
|
|
13748
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
13749
|
-
"Collection | URL" + ".");
|
|
13750
|
-
}
|
|
13751
|
-
}
|
|
13752
13515
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
|
13753
13516
|
if ("streams" in values && values.streams != null) {
|
|
13754
13517
|
if (Array.isArray(values.streams) &&
|
|
@@ -14380,64 +14143,6 @@ export class Group extends Object {
|
|
|
14380
14143
|
}
|
|
14381
14144
|
return v;
|
|
14382
14145
|
}
|
|
14383
|
-
async #fetchFeaturedTags(url, options = {}) {
|
|
14384
|
-
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
14385
|
-
fetchDocumentLoader;
|
|
14386
|
-
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
|
14387
|
-
fetchDocumentLoader;
|
|
14388
|
-
let fetchResult;
|
|
14389
|
-
try {
|
|
14390
|
-
fetchResult = await documentLoader(url.href);
|
|
14391
|
-
}
|
|
14392
|
-
catch (error) {
|
|
14393
|
-
if (options.suppressError) {
|
|
14394
|
-
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
|
14395
|
-
return null;
|
|
14396
|
-
}
|
|
14397
|
-
throw error;
|
|
14398
|
-
}
|
|
14399
|
-
const { document } = fetchResult;
|
|
14400
|
-
try {
|
|
14401
|
-
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
|
14402
|
-
}
|
|
14403
|
-
catch (e) {
|
|
14404
|
-
if (!(e instanceof TypeError))
|
|
14405
|
-
throw e;
|
|
14406
|
-
}
|
|
14407
|
-
throw new TypeError("Expected an object of any type of: " +
|
|
14408
|
-
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
|
14409
|
-
}
|
|
14410
|
-
/**
|
|
14411
|
-
* Similar to
|
|
14412
|
-
* {@link Group.getFeaturedTags},
|
|
14413
|
-
* but returns its `@id` URL instead of the object itself.
|
|
14414
|
-
*/
|
|
14415
|
-
get featuredTagsId() {
|
|
14416
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
14417
|
-
return null;
|
|
14418
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
14419
|
-
if (v instanceof URL)
|
|
14420
|
-
return v;
|
|
14421
|
-
return v.id;
|
|
14422
|
-
}
|
|
14423
|
-
/** What is known in Mastodon as "featured hashtags", hashtags that are featured
|
|
14424
|
-
* at people's profiles, is implemented using an extra property `featuredTags`
|
|
14425
|
-
* on the actor object that points to a {@link Collection} of {@link Hashtag}
|
|
14426
|
-
* objects specifically.
|
|
14427
|
-
*/
|
|
14428
|
-
async getFeaturedTags(options = {}) {
|
|
14429
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
14430
|
-
return null;
|
|
14431
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
14432
|
-
if (v instanceof URL) {
|
|
14433
|
-
const fetched = await this.#fetchFeaturedTags(v, options);
|
|
14434
|
-
if (fetched == null)
|
|
14435
|
-
return null;
|
|
14436
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0] = fetched;
|
|
14437
|
-
return fetched;
|
|
14438
|
-
}
|
|
14439
|
-
return v;
|
|
14440
|
-
}
|
|
14441
14146
|
async #fetchStream(url, options = {}) {
|
|
14442
14147
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
14443
14148
|
fetchDocumentLoader;
|
|
@@ -14648,16 +14353,6 @@ export class Group extends Object {
|
|
|
14648
14353
|
values["http://joinmastodon.org/ns#featured"] = array;
|
|
14649
14354
|
}
|
|
14650
14355
|
array = [];
|
|
14651
|
-
for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac) {
|
|
14652
|
-
const element = v instanceof URL
|
|
14653
|
-
? { "@id": v.href }
|
|
14654
|
-
: await v.toJsonLd(options);
|
|
14655
|
-
array.push(element);
|
|
14656
|
-
}
|
|
14657
|
-
if (array.length > 0) {
|
|
14658
|
-
values["http://joinmastodon.org/ns#featuredTags"] = array;
|
|
14659
|
-
}
|
|
14660
|
-
array = [];
|
|
14661
14356
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
|
14662
14357
|
const element = v instanceof URL
|
|
14663
14358
|
? { "@id": v.href }
|
|
@@ -14724,7 +14419,6 @@ export class Group extends Object {
|
|
|
14724
14419
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
|
14725
14420
|
"toot": "http://joinmastodon.org/ns#",
|
|
14726
14421
|
"featured": { "@id": "toot:featured", "@type": "@id" },
|
|
14727
|
-
"featuredTags": { "@id": "toot:featuredTags", "@type": "@id" },
|
|
14728
14422
|
"discoverable": "toot:discoverable",
|
|
14729
14423
|
"suspended": "toot:suspended",
|
|
14730
14424
|
"memorial": "toot:memorial",
|
|
@@ -14955,24 +14649,6 @@ export class Group extends Object {
|
|
|
14955
14649
|
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
|
14956
14650
|
}
|
|
14957
14651
|
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
|
14958
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
14959
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array = values["http://joinmastodon.org/ns#featuredTags"];
|
|
14960
|
-
for (const v of _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array == null
|
|
14961
|
-
? []
|
|
14962
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array.length === 1 &&
|
|
14963
|
-
"@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]
|
|
14964
|
-
? _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]["@list"]
|
|
14965
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array) {
|
|
14966
|
-
if (v == null)
|
|
14967
|
-
continue;
|
|
14968
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
14969
|
-
globalThis.Object.keys(v).length === 1) {
|
|
14970
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(new URL(v["@id"]));
|
|
14971
|
-
continue;
|
|
14972
|
-
}
|
|
14973
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(await Collection.fromJsonLd(v, options));
|
|
14974
|
-
}
|
|
14975
|
-
instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = _2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
14976
14652
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
14977
14653
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array = values["https://www.w3.org/ns/activitystreams#streams"];
|
|
14978
14654
|
for (const v of _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array == null
|
|
@@ -15185,17 +14861,6 @@ export class Group extends Object {
|
|
|
15185
14861
|
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
|
15186
14862
|
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
|
15187
14863
|
}
|
|
15188
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac
|
|
15189
|
-
// deno-lint-ignore no-explicit-any
|
|
15190
|
-
.map((v) => v instanceof URL
|
|
15191
|
-
? {
|
|
15192
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15193
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
|
15194
|
-
}
|
|
15195
|
-
: v);
|
|
15196
|
-
if (_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length == 1) {
|
|
15197
|
-
proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
15198
|
-
}
|
|
15199
14864
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
|
15200
14865
|
// deno-lint-ignore no-explicit-any
|
|
15201
14866
|
.map((v) => v instanceof URL
|
|
@@ -16834,13 +16499,13 @@ export class OrderedCollection extends Collection {
|
|
|
16834
16499
|
super(values, { documentLoader, contextLoader });
|
|
16835
16500
|
if ("items" in values && values.items != null) {
|
|
16836
16501
|
if (Array.isArray(values.items) &&
|
|
16837
|
-
values.items.every((v) => v instanceof Object || v instanceof
|
|
16502
|
+
values.items.every((v) => v instanceof Object || v instanceof URL)) {
|
|
16838
16503
|
// @ts-ignore: type is checked above.
|
|
16839
16504
|
this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
|
|
16840
16505
|
}
|
|
16841
16506
|
else {
|
|
16842
16507
|
throw new TypeError("The items must be an array of type " +
|
|
16843
|
-
"Object |
|
|
16508
|
+
"Object | URL" + ".");
|
|
16844
16509
|
}
|
|
16845
16510
|
}
|
|
16846
16511
|
}
|
|
@@ -16855,13 +16520,13 @@ export class OrderedCollection extends Collection {
|
|
|
16855
16520
|
clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
|
|
16856
16521
|
if ("items" in values && values.items != null) {
|
|
16857
16522
|
if (Array.isArray(values.items) &&
|
|
16858
|
-
values.items.every((v) => v instanceof Object || v instanceof
|
|
16523
|
+
values.items.every((v) => v instanceof Object || v instanceof URL)) {
|
|
16859
16524
|
// @ts-ignore: type is checked above.
|
|
16860
16525
|
clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
|
|
16861
16526
|
}
|
|
16862
16527
|
else {
|
|
16863
16528
|
throw new TypeError("The items must be an array of type " +
|
|
16864
|
-
"Object |
|
|
16529
|
+
"Object | URL" + ".");
|
|
16865
16530
|
}
|
|
16866
16531
|
}
|
|
16867
16532
|
return clone;
|
|
@@ -16890,18 +16555,8 @@ export class OrderedCollection extends Collection {
|
|
|
16890
16555
|
if (!(e instanceof TypeError))
|
|
16891
16556
|
throw e;
|
|
16892
16557
|
}
|
|
16893
|
-
try {
|
|
16894
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
|
16895
|
-
}
|
|
16896
|
-
catch (e) {
|
|
16897
|
-
if (!(e instanceof TypeError))
|
|
16898
|
-
throw e;
|
|
16899
|
-
}
|
|
16900
16558
|
throw new TypeError("Expected an object of any type of: " +
|
|
16901
|
-
[
|
|
16902
|
-
"https://www.w3.org/ns/activitystreams#Object",
|
|
16903
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
|
16904
|
-
].join(", "));
|
|
16559
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
|
16905
16560
|
}
|
|
16906
16561
|
/**
|
|
16907
16562
|
* Similar to
|
|
@@ -16949,9 +16604,7 @@ export class OrderedCollection extends Collection {
|
|
|
16949
16604
|
for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg) {
|
|
16950
16605
|
const element = v instanceof URL
|
|
16951
16606
|
? { "@id": v.href }
|
|
16952
|
-
: v
|
|
16953
|
-
? await v.toJsonLd(options)
|
|
16954
|
-
: await v.toJsonLd(options);
|
|
16607
|
+
: await v.toJsonLd(options);
|
|
16955
16608
|
array.push(element);
|
|
16956
16609
|
}
|
|
16957
16610
|
if (array.length > 0) {
|
|
@@ -16967,17 +16620,7 @@ export class OrderedCollection extends Collection {
|
|
|
16967
16620
|
if (options.expand) {
|
|
16968
16621
|
return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
16969
16622
|
}
|
|
16970
|
-
return await jsonld.compact(values, options.context ??
|
|
16971
|
-
[
|
|
16972
|
-
"https://www.w3.org/ns/activitystreams",
|
|
16973
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
16974
|
-
{
|
|
16975
|
-
"toot": "http://joinmastodon.org/ns#",
|
|
16976
|
-
"sensitive": "as:sensitive",
|
|
16977
|
-
"Emoji": "toot:Emoji",
|
|
16978
|
-
"Hashtag": "as:Hashtag",
|
|
16979
|
-
},
|
|
16980
|
-
], { documentLoader: options.contextLoader });
|
|
16623
|
+
return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
|
|
16981
16624
|
}
|
|
16982
16625
|
/**
|
|
16983
16626
|
* Converts a JSON-LD structure to an object of this type.
|
|
@@ -17029,71 +16672,12 @@ export class OrderedCollection extends Collection {
|
|
|
17029
16672
|
: _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array) {
|
|
17030
16673
|
if (v == null)
|
|
17031
16674
|
continue;
|
|
17032
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
17033
|
-
globalThis.Object.keys(v).length === 1) {
|
|
17034
|
-
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(new URL(v["@id"]));
|
|
17035
|
-
continue;
|
|
17036
|
-
}
|
|
17037
|
-
const decoded = typeof v === "object" && "@type" in v &&
|
|
17038
|
-
Array.isArray(v["@type"]) &&
|
|
17039
|
-
[
|
|
17040
|
-
"https://www.w3.org/ns/activitystreams#Object",
|
|
17041
|
-
"http://joinmastodon.org/ns#Emoji",
|
|
17042
|
-
"https://www.w3.org/ns/activitystreams#Activity",
|
|
17043
|
-
"https://www.w3.org/ns/activitystreams#Accept",
|
|
17044
|
-
"https://www.w3.org/ns/activitystreams#Add",
|
|
17045
|
-
"https://www.w3.org/ns/activitystreams#Announce",
|
|
17046
|
-
"https://www.w3.org/ns/activitystreams#Create",
|
|
17047
|
-
"https://www.w3.org/ns/activitystreams#Delete",
|
|
17048
|
-
"https://www.w3.org/ns/activitystreams#Dislike",
|
|
17049
|
-
"https://www.w3.org/ns/activitystreams#Flag",
|
|
17050
|
-
"https://www.w3.org/ns/activitystreams#Follow",
|
|
17051
|
-
"https://www.w3.org/ns/activitystreams#Ignore",
|
|
17052
|
-
"https://www.w3.org/ns/activitystreams#Block",
|
|
17053
|
-
"https://www.w3.org/ns/activitystreams#IntransitiveActivity",
|
|
17054
|
-
"https://www.w3.org/ns/activitystreams#Arrive",
|
|
17055
|
-
"https://www.w3.org/ns/activitystreams#Question",
|
|
17056
|
-
"https://www.w3.org/ns/activitystreams#Like",
|
|
17057
|
-
"https://www.w3.org/ns/activitystreams#Offer",
|
|
17058
|
-
"https://www.w3.org/ns/activitystreams#Reject",
|
|
17059
|
-
"https://www.w3.org/ns/activitystreams#Remove",
|
|
17060
|
-
"https://www.w3.org/ns/activitystreams#Undo",
|
|
17061
|
-
"https://www.w3.org/ns/activitystreams#Update",
|
|
17062
|
-
"https://www.w3.org/ns/activitystreams#Application",
|
|
17063
|
-
"https://www.w3.org/ns/activitystreams#Article",
|
|
17064
|
-
"https://www.w3.org/ns/activitystreams#Collection",
|
|
17065
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
|
17066
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
|
17067
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollection",
|
|
17068
|
-
"https://www.w3.org/ns/activitystreams#Document",
|
|
17069
|
-
"https://www.w3.org/ns/activitystreams#Audio",
|
|
17070
|
-
"https://www.w3.org/ns/activitystreams#Image",
|
|
17071
|
-
"https://www.w3.org/ns/activitystreams#Page",
|
|
17072
|
-
"https://www.w3.org/ns/activitystreams#Video",
|
|
17073
|
-
"https://www.w3.org/ns/activitystreams#Event",
|
|
17074
|
-
"https://www.w3.org/ns/activitystreams#Group",
|
|
17075
|
-
"https://www.w3.org/ns/activitystreams#Note",
|
|
17076
|
-
"https://www.w3.org/ns/activitystreams#Organization",
|
|
17077
|
-
"https://www.w3.org/ns/activitystreams#Person",
|
|
17078
|
-
"https://www.w3.org/ns/activitystreams#Place",
|
|
17079
|
-
"https://www.w3.org/ns/activitystreams#Profile",
|
|
17080
|
-
"https://www.w3.org/ns/activitystreams#Relationship",
|
|
17081
|
-
"https://www.w3.org/ns/activitystreams#Service",
|
|
17082
|
-
"https://www.w3.org/ns/activitystreams#Tombstone",
|
|
17083
|
-
].some((t) => v["@type"].includes(t))
|
|
17084
|
-
? await Object.fromJsonLd(v, options)
|
|
17085
|
-
: typeof v === "object" && "@type" in v &&
|
|
17086
|
-
Array.isArray(v["@type"]) &&
|
|
17087
|
-
[
|
|
17088
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
|
17089
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
|
17090
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
|
17091
|
-
].some((t) => v["@type"].includes(t))
|
|
17092
|
-
? await Link.fromJsonLd(v, options)
|
|
17093
|
-
: undefined;
|
|
17094
|
-
if (typeof decoded === "undefined")
|
|
16675
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
16676
|
+
globalThis.Object.keys(v).length === 1) {
|
|
16677
|
+
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(new URL(v["@id"]));
|
|
17095
16678
|
continue;
|
|
17096
|
-
|
|
16679
|
+
}
|
|
16680
|
+
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(await Object.fromJsonLd(v, options));
|
|
17097
16681
|
}
|
|
17098
16682
|
instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
|
|
17099
16683
|
return instance;
|
|
@@ -17220,17 +16804,7 @@ export class OrderedCollectionPage extends CollectionPage {
|
|
|
17220
16804
|
if (options.expand) {
|
|
17221
16805
|
return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
17222
16806
|
}
|
|
17223
|
-
return await jsonld.compact(values, options.context ??
|
|
17224
|
-
[
|
|
17225
|
-
"https://www.w3.org/ns/activitystreams",
|
|
17226
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
17227
|
-
{
|
|
17228
|
-
"toot": "http://joinmastodon.org/ns#",
|
|
17229
|
-
"sensitive": "as:sensitive",
|
|
17230
|
-
"Emoji": "toot:Emoji",
|
|
17231
|
-
"Hashtag": "as:Hashtag",
|
|
17232
|
-
},
|
|
17233
|
-
], { documentLoader: options.contextLoader });
|
|
16807
|
+
return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
|
|
17234
16808
|
}
|
|
17235
16809
|
/**
|
|
17236
16810
|
* Converts a JSON-LD structure to an object of this type.
|
|
@@ -17330,7 +16904,6 @@ export class Organization extends Object {
|
|
|
17330
16904
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
|
17331
16905
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
|
17332
16906
|
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
|
17333
|
-
#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
17334
16907
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
17335
16908
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
|
17336
16909
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
|
@@ -17499,17 +17072,6 @@ export class Organization extends Object {
|
|
|
17499
17072
|
"Collection | URL" + ".");
|
|
17500
17073
|
}
|
|
17501
17074
|
}
|
|
17502
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
17503
|
-
if (values.featuredTags instanceof Collection ||
|
|
17504
|
-
values.featuredTags instanceof URL) {
|
|
17505
|
-
// @ts-ignore: type is checked above.
|
|
17506
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
17507
|
-
}
|
|
17508
|
-
else {
|
|
17509
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
17510
|
-
"Collection | URL" + ".");
|
|
17511
|
-
}
|
|
17512
|
-
}
|
|
17513
17075
|
if ("streams" in values && values.streams != null) {
|
|
17514
17076
|
if (Array.isArray(values.streams) &&
|
|
17515
17077
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
|
@@ -17747,18 +17309,6 @@ export class Organization extends Object {
|
|
|
17747
17309
|
"Collection | URL" + ".");
|
|
17748
17310
|
}
|
|
17749
17311
|
}
|
|
17750
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
17751
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
17752
|
-
if (values.featuredTags instanceof Collection ||
|
|
17753
|
-
values.featuredTags instanceof URL) {
|
|
17754
|
-
// @ts-ignore: type is checked above.
|
|
17755
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
17756
|
-
}
|
|
17757
|
-
else {
|
|
17758
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
17759
|
-
"Collection | URL" + ".");
|
|
17760
|
-
}
|
|
17761
|
-
}
|
|
17762
17312
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
|
17763
17313
|
if ("streams" in values && values.streams != null) {
|
|
17764
17314
|
if (Array.isArray(values.streams) &&
|
|
@@ -18390,64 +17940,6 @@ export class Organization extends Object {
|
|
|
18390
17940
|
}
|
|
18391
17941
|
return v;
|
|
18392
17942
|
}
|
|
18393
|
-
async #fetchFeaturedTags(url, options = {}) {
|
|
18394
|
-
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
18395
|
-
fetchDocumentLoader;
|
|
18396
|
-
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
|
18397
|
-
fetchDocumentLoader;
|
|
18398
|
-
let fetchResult;
|
|
18399
|
-
try {
|
|
18400
|
-
fetchResult = await documentLoader(url.href);
|
|
18401
|
-
}
|
|
18402
|
-
catch (error) {
|
|
18403
|
-
if (options.suppressError) {
|
|
18404
|
-
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
|
18405
|
-
return null;
|
|
18406
|
-
}
|
|
18407
|
-
throw error;
|
|
18408
|
-
}
|
|
18409
|
-
const { document } = fetchResult;
|
|
18410
|
-
try {
|
|
18411
|
-
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
|
18412
|
-
}
|
|
18413
|
-
catch (e) {
|
|
18414
|
-
if (!(e instanceof TypeError))
|
|
18415
|
-
throw e;
|
|
18416
|
-
}
|
|
18417
|
-
throw new TypeError("Expected an object of any type of: " +
|
|
18418
|
-
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
|
18419
|
-
}
|
|
18420
|
-
/**
|
|
18421
|
-
* Similar to
|
|
18422
|
-
* {@link Organization.getFeaturedTags},
|
|
18423
|
-
* but returns its `@id` URL instead of the object itself.
|
|
18424
|
-
*/
|
|
18425
|
-
get featuredTagsId() {
|
|
18426
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
18427
|
-
return null;
|
|
18428
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
18429
|
-
if (v instanceof URL)
|
|
18430
|
-
return v;
|
|
18431
|
-
return v.id;
|
|
18432
|
-
}
|
|
18433
|
-
/** What is known in Mastodon as "featured hashtags", hashtags that are featured
|
|
18434
|
-
* at people's profiles, is implemented using an extra property `featuredTags`
|
|
18435
|
-
* on the actor object that points to a {@link Collection} of {@link Hashtag}
|
|
18436
|
-
* objects specifically.
|
|
18437
|
-
*/
|
|
18438
|
-
async getFeaturedTags(options = {}) {
|
|
18439
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
18440
|
-
return null;
|
|
18441
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
18442
|
-
if (v instanceof URL) {
|
|
18443
|
-
const fetched = await this.#fetchFeaturedTags(v, options);
|
|
18444
|
-
if (fetched == null)
|
|
18445
|
-
return null;
|
|
18446
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0] = fetched;
|
|
18447
|
-
return fetched;
|
|
18448
|
-
}
|
|
18449
|
-
return v;
|
|
18450
|
-
}
|
|
18451
17943
|
async #fetchStream(url, options = {}) {
|
|
18452
17944
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
18453
17945
|
fetchDocumentLoader;
|
|
@@ -18658,16 +18150,6 @@ export class Organization extends Object {
|
|
|
18658
18150
|
values["http://joinmastodon.org/ns#featured"] = array;
|
|
18659
18151
|
}
|
|
18660
18152
|
array = [];
|
|
18661
|
-
for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac) {
|
|
18662
|
-
const element = v instanceof URL
|
|
18663
|
-
? { "@id": v.href }
|
|
18664
|
-
: await v.toJsonLd(options);
|
|
18665
|
-
array.push(element);
|
|
18666
|
-
}
|
|
18667
|
-
if (array.length > 0) {
|
|
18668
|
-
values["http://joinmastodon.org/ns#featuredTags"] = array;
|
|
18669
|
-
}
|
|
18670
|
-
array = [];
|
|
18671
18153
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
|
18672
18154
|
const element = v instanceof URL
|
|
18673
18155
|
? { "@id": v.href }
|
|
@@ -18734,7 +18216,6 @@ export class Organization extends Object {
|
|
|
18734
18216
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
|
18735
18217
|
"toot": "http://joinmastodon.org/ns#",
|
|
18736
18218
|
"featured": { "@id": "toot:featured", "@type": "@id" },
|
|
18737
|
-
"featuredTags": { "@id": "toot:featuredTags", "@type": "@id" },
|
|
18738
18219
|
"discoverable": "toot:discoverable",
|
|
18739
18220
|
"suspended": "toot:suspended",
|
|
18740
18221
|
"memorial": "toot:memorial",
|
|
@@ -18965,24 +18446,6 @@ export class Organization extends Object {
|
|
|
18965
18446
|
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
|
18966
18447
|
}
|
|
18967
18448
|
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
|
18968
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
18969
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array = values["http://joinmastodon.org/ns#featuredTags"];
|
|
18970
|
-
for (const v of _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array == null
|
|
18971
|
-
? []
|
|
18972
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array.length === 1 &&
|
|
18973
|
-
"@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]
|
|
18974
|
-
? _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]["@list"]
|
|
18975
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array) {
|
|
18976
|
-
if (v == null)
|
|
18977
|
-
continue;
|
|
18978
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
18979
|
-
globalThis.Object.keys(v).length === 1) {
|
|
18980
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(new URL(v["@id"]));
|
|
18981
|
-
continue;
|
|
18982
|
-
}
|
|
18983
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(await Collection.fromJsonLd(v, options));
|
|
18984
|
-
}
|
|
18985
|
-
instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = _2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
18986
18449
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
18987
18450
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array = values["https://www.w3.org/ns/activitystreams#streams"];
|
|
18988
18451
|
for (const v of _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array == null
|
|
@@ -19195,17 +18658,6 @@ export class Organization extends Object {
|
|
|
19195
18658
|
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
|
19196
18659
|
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
|
19197
18660
|
}
|
|
19198
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac
|
|
19199
|
-
// deno-lint-ignore no-explicit-any
|
|
19200
|
-
.map((v) => v instanceof URL
|
|
19201
|
-
? {
|
|
19202
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
19203
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
|
19204
|
-
}
|
|
19205
|
-
: v);
|
|
19206
|
-
if (_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length == 1) {
|
|
19207
|
-
proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
19208
|
-
}
|
|
19209
18661
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
|
19210
18662
|
// deno-lint-ignore no-explicit-any
|
|
19211
18663
|
.map((v) => v instanceof URL
|
|
@@ -19414,7 +18866,6 @@ export class Person extends Object {
|
|
|
19414
18866
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
|
19415
18867
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
|
19416
18868
|
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
|
19417
|
-
#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
19418
18869
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
19419
18870
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
|
19420
18871
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
|
@@ -19583,17 +19034,6 @@ export class Person extends Object {
|
|
|
19583
19034
|
"Collection | URL" + ".");
|
|
19584
19035
|
}
|
|
19585
19036
|
}
|
|
19586
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
19587
|
-
if (values.featuredTags instanceof Collection ||
|
|
19588
|
-
values.featuredTags instanceof URL) {
|
|
19589
|
-
// @ts-ignore: type is checked above.
|
|
19590
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
19591
|
-
}
|
|
19592
|
-
else {
|
|
19593
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
19594
|
-
"Collection | URL" + ".");
|
|
19595
|
-
}
|
|
19596
|
-
}
|
|
19597
19037
|
if ("streams" in values && values.streams != null) {
|
|
19598
19038
|
if (Array.isArray(values.streams) &&
|
|
19599
19039
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
|
@@ -19831,18 +19271,6 @@ export class Person extends Object {
|
|
|
19831
19271
|
"Collection | URL" + ".");
|
|
19832
19272
|
}
|
|
19833
19273
|
}
|
|
19834
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
19835
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
19836
|
-
if (values.featuredTags instanceof Collection ||
|
|
19837
|
-
values.featuredTags instanceof URL) {
|
|
19838
|
-
// @ts-ignore: type is checked above.
|
|
19839
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
19840
|
-
}
|
|
19841
|
-
else {
|
|
19842
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
19843
|
-
"Collection | URL" + ".");
|
|
19844
|
-
}
|
|
19845
|
-
}
|
|
19846
19274
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
|
19847
19275
|
if ("streams" in values && values.streams != null) {
|
|
19848
19276
|
if (Array.isArray(values.streams) &&
|
|
@@ -20474,64 +19902,6 @@ export class Person extends Object {
|
|
|
20474
19902
|
}
|
|
20475
19903
|
return v;
|
|
20476
19904
|
}
|
|
20477
|
-
async #fetchFeaturedTags(url, options = {}) {
|
|
20478
|
-
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
20479
|
-
fetchDocumentLoader;
|
|
20480
|
-
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
|
20481
|
-
fetchDocumentLoader;
|
|
20482
|
-
let fetchResult;
|
|
20483
|
-
try {
|
|
20484
|
-
fetchResult = await documentLoader(url.href);
|
|
20485
|
-
}
|
|
20486
|
-
catch (error) {
|
|
20487
|
-
if (options.suppressError) {
|
|
20488
|
-
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
|
20489
|
-
return null;
|
|
20490
|
-
}
|
|
20491
|
-
throw error;
|
|
20492
|
-
}
|
|
20493
|
-
const { document } = fetchResult;
|
|
20494
|
-
try {
|
|
20495
|
-
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
|
20496
|
-
}
|
|
20497
|
-
catch (e) {
|
|
20498
|
-
if (!(e instanceof TypeError))
|
|
20499
|
-
throw e;
|
|
20500
|
-
}
|
|
20501
|
-
throw new TypeError("Expected an object of any type of: " +
|
|
20502
|
-
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
|
20503
|
-
}
|
|
20504
|
-
/**
|
|
20505
|
-
* Similar to
|
|
20506
|
-
* {@link Person.getFeaturedTags},
|
|
20507
|
-
* but returns its `@id` URL instead of the object itself.
|
|
20508
|
-
*/
|
|
20509
|
-
get featuredTagsId() {
|
|
20510
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
20511
|
-
return null;
|
|
20512
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
20513
|
-
if (v instanceof URL)
|
|
20514
|
-
return v;
|
|
20515
|
-
return v.id;
|
|
20516
|
-
}
|
|
20517
|
-
/** What is known in Mastodon as "featured hashtags", hashtags that are featured
|
|
20518
|
-
* at people's profiles, is implemented using an extra property `featuredTags`
|
|
20519
|
-
* on the actor object that points to a {@link Collection} of {@link Hashtag}
|
|
20520
|
-
* objects specifically.
|
|
20521
|
-
*/
|
|
20522
|
-
async getFeaturedTags(options = {}) {
|
|
20523
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
20524
|
-
return null;
|
|
20525
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
20526
|
-
if (v instanceof URL) {
|
|
20527
|
-
const fetched = await this.#fetchFeaturedTags(v, options);
|
|
20528
|
-
if (fetched == null)
|
|
20529
|
-
return null;
|
|
20530
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0] = fetched;
|
|
20531
|
-
return fetched;
|
|
20532
|
-
}
|
|
20533
|
-
return v;
|
|
20534
|
-
}
|
|
20535
19905
|
async #fetchStream(url, options = {}) {
|
|
20536
19906
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
20537
19907
|
fetchDocumentLoader;
|
|
@@ -20742,16 +20112,6 @@ export class Person extends Object {
|
|
|
20742
20112
|
values["http://joinmastodon.org/ns#featured"] = array;
|
|
20743
20113
|
}
|
|
20744
20114
|
array = [];
|
|
20745
|
-
for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac) {
|
|
20746
|
-
const element = v instanceof URL
|
|
20747
|
-
? { "@id": v.href }
|
|
20748
|
-
: await v.toJsonLd(options);
|
|
20749
|
-
array.push(element);
|
|
20750
|
-
}
|
|
20751
|
-
if (array.length > 0) {
|
|
20752
|
-
values["http://joinmastodon.org/ns#featuredTags"] = array;
|
|
20753
|
-
}
|
|
20754
|
-
array = [];
|
|
20755
20115
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
|
20756
20116
|
const element = v instanceof URL
|
|
20757
20117
|
? { "@id": v.href }
|
|
@@ -20818,7 +20178,6 @@ export class Person extends Object {
|
|
|
20818
20178
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
|
20819
20179
|
"toot": "http://joinmastodon.org/ns#",
|
|
20820
20180
|
"featured": { "@id": "toot:featured", "@type": "@id" },
|
|
20821
|
-
"featuredTags": { "@id": "toot:featuredTags", "@type": "@id" },
|
|
20822
20181
|
"discoverable": "toot:discoverable",
|
|
20823
20182
|
"suspended": "toot:suspended",
|
|
20824
20183
|
"memorial": "toot:memorial",
|
|
@@ -21049,24 +20408,6 @@ export class Person extends Object {
|
|
|
21049
20408
|
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
|
21050
20409
|
}
|
|
21051
20410
|
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
|
21052
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
21053
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array = values["http://joinmastodon.org/ns#featuredTags"];
|
|
21054
|
-
for (const v of _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array == null
|
|
21055
|
-
? []
|
|
21056
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array.length === 1 &&
|
|
21057
|
-
"@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]
|
|
21058
|
-
? _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]["@list"]
|
|
21059
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array) {
|
|
21060
|
-
if (v == null)
|
|
21061
|
-
continue;
|
|
21062
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
21063
|
-
globalThis.Object.keys(v).length === 1) {
|
|
21064
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(new URL(v["@id"]));
|
|
21065
|
-
continue;
|
|
21066
|
-
}
|
|
21067
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(await Collection.fromJsonLd(v, options));
|
|
21068
|
-
}
|
|
21069
|
-
instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = _2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
21070
20411
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
21071
20412
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array = values["https://www.w3.org/ns/activitystreams#streams"];
|
|
21072
20413
|
for (const v of _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array == null
|
|
@@ -21279,17 +20620,6 @@ export class Person extends Object {
|
|
|
21279
20620
|
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
|
21280
20621
|
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
|
21281
20622
|
}
|
|
21282
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac
|
|
21283
|
-
// deno-lint-ignore no-explicit-any
|
|
21284
|
-
.map((v) => v instanceof URL
|
|
21285
|
-
? {
|
|
21286
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
21287
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
|
21288
|
-
}
|
|
21289
|
-
: v);
|
|
21290
|
-
if (_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length == 1) {
|
|
21291
|
-
proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
21292
|
-
}
|
|
21293
20623
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
|
21294
20624
|
// deno-lint-ignore no-explicit-any
|
|
21295
20625
|
.map((v) => v instanceof URL
|
|
@@ -23319,7 +22649,6 @@ export class Service extends Object {
|
|
|
23319
22649
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
|
23320
22650
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
|
23321
22651
|
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
|
23322
|
-
#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
23323
22652
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
23324
22653
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
|
23325
22654
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
|
@@ -23488,17 +22817,6 @@ export class Service extends Object {
|
|
|
23488
22817
|
"Collection | URL" + ".");
|
|
23489
22818
|
}
|
|
23490
22819
|
}
|
|
23491
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
23492
|
-
if (values.featuredTags instanceof Collection ||
|
|
23493
|
-
values.featuredTags instanceof URL) {
|
|
23494
|
-
// @ts-ignore: type is checked above.
|
|
23495
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
23496
|
-
}
|
|
23497
|
-
else {
|
|
23498
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
23499
|
-
"Collection | URL" + ".");
|
|
23500
|
-
}
|
|
23501
|
-
}
|
|
23502
22820
|
if ("streams" in values && values.streams != null) {
|
|
23503
22821
|
if (Array.isArray(values.streams) &&
|
|
23504
22822
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
|
@@ -23736,18 +23054,6 @@ export class Service extends Object {
|
|
|
23736
23054
|
"Collection | URL" + ".");
|
|
23737
23055
|
}
|
|
23738
23056
|
}
|
|
23739
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
23740
|
-
if ("featuredTags" in values && values.featuredTags != null) {
|
|
23741
|
-
if (values.featuredTags instanceof Collection ||
|
|
23742
|
-
values.featuredTags instanceof URL) {
|
|
23743
|
-
// @ts-ignore: type is checked above.
|
|
23744
|
-
clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = [values.featuredTags];
|
|
23745
|
-
}
|
|
23746
|
-
else {
|
|
23747
|
-
throw new TypeError("The featuredTags must be of type " +
|
|
23748
|
-
"Collection | URL" + ".");
|
|
23749
|
-
}
|
|
23750
|
-
}
|
|
23751
23057
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
|
23752
23058
|
if ("streams" in values && values.streams != null) {
|
|
23753
23059
|
if (Array.isArray(values.streams) &&
|
|
@@ -24379,64 +23685,6 @@ export class Service extends Object {
|
|
|
24379
23685
|
}
|
|
24380
23686
|
return v;
|
|
24381
23687
|
}
|
|
24382
|
-
async #fetchFeaturedTags(url, options = {}) {
|
|
24383
|
-
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
24384
|
-
fetchDocumentLoader;
|
|
24385
|
-
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
|
24386
|
-
fetchDocumentLoader;
|
|
24387
|
-
let fetchResult;
|
|
24388
|
-
try {
|
|
24389
|
-
fetchResult = await documentLoader(url.href);
|
|
24390
|
-
}
|
|
24391
|
-
catch (error) {
|
|
24392
|
-
if (options.suppressError) {
|
|
24393
|
-
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
|
24394
|
-
return null;
|
|
24395
|
-
}
|
|
24396
|
-
throw error;
|
|
24397
|
-
}
|
|
24398
|
-
const { document } = fetchResult;
|
|
24399
|
-
try {
|
|
24400
|
-
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
|
24401
|
-
}
|
|
24402
|
-
catch (e) {
|
|
24403
|
-
if (!(e instanceof TypeError))
|
|
24404
|
-
throw e;
|
|
24405
|
-
}
|
|
24406
|
-
throw new TypeError("Expected an object of any type of: " +
|
|
24407
|
-
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
|
24408
|
-
}
|
|
24409
|
-
/**
|
|
24410
|
-
* Similar to
|
|
24411
|
-
* {@link Service.getFeaturedTags},
|
|
24412
|
-
* but returns its `@id` URL instead of the object itself.
|
|
24413
|
-
*/
|
|
24414
|
-
get featuredTagsId() {
|
|
24415
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
24416
|
-
return null;
|
|
24417
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
24418
|
-
if (v instanceof URL)
|
|
24419
|
-
return v;
|
|
24420
|
-
return v.id;
|
|
24421
|
-
}
|
|
24422
|
-
/** What is known in Mastodon as "featured hashtags", hashtags that are featured
|
|
24423
|
-
* at people's profiles, is implemented using an extra property `featuredTags`
|
|
24424
|
-
* on the actor object that points to a {@link Collection} of {@link Hashtag}
|
|
24425
|
-
* objects specifically.
|
|
24426
|
-
*/
|
|
24427
|
-
async getFeaturedTags(options = {}) {
|
|
24428
|
-
if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length < 1)
|
|
24429
|
-
return null;
|
|
24430
|
-
const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
24431
|
-
if (v instanceof URL) {
|
|
24432
|
-
const fetched = await this.#fetchFeaturedTags(v, options);
|
|
24433
|
-
if (fetched == null)
|
|
24434
|
-
return null;
|
|
24435
|
-
this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac[0] = fetched;
|
|
24436
|
-
return fetched;
|
|
24437
|
-
}
|
|
24438
|
-
return v;
|
|
24439
|
-
}
|
|
24440
23688
|
async #fetchStream(url, options = {}) {
|
|
24441
23689
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
|
24442
23690
|
fetchDocumentLoader;
|
|
@@ -24647,16 +23895,6 @@ export class Service extends Object {
|
|
|
24647
23895
|
values["http://joinmastodon.org/ns#featured"] = array;
|
|
24648
23896
|
}
|
|
24649
23897
|
array = [];
|
|
24650
|
-
for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac) {
|
|
24651
|
-
const element = v instanceof URL
|
|
24652
|
-
? { "@id": v.href }
|
|
24653
|
-
: await v.toJsonLd(options);
|
|
24654
|
-
array.push(element);
|
|
24655
|
-
}
|
|
24656
|
-
if (array.length > 0) {
|
|
24657
|
-
values["http://joinmastodon.org/ns#featuredTags"] = array;
|
|
24658
|
-
}
|
|
24659
|
-
array = [];
|
|
24660
23898
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
|
24661
23899
|
const element = v instanceof URL
|
|
24662
23900
|
? { "@id": v.href }
|
|
@@ -24723,7 +23961,6 @@ export class Service extends Object {
|
|
|
24723
23961
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
|
24724
23962
|
"toot": "http://joinmastodon.org/ns#",
|
|
24725
23963
|
"featured": { "@id": "toot:featured", "@type": "@id" },
|
|
24726
|
-
"featuredTags": { "@id": "toot:featuredTags", "@type": "@id" },
|
|
24727
23964
|
"discoverable": "toot:discoverable",
|
|
24728
23965
|
"suspended": "toot:suspended",
|
|
24729
23966
|
"memorial": "toot:memorial",
|
|
@@ -24954,24 +24191,6 @@ export class Service extends Object {
|
|
|
24954
24191
|
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
|
24955
24192
|
}
|
|
24956
24193
|
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
|
24957
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = [];
|
|
24958
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array = values["http://joinmastodon.org/ns#featuredTags"];
|
|
24959
|
-
for (const v of _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array == null
|
|
24960
|
-
? []
|
|
24961
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array.length === 1 &&
|
|
24962
|
-
"@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]
|
|
24963
|
-
? _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array[0]["@list"]
|
|
24964
|
-
: _2MxnRRLq9iPzx5CFq2NPrXdUDCac__array) {
|
|
24965
|
-
if (v == null)
|
|
24966
|
-
continue;
|
|
24967
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
|
24968
|
-
globalThis.Object.keys(v).length === 1) {
|
|
24969
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(new URL(v["@id"]));
|
|
24970
|
-
continue;
|
|
24971
|
-
}
|
|
24972
|
-
_2MxnRRLq9iPzx5CFq2NPrXdUDCac.push(await Collection.fromJsonLd(v, options));
|
|
24973
|
-
}
|
|
24974
|
-
instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac = _2MxnRRLq9iPzx5CFq2NPrXdUDCac;
|
|
24975
24194
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
|
24976
24195
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array = values["https://www.w3.org/ns/activitystreams#streams"];
|
|
24977
24196
|
for (const v of _3sG2Hdwn9qzKGu9mpYkqakAMUkH9__array == null
|
|
@@ -25184,17 +24403,6 @@ export class Service extends Object {
|
|
|
25184
24403
|
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
|
25185
24404
|
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
|
25186
24405
|
}
|
|
25187
|
-
const _2MxnRRLq9iPzx5CFq2NPrXdUDCac = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac
|
|
25188
|
-
// deno-lint-ignore no-explicit-any
|
|
25189
|
-
.map((v) => v instanceof URL
|
|
25190
|
-
? {
|
|
25191
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
25192
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
|
25193
|
-
}
|
|
25194
|
-
: v);
|
|
25195
|
-
if (_2MxnRRLq9iPzx5CFq2NPrXdUDCac.length == 1) {
|
|
25196
|
-
proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac[0];
|
|
25197
|
-
}
|
|
25198
24406
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
|
25199
24407
|
// deno-lint-ignore no-explicit-any
|
|
25200
24408
|
.map((v) => v instanceof URL
|