solid-ui 2.4.28-6f763399 → 2.4.28-bb8b5144

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 CHANGED
@@ -13272,7 +13272,7 @@ Object.defineProperty(exports, "__esModule", ({
13272
13272
  exports.getExistingPrivateKey = getExistingPrivateKey;
13273
13273
  exports.getExistingPublicKey = getExistingPublicKey;
13274
13274
  exports.getKeyIfExists = getKeyIfExists;
13275
- exports.pubKeyUrl = exports.privKeyUrl = exports.getPodRoot = void 0;
13275
+ exports.pubKeyUrl = exports.privKeyUrl = void 0;
13276
13276
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
13277
13277
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
13278
13278
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
@@ -13280,216 +13280,174 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
13280
13280
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
13281
13281
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13282
13282
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13283
- var getPodRoot = /*#__PURE__*/function () {
13283
+ /* export const getPodRoot = async (webId: NamedNode) => {
13284
+ const webIdURL = new URL(webId.uri)
13285
+ // find storages in webId document
13286
+ await store.fetcher.load(webId.uri)
13287
+ const storages = store.each(webId, ns.space('storage'), null, webId.doc())
13288
+ var podRoot: NamedNode | undefined
13289
+ if (!storages?.length) {
13290
+ // find storage recursively in webId URL
13291
+ let path = webIdURL.pathname
13292
+ while (path.length) {
13293
+ path = path.substring(0, path.lastIndexOf('/'))
13294
+ podRoot = store.sym(webIdURL.origin + path + '/')
13295
+ const res = await store.fetcher.webOperation('HEAD', podRoot.uri)
13296
+ if (res.headers.get('link')?.includes(ns.space('Storage').value)) break
13297
+ if (!path) debug.warn(`Current user storage not found for\n${webId}`)
13298
+ }
13299
+ } else {
13300
+ // give preference to storage in webId root
13301
+ podRoot = storages.find((storage) => webIdURL.origin === new URL(storage.value).origin) as NamedNode
13302
+ if (!podRoot) podRoot = storages[0] as NamedNode
13303
+ }
13304
+
13305
+ return podRoot as NamedNode
13306
+ } */
13307
+
13308
+ var pubKeyUrl = /*#__PURE__*/function () {
13284
13309
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
13285
- var webIdURL, storages, podRoot, path, _res$headers$get, res;
13310
+ var _store$any, _parentSettings;
13311
+ var parentSettings;
13286
13312
  return _regenerator["default"].wrap(function _callee$(_context) {
13287
13313
  while (1) switch (_context.prev = _context.next) {
13288
13314
  case 0:
13289
- webIdURL = new URL(webId.uri); // find storages in webId document
13290
- _context.next = 3;
13291
- return _solidLogic.store.fetcher.load(webId.uri);
13292
- case 3:
13293
- storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
13294
- if (storages !== null && storages !== void 0 && storages.length) {
13295
- _context.next = 19;
13296
- break;
13297
- }
13298
- // find storage recursively in webId URL
13299
- path = webIdURL.pathname;
13300
- case 6:
13301
- if (!path.length) {
13302
- _context.next = 17;
13303
- break;
13304
- }
13305
- path = path.substring(0, path.lastIndexOf('/'));
13306
- podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
13307
- _context.next = 11;
13308
- return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
13309
- case 11:
13310
- res = _context.sent;
13311
- if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
13312
- _context.next = 14;
13315
+ parentSettings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
13316
+ parentSettings = (_parentSettings = parentSettings) === null || _parentSettings === void 0 ? void 0 : _parentSettings.split('/').slice(0, -2).join('/');
13317
+ if (parentSettings) {
13318
+ _context.next = 4;
13313
13319
  break;
13314
13320
  }
13315
- return _context.abrupt("break", 17);
13316
- case 14:
13317
- if (!path) debug.warn("Current user storage not found for\n".concat(webId));
13318
- _context.next = 6;
13319
- break;
13320
- case 17:
13321
- _context.next = 21;
13322
- break;
13323
- case 19:
13324
- // give preference to storage in webId root
13325
- podRoot = storages.find(function (storage) {
13326
- return webIdURL.origin === new URL(storage.value).origin;
13327
- });
13328
- if (!podRoot) podRoot = storages[0];
13329
- case 21:
13330
- return _context.abrupt("return", podRoot);
13331
- case 22:
13321
+ throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
13322
+ case 4:
13323
+ return _context.abrupt("return", "".concat(parentSettings, "/profile/keys/publicKey.ttl"));
13324
+ case 5:
13332
13325
  case "end":
13333
13326
  return _context.stop();
13334
13327
  }
13335
13328
  }, _callee);
13336
13329
  }));
13337
- return function getPodRoot(_x) {
13330
+ return function pubKeyUrl(_x) {
13338
13331
  return _ref.apply(this, arguments);
13339
13332
  };
13340
13333
  }();
13341
- exports.getPodRoot = getPodRoot;
13342
- var pubKeyUrl = /*#__PURE__*/function () {
13343
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
13344
- return _regenerator["default"].wrap(function _callee2$(_context2) {
13345
- while (1) switch (_context2.prev = _context2.next) {
13346
- case 0:
13347
- _context2.prev = 0;
13348
- _context2.next = 3;
13349
- return getPodRoot(webId);
13350
- case 3:
13351
- _context2.t0 = _context2.sent.value;
13352
- return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
13353
- case 7:
13354
- _context2.prev = 7;
13355
- _context2.t1 = _context2["catch"](0);
13356
- throw new Error(_context2.t1);
13357
- case 10:
13358
- case "end":
13359
- return _context2.stop();
13360
- }
13361
- }, _callee2, null, [[0, 7]]);
13362
- }));
13363
- return function pubKeyUrl(_x2) {
13364
- return _ref2.apply(this, arguments);
13365
- };
13366
- }();
13367
13334
  exports.pubKeyUrl = pubKeyUrl;
