solid-ui 2.4.25-2c72c08a → 2.4.25-e709d181
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/main.js +1066 -437
- package/dist/main.js.map +1 -1
- package/lib/versionInfo.d.ts +2 -0
- package/lib/versionInfo.d.ts.map +1 -1
- package/lib/versionInfo.js +14 -12
- package/lib/versionInfo.js.map +1 -1
- package/package.json +4 -5
package/dist/main.js
CHANGED
|
@@ -13119,26 +13119,28 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13119
13119
|
}));
|
|
13120
13120
|
exports.versionInfo = void 0;
|
|
13121
13121
|
var versionInfo = {
|
|
13122
|
-
buildTime: '2023-
|
|
13123
|
-
commit: '
|
|
13122
|
+
buildTime: '2023-03-02T16:37:54Z',
|
|
13123
|
+
commit: 'e709d1818c38b016f4032b30613ee30fdcc12dc3',
|
|
13124
13124
|
npmInfo: {
|
|
13125
13125
|
'solid-ui': '2.4.25',
|
|
13126
13126
|
npm: '8.19.3',
|
|
13127
|
-
node: '
|
|
13128
|
-
v8: '
|
|
13129
|
-
uv: '1.
|
|
13127
|
+
node: '16.19.1',
|
|
13128
|
+
v8: '9.4.146.26-node.24',
|
|
13129
|
+
uv: '1.43.0',
|
|
13130
13130
|
zlib: '1.2.11',
|
|
13131
13131
|
brotli: '1.0.9',
|
|
13132
13132
|
ares: '1.18.1',
|
|
13133
|
-
modules: '
|
|
13134
|
-
nghttp2: '1.
|
|
13133
|
+
modules: '93',
|
|
13134
|
+
nghttp2: '1.47.0',
|
|
13135
13135
|
napi: '8',
|
|
13136
|
-
llhttp: '
|
|
13137
|
-
openssl: '1.1.
|
|
13138
|
-
cldr: '
|
|
13139
|
-
icu: '
|
|
13136
|
+
llhttp: '6.0.10',
|
|
13137
|
+
openssl: '1.1.1t+quic',
|
|
13138
|
+
cldr: '41.0',
|
|
13139
|
+
icu: '71.1',
|
|
13140
13140
|
tz: '2022f',
|
|
13141
|
-
unicode: '14.0'
|
|
13141
|
+
unicode: '14.0',
|
|
13142
|
+
ngtcp2: '0.8.1',
|
|
13143
|
+
nghttp3: '0.7.0'
|
|
13142
13144
|
}
|
|
13143
13145
|
};
|
|
13144
13146
|
exports.versionInfo = versionInfo;
|
|
@@ -25644,7 +25646,10 @@ class ClientAuthentication {
|
|
|
25644
25646
|
this.login = async (options, eventEmitter) => {
|
|
25645
25647
|
var _a, _b;
|
|
25646
25648
|
await this.sessionInfoManager.clear(options.sessionId);
|
|
25647
|
-
const redirectUrl = (
|
|
25649
|
+
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : (0, oidc_client_ext_1.removeOidcQueryParam)(window.location.href);
|
|
25650
|
+
if (!(0, solid_client_authn_core_1.isValidRedirectUrl)(redirectUrl)) {
|
|
25651
|
+
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI or it includes a hash fragment.`);
|
|
25652
|
+
}
|
|
25648
25653
|
await this.loginHandler.handle({
|
|
25649
25654
|
...options,
|
|
25650
25655
|
redirectUrl,
|
|
@@ -26115,7 +26120,6 @@ exports["default"] = ClientRegistrar;
|
|
|
26115
26120
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26116
26121
|
exports.WELL_KNOWN_OPENID_CONFIG = void 0;
|
|
26117
26122
|
const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
26118
|
-
const urlPath_1 = __webpack_require__(/*! ../../util/urlPath */ "./node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js");
|
|
26119
26123
|
exports.WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
|
|
26120
26124
|
const issuerConfigKeyMap = {
|
|
26121
26125
|
issuer: {
|
|
@@ -26221,7 +26225,7 @@ class IssuerConfigFetcher {
|
|
|
26221
26225
|
}
|
|
26222
26226
|
async fetchConfig(issuer) {
|
|
26223
26227
|
let issuerConfig;
|
|
26224
|
-
const openIdConfigUrl =
|
|
26228
|
+
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer).href;
|
|
26225
26229
|
const issuerConfigRequestBody = await window.fetch(openIdConfigUrl);
|
|
26226
26230
|
try {
|
|
26227
26231
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
@@ -26772,27 +26776,6 @@ exports["default"] = StorageUtilityBrowser;
|
|
|
26772
26776
|
|
|
26773
26777
|
/***/ }),
|
|
26774
26778
|
|
|
26775
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js":
|
|
26776
|
-
/*!******************************************************************************!*\
|
|
26777
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js ***!
|
|
26778
|
-
\******************************************************************************/
|
|
26779
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
26780
|
-
|
|
26781
|
-
"use strict";
|
|
26782
|
-
|
|
26783
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26784
|
-
exports.appendToUrlPathname = void 0;
|
|
26785
|
-
function appendToUrlPathname(url, append) {
|
|
26786
|
-
const parsedUrl = new URL(url);
|
|
26787
|
-
const path = parsedUrl.pathname;
|
|
26788
|
-
parsedUrl.pathname = `${path}${path.endsWith("/") ? "" : "/"}${append.startsWith("/") ? append.substring(1) : append}`;
|
|
26789
|
-
return parsedUrl.toString();
|
|
26790
|
-
}
|
|
26791
|
-
exports.appendToUrlPathname = appendToUrlPathname;
|
|
26792
|
-
//# sourceMappingURL=urlPath.js.map
|
|
26793
|
-
|
|
26794
|
-
/***/ }),
|
|
26795
|
-
|
|
26796
26779
|
/***/ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js":
|
|
26797
26780
|
/*!**********************************************************************************************************!*\
|
|
26798
26781
|
!*** ./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js ***!
|
|
@@ -27907,6 +27890,16 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
27907
27890
|
}
|
|
27908
27891
|
}
|
|
27909
27892
|
|
|
27893
|
+
function isValidRedirectUrl(redirectUrl) {
|
|
27894
|
+
try {
|
|
27895
|
+
const urlObject = new URL(redirectUrl);
|
|
27896
|
+
return urlObject.hash === "";
|
|
27897
|
+
}
|
|
27898
|
+
catch (e) {
|
|
27899
|
+
return false;
|
|
27900
|
+
}
|
|
27901
|
+
}
|
|
27902
|
+
|
|
27910
27903
|
function isSupportedTokenType(token) {
|
|
27911
27904
|
return typeof token === "string" && ["DPoP", "Bearer"].includes(token);
|
|
27912
27905
|
}
|
|
@@ -28322,6 +28315,7 @@ exports.getSessionIdFromOauthState = getSessionIdFromOauthState;
|
|
|
28322
28315
|
exports.getWebidFromTokenPayload = getWebidFromTokenPayload;
|
|
28323
28316
|
exports.handleRegistration = handleRegistration;
|
|
28324
28317
|
exports.isSupportedTokenType = isSupportedTokenType;
|
|
28318
|
+
exports.isValidRedirectUrl = isValidRedirectUrl;
|
|
28325
28319
|
exports.loadOidcContextFromStorage = loadOidcContextFromStorage;
|
|
28326
28320
|
exports.mockStorage = mockStorage;
|
|
28327
28321
|
exports.mockStorageUtility = mockStorageUtility;
|
|
@@ -35242,6 +35236,7 @@ const {
|
|
|
35242
35236
|
} = __webpack_require__(/*! ./url */ "./node_modules/jsonld/lib/url.js");
|
|
35243
35237
|
|
|
35244
35238
|
const {
|
|
35239
|
+
REGEX_KEYWORD,
|
|
35245
35240
|
addValue: _addValue,
|
|
35246
35241
|
asArray: _asArray,
|
|
35247
35242
|
compareShortestLeast: _compareShortestLeast
|
|
@@ -35259,7 +35254,6 @@ module.exports = api;
|
|
|
35259
35254
|
* to compact, null for none.
|
|
35260
35255
|
* @param element the element to compact.
|
|
35261
35256
|
* @param options the compaction options.
|
|
35262
|
-
* @param compactionMap the compaction map to use.
|
|
35263
35257
|
*
|
|
35264
35258
|
* @return a promise that resolves to the compacted value.
|
|
35265
35259
|
*/
|
|
@@ -35267,33 +35261,21 @@ api.compact = async ({
|
|
|
35267
35261
|
activeCtx,
|
|
35268
35262
|
activeProperty = null,
|
|
35269
35263
|
element,
|
|
35270
|
-
options = {}
|
|
35271
|
-
compactionMap = () => undefined
|
|
35264
|
+
options = {}
|
|
35272
35265
|
}) => {
|
|
35273
35266
|
// recursively compact array
|
|
35274
35267
|
if(_isArray(element)) {
|
|
35275
35268
|
let rval = [];
|
|
35276
35269
|
for(let i = 0; i < element.length; ++i) {
|
|
35277
|
-
|
|
35278
|
-
let compacted = await api.compact({
|
|
35270
|
+
const compacted = await api.compact({
|
|
35279
35271
|
activeCtx,
|
|
35280
35272
|
activeProperty,
|
|
35281
35273
|
element: element[i],
|
|
35282
|
-
options
|
|
35283
|
-
compactionMap
|
|
35274
|
+
options
|
|
35284
35275
|
});
|
|
35285
35276
|
if(compacted === null) {
|
|
35286
|
-
|
|
35287
|
-
|
|
35288
|
-
activeCtx,
|
|
35289
|
-
activeProperty,
|
|
35290
|
-
parent: element,
|
|
35291
|
-
index: i,
|
|
35292
|
-
options
|
|
35293
|
-
});
|
|
35294
|
-
if(compacted === undefined) {
|
|
35295
|
-
continue;
|
|
35296
|
-
}
|
|
35277
|
+
// FIXME: need event?
|
|
35278
|
+
continue;
|
|
35297
35279
|
}
|
|
35298
35280
|
rval.push(compacted);
|
|
35299
35281
|
}
|
|
@@ -35357,8 +35339,7 @@ api.compact = async ({
|
|
|
35357
35339
|
activeCtx,
|
|
35358
35340
|
activeProperty,
|
|
35359
35341
|
element: element['@list'],
|
|
35360
|
-
options
|
|
35361
|
-
compactionMap
|
|
35342
|
+
options
|
|
35362
35343
|
});
|
|
35363
35344
|
}
|
|
35364
35345
|
}
|
|
@@ -35486,8 +35467,7 @@ api.compact = async ({
|
|
|
35486
35467
|
activeCtx,
|
|
35487
35468
|
activeProperty: '@reverse',
|
|
35488
35469
|
element: expandedValue,
|
|
35489
|
-
options
|
|
35490
|
-
compactionMap
|
|
35470
|
+
options
|
|
35491
35471
|
});
|
|
35492
35472
|
|
|
35493
35473
|
// handle double-reversed properties
|
|
@@ -35524,8 +35504,7 @@ api.compact = async ({
|
|
|
35524
35504
|
activeCtx,
|
|
35525
35505
|
activeProperty,
|
|
35526
35506
|
element: expandedValue,
|
|
35527
|
-
options
|
|
35528
|
-
compactionMap
|
|
35507
|
+
options
|
|
35529
35508
|
});
|
|
35530
35509
|
|
|
35531
35510
|
if(!(_isArray(compactedValue) && compactedValue.length === 0)) {
|
|
@@ -35642,8 +35621,7 @@ api.compact = async ({
|
|
|
35642
35621
|
activeCtx,
|
|
35643
35622
|
activeProperty: itemActiveProperty,
|
|
35644
35623
|
element: (isList || isGraph) ? inner : expandedItem,
|
|
35645
|
-
options
|
|
35646
|
-
compactionMap
|
|
35624
|
+
options
|
|
35647
35625
|
});
|
|
35648
35626
|
|
|
35649
35627
|
// handle @list
|
|
@@ -35838,8 +35816,7 @@ api.compact = async ({
|
|
|
35838
35816
|
activeCtx,
|
|
35839
35817
|
activeProperty: itemActiveProperty,
|
|
35840
35818
|
element: {'@id': expandedItem['@id']},
|
|
35841
|
-
options
|
|
35842
|
-
compactionMap
|
|
35819
|
+
options
|
|
35843
35820
|
});
|
|
35844
35821
|
}
|
|
35845
35822
|
}
|
|
@@ -36153,7 +36130,8 @@ api.compactIri = ({
|
|
|
36153
36130
|
// The None case preserves rval as potentially relative
|
|
36154
36131
|
return iri;
|
|
36155
36132
|
} else {
|
|
36156
|
-
|
|
36133
|
+
const _iri = _removeBase(_prependBase(base, activeCtx['@base']), iri);
|
|
36134
|
+
return REGEX_KEYWORD.test(_iri) ? `./${_iri}` : _iri;
|
|
36157
36135
|
}
|
|
36158
36136
|
} else {
|
|
36159
36137
|
return _removeBase(base, iri);
|
|
@@ -36460,13 +36438,18 @@ const {
|
|
|
36460
36438
|
} = __webpack_require__(/*! ./url */ "./node_modules/jsonld/lib/url.js");
|
|
36461
36439
|
|
|
36462
36440
|
const {
|
|
36441
|
+
handleEvent: _handleEvent
|
|
36442
|
+
} = __webpack_require__(/*! ./events */ "./node_modules/jsonld/lib/events.js");
|
|
36443
|
+
|
|
36444
|
+
const {
|
|
36445
|
+
REGEX_BCP47,
|
|
36446
|
+
REGEX_KEYWORD,
|
|
36463
36447
|
asArray: _asArray,
|
|
36464
36448
|
compareShortestLeast: _compareShortestLeast
|
|
36465
36449
|
} = __webpack_require__(/*! ./util */ "./node_modules/jsonld/lib/util.js");
|
|
36466
36450
|
|
|
36467
36451
|
const INITIAL_CONTEXT_CACHE = new Map();
|
|
36468
36452
|
const INITIAL_CONTEXT_CACHE_MAX_SIZE = 10000;
|
|
36469
|
-
const KEYWORD_PATTERN = /^@[a-zA-Z]+$/;
|
|
36470
36453
|
|
|
36471
36454
|
const api = {};
|
|
36472
36455
|
module.exports = api;
|
|
@@ -36501,6 +36484,23 @@ api.process = async ({
|
|
|
36501
36484
|
return activeCtx;
|
|
36502
36485
|
}
|
|
36503
36486
|
|
|
36487
|
+
// event handler for capturing events to replay when using a cached context
|
|
36488
|
+
const events = [];
|
|
36489
|
+
const eventCaptureHandler = [
|
|
36490
|
+
({event, next}) => {
|
|
36491
|
+
events.push(event);
|
|
36492
|
+
next();
|
|
36493
|
+
}
|
|
36494
|
+
];
|
|
36495
|
+
// chain to original handler
|
|
36496
|
+
if(options.eventHandler) {
|
|
36497
|
+
eventCaptureHandler.push(options.eventHandler);
|
|
36498
|
+
}
|
|
36499
|
+
// store original options to use when replaying events
|
|
36500
|
+
const originalOptions = options;
|
|
36501
|
+
// shallow clone options with event capture handler
|
|
36502
|
+
options = {...options, eventHandler: eventCaptureHandler};
|
|
36503
|
+
|
|
36504
36504
|
// resolve contexts
|
|
36505
36505
|
const resolved = await options.contextResolver.resolve({
|
|
36506
36506
|
activeCtx,
|
|
@@ -36538,46 +36538,12 @@ api.process = async ({
|
|
|
36538
36538
|
if(ctx === null) {
|
|
36539
36539
|
// We can't nullify if there are protected terms and we're
|
|
36540
36540
|
// not allowing overrides (e.g. processing a property term scoped context)
|
|
36541
|
-
if(!overrideProtected &&
|
|
36542
|
-
Object.keys(activeCtx.protected).length !== 0) {
|
|
36543
|
-
const protectedMode = (options && options.protectedMode) || 'error';
|
|
36544
|
-
if(protectedMode === 'error') {
|
|
36545
|
-
throw new JsonLdError(
|
|
36546
|
-
'Tried to nullify a context with protected terms outside of ' +
|
|
36547
|
-
'a term definition.',
|
|
36548
|
-
'jsonld.SyntaxError',
|
|
36549
|
-
{code: 'invalid context nullification'});
|
|
36550
|
-
} else if(protectedMode === 'warn') {
|
|
36551
|
-
// FIXME: remove logging and use a handler
|
|
36552
|
-
console.warn('WARNING: invalid context nullification');
|
|
36553
|
-
|
|
36554
|
-
// get processed context from cache if available
|
|
36555
|
-
const processed = resolvedContext.getProcessed(activeCtx);
|
|
36556
|
-
if(processed) {
|
|
36557
|
-
rval = activeCtx = processed;
|
|
36558
|
-
continue;
|
|
36559
|
-
}
|
|
36560
|
-
|
|
36561
|
-
const oldActiveCtx = activeCtx;
|
|
36562
|
-
// copy all protected term definitions to fresh initial context
|
|
36563
|
-
rval = activeCtx = api.getInitialContext(options).clone();
|
|
36564
|
-
for(const [term, _protected] of
|
|
36565
|
-
Object.entries(oldActiveCtx.protected)) {
|
|
36566
|
-
if(_protected) {
|
|
36567
|
-
activeCtx.mappings[term] =
|
|
36568
|
-
util.clone(oldActiveCtx.mappings[term]);
|
|
36569
|
-
}
|
|
36570
|
-
}
|
|
36571
|
-
activeCtx.protected = util.clone(oldActiveCtx.protected);
|
|
36572
|
-
|
|
36573
|
-
// cache processed result
|
|
36574
|
-
resolvedContext.setProcessed(oldActiveCtx, rval);
|
|
36575
|
-
continue;
|
|
36576
|
-
}
|
|
36541
|
+
if(!overrideProtected && Object.keys(activeCtx.protected).length !== 0) {
|
|
36577
36542
|
throw new JsonLdError(
|
|
36578
|
-
'
|
|
36543
|
+
'Tried to nullify a context with protected terms outside of ' +
|
|
36544
|
+
'a term definition.',
|
|
36579
36545
|
'jsonld.SyntaxError',
|
|
36580
|
-
{code: 'invalid
|
|
36546
|
+
{code: 'invalid context nullification'});
|
|
36581
36547
|
}
|
|
36582
36548
|
rval = activeCtx = api.getInitialContext(options).clone();
|
|
36583
36549
|
continue;
|
|
@@ -36586,7 +36552,14 @@ api.process = async ({
|
|
|
36586
36552
|
// get processed context from cache if available
|
|
36587
36553
|
const processed = resolvedContext.getProcessed(activeCtx);
|
|
36588
36554
|
if(processed) {
|
|
36589
|
-
|
|
36555
|
+
if(originalOptions.eventHandler) {
|
|
36556
|
+
// replay events with original non-capturing options
|
|
36557
|
+
for(const event of processed.events) {
|
|
36558
|
+
_handleEvent({event, options: originalOptions});
|
|
36559
|
+
}
|
|
36560
|
+
}
|
|
36561
|
+
|
|
36562
|
+
rval = activeCtx = processed.context;
|
|
36590
36563
|
continue;
|
|
36591
36564
|
}
|
|
36592
36565
|
|
|
@@ -36671,8 +36644,25 @@ api.process = async ({
|
|
|
36671
36644
|
'@context must be an absolute IRI.',
|
|
36672
36645
|
'jsonld.SyntaxError', {code: 'invalid vocab mapping', context: ctx});
|
|
36673
36646
|
} else {
|
|
36674
|
-
|
|
36647
|
+
const vocab = _expandIri(rval, value, {vocab: true, base: true},
|
|
36675
36648
|
undefined, undefined, options);
|
|
36649
|
+
if(!_isAbsoluteIri(vocab)) {
|
|
36650
|
+
if(options.eventHandler) {
|
|
36651
|
+
_handleEvent({
|
|
36652
|
+
event: {
|
|
36653
|
+
type: ['JsonLdEvent'],
|
|
36654
|
+
code: 'relative @vocab reference',
|
|
36655
|
+
level: 'warning',
|
|
36656
|
+
message: 'Relative @vocab reference found.',
|
|
36657
|
+
details: {
|
|
36658
|
+
vocab
|
|
36659
|
+
}
|
|
36660
|
+
},
|
|
36661
|
+
options
|
|
36662
|
+
});
|
|
36663
|
+
}
|
|
36664
|
+
}
|
|
36665
|
+
rval['@vocab'] = vocab;
|
|
36676
36666
|
}
|
|
36677
36667
|
defined.set('@vocab', true);
|
|
36678
36668
|
}
|
|
@@ -36689,6 +36679,22 @@ api.process = async ({
|
|
|
36689
36679
|
'jsonld.SyntaxError',
|
|
36690
36680
|
{code: 'invalid default language', context: ctx});
|
|
36691
36681
|
} else {
|
|
36682
|
+
if(!value.match(REGEX_BCP47)) {
|
|
36683
|
+
if(options.eventHandler) {
|
|
36684
|
+
_handleEvent({
|
|
36685
|
+
event: {
|
|
36686
|
+
type: ['JsonLdEvent'],
|
|
36687
|
+
code: 'invalid @language value',
|
|
36688
|
+
level: 'warning',
|
|
36689
|
+
message: '@language value must be valid BCP47.',
|
|
36690
|
+
details: {
|
|
36691
|
+
language: value
|
|
36692
|
+
}
|
|
36693
|
+
},
|
|
36694
|
+
options
|
|
36695
|
+
});
|
|
36696
|
+
}
|
|
36697
|
+
}
|
|
36692
36698
|
rval['@language'] = value.toLowerCase();
|
|
36693
36699
|
}
|
|
36694
36700
|
defined.set('@language', true);
|
|
@@ -36854,7 +36860,10 @@ api.process = async ({
|
|
|
36854
36860
|
}
|
|
36855
36861
|
|
|
36856
36862
|
// cache processed result
|
|
36857
|
-
resolvedContext.setProcessed(activeCtx,
|
|
36863
|
+
resolvedContext.setProcessed(activeCtx, {
|
|
36864
|
+
context: rval,
|
|
36865
|
+
events
|
|
36866
|
+
});
|
|
36858
36867
|
}
|
|
36859
36868
|
|
|
36860
36869
|
return rval;
|
|
@@ -36869,9 +36878,6 @@ api.process = async ({
|
|
|
36869
36878
|
* @param defined a map of defining/defined keys to detect cycles and prevent
|
|
36870
36879
|
* double definitions.
|
|
36871
36880
|
* @param {Object} [options] - creation options.
|
|
36872
|
-
* @param {string} [options.protectedMode="error"] - "error" to throw error
|
|
36873
|
-
* on `@protected` constraint violation, "warn" to allow violations and
|
|
36874
|
-
* signal a warning.
|
|
36875
36881
|
* @param overrideProtected `false` allows protected terms to be modified.
|
|
36876
36882
|
*/
|
|
36877
36883
|
api.createTermDefinition = ({
|
|
@@ -36921,10 +36927,23 @@ api.createTermDefinition = ({
|
|
|
36921
36927
|
'Invalid JSON-LD syntax; keywords cannot be overridden.',
|
|
36922
36928
|
'jsonld.SyntaxError',
|
|
36923
36929
|
{code: 'keyword redefinition', context: localCtx, term});
|
|
36924
|
-
} else if(term.match(
|
|
36925
|
-
|
|
36926
|
-
|
|
36927
|
-
|
|
36930
|
+
} else if(term.match(REGEX_KEYWORD)) {
|
|
36931
|
+
if(options.eventHandler) {
|
|
36932
|
+
_handleEvent({
|
|
36933
|
+
event: {
|
|
36934
|
+
type: ['JsonLdEvent'],
|
|
36935
|
+
code: 'reserved term',
|
|
36936
|
+
level: 'warning',
|
|
36937
|
+
message:
|
|
36938
|
+
'Terms beginning with "@" are ' +
|
|
36939
|
+
'reserved for future use and dropped.',
|
|
36940
|
+
details: {
|
|
36941
|
+
term
|
|
36942
|
+
}
|
|
36943
|
+
},
|
|
36944
|
+
options
|
|
36945
|
+
});
|
|
36946
|
+
}
|
|
36928
36947
|
return;
|
|
36929
36948
|
} else if(term === '') {
|
|
36930
36949
|
throw new JsonLdError(
|
|
@@ -37004,10 +37023,23 @@ api.createTermDefinition = ({
|
|
|
37004
37023
|
'jsonld.SyntaxError', {code: 'invalid IRI mapping', context: localCtx});
|
|
37005
37024
|
}
|
|
37006
37025
|
|
|
37007
|
-
if(
|
|
37008
|
-
|
|
37009
|
-
|
|
37010
|
-
|
|
37026
|
+
if(reverse.match(REGEX_KEYWORD)) {
|
|
37027
|
+
if(options.eventHandler) {
|
|
37028
|
+
_handleEvent({
|
|
37029
|
+
event: {
|
|
37030
|
+
type: ['JsonLdEvent'],
|
|
37031
|
+
code: 'reserved @reverse value',
|
|
37032
|
+
level: 'warning',
|
|
37033
|
+
message:
|
|
37034
|
+
'@reverse values beginning with "@" are ' +
|
|
37035
|
+
'reserved for future use and dropped.',
|
|
37036
|
+
details: {
|
|
37037
|
+
reverse
|
|
37038
|
+
}
|
|
37039
|
+
},
|
|
37040
|
+
options
|
|
37041
|
+
});
|
|
37042
|
+
}
|
|
37011
37043
|
if(previousMapping) {
|
|
37012
37044
|
activeCtx.mappings.set(term, previousMapping);
|
|
37013
37045
|
} else {
|
|
@@ -37040,10 +37072,23 @@ api.createTermDefinition = ({
|
|
|
37040
37072
|
if(id === null) {
|
|
37041
37073
|
// reserve a null term, which may be protected
|
|
37042
37074
|
mapping['@id'] = null;
|
|
37043
|
-
} else if(!api.isKeyword(id) && id.match(
|
|
37044
|
-
|
|
37045
|
-
|
|
37046
|
-
|
|
37075
|
+
} else if(!api.isKeyword(id) && id.match(REGEX_KEYWORD)) {
|
|
37076
|
+
if(options.eventHandler) {
|
|
37077
|
+
_handleEvent({
|
|
37078
|
+
event: {
|
|
37079
|
+
type: ['JsonLdEvent'],
|
|
37080
|
+
code: 'reserved @id value',
|
|
37081
|
+
level: 'warning',
|
|
37082
|
+
message:
|
|
37083
|
+
'@id values beginning with "@" are ' +
|
|
37084
|
+
'reserved for future use and dropped.',
|
|
37085
|
+
details: {
|
|
37086
|
+
id
|
|
37087
|
+
}
|
|
37088
|
+
},
|
|
37089
|
+
options
|
|
37090
|
+
});
|
|
37091
|
+
}
|
|
37047
37092
|
if(previousMapping) {
|
|
37048
37093
|
activeCtx.mappings.set(term, previousMapping);
|
|
37049
37094
|
} else {
|
|
@@ -37358,23 +37403,10 @@ api.createTermDefinition = ({
|
|
|
37358
37403
|
activeCtx.protected[term] = true;
|
|
37359
37404
|
mapping.protected = true;
|
|
37360
37405
|
if(!_deepCompare(previousMapping, mapping)) {
|
|
37361
|
-
const protectedMode = (options && options.protectedMode) || 'error';
|
|
37362
|
-
if(protectedMode === 'error') {
|
|
37363
|
-
throw new JsonLdError(
|
|
37364
|
-
`Invalid JSON-LD syntax; tried to redefine "${term}" which is a ` +
|
|
37365
|
-
'protected term.',
|
|
37366
|
-
'jsonld.SyntaxError',
|
|
37367
|
-
{code: 'protected term redefinition', context: localCtx, term});
|
|
37368
|
-
} else if(protectedMode === 'warn') {
|
|
37369
|
-
// FIXME: remove logging and use a handler
|
|
37370
|
-
console.warn('WARNING: protected term redefinition', {term});
|
|
37371
|
-
return;
|
|
37372
|
-
}
|
|
37373
37406
|
throw new JsonLdError(
|
|
37374
|
-
'Invalid
|
|
37407
|
+
'Invalid JSON-LD syntax; tried to redefine a protected term.',
|
|
37375
37408
|
'jsonld.SyntaxError',
|
|
37376
|
-
{code: '
|
|
37377
|
-
protectedMode});
|
|
37409
|
+
{code: 'protected term redefinition', context: localCtx, term});
|
|
37378
37410
|
}
|
|
37379
37411
|
}
|
|
37380
37412
|
};
|
|
@@ -37423,7 +37455,7 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
|
|
|
37423
37455
|
}
|
|
37424
37456
|
|
|
37425
37457
|
// ignore non-keyword things that look like a keyword
|
|
37426
|
-
if(value.match(
|
|
37458
|
+
if(value.match(REGEX_KEYWORD)) {
|
|
37427
37459
|
return null;
|
|
37428
37460
|
}
|
|
37429
37461
|
|
|
@@ -37481,21 +37513,104 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
|
|
|
37481
37513
|
}
|
|
37482
37514
|
}
|
|
37483
37515
|
|
|
37484
|
-
//
|
|
37485
|
-
|
|
37486
|
-
|
|
37487
|
-
|
|
37516
|
+
// A flag that captures whether the iri being expanded is
|
|
37517
|
+
// the value for an @type
|
|
37518
|
+
//let typeExpansion = false;
|
|
37519
|
+
|
|
37520
|
+
//if(options !== undefined && options.typeExpansion !== undefined) {
|
|
37521
|
+
// typeExpansion = options.typeExpansion;
|
|
37522
|
+
//}
|
|
37488
37523
|
|
|
37489
|
-
|
|
37490
|
-
|
|
37491
|
-
|
|
37492
|
-
|
|
37493
|
-
|
|
37524
|
+
if(relativeTo.vocab && '@vocab' in activeCtx) {
|
|
37525
|
+
// prepend vocab
|
|
37526
|
+
const prependedResult = activeCtx['@vocab'] + value;
|
|
37527
|
+
// FIXME: needed? may be better as debug event.
|
|
37528
|
+
/*
|
|
37529
|
+
if(options && options.eventHandler) {
|
|
37530
|
+
_handleEvent({
|
|
37531
|
+
event: {
|
|
37532
|
+
type: ['JsonLdEvent'],
|
|
37533
|
+
code: 'prepending @vocab during expansion',
|
|
37534
|
+
level: 'info',
|
|
37535
|
+
message: 'Prepending @vocab during expansion.',
|
|
37536
|
+
details: {
|
|
37537
|
+
type: '@vocab',
|
|
37538
|
+
vocab: activeCtx['@vocab'],
|
|
37539
|
+
value,
|
|
37540
|
+
result: prependedResult,
|
|
37541
|
+
typeExpansion
|
|
37542
|
+
}
|
|
37543
|
+
},
|
|
37544
|
+
options
|
|
37545
|
+
});
|
|
37494
37546
|
}
|
|
37547
|
+
*/
|
|
37548
|
+
// the null case preserves value as potentially relative
|
|
37549
|
+
value = prependedResult;
|
|
37495
37550
|
} else if(relativeTo.base) {
|
|
37496
|
-
|
|
37551
|
+
// prepend base
|
|
37552
|
+
let prependedResult;
|
|
37553
|
+
let base;
|
|
37554
|
+
if('@base' in activeCtx) {
|
|
37555
|
+
if(activeCtx['@base']) {
|
|
37556
|
+
base = prependBase(options.base, activeCtx['@base']);
|
|
37557
|
+
prependedResult = prependBase(base, value);
|
|
37558
|
+
} else {
|
|
37559
|
+
base = activeCtx['@base'];
|
|
37560
|
+
prependedResult = value;
|
|
37561
|
+
}
|
|
37562
|
+
} else {
|
|
37563
|
+
base = options.base;
|
|
37564
|
+
prependedResult = prependBase(options.base, value);
|
|
37565
|
+
}
|
|
37566
|
+
// FIXME: needed? may be better as debug event.
|
|
37567
|
+
/*
|
|
37568
|
+
if(options && options.eventHandler) {
|
|
37569
|
+
_handleEvent({
|
|
37570
|
+
event: {
|
|
37571
|
+
type: ['JsonLdEvent'],
|
|
37572
|
+
code: 'prepending @base during expansion',
|
|
37573
|
+
level: 'info',
|
|
37574
|
+
message: 'Prepending @base during expansion.',
|
|
37575
|
+
details: {
|
|
37576
|
+
type: '@base',
|
|
37577
|
+
base,
|
|
37578
|
+
value,
|
|
37579
|
+
result: prependedResult,
|
|
37580
|
+
typeExpansion
|
|
37581
|
+
}
|
|
37582
|
+
},
|
|
37583
|
+
options
|
|
37584
|
+
});
|
|
37585
|
+
}
|
|
37586
|
+
*/
|
|
37587
|
+
// the null case preserves value as potentially relative
|
|
37588
|
+
value = prependedResult;
|
|
37497
37589
|
}
|
|
37498
37590
|
|
|
37591
|
+
// FIXME: duplicate? needed? maybe just enable in a verbose debug mode
|
|
37592
|
+
/*
|
|
37593
|
+
if(!_isAbsoluteIri(value) && options && options.eventHandler) {
|
|
37594
|
+
// emit event indicating a relative IRI was found, which can result in it
|
|
37595
|
+
// being dropped when converting to other RDF representations
|
|
37596
|
+
_handleEvent({
|
|
37597
|
+
event: {
|
|
37598
|
+
type: ['JsonLdEvent'],
|
|
37599
|
+
code: 'relative IRI after expansion',
|
|
37600
|
+
// FIXME: what level?
|
|
37601
|
+
level: 'warning',
|
|
37602
|
+
message: 'Relative IRI after expansion.',
|
|
37603
|
+
details: {
|
|
37604
|
+
relativeIri: value,
|
|
37605
|
+
typeExpansion
|
|
37606
|
+
}
|
|
37607
|
+
},
|
|
37608
|
+
options
|
|
37609
|
+
});
|
|
37610
|
+
// NOTE: relative reference events emitted at calling sites as needed
|
|
37611
|
+
}
|
|
37612
|
+
*/
|
|
37613
|
+
|
|
37499
37614
|
return value;
|
|
37500
37615
|
}
|
|
37501
37616
|
|
|
@@ -38011,7 +38126,7 @@ module.exports = ({
|
|
|
38011
38126
|
}
|
|
38012
38127
|
|
|
38013
38128
|
// "alternate" link header is a redirect
|
|
38014
|
-
alternate = linkHeaders
|
|
38129
|
+
alternate = linkHeaders.alternate;
|
|
38015
38130
|
if(alternate &&
|
|
38016
38131
|
alternate.type == 'application/ld+json' &&
|
|
38017
38132
|
!(contentType || '').match(/^application\/(\w*\+)?json$/)) {
|
|
@@ -38038,6 +38153,195 @@ function _get(xhr, url, headers) {
|
|
|
38038
38153
|
}
|
|
38039
38154
|
|
|
38040
38155
|
|
|
38156
|
+
/***/ }),
|
|
38157
|
+
|
|
38158
|
+
/***/ "./node_modules/jsonld/lib/events.js":
|
|
38159
|
+
/*!*******************************************!*\
|
|
38160
|
+
!*** ./node_modules/jsonld/lib/events.js ***!
|
|
38161
|
+
\*******************************************/
|
|
38162
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
38163
|
+
|
|
38164
|
+
"use strict";
|
|
38165
|
+
/*
|
|
38166
|
+
* Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
|
|
38167
|
+
*/
|
|
38168
|
+
|
|
38169
|
+
|
|
38170
|
+
const JsonLdError = __webpack_require__(/*! ./JsonLdError */ "./node_modules/jsonld/lib/JsonLdError.js");
|
|
38171
|
+
|
|
38172
|
+
const {
|
|
38173
|
+
isArray: _isArray
|
|
38174
|
+
} = __webpack_require__(/*! ./types */ "./node_modules/jsonld/lib/types.js");
|
|
38175
|
+
|
|
38176
|
+
const {
|
|
38177
|
+
asArray: _asArray
|
|
38178
|
+
} = __webpack_require__(/*! ./util */ "./node_modules/jsonld/lib/util.js");
|
|
38179
|
+
|
|
38180
|
+
const api = {};
|
|
38181
|
+
module.exports = api;
|
|
38182
|
+
|
|
38183
|
+
// default handler, store as null or an array
|
|
38184
|
+
// exposed to allow fast external pre-handleEvent() checks
|
|
38185
|
+
api.defaultEventHandler = null;
|
|
38186
|
+
|
|
38187
|
+
/**
|
|
38188
|
+
* Setup event handler.
|
|
38189
|
+
*
|
|
38190
|
+
* Return an array event handler constructed from an optional safe mode
|
|
38191
|
+
* handler, an optional options event handler, and an optional default handler.
|
|
38192
|
+
*
|
|
38193
|
+
* @param {object} options - processing options
|
|
38194
|
+
* {function|object|array} [eventHandler] - an event handler.
|
|
38195
|
+
*
|
|
38196
|
+
* @return an array event handler.
|
|
38197
|
+
*/
|
|
38198
|
+
api.setupEventHandler = ({options = {}}) => {
|
|
38199
|
+
// build in priority order
|
|
38200
|
+
const eventHandler = [].concat(
|
|
38201
|
+
options.safe ? api.safeEventHandler : [],
|
|
38202
|
+
options.eventHandler ? _asArray(options.eventHandler) : [],
|
|
38203
|
+
api.defaultEventHandler ? api.defaultEventHandler : []
|
|
38204
|
+
);
|
|
38205
|
+
// null if no handlers
|
|
38206
|
+
return eventHandler.length === 0 ? null : eventHandler;
|
|
38207
|
+
};
|
|
38208
|
+
|
|
38209
|
+
/**
|
|
38210
|
+
* Handle an event.
|
|
38211
|
+
*
|
|
38212
|
+
* Top level APIs have a common 'eventHandler' option. This option can be a
|
|
38213
|
+
* function, array of functions, object mapping event.code to functions (with a
|
|
38214
|
+
* default to call next()), or any combination of such handlers. Handlers will
|
|
38215
|
+
* be called with an object with an 'event' entry and a 'next' function. Custom
|
|
38216
|
+
* handlers should process the event as appropriate. The 'next()' function
|
|
38217
|
+
* should be called to let the next handler process the event.
|
|
38218
|
+
*
|
|
38219
|
+
* NOTE: Only call this function if options.eventHandler is set and is an
|
|
38220
|
+
* array of hanlers. This is an optimization. Callers are expected to check
|
|
38221
|
+
* for an event handler before constructing events and calling this function.
|
|
38222
|
+
*
|
|
38223
|
+
* @param {object} event - event structure:
|
|
38224
|
+
* {string} code - event code
|
|
38225
|
+
* {string} level - severity level, one of: ['warning']
|
|
38226
|
+
* {string} message - human readable message
|
|
38227
|
+
* {object} details - event specific details
|
|
38228
|
+
* @param {object} options - processing options
|
|
38229
|
+
* {array} eventHandler - an event handler array.
|
|
38230
|
+
*/
|
|
38231
|
+
api.handleEvent = ({
|
|
38232
|
+
event,
|
|
38233
|
+
options
|
|
38234
|
+
}) => {
|
|
38235
|
+
_handle({event, handlers: options.eventHandler});
|
|
38236
|
+
};
|
|
38237
|
+
|
|
38238
|
+
function _handle({event, handlers}) {
|
|
38239
|
+
let doNext = true;
|
|
38240
|
+
for(let i = 0; doNext && i < handlers.length; ++i) {
|
|
38241
|
+
doNext = false;
|
|
38242
|
+
const handler = handlers[i];
|
|
38243
|
+
if(_isArray(handler)) {
|
|
38244
|
+
doNext = _handle({event, handlers: handler});
|
|
38245
|
+
} else if(typeof handler === 'function') {
|
|
38246
|
+
handler({event, next: () => {
|
|
38247
|
+
doNext = true;
|
|
38248
|
+
}});
|
|
38249
|
+
} else if(typeof handler === 'object') {
|
|
38250
|
+
if(event.code in handler) {
|
|
38251
|
+
handler[event.code]({event, next: () => {
|
|
38252
|
+
doNext = true;
|
|
38253
|
+
}});
|
|
38254
|
+
} else {
|
|
38255
|
+
doNext = true;
|
|
38256
|
+
}
|
|
38257
|
+
} else {
|
|
38258
|
+
throw new JsonLdError(
|
|
38259
|
+
'Invalid event handler.',
|
|
38260
|
+
'jsonld.InvalidEventHandler',
|
|
38261
|
+
{event});
|
|
38262
|
+
}
|
|
38263
|
+
}
|
|
38264
|
+
return doNext;
|
|
38265
|
+
}
|
|
38266
|
+
|
|
38267
|
+
const _notSafeEventCodes = new Set([
|
|
38268
|
+
'empty object',
|
|
38269
|
+
'free-floating scalar',
|
|
38270
|
+
'invalid @language value',
|
|
38271
|
+
'invalid property',
|
|
38272
|
+
// NOTE: spec edge case
|
|
38273
|
+
'null @id value',
|
|
38274
|
+
'null @value value',
|
|
38275
|
+
'object with only @id',
|
|
38276
|
+
'object with only @language',
|
|
38277
|
+
'object with only @list',
|
|
38278
|
+
'object with only @value',
|
|
38279
|
+
'relative @id reference',
|
|
38280
|
+
'relative @type reference',
|
|
38281
|
+
'relative @vocab reference',
|
|
38282
|
+
'reserved @id value',
|
|
38283
|
+
'reserved @reverse value',
|
|
38284
|
+
'reserved term',
|
|
38285
|
+
// toRDF
|
|
38286
|
+
'blank node predicate',
|
|
38287
|
+
'relative graph reference',
|
|
38288
|
+
'relative object reference',
|
|
38289
|
+
'relative predicate reference',
|
|
38290
|
+
'relative subject reference'
|
|
38291
|
+
]);
|
|
38292
|
+
|
|
38293
|
+
// safe handler that rejects unsafe warning conditions
|
|
38294
|
+
api.safeEventHandler = function safeEventHandler({event, next}) {
|
|
38295
|
+
// fail on all unsafe warnings
|
|
38296
|
+
if(event.level === 'warning' && _notSafeEventCodes.has(event.code)) {
|
|
38297
|
+
throw new JsonLdError(
|
|
38298
|
+
'Safe mode validation error.',
|
|
38299
|
+
'jsonld.ValidationError',
|
|
38300
|
+
{event}
|
|
38301
|
+
);
|
|
38302
|
+
}
|
|
38303
|
+
next();
|
|
38304
|
+
};
|
|
38305
|
+
|
|
38306
|
+
// logs all events and continues
|
|
38307
|
+
api.logEventHandler = function logEventHandler({event, next}) {
|
|
38308
|
+
console.log(`EVENT: ${event.message}`, {event});
|
|
38309
|
+
next();
|
|
38310
|
+
};
|
|
38311
|
+
|
|
38312
|
+
// log 'warning' level events
|
|
38313
|
+
api.logWarningEventHandler = function logWarningEventHandler({event, next}) {
|
|
38314
|
+
if(event.level === 'warning') {
|
|
38315
|
+
console.warn(`WARNING: ${event.message}`, {event});
|
|
38316
|
+
}
|
|
38317
|
+
next();
|
|
38318
|
+
};
|
|
38319
|
+
|
|
38320
|
+
// fallback to throw errors for any unhandled events
|
|
38321
|
+
api.unhandledEventHandler = function unhandledEventHandler({event}) {
|
|
38322
|
+
throw new JsonLdError(
|
|
38323
|
+
'No handler for event.',
|
|
38324
|
+
'jsonld.UnhandledEvent',
|
|
38325
|
+
{event}
|
|
38326
|
+
);
|
|
38327
|
+
};
|
|
38328
|
+
|
|
38329
|
+
/**
|
|
38330
|
+
* Set default event handler.
|
|
38331
|
+
*
|
|
38332
|
+
* By default, all event are unhandled. It is recommended to pass in an
|
|
38333
|
+
* eventHandler into each call. However, this call allows using a default
|
|
38334
|
+
* eventHandler when one is not otherwise provided.
|
|
38335
|
+
*
|
|
38336
|
+
* @param {object} options - default handler options:
|
|
38337
|
+
* {function|object|array} eventHandler - a default event handler.
|
|
38338
|
+
* falsey to unset.
|
|
38339
|
+
*/
|
|
38340
|
+
api.setDefaultEventHandler = function({eventHandler} = {}) {
|
|
38341
|
+
api.defaultEventHandler = eventHandler ? _asArray(eventHandler) : null;
|
|
38342
|
+
};
|
|
38343
|
+
|
|
38344
|
+
|
|
38041
38345
|
/***/ }),
|
|
38042
38346
|
|
|
38043
38347
|
/***/ "./node_modules/jsonld/lib/expand.js":
|
|
@@ -38082,15 +38386,20 @@ const {
|
|
|
38082
38386
|
} = __webpack_require__(/*! ./url */ "./node_modules/jsonld/lib/url.js");
|
|
38083
38387
|
|
|
38084
38388
|
const {
|
|
38389
|
+
REGEX_BCP47,
|
|
38390
|
+
REGEX_KEYWORD,
|
|
38085
38391
|
addValue: _addValue,
|
|
38086
38392
|
asArray: _asArray,
|
|
38087
38393
|
getValues: _getValues,
|
|
38088
38394
|
validateTypeValue: _validateTypeValue
|
|
38089
38395
|
} = __webpack_require__(/*! ./util */ "./node_modules/jsonld/lib/util.js");
|
|
38090
38396
|
|
|
38397
|
+
const {
|
|
38398
|
+
handleEvent: _handleEvent
|
|
38399
|
+
} = __webpack_require__(/*! ./events */ "./node_modules/jsonld/lib/events.js");
|
|
38400
|
+
|
|
38091
38401
|
const api = {};
|
|
38092
38402
|
module.exports = api;
|
|
38093
|
-
const REGEX_BCP47 = /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;
|
|
38094
38403
|
|
|
38095
38404
|
/**
|
|
38096
38405
|
* Recursively expands an element using the given context. Any context in
|
|
@@ -38107,10 +38416,6 @@ const REGEX_BCP47 = /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;
|
|
|
38107
38416
|
* @param typeScopedContext an optional type-scoped active context for
|
|
38108
38417
|
* expanding values of nodes that were expressed according to
|
|
38109
38418
|
* a type-scoped context.
|
|
38110
|
-
* @param expansionMap(info) a function that can be used to custom map
|
|
38111
|
-
* unmappable values (or to throw an error when they are detected);
|
|
38112
|
-
* if this function returns `undefined` then the default behavior
|
|
38113
|
-
* will be used.
|
|
38114
38419
|
*
|
|
38115
38420
|
* @return a Promise that resolves to the expanded value.
|
|
38116
38421
|
*/
|
|
@@ -38121,8 +38426,7 @@ api.expand = async ({
|
|
|
38121
38426
|
options = {},
|
|
38122
38427
|
insideList = false,
|
|
38123
38428
|
insideIndex = false,
|
|
38124
|
-
typeScopedContext = null
|
|
38125
|
-
expansionMap = () => undefined
|
|
38429
|
+
typeScopedContext = null
|
|
38126
38430
|
}) => {
|
|
38127
38431
|
// nothing to expand
|
|
38128
38432
|
if(element === null || element === undefined) {
|
|
@@ -38135,21 +38439,28 @@ api.expand = async ({
|
|
|
38135
38439
|
}
|
|
38136
38440
|
|
|
38137
38441
|
if(!_isArray(element) && !_isObject(element)) {
|
|
38138
|
-
// drop free-floating scalars that are not in lists
|
|
38442
|
+
// drop free-floating scalars that are not in lists
|
|
38139
38443
|
if(!insideList && (activeProperty === null ||
|
|
38140
38444
|
_expandIri(activeCtx, activeProperty, {vocab: true},
|
|
38141
38445
|
options) === '@graph')) {
|
|
38142
|
-
|
|
38143
|
-
|
|
38144
|
-
|
|
38145
|
-
|
|
38146
|
-
|
|
38147
|
-
|
|
38148
|
-
|
|
38149
|
-
|
|
38150
|
-
|
|
38446
|
+
// FIXME
|
|
38447
|
+
if(options.eventHandler) {
|
|
38448
|
+
_handleEvent({
|
|
38449
|
+
event: {
|
|
38450
|
+
type: ['JsonLdEvent'],
|
|
38451
|
+
code: 'free-floating scalar',
|
|
38452
|
+
level: 'warning',
|
|
38453
|
+
message: 'Dropping free-floating scalar not in a list.',
|
|
38454
|
+
details: {
|
|
38455
|
+
value: element
|
|
38456
|
+
//activeProperty
|
|
38457
|
+
//insideList
|
|
38458
|
+
}
|
|
38459
|
+
},
|
|
38460
|
+
options
|
|
38461
|
+
});
|
|
38151
38462
|
}
|
|
38152
|
-
return
|
|
38463
|
+
return null;
|
|
38153
38464
|
}
|
|
38154
38465
|
|
|
38155
38466
|
// expand element according to value expansion rules
|
|
@@ -38169,7 +38480,6 @@ api.expand = async ({
|
|
|
38169
38480
|
activeProperty,
|
|
38170
38481
|
element: element[i],
|
|
38171
38482
|
options,
|
|
38172
|
-
expansionMap,
|
|
38173
38483
|
insideIndex,
|
|
38174
38484
|
typeScopedContext
|
|
38175
38485
|
});
|
|
@@ -38178,19 +38488,16 @@ api.expand = async ({
|
|
|
38178
38488
|
}
|
|
38179
38489
|
|
|
38180
38490
|
if(e === null) {
|
|
38181
|
-
|
|
38182
|
-
|
|
38183
|
-
|
|
38184
|
-
|
|
38185
|
-
|
|
38186
|
-
|
|
38187
|
-
|
|
38188
|
-
|
|
38189
|
-
|
|
38190
|
-
|
|
38191
|
-
if(e === undefined) {
|
|
38192
|
-
continue;
|
|
38193
|
-
}
|
|
38491
|
+
// FIXME: add debug event?
|
|
38492
|
+
//unmappedValue: element[i],
|
|
38493
|
+
//activeProperty,
|
|
38494
|
+
//parent: element,
|
|
38495
|
+
//index: i,
|
|
38496
|
+
//expandedParent: rval,
|
|
38497
|
+
//insideList
|
|
38498
|
+
|
|
38499
|
+
// NOTE: no-value events emitted at calling sites as needed
|
|
38500
|
+
continue;
|
|
38194
38501
|
}
|
|
38195
38502
|
|
|
38196
38503
|
if(_isArray(e)) {
|
|
@@ -38303,8 +38610,8 @@ api.expand = async ({
|
|
|
38303
38610
|
options,
|
|
38304
38611
|
insideList,
|
|
38305
38612
|
typeKey,
|
|
38306
|
-
typeScopedContext
|
|
38307
|
-
|
|
38613
|
+
typeScopedContext
|
|
38614
|
+
});
|
|
38308
38615
|
|
|
38309
38616
|
// get property count on expanded output
|
|
38310
38617
|
keys = Object.keys(rval);
|
|
@@ -38341,24 +38648,27 @@ api.expand = async ({
|
|
|
38341
38648
|
const values = rval['@value'] === null ? [] : _asArray(rval['@value']);
|
|
38342
38649
|
const types = _getValues(rval, '@type');
|
|
38343
38650
|
|
|
38344
|
-
// drop null @values
|
|
38651
|
+
// drop null @values
|
|
38345
38652
|
if(_processingMode(activeCtx, 1.1) && types.includes('@json') &&
|
|
38346
38653
|
types.length === 1) {
|
|
38347
38654
|
// Any value of @value is okay if @type: @json
|
|
38348
38655
|
} else if(values.length === 0) {
|
|
38349
|
-
|
|
38350
|
-
|
|
38351
|
-
|
|
38352
|
-
|
|
38353
|
-
|
|
38354
|
-
|
|
38355
|
-
|
|
38356
|
-
|
|
38357
|
-
|
|
38358
|
-
|
|
38359
|
-
|
|
38360
|
-
|
|
38656
|
+
// FIXME
|
|
38657
|
+
if(options.eventHandler) {
|
|
38658
|
+
_handleEvent({
|
|
38659
|
+
event: {
|
|
38660
|
+
type: ['JsonLdEvent'],
|
|
38661
|
+
code: 'null @value value',
|
|
38662
|
+
level: 'warning',
|
|
38663
|
+
message: 'Dropping null @value value.',
|
|
38664
|
+
details: {
|
|
38665
|
+
value: rval
|
|
38666
|
+
}
|
|
38667
|
+
},
|
|
38668
|
+
options
|
|
38669
|
+
});
|
|
38361
38670
|
}
|
|
38671
|
+
rval = null;
|
|
38362
38672
|
} else if(!values.every(v => (_isString(v) || _isEmptyObject(v))) &&
|
|
38363
38673
|
'@language' in rval) {
|
|
38364
38674
|
// if @language is present, @value must be a string
|
|
@@ -38393,43 +38703,64 @@ api.expand = async ({
|
|
|
38393
38703
|
count = keys.length;
|
|
38394
38704
|
}
|
|
38395
38705
|
} else if(count === 1 && '@language' in rval) {
|
|
38396
|
-
// drop objects with only @language
|
|
38397
|
-
|
|
38398
|
-
|
|
38399
|
-
|
|
38400
|
-
|
|
38401
|
-
|
|
38402
|
-
|
|
38403
|
-
|
|
38404
|
-
|
|
38405
|
-
|
|
38406
|
-
|
|
38407
|
-
|
|
38408
|
-
|
|
38706
|
+
// drop objects with only @language
|
|
38707
|
+
// FIXME
|
|
38708
|
+
if(options.eventHandler) {
|
|
38709
|
+
_handleEvent({
|
|
38710
|
+
event: {
|
|
38711
|
+
type: ['JsonLdEvent'],
|
|
38712
|
+
code: 'object with only @language',
|
|
38713
|
+
level: 'warning',
|
|
38714
|
+
message: 'Dropping object with only @language.',
|
|
38715
|
+
details: {
|
|
38716
|
+
value: rval
|
|
38717
|
+
}
|
|
38718
|
+
},
|
|
38719
|
+
options
|
|
38720
|
+
});
|
|
38409
38721
|
}
|
|
38722
|
+
rval = null;
|
|
38410
38723
|
}
|
|
38411
38724
|
|
|
38412
|
-
// drop certain top-level objects that do not occur in lists
|
|
38413
|
-
// mapped
|
|
38725
|
+
// drop certain top-level objects that do not occur in lists
|
|
38414
38726
|
if(_isObject(rval) &&
|
|
38415
38727
|
!options.keepFreeFloatingNodes && !insideList &&
|
|
38416
38728
|
(activeProperty === null || expandedActiveProperty === '@graph')) {
|
|
38417
38729
|
// drop empty object, top-level @value/@list, or object with only @id
|
|
38418
38730
|
if(count === 0 || '@value' in rval || '@list' in rval ||
|
|
38419
38731
|
(count === 1 && '@id' in rval)) {
|
|
38420
|
-
|
|
38421
|
-
|
|
38422
|
-
|
|
38423
|
-
|
|
38424
|
-
|
|
38425
|
-
|
|
38426
|
-
|
|
38427
|
-
|
|
38428
|
-
|
|
38429
|
-
|
|
38430
|
-
|
|
38431
|
-
rval
|
|
38732
|
+
// FIXME
|
|
38733
|
+
if(options.eventHandler) {
|
|
38734
|
+
// FIXME: one event or diff event for empty, @v/@l, {@id}?
|
|
38735
|
+
let code;
|
|
38736
|
+
let message;
|
|
38737
|
+
if(count === 0) {
|
|
38738
|
+
code = 'empty object';
|
|
38739
|
+
message = 'Dropping empty object.';
|
|
38740
|
+
} else if('@value' in rval) {
|
|
38741
|
+
code = 'object with only @value';
|
|
38742
|
+
message = 'Dropping object with only @value.';
|
|
38743
|
+
} else if('@list' in rval) {
|
|
38744
|
+
code = 'object with only @list';
|
|
38745
|
+
message = 'Dropping object with only @list.';
|
|
38746
|
+
} else if(count === 1 && '@id' in rval) {
|
|
38747
|
+
code = 'object with only @id';
|
|
38748
|
+
message = 'Dropping object with only @id.';
|
|
38749
|
+
}
|
|
38750
|
+
_handleEvent({
|
|
38751
|
+
event: {
|
|
38752
|
+
type: ['JsonLdEvent'],
|
|
38753
|
+
code,
|
|
38754
|
+
level: 'warning',
|
|
38755
|
+
message,
|
|
38756
|
+
details: {
|
|
38757
|
+
value: rval
|
|
38758
|
+
}
|
|
38759
|
+
},
|
|
38760
|
+
options
|
|
38761
|
+
});
|
|
38432
38762
|
}
|
|
38763
|
+
rval = null;
|
|
38433
38764
|
}
|
|
38434
38765
|
}
|
|
38435
38766
|
|
|
@@ -38448,10 +38779,6 @@ api.expand = async ({
|
|
|
38448
38779
|
* @param insideList true if the element is a list, false if not.
|
|
38449
38780
|
* @param typeKey first key found expanding to @type.
|
|
38450
38781
|
* @param typeScopedContext the context before reverting.
|
|
38451
|
-
* @param expansionMap(info) a function that can be used to custom map
|
|
38452
|
-
* unmappable values (or to throw an error when they are detected);
|
|
38453
|
-
* if this function returns `undefined` then the default behavior
|
|
38454
|
-
* will be used.
|
|
38455
38782
|
*/
|
|
38456
38783
|
async function _expandObject({
|
|
38457
38784
|
activeCtx,
|
|
@@ -38462,8 +38789,7 @@ async function _expandObject({
|
|
|
38462
38789
|
options = {},
|
|
38463
38790
|
insideList,
|
|
38464
38791
|
typeKey,
|
|
38465
|
-
typeScopedContext
|
|
38466
|
-
expansionMap
|
|
38792
|
+
typeScopedContext
|
|
38467
38793
|
}) {
|
|
38468
38794
|
const keys = Object.keys(element).sort();
|
|
38469
38795
|
const nests = [];
|
|
@@ -38473,7 +38799,10 @@ async function _expandObject({
|
|
|
38473
38799
|
const isJsonType = element[typeKey] &&
|
|
38474
38800
|
_expandIri(activeCtx,
|
|
38475
38801
|
(_isArray(element[typeKey]) ? element[typeKey][0] : element[typeKey]),
|
|
38476
|
-
{vocab: true},
|
|
38802
|
+
{vocab: true}, {
|
|
38803
|
+
...options,
|
|
38804
|
+
typeExpansion: true
|
|
38805
|
+
}) === '@json';
|
|
38477
38806
|
|
|
38478
38807
|
for(const key of keys) {
|
|
38479
38808
|
let value = element[key];
|
|
@@ -38485,25 +38814,28 @@ async function _expandObject({
|
|
|
38485
38814
|
}
|
|
38486
38815
|
|
|
38487
38816
|
// expand property
|
|
38488
|
-
|
|
38817
|
+
const expandedProperty = _expandIri(activeCtx, key, {vocab: true}, options);
|
|
38489
38818
|
|
|
38490
|
-
// drop non-absolute IRI keys that aren't keywords
|
|
38819
|
+
// drop non-absolute IRI keys that aren't keywords
|
|
38491
38820
|
if(expandedProperty === null ||
|
|
38492
38821
|
!(_isAbsoluteIri(expandedProperty) || _isKeyword(expandedProperty))) {
|
|
38493
|
-
|
|
38494
|
-
|
|
38495
|
-
|
|
38496
|
-
|
|
38497
|
-
|
|
38498
|
-
|
|
38499
|
-
|
|
38500
|
-
|
|
38501
|
-
|
|
38502
|
-
|
|
38503
|
-
|
|
38504
|
-
|
|
38505
|
-
|
|
38822
|
+
if(options.eventHandler) {
|
|
38823
|
+
_handleEvent({
|
|
38824
|
+
event: {
|
|
38825
|
+
type: ['JsonLdEvent'],
|
|
38826
|
+
code: 'invalid property',
|
|
38827
|
+
level: 'warning',
|
|
38828
|
+
message: 'Dropping property that did not expand into an ' +
|
|
38829
|
+
'absolute IRI or keyword.',
|
|
38830
|
+
details: {
|
|
38831
|
+
property: key,
|
|
38832
|
+
expandedProperty
|
|
38833
|
+
}
|
|
38834
|
+
},
|
|
38835
|
+
options
|
|
38836
|
+
});
|
|
38506
38837
|
}
|
|
38838
|
+
continue;
|
|
38507
38839
|
}
|
|
38508
38840
|
|
|
38509
38841
|
if(_isKeyword(expandedProperty)) {
|
|
@@ -38556,8 +38888,61 @@ async function _expandObject({
|
|
|
38556
38888
|
|
|
38557
38889
|
_addValue(
|
|
38558
38890
|
expandedParent, '@id',
|
|
38559
|
-
_asArray(value).map(v =>
|
|
38560
|
-
_isString(v)
|
|
38891
|
+
_asArray(value).map(v => {
|
|
38892
|
+
if(_isString(v)) {
|
|
38893
|
+
const ve = _expandIri(activeCtx, v, {base: true}, options);
|
|
38894
|
+
if(options.eventHandler) {
|
|
38895
|
+
if(ve === null) {
|
|
38896
|
+
// NOTE: spec edge case
|
|
38897
|
+
// See https://github.com/w3c/json-ld-api/issues/480
|
|
38898
|
+
if(v === null) {
|
|
38899
|
+
_handleEvent({
|
|
38900
|
+
event: {
|
|
38901
|
+
type: ['JsonLdEvent'],
|
|
38902
|
+
code: 'null @id value',
|
|
38903
|
+
level: 'warning',
|
|
38904
|
+
message: 'Null @id found.',
|
|
38905
|
+
details: {
|
|
38906
|
+
id: v
|
|
38907
|
+
}
|
|
38908
|
+
},
|
|
38909
|
+
options
|
|
38910
|
+
});
|
|
38911
|
+
} else {
|
|
38912
|
+
// matched KEYWORD regex
|
|
38913
|
+
_handleEvent({
|
|
38914
|
+
event: {
|
|
38915
|
+
type: ['JsonLdEvent'],
|
|
38916
|
+
code: 'reserved @id value',
|
|
38917
|
+
level: 'warning',
|
|
38918
|
+
message: 'Reserved @id found.',
|
|
38919
|
+
details: {
|
|
38920
|
+
id: v
|
|
38921
|
+
}
|
|
38922
|
+
},
|
|
38923
|
+
options
|
|
38924
|
+
});
|
|
38925
|
+
}
|
|
38926
|
+
} else if(!_isAbsoluteIri(ve)) {
|
|
38927
|
+
_handleEvent({
|
|
38928
|
+
event: {
|
|
38929
|
+
type: ['JsonLdEvent'],
|
|
38930
|
+
code: 'relative @id reference',
|
|
38931
|
+
level: 'warning',
|
|
38932
|
+
message: 'Relative @id reference found.',
|
|
38933
|
+
details: {
|
|
38934
|
+
id: v,
|
|
38935
|
+
expandedId: ve
|
|
38936
|
+
}
|
|
38937
|
+
},
|
|
38938
|
+
options
|
|
38939
|
+
});
|
|
38940
|
+
}
|
|
38941
|
+
}
|
|
38942
|
+
return ve;
|
|
38943
|
+
}
|
|
38944
|
+
return v;
|
|
38945
|
+
}),
|
|
38561
38946
|
{propertyIsArray: options.isFrame});
|
|
38562
38947
|
continue;
|
|
38563
38948
|
}
|
|
@@ -38569,17 +38954,39 @@ async function _expandObject({
|
|
|
38569
38954
|
value = Object.fromEntries(Object.entries(value).map(([k, v]) => [
|
|
38570
38955
|
_expandIri(typeScopedContext, k, {vocab: true}),
|
|
38571
38956
|
_asArray(v).map(vv =>
|
|
38572
|
-
_expandIri(typeScopedContext, vv, {base: true, vocab: true}
|
|
38957
|
+
_expandIri(typeScopedContext, vv, {base: true, vocab: true},
|
|
38958
|
+
{...options, typeExpansion: true})
|
|
38573
38959
|
)
|
|
38574
38960
|
]));
|
|
38575
38961
|
}
|
|
38576
38962
|
_validateTypeValue(value, options.isFrame);
|
|
38577
38963
|
_addValue(
|
|
38578
38964
|
expandedParent, '@type',
|
|
38579
|
-
_asArray(value).map(v =>
|
|
38580
|
-
_isString(v)
|
|
38581
|
-
_expandIri(typeScopedContext, v,
|
|
38582
|
-
{base: true, vocab: true},
|
|
38965
|
+
_asArray(value).map(v => {
|
|
38966
|
+
if(_isString(v)) {
|
|
38967
|
+
const ve = _expandIri(typeScopedContext, v,
|
|
38968
|
+
{base: true, vocab: true},
|
|
38969
|
+
{...options, typeExpansion: true});
|
|
38970
|
+
if(ve !== '@json' && !_isAbsoluteIri(ve)) {
|
|
38971
|
+
if(options.eventHandler) {
|
|
38972
|
+
_handleEvent({
|
|
38973
|
+
event: {
|
|
38974
|
+
type: ['JsonLdEvent'],
|
|
38975
|
+
code: 'relative @type reference',
|
|
38976
|
+
level: 'warning',
|
|
38977
|
+
message: 'Relative @type reference found.',
|
|
38978
|
+
details: {
|
|
38979
|
+
type: v
|
|
38980
|
+
}
|
|
38981
|
+
},
|
|
38982
|
+
options
|
|
38983
|
+
});
|
|
38984
|
+
}
|
|
38985
|
+
}
|
|
38986
|
+
return ve;
|
|
38987
|
+
}
|
|
38988
|
+
return v;
|
|
38989
|
+
}),
|
|
38583
38990
|
{propertyIsArray: options.isFrame});
|
|
38584
38991
|
continue;
|
|
38585
38992
|
}
|
|
@@ -38592,8 +38999,7 @@ async function _expandObject({
|
|
|
38592
38999
|
activeCtx,
|
|
38593
39000
|
activeProperty,
|
|
38594
39001
|
element: value,
|
|
38595
|
-
options
|
|
38596
|
-
expansionMap
|
|
39002
|
+
options
|
|
38597
39003
|
}));
|
|
38598
39004
|
|
|
38599
39005
|
// Expanded values must be node objects
|
|
@@ -38649,9 +39055,22 @@ async function _expandObject({
|
|
|
38649
39055
|
value = _asArray(value).map(v => _isString(v) ? v.toLowerCase() : v);
|
|
38650
39056
|
|
|
38651
39057
|
// ensure language tag matches BCP47
|
|
38652
|
-
for(const
|
|
38653
|
-
if(_isString(
|
|
38654
|
-
|
|
39058
|
+
for(const language of value) {
|
|
39059
|
+
if(_isString(language) && !language.match(REGEX_BCP47)) {
|
|
39060
|
+
if(options.eventHandler) {
|
|
39061
|
+
_handleEvent({
|
|
39062
|
+
event: {
|
|
39063
|
+
type: ['JsonLdEvent'],
|
|
39064
|
+
code: 'invalid @language value',
|
|
39065
|
+
level: 'warning',
|
|
39066
|
+
message: '@language value must be valid BCP47.',
|
|
39067
|
+
details: {
|
|
39068
|
+
language
|
|
39069
|
+
}
|
|
39070
|
+
},
|
|
39071
|
+
options
|
|
39072
|
+
});
|
|
39073
|
+
}
|
|
38655
39074
|
}
|
|
38656
39075
|
}
|
|
38657
39076
|
|
|
@@ -38712,8 +39131,7 @@ async function _expandObject({
|
|
|
38712
39131
|
activeProperty:
|
|
38713
39132
|
'@reverse',
|
|
38714
39133
|
element: value,
|
|
38715
|
-
options
|
|
38716
|
-
expansionMap
|
|
39134
|
+
options
|
|
38717
39135
|
});
|
|
38718
39136
|
// properties double-reversed
|
|
38719
39137
|
if('@reverse' in expandedValue) {
|
|
@@ -38788,7 +39206,6 @@ async function _expandObject({
|
|
|
38788
39206
|
options,
|
|
38789
39207
|
activeProperty: key,
|
|
38790
39208
|
value,
|
|
38791
|
-
expansionMap,
|
|
38792
39209
|
asGraph,
|
|
38793
39210
|
indexKey,
|
|
38794
39211
|
propertyIndex
|
|
@@ -38801,7 +39218,6 @@ async function _expandObject({
|
|
|
38801
39218
|
options,
|
|
38802
39219
|
activeProperty: key,
|
|
38803
39220
|
value,
|
|
38804
|
-
expansionMap,
|
|
38805
39221
|
asGraph,
|
|
38806
39222
|
indexKey: '@id'
|
|
38807
39223
|
});
|
|
@@ -38813,7 +39229,6 @@ async function _expandObject({
|
|
|
38813
39229
|
options,
|
|
38814
39230
|
activeProperty: key,
|
|
38815
39231
|
value,
|
|
38816
|
-
expansionMap,
|
|
38817
39232
|
asGraph: false,
|
|
38818
39233
|
indexKey: '@type'
|
|
38819
39234
|
});
|
|
@@ -38830,8 +39245,7 @@ async function _expandObject({
|
|
|
38830
39245
|
activeProperty: nextActiveProperty,
|
|
38831
39246
|
element: value,
|
|
38832
39247
|
options,
|
|
38833
|
-
insideList: isList
|
|
38834
|
-
expansionMap
|
|
39248
|
+
insideList: isList
|
|
38835
39249
|
});
|
|
38836
39250
|
} else if(
|
|
38837
39251
|
_getContextValue(activeCtx, key, '@type') === '@json') {
|
|
@@ -38846,29 +39260,18 @@ async function _expandObject({
|
|
|
38846
39260
|
activeProperty: key,
|
|
38847
39261
|
element: value,
|
|
38848
39262
|
options,
|
|
38849
|
-
insideList: false
|
|
38850
|
-
expansionMap
|
|
39263
|
+
insideList: false
|
|
38851
39264
|
});
|
|
38852
39265
|
}
|
|
38853
39266
|
}
|
|
38854
39267
|
|
|
38855
39268
|
// drop null values if property is not @value
|
|
38856
39269
|
if(expandedValue === null && expandedProperty !== '@value') {
|
|
38857
|
-
//
|
|
38858
|
-
|
|
38859
|
-
|
|
38860
|
-
|
|
38861
|
-
|
|
38862
|
-
activeProperty,
|
|
38863
|
-
parent: element,
|
|
38864
|
-
options,
|
|
38865
|
-
insideList,
|
|
38866
|
-
key,
|
|
38867
|
-
expandedParent
|
|
38868
|
-
});
|
|
38869
|
-
if(expandedValue === undefined) {
|
|
38870
|
-
continue;
|
|
38871
|
-
}
|
|
39270
|
+
// FIXME: event?
|
|
39271
|
+
//unmappedValue: value,
|
|
39272
|
+
//expandedProperty,
|
|
39273
|
+
//key,
|
|
39274
|
+
continue;
|
|
38872
39275
|
}
|
|
38873
39276
|
|
|
38874
39277
|
// convert expanded value to @list if container specifies it
|
|
@@ -38950,8 +39353,8 @@ async function _expandObject({
|
|
|
38950
39353
|
options,
|
|
38951
39354
|
insideList,
|
|
38952
39355
|
typeScopedContext,
|
|
38953
|
-
typeKey
|
|
38954
|
-
|
|
39356
|
+
typeKey
|
|
39357
|
+
});
|
|
38955
39358
|
}
|
|
38956
39359
|
}
|
|
38957
39360
|
}
|
|
@@ -38979,7 +39382,8 @@ function _expandValue({activeCtx, activeProperty, value, options}) {
|
|
|
38979
39382
|
if(expandedProperty === '@id') {
|
|
38980
39383
|
return _expandIri(activeCtx, value, {base: true}, options);
|
|
38981
39384
|
} else if(expandedProperty === '@type') {
|
|
38982
|
-
return _expandIri(activeCtx, value, {vocab: true, base: true},
|
|
39385
|
+
return _expandIri(activeCtx, value, {vocab: true, base: true},
|
|
39386
|
+
{...options, typeExpansion: true});
|
|
38983
39387
|
}
|
|
38984
39388
|
|
|
38985
39389
|
// get type definition from context
|
|
@@ -38987,7 +39391,25 @@ function _expandValue({activeCtx, activeProperty, value, options}) {
|
|
|
38987
39391
|
|
|
38988
39392
|
// do @id expansion (automatic for @graph)
|
|
38989
39393
|
if((type === '@id' || expandedProperty === '@graph') && _isString(value)) {
|
|
38990
|
-
|
|
39394
|
+
const expandedValue = _expandIri(activeCtx, value, {base: true}, options);
|
|
39395
|
+
// NOTE: handle spec edge case and avoid invalid {"@id": null}
|
|
39396
|
+
if(expandedValue === null && value.match(REGEX_KEYWORD)) {
|
|
39397
|
+
if(options.eventHandler) {
|
|
39398
|
+
_handleEvent({
|
|
39399
|
+
event: {
|
|
39400
|
+
type: ['JsonLdEvent'],
|
|
39401
|
+
code: 'reserved @id value',
|
|
39402
|
+
level: 'warning',
|
|
39403
|
+
message: 'Reserved @id found.',
|
|
39404
|
+
details: {
|
|
39405
|
+
id: activeProperty
|
|
39406
|
+
}
|
|
39407
|
+
},
|
|
39408
|
+
options
|
|
39409
|
+
});
|
|
39410
|
+
}
|
|
39411
|
+
}
|
|
39412
|
+
return {'@id': expandedValue};
|
|
38991
39413
|
}
|
|
38992
39414
|
// do @id expansion w/vocab
|
|
38993
39415
|
if(type === '@vocab' && _isString(value)) {
|
|
@@ -39058,6 +39480,22 @@ function _expandLanguageMap(activeCtx, languageMap, direction, options) {
|
|
|
39058
39480
|
}
|
|
39059
39481
|
const val = {'@value': item};
|
|
39060
39482
|
if(expandedKey !== '@none') {
|
|
39483
|
+
if(!key.match(REGEX_BCP47)) {
|
|
39484
|
+
if(options.eventHandler) {
|
|
39485
|
+
_handleEvent({
|
|
39486
|
+
event: {
|
|
39487
|
+
type: ['JsonLdEvent'],
|
|
39488
|
+
code: 'invalid @language value',
|
|
39489
|
+
level: 'warning',
|
|
39490
|
+
message: '@language value must be valid BCP47.',
|
|
39491
|
+
details: {
|
|
39492
|
+
language: key
|
|
39493
|
+
}
|
|
39494
|
+
},
|
|
39495
|
+
options
|
|
39496
|
+
});
|
|
39497
|
+
}
|
|
39498
|
+
}
|
|
39061
39499
|
val['@language'] = key.toLowerCase();
|
|
39062
39500
|
}
|
|
39063
39501
|
if(direction) {
|
|
@@ -39069,9 +39507,9 @@ function _expandLanguageMap(activeCtx, languageMap, direction, options) {
|
|
|
39069
39507
|
return rval;
|
|
39070
39508
|
}
|
|
39071
39509
|
|
|
39072
|
-
async function _expandIndexMap(
|
|
39073
|
-
|
|
39074
|
-
|
|
39510
|
+
async function _expandIndexMap({
|
|
39511
|
+
activeCtx, options, activeProperty, value, asGraph, indexKey, propertyIndex
|
|
39512
|
+
}) {
|
|
39075
39513
|
const rval = [];
|
|
39076
39514
|
const keys = Object.keys(value).sort();
|
|
39077
39515
|
const isTypeIndex = indexKey === '@type';
|
|
@@ -39100,8 +39538,7 @@ async function _expandIndexMap(
|
|
|
39100
39538
|
element: val,
|
|
39101
39539
|
options,
|
|
39102
39540
|
insideList: false,
|
|
39103
|
-
insideIndex: true
|
|
39104
|
-
expansionMap
|
|
39541
|
+
insideIndex: true
|
|
39105
39542
|
});
|
|
39106
39543
|
|
|
39107
39544
|
// expand for @type, but also for @none
|
|
@@ -40066,7 +40503,15 @@ function _valueMatch(pattern, value) {
|
|
|
40066
40503
|
const JsonLdError = __webpack_require__(/*! ./JsonLdError */ "./node_modules/jsonld/lib/JsonLdError.js");
|
|
40067
40504
|
const graphTypes = __webpack_require__(/*! ./graphTypes */ "./node_modules/jsonld/lib/graphTypes.js");
|
|
40068
40505
|
const types = __webpack_require__(/*! ./types */ "./node_modules/jsonld/lib/types.js");
|
|
40069
|
-
|
|
40506
|
+
|
|
40507
|
+
const {
|
|
40508
|
+
REGEX_BCP47,
|
|
40509
|
+
addValue: _addValue
|
|
40510
|
+
} = __webpack_require__(/*! ./util */ "./node_modules/jsonld/lib/util.js");
|
|
40511
|
+
|
|
40512
|
+
const {
|
|
40513
|
+
handleEvent: _handleEvent
|
|
40514
|
+
} = __webpack_require__(/*! ./events */ "./node_modules/jsonld/lib/events.js");
|
|
40070
40515
|
|
|
40071
40516
|
// constants
|
|
40072
40517
|
const {
|
|
@@ -40089,8 +40534,6 @@ const {
|
|
|
40089
40534
|
XSD_STRING,
|
|
40090
40535
|
} = __webpack_require__(/*! ./constants */ "./node_modules/jsonld/lib/constants.js");
|
|
40091
40536
|
|
|
40092
|
-
const REGEX_BCP47 = /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;
|
|
40093
|
-
|
|
40094
40537
|
const api = {};
|
|
40095
40538
|
module.exports = api;
|
|
40096
40539
|
|
|
@@ -40104,15 +40547,16 @@ module.exports = api;
|
|
|
40104
40547
|
*/
|
|
40105
40548
|
api.fromRDF = async (
|
|
40106
40549
|
dataset,
|
|
40107
|
-
|
|
40108
|
-
useRdfType = false,
|
|
40109
|
-
useNativeTypes = false,
|
|
40110
|
-
rdfDirection = null
|
|
40111
|
-
}
|
|
40550
|
+
options
|
|
40112
40551
|
) => {
|
|
40113
40552
|
const defaultGraph = {};
|
|
40114
40553
|
const graphMap = {'@default': defaultGraph};
|
|
40115
40554
|
const referencedOnce = {};
|
|
40555
|
+
const {
|
|
40556
|
+
useRdfType = false,
|
|
40557
|
+
useNativeTypes = false,
|
|
40558
|
+
rdfDirection = null
|
|
40559
|
+
} = options;
|
|
40116
40560
|
|
|
40117
40561
|
for(const quad of dataset) {
|
|
40118
40562
|
// TODO: change 'name' to 'graph'
|
|
@@ -40143,12 +40587,12 @@ api.fromRDF = async (
|
|
|
40143
40587
|
}
|
|
40144
40588
|
|
|
40145
40589
|
if(p === RDF_TYPE && !useRdfType && objectIsNode) {
|
|
40146
|
-
|
|
40590
|
+
_addValue(node, '@type', o.value, {propertyIsArray: true});
|
|
40147
40591
|
continue;
|
|
40148
40592
|
}
|
|
40149
40593
|
|
|
40150
|
-
const value = _RDFToObject(o, useNativeTypes, rdfDirection);
|
|
40151
|
-
|
|
40594
|
+
const value = _RDFToObject(o, useNativeTypes, rdfDirection, options);
|
|
40595
|
+
_addValue(node, p, value, {propertyIsArray: true});
|
|
40152
40596
|
|
|
40153
40597
|
// object may be an RDF list/partial list node but we can't know easily
|
|
40154
40598
|
// until all triples are read
|
|
@@ -40207,12 +40651,12 @@ api.fromRDF = async (
|
|
|
40207
40651
|
}
|
|
40208
40652
|
|
|
40209
40653
|
if(p === RDF_TYPE && !useRdfType && objectIsId) {
|
|
40210
|
-
|
|
40654
|
+
_addValue(node, '@type', o.value, {propertyIsArray: true});
|
|
40211
40655
|
continue;
|
|
40212
40656
|
}
|
|
40213
40657
|
|
|
40214
40658
|
const value = _RDFToObject(o, useNativeTypes);
|
|
40215
|
-
|
|
40659
|
+
_addValue(node, p, value, {propertyIsArray: true});
|
|
40216
40660
|
|
|
40217
40661
|
// object may be an RDF list/partial list node but we can't know easily
|
|
40218
40662
|
// until all triples are read
|
|
@@ -40335,10 +40779,12 @@ api.fromRDF = async (
|
|
|
40335
40779
|
*
|
|
40336
40780
|
* @param o the RDF triple object to convert.
|
|
40337
40781
|
* @param useNativeTypes true to output native types, false not to.
|
|
40782
|
+
* @param rdfDirection text direction mode [null, i18n-datatype]
|
|
40783
|
+
* @param options top level API options
|
|
40338
40784
|
*
|
|
40339
40785
|
* @return the JSON-LD object.
|
|
40340
40786
|
*/
|
|
40341
|
-
function _RDFToObject(o, useNativeTypes, rdfDirection) {
|
|
40787
|
+
function _RDFToObject(o, useNativeTypes, rdfDirection, options) {
|
|
40342
40788
|
// convert NamedNode/BlankNode object to JSON-LD
|
|
40343
40789
|
if(o.termType.endsWith('Node')) {
|
|
40344
40790
|
return {'@id': o.value};
|
|
@@ -40349,6 +40795,22 @@ function _RDFToObject(o, useNativeTypes, rdfDirection) {
|
|
|
40349
40795
|
|
|
40350
40796
|
// add language
|
|
40351
40797
|
if(o.language) {
|
|
40798
|
+
if(!o.language.match(REGEX_BCP47)) {
|
|
40799
|
+
if(options.eventHandler) {
|
|
40800
|
+
_handleEvent({
|
|
40801
|
+
event: {
|
|
40802
|
+
type: ['JsonLdEvent'],
|
|
40803
|
+
code: 'invalid @language value',
|
|
40804
|
+
level: 'warning',
|
|
40805
|
+
message: '@language value must be valid BCP47.',
|
|
40806
|
+
details: {
|
|
40807
|
+
language: o.language
|
|
40808
|
+
}
|
|
40809
|
+
},
|
|
40810
|
+
options
|
|
40811
|
+
});
|
|
40812
|
+
}
|
|
40813
|
+
}
|
|
40352
40814
|
rval['@language'] = o.language;
|
|
40353
40815
|
} else {
|
|
40354
40816
|
let type = o.datatype.value;
|
|
@@ -40394,7 +40856,20 @@ function _RDFToObject(o, useNativeTypes, rdfDirection) {
|
|
|
40394
40856
|
if(language.length > 0) {
|
|
40395
40857
|
rval['@language'] = language;
|
|
40396
40858
|
if(!language.match(REGEX_BCP47)) {
|
|
40397
|
-
|
|
40859
|
+
if(options.eventHandler) {
|
|
40860
|
+
_handleEvent({
|
|
40861
|
+
event: {
|
|
40862
|
+
type: ['JsonLdEvent'],
|
|
40863
|
+
code: 'invalid @language value',
|
|
40864
|
+
level: 'warning',
|
|
40865
|
+
message: '@language value must be valid BCP47.',
|
|
40866
|
+
details: {
|
|
40867
|
+
language
|
|
40868
|
+
}
|
|
40869
|
+
},
|
|
40870
|
+
options
|
|
40871
|
+
});
|
|
40872
|
+
}
|
|
40398
40873
|
}
|
|
40399
40874
|
}
|
|
40400
40875
|
rval['@direction'] = direction;
|
|
@@ -40524,11 +40999,12 @@ api.isSimpleGraph = v => {
|
|
|
40524
40999
|
api.isBlankNode = v => {
|
|
40525
41000
|
// Note: A value is a blank node if all of these hold true:
|
|
40526
41001
|
// 1. It is an Object.
|
|
40527
|
-
// 2. If it has an @id key
|
|
41002
|
+
// 2. If it has an @id key that is not a string OR begins with '_:'.
|
|
40528
41003
|
// 3. It has no keys OR is not a @value, @set, or @list.
|
|
40529
41004
|
if(types.isObject(v)) {
|
|
40530
41005
|
if('@id' in v) {
|
|
40531
|
-
|
|
41006
|
+
const id = v['@id'];
|
|
41007
|
+
return !types.isString(id) || id.indexOf('_:') === 0;
|
|
40532
41008
|
}
|
|
40533
41009
|
return (Object.keys(v).length === 0 ||
|
|
40534
41010
|
!(('@value' in v) || ('@set' in v) || ('@list' in v)));
|
|
@@ -40551,7 +41027,7 @@ api.isBlankNode = v => {
|
|
|
40551
41027
|
* @author Dave Longley
|
|
40552
41028
|
*
|
|
40553
41029
|
* @license BSD 3-Clause License
|
|
40554
|
-
* Copyright (c) 2011-
|
|
41030
|
+
* Copyright (c) 2011-2022 Digital Bazaar, Inc.
|
|
40555
41031
|
* All rights reserved.
|
|
40556
41032
|
*
|
|
40557
41033
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -40627,6 +41103,16 @@ const {
|
|
|
40627
41103
|
mergeNodeMaps: _mergeNodeMaps
|
|
40628
41104
|
} = __webpack_require__(/*! ./nodeMap */ "./node_modules/jsonld/lib/nodeMap.js");
|
|
40629
41105
|
|
|
41106
|
+
const {
|
|
41107
|
+
logEventHandler: _logEventHandler,
|
|
41108
|
+
logWarningEventHandler: _logWarningEventHandler,
|
|
41109
|
+
safeEventHandler: _safeEventHandler,
|
|
41110
|
+
setDefaultEventHandler: _setDefaultEventHandler,
|
|
41111
|
+
setupEventHandler: _setupEventHandler,
|
|
41112
|
+
strictEventHandler: _strictEventHandler,
|
|
41113
|
+
unhandledEventHandler: _unhandledEventHandler
|
|
41114
|
+
} = __webpack_require__(/*! ./events */ "./node_modules/jsonld/lib/events.js");
|
|
41115
|
+
|
|
40630
41116
|
/* eslint-disable indent */
|
|
40631
41117
|
// attaches jsonld API to the given object
|
|
40632
41118
|
const wrapper = function(jsonld) {
|
|
@@ -40657,15 +41143,8 @@ const _resolvedContextCache = new LRU({max: RESOLVED_CONTEXT_CACHE_MAX_SIZE});
|
|
|
40657
41143
|
* [skipExpansion] true to assume the input is expanded and skip
|
|
40658
41144
|
* expansion, false not to, defaults to false.
|
|
40659
41145
|
* [documentLoader(url, options)] the document loader.
|
|
40660
|
-
* [expansionMap(info)] a function that can be used to custom map
|
|
40661
|
-
* unmappable values (or to throw an error when they are detected);
|
|
40662
|
-
* if this function returns `undefined` then the default behavior
|
|
40663
|
-
* will be used.
|
|
40664
41146
|
* [framing] true if compaction is occuring during a framing operation.
|
|
40665
|
-
* [
|
|
40666
|
-
* unmappable values (or to throw an error when they are detected);
|
|
40667
|
-
* if this function returns `undefined` then the default behavior
|
|
40668
|
-
* will be used.
|
|
41147
|
+
* [safe] true to use safe mode. (default: false)
|
|
40669
41148
|
* [contextResolver] internal use only.
|
|
40670
41149
|
*
|
|
40671
41150
|
* @return a Promise that resolves to the compacted output.
|
|
@@ -40723,8 +41202,7 @@ jsonld.compact = async function(input, ctx, options) {
|
|
|
40723
41202
|
let compacted = await _compact({
|
|
40724
41203
|
activeCtx,
|
|
40725
41204
|
element: expanded,
|
|
40726
|
-
options
|
|
40727
|
-
compactionMap: options.compactionMap
|
|
41205
|
+
options
|
|
40728
41206
|
});
|
|
40729
41207
|
|
|
40730
41208
|
// perform clean up
|
|
@@ -40800,10 +41278,7 @@ jsonld.compact = async function(input, ctx, options) {
|
|
|
40800
41278
|
* [keepFreeFloatingNodes] true to keep free-floating nodes,
|
|
40801
41279
|
* false not to, defaults to false.
|
|
40802
41280
|
* [documentLoader(url, options)] the document loader.
|
|
40803
|
-
* [
|
|
40804
|
-
* unmappable values (or to throw an error when they are detected);
|
|
40805
|
-
* if this function returns `undefined` then the default behavior
|
|
40806
|
-
* will be used.
|
|
41281
|
+
* [safe] true to use safe mode. (default: false)
|
|
40807
41282
|
* [contextResolver] internal use only.
|
|
40808
41283
|
*
|
|
40809
41284
|
* @return a Promise that resolves to the expanded output.
|
|
@@ -40819,9 +41294,6 @@ jsonld.expand = async function(input, options) {
|
|
|
40819
41294
|
contextResolver: new ContextResolver(
|
|
40820
41295
|
{sharedCache: _resolvedContextCache})
|
|
40821
41296
|
});
|
|
40822
|
-
if(options.expansionMap === false) {
|
|
40823
|
-
options.expansionMap = undefined;
|
|
40824
|
-
}
|
|
40825
41297
|
|
|
40826
41298
|
// build set of objects that may have @contexts to resolve
|
|
40827
41299
|
const toResolve = {};
|
|
@@ -40872,8 +41344,7 @@ jsonld.expand = async function(input, options) {
|
|
|
40872
41344
|
let expanded = await _expand({
|
|
40873
41345
|
activeCtx,
|
|
40874
41346
|
element: toResolve.input,
|
|
40875
|
-
options
|
|
40876
|
-
expansionMap: options.expansionMap
|
|
41347
|
+
options
|
|
40877
41348
|
});
|
|
40878
41349
|
|
|
40879
41350
|
// optimize away @graph with no other properties
|
|
@@ -40956,6 +41427,7 @@ jsonld.flatten = async function(input, ctx, options) {
|
|
|
40956
41427
|
* [requireAll] default @requireAll flag (default: true).
|
|
40957
41428
|
* [omitDefault] default @omitDefault flag (default: false).
|
|
40958
41429
|
* [documentLoader(url, options)] the document loader.
|
|
41430
|
+
* [safe] true to use safe mode. (default: false)
|
|
40959
41431
|
* [contextResolver] internal use only.
|
|
40960
41432
|
*
|
|
40961
41433
|
* @return a Promise that resolves to the framed output.
|
|
@@ -41054,6 +41526,7 @@ jsonld.frame = async function(input, frame, options) {
|
|
|
41054
41526
|
* [base] the base IRI to use.
|
|
41055
41527
|
* [expandContext] a context to expand with.
|
|
41056
41528
|
* [documentLoader(url, options)] the document loader.
|
|
41529
|
+
* [safe] true to use safe mode. (default: false)
|
|
41057
41530
|
* [contextResolver] internal use only.
|
|
41058
41531
|
*
|
|
41059
41532
|
* @return a Promise that resolves to the linked output.
|
|
@@ -41074,12 +41547,18 @@ jsonld.link = async function(input, ctx, options) {
|
|
|
41074
41547
|
* unless the 'inputFormat' option is used. The output is an RDF dataset
|
|
41075
41548
|
* unless the 'format' option is used.
|
|
41076
41549
|
*
|
|
41550
|
+
* Note: Canonicalization sets `safe` to `true` and `base` to `null` by
|
|
41551
|
+
* default in order to produce safe outputs and "fail closed" by default. This
|
|
41552
|
+
* is different from the other API transformations in this version which
|
|
41553
|
+
* allow unsafe defaults (for cryptographic usage) in order to comply with the
|
|
41554
|
+
* JSON-LD 1.1 specification.
|
|
41555
|
+
*
|
|
41077
41556
|
* @param input the input to normalize as JSON-LD or as a format specified by
|
|
41078
41557
|
* the 'inputFormat' option.
|
|
41079
41558
|
* @param [options] the options to use:
|
|
41080
41559
|
* [algorithm] the normalization algorithm to use, `URDNA2015` or
|
|
41081
41560
|
* `URGNA2012` (default: `URDNA2015`).
|
|
41082
|
-
* [base] the base IRI to use.
|
|
41561
|
+
* [base] the base IRI to use (default: `null`).
|
|
41083
41562
|
* [expandContext] a context to expand with.
|
|
41084
41563
|
* [skipExpansion] true to assume the input is expanded and skip
|
|
41085
41564
|
* expansion, false not to, defaults to false.
|
|
@@ -41089,6 +41568,7 @@ jsonld.link = async function(input, ctx, options) {
|
|
|
41089
41568
|
* 'application/n-quads' for N-Quads.
|
|
41090
41569
|
* [documentLoader(url, options)] the document loader.
|
|
41091
41570
|
* [useNative] true to use a native canonize algorithm
|
|
41571
|
+
* [safe] true to use safe mode. (default: true).
|
|
41092
41572
|
* [contextResolver] internal use only.
|
|
41093
41573
|
*
|
|
41094
41574
|
* @return a Promise that resolves to the normalized output.
|
|
@@ -41100,9 +41580,10 @@ jsonld.normalize = jsonld.canonize = async function(input, options) {
|
|
|
41100
41580
|
|
|
41101
41581
|
// set default options
|
|
41102
41582
|
options = _setDefaults(options, {
|
|
41103
|
-
base: _isString(input) ? input :
|
|
41583
|
+
base: _isString(input) ? input : null,
|
|
41104
41584
|
algorithm: 'URDNA2015',
|
|
41105
41585
|
skipExpansion: false,
|
|
41586
|
+
safe: true,
|
|
41106
41587
|
contextResolver: new ContextResolver(
|
|
41107
41588
|
{sharedCache: _resolvedContextCache})
|
|
41108
41589
|
});
|
|
@@ -41143,6 +41624,9 @@ jsonld.normalize = jsonld.canonize = async function(input, options) {
|
|
|
41143
41624
|
* (default: false).
|
|
41144
41625
|
* [useNativeTypes] true to convert XSD types into native types
|
|
41145
41626
|
* (boolean, integer, double), false not to (default: false).
|
|
41627
|
+
* [rdfDirection] 'i18n-datatype' to support RDF transformation of
|
|
41628
|
+
* @direction (default: null).
|
|
41629
|
+
* [safe] true to use safe mode. (default: false)
|
|
41146
41630
|
*
|
|
41147
41631
|
* @return a Promise that resolves to the JSON-LD document.
|
|
41148
41632
|
*/
|
|
@@ -41192,6 +41676,7 @@ jsonld.fromRDF = async function(dataset, options) {
|
|
|
41192
41676
|
* [produceGeneralizedRdf] true to output generalized RDF, false
|
|
41193
41677
|
* to produce only standard RDF (default: false).
|
|
41194
41678
|
* [documentLoader(url, options)] the document loader.
|
|
41679
|
+
* [safe] true to use safe mode. (default: false)
|
|
41195
41680
|
* [contextResolver] internal use only.
|
|
41196
41681
|
*
|
|
41197
41682
|
* @return a Promise that resolves to the RDF dataset.
|
|
@@ -41284,6 +41769,7 @@ jsonld.createNodeMap = async function(input, options) {
|
|
|
41284
41769
|
* new properties where a node is in the `object` position
|
|
41285
41770
|
* (default: true).
|
|
41286
41771
|
* [documentLoader(url, options)] the document loader.
|
|
41772
|
+
* [safe] true to use safe mode. (default: false)
|
|
41287
41773
|
* [contextResolver] internal use only.
|
|
41288
41774
|
*
|
|
41289
41775
|
* @return a Promise that resolves to the merged output.
|
|
@@ -41446,6 +41932,7 @@ jsonld.get = async function(url, options) {
|
|
|
41446
41932
|
* @param localCtx the local context to process.
|
|
41447
41933
|
* @param [options] the options to use:
|
|
41448
41934
|
* [documentLoader(url, options)] the document loader.
|
|
41935
|
+
* [safe] true to use safe mode. (default: false)
|
|
41449
41936
|
* [contextResolver] internal use only.
|
|
41450
41937
|
*
|
|
41451
41938
|
* @return a Promise that resolves to the new active context.
|
|
@@ -41531,6 +42018,14 @@ jsonld.registerRDFParser('application/nquads', NQuads.parse);
|
|
|
41531
42018
|
/* URL API */
|
|
41532
42019
|
jsonld.url = __webpack_require__(/*! ./url */ "./node_modules/jsonld/lib/url.js");
|
|
41533
42020
|
|
|
42021
|
+
/* Events API and handlers */
|
|
42022
|
+
jsonld.logEventHandler = _logEventHandler;
|
|
42023
|
+
jsonld.logWarningEventHandler = _logWarningEventHandler;
|
|
42024
|
+
jsonld.safeEventHandler = _safeEventHandler;
|
|
42025
|
+
jsonld.setDefaultEventHandler = _setDefaultEventHandler;
|
|
42026
|
+
jsonld.strictEventHandler = _strictEventHandler;
|
|
42027
|
+
jsonld.unhandledEventHandler = _unhandledEventHandler;
|
|
42028
|
+
|
|
41534
42029
|
/* Utility API */
|
|
41535
42030
|
jsonld.util = util;
|
|
41536
42031
|
// backwards compatibility
|
|
@@ -41552,7 +42047,24 @@ function _setDefaults(options, {
|
|
|
41552
42047
|
documentLoader = jsonld.documentLoader,
|
|
41553
42048
|
...defaults
|
|
41554
42049
|
}) {
|
|
41555
|
-
|
|
42050
|
+
// fail if obsolete options present
|
|
42051
|
+
if(options && 'compactionMap' in options) {
|
|
42052
|
+
throw new JsonLdError(
|
|
42053
|
+
'"compactionMap" not supported.',
|
|
42054
|
+
'jsonld.OptionsError');
|
|
42055
|
+
}
|
|
42056
|
+
if(options && 'expansionMap' in options) {
|
|
42057
|
+
throw new JsonLdError(
|
|
42058
|
+
'"expansionMap" not supported.',
|
|
42059
|
+
'jsonld.OptionsError');
|
|
42060
|
+
}
|
|
42061
|
+
return Object.assign(
|
|
42062
|
+
{},
|
|
42063
|
+
{documentLoader},
|
|
42064
|
+
defaults,
|
|
42065
|
+
options,
|
|
42066
|
+
{eventHandler: _setupEventHandler({options})}
|
|
42067
|
+
);
|
|
41556
42068
|
}
|
|
41557
42069
|
|
|
41558
42070
|
// end of jsonld API `wrapper` factory
|
|
@@ -41946,6 +42458,10 @@ const jsonCanonicalize = __webpack_require__(/*! canonicalize */ "./node_modules
|
|
|
41946
42458
|
const types = __webpack_require__(/*! ./types */ "./node_modules/jsonld/lib/types.js");
|
|
41947
42459
|
const util = __webpack_require__(/*! ./util */ "./node_modules/jsonld/lib/util.js");
|
|
41948
42460
|
|
|
42461
|
+
const {
|
|
42462
|
+
handleEvent: _handleEvent
|
|
42463
|
+
} = __webpack_require__(/*! ./events */ "./node_modules/jsonld/lib/events.js");
|
|
42464
|
+
|
|
41949
42465
|
const {
|
|
41950
42466
|
// RDF,
|
|
41951
42467
|
// RDF_LIST,
|
|
@@ -42002,6 +42518,20 @@ api.toRDF = (input, options) => {
|
|
|
42002
42518
|
graphTerm.value = graphName;
|
|
42003
42519
|
} else {
|
|
42004
42520
|
// skip relative IRIs (not valid RDF)
|
|
42521
|
+
if(options.eventHandler) {
|
|
42522
|
+
_handleEvent({
|
|
42523
|
+
event: {
|
|
42524
|
+
type: ['JsonLdEvent'],
|
|
42525
|
+
code: 'relative graph reference',
|
|
42526
|
+
level: 'warning',
|
|
42527
|
+
message: 'Relative graph reference found.',
|
|
42528
|
+
details: {
|
|
42529
|
+
graph: graphName
|
|
42530
|
+
}
|
|
42531
|
+
},
|
|
42532
|
+
options
|
|
42533
|
+
});
|
|
42534
|
+
}
|
|
42005
42535
|
continue;
|
|
42006
42536
|
}
|
|
42007
42537
|
_graphToRDF(dataset, nodeMap[graphName], graphTerm, issuer, options);
|
|
@@ -42043,6 +42573,20 @@ function _graphToRDF(dataset, graph, graphTerm, issuer, options) {
|
|
|
42043
42573
|
|
|
42044
42574
|
// skip relative IRI subjects (not valid RDF)
|
|
42045
42575
|
if(!_isAbsoluteIri(id)) {
|
|
42576
|
+
if(options.eventHandler) {
|
|
42577
|
+
_handleEvent({
|
|
42578
|
+
event: {
|
|
42579
|
+
type: ['JsonLdEvent'],
|
|
42580
|
+
code: 'relative subject reference',
|
|
42581
|
+
level: 'warning',
|
|
42582
|
+
message: 'Relative subject reference found.',
|
|
42583
|
+
details: {
|
|
42584
|
+
subject: id
|
|
42585
|
+
}
|
|
42586
|
+
},
|
|
42587
|
+
options
|
|
42588
|
+
});
|
|
42589
|
+
}
|
|
42046
42590
|
continue;
|
|
42047
42591
|
}
|
|
42048
42592
|
|
|
@@ -42054,18 +42598,48 @@ function _graphToRDF(dataset, graph, graphTerm, issuer, options) {
|
|
|
42054
42598
|
|
|
42055
42599
|
// skip relative IRI predicates (not valid RDF)
|
|
42056
42600
|
if(!_isAbsoluteIri(property)) {
|
|
42601
|
+
if(options.eventHandler) {
|
|
42602
|
+
_handleEvent({
|
|
42603
|
+
event: {
|
|
42604
|
+
type: ['JsonLdEvent'],
|
|
42605
|
+
code: 'relative predicate reference',
|
|
42606
|
+
level: 'warning',
|
|
42607
|
+
message: 'Relative predicate reference found.',
|
|
42608
|
+
details: {
|
|
42609
|
+
predicate: property
|
|
42610
|
+
}
|
|
42611
|
+
},
|
|
42612
|
+
options
|
|
42613
|
+
});
|
|
42614
|
+
}
|
|
42057
42615
|
continue;
|
|
42058
42616
|
}
|
|
42059
42617
|
|
|
42060
42618
|
// skip blank node predicates unless producing generalized RDF
|
|
42061
42619
|
if(predicate.termType === 'BlankNode' &&
|
|
42062
42620
|
!options.produceGeneralizedRdf) {
|
|
42621
|
+
if(options.eventHandler) {
|
|
42622
|
+
_handleEvent({
|
|
42623
|
+
event: {
|
|
42624
|
+
type: ['JsonLdEvent'],
|
|
42625
|
+
code: 'blank node predicate',
|
|
42626
|
+
level: 'warning',
|
|
42627
|
+
message: 'Dropping blank node predicate.',
|
|
42628
|
+
details: {
|
|
42629
|
+
// FIXME: add better issuer API to get reverse mapping
|
|
42630
|
+
property: issuer.getOldIds()
|
|
42631
|
+
.find(key => issuer.getId(key) === property)
|
|
42632
|
+
}
|
|
42633
|
+
},
|
|
42634
|
+
options
|
|
42635
|
+
});
|
|
42636
|
+
}
|
|
42063
42637
|
continue;
|
|
42064
42638
|
}
|
|
42065
42639
|
|
|
42066
42640
|
// convert list, value or node object to triple
|
|
42067
|
-
const object =
|
|
42068
|
-
|
|
42641
|
+
const object = _objectToRDF(
|
|
42642
|
+
item, issuer, dataset, graphTerm, options.rdfDirection, options);
|
|
42069
42643
|
// skip null objects (they are relative IRIs)
|
|
42070
42644
|
if(object) {
|
|
42071
42645
|
dataset.push({
|
|
@@ -42088,10 +42662,11 @@ function _graphToRDF(dataset, graph, graphTerm, issuer, options) {
|
|
|
42088
42662
|
* @param issuer a IdentifierIssuer for assigning blank node names.
|
|
42089
42663
|
* @param dataset the array of quads to append to.
|
|
42090
42664
|
* @param graphTerm the graph term for each quad.
|
|
42665
|
+
* @param options the RDF serialization options.
|
|
42091
42666
|
*
|
|
42092
42667
|
* @return the head of the list.
|
|
42093
42668
|
*/
|
|
42094
|
-
function _listToRDF(list, issuer, dataset, graphTerm, rdfDirection) {
|
|
42669
|
+
function _listToRDF(list, issuer, dataset, graphTerm, rdfDirection, options) {
|
|
42095
42670
|
const first = {termType: 'NamedNode', value: RDF_FIRST};
|
|
42096
42671
|
const rest = {termType: 'NamedNode', value: RDF_REST};
|
|
42097
42672
|
const nil = {termType: 'NamedNode', value: RDF_NIL};
|
|
@@ -42102,7 +42677,8 @@ function _listToRDF(list, issuer, dataset, graphTerm, rdfDirection) {
|
|
|
42102
42677
|
let subject = result;
|
|
42103
42678
|
|
|
42104
42679
|
for(const item of list) {
|
|
42105
|
-
const object = _objectToRDF(
|
|
42680
|
+
const object = _objectToRDF(
|
|
42681
|
+
item, issuer, dataset, graphTerm, rdfDirection, options);
|
|
42106
42682
|
const next = {termType: 'BlankNode', value: issuer.getId()};
|
|
42107
42683
|
dataset.push({
|
|
42108
42684
|
subject,
|
|
@@ -42121,7 +42697,8 @@ function _listToRDF(list, issuer, dataset, graphTerm, rdfDirection) {
|
|
|
42121
42697
|
|
|
42122
42698
|
// Tail of list
|
|
42123
42699
|
if(last) {
|
|
42124
|
-
const object = _objectToRDF(
|
|
42700
|
+
const object = _objectToRDF(
|
|
42701
|
+
last, issuer, dataset, graphTerm, rdfDirection, options);
|
|
42125
42702
|
dataset.push({
|
|
42126
42703
|
subject,
|
|
42127
42704
|
predicate: first,
|
|
@@ -42147,10 +42724,13 @@ function _listToRDF(list, issuer, dataset, graphTerm, rdfDirection) {
|
|
|
42147
42724
|
* @param issuer a IdentifierIssuer for assigning blank node names.
|
|
42148
42725
|
* @param dataset the dataset to append RDF quads to.
|
|
42149
42726
|
* @param graphTerm the graph term for each quad.
|
|
42727
|
+
* @param options the RDF serialization options.
|
|
42150
42728
|
*
|
|
42151
42729
|
* @return the RDF literal or RDF resource.
|
|
42152
42730
|
*/
|
|
42153
|
-
function _objectToRDF(
|
|
42731
|
+
function _objectToRDF(
|
|
42732
|
+
item, issuer, dataset, graphTerm, rdfDirection, options
|
|
42733
|
+
) {
|
|
42154
42734
|
const object = {};
|
|
42155
42735
|
|
|
42156
42736
|
// convert value object to RDF
|
|
@@ -42196,8 +42776,8 @@ function _objectToRDF(item, issuer, dataset, graphTerm, rdfDirection) {
|
|
|
42196
42776
|
object.datatype.value = datatype || XSD_STRING;
|
|
42197
42777
|
}
|
|
42198
42778
|
} else if(graphTypes.isList(item)) {
|
|
42199
|
-
const _list =
|
|
42200
|
-
|
|
42779
|
+
const _list = _listToRDF(
|
|
42780
|
+
item['@list'], issuer, dataset, graphTerm, rdfDirection, options);
|
|
42201
42781
|
object.termType = _list.termType;
|
|
42202
42782
|
object.value = _list.value;
|
|
42203
42783
|
} else {
|
|
@@ -42209,6 +42789,20 @@ function _objectToRDF(item, issuer, dataset, graphTerm, rdfDirection) {
|
|
|
42209
42789
|
|
|
42210
42790
|
// skip relative IRIs, not valid RDF
|
|
42211
42791
|
if(object.termType === 'NamedNode' && !_isAbsoluteIri(object.value)) {
|
|
42792
|
+
if(options.eventHandler) {
|
|
42793
|
+
_handleEvent({
|
|
42794
|
+
event: {
|
|
42795
|
+
type: ['JsonLdEvent'],
|
|
42796
|
+
code: 'relative object reference',
|
|
42797
|
+
level: 'warning',
|
|
42798
|
+
message: 'Relative object reference found.',
|
|
42799
|
+
details: {
|
|
42800
|
+
object: object.value
|
|
42801
|
+
}
|
|
42802
|
+
},
|
|
42803
|
+
options
|
|
42804
|
+
});
|
|
42805
|
+
}
|
|
42212
42806
|
return null;
|
|
42213
42807
|
}
|
|
42214
42808
|
|
|
@@ -42652,10 +43246,12 @@ const IdentifierIssuer = (__webpack_require__(/*! rdf-canonize */ "./node_module
|
|
|
42652
43246
|
const JsonLdError = __webpack_require__(/*! ./JsonLdError */ "./node_modules/jsonld/lib/JsonLdError.js");
|
|
42653
43247
|
|
|
42654
43248
|
// constants
|
|
43249
|
+
const REGEX_BCP47 = /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;
|
|
42655
43250
|
const REGEX_LINK_HEADERS = /(?:<[^>]*?>|"[^"]*?"|[^,])+/g;
|
|
42656
43251
|
const REGEX_LINK_HEADER = /\s*<([^>]*?)>\s*(?:;\s*(.*))?/;
|
|
42657
43252
|
const REGEX_LINK_HEADER_PARAMS =
|
|
42658
43253
|
/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g;
|
|
43254
|
+
const REGEX_KEYWORD = /^@[a-zA-Z]+$/;
|
|
42659
43255
|
|
|
42660
43256
|
const DEFAULTS = {
|
|
42661
43257
|
headers: {
|
|
@@ -42666,6 +43262,8 @@ const DEFAULTS = {
|
|
|
42666
43262
|
const api = {};
|
|
42667
43263
|
module.exports = api;
|
|
42668
43264
|
api.IdentifierIssuer = IdentifierIssuer;
|
|
43265
|
+
api.REGEX_BCP47 = REGEX_BCP47;
|
|
43266
|
+
api.REGEX_KEYWORD = REGEX_KEYWORD;
|
|
42669
43267
|
|
|
42670
43268
|
/**
|
|
42671
43269
|
* Clones an object, array, Map, Set, or string/number. If a typed JavaScript
|
|
@@ -42772,7 +43370,7 @@ api.parseLinkHeader = header => {
|
|
|
42772
43370
|
while((match = REGEX_LINK_HEADER_PARAMS.exec(params))) {
|
|
42773
43371
|
result[match[1]] = (match[2] === undefined) ? match[3] : match[2];
|
|
42774
43372
|
}
|
|
42775
|
-
const rel = result
|
|
43373
|
+
const rel = result.rel || '';
|
|
42776
43374
|
if(Array.isArray(rval[rel])) {
|
|
42777
43375
|
rval[rel].push(result);
|
|
42778
43376
|
} else if(rval.hasOwnProperty(rel)) {
|
|
@@ -52438,10 +53036,11 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
52438
53036
|
}, {
|
|
52439
53037
|
key: "substitute",
|
|
52440
53038
|
value: function substitute(bindings) {
|
|
52441
|
-
var
|
|
52442
|
-
|
|
53039
|
+
var collection = new Collection();
|
|
53040
|
+
this.elements.forEach(function (ea) {
|
|
53041
|
+
collection.append(ea.substitute(bindings));
|
|
52443
53042
|
});
|
|
52444
|
-
return
|
|
53043
|
+
return collection;
|
|
52445
53044
|
}
|
|
52446
53045
|
}, {
|
|
52447
53046
|
key: "toNT",
|
|
@@ -54278,16 +54877,17 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54278
54877
|
var fetcher = this;
|
|
54279
54878
|
// @ts-ignore
|
|
54280
54879
|
if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {
|
|
54281
|
-
console.log('Internal error - fetchQueue exists ' + uri)
|
|
54880
|
+
// console.log('Internal error - fetchQueue exists ' + uri)
|
|
54282
54881
|
var promise = fetcher.fetchQueue[uri];
|
|
54283
54882
|
if (promise['PromiseStatus'] === 'resolved') {
|
|
54284
54883
|
delete fetcher.fetchQueue[uri];
|
|
54285
54884
|
} else {
|
|
54286
54885
|
// pending
|
|
54287
54886
|
delete fetcher.fetchQueue[uri];
|
|
54288
|
-
console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
54887
|
+
// console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
54289
54888
|
}
|
|
54290
54889
|
}
|
|
54890
|
+
|
|
54291
54891
|
if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' && fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {
|
|
54292
54892
|
var msg = "Rdflib: fetcher: Destructive operation on <".concat(fetcher.requested[uri], "> file being fetched! ") + uri;
|
|
54293
54893
|
console.error(msg);
|
|
@@ -56152,6 +56752,9 @@ function jsonldParser(str, kb, base, callback) {
|
|
|
56152
56752
|
var baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;
|
|
56153
56753
|
return jsonld__WEBPACK_IMPORTED_MODULE_0___default().flatten(JSON.parse(str), null, {
|
|
56154
56754
|
base: baseString
|
|
56755
|
+
}).then(function (flattened) {
|
|
56756
|
+
console.log(flattened);
|
|
56757
|
+
return flattened;
|
|
56155
56758
|
}).then(function (flattened) {
|
|
56156
56759
|
return flattened.reduce(function (store, flatResource) {
|
|
56157
56760
|
kb = processResource(kb, base, flatResource);
|
|
@@ -61239,7 +61842,7 @@ contentType, callback, options) {
|
|
|
61239
61842
|
documentString = sz.statementsToNTriples(newSts);
|
|
61240
61843
|
return executeCallback(null, documentString);
|
|
61241
61844
|
case _types__WEBPACK_IMPORTED_MODULE_0__.JSONLDContentType:
|
|
61242
|
-
sz.setFlags('si'); //
|
|
61845
|
+
sz.setFlags('si dr'); // turtle + dr (means no default, no relative prefix)
|
|
61243
61846
|
documentString = sz.statementsToJsonld(newSts); // convert via turtle
|
|
61244
61847
|
return executeCallback(null, documentString);
|
|
61245
61848
|
case _types__WEBPACK_IMPORTED_MODULE_0__.NQuadsContentType:
|
|
@@ -61311,7 +61914,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
61311
61914
|
|
|
61312
61915
|
|
|
61313
61916
|
|
|
61314
|
-
// import * as jsonld from 'jsonld'
|
|
61315
61917
|
|
|
61316
61918
|
function createSerializer(store) {
|
|
61317
61919
|
return new Serializer(store);
|
|
@@ -61818,7 +62420,7 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
61818
62420
|
var termToN3 = termToN3Method.bind(this);
|
|
61819
62421
|
function prefixDirectivesMethod() {
|
|
61820
62422
|
var str = '';
|
|
61821
|
-
if (this.defaultNamespace) {
|
|
62423
|
+
if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {
|
|
61822
62424
|
str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\n';
|
|
61823
62425
|
}
|
|
61824
62426
|
for (var ns in this.prefixes) {
|
|
@@ -62303,20 +62905,19 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
62303
62905
|
key: "statementsToJsonld",
|
|
62304
62906
|
value: function statementsToJsonld(sts) {
|
|
62305
62907
|
// ttl2jsonld creates context keys for all ttl prefix
|
|
62306
|
-
// context keys must be
|
|
62307
|
-
function findId(itemObj) {
|
|
62908
|
+
// context keys must be absolute IRI ttl2jsonld@0.0.8
|
|
62909
|
+
/* function findId (itemObj) {
|
|
62308
62910
|
if (itemObj['@id']) {
|
|
62309
|
-
|
|
62310
|
-
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
62911
|
+
const item = itemObj['@id'].split(':')
|
|
62912
|
+
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
62311
62913
|
}
|
|
62312
|
-
|
|
62313
|
-
for (
|
|
62314
|
-
if (typeof itemValues[i] !== 'string') {
|
|
62315
|
-
|
|
62316
|
-
findId(itemValues[i]);
|
|
62914
|
+
const itemValues = Object.values(itemObj)
|
|
62915
|
+
for (const i in itemValues) {
|
|
62916
|
+
if (typeof itemValues[i] !== 'string') { // @list contains array
|
|
62917
|
+
findId(itemValues[i])
|
|
62317
62918
|
}
|
|
62318
62919
|
}
|
|
62319
|
-
}
|
|
62920
|
+
} */
|
|
62320
62921
|
var turtleDoc = this.statementsToN3(sts);
|
|
62321
62922
|
var jsonldObj = _frogcat_ttl2jsonld__WEBPACK_IMPORTED_MODULE_4__.parse(turtleDoc);
|
|
62322
62923
|
return JSON.stringify(jsonldObj, null, 2);
|
|
@@ -63255,9 +63856,9 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
63255
63856
|
// console.log('ds before substitute: ' + ds)
|
|
63256
63857
|
if (binding) ds = ds.substitute(binding);
|
|
63257
63858
|
// console.log('applyPatch: delete: ' + ds)
|
|
63258
|
-
|
|
63859
|
+
|
|
63259
63860
|
var bad = [];
|
|
63260
|
-
var ds2 = ds.map(function (st) {
|
|
63861
|
+
var ds2 = ds.elements.map(function (st) {
|
|
63261
63862
|
// Find the actual statements in the store
|
|
63262
63863
|
var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target);
|
|
63263
63864
|
if (sts.length === 0) {
|
|
@@ -63282,8 +63883,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
63282
63883
|
// log.info("doPatch insert "+patch['insert'])
|
|
63283
63884
|
ds = patch['insert'];
|
|
63284
63885
|
if (binding) ds = ds.substitute(binding);
|
|
63285
|
-
ds
|
|
63286
|
-
ds.map(function (st) {
|
|
63886
|
+
ds.elements.map(function (st) {
|
|
63287
63887
|
st.graph = target;
|
|
63288
63888
|
targetKB.add(st.subject, st.predicate, st.object, st.graph);
|
|
63289
63889
|
});
|
|
@@ -63300,6 +63900,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
63300
63900
|
//@ts-ignore TODO: add sync property to Query when converting Query to typescript
|
|
63301
63901
|
query.sync = true;
|
|
63302
63902
|
var bindingsFound = [];
|
|
63903
|
+
query.pat.initBindings = [];
|
|
63303
63904
|
targetKB.query(query, function onBinding(binding) {
|
|
63304
63905
|
bindingsFound.push(binding);
|
|
63305
63906
|
// console.log(' got a binding: ' + bindingDebug(binding))
|
|
@@ -66818,15 +67419,13 @@ function createAclLogic(store) {
|
|
|
66818
67419
|
var ns = ns_1.ns;
|
|
66819
67420
|
function findAclDocUrl(url) {
|
|
66820
67421
|
return __awaiter(this, void 0, void 0, function () {
|
|
66821
|
-
var
|
|
67422
|
+
var docNode;
|
|
66822
67423
|
return __generator(this, function (_a) {
|
|
66823
67424
|
switch (_a.label) {
|
|
66824
|
-
case 0:
|
|
66825
|
-
doc = store.sym(url);
|
|
66826
|
-
return [4 /*yield*/, store.fetcher.load(doc)];
|
|
67425
|
+
case 0: return [4 /*yield*/, store.fetcher.load(url)];
|
|
66827
67426
|
case 1:
|
|
66828
67427
|
_a.sent();
|
|
66829
|
-
docNode = store.any(
|
|
67428
|
+
docNode = store.any(url, exports.ACL_LINK);
|
|
66830
67429
|
if (!docNode) {
|
|
66831
67430
|
throw new Error("No ACL link discovered for ".concat(url));
|
|
66832
67431
|
}
|
|
@@ -67634,7 +68233,7 @@ function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, acl
|
|
|
67634
68233
|
case 2: return [4 /*yield*/, profileLogic.getMainInbox(user)];
|
|
67635
68234
|
case 3:
|
|
67636
68235
|
inbox = _a.sent();
|
|
67637
|
-
return [4 /*yield*/, containerLogic.getContainerMembers(inbox
|
|
68236
|
+
return [4 /*yield*/, containerLogic.getContainerMembers(inbox)];
|
|
67638
68237
|
case 4:
|
|
67639
68238
|
urls = _a.sent();
|
|
67640
68239
|
return [2 /*return*/, urls.filter(function (url) { return !containerLogic.isContainer(url); })];
|
|
@@ -68790,19 +69389,21 @@ var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/inde
|
|
|
68790
69389
|
function createContainerLogic(store) {
|
|
68791
69390
|
function getContainerElements(containerNode) {
|
|
68792
69391
|
return store
|
|
68793
|
-
.statementsMatching(containerNode, (0, rdflib_1.sym)("http://www.w3.org/ns/ldp#contains"), undefined
|
|
69392
|
+
.statementsMatching(containerNode, (0, rdflib_1.sym)("http://www.w3.org/ns/ldp#contains"), undefined)
|
|
68794
69393
|
.map(function (st) { return st.object; });
|
|
68795
69394
|
}
|
|
68796
69395
|
function isContainer(url) {
|
|
68797
|
-
|
|
69396
|
+
var nodeToString = url.value;
|
|
69397
|
+
return nodeToString.charAt(nodeToString.length - 1) === "/";
|
|
68798
69398
|
}
|
|
68799
69399
|
function createContainer(url) {
|
|
68800
69400
|
return __awaiter(this, void 0, void 0, function () {
|
|
68801
|
-
var result;
|
|
69401
|
+
var stringToNode, result;
|
|
68802
69402
|
return __generator(this, function (_a) {
|
|
68803
69403
|
switch (_a.label) {
|
|
68804
69404
|
case 0:
|
|
68805
|
-
|
|
69405
|
+
stringToNode = (0, rdflib_1.sym)(url);
|
|
69406
|
+
if (!isContainer(stringToNode)) {
|
|
68806
69407
|
throw new Error("Not a container URL ".concat(url));
|
|
68807
69408
|
}
|
|
68808
69409
|
return [4 /*yield*/, store.fetcher._fetch(url, {
|
|
@@ -68826,16 +69427,12 @@ function createContainerLogic(store) {
|
|
|
68826
69427
|
}
|
|
68827
69428
|
function getContainerMembers(containerUrl) {
|
|
68828
69429
|
return __awaiter(this, void 0, void 0, function () {
|
|
68829
|
-
var containerNode, nodes;
|
|
68830
69430
|
return __generator(this, function (_a) {
|
|
68831
69431
|
switch (_a.label) {
|
|
68832
|
-
case 0:
|
|
68833
|
-
containerNode = store.sym(containerUrl);
|
|
68834
|
-
return [4 /*yield*/, store.fetcher.load(containerNode)];
|
|
69432
|
+
case 0: return [4 /*yield*/, store.fetcher.load(containerUrl)];
|
|
68835
69433
|
case 1:
|
|
68836
69434
|
_a.sent();
|
|
68837
|
-
|
|
68838
|
-
return [2 /*return*/, nodes.map(function (node) { return node.value; })];
|
|
69435
|
+
return [2 /*return*/, getContainerElements(containerUrl)];
|
|
68839
69436
|
}
|
|
68840
69437
|
});
|
|
68841
69438
|
});
|
|
@@ -69021,28 +69618,30 @@ var CustomError_1 = __webpack_require__(/*! ../logic/CustomError */ "./node_modu
|
|
|
69021
69618
|
var debug = __importStar(__webpack_require__(/*! ../util/debug */ "./node_modules/solid-logic/lib/util/debug.js"));
|
|
69022
69619
|
var utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/solid-logic/lib/util/utils.js");
|
|
69023
69620
|
function createUtilityLogic(store, aclLogic, containerLogic) {
|
|
69024
|
-
function recursiveDelete(
|
|
69621
|
+
function recursiveDelete(containerNode) {
|
|
69025
69622
|
return __awaiter(this, void 0, void 0, function () {
|
|
69026
|
-
var aclDocUrl, containerMembers, e_1;
|
|
69623
|
+
var aclDocUrl, containerMembers, nodeToStringHere, e_1;
|
|
69027
69624
|
return __generator(this, function (_a) {
|
|
69028
69625
|
switch (_a.label) {
|
|
69029
69626
|
case 0:
|
|
69030
69627
|
_a.trys.push([0, 6, , 7]);
|
|
69031
|
-
if (!containerLogic.isContainer(
|
|
69032
|
-
return [4 /*yield*/, aclLogic.findAclDocUrl(
|
|
69628
|
+
if (!containerLogic.isContainer(containerNode)) return [3 /*break*/, 5];
|
|
69629
|
+
return [4 /*yield*/, aclLogic.findAclDocUrl(containerNode)];
|
|
69033
69630
|
case 1:
|
|
69034
69631
|
aclDocUrl = _a.sent();
|
|
69035
69632
|
return [4 /*yield*/, store.fetcher._fetch(aclDocUrl, { method: "DELETE" })];
|
|
69036
69633
|
case 2:
|
|
69037
69634
|
_a.sent();
|
|
69038
|
-
return [4 /*yield*/, containerLogic.getContainerMembers(
|
|
69635
|
+
return [4 /*yield*/, containerLogic.getContainerMembers(containerNode)];
|
|
69039
69636
|
case 3:
|
|
69040
69637
|
containerMembers = _a.sent();
|
|
69041
69638
|
return [4 /*yield*/, Promise.all(containerMembers.map(function (url) { return recursiveDelete(url); }))];
|
|
69042
69639
|
case 4:
|
|
69043
69640
|
_a.sent();
|
|
69044
69641
|
_a.label = 5;
|
|
69045
|
-
case 5:
|
|
69642
|
+
case 5:
|
|
69643
|
+
nodeToStringHere = containerNode.value;
|
|
69644
|
+
return [2 /*return*/, store.fetcher._fetch(nodeToStringHere, { method: "DELETE" })];
|
|
69046
69645
|
case 6:
|
|
69047
69646
|
e_1 = _a.sent();
|
|
69048
69647
|
return [3 /*break*/, 7];
|
|
@@ -69187,7 +69786,7 @@ function createUtilityLogic(store, aclLogic, containerLogic) {
|
|
|
69187
69786
|
''
|
|
69188
69787
|
].join('\n');
|
|
69189
69788
|
}
|
|
69190
|
-
return [4 /*yield*/, aclLogic.findAclDocUrl(options.target)];
|
|
69789
|
+
return [4 /*yield*/, aclLogic.findAclDocUrl((0, rdflib_1.sym)(options.target))];
|
|
69191
69790
|
case 1:
|
|
69192
69791
|
aclDocUrl = _a.sent();
|
|
69193
69792
|
return [2 /*return*/, store.fetcher._fetch(aclDocUrl, {
|
|
@@ -73559,6 +74158,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
73559
74158
|
/* harmony export */ "getWebidFromTokenPayload": () => (/* binding */ getWebidFromTokenPayload),
|
|
73560
74159
|
/* harmony export */ "handleRegistration": () => (/* binding */ handleRegistration),
|
|
73561
74160
|
/* harmony export */ "isSupportedTokenType": () => (/* binding */ isSupportedTokenType),
|
|
74161
|
+
/* harmony export */ "isValidRedirectUrl": () => (/* binding */ isValidRedirectUrl),
|
|
73562
74162
|
/* harmony export */ "loadOidcContextFromStorage": () => (/* binding */ loadOidcContextFromStorage),
|
|
73563
74163
|
/* harmony export */ "mockStorage": () => (/* binding */ mockStorage),
|
|
73564
74164
|
/* harmony export */ "mockStorageUtility": () => (/* binding */ mockStorageUtility),
|
|
@@ -73665,6 +74265,16 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
73665
74265
|
}
|
|
73666
74266
|
}
|
|
73667
74267
|
|
|
74268
|
+
function isValidRedirectUrl(redirectUrl) {
|
|
74269
|
+
try {
|
|
74270
|
+
const urlObject = new URL(redirectUrl);
|
|
74271
|
+
return urlObject.hash === "";
|
|
74272
|
+
}
|
|
74273
|
+
catch (e) {
|
|
74274
|
+
return false;
|
|
74275
|
+
}
|
|
74276
|
+
}
|
|
74277
|
+
|
|
73668
74278
|
function isSupportedTokenType(token) {
|
|
73669
74279
|
return typeof token === "string" && ["DPoP", "Bearer"].includes(token);
|
|
73670
74280
|
}
|
|
@@ -75034,7 +75644,7 @@ class LocalJWKSet {
|
|
|
75034
75644
|
this._jwks = clone(jwks);
|
|
75035
75645
|
}
|
|
75036
75646
|
async getKey(protectedHeader, token) {
|
|
75037
|
-
const { alg, kid } = { ...protectedHeader, ...token.header };
|
|
75647
|
+
const { alg, kid } = { ...protectedHeader, ...token === null || token === void 0 ? void 0 : token.header };
|
|
75038
75648
|
const kty = getKtyFromAlg(alg);
|
|
75039
75649
|
const candidates = this._jwks.keys.filter((jwk) => {
|
|
75040
75650
|
let candidate = kty === jwk.kty;
|
|
@@ -75076,18 +75686,33 @@ class LocalJWKSet {
|
|
|
75076
75686
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey();
|
|
75077
75687
|
}
|
|
75078
75688
|
else if (length !== 1) {
|
|
75079
|
-
|
|
75689
|
+
const error = new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSMultipleMatchingKeys();
|
|
75690
|
+
const { _cached } = this;
|
|
75691
|
+
error[Symbol.asyncIterator] = async function* () {
|
|
75692
|
+
for (const jwk of candidates) {
|
|
75693
|
+
try {
|
|
75694
|
+
yield await importWithAlgCache(_cached, jwk, alg);
|
|
75695
|
+
}
|
|
75696
|
+
catch (_a) {
|
|
75697
|
+
continue;
|
|
75698
|
+
}
|
|
75699
|
+
}
|
|
75700
|
+
};
|
|
75701
|
+
throw error;
|
|
75080
75702
|
}
|
|
75081
|
-
|
|
75082
|
-
|
|
75083
|
-
|
|
75084
|
-
|
|
75085
|
-
|
|
75086
|
-
|
|
75087
|
-
|
|
75703
|
+
return importWithAlgCache(this._cached, jwk, alg);
|
|
75704
|
+
}
|
|
75705
|
+
}
|
|
75706
|
+
async function importWithAlgCache(cache, jwk, alg) {
|
|
75707
|
+
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
75708
|
+
if (cached[alg] === undefined) {
|
|
75709
|
+
const keyObject = await (0,_key_import_js__WEBPACK_IMPORTED_MODULE_0__.importJWK)({ ...jwk, ext: true }, alg);
|
|
75710
|
+
if (keyObject.type !== 'public') {
|
|
75711
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set members must be public keys');
|
|
75088
75712
|
}
|
|
75089
|
-
|
|
75713
|
+
cached[alg] = keyObject;
|
|
75090
75714
|
}
|
|
75715
|
+
return cached[alg];
|
|
75091
75716
|
}
|
|
75092
75717
|
function createLocalJWKSet(jwks) {
|
|
75093
75718
|
return LocalJWKSet.prototype.getKey.bind(new LocalJWKSet(jwks));
|
|
@@ -76516,13 +77141,13 @@ function checkSigCryptoKey(key, alg, ...usages) {
|
|
|
76516
77141
|
throw unusable(`SHA-${expected}`, 'algorithm.hash');
|
|
76517
77142
|
break;
|
|
76518
77143
|
}
|
|
76519
|
-
case (0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA': {
|
|
76520
|
-
if (!isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
76521
|
-
throw unusable('NODE-ED25519');
|
|
76522
|
-
break;
|
|
76523
|
-
}
|
|
76524
77144
|
case 'EdDSA': {
|
|
76525
77145
|
if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
|
|
77146
|
+
if ((0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
77147
|
+
if (isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
77148
|
+
break;
|
|
77149
|
+
throw unusable('Ed25519, Ed448, or NODE-ED25519');
|
|
77150
|
+
}
|
|
76526
77151
|
throw unusable('Ed25519 or Ed448');
|
|
76527
77152
|
}
|
|
76528
77153
|
break;
|
|
@@ -77407,7 +78032,7 @@ const getNamedCurve = (keyData) => {
|
|
|
77407
78032
|
}
|
|
77408
78033
|
};
|
|
77409
78034
|
const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
77410
|
-
var _a;
|
|
78035
|
+
var _a, _b;
|
|
77411
78036
|
let algorithm;
|
|
77412
78037
|
let keyUsages;
|
|
77413
78038
|
const keyData = new Uint8Array(atob(pem.replace(replace, ''))
|
|
@@ -77458,12 +78083,6 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
77458
78083
|
keyUsages = isPublic ? [] : ['deriveBits'];
|
|
77459
78084
|
break;
|
|
77460
78085
|
}
|
|
77461
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA': {
|
|
77462
|
-
const namedCurve = getNamedCurve(keyData).toUpperCase();
|
|
77463
|
-
algorithm = { name: `NODE-${namedCurve}`, namedCurve: `NODE-${namedCurve}` };
|
|
77464
|
-
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
77465
|
-
break;
|
|
77466
|
-
}
|
|
77467
78086
|
case 'EdDSA':
|
|
77468
78087
|
algorithm = { name: getNamedCurve(keyData) };
|
|
77469
78088
|
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
@@ -77471,7 +78090,18 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
77471
78090
|
default:
|
|
77472
78091
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
|
|
77473
78092
|
}
|
|
77474
|
-
|
|
78093
|
+
try {
|
|
78094
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
|
|
78095
|
+
}
|
|
78096
|
+
catch (err) {
|
|
78097
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78098
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78099
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78100
|
+
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78101
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_b = options === null || options === void 0 ? void 0 : options.extractable) !== null && _b !== void 0 ? _b : false, keyUsages);
|
|
78102
|
+
}
|
|
78103
|
+
throw err;
|
|
78104
|
+
}
|
|
77475
78105
|
};
|
|
77476
78106
|
const fromPKCS8 = (pem, alg, options) => {
|
|
77477
78107
|
return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options);
|
|
@@ -78036,7 +78666,7 @@ function getModulusLengthOption(options) {
|
|
|
78036
78666
|
return modulusLength;
|
|
78037
78667
|
}
|
|
78038
78668
|
async function generateKeyPair(alg, options) {
|
|
78039
|
-
var _a, _b, _c;
|
|
78669
|
+
var _a, _b, _c, _d;
|
|
78040
78670
|
let algorithm;
|
|
78041
78671
|
let keyUsages;
|
|
78042
78672
|
switch (alg) {
|
|
@@ -78086,17 +78716,6 @@ async function generateKeyPair(alg, options) {
|
|
|
78086
78716
|
algorithm = { name: 'ECDSA', namedCurve: 'P-521' };
|
|
78087
78717
|
keyUsages = ['sign', 'verify'];
|
|
78088
78718
|
break;
|
|
78089
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA':
|
|
78090
|
-
switch (options === null || options === void 0 ? void 0 : options.crv) {
|
|
78091
|
-
case undefined:
|
|
78092
|
-
case 'Ed25519':
|
|
78093
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78094
|
-
keyUsages = ['sign', 'verify'];
|
|
78095
|
-
break;
|
|
78096
|
-
default:
|
|
78097
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported crv option provided');
|
|
78098
|
-
}
|
|
78099
|
-
break;
|
|
78100
78719
|
case 'EdDSA':
|
|
78101
78720
|
keyUsages = ['sign', 'verify'];
|
|
78102
78721
|
const crv = (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : 'Ed25519';
|
|
@@ -78134,7 +78753,18 @@ async function generateKeyPair(alg, options) {
|
|
|
78134
78753
|
default:
|
|
78135
78754
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78136
78755
|
}
|
|
78137
|
-
|
|
78756
|
+
try {
|
|
78757
|
+
return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages));
|
|
78758
|
+
}
|
|
78759
|
+
catch (err) {
|
|
78760
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78761
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78762
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78763
|
+
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78764
|
+
return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_d = options === null || options === void 0 ? void 0 : options.extractable) !== null && _d !== void 0 ? _d : false, keyUsages));
|
|
78765
|
+
}
|
|
78766
|
+
throw err;
|
|
78767
|
+
}
|
|
78138
78768
|
}
|
|
78139
78769
|
|
|
78140
78770
|
|
|
@@ -78314,19 +78944,6 @@ function subtleMapping(jwk) {
|
|
|
78314
78944
|
}
|
|
78315
78945
|
break;
|
|
78316
78946
|
}
|
|
78317
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'OKP':
|
|
78318
|
-
if (jwk.alg !== 'EdDSA') {
|
|
78319
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78320
|
-
}
|
|
78321
|
-
switch (jwk.crv) {
|
|
78322
|
-
case 'Ed25519':
|
|
78323
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78324
|
-
keyUsages = jwk.d ? ['sign'] : ['verify'];
|
|
78325
|
-
break;
|
|
78326
|
-
default:
|
|
78327
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78328
|
-
}
|
|
78329
|
-
break;
|
|
78330
78947
|
case 'OKP': {
|
|
78331
78948
|
switch (jwk.alg) {
|
|
78332
78949
|
case 'EdDSA':
|
|
@@ -78364,7 +78981,18 @@ const parse = async (jwk) => {
|
|
|
78364
78981
|
const keyData = { ...jwk };
|
|
78365
78982
|
delete keyData.alg;
|
|
78366
78983
|
delete keyData.use;
|
|
78367
|
-
|
|
78984
|
+
try {
|
|
78985
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
78986
|
+
}
|
|
78987
|
+
catch (err) {
|
|
78988
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78989
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78990
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78991
|
+
rest[0] = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78992
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
78993
|
+
}
|
|
78994
|
+
throw err;
|
|
78995
|
+
}
|
|
78368
78996
|
};
|
|
78369
78997
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
|
|
78370
78998
|
|
|
@@ -78629,10 +79257,10 @@ function subtleDsa(alg, algorithm) {
|
|
|
78629
79257
|
case 'ES384':
|
|
78630
79258
|
case 'ES512':
|
|
78631
79259
|
return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
|
|
78632
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA':
|
|
78633
|
-
const { namedCurve } = algorithm;
|
|
78634
|
-
return { name: namedCurve, namedCurve };
|
|
78635
79260
|
case 'EdDSA':
|
|
79261
|
+
if ((0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && algorithm.name === 'NODE-ED25519') {
|
|
79262
|
+
return { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
79263
|
+
}
|
|
78636
79264
|
return { name: algorithm.name };
|
|
78637
79265
|
default:
|
|
78638
79266
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
@@ -79056,6 +79684,7 @@ class JWKSMultipleMatchingKeys extends JOSEError {
|
|
|
79056
79684
|
return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
|
79057
79685
|
}
|
|
79058
79686
|
}
|
|
79687
|
+
Symbol.asyncIterator;
|
|
79059
79688
|
class JWKSTimeout extends JOSEError {
|
|
79060
79689
|
constructor() {
|
|
79061
79690
|
super(...arguments);
|