@fedify/fedify 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2805,15 +2805,7 @@ export class Object {
2805
2805
  ...options,
2806
2806
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
2807
2807
  };
2808
- if (options.format == null &&
2809
- (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content == null ||
2810
- this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) &&
2811
- (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name == null ||
2812
- this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) &&
2813
- (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary == null ||
2814
- this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length < 1) &&
2815
- (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof == null ||
2816
- this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < 1)) {
2808
+ if (options.format == null && this.isCompactable()) {
2817
2809
  const result = {};
2818
2810
  // deno-lint-ignore no-unused-vars
2819
2811
  let compactItems;
@@ -3663,6 +3655,21 @@ export class Object {
3663
3655
  }
3664
3656
  return compacted;
3665
3657
  }
3658
+ isCompactable() {
3659
+ if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content != null &&
3660
+ this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 0)
3661
+ return false;
3662
+ if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null &&
3663
+ this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0)
3664
+ return false;
3665
+ if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary != null &&
3666
+ this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0)
3667
+ return false;
3668
+ if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof != null &&
3669
+ this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0)
3670
+ return false;
3671
+ return true;
3672
+ }
3666
3673
  /**
3667
3674
  * Converts a JSON-LD structure to an object of this type.
3668
3675
  * @param json The JSON-LD structure to convert.
@@ -5428,7 +5435,7 @@ export class Emoji extends Object {
5428
5435
  ...options,
5429
5436
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
5430
5437
  };
5431
- if (options.format == null) {
5438
+ if (options.format == null && this.isCompactable()) {
5432
5439
  const result = await super.toJsonLd({
5433
5440
  ...options,
5434
5441
  format: undefined,
@@ -5481,6 +5488,9 @@ export class Emoji extends Object {
5481
5488
  }
5482
5489
  return compacted;
5483
5490
  }
5491
+ isCompactable() {
5492
+ return super.isCompactable();
5493
+ }
5484
5494
  /**
5485
5495
  * Converts a JSON-LD structure to an object of this type.
5486
5496
  * @param json The JSON-LD structure to convert.
@@ -5642,7 +5652,7 @@ export class ChatMessage extends Object {
5642
5652
  ...options,
5643
5653
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
5644
5654
  };
5645
- if (options.format == null) {
5655
+ if (options.format == null && this.isCompactable()) {
5646
5656
  const result = await super.toJsonLd({
5647
5657
  ...options,
5648
5658
  format: undefined,
@@ -5742,6 +5752,9 @@ export class ChatMessage extends Object {
5742
5752
  }
5743
5753
  return compacted;
5744
5754
  }
5755
+ isCompactable() {
5756
+ return super.isCompactable();
5757
+ }
5745
5758
  /**
5746
5759
  * Converts a JSON-LD structure to an object of this type.
5747
5760
  * @param json The JSON-LD structure to convert.
@@ -5975,11 +5988,7 @@ export class PropertyValue {
5975
5988
  ...options,
5976
5989
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
5977
5990
  };
5978
- if (options.format == null &&
5979
- (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name == null ||
5980
- this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) &&
5981
- (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value == null ||
5982
- this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1)) {
5991
+ if (options.format == null && this.isCompactable()) {
5983
5992
  const result = {};
5984
5993
  // deno-lint-ignore no-unused-vars
5985
5994
  let compactItems;
@@ -6064,6 +6073,15 @@ export class PropertyValue {
6064
6073
  }
6065
6074
  return compacted;
6066
6075
  }
6076
+ isCompactable() {
6077
+ if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null &&
6078
+ this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0)
6079
+ return false;
6080
+ if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null &&
6081
+ this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0)
6082
+ return false;
6083
+ return true;
6084
+ }
6067
6085
  /**
6068
6086
  * Converts a JSON-LD structure to an object of this type.
6069
6087
  * @param json The JSON-LD structure to convert.
@@ -6571,6 +6589,9 @@ export class DataIntegrityProof {
6571
6589
  }
6572
6590
  return compacted;
6573
6591
  }
6592
+ isCompactable() {
6593
+ return true;
6594
+ }
6574
6595
  /**
6575
6596
  * Converts a JSON-LD structure to an object of this type.
6576
6597
  * @param json The JSON-LD structure to convert.
@@ -6995,7 +7016,7 @@ export class CryptographicKey {
6995
7016
  ...options,
6996
7017
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
6997
7018
  };
6998
- if (options.format == null) {
7019
+ if (options.format == null && this.isCompactable()) {
6999
7020
  const result = {};
7000
7021
  // deno-lint-ignore no-unused-vars
7001
7022
  let compactItems;
@@ -7100,6 +7121,9 @@ export class CryptographicKey {
7100
7121
  }
7101
7122
  return compacted;
7102
7123
  }
7124
+ isCompactable() {
7125
+ return true;
7126
+ }
7103
7127
  /**
7104
7128
  * Converts a JSON-LD structure to an object of this type.
7105
7129
  * @param json The JSON-LD structure to convert.
@@ -7480,7 +7504,7 @@ export class Multikey {
7480
7504
  ...options,
7481
7505
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
7482
7506
  };
7483
- if (options.format == null) {
7507
+ if (options.format == null && this.isCompactable()) {
7484
7508
  const result = {};
7485
7509
  // deno-lint-ignore no-unused-vars
7486
7510
  let compactItems;
@@ -7588,6 +7612,9 @@ export class Multikey {
7588
7612
  }
7589
7613
  return compacted;
7590
7614
  }
7615
+ isCompactable() {
7616
+ return true;
7617
+ }
7591
7618
  /**
7592
7619
  * Converts a JSON-LD structure to an object of this type.
7593
7620
  * @param json The JSON-LD structure to convert.
@@ -8674,135 +8701,6 @@ export class Activity extends Object {
8674
8701
  ...options,
8675
8702
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
8676
8703
  };
8677
- if (options.format == null) {
8678
- const result = await super.toJsonLd({
8679
- ...options,
8680
- format: undefined,
8681
- context: undefined,
8682
- });
8683
- // deno-lint-ignore no-unused-vars
8684
- let compactItems;
8685
- compactItems = [];
8686
- for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) {
8687
- const item = v instanceof URL
8688
- ? v.href
8689
- : v instanceof Application
8690
- ? await v.toJsonLd({
8691
- ...options,
8692
- format: undefined,
8693
- context: undefined,
8694
- })
8695
- : v instanceof Group
8696
- ? await v.toJsonLd({
8697
- ...options,
8698
- format: undefined,
8699
- context: undefined,
8700
- })
8701
- : v instanceof Organization
8702
- ? await v.toJsonLd({
8703
- ...options,
8704
- format: undefined,
8705
- context: undefined,
8706
- })
8707
- : v instanceof Person
8708
- ? await v.toJsonLd({
8709
- ...options,
8710
- format: undefined,
8711
- context: undefined,
8712
- })
8713
- : await v.toJsonLd({
8714
- ...options,
8715
- format: undefined,
8716
- context: undefined,
8717
- });
8718
- compactItems.push(item);
8719
- }
8720
- if (compactItems.length > 0) {
8721
- result["actor"] = compactItems.length > 1
8722
- ? compactItems
8723
- : compactItems[0];
8724
- }
8725
- compactItems = [];
8726
- for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) {
8727
- const item = v instanceof URL ? v.href : await v.toJsonLd({
8728
- ...options,
8729
- format: undefined,
8730
- context: undefined,
8731
- });
8732
- compactItems.push(item);
8733
- }
8734
- if (compactItems.length > 0) {
8735
- result["object"] = compactItems.length > 1
8736
- ? compactItems
8737
- : compactItems[0];
8738
- }
8739
- compactItems = [];
8740
- for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) {
8741
- const item = v instanceof URL ? v.href : await v.toJsonLd({
8742
- ...options,
8743
- format: undefined,
8744
- context: undefined,
8745
- });
8746
- compactItems.push(item);
8747
- }
8748
- if (compactItems.length > 0) {
8749
- result["target"] = compactItems.length > 1
8750
- ? compactItems
8751
- : compactItems[0];
8752
- }
8753
- compactItems = [];
8754
- for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) {
8755
- const item = v instanceof URL ? v.href : await v.toJsonLd({
8756
- ...options,
8757
- format: undefined,
8758
- context: undefined,
8759
- });
8760
- compactItems.push(item);
8761
- }
8762
- if (compactItems.length > 0) {
8763
- result["result"] = compactItems.length > 1
8764
- ? compactItems
8765
- : compactItems[0];
8766
- }
8767
- compactItems = [];
8768
- for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) {
8769
- const item = v instanceof URL ? v.href : await v.toJsonLd({
8770
- ...options,
8771
- format: undefined,
8772
- context: undefined,
8773
- });
8774
- compactItems.push(item);
8775
- }
8776
- if (compactItems.length > 0) {
8777
- result["origin"] = compactItems.length > 1
8778
- ? compactItems
8779
- : compactItems[0];
8780
- }
8781
- compactItems = [];
8782
- for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) {
8783
- const item = v instanceof URL ? v.href : await v.toJsonLd({
8784
- ...options,
8785
- format: undefined,
8786
- context: undefined,
8787
- });
8788
- compactItems.push(item);
8789
- }
8790
- if (compactItems.length > 0) {
8791
- result["instrument"] = compactItems.length > 1
8792
- ? compactItems
8793
- : compactItems[0];
8794
- }
8795
- result["type"] = "Activity";
8796
- if (this.id != null)
8797
- result["id"] = this.id.href;
8798
- result["@context"] = [
8799
- "https://www.w3.org/ns/activitystreams",
8800
- "https://w3id.org/security/v1",
8801
- "https://w3id.org/security/data-integrity/v1",
8802
- "https://w3id.org/identity/v1",
8803
- ];
8804
- return result;
8805
- }
8806
8704
  // deno-lint-ignore no-unused-vars prefer-const
8807
8705
  let array;
8808
8706
  const baseValues = await super.toJsonLd({
@@ -8893,10 +8791,10 @@ export class Activity extends Object {
8893
8791
  }
8894
8792
  const docContext = options.context ??
8895
8793
  [
8794
+ "https://w3id.org/identity/v1",
8896
8795
  "https://www.w3.org/ns/activitystreams",
8897
8796
  "https://w3id.org/security/v1",
8898
8797
  "https://w3id.org/security/data-integrity/v1",
8899
- "https://w3id.org/identity/v1",
8900
8798
  ];
8901
8799
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
8902
8800
  if (docContext != null) {
@@ -8915,6 +8813,9 @@ export class Activity extends Object {
8915
8813
  }
8916
8814
  return compacted;
8917
8815
  }
8816
+ isCompactable() {
8817
+ return super.isCompactable();
8818
+ }
8918
8819
  /**
8919
8820
  * Converts a JSON-LD structure to an object of this type.
8920
8821
  * @param json The JSON-LD structure to convert.
@@ -9361,24 +9262,6 @@ export class Accept extends Activity {
9361
9262
  ...options,
9362
9263
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
9363
9264
  };
9364
- if (options.format == null) {
9365
- const result = await super.toJsonLd({
9366
- ...options,
9367
- format: undefined,
9368
- context: undefined,
9369
- });
9370
- // deno-lint-ignore no-unused-vars
9371
- let compactItems;
9372
- result["type"] = "Accept";
9373
- if (this.id != null)
9374
- result["id"] = this.id.href;
9375
- result["@context"] = [
9376
- "https://www.w3.org/ns/activitystreams",
9377
- "https://w3id.org/security/data-integrity/v1",
9378
- "https://w3id.org/identity/v1",
9379
- ];
9380
- return result;
9381
- }
9382
9265
  // deno-lint-ignore no-unused-vars prefer-const
9383
9266
  let array;
9384
9267
  const baseValues = await super.toJsonLd({
@@ -9395,9 +9278,9 @@ export class Accept extends Activity {
9395
9278
  }
9396
9279
  const docContext = options.context ??
9397
9280
  [
9281
+ "https://w3id.org/identity/v1",
9398
9282
  "https://www.w3.org/ns/activitystreams",
9399
9283
  "https://w3id.org/security/data-integrity/v1",
9400
- "https://w3id.org/identity/v1",
9401
9284
  ];
9402
9285
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
9403
9286
  if (docContext != null) {
@@ -9416,6 +9299,9 @@ export class Accept extends Activity {
9416
9299
  }
9417
9300
  return compacted;
9418
9301
  }
9302
+ isCompactable() {
9303
+ return super.isCompactable();
9304
+ }
9419
9305
  /**
9420
9306
  * Converts a JSON-LD structure to an object of this type.
9421
9307
  * @param json The JSON-LD structure to convert.
@@ -9540,24 +9426,6 @@ export class Add extends Activity {
9540
9426
  ...options,
9541
9427
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
9542
9428
  };
9543
- if (options.format == null) {
9544
- const result = await super.toJsonLd({
9545
- ...options,
9546
- format: undefined,
9547
- context: undefined,
9548
- });
9549
- // deno-lint-ignore no-unused-vars
9550
- let compactItems;
9551
- result["type"] = "Add";
9552
- if (this.id != null)
9553
- result["id"] = this.id.href;
9554
- result["@context"] = [
9555
- "https://www.w3.org/ns/activitystreams",
9556
- "https://w3id.org/security/data-integrity/v1",
9557
- "https://w3id.org/identity/v1",
9558
- ];
9559
- return result;
9560
- }
9561
9429
  // deno-lint-ignore no-unused-vars prefer-const
9562
9430
  let array;
9563
9431
  const baseValues = await super.toJsonLd({
@@ -9574,9 +9442,9 @@ export class Add extends Activity {
9574
9442
  }
9575
9443
  const docContext = options.context ??
9576
9444
  [
9445
+ "https://w3id.org/identity/v1",
9577
9446
  "https://www.w3.org/ns/activitystreams",
9578
9447
  "https://w3id.org/security/data-integrity/v1",
9579
- "https://w3id.org/identity/v1",
9580
9448
  ];
9581
9449
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
9582
9450
  if (docContext != null) {
@@ -9595,6 +9463,9 @@ export class Add extends Activity {
9595
9463
  }
9596
9464
  return compacted;
9597
9465
  }
9466
+ isCompactable() {
9467
+ return super.isCompactable();
9468
+ }
9598
9469
  /**
9599
9470
  * Converts a JSON-LD structure to an object of this type.
9600
9471
  * @param json The JSON-LD structure to convert.
@@ -9715,36 +9586,6 @@ export class Announce extends Activity {
9715
9586
  ...options,
9716
9587
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
9717
9588
  };
9718
- if (options.format == null) {
9719
- const result = await super.toJsonLd({
9720
- ...options,
9721
- format: undefined,
9722
- context: undefined,
9723
- });
9724
- // deno-lint-ignore no-unused-vars
9725
- let compactItems;
9726
- result["type"] = "Announce";
9727
- if (this.id != null)
9728
- result["id"] = this.id.href;
9729
- result["@context"] = [
9730
- "https://www.w3.org/ns/activitystreams",
9731
- "https://w3id.org/security/data-integrity/v1",
9732
- "https://w3id.org/identity/v1",
9733
- {
9734
- "toot": "http://joinmastodon.org/ns#",
9735
- "misskey": "https://misskey-hub.net/ns#",
9736
- "fedibird": "http://fedibird.com/ns#",
9737
- "sensitive": "as:sensitive",
9738
- "votersCount": "toot:votersCount",
9739
- "Emoji": "toot:Emoji",
9740
- "Hashtag": "as:Hashtag",
9741
- "quoteUrl": "as:quoteUrl",
9742
- "_misskey_quote": "misskey:_misskey_quote",
9743
- "quoteUri": "fedibird:quoteUri",
9744
- },
9745
- ];
9746
- return result;
9747
- }
9748
9589
  // deno-lint-ignore no-unused-vars prefer-const
9749
9590
  let array;
9750
9591
  const baseValues = await super.toJsonLd({
@@ -9761,9 +9602,9 @@ export class Announce extends Activity {
9761
9602
  }
9762
9603
  const docContext = options.context ??
9763
9604
  [
9605
+ "https://w3id.org/identity/v1",
9764
9606
  "https://www.w3.org/ns/activitystreams",
9765
9607
  "https://w3id.org/security/data-integrity/v1",
9766
- "https://w3id.org/identity/v1",
9767
9608
  {
9768
9609
  "toot": "http://joinmastodon.org/ns#",
9769
9610
  "misskey": "https://misskey-hub.net/ns#",
@@ -9794,6 +9635,9 @@ export class Announce extends Activity {
9794
9635
  }
9795
9636
  return compacted;
9796
9637
  }
9638
+ isCompactable() {
9639
+ return super.isCompactable();
9640
+ }
9797
9641
  /**
9798
9642
  * Converts a JSON-LD structure to an object of this type.
9799
9643
  * @param json The JSON-LD structure to convert.
@@ -11376,9 +11220,7 @@ export class Application extends Object {
11376
11220
  ...options,
11377
11221
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
11378
11222
  };
11379
- if (options.format == null &&
11380
- (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername == null ||
11381
- this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1)) {
11223
+ if (options.format == null && this.isCompactable()) {
11382
11224
  const result = await super.toJsonLd({
11383
11225
  ...options,
11384
11226
  format: undefined,
@@ -11939,6 +11781,12 @@ export class Application extends Object {
11939
11781
  }
11940
11782
  return compacted;
11941
11783
  }
11784
+ isCompactable() {
11785
+ if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null &&
11786
+ this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0)
11787
+ return false;
11788
+ return super.isCompactable();
11789
+ }
11942
11790
  /**
11943
11791
  * Converts a JSON-LD structure to an object of this type.
11944
11792
  * @param json The JSON-LD structure to convert.
@@ -12669,24 +12517,6 @@ export class IntransitiveActivity extends Activity {
12669
12517
  ...options,
12670
12518
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
12671
12519
  };
12672
- if (options.format == null) {
12673
- const result = await super.toJsonLd({
12674
- ...options,
12675
- format: undefined,
12676
- context: undefined,
12677
- });
12678
- // deno-lint-ignore no-unused-vars
12679
- let compactItems;
12680
- result["type"] = "IntransitiveActivity";
12681
- if (this.id != null)
12682
- result["id"] = this.id.href;
12683
- result["@context"] = [
12684
- "https://www.w3.org/ns/activitystreams",
12685
- "https://w3id.org/security/data-integrity/v1",
12686
- "https://w3id.org/identity/v1",
12687
- ];
12688
- return result;
12689
- }
12690
12520
  // deno-lint-ignore no-unused-vars prefer-const
12691
12521
  let array;
12692
12522
  const baseValues = await super.toJsonLd({
@@ -12705,9 +12535,9 @@ export class IntransitiveActivity extends Activity {
12705
12535
  }
12706
12536
  const docContext = options.context ??
12707
12537
  [
12538
+ "https://w3id.org/identity/v1",
12708
12539
  "https://www.w3.org/ns/activitystreams",
12709
12540
  "https://w3id.org/security/data-integrity/v1",
12710
- "https://w3id.org/identity/v1",
12711
12541
  ];
12712
12542
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12713
12543
  if (docContext != null) {
@@ -12726,6 +12556,9 @@ export class IntransitiveActivity extends Activity {
12726
12556
  }
12727
12557
  return compacted;
12728
12558
  }
12559
+ isCompactable() {
12560
+ return super.isCompactable();
12561
+ }
12729
12562
  /**
12730
12563
  * Converts a JSON-LD structure to an object of this type.
12731
12564
  * @param json The JSON-LD structure to convert.
@@ -12871,9 +12704,9 @@ export class Arrive extends IntransitiveActivity {
12871
12704
  }
12872
12705
  const docContext = options.context ??
12873
12706
  [
12707
+ "https://w3id.org/identity/v1",
12874
12708
  "https://www.w3.org/ns/activitystreams",
12875
12709
  "https://w3id.org/security/data-integrity/v1",
12876
- "https://w3id.org/identity/v1",
12877
12710
  ];
12878
12711
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12879
12712
  if (docContext != null) {
@@ -12892,6 +12725,9 @@ export class Arrive extends IntransitiveActivity {
12892
12725
  }
12893
12726
  return compacted;
12894
12727
  }
12728
+ isCompactable() {
12729
+ return super.isCompactable();
12730
+ }
12895
12731
  /**
12896
12732
  * Converts a JSON-LD structure to an object of this type.
12897
12733
  * @param json The JSON-LD structure to convert.
@@ -13049,7 +12885,7 @@ export class Article extends Object {
13049
12885
  ...options,
13050
12886
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
13051
12887
  };
13052
- if (options.format == null) {
12888
+ if (options.format == null && this.isCompactable()) {
13053
12889
  const result = await super.toJsonLd({
13054
12890
  ...options,
13055
12891
  format: undefined,
@@ -13151,6 +12987,9 @@ export class Article extends Object {
13151
12987
  }
13152
12988
  return compacted;
13153
12989
  }
12990
+ isCompactable() {
12991
+ return super.isCompactable();
12992
+ }
13154
12993
  /**
13155
12994
  * Converts a JSON-LD structure to an object of this type.
13156
12995
  * @param json The JSON-LD structure to convert.
@@ -13371,7 +13210,7 @@ export class Document extends Object {
13371
13210
  ...options,
13372
13211
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
13373
13212
  };
13374
- if (options.format == null) {
13213
+ if (options.format == null && this.isCompactable()) {
13375
13214
  const result = await super.toJsonLd({
13376
13215
  ...options,
13377
13216
  format: undefined,
@@ -13468,6 +13307,9 @@ export class Document extends Object {
13468
13307
  }
13469
13308
  return compacted;
13470
13309
  }
13310
+ isCompactable() {
13311
+ return super.isCompactable();
13312
+ }
13471
13313
  /**
13472
13314
  * Converts a JSON-LD structure to an object of this type.
13473
13315
  * @param json The JSON-LD structure to convert.
@@ -13650,7 +13492,7 @@ export class Audio extends Document {
13650
13492
  ...options,
13651
13493
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
13652
13494
  };
13653
- if (options.format == null) {
13495
+ if (options.format == null && this.isCompactable()) {
13654
13496
  const result = await super.toJsonLd({
13655
13497
  ...options,
13656
13498
  format: undefined,
@@ -13703,6 +13545,9 @@ export class Audio extends Document {
13703
13545
  }
13704
13546
  return compacted;
13705
13547
  }
13548
+ isCompactable() {
13549
+ return super.isCompactable();
13550
+ }
13706
13551
  /**
13707
13552
  * Converts a JSON-LD structure to an object of this type.
13708
13553
  * @param json The JSON-LD structure to convert.
@@ -13822,24 +13667,6 @@ export class Ignore extends Activity {
13822
13667
  ...options,
13823
13668
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
13824
13669
  };
13825
- if (options.format == null) {
13826
- const result = await super.toJsonLd({
13827
- ...options,
13828
- format: undefined,
13829
- context: undefined,
13830
- });
13831
- // deno-lint-ignore no-unused-vars
13832
- let compactItems;
13833
- result["type"] = "Ignore";
13834
- if (this.id != null)
13835
- result["id"] = this.id.href;
13836
- result["@context"] = [
13837
- "https://www.w3.org/ns/activitystreams",
13838
- "https://w3id.org/security/data-integrity/v1",
13839
- "https://w3id.org/identity/v1",
13840
- ];
13841
- return result;
13842
- }
13843
13670
  // deno-lint-ignore no-unused-vars prefer-const
13844
13671
  let array;
13845
13672
  const baseValues = await super.toJsonLd({
@@ -13856,9 +13683,9 @@ export class Ignore extends Activity {
13856
13683
  }
13857
13684
  const docContext = options.context ??
13858
13685
  [
13686
+ "https://w3id.org/identity/v1",
13859
13687
  "https://www.w3.org/ns/activitystreams",
13860
13688
  "https://w3id.org/security/data-integrity/v1",
13861
- "https://w3id.org/identity/v1",
13862
13689
  ];
13863
13690
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13864
13691
  if (docContext != null) {
@@ -13877,6 +13704,9 @@ export class Ignore extends Activity {
13877
13704
  }
13878
13705
  return compacted;
13879
13706
  }
13707
+ isCompactable() {
13708
+ return super.isCompactable();
13709
+ }
13880
13710
  /**
13881
13711
  * Converts a JSON-LD structure to an object of this type.
13882
13712
  * @param json The JSON-LD structure to convert.
@@ -14001,24 +13831,6 @@ export class Block extends Ignore {
14001
13831
  ...options,
14002
13832
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
14003
13833
  };
14004
- if (options.format == null) {
14005
- const result = await super.toJsonLd({
14006
- ...options,
14007
- format: undefined,
14008
- context: undefined,
14009
- });
14010
- // deno-lint-ignore no-unused-vars
14011
- let compactItems;
14012
- result["type"] = "Block";
14013
- if (this.id != null)
14014
- result["id"] = this.id.href;
14015
- result["@context"] = [
14016
- "https://www.w3.org/ns/activitystreams",
14017
- "https://w3id.org/security/data-integrity/v1",
14018
- "https://w3id.org/identity/v1",
14019
- ];
14020
- return result;
14021
- }
14022
13834
  // deno-lint-ignore no-unused-vars prefer-const
14023
13835
  let array;
14024
13836
  const baseValues = await super.toJsonLd({
@@ -14035,9 +13847,9 @@ export class Block extends Ignore {
14035
13847
  }
14036
13848
  const docContext = options.context ??
14037
13849
  [
13850
+ "https://w3id.org/identity/v1",
14038
13851
  "https://www.w3.org/ns/activitystreams",
14039
13852
  "https://w3id.org/security/data-integrity/v1",
14040
- "https://w3id.org/identity/v1",
14041
13853
  ];
14042
13854
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
14043
13855
  if (docContext != null) {
@@ -14056,6 +13868,9 @@ export class Block extends Ignore {
14056
13868
  }
14057
13869
  return compacted;
14058
13870
  }
13871
+ isCompactable() {
13872
+ return super.isCompactable();
13873
+ }
14059
13874
  /**
14060
13875
  * Converts a JSON-LD structure to an object of this type.
14061
13876
  * @param json The JSON-LD structure to convert.
@@ -14539,7 +14354,7 @@ export class Collection extends Object {
14539
14354
  ...options,
14540
14355
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
14541
14356
  };
14542
- if (options.format == null) {
14357
+ if (options.format == null && this.isCompactable()) {
14543
14358
  const result = await super.toJsonLd({
14544
14359
  ...options,
14545
14360
  format: undefined,
@@ -14736,6 +14551,9 @@ export class Collection extends Object {
14736
14551
  }
14737
14552
  return compacted;
14738
14553
  }
14554
+ isCompactable() {
14555
+ return super.isCompactable();
14556
+ }
14739
14557
  /**
14740
14558
  * Converts a JSON-LD structure to an object of this type.
14741
14559
  * @param json The JSON-LD structure to convert.
@@ -15322,7 +15140,7 @@ export class CollectionPage extends Collection {
15322
15140
  ...options,
15323
15141
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
15324
15142
  };
15325
- if (options.format == null) {
15143
+ if (options.format == null && this.isCompactable()) {
15326
15144
  const result = await super.toJsonLd({
15327
15145
  ...options,
15328
15146
  format: undefined,
@@ -15462,6 +15280,9 @@ export class CollectionPage extends Collection {
15462
15280
  }
15463
15281
  return compacted;
15464
15282
  }
15283
+ isCompactable() {
15284
+ return super.isCompactable();
15285
+ }
15465
15286
  /**
15466
15287
  * Converts a JSON-LD structure to an object of this type.
15467
15288
  * @param json The JSON-LD structure to convert.
@@ -15677,37 +15498,6 @@ export class Create extends Activity {
15677
15498
  ...options,
15678
15499
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
15679
15500
  };
15680
- if (options.format == null) {
15681
- const result = await super.toJsonLd({
15682
- ...options,
15683
- format: undefined,
15684
- context: undefined,
15685
- });
15686
- // deno-lint-ignore no-unused-vars
15687
- let compactItems;
15688
- result["type"] = "Create";
15689
- if (this.id != null)
15690
- result["id"] = this.id.href;
15691
- result["@context"] = [
15692
- "https://www.w3.org/ns/activitystreams",
15693
- "https://w3id.org/security/data-integrity/v1",
15694
- "https://w3id.org/identity/v1",
15695
- {
15696
- "toot": "http://joinmastodon.org/ns#",
15697
- "misskey": "https://misskey-hub.net/ns#",
15698
- "fedibird": "http://fedibird.com/ns#",
15699
- "sensitive": "as:sensitive",
15700
- "votersCount": "toot:votersCount",
15701
- "Emoji": "toot:Emoji",
15702
- "Hashtag": "as:Hashtag",
15703
- "ChatMessage": "http://litepub.social/ns#ChatMessage",
15704
- "quoteUrl": "as:quoteUrl",
15705
- "_misskey_quote": "misskey:_misskey_quote",
15706
- "quoteUri": "fedibird:quoteUri",
15707
- },
15708
- ];
15709
- return result;
15710
- }
15711
15501
  // deno-lint-ignore no-unused-vars prefer-const
15712
15502
  let array;
15713
15503
  const baseValues = await super.toJsonLd({
@@ -15724,9 +15514,9 @@ export class Create extends Activity {
15724
15514
  }
15725
15515
  const docContext = options.context ??
15726
15516
  [
15517
+ "https://w3id.org/identity/v1",
15727
15518
  "https://www.w3.org/ns/activitystreams",
15728
15519
  "https://w3id.org/security/data-integrity/v1",
15729
- "https://w3id.org/identity/v1",
15730
15520
  {
15731
15521
  "toot": "http://joinmastodon.org/ns#",
15732
15522
  "misskey": "https://misskey-hub.net/ns#",
@@ -15758,6 +15548,9 @@ export class Create extends Activity {
15758
15548
  }
15759
15549
  return compacted;
15760
15550
  }
15551
+ isCompactable() {
15552
+ return super.isCompactable();
15553
+ }
15761
15554
  /**
15762
15555
  * Converts a JSON-LD structure to an object of this type.
15763
15556
  * @param json The JSON-LD structure to convert.
@@ -15877,37 +15670,6 @@ export class Delete extends Activity {
15877
15670
  ...options,
15878
15671
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
15879
15672
  };
15880
- if (options.format == null) {
15881
- const result = await super.toJsonLd({
15882
- ...options,
15883
- format: undefined,
15884
- context: undefined,
15885
- });
15886
- // deno-lint-ignore no-unused-vars
15887
- let compactItems;
15888
- result["type"] = "Delete";
15889
- if (this.id != null)
15890
- result["id"] = this.id.href;
15891
- result["@context"] = [
15892
- "https://www.w3.org/ns/activitystreams",
15893
- "https://w3id.org/security/data-integrity/v1",
15894
- "https://w3id.org/identity/v1",
15895
- {
15896
- "toot": "http://joinmastodon.org/ns#",
15897
- "misskey": "https://misskey-hub.net/ns#",
15898
- "fedibird": "http://fedibird.com/ns#",
15899
- "sensitive": "as:sensitive",
15900
- "votersCount": "toot:votersCount",
15901
- "Emoji": "toot:Emoji",
15902
- "Hashtag": "as:Hashtag",
15903
- "ChatMessage": "http://litepub.social/ns#ChatMessage",
15904
- "quoteUrl": "as:quoteUrl",
15905
- "_misskey_quote": "misskey:_misskey_quote",
15906
- "quoteUri": "fedibird:quoteUri",
15907
- },
15908
- ];
15909
- return result;
15910
- }
15911
15673
  // deno-lint-ignore no-unused-vars prefer-const
15912
15674
  let array;
15913
15675
  const baseValues = await super.toJsonLd({
@@ -15924,9 +15686,9 @@ export class Delete extends Activity {
15924
15686
  }
15925
15687
  const docContext = options.context ??
15926
15688
  [
15689
+ "https://w3id.org/identity/v1",
15927
15690
  "https://www.w3.org/ns/activitystreams",
15928
15691
  "https://w3id.org/security/data-integrity/v1",
15929
- "https://w3id.org/identity/v1",
15930
15692
  {
15931
15693
  "toot": "http://joinmastodon.org/ns#",
15932
15694
  "misskey": "https://misskey-hub.net/ns#",
@@ -15958,6 +15720,9 @@ export class Delete extends Activity {
15958
15720
  }
15959
15721
  return compacted;
15960
15722
  }
15723
+ isCompactable() {
15724
+ return super.isCompactable();
15725
+ }
15961
15726
  /**
15962
15727
  * Converts a JSON-LD structure to an object of this type.
15963
15728
  * @param json The JSON-LD structure to convert.
@@ -16076,24 +15841,6 @@ export class Dislike extends Activity {
16076
15841
  ...options,
16077
15842
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
16078
15843
  };
16079
- if (options.format == null) {
16080
- const result = await super.toJsonLd({
16081
- ...options,
16082
- format: undefined,
16083
- context: undefined,
16084
- });
16085
- // deno-lint-ignore no-unused-vars
16086
- let compactItems;
16087
- result["type"] = "Dislike";
16088
- if (this.id != null)
16089
- result["id"] = this.id.href;
16090
- result["@context"] = [
16091
- "https://www.w3.org/ns/activitystreams",
16092
- "https://w3id.org/security/data-integrity/v1",
16093
- "https://w3id.org/identity/v1",
16094
- ];
16095
- return result;
16096
- }
16097
15844
  // deno-lint-ignore no-unused-vars prefer-const
16098
15845
  let array;
16099
15846
  const baseValues = await super.toJsonLd({
@@ -16110,9 +15857,9 @@ export class Dislike extends Activity {
16110
15857
  }
16111
15858
  const docContext = options.context ??
16112
15859
  [
15860
+ "https://w3id.org/identity/v1",
16113
15861
  "https://www.w3.org/ns/activitystreams",
16114
15862
  "https://w3id.org/security/data-integrity/v1",
16115
- "https://w3id.org/identity/v1",
16116
15863
  ];
16117
15864
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
16118
15865
  if (docContext != null) {
@@ -16131,6 +15878,9 @@ export class Dislike extends Activity {
16131
15878
  }
16132
15879
  return compacted;
16133
15880
  }
15881
+ isCompactable() {
15882
+ return super.isCompactable();
15883
+ }
16134
15884
  /**
16135
15885
  * Converts a JSON-LD structure to an object of this type.
16136
15886
  * @param json The JSON-LD structure to convert.
@@ -16490,7 +16240,7 @@ export class Endpoints {
16490
16240
  ...options,
16491
16241
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
16492
16242
  };
16493
- if (options.format == null) {
16243
+ if (options.format == null && this.isCompactable()) {
16494
16244
  const result = {};
16495
16245
  // deno-lint-ignore no-unused-vars
16496
16246
  let compactItems;
@@ -16634,6 +16384,9 @@ export class Endpoints {
16634
16384
  }
16635
16385
  return compacted;
16636
16386
  }
16387
+ isCompactable() {
16388
+ return true;
16389
+ }
16637
16390
  /**
16638
16391
  * Converts a JSON-LD structure to an object of this type.
16639
16392
  * @param json The JSON-LD structure to convert.
@@ -16911,7 +16664,7 @@ export class Event extends Object {
16911
16664
  ...options,
16912
16665
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
16913
16666
  };
16914
- if (options.format == null) {
16667
+ if (options.format == null && this.isCompactable()) {
16915
16668
  const result = await super.toJsonLd({
16916
16669
  ...options,
16917
16670
  format: undefined,
@@ -16964,180 +16717,168 @@ export class Event extends Object {
16964
16717
  }
16965
16718
  return compacted;
16966
16719
  }
16967
- /**
16968
- * Converts a JSON-LD structure to an object of this type.
16969
- * @param json The JSON-LD structure to convert.
16970
- * @returns The object of this type.
16971
- * @throws {TypeError} If the given `json` is invalid.
16972
- */
16973
- static async fromJsonLd(json, options = {}) {
16974
- if (typeof json === "undefined") {
16975
- throw new TypeError("Invalid JSON-LD: undefined.");
16976
- }
16977
- else if (json === null)
16978
- throw new TypeError("Invalid JSON-LD: null.");
16979
- options = {
16980
- ...options,
16981
- documentLoader: options.documentLoader ?? fetchDocumentLoader,
16982
- contextLoader: options.contextLoader ?? fetchDocumentLoader,
16983
- };
16984
- // deno-lint-ignore no-explicit-any
16985
- let values;
16986
- if (globalThis.Object.keys(json).length == 0) {
16987
- values = {};
16988
- }
16989
- else {
16990
- const expanded = await jsonld.expand(json, {
16991
- documentLoader: options.contextLoader,
16992
- keepFreeFloatingNodes: true,
16993
- });
16994
- values =
16995
- // deno-lint-ignore no-explicit-any
16996
- (expanded[0] ?? {});
16997
- }
16998
- if ("@type" in values) {
16999
- if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Event")) {
17000
- throw new TypeError("Invalid type: " + values["@type"]);
17001
- }
17002
- }
17003
- delete values["@type"];
17004
- const instance = await super.fromJsonLd(values, {
17005
- ...options,
17006
- // @ts-ignore: an internal option
17007
- _fromSubclass: true,
17008
- });
17009
- if (!(instance instanceof Event)) {
17010
- throw new TypeError("Unexpected type: " + instance.constructor.name);
17011
- }
17012
- if (!("_fromSubclass" in options) || !options._fromSubclass) {
17013
- try {
17014
- instance.#cachedJsonLd = structuredClone(json);
17015
- }
17016
- catch {
17017
- getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
17018
- }
17019
- }
17020
- return instance;
17021
- }
17022
- _getCustomInspectProxy() {
17023
- const proxy = super._getCustomInspectProxy();
17024
- return proxy;
17025
- }
17026
- [Symbol.for("Deno.customInspect")](inspect, options) {
17027
- const proxy = this._getCustomInspectProxy();
17028
- return "Event " + inspect(proxy, options);
17029
- }
17030
- [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
17031
- const proxy = this._getCustomInspectProxy();
17032
- return "Event " + inspect(proxy, options);
17033
- }
17034
- }
17035
- /** Indicates that the `actor` is "flagging" the `object`. Flagging is defined
17036
- * in the sense common to many social platforms as reporting content as being
17037
- * inappropriate for any number of reasons.
17038
- */
17039
- export class Flag extends Activity {
17040
- #cachedJsonLd;
17041
- /**
17042
- * The type URI of {@link Flag}: `https://www.w3.org/ns/activitystreams#Flag`.
17043
- */
17044
- static get typeId() {
17045
- return new URL("https://www.w3.org/ns/activitystreams#Flag");
17046
- }
17047
- /**
17048
- * Constructs a new instance of Flag with the given values.
17049
- * @param values The values to initialize the instance with.
17050
- * @param options The options to use for initialization.
17051
- */
17052
- constructor(values, { documentLoader, contextLoader, } = {}) {
17053
- super(values, { documentLoader, contextLoader });
17054
- }
17055
- /**
17056
- * Clones this instance, optionally updating it with the given values.
17057
- * @param values The values to update the clone with.
17058
- * @options The options to use for cloning.
17059
- * @returns The cloned instance.
17060
- */
17061
- clone(values = {}, options = {}) {
17062
- const clone = super.clone(values, options);
17063
- return clone;
17064
- }
17065
- /**
17066
- * Converts this object to a JSON-LD structure.
17067
- * @param options The options to use.
17068
- * - `format`: The format of the output: `compact` or
17069
- `expand`.
17070
- * - `contextLoader`: The loader for remote JSON-LD contexts.
17071
- * - `context`: The JSON-LD context to use. Not applicable
17072
- when `format` is set to `'expand'`.
17073
- * @returns The JSON-LD representation of this object.
17074
- */
17075
- async toJsonLd(options = {}) {
17076
- if (options.format == null && this.#cachedJsonLd != null) {
17077
- return this.#cachedJsonLd;
17078
- }
17079
- if (options.format !== "compact" && options.context != null) {
17080
- throw new TypeError("The context option can only be used when the format option is set " +
17081
- "to 'compact'.");
17082
- }
17083
- options = {
17084
- ...options,
17085
- contextLoader: options.contextLoader ?? fetchDocumentLoader,
17086
- };
17087
- if (options.format == null) {
17088
- const result = await super.toJsonLd({
17089
- ...options,
17090
- format: undefined,
17091
- context: undefined,
17092
- });
17093
- // deno-lint-ignore no-unused-vars
17094
- let compactItems;
17095
- result["type"] = "Flag";
17096
- if (this.id != null)
17097
- result["id"] = this.id.href;
17098
- result["@context"] = [
17099
- "https://www.w3.org/ns/activitystreams",
17100
- "https://w3id.org/security/data-integrity/v1",
17101
- "https://w3id.org/identity/v1",
17102
- ];
17103
- return result;
17104
- }
17105
- // deno-lint-ignore no-unused-vars prefer-const
17106
- let array;
17107
- const baseValues = await super.toJsonLd({
17108
- ...options,
17109
- format: "expand",
17110
- context: undefined,
17111
- });
17112
- const values = baseValues[0];
17113
- values["@type"] = ["https://www.w3.org/ns/activitystreams#Flag"];
17114
- if (this.id != null)
17115
- values["@id"] = this.id.href;
17116
- if (options.format === "expand") {
17117
- return await jsonld.expand(values, { documentLoader: options.contextLoader });
17118
- }
17119
- const docContext = options.context ??
17120
- [
17121
- "https://www.w3.org/ns/activitystreams",
17122
- "https://w3id.org/security/data-integrity/v1",
17123
- "https://w3id.org/identity/v1",
17124
- ];
17125
- const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17126
- if (docContext != null) {
17127
- // Embed context
17128
- if ("proof" in compacted &&
17129
- compacted.proof != null) {
17130
- if (Array.isArray(compacted.proof)) {
17131
- for (const element of compacted.proof) {
17132
- element["@context"] = docContext;
17133
- }
17134
- }
17135
- else {
17136
- compacted.proof["@context"] = docContext;
17137
- }
17138
- }
17139
- }
17140
- return compacted;
16720
+ isCompactable() {
16721
+ return super.isCompactable();
16722
+ }
16723
+ /**
16724
+ * Converts a JSON-LD structure to an object of this type.
16725
+ * @param json The JSON-LD structure to convert.
16726
+ * @returns The object of this type.
16727
+ * @throws {TypeError} If the given `json` is invalid.
16728
+ */
16729
+ static async fromJsonLd(json, options = {}) {
16730
+ if (typeof json === "undefined") {
16731
+ throw new TypeError("Invalid JSON-LD: undefined.");
16732
+ }
16733
+ else if (json === null)
16734
+ throw new TypeError("Invalid JSON-LD: null.");
16735
+ options = {
16736
+ ...options,
16737
+ documentLoader: options.documentLoader ?? fetchDocumentLoader,
16738
+ contextLoader: options.contextLoader ?? fetchDocumentLoader,
16739
+ };
16740
+ // deno-lint-ignore no-explicit-any
16741
+ let values;
16742
+ if (globalThis.Object.keys(json).length == 0) {
16743
+ values = {};
16744
+ }
16745
+ else {
16746
+ const expanded = await jsonld.expand(json, {
16747
+ documentLoader: options.contextLoader,
16748
+ keepFreeFloatingNodes: true,
16749
+ });
16750
+ values =
16751
+ // deno-lint-ignore no-explicit-any
16752
+ (expanded[0] ?? {});
16753
+ }
16754
+ if ("@type" in values) {
16755
+ if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Event")) {
16756
+ throw new TypeError("Invalid type: " + values["@type"]);
16757
+ }
16758
+ }
16759
+ delete values["@type"];
16760
+ const instance = await super.fromJsonLd(values, {
16761
+ ...options,
16762
+ // @ts-ignore: an internal option
16763
+ _fromSubclass: true,
16764
+ });
16765
+ if (!(instance instanceof Event)) {
16766
+ throw new TypeError("Unexpected type: " + instance.constructor.name);
16767
+ }
16768
+ if (!("_fromSubclass" in options) || !options._fromSubclass) {
16769
+ try {
16770
+ instance.#cachedJsonLd = structuredClone(json);
16771
+ }
16772
+ catch {
16773
+ getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
16774
+ }
16775
+ }
16776
+ return instance;
16777
+ }
16778
+ _getCustomInspectProxy() {
16779
+ const proxy = super._getCustomInspectProxy();
16780
+ return proxy;
16781
+ }
16782
+ [Symbol.for("Deno.customInspect")](inspect, options) {
16783
+ const proxy = this._getCustomInspectProxy();
16784
+ return "Event " + inspect(proxy, options);
16785
+ }
16786
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
16787
+ const proxy = this._getCustomInspectProxy();
16788
+ return "Event " + inspect(proxy, options);
16789
+ }
16790
+ }
16791
+ /** Indicates that the `actor` is "flagging" the `object`. Flagging is defined
16792
+ * in the sense common to many social platforms as reporting content as being
16793
+ * inappropriate for any number of reasons.
16794
+ */
16795
+ export class Flag extends Activity {
16796
+ #cachedJsonLd;
16797
+ /**
16798
+ * The type URI of {@link Flag}: `https://www.w3.org/ns/activitystreams#Flag`.
16799
+ */
16800
+ static get typeId() {
16801
+ return new URL("https://www.w3.org/ns/activitystreams#Flag");
16802
+ }
16803
+ /**
16804
+ * Constructs a new instance of Flag with the given values.
16805
+ * @param values The values to initialize the instance with.
16806
+ * @param options The options to use for initialization.
16807
+ */
16808
+ constructor(values, { documentLoader, contextLoader, } = {}) {
16809
+ super(values, { documentLoader, contextLoader });
16810
+ }
16811
+ /**
16812
+ * Clones this instance, optionally updating it with the given values.
16813
+ * @param values The values to update the clone with.
16814
+ * @options The options to use for cloning.
16815
+ * @returns The cloned instance.
16816
+ */
16817
+ clone(values = {}, options = {}) {
16818
+ const clone = super.clone(values, options);
16819
+ return clone;
16820
+ }
16821
+ /**
16822
+ * Converts this object to a JSON-LD structure.
16823
+ * @param options The options to use.
16824
+ * - `format`: The format of the output: `compact` or
16825
+ `expand`.
16826
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
16827
+ * - `context`: The JSON-LD context to use. Not applicable
16828
+ when `format` is set to `'expand'`.
16829
+ * @returns The JSON-LD representation of this object.
16830
+ */
16831
+ async toJsonLd(options = {}) {
16832
+ if (options.format == null && this.#cachedJsonLd != null) {
16833
+ return this.#cachedJsonLd;
16834
+ }
16835
+ if (options.format !== "compact" && options.context != null) {
16836
+ throw new TypeError("The context option can only be used when the format option is set " +
16837
+ "to 'compact'.");
16838
+ }
16839
+ options = {
16840
+ ...options,
16841
+ contextLoader: options.contextLoader ?? fetchDocumentLoader,
16842
+ };
16843
+ // deno-lint-ignore no-unused-vars prefer-const
16844
+ let array;
16845
+ const baseValues = await super.toJsonLd({
16846
+ ...options,
16847
+ format: "expand",
16848
+ context: undefined,
16849
+ });
16850
+ const values = baseValues[0];
16851
+ values["@type"] = ["https://www.w3.org/ns/activitystreams#Flag"];
16852
+ if (this.id != null)
16853
+ values["@id"] = this.id.href;
16854
+ if (options.format === "expand") {
16855
+ return await jsonld.expand(values, { documentLoader: options.contextLoader });
16856
+ }
16857
+ const docContext = options.context ??
16858
+ [
16859
+ "https://w3id.org/identity/v1",
16860
+ "https://www.w3.org/ns/activitystreams",
16861
+ "https://w3id.org/security/data-integrity/v1",
16862
+ ];
16863
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
16864
+ if (docContext != null) {
16865
+ // Embed context
16866
+ if ("proof" in compacted &&
16867
+ compacted.proof != null) {
16868
+ if (Array.isArray(compacted.proof)) {
16869
+ for (const element of compacted.proof) {
16870
+ element["@context"] = docContext;
16871
+ }
16872
+ }
16873
+ else {
16874
+ compacted.proof["@context"] = docContext;
16875
+ }
16876
+ }
16877
+ }
16878
+ return compacted;
16879
+ }
16880
+ isCompactable() {
16881
+ return super.isCompactable();
17141
16882
  }
17142
16883
  /**
17143
16884
  * Converts a JSON-LD structure to an object of this type.
@@ -17260,24 +17001,6 @@ export class Follow extends Activity {
17260
17001
  ...options,
17261
17002
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
17262
17003
  };
17263
- if (options.format == null) {
17264
- const result = await super.toJsonLd({
17265
- ...options,
17266
- format: undefined,
17267
- context: undefined,
17268
- });
17269
- // deno-lint-ignore no-unused-vars
17270
- let compactItems;
17271
- result["type"] = "Follow";
17272
- if (this.id != null)
17273
- result["id"] = this.id.href;
17274
- result["@context"] = [
17275
- "https://www.w3.org/ns/activitystreams",
17276
- "https://w3id.org/security/data-integrity/v1",
17277
- "https://w3id.org/identity/v1",
17278
- ];
17279
- return result;
17280
- }
17281
17004
  // deno-lint-ignore no-unused-vars prefer-const
17282
17005
  let array;
17283
17006
  const baseValues = await super.toJsonLd({
@@ -17294,9 +17017,9 @@ export class Follow extends Activity {
17294
17017
  }
17295
17018
  const docContext = options.context ??
17296
17019
  [
17020
+ "https://w3id.org/identity/v1",
17297
17021
  "https://www.w3.org/ns/activitystreams",
17298
17022
  "https://w3id.org/security/data-integrity/v1",
17299
- "https://w3id.org/identity/v1",
17300
17023
  ];
17301
17024
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
17302
17025
  if (docContext != null) {
@@ -17315,6 +17038,9 @@ export class Follow extends Activity {
17315
17038
  }
17316
17039
  return compacted;
17317
17040
  }
17041
+ isCompactable() {
17042
+ return super.isCompactable();
17043
+ }
17318
17044
  /**
17319
17045
  * Converts a JSON-LD structure to an object of this type.
17320
17046
  * @param json The JSON-LD structure to convert.
@@ -18897,9 +18623,7 @@ export class Group extends Object {
18897
18623
  ...options,
18898
18624
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
18899
18625
  };
18900
- if (options.format == null &&
18901
- (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername == null ||
18902
- this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1)) {
18626
+ if (options.format == null && this.isCompactable()) {
18903
18627
  const result = await super.toJsonLd({
18904
18628
  ...options,
18905
18629
  format: undefined,
@@ -19460,6 +19184,12 @@ export class Group extends Object {
19460
19184
  }
19461
19185
  return compacted;
19462
19186
  }
19187
+ isCompactable() {
19188
+ if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null &&
19189
+ this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0)
19190
+ return false;
19191
+ return super.isCompactable();
19192
+ }
19463
19193
  /**
19464
19194
  * Converts a JSON-LD structure to an object of this type.
19465
19195
  * @param json The JSON-LD structure to convert.
@@ -20605,9 +20335,7 @@ export class Link {
20605
20335
  ...options,
20606
20336
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
20607
20337
  };
20608
- if (options.format == null &&
20609
- (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name == null ||
20610
- this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1)) {
20338
+ if (options.format == null && this.isCompactable()) {
20611
20339
  const result = {};
20612
20340
  // deno-lint-ignore no-unused-vars
20613
20341
  let compactItems;
@@ -20814,6 +20542,12 @@ export class Link {
20814
20542
  }
20815
20543
  return compacted;
20816
20544
  }
20545
+ isCompactable() {
20546
+ if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null &&
20547
+ this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0)
20548
+ return false;
20549
+ return true;
20550
+ }
20817
20551
  /**
20818
20552
  * Converts a JSON-LD structure to an object of this type.
20819
20553
  * @param json The JSON-LD structure to convert.
@@ -21244,7 +20978,7 @@ export class Hashtag extends Link {
21244
20978
  ...options,
21245
20979
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
21246
20980
  };
21247
- if (options.format == null) {
20981
+ if (options.format == null && this.isCompactable()) {
21248
20982
  const result = await super.toJsonLd({
21249
20983
  ...options,
21250
20984
  format: undefined,
@@ -21282,6 +21016,9 @@ export class Hashtag extends Link {
21282
21016
  }
21283
21017
  return compacted;
21284
21018
  }
21019
+ isCompactable() {
21020
+ return super.isCompactable();
21021
+ }
21285
21022
  /**
21286
21023
  * Converts a JSON-LD structure to an object of this type.
21287
21024
  * @param json The JSON-LD structure to convert.
@@ -21400,7 +21137,7 @@ export class Image extends Document {
21400
21137
  ...options,
21401
21138
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
21402
21139
  };
21403
- if (options.format == null) {
21140
+ if (options.format == null && this.isCompactable()) {
21404
21141
  const result = await super.toJsonLd({
21405
21142
  ...options,
21406
21143
  format: undefined,
@@ -21447,6 +21184,9 @@ export class Image extends Document {
21447
21184
  }
21448
21185
  return compacted;
21449
21186
  }
21187
+ isCompactable() {
21188
+ return super.isCompactable();
21189
+ }
21450
21190
  /**
21451
21191
  * Converts a JSON-LD structure to an object of this type.
21452
21192
  * @param json The JSON-LD structure to convert.
@@ -21567,24 +21307,6 @@ export class Offer extends Activity {
21567
21307
  ...options,
21568
21308
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
21569
21309
  };
21570
- if (options.format == null) {
21571
- const result = await super.toJsonLd({
21572
- ...options,
21573
- format: undefined,
21574
- context: undefined,
21575
- });
21576
- // deno-lint-ignore no-unused-vars
21577
- let compactItems;
21578
- result["type"] = "Offer";
21579
- if (this.id != null)
21580
- result["id"] = this.id.href;
21581
- result["@context"] = [
21582
- "https://www.w3.org/ns/activitystreams",
21583
- "https://w3id.org/security/data-integrity/v1",
21584
- "https://w3id.org/identity/v1",
21585
- ];
21586
- return result;
21587
- }
21588
21310
  // deno-lint-ignore no-unused-vars prefer-const
21589
21311
  let array;
21590
21312
  const baseValues = await super.toJsonLd({
@@ -21601,9 +21323,9 @@ export class Offer extends Activity {
21601
21323
  }
21602
21324
  const docContext = options.context ??
21603
21325
  [
21326
+ "https://w3id.org/identity/v1",
21604
21327
  "https://www.w3.org/ns/activitystreams",
21605
21328
  "https://w3id.org/security/data-integrity/v1",
21606
- "https://w3id.org/identity/v1",
21607
21329
  ];
21608
21330
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
21609
21331
  if (docContext != null) {
@@ -21622,6 +21344,9 @@ export class Offer extends Activity {
21622
21344
  }
21623
21345
  return compacted;
21624
21346
  }
21347
+ isCompactable() {
21348
+ return super.isCompactable();
21349
+ }
21625
21350
  /**
21626
21351
  * Converts a JSON-LD structure to an object of this type.
21627
21352
  * @param json The JSON-LD structure to convert.
@@ -21744,24 +21469,6 @@ export class Invite extends Offer {
21744
21469
  ...options,
21745
21470
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
21746
21471
  };
21747
- if (options.format == null) {
21748
- const result = await super.toJsonLd({
21749
- ...options,
21750
- format: undefined,
21751
- context: undefined,
21752
- });
21753
- // deno-lint-ignore no-unused-vars
21754
- let compactItems;
21755
- result["type"] = "Invite";
21756
- if (this.id != null)
21757
- result["id"] = this.id.href;
21758
- result["@context"] = [
21759
- "https://www.w3.org/ns/activitystreams",
21760
- "https://w3id.org/security/data-integrity/v1",
21761
- "https://w3id.org/identity/v1",
21762
- ];
21763
- return result;
21764
- }
21765
21472
  // deno-lint-ignore no-unused-vars prefer-const
21766
21473
  let array;
21767
21474
  const baseValues = await super.toJsonLd({
@@ -21778,9 +21485,9 @@ export class Invite extends Offer {
21778
21485
  }
21779
21486
  const docContext = options.context ??
21780
21487
  [
21488
+ "https://w3id.org/identity/v1",
21781
21489
  "https://www.w3.org/ns/activitystreams",
21782
21490
  "https://w3id.org/security/data-integrity/v1",
21783
- "https://w3id.org/identity/v1",
21784
21491
  ];
21785
21492
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
21786
21493
  if (docContext != null) {
@@ -21799,6 +21506,9 @@ export class Invite extends Offer {
21799
21506
  }
21800
21507
  return compacted;
21801
21508
  }
21509
+ isCompactable() {
21510
+ return super.isCompactable();
21511
+ }
21802
21512
  /**
21803
21513
  * Converts a JSON-LD structure to an object of this type.
21804
21514
  * @param json The JSON-LD structure to convert.
@@ -21918,24 +21628,6 @@ export class Join extends Activity {
21918
21628
  ...options,
21919
21629
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
21920
21630
  };
21921
- if (options.format == null) {
21922
- const result = await super.toJsonLd({
21923
- ...options,
21924
- format: undefined,
21925
- context: undefined,
21926
- });
21927
- // deno-lint-ignore no-unused-vars
21928
- let compactItems;
21929
- result["type"] = "Join";
21930
- if (this.id != null)
21931
- result["id"] = this.id.href;
21932
- result["@context"] = [
21933
- "https://www.w3.org/ns/activitystreams",
21934
- "https://w3id.org/security/data-integrity/v1",
21935
- "https://w3id.org/identity/v1",
21936
- ];
21937
- return result;
21938
- }
21939
21631
  // deno-lint-ignore no-unused-vars prefer-const
21940
21632
  let array;
21941
21633
  const baseValues = await super.toJsonLd({
@@ -21952,9 +21644,9 @@ export class Join extends Activity {
21952
21644
  }
21953
21645
  const docContext = options.context ??
21954
21646
  [
21647
+ "https://w3id.org/identity/v1",
21955
21648
  "https://www.w3.org/ns/activitystreams",
21956
21649
  "https://w3id.org/security/data-integrity/v1",
21957
- "https://w3id.org/identity/v1",
21958
21650
  ];
21959
21651
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
21960
21652
  if (docContext != null) {
@@ -21973,6 +21665,9 @@ export class Join extends Activity {
21973
21665
  }
21974
21666
  return compacted;
21975
21667
  }
21668
+ isCompactable() {
21669
+ return super.isCompactable();
21670
+ }
21976
21671
  /**
21977
21672
  * Converts a JSON-LD structure to an object of this type.
21978
21673
  * @param json The JSON-LD structure to convert.
@@ -22092,24 +21787,6 @@ export class Leave extends Activity {
22092
21787
  ...options,
22093
21788
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
22094
21789
  };
22095
- if (options.format == null) {
22096
- const result = await super.toJsonLd({
22097
- ...options,
22098
- format: undefined,
22099
- context: undefined,
22100
- });
22101
- // deno-lint-ignore no-unused-vars
22102
- let compactItems;
22103
- result["type"] = "Leave";
22104
- if (this.id != null)
22105
- result["id"] = this.id.href;
22106
- result["@context"] = [
22107
- "https://www.w3.org/ns/activitystreams",
22108
- "https://w3id.org/security/data-integrity/v1",
22109
- "https://w3id.org/identity/v1",
22110
- ];
22111
- return result;
22112
- }
22113
21790
  // deno-lint-ignore no-unused-vars prefer-const
22114
21791
  let array;
22115
21792
  const baseValues = await super.toJsonLd({
@@ -22126,9 +21803,9 @@ export class Leave extends Activity {
22126
21803
  }
22127
21804
  const docContext = options.context ??
22128
21805
  [
21806
+ "https://w3id.org/identity/v1",
22129
21807
  "https://www.w3.org/ns/activitystreams",
22130
21808
  "https://w3id.org/security/data-integrity/v1",
22131
- "https://w3id.org/identity/v1",
22132
21809
  ];
22133
21810
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
22134
21811
  if (docContext != null) {
@@ -22147,6 +21824,9 @@ export class Leave extends Activity {
22147
21824
  }
22148
21825
  return compacted;
22149
21826
  }
21827
+ isCompactable() {
21828
+ return super.isCompactable();
21829
+ }
22150
21830
  /**
22151
21831
  * Converts a JSON-LD structure to an object of this type.
22152
21832
  * @param json The JSON-LD structure to convert.
@@ -22266,24 +21946,6 @@ export class Like extends Activity {
22266
21946
  ...options,
22267
21947
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
22268
21948
  };
22269
- if (options.format == null) {
22270
- const result = await super.toJsonLd({
22271
- ...options,
22272
- format: undefined,
22273
- context: undefined,
22274
- });
22275
- // deno-lint-ignore no-unused-vars
22276
- let compactItems;
22277
- result["type"] = "Like";
22278
- if (this.id != null)
22279
- result["id"] = this.id.href;
22280
- result["@context"] = [
22281
- "https://www.w3.org/ns/activitystreams",
22282
- "https://w3id.org/security/data-integrity/v1",
22283
- "https://w3id.org/identity/v1",
22284
- ];
22285
- return result;
22286
- }
22287
21949
  // deno-lint-ignore no-unused-vars prefer-const
22288
21950
  let array;
22289
21951
  const baseValues = await super.toJsonLd({
@@ -22300,9 +21962,9 @@ export class Like extends Activity {
22300
21962
  }
22301
21963
  const docContext = options.context ??
22302
21964
  [
21965
+ "https://w3id.org/identity/v1",
22303
21966
  "https://www.w3.org/ns/activitystreams",
22304
21967
  "https://w3id.org/security/data-integrity/v1",
22305
- "https://w3id.org/identity/v1",
22306
21968
  ];
22307
21969
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
22308
21970
  if (docContext != null) {
@@ -22321,6 +21983,9 @@ export class Like extends Activity {
22321
21983
  }
22322
21984
  return compacted;
22323
21985
  }
21986
+ isCompactable() {
21987
+ return super.isCompactable();
21988
+ }
22324
21989
  /**
22325
21990
  * Converts a JSON-LD structure to an object of this type.
22326
21991
  * @param json The JSON-LD structure to convert.
@@ -22439,24 +22104,6 @@ export class Listen extends Activity {
22439
22104
  ...options,
22440
22105
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
22441
22106
  };
22442
- if (options.format == null) {
22443
- const result = await super.toJsonLd({
22444
- ...options,
22445
- format: undefined,
22446
- context: undefined,
22447
- });
22448
- // deno-lint-ignore no-unused-vars
22449
- let compactItems;
22450
- result["type"] = "Listen";
22451
- if (this.id != null)
22452
- result["id"] = this.id.href;
22453
- result["@context"] = [
22454
- "https://www.w3.org/ns/activitystreams",
22455
- "https://w3id.org/security/data-integrity/v1",
22456
- "https://w3id.org/identity/v1",
22457
- ];
22458
- return result;
22459
- }
22460
22107
  // deno-lint-ignore no-unused-vars prefer-const
22461
22108
  let array;
22462
22109
  const baseValues = await super.toJsonLd({
@@ -22473,9 +22120,9 @@ export class Listen extends Activity {
22473
22120
  }
22474
22121
  const docContext = options.context ??
22475
22122
  [
22123
+ "https://w3id.org/identity/v1",
22476
22124
  "https://www.w3.org/ns/activitystreams",
22477
22125
  "https://w3id.org/security/data-integrity/v1",
22478
- "https://w3id.org/identity/v1",
22479
22126
  ];
22480
22127
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
22481
22128
  if (docContext != null) {
@@ -22494,6 +22141,9 @@ export class Listen extends Activity {
22494
22141
  }
22495
22142
  return compacted;
22496
22143
  }
22144
+ isCompactable() {
22145
+ return super.isCompactable();
22146
+ }
22497
22147
  /**
22498
22148
  * Converts a JSON-LD structure to an object of this type.
22499
22149
  * @param json The JSON-LD structure to convert.
@@ -22612,7 +22262,7 @@ export class Mention extends Link {
22612
22262
  ...options,
22613
22263
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
22614
22264
  };
22615
- if (options.format == null) {
22265
+ if (options.format == null && this.isCompactable()) {
22616
22266
  const result = await super.toJsonLd({
22617
22267
  ...options,
22618
22268
  format: undefined,
@@ -22648,6 +22298,9 @@ export class Mention extends Link {
22648
22298
  }
22649
22299
  return compacted;
22650
22300
  }
22301
+ isCompactable() {
22302
+ return super.isCompactable();
22303
+ }
22651
22304
  /**
22652
22305
  * Converts a JSON-LD structure to an object of this type.
22653
22306
  * @param json The JSON-LD structure to convert.
@@ -22768,24 +22421,6 @@ export class Move extends Activity {
22768
22421
  ...options,
22769
22422
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
22770
22423
  };
22771
- if (options.format == null) {
22772
- const result = await super.toJsonLd({
22773
- ...options,
22774
- format: undefined,
22775
- context: undefined,
22776
- });
22777
- // deno-lint-ignore no-unused-vars
22778
- let compactItems;
22779
- result["type"] = "Move";
22780
- if (this.id != null)
22781
- result["id"] = this.id.href;
22782
- result["@context"] = [
22783
- "https://www.w3.org/ns/activitystreams",
22784
- "https://w3id.org/security/data-integrity/v1",
22785
- "https://w3id.org/identity/v1",
22786
- ];
22787
- return result;
22788
- }
22789
22424
  // deno-lint-ignore no-unused-vars prefer-const
22790
22425
  let array;
22791
22426
  const baseValues = await super.toJsonLd({
@@ -22802,9 +22437,9 @@ export class Move extends Activity {
22802
22437
  }
22803
22438
  const docContext = options.context ??
22804
22439
  [
22440
+ "https://w3id.org/identity/v1",
22805
22441
  "https://www.w3.org/ns/activitystreams",
22806
22442
  "https://w3id.org/security/data-integrity/v1",
22807
- "https://w3id.org/identity/v1",
22808
22443
  ];
22809
22444
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
22810
22445
  if (docContext != null) {
@@ -22823,6 +22458,9 @@ export class Move extends Activity {
22823
22458
  }
22824
22459
  return compacted;
22825
22460
  }
22461
+ isCompactable() {
22462
+ return super.isCompactable();
22463
+ }
22826
22464
  /**
22827
22465
  * Converts a JSON-LD structure to an object of this type.
22828
22466
  * @param json The JSON-LD structure to convert.
@@ -22981,7 +22619,7 @@ export class Note extends Object {
22981
22619
  ...options,
22982
22620
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
22983
22621
  };
22984
- if (options.format == null) {
22622
+ if (options.format == null && this.isCompactable()) {
22985
22623
  const result = await super.toJsonLd({
22986
22624
  ...options,
22987
22625
  format: undefined,
@@ -23083,6 +22721,9 @@ export class Note extends Object {
23083
22721
  }
23084
22722
  return compacted;
23085
22723
  }
22724
+ isCompactable() {
22725
+ return super.isCompactable();
22726
+ }
23086
22727
  /**
23087
22728
  * Converts a JSON-LD structure to an object of this type.
23088
22729
  * @param json The JSON-LD structure to convert.
@@ -23326,7 +22967,7 @@ export class OrderedCollection extends Collection {
23326
22967
  ...options,
23327
22968
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
23328
22969
  };
23329
- if (options.format == null) {
22970
+ if (options.format == null && this.isCompactable()) {
23330
22971
  const result = await super.toJsonLd({
23331
22972
  ...options,
23332
22973
  format: undefined,
@@ -23427,6 +23068,9 @@ export class OrderedCollection extends Collection {
23427
23068
  }
23428
23069
  return compacted;
23429
23070
  }
23071
+ isCompactable() {
23072
+ return super.isCompactable();
23073
+ }
23430
23074
  /**
23431
23075
  * Converts a JSON-LD structure to an object of this type.
23432
23076
  * @param json The JSON-LD structure to convert.
@@ -23771,7 +23415,7 @@ export class OrderedCollectionPage extends CollectionPage {
23771
23415
  ...options,
23772
23416
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
23773
23417
  };
23774
- if (options.format == null) {
23418
+ if (options.format == null && this.isCompactable()) {
23775
23419
  const result = await super.toJsonLd({
23776
23420
  ...options,
23777
23421
  format: undefined,
@@ -23894,6 +23538,9 @@ export class OrderedCollectionPage extends CollectionPage {
23894
23538
  }
23895
23539
  return compacted;
23896
23540
  }
23541
+ isCompactable() {
23542
+ return super.isCompactable();
23543
+ }
23897
23544
  /**
23898
23545
  * Converts a JSON-LD structure to an object of this type.
23899
23546
  * @param json The JSON-LD structure to convert.
@@ -25605,9 +25252,7 @@ export class Organization extends Object {
25605
25252
  ...options,
25606
25253
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
25607
25254
  };
25608
- if (options.format == null &&
25609
- (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername == null ||
25610
- this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1)) {
25255
+ if (options.format == null && this.isCompactable()) {
25611
25256
  const result = await super.toJsonLd({
25612
25257
  ...options,
25613
25258
  format: undefined,
@@ -26168,6 +25813,12 @@ export class Organization extends Object {
26168
25813
  }
26169
25814
  return compacted;
26170
25815
  }
25816
+ isCompactable() {
25817
+ if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null &&
25818
+ this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0)
25819
+ return false;
25820
+ return super.isCompactable();
25821
+ }
26171
25822
  /**
26172
25823
  * Converts a JSON-LD structure to an object of this type.
26173
25824
  * @param json The JSON-LD structure to convert.
@@ -26896,7 +26547,7 @@ export class Page extends Document {
26896
26547
  ...options,
26897
26548
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
26898
26549
  };
26899
- if (options.format == null) {
26550
+ if (options.format == null && this.isCompactable()) {
26900
26551
  const result = await super.toJsonLd({
26901
26552
  ...options,
26902
26553
  format: undefined,
@@ -26949,6 +26600,9 @@ export class Page extends Document {
26949
26600
  }
26950
26601
  return compacted;
26951
26602
  }
26603
+ isCompactable() {
26604
+ return super.isCompactable();
26605
+ }
26952
26606
  /**
26953
26607
  * Converts a JSON-LD structure to an object of this type.
26954
26608
  * @param json The JSON-LD structure to convert.
@@ -28531,9 +28185,7 @@ export class Person extends Object {
28531
28185
  ...options,
28532
28186
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
28533
28187
  };
28534
- if (options.format == null &&
28535
- (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername == null ||
28536
- this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1)) {
28188
+ if (options.format == null && this.isCompactable()) {
28537
28189
  const result = await super.toJsonLd({
28538
28190
  ...options,
28539
28191
  format: undefined,
@@ -29094,6 +28746,12 @@ export class Person extends Object {
29094
28746
  }
29095
28747
  return compacted;
29096
28748
  }
28749
+ isCompactable() {
28750
+ if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null &&
28751
+ this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0)
28752
+ return false;
28753
+ return super.isCompactable();
28754
+ }
29097
28755
  /**
29098
28756
  * Converts a JSON-LD structure to an object of this type.
29099
28757
  * @param json The JSON-LD structure to convert.
@@ -30018,7 +29676,7 @@ export class Place extends Object {
30018
29676
  ...options,
30019
29677
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
30020
29678
  };
30021
- if (options.format == null) {
29679
+ if (options.format == null && this.isCompactable()) {
30022
29680
  const result = await super.toJsonLd({
30023
29681
  ...options,
30024
29682
  format: undefined,
@@ -30206,6 +29864,9 @@ export class Place extends Object {
30206
29864
  }
30207
29865
  return compacted;
30208
29866
  }
29867
+ isCompactable() {
29868
+ return super.isCompactable();
29869
+ }
30209
29870
  /**
30210
29871
  * Converts a JSON-LD structure to an object of this type.
30211
29872
  * @param json The JSON-LD structure to convert.
@@ -30575,7 +30236,7 @@ export class Profile extends Object {
30575
30236
  ...options,
30576
30237
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
30577
30238
  };
30578
- if (options.format == null) {
30239
+ if (options.format == null && this.isCompactable()) {
30579
30240
  const result = await super.toJsonLd({
30580
30241
  ...options,
30581
30242
  format: undefined,
@@ -30653,6 +30314,9 @@ export class Profile extends Object {
30653
30314
  }
30654
30315
  return compacted;
30655
30316
  }
30317
+ isCompactable() {
30318
+ return super.isCompactable();
30319
+ }
30656
30320
  /**
30657
30321
  * Converts a JSON-LD structure to an object of this type.
30658
30322
  * @param json The JSON-LD structure to convert.
@@ -31072,100 +30736,6 @@ export class Question extends IntransitiveActivity {
31072
30736
  ...options,
31073
30737
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
31074
30738
  };
31075
- if (options.format == null) {
31076
- const result = await super.toJsonLd({
31077
- ...options,
31078
- format: undefined,
31079
- context: undefined,
31080
- });
31081
- // deno-lint-ignore no-unused-vars
31082
- let compactItems;
31083
- compactItems = [];
31084
- for (const v of this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) {
31085
- const item = v instanceof URL ? v.href : await v.toJsonLd({
31086
- ...options,
31087
- format: undefined,
31088
- context: undefined,
31089
- });
31090
- compactItems.push(item);
31091
- }
31092
- if (compactItems.length > 0) {
31093
- result["oneOf"] = compactItems.length > 1
31094
- ? compactItems
31095
- : compactItems[0];
31096
- }
31097
- compactItems = [];
31098
- for (const v of this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) {
31099
- const item = v instanceof URL ? v.href : await v.toJsonLd({
31100
- ...options,
31101
- format: undefined,
31102
- context: undefined,
31103
- });
31104
- compactItems.push(item);
31105
- }
31106
- if (compactItems.length > 0) {
31107
- result["anyOf"] = compactItems.length > 1
31108
- ? compactItems
31109
- : compactItems[0];
31110
- }
31111
- compactItems = [];
31112
- for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
31113
- const item = v instanceof dntShim.Temporal.Instant ? v.toString() : v;
31114
- compactItems.push(item);
31115
- }
31116
- if (compactItems.length > 0) {
31117
- result["closed"] = compactItems.length > 1
31118
- ? compactItems
31119
- : compactItems[0];
31120
- }
31121
- compactItems = [];
31122
- for (const v of this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) {
31123
- const item = v;
31124
- compactItems.push(item);
31125
- }
31126
- if (compactItems.length > 0) {
31127
- result["votersCount"] = compactItems.length > 1
31128
- ? compactItems
31129
- : compactItems[0];
31130
- }
31131
- compactItems = [];
31132
- for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) {
31133
- const item = v.href;
31134
- compactItems.push(item);
31135
- }
31136
- if (compactItems.length > 0) {
31137
- result["quoteUrl"] = compactItems.length > 1
31138
- ? compactItems
31139
- : compactItems[0];
31140
- result["_misskey_quote"] = compactItems.length > 1
31141
- ? compactItems
31142
- : compactItems[0];
31143
- result["quoteUri"] = compactItems.length > 1
31144
- ? compactItems
31145
- : compactItems[0];
31146
- }
31147
- result["type"] = "Question";
31148
- if (this.id != null)
31149
- result["id"] = this.id.href;
31150
- result["@context"] = [
31151
- "https://www.w3.org/ns/activitystreams",
31152
- "https://w3id.org/security/data-integrity/v1",
31153
- "https://w3id.org/identity/v1",
31154
- {
31155
- "toot": "http://joinmastodon.org/ns#",
31156
- "misskey": "https://misskey-hub.net/ns#",
31157
- "fedibird": "http://fedibird.com/ns#",
31158
- "sensitive": "as:sensitive",
31159
- "votersCount": "toot:votersCount",
31160
- "Emoji": "toot:Emoji",
31161
- "Hashtag": "as:Hashtag",
31162
- "quoteUrl": "as:quoteUrl",
31163
- "_misskey_quote": "misskey:_misskey_quote",
31164
- "quoteUri": "fedibird:quoteUri",
31165
- },
31166
- ];
31167
- return result;
31168
- }
31169
30739
  // deno-lint-ignore no-unused-vars prefer-const
31170
30740
  let array;
31171
30741
  const baseValues = await super.toJsonLd({
@@ -31241,9 +30811,9 @@ export class Question extends IntransitiveActivity {
31241
30811
  }
31242
30812
  const docContext = options.context ??
31243
30813
  [
30814
+ "https://w3id.org/identity/v1",
31244
30815
  "https://www.w3.org/ns/activitystreams",
31245
30816
  "https://w3id.org/security/data-integrity/v1",
31246
- "https://w3id.org/identity/v1",
31247
30817
  {
31248
30818
  "toot": "http://joinmastodon.org/ns#",
31249
30819
  "misskey": "https://misskey-hub.net/ns#",
@@ -31274,6 +30844,9 @@ export class Question extends IntransitiveActivity {
31274
30844
  }
31275
30845
  return compacted;
31276
30846
  }
30847
+ isCompactable() {
30848
+ return super.isCompactable();
30849
+ }
31277
30850
  /**
31278
30851
  * Converts a JSON-LD structure to an object of this type.
31279
30852
  * @param json The JSON-LD structure to convert.
@@ -31556,24 +31129,6 @@ export class Read extends Activity {
31556
31129
  ...options,
31557
31130
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
31558
31131
  };
31559
- if (options.format == null) {
31560
- const result = await super.toJsonLd({
31561
- ...options,
31562
- format: undefined,
31563
- context: undefined,
31564
- });
31565
- // deno-lint-ignore no-unused-vars
31566
- let compactItems;
31567
- result["type"] = "Read";
31568
- if (this.id != null)
31569
- result["id"] = this.id.href;
31570
- result["@context"] = [
31571
- "https://www.w3.org/ns/activitystreams",
31572
- "https://w3id.org/security/data-integrity/v1",
31573
- "https://w3id.org/identity/v1",
31574
- ];
31575
- return result;
31576
- }
31577
31132
  // deno-lint-ignore no-unused-vars prefer-const
31578
31133
  let array;
31579
31134
  const baseValues = await super.toJsonLd({
@@ -31590,9 +31145,9 @@ export class Read extends Activity {
31590
31145
  }
31591
31146
  const docContext = options.context ??
31592
31147
  [
31148
+ "https://w3id.org/identity/v1",
31593
31149
  "https://www.w3.org/ns/activitystreams",
31594
31150
  "https://w3id.org/security/data-integrity/v1",
31595
- "https://w3id.org/identity/v1",
31596
31151
  ];
31597
31152
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
31598
31153
  if (docContext != null) {
@@ -31611,6 +31166,9 @@ export class Read extends Activity {
31611
31166
  }
31612
31167
  return compacted;
31613
31168
  }
31169
+ isCompactable() {
31170
+ return super.isCompactable();
31171
+ }
31614
31172
  /**
31615
31173
  * Converts a JSON-LD structure to an object of this type.
31616
31174
  * @param json The JSON-LD structure to convert.
@@ -31730,24 +31288,6 @@ export class Reject extends Activity {
31730
31288
  ...options,
31731
31289
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
31732
31290
  };
31733
- if (options.format == null) {
31734
- const result = await super.toJsonLd({
31735
- ...options,
31736
- format: undefined,
31737
- context: undefined,
31738
- });
31739
- // deno-lint-ignore no-unused-vars
31740
- let compactItems;
31741
- result["type"] = "Reject";
31742
- if (this.id != null)
31743
- result["id"] = this.id.href;
31744
- result["@context"] = [
31745
- "https://www.w3.org/ns/activitystreams",
31746
- "https://w3id.org/security/data-integrity/v1",
31747
- "https://w3id.org/identity/v1",
31748
- ];
31749
- return result;
31750
- }
31751
31291
  // deno-lint-ignore no-unused-vars prefer-const
31752
31292
  let array;
31753
31293
  const baseValues = await super.toJsonLd({
@@ -31764,9 +31304,9 @@ export class Reject extends Activity {
31764
31304
  }
31765
31305
  const docContext = options.context ??
31766
31306
  [
31307
+ "https://w3id.org/identity/v1",
31767
31308
  "https://www.w3.org/ns/activitystreams",
31768
31309
  "https://w3id.org/security/data-integrity/v1",
31769
- "https://w3id.org/identity/v1",
31770
31310
  ];
31771
31311
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
31772
31312
  if (docContext != null) {
@@ -31785,6 +31325,9 @@ export class Reject extends Activity {
31785
31325
  }
31786
31326
  return compacted;
31787
31327
  }
31328
+ isCompactable() {
31329
+ return super.isCompactable();
31330
+ }
31788
31331
  /**
31789
31332
  * Converts a JSON-LD structure to an object of this type.
31790
31333
  * @param json The JSON-LD structure to convert.
@@ -32276,7 +31819,7 @@ export class Relationship extends Object {
32276
31819
  ...options,
32277
31820
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
32278
31821
  };
32279
- if (options.format == null) {
31822
+ if (options.format == null && this.isCompactable()) {
32280
31823
  const result = await super.toJsonLd({
32281
31824
  ...options,
32282
31825
  format: undefined,
@@ -32404,6 +31947,9 @@ export class Relationship extends Object {
32404
31947
  }
32405
31948
  return compacted;
32406
31949
  }
31950
+ isCompactable() {
31951
+ return super.isCompactable();
31952
+ }
32407
31953
  /**
32408
31954
  * Converts a JSON-LD structure to an object of this type.
32409
31955
  * @param json The JSON-LD structure to convert.
@@ -32626,24 +32172,6 @@ export class Remove extends Activity {
32626
32172
  ...options,
32627
32173
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
32628
32174
  };
32629
- if (options.format == null) {
32630
- const result = await super.toJsonLd({
32631
- ...options,
32632
- format: undefined,
32633
- context: undefined,
32634
- });
32635
- // deno-lint-ignore no-unused-vars
32636
- let compactItems;
32637
- result["type"] = "Remove";
32638
- if (this.id != null)
32639
- result["id"] = this.id.href;
32640
- result["@context"] = [
32641
- "https://www.w3.org/ns/activitystreams",
32642
- "https://w3id.org/security/data-integrity/v1",
32643
- "https://w3id.org/identity/v1",
32644
- ];
32645
- return result;
32646
- }
32647
32175
  // deno-lint-ignore no-unused-vars prefer-const
32648
32176
  let array;
32649
32177
  const baseValues = await super.toJsonLd({
@@ -32660,9 +32188,9 @@ export class Remove extends Activity {
32660
32188
  }
32661
32189
  const docContext = options.context ??
32662
32190
  [
32191
+ "https://w3id.org/identity/v1",
32663
32192
  "https://www.w3.org/ns/activitystreams",
32664
32193
  "https://w3id.org/security/data-integrity/v1",
32665
- "https://w3id.org/identity/v1",
32666
32194
  ];
32667
32195
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
32668
32196
  if (docContext != null) {
@@ -32681,6 +32209,9 @@ export class Remove extends Activity {
32681
32209
  }
32682
32210
  return compacted;
32683
32211
  }
32212
+ isCompactable() {
32213
+ return super.isCompactable();
32214
+ }
32684
32215
  /**
32685
32216
  * Converts a JSON-LD structure to an object of this type.
32686
32217
  * @param json The JSON-LD structure to convert.
@@ -34263,9 +33794,7 @@ export class Service extends Object {
34263
33794
  ...options,
34264
33795
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
34265
33796
  };
34266
- if (options.format == null &&
34267
- (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername == null ||
34268
- this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1)) {
33797
+ if (options.format == null && this.isCompactable()) {
34269
33798
  const result = await super.toJsonLd({
34270
33799
  ...options,
34271
33800
  format: undefined,
@@ -34826,6 +34355,12 @@ export class Service extends Object {
34826
34355
  }
34827
34356
  return compacted;
34828
34357
  }
34358
+ isCompactable() {
34359
+ if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null &&
34360
+ this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0)
34361
+ return false;
34362
+ return super.isCompactable();
34363
+ }
34829
34364
  /**
34830
34365
  * Converts a JSON-LD structure to an object of this type.
34831
34366
  * @param json The JSON-LD structure to convert.
@@ -35670,9 +35205,7 @@ export class Source {
35670
35205
  ...options,
35671
35206
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
35672
35207
  };
35673
- if (options.format == null &&
35674
- (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content == null ||
35675
- this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1)) {
35208
+ if (options.format == null && this.isCompactable()) {
35676
35209
  const result = {};
35677
35210
  // deno-lint-ignore no-unused-vars
35678
35211
  let compactItems;
@@ -35743,6 +35276,12 @@ export class Source {
35743
35276
  }
35744
35277
  return compacted;
35745
35278
  }
35279
+ isCompactable() {
35280
+ if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content != null &&
35281
+ this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 0)
35282
+ return false;
35283
+ return true;
35284
+ }
35746
35285
  /**
35747
35286
  * Converts a JSON-LD structure to an object of this type.
35748
35287
  * @param json The JSON-LD structure to convert.
@@ -35927,24 +35466,6 @@ export class TentativeAccept extends Accept {
35927
35466
  ...options,
35928
35467
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
35929
35468
  };
35930
- if (options.format == null) {
35931
- const result = await super.toJsonLd({
35932
- ...options,
35933
- format: undefined,
35934
- context: undefined,
35935
- });
35936
- // deno-lint-ignore no-unused-vars
35937
- let compactItems;
35938
- result["type"] = "TentativeAccept";
35939
- if (this.id != null)
35940
- result["id"] = this.id.href;
35941
- result["@context"] = [
35942
- "https://www.w3.org/ns/activitystreams",
35943
- "https://w3id.org/security/data-integrity/v1",
35944
- "https://w3id.org/identity/v1",
35945
- ];
35946
- return result;
35947
- }
35948
35469
  // deno-lint-ignore no-unused-vars prefer-const
35949
35470
  let array;
35950
35471
  const baseValues = await super.toJsonLd({
@@ -35961,9 +35482,9 @@ export class TentativeAccept extends Accept {
35961
35482
  }
35962
35483
  const docContext = options.context ??
35963
35484
  [
35485
+ "https://w3id.org/identity/v1",
35964
35486
  "https://www.w3.org/ns/activitystreams",
35965
35487
  "https://w3id.org/security/data-integrity/v1",
35966
- "https://w3id.org/identity/v1",
35967
35488
  ];
35968
35489
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
35969
35490
  if (docContext != null) {
@@ -35982,6 +35503,9 @@ export class TentativeAccept extends Accept {
35982
35503
  }
35983
35504
  return compacted;
35984
35505
  }
35506
+ isCompactable() {
35507
+ return super.isCompactable();
35508
+ }
35985
35509
  /**
35986
35510
  * Converts a JSON-LD structure to an object of this type.
35987
35511
  * @param json The JSON-LD structure to convert.
@@ -36101,24 +35625,6 @@ export class TentativeReject extends Reject {
36101
35625
  ...options,
36102
35626
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
36103
35627
  };
36104
- if (options.format == null) {
36105
- const result = await super.toJsonLd({
36106
- ...options,
36107
- format: undefined,
36108
- context: undefined,
36109
- });
36110
- // deno-lint-ignore no-unused-vars
36111
- let compactItems;
36112
- result["type"] = "TentativeReject";
36113
- if (this.id != null)
36114
- result["id"] = this.id.href;
36115
- result["@context"] = [
36116
- "https://www.w3.org/ns/activitystreams",
36117
- "https://w3id.org/security/data-integrity/v1",
36118
- "https://w3id.org/identity/v1",
36119
- ];
36120
- return result;
36121
- }
36122
35628
  // deno-lint-ignore no-unused-vars prefer-const
36123
35629
  let array;
36124
35630
  const baseValues = await super.toJsonLd({
@@ -36135,9 +35641,9 @@ export class TentativeReject extends Reject {
36135
35641
  }
36136
35642
  const docContext = options.context ??
36137
35643
  [
35644
+ "https://w3id.org/identity/v1",
36138
35645
  "https://www.w3.org/ns/activitystreams",
36139
35646
  "https://w3id.org/security/data-integrity/v1",
36140
- "https://w3id.org/identity/v1",
36141
35647
  ];
36142
35648
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
36143
35649
  if (docContext != null) {
@@ -36156,6 +35662,9 @@ export class TentativeReject extends Reject {
36156
35662
  }
36157
35663
  return compacted;
36158
35664
  }
35665
+ isCompactable() {
35666
+ return super.isCompactable();
35667
+ }
36159
35668
  /**
36160
35669
  * Converts a JSON-LD structure to an object of this type.
36161
35670
  * @param json The JSON-LD structure to convert.
@@ -36307,7 +35816,7 @@ export class Tombstone extends Object {
36307
35816
  ...options,
36308
35817
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
36309
35818
  };
36310
- if (options.format == null) {
35819
+ if (options.format == null && this.isCompactable()) {
36311
35820
  const result = await super.toJsonLd({
36312
35821
  ...options,
36313
35822
  format: undefined,
@@ -36382,6 +35891,9 @@ export class Tombstone extends Object {
36382
35891
  }
36383
35892
  return compacted;
36384
35893
  }
35894
+ isCompactable() {
35895
+ return super.isCompactable();
35896
+ }
36385
35897
  /**
36386
35898
  * Converts a JSON-LD structure to an object of this type.
36387
35899
  * @param json The JSON-LD structure to convert.
@@ -36529,24 +36041,6 @@ export class Travel extends IntransitiveActivity {
36529
36041
  ...options,
36530
36042
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
36531
36043
  };
36532
- if (options.format == null) {
36533
- const result = await super.toJsonLd({
36534
- ...options,
36535
- format: undefined,
36536
- context: undefined,
36537
- });
36538
- // deno-lint-ignore no-unused-vars
36539
- let compactItems;
36540
- result["type"] = "Travel";
36541
- if (this.id != null)
36542
- result["id"] = this.id.href;
36543
- result["@context"] = [
36544
- "https://www.w3.org/ns/activitystreams",
36545
- "https://w3id.org/security/data-integrity/v1",
36546
- "https://w3id.org/identity/v1",
36547
- ];
36548
- return result;
36549
- }
36550
36044
  // deno-lint-ignore no-unused-vars prefer-const
36551
36045
  let array;
36552
36046
  const baseValues = await super.toJsonLd({
@@ -36563,9 +36057,9 @@ export class Travel extends IntransitiveActivity {
36563
36057
  }
36564
36058
  const docContext = options.context ??
36565
36059
  [
36060
+ "https://w3id.org/identity/v1",
36566
36061
  "https://www.w3.org/ns/activitystreams",
36567
36062
  "https://w3id.org/security/data-integrity/v1",
36568
- "https://w3id.org/identity/v1",
36569
36063
  ];
36570
36064
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
36571
36065
  if (docContext != null) {
@@ -36584,6 +36078,9 @@ export class Travel extends IntransitiveActivity {
36584
36078
  }
36585
36079
  return compacted;
36586
36080
  }
36081
+ isCompactable() {
36082
+ return super.isCompactable();
36083
+ }
36587
36084
  /**
36588
36085
  * Converts a JSON-LD structure to an object of this type.
36589
36086
  * @param json The JSON-LD structure to convert.
@@ -36708,24 +36205,6 @@ export class Undo extends Activity {
36708
36205
  ...options,
36709
36206
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
36710
36207
  };
36711
- if (options.format == null) {
36712
- const result = await super.toJsonLd({
36713
- ...options,
36714
- format: undefined,
36715
- context: undefined,
36716
- });
36717
- // deno-lint-ignore no-unused-vars
36718
- let compactItems;
36719
- result["type"] = "Undo";
36720
- if (this.id != null)
36721
- result["id"] = this.id.href;
36722
- result["@context"] = [
36723
- "https://www.w3.org/ns/activitystreams",
36724
- "https://w3id.org/security/data-integrity/v1",
36725
- "https://w3id.org/identity/v1",
36726
- ];
36727
- return result;
36728
- }
36729
36208
  // deno-lint-ignore no-unused-vars prefer-const
36730
36209
  let array;
36731
36210
  const baseValues = await super.toJsonLd({
@@ -36742,9 +36221,9 @@ export class Undo extends Activity {
36742
36221
  }
36743
36222
  const docContext = options.context ??
36744
36223
  [
36224
+ "https://w3id.org/identity/v1",
36745
36225
  "https://www.w3.org/ns/activitystreams",
36746
36226
  "https://w3id.org/security/data-integrity/v1",
36747
- "https://w3id.org/identity/v1",
36748
36227
  ];
36749
36228
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
36750
36229
  if (docContext != null) {
@@ -36763,6 +36242,9 @@ export class Undo extends Activity {
36763
36242
  }
36764
36243
  return compacted;
36765
36244
  }
36245
+ isCompactable() {
36246
+ return super.isCompactable();
36247
+ }
36766
36248
  /**
36767
36249
  * Converts a JSON-LD structure to an object of this type.
36768
36250
  * @param json The JSON-LD structure to convert.
@@ -36885,47 +36367,6 @@ export class Update extends Activity {
36885
36367
  ...options,
36886
36368
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
36887
36369
  };
36888
- if (options.format == null) {
36889
- const result = await super.toJsonLd({
36890
- ...options,
36891
- format: undefined,
36892
- context: undefined,
36893
- });
36894
- // deno-lint-ignore no-unused-vars
36895
- let compactItems;
36896
- result["type"] = "Update";
36897
- if (this.id != null)
36898
- result["id"] = this.id.href;
36899
- result["@context"] = [
36900
- "https://www.w3.org/ns/activitystreams",
36901
- "https://w3id.org/security/data-integrity/v1",
36902
- "https://w3id.org/identity/v1",
36903
- {
36904
- "toot": "http://joinmastodon.org/ns#",
36905
- "schema": "http://schema.org#",
36906
- "misskey": "https://misskey-hub.net/ns#",
36907
- "fedibird": "http://fedibird.com/ns#",
36908
- "PropertyValue": "schema:PropertyValue",
36909
- "value": "schema:value",
36910
- "sensitive": "as:sensitive",
36911
- "votersCount": "toot:votersCount",
36912
- "featured": { "@id": "toot:featured", "@type": "@id" },
36913
- "featuredTags": { "@id": "toot:featuredTags", "@type": "@id" },
36914
- "discoverable": "toot:discoverable",
36915
- "suspended": "toot:suspended",
36916
- "memorial": "toot:memorial",
36917
- "indexable": "toot:indexable",
36918
- "Emoji": "toot:Emoji",
36919
- "Hashtag": "as:Hashtag",
36920
- "ChatMessage": "http://litepub.social/ns#ChatMessage",
36921
- "quoteUrl": "as:quoteUrl",
36922
- "_misskey_quote": "misskey:_misskey_quote",
36923
- "quoteUri": "fedibird:quoteUri",
36924
- "isCat": "misskey:isCat",
36925
- },
36926
- ];
36927
- return result;
36928
- }
36929
36370
  // deno-lint-ignore no-unused-vars prefer-const
36930
36371
  let array;
36931
36372
  const baseValues = await super.toJsonLd({
@@ -36942,9 +36383,9 @@ export class Update extends Activity {
36942
36383
  }
36943
36384
  const docContext = options.context ??
36944
36385
  [
36386
+ "https://w3id.org/identity/v1",
36945
36387
  "https://www.w3.org/ns/activitystreams",
36946
36388
  "https://w3id.org/security/data-integrity/v1",
36947
- "https://w3id.org/identity/v1",
36948
36389
  {
36949
36390
  "toot": "http://joinmastodon.org/ns#",
36950
36391
  "schema": "http://schema.org#",
@@ -36986,6 +36427,9 @@ export class Update extends Activity {
36986
36427
  }
36987
36428
  return compacted;
36988
36429
  }
36430
+ isCompactable() {
36431
+ return super.isCompactable();
36432
+ }
36989
36433
  /**
36990
36434
  * Converts a JSON-LD structure to an object of this type.
36991
36435
  * @param json The JSON-LD structure to convert.
@@ -37104,7 +36548,7 @@ export class Video extends Document {
37104
36548
  ...options,
37105
36549
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
37106
36550
  };
37107
- if (options.format == null) {
36551
+ if (options.format == null && this.isCompactable()) {
37108
36552
  const result = await super.toJsonLd({
37109
36553
  ...options,
37110
36554
  format: undefined,
@@ -37157,6 +36601,9 @@ export class Video extends Document {
37157
36601
  }
37158
36602
  return compacted;
37159
36603
  }
36604
+ isCompactable() {
36605
+ return super.isCompactable();
36606
+ }
37160
36607
  /**
37161
36608
  * Converts a JSON-LD structure to an object of this type.
37162
36609
  * @param json The JSON-LD structure to convert.
@@ -37275,24 +36722,6 @@ export class View extends Activity {
37275
36722
  ...options,
37276
36723
  contextLoader: options.contextLoader ?? fetchDocumentLoader,
37277
36724
  };
37278
- if (options.format == null) {
37279
- const result = await super.toJsonLd({
37280
- ...options,
37281
- format: undefined,
37282
- context: undefined,
37283
- });
37284
- // deno-lint-ignore no-unused-vars
37285
- let compactItems;
37286
- result["type"] = "View";
37287
- if (this.id != null)
37288
- result["id"] = this.id.href;
37289
- result["@context"] = [
37290
- "https://www.w3.org/ns/activitystreams",
37291
- "https://w3id.org/security/data-integrity/v1",
37292
- "https://w3id.org/identity/v1",
37293
- ];
37294
- return result;
37295
- }
37296
36725
  // deno-lint-ignore no-unused-vars prefer-const
37297
36726
  let array;
37298
36727
  const baseValues = await super.toJsonLd({
@@ -37309,9 +36738,9 @@ export class View extends Activity {
37309
36738
  }
37310
36739
  const docContext = options.context ??
37311
36740
  [
36741
+ "https://w3id.org/identity/v1",
37312
36742
  "https://www.w3.org/ns/activitystreams",
37313
36743
  "https://w3id.org/security/data-integrity/v1",
37314
- "https://w3id.org/identity/v1",
37315
36744
  ];
37316
36745
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
37317
36746
  if (docContext != null) {
@@ -37330,6 +36759,9 @@ export class View extends Activity {
37330
36759
  }
37331
36760
  return compacted;
37332
36761
  }
36762
+ isCompactable() {
36763
+ return super.isCompactable();
36764
+ }
37333
36765
  /**
37334
36766
  * Converts a JSON-LD structure to an object of this type.
37335
36767
  * @param json The JSON-LD structure to convert.