@fedify/fedify 0.11.0-dev.240 → 0.11.0-dev.242
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +51 -0
- package/esm/federation/handler.js +2 -2
- package/esm/federation/middleware.js +78 -0
- package/esm/vocab/activity.yaml +47 -0
- package/esm/vocab/application.yaml +14 -0
- package/esm/vocab/collection.yaml +0 -4
- package/esm/vocab/collectionpage.yaml +0 -3
- 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 +1350 -337
- 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/handler.d.ts +2 -2
- package/types/federation/handler.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 +587 -51
- package/types/vocab/vocab.d.ts.map +1 -1
package/esm/vocab/vocab.js
CHANGED
@@ -6047,6 +6047,10 @@ export class Activity extends Object {
|
|
6047
6047
|
}
|
6048
6048
|
#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = [];
|
6049
6049
|
#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = [];
|
6050
|
+
#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = [];
|
6051
|
+
#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = [];
|
6052
|
+
#_25zu2s3VxVujgEKqrDycjE284XQR = [];
|
6053
|
+
#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = [];
|
6050
6054
|
/**
|
6051
6055
|
* Constructs a new instance of Activity with the given values.
|
6052
6056
|
* @param values The values to initialize the instance with.
|
@@ -6111,6 +6115,110 @@ export class Activity extends Object {
|
|
6111
6115
|
"Object | URL" + ".");
|
6112
6116
|
}
|
6113
6117
|
}
|
6118
|
+
if ("target" in values && values.target != null) {
|
6119
|
+
if (values.target instanceof Object || values.target instanceof URL) {
|
6120
|
+
// @ts-ignore: type is checked above.
|
6121
|
+
this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = [values.target];
|
6122
|
+
}
|
6123
|
+
else {
|
6124
|
+
throw new TypeError("The target must be of type " +
|
6125
|
+
"Object | URL" + ".");
|
6126
|
+
}
|
6127
|
+
}
|
6128
|
+
if ("targets" in values && values.targets != null) {
|
6129
|
+
if ("target" in values &&
|
6130
|
+
values.target != null) {
|
6131
|
+
throw new TypeError("Cannot initialize both target and " +
|
6132
|
+
"targets at the same time.");
|
6133
|
+
}
|
6134
|
+
if (Array.isArray(values.targets) &&
|
6135
|
+
values.targets.every((v) => v instanceof Object || v instanceof URL)) {
|
6136
|
+
// @ts-ignore: type is checked above.
|
6137
|
+
this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = values.targets;
|
6138
|
+
}
|
6139
|
+
else {
|
6140
|
+
throw new TypeError("The targets must be an array of type " +
|
6141
|
+
"Object | URL" + ".");
|
6142
|
+
}
|
6143
|
+
}
|
6144
|
+
if ("result" in values && values.result != null) {
|
6145
|
+
if (values.result instanceof Object || values.result instanceof URL) {
|
6146
|
+
// @ts-ignore: type is checked above.
|
6147
|
+
this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = [values.result];
|
6148
|
+
}
|
6149
|
+
else {
|
6150
|
+
throw new TypeError("The result must be of type " +
|
6151
|
+
"Object | URL" + ".");
|
6152
|
+
}
|
6153
|
+
}
|
6154
|
+
if ("results" in values && values.results != null) {
|
6155
|
+
if ("result" in values &&
|
6156
|
+
values.result != null) {
|
6157
|
+
throw new TypeError("Cannot initialize both result and " +
|
6158
|
+
"results at the same time.");
|
6159
|
+
}
|
6160
|
+
if (Array.isArray(values.results) &&
|
6161
|
+
values.results.every((v) => v instanceof Object || v instanceof URL)) {
|
6162
|
+
// @ts-ignore: type is checked above.
|
6163
|
+
this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = values.results;
|
6164
|
+
}
|
6165
|
+
else {
|
6166
|
+
throw new TypeError("The results must be an array of type " +
|
6167
|
+
"Object | URL" + ".");
|
6168
|
+
}
|
6169
|
+
}
|
6170
|
+
if ("origin" in values && values.origin != null) {
|
6171
|
+
if (values.origin instanceof Object || values.origin instanceof URL) {
|
6172
|
+
// @ts-ignore: type is checked above.
|
6173
|
+
this.#_25zu2s3VxVujgEKqrDycjE284XQR = [values.origin];
|
6174
|
+
}
|
6175
|
+
else {
|
6176
|
+
throw new TypeError("The origin must be of type " +
|
6177
|
+
"Object | URL" + ".");
|
6178
|
+
}
|
6179
|
+
}
|
6180
|
+
if ("origins" in values && values.origins != null) {
|
6181
|
+
if ("origin" in values &&
|
6182
|
+
values.origin != null) {
|
6183
|
+
throw new TypeError("Cannot initialize both origin and " +
|
6184
|
+
"origins at the same time.");
|
6185
|
+
}
|
6186
|
+
if (Array.isArray(values.origins) &&
|
6187
|
+
values.origins.every((v) => v instanceof Object || v instanceof URL)) {
|
6188
|
+
// @ts-ignore: type is checked above.
|
6189
|
+
this.#_25zu2s3VxVujgEKqrDycjE284XQR = values.origins;
|
6190
|
+
}
|
6191
|
+
else {
|
6192
|
+
throw new TypeError("The origins must be an array of type " +
|
6193
|
+
"Object | URL" + ".");
|
6194
|
+
}
|
6195
|
+
}
|
6196
|
+
if ("instrument" in values && values.instrument != null) {
|
6197
|
+
if (values.instrument instanceof Object || values.instrument instanceof URL) {
|
6198
|
+
// @ts-ignore: type is checked above.
|
6199
|
+
this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = [values.instrument];
|
6200
|
+
}
|
6201
|
+
else {
|
6202
|
+
throw new TypeError("The instrument must be of type " +
|
6203
|
+
"Object | URL" + ".");
|
6204
|
+
}
|
6205
|
+
}
|
6206
|
+
if ("instruments" in values && values.instruments != null) {
|
6207
|
+
if ("instrument" in values &&
|
6208
|
+
values.instrument != null) {
|
6209
|
+
throw new TypeError("Cannot initialize both instrument and " +
|
6210
|
+
"instruments at the same time.");
|
6211
|
+
}
|
6212
|
+
if (Array.isArray(values.instruments) &&
|
6213
|
+
values.instruments.every((v) => v instanceof Object || v instanceof URL)) {
|
6214
|
+
// @ts-ignore: type is checked above.
|
6215
|
+
this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = values.instruments;
|
6216
|
+
}
|
6217
|
+
else {
|
6218
|
+
throw new TypeError("The instruments must be an array of type " +
|
6219
|
+
"Object | URL" + ".");
|
6220
|
+
}
|
6221
|
+
}
|
6114
6222
|
}
|
6115
6223
|
/**
|
6116
6224
|
* Clones this instance, optionally updating it with the given values.
|
@@ -6179,6 +6287,114 @@ export class Activity extends Object {
|
|
6179
6287
|
"Object | URL" + ".");
|
6180
6288
|
}
|
6181
6289
|
}
|
6290
|
+
clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF;
|
6291
|
+
if ("target" in values && values.target != null) {
|
6292
|
+
if (values.target instanceof Object || values.target instanceof URL) {
|
6293
|
+
// @ts-ignore: type is checked above.
|
6294
|
+
clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = [values.target];
|
6295
|
+
}
|
6296
|
+
else {
|
6297
|
+
throw new TypeError("The target must be of type " +
|
6298
|
+
"Object | URL" + ".");
|
6299
|
+
}
|
6300
|
+
}
|
6301
|
+
if ("targets" in values && values.targets != null) {
|
6302
|
+
if ("target" in values &&
|
6303
|
+
values.target != null) {
|
6304
|
+
throw new TypeError("Cannot update both target and " +
|
6305
|
+
"targets at the same time.");
|
6306
|
+
}
|
6307
|
+
if (Array.isArray(values.targets) &&
|
6308
|
+
values.targets.every((v) => v instanceof Object || v instanceof URL)) {
|
6309
|
+
// @ts-ignore: type is checked above.
|
6310
|
+
clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = values.targets;
|
6311
|
+
}
|
6312
|
+
else {
|
6313
|
+
throw new TypeError("The targets must be an array of type " +
|
6314
|
+
"Object | URL" + ".");
|
6315
|
+
}
|
6316
|
+
}
|
6317
|
+
clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G;
|
6318
|
+
if ("result" in values && values.result != null) {
|
6319
|
+
if (values.result instanceof Object || values.result instanceof URL) {
|
6320
|
+
// @ts-ignore: type is checked above.
|
6321
|
+
clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = [values.result];
|
6322
|
+
}
|
6323
|
+
else {
|
6324
|
+
throw new TypeError("The result must be of type " +
|
6325
|
+
"Object | URL" + ".");
|
6326
|
+
}
|
6327
|
+
}
|
6328
|
+
if ("results" in values && values.results != null) {
|
6329
|
+
if ("result" in values &&
|
6330
|
+
values.result != null) {
|
6331
|
+
throw new TypeError("Cannot update both result and " +
|
6332
|
+
"results at the same time.");
|
6333
|
+
}
|
6334
|
+
if (Array.isArray(values.results) &&
|
6335
|
+
values.results.every((v) => v instanceof Object || v instanceof URL)) {
|
6336
|
+
// @ts-ignore: type is checked above.
|
6337
|
+
clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = values.results;
|
6338
|
+
}
|
6339
|
+
else {
|
6340
|
+
throw new TypeError("The results must be an array of type " +
|
6341
|
+
"Object | URL" + ".");
|
6342
|
+
}
|
6343
|
+
}
|
6344
|
+
clone.#_25zu2s3VxVujgEKqrDycjE284XQR = this.#_25zu2s3VxVujgEKqrDycjE284XQR;
|
6345
|
+
if ("origin" in values && values.origin != null) {
|
6346
|
+
if (values.origin instanceof Object || values.origin instanceof URL) {
|
6347
|
+
// @ts-ignore: type is checked above.
|
6348
|
+
clone.#_25zu2s3VxVujgEKqrDycjE284XQR = [values.origin];
|
6349
|
+
}
|
6350
|
+
else {
|
6351
|
+
throw new TypeError("The origin must be of type " +
|
6352
|
+
"Object | URL" + ".");
|
6353
|
+
}
|
6354
|
+
}
|
6355
|
+
if ("origins" in values && values.origins != null) {
|
6356
|
+
if ("origin" in values &&
|
6357
|
+
values.origin != null) {
|
6358
|
+
throw new TypeError("Cannot update both origin and " +
|
6359
|
+
"origins at the same time.");
|
6360
|
+
}
|
6361
|
+
if (Array.isArray(values.origins) &&
|
6362
|
+
values.origins.every((v) => v instanceof Object || v instanceof URL)) {
|
6363
|
+
// @ts-ignore: type is checked above.
|
6364
|
+
clone.#_25zu2s3VxVujgEKqrDycjE284XQR = values.origins;
|
6365
|
+
}
|
6366
|
+
else {
|
6367
|
+
throw new TypeError("The origins must be an array of type " +
|
6368
|
+
"Object | URL" + ".");
|
6369
|
+
}
|
6370
|
+
}
|
6371
|
+
clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ;
|
6372
|
+
if ("instrument" in values && values.instrument != null) {
|
6373
|
+
if (values.instrument instanceof Object || values.instrument instanceof URL) {
|
6374
|
+
// @ts-ignore: type is checked above.
|
6375
|
+
clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = [values.instrument];
|
6376
|
+
}
|
6377
|
+
else {
|
6378
|
+
throw new TypeError("The instrument must be of type " +
|
6379
|
+
"Object | URL" + ".");
|
6380
|
+
}
|
6381
|
+
}
|
6382
|
+
if ("instruments" in values && values.instruments != null) {
|
6383
|
+
if ("instrument" in values &&
|
6384
|
+
values.instrument != null) {
|
6385
|
+
throw new TypeError("Cannot update both instrument and " +
|
6386
|
+
"instruments at the same time.");
|
6387
|
+
}
|
6388
|
+
if (Array.isArray(values.instruments) &&
|
6389
|
+
values.instruments.every((v) => v instanceof Object || v instanceof URL)) {
|
6390
|
+
// @ts-ignore: type is checked above.
|
6391
|
+
clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = values.instruments;
|
6392
|
+
}
|
6393
|
+
else {
|
6394
|
+
throw new TypeError("The instruments must be an array of type " +
|
6395
|
+
"Object | URL" + ".");
|
6396
|
+
}
|
6397
|
+
}
|
6182
6398
|
return clone;
|
6183
6399
|
}
|
6184
6400
|
async #fetchActor(url, options = {}) {
|
@@ -6383,6 +6599,348 @@ export class Activity extends Object {
|
|
6383
6599
|
yield v;
|
6384
6600
|
}
|
6385
6601
|
}
|
6602
|
+
async #fetchTarget(url, options = {}) {
|
6603
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
6604
|
+
fetchDocumentLoader;
|
6605
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
6606
|
+
fetchDocumentLoader;
|
6607
|
+
let fetchResult;
|
6608
|
+
try {
|
6609
|
+
fetchResult = await documentLoader(url.href);
|
6610
|
+
}
|
6611
|
+
catch (error) {
|
6612
|
+
if (options.suppressError) {
|
6613
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
6614
|
+
return null;
|
6615
|
+
}
|
6616
|
+
throw error;
|
6617
|
+
}
|
6618
|
+
const { document } = fetchResult;
|
6619
|
+
try {
|
6620
|
+
return await Object.fromJsonLd(document, { documentLoader, contextLoader });
|
6621
|
+
}
|
6622
|
+
catch (e) {
|
6623
|
+
if (!(e instanceof TypeError))
|
6624
|
+
throw e;
|
6625
|
+
}
|
6626
|
+
throw new TypeError("Expected an object of any type of: " +
|
6627
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
6628
|
+
}
|
6629
|
+
/**
|
6630
|
+
* Similar to
|
6631
|
+
* {@link Activity.getTarget},
|
6632
|
+
* but returns its `@id` URL instead of the object itself.
|
6633
|
+
*/
|
6634
|
+
get targetId() {
|
6635
|
+
if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.length < 1)
|
6636
|
+
return null;
|
6637
|
+
const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF[0];
|
6638
|
+
if (v instanceof URL)
|
6639
|
+
return v;
|
6640
|
+
return v.id;
|
6641
|
+
}
|
6642
|
+
/** Describes the indirect object, or target, of the activity. The precise
|
6643
|
+
* meaning of the target is largely dependent on the type of action being
|
6644
|
+
* described but will often be the object of the English preposition "to".
|
6645
|
+
* For instance, in the activity "John added a movie to his wishlist",
|
6646
|
+
* the target of the activity is John's wishlist. An activity can have more
|
6647
|
+
* than one target.
|
6648
|
+
*/
|
6649
|
+
async getTarget(options = {}) {
|
6650
|
+
if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.length < 1)
|
6651
|
+
return null;
|
6652
|
+
const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF[0];
|
6653
|
+
if (v instanceof URL) {
|
6654
|
+
const fetched = await this.#fetchTarget(v, options);
|
6655
|
+
if (fetched == null)
|
6656
|
+
return null;
|
6657
|
+
this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF[0] = fetched;
|
6658
|
+
return fetched;
|
6659
|
+
}
|
6660
|
+
return v;
|
6661
|
+
}
|
6662
|
+
/**
|
6663
|
+
* Similar to
|
6664
|
+
* {@link Activity.getTargets},
|
6665
|
+
* but returns their `@id`s instead of the objects themselves.
|
6666
|
+
*/
|
6667
|
+
get targetIds() {
|
6668
|
+
return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
6669
|
+
}
|
6670
|
+
/** Describes the indirect object, or target, of the activity. The precise
|
6671
|
+
* meaning of the target is largely dependent on the type of action being
|
6672
|
+
* described but will often be the object of the English preposition "to".
|
6673
|
+
* For instance, in the activity "John added a movie to his wishlist",
|
6674
|
+
* the target of the activity is John's wishlist. An activity can have more
|
6675
|
+
* than one target.
|
6676
|
+
*/
|
6677
|
+
async *getTargets(options = {}) {
|
6678
|
+
const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF;
|
6679
|
+
for (let i = 0; i < vs.length; i++) {
|
6680
|
+
const v = vs[i];
|
6681
|
+
if (v instanceof URL) {
|
6682
|
+
const fetched = await this.#fetchTarget(v, options);
|
6683
|
+
if (fetched == null)
|
6684
|
+
continue;
|
6685
|
+
vs[i] = fetched;
|
6686
|
+
yield fetched;
|
6687
|
+
continue;
|
6688
|
+
}
|
6689
|
+
yield v;
|
6690
|
+
}
|
6691
|
+
}
|
6692
|
+
async #fetchResult(url, options = {}) {
|
6693
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
6694
|
+
fetchDocumentLoader;
|
6695
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
6696
|
+
fetchDocumentLoader;
|
6697
|
+
let fetchResult;
|
6698
|
+
try {
|
6699
|
+
fetchResult = await documentLoader(url.href);
|
6700
|
+
}
|
6701
|
+
catch (error) {
|
6702
|
+
if (options.suppressError) {
|
6703
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
6704
|
+
return null;
|
6705
|
+
}
|
6706
|
+
throw error;
|
6707
|
+
}
|
6708
|
+
const { document } = fetchResult;
|
6709
|
+
try {
|
6710
|
+
return await Object.fromJsonLd(document, { documentLoader, contextLoader });
|
6711
|
+
}
|
6712
|
+
catch (e) {
|
6713
|
+
if (!(e instanceof TypeError))
|
6714
|
+
throw e;
|
6715
|
+
}
|
6716
|
+
throw new TypeError("Expected an object of any type of: " +
|
6717
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
6718
|
+
}
|
6719
|
+
/**
|
6720
|
+
* Similar to
|
6721
|
+
* {@link Activity.getResult},
|
6722
|
+
* but returns its `@id` URL instead of the object itself.
|
6723
|
+
*/
|
6724
|
+
get resultId() {
|
6725
|
+
if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G.length < 1)
|
6726
|
+
return null;
|
6727
|
+
const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G[0];
|
6728
|
+
if (v instanceof URL)
|
6729
|
+
return v;
|
6730
|
+
return v.id;
|
6731
|
+
}
|
6732
|
+
/** Describes the result of the activity. For instance, if a particular action
|
6733
|
+
* results in the creation of a new resource, the result property can be used
|
6734
|
+
* to describe that new resource.
|
6735
|
+
*/
|
6736
|
+
async getResult(options = {}) {
|
6737
|
+
if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G.length < 1)
|
6738
|
+
return null;
|
6739
|
+
const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G[0];
|
6740
|
+
if (v instanceof URL) {
|
6741
|
+
const fetched = await this.#fetchResult(v, options);
|
6742
|
+
if (fetched == null)
|
6743
|
+
return null;
|
6744
|
+
this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G[0] = fetched;
|
6745
|
+
return fetched;
|
6746
|
+
}
|
6747
|
+
return v;
|
6748
|
+
}
|
6749
|
+
/**
|
6750
|
+
* Similar to
|
6751
|
+
* {@link Activity.getResults},
|
6752
|
+
* but returns their `@id`s instead of the objects themselves.
|
6753
|
+
*/
|
6754
|
+
get resultIds() {
|
6755
|
+
return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
6756
|
+
}
|
6757
|
+
/** Describes the result of the activity. For instance, if a particular action
|
6758
|
+
* results in the creation of a new resource, the result property can be used
|
6759
|
+
* to describe that new resource.
|
6760
|
+
*/
|
6761
|
+
async *getResults(options = {}) {
|
6762
|
+
const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G;
|
6763
|
+
for (let i = 0; i < vs.length; i++) {
|
6764
|
+
const v = vs[i];
|
6765
|
+
if (v instanceof URL) {
|
6766
|
+
const fetched = await this.#fetchResult(v, options);
|
6767
|
+
if (fetched == null)
|
6768
|
+
continue;
|
6769
|
+
vs[i] = fetched;
|
6770
|
+
yield fetched;
|
6771
|
+
continue;
|
6772
|
+
}
|
6773
|
+
yield v;
|
6774
|
+
}
|
6775
|
+
}
|
6776
|
+
async #fetchOrigin(url, options = {}) {
|
6777
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
6778
|
+
fetchDocumentLoader;
|
6779
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
6780
|
+
fetchDocumentLoader;
|
6781
|
+
let fetchResult;
|
6782
|
+
try {
|
6783
|
+
fetchResult = await documentLoader(url.href);
|
6784
|
+
}
|
6785
|
+
catch (error) {
|
6786
|
+
if (options.suppressError) {
|
6787
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
6788
|
+
return null;
|
6789
|
+
}
|
6790
|
+
throw error;
|
6791
|
+
}
|
6792
|
+
const { document } = fetchResult;
|
6793
|
+
try {
|
6794
|
+
return await Object.fromJsonLd(document, { documentLoader, contextLoader });
|
6795
|
+
}
|
6796
|
+
catch (e) {
|
6797
|
+
if (!(e instanceof TypeError))
|
6798
|
+
throw e;
|
6799
|
+
}
|
6800
|
+
throw new TypeError("Expected an object of any type of: " +
|
6801
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
6802
|
+
}
|
6803
|
+
/**
|
6804
|
+
* Similar to
|
6805
|
+
* {@link Activity.getOrigin},
|
6806
|
+
* but returns its `@id` URL instead of the object itself.
|
6807
|
+
*/
|
6808
|
+
get originId() {
|
6809
|
+
if (this.#_25zu2s3VxVujgEKqrDycjE284XQR.length < 1)
|
6810
|
+
return null;
|
6811
|
+
const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR[0];
|
6812
|
+
if (v instanceof URL)
|
6813
|
+
return v;
|
6814
|
+
return v.id;
|
6815
|
+
}
|
6816
|
+
/** Describes an indirect object of the activity from which the activity is
|
6817
|
+
* directed. The precise meaning of the origin is the object of the English
|
6818
|
+
* preposition "from". For instance, in the activity "John moved an item to
|
6819
|
+
* List B from List A", the origin of the activity is "List A".
|
6820
|
+
*/
|
6821
|
+
async getOrigin(options = {}) {
|
6822
|
+
if (this.#_25zu2s3VxVujgEKqrDycjE284XQR.length < 1)
|
6823
|
+
return null;
|
6824
|
+
const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR[0];
|
6825
|
+
if (v instanceof URL) {
|
6826
|
+
const fetched = await this.#fetchOrigin(v, options);
|
6827
|
+
if (fetched == null)
|
6828
|
+
return null;
|
6829
|
+
this.#_25zu2s3VxVujgEKqrDycjE284XQR[0] = fetched;
|
6830
|
+
return fetched;
|
6831
|
+
}
|
6832
|
+
return v;
|
6833
|
+
}
|
6834
|
+
/**
|
6835
|
+
* Similar to
|
6836
|
+
* {@link Activity.getOrigins},
|
6837
|
+
* but returns their `@id`s instead of the objects themselves.
|
6838
|
+
*/
|
6839
|
+
get originIds() {
|
6840
|
+
return this.#_25zu2s3VxVujgEKqrDycjE284XQR.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
6841
|
+
}
|
6842
|
+
/** Describes an indirect object of the activity from which the activity is
|
6843
|
+
* directed. The precise meaning of the origin is the object of the English
|
6844
|
+
* preposition "from". For instance, in the activity "John moved an item to
|
6845
|
+
* List B from List A", the origin of the activity is "List A".
|
6846
|
+
*/
|
6847
|
+
async *getOrigins(options = {}) {
|
6848
|
+
const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR;
|
6849
|
+
for (let i = 0; i < vs.length; i++) {
|
6850
|
+
const v = vs[i];
|
6851
|
+
if (v instanceof URL) {
|
6852
|
+
const fetched = await this.#fetchOrigin(v, options);
|
6853
|
+
if (fetched == null)
|
6854
|
+
continue;
|
6855
|
+
vs[i] = fetched;
|
6856
|
+
yield fetched;
|
6857
|
+
continue;
|
6858
|
+
}
|
6859
|
+
yield v;
|
6860
|
+
}
|
6861
|
+
}
|
6862
|
+
async #fetchInstrument(url, options = {}) {
|
6863
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
6864
|
+
fetchDocumentLoader;
|
6865
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
6866
|
+
fetchDocumentLoader;
|
6867
|
+
let fetchResult;
|
6868
|
+
try {
|
6869
|
+
fetchResult = await documentLoader(url.href);
|
6870
|
+
}
|
6871
|
+
catch (error) {
|
6872
|
+
if (options.suppressError) {
|
6873
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
6874
|
+
return null;
|
6875
|
+
}
|
6876
|
+
throw error;
|
6877
|
+
}
|
6878
|
+
const { document } = fetchResult;
|
6879
|
+
try {
|
6880
|
+
return await Object.fromJsonLd(document, { documentLoader, contextLoader });
|
6881
|
+
}
|
6882
|
+
catch (e) {
|
6883
|
+
if (!(e instanceof TypeError))
|
6884
|
+
throw e;
|
6885
|
+
}
|
6886
|
+
throw new TypeError("Expected an object of any type of: " +
|
6887
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
6888
|
+
}
|
6889
|
+
/**
|
6890
|
+
* Similar to
|
6891
|
+
* {@link Activity.getInstrument},
|
6892
|
+
* but returns its `@id` URL instead of the object itself.
|
6893
|
+
*/
|
6894
|
+
get instrumentId() {
|
6895
|
+
if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.length < 1)
|
6896
|
+
return null;
|
6897
|
+
const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ[0];
|
6898
|
+
if (v instanceof URL)
|
6899
|
+
return v;
|
6900
|
+
return v.id;
|
6901
|
+
}
|
6902
|
+
/** Identifies one or more objects used (or to be used) in the completion of
|
6903
|
+
* an {@link Activity}.
|
6904
|
+
*/
|
6905
|
+
async getInstrument(options = {}) {
|
6906
|
+
if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.length < 1)
|
6907
|
+
return null;
|
6908
|
+
const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ[0];
|
6909
|
+
if (v instanceof URL) {
|
6910
|
+
const fetched = await this.#fetchInstrument(v, options);
|
6911
|
+
if (fetched == null)
|
6912
|
+
return null;
|
6913
|
+
this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ[0] = fetched;
|
6914
|
+
return fetched;
|
6915
|
+
}
|
6916
|
+
return v;
|
6917
|
+
}
|
6918
|
+
/**
|
6919
|
+
* Similar to
|
6920
|
+
* {@link Activity.getInstruments},
|
6921
|
+
* but returns their `@id`s instead of the objects themselves.
|
6922
|
+
*/
|
6923
|
+
get instrumentIds() {
|
6924
|
+
return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
6925
|
+
}
|
6926
|
+
/** Identifies one or more objects used (or to be used) in the completion of
|
6927
|
+
* an {@link Activity}.
|
6928
|
+
*/
|
6929
|
+
async *getInstruments(options = {}) {
|
6930
|
+
const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ;
|
6931
|
+
for (let i = 0; i < vs.length; i++) {
|
6932
|
+
const v = vs[i];
|
6933
|
+
if (v instanceof URL) {
|
6934
|
+
const fetched = await this.#fetchInstrument(v, options);
|
6935
|
+
if (fetched == null)
|
6936
|
+
continue;
|
6937
|
+
vs[i] = fetched;
|
6938
|
+
yield fetched;
|
6939
|
+
continue;
|
6940
|
+
}
|
6941
|
+
yield v;
|
6942
|
+
}
|
6943
|
+
}
|
6386
6944
|
/**
|
6387
6945
|
* Converts this object to a JSON-LD structure.
|
6388
6946
|
* @returns The JSON-LD representation of this object.
|
@@ -6400,32 +6958,72 @@ export class Activity extends Object {
|
|
6400
6958
|
});
|
6401
6959
|
const values = baseValues[0];
|
6402
6960
|
array = [];
|
6403
|
-
for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D) {
|
6961
|
+
for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D) {
|
6962
|
+
const element = v instanceof URL
|
6963
|
+
? { "@id": v.href }
|
6964
|
+
: v instanceof Application
|
6965
|
+
? await v.toJsonLd(options)
|
6966
|
+
: v instanceof Group
|
6967
|
+
? await v.toJsonLd(options)
|
6968
|
+
: v instanceof Organization
|
6969
|
+
? await v.toJsonLd(options)
|
6970
|
+
: v instanceof Person
|
6971
|
+
? await v.toJsonLd(options)
|
6972
|
+
: await v.toJsonLd(options);
|
6973
|
+
array.push(element);
|
6974
|
+
}
|
6975
|
+
if (array.length > 0) {
|
6976
|
+
values["https://www.w3.org/ns/activitystreams#actor"] = array;
|
6977
|
+
}
|
6978
|
+
array = [];
|
6979
|
+
for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc) {
|
6980
|
+
const element = v instanceof URL
|
6981
|
+
? { "@id": v.href }
|
6982
|
+
: await v.toJsonLd(options);
|
6983
|
+
array.push(element);
|
6984
|
+
}
|
6985
|
+
if (array.length > 0) {
|
6986
|
+
values["https://www.w3.org/ns/activitystreams#object"] = array;
|
6987
|
+
}
|
6988
|
+
array = [];
|
6989
|
+
for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF) {
|
6990
|
+
const element = v instanceof URL
|
6991
|
+
? { "@id": v.href }
|
6992
|
+
: await v.toJsonLd(options);
|
6993
|
+
array.push(element);
|
6994
|
+
}
|
6995
|
+
if (array.length > 0) {
|
6996
|
+
values["https://www.w3.org/ns/activitystreams#target"] = array;
|
6997
|
+
}
|
6998
|
+
array = [];
|
6999
|
+
for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G) {
|
6404
7000
|
const element = v instanceof URL
|
6405
7001
|
? { "@id": v.href }
|
6406
|
-
: v
|
6407
|
-
? await v.toJsonLd(options)
|
6408
|
-
: v instanceof Group
|
6409
|
-
? await v.toJsonLd(options)
|
6410
|
-
: v instanceof Organization
|
6411
|
-
? await v.toJsonLd(options)
|
6412
|
-
: v instanceof Person
|
6413
|
-
? await v.toJsonLd(options)
|
6414
|
-
: await v.toJsonLd(options);
|
7002
|
+
: await v.toJsonLd(options);
|
6415
7003
|
array.push(element);
|
6416
7004
|
}
|
6417
7005
|
if (array.length > 0) {
|
6418
|
-
values["https://www.w3.org/ns/activitystreams#
|
7006
|
+
values["https://www.w3.org/ns/activitystreams#result"] = array;
|
6419
7007
|
}
|
6420
7008
|
array = [];
|
6421
|
-
for (const v of this.#
|
7009
|
+
for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR) {
|
6422
7010
|
const element = v instanceof URL
|
6423
7011
|
? { "@id": v.href }
|
6424
7012
|
: await v.toJsonLd(options);
|
6425
7013
|
array.push(element);
|
6426
7014
|
}
|
6427
7015
|
if (array.length > 0) {
|
6428
|
-
values["https://www.w3.org/ns/activitystreams#
|
7016
|
+
values["https://www.w3.org/ns/activitystreams#origin"] = array;
|
7017
|
+
}
|
7018
|
+
array = [];
|
7019
|
+
for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ) {
|
7020
|
+
const element = v instanceof URL
|
7021
|
+
? { "@id": v.href }
|
7022
|
+
: await v.toJsonLd(options);
|
7023
|
+
array.push(element);
|
7024
|
+
}
|
7025
|
+
if (array.length > 0) {
|
7026
|
+
values["https://www.w3.org/ns/activitystreams#instrument"] = array;
|
6429
7027
|
}
|
6430
7028
|
values["@type"] = ["https://www.w3.org/ns/activitystreams#Activity"];
|
6431
7029
|
if (this.id)
|
@@ -6603,6 +7201,55 @@ export class Activity extends Object {
|
|
6603
7201
|
_2MH19yxjn1wnHsNfa5n4JBhJzxyc.push(await Object.fromJsonLd(v, options));
|
6604
7202
|
}
|
6605
7203
|
instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = _2MH19yxjn1wnHsNfa5n4JBhJzxyc;
|
7204
|
+
const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = [];
|
7205
|
+
for (const v of values["https://www.w3.org/ns/activitystreams#target"] ?? []) {
|
7206
|
+
if (v == null)
|
7207
|
+
continue;
|
7208
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
7209
|
+
globalThis.Object.keys(v).length === 1) {
|
7210
|
+
_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.push(new URL(v["@id"]));
|
7211
|
+
continue;
|
7212
|
+
}
|
7213
|
+
_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.push(await Object.fromJsonLd(v, options));
|
7214
|
+
}
|
7215
|
+
instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF;
|
7216
|
+
const _u4QGFbRFcYmPEKGbPv1hpBR9r5G = [];
|
7217
|
+
for (const v of values["https://www.w3.org/ns/activitystreams#result"] ?? []) {
|
7218
|
+
if (v == null)
|
7219
|
+
continue;
|
7220
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
7221
|
+
globalThis.Object.keys(v).length === 1) {
|
7222
|
+
_u4QGFbRFcYmPEKGbPv1hpBR9r5G.push(new URL(v["@id"]));
|
7223
|
+
continue;
|
7224
|
+
}
|
7225
|
+
_u4QGFbRFcYmPEKGbPv1hpBR9r5G.push(await Object.fromJsonLd(v, options));
|
7226
|
+
}
|
7227
|
+
instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G = _u4QGFbRFcYmPEKGbPv1hpBR9r5G;
|
7228
|
+
const _25zu2s3VxVujgEKqrDycjE284XQR = [];
|
7229
|
+
for (const v of values["https://www.w3.org/ns/activitystreams#origin"] ?? []) {
|
7230
|
+
if (v == null)
|
7231
|
+
continue;
|
7232
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
7233
|
+
globalThis.Object.keys(v).length === 1) {
|
7234
|
+
_25zu2s3VxVujgEKqrDycjE284XQR.push(new URL(v["@id"]));
|
7235
|
+
continue;
|
7236
|
+
}
|
7237
|
+
_25zu2s3VxVujgEKqrDycjE284XQR.push(await Object.fromJsonLd(v, options));
|
7238
|
+
}
|
7239
|
+
instance.#_25zu2s3VxVujgEKqrDycjE284XQR = _25zu2s3VxVujgEKqrDycjE284XQR;
|
7240
|
+
const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ = [];
|
7241
|
+
for (const v of values["https://www.w3.org/ns/activitystreams#instrument"] ??
|
7242
|
+
[]) {
|
7243
|
+
if (v == null)
|
7244
|
+
continue;
|
7245
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
7246
|
+
globalThis.Object.keys(v).length === 1) {
|
7247
|
+
_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.push(new URL(v["@id"]));
|
7248
|
+
continue;
|
7249
|
+
}
|
7250
|
+
_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.push(await Object.fromJsonLd(v, options));
|
7251
|
+
}
|
7252
|
+
instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ;
|
6606
7253
|
return instance;
|
6607
7254
|
}
|
6608
7255
|
_getCustomInspectProxy() {
|
@@ -6639,6 +7286,70 @@ export class Activity extends Object {
|
|
6639
7286
|
_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length > 0) {
|
6640
7287
|
proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc;
|
6641
7288
|
}
|
7289
|
+
const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF
|
7290
|
+
// deno-lint-ignore no-explicit-any
|
7291
|
+
.map((v) => v instanceof URL
|
7292
|
+
? {
|
7293
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
7294
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
7295
|
+
}
|
7296
|
+
: v);
|
7297
|
+
if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.length == 1) {
|
7298
|
+
proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF[0];
|
7299
|
+
}
|
7300
|
+
if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.length > 1 ||
|
7301
|
+
!("target" in proxy) &&
|
7302
|
+
_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF.length > 0) {
|
7303
|
+
proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF;
|
7304
|
+
}
|
7305
|
+
const _u4QGFbRFcYmPEKGbPv1hpBR9r5G = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G
|
7306
|
+
// deno-lint-ignore no-explicit-any
|
7307
|
+
.map((v) => v instanceof URL
|
7308
|
+
? {
|
7309
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
7310
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
7311
|
+
}
|
7312
|
+
: v);
|
7313
|
+
if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G.length == 1) {
|
7314
|
+
proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G[0];
|
7315
|
+
}
|
7316
|
+
if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G.length > 1 ||
|
7317
|
+
!("result" in proxy) &&
|
7318
|
+
_u4QGFbRFcYmPEKGbPv1hpBR9r5G.length > 0) {
|
7319
|
+
proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G;
|
7320
|
+
}
|
7321
|
+
const _25zu2s3VxVujgEKqrDycjE284XQR = this.#_25zu2s3VxVujgEKqrDycjE284XQR
|
7322
|
+
// deno-lint-ignore no-explicit-any
|
7323
|
+
.map((v) => v instanceof URL
|
7324
|
+
? {
|
7325
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
7326
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
7327
|
+
}
|
7328
|
+
: v);
|
7329
|
+
if (_25zu2s3VxVujgEKqrDycjE284XQR.length == 1) {
|
7330
|
+
proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR[0];
|
7331
|
+
}
|
7332
|
+
if (_25zu2s3VxVujgEKqrDycjE284XQR.length > 1 ||
|
7333
|
+
!("origin" in proxy) &&
|
7334
|
+
_25zu2s3VxVujgEKqrDycjE284XQR.length > 0) {
|
7335
|
+
proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR;
|
7336
|
+
}
|
7337
|
+
const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ
|
7338
|
+
// deno-lint-ignore no-explicit-any
|
7339
|
+
.map((v) => v instanceof URL
|
7340
|
+
? {
|
7341
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
7342
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
7343
|
+
}
|
7344
|
+
: v);
|
7345
|
+
if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.length == 1) {
|
7346
|
+
proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ[0];
|
7347
|
+
}
|
7348
|
+
if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.length > 1 ||
|
7349
|
+
!("instrument" in proxy) &&
|
7350
|
+
_3c5t2x7DYRo2shwTxpkd4kYSS5WQ.length > 0) {
|
7351
|
+
proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ;
|
7352
|
+
}
|
6642
7353
|
return proxy;
|
6643
7354
|
}
|
6644
7355
|
[Symbol.for("Deno.customInspect")](inspect, options) {
|
@@ -7011,6 +7722,7 @@ export class Application extends Object {
|
|
7011
7722
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
7012
7723
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
7013
7724
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
7725
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
7014
7726
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
7015
7727
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
7016
7728
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -7169,6 +7881,16 @@ export class Application extends Object {
|
|
7169
7881
|
"Collection | URL" + ".");
|
7170
7882
|
}
|
7171
7883
|
}
|
7884
|
+
if ("featured" in values && values.featured != null) {
|
7885
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
7886
|
+
// @ts-ignore: type is checked above.
|
7887
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
7888
|
+
}
|
7889
|
+
else {
|
7890
|
+
throw new TypeError("The featured must be of type " +
|
7891
|
+
"Collection | URL" + ".");
|
7892
|
+
}
|
7893
|
+
}
|
7172
7894
|
if ("streams" in values && values.streams != null) {
|
7173
7895
|
if (Array.isArray(values.streams) &&
|
7174
7896
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -7395,6 +8117,17 @@ export class Application extends Object {
|
|
7395
8117
|
"Collection | URL" + ".");
|
7396
8118
|
}
|
7397
8119
|
}
|
8120
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
8121
|
+
if ("featured" in values && values.featured != null) {
|
8122
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
8123
|
+
// @ts-ignore: type is checked above.
|
8124
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
8125
|
+
}
|
8126
|
+
else {
|
8127
|
+
throw new TypeError("The featured must be of type " +
|
8128
|
+
"Collection | URL" + ".");
|
8129
|
+
}
|
8130
|
+
}
|
7398
8131
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
7399
8132
|
if ("streams" in values && values.streams != null) {
|
7400
8133
|
if (Array.isArray(values.streams) &&
|
@@ -7968,6 +8701,64 @@ export class Application extends Object {
|
|
7968
8701
|
}
|
7969
8702
|
return v;
|
7970
8703
|
}
|
8704
|
+
async #fetchFeatured(url, options = {}) {
|
8705
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
8706
|
+
fetchDocumentLoader;
|
8707
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
8708
|
+
fetchDocumentLoader;
|
8709
|
+
let fetchResult;
|
8710
|
+
try {
|
8711
|
+
fetchResult = await documentLoader(url.href);
|
8712
|
+
}
|
8713
|
+
catch (error) {
|
8714
|
+
if (options.suppressError) {
|
8715
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
8716
|
+
return null;
|
8717
|
+
}
|
8718
|
+
throw error;
|
8719
|
+
}
|
8720
|
+
const { document } = fetchResult;
|
8721
|
+
try {
|
8722
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
8723
|
+
}
|
8724
|
+
catch (e) {
|
8725
|
+
if (!(e instanceof TypeError))
|
8726
|
+
throw e;
|
8727
|
+
}
|
8728
|
+
throw new TypeError("Expected an object of any type of: " +
|
8729
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
8730
|
+
}
|
8731
|
+
/**
|
8732
|
+
* Similar to
|
8733
|
+
* {@link Application.getFeatured},
|
8734
|
+
* but returns its `@id` URL instead of the object itself.
|
8735
|
+
*/
|
8736
|
+
get featuredId() {
|
8737
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
8738
|
+
return null;
|
8739
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
8740
|
+
if (v instanceof URL)
|
8741
|
+
return v;
|
8742
|
+
return v.id;
|
8743
|
+
}
|
8744
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
8745
|
+
* featured at the top of people's profiles, is implemented using an extra
|
8746
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
8747
|
+
* of objects.
|
8748
|
+
*/
|
8749
|
+
async getFeatured(options = {}) {
|
8750
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
8751
|
+
return null;
|
8752
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
8753
|
+
if (v instanceof URL) {
|
8754
|
+
const fetched = await this.#fetchFeatured(v, options);
|
8755
|
+
if (fetched == null)
|
8756
|
+
return null;
|
8757
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
8758
|
+
return fetched;
|
8759
|
+
}
|
8760
|
+
return v;
|
8761
|
+
}
|
7971
8762
|
async #fetchStream(url, options = {}) {
|
7972
8763
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
7973
8764
|
fetchDocumentLoader;
|
@@ -8166,6 +8957,15 @@ export class Application extends Object {
|
|
8166
8957
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
8167
8958
|
}
|
8168
8959
|
array = [];
|
8960
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
8961
|
+
const element = v instanceof URL
|
8962
|
+
? { "@id": v.href }
|
8963
|
+
: await v.toJsonLd(options);
|
8964
|
+
array.push(element);
|
8965
|
+
}
|
8966
|
+
if (array.length > 0)
|
8967
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
8968
|
+
array = [];
|
8169
8969
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
8170
8970
|
const element = v instanceof URL
|
8171
8971
|
? { "@id": v.href }
|
@@ -8230,6 +9030,7 @@ export class Application extends Object {
|
|
8230
9030
|
{
|
8231
9031
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
8232
9032
|
"toot": "http://joinmastodon.org/ns#",
|
9033
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
8233
9034
|
"discoverable": "toot:discoverable",
|
8234
9035
|
"suspended": "toot:suspended",
|
8235
9036
|
"memorial": "toot:memorial",
|
@@ -8389,6 +9190,18 @@ export class Application extends Object {
|
|
8389
9190
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
8390
9191
|
}
|
8391
9192
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
9193
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
9194
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
9195
|
+
if (v == null)
|
9196
|
+
continue;
|
9197
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
9198
|
+
globalThis.Object.keys(v).length === 1) {
|
9199
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
9200
|
+
continue;
|
9201
|
+
}
|
9202
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
9203
|
+
}
|
9204
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
8392
9205
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
8393
9206
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
8394
9207
|
if (v == null)
|
@@ -8554,6 +9367,17 @@ export class Application extends Object {
|
|
8554
9367
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
8555
9368
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
8556
9369
|
}
|
9370
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
9371
|
+
// deno-lint-ignore no-explicit-any
|
9372
|
+
.map((v) => v instanceof URL
|
9373
|
+
? {
|
9374
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
9375
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
9376
|
+
}
|
9377
|
+
: v);
|
9378
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
9379
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
9380
|
+
}
|
8557
9381
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
8558
9382
|
// deno-lint-ignore no-explicit-any
|
8559
9383
|
.map((v) => v instanceof URL
|
@@ -9607,46 +10431,44 @@ export class Collection extends Object {
|
|
9607
10431
|
}
|
9608
10432
|
if ("current" in values && values.current != null) {
|
9609
10433
|
if (values.current instanceof CollectionPage ||
|
9610
|
-
values.current instanceof
|
10434
|
+
values.current instanceof URL) {
|
9611
10435
|
// @ts-ignore: type is checked above.
|
9612
10436
|
this.#_3UyUdxnyn6cDn53QKrh4MBiearma = [values.current];
|
9613
10437
|
}
|
9614
10438
|
else {
|
9615
10439
|
throw new TypeError("The current must be of type " +
|
9616
|
-
"CollectionPage |
|
10440
|
+
"CollectionPage | URL" + ".");
|
9617
10441
|
}
|
9618
10442
|
}
|
9619
10443
|
if ("first" in values && values.first != null) {
|
9620
|
-
if (values.first instanceof CollectionPage ||
|
9621
|
-
values.first instanceof Link || values.first instanceof URL) {
|
10444
|
+
if (values.first instanceof CollectionPage || values.first instanceof URL) {
|
9622
10445
|
// @ts-ignore: type is checked above.
|
9623
10446
|
this.#_J52RqweMe6hhv7RnLJMC8BExTE5 = [values.first];
|
9624
10447
|
}
|
9625
10448
|
else {
|
9626
10449
|
throw new TypeError("The first must be of type " +
|
9627
|
-
"CollectionPage |
|
10450
|
+
"CollectionPage | URL" + ".");
|
9628
10451
|
}
|
9629
10452
|
}
|
9630
10453
|
if ("last" in values && values.last != null) {
|
9631
|
-
if (values.last instanceof CollectionPage || values.last instanceof
|
9632
|
-
values.last instanceof URL) {
|
10454
|
+
if (values.last instanceof CollectionPage || values.last instanceof URL) {
|
9633
10455
|
// @ts-ignore: type is checked above.
|
9634
10456
|
this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = [values.last];
|
9635
10457
|
}
|
9636
10458
|
else {
|
9637
10459
|
throw new TypeError("The last must be of type " +
|
9638
|
-
"CollectionPage |
|
10460
|
+
"CollectionPage | URL" + ".");
|
9639
10461
|
}
|
9640
10462
|
}
|
9641
10463
|
if ("items" in values && values.items != null) {
|
9642
10464
|
if (Array.isArray(values.items) &&
|
9643
|
-
values.items.every((v) => v instanceof Object || v instanceof
|
10465
|
+
values.items.every((v) => v instanceof Object || v instanceof URL)) {
|
9644
10466
|
// @ts-ignore: type is checked above.
|
9645
10467
|
this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
|
9646
10468
|
}
|
9647
10469
|
else {
|
9648
10470
|
throw new TypeError("The items must be an array of type " +
|
9649
|
-
"Object |
|
10471
|
+
"Object | URL" + ".");
|
9650
10472
|
}
|
9651
10473
|
}
|
9652
10474
|
}
|
@@ -9673,49 +10495,47 @@ export class Collection extends Object {
|
|
9673
10495
|
clone.#_3UyUdxnyn6cDn53QKrh4MBiearma = this.#_3UyUdxnyn6cDn53QKrh4MBiearma;
|
9674
10496
|
if ("current" in values && values.current != null) {
|
9675
10497
|
if (values.current instanceof CollectionPage ||
|
9676
|
-
values.current instanceof
|
10498
|
+
values.current instanceof URL) {
|
9677
10499
|
// @ts-ignore: type is checked above.
|
9678
10500
|
clone.#_3UyUdxnyn6cDn53QKrh4MBiearma = [values.current];
|
9679
10501
|
}
|
9680
10502
|
else {
|
9681
10503
|
throw new TypeError("The current must be of type " +
|
9682
|
-
"CollectionPage |
|
10504
|
+
"CollectionPage | URL" + ".");
|
9683
10505
|
}
|
9684
10506
|
}
|
9685
10507
|
clone.#_J52RqweMe6hhv7RnLJMC8BExTE5 = this.#_J52RqweMe6hhv7RnLJMC8BExTE5;
|
9686
10508
|
if ("first" in values && values.first != null) {
|
9687
|
-
if (values.first instanceof CollectionPage ||
|
9688
|
-
values.first instanceof Link || values.first instanceof URL) {
|
10509
|
+
if (values.first instanceof CollectionPage || values.first instanceof URL) {
|
9689
10510
|
// @ts-ignore: type is checked above.
|
9690
10511
|
clone.#_J52RqweMe6hhv7RnLJMC8BExTE5 = [values.first];
|
9691
10512
|
}
|
9692
10513
|
else {
|
9693
10514
|
throw new TypeError("The first must be of type " +
|
9694
|
-
"CollectionPage |
|
10515
|
+
"CollectionPage | URL" + ".");
|
9695
10516
|
}
|
9696
10517
|
}
|
9697
10518
|
clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26;
|
9698
10519
|
if ("last" in values && values.last != null) {
|
9699
|
-
if (values.last instanceof CollectionPage || values.last instanceof
|
9700
|
-
values.last instanceof URL) {
|
10520
|
+
if (values.last instanceof CollectionPage || values.last instanceof URL) {
|
9701
10521
|
// @ts-ignore: type is checked above.
|
9702
10522
|
clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = [values.last];
|
9703
10523
|
}
|
9704
10524
|
else {
|
9705
10525
|
throw new TypeError("The last must be of type " +
|
9706
|
-
"CollectionPage |
|
10526
|
+
"CollectionPage | URL" + ".");
|
9707
10527
|
}
|
9708
10528
|
}
|
9709
10529
|
clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
|
9710
10530
|
if ("items" in values && values.items != null) {
|
9711
10531
|
if (Array.isArray(values.items) &&
|
9712
|
-
values.items.every((v) => v instanceof Object || v instanceof
|
10532
|
+
values.items.every((v) => v instanceof Object || v instanceof URL)) {
|
9713
10533
|
// @ts-ignore: type is checked above.
|
9714
10534
|
clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
|
9715
10535
|
}
|
9716
10536
|
else {
|
9717
10537
|
throw new TypeError("The items must be an array of type " +
|
9718
|
-
"Object |
|
10538
|
+
"Object | URL" + ".");
|
9719
10539
|
}
|
9720
10540
|
}
|
9721
10541
|
return clone;
|
@@ -9753,18 +10573,8 @@ export class Collection extends Object {
|
|
9753
10573
|
if (!(e instanceof TypeError))
|
9754
10574
|
throw e;
|
9755
10575
|
}
|
9756
|
-
try {
|
9757
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
9758
|
-
}
|
9759
|
-
catch (e) {
|
9760
|
-
if (!(e instanceof TypeError))
|
9761
|
-
throw e;
|
9762
|
-
}
|
9763
10576
|
throw new TypeError("Expected an object of any type of: " +
|
9764
|
-
[
|
9765
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
9766
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
9767
|
-
].join(", "));
|
10577
|
+
["https://www.w3.org/ns/activitystreams#CollectionPage"].join(", "));
|
9768
10578
|
}
|
9769
10579
|
/**
|
9770
10580
|
* Similar to
|
@@ -9819,18 +10629,8 @@ export class Collection extends Object {
|
|
9819
10629
|
if (!(e instanceof TypeError))
|
9820
10630
|
throw e;
|
9821
10631
|
}
|
9822
|
-
try {
|
9823
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
9824
|
-
}
|
9825
|
-
catch (e) {
|
9826
|
-
if (!(e instanceof TypeError))
|
9827
|
-
throw e;
|
9828
|
-
}
|
9829
10632
|
throw new TypeError("Expected an object of any type of: " +
|
9830
|
-
[
|
9831
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
9832
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
9833
|
-
].join(", "));
|
10633
|
+
["https://www.w3.org/ns/activitystreams#CollectionPage"].join(", "));
|
9834
10634
|
}
|
9835
10635
|
/**
|
9836
10636
|
* Similar to
|
@@ -9885,18 +10685,8 @@ export class Collection extends Object {
|
|
9885
10685
|
if (!(e instanceof TypeError))
|
9886
10686
|
throw e;
|
9887
10687
|
}
|
9888
|
-
try {
|
9889
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
9890
|
-
}
|
9891
|
-
catch (e) {
|
9892
|
-
if (!(e instanceof TypeError))
|
9893
|
-
throw e;
|
9894
|
-
}
|
9895
10688
|
throw new TypeError("Expected an object of any type of: " +
|
9896
|
-
[
|
9897
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
9898
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
9899
|
-
].join(", "));
|
10689
|
+
["https://www.w3.org/ns/activitystreams#CollectionPage"].join(", "));
|
9900
10690
|
}
|
9901
10691
|
/**
|
9902
10692
|
* Similar to
|
@@ -9951,18 +10741,8 @@ export class Collection extends Object {
|
|
9951
10741
|
if (!(e instanceof TypeError))
|
9952
10742
|
throw e;
|
9953
10743
|
}
|
9954
|
-
try {
|
9955
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
9956
|
-
}
|
9957
|
-
catch (e) {
|
9958
|
-
if (!(e instanceof TypeError))
|
9959
|
-
throw e;
|
9960
|
-
}
|
9961
10744
|
throw new TypeError("Expected an object of any type of: " +
|
9962
|
-
[
|
9963
|
-
"https://www.w3.org/ns/activitystreams#Object",
|
9964
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
9965
|
-
].join(", "));
|
10745
|
+
["https://www.w3.org/ns/activitystreams#Object"].join(", "));
|
9966
10746
|
}
|
9967
10747
|
/**
|
9968
10748
|
* Similar to
|
@@ -10021,9 +10801,7 @@ export class Collection extends Object {
|
|
10021
10801
|
for (const v of this.#_3UyUdxnyn6cDn53QKrh4MBiearma) {
|
10022
10802
|
const element = v instanceof URL
|
10023
10803
|
? { "@id": v.href }
|
10024
|
-
: v
|
10025
|
-
? await v.toJsonLd(options)
|
10026
|
-
: await v.toJsonLd(options);
|
10804
|
+
: await v.toJsonLd(options);
|
10027
10805
|
array.push(element);
|
10028
10806
|
}
|
10029
10807
|
if (array.length > 0) {
|
@@ -10033,9 +10811,7 @@ export class Collection extends Object {
|
|
10033
10811
|
for (const v of this.#_J52RqweMe6hhv7RnLJMC8BExTE5) {
|
10034
10812
|
const element = v instanceof URL
|
10035
10813
|
? { "@id": v.href }
|
10036
|
-
: v
|
10037
|
-
? await v.toJsonLd(options)
|
10038
|
-
: await v.toJsonLd(options);
|
10814
|
+
: await v.toJsonLd(options);
|
10039
10815
|
array.push(element);
|
10040
10816
|
}
|
10041
10817
|
if (array.length > 0) {
|
@@ -10045,9 +10821,7 @@ export class Collection extends Object {
|
|
10045
10821
|
for (const v of this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26) {
|
10046
10822
|
const element = v instanceof URL
|
10047
10823
|
? { "@id": v.href }
|
10048
|
-
: v
|
10049
|
-
? await v.toJsonLd(options)
|
10050
|
-
: await v.toJsonLd(options);
|
10824
|
+
: await v.toJsonLd(options);
|
10051
10825
|
array.push(element);
|
10052
10826
|
}
|
10053
10827
|
if (array.length > 0) {
|
@@ -10057,9 +10831,7 @@ export class Collection extends Object {
|
|
10057
10831
|
for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg) {
|
10058
10832
|
const element = v instanceof URL
|
10059
10833
|
? { "@id": v.href }
|
10060
|
-
: v
|
10061
|
-
? await v.toJsonLd(options)
|
10062
|
-
: await v.toJsonLd(options);
|
10834
|
+
: await v.toJsonLd(options);
|
10063
10835
|
array.push(element);
|
10064
10836
|
}
|
10065
10837
|
if (array.length > 0) {
|
@@ -10130,37 +10902,19 @@ export class Collection extends Object {
|
|
10130
10902
|
[]) {
|
10131
10903
|
if (v == null)
|
10132
10904
|
continue;
|
10133
|
-
_XDbmNDuWHmrhqH712zqtecdbv1V.push(v["@value"]);
|
10134
|
-
}
|
10135
|
-
instance.#_XDbmNDuWHmrhqH712zqtecdbv1V = _XDbmNDuWHmrhqH712zqtecdbv1V;
|
10136
|
-
const _3UyUdxnyn6cDn53QKrh4MBiearma = [];
|
10137
|
-
for (const v of values["https://www.w3.org/ns/activitystreams#current"] ?? []) {
|
10138
|
-
if (v == null)
|
10139
|
-
continue;
|
10140
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
10141
|
-
globalThis.Object.keys(v).length === 1) {
|
10142
|
-
_3UyUdxnyn6cDn53QKrh4MBiearma.push(new URL(v["@id"]));
|
10143
|
-
continue;
|
10144
|
-
}
|
10145
|
-
|
10146
|
-
Array.isArray(v["@type"]) &&
|
10147
|
-
[
|
10148
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10149
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10150
|
-
].some((t) => v["@type"].includes(t))
|
10151
|
-
? await CollectionPage.fromJsonLd(v, options)
|
10152
|
-
: typeof v === "object" && "@type" in v &&
|
10153
|
-
Array.isArray(v["@type"]) &&
|
10154
|
-
[
|
10155
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10156
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10157
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10158
|
-
].some((t) => v["@type"].includes(t))
|
10159
|
-
? await Link.fromJsonLd(v, options)
|
10160
|
-
: undefined;
|
10161
|
-
if (typeof decoded === "undefined")
|
10162
|
-
continue;
|
10163
|
-
_3UyUdxnyn6cDn53QKrh4MBiearma.push(decoded);
|
10905
|
+
_XDbmNDuWHmrhqH712zqtecdbv1V.push(v["@value"]);
|
10906
|
+
}
|
10907
|
+
instance.#_XDbmNDuWHmrhqH712zqtecdbv1V = _XDbmNDuWHmrhqH712zqtecdbv1V;
|
10908
|
+
const _3UyUdxnyn6cDn53QKrh4MBiearma = [];
|
10909
|
+
for (const v of values["https://www.w3.org/ns/activitystreams#current"] ?? []) {
|
10910
|
+
if (v == null)
|
10911
|
+
continue;
|
10912
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
10913
|
+
globalThis.Object.keys(v).length === 1) {
|
10914
|
+
_3UyUdxnyn6cDn53QKrh4MBiearma.push(new URL(v["@id"]));
|
10915
|
+
continue;
|
10916
|
+
}
|
10917
|
+
_3UyUdxnyn6cDn53QKrh4MBiearma.push(await CollectionPage.fromJsonLd(v, options));
|
10164
10918
|
}
|
10165
10919
|
instance.#_3UyUdxnyn6cDn53QKrh4MBiearma = _3UyUdxnyn6cDn53QKrh4MBiearma;
|
10166
10920
|
const _J52RqweMe6hhv7RnLJMC8BExTE5 = [];
|
@@ -10172,25 +10926,7 @@ export class Collection extends Object {
|
|
10172
10926
|
_J52RqweMe6hhv7RnLJMC8BExTE5.push(new URL(v["@id"]));
|
10173
10927
|
continue;
|
10174
10928
|
}
|
10175
|
-
|
10176
|
-
Array.isArray(v["@type"]) &&
|
10177
|
-
[
|
10178
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10179
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10180
|
-
].some((t) => v["@type"].includes(t))
|
10181
|
-
? await CollectionPage.fromJsonLd(v, options)
|
10182
|
-
: typeof v === "object" && "@type" in v &&
|
10183
|
-
Array.isArray(v["@type"]) &&
|
10184
|
-
[
|
10185
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10186
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10187
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10188
|
-
].some((t) => v["@type"].includes(t))
|
10189
|
-
? await Link.fromJsonLd(v, options)
|
10190
|
-
: undefined;
|
10191
|
-
if (typeof decoded === "undefined")
|
10192
|
-
continue;
|
10193
|
-
_J52RqweMe6hhv7RnLJMC8BExTE5.push(decoded);
|
10929
|
+
_J52RqweMe6hhv7RnLJMC8BExTE5.push(await CollectionPage.fromJsonLd(v, options));
|
10194
10930
|
}
|
10195
10931
|
instance.#_J52RqweMe6hhv7RnLJMC8BExTE5 = _J52RqweMe6hhv7RnLJMC8BExTE5;
|
10196
10932
|
const _gyJJnyEFnuNVi1HFZKfAn3Hfn26 = [];
|
@@ -10202,25 +10938,7 @@ export class Collection extends Object {
|
|
10202
10938
|
_gyJJnyEFnuNVi1HFZKfAn3Hfn26.push(new URL(v["@id"]));
|
10203
10939
|
continue;
|
10204
10940
|
}
|
10205
|
-
|
10206
|
-
Array.isArray(v["@type"]) &&
|
10207
|
-
[
|
10208
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10209
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10210
|
-
].some((t) => v["@type"].includes(t))
|
10211
|
-
? await CollectionPage.fromJsonLd(v, options)
|
10212
|
-
: typeof v === "object" && "@type" in v &&
|
10213
|
-
Array.isArray(v["@type"]) &&
|
10214
|
-
[
|
10215
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10216
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10217
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10218
|
-
].some((t) => v["@type"].includes(t))
|
10219
|
-
? await Link.fromJsonLd(v, options)
|
10220
|
-
: undefined;
|
10221
|
-
if (typeof decoded === "undefined")
|
10222
|
-
continue;
|
10223
|
-
_gyJJnyEFnuNVi1HFZKfAn3Hfn26.push(decoded);
|
10941
|
+
_gyJJnyEFnuNVi1HFZKfAn3Hfn26.push(await CollectionPage.fromJsonLd(v, options));
|
10224
10942
|
}
|
10225
10943
|
instance.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = _gyJJnyEFnuNVi1HFZKfAn3Hfn26;
|
10226
10944
|
const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = [];
|
@@ -10232,66 +10950,7 @@ export class Collection extends Object {
|
|
10232
10950
|
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(new URL(v["@id"]));
|
10233
10951
|
continue;
|
10234
10952
|
}
|
10235
|
-
|
10236
|
-
Array.isArray(v["@type"]) &&
|
10237
|
-
[
|
10238
|
-
"https://www.w3.org/ns/activitystreams#Object",
|
10239
|
-
"http://joinmastodon.org/ns#Emoji",
|
10240
|
-
"https://www.w3.org/ns/activitystreams#Activity",
|
10241
|
-
"https://www.w3.org/ns/activitystreams#Accept",
|
10242
|
-
"https://www.w3.org/ns/activitystreams#Add",
|
10243
|
-
"https://www.w3.org/ns/activitystreams#Announce",
|
10244
|
-
"https://www.w3.org/ns/activitystreams#Create",
|
10245
|
-
"https://www.w3.org/ns/activitystreams#Delete",
|
10246
|
-
"https://www.w3.org/ns/activitystreams#Dislike",
|
10247
|
-
"https://www.w3.org/ns/activitystreams#Flag",
|
10248
|
-
"https://www.w3.org/ns/activitystreams#Follow",
|
10249
|
-
"https://www.w3.org/ns/activitystreams#Ignore",
|
10250
|
-
"https://www.w3.org/ns/activitystreams#Block",
|
10251
|
-
"https://www.w3.org/ns/activitystreams#IntransitiveActivity",
|
10252
|
-
"https://www.w3.org/ns/activitystreams#Arrive",
|
10253
|
-
"https://www.w3.org/ns/activitystreams#Question",
|
10254
|
-
"https://www.w3.org/ns/activitystreams#Like",
|
10255
|
-
"https://www.w3.org/ns/activitystreams#Offer",
|
10256
|
-
"https://www.w3.org/ns/activitystreams#Reject",
|
10257
|
-
"https://www.w3.org/ns/activitystreams#Remove",
|
10258
|
-
"https://www.w3.org/ns/activitystreams#Undo",
|
10259
|
-
"https://www.w3.org/ns/activitystreams#Update",
|
10260
|
-
"https://www.w3.org/ns/activitystreams#Application",
|
10261
|
-
"https://www.w3.org/ns/activitystreams#Article",
|
10262
|
-
"https://www.w3.org/ns/activitystreams#Collection",
|
10263
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10264
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10265
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollection",
|
10266
|
-
"https://www.w3.org/ns/activitystreams#Document",
|
10267
|
-
"https://www.w3.org/ns/activitystreams#Audio",
|
10268
|
-
"https://www.w3.org/ns/activitystreams#Image",
|
10269
|
-
"https://www.w3.org/ns/activitystreams#Page",
|
10270
|
-
"https://www.w3.org/ns/activitystreams#Video",
|
10271
|
-
"https://www.w3.org/ns/activitystreams#Event",
|
10272
|
-
"https://www.w3.org/ns/activitystreams#Group",
|
10273
|
-
"https://www.w3.org/ns/activitystreams#Note",
|
10274
|
-
"https://www.w3.org/ns/activitystreams#Organization",
|
10275
|
-
"https://www.w3.org/ns/activitystreams#Person",
|
10276
|
-
"https://www.w3.org/ns/activitystreams#Place",
|
10277
|
-
"https://www.w3.org/ns/activitystreams#Profile",
|
10278
|
-
"https://www.w3.org/ns/activitystreams#Relationship",
|
10279
|
-
"https://www.w3.org/ns/activitystreams#Service",
|
10280
|
-
"https://www.w3.org/ns/activitystreams#Tombstone",
|
10281
|
-
].some((t) => v["@type"].includes(t))
|
10282
|
-
? await Object.fromJsonLd(v, options)
|
10283
|
-
: typeof v === "object" && "@type" in v &&
|
10284
|
-
Array.isArray(v["@type"]) &&
|
10285
|
-
[
|
10286
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10287
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10288
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10289
|
-
].some((t) => v["@type"].includes(t))
|
10290
|
-
? await Link.fromJsonLd(v, options)
|
10291
|
-
: undefined;
|
10292
|
-
if (typeof decoded === "undefined")
|
10293
|
-
continue;
|
10294
|
-
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(decoded);
|
10953
|
+
_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(await Object.fromJsonLd(v, options));
|
10295
10954
|
}
|
10296
10955
|
instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
|
10297
10956
|
return instance;
|
@@ -10388,36 +11047,33 @@ export class CollectionPage extends Collection {
|
|
10388
11047
|
constructor(values, { documentLoader, contextLoader, } = {}) {
|
10389
11048
|
super(values, { documentLoader, contextLoader });
|
10390
11049
|
if ("partOf" in values && values.partOf != null) {
|
10391
|
-
if (values.partOf instanceof
|
10392
|
-
values.partOf instanceof URL) {
|
11050
|
+
if (values.partOf instanceof Collection || values.partOf instanceof URL) {
|
10393
11051
|
// @ts-ignore: type is checked above.
|
10394
11052
|
this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = [values.partOf];
|
10395
11053
|
}
|
10396
11054
|
else {
|
10397
11055
|
throw new TypeError("The partOf must be of type " +
|
10398
|
-
"
|
11056
|
+
"Collection | URL" + ".");
|
10399
11057
|
}
|
10400
11058
|
}
|
10401
11059
|
if ("next" in values && values.next != null) {
|
10402
|
-
if (values.next instanceof _b || values.next instanceof
|
10403
|
-
values.next instanceof URL) {
|
11060
|
+
if (values.next instanceof _b || values.next instanceof URL) {
|
10404
11061
|
// @ts-ignore: type is checked above.
|
10405
11062
|
this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = [values.next];
|
10406
11063
|
}
|
10407
11064
|
else {
|
10408
11065
|
throw new TypeError("The next must be of type " +
|
10409
|
-
"CollectionPage |
|
11066
|
+
"CollectionPage | URL" + ".");
|
10410
11067
|
}
|
10411
11068
|
}
|
10412
11069
|
if ("prev" in values && values.prev != null) {
|
10413
|
-
if (values.prev instanceof _b || values.prev instanceof
|
10414
|
-
values.prev instanceof URL) {
|
11070
|
+
if (values.prev instanceof _b || values.prev instanceof URL) {
|
10415
11071
|
// @ts-ignore: type is checked above.
|
10416
11072
|
this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = [values.prev];
|
10417
11073
|
}
|
10418
11074
|
else {
|
10419
11075
|
throw new TypeError("The prev must be of type " +
|
10420
|
-
"CollectionPage |
|
11076
|
+
"CollectionPage | URL" + ".");
|
10421
11077
|
}
|
10422
11078
|
}
|
10423
11079
|
}
|
@@ -10431,38 +11087,35 @@ export class CollectionPage extends Collection {
|
|
10431
11087
|
const clone = super.clone(values, options);
|
10432
11088
|
clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le;
|
10433
11089
|
if ("partOf" in values && values.partOf != null) {
|
10434
|
-
if (values.partOf instanceof
|
10435
|
-
values.partOf instanceof URL) {
|
11090
|
+
if (values.partOf instanceof Collection || values.partOf instanceof URL) {
|
10436
11091
|
// @ts-ignore: type is checked above.
|
10437
11092
|
clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = [values.partOf];
|
10438
11093
|
}
|
10439
11094
|
else {
|
10440
11095
|
throw new TypeError("The partOf must be of type " +
|
10441
|
-
"
|
11096
|
+
"Collection | URL" + ".");
|
10442
11097
|
}
|
10443
11098
|
}
|
10444
11099
|
clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY;
|
10445
11100
|
if ("next" in values && values.next != null) {
|
10446
|
-
if (values.next instanceof _b || values.next instanceof
|
10447
|
-
values.next instanceof URL) {
|
11101
|
+
if (values.next instanceof _b || values.next instanceof URL) {
|
10448
11102
|
// @ts-ignore: type is checked above.
|
10449
11103
|
clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = [values.next];
|
10450
11104
|
}
|
10451
11105
|
else {
|
10452
11106
|
throw new TypeError("The next must be of type " +
|
10453
|
-
"CollectionPage |
|
11107
|
+
"CollectionPage | URL" + ".");
|
10454
11108
|
}
|
10455
11109
|
}
|
10456
11110
|
clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA;
|
10457
11111
|
if ("prev" in values && values.prev != null) {
|
10458
|
-
if (values.prev instanceof _b || values.prev instanceof
|
10459
|
-
values.prev instanceof URL) {
|
11112
|
+
if (values.prev instanceof _b || values.prev instanceof URL) {
|
10460
11113
|
// @ts-ignore: type is checked above.
|
10461
11114
|
clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = [values.prev];
|
10462
11115
|
}
|
10463
11116
|
else {
|
10464
11117
|
throw new TypeError("The prev must be of type " +
|
10465
|
-
"CollectionPage |
|
11118
|
+
"CollectionPage | URL" + ".");
|
10466
11119
|
}
|
10467
11120
|
}
|
10468
11121
|
return clone;
|
@@ -10484,13 +11137,6 @@ export class CollectionPage extends Collection {
|
|
10484
11137
|
throw error;
|
10485
11138
|
}
|
10486
11139
|
const { document } = fetchResult;
|
10487
|
-
try {
|
10488
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
10489
|
-
}
|
10490
|
-
catch (e) {
|
10491
|
-
if (!(e instanceof TypeError))
|
10492
|
-
throw e;
|
10493
|
-
}
|
10494
11140
|
try {
|
10495
11141
|
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
10496
11142
|
}
|
@@ -10499,10 +11145,7 @@ export class CollectionPage extends Collection {
|
|
10499
11145
|
throw e;
|
10500
11146
|
}
|
10501
11147
|
throw new TypeError("Expected an object of any type of: " +
|
10502
|
-
[
|
10503
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10504
|
-
"https://www.w3.org/ns/activitystreams#Collection",
|
10505
|
-
].join(", "));
|
11148
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
10506
11149
|
}
|
10507
11150
|
/**
|
10508
11151
|
* Similar to
|
@@ -10557,18 +11200,8 @@ export class CollectionPage extends Collection {
|
|
10557
11200
|
if (!(e instanceof TypeError))
|
10558
11201
|
throw e;
|
10559
11202
|
}
|
10560
|
-
try {
|
10561
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
10562
|
-
}
|
10563
|
-
catch (e) {
|
10564
|
-
if (!(e instanceof TypeError))
|
10565
|
-
throw e;
|
10566
|
-
}
|
10567
11203
|
throw new TypeError("Expected an object of any type of: " +
|
10568
|
-
[
|
10569
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10570
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10571
|
-
].join(", "));
|
11204
|
+
["https://www.w3.org/ns/activitystreams#CollectionPage"].join(", "));
|
10572
11205
|
}
|
10573
11206
|
/**
|
10574
11207
|
* Similar to
|
@@ -10622,18 +11255,8 @@ export class CollectionPage extends Collection {
|
|
10622
11255
|
if (!(e instanceof TypeError))
|
10623
11256
|
throw e;
|
10624
11257
|
}
|
10625
|
-
try {
|
10626
|
-
return await Link.fromJsonLd(document, { documentLoader, contextLoader });
|
10627
|
-
}
|
10628
|
-
catch (e) {
|
10629
|
-
if (!(e instanceof TypeError))
|
10630
|
-
throw e;
|
10631
|
-
}
|
10632
11258
|
throw new TypeError("Expected an object of any type of: " +
|
10633
|
-
[
|
10634
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10635
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10636
|
-
].join(", "));
|
11259
|
+
["https://www.w3.org/ns/activitystreams#CollectionPage"].join(", "));
|
10637
11260
|
}
|
10638
11261
|
/**
|
10639
11262
|
* Similar to
|
@@ -10683,9 +11306,7 @@ export class CollectionPage extends Collection {
|
|
10683
11306
|
for (const v of this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le) {
|
10684
11307
|
const element = v instanceof URL
|
10685
11308
|
? { "@id": v.href }
|
10686
|
-
: v
|
10687
|
-
? await v.toJsonLd(options)
|
10688
|
-
: await v.toJsonLd(options);
|
11309
|
+
: await v.toJsonLd(options);
|
10689
11310
|
array.push(element);
|
10690
11311
|
}
|
10691
11312
|
if (array.length > 0) {
|
@@ -10695,9 +11316,7 @@ export class CollectionPage extends Collection {
|
|
10695
11316
|
for (const v of this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY) {
|
10696
11317
|
const element = v instanceof URL
|
10697
11318
|
? { "@id": v.href }
|
10698
|
-
: v
|
10699
|
-
? await v.toJsonLd(options)
|
10700
|
-
: await v.toJsonLd(options);
|
11319
|
+
: await v.toJsonLd(options);
|
10701
11320
|
array.push(element);
|
10702
11321
|
}
|
10703
11322
|
if (array.length > 0) {
|
@@ -10707,9 +11326,7 @@ export class CollectionPage extends Collection {
|
|
10707
11326
|
for (const v of this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA) {
|
10708
11327
|
const element = v instanceof URL
|
10709
11328
|
? { "@id": v.href }
|
10710
|
-
: v
|
10711
|
-
? await v.toJsonLd(options)
|
10712
|
-
: await v.toJsonLd(options);
|
11329
|
+
: await v.toJsonLd(options);
|
10713
11330
|
array.push(element);
|
10714
11331
|
}
|
10715
11332
|
if (array.length > 0) {
|
@@ -10776,27 +11393,7 @@ export class CollectionPage extends Collection {
|
|
10776
11393
|
_2kWgBhQKjEauxx8C6qF3ZQamK4Le.push(new URL(v["@id"]));
|
10777
11394
|
continue;
|
10778
11395
|
}
|
10779
|
-
|
10780
|
-
Array.isArray(v["@type"]) &&
|
10781
|
-
[
|
10782
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10783
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10784
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10785
|
-
].some((t) => v["@type"].includes(t))
|
10786
|
-
? await Link.fromJsonLd(v, options)
|
10787
|
-
: typeof v === "object" && "@type" in v &&
|
10788
|
-
Array.isArray(v["@type"]) &&
|
10789
|
-
[
|
10790
|
-
"https://www.w3.org/ns/activitystreams#Collection",
|
10791
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10792
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10793
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollection",
|
10794
|
-
].some((t) => v["@type"].includes(t))
|
10795
|
-
? await Collection.fromJsonLd(v, options)
|
10796
|
-
: undefined;
|
10797
|
-
if (typeof decoded === "undefined")
|
10798
|
-
continue;
|
10799
|
-
_2kWgBhQKjEauxx8C6qF3ZQamK4Le.push(decoded);
|
11396
|
+
_2kWgBhQKjEauxx8C6qF3ZQamK4Le.push(await Collection.fromJsonLd(v, options));
|
10800
11397
|
}
|
10801
11398
|
instance.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = _2kWgBhQKjEauxx8C6qF3ZQamK4Le;
|
10802
11399
|
const _3BT4kQLcXhHx7TAWaNDKh8nFn9eY = [];
|
@@ -10808,25 +11405,7 @@ export class CollectionPage extends Collection {
|
|
10808
11405
|
_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.push(new URL(v["@id"]));
|
10809
11406
|
continue;
|
10810
11407
|
}
|
10811
|
-
|
10812
|
-
Array.isArray(v["@type"]) &&
|
10813
|
-
[
|
10814
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10815
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10816
|
-
].some((t) => v["@type"].includes(t))
|
10817
|
-
? await _b.fromJsonLd(v, options)
|
10818
|
-
: typeof v === "object" && "@type" in v &&
|
10819
|
-
Array.isArray(v["@type"]) &&
|
10820
|
-
[
|
10821
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10822
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10823
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10824
|
-
].some((t) => v["@type"].includes(t))
|
10825
|
-
? await Link.fromJsonLd(v, options)
|
10826
|
-
: undefined;
|
10827
|
-
if (typeof decoded === "undefined")
|
10828
|
-
continue;
|
10829
|
-
_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.push(decoded);
|
11408
|
+
_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.push(await _b.fromJsonLd(v, options));
|
10830
11409
|
}
|
10831
11410
|
instance.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = _3BT4kQLcXhHx7TAWaNDKh8nFn9eY;
|
10832
11411
|
const _3b8yG8tDNzQFFEnWhCc13G8eHooA = [];
|
@@ -10838,25 +11417,7 @@ export class CollectionPage extends Collection {
|
|
10838
11417
|
_3b8yG8tDNzQFFEnWhCc13G8eHooA.push(new URL(v["@id"]));
|
10839
11418
|
continue;
|
10840
11419
|
}
|
10841
|
-
|
10842
|
-
Array.isArray(v["@type"]) &&
|
10843
|
-
[
|
10844
|
-
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
10845
|
-
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
10846
|
-
].some((t) => v["@type"].includes(t))
|
10847
|
-
? await _b.fromJsonLd(v, options)
|
10848
|
-
: typeof v === "object" && "@type" in v &&
|
10849
|
-
Array.isArray(v["@type"]) &&
|
10850
|
-
[
|
10851
|
-
"https://www.w3.org/ns/activitystreams#Link",
|
10852
|
-
"https://www.w3.org/ns/activitystreams#Hashtag",
|
10853
|
-
"https://www.w3.org/ns/activitystreams#Mention",
|
10854
|
-
].some((t) => v["@type"].includes(t))
|
10855
|
-
? await Link.fromJsonLd(v, options)
|
10856
|
-
: undefined;
|
10857
|
-
if (typeof decoded === "undefined")
|
10858
|
-
continue;
|
10859
|
-
_3b8yG8tDNzQFFEnWhCc13G8eHooA.push(decoded);
|
11420
|
+
_3b8yG8tDNzQFFEnWhCc13G8eHooA.push(await _b.fromJsonLd(v, options));
|
10860
11421
|
}
|
10861
11422
|
instance.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = _3b8yG8tDNzQFFEnWhCc13G8eHooA;
|
10862
11423
|
return instance;
|
@@ -12083,6 +12644,7 @@ export class Group extends Object {
|
|
12083
12644
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
12084
12645
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
12085
12646
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
12647
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
12086
12648
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
12087
12649
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
12088
12650
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -12241,6 +12803,16 @@ export class Group extends Object {
|
|
12241
12803
|
"Collection | URL" + ".");
|
12242
12804
|
}
|
12243
12805
|
}
|
12806
|
+
if ("featured" in values && values.featured != null) {
|
12807
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
12808
|
+
// @ts-ignore: type is checked above.
|
12809
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
12810
|
+
}
|
12811
|
+
else {
|
12812
|
+
throw new TypeError("The featured must be of type " +
|
12813
|
+
"Collection | URL" + ".");
|
12814
|
+
}
|
12815
|
+
}
|
12244
12816
|
if ("streams" in values && values.streams != null) {
|
12245
12817
|
if (Array.isArray(values.streams) &&
|
12246
12818
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -12467,6 +13039,17 @@ export class Group extends Object {
|
|
12467
13039
|
"Collection | URL" + ".");
|
12468
13040
|
}
|
12469
13041
|
}
|
13042
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
13043
|
+
if ("featured" in values && values.featured != null) {
|
13044
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
13045
|
+
// @ts-ignore: type is checked above.
|
13046
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
13047
|
+
}
|
13048
|
+
else {
|
13049
|
+
throw new TypeError("The featured must be of type " +
|
13050
|
+
"Collection | URL" + ".");
|
13051
|
+
}
|
13052
|
+
}
|
12470
13053
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
12471
13054
|
if ("streams" in values && values.streams != null) {
|
12472
13055
|
if (Array.isArray(values.streams) &&
|
@@ -13040,6 +13623,64 @@ export class Group extends Object {
|
|
13040
13623
|
}
|
13041
13624
|
return v;
|
13042
13625
|
}
|
13626
|
+
async #fetchFeatured(url, options = {}) {
|
13627
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
13628
|
+
fetchDocumentLoader;
|
13629
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
13630
|
+
fetchDocumentLoader;
|
13631
|
+
let fetchResult;
|
13632
|
+
try {
|
13633
|
+
fetchResult = await documentLoader(url.href);
|
13634
|
+
}
|
13635
|
+
catch (error) {
|
13636
|
+
if (options.suppressError) {
|
13637
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
13638
|
+
return null;
|
13639
|
+
}
|
13640
|
+
throw error;
|
13641
|
+
}
|
13642
|
+
const { document } = fetchResult;
|
13643
|
+
try {
|
13644
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
13645
|
+
}
|
13646
|
+
catch (e) {
|
13647
|
+
if (!(e instanceof TypeError))
|
13648
|
+
throw e;
|
13649
|
+
}
|
13650
|
+
throw new TypeError("Expected an object of any type of: " +
|
13651
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
13652
|
+
}
|
13653
|
+
/**
|
13654
|
+
* Similar to
|
13655
|
+
* {@link Group.getFeatured},
|
13656
|
+
* but returns its `@id` URL instead of the object itself.
|
13657
|
+
*/
|
13658
|
+
get featuredId() {
|
13659
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
13660
|
+
return null;
|
13661
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
13662
|
+
if (v instanceof URL)
|
13663
|
+
return v;
|
13664
|
+
return v.id;
|
13665
|
+
}
|
13666
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
13667
|
+
* featured at the top of people's profiles, is implemented using an extra
|
13668
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
13669
|
+
* of objects.
|
13670
|
+
*/
|
13671
|
+
async getFeatured(options = {}) {
|
13672
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
13673
|
+
return null;
|
13674
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
13675
|
+
if (v instanceof URL) {
|
13676
|
+
const fetched = await this.#fetchFeatured(v, options);
|
13677
|
+
if (fetched == null)
|
13678
|
+
return null;
|
13679
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
13680
|
+
return fetched;
|
13681
|
+
}
|
13682
|
+
return v;
|
13683
|
+
}
|
13043
13684
|
async #fetchStream(url, options = {}) {
|
13044
13685
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
13045
13686
|
fetchDocumentLoader;
|
@@ -13238,6 +13879,15 @@ export class Group extends Object {
|
|
13238
13879
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
13239
13880
|
}
|
13240
13881
|
array = [];
|
13882
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
13883
|
+
const element = v instanceof URL
|
13884
|
+
? { "@id": v.href }
|
13885
|
+
: await v.toJsonLd(options);
|
13886
|
+
array.push(element);
|
13887
|
+
}
|
13888
|
+
if (array.length > 0)
|
13889
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
13890
|
+
array = [];
|
13241
13891
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
13242
13892
|
const element = v instanceof URL
|
13243
13893
|
? { "@id": v.href }
|
@@ -13302,6 +13952,7 @@ export class Group extends Object {
|
|
13302
13952
|
{
|
13303
13953
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
13304
13954
|
"toot": "http://joinmastodon.org/ns#",
|
13955
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
13305
13956
|
"discoverable": "toot:discoverable",
|
13306
13957
|
"suspended": "toot:suspended",
|
13307
13958
|
"memorial": "toot:memorial",
|
@@ -13461,6 +14112,18 @@ export class Group extends Object {
|
|
13461
14112
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
13462
14113
|
}
|
13463
14114
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
14115
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
14116
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
14117
|
+
if (v == null)
|
14118
|
+
continue;
|
14119
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
14120
|
+
globalThis.Object.keys(v).length === 1) {
|
14121
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
14122
|
+
continue;
|
14123
|
+
}
|
14124
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
14125
|
+
}
|
14126
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
13464
14127
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
13465
14128
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
13466
14129
|
if (v == null)
|
@@ -13626,6 +14289,17 @@ export class Group extends Object {
|
|
13626
14289
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
13627
14290
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
13628
14291
|
}
|
14292
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
14293
|
+
// deno-lint-ignore no-explicit-any
|
14294
|
+
.map((v) => v instanceof URL
|
14295
|
+
? {
|
14296
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
14297
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
14298
|
+
}
|
14299
|
+
: v);
|
14300
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
14301
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
14302
|
+
}
|
13629
14303
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
13630
14304
|
// deno-lint-ignore no-explicit-any
|
13631
14305
|
.map((v) => v instanceof URL
|
@@ -15495,6 +16169,7 @@ export class Organization extends Object {
|
|
15495
16169
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
15496
16170
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
15497
16171
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
16172
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
15498
16173
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
15499
16174
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
15500
16175
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -15653,6 +16328,16 @@ export class Organization extends Object {
|
|
15653
16328
|
"Collection | URL" + ".");
|
15654
16329
|
}
|
15655
16330
|
}
|
16331
|
+
if ("featured" in values && values.featured != null) {
|
16332
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
16333
|
+
// @ts-ignore: type is checked above.
|
16334
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
16335
|
+
}
|
16336
|
+
else {
|
16337
|
+
throw new TypeError("The featured must be of type " +
|
16338
|
+
"Collection | URL" + ".");
|
16339
|
+
}
|
16340
|
+
}
|
15656
16341
|
if ("streams" in values && values.streams != null) {
|
15657
16342
|
if (Array.isArray(values.streams) &&
|
15658
16343
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -15879,6 +16564,17 @@ export class Organization extends Object {
|
|
15879
16564
|
"Collection | URL" + ".");
|
15880
16565
|
}
|
15881
16566
|
}
|
16567
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
16568
|
+
if ("featured" in values && values.featured != null) {
|
16569
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
16570
|
+
// @ts-ignore: type is checked above.
|
16571
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
16572
|
+
}
|
16573
|
+
else {
|
16574
|
+
throw new TypeError("The featured must be of type " +
|
16575
|
+
"Collection | URL" + ".");
|
16576
|
+
}
|
16577
|
+
}
|
15882
16578
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
15883
16579
|
if ("streams" in values && values.streams != null) {
|
15884
16580
|
if (Array.isArray(values.streams) &&
|
@@ -16452,6 +17148,64 @@ export class Organization extends Object {
|
|
16452
17148
|
}
|
16453
17149
|
return v;
|
16454
17150
|
}
|
17151
|
+
async #fetchFeatured(url, options = {}) {
|
17152
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
17153
|
+
fetchDocumentLoader;
|
17154
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
17155
|
+
fetchDocumentLoader;
|
17156
|
+
let fetchResult;
|
17157
|
+
try {
|
17158
|
+
fetchResult = await documentLoader(url.href);
|
17159
|
+
}
|
17160
|
+
catch (error) {
|
17161
|
+
if (options.suppressError) {
|
17162
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
17163
|
+
return null;
|
17164
|
+
}
|
17165
|
+
throw error;
|
17166
|
+
}
|
17167
|
+
const { document } = fetchResult;
|
17168
|
+
try {
|
17169
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
17170
|
+
}
|
17171
|
+
catch (e) {
|
17172
|
+
if (!(e instanceof TypeError))
|
17173
|
+
throw e;
|
17174
|
+
}
|
17175
|
+
throw new TypeError("Expected an object of any type of: " +
|
17176
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
17177
|
+
}
|
17178
|
+
/**
|
17179
|
+
* Similar to
|
17180
|
+
* {@link Organization.getFeatured},
|
17181
|
+
* but returns its `@id` URL instead of the object itself.
|
17182
|
+
*/
|
17183
|
+
get featuredId() {
|
17184
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
17185
|
+
return null;
|
17186
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
17187
|
+
if (v instanceof URL)
|
17188
|
+
return v;
|
17189
|
+
return v.id;
|
17190
|
+
}
|
17191
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
17192
|
+
* featured at the top of people's profiles, is implemented using an extra
|
17193
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
17194
|
+
* of objects.
|
17195
|
+
*/
|
17196
|
+
async getFeatured(options = {}) {
|
17197
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
17198
|
+
return null;
|
17199
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
17200
|
+
if (v instanceof URL) {
|
17201
|
+
const fetched = await this.#fetchFeatured(v, options);
|
17202
|
+
if (fetched == null)
|
17203
|
+
return null;
|
17204
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
17205
|
+
return fetched;
|
17206
|
+
}
|
17207
|
+
return v;
|
17208
|
+
}
|
16455
17209
|
async #fetchStream(url, options = {}) {
|
16456
17210
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
16457
17211
|
fetchDocumentLoader;
|
@@ -16650,6 +17404,15 @@ export class Organization extends Object {
|
|
16650
17404
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
16651
17405
|
}
|
16652
17406
|
array = [];
|
17407
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
17408
|
+
const element = v instanceof URL
|
17409
|
+
? { "@id": v.href }
|
17410
|
+
: await v.toJsonLd(options);
|
17411
|
+
array.push(element);
|
17412
|
+
}
|
17413
|
+
if (array.length > 0)
|
17414
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
17415
|
+
array = [];
|
16653
17416
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
16654
17417
|
const element = v instanceof URL
|
16655
17418
|
? { "@id": v.href }
|
@@ -16714,6 +17477,7 @@ export class Organization extends Object {
|
|
16714
17477
|
{
|
16715
17478
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
16716
17479
|
"toot": "http://joinmastodon.org/ns#",
|
17480
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
16717
17481
|
"discoverable": "toot:discoverable",
|
16718
17482
|
"suspended": "toot:suspended",
|
16719
17483
|
"memorial": "toot:memorial",
|
@@ -16873,6 +17637,18 @@ export class Organization extends Object {
|
|
16873
17637
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
16874
17638
|
}
|
16875
17639
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
17640
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
17641
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
17642
|
+
if (v == null)
|
17643
|
+
continue;
|
17644
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
17645
|
+
globalThis.Object.keys(v).length === 1) {
|
17646
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
17647
|
+
continue;
|
17648
|
+
}
|
17649
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
17650
|
+
}
|
17651
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
16876
17652
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
16877
17653
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
16878
17654
|
if (v == null)
|
@@ -17038,6 +17814,17 @@ export class Organization extends Object {
|
|
17038
17814
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
17039
17815
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
17040
17816
|
}
|
17817
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
17818
|
+
// deno-lint-ignore no-explicit-any
|
17819
|
+
.map((v) => v instanceof URL
|
17820
|
+
? {
|
17821
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
17822
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
17823
|
+
}
|
17824
|
+
: v);
|
17825
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
17826
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
17827
|
+
}
|
17041
17828
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
17042
17829
|
// deno-lint-ignore no-explicit-any
|
17043
17830
|
.map((v) => v instanceof URL
|
@@ -17245,6 +18032,7 @@ export class Person extends Object {
|
|
17245
18032
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
17246
18033
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
17247
18034
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
18035
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
17248
18036
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
17249
18037
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
17250
18038
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -17403,6 +18191,16 @@ export class Person extends Object {
|
|
17403
18191
|
"Collection | URL" + ".");
|
17404
18192
|
}
|
17405
18193
|
}
|
18194
|
+
if ("featured" in values && values.featured != null) {
|
18195
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
18196
|
+
// @ts-ignore: type is checked above.
|
18197
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
18198
|
+
}
|
18199
|
+
else {
|
18200
|
+
throw new TypeError("The featured must be of type " +
|
18201
|
+
"Collection | URL" + ".");
|
18202
|
+
}
|
18203
|
+
}
|
17406
18204
|
if ("streams" in values && values.streams != null) {
|
17407
18205
|
if (Array.isArray(values.streams) &&
|
17408
18206
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -17629,6 +18427,17 @@ export class Person extends Object {
|
|
17629
18427
|
"Collection | URL" + ".");
|
17630
18428
|
}
|
17631
18429
|
}
|
18430
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
18431
|
+
if ("featured" in values && values.featured != null) {
|
18432
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
18433
|
+
// @ts-ignore: type is checked above.
|
18434
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
18435
|
+
}
|
18436
|
+
else {
|
18437
|
+
throw new TypeError("The featured must be of type " +
|
18438
|
+
"Collection | URL" + ".");
|
18439
|
+
}
|
18440
|
+
}
|
17632
18441
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
17633
18442
|
if ("streams" in values && values.streams != null) {
|
17634
18443
|
if (Array.isArray(values.streams) &&
|
@@ -18202,6 +19011,64 @@ export class Person extends Object {
|
|
18202
19011
|
}
|
18203
19012
|
return v;
|
18204
19013
|
}
|
19014
|
+
async #fetchFeatured(url, options = {}) {
|
19015
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
19016
|
+
fetchDocumentLoader;
|
19017
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
19018
|
+
fetchDocumentLoader;
|
19019
|
+
let fetchResult;
|
19020
|
+
try {
|
19021
|
+
fetchResult = await documentLoader(url.href);
|
19022
|
+
}
|
19023
|
+
catch (error) {
|
19024
|
+
if (options.suppressError) {
|
19025
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
19026
|
+
return null;
|
19027
|
+
}
|
19028
|
+
throw error;
|
19029
|
+
}
|
19030
|
+
const { document } = fetchResult;
|
19031
|
+
try {
|
19032
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
19033
|
+
}
|
19034
|
+
catch (e) {
|
19035
|
+
if (!(e instanceof TypeError))
|
19036
|
+
throw e;
|
19037
|
+
}
|
19038
|
+
throw new TypeError("Expected an object of any type of: " +
|
19039
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
19040
|
+
}
|
19041
|
+
/**
|
19042
|
+
* Similar to
|
19043
|
+
* {@link Person.getFeatured},
|
19044
|
+
* but returns its `@id` URL instead of the object itself.
|
19045
|
+
*/
|
19046
|
+
get featuredId() {
|
19047
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
19048
|
+
return null;
|
19049
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
19050
|
+
if (v instanceof URL)
|
19051
|
+
return v;
|
19052
|
+
return v.id;
|
19053
|
+
}
|
19054
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
19055
|
+
* featured at the top of people's profiles, is implemented using an extra
|
19056
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
19057
|
+
* of objects.
|
19058
|
+
*/
|
19059
|
+
async getFeatured(options = {}) {
|
19060
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
19061
|
+
return null;
|
19062
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
19063
|
+
if (v instanceof URL) {
|
19064
|
+
const fetched = await this.#fetchFeatured(v, options);
|
19065
|
+
if (fetched == null)
|
19066
|
+
return null;
|
19067
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
19068
|
+
return fetched;
|
19069
|
+
}
|
19070
|
+
return v;
|
19071
|
+
}
|
18205
19072
|
async #fetchStream(url, options = {}) {
|
18206
19073
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
18207
19074
|
fetchDocumentLoader;
|
@@ -18400,6 +19267,15 @@ export class Person extends Object {
|
|
18400
19267
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
18401
19268
|
}
|
18402
19269
|
array = [];
|
19270
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
19271
|
+
const element = v instanceof URL
|
19272
|
+
? { "@id": v.href }
|
19273
|
+
: await v.toJsonLd(options);
|
19274
|
+
array.push(element);
|
19275
|
+
}
|
19276
|
+
if (array.length > 0)
|
19277
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
19278
|
+
array = [];
|
18403
19279
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
18404
19280
|
const element = v instanceof URL
|
18405
19281
|
? { "@id": v.href }
|
@@ -18464,6 +19340,7 @@ export class Person extends Object {
|
|
18464
19340
|
{
|
18465
19341
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
18466
19342
|
"toot": "http://joinmastodon.org/ns#",
|
19343
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
18467
19344
|
"discoverable": "toot:discoverable",
|
18468
19345
|
"suspended": "toot:suspended",
|
18469
19346
|
"memorial": "toot:memorial",
|
@@ -18623,6 +19500,18 @@ export class Person extends Object {
|
|
18623
19500
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
18624
19501
|
}
|
18625
19502
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
19503
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
19504
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
19505
|
+
if (v == null)
|
19506
|
+
continue;
|
19507
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
19508
|
+
globalThis.Object.keys(v).length === 1) {
|
19509
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
19510
|
+
continue;
|
19511
|
+
}
|
19512
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
19513
|
+
}
|
19514
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
18626
19515
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
18627
19516
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
18628
19517
|
if (v == null)
|
@@ -18788,6 +19677,17 @@ export class Person extends Object {
|
|
18788
19677
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
18789
19678
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
18790
19679
|
}
|
19680
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
19681
|
+
// deno-lint-ignore no-explicit-any
|
19682
|
+
.map((v) => v instanceof URL
|
19683
|
+
? {
|
19684
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
19685
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
19686
|
+
}
|
19687
|
+
: v);
|
19688
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
19689
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
19690
|
+
}
|
18791
19691
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
18792
19692
|
// deno-lint-ignore no-explicit-any
|
18793
19693
|
.map((v) => v instanceof URL
|
@@ -20745,6 +21645,7 @@ export class Service extends Object {
|
|
20745
21645
|
#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [];
|
20746
21646
|
#_BBCTgfphhsFzpVfKTykGSpBNwoA = [];
|
20747
21647
|
#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [];
|
21648
|
+
#_4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
20748
21649
|
#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
20749
21650
|
#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [];
|
20750
21651
|
#_gAJzg1QDc4rcefFsUzGSYmyXvNH = [];
|
@@ -20903,6 +21804,16 @@ export class Service extends Object {
|
|
20903
21804
|
"Collection | URL" + ".");
|
20904
21805
|
}
|
20905
21806
|
}
|
21807
|
+
if ("featured" in values && values.featured != null) {
|
21808
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
21809
|
+
// @ts-ignore: type is checked above.
|
21810
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
21811
|
+
}
|
21812
|
+
else {
|
21813
|
+
throw new TypeError("The featured must be of type " +
|
21814
|
+
"Collection | URL" + ".");
|
21815
|
+
}
|
21816
|
+
}
|
20906
21817
|
if ("streams" in values && values.streams != null) {
|
20907
21818
|
if (Array.isArray(values.streams) &&
|
20908
21819
|
values.streams.every((v) => v instanceof Collection || v instanceof URL)) {
|
@@ -21129,6 +22040,17 @@ export class Service extends Object {
|
|
21129
22040
|
"Collection | URL" + ".");
|
21130
22041
|
}
|
21131
22042
|
}
|
22043
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja;
|
22044
|
+
if ("featured" in values && values.featured != null) {
|
22045
|
+
if (values.featured instanceof Collection || values.featured instanceof URL) {
|
22046
|
+
// @ts-ignore: type is checked above.
|
22047
|
+
clone.#_4N1vBJzXDf8NbBumeECQMFvKetja = [values.featured];
|
22048
|
+
}
|
22049
|
+
else {
|
22050
|
+
throw new TypeError("The featured must be of type " +
|
22051
|
+
"Collection | URL" + ".");
|
22052
|
+
}
|
22053
|
+
}
|
21132
22054
|
clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9;
|
21133
22055
|
if ("streams" in values && values.streams != null) {
|
21134
22056
|
if (Array.isArray(values.streams) &&
|
@@ -21702,6 +22624,64 @@ export class Service extends Object {
|
|
21702
22624
|
}
|
21703
22625
|
return v;
|
21704
22626
|
}
|
22627
|
+
async #fetchFeatured(url, options = {}) {
|
22628
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
22629
|
+
fetchDocumentLoader;
|
22630
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
22631
|
+
fetchDocumentLoader;
|
22632
|
+
let fetchResult;
|
22633
|
+
try {
|
22634
|
+
fetchResult = await documentLoader(url.href);
|
22635
|
+
}
|
22636
|
+
catch (error) {
|
22637
|
+
if (options.suppressError) {
|
22638
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
|
22639
|
+
return null;
|
22640
|
+
}
|
22641
|
+
throw error;
|
22642
|
+
}
|
22643
|
+
const { document } = fetchResult;
|
22644
|
+
try {
|
22645
|
+
return await Collection.fromJsonLd(document, { documentLoader, contextLoader });
|
22646
|
+
}
|
22647
|
+
catch (e) {
|
22648
|
+
if (!(e instanceof TypeError))
|
22649
|
+
throw e;
|
22650
|
+
}
|
22651
|
+
throw new TypeError("Expected an object of any type of: " +
|
22652
|
+
["https://www.w3.org/ns/activitystreams#Collection"].join(", "));
|
22653
|
+
}
|
22654
|
+
/**
|
22655
|
+
* Similar to
|
22656
|
+
* {@link Service.getFeatured},
|
22657
|
+
* but returns its `@id` URL instead of the object itself.
|
22658
|
+
*/
|
22659
|
+
get featuredId() {
|
22660
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
22661
|
+
return null;
|
22662
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
22663
|
+
if (v instanceof URL)
|
22664
|
+
return v;
|
22665
|
+
return v.id;
|
22666
|
+
}
|
22667
|
+
/** What is known in Mastodon as "pinned statuses", or statuses that are always
|
22668
|
+
* featured at the top of people's profiles, is implemented using an extra
|
22669
|
+
* property `featured` on the actor object that points to a {@link Collection}
|
22670
|
+
* of objects.
|
22671
|
+
*/
|
22672
|
+
async getFeatured(options = {}) {
|
22673
|
+
if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja.length < 1)
|
22674
|
+
return null;
|
22675
|
+
const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
22676
|
+
if (v instanceof URL) {
|
22677
|
+
const fetched = await this.#fetchFeatured(v, options);
|
22678
|
+
if (fetched == null)
|
22679
|
+
return null;
|
22680
|
+
this.#_4N1vBJzXDf8NbBumeECQMFvKetja[0] = fetched;
|
22681
|
+
return fetched;
|
22682
|
+
}
|
22683
|
+
return v;
|
22684
|
+
}
|
21705
22685
|
async #fetchStream(url, options = {}) {
|
21706
22686
|
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
21707
22687
|
fetchDocumentLoader;
|
@@ -21900,6 +22880,15 @@ export class Service extends Object {
|
|
21900
22880
|
values["https://www.w3.org/ns/activitystreams#liked"] = array;
|
21901
22881
|
}
|
21902
22882
|
array = [];
|
22883
|
+
for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja) {
|
22884
|
+
const element = v instanceof URL
|
22885
|
+
? { "@id": v.href }
|
22886
|
+
: await v.toJsonLd(options);
|
22887
|
+
array.push(element);
|
22888
|
+
}
|
22889
|
+
if (array.length > 0)
|
22890
|
+
values["http://joinmastodon.org/ns#featured"] = array;
|
22891
|
+
array = [];
|
21903
22892
|
for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) {
|
21904
22893
|
const element = v instanceof URL
|
21905
22894
|
? { "@id": v.href }
|
@@ -21964,6 +22953,7 @@ export class Service extends Object {
|
|
21964
22953
|
{
|
21965
22954
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
21966
22955
|
"toot": "http://joinmastodon.org/ns#",
|
22956
|
+
"featured": { "@id": "toot:featured", "@type": "@id" },
|
21967
22957
|
"discoverable": "toot:discoverable",
|
21968
22958
|
"suspended": "toot:suspended",
|
21969
22959
|
"memorial": "toot:memorial",
|
@@ -22123,6 +23113,18 @@ export class Service extends Object {
|
|
22123
23113
|
_3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd(v, options));
|
22124
23114
|
}
|
22125
23115
|
instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU;
|
23116
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = [];
|
23117
|
+
for (const v of values["http://joinmastodon.org/ns#featured"] ?? []) {
|
23118
|
+
if (v == null)
|
23119
|
+
continue;
|
23120
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
23121
|
+
globalThis.Object.keys(v).length === 1) {
|
23122
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(new URL(v["@id"]));
|
23123
|
+
continue;
|
23124
|
+
}
|
23125
|
+
_4N1vBJzXDf8NbBumeECQMFvKetja.push(await Collection.fromJsonLd(v, options));
|
23126
|
+
}
|
23127
|
+
instance.#_4N1vBJzXDf8NbBumeECQMFvKetja = _4N1vBJzXDf8NbBumeECQMFvKetja;
|
22126
23128
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = [];
|
22127
23129
|
for (const v of values["https://www.w3.org/ns/activitystreams#streams"] ?? []) {
|
22128
23130
|
if (v == null)
|
@@ -22288,6 +23290,17 @@ export class Service extends Object {
|
|
22288
23290
|
if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) {
|
22289
23291
|
proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0];
|
22290
23292
|
}
|
23293
|
+
const _4N1vBJzXDf8NbBumeECQMFvKetja = this.#_4N1vBJzXDf8NbBumeECQMFvKetja
|
23294
|
+
// deno-lint-ignore no-explicit-any
|
23295
|
+
.map((v) => v instanceof URL
|
23296
|
+
? {
|
23297
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
23298
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
23299
|
+
}
|
23300
|
+
: v);
|
23301
|
+
if (_4N1vBJzXDf8NbBumeECQMFvKetja.length == 1) {
|
23302
|
+
proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja[0];
|
23303
|
+
}
|
22291
23304
|
const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9
|
22292
23305
|
// deno-lint-ignore no-explicit-any
|
22293
23306
|
.map((v) => v instanceof URL
|