@fedify/vocab 2.4.0-dev.1962 → 2.4.0-dev.1988
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-Cd5h_56C.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-DK1zVuhw.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/actor.test.ts +1 -0
- 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
|
@@ -155,6 +155,7 @@ var vocab_exports = /* @__PURE__ */ __exportAll({
|
|
|
155
155
|
TentativeAccept: () => TentativeAccept,
|
|
156
156
|
TentativeReject: () => TentativeReject,
|
|
157
157
|
Tombstone: () => Tombstone,
|
|
158
|
+
Translation: () => Translation,
|
|
158
159
|
Travel: () => Travel,
|
|
159
160
|
Undo: () => Undo,
|
|
160
161
|
Update: () => Update,
|
|
@@ -172,6 +173,29 @@ function isValidLanguageTag(language) {
|
|
|
172
173
|
throw error;
|
|
173
174
|
}
|
|
174
175
|
}
|
|
176
|
+
const extraPropertyContexts = {
|
|
177
|
+
"https://schema.org/translator": "https://w3id.org/fep/22cd",
|
|
178
|
+
"https://w3id.org/fep/22cd#translations": "https://w3id.org/fep/22cd"
|
|
179
|
+
};
|
|
180
|
+
function getExtraContexts(document) {
|
|
181
|
+
const contexts = /* @__PURE__ */ new Set();
|
|
182
|
+
const pending = [document];
|
|
183
|
+
while (pending.length > 0) {
|
|
184
|
+
const value = pending.pop();
|
|
185
|
+
if (value == null || typeof value !== "object") continue;
|
|
186
|
+
if (Array.isArray(value)) {
|
|
187
|
+
for (const item of value) pending.push(item);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if ("@value" in value) continue;
|
|
191
|
+
for (const [key, child] of globalThis.Object.entries(value)) {
|
|
192
|
+
if (key === "@context") continue;
|
|
193
|
+
if (globalThis.Object.hasOwn(extraPropertyContexts, key)) contexts.add(extraPropertyContexts[key]);
|
|
194
|
+
pending.push(child);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return [...contexts];
|
|
198
|
+
}
|
|
175
199
|
const PORTABLE_IRI_PATTERN = /^ap(?:\+ef61)?:\/\//i;
|
|
176
200
|
const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
177
201
|
"@id",
|
|
@@ -220,6 +244,9 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
|
220
244
|
"https://gotosocial.org/ns#manualApproval",
|
|
221
245
|
"https://gotosocial.org/ns#replyAuthorization",
|
|
222
246
|
"https://misskey-hub.net/ns#_misskey_quote",
|
|
247
|
+
"https://schema.org/isBasedOn",
|
|
248
|
+
"https://schema.org/translationOfWork",
|
|
249
|
+
"https://schema.org/translator",
|
|
223
250
|
"https://w3id.org/fep/044f#quote",
|
|
224
251
|
"https://w3id.org/fep/044f#quoteAuthorization",
|
|
225
252
|
"https://w3id.org/fep/5711#followersOf",
|
|
@@ -306,6 +333,7 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
|
306
333
|
"instrument",
|
|
307
334
|
"interactingObject",
|
|
308
335
|
"interactionTarget",
|
|
336
|
+
"isBasedOn",
|
|
309
337
|
"items",
|
|
310
338
|
"last",
|
|
311
339
|
"likeAuthorization",
|
|
@@ -354,6 +382,8 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
|
|
|
354
382
|
"tag",
|
|
355
383
|
"target",
|
|
356
384
|
"to",
|
|
385
|
+
"translationOfWork",
|
|
386
|
+
"translator",
|
|
357
387
|
"units",
|
|
358
388
|
"uploadMedia",
|
|
359
389
|
"url"
|
|
@@ -471,6 +501,7 @@ var Object$1 = class Object$1 {
|
|
|
471
501
|
#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = /* @__PURE__ */ new Set();
|
|
472
502
|
#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [];
|
|
473
503
|
#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = /* @__PURE__ */ new Set();
|
|
504
|
+
#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = [];
|
|
474
505
|
/**
|
|
475
506
|
* Constructs a new instance of Object with the given values.
|
|
476
507
|
* @param values The values to initialize the instance with.
|
|
@@ -709,6 +740,8 @@ var Object$1 = class Object$1 {
|
|
|
709
740
|
this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization];
|
|
710
741
|
this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0);
|
|
711
742
|
} else throw new TypeError("The announceAuthorization must be of type AnnounceAuthorization | URL.");
|
|
743
|
+
if ("translations" in values && values.translations != null) if (Array.isArray(values.translations) && values.translations.every((v) => v instanceof Translation)) this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations;
|
|
744
|
+
else throw new TypeError("The translations must be an array of type Translation.");
|
|
712
745
|
}
|
|
713
746
|
/**
|
|
714
747
|
* Clones this instance, optionally updating it with the given values.
|
|
@@ -1025,6 +1058,9 @@ var Object$1 = class Object$1 {
|
|
|
1025
1058
|
clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization];
|
|
1026
1059
|
clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = /* @__PURE__ */ new Set([0]);
|
|
1027
1060
|
} else throw new TypeError("The announceAuthorization must be of type AnnounceAuthorization | URL.");
|
|
1061
|
+
clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
1062
|
+
if ("translations" in values && values.translations != null) if (Array.isArray(values.translations) && values.translations.every((v) => v instanceof Translation)) clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations;
|
|
1063
|
+
else throw new TypeError("The translations must be an array of type Translation.");
|
|
1028
1064
|
return clone;
|
|
1029
1065
|
}
|
|
1030
1066
|
async #fetchAttachment(url, options = {}) {
|
|
@@ -4795,6 +4831,16 @@ var Object$1 = class Object$1 {
|
|
|
4795
4831
|
}
|
|
4796
4832
|
return v;
|
|
4797
4833
|
}
|
|
4834
|
+
/** Translation metadata for the language versions in this object's content,
|
|
4835
|
+
* name, or summary maps, as defined by the draft
|
|
4836
|
+
* [FEP-22cd](https://w3id.org/fep/22cd). Each entry describes one translated
|
|
4837
|
+
* language; directly authored languages have no entry. The entries share
|
|
4838
|
+
* this object's identity, replies, and reactions. Translator credit grants
|
|
4839
|
+
* no authority to update the object.
|
|
4840
|
+
*/
|
|
4841
|
+
get translations() {
|
|
4842
|
+
return this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
4843
|
+
}
|
|
4798
4844
|
/**
|
|
4799
4845
|
* Converts this object to a JSON-LD structure.
|
|
4800
4846
|
* @param options The options to use.
|
|
@@ -5197,6 +5243,16 @@ var Object$1 = class Object$1 {
|
|
|
5197
5243
|
compactItems.push(item);
|
|
5198
5244
|
}
|
|
5199
5245
|
if (compactItems.length > 0) result["announceAuthorization"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
5246
|
+
compactItems = [];
|
|
5247
|
+
for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) {
|
|
5248
|
+
const item = await v.toJsonLd({
|
|
5249
|
+
...options,
|
|
5250
|
+
format: void 0,
|
|
5251
|
+
context: void 0
|
|
5252
|
+
});
|
|
5253
|
+
compactItems.push(item);
|
|
5254
|
+
}
|
|
5255
|
+
if (compactItems.length > 0) result["translations"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
5200
5256
|
result["type"] = "Object";
|
|
5201
5257
|
if (this.id != null) result["id"] = formatIri(this.id);
|
|
5202
5258
|
result["@context"] = [
|
|
@@ -5647,13 +5703,24 @@ var Object$1 = class Object$1 {
|
|
|
5647
5703
|
array.push(element);
|
|
5648
5704
|
}
|
|
5649
5705
|
if (array.length > 0) values["https://gotosocial.org/ns#announceAuthorization"] = array;
|
|
5706
|
+
array = [];
|
|
5707
|
+
for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) {
|
|
5708
|
+
let element = await v.toJsonLd(options);
|
|
5709
|
+
if (Array.isArray(element)) {
|
|
5710
|
+
if (element.length < 1) continue;
|
|
5711
|
+
if (element.length == 1) element = element[0];
|
|
5712
|
+
}
|
|
5713
|
+
if (typeof element === "undefined") continue;
|
|
5714
|
+
array.push(element);
|
|
5715
|
+
}
|
|
5716
|
+
if (array.length > 0) values["https://w3id.org/fep/22cd#translations"] = array;
|
|
5650
5717
|
values["@type"] = ["https://www.w3.org/ns/activitystreams#Object"];
|
|
5651
5718
|
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
5652
5719
|
if (options.format === "expand") return await jsonld.expand(values, {
|
|
5653
5720
|
documentLoader: options.contextLoader,
|
|
5654
5721
|
keepFreeFloatingNodes: true
|
|
5655
5722
|
});
|
|
5656
|
-
|
|
5723
|
+
let docContext = options.context ?? [
|
|
5657
5724
|
"https://www.w3.org/ns/activitystreams",
|
|
5658
5725
|
"https://w3id.org/security/data-integrity/v1",
|
|
5659
5726
|
"https://gotosocial.org/ns",
|
|
@@ -5666,7 +5733,15 @@ var Object$1 = class Object$1 {
|
|
|
5666
5733
|
}
|
|
5667
5734
|
}
|
|
5668
5735
|
];
|
|
5669
|
-
|
|
5736
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
5737
|
+
if (options.context == null) {
|
|
5738
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
5739
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
5740
|
+
if (additionalContexts.length > 0) {
|
|
5741
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
5742
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
5743
|
+
}
|
|
5744
|
+
}
|
|
5670
5745
|
if (docContext != null) {
|
|
5671
5746
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
5672
5747
|
else compacted.proof["@context"] = docContext;
|
|
@@ -5679,6 +5754,7 @@ var Object$1 = class Object$1 {
|
|
|
5679
5754
|
if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary != null && this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0) return false;
|
|
5680
5755
|
if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof != null && this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) return false;
|
|
5681
5756
|
if (this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy != null && this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length > 0) return false;
|
|
5757
|
+
if (this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations != null && this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 0) return false;
|
|
5682
5758
|
return true;
|
|
5683
5759
|
}
|
|
5684
5760
|
/**
|
|
@@ -7080,6 +7156,22 @@ var Object$1 = class Object$1 {
|
|
|
7080
7156
|
_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(decoded);
|
|
7081
7157
|
}
|
|
7082
7158
|
instance.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization;
|
|
7159
|
+
const _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = [];
|
|
7160
|
+
let _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array = values["https://w3id.org/fep/22cd#translations"];
|
|
7161
|
+
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) {
|
|
7162
|
+
if (v == null) continue;
|
|
7163
|
+
const decoded = await Translation.fromJsonLd(v, {
|
|
7164
|
+
...options,
|
|
7165
|
+
baseUrl: options.baseUrl
|
|
7166
|
+
});
|
|
7167
|
+
if (typeof decoded === "undefined") {
|
|
7168
|
+
shouldCacheJsonLd = false;
|
|
7169
|
+
continue;
|
|
7170
|
+
}
|
|
7171
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
7172
|
+
_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.push(decoded);
|
|
7173
|
+
}
|
|
7174
|
+
instance.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
7083
7175
|
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
7084
7176
|
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
7085
7177
|
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
@@ -7300,6 +7392,11 @@ var Object$1 = class Object$1 {
|
|
|
7300
7392
|
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
7301
7393
|
} : v);
|
|
7302
7394
|
if (_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length == 1) proxy.announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0];
|
|
7395
|
+
const _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.map((v) => v instanceof URL ? {
|
|
7396
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
7397
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
7398
|
+
} : v);
|
|
7399
|
+
if (_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 1 || !("translation" in proxy) && _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 0) proxy.translations = _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
|
|
7303
7400
|
return proxy;
|
|
7304
7401
|
}
|
|
7305
7402
|
};
|
|
@@ -7384,11 +7481,19 @@ var Emoji = class Emoji extends Object$1 {
|
|
|
7384
7481
|
documentLoader: options.contextLoader,
|
|
7385
7482
|
keepFreeFloatingNodes: true
|
|
7386
7483
|
});
|
|
7387
|
-
|
|
7484
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
7388
7485
|
"toot": "http://joinmastodon.org/ns#",
|
|
7389
7486
|
"Emoji": "toot:Emoji"
|
|
7390
7487
|
}];
|
|
7391
|
-
|
|
7488
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
7489
|
+
if (options.context == null) {
|
|
7490
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
7491
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
7492
|
+
if (additionalContexts.length > 0) {
|
|
7493
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
7494
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
7495
|
+
}
|
|
7496
|
+
}
|
|
7392
7497
|
if (docContext != null) {
|
|
7393
7498
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
7394
7499
|
else compacted.proof["@context"] = docContext;
|
|
@@ -7962,7 +8067,7 @@ var ChatMessage = class ChatMessage extends Object$1 {
|
|
|
7962
8067
|
documentLoader: options.contextLoader,
|
|
7963
8068
|
keepFreeFloatingNodes: true
|
|
7964
8069
|
});
|
|
7965
|
-
|
|
8070
|
+
let docContext = options.context ?? [
|
|
7966
8071
|
"https://www.w3.org/ns/activitystreams",
|
|
7967
8072
|
"https://w3id.org/security/data-integrity/v1",
|
|
7968
8073
|
"https://gotosocial.org/ns",
|
|
@@ -7990,7 +8095,15 @@ var ChatMessage = class ChatMessage extends Object$1 {
|
|
|
7990
8095
|
}
|
|
7991
8096
|
}
|
|
7992
8097
|
];
|
|
7993
|
-
|
|
8098
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
8099
|
+
if (options.context == null) {
|
|
8100
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
8101
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
8102
|
+
if (additionalContexts.length > 0) {
|
|
8103
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
8104
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
8105
|
+
}
|
|
8106
|
+
}
|
|
7994
8107
|
if (docContext != null) {
|
|
7995
8108
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
7996
8109
|
else compacted.proof["@context"] = docContext;
|
|
@@ -9552,14 +9665,22 @@ var Activity = class Activity extends Object$1 {
|
|
|
9552
9665
|
documentLoader: options.contextLoader,
|
|
9553
9666
|
keepFreeFloatingNodes: true
|
|
9554
9667
|
});
|
|
9555
|
-
|
|
9668
|
+
let docContext = options.context ?? [
|
|
9556
9669
|
"https://w3id.org/identity/v1",
|
|
9557
9670
|
"https://www.w3.org/ns/activitystreams",
|
|
9558
9671
|
"https://w3id.org/security/v1",
|
|
9559
9672
|
"https://w3id.org/security/data-integrity/v1",
|
|
9560
9673
|
"https://gotosocial.org/ns"
|
|
9561
9674
|
];
|
|
9562
|
-
|
|
9675
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
9676
|
+
if (options.context == null) {
|
|
9677
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
9678
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
9679
|
+
if (additionalContexts.length > 0) {
|
|
9680
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
9681
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
9682
|
+
}
|
|
9683
|
+
}
|
|
9563
9684
|
if (docContext != null) {
|
|
9564
9685
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
9565
9686
|
else compacted.proof["@context"] = docContext;
|
|
@@ -9934,7 +10055,7 @@ var EmojiReact = class EmojiReact extends Activity {
|
|
|
9934
10055
|
documentLoader: options.contextLoader,
|
|
9935
10056
|
keepFreeFloatingNodes: true
|
|
9936
10057
|
});
|
|
9937
|
-
|
|
10058
|
+
let docContext = options.context ?? [
|
|
9938
10059
|
"https://w3id.org/identity/v1",
|
|
9939
10060
|
"https://www.w3.org/ns/activitystreams",
|
|
9940
10061
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -9946,7 +10067,15 @@ var EmojiReact = class EmojiReact extends Activity {
|
|
|
9946
10067
|
"Emoji": "toot:Emoji"
|
|
9947
10068
|
}
|
|
9948
10069
|
];
|
|
9949
|
-
|
|
10070
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10071
|
+
if (options.context == null) {
|
|
10072
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
10073
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
10074
|
+
if (additionalContexts.length > 0) {
|
|
10075
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
10076
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10077
|
+
}
|
|
10078
|
+
}
|
|
9950
10079
|
if (docContext != null) {
|
|
9951
10080
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
9952
10081
|
else compacted.proof["@context"] = docContext;
|
|
@@ -10239,12 +10368,20 @@ var PropertyValue = class {
|
|
|
10239
10368
|
documentLoader: options.contextLoader,
|
|
10240
10369
|
keepFreeFloatingNodes: true
|
|
10241
10370
|
});
|
|
10242
|
-
|
|
10371
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
10243
10372
|
"schema": "http://schema.org#",
|
|
10244
10373
|
"PropertyValue": "schema:PropertyValue",
|
|
10245
10374
|
"value": "schema:value"
|
|
10246
10375
|
}];
|
|
10247
|
-
|
|
10376
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10377
|
+
if (options.context == null) {
|
|
10378
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
10379
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
10380
|
+
if (additionalContexts.length > 0) {
|
|
10381
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
10382
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10383
|
+
}
|
|
10384
|
+
}
|
|
10248
10385
|
if (docContext != null) {}
|
|
10249
10386
|
return compacted;
|
|
10250
10387
|
}
|
|
@@ -10564,12 +10701,20 @@ var Measure = class {
|
|
|
10564
10701
|
documentLoader: options.contextLoader,
|
|
10565
10702
|
keepFreeFloatingNodes: true
|
|
10566
10703
|
});
|
|
10567
|
-
|
|
10704
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
10568
10705
|
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
10569
10706
|
"hasUnit": "om2:hasUnit",
|
|
10570
10707
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
10571
10708
|
}];
|
|
10572
|
-
|
|
10709
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10710
|
+
if (options.context == null) {
|
|
10711
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
10712
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
10713
|
+
if (additionalContexts.length > 0) {
|
|
10714
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
10715
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
10716
|
+
}
|
|
10717
|
+
}
|
|
10573
10718
|
if (docContext != null) {}
|
|
10574
10719
|
return compacted;
|
|
10575
10720
|
}
|
|
@@ -11106,246 +11251,262 @@ var AnnounceAuthorization = class AnnounceAuthorization extends Object$1 {
|
|
|
11106
11251
|
documentLoader: options.contextLoader,
|
|
11107
11252
|
keepFreeFloatingNodes: true
|
|
11108
11253
|
});
|
|
11109
|
-
|
|
11254
|
+
let docContext = options.context ?? [
|
|
11110
11255
|
"https://www.w3.org/ns/activitystreams",
|
|
11111
11256
|
"https://w3id.org/security/data-integrity/v1",
|
|
11112
11257
|
"https://gotosocial.org/ns"
|
|
11113
11258
|
];
|
|
11114
|
-
|
|
11115
|
-
if (
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
*
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11259
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11260
|
+
if (options.context == null) {
|
|
11261
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
11262
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
11263
|
+
if (additionalContexts.length > 0) {
|
|
11264
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
11265
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11266
|
+
}
|
|
11267
|
+
}
|
|
11268
|
+
if (docContext != null) {
|
|
11269
|
+
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
11270
|
+
else compacted.proof["@context"] = docContext;
|
|
11271
|
+
}
|
|
11272
|
+
return compacted;
|
|
11273
|
+
}
|
|
11274
|
+
isCompactable() {
|
|
11275
|
+
return super.isCompactable();
|
|
11276
|
+
}
|
|
11277
|
+
/**
|
|
11278
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
11279
|
+
* @param json The JSON-LD structure to convert.
|
|
11280
|
+
* @param options The options to use.
|
|
11281
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
11282
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
11283
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
11284
|
+
* If omitted, the global tracer provider is used.
|
|
11285
|
+
* @returns The object of this type.
|
|
11286
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
11287
|
+
*/
|
|
11288
|
+
static async fromJsonLd(json, options = {}) {
|
|
11289
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
11290
|
+
try {
|
|
11291
|
+
const object = await this.__fromJsonLd__AnnounceAuthorization__(json, span, options);
|
|
11292
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
11293
|
+
return object;
|
|
11294
|
+
} catch (error) {
|
|
11295
|
+
span.setStatus({
|
|
11296
|
+
code: SpanStatusCode.ERROR,
|
|
11297
|
+
message: String(error)
|
|
11298
|
+
});
|
|
11299
|
+
throw error;
|
|
11300
|
+
} finally {
|
|
11301
|
+
span.end();
|
|
11302
|
+
}
|
|
11303
|
+
});
|
|
11304
|
+
}
|
|
11305
|
+
static async __fromJsonLd__AnnounceAuthorization__(json, span, options = {}) {
|
|
11306
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
11307
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
11308
|
+
options = {
|
|
11309
|
+
...options,
|
|
11310
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
11311
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
11312
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
11313
|
+
};
|
|
11314
|
+
let values;
|
|
11315
|
+
let expanded;
|
|
11316
|
+
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
11317
|
+
values = json;
|
|
11318
|
+
expanded = [values];
|
|
11319
|
+
} else if (globalThis.Object.keys(json).length == 0) {
|
|
11320
|
+
values = {};
|
|
11321
|
+
expanded = [values];
|
|
11322
|
+
} else {
|
|
11323
|
+
expanded = await jsonld.expand(json, {
|
|
11324
|
+
documentLoader: options.contextLoader,
|
|
11325
|
+
keepFreeFloatingNodes: true
|
|
11326
|
+
});
|
|
11327
|
+
values = expanded[0] ?? {};
|
|
11328
|
+
}
|
|
11329
|
+
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
11330
|
+
if (id != null && options.baseUrl == null) options = {
|
|
11331
|
+
...options,
|
|
11332
|
+
baseUrl: id
|
|
11333
|
+
};
|
|
11334
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
11335
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
11336
|
+
if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
11337
|
+
}
|
|
11338
|
+
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
11339
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
11340
|
+
const superValues = structuredClone(values);
|
|
11341
|
+
delete superValues["@type"];
|
|
11342
|
+
const instance = await super.fromJsonLd(superValues, {
|
|
11343
|
+
...options,
|
|
11344
|
+
_fromSubclass: true
|
|
11345
|
+
});
|
|
11346
|
+
if (!(instance instanceof AnnounceAuthorization)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
11347
|
+
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
11348
|
+
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [];
|
|
11349
|
+
let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"];
|
|
11350
|
+
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) {
|
|
11351
|
+
if (v == null) continue;
|
|
11352
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11353
|
+
if (v["@id"].startsWith("_:")) continue;
|
|
11354
|
+
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(parseIri(v["@id"], options.baseUrl));
|
|
11355
|
+
continue;
|
|
11356
|
+
}
|
|
11357
|
+
const decoded = await Object$1.fromJsonLd(v, {
|
|
11358
|
+
...options,
|
|
11359
|
+
baseUrl: options.baseUrl
|
|
11360
|
+
});
|
|
11361
|
+
if (typeof decoded === "undefined") {
|
|
11362
|
+
shouldCacheJsonLd = false;
|
|
11363
|
+
continue;
|
|
11364
|
+
}
|
|
11365
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11366
|
+
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded);
|
|
11367
|
+
}
|
|
11368
|
+
instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;
|
|
11369
|
+
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [];
|
|
11370
|
+
let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"];
|
|
11371
|
+
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) {
|
|
11372
|
+
if (v == null) continue;
|
|
11373
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11374
|
+
if (v["@id"].startsWith("_:")) continue;
|
|
11375
|
+
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(parseIri(v["@id"], options.baseUrl));
|
|
11376
|
+
continue;
|
|
11377
|
+
}
|
|
11378
|
+
const decoded = await Object$1.fromJsonLd(v, {
|
|
11379
|
+
...options,
|
|
11380
|
+
baseUrl: options.baseUrl
|
|
11381
|
+
});
|
|
11382
|
+
if (typeof decoded === "undefined") {
|
|
11383
|
+
shouldCacheJsonLd = false;
|
|
11384
|
+
continue;
|
|
11385
|
+
}
|
|
11386
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11387
|
+
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded);
|
|
11388
|
+
}
|
|
11389
|
+
instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;
|
|
11390
|
+
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
11391
|
+
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
11392
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
11393
|
+
const compactArray = Array.isArray(json) && json.length === 1;
|
|
11394
|
+
const jsonLd = compactArray ? json[0] : json;
|
|
11395
|
+
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
11396
|
+
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
11397
|
+
} else instance._cachedJsonLd = structuredClone(json);
|
|
11398
|
+
} catch {
|
|
11399
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
11400
|
+
}
|
|
11401
|
+
return instance;
|
|
11402
|
+
}
|
|
11403
|
+
_getCustomInspectProxy() {
|
|
11404
|
+
const proxy = super._getCustomInspectProxy();
|
|
11405
|
+
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.map((v) => v instanceof URL ? {
|
|
11406
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11407
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11408
|
+
} : v);
|
|
11409
|
+
if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0];
|
|
11410
|
+
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.map((v) => v instanceof URL ? {
|
|
11411
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11412
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11413
|
+
} : v);
|
|
11414
|
+
if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0];
|
|
11415
|
+
return proxy;
|
|
11416
|
+
}
|
|
11417
|
+
};
|
|
11418
|
+
AnnounceAuthorization.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
11419
|
+
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11420
|
+
};
|
|
11421
|
+
AnnounceAuthorization.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
11422
|
+
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11423
|
+
};
|
|
11424
|
+
/** A request to announce (boost) a post that requires approval from
|
|
11425
|
+
* the post author.
|
|
11426
|
+
*
|
|
11427
|
+
* The `object` property references the post to be announced, and
|
|
11428
|
+
* the `instrument` property contains the {@link Announce} activity itself.
|
|
11429
|
+
*
|
|
11430
|
+
* The post author responds with an {@link Accept} (with an
|
|
11431
|
+
* {@link AnnounceAuthorization} as `result`) or a {@link Reject}.
|
|
11432
|
+
*
|
|
11433
|
+
* See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/)
|
|
11434
|
+
* for details.
|
|
11435
|
+
*/
|
|
11436
|
+
var AnnounceRequest = class AnnounceRequest extends Activity {
|
|
11437
|
+
/**
|
|
11438
|
+
* The type URI of {@link AnnounceRequest}: `https://gotosocial.org/ns#AnnounceRequest`.
|
|
11439
|
+
*/
|
|
11440
|
+
static get typeId() {
|
|
11441
|
+
return new URL("https://gotosocial.org/ns#AnnounceRequest");
|
|
11442
|
+
}
|
|
11443
|
+
/**
|
|
11444
|
+
* Constructs a new instance of AnnounceRequest with the given values.
|
|
11445
|
+
* @param values The values to initialize the instance with.
|
|
11446
|
+
* @param options The options to use for initialization.
|
|
11447
|
+
*/
|
|
11448
|
+
constructor(values, options = {}) {
|
|
11449
|
+
super(values, options);
|
|
11450
|
+
}
|
|
11451
|
+
/**
|
|
11452
|
+
* Clones this instance, optionally updating it with the given values.
|
|
11453
|
+
* @param values The values to update the clone with.
|
|
11454
|
+
* @param options The options to use for cloning.
|
|
11455
|
+
* @returns The cloned instance.
|
|
11456
|
+
*/
|
|
11457
|
+
clone(values = {}, options = {}) {
|
|
11458
|
+
if (this._warning != null) {
|
|
11459
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
11460
|
+
options = {
|
|
11461
|
+
...options,
|
|
11462
|
+
$warning: this._warning
|
|
11463
|
+
};
|
|
11464
|
+
}
|
|
11465
|
+
return super.clone(values, options);
|
|
11466
|
+
}
|
|
11467
|
+
/**
|
|
11468
|
+
* Converts this object to a JSON-LD structure.
|
|
11469
|
+
* @param options The options to use.
|
|
11470
|
+
* - `format`: The format of the output: `compact` or
|
|
11471
|
+
`expand`.
|
|
11472
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
11473
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
11474
|
+
when `format` is set to `'expand'`.
|
|
11475
|
+
* @returns The JSON-LD representation of this object.
|
|
11476
|
+
*/
|
|
11477
|
+
async toJsonLd(options = {}) {
|
|
11478
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
11479
|
+
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'.");
|
|
11480
|
+
options = {
|
|
11481
|
+
...options,
|
|
11482
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
11483
|
+
};
|
|
11484
|
+
const values = (await super.toJsonLd({
|
|
11485
|
+
...options,
|
|
11486
|
+
format: "expand",
|
|
11487
|
+
context: void 0
|
|
11488
|
+
}))[0];
|
|
11489
|
+
values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"];
|
|
11490
|
+
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
11491
|
+
if (options.format === "expand") return await jsonld.expand(values, {
|
|
11492
|
+
documentLoader: options.contextLoader,
|
|
11493
|
+
keepFreeFloatingNodes: true
|
|
11494
|
+
});
|
|
11495
|
+
let docContext = options.context ?? [
|
|
11496
|
+
"https://w3id.org/identity/v1",
|
|
11497
|
+
"https://www.w3.org/ns/activitystreams",
|
|
11498
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
11499
|
+
"https://gotosocial.org/ns"
|
|
11500
|
+
];
|
|
11501
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11502
|
+
if (options.context == null) {
|
|
11503
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
11504
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
11505
|
+
if (additionalContexts.length > 0) {
|
|
11506
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
11507
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11149
11508
|
}
|
|
11150
|
-
});
|
|
11151
|
-
}
|
|
11152
|
-
static async __fromJsonLd__AnnounceAuthorization__(json, span, options = {}) {
|
|
11153
|
-
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
11154
|
-
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
11155
|
-
options = {
|
|
11156
|
-
...options,
|
|
11157
|
-
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
11158
|
-
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
11159
|
-
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
11160
|
-
};
|
|
11161
|
-
let values;
|
|
11162
|
-
let expanded;
|
|
11163
|
-
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
11164
|
-
values = json;
|
|
11165
|
-
expanded = [values];
|
|
11166
|
-
} else if (globalThis.Object.keys(json).length == 0) {
|
|
11167
|
-
values = {};
|
|
11168
|
-
expanded = [values];
|
|
11169
|
-
} else {
|
|
11170
|
-
expanded = await jsonld.expand(json, {
|
|
11171
|
-
documentLoader: options.contextLoader,
|
|
11172
|
-
keepFreeFloatingNodes: true
|
|
11173
|
-
});
|
|
11174
|
-
values = expanded[0] ?? {};
|
|
11175
11509
|
}
|
|
11176
|
-
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
11177
|
-
if (id != null && options.baseUrl == null) options = {
|
|
11178
|
-
...options,
|
|
11179
|
-
baseUrl: id
|
|
11180
|
-
};
|
|
11181
|
-
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
11182
|
-
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
11183
|
-
if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
11184
|
-
}
|
|
11185
|
-
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
11186
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
11187
|
-
const superValues = structuredClone(values);
|
|
11188
|
-
delete superValues["@type"];
|
|
11189
|
-
const instance = await super.fromJsonLd(superValues, {
|
|
11190
|
-
...options,
|
|
11191
|
-
_fromSubclass: true
|
|
11192
|
-
});
|
|
11193
|
-
if (!(instance instanceof AnnounceAuthorization)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
11194
|
-
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
11195
|
-
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [];
|
|
11196
|
-
let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"];
|
|
11197
|
-
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) {
|
|
11198
|
-
if (v == null) continue;
|
|
11199
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11200
|
-
if (v["@id"].startsWith("_:")) continue;
|
|
11201
|
-
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(parseIri(v["@id"], options.baseUrl));
|
|
11202
|
-
continue;
|
|
11203
|
-
}
|
|
11204
|
-
const decoded = await Object$1.fromJsonLd(v, {
|
|
11205
|
-
...options,
|
|
11206
|
-
baseUrl: options.baseUrl
|
|
11207
|
-
});
|
|
11208
|
-
if (typeof decoded === "undefined") {
|
|
11209
|
-
shouldCacheJsonLd = false;
|
|
11210
|
-
continue;
|
|
11211
|
-
}
|
|
11212
|
-
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11213
|
-
_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded);
|
|
11214
|
-
}
|
|
11215
|
-
instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;
|
|
11216
|
-
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [];
|
|
11217
|
-
let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"];
|
|
11218
|
-
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) {
|
|
11219
|
-
if (v == null) continue;
|
|
11220
|
-
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
11221
|
-
if (v["@id"].startsWith("_:")) continue;
|
|
11222
|
-
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(parseIri(v["@id"], options.baseUrl));
|
|
11223
|
-
continue;
|
|
11224
|
-
}
|
|
11225
|
-
const decoded = await Object$1.fromJsonLd(v, {
|
|
11226
|
-
...options,
|
|
11227
|
-
baseUrl: options.baseUrl
|
|
11228
|
-
});
|
|
11229
|
-
if (typeof decoded === "undefined") {
|
|
11230
|
-
shouldCacheJsonLd = false;
|
|
11231
|
-
continue;
|
|
11232
|
-
}
|
|
11233
|
-
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
11234
|
-
_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded);
|
|
11235
|
-
}
|
|
11236
|
-
instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;
|
|
11237
|
-
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
11238
|
-
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
11239
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
11240
|
-
const compactArray = Array.isArray(json) && json.length === 1;
|
|
11241
|
-
const jsonLd = compactArray ? json[0] : json;
|
|
11242
|
-
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
11243
|
-
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
11244
|
-
} else instance._cachedJsonLd = structuredClone(json);
|
|
11245
|
-
} catch {
|
|
11246
|
-
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
11247
|
-
}
|
|
11248
|
-
return instance;
|
|
11249
|
-
}
|
|
11250
|
-
_getCustomInspectProxy() {
|
|
11251
|
-
const proxy = super._getCustomInspectProxy();
|
|
11252
|
-
const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.map((v) => v instanceof URL ? {
|
|
11253
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11254
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11255
|
-
} : v);
|
|
11256
|
-
if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0];
|
|
11257
|
-
const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.map((v) => v instanceof URL ? {
|
|
11258
|
-
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
11259
|
-
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
11260
|
-
} : v);
|
|
11261
|
-
if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0];
|
|
11262
|
-
return proxy;
|
|
11263
|
-
}
|
|
11264
|
-
};
|
|
11265
|
-
AnnounceAuthorization.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
11266
|
-
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11267
|
-
};
|
|
11268
|
-
AnnounceAuthorization.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
11269
|
-
return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
|
|
11270
|
-
};
|
|
11271
|
-
/** A request to announce (boost) a post that requires approval from
|
|
11272
|
-
* the post author.
|
|
11273
|
-
*
|
|
11274
|
-
* The `object` property references the post to be announced, and
|
|
11275
|
-
* the `instrument` property contains the {@link Announce} activity itself.
|
|
11276
|
-
*
|
|
11277
|
-
* The post author responds with an {@link Accept} (with an
|
|
11278
|
-
* {@link AnnounceAuthorization} as `result`) or a {@link Reject}.
|
|
11279
|
-
*
|
|
11280
|
-
* See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/)
|
|
11281
|
-
* for details.
|
|
11282
|
-
*/
|
|
11283
|
-
var AnnounceRequest = class AnnounceRequest extends Activity {
|
|
11284
|
-
/**
|
|
11285
|
-
* The type URI of {@link AnnounceRequest}: `https://gotosocial.org/ns#AnnounceRequest`.
|
|
11286
|
-
*/
|
|
11287
|
-
static get typeId() {
|
|
11288
|
-
return new URL("https://gotosocial.org/ns#AnnounceRequest");
|
|
11289
|
-
}
|
|
11290
|
-
/**
|
|
11291
|
-
* Constructs a new instance of AnnounceRequest with the given values.
|
|
11292
|
-
* @param values The values to initialize the instance with.
|
|
11293
|
-
* @param options The options to use for initialization.
|
|
11294
|
-
*/
|
|
11295
|
-
constructor(values, options = {}) {
|
|
11296
|
-
super(values, options);
|
|
11297
|
-
}
|
|
11298
|
-
/**
|
|
11299
|
-
* Clones this instance, optionally updating it with the given values.
|
|
11300
|
-
* @param values The values to update the clone with.
|
|
11301
|
-
* @param options The options to use for cloning.
|
|
11302
|
-
* @returns The cloned instance.
|
|
11303
|
-
*/
|
|
11304
|
-
clone(values = {}, options = {}) {
|
|
11305
|
-
if (this._warning != null) {
|
|
11306
|
-
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
11307
|
-
options = {
|
|
11308
|
-
...options,
|
|
11309
|
-
$warning: this._warning
|
|
11310
|
-
};
|
|
11311
|
-
}
|
|
11312
|
-
return super.clone(values, options);
|
|
11313
|
-
}
|
|
11314
|
-
/**
|
|
11315
|
-
* Converts this object to a JSON-LD structure.
|
|
11316
|
-
* @param options The options to use.
|
|
11317
|
-
* - `format`: The format of the output: `compact` or
|
|
11318
|
-
`expand`.
|
|
11319
|
-
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
11320
|
-
* - `context`: The JSON-LD context to use. Not applicable
|
|
11321
|
-
when `format` is set to `'expand'`.
|
|
11322
|
-
* @returns The JSON-LD representation of this object.
|
|
11323
|
-
*/
|
|
11324
|
-
async toJsonLd(options = {}) {
|
|
11325
|
-
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
11326
|
-
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'.");
|
|
11327
|
-
options = {
|
|
11328
|
-
...options,
|
|
11329
|
-
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
11330
|
-
};
|
|
11331
|
-
const values = (await super.toJsonLd({
|
|
11332
|
-
...options,
|
|
11333
|
-
format: "expand",
|
|
11334
|
-
context: void 0
|
|
11335
|
-
}))[0];
|
|
11336
|
-
values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"];
|
|
11337
|
-
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
11338
|
-
if (options.format === "expand") return await jsonld.expand(values, {
|
|
11339
|
-
documentLoader: options.contextLoader,
|
|
11340
|
-
keepFreeFloatingNodes: true
|
|
11341
|
-
});
|
|
11342
|
-
const docContext = options.context ?? [
|
|
11343
|
-
"https://w3id.org/identity/v1",
|
|
11344
|
-
"https://www.w3.org/ns/activitystreams",
|
|
11345
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
11346
|
-
"https://gotosocial.org/ns"
|
|
11347
|
-
];
|
|
11348
|
-
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11349
11510
|
if (docContext != null) {
|
|
11350
11511
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
11351
11512
|
else compacted.proof["@context"] = docContext;
|
|
@@ -11695,8 +11856,16 @@ var InteractionPolicy = class {
|
|
|
11695
11856
|
documentLoader: options.contextLoader,
|
|
11696
11857
|
keepFreeFloatingNodes: true
|
|
11697
11858
|
});
|
|
11698
|
-
|
|
11699
|
-
|
|
11859
|
+
let docContext = options.context ?? ["https://gotosocial.org/ns", "https://w3id.org/fep/7aa9"];
|
|
11860
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11861
|
+
if (options.context == null) {
|
|
11862
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
11863
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
11864
|
+
if (additionalContexts.length > 0) {
|
|
11865
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
11866
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
11867
|
+
}
|
|
11868
|
+
}
|
|
11700
11869
|
if (docContext != null) {}
|
|
11701
11870
|
return compacted;
|
|
11702
11871
|
}
|
|
@@ -12112,8 +12281,16 @@ var InteractionRule = class {
|
|
|
12112
12281
|
documentLoader: options.contextLoader,
|
|
12113
12282
|
keepFreeFloatingNodes: true
|
|
12114
12283
|
});
|
|
12115
|
-
|
|
12116
|
-
|
|
12284
|
+
let docContext = options.context ?? "https://gotosocial.org/ns";
|
|
12285
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12286
|
+
if (options.context == null) {
|
|
12287
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
12288
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
12289
|
+
if (additionalContexts.length > 0) {
|
|
12290
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
12291
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12292
|
+
}
|
|
12293
|
+
}
|
|
12117
12294
|
if (docContext != null) {}
|
|
12118
12295
|
return compacted;
|
|
12119
12296
|
}
|
|
@@ -12651,12 +12828,20 @@ var LikeAuthorization = class LikeAuthorization extends Object$1 {
|
|
|
12651
12828
|
documentLoader: options.contextLoader,
|
|
12652
12829
|
keepFreeFloatingNodes: true
|
|
12653
12830
|
});
|
|
12654
|
-
|
|
12831
|
+
let docContext = options.context ?? [
|
|
12655
12832
|
"https://www.w3.org/ns/activitystreams",
|
|
12656
12833
|
"https://w3id.org/security/data-integrity/v1",
|
|
12657
12834
|
"https://gotosocial.org/ns"
|
|
12658
12835
|
];
|
|
12659
|
-
|
|
12836
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12837
|
+
if (options.context == null) {
|
|
12838
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
12839
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
12840
|
+
if (additionalContexts.length > 0) {
|
|
12841
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
12842
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
12843
|
+
}
|
|
12844
|
+
}
|
|
12660
12845
|
if (docContext != null) {
|
|
12661
12846
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
12662
12847
|
else compacted.proof["@context"] = docContext;
|
|
@@ -12883,13 +13068,21 @@ var LikeRequest = class LikeRequest extends Activity {
|
|
|
12883
13068
|
documentLoader: options.contextLoader,
|
|
12884
13069
|
keepFreeFloatingNodes: true
|
|
12885
13070
|
});
|
|
12886
|
-
|
|
13071
|
+
let docContext = options.context ?? [
|
|
12887
13072
|
"https://w3id.org/identity/v1",
|
|
12888
13073
|
"https://www.w3.org/ns/activitystreams",
|
|
12889
13074
|
"https://w3id.org/security/data-integrity/v1",
|
|
12890
13075
|
"https://gotosocial.org/ns"
|
|
12891
13076
|
];
|
|
12892
|
-
|
|
13077
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13078
|
+
if (options.context == null) {
|
|
13079
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
13080
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
13081
|
+
if (additionalContexts.length > 0) {
|
|
13082
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
13083
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13084
|
+
}
|
|
13085
|
+
}
|
|
12893
13086
|
if (docContext != null) {
|
|
12894
13087
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
12895
13088
|
else compacted.proof["@context"] = docContext;
|
|
@@ -13393,12 +13586,20 @@ var ReplyAuthorization = class ReplyAuthorization extends Object$1 {
|
|
|
13393
13586
|
documentLoader: options.contextLoader,
|
|
13394
13587
|
keepFreeFloatingNodes: true
|
|
13395
13588
|
});
|
|
13396
|
-
|
|
13589
|
+
let docContext = options.context ?? [
|
|
13397
13590
|
"https://www.w3.org/ns/activitystreams",
|
|
13398
13591
|
"https://w3id.org/security/data-integrity/v1",
|
|
13399
13592
|
"https://gotosocial.org/ns"
|
|
13400
13593
|
];
|
|
13401
|
-
|
|
13594
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13595
|
+
if (options.context == null) {
|
|
13596
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
13597
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
13598
|
+
if (additionalContexts.length > 0) {
|
|
13599
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
13600
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13601
|
+
}
|
|
13602
|
+
}
|
|
13402
13603
|
if (docContext != null) {
|
|
13403
13604
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
13404
13605
|
else compacted.proof["@context"] = docContext;
|
|
@@ -13625,13 +13826,21 @@ var ReplyRequest = class ReplyRequest extends Activity {
|
|
|
13625
13826
|
documentLoader: options.contextLoader,
|
|
13626
13827
|
keepFreeFloatingNodes: true
|
|
13627
13828
|
});
|
|
13628
|
-
|
|
13829
|
+
let docContext = options.context ?? [
|
|
13629
13830
|
"https://w3id.org/identity/v1",
|
|
13630
13831
|
"https://www.w3.org/ns/activitystreams",
|
|
13631
13832
|
"https://w3id.org/security/data-integrity/v1",
|
|
13632
13833
|
"https://gotosocial.org/ns"
|
|
13633
13834
|
];
|
|
13634
|
-
|
|
13835
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13836
|
+
if (options.context == null) {
|
|
13837
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
13838
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
13839
|
+
if (additionalContexts.length > 0) {
|
|
13840
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
13841
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13842
|
+
}
|
|
13843
|
+
}
|
|
13635
13844
|
if (docContext != null) {
|
|
13636
13845
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
13637
13846
|
else compacted.proof["@context"] = docContext;
|
|
@@ -14135,13 +14344,21 @@ var QuoteAuthorization = class QuoteAuthorization extends Object$1 {
|
|
|
14135
14344
|
documentLoader: options.contextLoader,
|
|
14136
14345
|
keepFreeFloatingNodes: true
|
|
14137
14346
|
});
|
|
14138
|
-
|
|
14347
|
+
let docContext = options.context ?? [
|
|
14139
14348
|
"https://www.w3.org/ns/activitystreams",
|
|
14140
14349
|
"https://w3id.org/security/data-integrity/v1",
|
|
14141
14350
|
"https://gotosocial.org/ns",
|
|
14142
14351
|
{ "QuoteAuthorization": "https://w3id.org/fep/044f#QuoteAuthorization" }
|
|
14143
14352
|
];
|
|
14144
|
-
|
|
14353
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14354
|
+
if (options.context == null) {
|
|
14355
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
14356
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
14357
|
+
if (additionalContexts.length > 0) {
|
|
14358
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
14359
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14360
|
+
}
|
|
14361
|
+
}
|
|
14145
14362
|
if (docContext != null) {
|
|
14146
14363
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14147
14364
|
else compacted.proof["@context"] = docContext;
|
|
@@ -14368,7 +14585,7 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14368
14585
|
documentLoader: options.contextLoader,
|
|
14369
14586
|
keepFreeFloatingNodes: true
|
|
14370
14587
|
});
|
|
14371
|
-
|
|
14588
|
+
let docContext = options.context ?? [
|
|
14372
14589
|
"https://w3id.org/identity/v1",
|
|
14373
14590
|
"https://www.w3.org/ns/activitystreams",
|
|
14374
14591
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -14404,7 +14621,15 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14404
14621
|
}
|
|
14405
14622
|
}
|
|
14406
14623
|
];
|
|
14407
|
-
|
|
14624
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14625
|
+
if (options.context == null) {
|
|
14626
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
14627
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
14628
|
+
if (additionalContexts.length > 0) {
|
|
14629
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
14630
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14408
14633
|
if (docContext != null) {
|
|
14409
14634
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14410
14635
|
else compacted.proof["@context"] = docContext;
|
|
@@ -14473,18 +14698,816 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14473
14698
|
};
|
|
14474
14699
|
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
14475
14700
|
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
14476
|
-
if (!values["@type"].includes("https://w3id.org/fep/044f#QuoteRequest")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14701
|
+
if (!values["@type"].includes("https://w3id.org/fep/044f#QuoteRequest")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14702
|
+
}
|
|
14703
|
+
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
14704
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
14705
|
+
const superValues = structuredClone(values);
|
|
14706
|
+
delete superValues["@type"];
|
|
14707
|
+
const instance = await super.fromJsonLd(superValues, {
|
|
14708
|
+
...options,
|
|
14709
|
+
_fromSubclass: true
|
|
14710
|
+
});
|
|
14711
|
+
if (!(instance instanceof QuoteRequest)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
14712
|
+
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
14713
|
+
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
14714
|
+
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
14715
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
14716
|
+
const compactArray = Array.isArray(json) && json.length === 1;
|
|
14717
|
+
const jsonLd = compactArray ? json[0] : json;
|
|
14718
|
+
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
14719
|
+
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
14720
|
+
} else instance._cachedJsonLd = structuredClone(json);
|
|
14721
|
+
} catch {
|
|
14722
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
14723
|
+
}
|
|
14724
|
+
return instance;
|
|
14725
|
+
}
|
|
14726
|
+
_getCustomInspectProxy() {
|
|
14727
|
+
return super._getCustomInspectProxy();
|
|
14728
|
+
}
|
|
14729
|
+
};
|
|
14730
|
+
QuoteRequest.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
14731
|
+
return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
|
|
14732
|
+
};
|
|
14733
|
+
QuoteRequest.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
14734
|
+
return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
|
|
14735
|
+
};
|
|
14736
|
+
/** Translator credit and source freshness for one language version of an
|
|
14737
|
+
* {@link Object}, as defined by the draft
|
|
14738
|
+
* [FEP-22cd](https://w3id.org/fep/22cd). This is embedded metadata, not an
|
|
14739
|
+
* independent post or activity target. Its optional identifier need not be
|
|
14740
|
+
* dereferenceable and does not establish trust in embedded translator actors.
|
|
14741
|
+
*
|
|
14742
|
+
* Targets [draft revision 6d0d6559](https://codeberg.org/fediverse/fep/src/commit/6d0d6559054baeb7b71a5f2bdc14fc4c09b66f39/fep/22cd/fep-22cd.md).
|
|
14743
|
+
*/
|
|
14744
|
+
var Translation = class {
|
|
14745
|
+
#documentLoader;
|
|
14746
|
+
#contextLoader;
|
|
14747
|
+
#tracerProvider;
|
|
14748
|
+
#warning;
|
|
14749
|
+
#cachedJsonLd;
|
|
14750
|
+
#_baseUrl;
|
|
14751
|
+
#shouldCacheJsonLd = true;
|
|
14752
|
+
id;
|
|
14753
|
+
get _documentLoader() {
|
|
14754
|
+
return this.#documentLoader;
|
|
14755
|
+
}
|
|
14756
|
+
get _contextLoader() {
|
|
14757
|
+
return this.#contextLoader;
|
|
14758
|
+
}
|
|
14759
|
+
get _tracerProvider() {
|
|
14760
|
+
return this.#tracerProvider;
|
|
14761
|
+
}
|
|
14762
|
+
get _warning() {
|
|
14763
|
+
return this.#warning;
|
|
14764
|
+
}
|
|
14765
|
+
get _cachedJsonLd() {
|
|
14766
|
+
return this.#cachedJsonLd;
|
|
14767
|
+
}
|
|
14768
|
+
set _cachedJsonLd(value) {
|
|
14769
|
+
this.#cachedJsonLd = value;
|
|
14770
|
+
}
|
|
14771
|
+
get _baseUrl() {
|
|
14772
|
+
return this.#_baseUrl;
|
|
14773
|
+
}
|
|
14774
|
+
get _shouldCacheJsonLd() {
|
|
14775
|
+
return this.#shouldCacheJsonLd;
|
|
14776
|
+
}
|
|
14777
|
+
set _shouldCacheJsonLd(value) {
|
|
14778
|
+
this.#shouldCacheJsonLd = value;
|
|
14779
|
+
}
|
|
14780
|
+
static _shouldCacheDecodedJsonLd(value) {
|
|
14781
|
+
if (value == null || typeof value !== "object") return true;
|
|
14782
|
+
if (!("_shouldCacheJsonLd" in value)) return true;
|
|
14783
|
+
return value._shouldCacheJsonLd;
|
|
14784
|
+
}
|
|
14785
|
+
/**
|
|
14786
|
+
* The type URI of {@link Translation}: `https://w3id.org/fep/22cd#Translation`.
|
|
14787
|
+
*/
|
|
14788
|
+
static get typeId() {
|
|
14789
|
+
return new URL("https://w3id.org/fep/22cd#Translation");
|
|
14790
|
+
}
|
|
14791
|
+
#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [];
|
|
14792
|
+
#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [];
|
|
14793
|
+
#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set();
|
|
14794
|
+
#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [];
|
|
14795
|
+
#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [];
|
|
14796
|
+
#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [];
|
|
14797
|
+
#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [];
|
|
14798
|
+
/**
|
|
14799
|
+
* Constructs a new instance of Translation with the given values.
|
|
14800
|
+
* @param values The values to initialize the instance with.
|
|
14801
|
+
* @param options The options to use for initialization.
|
|
14802
|
+
*/
|
|
14803
|
+
constructor(values, options = {}) {
|
|
14804
|
+
this.#documentLoader = options.documentLoader;
|
|
14805
|
+
this.#contextLoader = options.contextLoader;
|
|
14806
|
+
this.#tracerProvider = options.tracerProvider;
|
|
14807
|
+
const baseUrl = options.baseUrl;
|
|
14808
|
+
this.#_baseUrl = baseUrl == null ? void 0 : new URL(baseUrl.href);
|
|
14809
|
+
if ("$warning" in options) this.#warning = options.$warning;
|
|
14810
|
+
if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
|
|
14811
|
+
else throw new TypeError("The id must be a URL.");
|
|
14812
|
+
if ("language" in values && values.language != null) if (values.language instanceof Intl.Locale) this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [values.language];
|
|
14813
|
+
else throw new TypeError("The language must be of type Intl.Locale.");
|
|
14814
|
+
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) {
|
|
14815
|
+
this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator];
|
|
14816
|
+
this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(0);
|
|
14817
|
+
} else throw new TypeError("The translator must be of type Application | Group | Organization | Person | Service | URL.");
|
|
14818
|
+
if ("translators" in values && values.translators != null) {
|
|
14819
|
+
if ("translator" in values && values.translator != null) throw new TypeError("Cannot initialize both translator and translators at the same time.");
|
|
14820
|
+
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)) {
|
|
14821
|
+
this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators;
|
|
14822
|
+
for (let i = 0; i < values.translators.length; i++) this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
|
|
14823
|
+
} else throw new TypeError("The translators must be an array of type Application | Group | Organization | Person | Service | URL.");
|
|
14824
|
+
}
|
|
14825
|
+
if ("original" in values && values.original != null) if (values.original instanceof URL) this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [values.original];
|
|
14826
|
+
else throw new TypeError("The original must be of type URL.");
|
|
14827
|
+
if ("sourceUpdated" in values && values.sourceUpdated != null) if (isTemporalInstant(values.sourceUpdated)) this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [values.sourceUpdated];
|
|
14828
|
+
else throw new TypeError("The sourceUpdated must be of type Temporal.Instant.");
|
|
14829
|
+
if ("basis" in values && values.basis != null) if (values.basis instanceof URL) this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [values.basis];
|
|
14830
|
+
else throw new TypeError("The basis must be of type URL.");
|
|
14831
|
+
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
14832
|
+
else throw new TypeError("The url must be of type URL | Link.");
|
|
14833
|
+
if ("urls" in values && values.urls != null) {
|
|
14834
|
+
if ("url" in values && values.url != null) throw new TypeError("Cannot initialize both url and urls at the same time.");
|
|
14835
|
+
if (Array.isArray(values.urls) && values.urls.every((v) => v instanceof URL || v instanceof Link)) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls;
|
|
14836
|
+
else throw new TypeError("The urls must be an array of type URL | Link.");
|
|
14837
|
+
}
|
|
14838
|
+
}
|
|
14839
|
+
/**
|
|
14840
|
+
* Clones this instance, optionally updating it with the given values.
|
|
14841
|
+
* @param values The values to update the clone with.
|
|
14842
|
+
* @param options The options to use for cloning.
|
|
14843
|
+
* @returns The cloned instance.
|
|
14844
|
+
*/
|
|
14845
|
+
clone(values = {}, options = {}) {
|
|
14846
|
+
if (this._warning != null) {
|
|
14847
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14848
|
+
options = {
|
|
14849
|
+
...options,
|
|
14850
|
+
$warning: this._warning
|
|
14851
|
+
};
|
|
14852
|
+
}
|
|
14853
|
+
const clone = new this.constructor({ id: values.id ?? this.id }, options);
|
|
14854
|
+
clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG;
|
|
14855
|
+
if ("language" in values && values.language != null) if (values.language instanceof Intl.Locale) clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [values.language];
|
|
14856
|
+
else throw new TypeError("The language must be of type Intl.Locale.");
|
|
14857
|
+
clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
14858
|
+
clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR);
|
|
14859
|
+
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) {
|
|
14860
|
+
clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator];
|
|
14861
|
+
clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set([0]);
|
|
14862
|
+
} else throw new TypeError("The translator must be of type Application | Group | Organization | Person | Service | URL.");
|
|
14863
|
+
if ("translators" in values && values.translators != null) {
|
|
14864
|
+
if ("translator" in values && values.translator != null) throw new TypeError("Cannot update both translator and translators at the same time.");
|
|
14865
|
+
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)) {
|
|
14866
|
+
clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators;
|
|
14867
|
+
clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set();
|
|
14868
|
+
for (let i = 0; i < values.translators.length; i++) clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
|
|
14869
|
+
} else throw new TypeError("The translators must be an array of type Application | Group | Organization | Person | Service | URL.");
|
|
14870
|
+
}
|
|
14871
|
+
clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7;
|
|
14872
|
+
if ("original" in values && values.original != null) if (values.original instanceof URL) clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [values.original];
|
|
14873
|
+
else throw new TypeError("The original must be of type URL.");
|
|
14874
|
+
clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated;
|
|
14875
|
+
if ("sourceUpdated" in values && values.sourceUpdated != null) if (isTemporalInstant(values.sourceUpdated)) clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [values.sourceUpdated];
|
|
14876
|
+
else throw new TypeError("The sourceUpdated must be of type Temporal.Instant.");
|
|
14877
|
+
clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW;
|
|
14878
|
+
if ("basis" in values && values.basis != null) if (values.basis instanceof URL) clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [values.basis];
|
|
14879
|
+
else throw new TypeError("The basis must be of type URL.");
|
|
14880
|
+
clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
14881
|
+
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
14882
|
+
else throw new TypeError("The url must be of type URL | Link.");
|
|
14883
|
+
if ("urls" in values && values.urls != null) {
|
|
14884
|
+
if ("url" in values && values.url != null) throw new TypeError("Cannot update both url and urls at the same time.");
|
|
14885
|
+
if (Array.isArray(values.urls) && values.urls.every((v) => v instanceof URL || v instanceof Link)) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls;
|
|
14886
|
+
else throw new TypeError("The urls must be an array of type URL | Link.");
|
|
14887
|
+
}
|
|
14888
|
+
return clone;
|
|
14889
|
+
}
|
|
14890
|
+
/** The translated language. Publishers must match a language in the
|
|
14891
|
+
* containing object's content, name, or summary map.
|
|
14892
|
+
*/
|
|
14893
|
+
get language() {
|
|
14894
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
14895
|
+
if (this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < 1) return null;
|
|
14896
|
+
return this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG[0];
|
|
14897
|
+
}
|
|
14898
|
+
async #fetchTranslator(url, options = {}) {
|
|
14899
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader();
|
|
14900
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ?? getDocumentLoader();
|
|
14901
|
+
const tracerProvider = options.tracerProvider ?? this._tracerProvider ?? trace.getTracerProvider();
|
|
14902
|
+
return await tracerProvider.getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
14903
|
+
const lookupUrl = formatIri(url);
|
|
14904
|
+
let fetchResult;
|
|
14905
|
+
try {
|
|
14906
|
+
fetchResult = await documentLoader(lookupUrl);
|
|
14907
|
+
} catch (error) {
|
|
14908
|
+
span.setStatus({
|
|
14909
|
+
code: SpanStatusCode.ERROR,
|
|
14910
|
+
message: String(error)
|
|
14911
|
+
});
|
|
14912
|
+
span.end();
|
|
14913
|
+
if (options.suppressError) {
|
|
14914
|
+
getLogger(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", {
|
|
14915
|
+
error,
|
|
14916
|
+
url: lookupUrl
|
|
14917
|
+
});
|
|
14918
|
+
return null;
|
|
14919
|
+
}
|
|
14920
|
+
throw error;
|
|
14921
|
+
}
|
|
14922
|
+
const { document, documentUrl } = fetchResult;
|
|
14923
|
+
const baseUrl = parseIri(documentUrl);
|
|
14924
|
+
try {
|
|
14925
|
+
const obj = await this.#translator_fromJsonLd(document, {
|
|
14926
|
+
documentLoader,
|
|
14927
|
+
contextLoader,
|
|
14928
|
+
tracerProvider,
|
|
14929
|
+
baseUrl
|
|
14930
|
+
});
|
|
14931
|
+
if (obj?.id != null && !isTrustedIriOrigin(options, obj.id, baseUrl)) {
|
|
14932
|
+
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\".");
|
|
14933
|
+
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\".", {
|
|
14934
|
+
...fetchResult,
|
|
14935
|
+
objectId: obj.id.href
|
|
14936
|
+
});
|
|
14937
|
+
return null;
|
|
14938
|
+
}
|
|
14939
|
+
span.setAttribute("activitypub.object.id", (obj.id ?? url).href);
|
|
14940
|
+
span.setAttribute("activitypub.object.type", obj.constructor.typeId.href);
|
|
14941
|
+
return obj;
|
|
14942
|
+
} catch (e) {
|
|
14943
|
+
if (options.suppressError) {
|
|
14944
|
+
getLogger(["fedify", "vocab"]).error("Failed to parse {url}: {error}", {
|
|
14945
|
+
error: e,
|
|
14946
|
+
url: lookupUrl
|
|
14947
|
+
});
|
|
14948
|
+
return null;
|
|
14949
|
+
}
|
|
14950
|
+
span.setStatus({
|
|
14951
|
+
code: SpanStatusCode.ERROR,
|
|
14952
|
+
message: String(e)
|
|
14953
|
+
});
|
|
14954
|
+
throw e;
|
|
14955
|
+
} finally {
|
|
14956
|
+
span.end();
|
|
14957
|
+
}
|
|
14958
|
+
});
|
|
14959
|
+
}
|
|
14960
|
+
async #translator_fromJsonLd(jsonLd, options) {
|
|
14961
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader();
|
|
14962
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ?? getDocumentLoader();
|
|
14963
|
+
const tracerProvider = options.tracerProvider ?? this._tracerProvider ?? trace.getTracerProvider();
|
|
14964
|
+
const baseUrl = options.baseUrl;
|
|
14965
|
+
try {
|
|
14966
|
+
return await Application.fromJsonLd(jsonLd, {
|
|
14967
|
+
documentLoader,
|
|
14968
|
+
contextLoader,
|
|
14969
|
+
tracerProvider,
|
|
14970
|
+
baseUrl
|
|
14971
|
+
});
|
|
14972
|
+
} catch (e) {
|
|
14973
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14974
|
+
}
|
|
14975
|
+
try {
|
|
14976
|
+
return await Group.fromJsonLd(jsonLd, {
|
|
14977
|
+
documentLoader,
|
|
14978
|
+
contextLoader,
|
|
14979
|
+
tracerProvider,
|
|
14980
|
+
baseUrl
|
|
14981
|
+
});
|
|
14982
|
+
} catch (e) {
|
|
14983
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14984
|
+
}
|
|
14985
|
+
try {
|
|
14986
|
+
return await Organization.fromJsonLd(jsonLd, {
|
|
14987
|
+
documentLoader,
|
|
14988
|
+
contextLoader,
|
|
14989
|
+
tracerProvider,
|
|
14990
|
+
baseUrl
|
|
14991
|
+
});
|
|
14992
|
+
} catch (e) {
|
|
14993
|
+
if (!(e instanceof TypeError)) throw e;
|
|
14994
|
+
}
|
|
14995
|
+
try {
|
|
14996
|
+
return await Person.fromJsonLd(jsonLd, {
|
|
14997
|
+
documentLoader,
|
|
14998
|
+
contextLoader,
|
|
14999
|
+
tracerProvider,
|
|
15000
|
+
baseUrl
|
|
15001
|
+
});
|
|
15002
|
+
} catch (e) {
|
|
15003
|
+
if (!(e instanceof TypeError)) throw e;
|
|
15004
|
+
}
|
|
15005
|
+
try {
|
|
15006
|
+
return await Service.fromJsonLd(jsonLd, {
|
|
15007
|
+
documentLoader,
|
|
15008
|
+
contextLoader,
|
|
15009
|
+
tracerProvider,
|
|
15010
|
+
baseUrl
|
|
15011
|
+
});
|
|
15012
|
+
} catch (e) {
|
|
15013
|
+
if (!(e instanceof TypeError)) throw e;
|
|
15014
|
+
}
|
|
15015
|
+
throw new TypeError("Expected an object of any type of: " + [
|
|
15016
|
+
"https://www.w3.org/ns/activitystreams#Application",
|
|
15017
|
+
"https://www.w3.org/ns/activitystreams#Group",
|
|
15018
|
+
"https://www.w3.org/ns/activitystreams#Organization",
|
|
15019
|
+
"https://www.w3.org/ns/activitystreams#Person",
|
|
15020
|
+
"https://www.w3.org/ns/activitystreams#Service"
|
|
15021
|
+
].join(", "));
|
|
15022
|
+
}
|
|
15023
|
+
/**
|
|
15024
|
+
* Similar to
|
|
15025
|
+
* {@link Translation.getTranslator},
|
|
15026
|
+
* but returns its `@id` URL instead of the object itself.
|
|
15027
|
+
*/
|
|
15028
|
+
get translatorId() {
|
|
15029
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15030
|
+
if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < 1) return null;
|
|
15031
|
+
const v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
|
|
15032
|
+
if (v instanceof URL) return v;
|
|
15033
|
+
return v.id;
|
|
15034
|
+
}
|
|
15035
|
+
/** The actors credited for this language version. Their order has no
|
|
15036
|
+
* meaning. Human actors credit translation or review; Application and
|
|
15037
|
+
* Service actors credit machine output. If any actor cannot be resolved,
|
|
15038
|
+
* the entry's human-or-machine status is unknown. Credit is asserted by
|
|
15039
|
+
* the publisher and grants no publishing authority. Embedded actors with
|
|
15040
|
+
* identifiers are fetched before being returned unless explicitly trusted.
|
|
15041
|
+
*/
|
|
15042
|
+
async getTranslator(options = {}) {
|
|
15043
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15044
|
+
if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < 1) return null;
|
|
15045
|
+
let v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
|
|
15046
|
+
if (!(v instanceof URL) && v.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) v = v.id;
|
|
15047
|
+
if (v instanceof URL) {
|
|
15048
|
+
const fetched = await this.#fetchTranslator(v, options);
|
|
15049
|
+
if (fetched == null) return null;
|
|
15050
|
+
this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0] = fetched;
|
|
15051
|
+
this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(0);
|
|
15052
|
+
this._cachedJsonLd = void 0;
|
|
15053
|
+
return fetched;
|
|
15054
|
+
}
|
|
15055
|
+
if (this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && "translator" in this._cachedJsonLd) {
|
|
15056
|
+
const prop = this._cachedJsonLd["translator"];
|
|
15057
|
+
const doc = Array.isArray(prop) ? prop[0] : prop;
|
|
15058
|
+
if (doc != null && typeof doc === "object" && "@context" in doc) v = await this.#translator_fromJsonLd(doc, {
|
|
15059
|
+
...options,
|
|
15060
|
+
baseUrl: options.baseUrl ?? this._baseUrl ?? (this.id != null && (this.id.protocol === "http:" || this.id.protocol === "https:") ? this.id : void 0)
|
|
15061
|
+
});
|
|
15062
|
+
}
|
|
15063
|
+
if (v?.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) {
|
|
15064
|
+
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\".");
|
|
15065
|
+
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\".", {
|
|
15066
|
+
objectId: v.id.href,
|
|
15067
|
+
parentObjectId: "untrusted metadata"
|
|
15068
|
+
});
|
|
15069
|
+
return null;
|
|
15070
|
+
}
|
|
15071
|
+
return v;
|
|
15072
|
+
}
|
|
15073
|
+
/**
|
|
15074
|
+
* Similar to
|
|
15075
|
+
* {@link Translation.getTranslators},
|
|
15076
|
+
* but returns their `@id`s instead of the objects themselves.
|
|
15077
|
+
*/
|
|
15078
|
+
get translatorIds() {
|
|
15079
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15080
|
+
return this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
|
15081
|
+
}
|
|
15082
|
+
/** The actors credited for this language version. Their order has no
|
|
15083
|
+
* meaning. Human actors credit translation or review; Application and
|
|
15084
|
+
* Service actors credit machine output. If any actor cannot be resolved,
|
|
15085
|
+
* the entry's human-or-machine status is unknown. Credit is asserted by
|
|
15086
|
+
* the publisher and grants no publishing authority. Embedded actors with
|
|
15087
|
+
* identifiers are fetched before being returned unless explicitly trusted.
|
|
15088
|
+
*/
|
|
15089
|
+
async *getTranslators(options = {}) {
|
|
15090
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15091
|
+
const vs = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
15092
|
+
for (let i = 0; i < vs.length; i++) {
|
|
15093
|
+
let v = vs[i];
|
|
15094
|
+
if (!(v instanceof URL) && v.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) v = v.id;
|
|
15095
|
+
if (v instanceof URL) {
|
|
15096
|
+
const fetched = await this.#fetchTranslator(v, options);
|
|
15097
|
+
if (fetched == null) continue;
|
|
15098
|
+
vs[i] = fetched;
|
|
15099
|
+
this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
|
|
15100
|
+
this._cachedJsonLd = void 0;
|
|
15101
|
+
yield fetched;
|
|
15102
|
+
continue;
|
|
15103
|
+
}
|
|
15104
|
+
if (this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && "translator" in this._cachedJsonLd) {
|
|
15105
|
+
const prop = this._cachedJsonLd["translator"];
|
|
15106
|
+
const obj = Array.isArray(prop) ? prop[i] : prop;
|
|
15107
|
+
if (obj != null && typeof obj === "object" && "@context" in obj) v = await this.#translator_fromJsonLd(obj, {
|
|
15108
|
+
...options,
|
|
15109
|
+
baseUrl: options.baseUrl ?? this._baseUrl ?? (this.id != null && (this.id.protocol === "http:" || this.id.protocol === "https:") ? this.id : void 0)
|
|
15110
|
+
});
|
|
15111
|
+
}
|
|
15112
|
+
if (v?.id != null && !isTrustedIriOrigin(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) {
|
|
15113
|
+
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\".");
|
|
15114
|
+
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\".", {
|
|
15115
|
+
objectId: v.id.href,
|
|
15116
|
+
parentObjectId: "untrusted metadata"
|
|
15117
|
+
});
|
|
15118
|
+
continue;
|
|
15119
|
+
}
|
|
15120
|
+
yield v;
|
|
15121
|
+
}
|
|
15122
|
+
}
|
|
15123
|
+
/** The identifier of the containing object. FEP-22cd translations share
|
|
15124
|
+
* that object's identity rather than introducing separate posts.
|
|
15125
|
+
*/
|
|
15126
|
+
get original() {
|
|
15127
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15128
|
+
if (this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length < 1) return null;
|
|
15129
|
+
return this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[0];
|
|
15130
|
+
}
|
|
15131
|
+
/** The source object's updated timestamp (or published timestamp if it has
|
|
15132
|
+
* no updated timestamp) at the last human review of this translation.
|
|
15133
|
+
* An absent value makes no freshness claim. A value earlier than the
|
|
15134
|
+
* current source timestamp indicates a potentially stale translation;
|
|
15135
|
+
* an equal or later value reflects the current source.
|
|
15136
|
+
*/
|
|
15137
|
+
get sourceUpdated() {
|
|
15138
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15139
|
+
if (this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length < 1) return null;
|
|
15140
|
+
return this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated[0];
|
|
15141
|
+
}
|
|
15142
|
+
/** An optional public revision resource identifying the source reviewed.
|
|
15143
|
+
* Supplements sourceUpdated without requiring private revision history
|
|
15144
|
+
* to be exposed.
|
|
15145
|
+
*/
|
|
15146
|
+
get basis() {
|
|
15147
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15148
|
+
if (this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length < 1) return null;
|
|
15149
|
+
return this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[0];
|
|
15150
|
+
}
|
|
15151
|
+
/** Links to renderings of this specific language version.
|
|
15152
|
+
*/
|
|
15153
|
+
get url() {
|
|
15154
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
15155
|
+
if (this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < 1) return null;
|
|
15156
|
+
return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0];
|
|
15157
|
+
}
|
|
15158
|
+
/** Links to renderings of this specific language version.
|
|
15159
|
+
*/
|
|
15160
|
+
get urls() {
|
|
15161
|
+
return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
15162
|
+
}
|
|
15163
|
+
/**
|
|
15164
|
+
* Converts this object to a JSON-LD structure.
|
|
15165
|
+
* @param options The options to use.
|
|
15166
|
+
* - `format`: The format of the output: `compact` or
|
|
15167
|
+
`expand`.
|
|
15168
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
15169
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
15170
|
+
when `format` is set to `'expand'`.
|
|
15171
|
+
* @returns The JSON-LD representation of this object.
|
|
15172
|
+
*/
|
|
15173
|
+
async toJsonLd(options = {}) {
|
|
15174
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
15175
|
+
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'.");
|
|
15176
|
+
options = {
|
|
15177
|
+
...options,
|
|
15178
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
15179
|
+
};
|
|
15180
|
+
if (options.format == null && this.isCompactable()) {
|
|
15181
|
+
const result = {};
|
|
15182
|
+
let compactItems = [];
|
|
15183
|
+
for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) {
|
|
15184
|
+
const item = v.baseName;
|
|
15185
|
+
compactItems.push(item);
|
|
15186
|
+
}
|
|
15187
|
+
if (compactItems.length > 0) result["inLanguage"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15188
|
+
compactItems = [];
|
|
15189
|
+
for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) {
|
|
15190
|
+
const item = v instanceof URL ? formatIri(v) : v instanceof Application ? await v.toJsonLd({
|
|
15191
|
+
...options,
|
|
15192
|
+
format: void 0,
|
|
15193
|
+
context: void 0
|
|
15194
|
+
}) : v instanceof Group ? await v.toJsonLd({
|
|
15195
|
+
...options,
|
|
15196
|
+
format: void 0,
|
|
15197
|
+
context: void 0
|
|
15198
|
+
}) : v instanceof Organization ? await v.toJsonLd({
|
|
15199
|
+
...options,
|
|
15200
|
+
format: void 0,
|
|
15201
|
+
context: void 0
|
|
15202
|
+
}) : v instanceof Person ? await v.toJsonLd({
|
|
15203
|
+
...options,
|
|
15204
|
+
format: void 0,
|
|
15205
|
+
context: void 0
|
|
15206
|
+
}) : await v.toJsonLd({
|
|
15207
|
+
...options,
|
|
15208
|
+
format: void 0,
|
|
15209
|
+
context: void 0
|
|
15210
|
+
});
|
|
15211
|
+
compactItems.push(item);
|
|
15212
|
+
}
|
|
15213
|
+
if (compactItems.length > 0) result["translator"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15214
|
+
compactItems = [];
|
|
15215
|
+
for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) {
|
|
15216
|
+
const item = formatIri(v);
|
|
15217
|
+
compactItems.push(item);
|
|
15218
|
+
}
|
|
15219
|
+
if (compactItems.length > 0) result["translationOfWork"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15220
|
+
compactItems = [];
|
|
15221
|
+
for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) {
|
|
15222
|
+
const item = v.toString();
|
|
15223
|
+
compactItems.push(item);
|
|
15224
|
+
}
|
|
15225
|
+
if (compactItems.length > 0) result["sourceUpdated"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15226
|
+
compactItems = [];
|
|
15227
|
+
for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) {
|
|
15228
|
+
const item = formatIri(v);
|
|
15229
|
+
compactItems.push(item);
|
|
15230
|
+
}
|
|
15231
|
+
if (compactItems.length > 0) result["isBasedOn"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15232
|
+
compactItems = [];
|
|
15233
|
+
for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) {
|
|
15234
|
+
const item = v instanceof URL ? formatIri(v) : await v.toJsonLd({
|
|
15235
|
+
...options,
|
|
15236
|
+
format: void 0,
|
|
15237
|
+
context: void 0
|
|
15238
|
+
});
|
|
15239
|
+
compactItems.push(item);
|
|
15240
|
+
}
|
|
15241
|
+
if (compactItems.length > 0) result["url"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
15242
|
+
result["type"] = "Translation";
|
|
15243
|
+
if (this.id != null) result["id"] = formatIri(this.id);
|
|
15244
|
+
result["@context"] = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/22cd"];
|
|
15245
|
+
return result;
|
|
15246
|
+
}
|
|
15247
|
+
let array;
|
|
15248
|
+
const values = {};
|
|
15249
|
+
array = [];
|
|
15250
|
+
for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) {
|
|
15251
|
+
let element = { "@value": v.baseName };
|
|
15252
|
+
if (Array.isArray(element)) {
|
|
15253
|
+
if (element.length < 1) continue;
|
|
15254
|
+
if (element.length == 1) element = element[0];
|
|
15255
|
+
}
|
|
15256
|
+
if (typeof element === "undefined") continue;
|
|
15257
|
+
array.push(element);
|
|
15258
|
+
}
|
|
15259
|
+
if (array.length > 0) values["https://schema.org/inLanguage"] = array;
|
|
15260
|
+
array = [];
|
|
15261
|
+
for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) {
|
|
15262
|
+
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);
|
|
15263
|
+
if (Array.isArray(element)) {
|
|
15264
|
+
if (element.length < 1) continue;
|
|
15265
|
+
if (element.length == 1) element = element[0];
|
|
15266
|
+
}
|
|
15267
|
+
if (typeof element === "undefined") continue;
|
|
15268
|
+
array.push(element);
|
|
15269
|
+
}
|
|
15270
|
+
if (array.length > 0) values["https://schema.org/translator"] = array;
|
|
15271
|
+
array = [];
|
|
15272
|
+
for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) {
|
|
15273
|
+
let element = { "@id": formatIri(v) };
|
|
15274
|
+
if (Array.isArray(element)) {
|
|
15275
|
+
if (element.length < 1) continue;
|
|
15276
|
+
if (element.length == 1) element = element[0];
|
|
15277
|
+
}
|
|
15278
|
+
if (typeof element === "undefined") continue;
|
|
15279
|
+
array.push(element);
|
|
15280
|
+
}
|
|
15281
|
+
if (array.length > 0) values["https://schema.org/translationOfWork"] = array;
|
|
15282
|
+
array = [];
|
|
15283
|
+
for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) {
|
|
15284
|
+
let element = {
|
|
15285
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
15286
|
+
"@value": v.toString()
|
|
15287
|
+
};
|
|
15288
|
+
if (Array.isArray(element)) {
|
|
15289
|
+
if (element.length < 1) continue;
|
|
15290
|
+
if (element.length == 1) element = element[0];
|
|
15291
|
+
}
|
|
15292
|
+
if (typeof element === "undefined") continue;
|
|
15293
|
+
array.push(element);
|
|
15294
|
+
}
|
|
15295
|
+
if (array.length > 0) values["https://w3id.org/fep/22cd#sourceUpdated"] = array;
|
|
15296
|
+
array = [];
|
|
15297
|
+
for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) {
|
|
15298
|
+
let element = { "@id": formatIri(v) };
|
|
15299
|
+
if (Array.isArray(element)) {
|
|
15300
|
+
if (element.length < 1) continue;
|
|
15301
|
+
if (element.length == 1) element = element[0];
|
|
15302
|
+
}
|
|
15303
|
+
if (typeof element === "undefined") continue;
|
|
15304
|
+
array.push(element);
|
|
15305
|
+
}
|
|
15306
|
+
if (array.length > 0) values["https://schema.org/isBasedOn"] = array;
|
|
15307
|
+
array = [];
|
|
15308
|
+
for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) {
|
|
15309
|
+
let element = v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options);
|
|
15310
|
+
if (Array.isArray(element)) {
|
|
15311
|
+
if (element.length < 1) continue;
|
|
15312
|
+
if (element.length == 1) element = element[0];
|
|
15313
|
+
}
|
|
15314
|
+
if (typeof element === "undefined") continue;
|
|
15315
|
+
array.push(element);
|
|
15316
|
+
}
|
|
15317
|
+
if (array.length > 0) values["https://www.w3.org/ns/activitystreams#url"] = array;
|
|
15318
|
+
values["@type"] = ["https://w3id.org/fep/22cd#Translation"];
|
|
15319
|
+
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
15320
|
+
if (options.format === "expand") return await jsonld.expand(values, {
|
|
15321
|
+
documentLoader: options.contextLoader,
|
|
15322
|
+
keepFreeFloatingNodes: true
|
|
15323
|
+
});
|
|
15324
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/22cd"];
|
|
15325
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15326
|
+
if (options.context == null) {
|
|
15327
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
15328
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
15329
|
+
if (additionalContexts.length > 0) {
|
|
15330
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
15331
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15332
|
+
}
|
|
15333
|
+
}
|
|
15334
|
+
if (docContext != null) {}
|
|
15335
|
+
return compacted;
|
|
15336
|
+
}
|
|
15337
|
+
isCompactable() {
|
|
15338
|
+
if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR != null && this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 0) return false;
|
|
15339
|
+
return true;
|
|
15340
|
+
}
|
|
15341
|
+
/**
|
|
15342
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
15343
|
+
* @param json The JSON-LD structure to convert.
|
|
15344
|
+
* @param options The options to use.
|
|
15345
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
15346
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
15347
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
15348
|
+
* If omitted, the global tracer provider is used.
|
|
15349
|
+
* @returns The object of this type.
|
|
15350
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
15351
|
+
*/
|
|
15352
|
+
static async fromJsonLd(json, options = {}) {
|
|
15353
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
15354
|
+
try {
|
|
15355
|
+
const object = await this.__fromJsonLd__Translation__(json, span, options);
|
|
15356
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
15357
|
+
return object;
|
|
15358
|
+
} catch (error) {
|
|
15359
|
+
span.setStatus({
|
|
15360
|
+
code: SpanStatusCode.ERROR,
|
|
15361
|
+
message: String(error)
|
|
15362
|
+
});
|
|
15363
|
+
throw error;
|
|
15364
|
+
} finally {
|
|
15365
|
+
span.end();
|
|
15366
|
+
}
|
|
15367
|
+
});
|
|
15368
|
+
}
|
|
15369
|
+
static async __fromJsonLd__Translation__(json, span, options = {}) {
|
|
15370
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
15371
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
15372
|
+
options = {
|
|
15373
|
+
...options,
|
|
15374
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
15375
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
15376
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
15377
|
+
};
|
|
15378
|
+
let values;
|
|
15379
|
+
let expanded;
|
|
15380
|
+
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
15381
|
+
values = json;
|
|
15382
|
+
expanded = [values];
|
|
15383
|
+
} else if (globalThis.Object.keys(json).length == 0) {
|
|
15384
|
+
values = {};
|
|
15385
|
+
expanded = [values];
|
|
15386
|
+
} else {
|
|
15387
|
+
expanded = await jsonld.expand(json, {
|
|
15388
|
+
documentLoader: options.contextLoader,
|
|
15389
|
+
keepFreeFloatingNodes: true
|
|
15390
|
+
});
|
|
15391
|
+
values = expanded[0] ?? {};
|
|
15392
|
+
}
|
|
15393
|
+
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
15394
|
+
if (id != null && options.baseUrl == null) options = {
|
|
15395
|
+
...options,
|
|
15396
|
+
baseUrl: id
|
|
15397
|
+
};
|
|
15398
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
15399
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
15400
|
+
if (!values["@type"].includes("https://w3id.org/fep/22cd#Translation")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14477
15401
|
}
|
|
14478
15402
|
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
14479
15403
|
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
14480
|
-
const
|
|
14481
|
-
delete superValues["@type"];
|
|
14482
|
-
const instance = await super.fromJsonLd(superValues, {
|
|
14483
|
-
...options,
|
|
14484
|
-
_fromSubclass: true
|
|
14485
|
-
});
|
|
14486
|
-
if (!(instance instanceof QuoteRequest)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
15404
|
+
const instance = new this({ id }, options);
|
|
14487
15405
|
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
15406
|
+
const _diXuPmFWiEqfLPhhrxg6Xc7ixZG = [];
|
|
15407
|
+
let _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array = values["https://schema.org/inLanguage"];
|
|
15408
|
+
for (const v of _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array == null ? [] : _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array.length === 1 && "@list" in _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array[0] ? _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array[0]["@list"] : _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array) {
|
|
15409
|
+
if (v == null) continue;
|
|
15410
|
+
const decoded = new Intl.Locale(v["@value"]);
|
|
15411
|
+
if (typeof decoded === "undefined") {
|
|
15412
|
+
shouldCacheJsonLd = false;
|
|
15413
|
+
continue;
|
|
15414
|
+
}
|
|
15415
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15416
|
+
_diXuPmFWiEqfLPhhrxg6Xc7ixZG.push(decoded);
|
|
15417
|
+
}
|
|
15418
|
+
instance.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = _diXuPmFWiEqfLPhhrxg6Xc7ixZG;
|
|
15419
|
+
const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [];
|
|
15420
|
+
let _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array = values["https://schema.org/translator"];
|
|
15421
|
+
for (const v of _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array == null ? [] : _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array.length === 1 && "@list" in _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array[0] ? _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array[0]["@list"] : _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array) {
|
|
15422
|
+
if (v == null) continue;
|
|
15423
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
|
|
15424
|
+
if (v["@id"].startsWith("_:")) continue;
|
|
15425
|
+
_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.push(parseIri(v["@id"], options.baseUrl));
|
|
15426
|
+
continue;
|
|
15427
|
+
}
|
|
15428
|
+
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, {
|
|
15429
|
+
...options,
|
|
15430
|
+
baseUrl: options.baseUrl
|
|
15431
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd(v, {
|
|
15432
|
+
...options,
|
|
15433
|
+
baseUrl: options.baseUrl
|
|
15434
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd(v, {
|
|
15435
|
+
...options,
|
|
15436
|
+
baseUrl: options.baseUrl
|
|
15437
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd(v, {
|
|
15438
|
+
...options,
|
|
15439
|
+
baseUrl: options.baseUrl
|
|
15440
|
+
}) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd(v, {
|
|
15441
|
+
...options,
|
|
15442
|
+
baseUrl: options.baseUrl
|
|
15443
|
+
}) : void 0;
|
|
15444
|
+
if (typeof decoded === "undefined") {
|
|
15445
|
+
shouldCacheJsonLd = false;
|
|
15446
|
+
continue;
|
|
15447
|
+
}
|
|
15448
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15449
|
+
_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.push(decoded);
|
|
15450
|
+
}
|
|
15451
|
+
instance.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
15452
|
+
const _Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [];
|
|
15453
|
+
let _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array = values["https://schema.org/translationOfWork"];
|
|
15454
|
+
for (const v of _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array == null ? [] : _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array.length === 1 && "@list" in _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array[0] ? _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array[0]["@list"] : _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array) {
|
|
15455
|
+
if (v == null) continue;
|
|
15456
|
+
const decoded = parseIri(v["@id"], options.baseUrl);
|
|
15457
|
+
if (typeof decoded === "undefined") {
|
|
15458
|
+
shouldCacheJsonLd = false;
|
|
15459
|
+
continue;
|
|
15460
|
+
}
|
|
15461
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15462
|
+
_Msz9PwRg7cWkiXPL4ixyQLtuuH7.push(decoded);
|
|
15463
|
+
}
|
|
15464
|
+
instance.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = _Msz9PwRg7cWkiXPL4ixyQLtuuH7;
|
|
15465
|
+
const _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [];
|
|
15466
|
+
let _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array = values["https://w3id.org/fep/22cd#sourceUpdated"];
|
|
15467
|
+
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) {
|
|
15468
|
+
if (v == null) continue;
|
|
15469
|
+
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
15470
|
+
if (typeof decoded === "undefined") {
|
|
15471
|
+
shouldCacheJsonLd = false;
|
|
15472
|
+
continue;
|
|
15473
|
+
}
|
|
15474
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15475
|
+
_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.push(decoded);
|
|
15476
|
+
}
|
|
15477
|
+
instance.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated;
|
|
15478
|
+
const _4KvkQNz1JjGs8S7iJDcGrUYETbUW = [];
|
|
15479
|
+
let _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array = values["https://schema.org/isBasedOn"];
|
|
15480
|
+
for (const v of _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array == null ? [] : _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array.length === 1 && "@list" in _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array[0] ? _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array[0]["@list"] : _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array) {
|
|
15481
|
+
if (v == null) continue;
|
|
15482
|
+
const decoded = parseIri(v["@id"], options.baseUrl);
|
|
15483
|
+
if (typeof decoded === "undefined") {
|
|
15484
|
+
shouldCacheJsonLd = false;
|
|
15485
|
+
continue;
|
|
15486
|
+
}
|
|
15487
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15488
|
+
_4KvkQNz1JjGs8S7iJDcGrUYETbUW.push(decoded);
|
|
15489
|
+
}
|
|
15490
|
+
instance.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = _4KvkQNz1JjGs8S7iJDcGrUYETbUW;
|
|
15491
|
+
const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [];
|
|
15492
|
+
let _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array = values["https://www.w3.org/ns/activitystreams#url"];
|
|
15493
|
+
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) {
|
|
15494
|
+
if (v == null) continue;
|
|
15495
|
+
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"]) && [
|
|
15496
|
+
"https://www.w3.org/ns/activitystreams#Link",
|
|
15497
|
+
"https://www.w3.org/ns/activitystreams#Hashtag",
|
|
15498
|
+
"https://www.w3.org/ns/activitystreams#Mention"
|
|
15499
|
+
].some((t) => v["@type"].includes(t)) ? await Link.fromJsonLd(v, {
|
|
15500
|
+
...options,
|
|
15501
|
+
baseUrl: options.baseUrl
|
|
15502
|
+
}) : void 0;
|
|
15503
|
+
if (typeof decoded === "undefined") {
|
|
15504
|
+
shouldCacheJsonLd = false;
|
|
15505
|
+
continue;
|
|
15506
|
+
}
|
|
15507
|
+
if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
|
|
15508
|
+
_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.push(decoded);
|
|
15509
|
+
}
|
|
15510
|
+
instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
14488
15511
|
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
14489
15512
|
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
14490
15513
|
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
@@ -14499,14 +15522,51 @@ var QuoteRequest = class QuoteRequest extends Activity {
|
|
|
14499
15522
|
return instance;
|
|
14500
15523
|
}
|
|
14501
15524
|
_getCustomInspectProxy() {
|
|
14502
|
-
|
|
15525
|
+
const proxy = {};
|
|
15526
|
+
if (this.id != null) proxy.id = {
|
|
15527
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
|
|
15528
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
|
|
15529
|
+
};
|
|
15530
|
+
const _diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.map((v) => v instanceof URL ? {
|
|
15531
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15532
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15533
|
+
} : v);
|
|
15534
|
+
if (_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length == 1) proxy.language = _diXuPmFWiEqfLPhhrxg6Xc7ixZG[0];
|
|
15535
|
+
const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.map((v) => v instanceof URL ? {
|
|
15536
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15537
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15538
|
+
} : v);
|
|
15539
|
+
if (_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length == 1) proxy.translator = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
|
|
15540
|
+
if (_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 1 || !("translator" in proxy) && _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 0) proxy.translators = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
|
|
15541
|
+
const _Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.map((v) => v instanceof URL ? {
|
|
15542
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15543
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15544
|
+
} : v);
|
|
15545
|
+
if (_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length == 1) proxy.original = _Msz9PwRg7cWkiXPL4ixyQLtuuH7[0];
|
|
15546
|
+
const _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.map((v) => v instanceof URL ? {
|
|
15547
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15548
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15549
|
+
} : v);
|
|
15550
|
+
if (_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length == 1) proxy.sourceUpdated = _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated[0];
|
|
15551
|
+
const _4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.map((v) => v instanceof URL ? {
|
|
15552
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15553
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15554
|
+
} : v);
|
|
15555
|
+
if (_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length == 1) proxy.basis = _4KvkQNz1JjGs8S7iJDcGrUYETbUW[0];
|
|
15556
|
+
const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.map((v) => v instanceof URL ? {
|
|
15557
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
15558
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
15559
|
+
} : v);
|
|
15560
|
+
if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0];
|
|
15561
|
+
if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 || !("url" in proxy) && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
15562
|
+
return proxy;
|
|
14503
15563
|
}
|
|
14504
15564
|
};
|
|
14505
|
-
|
|
14506
|
-
return "
|
|
15565
|
+
Translation.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
15566
|
+
return "Translation " + inspect(this._getCustomInspectProxy(), options);
|
|
14507
15567
|
};
|
|
14508
|
-
|
|
14509
|
-
return "
|
|
15568
|
+
Translation.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
15569
|
+
return "Translation " + inspect(this._getCustomInspectProxy(), options);
|
|
14510
15570
|
};
|
|
14511
15571
|
/** Proves that an actor consented to being included in a
|
|
14512
15572
|
* {@link FeaturedCollection}.
|
|
@@ -14904,13 +15964,21 @@ var FeatureAuthorization = class FeatureAuthorization extends Object$1 {
|
|
|
14904
15964
|
documentLoader: options.contextLoader,
|
|
14905
15965
|
keepFreeFloatingNodes: true
|
|
14906
15966
|
});
|
|
14907
|
-
|
|
15967
|
+
let docContext = options.context ?? [
|
|
14908
15968
|
"https://www.w3.org/ns/activitystreams",
|
|
14909
15969
|
"https://w3id.org/security/data-integrity/v1",
|
|
14910
15970
|
"https://gotosocial.org/ns",
|
|
14911
15971
|
"https://w3id.org/fep/7aa9"
|
|
14912
15972
|
];
|
|
14913
|
-
|
|
15973
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15974
|
+
if (options.context == null) {
|
|
15975
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
15976
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
15977
|
+
if (additionalContexts.length > 0) {
|
|
15978
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
15979
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
15980
|
+
}
|
|
15981
|
+
}
|
|
14914
15982
|
if (docContext != null) {
|
|
14915
15983
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14916
15984
|
else compacted.proof["@context"] = docContext;
|
|
@@ -15134,14 +16202,22 @@ var FeatureRequest = class FeatureRequest extends Activity {
|
|
|
15134
16202
|
documentLoader: options.contextLoader,
|
|
15135
16203
|
keepFreeFloatingNodes: true
|
|
15136
16204
|
});
|
|
15137
|
-
|
|
16205
|
+
let docContext = options.context ?? [
|
|
15138
16206
|
"https://w3id.org/identity/v1",
|
|
15139
16207
|
"https://www.w3.org/ns/activitystreams",
|
|
15140
16208
|
"https://w3id.org/security/data-integrity/v1",
|
|
15141
16209
|
"https://gotosocial.org/ns",
|
|
15142
16210
|
"https://w3id.org/fep/7aa9"
|
|
15143
16211
|
];
|
|
15144
|
-
|
|
16212
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
16213
|
+
if (options.context == null) {
|
|
16214
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
16215
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
16216
|
+
if (additionalContexts.length > 0) {
|
|
16217
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
16218
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
16219
|
+
}
|
|
16220
|
+
}
|
|
15145
16221
|
if (docContext != null) {
|
|
15146
16222
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
15147
16223
|
else compacted.proof["@context"] = docContext;
|
|
@@ -17292,7 +18368,7 @@ var Collection = class Collection extends Object$1 {
|
|
|
17292
18368
|
documentLoader: options.contextLoader,
|
|
17293
18369
|
keepFreeFloatingNodes: true
|
|
17294
18370
|
});
|
|
17295
|
-
|
|
18371
|
+
let docContext = options.context ?? [
|
|
17296
18372
|
"https://www.w3.org/ns/activitystreams",
|
|
17297
18373
|
"https://w3id.org/security/data-integrity/v1",
|
|
17298
18374
|
"https://gotosocial.org/ns",
|
|
@@ -17324,7 +18400,15 @@ var Collection = class Collection extends Object$1 {
|
|
|
17324
18400
|
}
|
|
17325
18401
|
}
|
|
17326
18402
|
];
|
|
17327
|
-
|
|
18403
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
18404
|
+
if (options.context == null) {
|
|
18405
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
18406
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
18407
|
+
if (additionalContexts.length > 0) {
|
|
18408
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
18409
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
18410
|
+
}
|
|
18411
|
+
}
|
|
17328
18412
|
if (docContext != null) {
|
|
17329
18413
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
17330
18414
|
else compacted.proof["@context"] = docContext;
|
|
@@ -18120,7 +19204,7 @@ var OrderedCollection = class OrderedCollection extends Collection {
|
|
|
18120
19204
|
documentLoader: options.contextLoader,
|
|
18121
19205
|
keepFreeFloatingNodes: true
|
|
18122
19206
|
});
|
|
18123
|
-
|
|
19207
|
+
let docContext = options.context ?? [
|
|
18124
19208
|
"https://www.w3.org/ns/activitystreams",
|
|
18125
19209
|
"https://w3id.org/security/data-integrity/v1",
|
|
18126
19210
|
"https://gotosocial.org/ns",
|
|
@@ -18152,7 +19236,15 @@ var OrderedCollection = class OrderedCollection extends Collection {
|
|
|
18152
19236
|
}
|
|
18153
19237
|
}
|
|
18154
19238
|
];
|
|
18155
|
-
|
|
19239
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19240
|
+
if (options.context == null) {
|
|
19241
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
19242
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
19243
|
+
if (additionalContexts.length > 0) {
|
|
19244
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
19245
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19246
|
+
}
|
|
19247
|
+
}
|
|
18156
19248
|
if (docContext != null) {
|
|
18157
19249
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
18158
19250
|
else compacted.proof["@context"] = docContext;
|
|
@@ -18515,7 +19607,7 @@ var FeaturedCollection = class FeaturedCollection extends OrderedCollection {
|
|
|
18515
19607
|
documentLoader: options.contextLoader,
|
|
18516
19608
|
keepFreeFloatingNodes: true
|
|
18517
19609
|
});
|
|
18518
|
-
|
|
19610
|
+
let docContext = options.context ?? [
|
|
18519
19611
|
"https://www.w3.org/ns/activitystreams",
|
|
18520
19612
|
"https://w3id.org/security/data-integrity/v1",
|
|
18521
19613
|
"https://gotosocial.org/ns",
|
|
@@ -18527,7 +19619,15 @@ var FeaturedCollection = class FeaturedCollection extends OrderedCollection {
|
|
|
18527
19619
|
"Hashtag": "as:Hashtag"
|
|
18528
19620
|
}
|
|
18529
19621
|
];
|
|
18530
|
-
|
|
19622
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19623
|
+
if (options.context == null) {
|
|
19624
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
19625
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
19626
|
+
if (additionalContexts.length > 0) {
|
|
19627
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
19628
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
19629
|
+
}
|
|
19630
|
+
}
|
|
18531
19631
|
if (docContext != null) {
|
|
18532
19632
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
18533
19633
|
else compacted.proof["@context"] = docContext;
|
|
@@ -19067,13 +20167,21 @@ var FeaturedItem = class FeaturedItem extends Object$1 {
|
|
|
19067
20167
|
documentLoader: options.contextLoader,
|
|
19068
20168
|
keepFreeFloatingNodes: true
|
|
19069
20169
|
});
|
|
19070
|
-
|
|
20170
|
+
let docContext = options.context ?? [
|
|
19071
20171
|
"https://www.w3.org/ns/activitystreams",
|
|
19072
20172
|
"https://w3id.org/security/data-integrity/v1",
|
|
19073
20173
|
"https://gotosocial.org/ns",
|
|
19074
20174
|
"https://w3id.org/fep/7aa9"
|
|
19075
20175
|
];
|
|
19076
|
-
|
|
20176
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20177
|
+
if (options.context == null) {
|
|
20178
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
20179
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
20180
|
+
if (additionalContexts.length > 0) {
|
|
20181
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
20182
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20183
|
+
}
|
|
20184
|
+
}
|
|
19077
20185
|
if (docContext != null) {
|
|
19078
20186
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
19079
20187
|
else compacted.proof["@context"] = docContext;
|
|
@@ -19380,8 +20488,16 @@ var DidService = class {
|
|
|
19380
20488
|
documentLoader: options.contextLoader,
|
|
19381
20489
|
keepFreeFloatingNodes: true
|
|
19382
20490
|
});
|
|
19383
|
-
|
|
19384
|
-
|
|
20491
|
+
let docContext = options.context ?? "https://www.w3.org/ns/did/v1";
|
|
20492
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20493
|
+
if (options.context == null) {
|
|
20494
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
20495
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
20496
|
+
if (additionalContexts.length > 0) {
|
|
20497
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
20498
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20499
|
+
}
|
|
20500
|
+
}
|
|
19385
20501
|
if (docContext != null) {}
|
|
19386
20502
|
return compacted;
|
|
19387
20503
|
}
|
|
@@ -19562,8 +20678,16 @@ var Export = class Export extends DidService {
|
|
|
19562
20678
|
documentLoader: options.contextLoader,
|
|
19563
20679
|
keepFreeFloatingNodes: true
|
|
19564
20680
|
});
|
|
19565
|
-
|
|
19566
|
-
|
|
20681
|
+
let docContext = options.context ?? "https://www.w3.org/ns/did/v1";
|
|
20682
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20683
|
+
if (options.context == null) {
|
|
20684
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
20685
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
20686
|
+
if (additionalContexts.length > 0) {
|
|
20687
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
20688
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
20689
|
+
}
|
|
20690
|
+
}
|
|
19567
20691
|
if (docContext != null) {}
|
|
19568
20692
|
return compacted;
|
|
19569
20693
|
}
|
|
@@ -20021,8 +21145,16 @@ var DataIntegrityProof = class {
|
|
|
20021
21145
|
documentLoader: options.contextLoader,
|
|
20022
21146
|
keepFreeFloatingNodes: true
|
|
20023
21147
|
});
|
|
20024
|
-
|
|
20025
|
-
|
|
21148
|
+
let docContext = options.context ?? "https://w3id.org/security/data-integrity/v1";
|
|
21149
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21150
|
+
if (options.context == null) {
|
|
21151
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
21152
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
21153
|
+
if (additionalContexts.length > 0) {
|
|
21154
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
21155
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21156
|
+
}
|
|
21157
|
+
}
|
|
20026
21158
|
if (docContext != null) {}
|
|
20027
21159
|
return compacted;
|
|
20028
21160
|
}
|
|
@@ -20582,8 +21714,16 @@ var CryptographicKey = class {
|
|
|
20582
21714
|
documentLoader: options.contextLoader,
|
|
20583
21715
|
keepFreeFloatingNodes: true
|
|
20584
21716
|
});
|
|
20585
|
-
|
|
20586
|
-
|
|
21717
|
+
let docContext = options.context ?? "https://w3id.org/security/v1";
|
|
21718
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21719
|
+
if (options.context == null) {
|
|
21720
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
21721
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
21722
|
+
if (additionalContexts.length > 0) {
|
|
21723
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
21724
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
21725
|
+
}
|
|
21726
|
+
}
|
|
20587
21727
|
if (docContext != null) {}
|
|
20588
21728
|
return compacted;
|
|
20589
21729
|
}
|
|
@@ -21110,8 +22250,16 @@ var Multikey = class {
|
|
|
21110
22250
|
documentLoader: options.contextLoader,
|
|
21111
22251
|
keepFreeFloatingNodes: true
|
|
21112
22252
|
});
|
|
21113
|
-
|
|
21114
|
-
|
|
22253
|
+
let docContext = options.context ?? "https://w3id.org/security/multikey/v1";
|
|
22254
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22255
|
+
if (options.context == null) {
|
|
22256
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
22257
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
22258
|
+
if (additionalContexts.length > 0) {
|
|
22259
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
22260
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22261
|
+
}
|
|
22262
|
+
}
|
|
21115
22263
|
if (docContext != null) {}
|
|
21116
22264
|
return compacted;
|
|
21117
22265
|
}
|
|
@@ -21449,7 +22597,7 @@ var Agreement = class Agreement extends Object$1 {
|
|
|
21449
22597
|
documentLoader: options.contextLoader,
|
|
21450
22598
|
keepFreeFloatingNodes: true
|
|
21451
22599
|
});
|
|
21452
|
-
|
|
22600
|
+
let docContext = options.context ?? [
|
|
21453
22601
|
"https://www.w3.org/ns/activitystreams",
|
|
21454
22602
|
"https://w3id.org/security/data-integrity/v1",
|
|
21455
22603
|
"https://gotosocial.org/ns",
|
|
@@ -21475,7 +22623,15 @@ var Agreement = class Agreement extends Object$1 {
|
|
|
21475
22623
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
21476
22624
|
}
|
|
21477
22625
|
];
|
|
21478
|
-
|
|
22626
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22627
|
+
if (options.context == null) {
|
|
22628
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
22629
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
22630
|
+
if (additionalContexts.length > 0) {
|
|
22631
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
22632
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22633
|
+
}
|
|
22634
|
+
}
|
|
21479
22635
|
if (docContext != null) {
|
|
21480
22636
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
21481
22637
|
else compacted.proof["@context"] = docContext;
|
|
@@ -21819,7 +22975,7 @@ var Commitment = class {
|
|
|
21819
22975
|
documentLoader: options.contextLoader,
|
|
21820
22976
|
keepFreeFloatingNodes: true
|
|
21821
22977
|
});
|
|
21822
|
-
|
|
22978
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
21823
22979
|
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
21824
22980
|
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
21825
22981
|
"Commitment": "vf:Commitment",
|
|
@@ -21831,7 +22987,15 @@ var Commitment = class {
|
|
|
21831
22987
|
"hasUnit": "om2:hasUnit",
|
|
21832
22988
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
21833
22989
|
}];
|
|
21834
|
-
|
|
22990
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22991
|
+
if (options.context == null) {
|
|
22992
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
22993
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
22994
|
+
if (additionalContexts.length > 0) {
|
|
22995
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
22996
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
22997
|
+
}
|
|
22998
|
+
}
|
|
21835
22999
|
if (docContext != null) {}
|
|
21836
23000
|
return compacted;
|
|
21837
23001
|
}
|
|
@@ -22261,7 +23425,7 @@ var Intent = class {
|
|
|
22261
23425
|
documentLoader: options.contextLoader,
|
|
22262
23426
|
keepFreeFloatingNodes: true
|
|
22263
23427
|
});
|
|
22264
|
-
|
|
23428
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
22265
23429
|
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
22266
23430
|
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
22267
23431
|
"Intent": "vf:Intent",
|
|
@@ -22276,7 +23440,15 @@ var Intent = class {
|
|
|
22276
23440
|
"hasUnit": "om2:hasUnit",
|
|
22277
23441
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
22278
23442
|
}];
|
|
22279
|
-
|
|
23443
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23444
|
+
if (options.context == null) {
|
|
23445
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
23446
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
23447
|
+
if (additionalContexts.length > 0) {
|
|
23448
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
23449
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23450
|
+
}
|
|
23451
|
+
}
|
|
22280
23452
|
if (docContext != null) {}
|
|
22281
23453
|
return compacted;
|
|
22282
23454
|
}
|
|
@@ -22721,7 +23893,7 @@ var Proposal = class Proposal extends Object$1 {
|
|
|
22721
23893
|
documentLoader: options.contextLoader,
|
|
22722
23894
|
keepFreeFloatingNodes: true
|
|
22723
23895
|
});
|
|
22724
|
-
|
|
23896
|
+
let docContext = options.context ?? [
|
|
22725
23897
|
"https://www.w3.org/ns/activitystreams",
|
|
22726
23898
|
"https://w3id.org/security/data-integrity/v1",
|
|
22727
23899
|
"https://gotosocial.org/ns",
|
|
@@ -22752,7 +23924,15 @@ var Proposal = class Proposal extends Object$1 {
|
|
|
22752
23924
|
"hasNumericalValue": "om2:hasNumericalValue"
|
|
22753
23925
|
}
|
|
22754
23926
|
];
|
|
22755
|
-
|
|
23927
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23928
|
+
if (options.context == null) {
|
|
23929
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
23930
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
23931
|
+
if (additionalContexts.length > 0) {
|
|
23932
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
23933
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
23934
|
+
}
|
|
23935
|
+
}
|
|
22756
23936
|
if (docContext != null) {
|
|
22757
23937
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
22758
23938
|
else compacted.proof["@context"] = docContext;
|
|
@@ -22998,13 +24178,21 @@ var Accept = class Accept extends Activity {
|
|
|
22998
24178
|
documentLoader: options.contextLoader,
|
|
22999
24179
|
keepFreeFloatingNodes: true
|
|
23000
24180
|
});
|
|
23001
|
-
|
|
24181
|
+
let docContext = options.context ?? [
|
|
23002
24182
|
"https://w3id.org/identity/v1",
|
|
23003
24183
|
"https://www.w3.org/ns/activitystreams",
|
|
23004
24184
|
"https://w3id.org/security/data-integrity/v1",
|
|
23005
24185
|
"https://gotosocial.org/ns"
|
|
23006
24186
|
];
|
|
23007
|
-
|
|
24187
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24188
|
+
if (options.context == null) {
|
|
24189
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
24190
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
24191
|
+
if (additionalContexts.length > 0) {
|
|
24192
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
24193
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24194
|
+
}
|
|
24195
|
+
}
|
|
23008
24196
|
if (docContext != null) {
|
|
23009
24197
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
23010
24198
|
else compacted.proof["@context"] = docContext;
|
|
@@ -23173,13 +24361,21 @@ var Add = class Add extends Activity {
|
|
|
23173
24361
|
documentLoader: options.contextLoader,
|
|
23174
24362
|
keepFreeFloatingNodes: true
|
|
23175
24363
|
});
|
|
23176
|
-
|
|
24364
|
+
let docContext = options.context ?? [
|
|
23177
24365
|
"https://w3id.org/identity/v1",
|
|
23178
24366
|
"https://www.w3.org/ns/activitystreams",
|
|
23179
24367
|
"https://w3id.org/security/data-integrity/v1",
|
|
23180
24368
|
"https://gotosocial.org/ns"
|
|
23181
24369
|
];
|
|
23182
|
-
|
|
24370
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24371
|
+
if (options.context == null) {
|
|
24372
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
24373
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
24374
|
+
if (additionalContexts.length > 0) {
|
|
24375
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
24376
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24377
|
+
}
|
|
24378
|
+
}
|
|
23183
24379
|
if (docContext != null) {
|
|
23184
24380
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
23185
24381
|
else compacted.proof["@context"] = docContext;
|
|
@@ -23346,7 +24542,7 @@ var Announce = class Announce extends Activity {
|
|
|
23346
24542
|
documentLoader: options.contextLoader,
|
|
23347
24543
|
keepFreeFloatingNodes: true
|
|
23348
24544
|
});
|
|
23349
|
-
|
|
24545
|
+
let docContext = options.context ?? [
|
|
23350
24546
|
"https://w3id.org/identity/v1",
|
|
23351
24547
|
"https://www.w3.org/ns/activitystreams",
|
|
23352
24548
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -23381,7 +24577,15 @@ var Announce = class Announce extends Activity {
|
|
|
23381
24577
|
}
|
|
23382
24578
|
}
|
|
23383
24579
|
];
|
|
23384
|
-
|
|
24580
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24581
|
+
if (options.context == null) {
|
|
24582
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
24583
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
24584
|
+
if (additionalContexts.length > 0) {
|
|
24585
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
24586
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
24587
|
+
}
|
|
24588
|
+
}
|
|
23385
24589
|
if (docContext != null) {
|
|
23386
24590
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
23387
24591
|
else compacted.proof["@context"] = docContext;
|
|
@@ -26618,7 +27822,7 @@ var Application = class Application extends Object$1 {
|
|
|
26618
27822
|
documentLoader: options.contextLoader,
|
|
26619
27823
|
keepFreeFloatingNodes: true
|
|
26620
27824
|
});
|
|
26621
|
-
|
|
27825
|
+
let docContext = options.context ?? [
|
|
26622
27826
|
"https://www.w3.org/ns/activitystreams",
|
|
26623
27827
|
"https://w3id.org/fep/ef61",
|
|
26624
27828
|
"https://w3id.org/security/v1",
|
|
@@ -26663,7 +27867,15 @@ var Application = class Application extends Object$1 {
|
|
|
26663
27867
|
"isCat": "misskey:isCat"
|
|
26664
27868
|
}
|
|
26665
27869
|
];
|
|
26666
|
-
|
|
27870
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
27871
|
+
if (options.context == null) {
|
|
27872
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
27873
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
27874
|
+
if (additionalContexts.length > 0) {
|
|
27875
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
27876
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
27877
|
+
}
|
|
27878
|
+
}
|
|
26667
27879
|
if (docContext != null) {
|
|
26668
27880
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
26669
27881
|
else compacted.proof["@context"] = docContext;
|
|
@@ -27416,13 +28628,21 @@ var IntransitiveActivity = class IntransitiveActivity extends Activity {
|
|
|
27416
28628
|
documentLoader: options.contextLoader,
|
|
27417
28629
|
keepFreeFloatingNodes: true
|
|
27418
28630
|
});
|
|
27419
|
-
|
|
28631
|
+
let docContext = options.context ?? [
|
|
27420
28632
|
"https://w3id.org/identity/v1",
|
|
27421
28633
|
"https://www.w3.org/ns/activitystreams",
|
|
27422
28634
|
"https://w3id.org/security/data-integrity/v1",
|
|
27423
28635
|
"https://gotosocial.org/ns"
|
|
27424
28636
|
];
|
|
27425
|
-
|
|
28637
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28638
|
+
if (options.context == null) {
|
|
28639
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
28640
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
28641
|
+
if (additionalContexts.length > 0) {
|
|
28642
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
28643
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28644
|
+
}
|
|
28645
|
+
}
|
|
27426
28646
|
if (docContext != null) {
|
|
27427
28647
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
27428
28648
|
else compacted.proof["@context"] = docContext;
|
|
@@ -27592,13 +28812,21 @@ var Arrive = class Arrive extends IntransitiveActivity {
|
|
|
27592
28812
|
documentLoader: options.contextLoader,
|
|
27593
28813
|
keepFreeFloatingNodes: true
|
|
27594
28814
|
});
|
|
27595
|
-
|
|
28815
|
+
let docContext = options.context ?? [
|
|
27596
28816
|
"https://w3id.org/identity/v1",
|
|
27597
28817
|
"https://www.w3.org/ns/activitystreams",
|
|
27598
28818
|
"https://w3id.org/security/data-integrity/v1",
|
|
27599
28819
|
"https://gotosocial.org/ns"
|
|
27600
28820
|
];
|
|
27601
|
-
|
|
28821
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28822
|
+
if (options.context == null) {
|
|
28823
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
28824
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
28825
|
+
if (additionalContexts.length > 0) {
|
|
28826
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
28827
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
28828
|
+
}
|
|
28829
|
+
}
|
|
27602
28830
|
if (docContext != null) {
|
|
27603
28831
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
27604
28832
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28169,7 +29397,7 @@ var Article = class Article extends Object$1 {
|
|
|
28169
29397
|
documentLoader: options.contextLoader,
|
|
28170
29398
|
keepFreeFloatingNodes: true
|
|
28171
29399
|
});
|
|
28172
|
-
|
|
29400
|
+
let docContext = options.context ?? [
|
|
28173
29401
|
"https://www.w3.org/ns/activitystreams",
|
|
28174
29402
|
"https://w3id.org/security/data-integrity/v1",
|
|
28175
29403
|
"https://gotosocial.org/ns",
|
|
@@ -28198,7 +29426,15 @@ var Article = class Article extends Object$1 {
|
|
|
28198
29426
|
}
|
|
28199
29427
|
}
|
|
28200
29428
|
];
|
|
28201
|
-
|
|
29429
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29430
|
+
if (options.context == null) {
|
|
29431
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
29432
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
29433
|
+
if (additionalContexts.length > 0) {
|
|
29434
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
29435
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29436
|
+
}
|
|
29437
|
+
}
|
|
28202
29438
|
if (docContext != null) {
|
|
28203
29439
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
28204
29440
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28555,13 +29791,21 @@ var Document = class Document extends Object$1 {
|
|
|
28555
29791
|
documentLoader: options.contextLoader,
|
|
28556
29792
|
keepFreeFloatingNodes: true
|
|
28557
29793
|
});
|
|
28558
|
-
|
|
29794
|
+
let docContext = options.context ?? [
|
|
28559
29795
|
"https://www.w3.org/ns/activitystreams",
|
|
28560
29796
|
"https://w3id.org/security/data-integrity/v2",
|
|
28561
29797
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
28562
29798
|
"https://gotosocial.org/ns"
|
|
28563
29799
|
];
|
|
28564
|
-
|
|
29800
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29801
|
+
if (options.context == null) {
|
|
29802
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
29803
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
29804
|
+
if (additionalContexts.length > 0) {
|
|
29805
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
29806
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29807
|
+
}
|
|
29808
|
+
}
|
|
28565
29809
|
if (docContext != null) {
|
|
28566
29810
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
28567
29811
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28801,13 +30045,21 @@ var Audio = class Audio extends Document {
|
|
|
28801
30045
|
documentLoader: options.contextLoader,
|
|
28802
30046
|
keepFreeFloatingNodes: true
|
|
28803
30047
|
});
|
|
28804
|
-
|
|
30048
|
+
let docContext = options.context ?? [
|
|
28805
30049
|
"https://www.w3.org/ns/activitystreams",
|
|
28806
30050
|
"https://w3id.org/security/data-integrity/v2",
|
|
28807
30051
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
28808
30052
|
"https://gotosocial.org/ns"
|
|
28809
30053
|
];
|
|
28810
|
-
|
|
30054
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30055
|
+
if (options.context == null) {
|
|
30056
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
30057
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
30058
|
+
if (additionalContexts.length > 0) {
|
|
30059
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
30060
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30061
|
+
}
|
|
30062
|
+
}
|
|
28811
30063
|
if (docContext != null) {
|
|
28812
30064
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
28813
30065
|
else compacted.proof["@context"] = docContext;
|
|
@@ -28967,194 +30219,210 @@ var Ignore = class Ignore extends Activity {
|
|
|
28967
30219
|
format: "expand",
|
|
28968
30220
|
context: void 0
|
|
28969
30221
|
}))[0];
|
|
28970
|
-
values["@type"] = ["https://www.w3.org/ns/activitystreams#Ignore"];
|
|
30222
|
+
values["@type"] = ["https://www.w3.org/ns/activitystreams#Ignore"];
|
|
30223
|
+
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
30224
|
+
if (options.format === "expand") return await jsonld.expand(values, {
|
|
30225
|
+
documentLoader: options.contextLoader,
|
|
30226
|
+
keepFreeFloatingNodes: true
|
|
30227
|
+
});
|
|
30228
|
+
let docContext = options.context ?? [
|
|
30229
|
+
"https://w3id.org/identity/v1",
|
|
30230
|
+
"https://www.w3.org/ns/activitystreams",
|
|
30231
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
30232
|
+
"https://gotosocial.org/ns"
|
|
30233
|
+
];
|
|
30234
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30235
|
+
if (options.context == null) {
|
|
30236
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
30237
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
30238
|
+
if (additionalContexts.length > 0) {
|
|
30239
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
30240
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30241
|
+
}
|
|
30242
|
+
}
|
|
30243
|
+
if (docContext != null) {
|
|
30244
|
+
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30245
|
+
else compacted.proof["@context"] = docContext;
|
|
30246
|
+
}
|
|
30247
|
+
return compacted;
|
|
30248
|
+
}
|
|
30249
|
+
isCompactable() {
|
|
30250
|
+
return super.isCompactable();
|
|
30251
|
+
}
|
|
30252
|
+
/**
|
|
30253
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
30254
|
+
* @param json The JSON-LD structure to convert.
|
|
30255
|
+
* @param options The options to use.
|
|
30256
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
30257
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
30258
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
30259
|
+
* If omitted, the global tracer provider is used.
|
|
30260
|
+
* @returns The object of this type.
|
|
30261
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
30262
|
+
*/
|
|
30263
|
+
static async fromJsonLd(json, options = {}) {
|
|
30264
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
30265
|
+
try {
|
|
30266
|
+
const object = await this.__fromJsonLd__Ignore__(json, span, options);
|
|
30267
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
30268
|
+
return object;
|
|
30269
|
+
} catch (error) {
|
|
30270
|
+
span.setStatus({
|
|
30271
|
+
code: SpanStatusCode.ERROR,
|
|
30272
|
+
message: String(error)
|
|
30273
|
+
});
|
|
30274
|
+
throw error;
|
|
30275
|
+
} finally {
|
|
30276
|
+
span.end();
|
|
30277
|
+
}
|
|
30278
|
+
});
|
|
30279
|
+
}
|
|
30280
|
+
static async __fromJsonLd__Ignore__(json, span, options = {}) {
|
|
30281
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
30282
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
30283
|
+
options = {
|
|
30284
|
+
...options,
|
|
30285
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
30286
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
30287
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
30288
|
+
};
|
|
30289
|
+
let values;
|
|
30290
|
+
let expanded;
|
|
30291
|
+
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
30292
|
+
values = json;
|
|
30293
|
+
expanded = [values];
|
|
30294
|
+
} else if (globalThis.Object.keys(json).length == 0) {
|
|
30295
|
+
values = {};
|
|
30296
|
+
expanded = [values];
|
|
30297
|
+
} else {
|
|
30298
|
+
expanded = await jsonld.expand(json, {
|
|
30299
|
+
documentLoader: options.contextLoader,
|
|
30300
|
+
keepFreeFloatingNodes: true
|
|
30301
|
+
});
|
|
30302
|
+
values = expanded[0] ?? {};
|
|
30303
|
+
}
|
|
30304
|
+
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
30305
|
+
if (id != null && options.baseUrl == null) options = {
|
|
30306
|
+
...options,
|
|
30307
|
+
baseUrl: id
|
|
30308
|
+
};
|
|
30309
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
30310
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
30311
|
+
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) return await Block.fromJsonLd(json, options);
|
|
30312
|
+
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
30313
|
+
}
|
|
30314
|
+
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
30315
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
30316
|
+
const superValues = structuredClone(values);
|
|
30317
|
+
delete superValues["@type"];
|
|
30318
|
+
const instance = await super.fromJsonLd(superValues, {
|
|
30319
|
+
...options,
|
|
30320
|
+
_fromSubclass: true
|
|
30321
|
+
});
|
|
30322
|
+
if (!(instance instanceof Ignore)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
30323
|
+
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
30324
|
+
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
30325
|
+
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
30326
|
+
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
30327
|
+
const compactArray = Array.isArray(json) && json.length === 1;
|
|
30328
|
+
const jsonLd = compactArray ? json[0] : json;
|
|
30329
|
+
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
30330
|
+
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
30331
|
+
} else instance._cachedJsonLd = structuredClone(json);
|
|
30332
|
+
} catch {
|
|
30333
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
30334
|
+
}
|
|
30335
|
+
return instance;
|
|
30336
|
+
}
|
|
30337
|
+
_getCustomInspectProxy() {
|
|
30338
|
+
return super._getCustomInspectProxy();
|
|
30339
|
+
}
|
|
30340
|
+
};
|
|
30341
|
+
Ignore.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
30342
|
+
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
30343
|
+
};
|
|
30344
|
+
Ignore.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
30345
|
+
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
30346
|
+
};
|
|
30347
|
+
/** Indicates that the `actor` is blocking the `object`. Blocking is a stronger
|
|
30348
|
+
* form of {@link Ignore}. The typical use is to support social systems that
|
|
30349
|
+
* allow one user to block activities or content of other users. The `target`
|
|
30350
|
+
* and `origin` typically have no defined meaning.
|
|
30351
|
+
*/
|
|
30352
|
+
var Block = class Block extends Ignore {
|
|
30353
|
+
/**
|
|
30354
|
+
* The type URI of {@link Block}: `https://www.w3.org/ns/activitystreams#Block`.
|
|
30355
|
+
*/
|
|
30356
|
+
static get typeId() {
|
|
30357
|
+
return new URL("https://www.w3.org/ns/activitystreams#Block");
|
|
30358
|
+
}
|
|
30359
|
+
/**
|
|
30360
|
+
* Constructs a new instance of Block with the given values.
|
|
30361
|
+
* @param values The values to initialize the instance with.
|
|
30362
|
+
* @param options The options to use for initialization.
|
|
30363
|
+
*/
|
|
30364
|
+
constructor(values, options = {}) {
|
|
30365
|
+
super(values, options);
|
|
30366
|
+
}
|
|
30367
|
+
/**
|
|
30368
|
+
* Clones this instance, optionally updating it with the given values.
|
|
30369
|
+
* @param values The values to update the clone with.
|
|
30370
|
+
* @param options The options to use for cloning.
|
|
30371
|
+
* @returns The cloned instance.
|
|
30372
|
+
*/
|
|
30373
|
+
clone(values = {}, options = {}) {
|
|
30374
|
+
if (this._warning != null) {
|
|
30375
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
30376
|
+
options = {
|
|
30377
|
+
...options,
|
|
30378
|
+
$warning: this._warning
|
|
30379
|
+
};
|
|
30380
|
+
}
|
|
30381
|
+
return super.clone(values, options);
|
|
30382
|
+
}
|
|
30383
|
+
/**
|
|
30384
|
+
* Converts this object to a JSON-LD structure.
|
|
30385
|
+
* @param options The options to use.
|
|
30386
|
+
* - `format`: The format of the output: `compact` or
|
|
30387
|
+
`expand`.
|
|
30388
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
30389
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
30390
|
+
when `format` is set to `'expand'`.
|
|
30391
|
+
* @returns The JSON-LD representation of this object.
|
|
30392
|
+
*/
|
|
30393
|
+
async toJsonLd(options = {}) {
|
|
30394
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
30395
|
+
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'.");
|
|
30396
|
+
options = {
|
|
30397
|
+
...options,
|
|
30398
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
30399
|
+
};
|
|
30400
|
+
const values = (await super.toJsonLd({
|
|
30401
|
+
...options,
|
|
30402
|
+
format: "expand",
|
|
30403
|
+
context: void 0
|
|
30404
|
+
}))[0];
|
|
30405
|
+
values["@type"] = ["https://www.w3.org/ns/activitystreams#Block"];
|
|
28971
30406
|
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
28972
30407
|
if (options.format === "expand") return await jsonld.expand(values, {
|
|
28973
30408
|
documentLoader: options.contextLoader,
|
|
28974
30409
|
keepFreeFloatingNodes: true
|
|
28975
30410
|
});
|
|
28976
|
-
|
|
30411
|
+
let docContext = options.context ?? [
|
|
28977
30412
|
"https://w3id.org/identity/v1",
|
|
28978
30413
|
"https://www.w3.org/ns/activitystreams",
|
|
28979
30414
|
"https://w3id.org/security/data-integrity/v1",
|
|
28980
30415
|
"https://gotosocial.org/ns"
|
|
28981
30416
|
];
|
|
28982
|
-
|
|
28983
|
-
if (
|
|
28984
|
-
|
|
28985
|
-
|
|
28986
|
-
|
|
28987
|
-
|
|
28988
|
-
|
|
28989
|
-
isCompactable() {
|
|
28990
|
-
return super.isCompactable();
|
|
28991
|
-
}
|
|
28992
|
-
/**
|
|
28993
|
-
* Converts a JSON-LD structure to an object of this type.
|
|
28994
|
-
* @param json The JSON-LD structure to convert.
|
|
28995
|
-
* @param options The options to use.
|
|
28996
|
-
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
28997
|
-
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
28998
|
-
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
28999
|
-
* If omitted, the global tracer provider is used.
|
|
29000
|
-
* @returns The object of this type.
|
|
29001
|
-
* @throws {TypeError} If the given `json` is invalid.
|
|
29002
|
-
*/
|
|
29003
|
-
static async fromJsonLd(json, options = {}) {
|
|
29004
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
29005
|
-
try {
|
|
29006
|
-
const object = await this.__fromJsonLd__Ignore__(json, span, options);
|
|
29007
|
-
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
29008
|
-
return object;
|
|
29009
|
-
} catch (error) {
|
|
29010
|
-
span.setStatus({
|
|
29011
|
-
code: SpanStatusCode.ERROR,
|
|
29012
|
-
message: String(error)
|
|
29013
|
-
});
|
|
29014
|
-
throw error;
|
|
29015
|
-
} finally {
|
|
29016
|
-
span.end();
|
|
30417
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
30418
|
+
if (options.context == null) {
|
|
30419
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
30420
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
30421
|
+
if (additionalContexts.length > 0) {
|
|
30422
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
30423
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29017
30424
|
}
|
|
29018
|
-
});
|
|
29019
|
-
}
|
|
29020
|
-
static async __fromJsonLd__Ignore__(json, span, options = {}) {
|
|
29021
|
-
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
29022
|
-
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
29023
|
-
options = {
|
|
29024
|
-
...options,
|
|
29025
|
-
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
29026
|
-
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
29027
|
-
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
29028
|
-
};
|
|
29029
|
-
let values;
|
|
29030
|
-
let expanded;
|
|
29031
|
-
if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
|
|
29032
|
-
values = json;
|
|
29033
|
-
expanded = [values];
|
|
29034
|
-
} else if (globalThis.Object.keys(json).length == 0) {
|
|
29035
|
-
values = {};
|
|
29036
|
-
expanded = [values];
|
|
29037
|
-
} else {
|
|
29038
|
-
expanded = await jsonld.expand(json, {
|
|
29039
|
-
documentLoader: options.contextLoader,
|
|
29040
|
-
keepFreeFloatingNodes: true
|
|
29041
|
-
});
|
|
29042
|
-
values = expanded[0] ?? {};
|
|
29043
30425
|
}
|
|
29044
|
-
const id = parseJsonLdId(values["@id"], options.baseUrl);
|
|
29045
|
-
if (id != null && options.baseUrl == null) options = {
|
|
29046
|
-
...options,
|
|
29047
|
-
baseUrl: id
|
|
29048
|
-
};
|
|
29049
|
-
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
29050
|
-
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
29051
|
-
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) return await Block.fromJsonLd(json, options);
|
|
29052
|
-
if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
29053
|
-
}
|
|
29054
|
-
let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? normalizeJsonLdIris(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
|
|
29055
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
|
|
29056
|
-
const superValues = structuredClone(values);
|
|
29057
|
-
delete superValues["@type"];
|
|
29058
|
-
const instance = await super.fromJsonLd(superValues, {
|
|
29059
|
-
...options,
|
|
29060
|
-
_fromSubclass: true
|
|
29061
|
-
});
|
|
29062
|
-
if (!(instance instanceof Ignore)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
29063
|
-
let shouldCacheJsonLd = instance._shouldCacheJsonLd;
|
|
29064
|
-
instance._shouldCacheJsonLd = shouldCacheJsonLd;
|
|
29065
|
-
if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
|
|
29066
|
-
if (cacheJsonLd != null && cacheJsonLd !== expanded) {
|
|
29067
|
-
const compactArray = Array.isArray(json) && json.length === 1;
|
|
29068
|
-
const jsonLd = compactArray ? json[0] : json;
|
|
29069
|
-
const cachedJsonLd = await compactJsonLdCache(cacheJsonLd, jsonLd, options.contextLoader);
|
|
29070
|
-
instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
|
|
29071
|
-
} else instance._cachedJsonLd = structuredClone(json);
|
|
29072
|
-
} catch {
|
|
29073
|
-
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
29074
|
-
}
|
|
29075
|
-
return instance;
|
|
29076
|
-
}
|
|
29077
|
-
_getCustomInspectProxy() {
|
|
29078
|
-
return super._getCustomInspectProxy();
|
|
29079
|
-
}
|
|
29080
|
-
};
|
|
29081
|
-
Ignore.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
29082
|
-
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
29083
|
-
};
|
|
29084
|
-
Ignore.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
29085
|
-
return "Ignore " + inspect(this._getCustomInspectProxy(), options);
|
|
29086
|
-
};
|
|
29087
|
-
/** Indicates that the `actor` is blocking the `object`. Blocking is a stronger
|
|
29088
|
-
* form of {@link Ignore}. The typical use is to support social systems that
|
|
29089
|
-
* allow one user to block activities or content of other users. The `target`
|
|
29090
|
-
* and `origin` typically have no defined meaning.
|
|
29091
|
-
*/
|
|
29092
|
-
var Block = class Block extends Ignore {
|
|
29093
|
-
/**
|
|
29094
|
-
* The type URI of {@link Block}: `https://www.w3.org/ns/activitystreams#Block`.
|
|
29095
|
-
*/
|
|
29096
|
-
static get typeId() {
|
|
29097
|
-
return new URL("https://www.w3.org/ns/activitystreams#Block");
|
|
29098
|
-
}
|
|
29099
|
-
/**
|
|
29100
|
-
* Constructs a new instance of Block with the given values.
|
|
29101
|
-
* @param values The values to initialize the instance with.
|
|
29102
|
-
* @param options The options to use for initialization.
|
|
29103
|
-
*/
|
|
29104
|
-
constructor(values, options = {}) {
|
|
29105
|
-
super(values, options);
|
|
29106
|
-
}
|
|
29107
|
-
/**
|
|
29108
|
-
* Clones this instance, optionally updating it with the given values.
|
|
29109
|
-
* @param values The values to update the clone with.
|
|
29110
|
-
* @param options The options to use for cloning.
|
|
29111
|
-
* @returns The cloned instance.
|
|
29112
|
-
*/
|
|
29113
|
-
clone(values = {}, options = {}) {
|
|
29114
|
-
if (this._warning != null) {
|
|
29115
|
-
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
29116
|
-
options = {
|
|
29117
|
-
...options,
|
|
29118
|
-
$warning: this._warning
|
|
29119
|
-
};
|
|
29120
|
-
}
|
|
29121
|
-
return super.clone(values, options);
|
|
29122
|
-
}
|
|
29123
|
-
/**
|
|
29124
|
-
* Converts this object to a JSON-LD structure.
|
|
29125
|
-
* @param options The options to use.
|
|
29126
|
-
* - `format`: The format of the output: `compact` or
|
|
29127
|
-
`expand`.
|
|
29128
|
-
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
29129
|
-
* - `context`: The JSON-LD context to use. Not applicable
|
|
29130
|
-
when `format` is set to `'expand'`.
|
|
29131
|
-
* @returns The JSON-LD representation of this object.
|
|
29132
|
-
*/
|
|
29133
|
-
async toJsonLd(options = {}) {
|
|
29134
|
-
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
29135
|
-
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'.");
|
|
29136
|
-
options = {
|
|
29137
|
-
...options,
|
|
29138
|
-
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
29139
|
-
};
|
|
29140
|
-
const values = (await super.toJsonLd({
|
|
29141
|
-
...options,
|
|
29142
|
-
format: "expand",
|
|
29143
|
-
context: void 0
|
|
29144
|
-
}))[0];
|
|
29145
|
-
values["@type"] = ["https://www.w3.org/ns/activitystreams#Block"];
|
|
29146
|
-
if (this.id != null) values["@id"] = formatIri(this.id);
|
|
29147
|
-
if (options.format === "expand") return await jsonld.expand(values, {
|
|
29148
|
-
documentLoader: options.contextLoader,
|
|
29149
|
-
keepFreeFloatingNodes: true
|
|
29150
|
-
});
|
|
29151
|
-
const docContext = options.context ?? [
|
|
29152
|
-
"https://w3id.org/identity/v1",
|
|
29153
|
-
"https://www.w3.org/ns/activitystreams",
|
|
29154
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
29155
|
-
"https://gotosocial.org/ns"
|
|
29156
|
-
];
|
|
29157
|
-
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
29158
30426
|
if (docContext != null) {
|
|
29159
30427
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
29160
30428
|
else compacted.proof["@context"] = docContext;
|
|
@@ -29837,7 +31105,7 @@ var CollectionPage = class CollectionPage extends Collection {
|
|
|
29837
31105
|
documentLoader: options.contextLoader,
|
|
29838
31106
|
keepFreeFloatingNodes: true
|
|
29839
31107
|
});
|
|
29840
|
-
|
|
31108
|
+
let docContext = options.context ?? [
|
|
29841
31109
|
"https://www.w3.org/ns/activitystreams",
|
|
29842
31110
|
"https://w3id.org/security/data-integrity/v1",
|
|
29843
31111
|
"https://gotosocial.org/ns",
|
|
@@ -29869,7 +31137,15 @@ var CollectionPage = class CollectionPage extends Collection {
|
|
|
29869
31137
|
}
|
|
29870
31138
|
}
|
|
29871
31139
|
];
|
|
29872
|
-
|
|
31140
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31141
|
+
if (options.context == null) {
|
|
31142
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31143
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31144
|
+
if (additionalContexts.length > 0) {
|
|
31145
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31146
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31147
|
+
}
|
|
31148
|
+
}
|
|
29873
31149
|
if (docContext != null) {
|
|
29874
31150
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
29875
31151
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30114,7 +31390,7 @@ var Create = class Create extends Activity {
|
|
|
30114
31390
|
documentLoader: options.contextLoader,
|
|
30115
31391
|
keepFreeFloatingNodes: true
|
|
30116
31392
|
});
|
|
30117
|
-
|
|
31393
|
+
let docContext = options.context ?? [
|
|
30118
31394
|
"https://w3id.org/identity/v1",
|
|
30119
31395
|
"https://www.w3.org/ns/activitystreams",
|
|
30120
31396
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -30150,7 +31426,15 @@ var Create = class Create extends Activity {
|
|
|
30150
31426
|
}
|
|
30151
31427
|
}
|
|
30152
31428
|
];
|
|
30153
|
-
|
|
31429
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31430
|
+
if (options.context == null) {
|
|
31431
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31432
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31433
|
+
if (additionalContexts.length > 0) {
|
|
31434
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31435
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31436
|
+
}
|
|
31437
|
+
}
|
|
30154
31438
|
if (docContext != null) {
|
|
30155
31439
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30156
31440
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30316,7 +31600,7 @@ var Delete = class Delete extends Activity {
|
|
|
30316
31600
|
documentLoader: options.contextLoader,
|
|
30317
31601
|
keepFreeFloatingNodes: true
|
|
30318
31602
|
});
|
|
30319
|
-
|
|
31603
|
+
let docContext = options.context ?? [
|
|
30320
31604
|
"https://w3id.org/identity/v1",
|
|
30321
31605
|
"https://www.w3.org/ns/activitystreams",
|
|
30322
31606
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -30348,7 +31632,15 @@ var Delete = class Delete extends Activity {
|
|
|
30348
31632
|
}
|
|
30349
31633
|
}
|
|
30350
31634
|
];
|
|
30351
|
-
|
|
31635
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31636
|
+
if (options.context == null) {
|
|
31637
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31638
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31639
|
+
if (additionalContexts.length > 0) {
|
|
31640
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31641
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31642
|
+
}
|
|
31643
|
+
}
|
|
30352
31644
|
if (docContext != null) {
|
|
30353
31645
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30354
31646
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30513,7 +31805,7 @@ var Dislike = class Dislike extends Activity {
|
|
|
30513
31805
|
documentLoader: options.contextLoader,
|
|
30514
31806
|
keepFreeFloatingNodes: true
|
|
30515
31807
|
});
|
|
30516
|
-
|
|
31808
|
+
let docContext = options.context ?? [
|
|
30517
31809
|
"https://w3id.org/identity/v1",
|
|
30518
31810
|
"https://www.w3.org/ns/activitystreams",
|
|
30519
31811
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -30523,7 +31815,15 @@ var Dislike = class Dislike extends Activity {
|
|
|
30523
31815
|
"Emoji": "toot:Emoji"
|
|
30524
31816
|
}
|
|
30525
31817
|
];
|
|
30526
|
-
|
|
31818
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31819
|
+
if (options.context == null) {
|
|
31820
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
31821
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
31822
|
+
if (additionalContexts.length > 0) {
|
|
31823
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
31824
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
31825
|
+
}
|
|
31826
|
+
}
|
|
30527
31827
|
if (docContext != null) {
|
|
30528
31828
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
30529
31829
|
else compacted.proof["@context"] = docContext;
|
|
@@ -30976,8 +32276,16 @@ var Endpoints = class {
|
|
|
30976
32276
|
documentLoader: options.contextLoader,
|
|
30977
32277
|
keepFreeFloatingNodes: true
|
|
30978
32278
|
});
|
|
30979
|
-
|
|
30980
|
-
|
|
32279
|
+
let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
|
|
32280
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32281
|
+
if (options.context == null) {
|
|
32282
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32283
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32284
|
+
if (additionalContexts.length > 0) {
|
|
32285
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32286
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32287
|
+
}
|
|
32288
|
+
}
|
|
30981
32289
|
if (docContext != null) {}
|
|
30982
32290
|
return compacted;
|
|
30983
32291
|
}
|
|
@@ -31279,12 +32587,20 @@ var Event = class Event extends Object$1 {
|
|
|
31279
32587
|
documentLoader: options.contextLoader,
|
|
31280
32588
|
keepFreeFloatingNodes: true
|
|
31281
32589
|
});
|
|
31282
|
-
|
|
32590
|
+
let docContext = options.context ?? [
|
|
31283
32591
|
"https://www.w3.org/ns/activitystreams",
|
|
31284
32592
|
"https://w3id.org/security/data-integrity/v1",
|
|
31285
32593
|
"https://gotosocial.org/ns"
|
|
31286
32594
|
];
|
|
31287
|
-
|
|
32595
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32596
|
+
if (options.context == null) {
|
|
32597
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32598
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32599
|
+
if (additionalContexts.length > 0) {
|
|
32600
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32601
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32602
|
+
}
|
|
32603
|
+
}
|
|
31288
32604
|
if (docContext != null) {
|
|
31289
32605
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
31290
32606
|
else compacted.proof["@context"] = docContext;
|
|
@@ -31451,13 +32767,21 @@ var Flag = class Flag extends Activity {
|
|
|
31451
32767
|
documentLoader: options.contextLoader,
|
|
31452
32768
|
keepFreeFloatingNodes: true
|
|
31453
32769
|
});
|
|
31454
|
-
|
|
32770
|
+
let docContext = options.context ?? [
|
|
31455
32771
|
"https://w3id.org/identity/v1",
|
|
31456
32772
|
"https://www.w3.org/ns/activitystreams",
|
|
31457
32773
|
"https://w3id.org/security/data-integrity/v1",
|
|
31458
32774
|
"https://gotosocial.org/ns"
|
|
31459
32775
|
];
|
|
31460
|
-
|
|
32776
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32777
|
+
if (options.context == null) {
|
|
32778
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32779
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32780
|
+
if (additionalContexts.length > 0) {
|
|
32781
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32782
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32783
|
+
}
|
|
32784
|
+
}
|
|
31461
32785
|
if (docContext != null) {
|
|
31462
32786
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
31463
32787
|
else compacted.proof["@context"] = docContext;
|
|
@@ -31625,7 +32949,7 @@ var Follow = class Follow extends Activity {
|
|
|
31625
32949
|
documentLoader: options.contextLoader,
|
|
31626
32950
|
keepFreeFloatingNodes: true
|
|
31627
32951
|
});
|
|
31628
|
-
|
|
32952
|
+
let docContext = options.context ?? [
|
|
31629
32953
|
"https://w3id.org/identity/v1",
|
|
31630
32954
|
"https://www.w3.org/ns/activitystreams",
|
|
31631
32955
|
"https://w3id.org/security/v1",
|
|
@@ -31634,7 +32958,15 @@ var Follow = class Follow extends Activity {
|
|
|
31634
32958
|
"https://w3id.org/security/multikey/v1",
|
|
31635
32959
|
"https://gotosocial.org/ns"
|
|
31636
32960
|
];
|
|
31637
|
-
|
|
32961
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32962
|
+
if (options.context == null) {
|
|
32963
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
32964
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
32965
|
+
if (additionalContexts.length > 0) {
|
|
32966
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
32967
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
32968
|
+
}
|
|
32969
|
+
}
|
|
31638
32970
|
if (docContext != null) {
|
|
31639
32971
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
31640
32972
|
else compacted.proof["@context"] = docContext;
|
|
@@ -34871,7 +36203,7 @@ var Group = class Group extends Object$1 {
|
|
|
34871
36203
|
documentLoader: options.contextLoader,
|
|
34872
36204
|
keepFreeFloatingNodes: true
|
|
34873
36205
|
});
|
|
34874
|
-
|
|
36206
|
+
let docContext = options.context ?? [
|
|
34875
36207
|
"https://www.w3.org/ns/activitystreams",
|
|
34876
36208
|
"https://w3id.org/fep/ef61",
|
|
34877
36209
|
"https://w3id.org/security/v1",
|
|
@@ -34916,7 +36248,15 @@ var Group = class Group extends Object$1 {
|
|
|
34916
36248
|
"isCat": "misskey:isCat"
|
|
34917
36249
|
}
|
|
34918
36250
|
];
|
|
34919
|
-
|
|
36251
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
36252
|
+
if (options.context == null) {
|
|
36253
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
36254
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
36255
|
+
if (additionalContexts.length > 0) {
|
|
36256
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
36257
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
36258
|
+
}
|
|
36259
|
+
}
|
|
34920
36260
|
if (docContext != null) {
|
|
34921
36261
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
34922
36262
|
else compacted.proof["@context"] = docContext;
|
|
@@ -36200,8 +37540,16 @@ var Link = class Link {
|
|
|
36200
37540
|
documentLoader: options.contextLoader,
|
|
36201
37541
|
keepFreeFloatingNodes: true
|
|
36202
37542
|
});
|
|
36203
|
-
|
|
36204
|
-
|
|
37543
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/ef61"];
|
|
37544
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37545
|
+
if (options.context == null) {
|
|
37546
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
37547
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
37548
|
+
if (additionalContexts.length > 0) {
|
|
37549
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
37550
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37551
|
+
}
|
|
37552
|
+
}
|
|
36205
37553
|
if (docContext != null) {}
|
|
36206
37554
|
return compacted;
|
|
36207
37555
|
}
|
|
@@ -36627,8 +37975,16 @@ var Hashtag = class Hashtag extends Link {
|
|
|
36627
37975
|
documentLoader: options.contextLoader,
|
|
36628
37976
|
keepFreeFloatingNodes: true
|
|
36629
37977
|
});
|
|
36630
|
-
|
|
36631
|
-
|
|
37978
|
+
let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", { "Hashtag": "as:Hashtag" }];
|
|
37979
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37980
|
+
if (options.context == null) {
|
|
37981
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
37982
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
37983
|
+
if (additionalContexts.length > 0) {
|
|
37984
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
37985
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
37986
|
+
}
|
|
37987
|
+
}
|
|
36632
37988
|
if (docContext != null) {}
|
|
36633
37989
|
return compacted;
|
|
36634
37990
|
}
|
|
@@ -36806,13 +38162,21 @@ var Image = class Image extends Document {
|
|
|
36806
38162
|
documentLoader: options.contextLoader,
|
|
36807
38163
|
keepFreeFloatingNodes: true
|
|
36808
38164
|
});
|
|
36809
|
-
|
|
38165
|
+
let docContext = options.context ?? [
|
|
36810
38166
|
"https://www.w3.org/ns/activitystreams",
|
|
36811
38167
|
"https://w3id.org/security/data-integrity/v2",
|
|
36812
38168
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
36813
38169
|
"https://gotosocial.org/ns"
|
|
36814
38170
|
];
|
|
36815
|
-
|
|
38171
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38172
|
+
if (options.context == null) {
|
|
38173
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38174
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38175
|
+
if (additionalContexts.length > 0) {
|
|
38176
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38177
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38178
|
+
}
|
|
38179
|
+
}
|
|
36816
38180
|
if (docContext != null) {
|
|
36817
38181
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
36818
38182
|
else compacted.proof["@context"] = docContext;
|
|
@@ -36979,13 +38343,21 @@ var Offer = class Offer extends Activity {
|
|
|
36979
38343
|
documentLoader: options.contextLoader,
|
|
36980
38344
|
keepFreeFloatingNodes: true
|
|
36981
38345
|
});
|
|
36982
|
-
|
|
38346
|
+
let docContext = options.context ?? [
|
|
36983
38347
|
"https://w3id.org/identity/v1",
|
|
36984
38348
|
"https://www.w3.org/ns/activitystreams",
|
|
36985
38349
|
"https://w3id.org/security/data-integrity/v1",
|
|
36986
38350
|
"https://gotosocial.org/ns"
|
|
36987
38351
|
];
|
|
36988
|
-
|
|
38352
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38353
|
+
if (options.context == null) {
|
|
38354
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38355
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38356
|
+
if (additionalContexts.length > 0) {
|
|
38357
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38358
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38359
|
+
}
|
|
38360
|
+
}
|
|
36989
38361
|
if (docContext != null) {
|
|
36990
38362
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
36991
38363
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37152,13 +38524,21 @@ var Invite = class Invite extends Offer {
|
|
|
37152
38524
|
documentLoader: options.contextLoader,
|
|
37153
38525
|
keepFreeFloatingNodes: true
|
|
37154
38526
|
});
|
|
37155
|
-
|
|
38527
|
+
let docContext = options.context ?? [
|
|
37156
38528
|
"https://w3id.org/identity/v1",
|
|
37157
38529
|
"https://www.w3.org/ns/activitystreams",
|
|
37158
38530
|
"https://w3id.org/security/data-integrity/v1",
|
|
37159
38531
|
"https://gotosocial.org/ns"
|
|
37160
38532
|
];
|
|
37161
|
-
|
|
38533
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38534
|
+
if (options.context == null) {
|
|
38535
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38536
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38537
|
+
if (additionalContexts.length > 0) {
|
|
38538
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38539
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38540
|
+
}
|
|
38541
|
+
}
|
|
37162
38542
|
if (docContext != null) {
|
|
37163
38543
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37164
38544
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37324,13 +38704,21 @@ var Join = class Join extends Activity {
|
|
|
37324
38704
|
documentLoader: options.contextLoader,
|
|
37325
38705
|
keepFreeFloatingNodes: true
|
|
37326
38706
|
});
|
|
37327
|
-
|
|
38707
|
+
let docContext = options.context ?? [
|
|
37328
38708
|
"https://w3id.org/identity/v1",
|
|
37329
38709
|
"https://www.w3.org/ns/activitystreams",
|
|
37330
38710
|
"https://w3id.org/security/data-integrity/v1",
|
|
37331
38711
|
"https://gotosocial.org/ns"
|
|
37332
38712
|
];
|
|
37333
|
-
|
|
38713
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38714
|
+
if (options.context == null) {
|
|
38715
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38716
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38717
|
+
if (additionalContexts.length > 0) {
|
|
38718
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38719
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38720
|
+
}
|
|
38721
|
+
}
|
|
37334
38722
|
if (docContext != null) {
|
|
37335
38723
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37336
38724
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37496,13 +38884,21 @@ var Leave = class Leave extends Activity {
|
|
|
37496
38884
|
documentLoader: options.contextLoader,
|
|
37497
38885
|
keepFreeFloatingNodes: true
|
|
37498
38886
|
});
|
|
37499
|
-
|
|
38887
|
+
let docContext = options.context ?? [
|
|
37500
38888
|
"https://w3id.org/identity/v1",
|
|
37501
38889
|
"https://www.w3.org/ns/activitystreams",
|
|
37502
38890
|
"https://w3id.org/security/data-integrity/v1",
|
|
37503
38891
|
"https://gotosocial.org/ns"
|
|
37504
38892
|
];
|
|
37505
|
-
|
|
38893
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38894
|
+
if (options.context == null) {
|
|
38895
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
38896
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
38897
|
+
if (additionalContexts.length > 0) {
|
|
38898
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
38899
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
38900
|
+
}
|
|
38901
|
+
}
|
|
37506
38902
|
if (docContext != null) {
|
|
37507
38903
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37508
38904
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37668,7 +39064,7 @@ var Like = class Like extends Activity {
|
|
|
37668
39064
|
documentLoader: options.contextLoader,
|
|
37669
39065
|
keepFreeFloatingNodes: true
|
|
37670
39066
|
});
|
|
37671
|
-
|
|
39067
|
+
let docContext = options.context ?? [
|
|
37672
39068
|
"https://w3id.org/identity/v1",
|
|
37673
39069
|
"https://www.w3.org/ns/activitystreams",
|
|
37674
39070
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -37678,7 +39074,15 @@ var Like = class Like extends Activity {
|
|
|
37678
39074
|
"Emoji": "toot:Emoji"
|
|
37679
39075
|
}
|
|
37680
39076
|
];
|
|
37681
|
-
|
|
39077
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39078
|
+
if (options.context == null) {
|
|
39079
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39080
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39081
|
+
if (additionalContexts.length > 0) {
|
|
39082
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39083
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39084
|
+
}
|
|
39085
|
+
}
|
|
37682
39086
|
if (docContext != null) {
|
|
37683
39087
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37684
39088
|
else compacted.proof["@context"] = docContext;
|
|
@@ -37843,13 +39247,21 @@ var Listen = class Listen extends Activity {
|
|
|
37843
39247
|
documentLoader: options.contextLoader,
|
|
37844
39248
|
keepFreeFloatingNodes: true
|
|
37845
39249
|
});
|
|
37846
|
-
|
|
39250
|
+
let docContext = options.context ?? [
|
|
37847
39251
|
"https://w3id.org/identity/v1",
|
|
37848
39252
|
"https://www.w3.org/ns/activitystreams",
|
|
37849
39253
|
"https://w3id.org/security/data-integrity/v1",
|
|
37850
39254
|
"https://gotosocial.org/ns"
|
|
37851
39255
|
];
|
|
37852
|
-
|
|
39256
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39257
|
+
if (options.context == null) {
|
|
39258
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39259
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39260
|
+
if (additionalContexts.length > 0) {
|
|
39261
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39262
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39263
|
+
}
|
|
39264
|
+
}
|
|
37853
39265
|
if (docContext != null) {
|
|
37854
39266
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
37855
39267
|
else compacted.proof["@context"] = docContext;
|
|
@@ -38025,8 +39437,16 @@ var Mention = class Mention extends Link {
|
|
|
38025
39437
|
documentLoader: options.contextLoader,
|
|
38026
39438
|
keepFreeFloatingNodes: true
|
|
38027
39439
|
});
|
|
38028
|
-
|
|
38029
|
-
|
|
39440
|
+
let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
|
|
39441
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39442
|
+
if (options.context == null) {
|
|
39443
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39444
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39445
|
+
if (additionalContexts.length > 0) {
|
|
39446
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39447
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39448
|
+
}
|
|
39449
|
+
}
|
|
38030
39450
|
if (docContext != null) {}
|
|
38031
39451
|
return compacted;
|
|
38032
39452
|
}
|
|
@@ -38190,13 +39610,21 @@ var Move = class Move extends Activity {
|
|
|
38190
39610
|
documentLoader: options.contextLoader,
|
|
38191
39611
|
keepFreeFloatingNodes: true
|
|
38192
39612
|
});
|
|
38193
|
-
|
|
39613
|
+
let docContext = options.context ?? [
|
|
38194
39614
|
"https://w3id.org/identity/v1",
|
|
38195
39615
|
"https://www.w3.org/ns/activitystreams",
|
|
38196
39616
|
"https://w3id.org/security/data-integrity/v1",
|
|
38197
39617
|
"https://gotosocial.org/ns"
|
|
38198
39618
|
];
|
|
38199
|
-
|
|
39619
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39620
|
+
if (options.context == null) {
|
|
39621
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
39622
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
39623
|
+
if (additionalContexts.length > 0) {
|
|
39624
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
39625
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
39626
|
+
}
|
|
39627
|
+
}
|
|
38200
39628
|
if (docContext != null) {
|
|
38201
39629
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
38202
39630
|
else compacted.proof["@context"] = docContext;
|
|
@@ -38768,7 +40196,7 @@ var Note = class Note extends Object$1 {
|
|
|
38768
40196
|
documentLoader: options.contextLoader,
|
|
38769
40197
|
keepFreeFloatingNodes: true
|
|
38770
40198
|
});
|
|
38771
|
-
|
|
40199
|
+
let docContext = options.context ?? [
|
|
38772
40200
|
"https://www.w3.org/ns/activitystreams",
|
|
38773
40201
|
"https://w3id.org/security/data-integrity/v1",
|
|
38774
40202
|
"https://gotosocial.org/ns",
|
|
@@ -38797,7 +40225,15 @@ var Note = class Note extends Object$1 {
|
|
|
38797
40225
|
}
|
|
38798
40226
|
}
|
|
38799
40227
|
];
|
|
38800
|
-
|
|
40228
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40229
|
+
if (options.context == null) {
|
|
40230
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
40231
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
40232
|
+
if (additionalContexts.length > 0) {
|
|
40233
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
40234
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40235
|
+
}
|
|
40236
|
+
}
|
|
38801
40237
|
if (docContext != null) {
|
|
38802
40238
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
38803
40239
|
else compacted.proof["@context"] = docContext;
|
|
@@ -39289,7 +40725,7 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
|
|
|
39289
40725
|
documentLoader: options.contextLoader,
|
|
39290
40726
|
keepFreeFloatingNodes: true
|
|
39291
40727
|
});
|
|
39292
|
-
|
|
40728
|
+
let docContext = options.context ?? [
|
|
39293
40729
|
"https://www.w3.org/ns/activitystreams",
|
|
39294
40730
|
"https://w3id.org/security/data-integrity/v1",
|
|
39295
40731
|
"https://gotosocial.org/ns",
|
|
@@ -39321,7 +40757,15 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
|
|
|
39321
40757
|
}
|
|
39322
40758
|
}
|
|
39323
40759
|
];
|
|
39324
|
-
|
|
40760
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40761
|
+
if (options.context == null) {
|
|
40762
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
40763
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
40764
|
+
if (additionalContexts.length > 0) {
|
|
40765
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
40766
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
40767
|
+
}
|
|
40768
|
+
}
|
|
39325
40769
|
if (docContext != null) {
|
|
39326
40770
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
39327
40771
|
else compacted.proof["@context"] = docContext;
|
|
@@ -42680,7 +44124,7 @@ var Organization = class Organization extends Object$1 {
|
|
|
42680
44124
|
documentLoader: options.contextLoader,
|
|
42681
44125
|
keepFreeFloatingNodes: true
|
|
42682
44126
|
});
|
|
42683
|
-
|
|
44127
|
+
let docContext = options.context ?? [
|
|
42684
44128
|
"https://www.w3.org/ns/activitystreams",
|
|
42685
44129
|
"https://w3id.org/fep/ef61",
|
|
42686
44130
|
"https://w3id.org/security/v1",
|
|
@@ -42725,7 +44169,15 @@ var Organization = class Organization extends Object$1 {
|
|
|
42725
44169
|
"isCat": "misskey:isCat"
|
|
42726
44170
|
}
|
|
42727
44171
|
];
|
|
42728
|
-
|
|
44172
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44173
|
+
if (options.context == null) {
|
|
44174
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
44175
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
44176
|
+
if (additionalContexts.length > 0) {
|
|
44177
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
44178
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44179
|
+
}
|
|
44180
|
+
}
|
|
42729
44181
|
if (docContext != null) {
|
|
42730
44182
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
42731
44183
|
else compacted.proof["@context"] = docContext;
|
|
@@ -43492,13 +44944,21 @@ var Page = class Page extends Document {
|
|
|
43492
44944
|
documentLoader: options.contextLoader,
|
|
43493
44945
|
keepFreeFloatingNodes: true
|
|
43494
44946
|
});
|
|
43495
|
-
|
|
44947
|
+
let docContext = options.context ?? [
|
|
43496
44948
|
"https://www.w3.org/ns/activitystreams",
|
|
43497
44949
|
"https://w3id.org/security/data-integrity/v2",
|
|
43498
44950
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
43499
44951
|
"https://gotosocial.org/ns"
|
|
43500
44952
|
];
|
|
43501
|
-
|
|
44953
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44954
|
+
if (options.context == null) {
|
|
44955
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
44956
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
44957
|
+
if (additionalContexts.length > 0) {
|
|
44958
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
44959
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
44960
|
+
}
|
|
44961
|
+
}
|
|
43502
44962
|
if (docContext != null) {
|
|
43503
44963
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
43504
44964
|
else compacted.proof["@context"] = docContext;
|
|
@@ -46735,7 +48195,7 @@ var Person = class Person extends Object$1 {
|
|
|
46735
48195
|
documentLoader: options.contextLoader,
|
|
46736
48196
|
keepFreeFloatingNodes: true
|
|
46737
48197
|
});
|
|
46738
|
-
|
|
48198
|
+
let docContext = options.context ?? [
|
|
46739
48199
|
"https://www.w3.org/ns/activitystreams",
|
|
46740
48200
|
"https://w3id.org/fep/ef61",
|
|
46741
48201
|
"https://w3id.org/security/v1",
|
|
@@ -46780,7 +48240,15 @@ var Person = class Person extends Object$1 {
|
|
|
46780
48240
|
"isCat": "misskey:isCat"
|
|
46781
48241
|
}
|
|
46782
48242
|
];
|
|
46783
|
-
|
|
48243
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
48244
|
+
if (options.context == null) {
|
|
48245
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
48246
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
48247
|
+
if (additionalContexts.length > 0) {
|
|
48248
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
48249
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
48250
|
+
}
|
|
48251
|
+
}
|
|
46784
48252
|
if (docContext != null) {
|
|
46785
48253
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
46786
48254
|
else compacted.proof["@context"] = docContext;
|
|
@@ -47753,12 +49221,20 @@ var Place = class Place extends Object$1 {
|
|
|
47753
49221
|
documentLoader: options.contextLoader,
|
|
47754
49222
|
keepFreeFloatingNodes: true
|
|
47755
49223
|
});
|
|
47756
|
-
|
|
49224
|
+
let docContext = options.context ?? [
|
|
47757
49225
|
"https://www.w3.org/ns/activitystreams",
|
|
47758
49226
|
"https://w3id.org/security/data-integrity/v1",
|
|
47759
49227
|
"https://gotosocial.org/ns"
|
|
47760
49228
|
];
|
|
47761
|
-
|
|
49229
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49230
|
+
if (options.context == null) {
|
|
49231
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
49232
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
49233
|
+
if (additionalContexts.length > 0) {
|
|
49234
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
49235
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49236
|
+
}
|
|
49237
|
+
}
|
|
47762
49238
|
if (docContext != null) {
|
|
47763
49239
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
47764
49240
|
else compacted.proof["@context"] = docContext;
|
|
@@ -48211,12 +49687,20 @@ var Profile = class Profile extends Object$1 {
|
|
|
48211
49687
|
documentLoader: options.contextLoader,
|
|
48212
49688
|
keepFreeFloatingNodes: true
|
|
48213
49689
|
});
|
|
48214
|
-
|
|
49690
|
+
let docContext = options.context ?? [
|
|
48215
49691
|
"https://www.w3.org/ns/activitystreams",
|
|
48216
49692
|
"https://w3id.org/security/data-integrity/v1",
|
|
48217
49693
|
"https://gotosocial.org/ns"
|
|
48218
49694
|
];
|
|
48219
|
-
|
|
49695
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49696
|
+
if (options.context == null) {
|
|
49697
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
49698
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
49699
|
+
if (additionalContexts.length > 0) {
|
|
49700
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
49701
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
49702
|
+
}
|
|
49703
|
+
}
|
|
48220
49704
|
if (docContext != null) {
|
|
48221
49705
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
48222
49706
|
else compacted.proof["@context"] = docContext;
|
|
@@ -49108,7 +50592,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
49108
50592
|
documentLoader: options.contextLoader,
|
|
49109
50593
|
keepFreeFloatingNodes: true
|
|
49110
50594
|
});
|
|
49111
|
-
|
|
50595
|
+
let docContext = options.context ?? [
|
|
49112
50596
|
"https://w3id.org/identity/v1",
|
|
49113
50597
|
"https://www.w3.org/ns/activitystreams",
|
|
49114
50598
|
"https://w3id.org/security/data-integrity/v1",
|
|
@@ -49142,7 +50626,15 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
49142
50626
|
}
|
|
49143
50627
|
}
|
|
49144
50628
|
];
|
|
49145
|
-
|
|
50629
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50630
|
+
if (options.context == null) {
|
|
50631
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
50632
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
50633
|
+
if (additionalContexts.length > 0) {
|
|
50634
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
50635
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50636
|
+
}
|
|
50637
|
+
}
|
|
49146
50638
|
if (docContext != null) {
|
|
49147
50639
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
49148
50640
|
else compacted.proof["@context"] = docContext;
|
|
@@ -49468,13 +50960,21 @@ var Read = class Read extends Activity {
|
|
|
49468
50960
|
documentLoader: options.contextLoader,
|
|
49469
50961
|
keepFreeFloatingNodes: true
|
|
49470
50962
|
});
|
|
49471
|
-
|
|
50963
|
+
let docContext = options.context ?? [
|
|
49472
50964
|
"https://w3id.org/identity/v1",
|
|
49473
50965
|
"https://www.w3.org/ns/activitystreams",
|
|
49474
50966
|
"https://w3id.org/security/data-integrity/v1",
|
|
49475
50967
|
"https://gotosocial.org/ns"
|
|
49476
50968
|
];
|
|
49477
|
-
|
|
50969
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50970
|
+
if (options.context == null) {
|
|
50971
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
50972
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
50973
|
+
if (additionalContexts.length > 0) {
|
|
50974
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
50975
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
50976
|
+
}
|
|
50977
|
+
}
|
|
49478
50978
|
if (docContext != null) {
|
|
49479
50979
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
49480
50980
|
else compacted.proof["@context"] = docContext;
|
|
@@ -49640,13 +51140,21 @@ var Reject = class Reject extends Activity {
|
|
|
49640
51140
|
documentLoader: options.contextLoader,
|
|
49641
51141
|
keepFreeFloatingNodes: true
|
|
49642
51142
|
});
|
|
49643
|
-
|
|
51143
|
+
let docContext = options.context ?? [
|
|
49644
51144
|
"https://w3id.org/identity/v1",
|
|
49645
51145
|
"https://www.w3.org/ns/activitystreams",
|
|
49646
51146
|
"https://w3id.org/security/data-integrity/v1",
|
|
49647
51147
|
"https://gotosocial.org/ns"
|
|
49648
51148
|
];
|
|
49649
|
-
|
|
51149
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51150
|
+
if (options.context == null) {
|
|
51151
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
51152
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
51153
|
+
if (additionalContexts.length > 0) {
|
|
51154
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
51155
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51156
|
+
}
|
|
51157
|
+
}
|
|
49650
51158
|
if (docContext != null) {
|
|
49651
51159
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
49652
51160
|
else compacted.proof["@context"] = docContext;
|
|
@@ -50433,12 +51941,20 @@ var Relationship = class Relationship extends Object$1 {
|
|
|
50433
51941
|
documentLoader: options.contextLoader,
|
|
50434
51942
|
keepFreeFloatingNodes: true
|
|
50435
51943
|
});
|
|
50436
|
-
|
|
51944
|
+
let docContext = options.context ?? [
|
|
50437
51945
|
"https://www.w3.org/ns/activitystreams",
|
|
50438
51946
|
"https://w3id.org/security/data-integrity/v1",
|
|
50439
51947
|
"https://gotosocial.org/ns"
|
|
50440
51948
|
];
|
|
50441
|
-
|
|
51949
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51950
|
+
if (options.context == null) {
|
|
51951
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
51952
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
51953
|
+
if (additionalContexts.length > 0) {
|
|
51954
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
51955
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
51956
|
+
}
|
|
51957
|
+
}
|
|
50442
51958
|
if (docContext != null) {
|
|
50443
51959
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
50444
51960
|
else compacted.proof["@context"] = docContext;
|
|
@@ -50685,13 +52201,21 @@ var Remove = class Remove extends Activity {
|
|
|
50685
52201
|
documentLoader: options.contextLoader,
|
|
50686
52202
|
keepFreeFloatingNodes: true
|
|
50687
52203
|
});
|
|
50688
|
-
|
|
52204
|
+
let docContext = options.context ?? [
|
|
50689
52205
|
"https://w3id.org/identity/v1",
|
|
50690
52206
|
"https://www.w3.org/ns/activitystreams",
|
|
50691
52207
|
"https://w3id.org/security/data-integrity/v1",
|
|
50692
52208
|
"https://gotosocial.org/ns"
|
|
50693
52209
|
];
|
|
50694
|
-
|
|
52210
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
52211
|
+
if (options.context == null) {
|
|
52212
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
52213
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
52214
|
+
if (additionalContexts.length > 0) {
|
|
52215
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
52216
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
52217
|
+
}
|
|
52218
|
+
}
|
|
50695
52219
|
if (docContext != null) {
|
|
50696
52220
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
50697
52221
|
else compacted.proof["@context"] = docContext;
|
|
@@ -53928,7 +55452,7 @@ var Service = class Service extends Object$1 {
|
|
|
53928
55452
|
documentLoader: options.contextLoader,
|
|
53929
55453
|
keepFreeFloatingNodes: true
|
|
53930
55454
|
});
|
|
53931
|
-
|
|
55455
|
+
let docContext = options.context ?? [
|
|
53932
55456
|
"https://www.w3.org/ns/activitystreams",
|
|
53933
55457
|
"https://w3id.org/fep/ef61",
|
|
53934
55458
|
"https://w3id.org/security/v1",
|
|
@@ -53973,7 +55497,15 @@ var Service = class Service extends Object$1 {
|
|
|
53973
55497
|
"isCat": "misskey:isCat"
|
|
53974
55498
|
}
|
|
53975
55499
|
];
|
|
53976
|
-
|
|
55500
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
55501
|
+
if (options.context == null) {
|
|
55502
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
55503
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
55504
|
+
if (additionalContexts.length > 0) {
|
|
55505
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
55506
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
55507
|
+
}
|
|
55508
|
+
}
|
|
53977
55509
|
if (docContext != null) {
|
|
53978
55510
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
53979
55511
|
else compacted.proof["@context"] = docContext;
|
|
@@ -54855,8 +56387,16 @@ var Source = class {
|
|
|
54855
56387
|
documentLoader: options.contextLoader,
|
|
54856
56388
|
keepFreeFloatingNodes: true
|
|
54857
56389
|
});
|
|
54858
|
-
|
|
54859
|
-
|
|
56390
|
+
let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
|
|
56391
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56392
|
+
if (options.context == null) {
|
|
56393
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56394
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56395
|
+
if (additionalContexts.length > 0) {
|
|
56396
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56397
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56398
|
+
}
|
|
56399
|
+
}
|
|
54860
56400
|
if (docContext != null) {}
|
|
54861
56401
|
return compacted;
|
|
54862
56402
|
}
|
|
@@ -55056,13 +56596,21 @@ var TentativeAccept = class TentativeAccept extends Accept {
|
|
|
55056
56596
|
documentLoader: options.contextLoader,
|
|
55057
56597
|
keepFreeFloatingNodes: true
|
|
55058
56598
|
});
|
|
55059
|
-
|
|
56599
|
+
let docContext = options.context ?? [
|
|
55060
56600
|
"https://w3id.org/identity/v1",
|
|
55061
56601
|
"https://www.w3.org/ns/activitystreams",
|
|
55062
56602
|
"https://w3id.org/security/data-integrity/v1",
|
|
55063
56603
|
"https://gotosocial.org/ns"
|
|
55064
56604
|
];
|
|
55065
|
-
|
|
56605
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56606
|
+
if (options.context == null) {
|
|
56607
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56608
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56609
|
+
if (additionalContexts.length > 0) {
|
|
56610
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56611
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56612
|
+
}
|
|
56613
|
+
}
|
|
55066
56614
|
if (docContext != null) {
|
|
55067
56615
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55068
56616
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55228,13 +56776,21 @@ var TentativeReject = class TentativeReject extends Reject {
|
|
|
55228
56776
|
documentLoader: options.contextLoader,
|
|
55229
56777
|
keepFreeFloatingNodes: true
|
|
55230
56778
|
});
|
|
55231
|
-
|
|
56779
|
+
let docContext = options.context ?? [
|
|
55232
56780
|
"https://w3id.org/identity/v1",
|
|
55233
56781
|
"https://www.w3.org/ns/activitystreams",
|
|
55234
56782
|
"https://w3id.org/security/data-integrity/v1",
|
|
55235
56783
|
"https://gotosocial.org/ns"
|
|
55236
56784
|
];
|
|
55237
|
-
|
|
56785
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56786
|
+
if (options.context == null) {
|
|
56787
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
56788
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
56789
|
+
if (additionalContexts.length > 0) {
|
|
56790
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
56791
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
56792
|
+
}
|
|
56793
|
+
}
|
|
55238
56794
|
if (docContext != null) {
|
|
55239
56795
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55240
56796
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55499,12 +57055,20 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
55499
57055
|
documentLoader: options.contextLoader,
|
|
55500
57056
|
keepFreeFloatingNodes: true
|
|
55501
57057
|
});
|
|
55502
|
-
|
|
57058
|
+
let docContext = options.context ?? [
|
|
55503
57059
|
"https://www.w3.org/ns/activitystreams",
|
|
55504
57060
|
"https://w3id.org/security/data-integrity/v1",
|
|
55505
57061
|
"https://gotosocial.org/ns"
|
|
55506
57062
|
];
|
|
55507
|
-
|
|
57063
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57064
|
+
if (options.context == null) {
|
|
57065
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57066
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57067
|
+
if (additionalContexts.length > 0) {
|
|
57068
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57069
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57070
|
+
}
|
|
57071
|
+
}
|
|
55508
57072
|
if (docContext != null) {
|
|
55509
57073
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55510
57074
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55716,13 +57280,21 @@ var Travel = class Travel extends IntransitiveActivity {
|
|
|
55716
57280
|
documentLoader: options.contextLoader,
|
|
55717
57281
|
keepFreeFloatingNodes: true
|
|
55718
57282
|
});
|
|
55719
|
-
|
|
57283
|
+
let docContext = options.context ?? [
|
|
55720
57284
|
"https://w3id.org/identity/v1",
|
|
55721
57285
|
"https://www.w3.org/ns/activitystreams",
|
|
55722
57286
|
"https://w3id.org/security/data-integrity/v1",
|
|
55723
57287
|
"https://gotosocial.org/ns"
|
|
55724
57288
|
];
|
|
55725
|
-
|
|
57289
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57290
|
+
if (options.context == null) {
|
|
57291
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57292
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57293
|
+
if (additionalContexts.length > 0) {
|
|
57294
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57295
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57296
|
+
}
|
|
57297
|
+
}
|
|
55726
57298
|
if (docContext != null) {
|
|
55727
57299
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55728
57300
|
else compacted.proof["@context"] = docContext;
|
|
@@ -55893,7 +57465,7 @@ var Undo = class Undo extends Activity {
|
|
|
55893
57465
|
documentLoader: options.contextLoader,
|
|
55894
57466
|
keepFreeFloatingNodes: true
|
|
55895
57467
|
});
|
|
55896
|
-
|
|
57468
|
+
let docContext = options.context ?? [
|
|
55897
57469
|
"https://w3id.org/identity/v1",
|
|
55898
57470
|
"https://www.w3.org/ns/activitystreams",
|
|
55899
57471
|
"https://w3id.org/security/v1",
|
|
@@ -55908,7 +57480,15 @@ var Undo = class Undo extends Activity {
|
|
|
55908
57480
|
"Emoji": "toot:Emoji"
|
|
55909
57481
|
}
|
|
55910
57482
|
];
|
|
55911
|
-
|
|
57483
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57484
|
+
if (options.context == null) {
|
|
57485
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57486
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57487
|
+
if (additionalContexts.length > 0) {
|
|
57488
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57489
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57490
|
+
}
|
|
57491
|
+
}
|
|
55912
57492
|
if (docContext != null) {
|
|
55913
57493
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
55914
57494
|
else compacted.proof["@context"] = docContext;
|
|
@@ -56077,7 +57657,7 @@ var Update = class Update extends Activity {
|
|
|
56077
57657
|
documentLoader: options.contextLoader,
|
|
56078
57658
|
keepFreeFloatingNodes: true
|
|
56079
57659
|
});
|
|
56080
|
-
|
|
57660
|
+
let docContext = options.context ?? [
|
|
56081
57661
|
"https://w3id.org/identity/v1",
|
|
56082
57662
|
"https://www.w3.org/ns/activitystreams",
|
|
56083
57663
|
"https://w3id.org/security/v1",
|
|
@@ -56142,7 +57722,15 @@ var Update = class Update extends Activity {
|
|
|
56142
57722
|
}
|
|
56143
57723
|
}
|
|
56144
57724
|
];
|
|
56145
|
-
|
|
57725
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57726
|
+
if (options.context == null) {
|
|
57727
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57728
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57729
|
+
if (additionalContexts.length > 0) {
|
|
57730
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57731
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57732
|
+
}
|
|
57733
|
+
}
|
|
56146
57734
|
if (docContext != null) {
|
|
56147
57735
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
56148
57736
|
else compacted.proof["@context"] = docContext;
|
|
@@ -56323,13 +57911,21 @@ var Video = class Video extends Document {
|
|
|
56323
57911
|
documentLoader: options.contextLoader,
|
|
56324
57912
|
keepFreeFloatingNodes: true
|
|
56325
57913
|
});
|
|
56326
|
-
|
|
57914
|
+
let docContext = options.context ?? [
|
|
56327
57915
|
"https://www.w3.org/ns/activitystreams",
|
|
56328
57916
|
"https://w3id.org/security/data-integrity/v2",
|
|
56329
57917
|
{ "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
|
|
56330
57918
|
"https://gotosocial.org/ns"
|
|
56331
57919
|
];
|
|
56332
|
-
|
|
57920
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57921
|
+
if (options.context == null) {
|
|
57922
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
57923
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
57924
|
+
if (additionalContexts.length > 0) {
|
|
57925
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
57926
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
57927
|
+
}
|
|
57928
|
+
}
|
|
56333
57929
|
if (docContext != null) {
|
|
56334
57930
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
56335
57931
|
else compacted.proof["@context"] = docContext;
|
|
@@ -56494,13 +58090,21 @@ var View = class View extends Activity {
|
|
|
56494
58090
|
documentLoader: options.contextLoader,
|
|
56495
58091
|
keepFreeFloatingNodes: true
|
|
56496
58092
|
});
|
|
56497
|
-
|
|
58093
|
+
let docContext = options.context ?? [
|
|
56498
58094
|
"https://w3id.org/identity/v1",
|
|
56499
58095
|
"https://www.w3.org/ns/activitystreams",
|
|
56500
58096
|
"https://w3id.org/security/data-integrity/v1",
|
|
56501
58097
|
"https://gotosocial.org/ns"
|
|
56502
58098
|
];
|
|
56503
|
-
|
|
58099
|
+
let compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
58100
|
+
if (options.context == null) {
|
|
58101
|
+
const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
|
|
58102
|
+
const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
|
|
58103
|
+
if (additionalContexts.length > 0) {
|
|
58104
|
+
docContext = [...currentContexts, ...additionalContexts];
|
|
58105
|
+
compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
58106
|
+
}
|
|
58107
|
+
}
|
|
56504
58108
|
if (docContext != null) {
|
|
56505
58109
|
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
56506
58110
|
else compacted.proof["@context"] = docContext;
|
|
@@ -56769,4 +58373,4 @@ function getEntityTypeById(id) {
|
|
|
56769
58373
|
return entityTypeIds.get(typeof id === "string" ? id : id?.href);
|
|
56770
58374
|
}
|
|
56771
58375
|
//#endregion
|
|
56772
|
-
export {
|
|
58376
|
+
export { Offer as A, Reject as B, InteractionPolicy as C, Multikey as D, Measure as E, PropertyValue as F, Update as G, Source as H, Proposal as I, vocab_exports as J, getEntityTypeById as K, Question as L, Organization as M, Person as N, Note as O, Place as P, QuoteAuthorization as R, Intent as S, Link as T, Tombstone as U, Service as V, Translation as W, __exportAll as X, __commonJSMin as Y, __toESM as Z, FeaturedItem as _, Application as a, Hashtag as b, Commitment as c, Delete as d, Document as f, FeaturedCollection as g, FeatureRequest as h, Announce as i, OrderedCollectionPage as j, Object$1 as k, Create as l, FeatureAuthorization as m, Activity as n, Article as o, Endpoints as p, isEntityType as q, Agreement as r, Collection as s, Accept as t, CryptographicKey as u, Follow as v, InteractionRule as w, Image as x, Group as y, QuoteRequest as z };
|