@fedify/fedify 0.11.0-dev.258 → 0.11.0-dev.260

Sign up to get free protection for your applications and to get access to all the features.
@@ -3043,12 +3043,28 @@ export class Object {
3043
3043
  if (options.expand) {
3044
3044
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
3045
3045
  }
3046
- return await jsonld.compact(values, options.context ??
3046
+ const docContext = options.context ??
3047
3047
  [
3048
3048
  "https://www.w3.org/ns/activitystreams",
3049
3049
  "https://w3id.org/security/data-integrity/v1",
3050
3050
  { "sensitive": "as:sensitive" },
3051
- ], { documentLoader: options.contextLoader });
3051
+ ];
3052
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
3053
+ if (docContext != null) {
3054
+ // Embed context
3055
+ if ("proof" in compacted &&
3056
+ compacted.proof != null) {
3057
+ if (Array.isArray(compacted.proof)) {
3058
+ for (const element of compacted.proof) {
3059
+ element["@context"] = docContext;
3060
+ }
3061
+ }
3062
+ else {
3063
+ compacted.proof["@context"] = docContext;
3064
+ }
3065
+ }
3066
+ }
3067
+ return compacted;
3052
3068
  }
3053
3069
  /**
3054
3070
  * Converts a JSON-LD structure to an object of this type.
@@ -4699,11 +4715,27 @@ export class Emoji extends Object {
4699
4715
  if (options.expand) {
4700
4716
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
4701
4717
  }
4702
- return await jsonld.compact(values, options.context ??
4718
+ const docContext = options.context ??
4703
4719
  ["https://www.w3.org/ns/activitystreams", {
4704
4720
  "toot": "http://joinmastodon.org/ns#",
4705
4721
  "Emoji": "toot:Emoji",
4706
- }], { documentLoader: options.contextLoader });
4722
+ }];
4723
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
4724
+ if (docContext != null) {
4725
+ // Embed context
4726
+ if ("proof" in compacted &&
4727
+ compacted.proof != null) {
4728
+ if (Array.isArray(compacted.proof)) {
4729
+ for (const element of compacted.proof) {
4730
+ element["@context"] = docContext;
4731
+ }
4732
+ }
4733
+ else {
4734
+ compacted.proof["@context"] = docContext;
4735
+ }
4736
+ }
4737
+ }
4738
+ return compacted;
4707
4739
  }
4708
4740
  /**
4709
4741
  * Converts a JSON-LD structure to an object of this type.
@@ -4904,12 +4936,17 @@ export class PropertyValue {
4904
4936
  if (options.expand) {
4905
4937
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
4906
4938
  }
4907
- return await jsonld.compact(values, options.context ??
4939
+ const docContext = options.context ??
4908
4940
  ["https://www.w3.org/ns/activitystreams", {
4909
4941
  "schema": "http://schema.org#",
4910
4942
  "PropertyValue": "schema:PropertyValue",
4911
4943
  "value": "schema:value",
4912
- }], { documentLoader: options.contextLoader });
4944
+ }];
4945
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
4946
+ if (docContext != null) {
4947
+ // Embed context
4948
+ }
4949
+ return compacted;
4913
4950
  }
4914
4951
  /**
4915
4952
  * Converts a JSON-LD structure to an object of this type.
@@ -5364,7 +5401,13 @@ export class DataIntegrityProof {
5364
5401
  if (options.expand) {
5365
5402
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
5366
5403
  }
5367
- return await jsonld.compact(values, options.context ?? "https://w3id.org/security/data-integrity/v1", { documentLoader: options.contextLoader });
5404
+ const docContext = options.context ??
5405
+ "https://w3id.org/security/data-integrity/v1";
5406
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
5407
+ if (docContext != null) {
5408
+ // Embed context
5409
+ }
5410
+ return compacted;
5368
5411
  }
5369
5412
  /**
5370
5413
  * Converts a JSON-LD structure to an object of this type.
@@ -5789,7 +5832,13 @@ export class CryptographicKey {
5789
5832
  if (options.expand) {
5790
5833
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
5791
5834
  }
5792
- return await jsonld.compact(values, options.context ?? "https://w3id.org/security/v1", { documentLoader: options.contextLoader });
5835
+ const docContext = options.context ??
5836
+ "https://w3id.org/security/v1";
5837
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
5838
+ if (docContext != null) {
5839
+ // Embed context
5840
+ }
5841
+ return compacted;
5793
5842
  }
5794
5843
  /**
5795
5844
  * Converts a JSON-LD structure to an object of this type.
@@ -6176,7 +6225,13 @@ export class Multikey {
6176
6225
  if (options.expand) {
6177
6226
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
6178
6227
  }
6179
- return await jsonld.compact(values, options.context ?? "https://w3id.org/security/multikey/v1", { documentLoader: options.contextLoader });
6228
+ const docContext = options.context ??
6229
+ "https://w3id.org/security/multikey/v1";
6230
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
6231
+ if (docContext != null) {
6232
+ // Embed context
6233
+ }
6234
+ return compacted;
6180
6235
  }
6181
6236
  /**
6182
6237
  * Converts a JSON-LD structure to an object of this type.
@@ -7311,12 +7366,28 @@ export class Activity extends Object {
7311
7366
  if (options.expand) {
7312
7367
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
7313
7368
  }
7314
- return await jsonld.compact(values, options.context ??
7369
+ const docContext = options.context ??
7315
7370
  [
7316
7371
  "https://www.w3.org/ns/activitystreams",
7317
7372
  "https://w3id.org/security/v1",
7318
7373
  "https://w3id.org/security/data-integrity/v1",
7319
- ], { documentLoader: options.contextLoader });
7374
+ ];
7375
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
7376
+ if (docContext != null) {
7377
+ // Embed context
7378
+ if ("proof" in compacted &&
7379
+ compacted.proof != null) {
7380
+ if (Array.isArray(compacted.proof)) {
7381
+ for (const element of compacted.proof) {
7382
+ element["@context"] = docContext;
7383
+ }
7384
+ }
7385
+ else {
7386
+ compacted.proof["@context"] = docContext;
7387
+ }
7388
+ }
7389
+ }
7390
+ return compacted;
7320
7391
  }
7321
7392
  /**
7322
7393
  * Converts a JSON-LD structure to an object of this type.
@@ -7743,11 +7814,27 @@ export class Accept extends Activity {
7743
7814
  if (options.expand) {
7744
7815
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
7745
7816
  }
7746
- return await jsonld.compact(values, options.context ??
7817
+ const docContext = options.context ??
7747
7818
  [
7748
7819
  "https://www.w3.org/ns/activitystreams",
7749
7820
  "https://w3id.org/security/data-integrity/v1",
7750
- ], { documentLoader: options.contextLoader });
7821
+ ];
7822
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
7823
+ if (docContext != null) {
7824
+ // Embed context
7825
+ if ("proof" in compacted &&
7826
+ compacted.proof != null) {
7827
+ if (Array.isArray(compacted.proof)) {
7828
+ for (const element of compacted.proof) {
7829
+ element["@context"] = docContext;
7830
+ }
7831
+ }
7832
+ else {
7833
+ compacted.proof["@context"] = docContext;
7834
+ }
7835
+ }
7836
+ }
7837
+ return compacted;
7751
7838
  }
7752
7839
  /**
7753
7840
  * Converts a JSON-LD structure to an object of this type.
@@ -7856,11 +7943,27 @@ export class Add extends Activity {
7856
7943
  if (options.expand) {
7857
7944
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
7858
7945
  }
7859
- return await jsonld.compact(values, options.context ??
7946
+ const docContext = options.context ??
7860
7947
  [
7861
7948
  "https://www.w3.org/ns/activitystreams",
7862
7949
  "https://w3id.org/security/data-integrity/v1",
7863
- ], { documentLoader: options.contextLoader });
7950
+ ];
7951
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
7952
+ if (docContext != null) {
7953
+ // Embed context
7954
+ if ("proof" in compacted &&
7955
+ compacted.proof != null) {
7956
+ if (Array.isArray(compacted.proof)) {
7957
+ for (const element of compacted.proof) {
7958
+ element["@context"] = docContext;
7959
+ }
7960
+ }
7961
+ else {
7962
+ compacted.proof["@context"] = docContext;
7963
+ }
7964
+ }
7965
+ }
7966
+ return compacted;
7864
7967
  }
7865
7968
  /**
7866
7969
  * Converts a JSON-LD structure to an object of this type.
@@ -7968,7 +8071,7 @@ export class Announce extends Activity {
7968
8071
  if (options.expand) {
7969
8072
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
7970
8073
  }
7971
- return await jsonld.compact(values, options.context ??
8074
+ const docContext = options.context ??
7972
8075
  [
7973
8076
  "https://www.w3.org/ns/activitystreams",
7974
8077
  "https://w3id.org/security/data-integrity/v1",
@@ -7978,7 +8081,23 @@ export class Announce extends Activity {
7978
8081
  "Emoji": "toot:Emoji",
7979
8082
  "Hashtag": "as:Hashtag",
7980
8083
  },
7981
- ], { documentLoader: options.contextLoader });
8084
+ ];
8085
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
8086
+ if (docContext != null) {
8087
+ // Embed context
8088
+ if ("proof" in compacted &&
8089
+ compacted.proof != null) {
8090
+ if (Array.isArray(compacted.proof)) {
8091
+ for (const element of compacted.proof) {
8092
+ element["@context"] = docContext;
8093
+ }
8094
+ }
8095
+ else {
8096
+ compacted.proof["@context"] = docContext;
8097
+ }
8098
+ }
8099
+ }
8100
+ return compacted;
7982
8101
  }
7983
8102
  /**
7984
8103
  * Converts a JSON-LD structure to an object of this type.
@@ -9447,7 +9566,7 @@ export class Application extends Object {
9447
9566
  if (options.expand) {
9448
9567
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
9449
9568
  }
9450
- return await jsonld.compact(values, options.context ??
9569
+ const docContext = options.context ??
9451
9570
  [
9452
9571
  "https://www.w3.org/ns/activitystreams",
9453
9572
  "https://w3id.org/security/v1",
@@ -9467,7 +9586,23 @@ export class Application extends Object {
9467
9586
  "PropertyValue": "schema:PropertyValue",
9468
9587
  "value": "schema:value",
9469
9588
  },
9470
- ], { documentLoader: options.contextLoader });
9589
+ ];
9590
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
9591
+ if (docContext != null) {
9592
+ // Embed context
9593
+ if ("proof" in compacted &&
9594
+ compacted.proof != null) {
9595
+ if (Array.isArray(compacted.proof)) {
9596
+ for (const element of compacted.proof) {
9597
+ element["@context"] = docContext;
9598
+ }
9599
+ }
9600
+ else {
9601
+ compacted.proof["@context"] = docContext;
9602
+ }
9603
+ }
9604
+ }
9605
+ return compacted;
9471
9606
  }
9472
9607
  /**
9473
9608
  * Converts a JSON-LD structure to an object of this type.
@@ -10062,11 +10197,27 @@ export class IntransitiveActivity extends Activity {
10062
10197
  if (options.expand) {
10063
10198
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10064
10199
  }
10065
- return await jsonld.compact(values, options.context ??
10200
+ const docContext = options.context ??
10066
10201
  [
10067
10202
  "https://www.w3.org/ns/activitystreams",
10068
10203
  "https://w3id.org/security/data-integrity/v1",
10069
- ], { documentLoader: options.contextLoader });
10204
+ ];
10205
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
10206
+ if (docContext != null) {
10207
+ // Embed context
10208
+ if ("proof" in compacted &&
10209
+ compacted.proof != null) {
10210
+ if (Array.isArray(compacted.proof)) {
10211
+ for (const element of compacted.proof) {
10212
+ element["@context"] = docContext;
10213
+ }
10214
+ }
10215
+ else {
10216
+ compacted.proof["@context"] = docContext;
10217
+ }
10218
+ }
10219
+ }
10220
+ return compacted;
10070
10221
  }
10071
10222
  /**
10072
10223
  * Converts a JSON-LD structure to an object of this type.
@@ -10182,11 +10333,27 @@ export class Arrive extends IntransitiveActivity {
10182
10333
  if (options.expand) {
10183
10334
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10184
10335
  }
10185
- return await jsonld.compact(values, options.context ??
10336
+ const docContext = options.context ??
10186
10337
  [
10187
10338
  "https://www.w3.org/ns/activitystreams",
10188
10339
  "https://w3id.org/security/data-integrity/v1",
10189
- ], { documentLoader: options.contextLoader });
10340
+ ];
10341
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
10342
+ if (docContext != null) {
10343
+ // Embed context
10344
+ if ("proof" in compacted &&
10345
+ compacted.proof != null) {
10346
+ if (Array.isArray(compacted.proof)) {
10347
+ for (const element of compacted.proof) {
10348
+ element["@context"] = docContext;
10349
+ }
10350
+ }
10351
+ else {
10352
+ compacted.proof["@context"] = docContext;
10353
+ }
10354
+ }
10355
+ }
10356
+ return compacted;
10190
10357
  }
10191
10358
  /**
10192
10359
  * Converts a JSON-LD structure to an object of this type.
@@ -10292,7 +10459,7 @@ export class Article extends Object {
10292
10459
  if (options.expand) {
10293
10460
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10294
10461
  }
10295
- return await jsonld.compact(values, options.context ??
10462
+ const docContext = options.context ??
10296
10463
  [
10297
10464
  "https://www.w3.org/ns/activitystreams",
10298
10465
  "https://w3id.org/security/data-integrity/v1",
@@ -10302,7 +10469,23 @@ export class Article extends Object {
10302
10469
  "Emoji": "toot:Emoji",
10303
10470
  "Hashtag": "as:Hashtag",
10304
10471
  },
10305
- ], { documentLoader: options.contextLoader });
10472
+ ];
10473
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
10474
+ if (docContext != null) {
10475
+ // Embed context
10476
+ if ("proof" in compacted &&
10477
+ compacted.proof != null) {
10478
+ if (Array.isArray(compacted.proof)) {
10479
+ for (const element of compacted.proof) {
10480
+ element["@context"] = docContext;
10481
+ }
10482
+ }
10483
+ else {
10484
+ compacted.proof["@context"] = docContext;
10485
+ }
10486
+ }
10487
+ }
10488
+ return compacted;
10306
10489
  }
10307
10490
  /**
10308
10491
  * Converts a JSON-LD structure to an object of this type.
@@ -10494,11 +10677,27 @@ export class Document extends Object {
10494
10677
  if (options.expand) {
10495
10678
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10496
10679
  }
10497
- return await jsonld.compact(values, options.context ??
10680
+ const docContext = options.context ??
10498
10681
  [
10499
10682
  "https://www.w3.org/ns/activitystreams",
10500
10683
  "https://w3id.org/security/data-integrity/v1",
10501
- ], { documentLoader: options.contextLoader });
10684
+ ];
10685
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
10686
+ if (docContext != null) {
10687
+ // Embed context
10688
+ if ("proof" in compacted &&
10689
+ compacted.proof != null) {
10690
+ if (Array.isArray(compacted.proof)) {
10691
+ for (const element of compacted.proof) {
10692
+ element["@context"] = docContext;
10693
+ }
10694
+ }
10695
+ else {
10696
+ compacted.proof["@context"] = docContext;
10697
+ }
10698
+ }
10699
+ }
10700
+ return compacted;
10502
10701
  }
10503
10702
  /**
10504
10703
  * Converts a JSON-LD structure to an object of this type.
@@ -10668,11 +10867,27 @@ export class Audio extends Document {
10668
10867
  if (options.expand) {
10669
10868
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10670
10869
  }
10671
- return await jsonld.compact(values, options.context ??
10870
+ const docContext = options.context ??
10672
10871
  [
10673
10872
  "https://www.w3.org/ns/activitystreams",
10674
10873
  "https://w3id.org/security/data-integrity/v1",
10675
- ], { documentLoader: options.contextLoader });
10874
+ ];
10875
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
10876
+ if (docContext != null) {
10877
+ // Embed context
10878
+ if ("proof" in compacted &&
10879
+ compacted.proof != null) {
10880
+ if (Array.isArray(compacted.proof)) {
10881
+ for (const element of compacted.proof) {
10882
+ element["@context"] = docContext;
10883
+ }
10884
+ }
10885
+ else {
10886
+ compacted.proof["@context"] = docContext;
10887
+ }
10888
+ }
10889
+ }
10890
+ return compacted;
10676
10891
  }
10677
10892
  /**
10678
10893
  * Converts a JSON-LD structure to an object of this type.
@@ -10779,11 +10994,27 @@ export class Ignore extends Activity {
10779
10994
  if (options.expand) {
10780
10995
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10781
10996
  }
10782
- return await jsonld.compact(values, options.context ??
10997
+ const docContext = options.context ??
10783
10998
  [
10784
10999
  "https://www.w3.org/ns/activitystreams",
10785
11000
  "https://w3id.org/security/data-integrity/v1",
10786
- ], { documentLoader: options.contextLoader });
11001
+ ];
11002
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
11003
+ if (docContext != null) {
11004
+ // Embed context
11005
+ if ("proof" in compacted &&
11006
+ compacted.proof != null) {
11007
+ if (Array.isArray(compacted.proof)) {
11008
+ for (const element of compacted.proof) {
11009
+ element["@context"] = docContext;
11010
+ }
11011
+ }
11012
+ else {
11013
+ compacted.proof["@context"] = docContext;
11014
+ }
11015
+ }
11016
+ }
11017
+ return compacted;
10787
11018
  }
10788
11019
  /**
10789
11020
  * Converts a JSON-LD structure to an object of this type.
@@ -10896,11 +11127,27 @@ export class Block extends Ignore {
10896
11127
  if (options.expand) {
10897
11128
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
10898
11129
  }
10899
- return await jsonld.compact(values, options.context ??
11130
+ const docContext = options.context ??
10900
11131
  [
10901
11132
  "https://www.w3.org/ns/activitystreams",
10902
11133
  "https://w3id.org/security/data-integrity/v1",
10903
- ], { documentLoader: options.contextLoader });
11134
+ ];
11135
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
11136
+ if (docContext != null) {
11137
+ // Embed context
11138
+ if ("proof" in compacted &&
11139
+ compacted.proof != null) {
11140
+ if (Array.isArray(compacted.proof)) {
11141
+ for (const element of compacted.proof) {
11142
+ element["@context"] = docContext;
11143
+ }
11144
+ }
11145
+ else {
11146
+ compacted.proof["@context"] = docContext;
11147
+ }
11148
+ }
11149
+ }
11150
+ return compacted;
10904
11151
  }
10905
11152
  /**
10906
11153
  * Converts a JSON-LD structure to an object of this type.
@@ -11419,7 +11666,7 @@ export class Collection extends Object {
11419
11666
  if (options.expand) {
11420
11667
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
11421
11668
  }
11422
- return await jsonld.compact(values, options.context ??
11669
+ const docContext = options.context ??
11423
11670
  [
11424
11671
  "https://www.w3.org/ns/activitystreams",
11425
11672
  "https://w3id.org/security/data-integrity/v1",
@@ -11429,7 +11676,23 @@ export class Collection extends Object {
11429
11676
  "Emoji": "toot:Emoji",
11430
11677
  "Hashtag": "as:Hashtag",
11431
11678
  },
11432
- ], { documentLoader: options.contextLoader });
11679
+ ];
11680
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
11681
+ if (docContext != null) {
11682
+ // Embed context
11683
+ if ("proof" in compacted &&
11684
+ compacted.proof != null) {
11685
+ if (Array.isArray(compacted.proof)) {
11686
+ for (const element of compacted.proof) {
11687
+ element["@context"] = docContext;
11688
+ }
11689
+ }
11690
+ else {
11691
+ compacted.proof["@context"] = docContext;
11692
+ }
11693
+ }
11694
+ }
11695
+ return compacted;
11433
11696
  }
11434
11697
  /**
11435
11698
  * Converts a JSON-LD structure to an object of this type.
@@ -12016,7 +12279,7 @@ export class CollectionPage extends Collection {
12016
12279
  if (options.expand) {
12017
12280
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
12018
12281
  }
12019
- return await jsonld.compact(values, options.context ??
12282
+ const docContext = options.context ??
12020
12283
  [
12021
12284
  "https://www.w3.org/ns/activitystreams",
12022
12285
  "https://w3id.org/security/data-integrity/v1",
@@ -12026,7 +12289,23 @@ export class CollectionPage extends Collection {
12026
12289
  "Emoji": "toot:Emoji",
12027
12290
  "Hashtag": "as:Hashtag",
12028
12291
  },
12029
- ], { documentLoader: options.contextLoader });
12292
+ ];
12293
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12294
+ if (docContext != null) {
12295
+ // Embed context
12296
+ if ("proof" in compacted &&
12297
+ compacted.proof != null) {
12298
+ if (Array.isArray(compacted.proof)) {
12299
+ for (const element of compacted.proof) {
12300
+ element["@context"] = docContext;
12301
+ }
12302
+ }
12303
+ else {
12304
+ compacted.proof["@context"] = docContext;
12305
+ }
12306
+ }
12307
+ }
12308
+ return compacted;
12030
12309
  }
12031
12310
  /**
12032
12311
  * Converts a JSON-LD structure to an object of this type.
@@ -12224,7 +12503,7 @@ export class Create extends Activity {
12224
12503
  if (options.expand) {
12225
12504
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
12226
12505
  }
12227
- return await jsonld.compact(values, options.context ??
12506
+ const docContext = options.context ??
12228
12507
  [
12229
12508
  "https://www.w3.org/ns/activitystreams",
12230
12509
  "https://w3id.org/security/data-integrity/v1",
@@ -12234,7 +12513,23 @@ export class Create extends Activity {
12234
12513
  "Emoji": "toot:Emoji",
12235
12514
  "Hashtag": "as:Hashtag",
12236
12515
  },
12237
- ], { documentLoader: options.contextLoader });
12516
+ ];
12517
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12518
+ if (docContext != null) {
12519
+ // Embed context
12520
+ if ("proof" in compacted &&
12521
+ compacted.proof != null) {
12522
+ if (Array.isArray(compacted.proof)) {
12523
+ for (const element of compacted.proof) {
12524
+ element["@context"] = docContext;
12525
+ }
12526
+ }
12527
+ else {
12528
+ compacted.proof["@context"] = docContext;
12529
+ }
12530
+ }
12531
+ }
12532
+ return compacted;
12238
12533
  }
12239
12534
  /**
12240
12535
  * Converts a JSON-LD structure to an object of this type.
@@ -12341,11 +12636,27 @@ export class Delete extends Activity {
12341
12636
  if (options.expand) {
12342
12637
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
12343
12638
  }
12344
- return await jsonld.compact(values, options.context ??
12639
+ const docContext = options.context ??
12345
12640
  [
12346
12641
  "https://www.w3.org/ns/activitystreams",
12347
12642
  "https://w3id.org/security/data-integrity/v1",
12348
- ], { documentLoader: options.contextLoader });
12643
+ ];
12644
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12645
+ if (docContext != null) {
12646
+ // Embed context
12647
+ if ("proof" in compacted &&
12648
+ compacted.proof != null) {
12649
+ if (Array.isArray(compacted.proof)) {
12650
+ for (const element of compacted.proof) {
12651
+ element["@context"] = docContext;
12652
+ }
12653
+ }
12654
+ else {
12655
+ compacted.proof["@context"] = docContext;
12656
+ }
12657
+ }
12658
+ }
12659
+ return compacted;
12349
12660
  }
12350
12661
  /**
12351
12662
  * Converts a JSON-LD structure to an object of this type.
@@ -12451,11 +12762,27 @@ export class Dislike extends Activity {
12451
12762
  if (options.expand) {
12452
12763
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
12453
12764
  }
12454
- return await jsonld.compact(values, options.context ??
12765
+ const docContext = options.context ??
12455
12766
  [
12456
12767
  "https://www.w3.org/ns/activitystreams",
12457
12768
  "https://w3id.org/security/data-integrity/v1",
12458
- ], { documentLoader: options.contextLoader });
12769
+ ];
12770
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12771
+ if (docContext != null) {
12772
+ // Embed context
12773
+ if ("proof" in compacted &&
12774
+ compacted.proof != null) {
12775
+ if (Array.isArray(compacted.proof)) {
12776
+ for (const element of compacted.proof) {
12777
+ element["@context"] = docContext;
12778
+ }
12779
+ }
12780
+ else {
12781
+ compacted.proof["@context"] = docContext;
12782
+ }
12783
+ }
12784
+ }
12785
+ return compacted;
12459
12786
  }
12460
12787
  /**
12461
12788
  * Converts a JSON-LD structure to an object of this type.
@@ -12826,7 +13153,13 @@ export class Endpoints {
12826
13153
  if (options.expand) {
12827
13154
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
12828
13155
  }
12829
- return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
13156
+ const docContext = options.context ??
13157
+ "https://www.w3.org/ns/activitystreams";
13158
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13159
+ if (docContext != null) {
13160
+ // Embed context
13161
+ }
13162
+ return compacted;
12830
13163
  }
12831
13164
  /**
12832
13165
  * Converts a JSON-LD structure to an object of this type.
@@ -13079,11 +13412,27 @@ export class Event extends Object {
13079
13412
  if (options.expand) {
13080
13413
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
13081
13414
  }
13082
- return await jsonld.compact(values, options.context ??
13415
+ const docContext = options.context ??
13083
13416
  [
13084
13417
  "https://www.w3.org/ns/activitystreams",
13085
13418
  "https://w3id.org/security/data-integrity/v1",
13086
- ], { documentLoader: options.contextLoader });
13419
+ ];
13420
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13421
+ if (docContext != null) {
13422
+ // Embed context
13423
+ if ("proof" in compacted &&
13424
+ compacted.proof != null) {
13425
+ if (Array.isArray(compacted.proof)) {
13426
+ for (const element of compacted.proof) {
13427
+ element["@context"] = docContext;
13428
+ }
13429
+ }
13430
+ else {
13431
+ compacted.proof["@context"] = docContext;
13432
+ }
13433
+ }
13434
+ }
13435
+ return compacted;
13087
13436
  }
13088
13437
  /**
13089
13438
  * Converts a JSON-LD structure to an object of this type.
@@ -13191,11 +13540,27 @@ export class Flag extends Activity {
13191
13540
  if (options.expand) {
13192
13541
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
13193
13542
  }
13194
- return await jsonld.compact(values, options.context ??
13543
+ const docContext = options.context ??
13195
13544
  [
13196
13545
  "https://www.w3.org/ns/activitystreams",
13197
13546
  "https://w3id.org/security/data-integrity/v1",
13198
- ], { documentLoader: options.contextLoader });
13547
+ ];
13548
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13549
+ if (docContext != null) {
13550
+ // Embed context
13551
+ if ("proof" in compacted &&
13552
+ compacted.proof != null) {
13553
+ if (Array.isArray(compacted.proof)) {
13554
+ for (const element of compacted.proof) {
13555
+ element["@context"] = docContext;
13556
+ }
13557
+ }
13558
+ else {
13559
+ compacted.proof["@context"] = docContext;
13560
+ }
13561
+ }
13562
+ }
13563
+ return compacted;
13199
13564
  }
13200
13565
  /**
13201
13566
  * Converts a JSON-LD structure to an object of this type.
@@ -13304,11 +13669,27 @@ export class Follow extends Activity {
13304
13669
  if (options.expand) {
13305
13670
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
13306
13671
  }
13307
- return await jsonld.compact(values, options.context ??
13672
+ const docContext = options.context ??
13308
13673
  [
13309
13674
  "https://www.w3.org/ns/activitystreams",
13310
13675
  "https://w3id.org/security/data-integrity/v1",
13311
- ], { documentLoader: options.contextLoader });
13676
+ ];
13677
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13678
+ if (docContext != null) {
13679
+ // Embed context
13680
+ if ("proof" in compacted &&
13681
+ compacted.proof != null) {
13682
+ if (Array.isArray(compacted.proof)) {
13683
+ for (const element of compacted.proof) {
13684
+ element["@context"] = docContext;
13685
+ }
13686
+ }
13687
+ else {
13688
+ compacted.proof["@context"] = docContext;
13689
+ }
13690
+ }
13691
+ }
13692
+ return compacted;
13312
13693
  }
13313
13694
  /**
13314
13695
  * Converts a JSON-LD structure to an object of this type.
@@ -14777,7 +15158,7 @@ export class Group extends Object {
14777
15158
  if (options.expand) {
14778
15159
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
14779
15160
  }
14780
- return await jsonld.compact(values, options.context ??
15161
+ const docContext = options.context ??
14781
15162
  [
14782
15163
  "https://www.w3.org/ns/activitystreams",
14783
15164
  "https://w3id.org/security/v1",
@@ -14797,7 +15178,23 @@ export class Group extends Object {
14797
15178
  "PropertyValue": "schema:PropertyValue",
14798
15179
  "value": "schema:value",
14799
15180
  },
14800
- ], { documentLoader: options.contextLoader });
15181
+ ];
15182
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
15183
+ if (docContext != null) {
15184
+ // Embed context
15185
+ if ("proof" in compacted &&
15186
+ compacted.proof != null) {
15187
+ if (Array.isArray(compacted.proof)) {
15188
+ for (const element of compacted.proof) {
15189
+ element["@context"] = docContext;
15190
+ }
15191
+ }
15192
+ else {
15193
+ compacted.proof["@context"] = docContext;
15194
+ }
15195
+ }
15196
+ }
15197
+ return compacted;
14801
15198
  }
14802
15199
  /**
14803
15200
  * Converts a JSON-LD structure to an object of this type.
@@ -15870,7 +16267,13 @@ export class Link {
15870
16267
  if (options.expand) {
15871
16268
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
15872
16269
  }
15873
- return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
16270
+ const docContext = options.context ??
16271
+ "https://www.w3.org/ns/activitystreams";
16272
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
16273
+ if (docContext != null) {
16274
+ // Embed context
16275
+ }
16276
+ return compacted;
15874
16277
  }
15875
16278
  /**
15876
16279
  * Converts a JSON-LD structure to an object of this type.
@@ -16272,8 +16675,13 @@ export class Hashtag extends Link {
16272
16675
  if (options.expand) {
16273
16676
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16274
16677
  }
16275
- return await jsonld.compact(values, options.context ??
16276
- ["https://www.w3.org/ns/activitystreams", { "Hashtag": "as:Hashtag" }], { documentLoader: options.contextLoader });
16678
+ const docContext = options.context ??
16679
+ ["https://www.w3.org/ns/activitystreams", { "Hashtag": "as:Hashtag" }];
16680
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
16681
+ if (docContext != null) {
16682
+ // Embed context
16683
+ }
16684
+ return compacted;
16277
16685
  }
16278
16686
  /**
16279
16687
  * Converts a JSON-LD structure to an object of this type.
@@ -16379,7 +16787,24 @@ export class Image extends Document {
16379
16787
  if (options.expand) {
16380
16788
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16381
16789
  }
16382
- return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
16790
+ const docContext = options.context ??
16791
+ "https://www.w3.org/ns/activitystreams";
16792
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
16793
+ if (docContext != null) {
16794
+ // Embed context
16795
+ if ("proof" in compacted &&
16796
+ compacted.proof != null) {
16797
+ if (Array.isArray(compacted.proof)) {
16798
+ for (const element of compacted.proof) {
16799
+ element["@context"] = docContext;
16800
+ }
16801
+ }
16802
+ else {
16803
+ compacted.proof["@context"] = docContext;
16804
+ }
16805
+ }
16806
+ }
16807
+ return compacted;
16383
16808
  }
16384
16809
  /**
16385
16810
  * Converts a JSON-LD structure to an object of this type.
@@ -16487,11 +16912,27 @@ export class Offer extends Activity {
16487
16912
  if (options.expand) {
16488
16913
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16489
16914
  }
16490
- return await jsonld.compact(values, options.context ??
16915
+ const docContext = options.context ??
16491
16916
  [
16492
16917
  "https://www.w3.org/ns/activitystreams",
16493
16918
  "https://w3id.org/security/data-integrity/v1",
16494
- ], { documentLoader: options.contextLoader });
16919
+ ];
16920
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
16921
+ if (docContext != null) {
16922
+ // Embed context
16923
+ if ("proof" in compacted &&
16924
+ compacted.proof != null) {
16925
+ if (Array.isArray(compacted.proof)) {
16926
+ for (const element of compacted.proof) {
16927
+ element["@context"] = docContext;
16928
+ }
16929
+ }
16930
+ else {
16931
+ compacted.proof["@context"] = docContext;
16932
+ }
16933
+ }
16934
+ }
16935
+ return compacted;
16495
16936
  }
16496
16937
  /**
16497
16938
  * Converts a JSON-LD structure to an object of this type.
@@ -16602,11 +17043,27 @@ export class Invite extends Offer {
16602
17043
  if (options.expand) {
16603
17044
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16604
17045
  }
16605
- return await jsonld.compact(values, options.context ??
17046
+ const docContext = options.context ??
16606
17047
  [
16607
17048
  "https://www.w3.org/ns/activitystreams",
16608
17049
  "https://w3id.org/security/data-integrity/v1",
16609
- ], { documentLoader: options.contextLoader });
17050
+ ];
17051
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17052
+ if (docContext != null) {
17053
+ // Embed context
17054
+ if ("proof" in compacted &&
17055
+ compacted.proof != null) {
17056
+ if (Array.isArray(compacted.proof)) {
17057
+ for (const element of compacted.proof) {
17058
+ element["@context"] = docContext;
17059
+ }
17060
+ }
17061
+ else {
17062
+ compacted.proof["@context"] = docContext;
17063
+ }
17064
+ }
17065
+ }
17066
+ return compacted;
16610
17067
  }
16611
17068
  /**
16612
17069
  * Converts a JSON-LD structure to an object of this type.
@@ -16713,11 +17170,27 @@ export class Join extends Activity {
16713
17170
  if (options.expand) {
16714
17171
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16715
17172
  }
16716
- return await jsonld.compact(values, options.context ??
17173
+ const docContext = options.context ??
16717
17174
  [
16718
17175
  "https://www.w3.org/ns/activitystreams",
16719
17176
  "https://w3id.org/security/data-integrity/v1",
16720
- ], { documentLoader: options.contextLoader });
17177
+ ];
17178
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17179
+ if (docContext != null) {
17180
+ // Embed context
17181
+ if ("proof" in compacted &&
17182
+ compacted.proof != null) {
17183
+ if (Array.isArray(compacted.proof)) {
17184
+ for (const element of compacted.proof) {
17185
+ element["@context"] = docContext;
17186
+ }
17187
+ }
17188
+ else {
17189
+ compacted.proof["@context"] = docContext;
17190
+ }
17191
+ }
17192
+ }
17193
+ return compacted;
16721
17194
  }
16722
17195
  /**
16723
17196
  * Converts a JSON-LD structure to an object of this type.
@@ -16824,11 +17297,27 @@ export class Leave extends Activity {
16824
17297
  if (options.expand) {
16825
17298
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16826
17299
  }
16827
- return await jsonld.compact(values, options.context ??
17300
+ const docContext = options.context ??
16828
17301
  [
16829
17302
  "https://www.w3.org/ns/activitystreams",
16830
17303
  "https://w3id.org/security/data-integrity/v1",
16831
- ], { documentLoader: options.contextLoader });
17304
+ ];
17305
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17306
+ if (docContext != null) {
17307
+ // Embed context
17308
+ if ("proof" in compacted &&
17309
+ compacted.proof != null) {
17310
+ if (Array.isArray(compacted.proof)) {
17311
+ for (const element of compacted.proof) {
17312
+ element["@context"] = docContext;
17313
+ }
17314
+ }
17315
+ else {
17316
+ compacted.proof["@context"] = docContext;
17317
+ }
17318
+ }
17319
+ }
17320
+ return compacted;
16832
17321
  }
16833
17322
  /**
16834
17323
  * Converts a JSON-LD structure to an object of this type.
@@ -16935,11 +17424,27 @@ export class Like extends Activity {
16935
17424
  if (options.expand) {
16936
17425
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
16937
17426
  }
16938
- return await jsonld.compact(values, options.context ??
17427
+ const docContext = options.context ??
16939
17428
  [
16940
17429
  "https://www.w3.org/ns/activitystreams",
16941
17430
  "https://w3id.org/security/data-integrity/v1",
16942
- ], { documentLoader: options.contextLoader });
17431
+ ];
17432
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17433
+ if (docContext != null) {
17434
+ // Embed context
17435
+ if ("proof" in compacted &&
17436
+ compacted.proof != null) {
17437
+ if (Array.isArray(compacted.proof)) {
17438
+ for (const element of compacted.proof) {
17439
+ element["@context"] = docContext;
17440
+ }
17441
+ }
17442
+ else {
17443
+ compacted.proof["@context"] = docContext;
17444
+ }
17445
+ }
17446
+ }
17447
+ return compacted;
16943
17448
  }
16944
17449
  /**
16945
17450
  * Converts a JSON-LD structure to an object of this type.
@@ -17045,11 +17550,27 @@ export class Listen extends Activity {
17045
17550
  if (options.expand) {
17046
17551
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
17047
17552
  }
17048
- return await jsonld.compact(values, options.context ??
17553
+ const docContext = options.context ??
17049
17554
  [
17050
17555
  "https://www.w3.org/ns/activitystreams",
17051
17556
  "https://w3id.org/security/data-integrity/v1",
17052
- ], { documentLoader: options.contextLoader });
17557
+ ];
17558
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17559
+ if (docContext != null) {
17560
+ // Embed context
17561
+ if ("proof" in compacted &&
17562
+ compacted.proof != null) {
17563
+ if (Array.isArray(compacted.proof)) {
17564
+ for (const element of compacted.proof) {
17565
+ element["@context"] = docContext;
17566
+ }
17567
+ }
17568
+ else {
17569
+ compacted.proof["@context"] = docContext;
17570
+ }
17571
+ }
17572
+ }
17573
+ return compacted;
17053
17574
  }
17054
17575
  /**
17055
17576
  * Converts a JSON-LD structure to an object of this type.
@@ -17155,7 +17676,13 @@ export class Mention extends Link {
17155
17676
  if (options.expand) {
17156
17677
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
17157
17678
  }
17158
- return await jsonld.compact(values, options.context ?? "https://www.w3.org/ns/activitystreams", { documentLoader: options.contextLoader });
17679
+ const docContext = options.context ??
17680
+ "https://www.w3.org/ns/activitystreams";
17681
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17682
+ if (docContext != null) {
17683
+ // Embed context
17684
+ }
17685
+ return compacted;
17159
17686
  }
17160
17687
  /**
17161
17688
  * Converts a JSON-LD structure to an object of this type.
@@ -17262,7 +17789,7 @@ export class Note extends Object {
17262
17789
  if (options.expand) {
17263
17790
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
17264
17791
  }
17265
- return await jsonld.compact(values, options.context ??
17792
+ const docContext = options.context ??
17266
17793
  [
17267
17794
  "https://www.w3.org/ns/activitystreams",
17268
17795
  "https://w3id.org/security/data-integrity/v1",
@@ -17272,7 +17799,23 @@ export class Note extends Object {
17272
17799
  "Emoji": "toot:Emoji",
17273
17800
  "Hashtag": "as:Hashtag",
17274
17801
  },
17275
- ], { documentLoader: options.contextLoader });
17802
+ ];
17803
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17804
+ if (docContext != null) {
17805
+ // Embed context
17806
+ if ("proof" in compacted &&
17807
+ compacted.proof != null) {
17808
+ if (Array.isArray(compacted.proof)) {
17809
+ for (const element of compacted.proof) {
17810
+ element["@context"] = docContext;
17811
+ }
17812
+ }
17813
+ else {
17814
+ compacted.proof["@context"] = docContext;
17815
+ }
17816
+ }
17817
+ }
17818
+ return compacted;
17276
17819
  }
17277
17820
  /**
17278
17821
  * Converts a JSON-LD structure to an object of this type.
@@ -17482,7 +18025,7 @@ export class OrderedCollection extends Collection {
17482
18025
  if (options.expand) {
17483
18026
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
17484
18027
  }
17485
- return await jsonld.compact(values, options.context ??
18028
+ const docContext = options.context ??
17486
18029
  [
17487
18030
  "https://www.w3.org/ns/activitystreams",
17488
18031
  "https://w3id.org/security/data-integrity/v1",
@@ -17492,7 +18035,23 @@ export class OrderedCollection extends Collection {
17492
18035
  "Emoji": "toot:Emoji",
17493
18036
  "Hashtag": "as:Hashtag",
17494
18037
  },
17495
- ], { documentLoader: options.contextLoader });
18038
+ ];
18039
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
18040
+ if (docContext != null) {
18041
+ // Embed context
18042
+ if ("proof" in compacted &&
18043
+ compacted.proof != null) {
18044
+ if (Array.isArray(compacted.proof)) {
18045
+ for (const element of compacted.proof) {
18046
+ element["@context"] = docContext;
18047
+ }
18048
+ }
18049
+ else {
18050
+ compacted.proof["@context"] = docContext;
18051
+ }
18052
+ }
18053
+ }
18054
+ return compacted;
17496
18055
  }
17497
18056
  /**
17498
18057
  * Converts a JSON-LD structure to an object of this type.
@@ -17654,6 +18213,7 @@ export class OrderedCollectionPage extends CollectionPage {
17654
18213
  static get typeId() {
17655
18214
  return new URL("https://www.w3.org/ns/activitystreams#OrderedCollectionPage");
17656
18215
  }
18216
+ #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = [];
17657
18217
  #_2W4yinFwqmpneu2h4m1mZ3pcLADd = [];
17658
18218
  /**
17659
18219
  * Constructs a new instance of OrderedCollectionPage with the given values.
@@ -17662,6 +18222,17 @@ export class OrderedCollectionPage extends CollectionPage {
17662
18222
  */
