@muze-nl/jsfs-solid 0.2.2 → 0.2.4
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/browser.js +400 -153
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +10 -10
- package/dist/browser.min.js.map +4 -4
- package/package.json +7 -7
- package/package.json~ +37 -0
- package/src/SolidClient.js +3 -3
package/dist/browser.js
CHANGED
|
@@ -8416,9 +8416,9 @@
|
|
|
8416
8416
|
return new Client(...deepClone(options));
|
|
8417
8417
|
}
|
|
8418
8418
|
function getRequestParams(req, current) {
|
|
8419
|
-
let
|
|
8420
|
-
if (!
|
|
8421
|
-
|
|
8419
|
+
let params = current || {};
|
|
8420
|
+
if (!params.url && current.url) {
|
|
8421
|
+
params.url = current.url;
|
|
8422
8422
|
}
|
|
8423
8423
|
for (let prop of [
|
|
8424
8424
|
"method",
|
|
@@ -8444,27 +8444,27 @@
|
|
|
8444
8444
|
value = value[Symbol.metroSource];
|
|
8445
8445
|
}
|
|
8446
8446
|
if (typeof value == "function") {
|
|
8447
|
-
|
|
8447
|
+
params[prop] = value(params[prop], params);
|
|
8448
8448
|
} else {
|
|
8449
8449
|
if (prop == "url") {
|
|
8450
|
-
|
|
8450
|
+
params.url = url(params.url, value);
|
|
8451
8451
|
} else if (prop == "headers") {
|
|
8452
|
-
|
|
8452
|
+
params.headers = new Headers(current.headers);
|
|
8453
8453
|
if (!(value instanceof Headers)) {
|
|
8454
8454
|
value = new Headers(req.headers);
|
|
8455
8455
|
}
|
|
8456
8456
|
for (let [key, val] of value.entries()) {
|
|
8457
|
-
|
|
8457
|
+
params.headers.set(key, val);
|
|
8458
8458
|
}
|
|
8459
8459
|
} else {
|
|
8460
|
-
|
|
8460
|
+
params[prop] = value;
|
|
8461
8461
|
}
|
|
8462
8462
|
}
|
|
8463
8463
|
}
|
|
8464
8464
|
if (req instanceof Request && req.data) {
|
|
8465
|
-
|
|
8465
|
+
params.body = req.data;
|
|
8466
8466
|
}
|
|
8467
|
-
return
|
|
8467
|
+
return params;
|
|
8468
8468
|
}
|
|
8469
8469
|
function request(...options) {
|
|
8470
8470
|
let requestParams = {
|
|
@@ -8528,9 +8528,9 @@
|
|
|
8528
8528
|
});
|
|
8529
8529
|
}
|
|
8530
8530
|
function getResponseParams(res, current) {
|
|
8531
|
-
let
|
|
8532
|
-
if (!
|
|
8533
|
-
|
|
8531
|
+
let params = current || {};
|
|
8532
|
+
if (!params.url && current.url) {
|
|
8533
|
+
params.url = current.url;
|
|
8534
8534
|
}
|
|
8535
8535
|
for (let prop of ["status", "statusText", "headers", "body", "url", "type", "redirected"]) {
|
|
8536
8536
|
let value = res[prop];
|
|
@@ -8541,19 +8541,19 @@
|
|
|
8541
8541
|
value = value[Symbol.metroSource];
|
|
8542
8542
|
}
|
|
8543
8543
|
if (typeof value == "function") {
|
|
8544
|
-
|
|
8544
|
+
params[prop] = value(params[prop], params);
|
|
8545
8545
|
} else {
|
|
8546
8546
|
if (prop == "url") {
|
|
8547
|
-
|
|
8547
|
+
params.url = new URL(value, params.url || "https://localhost/");
|
|
8548
8548
|
} else {
|
|
8549
|
-
|
|
8549
|
+
params[prop] = value;
|
|
8550
8550
|
}
|
|
8551
8551
|
}
|
|
8552
8552
|
}
|
|
8553
8553
|
if (res instanceof Response && res.data) {
|
|
8554
|
-
|
|
8554
|
+
params.body = res.data;
|
|
8555
8555
|
}
|
|
8556
|
-
return
|
|
8556
|
+
return params;
|
|
8557
8557
|
}
|
|
8558
8558
|
function response(...options) {
|
|
8559
8559
|
let responseParams = {};
|
|
@@ -8612,12 +8612,12 @@
|
|
|
8612
8612
|
}
|
|
8613
8613
|
});
|
|
8614
8614
|
}
|
|
8615
|
-
function appendSearchParams(url2,
|
|
8616
|
-
if (typeof
|
|
8617
|
-
|
|
8615
|
+
function appendSearchParams(url2, params) {
|
|
8616
|
+
if (typeof params == "function") {
|
|
8617
|
+
params(url2.searchParams, url2);
|
|
8618
8618
|
} else {
|
|
8619
|
-
|
|
8620
|
-
|
|
8619
|
+
params = new URLSearchParams(params);
|
|
8620
|
+
params.forEach((value, key) => {
|
|
8621
8621
|
url2.searchParams.append(key, value);
|
|
8622
8622
|
});
|
|
8623
8623
|
}
|
|
@@ -8736,31 +8736,31 @@
|
|
|
8736
8736
|
});
|
|
8737
8737
|
}
|
|
8738
8738
|
function formdata(...options) {
|
|
8739
|
-
var
|
|
8739
|
+
var params = new FormData();
|
|
8740
8740
|
for (let option of options) {
|
|
8741
8741
|
if (option instanceof HTMLFormElement) {
|
|
8742
8742
|
option = new FormData(option);
|
|
8743
8743
|
}
|
|
8744
8744
|
if (option instanceof FormData) {
|
|
8745
8745
|
for (let entry of option.entries()) {
|
|
8746
|
-
|
|
8746
|
+
params.append(entry[0], entry[1]);
|
|
8747
8747
|
}
|
|
8748
8748
|
} else if (option && typeof option == "object") {
|
|
8749
8749
|
for (let entry of Object.entries(option)) {
|
|
8750
8750
|
if (Array.isArray(entry[1])) {
|
|
8751
8751
|
for (let value of entry[1]) {
|
|
8752
|
-
|
|
8752
|
+
params.append(entry[0], value);
|
|
8753
8753
|
}
|
|
8754
8754
|
} else {
|
|
8755
|
-
|
|
8755
|
+
params.append(entry[0], entry[1]);
|
|
8756
8756
|
}
|
|
8757
8757
|
}
|
|
8758
8758
|
} else {
|
|
8759
8759
|
throw new metroError("metro.formdata: unknown option type " + metroURL + "formdata/unknown-option-value/", option);
|
|
8760
8760
|
}
|
|
8761
8761
|
}
|
|
8762
|
-
Object.freeze(
|
|
8763
|
-
return new Proxy(
|
|
8762
|
+
Object.freeze(params);
|
|
8763
|
+
return new Proxy(params, {
|
|
8764
8764
|
get(target, prop) {
|
|
8765
8765
|
let result2;
|
|
8766
8766
|
switch (prop) {
|
|
@@ -9165,6 +9165,12 @@
|
|
|
9165
9165
|
|
|
9166
9166
|
// node_modules/@muze-nl/assert/src/assert.mjs
|
|
9167
9167
|
globalThis.assertEnabled = false;
|
|
9168
|
+
function enable() {
|
|
9169
|
+
globalThis.assertEnabled = true;
|
|
9170
|
+
}
|
|
9171
|
+
function disable() {
|
|
9172
|
+
globalThis.assertEnabled = false;
|
|
9173
|
+
}
|
|
9168
9174
|
function assert(source, test) {
|
|
9169
9175
|
if (globalThis.assertEnabled) {
|
|
9170
9176
|
let problems = fails(source, test);
|
|
@@ -9378,6 +9384,24 @@
|
|
|
9378
9384
|
function warn(message, data, pattern, path) {
|
|
9379
9385
|
console.warn("\u{1F170}\uFE0F Assert: " + path, message, pattern, data);
|
|
9380
9386
|
}
|
|
9387
|
+
globalThis.assert = {
|
|
9388
|
+
warn,
|
|
9389
|
+
error,
|
|
9390
|
+
assert,
|
|
9391
|
+
enable,
|
|
9392
|
+
disable,
|
|
9393
|
+
Required,
|
|
9394
|
+
Recommended,
|
|
9395
|
+
Optional,
|
|
9396
|
+
oneOf,
|
|
9397
|
+
anyOf,
|
|
9398
|
+
allOf,
|
|
9399
|
+
validURL,
|
|
9400
|
+
validEmail,
|
|
9401
|
+
instanceOf,
|
|
9402
|
+
not,
|
|
9403
|
+
fails
|
|
9404
|
+
};
|
|
9381
9405
|
|
|
9382
9406
|
// node_modules/@muze-nl/metro-oauth2/src/tokenstore.mjs
|
|
9383
9407
|
function tokenStore(site) {
|
|
@@ -9528,20 +9552,20 @@
|
|
|
9528
9552
|
function getTokensFromLocation() {
|
|
9529
9553
|
if (typeof window !== "undefined" && window?.location) {
|
|
9530
9554
|
let url2 = url(window.location);
|
|
9531
|
-
let code, state,
|
|
9555
|
+
let code, state, params;
|
|
9532
9556
|
if (url2.searchParams.has("code")) {
|
|
9533
|
-
|
|
9557
|
+
params = url2.searchParams;
|
|
9534
9558
|
url2 = url2.with({ search: "" });
|
|
9535
9559
|
history.pushState({}, "", url2.href);
|
|
9536
9560
|
} else if (url2.hash) {
|
|
9537
9561
|
let query = url2.hash.substr(1);
|
|
9538
|
-
|
|
9562
|
+
params = new URLSearchParams("?" + query);
|
|
9539
9563
|
url2 = url2.with({ hash: "" });
|
|
9540
9564
|
history.pushState({}, "", url2.href);
|
|
9541
9565
|
}
|
|
9542
|
-
if (
|
|
9543
|
-
code =
|
|
9544
|
-
state =
|
|
9566
|
+
if (params) {
|
|
9567
|
+
code = params.get("code");
|
|
9568
|
+
state = params.get("state");
|
|
9545
9569
|
let storedState = options.state.get("metro/state");
|
|
9546
9570
|
if (!state || state !== storedState) {
|
|
9547
9571
|
return;
|
|
@@ -9569,7 +9593,7 @@
|
|
|
9569
9593
|
let response2 = await options.client.post(tokenReq);
|
|
9570
9594
|
if (!response2.ok) {
|
|
9571
9595
|
let msg = await response2.text();
|
|
9572
|
-
throw metroError("OAuth2mw: fetch access_token: " + response2.status + ": " + response2.statusText, { cause: tokenReq });
|
|
9596
|
+
throw metroError("OAuth2mw: fetch access_token: " + response2.status + ": " + response2.statusText + " (" + msg + ")", { cause: tokenReq });
|
|
9573
9597
|
}
|
|
9574
9598
|
let data = await response2.json();
|
|
9575
9599
|
options.tokens.set("access_token", {
|
|
@@ -9660,36 +9684,35 @@
|
|
|
9660
9684
|
throw metroError("oauth2mw: Missing options.endpoints.token url");
|
|
9661
9685
|
}
|
|
9662
9686
|
let url2 = url(oauth2.token_endpoint, { hash: "" });
|
|
9663
|
-
let
|
|
9687
|
+
let params = {
|
|
9664
9688
|
grant_type: grant_type || oauth2.grant_type,
|
|
9665
9689
|
client_id: oauth2.client_id
|
|
9666
9690
|
};
|
|
9667
9691
|
if (oauth2.client_secret) {
|
|
9668
|
-
|
|
9692
|
+
params.client_secret = oauth2.client_secret;
|
|
9669
9693
|
}
|
|
9670
9694
|
if (oauth2.scope) {
|
|
9671
|
-
|
|
9695
|
+
params.scope = oauth2.scope;
|
|
9672
9696
|
}
|
|
9673
|
-
switch (
|
|
9697
|
+
switch (params.grant_type) {
|
|
9674
9698
|
case "authorization_code":
|
|
9675
|
-
|
|
9676
|
-
|
|
9699
|
+
params.redirect_uri = oauth2.redirect_uri;
|
|
9700
|
+
params.code = options.tokens.get("authorization_code");
|
|
9677
9701
|
const code_verifier = options.tokens.get("code_verifier");
|
|
9678
9702
|
if (code_verifier) {
|
|
9679
|
-
|
|
9703
|
+
params.code_verifier = code_verifier;
|
|
9680
9704
|
}
|
|
9681
9705
|
break;
|
|
9682
9706
|
case "client_credentials":
|
|
9683
9707
|
break;
|
|
9684
9708
|
case "refresh_token":
|
|
9685
|
-
|
|
9686
|
-
params2.refresh_token = refreshToken.value;
|
|
9709
|
+
params.refresh_token = options.tokens.get("refresh_token");
|
|
9687
9710
|
break;
|
|
9688
9711
|
default:
|
|
9689
9712
|
throw new Error("Unknown grant_type: ".oauth2.grant_type);
|
|
9690
9713
|
break;
|
|
9691
9714
|
}
|
|
9692
|
-
return request(url2, { method: "POST", body: new URLSearchParams(
|
|
9715
|
+
return request(url2, { method: "POST", body: new URLSearchParams(params) });
|
|
9693
9716
|
}
|
|
9694
9717
|
}
|
|
9695
9718
|
function isExpired(token) {
|
|
@@ -9741,7 +9764,7 @@
|
|
|
9741
9764
|
if (!url2.searchParams.has("code")) {
|
|
9742
9765
|
if (url2.hash) {
|
|
9743
9766
|
let query = url2.hash.substr(1);
|
|
9744
|
-
params = new URLSearchParams("?" + query);
|
|
9767
|
+
const params = new URLSearchParams("?" + query);
|
|
9745
9768
|
if (params.has("code")) {
|
|
9746
9769
|
return true;
|
|
9747
9770
|
}
|
|
@@ -9842,35 +9865,44 @@
|
|
|
9842
9865
|
const signature = b64u(await crypto.subtle.sign(subtleAlgorithm(key), key, buf(input)));
|
|
9843
9866
|
return `${input}.${signature}`;
|
|
9844
9867
|
}
|
|
9845
|
-
var
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
input
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9868
|
+
var encodeBase64Url;
|
|
9869
|
+
if (Uint8Array.prototype.toBase64) {
|
|
9870
|
+
encodeBase64Url = (input) => {
|
|
9871
|
+
if (input instanceof ArrayBuffer) {
|
|
9872
|
+
input = new Uint8Array(input);
|
|
9873
|
+
}
|
|
9874
|
+
return input.toBase64({ alphabet: "base64url", omitPadding: true });
|
|
9875
|
+
};
|
|
9876
|
+
} else {
|
|
9877
|
+
const CHUNK_SIZE = 32768;
|
|
9878
|
+
encodeBase64Url = (input) => {
|
|
9879
|
+
if (input instanceof ArrayBuffer) {
|
|
9880
|
+
input = new Uint8Array(input);
|
|
9881
|
+
}
|
|
9882
|
+
const arr = [];
|
|
9883
|
+
for (let i = 0; i < input.byteLength; i += CHUNK_SIZE) {
|
|
9884
|
+
arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));
|
|
9885
|
+
}
|
|
9886
|
+
return btoa(arr.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
9887
|
+
};
|
|
9855
9888
|
}
|
|
9856
9889
|
function b64u(input) {
|
|
9857
9890
|
return encodeBase64Url(input);
|
|
9858
9891
|
}
|
|
9859
|
-
function randomBytes() {
|
|
9860
|
-
return b64u(crypto.getRandomValues(new Uint8Array(32)));
|
|
9861
|
-
}
|
|
9862
9892
|
var UnsupportedOperationError = class extends Error {
|
|
9863
9893
|
constructor(message) {
|
|
9864
|
-
|
|
9894
|
+
var _a;
|
|
9895
|
+
super(message !== null && message !== void 0 ? message : "operation not supported");
|
|
9865
9896
|
this.name = this.constructor.name;
|
|
9866
|
-
Error.captureStackTrace
|
|
9897
|
+
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
|
9867
9898
|
}
|
|
9868
9899
|
};
|
|
9869
9900
|
var OperationProcessingError = class extends Error {
|
|
9870
9901
|
constructor(message) {
|
|
9902
|
+
var _a;
|
|
9871
9903
|
super(message);
|
|
9872
9904
|
this.name = this.constructor.name;
|
|
9873
|
-
Error.captureStackTrace
|
|
9905
|
+
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
|
9874
9906
|
}
|
|
9875
9907
|
};
|
|
9876
9908
|
function psAlg(key) {
|
|
@@ -9906,7 +9938,7 @@
|
|
|
9906
9938
|
case "ECDSA":
|
|
9907
9939
|
return esAlg(key);
|
|
9908
9940
|
case "Ed25519":
|
|
9909
|
-
return "
|
|
9941
|
+
return "Ed25519";
|
|
9910
9942
|
default:
|
|
9911
9943
|
throw new UnsupportedOperationError("unsupported CryptoKey algorithm name");
|
|
9912
9944
|
}
|
|
@@ -9923,9 +9955,9 @@
|
|
|
9923
9955
|
function epochTime() {
|
|
9924
9956
|
return Math.floor(Date.now() / 1e3);
|
|
9925
9957
|
}
|
|
9926
|
-
async function
|
|
9927
|
-
const privateKey = keypair
|
|
9928
|
-
const publicKey = keypair
|
|
9958
|
+
async function generateProof(keypair, htu, htm, nonce, accessToken, additional) {
|
|
9959
|
+
const privateKey = keypair === null || keypair === void 0 ? void 0 : keypair.privateKey;
|
|
9960
|
+
const publicKey = keypair === null || keypair === void 0 ? void 0 : keypair.publicKey;
|
|
9929
9961
|
if (!isPrivateKey(privateKey)) {
|
|
9930
9962
|
throw new TypeError('"keypair.privateKey" must be a private CryptoKey');
|
|
9931
9963
|
}
|
|
@@ -9954,21 +9986,21 @@
|
|
|
9954
9986
|
alg: determineJWSAlgorithm(privateKey),
|
|
9955
9987
|
typ: "dpop+jwt",
|
|
9956
9988
|
jwk: await publicJwk(publicKey)
|
|
9957
|
-
}, {
|
|
9958
|
-
...additional,
|
|
9989
|
+
}, Object.assign(Object.assign({}, additional), {
|
|
9959
9990
|
iat: epochTime(),
|
|
9960
|
-
jti:
|
|
9991
|
+
jti: crypto.randomUUID(),
|
|
9961
9992
|
htm,
|
|
9962
9993
|
nonce,
|
|
9963
9994
|
htu,
|
|
9964
9995
|
ath: accessToken ? b64u(await crypto.subtle.digest("SHA-256", buf(accessToken))) : void 0
|
|
9965
|
-
}, privateKey);
|
|
9996
|
+
}), privateKey);
|
|
9966
9997
|
}
|
|
9967
9998
|
async function publicJwk(key) {
|
|
9968
9999
|
const { kty, e, n, x, y, crv } = await crypto.subtle.exportKey("jwk", key);
|
|
9969
10000
|
return { kty, crv, e, n, x, y };
|
|
9970
10001
|
}
|
|
9971
10002
|
async function generateKeyPair(alg, options) {
|
|
10003
|
+
var _a;
|
|
9972
10004
|
let algorithm;
|
|
9973
10005
|
if (typeof alg !== "string" || alg.length === 0) {
|
|
9974
10006
|
throw new TypeError('"alg" must be a non-empty string');
|
|
@@ -9978,7 +10010,7 @@
|
|
|
9978
10010
|
algorithm = {
|
|
9979
10011
|
name: "RSA-PSS",
|
|
9980
10012
|
hash: "SHA-256",
|
|
9981
|
-
modulusLength:
|
|
10013
|
+
modulusLength: 2048,
|
|
9982
10014
|
publicExponent: new Uint8Array([1, 0, 1])
|
|
9983
10015
|
};
|
|
9984
10016
|
break;
|
|
@@ -9986,20 +10018,20 @@
|
|
|
9986
10018
|
algorithm = {
|
|
9987
10019
|
name: "RSASSA-PKCS1-v1_5",
|
|
9988
10020
|
hash: "SHA-256",
|
|
9989
|
-
modulusLength:
|
|
10021
|
+
modulusLength: 2048,
|
|
9990
10022
|
publicExponent: new Uint8Array([1, 0, 1])
|
|
9991
10023
|
};
|
|
9992
10024
|
break;
|
|
9993
10025
|
case "ES256":
|
|
9994
10026
|
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
9995
10027
|
break;
|
|
9996
|
-
case "
|
|
10028
|
+
case "Ed25519":
|
|
9997
10029
|
algorithm = { name: "Ed25519" };
|
|
9998
10030
|
break;
|
|
9999
10031
|
default:
|
|
10000
10032
|
throw new UnsupportedOperationError();
|
|
10001
10033
|
}
|
|
10002
|
-
return crypto.subtle.generateKey(algorithm, options
|
|
10034
|
+
return crypto.subtle.generateKey(algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, ["sign", "verify"]);
|
|
10003
10035
|
}
|
|
10004
10036
|
|
|
10005
10037
|
// node_modules/@muze-nl/metro-oauth2/src/oauth2.dpop.mjs
|
|
@@ -10021,14 +10053,14 @@
|
|
|
10021
10053
|
}
|
|
10022
10054
|
const url2 = everything_default.url(req.url);
|
|
10023
10055
|
if (req.url.startsWith(options.authorization_endpoint)) {
|
|
10024
|
-
let
|
|
10025
|
-
if (
|
|
10026
|
-
|
|
10056
|
+
let params = req.body;
|
|
10057
|
+
if (params instanceof URLSearchParams || params instanceof FormData) {
|
|
10058
|
+
params.set("dpop_jkt", keyInfo.keyPair.publicKey);
|
|
10027
10059
|
} else {
|
|
10028
|
-
|
|
10060
|
+
params.dpop_jkt = keyInfo.keyPair.publicKey;
|
|
10029
10061
|
}
|
|
10030
10062
|
} else if (req.url.startsWith(options.token_endpoint)) {
|
|
10031
|
-
const dpopHeader = await
|
|
10063
|
+
const dpopHeader = await generateProof(keyInfo.keyPair, req.url, req.method);
|
|
10032
10064
|
req = req.with({
|
|
10033
10065
|
headers: {
|
|
10034
10066
|
"DPoP": dpopHeader
|
|
@@ -10037,7 +10069,7 @@
|
|
|
10037
10069
|
} else if (req.headers.has("Authorization")) {
|
|
10038
10070
|
const nonce = localStorage.getItem(url2.host + ":nonce") || void 0;
|
|
10039
10071
|
const accessToken = req.headers.get("Authorization").split(" ")[1];
|
|
10040
|
-
const dpopHeader = await
|
|
10072
|
+
const dpopHeader = await generateProof(keyInfo.keyPair, req.url, req.method, nonce, accessToken);
|
|
10041
10073
|
req = req.with({
|
|
10042
10074
|
headers: {
|
|
10043
10075
|
"Authorization": "DPoP " + accessToken,
|
|
@@ -10676,7 +10708,9 @@
|
|
|
10676
10708
|
nil: `${RDF}nil`,
|
|
10677
10709
|
first: `${RDF}first`,
|
|
10678
10710
|
rest: `${RDF}rest`,
|
|
10679
|
-
langString: `${RDF}langString
|
|
10711
|
+
langString: `${RDF}langString`,
|
|
10712
|
+
dirLangString: `${RDF}dirLangString`,
|
|
10713
|
+
reifies: `${RDF}reifies`
|
|
10680
10714
|
},
|
|
10681
10715
|
owl: {
|
|
10682
10716
|
sameAs: "http://www.w3.org/2002/07/owl#sameAs"
|
|
@@ -10729,6 +10763,7 @@
|
|
|
10729
10763
|
_unescapedIri: true,
|
|
10730
10764
|
_simpleQuotedString: true,
|
|
10731
10765
|
_langcode: true,
|
|
10766
|
+
_dircode: true,
|
|
10732
10767
|
_blank: true,
|
|
10733
10768
|
_newline: true,
|
|
10734
10769
|
_comment: true,
|
|
@@ -10742,15 +10777,16 @@
|
|
|
10742
10777
|
this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/;
|
|
10743
10778
|
this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/;
|
|
10744
10779
|
this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/;
|
|
10745
|
-
this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9
|
|
10780
|
+
this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i;
|
|
10781
|
+
this._dircode = /^--(ltr)|(rtl)/;
|
|
10746
10782
|
this._prefix = /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/;
|
|
10747
10783
|
this._prefixed = /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/;
|
|
10748
10784
|
this._variable = /^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/;
|
|
10749
10785
|
this._blank = /^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/;
|
|
10750
10786
|
this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/;
|
|
10751
10787
|
this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/;
|
|
10752
|
-
this.
|
|
10753
|
-
this.
|
|
10788
|
+
this._atKeyword = /^@[a-z]+(?=[\s#<:])/i;
|
|
10789
|
+
this._keyword = /^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i;
|
|
10754
10790
|
this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/;
|
|
10755
10791
|
this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/;
|
|
10756
10792
|
this._comment = /#([^\n\r]*)/;
|
|
@@ -10824,7 +10860,9 @@
|
|
|
10824
10860
|
if (value === null || illegalIriChars.test(value))
|
|
10825
10861
|
return reportSyntaxError(this);
|
|
10826
10862
|
type = "IRI";
|
|
10827
|
-
} else if (input.length >
|
|
10863
|
+
} else if (input.length > 2 && input[1] === "<" && input[2] === "(")
|
|
10864
|
+
type = "<<(", matchLength = 3;
|
|
10865
|
+
else if (!this._lineMode && input.length > (inputFinished ? 1 : 2) && input[1] === "<")
|
|
10828
10866
|
type = "<<", matchLength = 2;
|
|
10829
10867
|
else if (this._n3Mode && input.length > 1 && input[1] === "=") {
|
|
10830
10868
|
matchLength = 2;
|
|
@@ -10873,9 +10911,9 @@
|
|
|
10873
10911
|
type = "var", value = match[0];
|
|
10874
10912
|
break;
|
|
10875
10913
|
case "@":
|
|
10876
|
-
if (this._previousMarker === "literal" && (match = this._langcode.exec(input)))
|
|
10914
|
+
if (this._previousMarker === "literal" && (match = this._langcode.exec(input)) && match[1] !== "version")
|
|
10877
10915
|
type = "langcode", value = match[1];
|
|
10878
|
-
else if (match = this.
|
|
10916
|
+
else if (match = this._atKeyword.exec(input))
|
|
10879
10917
|
type = match[0];
|
|
10880
10918
|
break;
|
|
10881
10919
|
case ".":
|
|
@@ -10897,6 +10935,11 @@
|
|
|
10897
10935
|
case "9":
|
|
10898
10936
|
case "+":
|
|
10899
10937
|
case "-":
|
|
10938
|
+
if (input[1] === "-") {
|
|
10939
|
+
if (this._previousMarker === "langcode" && (match = this._dircode.exec(input)))
|
|
10940
|
+
type = "dircode", matchLength = 2, value = match[1] || match[2], matchLength = value.length + 2;
|
|
10941
|
+
break;
|
|
10942
|
+
}
|
|
10900
10943
|
if (match = this._number.exec(input) || inputFinished && (match = this._number.exec(`${input} `))) {
|
|
10901
10944
|
type = "literal", value = match[0];
|
|
10902
10945
|
prefix2 = typeof match[1] === "string" ? xsd.double : typeof match[2] === "string" ? xsd.decimal : xsd.integer;
|
|
@@ -10908,7 +10951,9 @@
|
|
|
10908
10951
|
case "P":
|
|
10909
10952
|
case "G":
|
|
10910
10953
|
case "g":
|
|
10911
|
-
|
|
10954
|
+
case "V":
|
|
10955
|
+
case "v":
|
|
10956
|
+
if (match = this._keyword.exec(input))
|
|
10912
10957
|
type = match[0].toUpperCase();
|
|
10913
10958
|
else
|
|
10914
10959
|
inconclusive = true;
|
|
@@ -10938,13 +10983,21 @@
|
|
|
10938
10983
|
case "!":
|
|
10939
10984
|
if (!this._n3Mode)
|
|
10940
10985
|
break;
|
|
10986
|
+
case ")":
|
|
10987
|
+
if (!inputFinished && (input.length === 1 || input.length === 2 && input[1] === ">")) {
|
|
10988
|
+
break;
|
|
10989
|
+
}
|
|
10990
|
+
if (input.length > 2 && input[1] === ">" && input[2] === ">") {
|
|
10991
|
+
type = ")>>", matchLength = 3;
|
|
10992
|
+
break;
|
|
10993
|
+
}
|
|
10941
10994
|
case ",":
|
|
10942
10995
|
case ";":
|
|
10943
10996
|
case "[":
|
|
10944
10997
|
case "]":
|
|
10945
10998
|
case "(":
|
|
10946
|
-
case ")":
|
|
10947
10999
|
case "}":
|
|
11000
|
+
case "~":
|
|
10948
11001
|
if (!this._lineMode) {
|
|
10949
11002
|
matchLength = 1;
|
|
10950
11003
|
type = firstChar;
|
|
@@ -11171,7 +11224,15 @@
|
|
|
11171
11224
|
get language() {
|
|
11172
11225
|
const id = this.id;
|
|
11173
11226
|
let atPos = id.lastIndexOf('"') + 1;
|
|
11174
|
-
|
|
11227
|
+
const dirPos = id.lastIndexOf("--");
|
|
11228
|
+
return atPos < id.length && id[atPos++] === "@" ? (dirPos > atPos ? id.substr(0, dirPos) : id).substr(atPos).toLowerCase() : "";
|
|
11229
|
+
}
|
|
11230
|
+
// ### The direction of this literal
|
|
11231
|
+
get direction() {
|
|
11232
|
+
const id = this.id;
|
|
11233
|
+
const endPos = id.lastIndexOf('"');
|
|
11234
|
+
const dirPos = id.lastIndexOf("--");
|
|
11235
|
+
return dirPos > endPos && dirPos + 2 < id.length ? id.substr(dirPos + 2).toLowerCase() : "";
|
|
11175
11236
|
}
|
|
11176
11237
|
// ### The datatype IRI of this literal
|
|
11177
11238
|
get datatype() {
|
|
@@ -11182,21 +11243,22 @@
|
|
|
11182
11243
|
const id = this.id, dtPos = id.lastIndexOf('"') + 1;
|
|
11183
11244
|
const char = dtPos < id.length ? id[dtPos] : "";
|
|
11184
11245
|
return char === "^" ? id.substr(dtPos + 2) : (
|
|
11185
|
-
// If "@" follows, return rdf:langString; xsd:string otherwise
|
|
11186
|
-
char !== "@" ? xsd2.string : rdf.langString
|
|
11246
|
+
// If "@" follows, return rdf:langString or rdf:dirLangString; xsd:string otherwise
|
|
11247
|
+
char !== "@" ? xsd2.string : id.indexOf("--", dtPos) > 0 ? rdf.dirLangString : rdf.langString
|
|
11187
11248
|
);
|
|
11188
11249
|
}
|
|
11189
11250
|
// ### Returns whether this object represents the same term as the other
|
|
11190
11251
|
equals(other) {
|
|
11191
11252
|
if (other instanceof _Literal)
|
|
11192
11253
|
return this.id === other.id;
|
|
11193
|
-
return !!other && !!other.datatype && this.termType === other.termType && this.value === other.value && this.language === other.language && this.datatype.value === other.datatype.value;
|
|
11254
|
+
return !!other && !!other.datatype && this.termType === other.termType && this.value === other.value && this.language === other.language && (this.direction === other.direction || this.direction === "" && !other.direction) && this.datatype.value === other.datatype.value;
|
|
11194
11255
|
}
|
|
11195
11256
|
toJSON() {
|
|
11196
11257
|
return {
|
|
11197
11258
|
termType: this.termType,
|
|
11198
11259
|
value: this.value,
|
|
11199
11260
|
language: this.language,
|
|
11261
|
+
direction: this.direction,
|
|
11200
11262
|
datatype: { termType: "NamedNode", value: this.datatypeString }
|
|
11201
11263
|
};
|
|
11202
11264
|
}
|
|
@@ -11257,9 +11319,22 @@
|
|
|
11257
11319
|
if (id[id.length - 1] === '"')
|
|
11258
11320
|
return factory.literal(id.substr(1, id.length - 2));
|
|
11259
11321
|
const endPos = id.lastIndexOf('"', id.length - 1);
|
|
11322
|
+
let languageOrDatatype;
|
|
11323
|
+
if (id[endPos + 1] === "@") {
|
|
11324
|
+
languageOrDatatype = id.substr(endPos + 2);
|
|
11325
|
+
const dashDashIndex = languageOrDatatype.lastIndexOf("--");
|
|
11326
|
+
if (dashDashIndex > 0 && dashDashIndex < languageOrDatatype.length) {
|
|
11327
|
+
languageOrDatatype = {
|
|
11328
|
+
language: languageOrDatatype.substr(0, dashDashIndex),
|
|
11329
|
+
direction: languageOrDatatype.substr(dashDashIndex + 2)
|
|
11330
|
+
};
|
|
11331
|
+
}
|
|
11332
|
+
} else {
|
|
11333
|
+
languageOrDatatype = factory.namedNode(id.substr(endPos + 3));
|
|
11334
|
+
}
|
|
11260
11335
|
return factory.literal(
|
|
11261
11336
|
id.substr(1, endPos - 1),
|
|
11262
|
-
|
|
11337
|
+
languageOrDatatype
|
|
11263
11338
|
);
|
|
11264
11339
|
case "[":
|
|
11265
11340
|
id = JSON.parse(id);
|
|
@@ -11293,7 +11368,7 @@
|
|
|
11293
11368
|
case "DefaultGraph":
|
|
11294
11369
|
return "";
|
|
11295
11370
|
case "Literal":
|
|
11296
|
-
return `"${term.value}"${term.language ? `@${term.language}` : term.datatype && term.datatype.value !== xsd2.string ? `^^${term.datatype.value}` : ""}`;
|
|
11371
|
+
return `"${term.value}"${term.language ? `@${term.language}${term.direction ? `--${term.direction}` : ""}` : term.datatype && term.datatype.value !== xsd2.string ? `^^${term.datatype.value}` : ""}`;
|
|
11297
11372
|
case "Quad":
|
|
11298
11373
|
const res = [
|
|
11299
11374
|
termToId(term.subject, true),
|
|
@@ -11356,6 +11431,9 @@
|
|
|
11356
11431
|
function literal(value, languageOrDataType) {
|
|
11357
11432
|
if (typeof languageOrDataType === "string")
|
|
11358
11433
|
return new Literal(`"${value}"@${languageOrDataType.toLowerCase()}`);
|
|
11434
|
+
if (languageOrDataType !== void 0 && !("termType" in languageOrDataType)) {
|
|
11435
|
+
return new Literal(`"${value}"@${languageOrDataType.language.toLowerCase()}${languageOrDataType.direction ? `--${languageOrDataType.direction.toLowerCase()}` : ""}`);
|
|
11436
|
+
}
|
|
11359
11437
|
let datatype = languageOrDataType ? languageOrDataType.value : "";
|
|
11360
11438
|
if (datatype === "") {
|
|
11361
11439
|
if (typeof value === "boolean")
|
|
@@ -11411,7 +11489,7 @@
|
|
|
11411
11489
|
|
|
11412
11490
|
// node_modules/n3/src/N3Parser.js
|
|
11413
11491
|
var blankNodePrefix = 0;
|
|
11414
|
-
var N3Parser = class {
|
|
11492
|
+
var N3Parser = class _N3Parser {
|
|
11415
11493
|
constructor(options) {
|
|
11416
11494
|
this._contextStack = [];
|
|
11417
11495
|
this._graph = null;
|
|
@@ -11423,7 +11501,6 @@
|
|
|
11423
11501
|
this._readPredicateOrNamedGraph = this._readPredicate;
|
|
11424
11502
|
this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);
|
|
11425
11503
|
this._isImpliedBy = options.isImpliedBy;
|
|
11426
|
-
this._supportsRDFStar = format === "" || /star|\*$/.test(format);
|
|
11427
11504
|
if (isLineMode)
|
|
11428
11505
|
this._resolveRelativeIRI = (iri) => {
|
|
11429
11506
|
return null;
|
|
@@ -11431,6 +11508,8 @@
|
|
|
11431
11508
|
this._blankNodePrefix = typeof options.blankNodePrefix !== "string" ? "" : options.blankNodePrefix.replace(/^(?!_:)/, "_:");
|
|
11432
11509
|
this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });
|
|
11433
11510
|
this._explicitQuantifiers = !!options.explicitQuantifiers;
|
|
11511
|
+
this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
|
|
11512
|
+
this._version = options.version;
|
|
11434
11513
|
}
|
|
11435
11514
|
// ## Static class methods
|
|
11436
11515
|
// ### `_resetBlankNodePrefix` restarts blank node prefix identification
|
|
@@ -11490,6 +11569,12 @@
|
|
|
11490
11569
|
this._quantified = context.quantified;
|
|
11491
11570
|
}
|
|
11492
11571
|
}
|
|
11572
|
+
// ### `_readBeforeTopContext` is called once only at the start of parsing.
|
|
11573
|
+
_readBeforeTopContext(token) {
|
|
11574
|
+
if (this._version && !this._isValidVersion(this._version))
|
|
11575
|
+
return this._error(`Detected unsupported version as media type parameter: "${this._version}"`, token);
|
|
11576
|
+
return this._readInTopContext(token);
|
|
11577
|
+
}
|
|
11493
11578
|
// ### `_readInTopContext` reads a token when in the top context
|
|
11494
11579
|
_readInTopContext(token) {
|
|
11495
11580
|
switch (token.type) {
|
|
@@ -11509,6 +11594,11 @@
|
|
|
11509
11594
|
this._sparqlStyle = true;
|
|
11510
11595
|
case "@base":
|
|
11511
11596
|
return this._readBaseIRI;
|
|
11597
|
+
// It could be a version declaration
|
|
11598
|
+
case "VERSION":
|
|
11599
|
+
this._sparqlStyle = true;
|
|
11600
|
+
case "@version":
|
|
11601
|
+
return this._readVersion;
|
|
11512
11602
|
// It could be a graph
|
|
11513
11603
|
case "{":
|
|
11514
11604
|
if (this._supportsNamedGraphs) {
|
|
@@ -11574,6 +11664,10 @@
|
|
|
11574
11664
|
);
|
|
11575
11665
|
return this._readBlankNodeHead;
|
|
11576
11666
|
case "(":
|
|
11667
|
+
const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];
|
|
11668
|
+
if (parent.type === "<<") {
|
|
11669
|
+
return this._error("Unexpected list in reified triple", token);
|
|
11670
|
+
}
|
|
11577
11671
|
this._saveContext("list", this._graph, this.RDF_NIL, null, null);
|
|
11578
11672
|
this._subject = null;
|
|
11579
11673
|
return this._readListItem;
|
|
@@ -11613,9 +11707,13 @@
|
|
|
11613
11707
|
} else
|
|
11614
11708
|
this._subject = this._factory.literal(token.value, this._factory.namedNode(token.prefix));
|
|
11615
11709
|
break;
|
|
11710
|
+
case "<<(":
|
|
11711
|
+
if (!this._n3Mode)
|
|
11712
|
+
return this._error("Disallowed triple term as subject", token);
|
|
11713
|
+
this._saveContext("<<(", this._graph, null, null, null);
|
|
11714
|
+
this._graph = null;
|
|
11715
|
+
return this._readSubject;
|
|
11616
11716
|
case "<<":
|
|
11617
|
-
if (!this._supportsRDFStar)
|
|
11618
|
-
return this._error("Unexpected RDF-star syntax", token);
|
|
11619
11717
|
this._saveContext("<<", this._graph, null, null, null);
|
|
11620
11718
|
this._graph = null;
|
|
11621
11719
|
return this._readSubject;
|
|
@@ -11639,6 +11737,7 @@
|
|
|
11639
11737
|
case ".":
|
|
11640
11738
|
case "]":
|
|
11641
11739
|
case "}":
|
|
11740
|
+
case "|}":
|
|
11642
11741
|
if (this._predicate === null)
|
|
11643
11742
|
return this._error(`Unexpected ${type}`, token);
|
|
11644
11743
|
this._subject = null;
|
|
@@ -11663,6 +11762,7 @@
|
|
|
11663
11762
|
if ((this._predicate = this._readEntity(token)) === void 0)
|
|
11664
11763
|
return;
|
|
11665
11764
|
}
|
|
11765
|
+
this._validAnnotation = true;
|
|
11666
11766
|
return this._readObject;
|
|
11667
11767
|
}
|
|
11668
11768
|
// ### `_readObject` reads a quad's object
|
|
@@ -11685,6 +11785,10 @@
|
|
|
11685
11785
|
);
|
|
11686
11786
|
return this._readBlankNodeHead;
|
|
11687
11787
|
case "(":
|
|
11788
|
+
const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];
|
|
11789
|
+
if (parent.type === "<<") {
|
|
11790
|
+
return this._error("Unexpected list in reified triple", token);
|
|
11791
|
+
}
|
|
11688
11792
|
this._saveContext("list", this._graph, this._subject, this._predicate, this.RDF_NIL);
|
|
11689
11793
|
this._subject = null;
|
|
11690
11794
|
return this._readListItem;
|
|
@@ -11699,9 +11803,11 @@
|
|
|
11699
11803
|
this._graph = this._factory.blankNode()
|
|
11700
11804
|
);
|
|
11701
11805
|
return this._readSubject;
|
|
11806
|
+
case "<<(":
|
|
11807
|
+
this._saveContext("<<(", this._graph, this._subject, this._predicate, null);
|
|
11808
|
+
this._graph = null;
|
|
11809
|
+
return this._readSubject;
|
|
11702
11810
|
case "<<":
|
|
11703
|
-
if (!this._supportsRDFStar)
|
|
11704
|
-
return this._error("Unexpected RDF-star syntax", token);
|
|
11705
11811
|
this._saveContext("<<", this._graph, this._subject, this._predicate, null);
|
|
11706
11812
|
this._graph = null;
|
|
11707
11813
|
return this._readSubject;
|
|
@@ -11730,6 +11836,10 @@
|
|
|
11730
11836
|
this._subject = null;
|
|
11731
11837
|
return this._readBlankNodeTail(token);
|
|
11732
11838
|
} else {
|
|
11839
|
+
const stack = this._contextStack, parentParent = stack.length > 1 && stack[stack.length - 2];
|
|
11840
|
+
if (parentParent.type === "<<") {
|
|
11841
|
+
return this._error("Unexpected compound blank node expression in reified triple", token);
|
|
11842
|
+
}
|
|
11733
11843
|
this._predicate = null;
|
|
11734
11844
|
return this._readPredicate(token);
|
|
11735
11845
|
}
|
|
@@ -11820,12 +11930,19 @@
|
|
|
11820
11930
|
this._graph = this._factory.blankNode()
|
|
11821
11931
|
);
|
|
11822
11932
|
return this._readSubject;
|
|
11933
|
+
case "<<":
|
|
11934
|
+
this._saveContext("<<", this._graph, null, null, null);
|
|
11935
|
+
this._graph = null;
|
|
11936
|
+
next = this._readSubject;
|
|
11937
|
+
break;
|
|
11823
11938
|
default:
|
|
11824
11939
|
if ((item = this._readEntity(token)) === void 0)
|
|
11825
11940
|
return;
|
|
11826
11941
|
}
|
|
11827
11942
|
if (list === null)
|
|
11828
11943
|
this._subject = list = this._factory.blankNode();
|
|
11944
|
+
if (token.type === "<<")
|
|
11945
|
+
stack[stack.length - 1].subject = this._subject;
|
|
11829
11946
|
if (previousList === null) {
|
|
11830
11947
|
if (parent.predicate === null)
|
|
11831
11948
|
parent.subject = list;
|
|
@@ -11853,43 +11970,73 @@
|
|
|
11853
11970
|
return this._completeObjectLiteral(token, true);
|
|
11854
11971
|
}
|
|
11855
11972
|
// ### `_completeLiteral` completes a literal with an optional datatype or language
|
|
11856
|
-
_completeLiteral(token) {
|
|
11973
|
+
_completeLiteral(token, component) {
|
|
11857
11974
|
let literal2 = this._factory.literal(this._literalValue);
|
|
11975
|
+
let readCb;
|
|
11858
11976
|
switch (token.type) {
|
|
11859
11977
|
// Create a datatyped literal
|
|
11860
11978
|
case "type":
|
|
11861
11979
|
case "typeIRI":
|
|
11862
11980
|
const datatype = this._readEntity(token);
|
|
11863
11981
|
if (datatype === void 0) return;
|
|
11982
|
+
if (datatype.value === IRIs_default.rdf.langString || datatype.value === IRIs_default.rdf.dirLangString) {
|
|
11983
|
+
return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype", token);
|
|
11984
|
+
}
|
|
11864
11985
|
literal2 = this._factory.literal(this._literalValue, datatype);
|
|
11865
11986
|
token = null;
|
|
11866
11987
|
break;
|
|
11867
11988
|
// Create a language-tagged string
|
|
11868
11989
|
case "langcode":
|
|
11990
|
+
if (token.value.split("-").some((t) => t.length > 8))
|
|
11991
|
+
return this._error("Detected language tag with subtag longer than 8 characters", token);
|
|
11869
11992
|
literal2 = this._factory.literal(this._literalValue, token.value);
|
|
11993
|
+
this._literalLanguage = token.value;
|
|
11870
11994
|
token = null;
|
|
11995
|
+
readCb = this._readDirCode.bind(this, component);
|
|
11871
11996
|
break;
|
|
11872
11997
|
}
|
|
11873
|
-
return { token, literal: literal2 };
|
|
11998
|
+
return { token, literal: literal2, readCb };
|
|
11999
|
+
}
|
|
12000
|
+
_readDirCode(component, listItem, token) {
|
|
12001
|
+
if (token.type === "dircode") {
|
|
12002
|
+
const term = this._factory.literal(this._literalValue, { language: this._literalLanguage, direction: token.value });
|
|
12003
|
+
if (component === "subject")
|
|
12004
|
+
this._subject = term;
|
|
12005
|
+
else
|
|
12006
|
+
this._object = term;
|
|
12007
|
+
this._literalLanguage = void 0;
|
|
12008
|
+
token = null;
|
|
12009
|
+
}
|
|
12010
|
+
if (component === "subject")
|
|
12011
|
+
return token === null ? this._readPredicateOrNamedGraph : this._readPredicateOrNamedGraph(token);
|
|
12012
|
+
return this._completeObjectLiteralPost(token, listItem);
|
|
11874
12013
|
}
|
|
11875
12014
|
// Completes a literal in subject position
|
|
11876
12015
|
_completeSubjectLiteral(token) {
|
|
11877
|
-
|
|
12016
|
+
const completed = this._completeLiteral(token, "subject");
|
|
12017
|
+
this._subject = completed.literal;
|
|
12018
|
+
if (completed.readCb)
|
|
12019
|
+
return completed.readCb.bind(this, false);
|
|
11878
12020
|
return this._readPredicateOrNamedGraph;
|
|
11879
12021
|
}
|
|
11880
12022
|
// Completes a literal in object position
|
|
11881
12023
|
_completeObjectLiteral(token, listItem) {
|
|
11882
|
-
const completed = this._completeLiteral(token);
|
|
12024
|
+
const completed = this._completeLiteral(token, "object");
|
|
11883
12025
|
if (!completed)
|
|
11884
12026
|
return;
|
|
11885
12027
|
this._object = completed.literal;
|
|
12028
|
+
if (completed.readCb)
|
|
12029
|
+
return completed.readCb.bind(this, listItem);
|
|
12030
|
+
return this._completeObjectLiteralPost(completed.token, listItem);
|
|
12031
|
+
}
|
|
12032
|
+
_completeObjectLiteralPost(token, listItem) {
|
|
11886
12033
|
if (listItem)
|
|
11887
12034
|
this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);
|
|
11888
|
-
if (
|
|
12035
|
+
if (token === null)
|
|
11889
12036
|
return this._getContextEndReader();
|
|
11890
12037
|
else {
|
|
11891
12038
|
this._readCallback = this._getContextEndReader();
|
|
11892
|
-
return this._readCallback(
|
|
12039
|
+
return this._readCallback(token);
|
|
11893
12040
|
}
|
|
11894
12041
|
}
|
|
11895
12042
|
// ### `_readFormulaTail` reads the end of a formula
|
|
@@ -11903,7 +12050,7 @@
|
|
|
11903
12050
|
}
|
|
11904
12051
|
// ### `_readPunctuation` reads punctuation between quads or quad parts
|
|
11905
12052
|
_readPunctuation(token) {
|
|
11906
|
-
let next, graph = this._graph;
|
|
12053
|
+
let next, graph = this._graph, startingAnnotation = false;
|
|
11907
12054
|
const subject = this._subject, inversePredicate = this._inversePredicate;
|
|
11908
12055
|
switch (token.type) {
|
|
11909
12056
|
// A closing brace ends a graph
|
|
@@ -11916,6 +12063,7 @@
|
|
|
11916
12063
|
// A dot just ends the statement, without sharing anything with the next
|
|
11917
12064
|
case ".":
|
|
11918
12065
|
this._subject = null;
|
|
12066
|
+
this._tripleTerm = null;
|
|
11919
12067
|
next = this._contextStack.length ? this._readSubject : this._readInTopContext;
|
|
11920
12068
|
if (inversePredicate) this._inversePredicate = false;
|
|
11921
12069
|
break;
|
|
@@ -11927,19 +12075,26 @@
|
|
|
11927
12075
|
case ",":
|
|
11928
12076
|
next = this._readObject;
|
|
11929
12077
|
break;
|
|
12078
|
+
// ~ is allowed in the annotation syntax
|
|
12079
|
+
case "~":
|
|
12080
|
+
next = this._readReifierInAnnotation;
|
|
12081
|
+
startingAnnotation = true;
|
|
12082
|
+
break;
|
|
11930
12083
|
// {| means that the current triple is annotated with predicate-object pairs.
|
|
11931
12084
|
case "{|":
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
this._subject = this._factory.quad(subject, predicate, object, this.DEFAULTGRAPH);
|
|
12085
|
+
this._subject = this._readTripleTerm();
|
|
12086
|
+
this._validAnnotation = false;
|
|
12087
|
+
startingAnnotation = true;
|
|
11936
12088
|
next = this._readPredicate;
|
|
11937
12089
|
break;
|
|
11938
|
-
// |} means that the current
|
|
12090
|
+
// |} means that the current reified triple in annotation syntax is finalized.
|
|
11939
12091
|
case "|}":
|
|
11940
|
-
if (this.
|
|
11941
|
-
return this._error("Unexpected
|
|
12092
|
+
if (!this._annotation)
|
|
12093
|
+
return this._error("Unexpected annotation syntax closing", token);
|
|
12094
|
+
if (!this._validAnnotation)
|
|
12095
|
+
return this._error("Annotation block can not be empty", token);
|
|
11942
12096
|
this._subject = null;
|
|
12097
|
+
this._annotation = false;
|
|
11943
12098
|
next = this._readPunctuation;
|
|
11944
12099
|
break;
|
|
11945
12100
|
default:
|
|
@@ -11949,13 +12104,16 @@
|
|
|
11949
12104
|
}
|
|
11950
12105
|
return this._error(`Expected punctuation to follow "${this._object.id}"`, token);
|
|
11951
12106
|
}
|
|
11952
|
-
if (subject !== null) {
|
|
12107
|
+
if (subject !== null && (!startingAnnotation || startingAnnotation && !this._annotation)) {
|
|
11953
12108
|
const predicate = this._predicate, object = this._object;
|
|
11954
12109
|
if (!inversePredicate)
|
|
11955
12110
|
this._emit(subject, predicate, object, graph);
|
|
11956
12111
|
else
|
|
11957
12112
|
this._emit(object, predicate, subject, graph);
|
|
11958
12113
|
}
|
|
12114
|
+
if (startingAnnotation) {
|
|
12115
|
+
this._annotation = true;
|
|
12116
|
+
}
|
|
11959
12117
|
return next;
|
|
11960
12118
|
}
|
|
11961
12119
|
// ### `_readBlankNodePunctuation` reads punctuation in a blank node
|
|
@@ -12006,6 +12164,21 @@
|
|
|
12006
12164
|
this._setBase(iri);
|
|
12007
12165
|
return this._readDeclarationPunctuation;
|
|
12008
12166
|
}
|
|
12167
|
+
// ### `_isValidVersion` checks if the given version is valid for this parser to handle.
|
|
12168
|
+
_isValidVersion(version) {
|
|
12169
|
+
return this._parseUnsupportedVersions || _N3Parser.SUPPORTED_VERSIONS.includes(version);
|
|
12170
|
+
}
|
|
12171
|
+
// ### `_readVersion` reads version string declaration
|
|
12172
|
+
_readVersion(token) {
|
|
12173
|
+
if (token.type !== "literal")
|
|
12174
|
+
return this._error("Expected literal to follow version declaration", token);
|
|
12175
|
+
if (token.end - token.start !== token.value.length + 2)
|
|
12176
|
+
return this._error("Version declarations must use single quotes", token);
|
|
12177
|
+
this._versionCallback(token.value);
|
|
12178
|
+
if (!this._isValidVersion(token.value))
|
|
12179
|
+
return this._error(`Detected unsupported version: "${token.value}"`, token);
|
|
12180
|
+
return this._readDeclarationPunctuation;
|
|
12181
|
+
}
|
|
12009
12182
|
// ### `_readNamedGraphLabel` reads the label of a named graph
|
|
12010
12183
|
_readNamedGraphLabel(token) {
|
|
12011
12184
|
switch (token.type) {
|
|
@@ -12132,26 +12305,17 @@
|
|
|
12132
12305
|
this._emit(subject, predicate, object, this._graph);
|
|
12133
12306
|
return this._readPath;
|
|
12134
12307
|
}
|
|
12135
|
-
// ### `
|
|
12136
|
-
|
|
12137
|
-
if (token.type !== ">>")
|
|
12138
|
-
|
|
12139
|
-
return this._readRDFStarTail;
|
|
12140
|
-
return this._error(`Expected >> to follow "${this._object.id}"`, token);
|
|
12141
|
-
}
|
|
12142
|
-
return this._readRDFStarTail(token);
|
|
12143
|
-
}
|
|
12144
|
-
// ### `_readRDFStarTail` reads the end of a nested RDF-star triple
|
|
12145
|
-
_readRDFStarTail(token) {
|
|
12146
|
-
if (token.type !== ">>")
|
|
12147
|
-
return this._error(`Expected >> but got ${token.type}`, token);
|
|
12308
|
+
// ### `_readTripleTermTail` reads the end of a triple term
|
|
12309
|
+
_readTripleTermTail(token) {
|
|
12310
|
+
if (token.type !== ")>>")
|
|
12311
|
+
return this._error(`Expected )>> but got ${token.type}`, token);
|
|
12148
12312
|
const quad2 = this._factory.quad(
|
|
12149
12313
|
this._subject,
|
|
12150
12314
|
this._predicate,
|
|
12151
12315
|
this._object,
|
|
12152
12316
|
this._graph || this.DEFAULTGRAPH
|
|
12153
12317
|
);
|
|
12154
|
-
this._restoreContext("<<", token);
|
|
12318
|
+
this._restoreContext("<<(", token);
|
|
12155
12319
|
if (this._subject === null) {
|
|
12156
12320
|
this._subject = quad2;
|
|
12157
12321
|
return this._readPredicate;
|
|
@@ -12160,6 +12324,63 @@
|
|
|
12160
12324
|
return this._getContextEndReader();
|
|
12161
12325
|
}
|
|
12162
12326
|
}
|
|
12327
|
+
// ### `_readReifiedTripleTailOrReifier` reads a reifier or the end of a nested reified triple
|
|
12328
|
+
_readReifiedTripleTailOrReifier(token) {
|
|
12329
|
+
if (token.type === "~") {
|
|
12330
|
+
return this._readReifier;
|
|
12331
|
+
}
|
|
12332
|
+
return this._readReifiedTripleTail(token);
|
|
12333
|
+
}
|
|
12334
|
+
// ### `_readReifiedTripleTail` reads the end of a nested reified triple
|
|
12335
|
+
_readReifiedTripleTail(token) {
|
|
12336
|
+
if (token.type !== ">>")
|
|
12337
|
+
return this._error(`Expected >> but got ${token.type}`, token);
|
|
12338
|
+
this._tripleTerm = null;
|
|
12339
|
+
const reifier = this._readTripleTerm();
|
|
12340
|
+
this._restoreContext("<<", token);
|
|
12341
|
+
const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];
|
|
12342
|
+
if (parent && parent.type === "list") {
|
|
12343
|
+
this._emit(this._subject, this.RDF_FIRST, reifier, this._graph);
|
|
12344
|
+
return this._getContextEndReader();
|
|
12345
|
+
} else if (this._subject === null) {
|
|
12346
|
+
this._subject = reifier;
|
|
12347
|
+
return this._readPredicateOrReifierTripleEnd;
|
|
12348
|
+
} else {
|
|
12349
|
+
this._object = reifier;
|
|
12350
|
+
return this._getContextEndReader();
|
|
12351
|
+
}
|
|
12352
|
+
}
|
|
12353
|
+
_readPredicateOrReifierTripleEnd(token) {
|
|
12354
|
+
if (token.type === ".") {
|
|
12355
|
+
this._subject = null;
|
|
12356
|
+
return this._readPunctuation(token);
|
|
12357
|
+
}
|
|
12358
|
+
return this._readPredicate(token);
|
|
12359
|
+
}
|
|
12360
|
+
// ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
|
|
12361
|
+
_readReifier(token) {
|
|
12362
|
+
this._reifier = this._readEntity(token);
|
|
12363
|
+
return this._readReifiedTripleTail;
|
|
12364
|
+
}
|
|
12365
|
+
// ### `_readReifier` reads the optional triple term identifier after a tilde when in annotation syntax.
|
|
12366
|
+
_readReifierInAnnotation(token) {
|
|
12367
|
+
if (token.type === "IRI" || token.type === "typeIRI" || token.type === "type" || token.type === "prefixed" || token.type === "blank" || token.type === "var") {
|
|
12368
|
+
this._reifier = this._readEntity(token);
|
|
12369
|
+
return this._readPunctuation;
|
|
12370
|
+
}
|
|
12371
|
+
this._readTripleTerm();
|
|
12372
|
+
this._subject = null;
|
|
12373
|
+
return this._readPunctuation(token);
|
|
12374
|
+
}
|
|
12375
|
+
_readTripleTerm() {
|
|
12376
|
+
const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];
|
|
12377
|
+
const parentGraph = parent ? parent.graph : void 0;
|
|
12378
|
+
const reifier = this._reifier || this._factory.blankNode();
|
|
12379
|
+
this._reifier = null;
|
|
12380
|
+
this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
|
|
12381
|
+
this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
|
|
12382
|
+
return reifier;
|
|
12383
|
+
}
|
|
12163
12384
|
// ### `_getContextEndReader` gets the next reader function at the end of a context
|
|
12164
12385
|
_getContextEndReader() {
|
|
12165
12386
|
const contextStack = this._contextStack;
|
|
@@ -12172,8 +12393,10 @@
|
|
|
12172
12393
|
return this._readListItem;
|
|
12173
12394
|
case "formula":
|
|
12174
12395
|
return this._readFormulaTail;
|
|
12396
|
+
case "<<(":
|
|
12397
|
+
return this._readTripleTermTail;
|
|
12175
12398
|
case "<<":
|
|
12176
|
-
return this.
|
|
12399
|
+
return this._readReifiedTripleTailOrReifier;
|
|
12177
12400
|
}
|
|
12178
12401
|
}
|
|
12179
12402
|
// ### `_emit` sends a quad through the callback
|
|
@@ -12271,21 +12494,24 @@
|
|
|
12271
12494
|
}
|
|
12272
12495
|
// ## Public methods
|
|
12273
12496
|
// ### `parse` parses the N3 input and emits each parsed quad through the onQuad callback.
|
|
12274
|
-
parse(input, quadCallback, prefixCallback) {
|
|
12275
|
-
let onQuad, onPrefix, onComment;
|
|
12276
|
-
if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment)) {
|
|
12497
|
+
parse(input, quadCallback, prefixCallback, versionCallback) {
|
|
12498
|
+
let onQuad, onPrefix, onComment, onVersion;
|
|
12499
|
+
if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment || quadCallback.onVersion)) {
|
|
12277
12500
|
onQuad = quadCallback.onQuad;
|
|
12278
12501
|
onPrefix = quadCallback.onPrefix;
|
|
12279
12502
|
onComment = quadCallback.onComment;
|
|
12503
|
+
onVersion = quadCallback.onVersion;
|
|
12280
12504
|
} else {
|
|
12281
12505
|
onQuad = quadCallback;
|
|
12282
12506
|
onPrefix = prefixCallback;
|
|
12507
|
+
onVersion = versionCallback;
|
|
12283
12508
|
}
|
|
12284
|
-
this._readCallback = this.
|
|
12509
|
+
this._readCallback = this._readBeforeTopContext;
|
|
12285
12510
|
this._sparqlStyle = false;
|
|
12286
12511
|
this._prefixes = /* @__PURE__ */ Object.create(null);
|
|
12287
12512
|
this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2) : `b${blankNodePrefix++}_`;
|
|
12288
12513
|
this._prefixCallback = onPrefix || noop;
|
|
12514
|
+
this._versionCallback = onVersion || noop;
|
|
12289
12515
|
this._inversePredicate = false;
|
|
12290
12516
|
this._quantified = /* @__PURE__ */ Object.create(null);
|
|
12291
12517
|
if (!onQuad) {
|
|
@@ -12331,6 +12557,7 @@
|
|
|
12331
12557
|
parser.RDF_FIRST = factory.namedNode(IRIs_default.rdf.first);
|
|
12332
12558
|
parser.RDF_REST = factory.namedNode(IRIs_default.rdf.rest);
|
|
12333
12559
|
parser.RDF_NIL = factory.namedNode(IRIs_default.rdf.nil);
|
|
12560
|
+
parser.RDF_REIFIES = factory.namedNode(IRIs_default.rdf.reifies);
|
|
12334
12561
|
parser.N3_FORALL = factory.namedNode(IRIs_default.r.forAll);
|
|
12335
12562
|
parser.N3_FORSOME = factory.namedNode(IRIs_default.r.forSome);
|
|
12336
12563
|
parser.ABBREVIATIONS = {
|
|
@@ -12341,6 +12568,11 @@
|
|
|
12341
12568
|
};
|
|
12342
12569
|
parser.QUANTIFIERS_GRAPH = factory.namedNode("urn:n3:quantifiers");
|
|
12343
12570
|
}
|
|
12571
|
+
N3Parser.SUPPORTED_VERSIONS = [
|
|
12572
|
+
"1.2",
|
|
12573
|
+
"1.2-basic",
|
|
12574
|
+
"1.1"
|
|
12575
|
+
];
|
|
12344
12576
|
initDataFactory(N3Parser.prototype, N3DataFactory_default);
|
|
12345
12577
|
|
|
12346
12578
|
// node_modules/n3/src/N3Util.js
|
|
@@ -12606,8 +12838,9 @@
|
|
|
12606
12838
|
let value = literal2.value;
|
|
12607
12839
|
if (escape.test(value))
|
|
12608
12840
|
value = value.replace(escapeAll, characterReplacer);
|
|
12841
|
+
const direction = literal2.direction ? `--${literal2.direction}` : "";
|
|
12609
12842
|
if (literal2.language)
|
|
12610
|
-
return `"${value}"@${literal2.language}`;
|
|
12843
|
+
return `"${value}"@${literal2.language}${direction}`;
|
|
12611
12844
|
if (this._lineMode) {
|
|
12612
12845
|
if (literal2.datatype.value === xsd3.string)
|
|
12613
12846
|
return `"${value}"`;
|
|
@@ -12652,7 +12885,7 @@
|
|
|
12652
12885
|
}
|
|
12653
12886
|
// ### `_encodeQuad` encodes an RDF-star quad
|
|
12654
12887
|
_encodeQuad({ subject, predicate, object, graph }) {
|
|
12655
|
-
return
|
|
12888
|
+
return `<<(${this._encodeSubject(subject)} ${this._encodePredicate(predicate)} ${this._encodeObject(object)}${isDefaultGraph(graph) ? "" : ` ${this._encodeIriOrBlank(graph)}`})>>`;
|
|
12656
12889
|
}
|
|
12657
12890
|
// ### `_blockedWrite` replaces `_write` after the writer has been closed
|
|
12658
12891
|
_blockedWrite() {
|
|
@@ -14091,6 +14324,7 @@
|
|
|
14091
14324
|
// node_modules/@muze-nl/oldm/src/oldm-n3.mjs
|
|
14092
14325
|
var n3Parser = (input, uri, type) => {
|
|
14093
14326
|
const parser = new src_default.Parser({
|
|
14327
|
+
baseIRI: uri,
|
|
14094
14328
|
blankNodePrefix: "",
|
|
14095
14329
|
format: type
|
|
14096
14330
|
});
|
|
@@ -14130,6 +14364,9 @@
|
|
|
14130
14364
|
}
|
|
14131
14365
|
let preds = getPredicates(subject);
|
|
14132
14366
|
for (let pred of preds) {
|
|
14367
|
+
if (pred.predicate.id == "id" || pred.predicate.id == "a") {
|
|
14368
|
+
continue;
|
|
14369
|
+
}
|
|
14133
14370
|
if (!Array.isArray(pred.object)) {
|
|
14134
14371
|
pred.object = [pred.object];
|
|
14135
14372
|
}
|
|
@@ -14162,17 +14399,17 @@
|
|
|
14162
14399
|
} else if (isLiteral2(object2)) {
|
|
14163
14400
|
pred.object = getLiteral(object2);
|
|
14164
14401
|
} else {
|
|
14165
|
-
console.log("
|
|
14402
|
+
console.log("oldm-ns: encountered unknown object", object2, predicate);
|
|
14166
14403
|
}
|
|
14167
14404
|
preds.push(pred);
|
|
14168
14405
|
});
|
|
14169
14406
|
return preds;
|
|
14170
14407
|
};
|
|
14171
14408
|
const getLiteral = (object) => {
|
|
14172
|
-
let type = source.getType(object) ||
|
|
14409
|
+
let type = source.getType(object) || void 0;
|
|
14173
14410
|
if (type) {
|
|
14174
14411
|
if (type == xsd4 + source.context.separator + "string" || type == xsd4 + source.context.separator + "number") {
|
|
14175
|
-
type =
|
|
14412
|
+
type = void 0;
|
|
14176
14413
|
} else {
|
|
14177
14414
|
type = source.fullURI(type);
|
|
14178
14415
|
}
|
|
@@ -14258,23 +14495,33 @@
|
|
|
14258
14495
|
} else for (const [filterKey, filterValue] of Object.entries(filter)) {
|
|
14259
14496
|
if (filterValue instanceof Function) {
|
|
14260
14497
|
fns.push((data) => {
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
}
|
|
14264
|
-
|
|
14498
|
+
if (filterKey == "_") {
|
|
14499
|
+
return filterValue(data, filterKey, "select");
|
|
14500
|
+
} else {
|
|
14501
|
+
return {
|
|
14502
|
+
[filterKey]: filterValue(data, filterKey, "select")
|
|
14503
|
+
};
|
|
14504
|
+
}
|
|
14265
14505
|
});
|
|
14266
14506
|
} else if (!isPrimitiveWrapper(filterValue)) {
|
|
14267
14507
|
fns.push((data) => {
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
}
|
|
14271
|
-
|
|
14508
|
+
if (filterKey == "_") {
|
|
14509
|
+
return from(data[filterKey]).select(filterValue);
|
|
14510
|
+
} else {
|
|
14511
|
+
return {
|
|
14512
|
+
[filterKey]: from(data[filterKey]).select(filterValue)
|
|
14513
|
+
};
|
|
14514
|
+
}
|
|
14272
14515
|
});
|
|
14273
14516
|
} else {
|
|
14274
14517
|
fns.push(() => {
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
}
|
|
14518
|
+
if (filterKey == "_") {
|
|
14519
|
+
return filterValue;
|
|
14520
|
+
} else {
|
|
14521
|
+
return {
|
|
14522
|
+
[filterKey]: filterValue
|
|
14523
|
+
};
|
|
14524
|
+
}
|
|
14278
14525
|
});
|
|
14279
14526
|
}
|
|
14280
14527
|
}
|
|
@@ -14652,7 +14899,7 @@
|
|
|
14652
14899
|
prop = localPath.shift();
|
|
14653
14900
|
}
|
|
14654
14901
|
return data;
|
|
14655
|
-
} else if (key) {
|
|
14902
|
+
} else if (key && key !== "_") {
|
|
14656
14903
|
if (typeof data?.[key] != "undefined") {
|
|
14657
14904
|
return data[key];
|
|
14658
14905
|
} else {
|