@pod-os/core 0.9.1-49d87ed.0 → 0.9.1-6931b20.0
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/dist/index.js +567 -366
- package/dist/{jsonld-62EQUZ7Z.js → jsonld-5UGKFKA6.js} +81 -16
- package/lib/index.js +647 -381
- package/package.json +18 -18
- package/types/profile/WebIdProfile.d.ts +9 -0
- package/types/search/LabelIndex.d.ts +7 -0
- package/types/search/SearchIndex.d.ts +19 -0
|
@@ -1943,7 +1943,7 @@ var require_url = __commonJS({
|
|
|
1943
1943
|
"fragment"
|
|
1944
1944
|
],
|
|
1945
1945
|
/* eslint-disable-next-line max-len */
|
|
1946
|
-
regex: /^(([
|
|
1946
|
+
regex: /^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
|
|
1947
1947
|
}
|
|
1948
1948
|
};
|
|
1949
1949
|
api.parse = (str, parser) => {
|
|
@@ -3206,7 +3206,9 @@ var require_events = __commonJS({
|
|
|
3206
3206
|
"relative graph reference",
|
|
3207
3207
|
"relative object reference",
|
|
3208
3208
|
"relative predicate reference",
|
|
3209
|
-
"relative subject reference"
|
|
3209
|
+
"relative subject reference",
|
|
3210
|
+
// toRDF / fromRDF
|
|
3211
|
+
"rdfDirection not set"
|
|
3210
3212
|
]);
|
|
3211
3213
|
api.safeEventHandler = function safeEventHandler({ event, next }) {
|
|
3212
3214
|
if (event.level === "warning" && _notSafeEventCodes.has(event.code)) {
|
|
@@ -3832,7 +3834,7 @@ var require_context = __commonJS({
|
|
|
3832
3834
|
}
|
|
3833
3835
|
}
|
|
3834
3836
|
mapping["@id"] = id2;
|
|
3835
|
-
mapping._prefix = simpleTerm && !mapping._termHasColon && id2.match(/[:\/\?#\[\]@]$/);
|
|
3837
|
+
mapping._prefix = simpleTerm && !mapping._termHasColon && id2.match(/[:\/\?#\[\]@]$/) !== null;
|
|
3836
3838
|
}
|
|
3837
3839
|
}
|
|
3838
3840
|
if (!("@id" in mapping)) {
|
|
@@ -5243,12 +5245,13 @@ var require_expand = __commonJS({
|
|
|
5243
5245
|
}
|
|
5244
5246
|
if (container.includes("@graph") && !container.some((key2) => key2 === "@id" || key2 === "@index")) {
|
|
5245
5247
|
expandedValue = _asArray(expandedValue);
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
}
|
|
5248
|
+
if (!options.isFrame) {
|
|
5249
|
+
expandedValue = expandedValue.filter((v) => {
|
|
5250
|
+
const count = Object.keys(v).length;
|
|
5251
|
+
return _dropUnsafeObject({ value: v, count, options }) !== null;
|
|
5252
|
+
});
|
|
5253
|
+
}
|
|
5254
|
+
if (expandedValue.length === 0) {
|
|
5252
5255
|
continue;
|
|
5253
5256
|
}
|
|
5254
5257
|
expandedValue = expandedValue.map((v) => ({ "@graph": _asArray(v) }));
|
|
@@ -5796,14 +5799,29 @@ var require_fromRdf = __commonJS({
|
|
|
5796
5799
|
var api = {};
|
|
5797
5800
|
module.exports = api;
|
|
5798
5801
|
api.fromRDF = async (dataset, options) => {
|
|
5799
|
-
const defaultGraph = {};
|
|
5800
|
-
const graphMap = { "@default": defaultGraph };
|
|
5801
|
-
const referencedOnce = {};
|
|
5802
5802
|
const {
|
|
5803
5803
|
useRdfType = false,
|
|
5804
5804
|
useNativeTypes = false,
|
|
5805
5805
|
rdfDirection = null
|
|
5806
5806
|
} = options;
|
|
5807
|
+
const defaultGraph = {};
|
|
5808
|
+
const graphMap = { "@default": defaultGraph };
|
|
5809
|
+
const referencedOnce = {};
|
|
5810
|
+
if (rdfDirection) {
|
|
5811
|
+
if (rdfDirection === "compound-literal") {
|
|
5812
|
+
throw new JsonLdError(
|
|
5813
|
+
"Unsupported rdfDirection value.",
|
|
5814
|
+
"jsonld.InvalidRdfDirection",
|
|
5815
|
+
{ value: rdfDirection }
|
|
5816
|
+
);
|
|
5817
|
+
} else if (rdfDirection !== "i18n-datatype") {
|
|
5818
|
+
throw new JsonLdError(
|
|
5819
|
+
"Unknown rdfDirection value.",
|
|
5820
|
+
"jsonld.InvalidRdfDirection",
|
|
5821
|
+
{ value: rdfDirection }
|
|
5822
|
+
);
|
|
5823
|
+
}
|
|
5824
|
+
}
|
|
5807
5825
|
for (const quad of dataset) {
|
|
5808
5826
|
const name = quad.graph.termType === "DefaultGraph" ? "@default" : quad.graph.value;
|
|
5809
5827
|
if (!(name in graphMap)) {
|
|
@@ -6000,9 +6018,9 @@ var require_fromRdf = __commonJS({
|
|
|
6000
6018
|
}
|
|
6001
6019
|
});
|
|
6002
6020
|
|
|
6003
|
-
// ../node_modules/canonicalize/lib/canonicalize.js
|
|
6021
|
+
// ../node_modules/jsonld/node_modules/canonicalize/lib/canonicalize.js
|
|
6004
6022
|
var require_canonicalize = __commonJS({
|
|
6005
|
-
"../node_modules/canonicalize/lib/canonicalize.js"(exports, module) {
|
|
6023
|
+
"../node_modules/jsonld/node_modules/canonicalize/lib/canonicalize.js"(exports, module) {
|
|
6006
6024
|
"use strict";
|
|
6007
6025
|
module.exports = function serialize(object) {
|
|
6008
6026
|
if (object === null || typeof object !== "object" || object.toJSON != null) {
|
|
@@ -6034,6 +6052,7 @@ var require_toRdf = __commonJS({
|
|
|
6034
6052
|
var { isKeyword } = require_context();
|
|
6035
6053
|
var graphTypes = require_graphTypes();
|
|
6036
6054
|
var jsonCanonicalize = require_canonicalize();
|
|
6055
|
+
var JsonLdError = require_JsonLdError();
|
|
6037
6056
|
var types = require_types();
|
|
6038
6057
|
var util = require_util();
|
|
6039
6058
|
var {
|
|
@@ -6273,15 +6292,61 @@ var require_toRdf = __commonJS({
|
|
|
6273
6292
|
} else if (types.isNumber(value)) {
|
|
6274
6293
|
object.value = value.toFixed(0);
|
|
6275
6294
|
object.datatype.value = datatype || XSD_INTEGER;
|
|
6276
|
-
} else if (rdfDirection === "i18n-datatype"
|
|
6277
|
-
const
|
|
6295
|
+
} else if ("@direction" in item && rdfDirection === "i18n-datatype") {
|
|
6296
|
+
const language = (item["@language"] || "").toLowerCase();
|
|
6297
|
+
const direction = item["@direction"];
|
|
6298
|
+
const datatype2 = `https://www.w3.org/ns/i18n#${language}_${direction}`;
|
|
6278
6299
|
object.datatype.value = datatype2;
|
|
6279
6300
|
object.value = value;
|
|
6301
|
+
} else if ("@direction" in item && rdfDirection === "compound-literal") {
|
|
6302
|
+
throw new JsonLdError(
|
|
6303
|
+
"Unsupported rdfDirection value.",
|
|
6304
|
+
"jsonld.InvalidRdfDirection",
|
|
6305
|
+
{ value: rdfDirection }
|
|
6306
|
+
);
|
|
6307
|
+
} else if ("@direction" in item && rdfDirection) {
|
|
6308
|
+
throw new JsonLdError(
|
|
6309
|
+
"Unknown rdfDirection value.",
|
|
6310
|
+
"jsonld.InvalidRdfDirection",
|
|
6311
|
+
{ value: rdfDirection }
|
|
6312
|
+
);
|
|
6280
6313
|
} else if ("@language" in item) {
|
|
6314
|
+
if ("@direction" in item && !rdfDirection) {
|
|
6315
|
+
if (options.eventHandler) {
|
|
6316
|
+
_handleEvent({
|
|
6317
|
+
event: {
|
|
6318
|
+
type: ["JsonLdEvent"],
|
|
6319
|
+
code: "rdfDirection not set",
|
|
6320
|
+
level: "warning",
|
|
6321
|
+
message: "rdfDirection not set for @direction.",
|
|
6322
|
+
details: {
|
|
6323
|
+
object: object.value
|
|
6324
|
+
}
|
|
6325
|
+
},
|
|
6326
|
+
options
|
|
6327
|
+
});
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6281
6330
|
object.value = value;
|
|
6282
6331
|
object.datatype.value = datatype || RDF_LANGSTRING;
|
|
6283
6332
|
object.language = item["@language"];
|
|
6284
6333
|
} else {
|
|
6334
|
+
if ("@direction" in item && !rdfDirection) {
|
|
6335
|
+
if (options.eventHandler) {
|
|
6336
|
+
_handleEvent({
|
|
6337
|
+
event: {
|
|
6338
|
+
type: ["JsonLdEvent"],
|
|
6339
|
+
code: "rdfDirection not set",
|
|
6340
|
+
level: "warning",
|
|
6341
|
+
message: "rdfDirection not set for @direction.",
|
|
6342
|
+
details: {
|
|
6343
|
+
object: object.value
|
|
6344
|
+
}
|
|
6345
|
+
},
|
|
6346
|
+
options
|
|
6347
|
+
});
|
|
6348
|
+
}
|
|
6349
|
+
}
|
|
6285
6350
|
object.value = value;
|
|
6286
6351
|
object.datatype.value = datatype || XSD_STRING;
|
|
6287
6352
|
}
|