solid-ui 2.4.27-c461bad8 → 2.4.27-f9084b4c
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/solid-ui.js +189 -91
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +26 -22
- package/lib/login/login.js.map +1 -1
- package/lib/versionInfo.js +5 -5
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/forms.js +8 -4
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +2 -2
package/dist/solid-ui.js
CHANGED
|
@@ -7170,6 +7170,8 @@ function renderSignInPopup(dom) {
|
|
|
7170
7170
|
while (1) switch (_context.prev = _context.next) {
|
|
7171
7171
|
case 0:
|
|
7172
7172
|
_context.prev = 0;
|
|
7173
|
+
// clear authorization metadata from store
|
|
7174
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7173
7175
|
// Save hash
|
|
7174
7176
|
preLoginRedirectHash = new URL(window.location.href).hash;
|
|
7175
7177
|
if (preLoginRedirectHash) {
|
|
@@ -7179,23 +7181,23 @@ function renderSignInPopup(dom) {
|
|
|
7179
7181
|
// Login
|
|
7180
7182
|
locationUrl = new URL(window.location.href);
|
|
7181
7183
|
locationUrl.hash = ''; // remove hash part
|
|
7182
|
-
_context.next =
|
|
7184
|
+
_context.next = 9;
|
|
7183
7185
|
return _solidLogic.authSession.login({
|
|
7184
7186
|
redirectUrl: locationUrl.href,
|
|
7185
7187
|
oidcIssuer: issuerUri
|
|
7186
7188
|
});
|
|
7187
|
-
case
|
|
7188
|
-
_context.next =
|
|
7189
|
+
case 9:
|
|
7190
|
+
_context.next = 14;
|
|
7189
7191
|
break;
|
|
7190
|
-
case
|
|
7191
|
-
_context.prev =
|
|
7192
|
+
case 11:
|
|
7193
|
+
_context.prev = 11;
|
|
7192
7194
|
_context.t0 = _context["catch"](0);
|
|
7193
7195
|
(0, _log.alert)(_context.t0.message);
|
|
7194
|
-
case
|
|
7196
|
+
case 14:
|
|
7195
7197
|
case "end":
|
|
7196
7198
|
return _context.stop();
|
|
7197
7199
|
}
|
|
7198
|
-
}, _callee, null, [[0,
|
|
7200
|
+
}, _callee, null, [[0, 11]]);
|
|
7199
7201
|
}));
|
|
7200
7202
|
return function loginToIssuer(_x11) {
|
|
7201
7203
|
return _ref.apply(this, arguments);
|
|
@@ -7347,45 +7349,47 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
|
|
|
7347
7349
|
case 0:
|
|
7348
7350
|
issuer = window.localStorage.getItem('loginIssuer');
|
|
7349
7351
|
if (!issuer) {
|
|
7350
|
-
_context2.next =
|
|
7352
|
+
_context2.next = 20;
|
|
7351
7353
|
break;
|
|
7352
7354
|
}
|
|
7353
7355
|
_context2.prev = 2;
|
|
7356
|
+
// clear authorization metadata from store
|
|
7357
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7354
7358
|
wellKnownUri = new URL(issuer);
|
|
7355
7359
|
wellKnownUri.pathname = '/.well-known/openid-configuration';
|
|
7356
|
-
_context2.next =
|
|
7360
|
+
_context2.next = 8;
|
|
7357
7361
|
return fetch(wellKnownUri.toString());
|
|
7358
|
-
case
|
|
7362
|
+
case 8:
|
|
7359
7363
|
wellKnownResult = _context2.sent;
|
|
7360
7364
|
if (!(wellKnownResult.status === 200)) {
|
|
7361
|
-
_context2.next =
|
|
7365
|
+
_context2.next = 16;
|
|
7362
7366
|
break;
|
|
7363
7367
|
}
|
|
7364
|
-
_context2.next =
|
|
7368
|
+
_context2.next = 12;
|
|
7365
7369
|
return wellKnownResult.json();
|
|
7366
|
-
case
|
|
7370
|
+
case 12:
|
|
7367
7371
|
openidConfiguration = _context2.sent;
|
|
7368
7372
|
if (!(openidConfiguration && openidConfiguration.end_session_endpoint)) {
|
|
7369
|
-
_context2.next =
|
|
7373
|
+
_context2.next = 16;
|
|
7370
7374
|
break;
|
|
7371
7375
|
}
|
|
7372
|
-
_context2.next =
|
|
7376
|
+
_context2.next = 16;
|
|
7373
7377
|
return fetch(openidConfiguration.end_session_endpoint, {
|
|
7374
7378
|
credentials: 'include'
|
|
7375
7379
|
});
|
|
7376
|
-
case
|
|
7377
|
-
_context2.next =
|
|
7380
|
+
case 16:
|
|
7381
|
+
_context2.next = 20;
|
|
7378
7382
|
break;
|
|
7379
|
-
case
|
|
7380
|
-
_context2.prev =
|
|
7383
|
+
case 18:
|
|
7384
|
+
_context2.prev = 18;
|
|
7381
7385
|
_context2.t0 = _context2["catch"](2);
|
|
7382
|
-
case 19:
|
|
7383
|
-
window.location.reload();
|
|
7384
7386
|
case 20:
|
|
7387
|
+
window.location.reload();
|
|
7388
|
+
case 21:
|
|
7385
7389
|
case "end":
|
|
7386
7390
|
return _context2.stop();
|
|
7387
7391
|
}
|
|
7388
|
-
}, _callee2, null, [[2,
|
|
7392
|
+
}, _callee2, null, [[2, 18]]);
|
|
7389
7393
|
})));
|
|
7390
7394
|
|
|
7391
7395
|
/**
|
|
@@ -13131,17 +13135,17 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13131
13135
|
}));
|
|
13132
13136
|
exports.versionInfo = void 0;
|
|
13133
13137
|
var versionInfo = {
|
|
13134
|
-
buildTime: '2023-
|
|
13135
|
-
commit: '
|
|
13138
|
+
buildTime: '2023-04-06T12:13:32Z',
|
|
13139
|
+
commit: 'f9084b4cf727fd1908e9c9b310c367c4eefa04ab',
|
|
13136
13140
|
npmInfo: {
|
|
13137
13141
|
'solid-ui': '2.4.27',
|
|
13138
13142
|
npm: '8.19.4',
|
|
13139
|
-
node: '16.
|
|
13140
|
-
v8: '9.4.146.26-node.
|
|
13143
|
+
node: '16.20.0',
|
|
13144
|
+
v8: '9.4.146.26-node.26',
|
|
13141
13145
|
uv: '1.43.0',
|
|
13142
13146
|
zlib: '1.2.11',
|
|
13143
13147
|
brotli: '1.0.9',
|
|
13144
|
-
ares: '1.
|
|
13148
|
+
ares: '1.19.0',
|
|
13145
13149
|
modules: '93',
|
|
13146
13150
|
nghttp2: '1.47.0',
|
|
13147
13151
|
napi: '8',
|
|
@@ -15683,7 +15687,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
15683
15687
|
** <select id=dropDownSelect>
|
|
15684
15688
|
** <option> ....
|
|
15685
15689
|
** <subForm>
|
|
15686
|
-
** Alternative implementatons
|
|
15690
|
+
** Alternative implementatons could be:
|
|
15687
15691
|
** -- pop-up menu (as here)
|
|
15688
15692
|
** -- radio buttons
|
|
15689
15693
|
** -- auto-complete typing
|
|
@@ -15724,11 +15728,11 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15724
15728
|
subForm: subForm,
|
|
15725
15729
|
disambiguate: false
|
|
15726
15730
|
};
|
|
15727
|
-
function getSelectorOptions() {
|
|
15731
|
+
function getSelectorOptions(dataSource) {
|
|
15728
15732
|
var possible = [];
|
|
15729
15733
|
var possibleProperties;
|
|
15730
15734
|
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
15731
|
-
for (var x in findMembersNT(kb, uiFrom,
|
|
15735
|
+
for (var x in findMembersNT(kb, uiFrom, dataSource)) {
|
|
15732
15736
|
possible.push(kb.fromNT(x));
|
|
15733
15737
|
} // Use rdfs
|
|
15734
15738
|
|
|
@@ -15760,6 +15764,10 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15760
15764
|
|
|
15761
15765
|
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
15762
15766
|
if (multiSelect) opts.multiSelect = true;
|
|
15767
|
+
|
|
15768
|
+
// by default searches the dataDoc graph or optionally the full store
|
|
15769
|
+
var dataSource = kb.any(form, ui('search-full-store')).length ? null : dataDoc; // optional
|
|
15770
|
+
|
|
15763
15771
|
var selector;
|
|
15764
15772
|
rhs.refresh = function () {
|
|
15765
15773
|
// from ui:property
|
|
@@ -15767,7 +15775,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15767
15775
|
return object.value;
|
|
15768
15776
|
});
|
|
15769
15777
|
// from ui:from + ui:property
|
|
15770
|
-
var possibleOptions = getSelectorOptions();
|
|
15778
|
+
var possibleOptions = getSelectorOptions(dataSource);
|
|
15771
15779
|
possibleOptions.push(selectedOptions);
|
|
15772
15780
|
possibleOptions = sortByLabel(possibleOptions);
|
|
15773
15781
|
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
@@ -53604,7 +53612,9 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
53604
53612
|
if (!this._fetch) {
|
|
53605
53613
|
throw new Error('No _fetch function available for Fetcher');
|
|
53606
53614
|
}
|
|
53607
|
-
|
|
53615
|
+
// This is the name of the graph we store all the HTTP metadata in
|
|
53616
|
+
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
53617
|
+
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
|
53608
53618
|
this.store.fetcher = this; // Bi-linked
|
|
53609
53619
|
this.requested = {};
|
|
53610
53620
|
this.timeouts = {};
|
|
@@ -54436,17 +54446,19 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54436
54446
|
var _this10 = this;
|
|
54437
54447
|
var kb = this.store;
|
|
54438
54448
|
var responseNode = kb.bnode();
|
|
54439
|
-
kb.add(options.req, this.ns.link('response'), responseNode,
|
|
54440
|
-
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status),
|
|
54441
|
-
kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText),
|
|
54449
|
+
kb.add(options.req, this.ns.link('response'), responseNode, this.appNode);
|
|
54450
|
+
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status), this.appNode);
|
|
54451
|
+
kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText), this.appNode);
|
|
54442
54452
|
|
|
54443
54453
|
// Save the response headers
|
|
54444
54454
|
response.headers.forEach(function (value, header) {
|
|
54445
|
-
kb.add(responseNode, _this10.ns.httph(header), _this10.store.rdfFactory.literal(value),
|
|
54455
|
+
kb.add(responseNode, _this10.ns.httph(header), _this10.store.rdfFactory.literal(value), _this10.appNode);
|
|
54446
54456
|
if (header === 'content-type') {
|
|
54447
|
-
kb.add(options.resource, _this10.ns.rdf('type'), kb.rdfFactory.namedNode(_utils_js__WEBPACK_IMPORTED_MODULE_11__.mediaTypeClass(value).value), responseNode
|
|
54457
|
+
kb.add(options.resource, _this10.ns.rdf('type'), kb.rdfFactory.namedNode(_utils_js__WEBPACK_IMPORTED_MODULE_11__.mediaTypeClass(value).value), _this10.appNode // responseNode
|
|
54458
|
+
);
|
|
54448
54459
|
}
|
|
54449
54460
|
});
|
|
54461
|
+
|
|
54450
54462
|
return responseNode;
|
|
54451
54463
|
}
|
|
54452
54464
|
}, {
|
|
@@ -64245,17 +64257,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64245
64257
|
/* harmony export */ "default": () => (/* binding */ UpdateManager)
|
|
64246
64258
|
/* harmony export */ });
|
|
64247
64259
|
/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
|
|
64248
|
-
/* harmony import */ var
|
|
64249
|
-
/* harmony import */ var
|
|
64250
|
-
/* harmony import */ var
|
|
64251
|
-
/* harmony import */ var
|
|
64252
|
-
/* harmony import */ var
|
|
64253
|
-
/* harmony import */ var
|
|
64254
|
-
/* harmony import */ var
|
|
64255
|
-
/* harmony import */ var
|
|
64256
|
-
/* harmony import */ var
|
|
64257
|
-
/* harmony import */ var
|
|
64258
|
-
/* harmony import */ var
|
|
64260
|
+
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
|
|
64261
|
+
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
|
|
64262
|
+
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
|
|
64263
|
+
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
|
|
64264
|
+
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
|
|
64265
|
+
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);
|
|
64266
|
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./store */ "./node_modules/rdflib/esm/store.js");
|
|
64267
|
+
/* harmony import */ var _uri__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./uri */ "./node_modules/rdflib/esm/uri.js");
|
|
64268
|
+
/* harmony import */ var _fetcher__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fetcher */ "./node_modules/rdflib/esm/fetcher.js");
|
|
64269
|
+
/* harmony import */ var _namespace__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./namespace */ "./node_modules/rdflib/esm/namespace.js");
|
|
64270
|
+
/* harmony import */ var _serializer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./serializer */ "./node_modules/rdflib/esm/serializer.js");
|
|
64271
|
+
/* harmony import */ var _utils_terms__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/terms */ "./node_modules/rdflib/esm/utils/terms.js");
|
|
64272
|
+
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./utils-js */ "./node_modules/rdflib/esm/utils-js.js");
|
|
64273
|
+
/* harmony import */ var _utils_termValue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/termValue */ "./node_modules/rdflib/esm/utils/termValue.js");
|
|
64274
|
+
|
|
64275
|
+
|
|
64259
64276
|
|
|
64260
64277
|
|
|
64261
64278
|
|
|
@@ -64292,35 +64309,35 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64292
64309
|
* @param store - The quadstore to store data and metadata. Created if not passed.
|
|
64293
64310
|
*/
|
|
64294
64311
|
function UpdateManager(store) {
|
|
64295
|
-
(0,
|
|
64296
|
-
(0,
|
|
64297
|
-
(0,
|
|
64298
|
-
(0,
|
|
64299
|
-
(0,
|
|
64300
|
-
(0,
|
|
64301
|
-
store = store || new
|
|
64312
|
+
(0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__["default"])(this, UpdateManager);
|
|
64313
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "store", void 0);
|
|
64314
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "ifps", void 0);
|
|
64315
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "fps", void 0);
|
|
64316
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "patchControl", void 0);
|
|
64317
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "ns", void 0);
|
|
64318
|
+
store = store || new _store__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
64302
64319
|
if (store.updater) {
|
|
64303
64320
|
throw new Error("You can't have two UpdateManagers for the same store");
|
|
64304
64321
|
}
|
|
64305
64322
|
if (!store.fetcher) {
|
|
64306
|
-
store.fetcher = new
|
|
64323
|
+
store.fetcher = new _fetcher__WEBPACK_IMPORTED_MODULE_7__["default"](store);
|
|
64307
64324
|
}
|
|
64308
64325
|
this.store = store;
|
|
64309
64326
|
store.updater = this;
|
|
64310
64327
|
this.ifps = {};
|
|
64311
64328
|
this.fps = {};
|
|
64312
64329
|
this.ns = {};
|
|
64313
|
-
this.ns.link = (0,
|
|
64314
|
-
this.ns.http = (0,
|
|
64315
|
-
this.ns.httph = (0,
|
|
64316
|
-
this.ns.ldp = (0,
|
|
64317
|
-
this.ns.rdf = (0,
|
|
64318
|
-
this.ns.rdfs = (0,
|
|
64319
|
-
this.ns.rdf = (0,
|
|
64320
|
-
this.ns.owl = (0,
|
|
64330
|
+
this.ns.link = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/link#');
|
|
64331
|
+
this.ns.http = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/http#');
|
|
64332
|
+
this.ns.httph = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/httph#');
|
|
64333
|
+
this.ns.ldp = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/ns/ldp#');
|
|
64334
|
+
this.ns.rdf = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
64335
|
+
this.ns.rdfs = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2000/01/rdf-schema#');
|
|
64336
|
+
this.ns.rdf = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
64337
|
+
this.ns.owl = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2002/07/owl#');
|
|
64321
64338
|
this.patchControl = [];
|
|
64322
64339
|
}
|
|
64323
|
-
(0,
|
|
64340
|
+
(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__["default"])(UpdateManager, [{
|
|
64324
64341
|
key: "patchControlFor",
|
|
64325
64342
|
value: function patchControlFor(doc) {
|
|
64326
64343
|
if (!this.patchControl[doc.value]) {
|
|
@@ -64334,13 +64351,87 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64334
64351
|
return uri.slice(0, 4) === 'http';
|
|
64335
64352
|
}
|
|
64336
64353
|
|
|
64354
|
+
/** Remove from the store HTTP authorization metadata
|
|
64355
|
+
* The editble function below relies on copies we have in the store
|
|
64356
|
+
* of the results of previous HTTP transactions. Howver, when
|
|
64357
|
+
* the user logs in, then that data misrepresents what would happen
|
|
64358
|
+
* if the user tried again.
|
|
64359
|
+
*/
|
|
64360
|
+
}, {
|
|
64361
|
+
key: "flagAuthorizationMetadata",
|
|
64362
|
+
value: function flagAuthorizationMetadata() {
|
|
64363
|
+
var kb = this.store;
|
|
64364
|
+
var meta = kb.fetcher.appNode;
|
|
64365
|
+
var requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(function (st) {
|
|
64366
|
+
return st.subject;
|
|
64367
|
+
});
|
|
64368
|
+
var _iterator = _createForOfIteratorHelper(requests),
|
|
64369
|
+
_step;
|
|
64370
|
+
try {
|
|
64371
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
64372
|
+
var request = _step.value;
|
|
64373
|
+
var _response = kb.any(request, this.ns.link('response'), null, meta);
|
|
64374
|
+
if (_response !== undefined) {
|
|
64375
|
+
// ts
|
|
64376
|
+
this.store.add(_response, this.ns.link('outOfDate'), true, meta); // @@ Boolean is fine - fix types
|
|
64377
|
+
}
|
|
64378
|
+
}
|
|
64379
|
+
} catch (err) {
|
|
64380
|
+
_iterator.e(err);
|
|
64381
|
+
} finally {
|
|
64382
|
+
_iterator.f();
|
|
64383
|
+
}
|
|
64384
|
+
}
|
|
64385
|
+
|
|
64386
|
+
/**
|
|
64387
|
+
* Tests whether a file is editable.
|
|
64388
|
+
* If the file has a specific annotation that it is machine written,
|
|
64389
|
+
* for safety, it is editable (this doesn't actually check for write access)
|
|
64390
|
+
* If the file has wac-allow and accept patch headers, those are respected.
|
|
64391
|
+
* and local write access is determined by those headers.
|
|
64392
|
+
* This async version not only looks at past HTTP requests, it also makes new ones if necessary.
|
|
64393
|
+
*
|
|
64394
|
+
* @returns The method string SPARQL or DAV or
|
|
64395
|
+
* LOCALFILE or false if known, undefined if not known.
|
|
64396
|
+
*/
|
|
64397
|
+
}, {
|
|
64398
|
+
key: "checkEditable",
|
|
64399
|
+
value: function () {
|
|
64400
|
+
var _checkEditable = (0,_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default().mark(function _callee(uri, kb) {
|
|
64401
|
+
var initial, final;
|
|
64402
|
+
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default().wrap(function _callee$(_context) {
|
|
64403
|
+
while (1) switch (_context.prev = _context.next) {
|
|
64404
|
+
case 0:
|
|
64405
|
+
initial = this.editable(uri, kb);
|
|
64406
|
+
if (!(initial !== undefined)) {
|
|
64407
|
+
_context.next = 3;
|
|
64408
|
+
break;
|
|
64409
|
+
}
|
|
64410
|
+
return _context.abrupt("return", initial);
|
|
64411
|
+
case 3:
|
|
64412
|
+
_context.next = 5;
|
|
64413
|
+
return this.store.fetcher.load(uri);
|
|
64414
|
+
case 5:
|
|
64415
|
+
final = this.editable(uri, kb); // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
|
|
64416
|
+
return _context.abrupt("return", final);
|
|
64417
|
+
case 7:
|
|
64418
|
+
case "end":
|
|
64419
|
+
return _context.stop();
|
|
64420
|
+
}
|
|
64421
|
+
}, _callee, this);
|
|
64422
|
+
}));
|
|
64423
|
+
function checkEditable(_x, _x2) {
|
|
64424
|
+
return _checkEditable.apply(this, arguments);
|
|
64425
|
+
}
|
|
64426
|
+
return checkEditable;
|
|
64427
|
+
}()
|
|
64337
64428
|
/**
|
|
64338
64429
|
* Tests whether a file is editable.
|
|
64339
64430
|
* If the file has a specific annotation that it is machine written,
|
|
64340
64431
|
* for safety, it is editable (this doesn't actually check for write access)
|
|
64341
64432
|
* If the file has wac-allow and accept patch headers, those are respected.
|
|
64342
64433
|
* and local write access is determined by those headers.
|
|
64343
|
-
* This version only looks at past HTTP requests, does not make new ones.
|
|
64434
|
+
* This synchronous version only looks at past HTTP requests, does not make new ones.
|
|
64344
64435
|
*
|
|
64345
64436
|
* @returns The method string SPARQL or DAV or
|
|
64346
64437
|
* LOCALFILE or false if known, undefined if not known.
|
|
@@ -64355,29 +64446,36 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64355
64446
|
if (!kb) {
|
|
64356
64447
|
kb = this.store;
|
|
64357
64448
|
}
|
|
64358
|
-
uri = (0,
|
|
64449
|
+
uri = (0,_utils_termValue__WEBPACK_IMPORTED_MODULE_9__.termValue)(uri);
|
|
64359
64450
|
if (!this.isHttpUri(uri)) {
|
|
64360
|
-
if (
|
|
64451
|
+
if (this.store.holds(this.store.rdfFactory.namedNode(uri), this.store.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), this.store.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
|
|
64361
64452
|
return 'LOCALFILE';
|
|
64362
64453
|
}
|
|
64363
64454
|
}
|
|
64364
64455
|
var request;
|
|
64365
64456
|
var definitive = false;
|
|
64457
|
+
var meta = this.store.fetcher.appNode;
|
|
64458
|
+
// const kb = s
|
|
64459
|
+
|
|
64366
64460
|
// @ts-ignore passes a string to kb.each, which expects a term. Should this work?
|
|
64367
|
-
var requests = kb.each(undefined, this.ns.link('requestedURI'), (0,
|
|
64461
|
+
var requests = kb.each(undefined, this.ns.link('requestedURI'), (0,_uri__WEBPACK_IMPORTED_MODULE_10__.docpart)(uri), meta);
|
|
64368
64462
|
var method;
|
|
64369
64463
|
for (var r = 0; r < requests.length; r++) {
|
|
64370
64464
|
request = requests[r];
|
|
64371
64465
|
if (request !== undefined) {
|
|
64372
|
-
var
|
|
64373
|
-
if (
|
|
64374
|
-
|
|
64466
|
+
var _response2 = kb.any(request, this.ns.link('response'), null, meta);
|
|
64467
|
+
if (_response2 !== undefined) {
|
|
64468
|
+
// ts
|
|
64469
|
+
|
|
64470
|
+
var outOfDate = kb.anyJS(_response2, this.ns.link('outOfDate'), null, meta);
|
|
64471
|
+
if (outOfDate) continue;
|
|
64472
|
+
var wacAllow = kb.anyValue(_response2, this.ns.httph('wac-allow'));
|
|
64375
64473
|
if (wacAllow) {
|
|
64376
|
-
var
|
|
64377
|
-
|
|
64474
|
+
var _iterator2 = _createForOfIteratorHelper(wacAllow.split(',')),
|
|
64475
|
+
_step2;
|
|
64378
64476
|
try {
|
|
64379
|
-
for (
|
|
64380
|
-
var bit =
|
|
64477
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
64478
|
+
var bit = _step2.value;
|
|
64381
64479
|
var lr = bit.split('=');
|
|
64382
64480
|
if (lr[0].includes('user') && !lr[1].includes('write') && !lr[1].includes('append')) {
|
|
64383
64481
|
// console.log(' editable? excluded by WAC-Allow: ', wacAllow)
|
|
@@ -64385,12 +64483,12 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64385
64483
|
}
|
|
64386
64484
|
}
|
|
64387
64485
|
} catch (err) {
|
|
64388
|
-
|
|
64486
|
+
_iterator2.e(err);
|
|
64389
64487
|
} finally {
|
|
64390
|
-
|
|
64488
|
+
_iterator2.f();
|
|
64391
64489
|
}
|
|
64392
64490
|
}
|
|
64393
|
-
var acceptPatch = kb.each(
|
|
64491
|
+
var acceptPatch = kb.each(_response2, this.ns.httph('accept-patch'));
|
|
64394
64492
|
if (acceptPatch.length) {
|
|
64395
64493
|
for (var i = 0; i < acceptPatch.length; i++) {
|
|
64396
64494
|
method = acceptPatch[i].value.trim();
|
|
@@ -64398,7 +64496,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64398
64496
|
if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL';
|
|
64399
64497
|
}
|
|
64400
64498
|
}
|
|
64401
|
-
var authorVia = kb.each(
|
|
64499
|
+
var authorVia = kb.each(_response2, this.ns.httph('ms-author-via'));
|
|
64402
64500
|
if (authorVia.length) {
|
|
64403
64501
|
for (var _i = 0; _i < authorVia.length; _i++) {
|
|
64404
64502
|
method = authorVia[_i].value.trim();
|
|
@@ -64413,7 +64511,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64413
64511
|
if (!this.isHttpUri(uri)) {
|
|
64414
64512
|
if (!wacAllow) return false;else return 'LOCALFILE';
|
|
64415
64513
|
}
|
|
64416
|
-
var status = kb.each(
|
|
64514
|
+
var status = kb.each(_response2, this.ns.http('status'));
|
|
64417
64515
|
if (status.length) {
|
|
64418
64516
|
for (var _i2 = 0; _i2 < status.length; _i2++) {
|
|
64419
64517
|
// @ts-ignore since statuses should be TFTerms, this should always be false
|
|
@@ -64462,7 +64560,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64462
64560
|
key: "statementBnodes",
|
|
64463
64561
|
value: function statementBnodes(st) {
|
|
64464
64562
|
return [st.subject, st.predicate, st.object].filter(function (x) {
|
|
64465
|
-
return (0,
|
|
64563
|
+
return (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isBlankNode)(x);
|
|
64466
64564
|
});
|
|
64467
64565
|
}
|
|
64468
64566
|
|
|
@@ -64857,7 +64955,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64857
64955
|
// console.log('Server does not support live updates through Updates-Via :-(')
|
|
64858
64956
|
return false;
|
|
64859
64957
|
}
|
|
64860
|
-
wssURI = (0,
|
|
64958
|
+
wssURI = (0,_uri__WEBPACK_IMPORTED_MODULE_10__.join)(wssURI, doc.value);
|
|
64861
64959
|
var validWssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:');
|
|
64862
64960
|
// console.log('Web socket URI ' + wssURI)
|
|
64863
64961
|
|
|
@@ -64997,8 +65095,8 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64997
65095
|
|
|
64998
65096
|
try {
|
|
64999
65097
|
var kb = this.store;
|
|
65000
|
-
var ds = !deletions ? [] : (0,
|
|
65001
|
-
var is = !insertions ? [] : (0,
|
|
65098
|
+
var ds = !deletions ? [] : (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore)(deletions) ? deletions.statements : deletions instanceof Array ? deletions : [deletions];
|
|
65099
|
+
var is = !insertions ? [] : (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore)(insertions) ? insertions.statements : insertions instanceof Array ? insertions : [insertions];
|
|
65002
65100
|
if (!(ds instanceof Array)) {
|
|
65003
65101
|
throw new Error('Type Error ' + (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(ds) + ': ' + ds);
|
|
65004
65102
|
}
|
|
@@ -65155,7 +65253,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65155
65253
|
}
|
|
65156
65254
|
}
|
|
65157
65255
|
} catch (e) {
|
|
65158
|
-
callback(undefined, false, 'Exception in update: ' + e + '\n' +
|
|
65256
|
+
callback(undefined, false, 'Exception in update: ' + e + '\n' + _utils_js__WEBPACK_IMPORTED_MODULE_12__.stackString(e));
|
|
65159
65257
|
}
|
|
65160
65258
|
}
|
|
65161
65259
|
}, {
|
|
@@ -65178,7 +65276,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65178
65276
|
// prepare contents of revised document
|
|
65179
65277
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!
|
|
65180
65278
|
for (var i = 0; i < ds.length; i++) {
|
|
65181
|
-
|
|
65279
|
+
_utils_js__WEBPACK_IMPORTED_MODULE_12__.RDFArrayRemove(newSts, ds[i]);
|
|
65182
65280
|
}
|
|
65183
65281
|
for (var _i9 = 0; _i9 < is.length; _i9++) {
|
|
65184
65282
|
newSts.push(is[_i9]);
|
|
@@ -65189,7 +65287,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65189
65287
|
var candidateTarget = kb.the(response, this.ns.httph('content-location'));
|
|
65190
65288
|
var targetURI;
|
|
65191
65289
|
if (candidateTarget) {
|
|
65192
|
-
targetURI = (0,
|
|
65290
|
+
targetURI = (0,_uri__WEBPACK_IMPORTED_MODULE_10__.join)(candidateTarget.value, targetURI);
|
|
65193
65291
|
}
|
|
65194
65292
|
options.contentType = contentType;
|
|
65195
65293
|
options.noMeta = true;
|
|
@@ -65230,7 +65328,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65230
65328
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!
|
|
65231
65329
|
|
|
65232
65330
|
for (var i = 0; i < ds.length; i++) {
|
|
65233
|
-
|
|
65331
|
+
_utils_js__WEBPACK_IMPORTED_MODULE_12__.RDFArrayRemove(newSts, ds[i]);
|
|
65234
65332
|
}
|
|
65235
65333
|
for (var _i12 = 0; _i12 < is.length; _i12++) {
|
|
65236
65334
|
newSts.push(is[_i12]);
|
|
@@ -65241,7 +65339,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65241
65339
|
throw new Error('Rewriting file: No filename extension: ' + doc.value);
|
|
65242
65340
|
}
|
|
65243
65341
|
var ext = doc.value.slice(dot + 1);
|
|
65244
|
-
var contentType =
|
|
65342
|
+
var contentType = _fetcher__WEBPACK_IMPORTED_MODULE_7__["default"].CONTENT_TYPE_BY_EXT[ext];
|
|
65245
65343
|
if (!contentType) {
|
|
65246
65344
|
throw new Error('File extension .' + ext + ' not supported for data write');
|
|
65247
65345
|
}
|
|
@@ -65274,7 +65372,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65274
65372
|
}
|
|
65275
65373
|
|
|
65276
65374
|
// serialize to the appropriate format
|
|
65277
|
-
var sz = (0,
|
|
65375
|
+
var sz = (0,_serializer__WEBPACK_IMPORTED_MODULE_13__["default"])(kb);
|
|
65278
65376
|
sz.suggestNamespaces(kb.namespaces);
|
|
65279
65377
|
sz.setBase(uri);
|
|
65280
65378
|
switch (contentType) {
|