17663
18223
  constructor(values, { documentLoader, contextLoader, } = {}) {
17664
18224
  super(values, { documentLoader, contextLoader });
18225
+ if ("items" in values && values.items != null) {
18226
+ if (Array.isArray(values.items) &&
18227
+ values.items.every((v) => v instanceof Object || v instanceof Link || v instanceof URL)) {
18228
+ // @ts-ignore: type is checked above.
18229
+ this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
18230
+ }
18231
+ else {
18232
+ throw new TypeError("The items must be an array of type " +
18233
+ "Object | Link | URL" + ".");
18234
+ }
18235
+ }
17665
18236
  if ("startIndex" in values && values.startIndex != null) {
17666
18237
  if (typeof values.startIndex === "number" &&
17667
18238
  Number.isInteger(values.startIndex) && values.startIndex >= 0) {
@@ -17682,6 +18253,18 @@ export class OrderedCollectionPage extends CollectionPage {
17682
18253
  */
17683
18254
  clone(values = {}, options = {}) {
17684
18255
  const clone = super.clone(values, options);
18256
+ clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
18257
+ if ("items" in values && values.items != null) {
18258
+ if (Array.isArray(values.items) &&
18259
+ values.items.every((v) => v instanceof Object || v instanceof Link || v instanceof URL)) {
18260
+ // @ts-ignore: type is checked above.
18261
+ clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items;
18262
+ }
18263
+ else {
18264
+ throw new TypeError("The items must be an array of type " +
18265
+ "Object | Link | URL" + ".");
18266
+ }
18267
+ }
17685
18268
  clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd;
17686
18269
  if ("startIndex" in values && values.startIndex != null) {
17687
18270
  if (typeof values.startIndex === "number" &&
@@ -17696,6 +18279,69 @@ export class OrderedCollectionPage extends CollectionPage {
17696
18279
  }
17697
18280
  return clone;
17698
18281
  }
18282
+ async #fetchItem(url, options = {}) {
18283
+ const documentLoader = options.documentLoader ?? this._documentLoader ??
18284
+ fetchDocumentLoader;
18285
+ const contextLoader = options.contextLoader ?? this._contextLoader ??
18286
+ fetchDocumentLoader;
18287
+ let fetchResult;
18288
+ try {
18289
+ fetchResult = await documentLoader(url.href);
18290
+ }
18291
+ catch (error) {
18292
+ if (options.suppressError) {
18293
+ getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", { error, url: url.href });
18294
+ return null;
18295
+ }
18296
+ throw error;
18297
+ }
18298
+ const { document } = fetchResult;
18299
+ try {
18300
+ return await Object.fromJsonLd(document, { documentLoader, contextLoader });
18301
+ }
18302
+ catch (e) {
18303
+ if (!(e instanceof TypeError))
18304
+ throw e;
18305
+ }
18306
+ try {
18307
+ return await Link.fromJsonLd(document, { documentLoader, contextLoader });
18308
+ }
18309
+ catch (e) {
18310
+ if (!(e instanceof TypeError))
18311
+ throw e;
18312
+ }
18313
+ throw new TypeError("Expected an object of any type of: " +
18314
+ [
18315
+ "https://www.w3.org/ns/activitystreams#Object",
18316
+ "https://www.w3.org/ns/activitystreams#Link",
18317
+ ].join(", "));
18318
+ }
18319
+ /**
18320
+ * Similar to
18321
+ * {@link OrderedCollectionPage.getItems},
18322
+ * but returns their `@id`s instead of the objects themselves.
18323
+ */
18324
+ get itemIds() {
18325
+ return this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
18326
+ }
18327
+ /** Identifies the items contained in a collection. The items might be ordered
18328
+ * or unordered.
18329
+ */
18330
+ async *getItems(options = {}) {
18331
+ const vs = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
18332
+ for (let i = 0; i < vs.length; i++) {
18333
+ const v = vs[i];
18334
+ if (v instanceof URL) {
18335
+ const fetched = await this.#fetchItem(v, options);
18336
+ if (fetched == null)
18337
+ continue;
18338
+ vs[i] = fetched;
18339
+ yield fetched;
18340
+ continue;
18341
+ }
18342
+ yield v;
18343
+ }
18344
+ }
17699
18345
  /** A non-negative integer value identifying the relative position within
17700
18346
  * the logical view of a strictly ordered collection.
17701
18347
  */
@@ -17721,6 +18367,20 @@ export class OrderedCollectionPage extends CollectionPage {
17721
18367
  });
17722
18368
  const values = baseValues[0];
17723
18369
  array = [];
18370
+ for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg) {
18371
+ const element = v instanceof URL
18372
+ ? { "@id": v.href }
18373
+ : v instanceof Object
18374
+ ? await v.toJsonLd(options)
18375
+ : await v.toJsonLd(options);
18376
+ array.push(element);
18377
+ }
18378
+ if (array.length > 0) {
18379
+ values["https://www.w3.org/ns/activitystreams#items"] = {
18380
+ "@list": array,
18381
+ };
18382
+ }
18383
+ array = [];
17724
18384
  for (const v of this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd) {
17725
18385
  const element = {
17726
18386
  "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger",
@@ -17739,7 +18399,7 @@ export class OrderedCollectionPage extends CollectionPage {
17739
18399
  if (options.expand) {
17740
18400
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
17741
18401
  }
17742
- return await jsonld.compact(values, options.context ??
18402
+ const docContext = options.context ??
17743
18403
  [
17744
18404
  "https://www.w3.org/ns/activitystreams",
17745
18405
  "https://w3id.org/security/data-integrity/v1",
@@ -17749,7 +18409,23 @@ export class OrderedCollectionPage extends CollectionPage {
17749
18409
  "Emoji": "toot:Emoji",
17750
18410
  "Hashtag": "as:Hashtag",
17751
18411
  },
17752
- ], { documentLoader: options.contextLoader });
18412
+ ];
18413
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
18414
+ if (docContext != null) {
18415
+ // Embed context
18416
+ if ("proof" in compacted &&
18417
+ compacted.proof != null) {
18418
+ if (Array.isArray(compacted.proof)) {
18419
+ for (const element of compacted.proof) {
18420
+ element["@context"] = docContext;
18421
+ }
18422
+ }
18423
+ else {
18424
+ compacted.proof["@context"] = docContext;
18425
+ }
18426
+ }
18427
+ }
18428
+ return compacted;
17753
18429
  }
17754
18430
  /**
17755
18431
  * Converts a JSON-LD structure to an object of this type.
@@ -17791,6 +18467,87 @@ export class OrderedCollectionPage extends CollectionPage {
17791
18467
  if (!(instance instanceof OrderedCollectionPage)) {
17792
18468
  throw new TypeError("Unexpected type: " + instance.constructor.name);
17793
18469
  }
18470
+ const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = [];
18471
+ const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array = values["https://www.w3.org/ns/activitystreams#items"];
18472
+ for (const v of _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array == null
18473
+ ? []
18474
+ : _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array.length === 1 &&
18475
+ "@list" in _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array[0]
18476
+ ? _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array[0]["@list"]
18477
+ : _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg__array) {
18478
+ if (v == null)
18479
+ continue;
18480
+ if (typeof v === "object" && "@id" in v && !("@type" in v) &&
18481
+ globalThis.Object.keys(v).length === 1) {
18482
+ _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(new URL(v["@id"]));
18483
+ continue;
18484
+ }
18485
+ const decoded = typeof v === "object" && "@type" in v &&
18486
+ Array.isArray(v["@type"]) &&
18487
+ [
18488
+ "https://www.w3.org/ns/activitystreams#Object",
18489
+ "http://joinmastodon.org/ns#Emoji",
18490
+ "https://www.w3.org/ns/activitystreams#Activity",
18491
+ "https://www.w3.org/ns/activitystreams#Accept",
18492
+ "https://www.w3.org/ns/activitystreams#Add",
18493
+ "https://www.w3.org/ns/activitystreams#Announce",
18494
+ "https://www.w3.org/ns/activitystreams#Create",
18495
+ "https://www.w3.org/ns/activitystreams#Delete",
18496
+ "https://www.w3.org/ns/activitystreams#Dislike",
18497
+ "https://www.w3.org/ns/activitystreams#Flag",
18498
+ "https://www.w3.org/ns/activitystreams#Follow",
18499
+ "https://www.w3.org/ns/activitystreams#Ignore",
18500
+ "https://www.w3.org/ns/activitystreams#Block",
18501
+ "https://www.w3.org/ns/activitystreams#IntransitiveActivity",
18502
+ "https://www.w3.org/ns/activitystreams#Arrive",
18503
+ "https://www.w3.org/ns/activitystreams#Question",
18504
+ "https://www.w3.org/ns/activitystreams#Join",
18505
+ "https://www.w3.org/ns/activitystreams#Leave",
18506
+ "https://www.w3.org/ns/activitystreams#Like",
18507
+ "https://www.w3.org/ns/activitystreams#Listen",
18508
+ "https://www.w3.org/ns/activitystreams#Offer",
18509
+ "https://www.w3.org/ns/activitystreams#Invite",
18510
+ "https://www.w3.org/ns/activitystreams#Reject",
18511
+ "https://www.w3.org/ns/activitystreams#Remove",
18512
+ "https://www.w3.org/ns/activitystreams#Undo",
18513
+ "https://www.w3.org/ns/activitystreams#Update",
18514
+ "https://www.w3.org/ns/activitystreams#Application",
18515
+ "https://www.w3.org/ns/activitystreams#Article",
18516
+ "https://www.w3.org/ns/activitystreams#Collection",
18517
+ "https://www.w3.org/ns/activitystreams#CollectionPage",
18518
+ "https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
18519
+ "https://www.w3.org/ns/activitystreams#OrderedCollection",
18520
+ "https://www.w3.org/ns/activitystreams#Document",
18521
+ "https://www.w3.org/ns/activitystreams#Audio",
18522
+ "https://www.w3.org/ns/activitystreams#Image",
18523
+ "https://www.w3.org/ns/activitystreams#Page",
18524
+ "https://www.w3.org/ns/activitystreams#Video",
18525
+ "https://www.w3.org/ns/activitystreams#Event",
18526
+ "https://www.w3.org/ns/activitystreams#Group",
18527
+ "https://www.w3.org/ns/activitystreams#Note",
18528
+ "https://www.w3.org/ns/activitystreams#Organization",
18529
+ "https://www.w3.org/ns/activitystreams#Person",
18530
+ "https://www.w3.org/ns/activitystreams#Place",
18531
+ "https://www.w3.org/ns/activitystreams#Profile",
18532
+ "https://www.w3.org/ns/activitystreams#Relationship",
18533
+ "https://www.w3.org/ns/activitystreams#Service",
18534
+ "https://www.w3.org/ns/activitystreams#Tombstone",
18535
+ ].some((t) => v["@type"].includes(t))
18536
+ ? await Object.fromJsonLd(v, options)
18537
+ : typeof v === "object" && "@type" in v &&
18538
+ Array.isArray(v["@type"]) &&
18539
+ [
18540
+ "https://www.w3.org/ns/activitystreams#Link",
18541
+ "https://www.w3.org/ns/activitystreams#Hashtag",
18542
+ "https://www.w3.org/ns/activitystreams#Mention",
18543
+ ].some((t) => v["@type"].includes(t))
18544
+ ? await Link.fromJsonLd(v, options)
18545
+ : undefined;
18546
+ if (typeof decoded === "undefined")
18547
+ continue;
18548
+ _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(decoded);
18549
+ }
18550
+ instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
17794
18551
  const _2W4yinFwqmpneu2h4m1mZ3pcLADd = [];
17795
18552
  const _2W4yinFwqmpneu2h4m1mZ3pcLADd__array = values["https://www.w3.org/ns/activitystreams#startIndex"];
17796
18553
  for (const v of _2W4yinFwqmpneu2h4m1mZ3pcLADd__array == null
@@ -17808,6 +18565,19 @@ export class OrderedCollectionPage extends CollectionPage {
17808
18565
  }
17809
18566
  _getCustomInspectProxy() {
17810
18567
  const proxy = super._getCustomInspectProxy();
18568
+ const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg
18569
+ // deno-lint-ignore no-explicit-any
18570
+ .map((v) => v instanceof URL
18571
+ ? {
18572
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
18573
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
18574
+ }
18575
+ : v);
18576
+ if (_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.length > 1 ||
18577
+ !("item" in proxy) &&
18578
+ _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.length > 0) {
18579
+ proxy.items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg;
18580
+ }
17811
18581
  const _2W4yinFwqmpneu2h4m1mZ3pcLADd = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd
17812
18582
  // deno-lint-ignore no-explicit-any
17813
18583
  .map((v) => v instanceof URL
@@ -19242,7 +20012,7 @@ export class Organization extends Object {
19242
20012
  if (options.expand) {
19243
20013
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
19244
20014
  }
19245
- return await jsonld.compact(values, options.context ??
20015
+ const docContext = options.context ??
19246
20016
  [
19247
20017
  "https://www.w3.org/ns/activitystreams",
19248
20018
  "https://w3id.org/security/v1",
@@ -19262,7 +20032,23 @@ export class Organization extends Object {
19262
20032
  "PropertyValue": "schema:PropertyValue",
19263
20033
  "value": "schema:value",
19264
20034
  },
19265
- ], { documentLoader: options.contextLoader });
20035
+ ];
20036
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
20037
+ if (docContext != null) {
20038
+ // Embed context
20039
+ if ("proof" in compacted &&
20040
+ compacted.proof != null) {
20041
+ if (Array.isArray(compacted.proof)) {
20042
+ for (const element of compacted.proof) {
20043
+ element["@context"] = docContext;
20044
+ }
20045
+ }
20046
+ else {
20047
+ compacted.proof["@context"] = docContext;
20048
+ }
20049
+ }
20050
+ }
20051
+ return compacted;
19266
20052
  }
19267
20053
  /**
19268
20054
  * Converts a JSON-LD structure to an object of this type.
@@ -19853,11 +20639,27 @@ export class Page extends Document {
19853
20639
  if (options.expand) {
19854
20640
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
19855
20641
  }
19856
- return await jsonld.compact(values, options.context ??
20642
+ const docContext = options.context ??
19857
20643
  [
19858
20644
  "https://www.w3.org/ns/activitystreams",
19859
20645
  "https://w3id.org/security/data-integrity/v1",
19860
- ], { documentLoader: options.contextLoader });
20646
+ ];
20647
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
20648
+ if (docContext != null) {
20649
+ // Embed context
20650
+ if ("proof" in compacted &&
20651
+ compacted.proof != null) {
20652
+ if (Array.isArray(compacted.proof)) {
20653
+ for (const element of compacted.proof) {
20654
+ element["@context"] = docContext;
20655
+ }
20656
+ }
20657
+ else {
20658
+ compacted.proof["@context"] = docContext;
20659
+ }
20660
+ }
20661
+ }
20662
+ return compacted;
19861
20663
  }
19862
20664
  /**
19863
20665
  * Converts a JSON-LD structure to an object of this type.
@@ -21326,7 +22128,7 @@ export class Person extends Object {
21326
22128
  if (options.expand) {
21327
22129
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
21328
22130
  }
21329
- return await jsonld.compact(values, options.context ??
22131
+ const docContext = options.context ??
21330
22132
  [
21331
22133
  "https://www.w3.org/ns/activitystreams",
21332
22134
  "https://w3id.org/security/v1",
@@ -21346,7 +22148,23 @@ export class Person extends Object {
21346
22148
  "PropertyValue": "schema:PropertyValue",
21347
22149
  "value": "schema:value",
21348
22150
  },
21349
- ], { documentLoader: options.contextLoader });
22151
+ ];
22152
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
22153
+ if (docContext != null) {
22154
+ // Embed context
22155
+ if ("proof" in compacted &&
22156
+ compacted.proof != null) {
22157
+ if (Array.isArray(compacted.proof)) {
22158
+ for (const element of compacted.proof) {
22159
+ element["@context"] = docContext;
22160
+ }
22161
+ }
22162
+ else {
22163
+ compacted.proof["@context"] = docContext;
22164
+ }
22165
+ }
22166
+ }
22167
+ return compacted;
21350
22168
  }
21351
22169
  /**
21352
22170
  * Converts a JSON-LD structure to an object of this type.
@@ -22193,11 +23011,27 @@ export class Place extends Object {
22193
23011
  if (options.expand) {
22194
23012
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
22195
23013
  }
22196
- return await jsonld.compact(values, options.context ??
23014
+ const docContext = options.context ??
22197
23015
  [
22198
23016
  "https://www.w3.org/ns/activitystreams",
22199
23017
  "https://w3id.org/security/data-integrity/v1",
22200
- ], { documentLoader: options.contextLoader });
23018
+ ];
23019
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
23020
+ if (docContext != null) {
23021
+ // Embed context
23022
+ if ("proof" in compacted &&
23023
+ compacted.proof != null) {
23024
+ if (Array.isArray(compacted.proof)) {
23025
+ for (const element of compacted.proof) {
23026
+ element["@context"] = docContext;
23027
+ }
23028
+ }
23029
+ else {
23030
+ compacted.proof["@context"] = docContext;
23031
+ }
23032
+ }
23033
+ }
23034
+ return compacted;
22201
23035
  }
22202
23036
  /**
22203
23037
  * Converts a JSON-LD structure to an object of this type.
@@ -22550,11 +23384,27 @@ export class Profile extends Object {
22550
23384
  if (options.expand) {
22551
23385
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
22552
23386
  }
22553
- return await jsonld.compact(values, options.context ??
23387
+ const docContext = options.context ??
22554
23388
  [
22555
23389
  "https://www.w3.org/ns/activitystreams",
22556
23390
  "https://w3id.org/security/data-integrity/v1",
22557
- ], { documentLoader: options.contextLoader });
23391
+ ];
23392
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
23393
+ if (docContext != null) {
23394
+ // Embed context
23395
+ if ("proof" in compacted &&
23396
+ compacted.proof != null) {
23397
+ if (Array.isArray(compacted.proof)) {
23398
+ for (const element of compacted.proof) {
23399
+ element["@context"] = docContext;
23400
+ }
23401
+ }
23402
+ else {
23403
+ compacted.proof["@context"] = docContext;
23404
+ }
23405
+ }
23406
+ }
23407
+ return compacted;
22558
23408
  }
22559
23409
  /**
22560
23410
  * Converts a JSON-LD structure to an object of this type.
@@ -22871,7 +23721,7 @@ export class Question extends IntransitiveActivity {
22871
23721
  if (options.expand) {
22872
23722
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
22873
23723
  }
22874
- return await jsonld.compact(values, options.context ??
23724
+ const docContext = options.context ??
22875
23725
  [
22876
23726
  "https://www.w3.org/ns/activitystreams",
22877
23727
  "https://w3id.org/security/data-integrity/v1",
@@ -22881,7 +23731,23 @@ export class Question extends IntransitiveActivity {
22881
23731
  "Emoji": "toot:Emoji",
22882
23732
  "Hashtag": "as:Hashtag",
22883
23733
  },
22884
- ], { documentLoader: options.contextLoader });
23734
+ ];
23735
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
23736
+ if (docContext != null) {
23737
+ // Embed context
23738
+ if ("proof" in compacted &&
23739
+ compacted.proof != null) {
23740
+ if (Array.isArray(compacted.proof)) {
23741
+ for (const element of compacted.proof) {
23742
+ element["@context"] = docContext;
23743
+ }
23744
+ }
23745
+ else {
23746
+ compacted.proof["@context"] = docContext;
23747
+ }
23748
+ }
23749
+ }
23750
+ return compacted;
22885
23751
  }
22886
23752
  /**
22887
23753
  * Converts a JSON-LD structure to an object of this type.
@@ -23050,11 +23916,27 @@ export class Reject extends Activity {
23050
23916
  if (options.expand) {
23051
23917
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
23052
23918
  }
23053
- return await jsonld.compact(values, options.context ??
23919
+ const docContext = options.context ??
23054
23920
  [
23055
23921
  "https://www.w3.org/ns/activitystreams",
23056
23922
  "https://w3id.org/security/data-integrity/v1",
23057
- ], { documentLoader: options.contextLoader });
23923
+ ];
23924
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
23925
+ if (docContext != null) {
23926
+ // Embed context
23927
+ if ("proof" in compacted &&
23928
+ compacted.proof != null) {
23929
+ if (Array.isArray(compacted.proof)) {
23930
+ for (const element of compacted.proof) {
23931
+ element["@context"] = docContext;
23932
+ }
23933
+ }
23934
+ else {
23935
+ compacted.proof["@context"] = docContext;
23936
+ }
23937
+ }
23938
+ }
23939
+ return compacted;
23058
23940
  }
23059
23941
  /**
23060
23942
  * Converts a JSON-LD structure to an object of this type.
@@ -23550,11 +24432,27 @@ export class Relationship extends Object {
23550
24432
  if (options.expand) {
23551
24433
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
23552
24434
  }
23553
- return await jsonld.compact(values, options.context ??
24435
+ const docContext = options.context ??
23554
24436
  [
23555
24437
  "https://www.w3.org/ns/activitystreams",
23556
24438
  "https://w3id.org/security/data-integrity/v1",
23557
- ], { documentLoader: options.contextLoader });
24439
+ ];
24440
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
24441
+ if (docContext != null) {
24442
+ // Embed context
24443
+ if ("proof" in compacted &&
24444
+ compacted.proof != null) {
24445
+ if (Array.isArray(compacted.proof)) {
24446
+ for (const element of compacted.proof) {
24447
+ element["@context"] = docContext;
24448
+ }
24449
+ }
24450
+ else {
24451
+ compacted.proof["@context"] = docContext;
24452
+ }
24453
+ }
24454
+ }
24455
+ return compacted;
23558
24456
  }
23559
24457
  /**
23560
24458
  * Converts a JSON-LD structure to an object of this type.
@@ -23758,11 +24656,27 @@ export class Remove extends Activity {
23758
24656
  if (options.expand) {
23759
24657
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
23760
24658
  }
23761
- return await jsonld.compact(values, options.context ??
24659
+ const docContext = options.context ??
23762
24660
  [
23763
24661
  "https://www.w3.org/ns/activitystreams",
23764
24662
  "https://w3id.org/security/data-integrity/v1",
23765
- ], { documentLoader: options.contextLoader });
24663
+ ];
24664
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
24665
+ if (docContext != null) {
24666
+ // Embed context
24667
+ if ("proof" in compacted &&
24668
+ compacted.proof != null) {
24669
+ if (Array.isArray(compacted.proof)) {
24670
+ for (const element of compacted.proof) {
24671
+ element["@context"] = docContext;
24672
+ }
24673
+ }
24674
+ else {
24675
+ compacted.proof["@context"] = docContext;
24676
+ }
24677
+ }
24678
+ }
24679
+ return compacted;
23766
24680
  }
23767
24681
  /**
23768
24682
  * Converts a JSON-LD structure to an object of this type.
@@ -25231,7 +26145,7 @@ export class Service extends Object {
25231
26145
  if (options.expand) {
25232
26146
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
25233
26147
  }
25234
- return await jsonld.compact(values, options.context ??
26148
+ const docContext = options.context ??
25235
26149
  [
25236
26150
  "https://www.w3.org/ns/activitystreams",
25237
26151
  "https://w3id.org/security/v1",
@@ -25251,7 +26165,23 @@ export class Service extends Object {
25251
26165
  "PropertyValue": "schema:PropertyValue",
25252
26166
  "value": "schema:value",
25253
26167
  },
25254
- ], { documentLoader: options.contextLoader });
26168
+ ];
26169
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
26170
+ if (docContext != null) {
26171
+ // Embed context
26172
+ if ("proof" in compacted &&
26173
+ compacted.proof != null) {
26174
+ if (Array.isArray(compacted.proof)) {
26175
+ for (const element of compacted.proof) {
26176
+ element["@context"] = docContext;
26177
+ }
26178
+ }
26179
+ else {
26180
+ compacted.proof["@context"] = docContext;
26181
+ }
26182
+ }
26183
+ }
26184
+ return compacted;
25255
26185
  }
25256
26186
  /**
25257
26187
  * Converts a JSON-LD structure to an object of this type.
@@ -25885,11 +26815,27 @@ export class Tombstone extends Object {
25885
26815
  if (options.expand) {
25886
26816
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
25887
26817
  }
25888
- return await jsonld.compact(values, options.context ??
26818
+ const docContext = options.context ??
25889
26819
  [
25890
26820
  "https://www.w3.org/ns/activitystreams",
25891
26821
  "https://w3id.org/security/data-integrity/v1",
25892
- ], { documentLoader: options.contextLoader });
26822
+ ];
26823
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
26824
+ if (docContext != null) {
26825
+ // Embed context
26826
+ if ("proof" in compacted &&
26827
+ compacted.proof != null) {
26828
+ if (Array.isArray(compacted.proof)) {
26829
+ for (const element of compacted.proof) {
26830
+ element["@context"] = docContext;
26831
+ }
26832
+ }
26833
+ else {
26834
+ compacted.proof["@context"] = docContext;
26835
+ }
26836
+ }
26837
+ }
26838
+ return compacted;
25893
26839
  }
25894
26840
  /**
25895
26841
  * Converts a JSON-LD structure to an object of this type.
@@ -26025,11 +26971,27 @@ export class Undo extends Activity {
26025
26971
  if (options.expand) {
26026
26972
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
26027
26973
  }
26028
- return await jsonld.compact(values, options.context ??
26974
+ const docContext = options.context ??
26029
26975
  [
26030
26976
  "https://www.w3.org/ns/activitystreams",
26031
26977
  "https://w3id.org/security/data-integrity/v1",
26032
- ], { documentLoader: options.contextLoader });
26978
+ ];
26979
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
26980
+ if (docContext != null) {
26981
+ // Embed context
26982
+ if ("proof" in compacted &&
26983
+ compacted.proof != null) {
26984
+ if (Array.isArray(compacted.proof)) {
26985
+ for (const element of compacted.proof) {
26986
+ element["@context"] = docContext;
26987
+ }
26988
+ }
26989
+ else {
26990
+ compacted.proof["@context"] = docContext;
26991
+ }
26992
+ }
26993
+ }
26994
+ return compacted;
26033
26995
  }
26034
26996
  /**
26035
26997
  * Converts a JSON-LD structure to an object of this type.
@@ -26139,7 +27101,7 @@ export class Update extends Activity {
26139
27101
  if (options.expand) {
26140
27102
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
26141
27103
  }
26142
- return await jsonld.compact(values, options.context ??
27104
+ const docContext = options.context ??
26143
27105
  [
26144
27106
  "https://www.w3.org/ns/activitystreams",
26145
27107
  "https://w3id.org/security/data-integrity/v1",
@@ -26149,7 +27111,23 @@ export class Update extends Activity {
26149
27111
  "Emoji": "toot:Emoji",
26150
27112
  "Hashtag": "as:Hashtag",
26151
27113
  },
26152
- ], { documentLoader: options.contextLoader });
27114
+ ];
27115
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
27116
+ if (docContext != null) {
27117
+ // Embed context
27118
+ if ("proof" in compacted &&
27119
+ compacted.proof != null) {
27120
+ if (Array.isArray(compacted.proof)) {
27121
+ for (const element of compacted.proof) {
27122
+ element["@context"] = docContext;
27123
+ }
27124
+ }
27125
+ else {
27126
+ compacted.proof["@context"] = docContext;
27127
+ }
27128
+ }
27129
+ }
27130
+ return compacted;
26153
27131
  }
26154
27132
  /**
26155
27133
  * Converts a JSON-LD structure to an object of this type.
@@ -26255,11 +27233,27 @@ export class Video extends Document {
26255
27233
  if (options.expand) {
26256
27234
  return await jsonld.expand(values, { documentLoader: options.contextLoader });
26257
27235
  }
26258
- return await jsonld.compact(values, options.context ??
27236
+ const docContext = options.context ??
26259
27237
  [
26260
27238
  "https://www.w3.org/ns/activitystreams",
26261
27239
  "https://w3id.org/security/data-integrity/v1",
26262
- ], { documentLoader: options.contextLoader });
27240
+ ];
27241
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
27242
+ if (docContext != null) {
27243
+ // Embed context
27244
+ if ("proof" in compacted &&
27245
+ compacted.proof != null) {
27246
+ if (Array.isArray(compacted.proof)) {
27247
+ for (const element of compacted.proof) {
27248
+ element["@context"] = docContext;
27249
+ }
27250
+ }
27251
+ else {
27252
+ compacted.proof["@context"] = docContext;
27253
+ }
27254
+ }
27255
+ }
27256
+ return compacted;
26263
27257
  }
26264
27258
  /**
26265
27259
  * Converts a JSON-LD structure to an object of this type.