@fedify/vocab 2.2.0-dev.635 → 2.2.0-dev.700
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 +1080 -1
- package/dist/mod.d.cts +422 -2
- package/dist/mod.d.ts +422 -2
- package/dist/mod.js +1079 -3
- package/dist-tests/actor.test.mjs +2 -2
- package/dist-tests/{deno-BFydpyWl.mjs → deno-Ds6NDIzV.mjs} +2 -2
- package/dist-tests/intent.yaml +72 -0
- package/dist-tests/lookup.test.mjs +2 -2
- package/dist-tests/measure.yaml +32 -0
- package/dist-tests/proposal.yaml +90 -0
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-ZNOT6nzY.mjs → vocab-CGZuHaxe.mjs} +1080 -1
- package/dist-tests/vocab.test.mjs +3 -2
- package/package.json +4 -4
- package/src/__snapshots__/vocab.test.ts.snap +198 -0
- package/src/intent.yaml +72 -0
- package/src/measure.yaml +32 -0
- package/src/proposal.yaml +90 -0
- package/src/vocab.test.ts +6 -1
|
@@ -3,7 +3,7 @@ globalThis.addEventListener = () => {};
|
|
|
3
3
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
4
4
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
|
-
import { LanguageString, decodeMultibase, encodeMultibase, exportMultibaseKey, exportSpki, getDocumentLoader, importMultibaseKey, importPem } from "@fedify/vocab-runtime";
|
|
6
|
+
import { LanguageString, decodeMultibase, encodeMultibase, exportMultibaseKey, exportSpki, getDocumentLoader, importMultibaseKey, importPem, isDecimal, parseDecimal } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region \0rolldown/runtime.js
|
|
8
8
|
var __create = Object.create;
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -70,6 +70,7 @@ var vocab_exports = /* @__PURE__ */ __exportAll({
|
|
|
70
70
|
Hashtag: () => Hashtag,
|
|
71
71
|
Ignore: () => Ignore,
|
|
72
72
|
Image: () => Image,
|
|
73
|
+
Intent: () => Intent,
|
|
73
74
|
InteractionPolicy: () => InteractionPolicy,
|
|
74
75
|
InteractionRule: () => InteractionRule,
|
|
75
76
|
IntransitiveActivity: () => IntransitiveActivity,
|
|
@@ -81,6 +82,7 @@ var vocab_exports = /* @__PURE__ */ __exportAll({
|
|
|
81
82
|
LikeRequest: () => LikeRequest,
|
|
82
83
|
Link: () => Link,
|
|
83
84
|
Listen: () => Listen,
|
|
85
|
+
Measure: () => Measure,
|
|
84
86
|
Mention: () => Mention,
|
|
85
87
|
Move: () => Move,
|
|
86
88
|
Multikey: () => Multikey,
|
|
@@ -95,6 +97,7 @@ var vocab_exports = /* @__PURE__ */ __exportAll({
|
|
|
95
97
|
Place: () => Place,
|
|
96
98
|
Profile: () => Profile,
|
|
97
99
|
PropertyValue: () => PropertyValue,
|
|
100
|
+
Proposal: () => Proposal,
|
|
98
101
|
Question: () => Question,
|
|
99
102
|
Read: () => Read,
|
|
100
103
|
Reject: () => Reject,
|
|
@@ -5124,6 +5127,7 @@ var Object$1 = class Object$1 {
|
|
|
5124
5127
|
if (values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) return await AnnounceAuthorization.fromJsonLd(json, options);
|
|
5125
5128
|
if (values["@type"].includes("https://gotosocial.org/ns#LikeApproval")) return await LikeAuthorization.fromJsonLd(json, options);
|
|
5126
5129
|
if (values["@type"].includes("https://gotosocial.org/ns#ReplyAuthorization")) return await ReplyAuthorization.fromJsonLd(json, options);
|
|
5130
|
+
if (values["@type"].includes("https://w3id.org/valueflows/ont/vf#Proposal")) return await Proposal.fromJsonLd(json, options);
|
|
5127
5131
|
if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) return await Activity.fromJsonLd(json, options);
|
|
5128
5132
|
if (values["@type"].includes("http://litepub.social/ns#EmojiReact")) return await EmojiReact.fromJsonLd(json, options);
|
|
5129
5133
|
if (values["@type"].includes("https://gotosocial.org/ns#AnnounceRequest")) return await AnnounceRequest.fromJsonLd(json, options);
|
|
@@ -5197,6 +5201,7 @@ var Object$1 = class Object$1 {
|
|
|
5197
5201
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5198
5202
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5199
5203
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5204
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5200
5205
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5201
5206
|
"http://litepub.social/ns#EmojiReact",
|
|
5202
5207
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -5336,6 +5341,7 @@ var Object$1 = class Object$1 {
|
|
|
5336
5341
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5337
5342
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5338
5343
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5344
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5339
5345
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5340
5346
|
"http://litepub.social/ns#EmojiReact",
|
|
5341
5347
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -5437,6 +5443,7 @@ var Object$1 = class Object$1 {
|
|
|
5437
5443
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5438
5444
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5439
5445
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5446
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5440
5447
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5441
5448
|
"http://litepub.social/ns#EmojiReact",
|
|
5442
5449
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -5550,6 +5557,7 @@ var Object$1 = class Object$1 {
|
|
|
5550
5557
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5551
5558
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5552
5559
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5560
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5553
5561
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5554
5562
|
"http://litepub.social/ns#EmojiReact",
|
|
5555
5563
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -5635,6 +5643,7 @@ var Object$1 = class Object$1 {
|
|
|
5635
5643
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5636
5644
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5637
5645
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5646
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5638
5647
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5639
5648
|
"http://litepub.social/ns#EmojiReact",
|
|
5640
5649
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -5727,6 +5736,7 @@ var Object$1 = class Object$1 {
|
|
|
5727
5736
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5728
5737
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5729
5738
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5739
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5730
5740
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5731
5741
|
"http://litepub.social/ns#EmojiReact",
|
|
5732
5742
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -5884,6 +5894,7 @@ var Object$1 = class Object$1 {
|
|
|
5884
5894
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
5885
5895
|
"https://gotosocial.org/ns#LikeApproval",
|
|
5886
5896
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
5897
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
5887
5898
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
5888
5899
|
"http://litepub.social/ns#EmojiReact",
|
|
5889
5900
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -8771,6 +8782,267 @@ PropertyValue.prototype[Symbol.for("Deno.customInspect")] = function(inspect, op
|
|
|
8771
8782
|
PropertyValue.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
8772
8783
|
return "PropertyValue " + inspect(this._getCustomInspectProxy(), options);
|
|
8773
8784
|
};
|
|
8785
|
+
/** A quantity with a unit of measure.
|
|
8786
|
+
*/
|
|
8787
|
+
var Measure = class {
|
|
8788
|
+
#documentLoader;
|
|
8789
|
+
#contextLoader;
|
|
8790
|
+
#tracerProvider;
|
|
8791
|
+
#warning;
|
|
8792
|
+
#cachedJsonLd;
|
|
8793
|
+
id;
|
|
8794
|
+
get _documentLoader() {
|
|
8795
|
+
return this.#documentLoader;
|
|
8796
|
+
}
|
|
8797
|
+
get _contextLoader() {
|
|
8798
|
+
return this.#contextLoader;
|
|
8799
|
+
}
|
|
8800
|
+
get _tracerProvider() {
|
|
8801
|
+
return this.#tracerProvider;
|
|
8802
|
+
}
|
|
8803
|
+
get _warning() {
|
|
8804
|
+
return this.#warning;
|
|
8805
|
+
}
|
|
8806
|
+
get _cachedJsonLd() {
|
|
8807
|
+
return this.#cachedJsonLd;
|
|
8808
|
+
}
|
|
8809
|
+
set _cachedJsonLd(value) {
|
|
8810
|
+
this.#cachedJsonLd = value;
|
|
8811
|
+
}
|
|
8812
|
+
/**
|
|
8813
|
+
* The type URI of {@link Measure}: `http://www.ontology-of-units-of-measure.org/resource/om-2/Measure`.
|
|
8814
|
+
*/
|
|
8815
|
+
static get typeId() {
|
|
8816
|
+
return new URL("http://www.ontology-of-units-of-measure.org/resource/om-2/Measure");
|
|
8817
|
+
}
|
|
8818
|
+
#_27fgyFbosTtMAhuepJH8K3ZGURT6 = [];
|
|
8819
|
+
#_1GQx8o2RgxRs4x9G5uT39XYBv7D = [];
|
|
8820
|
+
/**
|
|
8821
|
+
* Constructs a new instance of Measure with the given values.
|
|
8822
|
+
* @param values The values to initialize the instance with.
|
|
8823
|
+
* @param options The options to use for initialization.
|
|
8824
|
+
*/
|
|
8825
|
+
constructor(values, options = {}) {
|
|
8826
|
+
this.#documentLoader = options.documentLoader;
|
|
8827
|
+
this.#contextLoader = options.contextLoader;
|
|
8828
|
+
this.#tracerProvider = options.tracerProvider;
|
|
8829
|
+
if ("$warning" in options) this.#warning = options.$warning;
|
|
8830
|
+
if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
|
|
8831
|
+
else throw new TypeError("The id must be a URL.");
|
|
8832
|
+
if ("unit" in values && values.unit != null) if (typeof values.unit === "string") this.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = [values.unit];
|
|
8833
|
+
else throw new TypeError("The unit must be of type string.");
|
|
8834
|
+
if ("numericalValue" in values && values.numericalValue != null) if (typeof values.numericalValue === "string" && isDecimal(values.numericalValue)) this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = [values.numericalValue];
|
|
8835
|
+
else throw new TypeError("The numericalValue must be of type Decimal.");
|
|
8836
|
+
}
|
|
8837
|
+
/**
|
|
8838
|
+
* Clones this instance, optionally updating it with the given values.
|
|
8839
|
+
* @param values The values to update the clone with.
|
|
8840
|
+
* @param options The options to use for cloning.
|
|
8841
|
+
* @returns The cloned instance.
|
|
8842
|
+
*/
|
|
8843
|
+
clone(values = {}, options = {}) {
|
|
8844
|
+
if (this._warning != null) {
|
|
8845
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
8846
|
+
options = {
|
|
8847
|
+
...options,
|
|
8848
|
+
$warning: this._warning
|
|
8849
|
+
};
|
|
8850
|
+
}
|
|
8851
|
+
const clone = new this.constructor({ id: values.id ?? this.id }, options);
|
|
8852
|
+
clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6;
|
|
8853
|
+
if ("unit" in values && values.unit != null) if (typeof values.unit === "string") clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = [values.unit];
|
|
8854
|
+
else throw new TypeError("The unit must be of type string.");
|
|
8855
|
+
clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D;
|
|
8856
|
+
if ("numericalValue" in values && values.numericalValue != null) if (typeof values.numericalValue === "string" && isDecimal(values.numericalValue)) clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = [values.numericalValue];
|
|
8857
|
+
else throw new TypeError("The numericalValue must be of type Decimal.");
|
|
8858
|
+
return clone;
|
|
8859
|
+
}
|
|
8860
|
+
/** The name of the unit, according to the Ontology of units of Measure
|
|
8861
|
+
* classification. The recommended unit for countable items is `"one"`.
|
|
8862
|
+
*/
|
|
8863
|
+
get unit() {
|
|
8864
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
8865
|
+
if (this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < 1) return null;
|
|
8866
|
+
return this.#_27fgyFbosTtMAhuepJH8K3ZGURT6[0];
|
|
8867
|
+
}
|
|
8868
|
+
/** The amount of the resource. If not specified, arbitrary amounts can be
|
|
8869
|
+
* used when responding to the proposal.
|
|
8870
|
+
*/
|
|
8871
|
+
get numericalValue() {
|
|
8872
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
8873
|
+
if (this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.length < 1) return null;
|
|
8874
|
+
return this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D[0];
|
|
8875
|
+
}
|
|
8876
|
+
/**
|
|
8877
|
+
* Converts this object to a JSON-LD structure.
|
|
8878
|
+
* @param options The options to use.
|
|
8879
|
+
* - `format`: The format of the output: `compact` or
|
|
8880
|
+
`expand`.
|
|
8881
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
8882
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
8883
|
+
when `format` is set to `'expand'`.
|
|
8884
|
+
* @returns The JSON-LD representation of this object.
|
|
8885
|
+
*/
|
|
8886
|
+
async toJsonLd(options = {}) {
|
|
8887
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
8888
|
+
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'.");
|
|
8889
|
+
options = {
|
|
8890
|
+
...options,
|
|
8891
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
8892
|
+
};
|
|
8893
|
+
if (options.format == null && this.isCompactable()) {
|
|
8894
|
+
const result = {};
|
|
8895
|
+
let compactItems = [];
|
|
8896
|
+
for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) {
|
|
8897
|
+
const item = v;
|
|
8898
|
+
compactItems.push(item);
|
|
8899
|
+
}
|
|
8900
|
+
if (compactItems.length > 0) result["hasUnit"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
8901
|
+
compactItems = [];
|
|
8902
|
+
for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) {
|
|
8903
|
+
const item = v;
|
|
8904
|
+
compactItems.push(item);
|
|
8905
|
+
}
|
|
8906
|
+
if (compactItems.length > 0) result["hasNumericalValue"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
8907
|
+
result["type"] = "om2:Measure";
|
|
8908
|
+
if (this.id != null) result["id"] = this.id.href;
|
|
8909
|
+
result["@context"] = ["https://www.w3.org/ns/activitystreams", {
|
|
8910
|
+
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
8911
|
+
"hasUnit": "om2:hasUnit",
|
|
8912
|
+
"hasNumericalValue": "om2:hasNumericalValue"
|
|
8913
|
+
}];
|
|
8914
|
+
return result;
|
|
8915
|
+
}
|
|
8916
|
+
let array;
|
|
8917
|
+
const values = {};
|
|
8918
|
+
array = [];
|
|
8919
|
+
for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) {
|
|
8920
|
+
const element = { "@value": v };
|
|
8921
|
+
array.push(element);
|
|
8922
|
+
}
|
|
8923
|
+
if (array.length > 0) values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"] = array;
|
|
8924
|
+
array = [];
|
|
8925
|
+
for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) {
|
|
8926
|
+
const element = {
|
|
8927
|
+
"@type": "http://www.w3.org/2001/XMLSchema#decimal",
|
|
8928
|
+
"@value": v
|
|
8929
|
+
};
|
|
8930
|
+
array.push(element);
|
|
8931
|
+
}
|
|
8932
|
+
if (array.length > 0) values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"] = array;
|
|
8933
|
+
values["@type"] = ["http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"];
|
|
8934
|
+
if (this.id != null) values["@id"] = this.id.href;
|
|
8935
|
+
if (options.format === "expand") return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
8936
|
+
const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
8937
|
+
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
8938
|
+
"hasUnit": "om2:hasUnit",
|
|
8939
|
+
"hasNumericalValue": "om2:hasNumericalValue"
|
|
8940
|
+
}];
|
|
8941
|
+
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
8942
|
+
if (docContext != null) {}
|
|
8943
|
+
return compacted;
|
|
8944
|
+
}
|
|
8945
|
+
isCompactable() {
|
|
8946
|
+
return true;
|
|
8947
|
+
}
|
|
8948
|
+
/**
|
|
8949
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
8950
|
+
* @param json The JSON-LD structure to convert.
|
|
8951
|
+
* @param options The options to use.
|
|
8952
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
8953
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
8954
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
8955
|
+
* If omitted, the global tracer provider is used.
|
|
8956
|
+
* @returns The object of this type.
|
|
8957
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
8958
|
+
*/
|
|
8959
|
+
static async fromJsonLd(json, options = {}) {
|
|
8960
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.2.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
8961
|
+
try {
|
|
8962
|
+
const object = await this.__fromJsonLd__Measure__(json, span, options);
|
|
8963
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
8964
|
+
return object;
|
|
8965
|
+
} catch (error) {
|
|
8966
|
+
span.setStatus({
|
|
8967
|
+
code: SpanStatusCode.ERROR,
|
|
8968
|
+
message: String(error)
|
|
8969
|
+
});
|
|
8970
|
+
throw error;
|
|
8971
|
+
} finally {
|
|
8972
|
+
span.end();
|
|
8973
|
+
}
|
|
8974
|
+
});
|
|
8975
|
+
}
|
|
8976
|
+
static async __fromJsonLd__Measure__(json, span, options = {}) {
|
|
8977
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
8978
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
8979
|
+
options = {
|
|
8980
|
+
...options,
|
|
8981
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
8982
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
8983
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
8984
|
+
};
|
|
8985
|
+
let values;
|
|
8986
|
+
if (globalThis.Object.keys(json).length == 0) values = {};
|
|
8987
|
+
else values = (await jsonld.expand(json, {
|
|
8988
|
+
documentLoader: options.contextLoader,
|
|
8989
|
+
keepFreeFloatingNodes: true
|
|
8990
|
+
}))[0] ?? {};
|
|
8991
|
+
if (options.baseUrl == null && values["@id"] != null) options = {
|
|
8992
|
+
...options,
|
|
8993
|
+
baseUrl: new URL(values["@id"])
|
|
8994
|
+
};
|
|
8995
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
8996
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
8997
|
+
if (!values["@type"].includes("http://www.ontology-of-units-of-measure.org/resource/om-2/Measure")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
8998
|
+
}
|
|
8999
|
+
const instance = new this({ id: "@id" in values ? new URL(values["@id"]) : void 0 }, options);
|
|
9000
|
+
const _27fgyFbosTtMAhuepJH8K3ZGURT6 = [];
|
|
9001
|
+
let _27fgyFbosTtMAhuepJH8K3ZGURT6__array = values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"];
|
|
9002
|
+
for (const v of _27fgyFbosTtMAhuepJH8K3ZGURT6__array == null ? [] : _27fgyFbosTtMAhuepJH8K3ZGURT6__array.length === 1 && "@list" in _27fgyFbosTtMAhuepJH8K3ZGURT6__array[0] ? _27fgyFbosTtMAhuepJH8K3ZGURT6__array[0]["@list"] : _27fgyFbosTtMAhuepJH8K3ZGURT6__array) {
|
|
9003
|
+
if (v == null) continue;
|
|
9004
|
+
_27fgyFbosTtMAhuepJH8K3ZGURT6.push(v["@value"]);
|
|
9005
|
+
}
|
|
9006
|
+
instance.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = _27fgyFbosTtMAhuepJH8K3ZGURT6;
|
|
9007
|
+
const _1GQx8o2RgxRs4x9G5uT39XYBv7D = [];
|
|
9008
|
+
let _1GQx8o2RgxRs4x9G5uT39XYBv7D__array = values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"];
|
|
9009
|
+
for (const v of _1GQx8o2RgxRs4x9G5uT39XYBv7D__array == null ? [] : _1GQx8o2RgxRs4x9G5uT39XYBv7D__array.length === 1 && "@list" in _1GQx8o2RgxRs4x9G5uT39XYBv7D__array[0] ? _1GQx8o2RgxRs4x9G5uT39XYBv7D__array[0]["@list"] : _1GQx8o2RgxRs4x9G5uT39XYBv7D__array) {
|
|
9010
|
+
if (v == null) continue;
|
|
9011
|
+
_1GQx8o2RgxRs4x9G5uT39XYBv7D.push(parseDecimal(v["@value"]));
|
|
9012
|
+
}
|
|
9013
|
+
instance.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = _1GQx8o2RgxRs4x9G5uT39XYBv7D;
|
|
9014
|
+
if (!("_fromSubclass" in options) || !options._fromSubclass) try {
|
|
9015
|
+
instance._cachedJsonLd = structuredClone(json);
|
|
9016
|
+
} catch {
|
|
9017
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
9018
|
+
}
|
|
9019
|
+
return instance;
|
|
9020
|
+
}
|
|
9021
|
+
_getCustomInspectProxy() {
|
|
9022
|
+
const proxy = {};
|
|
9023
|
+
if (this.id != null) proxy.id = {
|
|
9024
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
|
|
9025
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
|
|
9026
|
+
};
|
|
9027
|
+
const _27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.map((v) => v instanceof URL ? {
|
|
9028
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
9029
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
9030
|
+
} : v);
|
|
9031
|
+
if (_27fgyFbosTtMAhuepJH8K3ZGURT6.length == 1) proxy.unit = _27fgyFbosTtMAhuepJH8K3ZGURT6[0];
|
|
9032
|
+
const _1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.map((v) => v instanceof URL ? {
|
|
9033
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
9034
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
9035
|
+
} : v);
|
|
9036
|
+
if (_1GQx8o2RgxRs4x9G5uT39XYBv7D.length == 1) proxy.numericalValue = _1GQx8o2RgxRs4x9G5uT39XYBv7D[0];
|
|
9037
|
+
return proxy;
|
|
9038
|
+
}
|
|
9039
|
+
};
|
|
9040
|
+
Measure.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
9041
|
+
return "Measure " + inspect(this._getCustomInspectProxy(), options);
|
|
9042
|
+
};
|
|
9043
|
+
Measure.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
9044
|
+
return "Measure " + inspect(this._getCustomInspectProxy(), options);
|
|
9045
|
+
};
|
|
8774
9046
|
/** Proves that an {@link Announce} interaction has been approved by
|
|
8775
9047
|
* the post author.
|
|
8776
9048
|
*
|
|
@@ -13069,6 +13341,809 @@ Multikey.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options
|
|
|
13069
13341
|
Multikey.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
13070
13342
|
return "Multikey " + inspect(this._getCustomInspectProxy(), options);
|
|
13071
13343
|
};
|
|
13344
|
+
/** A proposed economic transaction describing what is being offered or requested
|
|
13345
|
+
* in a {@link Proposal}.
|
|
13346
|
+
*/
|
|
13347
|
+
var Intent = class {
|
|
13348
|
+
#documentLoader;
|
|
13349
|
+
#contextLoader;
|
|
13350
|
+
#tracerProvider;
|
|
13351
|
+
#warning;
|
|
13352
|
+
#cachedJsonLd;
|
|
13353
|
+
id;
|
|
13354
|
+
get _documentLoader() {
|
|
13355
|
+
return this.#documentLoader;
|
|
13356
|
+
}
|
|
13357
|
+
get _contextLoader() {
|
|
13358
|
+
return this.#contextLoader;
|
|
13359
|
+
}
|
|
13360
|
+
get _tracerProvider() {
|
|
13361
|
+
return this.#tracerProvider;
|
|
13362
|
+
}
|
|
13363
|
+
get _warning() {
|
|
13364
|
+
return this.#warning;
|
|
13365
|
+
}
|
|
13366
|
+
get _cachedJsonLd() {
|
|
13367
|
+
return this.#cachedJsonLd;
|
|
13368
|
+
}
|
|
13369
|
+
set _cachedJsonLd(value) {
|
|
13370
|
+
this.#cachedJsonLd = value;
|
|
13371
|
+
}
|
|
13372
|
+
/**
|
|
13373
|
+
* The type URI of {@link Intent}: `https://w3id.org/valueflows/ont/vf#Intent`.
|
|
13374
|
+
*/
|
|
13375
|
+
static get typeId() {
|
|
13376
|
+
return new URL("https://w3id.org/valueflows/ont/vf#Intent");
|
|
13377
|
+
}
|
|
13378
|
+
#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [];
|
|
13379
|
+
#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [];
|
|
13380
|
+
#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [];
|
|
13381
|
+
#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [];
|
|
13382
|
+
#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [];
|
|
13383
|
+
/**
|
|
13384
|
+
* Constructs a new instance of Intent with the given values.
|
|
13385
|
+
* @param values The values to initialize the instance with.
|
|
13386
|
+
* @param options The options to use for initialization.
|
|
13387
|
+
*/
|
|
13388
|
+
constructor(values, options = {}) {
|
|
13389
|
+
this.#documentLoader = options.documentLoader;
|
|
13390
|
+
this.#contextLoader = options.contextLoader;
|
|
13391
|
+
this.#tracerProvider = options.tracerProvider;
|
|
13392
|
+
if ("$warning" in options) this.#warning = options.$warning;
|
|
13393
|
+
if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
|
|
13394
|
+
else throw new TypeError("The id must be a URL.");
|
|
13395
|
+
if ("action" in values && values.action != null) if (typeof values.action === "string") this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [values.action];
|
|
13396
|
+
else throw new TypeError("The action must be of type string.");
|
|
13397
|
+
if ("resourceConformsTo" in values && values.resourceConformsTo != null) if (values.resourceConformsTo instanceof URL) this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [values.resourceConformsTo];
|
|
13398
|
+
else throw new TypeError("The resourceConformsTo must be of type URL.");
|
|
13399
|
+
if ("resourceQuantity" in values && values.resourceQuantity != null) if (values.resourceQuantity instanceof Measure) this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [values.resourceQuantity];
|
|
13400
|
+
else throw new TypeError("The resourceQuantity must be of type Measure.");
|
|
13401
|
+
if ("availableQuantity" in values && values.availableQuantity != null) if (values.availableQuantity instanceof Measure) this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [values.availableQuantity];
|
|
13402
|
+
else throw new TypeError("The availableQuantity must be of type Measure.");
|
|
13403
|
+
if ("minimumQuantity" in values && values.minimumQuantity != null) if (values.minimumQuantity instanceof Measure) this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [values.minimumQuantity];
|
|
13404
|
+
else throw new TypeError("The minimumQuantity must be of type Measure.");
|
|
13405
|
+
}
|
|
13406
|
+
/**
|
|
13407
|
+
* Clones this instance, optionally updating it with the given values.
|
|
13408
|
+
* @param values The values to update the clone with.
|
|
13409
|
+
* @param options The options to use for cloning.
|
|
13410
|
+
* @returns The cloned instance.
|
|
13411
|
+
*/
|
|
13412
|
+
clone(values = {}, options = {}) {
|
|
13413
|
+
if (this._warning != null) {
|
|
13414
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13415
|
+
options = {
|
|
13416
|
+
...options,
|
|
13417
|
+
$warning: this._warning
|
|
13418
|
+
};
|
|
13419
|
+
}
|
|
13420
|
+
const clone = new this.constructor({ id: values.id ?? this.id }, options);
|
|
13421
|
+
clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action;
|
|
13422
|
+
if ("action" in values && values.action != null) if (typeof values.action === "string") clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [values.action];
|
|
13423
|
+
else throw new TypeError("The action must be of type string.");
|
|
13424
|
+
clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo;
|
|
13425
|
+
if ("resourceConformsTo" in values && values.resourceConformsTo != null) if (values.resourceConformsTo instanceof URL) clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [values.resourceConformsTo];
|
|
13426
|
+
else throw new TypeError("The resourceConformsTo must be of type URL.");
|
|
13427
|
+
clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity;
|
|
13428
|
+
if ("resourceQuantity" in values && values.resourceQuantity != null) if (values.resourceQuantity instanceof Measure) clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [values.resourceQuantity];
|
|
13429
|
+
else throw new TypeError("The resourceQuantity must be of type Measure.");
|
|
13430
|
+
clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity;
|
|
13431
|
+
if ("availableQuantity" in values && values.availableQuantity != null) if (values.availableQuantity instanceof Measure) clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [values.availableQuantity];
|
|
13432
|
+
else throw new TypeError("The availableQuantity must be of type Measure.");
|
|
13433
|
+
clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity;
|
|
13434
|
+
if ("minimumQuantity" in values && values.minimumQuantity != null) if (values.minimumQuantity instanceof Measure) clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [values.minimumQuantity];
|
|
13435
|
+
else throw new TypeError("The minimumQuantity must be of type Measure.");
|
|
13436
|
+
return clone;
|
|
13437
|
+
}
|
|
13438
|
+
/** The type of economic transaction. The value of this property should be
|
|
13439
|
+
* either `"deliverService"` or `"transfer"`.
|
|
13440
|
+
*/
|
|
13441
|
+
get action() {
|
|
13442
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13443
|
+
if (this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < 1) return null;
|
|
13444
|
+
return this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action[0];
|
|
13445
|
+
}
|
|
13446
|
+
/** The type of an economic resource. Could be any URI.
|
|
13447
|
+
*/
|
|
13448
|
+
get resourceConformsTo() {
|
|
13449
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13450
|
+
if (this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length < 1) return null;
|
|
13451
|
+
return this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[0];
|
|
13452
|
+
}
|
|
13453
|
+
/** The amount and unit of the economic resource.
|
|
13454
|
+
*/
|
|
13455
|
+
get resourceQuantity() {
|
|
13456
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13457
|
+
if (this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < 1) return null;
|
|
13458
|
+
return this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[0];
|
|
13459
|
+
}
|
|
13460
|
+
/** The quantity of the offered resource currently available.
|
|
13461
|
+
*/
|
|
13462
|
+
get availableQuantity() {
|
|
13463
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13464
|
+
if (this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length < 1) return null;
|
|
13465
|
+
return this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[0];
|
|
13466
|
+
}
|
|
13467
|
+
/** The minimum possible quantity of the resource.
|
|
13468
|
+
*/
|
|
13469
|
+
get minimumQuantity() {
|
|
13470
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13471
|
+
if (this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length < 1) return null;
|
|
13472
|
+
return this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[0];
|
|
13473
|
+
}
|
|
13474
|
+
/**
|
|
13475
|
+
* Converts this object to a JSON-LD structure.
|
|
13476
|
+
* @param options The options to use.
|
|
13477
|
+
* - `format`: The format of the output: `compact` or
|
|
13478
|
+
`expand`.
|
|
13479
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
13480
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
13481
|
+
when `format` is set to `'expand'`.
|
|
13482
|
+
* @returns The JSON-LD representation of this object.
|
|
13483
|
+
*/
|
|
13484
|
+
async toJsonLd(options = {}) {
|
|
13485
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
13486
|
+
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'.");
|
|
13487
|
+
options = {
|
|
13488
|
+
...options,
|
|
13489
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
13490
|
+
};
|
|
13491
|
+
if (options.format == null && this.isCompactable()) {
|
|
13492
|
+
const result = {};
|
|
13493
|
+
let compactItems = [];
|
|
13494
|
+
for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) {
|
|
13495
|
+
const item = v;
|
|
13496
|
+
compactItems.push(item);
|
|
13497
|
+
}
|
|
13498
|
+
if (compactItems.length > 0) result["action"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13499
|
+
compactItems = [];
|
|
13500
|
+
for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) {
|
|
13501
|
+
const item = v.href;
|
|
13502
|
+
compactItems.push(item);
|
|
13503
|
+
}
|
|
13504
|
+
if (compactItems.length > 0) result["resourceConformsTo"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13505
|
+
compactItems = [];
|
|
13506
|
+
for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) {
|
|
13507
|
+
const item = await v.toJsonLd({
|
|
13508
|
+
...options,
|
|
13509
|
+
format: void 0,
|
|
13510
|
+
context: void 0
|
|
13511
|
+
});
|
|
13512
|
+
compactItems.push(item);
|
|
13513
|
+
}
|
|
13514
|
+
if (compactItems.length > 0) result["resourceQuantity"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13515
|
+
compactItems = [];
|
|
13516
|
+
for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) {
|
|
13517
|
+
const item = await v.toJsonLd({
|
|
13518
|
+
...options,
|
|
13519
|
+
format: void 0,
|
|
13520
|
+
context: void 0
|
|
13521
|
+
});
|
|
13522
|
+
compactItems.push(item);
|
|
13523
|
+
}
|
|
13524
|
+
if (compactItems.length > 0) result["availableQuantity"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13525
|
+
compactItems = [];
|
|
13526
|
+
for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) {
|
|
13527
|
+
const item = await v.toJsonLd({
|
|
13528
|
+
...options,
|
|
13529
|
+
format: void 0,
|
|
13530
|
+
context: void 0
|
|
13531
|
+
});
|
|
13532
|
+
compactItems.push(item);
|
|
13533
|
+
}
|
|
13534
|
+
if (compactItems.length > 0) result["minimumQuantity"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13535
|
+
result["type"] = "Intent";
|
|
13536
|
+
if (this.id != null) result["id"] = this.id.href;
|
|
13537
|
+
result["@context"] = ["https://www.w3.org/ns/activitystreams", {
|
|
13538
|
+
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
13539
|
+
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
13540
|
+
"Intent": "vf:Intent",
|
|
13541
|
+
"action": "vf:action",
|
|
13542
|
+
"resourceConformsTo": {
|
|
13543
|
+
"@id": "vf:resourceConformsTo",
|
|
13544
|
+
"@type": "@id"
|
|
13545
|
+
},
|
|
13546
|
+
"resourceQuantity": "vf:resourceQuantity",
|
|
13547
|
+
"availableQuantity": "vf:availableQuantity",
|
|
13548
|
+
"minimumQuantity": "vf:minimumQuantity",
|
|
13549
|
+
"hasUnit": "om2:hasUnit",
|
|
13550
|
+
"hasNumericalValue": "om2:hasNumericalValue"
|
|
13551
|
+
}];
|
|
13552
|
+
return result;
|
|
13553
|
+
}
|
|
13554
|
+
let array;
|
|
13555
|
+
const values = {};
|
|
13556
|
+
array = [];
|
|
13557
|
+
for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) {
|
|
13558
|
+
const element = { "@value": v };
|
|
13559
|
+
array.push(element);
|
|
13560
|
+
}
|
|
13561
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#action"] = array;
|
|
13562
|
+
array = [];
|
|
13563
|
+
for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) {
|
|
13564
|
+
const element = { "@id": v.href };
|
|
13565
|
+
array.push(element);
|
|
13566
|
+
}
|
|
13567
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#resourceConformsTo"] = array;
|
|
13568
|
+
array = [];
|
|
13569
|
+
for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) {
|
|
13570
|
+
const element = await v.toJsonLd(options);
|
|
13571
|
+
array.push(element);
|
|
13572
|
+
}
|
|
13573
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#resourceQuantity"] = array;
|
|
13574
|
+
array = [];
|
|
13575
|
+
for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) {
|
|
13576
|
+
const element = await v.toJsonLd(options);
|
|
13577
|
+
array.push(element);
|
|
13578
|
+
}
|
|
13579
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#availableQuantity"] = array;
|
|
13580
|
+
array = [];
|
|
13581
|
+
for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) {
|
|
13582
|
+
const element = await v.toJsonLd(options);
|
|
13583
|
+
array.push(element);
|
|
13584
|
+
}
|
|
13585
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#minimumQuantity"] = array;
|
|
13586
|
+
values["@type"] = ["https://w3id.org/valueflows/ont/vf#Intent"];
|
|
13587
|
+
if (this.id != null) values["@id"] = this.id.href;
|
|
13588
|
+
if (options.format === "expand") return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
13589
|
+
const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
|
|
13590
|
+
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
13591
|
+
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
13592
|
+
"Intent": "vf:Intent",
|
|
13593
|
+
"action": "vf:action",
|
|
13594
|
+
"resourceConformsTo": {
|
|
13595
|
+
"@id": "vf:resourceConformsTo",
|
|
13596
|
+
"@type": "@id"
|
|
13597
|
+
},
|
|
13598
|
+
"resourceQuantity": "vf:resourceQuantity",
|
|
13599
|
+
"availableQuantity": "vf:availableQuantity",
|
|
13600
|
+
"minimumQuantity": "vf:minimumQuantity",
|
|
13601
|
+
"hasUnit": "om2:hasUnit",
|
|
13602
|
+
"hasNumericalValue": "om2:hasNumericalValue"
|
|
13603
|
+
}];
|
|
13604
|
+
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
13605
|
+
if (docContext != null) {}
|
|
13606
|
+
return compacted;
|
|
13607
|
+
}
|
|
13608
|
+
isCompactable() {
|
|
13609
|
+
return true;
|
|
13610
|
+
}
|
|
13611
|
+
/**
|
|
13612
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
13613
|
+
* @param json The JSON-LD structure to convert.
|
|
13614
|
+
* @param options The options to use.
|
|
13615
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
13616
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
13617
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
13618
|
+
* If omitted, the global tracer provider is used.
|
|
13619
|
+
* @returns The object of this type.
|
|
13620
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
13621
|
+
*/
|
|
13622
|
+
static async fromJsonLd(json, options = {}) {
|
|
13623
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.2.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
13624
|
+
try {
|
|
13625
|
+
const object = await this.__fromJsonLd__Intent__(json, span, options);
|
|
13626
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
13627
|
+
return object;
|
|
13628
|
+
} catch (error) {
|
|
13629
|
+
span.setStatus({
|
|
13630
|
+
code: SpanStatusCode.ERROR,
|
|
13631
|
+
message: String(error)
|
|
13632
|
+
});
|
|
13633
|
+
throw error;
|
|
13634
|
+
} finally {
|
|
13635
|
+
span.end();
|
|
13636
|
+
}
|
|
13637
|
+
});
|
|
13638
|
+
}
|
|
13639
|
+
static async __fromJsonLd__Intent__(json, span, options = {}) {
|
|
13640
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
13641
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
13642
|
+
options = {
|
|
13643
|
+
...options,
|
|
13644
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
13645
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
13646
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
13647
|
+
};
|
|
13648
|
+
let values;
|
|
13649
|
+
if (globalThis.Object.keys(json).length == 0) values = {};
|
|
13650
|
+
else values = (await jsonld.expand(json, {
|
|
13651
|
+
documentLoader: options.contextLoader,
|
|
13652
|
+
keepFreeFloatingNodes: true
|
|
13653
|
+
}))[0] ?? {};
|
|
13654
|
+
if (options.baseUrl == null && values["@id"] != null) options = {
|
|
13655
|
+
...options,
|
|
13656
|
+
baseUrl: new URL(values["@id"])
|
|
13657
|
+
};
|
|
13658
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
13659
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
13660
|
+
if (!values["@type"].includes("https://w3id.org/valueflows/ont/vf#Intent")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
13661
|
+
}
|
|
13662
|
+
const instance = new this({ id: "@id" in values ? new URL(values["@id"]) : void 0 }, options);
|
|
13663
|
+
const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [];
|
|
13664
|
+
let _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array = values["https://w3id.org/valueflows/ont/vf#action"];
|
|
13665
|
+
for (const v of _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array == null ? [] : _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array.length === 1 && "@list" in _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array[0] ? _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array[0]["@list"] : _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array) {
|
|
13666
|
+
if (v == null) continue;
|
|
13667
|
+
_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.push(v["@value"]);
|
|
13668
|
+
}
|
|
13669
|
+
instance.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = _38VmZKmXJSBy3AvgqNa9GVqbdphy_action;
|
|
13670
|
+
const _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [];
|
|
13671
|
+
let _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array = values["https://w3id.org/valueflows/ont/vf#resourceConformsTo"];
|
|
13672
|
+
for (const v of _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array == null ? [] : _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array.length === 1 && "@list" in _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array[0] ? _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array[0]["@list"] : _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array) {
|
|
13673
|
+
if (v == null) continue;
|
|
13674
|
+
_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.push(v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].includes("/", 5) ? v["@id"].slice(5, v["@id"].indexOf("/", 5)) : v["@id"].slice(5)) + (v["@id"].includes("/", 5) ? v["@id"].slice(v["@id"].indexOf("/", 5)) : "")) : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) ? new URL(v["@id"]) : new URL(v["@id"], values["@id"] == null ? options.baseUrl : new URL(values["@id"])));
|
|
13675
|
+
}
|
|
13676
|
+
instance.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo;
|
|
13677
|
+
const _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [];
|
|
13678
|
+
let _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array = values["https://w3id.org/valueflows/ont/vf#resourceQuantity"];
|
|
13679
|
+
for (const v of _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array == null ? [] : _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array.length === 1 && "@list" in _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array[0] ? _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array[0]["@list"] : _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array) {
|
|
13680
|
+
if (v == null) continue;
|
|
13681
|
+
_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.push(await Measure.fromJsonLd(v, {
|
|
13682
|
+
...options,
|
|
13683
|
+
baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
|
|
13684
|
+
}));
|
|
13685
|
+
}
|
|
13686
|
+
instance.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity;
|
|
13687
|
+
const _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [];
|
|
13688
|
+
let _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array = values["https://w3id.org/valueflows/ont/vf#availableQuantity"];
|
|
13689
|
+
for (const v of _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array == null ? [] : _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array.length === 1 && "@list" in _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array[0] ? _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array[0]["@list"] : _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array) {
|
|
13690
|
+
if (v == null) continue;
|
|
13691
|
+
_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.push(await Measure.fromJsonLd(v, {
|
|
13692
|
+
...options,
|
|
13693
|
+
baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
|
|
13694
|
+
}));
|
|
13695
|
+
}
|
|
13696
|
+
instance.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity;
|
|
13697
|
+
const _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [];
|
|
13698
|
+
let _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array = values["https://w3id.org/valueflows/ont/vf#minimumQuantity"];
|
|
13699
|
+
for (const v of _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array == null ? [] : _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array.length === 1 && "@list" in _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array[0] ? _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array[0]["@list"] : _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array) {
|
|
13700
|
+
if (v == null) continue;
|
|
13701
|
+
_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.push(await Measure.fromJsonLd(v, {
|
|
13702
|
+
...options,
|
|
13703
|
+
baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
|
|
13704
|
+
}));
|
|
13705
|
+
}
|
|
13706
|
+
instance.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity;
|
|
13707
|
+
if (!("_fromSubclass" in options) || !options._fromSubclass) try {
|
|
13708
|
+
instance._cachedJsonLd = structuredClone(json);
|
|
13709
|
+
} catch {
|
|
13710
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
13711
|
+
}
|
|
13712
|
+
return instance;
|
|
13713
|
+
}
|
|
13714
|
+
_getCustomInspectProxy() {
|
|
13715
|
+
const proxy = {};
|
|
13716
|
+
if (this.id != null) proxy.id = {
|
|
13717
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
|
|
13718
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
|
|
13719
|
+
};
|
|
13720
|
+
const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.map((v) => v instanceof URL ? {
|
|
13721
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
13722
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
13723
|
+
} : v);
|
|
13724
|
+
if (_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length == 1) proxy.action = _38VmZKmXJSBy3AvgqNa9GVqbdphy_action[0];
|
|
13725
|
+
const _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.map((v) => v instanceof URL ? {
|
|
13726
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
13727
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
13728
|
+
} : v);
|
|
13729
|
+
if (_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length == 1) proxy.resourceConformsTo = _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[0];
|
|
13730
|
+
const _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.map((v) => v instanceof URL ? {
|
|
13731
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
13732
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
13733
|
+
} : v);
|
|
13734
|
+
if (_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length == 1) proxy.resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[0];
|
|
13735
|
+
const _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.map((v) => v instanceof URL ? {
|
|
13736
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
13737
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
13738
|
+
} : v);
|
|
13739
|
+
if (_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length == 1) proxy.availableQuantity = _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[0];
|
|
13740
|
+
const _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.map((v) => v instanceof URL ? {
|
|
13741
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
13742
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
13743
|
+
} : v);
|
|
13744
|
+
if (_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length == 1) proxy.minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[0];
|
|
13745
|
+
return proxy;
|
|
13746
|
+
}
|
|
13747
|
+
};
|
|
13748
|
+
Intent.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
13749
|
+
return "Intent " + inspect(this._getCustomInspectProxy(), options);
|
|
13750
|
+
};
|
|
13751
|
+
Intent.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
13752
|
+
return "Intent " + inspect(this._getCustomInspectProxy(), options);
|
|
13753
|
+
};
|
|
13754
|
+
/** A published request or offer, sometimes with what is expected in return.
|
|
13755
|
+
*
|
|
13756
|
+
* Proposals contain a primary {@link Intent} (via `publishes`) describing
|
|
13757
|
+
* what is being offered or requested, and optionally a reciprocal
|
|
13758
|
+
* {@link Intent} describing what is expected or offered in return.
|
|
13759
|
+
*
|
|
13760
|
+
* Note: This type extends ActivityStreams `Object` for practical
|
|
13761
|
+
* interoperability within ActivityPub federation, even though FEP-0837
|
|
13762
|
+
* defines `Proposal` as a pure ValueFlows type. Extending `Object`
|
|
13763
|
+
* provides useful inherited properties such as `name`, `content`,
|
|
13764
|
+
* `attributedTo`, `published`, `to`, and `location` without needing to
|
|
13765
|
+
* redefine them.
|
|
13766
|
+
*/
|
|
13767
|
+
var Proposal = class Proposal extends Object$1 {
|
|
13768
|
+
/**
|
|
13769
|
+
* The type URI of {@link Proposal}: `https://w3id.org/valueflows/ont/vf#Proposal`.
|
|
13770
|
+
*/
|
|
13771
|
+
static get typeId() {
|
|
13772
|
+
return new URL("https://w3id.org/valueflows/ont/vf#Proposal");
|
|
13773
|
+
}
|
|
13774
|
+
#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [];
|
|
13775
|
+
#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [];
|
|
13776
|
+
#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [];
|
|
13777
|
+
#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [];
|
|
13778
|
+
/**
|
|
13779
|
+
* Constructs a new instance of Proposal with the given values.
|
|
13780
|
+
* @param values The values to initialize the instance with.
|
|
13781
|
+
* @param options The options to use for initialization.
|
|
13782
|
+
*/
|
|
13783
|
+
constructor(values, options = {}) {
|
|
13784
|
+
super(values, options);
|
|
13785
|
+
if ("purpose" in values && values.purpose != null) if (typeof values.purpose === "string") this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [values.purpose];
|
|
13786
|
+
else throw new TypeError("The purpose must be of type string.");
|
|
13787
|
+
if ("publishes" in values && values.publishes != null) if (values.publishes instanceof Intent) this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [values.publishes];
|
|
13788
|
+
else throw new TypeError("The publishes must be of type Intent.");
|
|
13789
|
+
if ("reciprocal" in values && values.reciprocal != null) if (values.reciprocal instanceof Intent) this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [values.reciprocal];
|
|
13790
|
+
else throw new TypeError("The reciprocal must be of type Intent.");
|
|
13791
|
+
if ("unitBased" in values && values.unitBased != null) if (typeof values.unitBased === "boolean") this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [values.unitBased];
|
|
13792
|
+
else throw new TypeError("The unitBased must be of type boolean.");
|
|
13793
|
+
}
|
|
13794
|
+
/**
|
|
13795
|
+
* Clones this instance, optionally updating it with the given values.
|
|
13796
|
+
* @param values The values to update the clone with.
|
|
13797
|
+
* @param options The options to use for cloning.
|
|
13798
|
+
* @returns The cloned instance.
|
|
13799
|
+
*/
|
|
13800
|
+
clone(values = {}, options = {}) {
|
|
13801
|
+
if (this._warning != null) {
|
|
13802
|
+
getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13803
|
+
options = {
|
|
13804
|
+
...options,
|
|
13805
|
+
$warning: this._warning
|
|
13806
|
+
};
|
|
13807
|
+
}
|
|
13808
|
+
const clone = super.clone(values, options);
|
|
13809
|
+
clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose;
|
|
13810
|
+
if ("purpose" in values && values.purpose != null) if (typeof values.purpose === "string") clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [values.purpose];
|
|
13811
|
+
else throw new TypeError("The purpose must be of type string.");
|
|
13812
|
+
clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes;
|
|
13813
|
+
if ("publishes" in values && values.publishes != null) if (values.publishes instanceof Intent) clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [values.publishes];
|
|
13814
|
+
else throw new TypeError("The publishes must be of type Intent.");
|
|
13815
|
+
clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal;
|
|
13816
|
+
if ("reciprocal" in values && values.reciprocal != null) if (values.reciprocal instanceof Intent) clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [values.reciprocal];
|
|
13817
|
+
else throw new TypeError("The reciprocal must be of type Intent.");
|
|
13818
|
+
clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased;
|
|
13819
|
+
if ("unitBased" in values && values.unitBased != null) if (typeof values.unitBased === "boolean") clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [values.unitBased];
|
|
13820
|
+
else throw new TypeError("The unitBased must be of type boolean.");
|
|
13821
|
+
return clone;
|
|
13822
|
+
}
|
|
13823
|
+
/** The type of proposal. Possible values are `"offer"` and `"request"`.
|
|
13824
|
+
*/
|
|
13825
|
+
get purpose() {
|
|
13826
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13827
|
+
if (this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length < 1) return null;
|
|
13828
|
+
return this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose[0];
|
|
13829
|
+
}
|
|
13830
|
+
/** The primary intent of this proposal, describing what is being offered
|
|
13831
|
+
* or requested.
|
|
13832
|
+
*/
|
|
13833
|
+
get publishes() {
|
|
13834
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13835
|
+
if (this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length < 1) return null;
|
|
13836
|
+
return this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[0];
|
|
13837
|
+
}
|
|
13838
|
+
/** The reciprocal intent of this proposal, describing what is expected
|
|
13839
|
+
* or offered in return.
|
|
13840
|
+
*/
|
|
13841
|
+
get reciprocal() {
|
|
13842
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13843
|
+
if (this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length < 1) return null;
|
|
13844
|
+
return this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[0];
|
|
13845
|
+
}
|
|
13846
|
+
/** Indicates whether the quantities expressed in the proposal can be
|
|
13847
|
+
* multiplied or not. The default is `false`.
|
|
13848
|
+
*/
|
|
13849
|
+
get unitBased() {
|
|
13850
|
+
if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
|
|
13851
|
+
if (this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length < 1) return null;
|
|
13852
|
+
return this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased[0];
|
|
13853
|
+
}
|
|
13854
|
+
/**
|
|
13855
|
+
* Converts this object to a JSON-LD structure.
|
|
13856
|
+
* @param options The options to use.
|
|
13857
|
+
* - `format`: The format of the output: `compact` or
|
|
13858
|
+
`expand`.
|
|
13859
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
13860
|
+
* - `context`: The JSON-LD context to use. Not applicable
|
|
13861
|
+
when `format` is set to `'expand'`.
|
|
13862
|
+
* @returns The JSON-LD representation of this object.
|
|
13863
|
+
*/
|
|
13864
|
+
async toJsonLd(options = {}) {
|
|
13865
|
+
if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
|
|
13866
|
+
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'.");
|
|
13867
|
+
options = {
|
|
13868
|
+
...options,
|
|
13869
|
+
contextLoader: options.contextLoader ?? getDocumentLoader()
|
|
13870
|
+
};
|
|
13871
|
+
if (options.format == null && this.isCompactable()) {
|
|
13872
|
+
const result = await super.toJsonLd({
|
|
13873
|
+
...options,
|
|
13874
|
+
format: void 0,
|
|
13875
|
+
context: void 0
|
|
13876
|
+
});
|
|
13877
|
+
let compactItems = [];
|
|
13878
|
+
for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) {
|
|
13879
|
+
const item = v;
|
|
13880
|
+
compactItems.push(item);
|
|
13881
|
+
}
|
|
13882
|
+
if (compactItems.length > 0) result["purpose"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13883
|
+
compactItems = [];
|
|
13884
|
+
for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) {
|
|
13885
|
+
const item = await v.toJsonLd({
|
|
13886
|
+
...options,
|
|
13887
|
+
format: void 0,
|
|
13888
|
+
context: void 0
|
|
13889
|
+
});
|
|
13890
|
+
compactItems.push(item);
|
|
13891
|
+
}
|
|
13892
|
+
if (compactItems.length > 0) result["publishes"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13893
|
+
compactItems = [];
|
|
13894
|
+
for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) {
|
|
13895
|
+
const item = await v.toJsonLd({
|
|
13896
|
+
...options,
|
|
13897
|
+
format: void 0,
|
|
13898
|
+
context: void 0
|
|
13899
|
+
});
|
|
13900
|
+
compactItems.push(item);
|
|
13901
|
+
}
|
|
13902
|
+
if (compactItems.length > 0) result["reciprocal"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13903
|
+
compactItems = [];
|
|
13904
|
+
for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) {
|
|
13905
|
+
const item = v;
|
|
13906
|
+
compactItems.push(item);
|
|
13907
|
+
}
|
|
13908
|
+
if (compactItems.length > 0) result["unitBased"] = compactItems.length > 1 ? compactItems : compactItems[0];
|
|
13909
|
+
result["type"] = "Proposal";
|
|
13910
|
+
if (this.id != null) result["id"] = this.id.href;
|
|
13911
|
+
result["@context"] = [
|
|
13912
|
+
"https://www.w3.org/ns/activitystreams",
|
|
13913
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
13914
|
+
"https://gotosocial.org/ns",
|
|
13915
|
+
{
|
|
13916
|
+
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
13917
|
+
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
13918
|
+
"fedibird": "http://fedibird.com/ns#",
|
|
13919
|
+
"sensitive": "as:sensitive",
|
|
13920
|
+
"emojiReactions": {
|
|
13921
|
+
"@id": "fedibird:emojiReactions",
|
|
13922
|
+
"@type": "@id"
|
|
13923
|
+
},
|
|
13924
|
+
"Proposal": "vf:Proposal",
|
|
13925
|
+
"Intent": "vf:Intent",
|
|
13926
|
+
"purpose": "vf:purpose",
|
|
13927
|
+
"unitBased": "vf:unitBased",
|
|
13928
|
+
"publishes": "vf:publishes",
|
|
13929
|
+
"reciprocal": "vf:reciprocal",
|
|
13930
|
+
"action": "vf:action",
|
|
13931
|
+
"resourceConformsTo": {
|
|
13932
|
+
"@id": "vf:resourceConformsTo",
|
|
13933
|
+
"@type": "@id"
|
|
13934
|
+
},
|
|
13935
|
+
"resourceQuantity": "vf:resourceQuantity",
|
|
13936
|
+
"availableQuantity": "vf:availableQuantity",
|
|
13937
|
+
"minimumQuantity": "vf:minimumQuantity",
|
|
13938
|
+
"hasUnit": "om2:hasUnit",
|
|
13939
|
+
"hasNumericalValue": "om2:hasNumericalValue"
|
|
13940
|
+
}
|
|
13941
|
+
];
|
|
13942
|
+
return result;
|
|
13943
|
+
}
|
|
13944
|
+
let array;
|
|
13945
|
+
const values = (await super.toJsonLd({
|
|
13946
|
+
...options,
|
|
13947
|
+
format: "expand",
|
|
13948
|
+
context: void 0
|
|
13949
|
+
}))[0];
|
|
13950
|
+
array = [];
|
|
13951
|
+
for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) {
|
|
13952
|
+
const element = { "@value": v };
|
|
13953
|
+
array.push(element);
|
|
13954
|
+
}
|
|
13955
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#purpose"] = array;
|
|
13956
|
+
array = [];
|
|
13957
|
+
for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) {
|
|
13958
|
+
const element = await v.toJsonLd(options);
|
|
13959
|
+
array.push(element);
|
|
13960
|
+
}
|
|
13961
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#publishes"] = array;
|
|
13962
|
+
array = [];
|
|
13963
|
+
for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) {
|
|
13964
|
+
const element = await v.toJsonLd(options);
|
|
13965
|
+
array.push(element);
|
|
13966
|
+
}
|
|
13967
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#reciprocal"] = array;
|
|
13968
|
+
array = [];
|
|
13969
|
+
for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) {
|
|
13970
|
+
const element = { "@value": v };
|
|
13971
|
+
array.push(element);
|
|
13972
|
+
}
|
|
13973
|
+
if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#unitBased"] = array;
|
|
13974
|
+
values["@type"] = ["https://w3id.org/valueflows/ont/vf#Proposal"];
|
|
13975
|
+
if (this.id != null) values["@id"] = this.id.href;
|
|
13976
|
+
if (options.format === "expand") return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
|
13977
|
+
const docContext = options.context ?? [
|
|
13978
|
+
"https://www.w3.org/ns/activitystreams",
|
|
13979
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
13980
|
+
"https://gotosocial.org/ns",
|
|
13981
|
+
{
|
|
13982
|
+
"vf": "https://w3id.org/valueflows/ont/vf#",
|
|
13983
|
+
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
|
|
13984
|
+
"fedibird": "http://fedibird.com/ns#",
|
|
13985
|
+
"sensitive": "as:sensitive",
|
|
13986
|
+
"emojiReactions": {
|
|
13987
|
+
"@id": "fedibird:emojiReactions",
|
|
13988
|
+
"@type": "@id"
|
|
13989
|
+
},
|
|
13990
|
+
"Proposal": "vf:Proposal",
|
|
13991
|
+
"Intent": "vf:Intent",
|
|
13992
|
+
"purpose": "vf:purpose",
|
|
13993
|
+
"unitBased": "vf:unitBased",
|
|
13994
|
+
"publishes": "vf:publishes",
|
|
13995
|
+
"reciprocal": "vf:reciprocal",
|
|
13996
|
+
"action": "vf:action",
|
|
13997
|
+
"resourceConformsTo": {
|
|
13998
|
+
"@id": "vf:resourceConformsTo",
|
|
13999
|
+
"@type": "@id"
|
|
14000
|
+
},
|
|
14001
|
+
"resourceQuantity": "vf:resourceQuantity",
|
|
14002
|
+
"availableQuantity": "vf:availableQuantity",
|
|
14003
|
+
"minimumQuantity": "vf:minimumQuantity",
|
|
14004
|
+
"hasUnit": "om2:hasUnit",
|
|
14005
|
+
"hasNumericalValue": "om2:hasNumericalValue"
|
|
14006
|
+
}
|
|
14007
|
+
];
|
|
14008
|
+
const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
|
|
14009
|
+
if (docContext != null) {
|
|
14010
|
+
if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
|
|
14011
|
+
else compacted.proof["@context"] = docContext;
|
|
14012
|
+
}
|
|
14013
|
+
return compacted;
|
|
14014
|
+
}
|
|
14015
|
+
isCompactable() {
|
|
14016
|
+
return super.isCompactable();
|
|
14017
|
+
}
|
|
14018
|
+
/**
|
|
14019
|
+
* Converts a JSON-LD structure to an object of this type.
|
|
14020
|
+
* @param json The JSON-LD structure to convert.
|
|
14021
|
+
* @param options The options to use.
|
|
14022
|
+
* - `documentLoader`: The loader for remote JSON-LD documents.
|
|
14023
|
+
* - `contextLoader`: The loader for remote JSON-LD contexts.
|
|
14024
|
+
* - `tracerProvider`: The OpenTelemetry tracer provider to use.
|
|
14025
|
+
* If omitted, the global tracer provider is used.
|
|
14026
|
+
* @returns The object of this type.
|
|
14027
|
+
* @throws {TypeError} If the given `json` is invalid.
|
|
14028
|
+
*/
|
|
14029
|
+
static async fromJsonLd(json, options = {}) {
|
|
14030
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.2.0").startActiveSpan("activitypub.parse_object", async (span) => {
|
|
14031
|
+
try {
|
|
14032
|
+
const object = await this.__fromJsonLd__Proposal__(json, span, options);
|
|
14033
|
+
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
14034
|
+
return object;
|
|
14035
|
+
} catch (error) {
|
|
14036
|
+
span.setStatus({
|
|
14037
|
+
code: SpanStatusCode.ERROR,
|
|
14038
|
+
message: String(error)
|
|
14039
|
+
});
|
|
14040
|
+
throw error;
|
|
14041
|
+
} finally {
|
|
14042
|
+
span.end();
|
|
14043
|
+
}
|
|
14044
|
+
});
|
|
14045
|
+
}
|
|
14046
|
+
static async __fromJsonLd__Proposal__(json, span, options = {}) {
|
|
14047
|
+
if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
|
|
14048
|
+
else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
|
|
14049
|
+
options = {
|
|
14050
|
+
...options,
|
|
14051
|
+
documentLoader: options.documentLoader ?? getDocumentLoader(),
|
|
14052
|
+
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
14053
|
+
tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
|
|
14054
|
+
};
|
|
14055
|
+
let values;
|
|
14056
|
+
if (globalThis.Object.keys(json).length == 0) values = {};
|
|
14057
|
+
else values = (await jsonld.expand(json, {
|
|
14058
|
+
documentLoader: options.contextLoader,
|
|
14059
|
+
keepFreeFloatingNodes: true
|
|
14060
|
+
}))[0] ?? {};
|
|
14061
|
+
if (options.baseUrl == null && values["@id"] != null) options = {
|
|
14062
|
+
...options,
|
|
14063
|
+
baseUrl: new URL(values["@id"])
|
|
14064
|
+
};
|
|
14065
|
+
if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
|
|
14066
|
+
if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
|
|
14067
|
+
if (!values["@type"].includes("https://w3id.org/valueflows/ont/vf#Proposal")) throw new TypeError("Invalid type: " + values["@type"]);
|
|
14068
|
+
}
|
|
14069
|
+
delete values["@type"];
|
|
14070
|
+
const instance = await super.fromJsonLd(values, {
|
|
14071
|
+
...options,
|
|
14072
|
+
_fromSubclass: true
|
|
14073
|
+
});
|
|
14074
|
+
if (!(instance instanceof Proposal)) throw new TypeError("Unexpected type: " + instance.constructor.name);
|
|
14075
|
+
const _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [];
|
|
14076
|
+
let _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array = values["https://w3id.org/valueflows/ont/vf#purpose"];
|
|
14077
|
+
for (const v of _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array == null ? [] : _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array.length === 1 && "@list" in _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array[0] ? _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array[0]["@list"] : _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array) {
|
|
14078
|
+
if (v == null) continue;
|
|
14079
|
+
_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.push(v["@value"]);
|
|
14080
|
+
}
|
|
14081
|
+
instance.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose;
|
|
14082
|
+
const _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [];
|
|
14083
|
+
let _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array = values["https://w3id.org/valueflows/ont/vf#publishes"];
|
|
14084
|
+
for (const v of _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array == null ? [] : _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array.length === 1 && "@list" in _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array[0] ? _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array[0]["@list"] : _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array) {
|
|
14085
|
+
if (v == null) continue;
|
|
14086
|
+
_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.push(await Intent.fromJsonLd(v, {
|
|
14087
|
+
...options,
|
|
14088
|
+
baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
|
|
14089
|
+
}));
|
|
14090
|
+
}
|
|
14091
|
+
instance.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes;
|
|
14092
|
+
const _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [];
|
|
14093
|
+
let _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array = values["https://w3id.org/valueflows/ont/vf#reciprocal"];
|
|
14094
|
+
for (const v of _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array == null ? [] : _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array.length === 1 && "@list" in _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array[0] ? _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array[0]["@list"] : _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array) {
|
|
14095
|
+
if (v == null) continue;
|
|
14096
|
+
_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.push(await Intent.fromJsonLd(v, {
|
|
14097
|
+
...options,
|
|
14098
|
+
baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
|
|
14099
|
+
}));
|
|
14100
|
+
}
|
|
14101
|
+
instance.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal;
|
|
14102
|
+
const _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [];
|
|
14103
|
+
let _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array = values["https://w3id.org/valueflows/ont/vf#unitBased"];
|
|
14104
|
+
for (const v of _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array == null ? [] : _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array.length === 1 && "@list" in _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array[0] ? _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array[0]["@list"] : _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array) {
|
|
14105
|
+
if (v == null) continue;
|
|
14106
|
+
_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.push(v["@value"]);
|
|
14107
|
+
}
|
|
14108
|
+
instance.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased;
|
|
14109
|
+
if (!("_fromSubclass" in options) || !options._fromSubclass) try {
|
|
14110
|
+
instance._cachedJsonLd = structuredClone(json);
|
|
14111
|
+
} catch {
|
|
14112
|
+
getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
|
|
14113
|
+
}
|
|
14114
|
+
return instance;
|
|
14115
|
+
}
|
|
14116
|
+
_getCustomInspectProxy() {
|
|
14117
|
+
const proxy = super._getCustomInspectProxy();
|
|
14118
|
+
const _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.map((v) => v instanceof URL ? {
|
|
14119
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
14120
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
14121
|
+
} : v);
|
|
14122
|
+
if (_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length == 1) proxy.purpose = _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose[0];
|
|
14123
|
+
const _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.map((v) => v instanceof URL ? {
|
|
14124
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
14125
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
14126
|
+
} : v);
|
|
14127
|
+
if (_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length == 1) proxy.publishes = _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[0];
|
|
14128
|
+
const _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.map((v) => v instanceof URL ? {
|
|
14129
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
14130
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
14131
|
+
} : v);
|
|
14132
|
+
if (_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length == 1) proxy.reciprocal = _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[0];
|
|
14133
|
+
const _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.map((v) => v instanceof URL ? {
|
|
14134
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
|
14135
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
|
|
14136
|
+
} : v);
|
|
14137
|
+
if (_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length == 1) proxy.unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased[0];
|
|
14138
|
+
return proxy;
|
|
14139
|
+
}
|
|
14140
|
+
};
|
|
14141
|
+
Proposal.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
14142
|
+
return "Proposal " + inspect(this._getCustomInspectProxy(), options);
|
|
14143
|
+
};
|
|
14144
|
+
Proposal.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
14145
|
+
return "Proposal " + inspect(this._getCustomInspectProxy(), options);
|
|
14146
|
+
};
|
|
13072
14147
|
/** Indicates that the `actor` accepts the `object`. The `target` property can be
|
|
13073
14148
|
* used in certain circumstances to indicate the context into which the `object`
|
|
13074
14149
|
* has been accepted.
|
|
@@ -20157,6 +21232,7 @@ var Collection = class Collection extends Object$1 {
|
|
|
20157
21232
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
20158
21233
|
"https://gotosocial.org/ns#LikeApproval",
|
|
20159
21234
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
21235
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
20160
21236
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
20161
21237
|
"http://litepub.social/ns#EmojiReact",
|
|
20162
21238
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -26398,6 +27474,7 @@ var Link = class Link {
|
|
|
26398
27474
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
26399
27475
|
"https://gotosocial.org/ns#LikeApproval",
|
|
26400
27476
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
27477
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
26401
27478
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
26402
27479
|
"http://litepub.social/ns#EmojiReact",
|
|
26403
27480
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -28655,6 +29732,7 @@ var OrderedCollection = class OrderedCollection extends Collection {
|
|
|
28655
29732
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
28656
29733
|
"https://gotosocial.org/ns#LikeApproval",
|
|
28657
29734
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
29735
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
28658
29736
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
28659
29737
|
"http://litepub.social/ns#EmojiReact",
|
|
28660
29738
|
"https://gotosocial.org/ns#AnnounceRequest",
|
|
@@ -29140,6 +30218,7 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
|
|
|
29140
30218
|
"https://gotosocial.org/ns#AnnounceAuthorization",
|
|
29141
30219
|
"https://gotosocial.org/ns#LikeApproval",
|
|
29142
30220
|
"https://gotosocial.org/ns#ReplyAuthorization",
|
|
30221
|
+
"https://w3id.org/valueflows/ont/vf#Proposal",
|
|
29143
30222
|
"https://www.w3.org/ns/activitystreams#Activity",
|
|
29144
30223
|
"http://litepub.social/ns#EmojiReact",
|
|
29145
30224
|
"https://gotosocial.org/ns#AnnounceRequest",
|