13368
- function getExistingPublicKey(_x3, _x4) {
13335
+ function getExistingPublicKey(_x2, _x3) {
13369
13336
  return _getExistingPublicKey.apply(this, arguments);
13370
13337
  }
13371
13338
  function _getExistingPublicKey() {
13372
- _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, publicKeyUrl) {
13373
- return _regenerator["default"].wrap(function _callee4$(_context4) {
13374
- while (1) switch (_context4.prev = _context4.next) {
13339
+ _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, publicKeyUrl) {
13340
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
13341
+ while (1) switch (_context3.prev = _context3.next) {
13375
13342
  case 0:
13376
- _context4.next = 2;
13343
+ _context3.next = 2;
13377
13344
  return getKeyIfExists(webId, publicKeyUrl, 'publicKey');
13378
13345
  case 2:
13379
- return _context4.abrupt("return", _context4.sent);
13346
+ return _context3.abrupt("return", _context3.sent);
13380
13347
  case 3:
13381
13348
  case "end":
13382
- return _context4.stop();
13349
+ return _context3.stop();
13383
13350
  }
13384
- }, _callee4);
13351
+ }, _callee3);
13385
13352
  }));
13386
13353
  return _getExistingPublicKey.apply(this, arguments);
13387
13354
  }
13388
13355
  var privKeyUrl = /*#__PURE__*/function () {
13389
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
13390
- var _store$any, _settings;
13391
- var settings, _settings2, podRoot;
13392
- return _regenerator["default"].wrap(function _callee3$(_context3) {
13393
- while (1) switch (_context3.prev = _context3.next) {
13356
+ var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
13357
+ var _store$any2, _settings;
13358
+ var settings;
13359
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
13360
+ while (1) switch (_context2.prev = _context2.next) {
13394
13361
  case 0:
13395
- settings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
13362
+ settings = (_store$any2 = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any2 === void 0 ? void 0 : _store$any2.value;
13396
13363
  settings = (_settings = settings) === null || _settings === void 0 ? void 0 : _settings.split('/').slice(0, -1).join('/');
13397
- _context3.prev = 2;
13398
- _context3.next = 5;
13399
- return getPodRoot(webId);
13400
- case 5:
13401
- podRoot = _context3.sent;
13402
- if ((_settings2 = settings) !== null && _settings2 !== void 0 && _settings2.startsWith(podRoot.value)) {
13403
- _context3.next = 8;
13364
+ if (settings) {
13365
+ _context2.next = 4;
13404
13366
  break;
13405
13367
  }
13406
- throw new Error("/settings/ is expected to be in ".concat(podRoot.value));
13407
- case 8:
13408
- return _context3.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
13409
- case 11:
13410
- _context3.prev = 11;
13411
- _context3.t0 = _context3["catch"](2);
13412
- throw new Error(_context3.t0);
13413
- case 14:
13368
+ throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
13369
+ case 4:
13370
+ return _context2.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
13371
+ case 5:
13414
13372
  case "end":
13415
- return _context3.stop();
13373
+ return _context2.stop();
13416
13374
  }
13417
- }, _callee3, null, [[2, 11]]);
13375
+ }, _callee2);
13418
13376
  }));
13419
- return function privKeyUrl(_x5) {
13420
- return _ref3.apply(this, arguments);
13377
+ return function privKeyUrl(_x4) {
13378
+ return _ref2.apply(this, arguments);
13421
13379
  };
13422
13380
  }();
13423
13381
  exports.privKeyUrl = privKeyUrl;
