@fedify/vocab 2.4.0-dev.1962 → 2.4.0-dev.1964
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist/mod.cjs +2190 -586
- package/dist/mod.d.cts +323 -1
- package/dist/mod.d.ts +323 -1
- package/dist/mod.js +2190 -587
- package/dist-tests/actor-Bms47rRP.mjs +207 -0
- package/dist-tests/actor.test.mjs +3 -2
- package/dist-tests/{actor-DH8a9EGs.mjs → esm-BcWVaclW.mjs} +2 -205
- package/dist-tests/lookup-DaLkzo2s.mjs +264 -0
- package/dist-tests/lookup.test.mjs +4 -262
- package/dist-tests/object.yaml +15 -0
- package/dist-tests/translation.test.mjs +404 -0
- package/dist-tests/translation.yaml +91 -0
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-CNiWKo57.mjs → vocab-D3s0_CFf.mjs} +2190 -586
- package/dist-tests/vocab.test.mjs +4 -2
- package/package.json +4 -4
- package/src/__snapshots__/vocab.test.ts.snap +285 -9
- package/src/object.yaml +15 -0
- package/src/translation.test.ts +518 -0
- package/src/translation.yaml +91 -0
- package/src/vocab.test.ts +19 -1
package/dist/mod.js
CHANGED
|
@@ -10,7 +10,7 @@ import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/tem
|
|
|
10
10
|
import { delay } from "es-toolkit";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/vocab";
|
|
13
|
-
var version = "2.4.0-dev.
|
|
13
|
+
var version = "2.4.0-dev.1964+1d28dc03";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/type.ts
|
|
16
16
|
function getTypeId(object) {
|
|
@@ -62,6 +62,29 @@ function isValidLanguageTag(language) {
|
|
|
62
62
|
throw error;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
const extraPropertyContexts = {
|
|
66
|
+
"https://schema.org/translator": "https://w3id.org/fep/22cd",
|
|
67
|
+
"https://w3id.org/fep/22cd#translations": "https://w3id.org/fep/22cd"
|
|
68
|
+
};
|
|
69
|
+
function getExtraContexts(document) {
|
|
70
|
+
const contexts = /* @__PURE__ */ new Set();
|
|
71
|
+
const pending = [document];
|
|
72
|
+
while (pending.length > 0) {
|
|
73
|
+
const value = pending.pop();
|
|
74
|
+
if (value == null || typeof value !== "object") continue;
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
for (const item of value) pending.push(item);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if ("@value" in value) continue;
|
|
80
|
+
for (const [key, child] of globalThis.Object.entries(value)) {
|
|
81
|
+
if (key === "@context") continue;
|
|
82
|
+
if (globalThis.Object.hasOwn(extraPropertyContexts, key)) contexts.add(extraPropertyContexts[key]);
|
|
83
|
+
pending.push(child);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return [...contexts];
|
|
87
|
+
}
|
|
65
88
|
const PORTABLE_IRI_PATTERN = /^ap(?:\+ef61)?:\/\//i;
|
|
66
89
|
const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
67
90
|
"@id",
|
|
@@ -110,6 +133,9 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
|
110
133
|
"https://gotosocial.org/ns#manualApproval",
|
|
111
134
|
"https://gotosocial.org/ns#replyAuthorization",
|
|
112
135
|
"https://misskey-hub.net/ns#_misskey_quote",
|
|
136
|
+
"https://schema.org/isBasedOn",
|
|
137
|
+
"https://schema.org/translationOfWork",
|
|
138
|
+
"https://schema.org/translator",
|
|
113
139
|
"https://w3id.org/fep/044f#quote",
|
|
114
140
|
"https://w3id.org/fep/044f#quoteAuthorization",
|
|
115
141
|
"https://w3id.org/fep/5711#followersOf",
|
|
@@ -196,6 +222,7 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
|
196
222
|
"instrument",
|
|
197
223
|
"interactingObject",
|
|
198
224
|
"interactionTarget",
|
|
225
|
+
"isBasedOn",
|
|
199
226
|
"items",
|
|
200
227
|
"last",
|
|
201
228
|
"likeAuthorization",
|
|
@@ -244,6 +271,8 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
|
244
271
|
"tag",
|
|
245
272
|
"target",
|
|
246
273
|
"to",
|
|
274
|
+
"translationOfWork",
|
|
275
|
+
"translator",
|
|
247
276
|
"units",
|
|
248
277
|
"uploadMedia",
|
|
249
278
|
"url"
|
|
@@ -361,6 +390,7 @@ var Object$1 = class Object$1 {
|
|
|
361
390
|
#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = /* @__PURE__ */ new Set();
|
|
362
391
|
#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [];
|
|
363
392
|
#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = /* @__PURE__ */ new Set();
|
|
393
|
+
#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = [];
|
|
364
394
|
/**
|
|
365
395
|
* Constructs a new instance of Object with the given values.
|
|
366
396
|
* @param values The values to initialize the instance with.
|
|
@@ -599,6 +629,8 @@ var Object$1 = class Object$1 {
|
|
|
599
629
|
this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization];
|
|
600
630
|
this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0);
|
|
601
631
|
} else throw new TypeError("The announceAuthorization must be of type AnnounceAuthorization | URL.");
|
|
632
|
+
if ("translations" in values && values.translations != null) if (Array.isArray(values.translations) && values.translations.every((v) => v instanceof Translation)) this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations;
|
|
633
|
+
else throw new TypeError("The translations must be an array of type Translation.");
|
|
602
634
|
}
|
|
603
635
|
/**
|
|
604
636
|
* Clones this instance, optionally updating it with the given values.
|
|
@@ -915,6 +947,9 @@ var Object$1 = class Object$1 {
|
|
|
915
947
|
clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization];
|
|
916
948
|
clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = /* @__PURE__ */ new Set([0]);
|
|
917
949
|
} else throw new TypeError("The announceAuthorization must be of type AnnounceAuthorization | URL.");
|
|
950
|
+
clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
951
|
+
if ("translations" in values && values.translations != null) if (Array.isArray(values.translations) && values.translations.every((v) => v instanceof Translation)) clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations;
|
|
952
|
+
else throw new TypeError("The translations must be an array of type Translation.");
|
|
918
953
|
return clone;
|
|
919
954
|
}
|
|
920
955
|
async #fetchAttachment(url, options = {}) {
|
|
@@ -4685,6 +4720,16 @@ var Object$1 = class Object$1 {
|
|
|
4685
4720
|
}
|
|
4686
4721
|
return v;
|
|
4687
4722
|
}
|
|
4723
|
+
/** Translation metadata for the language versions in this object's content,
|
|
4724
|
+
* name, or summary maps, as defined by the draft
|
|
4725
|
+
* [FEP-22cd](https://w3id.org/fep/22cd). Each entry describes one translated
|
|
4726
|
+
* language; directly authored languages have no entry. The entries share
|
|
4727
|
+
* this object's identity, replies, and reactions. Translator credit grants
|
|
4728
|
+
* no authority to update the object.
|
|
4729
|
+
*/
|
|
4730
|
+
get translations() {
|
|
4731
|
+
return this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
4732
|
+
}
|
|
4688
4733
|
/**
|
|
4689
4734
|
* Converts this object to a JSON-LD structure.
|
|
4690
4735
|
* @param options The options to use.
|
|
@@ -5087,6 +5132,16 @@ var Object$1 = class Object$1 {
|
|
|
5087
5132
|
compactItems.push(item);
|
|
5088
5133
|
}
|
|
5089
5134
|
if (compactItems.length > 0) result["announceAuthorization"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
5135
|
+
compactItems = [];
|
|
5136
|
+
for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) {
|
|
5137
|
+
const item = await v.toJsonLd({
|
|
5138
|
+
...options,
|
|
5139
|
+
format: void 0,
|
|
5140
|
+
context: void 0
|
|
5141
|
+
});
|
|
5142
|
+
compactItems.push(item);
|
|
5143
|
+
}
|
|
5144
|
+
if (compactItems.length > 0) result["translations"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
5090
5145
|
result["type"] = "Object";
|
|
5091
5146
|
if (this.id != null) result["id"] = formatIri(this.id);
|
|
5092
5147
|
result["@context"] = [
|
|
@@ -5537,13 +5592,24 @@ var Object$1 = class Object$1 {
|
|
|
5537
5592
|
array.push(element);
|
|
5538
5593
|
}
|
|
5539
5594
|
if (array.length > 0) values["https://gotosocial.org/ns#announceAuthorization"] = array;
|
|
5595
|
+
array = [];
|
|
5596
|
+
for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) {
|
|
5597
|
+
let element = await v.toJsonLd(options);
|
|
5598
|
+
if (Array.isArray(element)) {
|
|
5599
|
+
if (element.length < 1) continue;
|
|
5600
|
+
if (element.length == 1) element = element[0];
|
|
5601
|
+
}
|
|
5602
|
+
if (typeof element === "undefined") continue;
|
|
5603
|
+
array.push(element);
|
|
5604
|
+
}
|
|
5605
|
+
if (array.length > 0) values["https://w3id.org/fep/22cd#translations"] = array;
|
|
5540
5606
|
values["@type"] = ["https://www.w3.org/ns/activitystreams#Object"];
|
|
5541
5607
|
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
5542
5608
|
if (options.format === "expand") return await jsonld.expand(values, {
|
|
5543
5609
|
documentLoader: options.contextLoader,
|
|
5544
5610
|
keepFreeFloatingNodes: true
|
|
5545
5611
|
});
|
|
5546
|
-
|
|
5612
|
+
let docContext = options.context ?? [
|
|
5547
5613
|
"https://www.w3.org/ns/activitystreams",
|
|
5548
5614
|
"https://w3id.org/security/data-integrity/v1",
|
|
5549
5615
|
"https://gotosocial.org/ns",
|
|
@@ -5556,7 +5622,15 @@ var Object$1 = class Object$1 {
|
|
|
5556
5622
|
}
|
|
5557
5623
|
}
|
|
5558
5624
|
];
|
|
5559
|
-
|
|
5625
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
5626
|
+
if (options.context == null) {
|
|
5627
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
5628
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
5629
|
+
if (additionalContexts.length > 0) {
|
|
5630
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
5631
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
5632
|
+
}
|
|
5633
|
+
}
|
|
5560
5634
|
if (docContext != null) {
|
|
5561
5635
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
5562
5636
|
else compacted.proof["@context"] = docContext;
|
|
@@ -5569,6 +5643,7 @@ var Object$1 = class Object$1 {
|
|
|
5569
5643
|
if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary != null && this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0) return false;
|
|
5570
5644
|
if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof != null && this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) return false;
|
|
5571
5645
|
if (this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy != null && this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length > 0) return false;
|
|
5646
|
+
if (this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations != null && this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 0) return false;
|
|
5572
5647
|
return true;
|
|
5573
5648
|
}
|
|
5574
5649
|
/**
|
|
@@ -6970,6 +7045,22 @@ var Object$1 = class Object$1 {
|
|
|
6970
7045
|
_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(decoded);
|
|
6971
7046
|
}
|
|
6972
7047
|
instance.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization;
|
|
7048
|
+
const _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = [];
|
|
7049
|
+
let _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array = values["https://w3id.org/fep/22cd#translations"];
|
|
7050
|
+
for (const v of _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array == null ? [] : _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array.length === 1 && "@list" in _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array[0] ? _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array[0]["@list"] : _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array) {
|
|
7051
|
+
if (v == null) continue;
|
|
7052
|
+
const decoded = await Translation.fromJsonLd(v, {
|
|
7053
|
+
...options,
|
|
7054
|
+
baseUrl: options.baseUrl
|
|
7055
|
+
});
|
|
7056
|
+
if (typeof decoded === "undefined") {
|
|
7057
|
+
shouldCacheJsonLd = false;
|
|
7058
|
+
continue;
|
|
7059
|
+
}
|
|
7060
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
7061
|
+
_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.push(decoded);
|
|
7062
|
+
}
|
|
7063
|
+
instance.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
6973
7064
|
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
6974
7065
|
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
6975
7066
|
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
@@ -7190,6 +7281,11 @@ var Object$1 = class Object$1 {
|
|
|
7190
7281
|
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
7191
7282
|
} : v);
|
|
7192
7283
|
if (_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length == 1) proxy.announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0];
|
|
7284
|
+
const _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.map((v) => v instanceof URL ? {
|
|
7285
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
7286
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
7287
|
+
} : v);
|
|
7288
|
+
if (_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 1 || !("translation" in proxy) && _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 0) proxy.translations = _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
7193
7289
|
return proxy;
|
|
7194
7290
|
}
|
|
7195
7291
|
};
|
|
@@ -7274,11 +7370,19 @@ var Emoji = class Emoji extends Object$1 {
|
|
|
7274
7370
|
documentLoader: options.contextLoader,
|
|
7275
7371
|
keepFreeFloatingNodes: true
|
|
7276
7372
|
});
|
|
7277
|
-
|
|
7373
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
7278
7374
|
"toot": "http://joinmastodon.org/ns#",
|
|
7279
7375
|
"Emoji": "toot:Emoji"
|
|
7280
7376
|
}];
|
|
7281
|
-
|
|
7377
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
7378
|
+
if (options.context == null) {
|
|
7379
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
7380
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
7381
|
+
if (additionalContexts.length > 0) {
|
|
7382
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
7383
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7282
7386
|
if (docContext != null) {
|
|
7283
7387
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
7284
7388
|
else compacted.proof["@context"] = docContext;
|
|
@@ -7852,7 +7956,7 @@ var ChatMessage = class ChatMessage extends Object$1 {
|
|
|
7852
7956
|
documentLoader: options.contextLoader,
|
|
7853
7957
|
keepFreeFloatingNodes: true
|
|
7854
7958
|
});
|
|
7855
|
-
|
|
7959
|
+
let docContext = options.context ?? [
|
|
7856
7960
|
"https://www.w3.org/ns/activitystreams",
|
|
7857
7961
|
"https://w3id.org/security/data-integrity/v1",
|
|
7858
7962
|
"https://gotosocial.org/ns",
|
|
@@ -7880,7 +7984,15 @@ var ChatMessage = class ChatMessage extends Object$1 {
|
|
|
7880
7984
|
}
|
|
7881
7985
|
}
|
|
7882
7986
|
];
|
|
7883
|
-
|
|
7987
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
7988
|
+
if (options.context == null) {
|
|
7989
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
7990
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
7991
|
+
if (additionalContexts.length > 0) {
|
|
7992
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
7993
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
7994
|
+
}
|
|
7995
|
+
}
|
|
7884
7996
|
if (docContext != null) {
|
|
7885
7997
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
7886
7998
|
else compacted.proof["@context"] = docContext;
|
|
@@ -9442,14 +9554,22 @@ var Activity = class Activity extends Object$1 {
|
|
|
9442
9554
|
documentLoader: options.contextLoader,
|
|
9443
9555
|
keepFreeFloatingNodes: true
|
|
9444
9556
|
});
|
|
9445
|
-
|
|
9557
|
+
let docContext = options.context ?? [
|
|
9446
9558
|
"https://w3id.org/identity/v1",
|
|
9447
9559
|
"https://www.w3.org/ns/activitystreams",
|
|
9448
9560
|
"https://w3id.org/security/v1",
|
|
9449
9561
|
"https://w3id.org/security/data-integrity/v1",
|
|
9450
9562
|
"https://gotosocial.org/ns"
|
|
9451
9563
|
];
|
|
9452
|
-
|
|
9564
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
9565
|
+
if (options.context == null) {
|
|
9566
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
9567
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
9568
|
+
if (additionalContexts.length > 0) {
|
|
9569
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
9570
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
9571
|
+
}
|
|
9572
|
+
}
|
|
9453
9573
|
if (docContext != null) {
|
|
9454
9574
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
9455
9575
|
else compacted.proof["@context"] = docContext;
|
|
@@ -9824,7 +9944,7 @@ var EmojiReact = class EmojiReact extends Activity {
|
|
|
9824
9944
|
documentLoader: options.contextLoader,
|
|
9825
9945
|
keepFreeFloatingNodes: true
|
|
9826
9946
|
});
|
|
9827
|
-
|
|
9947
|
+
let docContext = options.context ?? [
|
|
9828
9948
|
"https://w3id.org/identity/v1",
|
|
9829
9949
|
"https://www.w3.org/ns/activitystreams",
|
|
9830
9950
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -9836,7 +9956,15 @@ var EmojiReact = class EmojiReact extends Activity {
|
|
|
9836
9956
|
"Emoji": "toot:Emoji"
|
|
9837
9957
|
}
|
|
9838
9958
|
];
|
|
9839
|
-
|
|
9959
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
9960
|
+
if (options.context == null) {
|
|
9961
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
9962
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
9963
|
+
if (additionalContexts.length > 0) {
|
|
9964
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
9965
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
9966
|
+
}
|
|
9967
|
+
}
|
|
9840
9968
|
if (docContext != null) {
|
|
9841
9969
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
9842
9970
|
else compacted.proof["@context"] = docContext;
|
|
@@ -10129,12 +10257,20 @@ var PropertyValue = class {
|
|
|
10129
10257
|
documentLoader: options.contextLoader,
|
|
10130
10258
|
keepFreeFloatingNodes: true
|
|
10131
10259
|
});
|
|
10132
|
-
|
|
10260
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
10133
10261
|
"schema": "http://schema.org#",
|
|
10134
10262
|
"PropertyValue": "schema:PropertyValue",
|
|
10135
10263
|
"value": "schema:value"
|
|
10136
10264
|
}];
|
|
10137
|
-
|
|
10265
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10266
|
+
if (options.context == null) {
|
|
10267
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
10268
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
10269
|
+
if (additionalContexts.length > 0) {
|
|
10270
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
10271
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10272
|
+
}
|
|
10273
|
+
}
|
|
10138
10274
|
if (docContext != null) {}
|
|
10139
10275
|
return compacted;
|
|
10140
10276
|
}
|
|
@@ -10454,12 +10590,20 @@ var Measure = class {
|
|
|
10454
10590
|
documentLoader: options.contextLoader,
|
|
10455
10591
|
keepFreeFloatingNodes: true
|
|
10456
10592
|
});
|
|
10457
|
-
|
|
10593
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
10458
10594
|
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
10459
10595
|
"hasUnit": "om2:hasUnit",
|
|
10460
10596
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
10461
10597
|
}];
|
|
10462
|
-
|
|
10598
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10599
|
+
if (options.context == null) {
|
|
10600
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
10601
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
10602
|
+
if (additionalContexts.length > 0) {
|
|
10603
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
10604
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10605
|
+
}
|
|
10606
|
+
}
|
|
10463
10607
|
if (docContext != null) {}
|
|
10464
10608
|
return compacted;
|
|
10465
10609
|
}
|
|
@@ -10996,246 +11140,262 @@ var AnnounceAuthorization = class AnnounceAuthorization extends Object$1 {
|
|
|
10996
11140
|
documentLoader: options.contextLoader,
|
|
10997
11141
|
keepFreeFloatingNodes: true
|
|
10998
11142
|
});
|
|
10999
|
-
|
|
11143
|
+
let docContext = options.context ?? [
|
|
11000
11144
|
"https://www.w3.org/ns/activitystreams",
|
|
11001
11145
|
"https://w3id.org/security/data-integrity/v1",
|
|
11002
11146
|
"https://gotosocial.org/ns"
|
|
11003
11147
|
];
|
|
11004
|
-
|
|
11005
|
-
if (
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
*
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11148
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11149
|
+
if (options.context == null) {
|
|
11150
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
11151
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
11152
|
+
if (additionalContexts.length > 0) {
|
|
11153
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
11154
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
if (docContext != null) {
|
|
11158
|
+
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
11159
|
+
else compacted.proof["@context"] = docContext;
|
|
11160
|
+
}
|
|
11161
|
+
return compacted;
|
|
11162
|
+
}
|
|
11163
|
+
isCompactable() {
|
|
11164
|
+
return super.isCompactable();
|
|
11165
|
+
}
|
|
11166
|
+
/**
|
|
11167
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
11168
|
+
* @param json The JSON-LD structure to convert.
|
|
11169
|
+
* @param options The options to use.
|
|
11170
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
11171
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
11172
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
11173
|
+
* If omitted, the global tracer provider is used.
|
|
11174
|
+
* @returns The object of this type.
|
|
11175
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
11176
|
+
*/
|
|
11177
|
+
static async fromJsonLd(json, options = {}) {
|
|
11178
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
11179
|
+
try {
|
|
11180
|
+
const object = await this.__fromJsonLd__AnnounceAuthorization__(json, span, options);
|
|
11181
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
11182
|
+
return object;
|
|
11183
|
+
} catch (error) {
|
|
11184
|
+
span.setStatus({
|
|
11185
|
+
code: SpanStatusCode.ERROR,
|
|
11186
|
+
message: String(error)
|
|
11187
|
+
});
|
|
11188
|
+
throw error;
|
|
11189
|
+
} finally {
|
|
11190
|
+
span.end();
|
|
11191
|
+
}
|
|
11192
|
+
});
|
|
11193
|
+
}
|
|
11194
|
+
static async __fromJsonLd__AnnounceAuthorization__(json, span, options = {}) {
|
|
11195
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
11196
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
11197
|
+
options = {
|
|
11198
|
+
...options,
|
|
11199
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
11200
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
11201
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
11202
|
+
};
|
|
11203
|
+
let values;
|
|
11204
|
+
let expanded;
|
|
11205
|
+
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
11206
|
+
values = json;
|
|
11207
|
+
expanded = [values];
|
|
11208
|
+
} else if (globalThis.Object.keys(json).length == 0) {
|
|
11209
|
+
values = {};
|
|
11210
|
+
expanded = [values];
|
|
11211
|
+
} else {
|
|
11212
|
+
expanded = await jsonld.expand(json, {
|
|
11213
|
+
documentLoader: options.contextLoader,
|
|
11214
|
+
keepFreeFloatingNodes: true
|
|
11215
|
+
});
|
|
11216
|
+
values = expanded[0] ?? {};
|
|
11217
|
+
}
|
|
11218
|
+
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
11219
|
+
if (id != null && options.baseUrl == null) options = {
|
|
11220
|
+
...options,
|
|
11221
|
+
baseUrl: id
|
|
11222
|
+
};
|
|
11223
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
11224
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
11225
|
+
if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
11226
|
+
}
|
|
11227
|
+
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
11228
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
11229
|
+
const superValues = structuredClone(values);
|
|
11230
|
+
delete superValues["@type"];
|
|
11231
|
+
const instance = await super.fromJsonLd(superValues, {
|
|
11232
|
+
...options,
|
|
11233
|
+
_fromSubclass: true
|
|
11234
|
+
});
|
|
11235
|
+
if (!(instance instanceof AnnounceAuthorization)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
11236
|
+
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
11237
|
+
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [];
|
|
11238
|
+
let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"];
|
|
11239
|
+
for (const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array) {
|
|
11240
|
+
if (v == null) continue;
|
|
11241
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11242
|
+
if (v["@id"].startsWith("_:")) continue;
|
|
11243
|
+
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(parseIri(v["@id"], options.baseUrl));
|
|
11244
|
+
continue;
|
|
11245
|
+
}
|
|
11246
|
+
const decoded = await Object$1.fromJsonLd(v, {
|
|
11247
|
+
...options,
|
|
11248
|
+
baseUrl: options.baseUrl
|
|
11249
|
+
});
|
|
11250
|
+
if (typeof decoded === "undefined") {
|
|
11251
|
+
shouldCacheJsonLd = false;
|
|
11252
|
+
continue;
|
|
11253
|
+
}
|
|
11254
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11255
|
+
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded);
|
|
11256
|
+
}
|
|
11257
|
+
instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;
|
|
11258
|
+
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [];
|
|
11259
|
+
let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"];
|
|
11260
|
+
for (const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array) {
|
|
11261
|
+
if (v == null) continue;
|
|
11262
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11263
|
+
if (v["@id"].startsWith("_:")) continue;
|
|
11264
|
+
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(parseIri(v["@id"], options.baseUrl));
|
|
11265
|
+
continue;
|
|
11266
|
+
}
|
|
11267
|
+
const decoded = await Object$1.fromJsonLd(v, {
|
|
11268
|
+
...options,
|
|
11269
|
+
baseUrl: options.baseUrl
|
|
11270
|
+
});
|
|
11271
|
+
if (typeof decoded === "undefined") {
|
|
11272
|
+
shouldCacheJsonLd = false;
|
|
11273
|
+
continue;
|
|
11274
|
+
}
|
|
11275
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11276
|
+
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded);
|
|
11277
|
+
}
|
|
11278
|
+
instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;
|
|
11279
|
+
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
11280
|
+
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
11281
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
11282
|
+
const compactArray = Array.isArray(json) && json.length === 1;
|
|
11283
|
+
const jsonLd = compactArray ? json[0] : json;
|
|
11284
|
+
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
11285
|
+
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
11286
|
+
} else instance._cachedJsonLd = structuredClone(json);
|
|
11287
|
+
} catch {
|
|
11288
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
11289
|
+
}
|
|
11290
|
+
return instance;
|
|
11291
|
+
}
|
|
11292
|
+
_getCustomInspectProxy() {
|
|
11293
|
+
const proxy = super._getCustomInspectProxy();
|
|
11294
|
+
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.map((v) => v instanceof URL ? {
|
|
11295
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11296
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11297
|
+
} : v);
|
|
11298
|
+
if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0];
|
|
11299
|
+
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.map((v) => v instanceof URL ? {
|
|
11300
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11301
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11302
|
+
} : v);
|
|
11303
|
+
if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0];
|
|
11304
|
+
return proxy;
|
|
11305
|
+
}
|
|
11306
|
+
};
|
|
11307
|
+
AnnounceAuthorization.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
11308
|
+
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11309
|
+
};
|
|
11310
|
+
AnnounceAuthorization.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
11311
|
+
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11312
|
+
};
|
|
11313
|
+
/** A request to announce (boost) a post that requires approval from
|
|
11314
|
+
* the post author.
|
|
11315
|
+
*
|
|
11316
|
+
* The `object` property references the post to be announced, and
|
|
11317
|
+
* the `instrument` property contains the {@link Announce} activity itself.
|
|
11318
|
+
*
|
|
11319
|
+
* The post author responds with an {@link Accept} (with an
|
|
11320
|
+
* {@link AnnounceAuthorization} as `result`) or a {@link Reject}.
|
|
11321
|
+
*
|
|
11322
|
+
* See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/)
|
|
11323
|
+
* for details.
|
|
11324
|
+
*/
|
|
11325
|
+
var AnnounceRequest = class AnnounceRequest extends Activity {
|
|
11326
|
+
/**
|
|
11327
|
+
* The type URI of {@link AnnounceRequest}: `https://gotosocial.org/ns#AnnounceRequest`.
|
|
11328
|
+
*/
|
|
11329
|
+
static get typeId() {
|
|
11330
|
+
return new URL("https://gotosocial.org/ns#AnnounceRequest");
|
|
11331
|
+
}
|
|
11332
|
+
/**
|
|
11333
|
+
* Constructs a new instance of AnnounceRequest with the given values.
|
|
11334
|
+
* @param values The values to initialize the instance with.
|
|
11335
|
+
* @param options The options to use for initialization.
|
|
11336
|
+
*/
|
|
11337
|
+
constructor(values, options = {}) {
|
|
11338
|
+
super(values, options);
|
|
11339
|
+
}
|
|
11340
|
+
/**
|
|
11341
|
+
* Clones this instance, optionally updating it with the given values.
|
|
11342
|
+
* @param values The values to update the clone with.
|
|
11343
|
+
* @param options The options to use for cloning.
|
|
11344
|
+
* @returns The cloned instance.
|
|
11345
|
+
*/
|
|
11346
|
+
clone(values = {}, options = {}) {
|
|
11347
|
+
if (this._warning != null) {
|
|
11348
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
11349
|
+
options = {
|
|
11350
|
+
...options,
|
|
11351
|
+
$warning: this._warning
|
|
11352
|
+
};
|
|
11353
|
+
}
|
|
11354
|
+
return super.clone(values, options);
|
|
11355
|
+
}
|
|
11356
|
+
/**
|
|
11357
|
+
* Converts this object to a JSON-LD structure.
|
|
11358
|
+
* @param options The options to use.
|
|
11359
|
+
* - `format`: The format of the output: `compact` or
|
|
11360
|
+
`expand`.
|
|
11361
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
11362
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
11363
|
+
when `format` is set to `'expand'`.
|
|
11364
|
+
* @returns The JSON-LD representation of this object.
|
|
11365
|
+
*/
|
|
11366
|
+
async toJsonLd(options = {}) {
|
|
11367
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
11368
|
+
if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
|
|
11369
|
+
options = {
|
|
11370
|
+
...options,
|
|
11371
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
11372
|
+
};
|
|
11373
|
+
const values = (await super.toJsonLd({
|
|
11374
|
+
...options,
|
|
11375
|
+
format: "expand",
|
|
11376
|
+
context: void 0
|
|
11377
|
+
}))[0];
|
|
11378
|
+
values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"];
|
|
11379
|
+
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
11380
|
+
if (options.format === "expand") return await jsonld.expand(values, {
|
|
11381
|
+
documentLoader: options.contextLoader,
|
|
11382
|
+
keepFreeFloatingNodes: true
|
|
11383
|
+
});
|
|
11384
|
+
let docContext = options.context ?? [
|
|
11385
|
+
"https://w3id.org/identity/v1",
|
|
11386
|
+
"https://www.w3.org/ns/activitystreams",
|
|
11387
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
11388
|
+
"https://gotosocial.org/ns"
|
|
11389
|
+
];
|
|
11390
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11391
|
+
if (options.context == null) {
|
|
11392
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
11393
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
11394
|
+
if (additionalContexts.length > 0) {
|
|
11395
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
11396
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11039
11397
|
}
|
|
11040
|
-
});
|
|
11041
|
-
}
|
|
11042
|
-
static async __fromJsonLd__AnnounceAuthorization__(json, span, options = {}) {
|
|
11043
|
-
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
11044
|
-
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
11045
|
-
options = {
|
|
11046
|
-
...options,
|
|
11047
|
-
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
11048
|
-
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
11049
|
-
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
11050
|
-
};
|
|
11051
|
-
let values;
|
|
11052
|
-
let expanded;
|
|
11053
|
-
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
11054
|
-
values = json;
|
|
11055
|
-
expanded = [values];
|
|
11056
|
-
} else if (globalThis.Object.keys(json).length == 0) {
|
|
11057
|
-
values = {};
|
|
11058
|
-
expanded = [values];
|
|
11059
|
-
} else {
|
|
11060
|
-
expanded = await jsonld.expand(json, {
|
|
11061
|
-
documentLoader: options.contextLoader,
|
|
11062
|
-
keepFreeFloatingNodes: true
|
|
11063
|
-
});
|
|
11064
|
-
values = expanded[0] ?? {};
|
|
11065
11398
|
}
|
|
11066
|
-
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
11067
|
-
if (id != null && options.baseUrl == null) options = {
|
|
11068
|
-
...options,
|
|
11069
|
-
baseUrl: id
|
|
11070
|
-
};
|
|
11071
|
-
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
11072
|
-
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
11073
|
-
if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
11074
|
-
}
|
|
11075
|
-
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
11076
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
11077
|
-
const superValues = structuredClone(values);
|
|
11078
|
-
delete superValues["@type"];
|
|
11079
|
-
const instance = await super.fromJsonLd(superValues, {
|
|
11080
|
-
...options,
|
|
11081
|
-
_fromSubclass: true
|
|
11082
|
-
});
|
|
11083
|
-
if (!(instance instanceof AnnounceAuthorization)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
11084
|
-
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
11085
|
-
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [];
|
|
11086
|
-
let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"];
|
|
11087
|
-
for (const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array) {
|
|
11088
|
-
if (v == null) continue;
|
|
11089
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11090
|
-
if (v["@id"].startsWith("_:")) continue;
|
|
11091
|
-
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(parseIri(v["@id"], options.baseUrl));
|
|
11092
|
-
continue;
|
|
11093
|
-
}
|
|
11094
|
-
const decoded = await Object$1.fromJsonLd(v, {
|
|
11095
|
-
...options,
|
|
11096
|
-
baseUrl: options.baseUrl
|
|
11097
|
-
});
|
|
11098
|
-
if (typeof decoded === "undefined") {
|
|
11099
|
-
shouldCacheJsonLd = false;
|
|
11100
|
-
continue;
|
|
11101
|
-
}
|
|
11102
|
-
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11103
|
-
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded);
|
|
11104
|
-
}
|
|
11105
|
-
instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;
|
|
11106
|
-
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [];
|
|
11107
|
-
let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"];
|
|
11108
|
-
for (const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array) {
|
|
11109
|
-
if (v == null) continue;
|
|
11110
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11111
|
-
if (v["@id"].startsWith("_:")) continue;
|
|
11112
|
-
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(parseIri(v["@id"], options.baseUrl));
|
|
11113
|
-
continue;
|
|
11114
|
-
}
|
|
11115
|
-
const decoded = await Object$1.fromJsonLd(v, {
|
|
11116
|
-
...options,
|
|
11117
|
-
baseUrl: options.baseUrl
|
|
11118
|
-
});
|
|
11119
|
-
if (typeof decoded === "undefined") {
|
|
11120
|
-
shouldCacheJsonLd = false;
|
|
11121
|
-
continue;
|
|
11122
|
-
}
|
|
11123
|
-
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11124
|
-
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded);
|
|
11125
|
-
}
|
|
11126
|
-
instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;
|
|
11127
|
-
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
11128
|
-
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
11129
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
11130
|
-
const compactArray = Array.isArray(json) && json.length === 1;
|
|
11131
|
-
const jsonLd = compactArray ? json[0] : json;
|
|
11132
|
-
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
11133
|
-
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
11134
|
-
} else instance._cachedJsonLd = structuredClone(json);
|
|
11135
|
-
} catch {
|
|
11136
|
-
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
11137
|
-
}
|
|
11138
|
-
return instance;
|
|
11139
|
-
}
|
|
11140
|
-
_getCustomInspectProxy() {
|
|
11141
|
-
const proxy = super._getCustomInspectProxy();
|
|
11142
|
-
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.map((v) => v instanceof URL ? {
|
|
11143
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11144
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11145
|
-
} : v);
|
|
11146
|
-
if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0];
|
|
11147
|
-
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.map((v) => v instanceof URL ? {
|
|
11148
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11149
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11150
|
-
} : v);
|
|
11151
|
-
if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0];
|
|
11152
|
-
return proxy;
|
|
11153
|
-
}
|
|
11154
|
-
};
|
|
11155
|
-
AnnounceAuthorization.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
11156
|
-
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11157
|
-
};
|
|
11158
|
-
AnnounceAuthorization.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
11159
|
-
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11160
|
-
};
|
|
11161
|
-
/** A request to announce (boost) a post that requires approval from
|
|
11162
|
-
* the post author.
|
|
11163
|
-
*
|
|
11164
|
-
* The `object` property references the post to be announced, and
|
|
11165
|
-
* the `instrument` property contains the {@link Announce} activity itself.
|
|
11166
|
-
*
|
|
11167
|
-
* The post author responds with an {@link Accept} (with an
|
|
11168
|
-
* {@link AnnounceAuthorization} as `result`) or a {@link Reject}.
|
|
11169
|
-
*
|
|
11170
|
-
* See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/)
|
|
11171
|
-
* for details.
|
|
11172
|
-
*/
|
|
11173
|
-
var AnnounceRequest = class AnnounceRequest extends Activity {
|
|
11174
|
-
/**
|
|
11175
|
-
* The type URI of {@link AnnounceRequest}: `https://gotosocial.org/ns#AnnounceRequest`.
|
|
11176
|
-
*/
|
|
11177
|
-
static get typeId() {
|
|
11178
|
-
return new URL("https://gotosocial.org/ns#AnnounceRequest");
|
|
11179
|
-
}
|
|
11180
|
-
/**
|
|
11181
|
-
* Constructs a new instance of AnnounceRequest with the given values.
|
|
11182
|
-
* @param values The values to initialize the instance with.
|
|
11183
|
-
* @param options The options to use for initialization.
|
|
11184
|
-
*/
|
|
11185
|
-
constructor(values, options = {}) {
|
|
11186
|
-
super(values, options);
|
|
11187
|
-
}
|
|
11188
|
-
/**
|
|
11189
|
-
* Clones this instance, optionally updating it with the given values.
|
|
11190
|
-
* @param values The values to update the clone with.
|
|
11191
|
-
* @param options The options to use for cloning.
|
|
11192
|
-
* @returns The cloned instance.
|
|
11193
|
-
*/
|
|
11194
|
-
clone(values = {}, options = {}) {
|
|
11195
|
-
if (this._warning != null) {
|
|
11196
|
-
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
11197
|
-
options = {
|
|
11198
|
-
...options,
|
|
11199
|
-
$warning: this._warning
|
|
11200
|
-
};
|
|
11201
|
-
}
|
|
11202
|
-
return super.clone(values, options);
|
|
11203
|
-
}
|
|
11204
|
-
/**
|
|
11205
|
-
* Converts this object to a JSON-LD structure.
|
|
11206
|
-
* @param options The options to use.
|
|
11207
|
-
* - `format`: The format of the output: `compact` or
|
|
11208
|
-
`expand`.
|
|
11209
|
-
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
11210
|
-
* - `context`: The JSON-LD context to use. Not applicable
|
|
11211
|
-
when `format` is set to `'expand'`.
|
|
11212
|
-
* @returns The JSON-LD representation of this object.
|
|
11213
|
-
*/
|
|
11214
|
-
async toJsonLd(options = {}) {
|
|
11215
|
-
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
11216
|
-
if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
|
|
11217
|
-
options = {
|
|
11218
|
-
...options,
|
|
11219
|
-
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
11220
|
-
};
|
|
11221
|
-
const values = (await super.toJsonLd({
|
|
11222
|
-
...options,
|
|
11223
|
-
format: "expand",
|
|
11224
|
-
context: void 0
|
|
11225
|
-
}))[0];
|
|
11226
|
-
values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"];
|
|
11227
|
-
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
11228
|
-
if (options.format === "expand") return await jsonld.expand(values, {
|
|
11229
|
-
documentLoader: options.contextLoader,
|
|
11230
|
-
keepFreeFloatingNodes: true
|
|
11231
|
-
});
|
|
11232
|
-
const docContext = options.context ?? [
|
|
11233
|
-
"https://w3id.org/identity/v1",
|
|
11234
|
-
"https://www.w3.org/ns/activitystreams",
|
|
11235
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
11236
|
-
"https://gotosocial.org/ns"
|
|
11237
|
-
];
|
|
11238
|
-
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11239
11399
|
if (docContext != null) {
|
|
11240
11400
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
11241
11401
|
else compacted.proof["@context"] = docContext;
|
|
@@ -11585,8 +11745,16 @@ var InteractionPolicy = class {
|
|
|
11585
11745
|
documentLoader: options.contextLoader,
|
|
11586
11746
|
keepFreeFloatingNodes: true
|
|
11587
11747
|
});
|
|
11588
|
-
|
|
11589
|
-
|
|
11748
|
+
let docContext = options.context ?? ["https://gotosocial.org/ns", "https://w3id.org/fep/7aa9"];
|
|
11749
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11750
|
+
if (options.context == null) {
|
|
11751
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
11752
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
11753
|
+
if (additionalContexts.length > 0) {
|
|
11754
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
11755
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11756
|
+
}
|
|
11757
|
+
}
|
|
11590
11758
|
if (docContext != null) {}
|
|
11591
11759
|
return compacted;
|
|
11592
11760
|
}
|
|
@@ -12002,8 +12170,16 @@ var InteractionRule = class {
|
|
|
12002
12170
|
documentLoader: options.contextLoader,
|
|
12003
12171
|
keepFreeFloatingNodes: true
|
|
12004
12172
|
});
|
|
12005
|
-
|
|
12006
|
-
|
|
12173
|
+
let docContext = options.context ?? "https://gotosocial.org/ns";
|
|
12174
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12175
|
+
if (options.context == null) {
|
|
12176
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
12177
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
12178
|
+
if (additionalContexts.length > 0) {
|
|
12179
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
12180
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12181
|
+
}
|
|
12182
|
+
}
|
|
12007
12183
|
if (docContext != null) {}
|
|
12008
12184
|
return compacted;
|
|
12009
12185
|
}
|
|
@@ -12541,12 +12717,20 @@ var LikeAuthorization = class LikeAuthorization extends Object$1 {
|
|
|
12541
12717
|
documentLoader: options.contextLoader,
|
|
12542
12718
|
keepFreeFloatingNodes: true
|
|
12543
12719
|
});
|
|
12544
|
-
|
|
12720
|
+
let docContext = options.context ?? [
|
|
12545
12721
|
"https://www.w3.org/ns/activitystreams",
|
|
12546
12722
|
"https://w3id.org/security/data-integrity/v1",
|
|
12547
12723
|
"https://gotosocial.org/ns"
|
|
12548
12724
|
];
|
|
12549
|
-
|
|
12725
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12726
|
+
if (options.context == null) {
|
|
12727
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
12728
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
12729
|
+
if (additionalContexts.length > 0) {
|
|
12730
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
12731
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12732
|
+
}
|
|
12733
|
+
}
|
|
12550
12734
|
if (docContext != null) {
|
|
12551
12735
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
12552
12736
|
else compacted.proof["@context"] = docContext;
|
|
@@ -12773,13 +12957,21 @@ var LikeRequest = class LikeRequest extends Activity {
|
|
|
12773
12957
|
documentLoader: options.contextLoader,
|
|
12774
12958
|
keepFreeFloatingNodes: true
|
|
12775
12959
|
});
|
|
12776
|
-
|
|
12960
|
+
let docContext = options.context ?? [
|
|
12777
12961
|
"https://w3id.org/identity/v1",
|
|
12778
12962
|
"https://www.w3.org/ns/activitystreams",
|
|
12779
12963
|
"https://w3id.org/security/data-integrity/v1",
|
|
12780
12964
|
"https://gotosocial.org/ns"
|
|
12781
12965
|
];
|
|
12782
|
-
|
|
12966
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12967
|
+
if (options.context == null) {
|
|
12968
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
12969
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
12970
|
+
if (additionalContexts.length > 0) {
|
|
12971
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
12972
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12973
|
+
}
|
|
12974
|
+
}
|
|
12783
12975
|
if (docContext != null) {
|
|
12784
12976
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
12785
12977
|
else compacted.proof["@context"] = docContext;
|
|
@@ -13283,12 +13475,20 @@ var ReplyAuthorization = class ReplyAuthorization extends Object$1 {
|
|
|
13283
13475
|
documentLoader: options.contextLoader,
|
|
13284
13476
|
keepFreeFloatingNodes: true
|
|
13285
13477
|
});
|
|
13286
|
-
|
|
13478
|
+
let docContext = options.context ?? [
|
|
13287
13479
|
"https://www.w3.org/ns/activitystreams",
|
|
13288
13480
|
"https://w3id.org/security/data-integrity/v1",
|
|
13289
13481
|
"https://gotosocial.org/ns"
|
|
13290
13482
|
];
|
|
13291
|
-
|
|
13483
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13484
|
+
if (options.context == null) {
|
|
13485
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
13486
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
13487
|
+
if (additionalContexts.length > 0) {
|
|
13488
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
13489
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13490
|
+
}
|
|
13491
|
+
}
|
|
13292
13492
|
if (docContext != null) {
|
|
13293
13493
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
13294
13494
|
else compacted.proof["@context"] = docContext;
|
|
@@ -13515,13 +13715,21 @@ var ReplyRequest = class ReplyRequest extends Activity {
|
|
|
13515
13715
|
documentLoader: options.contextLoader,
|
|
13516
13716
|
keepFreeFloatingNodes: true
|
|
13517
13717
|
});
|
|
13518
|
-
|
|
13718
|
+
let docContext = options.context ?? [
|
|
13519
13719
|
"https://w3id.org/identity/v1",
|
|
13520
13720
|
"https://www.w3.org/ns/activitystreams",
|
|
13521
13721
|
"https://w3id.org/security/data-integrity/v1",
|
|
13522
13722
|
"https://gotosocial.org/ns"
|
|
13523
13723
|
];
|
|
13524
|
-
|
|
13724
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13725
|
+
if (options.context == null) {
|
|
13726
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
13727
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
13728
|
+
if (additionalContexts.length > 0) {
|
|
13729
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
13730
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13731
|
+
}
|
|
13732
|
+
}
|
|
13525
13733
|
if (docContext != null) {
|
|
13526
13734
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
13527
13735
|
else compacted.proof["@context"] = docContext;
|
|
@@ -14025,13 +14233,21 @@ var QuoteAuthorization = class QuoteAuthorization extends Object$1 {
|
|
|
14025
14233
|
documentLoader: options.contextLoader,
|
|
14026
14234
|
keepFreeFloatingNodes: true
|
|
14027
14235
|
});
|
|
14028
|
-
|
|
14236
|
+
let docContext = options.context ?? [
|
|
14029
14237
|
"https://www.w3.org/ns/activitystreams",
|
|
14030
14238
|
"https://w3id.org/security/data-integrity/v1",
|
|
14031
14239
|
"https://gotosocial.org/ns",
|
|
14032
14240
|
{ "QuoteAuthorization": "https://w3id.org/fep/044f#QuoteAuthorization" }
|
|
14033
14241
|
];
|
|
14034
|
-
|
|
14242
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14243
|
+
if (options.context == null) {
|
|
14244
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
14245
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
14246
|
+
if (additionalContexts.length > 0) {
|
|
14247
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
14248
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14249
|
+
}
|
|
14250
|
+
}
|
|
14035
14251
|
if (docContext != null) {
|
|
14036
14252
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14037
14253
|
else compacted.proof["@context"] = docContext;
|
|
@@ -14258,7 +14474,7 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14258
14474
|
documentLoader: options.contextLoader,
|
|
14259
14475
|
keepFreeFloatingNodes: true
|
|
14260
14476
|
});
|
|
14261
|
-
|
|
14477
|
+
let docContext = options.context ?? [
|
|
14262
14478
|
"https://w3id.org/identity/v1",
|
|
14263
14479
|
"https://www.w3.org/ns/activitystreams",
|
|
14264
14480
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -14294,7 +14510,15 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14294
14510
|
}
|
|
14295
14511
|
}
|
|
14296
14512
|
];
|
|
14297
|
-
|
|
14513
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14514
|
+
if (options.context == null) {
|
|
14515
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
14516
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
14517
|
+
if (additionalContexts.length > 0) {
|
|
14518
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
14519
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14520
|
+
}
|
|
14521
|
+
}
|
|
14298
14522
|
if (docContext != null) {
|
|
14299
14523
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14300
14524
|
else compacted.proof["@context"] = docContext;
|
|
@@ -14363,18 +14587,816 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14363
14587
|
};
|
|
14364
14588
|
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
14365
14589
|
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
14366
|
-
if (!values["@type"].includes("https://w3id.org/fep/044f#QuoteRequest")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14590
|
+
if (!values["@type"].includes("https://w3id.org/fep/044f#QuoteRequest")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14591
|
+
}
|
|
14592
|
+
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
14593
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
14594
|
+
const superValues = structuredClone(values);
|
|
14595
|
+
delete superValues["@type"];
|
|
14596
|
+
const instance = await super.fromJsonLd(superValues, {
|
|
14597
|
+
...options,
|
|
14598
|
+
_fromSubclass: true
|
|
14599
|
+
});
|
|
14600
|
+
if (!(instance instanceof QuoteRequest)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
14601
|
+
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
14602
|
+
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
14603
|
+
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
14604
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
14605
|
+
const compactArray = Array.isArray(json) && json.length === 1;
|
|
14606
|
+
const jsonLd = compactArray ? json[0] : json;
|
|
14607
|
+
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
14608
|
+
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
14609
|
+
} else instance._cachedJsonLd = structuredClone(json);
|
|
14610
|
+
} catch {
|
|
14611
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
14612
|
+
}
|
|
14613
|
+
return instance;
|
|
14614
|
+
}
|
|
14615
|
+
_getCustomInspectProxy() {
|
|
14616
|
+
return super._getCustomInspectProxy();
|
|
14617
|
+
}
|
|
14618
|
+
};
|
|
14619
|
+
QuoteRequest.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
14620
|
+
return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
|
|
14621
|
+
};
|
|
14622
|
+
QuoteRequest.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
14623
|
+
return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
|
|
14624
|
+
};
|
|
14625
|
+
/** Translator credit and source freshness for one language version of an
|
|
14626
|
+
* {@link Object}, as defined by the draft
|
|
14627
|
+
* [FEP-22cd](https://w3id.org/fep/22cd). This is embedded metadata, not an
|
|
14628
|
+
* independent post or activity target. Its optional identifier need not be
|
|
14629
|
+
* dereferenceable and does not establish trust in embedded translator actors.
|
|
14630
|
+
*
|
|
14631
|
+
* Targets [draft revision 6d0d6559](https://codeberg.org/fediverse/fep/src/commit/6d0d6559054baeb7b71a5f2bdc14fc4c09b66f39/fep/22cd/fep-22cd.md).
|
|
14632
|
+
*/
|
|
14633
|
+
var Translation = class {
|
|
14634
|
+
#documentLoader;
|
|
14635
|
+
#contextLoader;
|
|
14636
|
+
#tracerProvider;
|
|
14637
|
+
#warning;
|
|
14638
|
+
#cachedJsonLd;
|
|
14639
|
+
#_baseUrl;
|
|
14640
|
+
#shouldCacheJsonLd = true;
|
|
14641
|
+
id;
|
|
14642
|
+
get _documentLoader() {
|
|
14643
|
+
return this.#documentLoader;
|
|
14644
|
+
}
|
|
14645
|
+
get _contextLoader() {
|
|
14646
|
+
return this.#contextLoader;
|
|
14647
|
+
}
|
|
14648
|
+
get _tracerProvider() {
|
|
14649
|
+
return this.#tracerProvider;
|
|
14650
|
+
}
|
|
14651
|
+
get _warning() {
|
|
14652
|
+
return this.#warning;
|
|
14653
|
+
}
|
|
14654
|
+
get _cachedJsonLd() {
|
|
14655
|
+
return this.#cachedJsonLd;
|
|
14656
|
+
}
|
|
14657
|
+
set _cachedJsonLd(value) {
|
|
14658
|
+
this.#cachedJsonLd = value;
|
|
14659
|
+
}
|
|
14660
|
+
get _baseUrl() {
|
|
14661
|
+
return this.#_baseUrl;
|
|
14662
|
+
}
|
|
14663
|
+
get _shouldCacheJsonLd() {
|
|
14664
|
+
return this.#shouldCacheJsonLd;
|
|
14665
|
+
}
|
|
14666
|
+
set _shouldCacheJsonLd(value) {
|
|
14667
|
+
this.#shouldCacheJsonLd = value;
|
|
14668
|
+
}
|
|
14669
|
+
static _shouldCacheDecodedJsonLd(value) {
|
|
14670
|
+
if (value == null || typeof value !== "object") return true;
|
|
14671
|
+
if (!("_shouldCacheJsonLd" in value)) return true;
|
|
14672
|
+
return value._shouldCacheJsonLd;
|
|
14673
|
+
}
|
|
14674
|
+
/**
|
|
14675
|
+
* The type URI of {@link Translation}: `https://w3id.org/fep/22cd#Translation`.
|
|
14676
|
+
*/
|
|
14677
|
+
static get typeId() {
|
|
14678
|
+
return new URL("https://w3id.org/fep/22cd#Translation");
|
|
14679
|
+
}
|
|
14680
|
+
#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [];
|
|
14681
|
+
#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [];
|
|
14682
|
+
#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set();
|
|
14683
|
+
#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [];
|
|
14684
|
+
#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [];
|
|
14685
|
+
#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [];
|
|
14686
|
+
#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [];
|
|
14687
|
+
/**
|
|
14688
|
+
* Constructs a new instance of Translation with the given values.
|
|
14689
|
+
* @param values The values to initialize the instance with.
|
|
14690
|
+
* @param options The options to use for initialization.
|
|
14691
|
+
*/
|
|
14692
|
+
constructor(values, options = {}) {
|
|
14693
|
+
this.#documentLoader = options.documentLoader;
|
|
14694
|
+
this.#contextLoader = options.contextLoader;
|
|
14695
|
+
this.#tracerProvider = options.tracerProvider;
|
|
14696
|
+
const baseUrl = options.baseUrl;
|
|
14697
|
+
this.#_baseUrl = baseUrl == null ? void 0 : new URL(baseUrl.href);
|
|
14698
|
+
if ("$warning" in options) this.#warning = options.$warning;
|
|
14699
|
+
if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
|
|
14700
|
+
else throw new TypeError("The id must be a URL.");
|
|
14701
|
+
if ("language" in values && values.language != null) if (values.language instanceof Intl.Locale) this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [values.language];
|
|
14702
|
+
else throw new TypeError("The language must be of type Intl.Locale.");
|
|
14703
|
+
if ("translator" in values && values.translator != null) if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) {
|
|
14704
|
+
this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator];
|
|
14705
|
+
this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(0);
|
|
14706
|
+
} else throw new TypeError("The translator must be of type Application | Group | Organization | Person | Service | URL.");
|
|
14707
|
+
if ("translators" in values && values.translators != null) {
|
|
14708
|
+
if ("translator" in values && values.translator != null) throw new TypeError("Cannot initialize both translator and translators at the same time.");
|
|
14709
|
+
if (Array.isArray(values.translators) && values.translators.every((v) => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) {
|
|
14710
|
+
this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators;
|
|
14711
|
+
for (let i = 0; i < values.translators.length; i++) this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
|
|
14712
|
+
} else throw new TypeError("The translators must be an array of type Application | Group | Organization | Person | Service | URL.");
|
|
14713
|
+
}
|
|
14714
|
+
if ("original" in values && values.original != null) if (values.original instanceof URL) this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [values.original];
|
|
14715
|
+
else throw new TypeError("The original must be of type URL.");
|
|
14716
|
+
if ("sourceUpdated" in values && values.sourceUpdated != null) if (isTemporalInstant(values.sourceUpdated)) this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [values.sourceUpdated];
|
|
14717
|
+
else throw new TypeError("The sourceUpdated must be of type Temporal.Instant.");
|
|
14718
|
+
if ("basis" in values && values.basis != null) if (values.basis instanceof URL) this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [values.basis];
|
|
14719
|
+
else throw new TypeError("The basis must be of type URL.");
|
|
14720
|
+
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
14721
|
+
else throw new TypeError("The url must be of type URL | Link.");
|
|
14722
|
+
if ("urls" in values && values.urls != null) {
|
|
14723
|
+
if ("url" in values && values.url != null) throw new TypeError("Cannot initialize both url and urls at the same time.");
|
|
14724
|
+
if (Array.isArray(values.urls) && values.urls.every((v) => v instanceof URL || v instanceof Link)) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls;
|
|
14725
|
+
else throw new TypeError("The urls must be an array of type URL | Link.");
|
|
14726
|
+
}
|
|
14727
|
+
}
|
|
14728
|
+
/**
|
|
14729
|
+
* Clones this instance, optionally updating it with the given values.
|
|
14730
|
+
* @param values The values to update the clone with.
|
|
14731
|
+
* @param options The options to use for cloning.
|
|
14732
|
+
* @returns The cloned instance.
|
|
14733
|
+
*/
|
|
14734
|
+
clone(values = {}, options = {}) {
|
|
14735
|
+
if (this._warning != null) {
|
|
14736
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14737
|
+
options = {
|
|
14738
|
+
...options,
|
|
14739
|
+
$warning: this._warning
|
|
14740
|
+
};
|
|
14741
|
+
}
|
|
14742
|
+
const clone = new this.constructor({ id: values.id ?? this.id }, options);
|
|
14743
|
+
clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG;
|
|
14744
|
+
if ("language" in values && values.language != null) if (values.language instanceof Intl.Locale) clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [values.language];
|
|
14745
|
+
else throw new TypeError("The language must be of type Intl.Locale.");
|
|
14746
|
+
clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
14747
|
+
clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR);
|
|
14748
|
+
if ("translator" in values && values.translator != null) if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) {
|
|
14749
|
+
clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator];
|
|
14750
|
+
clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set([0]);
|
|
14751
|
+
} else throw new TypeError("The translator must be of type Application | Group | Organization | Person | Service | URL.");
|
|
14752
|
+
if ("translators" in values && values.translators != null) {
|
|
14753
|
+
if ("translator" in values && values.translator != null) throw new TypeError("Cannot update both translator and translators at the same time.");
|
|
14754
|
+
if (Array.isArray(values.translators) && values.translators.every((v) => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) {
|
|
14755
|
+
clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators;
|
|
14756
|
+
clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set();
|
|
14757
|
+
for (let i = 0; i < values.translators.length; i++) clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
|
|
14758
|
+
} else throw new TypeError("The translators must be an array of type Application | Group | Organization | Person | Service | URL.");
|
|
14759
|
+
}
|
|
14760
|
+
clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7;
|
|
14761
|
+
if ("original" in values && values.original != null) if (values.original instanceof URL) clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [values.original];
|
|
14762
|
+
else throw new TypeError("The original must be of type URL.");
|
|
14763
|
+
clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated;
|
|
14764
|
+
if ("sourceUpdated" in values && values.sourceUpdated != null) if (isTemporalInstant(values.sourceUpdated)) clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [values.sourceUpdated];
|
|
14765
|
+
else throw new TypeError("The sourceUpdated must be of type Temporal.Instant.");
|
|
14766
|
+
clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW;
|
|
14767
|
+
if ("basis" in values && values.basis != null) if (values.basis instanceof URL) clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [values.basis];
|
|
14768
|
+
else throw new TypeError("The basis must be of type URL.");
|
|
14769
|
+
clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
14770
|
+
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
14771
|
+
else throw new TypeError("The url must be of type URL | Link.");
|
|
14772
|
+
if ("urls" in values && values.urls != null) {
|
|
14773
|
+
if ("url" in values && values.url != null) throw new TypeError("Cannot update both url and urls at the same time.");
|
|
14774
|
+
if (Array.isArray(values.urls) && values.urls.every((v) => v instanceof URL || v instanceof Link)) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls;
|
|
14775
|
+
else throw new TypeError("The urls must be an array of type URL | Link.");
|
|
14776
|
+
}
|
|
14777
|
+
return clone;
|
|
14778
|
+
}
|
|
14779
|
+
/** The translated language. Publishers must match a language in the
|
|
14780
|
+
* containing object's content, name, or summary map.
|
|
14781
|
+
*/
|
|
14782
|
+
get language() {
|
|
14783
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14784
|
+
if (this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < 1) return null;
|
|
14785
|
+
return this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG[0];
|
|
14786
|
+
}
|
|
14787
|
+
async #fetchTranslator(url, options = {}) {
|
|
14788
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader();
|
|
14789
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ?? getDocumentLoader();
|
|
14790
|
+
const tracerProvider = options.tracerProvider ?? this._tracerProvider ?? trace.getTracerProvider();
|
|
14791
|
+
return await tracerProvider.getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
14792
|
+
const lookupUrl = formatIri(url);
|
|
14793
|
+
let fetchResult;
|
|
14794
|
+
try {
|
|
14795
|
+
fetchResult = await documentLoader(lookupUrl);
|
|
14796
|
+
} catch (error) {
|
|
14797
|
+
span.setStatus({
|
|
14798
|
+
code: SpanStatusCode.ERROR,
|
|
14799
|
+
message: String(error)
|
|
14800
|
+
});
|
|
14801
|
+
span.end();
|
|
14802
|
+
if (options.suppressError) {
|
|
14803
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", {
|
|
14804
|
+
error,
|
|
14805
|
+
url: lookupUrl
|
|
14806
|
+
});
|
|
14807
|
+
return null;
|
|
14808
|
+
}
|
|
14809
|
+
throw error;
|
|
14810
|
+
}
|
|
14811
|
+
const { document, documentUrl } = fetchResult;
|
|
14812
|
+
const baseUrl = parseIri(documentUrl);
|
|
14813
|
+
try {
|
|
14814
|
+
const obj = await this.#translator_fromJsonLd(document, {
|
|
14815
|
+
documentLoader,
|
|
14816
|
+
contextLoader,
|
|
14817
|
+
tracerProvider,
|
|
14818
|
+
baseUrl
|
|
14819
|
+
});
|
|
14820
|
+
if (obj?.id != null && !isTrustedIriOrigin(options, obj.id, baseUrl)) {
|
|
14821
|
+
if (options.crossOrigin === "throw") throw new Error("The object's @id (" + obj.id.href + ") has a different origin than the document URL (" + baseUrl.href + "); refusing to return the object. If you want to bypass this check and are aware ofthe security implications, set the crossOrigin option to \"trust\".");
|
|
14822
|
+
getLogger(["fedify", "vocab"]).warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
|
|
14823
|
+
...fetchResult,
|
|
14824
|
+
objectId: obj.id.href
|
|
14825
|
+
});
|
|
14826
|
+
return null;
|
|
14827
|
+
}
|
|
14828
|
+
span.setAttribute("activitypub.object.id", (obj.id ?? url).href);
|
|
14829
|
+
span.setAttribute("activitypub.object.type", obj.constructor.typeId.href);
|
|
14830
|
+
return obj;
|
|
14831
|
+
} catch (e) {
|
|
14832
|
+
if (options.suppressError) {
|
|
14833
|
+
getLogger(["fedify", "vocab"]).error("Failed to parse {url}: {error}", {
|
|
14834
|
+
error: e,
|
|
14835
|
+
url: lookupUrl
|
|
14836
|
+
});
|
|
14837
|
+
return null;
|
|
14838
|
+
}
|
|
14839
|
+
span.setStatus({
|
|
14840
|
+
code: SpanStatusCode.ERROR,
|
|
14841
|
+
message: String(e)
|
|
14842
|
+
});
|
|
14843
|
+
throw e;
|
|
14844
|
+
} finally {
|
|
14845
|
+
span.end();
|
|
14846
|
+
}
|
|
14847
|
+
});
|
|
14848
|
+
}
|
|
14849
|
+
async #translator_fromJsonLd(jsonLd, options) {
|
|
14850
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader();
|
|
14851
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ?? getDocumentLoader();
|
|
14852
|
+
const tracerProvider = options.tracerProvider ?? this._tracerProvider ?? trace.getTracerProvider();
|
|
14853
|
+
const baseUrl = options.baseUrl;
|
|
14854
|
+
try {
|
|
14855
|
+
return await Application.fromJsonLd(jsonLd, {
|
|
14856
|
+
documentLoader,
|
|
14857
|
+
contextLoader,
|
|
14858
|
+
tracerProvider,
|
|
14859
|
+
baseUrl
|
|
14860
|
+
});
|
|
14861
|
+
} catch (e) {
|
|
14862
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14863
|
+
}
|
|
14864
|
+
try {
|
|
14865
|
+
return await Group.fromJsonLd(jsonLd, {
|
|
14866
|
+
documentLoader,
|
|
14867
|
+
contextLoader,
|
|
14868
|
+
tracerProvider,
|
|
14869
|
+
baseUrl
|
|
14870
|
+
});
|
|
14871
|
+
} catch (e) {
|
|
14872
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14873
|
+
}
|
|
14874
|
+
try {
|
|
14875
|
+
return await Organization.fromJsonLd(jsonLd, {
|
|
14876
|
+
documentLoader,
|
|
14877
|
+
contextLoader,
|
|
14878
|
+
tracerProvider,
|
|
14879
|
+
baseUrl
|
|
14880
|
+
});
|
|
14881
|
+
} catch (e) {
|
|
14882
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14883
|
+
}
|
|
14884
|
+
try {
|
|
14885
|
+
return await Person.fromJsonLd(jsonLd, {
|
|
14886
|
+
documentLoader,
|
|
14887
|
+
contextLoader,
|
|
14888
|
+
tracerProvider,
|
|
14889
|
+
baseUrl
|
|
14890
|
+
});
|
|
14891
|
+
} catch (e) {
|
|
14892
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14893
|
+
}
|
|
14894
|
+
try {
|
|
14895
|
+
return await Service.fromJsonLd(jsonLd, {
|
|
14896
|
+
documentLoader,
|
|
14897
|
+
contextLoader,
|
|
14898
|
+
tracerProvider,
|
|
14899
|
+
baseUrl
|
|
14900
|
+
});
|
|
14901
|
+
} catch (e) {
|
|
14902
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14903
|
+
}
|
|
14904
|
+
throw new TypeError("Expected an object of any type of: " + [
|
|
14905
|
+
"https://www.w3.org/ns/activitystreams#Application",
|
|
14906
|
+
"https://www.w3.org/ns/activitystreams#Group",
|
|
14907
|
+
"https://www.w3.org/ns/activitystreams#Organization",
|
|
14908
|
+
"https://www.w3.org/ns/activitystreams#Person",
|
|
14909
|
+
"https://www.w3.org/ns/activitystreams#Service"
|
|
14910
|
+
].join(", "));
|
|
14911
|
+
}
|
|
14912
|
+
/**
|
|
14913
|
+
* Similar to
|
|
14914
|
+
* {@link Translation.getTranslator},
|
|
14915
|
+
* but returns its `@id` URL instead of the object itself.
|
|
14916
|
+
*/
|
|
14917
|
+
get translatorId() {
|
|
14918
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14919
|
+
if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < 1) return null;
|
|
14920
|
+
const v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
|
|
14921
|
+
if (v instanceof URL) return v;
|
|
14922
|
+
return v.id;
|
|
14923
|
+
}
|
|
14924
|
+
/** The actors credited for this language version. Their order has no
|
|
14925
|
+
* meaning. Human actors credit translation or review; Application and
|
|
14926
|
+
* Service actors credit machine output. If any actor cannot be resolved,
|
|
14927
|
+
* the entry's human-or-machine status is unknown. Credit is asserted by
|
|
14928
|
+
* the publisher and grants no publishing authority. Embedded actors with
|
|
14929
|
+
* identifiers are fetched before being returned unless explicitly trusted.
|
|
14930
|
+
*/
|
|
14931
|
+
async getTranslator(options = {}) {
|
|
14932
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14933
|
+
if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < 1) return null;
|
|
14934
|
+
let v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
|
|
14935
|
+
if (!(v instanceof URL) && v.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) v = v.id;
|
|
14936
|
+
if (v instanceof URL) {
|
|
14937
|
+
const fetched = await this.#fetchTranslator(v, options);
|
|
14938
|
+
if (fetched == null) return null;
|
|
14939
|
+
this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0] = fetched;
|
|
14940
|
+
this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(0);
|
|
14941
|
+
this._cachedJsonLd = void 0;
|
|
14942
|
+
return fetched;
|
|
14943
|
+
}
|
|
14944
|
+
if (this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && "translator" in this._cachedJsonLd) {
|
|
14945
|
+
const prop = this._cachedJsonLd["translator"];
|
|
14946
|
+
const doc = Array.isArray(prop) ? prop[0] : prop;
|
|
14947
|
+
if (doc != null && typeof doc === "object" && "@context" in doc) v = await this.#translator_fromJsonLd(doc, {
|
|
14948
|
+
...options,
|
|
14949
|
+
baseUrl: options.baseUrl ?? this._baseUrl ?? (this.id != null && (this.id.protocol === "http:" || this.id.protocol === "https:") ? this.id : void 0)
|
|
14950
|
+
});
|
|
14951
|
+
}
|
|
14952
|
+
if (v?.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) {
|
|
14953
|
+
if (options.crossOrigin === "throw") throw new Error("The property object's @id (" + v.id.href + ") has a different origin than the property owner's @id (untrusted metadata); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".");
|
|
14954
|
+
getLogger(["fedify", "vocab"]).warn("The property object's @id ({objectId}) has a different origin than the property owner's @id ({parentObjectId}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
|
|
14955
|
+
objectId: v.id.href,
|
|
14956
|
+
parentObjectId: "untrusted metadata"
|
|
14957
|
+
});
|
|
14958
|
+
return null;
|
|
14959
|
+
}
|
|
14960
|
+
return v;
|
|
14961
|
+
}
|
|
14962
|
+
/**
|
|
14963
|
+
* Similar to
|
|
14964
|
+
* {@link Translation.getTranslators},
|
|
14965
|
+
* but returns their `@id`s instead of the objects themselves.
|
|
14966
|
+
*/
|
|
14967
|
+
get translatorIds() {
|
|
14968
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14969
|
+
return this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
|
14970
|
+
}
|
|
14971
|
+
/** The actors credited for this language version. Their order has no
|
|
14972
|
+
* meaning. Human actors credit translation or review; Application and
|
|
14973
|
+
* Service actors credit machine output. If any actor cannot be resolved,
|
|
14974
|
+
* the entry's human-or-machine status is unknown. Credit is asserted by
|
|
14975
|
+
* the publisher and grants no publishing authority. Embedded actors with
|
|
14976
|
+
* identifiers are fetched before being returned unless explicitly trusted.
|
|
14977
|
+
*/
|
|
14978
|
+
async *getTranslators(options = {}) {
|
|
14979
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14980
|
+
const vs = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
14981
|
+
for (let i = 0; i < vs.length; i++) {
|
|
14982
|
+
let v = vs[i];
|
|
14983
|
+
if (!(v instanceof URL) && v.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) v = v.id;
|
|
14984
|
+
if (v instanceof URL) {
|
|
14985
|
+
const fetched = await this.#fetchTranslator(v, options);
|
|
14986
|
+
if (fetched == null) continue;
|
|
14987
|
+
vs[i] = fetched;
|
|
14988
|
+
this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
|
|
14989
|
+
this._cachedJsonLd = void 0;
|
|
14990
|
+
yield fetched;
|
|
14991
|
+
continue;
|
|
14992
|
+
}
|
|
14993
|
+
if (this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && "translator" in this._cachedJsonLd) {
|
|
14994
|
+
const prop = this._cachedJsonLd["translator"];
|
|
14995
|
+
const obj = Array.isArray(prop) ? prop[i] : prop;
|
|
14996
|
+
if (obj != null && typeof obj === "object" && "@context" in obj) v = await this.#translator_fromJsonLd(obj, {
|
|
14997
|
+
...options,
|
|
14998
|
+
baseUrl: options.baseUrl ?? this._baseUrl ?? (this.id != null && (this.id.protocol === "http:" || this.id.protocol === "https:") ? this.id : void 0)
|
|
14999
|
+
});
|
|
15000
|
+
}
|
|
15001
|
+
if (v?.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) {
|
|
15002
|
+
if (options.crossOrigin === "throw") throw new Error("The property object's @id (" + v.id.href + ") has a different origin than the property owner's @id (untrusted metadata); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".");
|
|
15003
|
+
getLogger(["fedify", "vocab"]).warn("The property object's @id ({objectId}) has a different origin than the property owner's @id ({parentObjectId}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
|
|
15004
|
+
objectId: v.id.href,
|
|
15005
|
+
parentObjectId: "untrusted metadata"
|
|
15006
|
+
});
|
|
15007
|
+
continue;
|
|
15008
|
+
}
|
|
15009
|
+
yield v;
|
|
15010
|
+
}
|
|
15011
|
+
}
|
|
15012
|
+
/** The identifier of the containing object. FEP-22cd translations share
|
|
15013
|
+
* that object's identity rather than introducing separate posts.
|
|
15014
|
+
*/
|
|
15015
|
+
get original() {
|
|
15016
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15017
|
+
if (this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length < 1) return null;
|
|
15018
|
+
return this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[0];
|
|
15019
|
+
}
|
|
15020
|
+
/** The source object's updated timestamp (or published timestamp if it has
|
|
15021
|
+
* no updated timestamp) at the last human review of this translation.
|
|
15022
|
+
* An absent value makes no freshness claim. A value earlier than the
|
|
15023
|
+
* current source timestamp indicates a potentially stale translation;
|
|
15024
|
+
* an equal or later value reflects the current source.
|
|
15025
|
+
*/
|
|
15026
|
+
get sourceUpdated() {
|
|
15027
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15028
|
+
if (this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length < 1) return null;
|
|
15029
|
+
return this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated[0];
|
|
15030
|
+
}
|
|
15031
|
+
/** An optional public revision resource identifying the source reviewed.
|
|
15032
|
+
* Supplements sourceUpdated without requiring private revision history
|
|
15033
|
+
* to be exposed.
|
|
15034
|
+
*/
|
|
15035
|
+
get basis() {
|
|
15036
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15037
|
+
if (this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length < 1) return null;
|
|
15038
|
+
return this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[0];
|
|
15039
|
+
}
|
|
15040
|
+
/** Links to renderings of this specific language version.
|
|
15041
|
+
*/
|
|
15042
|
+
get url() {
|
|
15043
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15044
|
+
if (this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < 1) return null;
|
|
15045
|
+
return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0];
|
|
15046
|
+
}
|
|
15047
|
+
/** Links to renderings of this specific language version.
|
|
15048
|
+
*/
|
|
15049
|
+
get urls() {
|
|
15050
|
+
return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
15051
|
+
}
|
|
15052
|
+
/**
|
|
15053
|
+
* Converts this object to a JSON-LD structure.
|
|
15054
|
+
* @param options The options to use.
|
|
15055
|
+
* - `format`: The format of the output: `compact` or
|
|
15056
|
+
`expand`.
|
|
15057
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
15058
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
15059
|
+
when `format` is set to `'expand'`.
|
|
15060
|
+
* @returns The JSON-LD representation of this object.
|
|
15061
|
+
*/
|
|
15062
|
+
async toJsonLd(options = {}) {
|
|
15063
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
15064
|
+
if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
|
|
15065
|
+
options = {
|
|
15066
|
+
...options,
|
|
15067
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
15068
|
+
};
|
|
15069
|
+
if (options.format == null && this.isCompactable()) {
|
|
15070
|
+
const result = {};
|
|
15071
|
+
let compactItems = [];
|
|
15072
|
+
for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) {
|
|
15073
|
+
const item = v.baseName;
|
|
15074
|
+
compactItems.push(item);
|
|
15075
|
+
}
|
|
15076
|
+
if (compactItems.length > 0) result["inLanguage"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15077
|
+
compactItems = [];
|
|
15078
|
+
for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) {
|
|
15079
|
+
const item = v instanceof URL ? formatIri(v) : v instanceof Application ? await v.toJsonLd({
|
|
15080
|
+
...options,
|
|
15081
|
+
format: void 0,
|
|
15082
|
+
context: void 0
|
|
15083
|
+
}) : v instanceof Group ? await v.toJsonLd({
|
|
15084
|
+
...options,
|
|
15085
|
+
format: void 0,
|
|
15086
|
+
context: void 0
|
|
15087
|
+
}) : v instanceof Organization ? await v.toJsonLd({
|
|
15088
|
+
...options,
|
|
15089
|
+
format: void 0,
|
|
15090
|
+
context: void 0
|
|
15091
|
+
}) : v instanceof Person ? await v.toJsonLd({
|
|
15092
|
+
...options,
|
|
15093
|
+
format: void 0,
|
|
15094
|
+
context: void 0
|
|
15095
|
+
}) : await v.toJsonLd({
|
|
15096
|
+
...options,
|
|
15097
|
+
format: void 0,
|
|
15098
|
+
context: void 0
|
|
15099
|
+
});
|
|
15100
|
+
compactItems.push(item);
|
|
15101
|
+
}
|
|
15102
|
+
if (compactItems.length > 0) result["translator"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15103
|
+
compactItems = [];
|
|
15104
|
+
for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) {
|
|
15105
|
+
const item = formatIri(v);
|
|
15106
|
+
compactItems.push(item);
|
|
15107
|
+
}
|
|
15108
|
+
if (compactItems.length > 0) result["translationOfWork"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15109
|
+
compactItems = [];
|
|
15110
|
+
for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) {
|
|
15111
|
+
const item = v.toString();
|
|
15112
|
+
compactItems.push(item);
|
|
15113
|
+
}
|
|
15114
|
+
if (compactItems.length > 0) result["sourceUpdated"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15115
|
+
compactItems = [];
|
|
15116
|
+
for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) {
|
|
15117
|
+
const item = formatIri(v);
|
|
15118
|
+
compactItems.push(item);
|
|
15119
|
+
}
|
|
15120
|
+
if (compactItems.length > 0) result["isBasedOn"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15121
|
+
compactItems = [];
|
|
15122
|
+
for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) {
|
|
15123
|
+
const item = v instanceof URL ? formatIri(v) : await v.toJsonLd({
|
|
15124
|
+
...options,
|
|
15125
|
+
format: void 0,
|
|
15126
|
+
context: void 0
|
|
15127
|
+
});
|
|
15128
|
+
compactItems.push(item);
|
|
15129
|
+
}
|
|
15130
|
+
if (compactItems.length > 0) result["url"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15131
|
+
result["type"] = "Translation";
|
|
15132
|
+
if (this.id != null) result["id"] = formatIri(this.id);
|
|
15133
|
+
result["@context"] = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/22cd"];
|
|
15134
|
+
return result;
|
|
15135
|
+
}
|
|
15136
|
+
let array;
|
|
15137
|
+
const values = {};
|
|
15138
|
+
array = [];
|
|
15139
|
+
for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) {
|
|
15140
|
+
let element = { "@value": v.baseName };
|
|
15141
|
+
if (Array.isArray(element)) {
|
|
15142
|
+
if (element.length < 1) continue;
|
|
15143
|
+
if (element.length == 1) element = element[0];
|
|
15144
|
+
}
|
|
15145
|
+
if (typeof element === "undefined") continue;
|
|
15146
|
+
array.push(element);
|
|
15147
|
+
}
|
|
15148
|
+
if (array.length > 0) values["https://schema.org/inLanguage"] = array;
|
|
15149
|
+
array = [];
|
|
15150
|
+
for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) {
|
|
15151
|
+
let element = v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options);
|
|
15152
|
+
if (Array.isArray(element)) {
|
|
15153
|
+
if (element.length < 1) continue;
|
|
15154
|
+
if (element.length == 1) element = element[0];
|
|
15155
|
+
}
|
|
15156
|
+
if (typeof element === "undefined") continue;
|
|
15157
|
+
array.push(element);
|
|
15158
|
+
}
|
|
15159
|
+
if (array.length > 0) values["https://schema.org/translator"] = array;
|
|
15160
|
+
array = [];
|
|
15161
|
+
for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) {
|
|
15162
|
+
let element = { "@id": formatIri(v) };
|
|
15163
|
+
if (Array.isArray(element)) {
|
|
15164
|
+
if (element.length < 1) continue;
|
|
15165
|
+
if (element.length == 1) element = element[0];
|
|
15166
|
+
}
|
|
15167
|
+
if (typeof element === "undefined") continue;
|
|
15168
|
+
array.push(element);
|
|
15169
|
+
}
|
|
15170
|
+
if (array.length > 0) values["https://schema.org/translationOfWork"] = array;
|
|
15171
|
+
array = [];
|
|
15172
|
+
for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) {
|
|
15173
|
+
let element = {
|
|
15174
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
15175
|
+
"@value": v.toString()
|
|
15176
|
+
};
|
|
15177
|
+
if (Array.isArray(element)) {
|
|
15178
|
+
if (element.length < 1) continue;
|
|
15179
|
+
if (element.length == 1) element = element[0];
|
|
15180
|
+
}
|
|
15181
|
+
if (typeof element === "undefined") continue;
|
|
15182
|
+
array.push(element);
|
|
15183
|
+
}
|
|
15184
|
+
if (array.length > 0) values["https://w3id.org/fep/22cd#sourceUpdated"] = array;
|
|
15185
|
+
array = [];
|
|
15186
|
+
for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) {
|
|
15187
|
+
let element = { "@id": formatIri(v) };
|
|
15188
|
+
if (Array.isArray(element)) {
|
|
15189
|
+
if (element.length < 1) continue;
|
|
15190
|
+
if (element.length == 1) element = element[0];
|
|
15191
|
+
}
|
|
15192
|
+
if (typeof element === "undefined") continue;
|
|
15193
|
+
array.push(element);
|
|
15194
|
+
}
|
|
15195
|
+
if (array.length > 0) values["https://schema.org/isBasedOn"] = array;
|
|
15196
|
+
array = [];
|
|
15197
|
+
for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) {
|
|
15198
|
+
let element = v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options);
|
|
15199
|
+
if (Array.isArray(element)) {
|
|
15200
|
+
if (element.length < 1) continue;
|
|
15201
|
+
if (element.length == 1) element = element[0];
|
|
15202
|
+
}
|
|
15203
|
+
if (typeof element === "undefined") continue;
|
|
15204
|
+
array.push(element);
|
|
15205
|
+
}
|
|
15206
|
+
if (array.length > 0) values["https://www.w3.org/ns/activitystreams#url"] = array;
|
|
15207
|
+
values["@type"] = ["https://w3id.org/fep/22cd#Translation"];
|
|
15208
|
+
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
15209
|
+
if (options.format === "expand") return await jsonld.expand(values, {
|
|
15210
|
+
documentLoader: options.contextLoader,
|
|
15211
|
+
keepFreeFloatingNodes: true
|
|
15212
|
+
});
|
|
15213
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/22cd"];
|
|
15214
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15215
|
+
if (options.context == null) {
|
|
15216
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
15217
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
15218
|
+
if (additionalContexts.length > 0) {
|
|
15219
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
15220
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15221
|
+
}
|
|
15222
|
+
}
|
|
15223
|
+
if (docContext != null) {}
|
|
15224
|
+
return compacted;
|
|
15225
|
+
}
|
|
15226
|
+
isCompactable() {
|
|
15227
|
+
if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR != null && this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 0) return false;
|
|
15228
|
+
return true;
|
|
15229
|
+
}
|
|
15230
|
+
/**
|
|
15231
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
15232
|
+
* @param json The JSON-LD structure to convert.
|
|
15233
|
+
* @param options The options to use.
|
|
15234
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
15235
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
15236
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
15237
|
+
* If omitted, the global tracer provider is used.
|
|
15238
|
+
* @returns The object of this type.
|
|
15239
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
15240
|
+
*/
|
|
15241
|
+
static async fromJsonLd(json, options = {}) {
|
|
15242
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
15243
|
+
try {
|
|
15244
|
+
const object = await this.__fromJsonLd__Translation__(json, span, options);
|
|
15245
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
15246
|
+
return object;
|
|
15247
|
+
} catch (error) {
|
|
15248
|
+
span.setStatus({
|
|
15249
|
+
code: SpanStatusCode.ERROR,
|
|
15250
|
+
message: String(error)
|
|
15251
|
+
});
|
|
15252
|
+
throw error;
|
|
15253
|
+
} finally {
|
|
15254
|
+
span.end();
|
|
15255
|
+
}
|
|
15256
|
+
});
|
|
15257
|
+
}
|
|
15258
|
+
static async __fromJsonLd__Translation__(json, span, options = {}) {
|
|
15259
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
15260
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
15261
|
+
options = {
|
|
15262
|
+
...options,
|
|
15263
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
15264
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
15265
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
15266
|
+
};
|
|
15267
|
+
let values;
|
|
15268
|
+
let expanded;
|
|
15269
|
+
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
15270
|
+
values = json;
|
|
15271
|
+
expanded = [values];
|
|
15272
|
+
} else if (globalThis.Object.keys(json).length == 0) {
|
|
15273
|
+
values = {};
|
|
15274
|
+
expanded = [values];
|
|
15275
|
+
} else {
|
|
15276
|
+
expanded = await jsonld.expand(json, {
|
|
15277
|
+
documentLoader: options.contextLoader,
|
|
15278
|
+
keepFreeFloatingNodes: true
|
|
15279
|
+
});
|
|
15280
|
+
values = expanded[0] ?? {};
|
|
15281
|
+
}
|
|
15282
|
+
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
15283
|
+
if (id != null && options.baseUrl == null) options = {
|
|
15284
|
+
...options,
|
|
15285
|
+
baseUrl: id
|
|
15286
|
+
};
|
|
15287
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
15288
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
15289
|
+
if (!values["@type"].includes("https://w3id.org/fep/22cd#Translation")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14367
15290
|
}
|
|
14368
15291
|
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
14369
15292
|
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
14370
|
-
const
|
|
14371
|
-
delete superValues["@type"];
|
|
14372
|
-
const instance = await super.fromJsonLd(superValues, {
|
|
14373
|
-
...options,
|
|
14374
|
-
_fromSubclass: true
|
|
14375
|
-
});
|
|
14376
|
-
if (!(instance instanceof QuoteRequest)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
15293
|
+
const instance = new this({ id }, options);
|
|
14377
15294
|
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
15295
|
+
const _diXuPmFWiEqfLPhhrxg6Xc7ixZG = [];
|
|
15296
|
+
let _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array = values["https://schema.org/inLanguage"];
|
|
15297
|
+
for (const v of _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array == null ? [] : _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array.length === 1 && "@list" in _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array[0] ? _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array[0]["@list"] : _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array) {
|
|
15298
|
+
if (v == null) continue;
|
|
15299
|
+
const decoded = new Intl.Locale(v["@value"]);
|
|
15300
|
+
if (typeof decoded === "undefined") {
|
|
15301
|
+
shouldCacheJsonLd = false;
|
|
15302
|
+
continue;
|
|
15303
|
+
}
|
|
15304
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15305
|
+
_diXuPmFWiEqfLPhhrxg6Xc7ixZG.push(decoded);
|
|
15306
|
+
}
|
|
15307
|
+
instance.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = _diXuPmFWiEqfLPhhrxg6Xc7ixZG;
|
|
15308
|
+
const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [];
|
|
15309
|
+
let _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array = values["https://schema.org/translator"];
|
|
15310
|
+
for (const v of _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array == null ? [] : _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array.length === 1 && "@list" in _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array[0] ? _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array[0]["@list"] : _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array) {
|
|
15311
|
+
if (v == null) continue;
|
|
15312
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
15313
|
+
if (v["@id"].startsWith("_:")) continue;
|
|
15314
|
+
_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.push(parseIri(v["@id"], options.baseUrl));
|
|
15315
|
+
continue;
|
|
15316
|
+
}
|
|
15317
|
+
const decoded = typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd(v, {
|
|
15318
|
+
...options,
|
|
15319
|
+
baseUrl: options.baseUrl
|
|
15320
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd(v, {
|
|
15321
|
+
...options,
|
|
15322
|
+
baseUrl: options.baseUrl
|
|
15323
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd(v, {
|
|
15324
|
+
...options,
|
|
15325
|
+
baseUrl: options.baseUrl
|
|
15326
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd(v, {
|
|
15327
|
+
...options,
|
|
15328
|
+
baseUrl: options.baseUrl
|
|
15329
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd(v, {
|
|
15330
|
+
...options,
|
|
15331
|
+
baseUrl: options.baseUrl
|
|
15332
|
+
}) : void 0;
|
|
15333
|
+
if (typeof decoded === "undefined") {
|
|
15334
|
+
shouldCacheJsonLd = false;
|
|
15335
|
+
continue;
|
|
15336
|
+
}
|
|
15337
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15338
|
+
_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.push(decoded);
|
|
15339
|
+
}
|
|
15340
|
+
instance.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
15341
|
+
const _Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [];
|
|
15342
|
+
let _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array = values["https://schema.org/translationOfWork"];
|
|
15343
|
+
for (const v of _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array == null ? [] : _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array.length === 1 && "@list" in _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array[0] ? _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array[0]["@list"] : _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array) {
|
|
15344
|
+
if (v == null) continue;
|
|
15345
|
+
const decoded = parseIri(v["@id"], options.baseUrl);
|
|
15346
|
+
if (typeof decoded === "undefined") {
|
|
15347
|
+
shouldCacheJsonLd = false;
|
|
15348
|
+
continue;
|
|
15349
|
+
}
|
|
15350
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15351
|
+
_Msz9PwRg7cWkiXPL4ixyQLtuuH7.push(decoded);
|
|
15352
|
+
}
|
|
15353
|
+
instance.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = _Msz9PwRg7cWkiXPL4ixyQLtuuH7;
|
|
15354
|
+
const _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [];
|
|
15355
|
+
let _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array = values["https://w3id.org/fep/22cd#sourceUpdated"];
|
|
15356
|
+
for (const v of _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array == null ? [] : _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array.length === 1 && "@list" in _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array[0] ? _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array[0]["@list"] : _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array) {
|
|
15357
|
+
if (v == null) continue;
|
|
15358
|
+
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
15359
|
+
if (typeof decoded === "undefined") {
|
|
15360
|
+
shouldCacheJsonLd = false;
|
|
15361
|
+
continue;
|
|
15362
|
+
}
|
|
15363
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15364
|
+
_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.push(decoded);
|
|
15365
|
+
}
|
|
15366
|
+
instance.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated;
|
|
15367
|
+
const _4KvkQNz1JjGs8S7iJDcGrUYETbUW = [];
|
|
15368
|
+
let _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array = values["https://schema.org/isBasedOn"];
|
|
15369
|
+
for (const v of _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array == null ? [] : _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array.length === 1 && "@list" in _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array[0] ? _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array[0]["@list"] : _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array) {
|
|
15370
|
+
if (v == null) continue;
|
|
15371
|
+
const decoded = parseIri(v["@id"], options.baseUrl);
|
|
15372
|
+
if (typeof decoded === "undefined") {
|
|
15373
|
+
shouldCacheJsonLd = false;
|
|
15374
|
+
continue;
|
|
15375
|
+
}
|
|
15376
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15377
|
+
_4KvkQNz1JjGs8S7iJDcGrUYETbUW.push(decoded);
|
|
15378
|
+
}
|
|
15379
|
+
instance.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = _4KvkQNz1JjGs8S7iJDcGrUYETbUW;
|
|
15380
|
+
const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [];
|
|
15381
|
+
let _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array = values["https://www.w3.org/ns/activitystreams#url"];
|
|
15382
|
+
for (const v of _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array == null ? [] : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array.length === 1 && "@list" in _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0] ? _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0]["@list"] : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array) {
|
|
15383
|
+
if (v == null) continue;
|
|
15384
|
+
const decoded = v != null && typeof v === "object" && "@id" in v && typeof v["@id"] === "string" && v["@id"] !== "" ? parseIri(v["@id"], options.baseUrl) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && [
|
|
15385
|
+
"https://www.w3.org/ns/activitystreams#Link",
|
|
15386
|
+
"https://www.w3.org/ns/activitystreams#Hashtag",
|
|
15387
|
+
"https://www.w3.org/ns/activitystreams#Mention"
|
|
15388
|
+
].some((t) => v["@type"].includes(t)) ? await Link.fromJsonLd(v, {
|
|
15389
|
+
...options,
|
|
15390
|
+
baseUrl: options.baseUrl
|
|
15391
|
+
}) : void 0;
|
|
15392
|
+
if (typeof decoded === "undefined") {
|
|
15393
|
+
shouldCacheJsonLd = false;
|
|
15394
|
+
continue;
|
|
15395
|
+
}
|
|
15396
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15397
|
+
_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.push(decoded);
|
|
15398
|
+
}
|
|
15399
|
+
instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
14378
15400
|
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
14379
15401
|
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
14380
15402
|
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
@@ -14389,14 +15411,51 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14389
15411
|
return instance;
|
|
14390
15412
|
}
|
|
14391
15413
|
_getCustomInspectProxy() {
|
|
14392
|
-
|
|
15414
|
+
const proxy = {};
|
|
15415
|
+
if (this.id != null) proxy.id = {
|
|
15416
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
|
|
15417
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
|
|
15418
|
+
};
|
|
15419
|
+
const _diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.map((v) => v instanceof URL ? {
|
|
15420
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15421
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15422
|
+
} : v);
|
|
15423
|
+
if (_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length == 1) proxy.language = _diXuPmFWiEqfLPhhrxg6Xc7ixZG[0];
|
|
15424
|
+
const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.map((v) => v instanceof URL ? {
|
|
15425
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15426
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15427
|
+
} : v);
|
|
15428
|
+
if (_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length == 1) proxy.translator = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
|
|
15429
|
+
if (_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 1 || !("translator" in proxy) && _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 0) proxy.translators = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
15430
|
+
const _Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.map((v) => v instanceof URL ? {
|
|
15431
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15432
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15433
|
+
} : v);
|
|
15434
|
+
if (_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length == 1) proxy.original = _Msz9PwRg7cWkiXPL4ixyQLtuuH7[0];
|
|
15435
|
+
const _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.map((v) => v instanceof URL ? {
|
|
15436
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15437
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15438
|
+
} : v);
|
|
15439
|
+
if (_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length == 1) proxy.sourceUpdated = _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated[0];
|
|
15440
|
+
const _4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.map((v) => v instanceof URL ? {
|
|
15441
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15442
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15443
|
+
} : v);
|
|
15444
|
+
if (_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length == 1) proxy.basis = _4KvkQNz1JjGs8S7iJDcGrUYETbUW[0];
|
|
15445
|
+
const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.map((v) => v instanceof URL ? {
|
|
15446
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15447
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15448
|
+
} : v);
|
|
15449
|
+
if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0];
|
|
15450
|
+
if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 || !("url" in proxy) && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
15451
|
+
return proxy;
|
|
14393
15452
|
}
|
|
14394
15453
|
};
|
|
14395
|
-
|
|
14396
|
-
return "
|
|
15454
|
+
Translation.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
15455
|
+
return "Translation " + inspect(this._getCustomInspectProxy(), options);
|
|
14397
15456
|
};
|
|
14398
|
-
|
|
14399
|
-
return "
|
|
15457
|
+
Translation.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
15458
|
+
return "Translation " + inspect(this._getCustomInspectProxy(), options);
|
|
14400
15459
|
};
|
|
14401
15460
|
/** Proves that an actor consented to being included in a
|
|
14402
15461
|
* {@link FeaturedCollection}.
|
|
@@ -14794,13 +15853,21 @@ var FeatureAuthorization = class FeatureAuthorization extends Object$1 {
|
|
|
14794
15853
|
documentLoader: options.contextLoader,
|
|
14795
15854
|
keepFreeFloatingNodes: true
|
|
14796
15855
|
});
|
|
14797
|
-
|
|
15856
|
+
let docContext = options.context ?? [
|
|
14798
15857
|
"https://www.w3.org/ns/activitystreams",
|
|
14799
15858
|
"https://w3id.org/security/data-integrity/v1",
|
|
14800
15859
|
"https://gotosocial.org/ns",
|
|
14801
15860
|
"https://w3id.org/fep/7aa9"
|
|
14802
15861
|
];
|
|
14803
|
-
|
|
15862
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15863
|
+
if (options.context == null) {
|
|
15864
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
15865
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
15866
|
+
if (additionalContexts.length > 0) {
|
|
15867
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
15868
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15869
|
+
}
|
|
15870
|
+
}
|
|
14804
15871
|
if (docContext != null) {
|
|
14805
15872
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14806
15873
|
else compacted.proof["@context"] = docContext;
|
|
@@ -15024,14 +16091,22 @@ var FeatureRequest = class FeatureRequest extends Activity {
|
|
|
15024
16091
|
documentLoader: options.contextLoader,
|
|
15025
16092
|
keepFreeFloatingNodes: true
|
|
15026
16093
|
});
|
|
15027
|
-
|
|
16094
|
+
let docContext = options.context ?? [
|
|
15028
16095
|
"https://w3id.org/identity/v1",
|
|
15029
16096
|
"https://www.w3.org/ns/activitystreams",
|
|
15030
16097
|
"https://w3id.org/security/data-integrity/v1",
|
|
15031
16098
|
"https://gotosocial.org/ns",
|
|
15032
16099
|
"https://w3id.org/fep/7aa9"
|
|
15033
16100
|
];
|
|
15034
|
-
|
|
16101
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
16102
|
+
if (options.context == null) {
|
|
16103
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
16104
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
16105
|
+
if (additionalContexts.length > 0) {
|
|
16106
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
16107
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
16108
|
+
}
|
|
16109
|
+
}
|
|
15035
16110
|
if (docContext != null) {
|
|
15036
16111
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
15037
16112
|
else compacted.proof["@context"] = docContext;
|
|
@@ -17182,7 +18257,7 @@ var Collection = class Collection extends Object$1 {
|
|
|
17182
18257
|
documentLoader: options.contextLoader,
|
|
17183
18258
|
keepFreeFloatingNodes: true
|
|
17184
18259
|
});
|
|
17185
|
-
|
|
18260
|
+
let docContext = options.context ?? [
|
|
17186
18261
|
"https://www.w3.org/ns/activitystreams",
|
|
17187
18262
|
"https://w3id.org/security/data-integrity/v1",
|
|
17188
18263
|
"https://gotosocial.org/ns",
|
|
@@ -17214,7 +18289,15 @@ var Collection = class Collection extends Object$1 {
|
|
|
17214
18289
|
}
|
|
17215
18290
|
}
|
|
17216
18291
|
];
|
|
17217
|
-
|
|
18292
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
18293
|
+
if (options.context == null) {
|
|
18294
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
18295
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
18296
|
+
if (additionalContexts.length > 0) {
|
|
18297
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
18298
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
18299
|
+
}
|
|
18300
|
+
}
|
|
17218
18301
|
if (docContext != null) {
|
|
17219
18302
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
17220
18303
|
else compacted.proof["@context"] = docContext;
|
|
@@ -18010,7 +19093,7 @@ var OrderedCollection = class OrderedCollection extends Collection {
|
|
|
18010
19093
|
documentLoader: options.contextLoader,
|
|
18011
19094
|
keepFreeFloatingNodes: true
|
|
18012
19095
|
});
|
|
18013
|
-
|
|
19096
|
+
let docContext = options.context ?? [
|
|
18014
19097
|
"https://www.w3.org/ns/activitystreams",
|
|
18015
19098
|
"https://w3id.org/security/data-integrity/v1",
|
|
18016
19099
|
"https://gotosocial.org/ns",
|
|
@@ -18042,7 +19125,15 @@ var OrderedCollection = class OrderedCollection extends Collection {
|
|
|
18042
19125
|
}
|
|
18043
19126
|
}
|
|
18044
19127
|
];
|
|
18045
|
-
|
|
19128
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19129
|
+
if (options.context == null) {
|
|
19130
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
19131
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
19132
|
+
if (additionalContexts.length > 0) {
|
|
19133
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
19134
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19135
|
+
}
|
|
19136
|
+
}
|
|
18046
19137
|
if (docContext != null) {
|
|
18047
19138
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
18048
19139
|
else compacted.proof["@context"] = docContext;
|
|
@@ -18405,7 +19496,7 @@ var FeaturedCollection = class FeaturedCollection extends OrderedCollection {
|
|
|
18405
19496
|
documentLoader: options.contextLoader,
|
|
18406
19497
|
keepFreeFloatingNodes: true
|
|
18407
19498
|
});
|
|
18408
|
-
|
|
19499
|
+
let docContext = options.context ?? [
|
|
18409
19500
|
"https://www.w3.org/ns/activitystreams",
|
|
18410
19501
|
"https://w3id.org/security/data-integrity/v1",
|
|
18411
19502
|
"https://gotosocial.org/ns",
|
|
@@ -18417,7 +19508,15 @@ var FeaturedCollection = class FeaturedCollection extends OrderedCollection {
|
|
|
18417
19508
|
"Hashtag": "as:Hashtag"
|
|
18418
19509
|
}
|
|
18419
19510
|
];
|
|
18420
|
-
|
|
19511
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19512
|
+
if (options.context == null) {
|
|
19513
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
19514
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
19515
|
+
if (additionalContexts.length > 0) {
|
|
19516
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
19517
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19518
|
+
}
|
|
19519
|
+
}
|
|
18421
19520
|
if (docContext != null) {
|
|
18422
19521
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
18423
19522
|
else compacted.proof["@context"] = docContext;
|
|
@@ -18957,13 +20056,21 @@ var FeaturedItem = class FeaturedItem extends Object$1 {
|
|
|
18957
20056
|
documentLoader: options.contextLoader,
|
|
18958
20057
|
keepFreeFloatingNodes: true
|
|
18959
20058
|
});
|
|
18960
|
-
|
|
20059
|
+
let docContext = options.context ?? [
|
|
18961
20060
|
"https://www.w3.org/ns/activitystreams",
|
|
18962
20061
|
"https://w3id.org/security/data-integrity/v1",
|
|
18963
20062
|
"https://gotosocial.org/ns",
|
|
18964
20063
|
"https://w3id.org/fep/7aa9"
|
|
18965
20064
|
];
|
|
18966
|
-
|
|
20065
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20066
|
+
if (options.context == null) {
|
|
20067
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
20068
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
20069
|
+
if (additionalContexts.length > 0) {
|
|
20070
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
20071
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20072
|
+
}
|
|
20073
|
+
}
|
|
18967
20074
|
if (docContext != null) {
|
|
18968
20075
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
18969
20076
|
else compacted.proof["@context"] = docContext;
|
|
@@ -19270,8 +20377,16 @@ var DidService = class {
|
|
|
19270
20377
|
documentLoader: options.contextLoader,
|
|
19271
20378
|
keepFreeFloatingNodes: true
|
|
19272
20379
|
});
|
|
19273
|
-
|
|
19274
|
-
|
|
20380
|
+
let docContext = options.context ?? "https://www.w3.org/ns/did/v1";
|
|
20381
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20382
|
+
if (options.context == null) {
|
|
20383
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
20384
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
20385
|
+
if (additionalContexts.length > 0) {
|
|
20386
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
20387
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20388
|
+
}
|
|
20389
|
+
}
|
|
19275
20390
|
if (docContext != null) {}
|
|
19276
20391
|
return compacted;
|
|
19277
20392
|
}
|
|
@@ -19452,8 +20567,16 @@ var Export = class Export extends DidService {
|
|
|
19452
20567
|
documentLoader: options.contextLoader,
|
|
19453
20568
|
keepFreeFloatingNodes: true
|
|
19454
20569
|
});
|
|
19455
|
-
|
|
19456
|
-
|
|
20570
|
+
let docContext = options.context ?? "https://www.w3.org/ns/did/v1";
|
|
20571
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20572
|
+
if (options.context == null) {
|
|
20573
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
20574
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
20575
|
+
if (additionalContexts.length > 0) {
|
|
20576
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
20577
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20578
|
+
}
|
|
20579
|
+
}
|
|
19457
20580
|
if (docContext != null) {}
|
|
19458
20581
|
return compacted;
|
|
19459
20582
|
}
|
|
@@ -19911,8 +21034,16 @@ var DataIntegrityProof = class {
|
|
|
19911
21034
|
documentLoader: options.contextLoader,
|
|
19912
21035
|
keepFreeFloatingNodes: true
|
|
19913
21036
|
});
|
|
19914
|
-
|
|
19915
|
-
|
|
21037
|
+
let docContext = options.context ?? "https://w3id.org/security/data-integrity/v1";
|
|
21038
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21039
|
+
if (options.context == null) {
|
|
21040
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
21041
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
21042
|
+
if (additionalContexts.length > 0) {
|
|
21043
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
21044
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21045
|
+
}
|
|
21046
|
+
}
|
|
19916
21047
|
if (docContext != null) {}
|
|
19917
21048
|
return compacted;
|
|
19918
21049
|
}
|
|
@@ -20472,8 +21603,16 @@ var CryptographicKey = class {
|
|
|
20472
21603
|
documentLoader: options.contextLoader,
|
|
20473
21604
|
keepFreeFloatingNodes: true
|
|
20474
21605
|
});
|
|
20475
|
-
|
|
20476
|
-
|
|
21606
|
+
let docContext = options.context ?? "https://w3id.org/security/v1";
|
|
21607
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21608
|
+
if (options.context == null) {
|
|
21609
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
21610
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
21611
|
+
if (additionalContexts.length > 0) {
|
|
21612
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
21613
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21614
|
+
}
|
|
21615
|
+
}
|
|
20477
21616
|
if (docContext != null) {}
|
|
20478
21617
|
return compacted;
|
|
20479
21618
|
}
|
|
@@ -21000,8 +22139,16 @@ var Multikey = class {
|
|
|
21000
22139
|
documentLoader: options.contextLoader,
|
|
21001
22140
|
keepFreeFloatingNodes: true
|
|
21002
22141
|
});
|
|
21003
|
-
|
|
21004
|
-
|
|
22142
|
+
let docContext = options.context ?? "https://w3id.org/security/multikey/v1";
|
|
22143
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22144
|
+
if (options.context == null) {
|
|
22145
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
22146
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
22147
|
+
if (additionalContexts.length > 0) {
|
|
22148
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
22149
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22150
|
+
}
|
|
22151
|
+
}
|
|
21005
22152
|
if (docContext != null) {}
|
|
21006
22153
|
return compacted;
|
|
21007
22154
|
}
|
|
@@ -21339,7 +22486,7 @@ var Agreement = class Agreement extends Object$1 {
|
|
|
21339
22486
|
documentLoader: options.contextLoader,
|
|
21340
22487
|
keepFreeFloatingNodes: true
|
|
21341
22488
|
});
|
|
21342
|
-
|
|
22489
|
+
let docContext = options.context ?? [
|
|
21343
22490
|
"https://www.w3.org/ns/activitystreams",
|
|
21344
22491
|
"https://w3id.org/security/data-integrity/v1",
|
|
21345
22492
|
"https://gotosocial.org/ns",
|
|
@@ -21365,7 +22512,15 @@ var Agreement = class Agreement extends Object$1 {
|
|
|
21365
22512
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
21366
22513
|
}
|
|
21367
22514
|
];
|
|
21368
|
-
|
|
22515
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22516
|
+
if (options.context == null) {
|
|
22517
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
22518
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
22519
|
+
if (additionalContexts.length > 0) {
|
|
22520
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
22521
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22522
|
+
}
|
|
22523
|
+
}
|
|
21369
22524
|
if (docContext != null) {
|
|
21370
22525
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
21371
22526
|
else compacted.proof["@context"] = docContext;
|
|
@@ -21709,7 +22864,7 @@ var Commitment = class {
|
|
|
21709
22864
|
documentLoader: options.contextLoader,
|
|
21710
22865
|
keepFreeFloatingNodes: true
|
|
21711
22866
|
});
|
|
21712
|
-
|
|
22867
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
21713
22868
|
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
21714
22869
|
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
21715
22870
|
"Commitment": "vf:Commitment",
|
|
@@ -21721,7 +22876,15 @@ var Commitment = class {
|
|
|
21721
22876
|
"hasUnit": "om2:hasUnit",
|
|
21722
22877
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
21723
22878
|
}];
|
|
21724
|
-
|
|
22879
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22880
|
+
if (options.context == null) {
|
|
22881
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
22882
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
22883
|
+
if (additionalContexts.length > 0) {
|
|
22884
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
22885
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22886
|
+
}
|
|
22887
|
+
}
|
|
21725
22888
|
if (docContext != null) {}
|
|
21726
22889
|
return compacted;
|
|
21727
22890
|
}
|
|
@@ -22151,7 +23314,7 @@ var Intent = class {
|
|
|
22151
23314
|
documentLoader: options.contextLoader,
|
|
22152
23315
|
keepFreeFloatingNodes: true
|
|
22153
23316
|
});
|
|
22154
|
-
|
|
23317
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
22155
23318
|
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
22156
23319
|
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
22157
23320
|
"Intent": "vf:Intent",
|
|
@@ -22166,7 +23329,15 @@ var Intent = class {
|
|
|
22166
23329
|
"hasUnit": "om2:hasUnit",
|
|
22167
23330
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
22168
23331
|
}];
|
|
22169
|
-
|
|
23332
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23333
|
+
if (options.context == null) {
|
|
23334
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
23335
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
23336
|
+
if (additionalContexts.length > 0) {
|
|
23337
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
23338
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23339
|
+
}
|
|
23340
|
+
}
|
|
22170
23341
|
if (docContext != null) {}
|
|
22171
23342
|
return compacted;
|
|
22172
23343
|
}
|
|
@@ -22611,7 +23782,7 @@ var Proposal = class Proposal extends Object$1 {
|
|
|
22611
23782
|
documentLoader: options.contextLoader,
|
|
22612
23783
|
keepFreeFloatingNodes: true
|
|
22613
23784
|
});
|
|
22614
|
-
|
|
23785
|
+
let docContext = options.context ?? [
|
|
22615
23786
|
"https://www.w3.org/ns/activitystreams",
|
|
22616
23787
|
"https://w3id.org/security/data-integrity/v1",
|
|
22617
23788
|
"https://gotosocial.org/ns",
|
|
@@ -22642,7 +23813,15 @@ var Proposal = class Proposal extends Object$1 {
|
|
|
22642
23813
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
22643
23814
|
}
|
|
22644
23815
|
];
|
|
22645
|
-
|
|
23816
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23817
|
+
if (options.context == null) {
|
|
23818
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
23819
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
23820
|
+
if (additionalContexts.length > 0) {
|
|
23821
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
23822
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23823
|
+
}
|
|
23824
|
+
}
|
|
22646
23825
|
if (docContext != null) {
|
|
22647
23826
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
22648
23827
|
else compacted.proof["@context"] = docContext;
|
|
@@ -22888,13 +24067,21 @@ var Accept = class Accept extends Activity {
|
|
|
22888
24067
|
documentLoader: options.contextLoader,
|
|
22889
24068
|
keepFreeFloatingNodes: true
|
|
22890
24069
|
});
|
|
22891
|
-
|
|
24070
|
+
let docContext = options.context ?? [
|
|
22892
24071
|
"https://w3id.org/identity/v1",
|
|
22893
24072
|
"https://www.w3.org/ns/activitystreams",
|
|
22894
24073
|
"https://w3id.org/security/data-integrity/v1",
|
|
22895
24074
|
"https://gotosocial.org/ns"
|
|
22896
24075
|
];
|
|
22897
|
-
|
|
24076
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24077
|
+
if (options.context == null) {
|
|
24078
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
24079
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
24080
|
+
if (additionalContexts.length > 0) {
|
|
24081
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
24082
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24083
|
+
}
|
|
24084
|
+
}
|
|
22898
24085
|
if (docContext != null) {
|
|
22899
24086
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
22900
24087
|
else compacted.proof["@context"] = docContext;
|
|
@@ -23063,13 +24250,21 @@ var Add = class Add extends Activity {
|
|
|
23063
24250
|
documentLoader: options.contextLoader,
|
|
23064
24251
|
keepFreeFloatingNodes: true
|
|
23065
24252
|
});
|
|
23066
|
-
|
|
24253
|
+
let docContext = options.context ?? [
|
|
23067
24254
|
"https://w3id.org/identity/v1",
|
|
23068
24255
|
"https://www.w3.org/ns/activitystreams",
|
|
23069
24256
|
"https://w3id.org/security/data-integrity/v1",
|
|
23070
24257
|
"https://gotosocial.org/ns"
|
|
23071
24258
|
];
|
|
23072
|
-
|
|
24259
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24260
|
+
if (options.context == null) {
|
|
24261
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
24262
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
24263
|
+
if (additionalContexts.length > 0) {
|
|
24264
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
24265
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24266
|
+
}
|
|
24267
|
+
}
|
|
23073
24268
|
if (docContext != null) {
|
|
23074
24269
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
23075
24270
|
else compacted.proof["@context"] = docContext;
|
|
@@ -23236,7 +24431,7 @@ var Announce = class Announce extends Activity {
|
|
|
23236
24431
|
documentLoader: options.contextLoader,
|
|
23237
24432
|
keepFreeFloatingNodes: true
|
|
23238
24433
|
});
|
|
23239
|
-
|
|
24434
|
+
let docContext = options.context ?? [
|
|
23240
24435
|
"https://w3id.org/identity/v1",
|
|
23241
24436
|
"https://www.w3.org/ns/activitystreams",
|
|
23242
24437
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -23271,7 +24466,15 @@ var Announce = class Announce extends Activity {
|
|
|
23271
24466
|
}
|
|
23272
24467
|
}
|
|
23273
24468
|
];
|
|
23274
|
-
|
|
24469
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24470
|
+
if (options.context == null) {
|
|
24471
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
24472
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
24473
|
+
if (additionalContexts.length > 0) {
|
|
24474
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
24475
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24476
|
+
}
|
|
24477
|
+
}
|
|
23275
24478
|
if (docContext != null) {
|
|
23276
24479
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
23277
24480
|
else compacted.proof["@context"] = docContext;
|
|
@@ -26508,7 +27711,7 @@ var Application = class Application extends Object$1 {
|
|
|
26508
27711
|
documentLoader: options.contextLoader,
|
|
26509
27712
|
keepFreeFloatingNodes: true
|
|
26510
27713
|
});
|
|
26511
|
-
|
|
27714
|
+
let docContext = options.context ?? [
|
|
26512
27715
|
"https://www.w3.org/ns/activitystreams",
|
|
26513
27716
|
"https://w3id.org/fep/ef61",
|
|
26514
27717
|
"https://w3id.org/security/v1",
|
|
@@ -26553,7 +27756,15 @@ var Application = class Application extends Object$1 {
|
|
|
26553
27756
|
"isCat": "misskey:isCat"
|
|
26554
27757
|
}
|
|
26555
27758
|
];
|
|
26556
|
-
|
|
27759
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
27760
|
+
if (options.context == null) {
|
|
27761
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
27762
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
27763
|
+
if (additionalContexts.length > 0) {
|
|
27764
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
27765
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
27766
|
+
}
|
|
27767
|
+
}
|
|
26557
27768
|
if (docContext != null) {
|
|
26558
27769
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
26559
27770
|
else compacted.proof["@context"] = docContext;
|
|
@@ -27306,13 +28517,21 @@ var IntransitiveActivity = class IntransitiveActivity extends Activity {
|
|
|
27306
28517
|
documentLoader: options.contextLoader,
|
|
27307
28518
|
keepFreeFloatingNodes: true
|
|
27308
28519
|
});
|
|
27309
|
-
|
|
28520
|
+
let docContext = options.context ?? [
|
|
27310
28521
|
"https://w3id.org/identity/v1",
|
|
27311
28522
|
"https://www.w3.org/ns/activitystreams",
|
|
27312
28523
|
"https://w3id.org/security/data-integrity/v1",
|
|
27313
28524
|
"https://gotosocial.org/ns"
|
|
27314
28525
|
];
|
|
27315
|
-
|
|
28526
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28527
|
+
if (options.context == null) {
|
|
28528
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
28529
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
28530
|
+
if (additionalContexts.length > 0) {
|
|
28531
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
28532
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28533
|
+
}
|
|
28534
|
+
}
|
|
27316
28535
|
if (docContext != null) {
|
|
27317
28536
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
27318
28537
|
else compacted.proof["@context"] = docContext;
|
|
@@ -27482,13 +28701,21 @@ var Arrive = class Arrive extends IntransitiveActivity {
|
|
|
27482
28701
|
documentLoader: options.contextLoader,
|
|
27483
28702
|
keepFreeFloatingNodes: true
|
|
27484
28703
|
});
|
|
27485
|
-
|
|
28704
|
+
let docContext = options.context ?? [
|
|
27486
28705
|
"https://w3id.org/identity/v1",
|
|
27487
28706
|
"https://www.w3.org/ns/activitystreams",
|
|
27488
28707
|
"https://w3id.org/security/data-integrity/v1",
|
|
27489
28708
|
"https://gotosocial.org/ns"
|
|
27490
28709
|
];
|
|
27491
|
-
|
|
28710
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28711
|
+
if (options.context == null) {
|
|
28712
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
28713
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
28714
|
+
if (additionalContexts.length > 0) {
|
|
28715
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
28716
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28717
|
+
}
|
|
28718
|
+
}
|
|
27492
28719
|
if (docContext != null) {
|
|
27493
28720
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
27494
28721
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28059,7 +29286,7 @@ var Article = class Article extends Object$1 {
|
|
|
28059
29286
|
documentLoader: options.contextLoader,
|
|
28060
29287
|
keepFreeFloatingNodes: true
|
|
28061
29288
|
});
|
|
28062
|
-
|
|
29289
|
+
let docContext = options.context ?? [
|
|
28063
29290
|
"https://www.w3.org/ns/activitystreams",
|
|
28064
29291
|
"https://w3id.org/security/data-integrity/v1",
|
|
28065
29292
|
"https://gotosocial.org/ns",
|
|
@@ -28088,7 +29315,15 @@ var Article = class Article extends Object$1 {
|
|
|
28088
29315
|
}
|
|
28089
29316
|
}
|
|
28090
29317
|
];
|
|
28091
|
-
|
|
29318
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29319
|
+
if (options.context == null) {
|
|
29320
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
29321
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
29322
|
+
if (additionalContexts.length > 0) {
|
|
29323
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
29324
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29325
|
+
}
|
|
29326
|
+
}
|
|
28092
29327
|
if (docContext != null) {
|
|
28093
29328
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
28094
29329
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28445,13 +29680,21 @@ var Document = class Document extends Object$1 {
|
|
|
28445
29680
|
documentLoader: options.contextLoader,
|
|
28446
29681
|
keepFreeFloatingNodes: true
|
|
28447
29682
|
});
|
|
28448
|
-
|
|
29683
|
+
let docContext = options.context ?? [
|
|
28449
29684
|
"https://www.w3.org/ns/activitystreams",
|
|
28450
29685
|
"https://w3id.org/security/data-integrity/v2",
|
|
28451
29686
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
28452
29687
|
"https://gotosocial.org/ns"
|
|
28453
29688
|
];
|
|
28454
|
-
|
|
29689
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29690
|
+
if (options.context == null) {
|
|
29691
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
29692
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
29693
|
+
if (additionalContexts.length > 0) {
|
|
29694
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
29695
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29696
|
+
}
|
|
29697
|
+
}
|
|
28455
29698
|
if (docContext != null) {
|
|
28456
29699
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
28457
29700
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28691,13 +29934,21 @@ var Audio = class Audio extends Document {
|
|
|
28691
29934
|
documentLoader: options.contextLoader,
|
|
28692
29935
|
keepFreeFloatingNodes: true
|
|
28693
29936
|
});
|
|
28694
|
-
|
|
29937
|
+
let docContext = options.context ?? [
|
|
28695
29938
|
"https://www.w3.org/ns/activitystreams",
|
|
28696
29939
|
"https://w3id.org/security/data-integrity/v2",
|
|
28697
29940
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
28698
29941
|
"https://gotosocial.org/ns"
|
|
28699
29942
|
];
|
|
28700
|
-
|
|
29943
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29944
|
+
if (options.context == null) {
|
|
29945
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
29946
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
29947
|
+
if (additionalContexts.length > 0) {
|
|
29948
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
29949
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29950
|
+
}
|
|
29951
|
+
}
|
|
28701
29952
|
if (docContext != null) {
|
|
28702
29953
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
28703
29954
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28857,194 +30108,210 @@ var Ignore = class Ignore extends Activity {
|
|
|
28857
30108
|
format: "expand",
|
|
28858
30109
|
context: void 0
|
|
28859
30110
|
}))[0];
|
|
28860
|
-
values["@type"] = ["https://www.w3.org/ns/activitystreams#Ignore"];
|
|
30111
|
+
values["@type"] = ["https://www.w3.org/ns/activitystreams#Ignore"];
|
|
30112
|
+
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
30113
|
+
if (options.format === "expand") return await jsonld.expand(values, {
|
|
30114
|
+
documentLoader: options.contextLoader,
|
|
30115
|
+
keepFreeFloatingNodes: true
|
|
30116
|
+
});
|
|
30117
|
+
let docContext = options.context ?? [
|
|
30118
|
+
"https://w3id.org/identity/v1",
|
|
30119
|
+
"https://www.w3.org/ns/activitystreams",
|
|
30120
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
30121
|
+
"https://gotosocial.org/ns"
|
|
30122
|
+
];
|
|
30123
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30124
|
+
if (options.context == null) {
|
|
30125
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
30126
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
30127
|
+
if (additionalContexts.length > 0) {
|
|
30128
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
30129
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30130
|
+
}
|
|
30131
|
+
}
|
|
30132
|
+
if (docContext != null) {
|
|
30133
|
+
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30134
|
+
else compacted.proof["@context"] = docContext;
|
|
30135
|
+
}
|
|
30136
|
+
return compacted;
|
|
30137
|
+
}
|
|
30138
|
+
isCompactable() {
|
|
30139
|
+
return super.isCompactable();
|
|
30140
|
+
}
|
|
30141
|
+
/**
|
|
30142
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
30143
|
+
* @param json The JSON-LD structure to convert.
|
|
30144
|
+
* @param options The options to use.
|
|
30145
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
30146
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
30147
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
30148
|
+
* If omitted, the global tracer provider is used.
|
|
30149
|
+
* @returns The object of this type.
|
|
30150
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
30151
|
+
*/
|
|
30152
|
+
static async fromJsonLd(json, options = {}) {
|
|
30153
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
30154
|
+
try {
|
|
30155
|
+
const object = await this.__fromJsonLd__Ignore__(json, span, options);
|
|
30156
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
30157
|
+
return object;
|
|
30158
|
+
} catch (error) {
|
|
30159
|
+
span.setStatus({
|
|
30160
|
+
code: SpanStatusCode.ERROR,
|
|
30161
|
+
message: String(error)
|
|
30162
|
+
});
|
|
30163
|
+
throw error;
|
|
30164
|
+
} finally {
|
|
30165
|
+
span.end();
|
|
30166
|
+
}
|
|
30167
|
+
});
|
|
30168
|
+
}
|
|
30169
|
+
static async __fromJsonLd__Ignore__(json, span, options = {}) {
|
|
30170
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
30171
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
30172
|
+
options = {
|
|
30173
|
+
...options,
|
|
30174
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
30175
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
30176
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
30177
|
+
};
|
|
30178
|
+
let values;
|
|
30179
|
+
let expanded;
|
|
30180
|
+
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
30181
|
+
values = json;
|
|
30182
|
+
expanded = [values];
|
|
30183
|
+
} else if (globalThis.Object.keys(json).length == 0) {
|
|
30184
|
+
values = {};
|
|
30185
|
+
expanded = [values];
|
|
30186
|
+
} else {
|
|
30187
|
+
expanded = await jsonld.expand(json, {
|
|
30188
|
+
documentLoader: options.contextLoader,
|
|
30189
|
+
keepFreeFloatingNodes: true
|
|
30190
|
+
});
|
|
30191
|
+
values = expanded[0] ?? {};
|
|
30192
|
+
}
|
|
30193
|
+
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
30194
|
+
if (id != null && options.baseUrl == null) options = {
|
|
30195
|
+
...options,
|
|
30196
|
+
baseUrl: id
|
|
30197
|
+
};
|
|
30198
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
30199
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
30200
|
+
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) return await Block.fromJsonLd(json, options);
|
|
30201
|
+
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
30202
|
+
}
|
|
30203
|
+
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
30204
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
30205
|
+
const superValues = structuredClone(values);
|
|
30206
|
+
delete superValues["@type"];
|
|
30207
|
+
const instance = await super.fromJsonLd(superValues, {
|
|
30208
|
+
...options,
|
|
30209
|
+
_fromSubclass: true
|
|
30210
|
+
});
|
|
30211
|
+
if (!(instance instanceof Ignore)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
30212
|
+
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
30213
|
+
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
30214
|
+
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
30215
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
30216
|
+
const compactArray = Array.isArray(json) && json.length === 1;
|
|
30217
|
+
const jsonLd = compactArray ? json[0] : json;
|
|
30218
|
+
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
30219
|
+
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
30220
|
+
} else instance._cachedJsonLd = structuredClone(json);
|
|
30221
|
+
} catch {
|
|
30222
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
30223
|
+
}
|
|
30224
|
+
return instance;
|
|
30225
|
+
}
|
|
30226
|
+
_getCustomInspectProxy() {
|
|
30227
|
+
return super._getCustomInspectProxy();
|
|
30228
|
+
}
|
|
30229
|
+
};
|
|
30230
|
+
Ignore.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
30231
|
+
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
30232
|
+
};
|
|
30233
|
+
Ignore.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
30234
|
+
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
30235
|
+
};
|
|
30236
|
+
/** Indicates that the `actor` is blocking the `object`. Blocking is a stronger
|
|
30237
|
+
* form of {@link Ignore}. The typical use is to support social systems that
|
|
30238
|
+
* allow one user to block activities or content of other users. The `target`
|
|
30239
|
+
* and `origin` typically have no defined meaning.
|
|
30240
|
+
*/
|
|
30241
|
+
var Block = class Block extends Ignore {
|
|
30242
|
+
/**
|
|
30243
|
+
* The type URI of {@link Block}: `https://www.w3.org/ns/activitystreams#Block`.
|
|
30244
|
+
*/
|
|
30245
|
+
static get typeId() {
|
|
30246
|
+
return new URL("https://www.w3.org/ns/activitystreams#Block");
|
|
30247
|
+
}
|
|
30248
|
+
/**
|
|
30249
|
+
* Constructs a new instance of Block with the given values.
|
|
30250
|
+
* @param values The values to initialize the instance with.
|
|
30251
|
+
* @param options The options to use for initialization.
|
|
30252
|
+
*/
|
|
30253
|
+
constructor(values, options = {}) {
|
|
30254
|
+
super(values, options);
|
|
30255
|
+
}
|
|
30256
|
+
/**
|
|
30257
|
+
* Clones this instance, optionally updating it with the given values.
|
|
30258
|
+
* @param values The values to update the clone with.
|
|
30259
|
+
* @param options The options to use for cloning.
|
|
30260
|
+
* @returns The cloned instance.
|
|
30261
|
+
*/
|
|
30262
|
+
clone(values = {}, options = {}) {
|
|
30263
|
+
if (this._warning != null) {
|
|
30264
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
30265
|
+
options = {
|
|
30266
|
+
...options,
|
|
30267
|
+
$warning: this._warning
|
|
30268
|
+
};
|
|
30269
|
+
}
|
|
30270
|
+
return super.clone(values, options);
|
|
30271
|
+
}
|
|
30272
|
+
/**
|
|
30273
|
+
* Converts this object to a JSON-LD structure.
|
|
30274
|
+
* @param options The options to use.
|
|
30275
|
+
* - `format`: The format of the output: `compact` or
|
|
30276
|
+
`expand`.
|
|
30277
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
30278
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
30279
|
+
when `format` is set to `'expand'`.
|
|
30280
|
+
* @returns The JSON-LD representation of this object.
|
|
30281
|
+
*/
|
|
30282
|
+
async toJsonLd(options = {}) {
|
|
30283
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
30284
|
+
if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
|
|
30285
|
+
options = {
|
|
30286
|
+
...options,
|
|
30287
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
30288
|
+
};
|
|
30289
|
+
const values = (await super.toJsonLd({
|
|
30290
|
+
...options,
|
|
30291
|
+
format: "expand",
|
|
30292
|
+
context: void 0
|
|
30293
|
+
}))[0];
|
|
30294
|
+
values["@type"] = ["https://www.w3.org/ns/activitystreams#Block"];
|
|
28861
30295
|
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
28862
30296
|
if (options.format === "expand") return await jsonld.expand(values, {
|
|
28863
30297
|
documentLoader: options.contextLoader,
|
|
28864
30298
|
keepFreeFloatingNodes: true
|
|
28865
30299
|
});
|
|
28866
|
-
|
|
30300
|
+
let docContext = options.context ?? [
|
|
28867
30301
|
"https://w3id.org/identity/v1",
|
|
28868
30302
|
"https://www.w3.org/ns/activitystreams",
|
|
28869
30303
|
"https://w3id.org/security/data-integrity/v1",
|
|
28870
30304
|
"https://gotosocial.org/ns"
|
|
28871
30305
|
];
|
|
28872
|
-
|
|
28873
|
-
if (
|
|
28874
|
-
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
28878
|
-
|
|
28879
|
-
isCompactable() {
|
|
28880
|
-
return super.isCompactable();
|
|
28881
|
-
}
|
|
28882
|
-
/**
|
|
28883
|
-
* Converts a JSON-LD structure to an object of this type.
|
|
28884
|
-
* @param json The JSON-LD structure to convert.
|
|
28885
|
-
* @param options The options to use.
|
|
28886
|
-
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
28887
|
-
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
28888
|
-
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
28889
|
-
* If omitted, the global tracer provider is used.
|
|
28890
|
-
* @returns The object of this type.
|
|
28891
|
-
* @throws {TypeError} If the given `json` is invalid.
|
|
28892
|
-
*/
|
|
28893
|
-
static async fromJsonLd(json, options = {}) {
|
|
28894
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
28895
|
-
try {
|
|
28896
|
-
const object = await this.__fromJsonLd__Ignore__(json, span, options);
|
|
28897
|
-
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
28898
|
-
return object;
|
|
28899
|
-
} catch (error) {
|
|
28900
|
-
span.setStatus({
|
|
28901
|
-
code: SpanStatusCode.ERROR,
|
|
28902
|
-
message: String(error)
|
|
28903
|
-
});
|
|
28904
|
-
throw error;
|
|
28905
|
-
} finally {
|
|
28906
|
-
span.end();
|
|
30306
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30307
|
+
if (options.context == null) {
|
|
30308
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
30309
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
30310
|
+
if (additionalContexts.length > 0) {
|
|
30311
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
30312
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28907
30313
|
}
|
|
28908
|
-
});
|
|
28909
|
-
}
|
|
28910
|
-
static async __fromJsonLd__Ignore__(json, span, options = {}) {
|
|
28911
|
-
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
28912
|
-
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
28913
|
-
options = {
|
|
28914
|
-
...options,
|
|
28915
|
-
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
28916
|
-
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
28917
|
-
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
28918
|
-
};
|
|
28919
|
-
let values;
|
|
28920
|
-
let expanded;
|
|
28921
|
-
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
28922
|
-
values = json;
|
|
28923
|
-
expanded = [values];
|
|
28924
|
-
} else if (globalThis.Object.keys(json).length == 0) {
|
|
28925
|
-
values = {};
|
|
28926
|
-
expanded = [values];
|
|
28927
|
-
} else {
|
|
28928
|
-
expanded = await jsonld.expand(json, {
|
|
28929
|
-
documentLoader: options.contextLoader,
|
|
28930
|
-
keepFreeFloatingNodes: true
|
|
28931
|
-
});
|
|
28932
|
-
values = expanded[0] ?? {};
|
|
28933
30314
|
}
|
|
28934
|
-
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
28935
|
-
if (id != null && options.baseUrl == null) options = {
|
|
28936
|
-
...options,
|
|
28937
|
-
baseUrl: id
|
|
28938
|
-
};
|
|
28939
|
-
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
28940
|
-
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
28941
|
-
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) return await Block.fromJsonLd(json, options);
|
|
28942
|
-
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
28943
|
-
}
|
|
28944
|
-
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
28945
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
28946
|
-
const superValues = structuredClone(values);
|
|
28947
|
-
delete superValues["@type"];
|
|
28948
|
-
const instance = await super.fromJsonLd(superValues, {
|
|
28949
|
-
...options,
|
|
28950
|
-
_fromSubclass: true
|
|
28951
|
-
});
|
|
28952
|
-
if (!(instance instanceof Ignore)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
28953
|
-
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
28954
|
-
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
28955
|
-
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
28956
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
28957
|
-
const compactArray = Array.isArray(json) && json.length === 1;
|
|
28958
|
-
const jsonLd = compactArray ? json[0] : json;
|
|
28959
|
-
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
28960
|
-
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
28961
|
-
} else instance._cachedJsonLd = structuredClone(json);
|
|
28962
|
-
} catch {
|
|
28963
|
-
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
28964
|
-
}
|
|
28965
|
-
return instance;
|
|
28966
|
-
}
|
|
28967
|
-
_getCustomInspectProxy() {
|
|
28968
|
-
return super._getCustomInspectProxy();
|
|
28969
|
-
}
|
|
28970
|
-
};
|
|
28971
|
-
Ignore.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
28972
|
-
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
28973
|
-
};
|
|
28974
|
-
Ignore.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
28975
|
-
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
28976
|
-
};
|
|
28977
|
-
/** Indicates that the `actor` is blocking the `object`. Blocking is a stronger
|
|
28978
|
-
* form of {@link Ignore}. The typical use is to support social systems that
|
|
28979
|
-
* allow one user to block activities or content of other users. The `target`
|
|
28980
|
-
* and `origin` typically have no defined meaning.
|
|
28981
|
-
*/
|
|
28982
|
-
var Block = class Block extends Ignore {
|
|
28983
|
-
/**
|
|
28984
|
-
* The type URI of {@link Block}: `https://www.w3.org/ns/activitystreams#Block`.
|
|
28985
|
-
*/
|
|
28986
|
-
static get typeId() {
|
|
28987
|
-
return new URL("https://www.w3.org/ns/activitystreams#Block");
|
|
28988
|
-
}
|
|
28989
|
-
/**
|
|
28990
|
-
* Constructs a new instance of Block with the given values.
|
|
28991
|
-
* @param values The values to initialize the instance with.
|
|
28992
|
-
* @param options The options to use for initialization.
|
|
28993
|
-
*/
|
|
28994
|
-
constructor(values, options = {}) {
|
|
28995
|
-
super(values, options);
|
|
28996
|
-
}
|
|
28997
|
-
/**
|
|
28998
|
-
* Clones this instance, optionally updating it with the given values.
|
|
28999
|
-
* @param values The values to update the clone with.
|
|
29000
|
-
* @param options The options to use for cloning.
|
|
29001
|
-
* @returns The cloned instance.
|
|
29002
|
-
*/
|
|
29003
|
-
clone(values = {}, options = {}) {
|
|
29004
|
-
if (this._warning != null) {
|
|
29005
|
-
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
29006
|
-
options = {
|
|
29007
|
-
...options,
|
|
29008
|
-
$warning: this._warning
|
|
29009
|
-
};
|
|
29010
|
-
}
|
|
29011
|
-
return super.clone(values, options);
|
|
29012
|
-
}
|
|
29013
|
-
/**
|
|
29014
|
-
* Converts this object to a JSON-LD structure.
|
|
29015
|
-
* @param options The options to use.
|
|
29016
|
-
* - `format`: The format of the output: `compact` or
|
|
29017
|
-
`expand`.
|
|
29018
|
-
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
29019
|
-
* - `context`: The JSON-LD context to use. Not applicable
|
|
29020
|
-
when `format` is set to `'expand'`.
|
|
29021
|
-
* @returns The JSON-LD representation of this object.
|
|
29022
|
-
*/
|
|
29023
|
-
async toJsonLd(options = {}) {
|
|
29024
|
-
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
29025
|
-
if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
|
|
29026
|
-
options = {
|
|
29027
|
-
...options,
|
|
29028
|
-
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
29029
|
-
};
|
|
29030
|
-
const values = (await super.toJsonLd({
|
|
29031
|
-
...options,
|
|
29032
|
-
format: "expand",
|
|
29033
|
-
context: void 0
|
|
29034
|
-
}))[0];
|
|
29035
|
-
values["@type"] = ["https://www.w3.org/ns/activitystreams#Block"];
|
|
29036
|
-
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
29037
|
-
if (options.format === "expand") return await jsonld.expand(values, {
|
|
29038
|
-
documentLoader: options.contextLoader,
|
|
29039
|
-
keepFreeFloatingNodes: true
|
|
29040
|
-
});
|
|
29041
|
-
const docContext = options.context ?? [
|
|
29042
|
-
"https://w3id.org/identity/v1",
|
|
29043
|
-
"https://www.w3.org/ns/activitystreams",
|
|
29044
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
29045
|
-
"https://gotosocial.org/ns"
|
|
29046
|
-
];
|
|
29047
|
-
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29048
30315
|
if (docContext != null) {
|
|
29049
30316
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
29050
30317
|
else compacted.proof["@context"] = docContext;
|
|
@@ -29727,7 +30994,7 @@ var CollectionPage = class CollectionPage extends Collection {
|
|
|
29727
30994
|
documentLoader: options.contextLoader,
|
|
29728
30995
|
keepFreeFloatingNodes: true
|
|
29729
30996
|
});
|
|
29730
|
-
|
|
30997
|
+
let docContext = options.context ?? [
|
|
29731
30998
|
"https://www.w3.org/ns/activitystreams",
|
|
29732
30999
|
"https://w3id.org/security/data-integrity/v1",
|
|
29733
31000
|
"https://gotosocial.org/ns",
|
|
@@ -29759,7 +31026,15 @@ var CollectionPage = class CollectionPage extends Collection {
|
|
|
29759
31026
|
}
|
|
29760
31027
|
}
|
|
29761
31028
|
];
|
|
29762
|
-
|
|
31029
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31030
|
+
if (options.context == null) {
|
|
31031
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31032
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31033
|
+
if (additionalContexts.length > 0) {
|
|
31034
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31035
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31036
|
+
}
|
|
31037
|
+
}
|
|
29763
31038
|
if (docContext != null) {
|
|
29764
31039
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
29765
31040
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30004,7 +31279,7 @@ var Create = class Create extends Activity {
|
|
|
30004
31279
|
documentLoader: options.contextLoader,
|
|
30005
31280
|
keepFreeFloatingNodes: true
|
|
30006
31281
|
});
|
|
30007
|
-
|
|
31282
|
+
let docContext = options.context ?? [
|
|
30008
31283
|
"https://w3id.org/identity/v1",
|
|
30009
31284
|
"https://www.w3.org/ns/activitystreams",
|
|
30010
31285
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -30040,7 +31315,15 @@ var Create = class Create extends Activity {
|
|
|
30040
31315
|
}
|
|
30041
31316
|
}
|
|
30042
31317
|
];
|
|
30043
|
-
|
|
31318
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31319
|
+
if (options.context == null) {
|
|
31320
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31321
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31322
|
+
if (additionalContexts.length > 0) {
|
|
31323
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31324
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31325
|
+
}
|
|
31326
|
+
}
|
|
30044
31327
|
if (docContext != null) {
|
|
30045
31328
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30046
31329
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30206,7 +31489,7 @@ var Delete = class Delete extends Activity {
|
|
|
30206
31489
|
documentLoader: options.contextLoader,
|
|
30207
31490
|
keepFreeFloatingNodes: true
|
|
30208
31491
|
});
|
|
30209
|
-
|
|
31492
|
+
let docContext = options.context ?? [
|
|
30210
31493
|
"https://w3id.org/identity/v1",
|
|
30211
31494
|
"https://www.w3.org/ns/activitystreams",
|
|
30212
31495
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -30238,7 +31521,15 @@ var Delete = class Delete extends Activity {
|
|
|
30238
31521
|
}
|
|
30239
31522
|
}
|
|
30240
31523
|
];
|
|
30241
|
-
|
|
31524
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31525
|
+
if (options.context == null) {
|
|
31526
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31527
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31528
|
+
if (additionalContexts.length > 0) {
|
|
31529
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31530
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31531
|
+
}
|
|
31532
|
+
}
|
|
30242
31533
|
if (docContext != null) {
|
|
30243
31534
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30244
31535
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30403,7 +31694,7 @@ var Dislike = class Dislike extends Activity {
|
|
|
30403
31694
|
documentLoader: options.contextLoader,
|
|
30404
31695
|
keepFreeFloatingNodes: true
|
|
30405
31696
|
});
|
|
30406
|
-
|
|
31697
|
+
let docContext = options.context ?? [
|
|
30407
31698
|
"https://w3id.org/identity/v1",
|
|
30408
31699
|
"https://www.w3.org/ns/activitystreams",
|
|
30409
31700
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -30413,7 +31704,15 @@ var Dislike = class Dislike extends Activity {
|
|
|
30413
31704
|
"Emoji": "toot:Emoji"
|
|
30414
31705
|
}
|
|
30415
31706
|
];
|
|
30416
|
-
|
|
31707
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31708
|
+
if (options.context == null) {
|
|
31709
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31710
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31711
|
+
if (additionalContexts.length > 0) {
|
|
31712
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31713
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31714
|
+
}
|
|
31715
|
+
}
|
|
30417
31716
|
if (docContext != null) {
|
|
30418
31717
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30419
31718
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30866,8 +32165,16 @@ var Endpoints = class {
|
|
|
30866
32165
|
documentLoader: options.contextLoader,
|
|
30867
32166
|
keepFreeFloatingNodes: true
|
|
30868
32167
|
});
|
|
30869
|
-
|
|
30870
|
-
|
|
32168
|
+
let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
|
|
32169
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32170
|
+
if (options.context == null) {
|
|
32171
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32172
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32173
|
+
if (additionalContexts.length > 0) {
|
|
32174
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32175
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32176
|
+
}
|
|
32177
|
+
}
|
|
30871
32178
|
if (docContext != null) {}
|
|
30872
32179
|
return compacted;
|
|
30873
32180
|
}
|
|
@@ -31169,12 +32476,20 @@ var Event = class Event extends Object$1 {
|
|
|
31169
32476
|
documentLoader: options.contextLoader,
|
|
31170
32477
|
keepFreeFloatingNodes: true
|
|
31171
32478
|
});
|
|
31172
|
-
|
|
32479
|
+
let docContext = options.context ?? [
|
|
31173
32480
|
"https://www.w3.org/ns/activitystreams",
|
|
31174
32481
|
"https://w3id.org/security/data-integrity/v1",
|
|
31175
32482
|
"https://gotosocial.org/ns"
|
|
31176
32483
|
];
|
|
31177
|
-
|
|
32484
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32485
|
+
if (options.context == null) {
|
|
32486
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32487
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32488
|
+
if (additionalContexts.length > 0) {
|
|
32489
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32490
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32491
|
+
}
|
|
32492
|
+
}
|
|
31178
32493
|
if (docContext != null) {
|
|
31179
32494
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
31180
32495
|
else compacted.proof["@context"] = docContext;
|
|
@@ -31341,13 +32656,21 @@ var Flag = class Flag extends Activity {
|
|
|
31341
32656
|
documentLoader: options.contextLoader,
|
|
31342
32657
|
keepFreeFloatingNodes: true
|
|
31343
32658
|
});
|
|
31344
|
-
|
|
32659
|
+
let docContext = options.context ?? [
|
|
31345
32660
|
"https://w3id.org/identity/v1",
|
|
31346
32661
|
"https://www.w3.org/ns/activitystreams",
|
|
31347
32662
|
"https://w3id.org/security/data-integrity/v1",
|
|
31348
32663
|
"https://gotosocial.org/ns"
|
|
31349
32664
|
];
|
|
31350
|
-
|
|
32665
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32666
|
+
if (options.context == null) {
|
|
32667
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32668
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32669
|
+
if (additionalContexts.length > 0) {
|
|
32670
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32671
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32672
|
+
}
|
|
32673
|
+
}
|
|
31351
32674
|
if (docContext != null) {
|
|
31352
32675
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
31353
32676
|
else compacted.proof["@context"] = docContext;
|
|
@@ -31515,7 +32838,7 @@ var Follow = class Follow extends Activity {
|
|
|
31515
32838
|
documentLoader: options.contextLoader,
|
|
31516
32839
|
keepFreeFloatingNodes: true
|
|
31517
32840
|
});
|
|
31518
|
-
|
|
32841
|
+
let docContext = options.context ?? [
|
|
31519
32842
|
"https://w3id.org/identity/v1",
|
|
31520
32843
|
"https://www.w3.org/ns/activitystreams",
|
|
31521
32844
|
"https://w3id.org/security/v1",
|
|
@@ -31524,7 +32847,15 @@ var Follow = class Follow extends Activity {
|
|
|
31524
32847
|
"https://w3id.org/security/multikey/v1",
|
|
31525
32848
|
"https://gotosocial.org/ns"
|
|
31526
32849
|
];
|
|
31527
|
-
|
|
32850
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32851
|
+
if (options.context == null) {
|
|
32852
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32853
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32854
|
+
if (additionalContexts.length > 0) {
|
|
32855
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32856
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32857
|
+
}
|
|
32858
|
+
}
|
|
31528
32859
|
if (docContext != null) {
|
|
31529
32860
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
31530
32861
|
else compacted.proof["@context"] = docContext;
|
|
@@ -34761,7 +36092,7 @@ var Group = class Group extends Object$1 {
|
|
|
34761
36092
|
documentLoader: options.contextLoader,
|
|
34762
36093
|
keepFreeFloatingNodes: true
|
|
34763
36094
|
});
|
|
34764
|
-
|
|
36095
|
+
let docContext = options.context ?? [
|
|
34765
36096
|
"https://www.w3.org/ns/activitystreams",
|
|
34766
36097
|
"https://w3id.org/fep/ef61",
|
|
34767
36098
|
"https://w3id.org/security/v1",
|
|
@@ -34806,7 +36137,15 @@ var Group = class Group extends Object$1 {
|
|
|
34806
36137
|
"isCat": "misskey:isCat"
|
|
34807
36138
|
}
|
|
34808
36139
|
];
|
|
34809
|
-
|
|
36140
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
36141
|
+
if (options.context == null) {
|
|
36142
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
36143
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
36144
|
+
if (additionalContexts.length > 0) {
|
|
36145
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
36146
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
36147
|
+
}
|
|
36148
|
+
}
|
|
34810
36149
|
if (docContext != null) {
|
|
34811
36150
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
34812
36151
|
else compacted.proof["@context"] = docContext;
|
|
@@ -36090,8 +37429,16 @@ var Link = class Link {
|
|
|
36090
37429
|
documentLoader: options.contextLoader,
|
|
36091
37430
|
keepFreeFloatingNodes: true
|
|
36092
37431
|
});
|
|
36093
|
-
|
|
36094
|
-
|
|
37432
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/ef61"];
|
|
37433
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37434
|
+
if (options.context == null) {
|
|
37435
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
37436
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
37437
|
+
if (additionalContexts.length > 0) {
|
|
37438
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
37439
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37440
|
+
}
|
|
37441
|
+
}
|
|
36095
37442
|
if (docContext != null) {}
|
|
36096
37443
|
return compacted;
|
|
36097
37444
|
}
|
|
@@ -36517,8 +37864,16 @@ var Hashtag = class Hashtag extends Link {
|
|
|
36517
37864
|
documentLoader: options.contextLoader,
|
|
36518
37865
|
keepFreeFloatingNodes: true
|
|
36519
37866
|
});
|
|
36520
|
-
|
|
36521
|
-
|
|
37867
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", { "Hashtag": "as:Hashtag" }];
|
|
37868
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37869
|
+
if (options.context == null) {
|
|
37870
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
37871
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
37872
|
+
if (additionalContexts.length > 0) {
|
|
37873
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
37874
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37875
|
+
}
|
|
37876
|
+
}
|
|
36522
37877
|
if (docContext != null) {}
|
|
36523
37878
|
return compacted;
|
|
36524
37879
|
}
|
|
@@ -36696,13 +38051,21 @@ var Image = class Image extends Document {
|
|
|
36696
38051
|
documentLoader: options.contextLoader,
|
|
36697
38052
|
keepFreeFloatingNodes: true
|
|
36698
38053
|
});
|
|
36699
|
-
|
|
38054
|
+
let docContext = options.context ?? [
|
|
36700
38055
|
"https://www.w3.org/ns/activitystreams",
|
|
36701
38056
|
"https://w3id.org/security/data-integrity/v2",
|
|
36702
38057
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
36703
38058
|
"https://gotosocial.org/ns"
|
|
36704
38059
|
];
|
|
36705
|
-
|
|
38060
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38061
|
+
if (options.context == null) {
|
|
38062
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38063
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38064
|
+
if (additionalContexts.length > 0) {
|
|
38065
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38066
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38067
|
+
}
|
|
38068
|
+
}
|
|
36706
38069
|
if (docContext != null) {
|
|
36707
38070
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
36708
38071
|
else compacted.proof["@context"] = docContext;
|
|
@@ -36869,13 +38232,21 @@ var Offer = class Offer extends Activity {
|
|
|
36869
38232
|
documentLoader: options.contextLoader,
|
|
36870
38233
|
keepFreeFloatingNodes: true
|
|
36871
38234
|
});
|
|
36872
|
-
|
|
38235
|
+
let docContext = options.context ?? [
|
|
36873
38236
|
"https://w3id.org/identity/v1",
|
|
36874
38237
|
"https://www.w3.org/ns/activitystreams",
|
|
36875
38238
|
"https://w3id.org/security/data-integrity/v1",
|
|
36876
38239
|
"https://gotosocial.org/ns"
|
|
36877
38240
|
];
|
|
36878
|
-
|
|
38241
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38242
|
+
if (options.context == null) {
|
|
38243
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38244
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38245
|
+
if (additionalContexts.length > 0) {
|
|
38246
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38247
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38248
|
+
}
|
|
38249
|
+
}
|
|
36879
38250
|
if (docContext != null) {
|
|
36880
38251
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
36881
38252
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37042,13 +38413,21 @@ var Invite = class Invite extends Offer {
|
|
|
37042
38413
|
documentLoader: options.contextLoader,
|
|
37043
38414
|
keepFreeFloatingNodes: true
|
|
37044
38415
|
});
|
|
37045
|
-
|
|
38416
|
+
let docContext = options.context ?? [
|
|
37046
38417
|
"https://w3id.org/identity/v1",
|
|
37047
38418
|
"https://www.w3.org/ns/activitystreams",
|
|
37048
38419
|
"https://w3id.org/security/data-integrity/v1",
|
|
37049
38420
|
"https://gotosocial.org/ns"
|
|
37050
38421
|
];
|
|
37051
|
-
|
|
38422
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38423
|
+
if (options.context == null) {
|
|
38424
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38425
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38426
|
+
if (additionalContexts.length > 0) {
|
|
38427
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38428
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38429
|
+
}
|
|
38430
|
+
}
|
|
37052
38431
|
if (docContext != null) {
|
|
37053
38432
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37054
38433
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37214,13 +38593,21 @@ var Join = class Join extends Activity {
|
|
|
37214
38593
|
documentLoader: options.contextLoader,
|
|
37215
38594
|
keepFreeFloatingNodes: true
|
|
37216
38595
|
});
|
|
37217
|
-
|
|
38596
|
+
let docContext = options.context ?? [
|
|
37218
38597
|
"https://w3id.org/identity/v1",
|
|
37219
38598
|
"https://www.w3.org/ns/activitystreams",
|
|
37220
38599
|
"https://w3id.org/security/data-integrity/v1",
|
|
37221
38600
|
"https://gotosocial.org/ns"
|
|
37222
38601
|
];
|
|
37223
|
-
|
|
38602
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38603
|
+
if (options.context == null) {
|
|
38604
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38605
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38606
|
+
if (additionalContexts.length > 0) {
|
|
38607
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38608
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38609
|
+
}
|
|
38610
|
+
}
|
|
37224
38611
|
if (docContext != null) {
|
|
37225
38612
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37226
38613
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37386,13 +38773,21 @@ var Leave = class Leave extends Activity {
|
|
|
37386
38773
|
documentLoader: options.contextLoader,
|
|
37387
38774
|
keepFreeFloatingNodes: true
|
|
37388
38775
|
});
|
|
37389
|
-
|
|
38776
|
+
let docContext = options.context ?? [
|
|
37390
38777
|
"https://w3id.org/identity/v1",
|
|
37391
38778
|
"https://www.w3.org/ns/activitystreams",
|
|
37392
38779
|
"https://w3id.org/security/data-integrity/v1",
|
|
37393
38780
|
"https://gotosocial.org/ns"
|
|
37394
38781
|
];
|
|
37395
|
-
|
|
38782
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38783
|
+
if (options.context == null) {
|
|
38784
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38785
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38786
|
+
if (additionalContexts.length > 0) {
|
|
38787
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38788
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38789
|
+
}
|
|
38790
|
+
}
|
|
37396
38791
|
if (docContext != null) {
|
|
37397
38792
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37398
38793
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37558,7 +38953,7 @@ var Like = class Like extends Activity {
|
|
|
37558
38953
|
documentLoader: options.contextLoader,
|
|
37559
38954
|
keepFreeFloatingNodes: true
|
|
37560
38955
|
});
|
|
37561
|
-
|
|
38956
|
+
let docContext = options.context ?? [
|
|
37562
38957
|
"https://w3id.org/identity/v1",
|
|
37563
38958
|
"https://www.w3.org/ns/activitystreams",
|
|
37564
38959
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -37568,7 +38963,15 @@ var Like = class Like extends Activity {
|
|
|
37568
38963
|
"Emoji": "toot:Emoji"
|
|
37569
38964
|
}
|
|
37570
38965
|
];
|
|
37571
|
-
|
|
38966
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38967
|
+
if (options.context == null) {
|
|
38968
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38969
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38970
|
+
if (additionalContexts.length > 0) {
|
|
38971
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38972
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38973
|
+
}
|
|
38974
|
+
}
|
|
37572
38975
|
if (docContext != null) {
|
|
37573
38976
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37574
38977
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37733,13 +39136,21 @@ var Listen = class Listen extends Activity {
|
|
|
37733
39136
|
documentLoader: options.contextLoader,
|
|
37734
39137
|
keepFreeFloatingNodes: true
|
|
37735
39138
|
});
|
|
37736
|
-
|
|
39139
|
+
let docContext = options.context ?? [
|
|
37737
39140
|
"https://w3id.org/identity/v1",
|
|
37738
39141
|
"https://www.w3.org/ns/activitystreams",
|
|
37739
39142
|
"https://w3id.org/security/data-integrity/v1",
|
|
37740
39143
|
"https://gotosocial.org/ns"
|
|
37741
39144
|
];
|
|
37742
|
-
|
|
39145
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39146
|
+
if (options.context == null) {
|
|
39147
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39148
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39149
|
+
if (additionalContexts.length > 0) {
|
|
39150
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39151
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39152
|
+
}
|
|
39153
|
+
}
|
|
37743
39154
|
if (docContext != null) {
|
|
37744
39155
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37745
39156
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37915,8 +39326,16 @@ var Mention = class Mention extends Link {
|
|
|
37915
39326
|
documentLoader: options.contextLoader,
|
|
37916
39327
|
keepFreeFloatingNodes: true
|
|
37917
39328
|
});
|
|
37918
|
-
|
|
37919
|
-
|
|
39329
|
+
let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
|
|
39330
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39331
|
+
if (options.context == null) {
|
|
39332
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39333
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39334
|
+
if (additionalContexts.length > 0) {
|
|
39335
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39336
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39337
|
+
}
|
|
39338
|
+
}
|
|
37920
39339
|
if (docContext != null) {}
|
|
37921
39340
|
return compacted;
|
|
37922
39341
|
}
|
|
@@ -38080,13 +39499,21 @@ var Move = class Move extends Activity {
|
|
|
38080
39499
|
documentLoader: options.contextLoader,
|
|
38081
39500
|
keepFreeFloatingNodes: true
|
|
38082
39501
|
});
|
|
38083
|
-
|
|
39502
|
+
let docContext = options.context ?? [
|
|
38084
39503
|
"https://w3id.org/identity/v1",
|
|
38085
39504
|
"https://www.w3.org/ns/activitystreams",
|
|
38086
39505
|
"https://w3id.org/security/data-integrity/v1",
|
|
38087
39506
|
"https://gotosocial.org/ns"
|
|
38088
39507
|
];
|
|
38089
|
-
|
|
39508
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39509
|
+
if (options.context == null) {
|
|
39510
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39511
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39512
|
+
if (additionalContexts.length > 0) {
|
|
39513
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39514
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39515
|
+
}
|
|
39516
|
+
}
|
|
38090
39517
|
if (docContext != null) {
|
|
38091
39518
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
38092
39519
|
else compacted.proof["@context"] = docContext;
|
|
@@ -38658,7 +40085,7 @@ var Note = class Note extends Object$1 {
|
|
|
38658
40085
|
documentLoader: options.contextLoader,
|
|
38659
40086
|
keepFreeFloatingNodes: true
|
|
38660
40087
|
});
|
|
38661
|
-
|
|
40088
|
+
let docContext = options.context ?? [
|
|
38662
40089
|
"https://www.w3.org/ns/activitystreams",
|
|
38663
40090
|
"https://w3id.org/security/data-integrity/v1",
|
|
38664
40091
|
"https://gotosocial.org/ns",
|
|
@@ -38687,7 +40114,15 @@ var Note = class Note extends Object$1 {
|
|
|
38687
40114
|
}
|
|
38688
40115
|
}
|
|
38689
40116
|
];
|
|
38690
|
-
|
|
40117
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40118
|
+
if (options.context == null) {
|
|
40119
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
40120
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
40121
|
+
if (additionalContexts.length > 0) {
|
|
40122
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
40123
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40124
|
+
}
|
|
40125
|
+
}
|
|
38691
40126
|
if (docContext != null) {
|
|
38692
40127
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
38693
40128
|
else compacted.proof["@context"] = docContext;
|
|
@@ -39179,7 +40614,7 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
|
|
|
39179
40614
|
documentLoader: options.contextLoader,
|
|
39180
40615
|
keepFreeFloatingNodes: true
|
|
39181
40616
|
});
|
|
39182
|
-
|
|
40617
|
+
let docContext = options.context ?? [
|
|
39183
40618
|
"https://www.w3.org/ns/activitystreams",
|
|
39184
40619
|
"https://w3id.org/security/data-integrity/v1",
|
|
39185
40620
|
"https://gotosocial.org/ns",
|
|
@@ -39211,7 +40646,15 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
|
|
|
39211
40646
|
}
|
|
39212
40647
|
}
|
|
39213
40648
|
];
|
|
39214
|
-
|
|
40649
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40650
|
+
if (options.context == null) {
|
|
40651
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
40652
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
40653
|
+
if (additionalContexts.length > 0) {
|
|
40654
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
40655
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40656
|
+
}
|
|
40657
|
+
}
|
|
39215
40658
|
if (docContext != null) {
|
|
39216
40659
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
39217
40660
|
else compacted.proof["@context"] = docContext;
|
|
@@ -42570,7 +44013,7 @@ var Organization = class Organization extends Object$1 {
|
|
|
42570
44013
|
documentLoader: options.contextLoader,
|
|
42571
44014
|
keepFreeFloatingNodes: true
|
|
42572
44015
|
});
|
|
42573
|
-
|
|
44016
|
+
let docContext = options.context ?? [
|
|
42574
44017
|
"https://www.w3.org/ns/activitystreams",
|
|
42575
44018
|
"https://w3id.org/fep/ef61",
|
|
42576
44019
|
"https://w3id.org/security/v1",
|
|
@@ -42615,7 +44058,15 @@ var Organization = class Organization extends Object$1 {
|
|
|
42615
44058
|
"isCat": "misskey:isCat"
|
|
42616
44059
|
}
|
|
42617
44060
|
];
|
|
42618
|
-
|
|
44061
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44062
|
+
if (options.context == null) {
|
|
44063
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
44064
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
44065
|
+
if (additionalContexts.length > 0) {
|
|
44066
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
44067
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44068
|
+
}
|
|
44069
|
+
}
|
|
42619
44070
|
if (docContext != null) {
|
|
42620
44071
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
42621
44072
|
else compacted.proof["@context"] = docContext;
|
|
@@ -43382,13 +44833,21 @@ var Page = class Page extends Document {
|
|
|
43382
44833
|
documentLoader: options.contextLoader,
|
|
43383
44834
|
keepFreeFloatingNodes: true
|
|
43384
44835
|
});
|
|
43385
|
-
|
|
44836
|
+
let docContext = options.context ?? [
|
|
43386
44837
|
"https://www.w3.org/ns/activitystreams",
|
|
43387
44838
|
"https://w3id.org/security/data-integrity/v2",
|
|
43388
44839
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
43389
44840
|
"https://gotosocial.org/ns"
|
|
43390
44841
|
];
|
|
43391
|
-
|
|
44842
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44843
|
+
if (options.context == null) {
|
|
44844
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
44845
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
44846
|
+
if (additionalContexts.length > 0) {
|
|
44847
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
44848
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44849
|
+
}
|
|
44850
|
+
}
|
|
43392
44851
|
if (docContext != null) {
|
|
43393
44852
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
43394
44853
|
else compacted.proof["@context"] = docContext;
|
|
@@ -46625,7 +48084,7 @@ var Person = class Person extends Object$1 {
|
|
|
46625
48084
|
documentLoader: options.contextLoader,
|
|
46626
48085
|
keepFreeFloatingNodes: true
|
|
46627
48086
|
});
|
|
46628
|
-
|
|
48087
|
+
let docContext = options.context ?? [
|
|
46629
48088
|
"https://www.w3.org/ns/activitystreams",
|
|
46630
48089
|
"https://w3id.org/fep/ef61",
|
|
46631
48090
|
"https://w3id.org/security/v1",
|
|
@@ -46670,7 +48129,15 @@ var Person = class Person extends Object$1 {
|
|
|
46670
48129
|
"isCat": "misskey:isCat"
|
|
46671
48130
|
}
|
|
46672
48131
|
];
|
|
46673
|
-
|
|
48132
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
48133
|
+
if (options.context == null) {
|
|
48134
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
48135
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
48136
|
+
if (additionalContexts.length > 0) {
|
|
48137
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
48138
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
48139
|
+
}
|
|
48140
|
+
}
|
|
46674
48141
|
if (docContext != null) {
|
|
46675
48142
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
46676
48143
|
else compacted.proof["@context"] = docContext;
|
|
@@ -47643,12 +49110,20 @@ var Place = class Place extends Object$1 {
|
|
|
47643
49110
|
documentLoader: options.contextLoader,
|
|
47644
49111
|
keepFreeFloatingNodes: true
|
|
47645
49112
|
});
|
|
47646
|
-
|
|
49113
|
+
let docContext = options.context ?? [
|
|
47647
49114
|
"https://www.w3.org/ns/activitystreams",
|
|
47648
49115
|
"https://w3id.org/security/data-integrity/v1",
|
|
47649
49116
|
"https://gotosocial.org/ns"
|
|
47650
49117
|
];
|
|
47651
|
-
|
|
49118
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49119
|
+
if (options.context == null) {
|
|
49120
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
49121
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
49122
|
+
if (additionalContexts.length > 0) {
|
|
49123
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
49124
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49125
|
+
}
|
|
49126
|
+
}
|
|
47652
49127
|
if (docContext != null) {
|
|
47653
49128
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
47654
49129
|
else compacted.proof["@context"] = docContext;
|
|
@@ -48101,12 +49576,20 @@ var Profile = class Profile extends Object$1 {
|
|
|
48101
49576
|
documentLoader: options.contextLoader,
|
|
48102
49577
|
keepFreeFloatingNodes: true
|
|
48103
49578
|
});
|
|
48104
|
-
|
|
49579
|
+
let docContext = options.context ?? [
|
|
48105
49580
|
"https://www.w3.org/ns/activitystreams",
|
|
48106
49581
|
"https://w3id.org/security/data-integrity/v1",
|
|
48107
49582
|
"https://gotosocial.org/ns"
|
|
48108
49583
|
];
|
|
48109
|
-
|
|
49584
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49585
|
+
if (options.context == null) {
|
|
49586
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
49587
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
49588
|
+
if (additionalContexts.length > 0) {
|
|
49589
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
49590
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49591
|
+
}
|
|
49592
|
+
}
|
|
48110
49593
|
if (docContext != null) {
|
|
48111
49594
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
48112
49595
|
else compacted.proof["@context"] = docContext;
|
|
@@ -48998,7 +50481,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
48998
50481
|
documentLoader: options.contextLoader,
|
|
48999
50482
|
keepFreeFloatingNodes: true
|
|
49000
50483
|
});
|
|
49001
|
-
|
|
50484
|
+
let docContext = options.context ?? [
|
|
49002
50485
|
"https://w3id.org/identity/v1",
|
|
49003
50486
|
"https://www.w3.org/ns/activitystreams",
|
|
49004
50487
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -49032,7 +50515,15 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
49032
50515
|
}
|
|
49033
50516
|
}
|
|
49034
50517
|
];
|
|
49035
|
-
|
|
50518
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50519
|
+
if (options.context == null) {
|
|
50520
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
50521
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
50522
|
+
if (additionalContexts.length > 0) {
|
|
50523
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
50524
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50525
|
+
}
|
|
50526
|
+
}
|
|
49036
50527
|
if (docContext != null) {
|
|
49037
50528
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
49038
50529
|
else compacted.proof["@context"] = docContext;
|
|
@@ -49358,13 +50849,21 @@ var Read = class Read extends Activity {
|
|
|
49358
50849
|
documentLoader: options.contextLoader,
|
|
49359
50850
|
keepFreeFloatingNodes: true
|
|
49360
50851
|
});
|
|
49361
|
-
|
|
50852
|
+
let docContext = options.context ?? [
|
|
49362
50853
|
"https://w3id.org/identity/v1",
|
|
49363
50854
|
"https://www.w3.org/ns/activitystreams",
|
|
49364
50855
|
"https://w3id.org/security/data-integrity/v1",
|
|
49365
50856
|
"https://gotosocial.org/ns"
|
|
49366
50857
|
];
|
|
49367
|
-
|
|
50858
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50859
|
+
if (options.context == null) {
|
|
50860
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
50861
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
50862
|
+
if (additionalContexts.length > 0) {
|
|
50863
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
50864
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50865
|
+
}
|
|
50866
|
+
}
|
|
49368
50867
|
if (docContext != null) {
|
|
49369
50868
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
49370
50869
|
else compacted.proof["@context"] = docContext;
|
|
@@ -49530,13 +51029,21 @@ var Reject = class Reject extends Activity {
|
|
|
49530
51029
|
documentLoader: options.contextLoader,
|
|
49531
51030
|
keepFreeFloatingNodes: true
|
|
49532
51031
|
});
|
|
49533
|
-
|
|
51032
|
+
let docContext = options.context ?? [
|
|
49534
51033
|
"https://w3id.org/identity/v1",
|
|
49535
51034
|
"https://www.w3.org/ns/activitystreams",
|
|
49536
51035
|
"https://w3id.org/security/data-integrity/v1",
|
|
49537
51036
|
"https://gotosocial.org/ns"
|
|
49538
51037
|
];
|
|
49539
|
-
|
|
51038
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51039
|
+
if (options.context == null) {
|
|
51040
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
51041
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
51042
|
+
if (additionalContexts.length > 0) {
|
|
51043
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
51044
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51045
|
+
}
|
|
51046
|
+
}
|
|
49540
51047
|
if (docContext != null) {
|
|
49541
51048
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
49542
51049
|
else compacted.proof["@context"] = docContext;
|
|
@@ -50323,12 +51830,20 @@ var Relationship = class Relationship extends Object$1 {
|
|
|
50323
51830
|
documentLoader: options.contextLoader,
|
|
50324
51831
|
keepFreeFloatingNodes: true
|
|
50325
51832
|
});
|
|
50326
|
-
|
|
51833
|
+
let docContext = options.context ?? [
|
|
50327
51834
|
"https://www.w3.org/ns/activitystreams",
|
|
50328
51835
|
"https://w3id.org/security/data-integrity/v1",
|
|
50329
51836
|
"https://gotosocial.org/ns"
|
|
50330
51837
|
];
|
|
50331
|
-
|
|
51838
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51839
|
+
if (options.context == null) {
|
|
51840
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
51841
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
51842
|
+
if (additionalContexts.length > 0) {
|
|
51843
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
51844
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51845
|
+
}
|
|
51846
|
+
}
|
|
50332
51847
|
if (docContext != null) {
|
|
50333
51848
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
50334
51849
|
else compacted.proof["@context"] = docContext;
|
|
@@ -50575,13 +52090,21 @@ var Remove = class Remove extends Activity {
|
|
|
50575
52090
|
documentLoader: options.contextLoader,
|
|
50576
52091
|
keepFreeFloatingNodes: true
|
|
50577
52092
|
});
|
|
50578
|
-
|
|
52093
|
+
let docContext = options.context ?? [
|
|
50579
52094
|
"https://w3id.org/identity/v1",
|
|
50580
52095
|
"https://www.w3.org/ns/activitystreams",
|
|
50581
52096
|
"https://w3id.org/security/data-integrity/v1",
|
|
50582
52097
|
"https://gotosocial.org/ns"
|
|
50583
52098
|
];
|
|
50584
|
-
|
|
52099
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
52100
|
+
if (options.context == null) {
|
|
52101
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
52102
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
52103
|
+
if (additionalContexts.length > 0) {
|
|
52104
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
52105
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
52106
|
+
}
|
|
52107
|
+
}
|
|
50585
52108
|
if (docContext != null) {
|
|
50586
52109
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
50587
52110
|
else compacted.proof["@context"] = docContext;
|
|
@@ -53818,7 +55341,7 @@ var Service = class Service extends Object$1 {
|
|
|
53818
55341
|
documentLoader: options.contextLoader,
|
|
53819
55342
|
keepFreeFloatingNodes: true
|
|
53820
55343
|
});
|
|
53821
|
-
|
|
55344
|
+
let docContext = options.context ?? [
|
|
53822
55345
|
"https://www.w3.org/ns/activitystreams",
|
|
53823
55346
|
"https://w3id.org/fep/ef61",
|
|
53824
55347
|
"https://w3id.org/security/v1",
|
|
@@ -53863,7 +55386,15 @@ var Service = class Service extends Object$1 {
|
|
|
53863
55386
|
"isCat": "misskey:isCat"
|
|
53864
55387
|
}
|
|
53865
55388
|
];
|
|
53866
|
-
|
|
55389
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
55390
|
+
if (options.context == null) {
|
|
55391
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
55392
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
55393
|
+
if (additionalContexts.length > 0) {
|
|
55394
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
55395
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
55396
|
+
}
|
|
55397
|
+
}
|
|
53867
55398
|
if (docContext != null) {
|
|
53868
55399
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
53869
55400
|
else compacted.proof["@context"] = docContext;
|
|
@@ -54745,8 +56276,16 @@ var Source = class {
|
|
|
54745
56276
|
documentLoader: options.contextLoader,
|
|
54746
56277
|
keepFreeFloatingNodes: true
|
|
54747
56278
|
});
|
|
54748
|
-
|
|
54749
|
-
|
|
56279
|
+
let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
|
|
56280
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56281
|
+
if (options.context == null) {
|
|
56282
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56283
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56284
|
+
if (additionalContexts.length > 0) {
|
|
56285
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56286
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56287
|
+
}
|
|
56288
|
+
}
|
|
54750
56289
|
if (docContext != null) {}
|
|
54751
56290
|
return compacted;
|
|
54752
56291
|
}
|
|
@@ -54946,13 +56485,21 @@ var TentativeAccept = class TentativeAccept extends Accept {
|
|
|
54946
56485
|
documentLoader: options.contextLoader,
|
|
54947
56486
|
keepFreeFloatingNodes: true
|
|
54948
56487
|
});
|
|
54949
|
-
|
|
56488
|
+
let docContext = options.context ?? [
|
|
54950
56489
|
"https://w3id.org/identity/v1",
|
|
54951
56490
|
"https://www.w3.org/ns/activitystreams",
|
|
54952
56491
|
"https://w3id.org/security/data-integrity/v1",
|
|
54953
56492
|
"https://gotosocial.org/ns"
|
|
54954
56493
|
];
|
|
54955
|
-
|
|
56494
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56495
|
+
if (options.context == null) {
|
|
56496
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56497
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56498
|
+
if (additionalContexts.length > 0) {
|
|
56499
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56500
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56501
|
+
}
|
|
56502
|
+
}
|
|
54956
56503
|
if (docContext != null) {
|
|
54957
56504
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
54958
56505
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55118,13 +56665,21 @@ var TentativeReject = class TentativeReject extends Reject {
|
|
|
55118
56665
|
documentLoader: options.contextLoader,
|
|
55119
56666
|
keepFreeFloatingNodes: true
|
|
55120
56667
|
});
|
|
55121
|
-
|
|
56668
|
+
let docContext = options.context ?? [
|
|
55122
56669
|
"https://w3id.org/identity/v1",
|
|
55123
56670
|
"https://www.w3.org/ns/activitystreams",
|
|
55124
56671
|
"https://w3id.org/security/data-integrity/v1",
|
|
55125
56672
|
"https://gotosocial.org/ns"
|
|
55126
56673
|
];
|
|
55127
|
-
|
|
56674
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56675
|
+
if (options.context == null) {
|
|
56676
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56677
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56678
|
+
if (additionalContexts.length > 0) {
|
|
56679
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56680
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56681
|
+
}
|
|
56682
|
+
}
|
|
55128
56683
|
if (docContext != null) {
|
|
55129
56684
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55130
56685
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55389,12 +56944,20 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
55389
56944
|
documentLoader: options.contextLoader,
|
|
55390
56945
|
keepFreeFloatingNodes: true
|
|
55391
56946
|
});
|
|
55392
|
-
|
|
56947
|
+
let docContext = options.context ?? [
|
|
55393
56948
|
"https://www.w3.org/ns/activitystreams",
|
|
55394
56949
|
"https://w3id.org/security/data-integrity/v1",
|
|
55395
56950
|
"https://gotosocial.org/ns"
|
|
55396
56951
|
];
|
|
55397
|
-
|
|
56952
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56953
|
+
if (options.context == null) {
|
|
56954
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56955
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56956
|
+
if (additionalContexts.length > 0) {
|
|
56957
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56958
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56959
|
+
}
|
|
56960
|
+
}
|
|
55398
56961
|
if (docContext != null) {
|
|
55399
56962
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55400
56963
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55606,13 +57169,21 @@ var Travel = class Travel extends IntransitiveActivity {
|
|
|
55606
57169
|
documentLoader: options.contextLoader,
|
|
55607
57170
|
keepFreeFloatingNodes: true
|
|
55608
57171
|
});
|
|
55609
|
-
|
|
57172
|
+
let docContext = options.context ?? [
|
|
55610
57173
|
"https://w3id.org/identity/v1",
|
|
55611
57174
|
"https://www.w3.org/ns/activitystreams",
|
|
55612
57175
|
"https://w3id.org/security/data-integrity/v1",
|
|
55613
57176
|
"https://gotosocial.org/ns"
|
|
55614
57177
|
];
|
|
55615
|
-
|
|
57178
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57179
|
+
if (options.context == null) {
|
|
57180
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57181
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57182
|
+
if (additionalContexts.length > 0) {
|
|
57183
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57184
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57185
|
+
}
|
|
57186
|
+
}
|
|
55616
57187
|
if (docContext != null) {
|
|
55617
57188
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55618
57189
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55783,7 +57354,7 @@ var Undo = class Undo extends Activity {
|
|
|
55783
57354
|
documentLoader: options.contextLoader,
|
|
55784
57355
|
keepFreeFloatingNodes: true
|
|
55785
57356
|
});
|
|
55786
|
-
|
|
57357
|
+
let docContext = options.context ?? [
|
|
55787
57358
|
"https://w3id.org/identity/v1",
|
|
55788
57359
|
"https://www.w3.org/ns/activitystreams",
|
|
55789
57360
|
"https://w3id.org/security/v1",
|
|
@@ -55798,7 +57369,15 @@ var Undo = class Undo extends Activity {
|
|
|
55798
57369
|
"Emoji": "toot:Emoji"
|
|
55799
57370
|
}
|
|
55800
57371
|
];
|
|
55801
|
-
|
|
57372
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57373
|
+
if (options.context == null) {
|
|
57374
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57375
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57376
|
+
if (additionalContexts.length > 0) {
|
|
57377
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57378
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57379
|
+
}
|
|
57380
|
+
}
|
|
55802
57381
|
if (docContext != null) {
|
|
55803
57382
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55804
57383
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55967,7 +57546,7 @@ var Update = class Update extends Activity {
|
|
|
55967
57546
|
documentLoader: options.contextLoader,
|
|
55968
57547
|
keepFreeFloatingNodes: true
|
|
55969
57548
|
});
|
|
55970
|
-
|
|
57549
|
+
let docContext = options.context ?? [
|
|
55971
57550
|
"https://w3id.org/identity/v1",
|
|
55972
57551
|
"https://www.w3.org/ns/activitystreams",
|
|
55973
57552
|
"https://w3id.org/security/v1",
|
|
@@ -56032,7 +57611,15 @@ var Update = class Update extends Activity {
|
|
|
56032
57611
|
}
|
|
56033
57612
|
}
|
|
56034
57613
|
];
|
|
56035
|
-
|
|
57614
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57615
|
+
if (options.context == null) {
|
|
57616
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57617
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57618
|
+
if (additionalContexts.length > 0) {
|
|
57619
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57620
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57621
|
+
}
|
|
57622
|
+
}
|
|
56036
57623
|
if (docContext != null) {
|
|
56037
57624
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
56038
57625
|
else compacted.proof["@context"] = docContext;
|
|
@@ -56213,13 +57800,21 @@ var Video = class Video extends Document {
|
|
|
56213
57800
|
documentLoader: options.contextLoader,
|
|
56214
57801
|
keepFreeFloatingNodes: true
|
|
56215
57802
|
});
|
|
56216
|
-
|
|
57803
|
+
let docContext = options.context ?? [
|
|
56217
57804
|
"https://www.w3.org/ns/activitystreams",
|
|
56218
57805
|
"https://w3id.org/security/data-integrity/v2",
|
|
56219
57806
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
56220
57807
|
"https://gotosocial.org/ns"
|
|
56221
57808
|
];
|
|
56222
|
-
|
|
57809
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57810
|
+
if (options.context == null) {
|
|
57811
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57812
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57813
|
+
if (additionalContexts.length > 0) {
|
|
57814
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57815
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57816
|
+
}
|
|
57817
|
+
}
|
|
56223
57818
|
if (docContext != null) {
|
|
56224
57819
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
56225
57820
|
else compacted.proof["@context"] = docContext;
|
|
@@ -56384,13 +57979,21 @@ var View = class View extends Activity {
|
|
|
56384
57979
|
documentLoader: options.contextLoader,
|
|
56385
57980
|
keepFreeFloatingNodes: true
|
|
56386
57981
|
});
|
|
56387
|
-
|
|
57982
|
+
let docContext = options.context ?? [
|
|
56388
57983
|
"https://w3id.org/identity/v1",
|
|
56389
57984
|
"https://www.w3.org/ns/activitystreams",
|
|
56390
57985
|
"https://w3id.org/security/data-integrity/v1",
|
|
56391
57986
|
"https://gotosocial.org/ns"
|
|
56392
57987
|
];
|
|
56393
|
-
|
|
57988
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57989
|
+
if (options.context == null) {
|
|
57990
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57991
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57992
|
+
if (additionalContexts.length > 0) {
|
|
57993
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57994
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57995
|
+
}
|
|
57996
|
+
}
|
|
56394
57997
|
if (docContext != null) {
|
|
56395
57998
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
56396
57999
|
else compacted.proof["@context"] = docContext;
|
|
@@ -57139,4 +58742,4 @@ async function* traverseCollection(collection, options = {}) {
|
|
|
57139
58742
|
}
|
|
57140
58743
|
}
|
|
57141
58744
|
//#endregion
|
|
57142
|
-
export { Accept, Activity, Add, Agreement, Announce, AnnounceAuthorization, AnnounceRequest, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Commitment, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, FeatureAuthorization, FeatureRequest, FeaturedCollection, FeaturedItem, Flag, Follow, Group, Hashtag, Ignore, Image, Intent, InteractionPolicy, InteractionRule, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, LikeAuthorization, LikeRequest, Link, Listen, Measure, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Proposal, Question, QuoteAuthorization, QuoteRequest, Read, Reject, Relationship, Remove, ReplyAuthorization, ReplyRequest, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getEntityTypeById, getTypeId, isActor, isEntityType, isFediverseHandle, lookupObject, normalizeActorHandle, normalizeLinkToImage, parseFediverseHandle, toAcctUrl, traverseCollection };
|
|
58745
|
+
export { Accept, Activity, Add, Agreement, Announce, AnnounceAuthorization, AnnounceRequest, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Commitment, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, FeatureAuthorization, FeatureRequest, FeaturedCollection, FeaturedItem, Flag, Follow, Group, Hashtag, Ignore, Image, Intent, InteractionPolicy, InteractionRule, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, LikeAuthorization, LikeRequest, Link, Listen, Measure, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Proposal, Question, QuoteAuthorization, QuoteRequest, Read, Reject, Relationship, Remove, ReplyAuthorization, ReplyRequest, Service, Source, TentativeAccept, TentativeReject, Tombstone, Translation, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getEntityTypeById, getTypeId, isActor, isEntityType, isFediverseHandle, lookupObject, normalizeActorHandle, normalizeLinkToImage, parseFediverseHandle, toAcctUrl, traverseCollection };
|