13424
- function getExistingPrivateKey(_x6, _x7) {
13382
+ function getExistingPrivateKey(_x5, _x6) {
13425
13383
  return _getExistingPrivateKey.apply(this, arguments);
13426
13384
  }
13427
13385
  function _getExistingPrivateKey() {
13428
- _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, privateKeyUrl) {
13429
- return _regenerator["default"].wrap(function _callee5$(_context5) {
13430
- while (1) switch (_context5.prev = _context5.next) {
13386
+ _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, privateKeyUrl) {
13387
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
13388
+ while (1) switch (_context4.prev = _context4.next) {
13431
13389
  case 0:
13432
- _context5.next = 2;
13390
+ _context4.next = 2;
13433
13391
  return getKeyIfExists(webId, privateKeyUrl, 'privateKey');
13434
13392
  case 2:
13435
- return _context5.abrupt("return", _context5.sent);
13393
+ return _context4.abrupt("return", _context4.sent);
13436
13394
  case 3:
13437
13395
  case "end":
13438
- return _context5.stop();
13396
+ return _context4.stop();
13439
13397
  }
13440
- }, _callee5);
13398
+ }, _callee4);
13441
13399
  }));
13442
13400
  return _getExistingPrivateKey.apply(this, arguments);
13443
13401
  }
13444
- function getKeyIfExists(_x8, _x9, _x10) {
13402
+ function getKeyIfExists(_x7, _x8, _x9) {
13445
13403
  return _getKeyIfExists.apply(this, arguments);
13446
13404
  }
13447
13405
  function _getKeyIfExists() {
13448
- _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
13406
+ _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, keyUrl, keyType) {
13449
13407
  var key;
13450
- return _regenerator["default"].wrap(function _callee6$(_context6) {
13451
- while (1) switch (_context6.prev = _context6.next) {
13408
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
13409
+ while (1) switch (_context5.prev = _context5.next) {
13452
13410
  case 0:
13453
- _context6.prev = 0;
13454
- _context6.next = 3;
13411
+ _context5.prev = 0;
13412
+ _context5.next = 3;
13455
13413
  return _solidLogic.store.fetcher.load(keyUrl);
13456
13414
  case 3:
13457
13415
  key = _solidLogic.store.any(webId, ns.solid(keyType)); // store.sym(CERT + keyType))
13458
- return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
13416
+ return _context5.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
13459
13417
  case 7:
13460
- _context6.prev = 7;
13461
- _context6.t0 = _context6["catch"](0);
13462
- if (!(_context6.t0.response.status === 404)) {
13463
- _context6.next = 24;
13418
+ _context5.prev = 7;
13419
+ _context5.t0 = _context5["catch"](0);
13420
+ if (!(_context5.t0.response.status === 404)) {
13421
+ _context5.next = 24;
13464
13422
  break;
13465
13423
  }
13466
13424
  debug.log('createIfNotExists: doc does NOT exist, will create... ' + keyUrl);
13467
- _context6.prev = 11;
13468
- _context6.next = 14;
13425
+ _context5.prev = 11;
13426
+ _context5.next = 14;
13469
13427
  return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
13470
13428
  data: '',
13471
13429
  contentType: 'text/turtle'
13472
13430
  });
13473
13431
  case 14:
13474
- _context6.next = 20;
13432
+ _context5.next = 20;
13475
13433
  break;
13476
13434
  case 16:
13477
- _context6.prev = 16;
13478
- _context6.t1 = _context6["catch"](11);
13479
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
13480
- throw _context6.t1;
13435
+ _context5.prev = 16;
13436
+ _context5.t1 = _context5["catch"](11);
13437
+ debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t1);
13438
+ throw _context5.t1;
13481
13439
  case 20:
13482
13440
  delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
13483
13441
  // debug.log('createIfNotExists doc created ok ' + doc)
13484
- return _context6.abrupt("return", undefined);
13442
+ return _context5.abrupt("return", undefined);
13485
13443
  case 24:
13486
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
13487
- throw _context6.t0;
13444
+ debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t0);
13445
+ throw _context5.t0;
13488
13446
  case 26:
13489
13447
  case "end":
13490
- return _context6.stop();
13448
+ return _context5.stop();
13491
13449
  }
13492
- }, _callee6, null, [[0, 7], [11, 16]]);
13450
+ }, _callee5, null, [[0, 7], [11, 16]]);
13493
13451
  }));
13494
13452
  return _getKeyIfExists.apply(this, arguments);
13495
13453
  }
@@ -13728,8 +13686,8 @@ Object.defineProperty(exports, "__esModule", ({
13728
13686
  }));
13729
13687
  exports.versionInfo = void 0;
13730
13688
  var versionInfo = {
13731
- buildTime: '2023-05-25T09:43:51Z',
13732
- commit: '6f763399cd83ecfe031ae11f0f50b71da1ff3bd5',
13689
+ buildTime: '2023-05-25T19:39:41Z',
13690
+ commit: 'bb8b5144f6b4f40d43f5625b45383d9272d8db1d',
13733
13691
  npmInfo: {
13734
13692
  'solid-ui': '2.4.28',
13735
13693
  npm: '8.19.4',