solid-ui 2.4.27-70090f20 → 2.4.27-75062170

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
@@ -4065,70 +4065,65 @@ function getPublicKey(_x) {
4065
4065
  return _getPublicKey.apply(this, arguments);
4066
4066
  }
4067
4067
  function _getPublicKey() {
4068
- _getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
4068
+ _getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
4069
4069
  var publicKeyDoc, key;
4070
- return _regenerator["default"].wrap(function _callee$(_context) {
4071
- while (1) switch (_context.prev = _context.next) {
4070
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
4071
+ while (1) switch (_context2.prev = _context2.next) {
4072
4072
  case 0:
4073
- _context.next = 2;
4073
+ _context2.next = 2;
4074
4074
  return _solidLogic.store.fetcher.load(webId);
4075
4075
  case 2:
4076
- _context.next = 4;
4076
+ _context2.next = 4;
4077
4077
  return (0, _accessData.pubKeyUrl)(webId);
4078
4078
  case 4:
4079
- publicKeyDoc = _context.sent;
4080
- _context.prev = 5;
4081
- _context.next = 8;
4079
+ publicKeyDoc = _context2.sent;
4080
+ _context2.prev = 5;
4081
+ _context2.next = 8;
4082
4082
  return _solidLogic.store.fetcher.load(publicKeyDoc);
4083
4083
  case 8:
4084
4084
  // url.href)
4085
4085
  key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
4086
- return _context.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
4086
+ return _context2.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
4087
4087
  case 12:
4088
- _context.prev = 12;
4089
- _context.t0 = _context["catch"](5);
4090
- return _context.abrupt("return", undefined);
4088
+ _context2.prev = 12;
4089
+ _context2.t0 = _context2["catch"](5);
4090
+ return _context2.abrupt("return", undefined);
4091
4091
  case 15:
4092
4092
  case "end":
4093
- return _context.stop();
4093
+ return _context2.stop();
4094
4094
  }
4095
- }, _callee, null, [[5, 12]]);
4095
+ }, _callee2, null, [[5, 12]]);
4096
4096
  }));
4097
4097
  return _getPublicKey.apply(this, arguments);
4098
4098
  }
4099
4099
  function getPrivateKey(_x2) {
4100
4100
  return _getPrivateKey.apply(this, arguments);
4101
4101
  }
4102
- /**
4103
- * delete acl if keydoc exists
4104
- * create/edit keyDoc
4105
- * set keyDoc acl
4106
- */
4107
4102
  function _getPrivateKey() {
4108
- _getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
4103
+ _getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
4109
4104
  var publicKeyDoc, privateKeyDoc, publicKey, privateKey, validPublicKey, del, add, newPublicKey, keyContainer;
4110
- return _regenerator["default"].wrap(function _callee2$(_context2) {
4111
- while (1) switch (_context2.prev = _context2.next) {
4105
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
4106
+ while (1) switch (_context3.prev = _context3.next) {
4112
4107
  case 0:
4113
- _context2.next = 2;
4108
+ _context3.next = 2;
4114
4109
  return _solidLogic.store.fetcher.load(webId);
4115
4110
  case 2:
4116
- _context2.next = 4;
4111
+ _context3.next = 4;
4117
4112
  return (0, _accessData.pubKeyUrl)(webId);
4118
4113
  case 4:
4119
- publicKeyDoc = _context2.sent;
4120
- _context2.next = 7;
4114
+ publicKeyDoc = _context3.sent;
4115
+ _context3.next = 7;
4121
4116
  return (0, _accessData.privKeyUrl)(webId);
4122
4117
  case 7:
4123
- privateKeyDoc = _context2.sent;
4124
- _context2.next = 10;
4118
+ privateKeyDoc = _context3.sent;
4119
+ _context3.next = 10;
4125
4120
  return (0, _accessData.getExistingPublicKey)(webId, publicKeyDoc);
4126
4121
  case 10:
4127
- publicKey = _context2.sent;
4128
- _context2.next = 13;
4122
+ publicKey = _context3.sent;
4123
+ _context3.next = 13;
4129
4124
  return (0, _accessData.getExistingPrivateKey)(webId, privateKeyDoc);
4130
4125
  case 13:
4131
- privateKey = _context2.sent;
4126
+ privateKey = _context3.sent;
4132
4127
  // is publicKey valid ?
4133
4128
  validPublicKey = true;
4134
4129
  if (privateKey && publicKey !== generatePublicKey(privateKey)) {
@@ -4137,23 +4132,23 @@ function _getPrivateKey() {
4137
4132
 
4138
4133
  // create key pair or repair publicKey
4139
4134
  if (!(!privateKey || !publicKey || !validPublicKey)) {
4140
- _context2.next = 34;
4135
+ _context3.next = 34;
4141
4136
  break;
4142
4137
  }
4143
4138
  del = [];
4144
4139
  add = []; // if (privateKey) del.push($rdf.st(webId, store.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), store.sym(privateKeyDoc)))
4145
4140
  if (privateKey) {
4146
- _context2.next = 24;
4141
+ _context3.next = 24;
4147
4142
  break;
4148
4143
  }
4149
4144
  // add = []
4150
4145
  privateKey = generatePrivateKey();
4151
4146
  add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
4152
- _context2.next = 24;
4147
+ _context3.next = 24;
4153
4148
  return saveKey(privateKeyDoc, [], add, webId.uri);
4154
4149
  case 24:
4155
4150
  if (!(!publicKey || !validPublicKey)) {
4156
- _context2.next = 31;
4151
+ _context3.next = 31;
4157
4152
  break;
4158
4153
  }
4159
4154
  del = [];
@@ -4165,83 +4160,98 @@ function _getPrivateKey() {
4165
4160
  // update new valid key
4166
4161
  newPublicKey = generatePublicKey(privateKey);
4167
4162
  add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
4168
- _context2.next = 31;
4163
+ _context3.next = 31;
4169
4164
  return saveKey(publicKeyDoc, del, add);
4170
4165
  case 31:
4171
4166
  keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
4172
- _context2.next = 34;
4167
+ _context3.next = 34;
4173
4168
  return (0, _acl.setAcl)(keyContainer, (0, _acl.keyContainerAclBody)(webId.uri));
4174
4169
  case 34:
4175
- return _context2.abrupt("return", privateKey);
4170
+ return _context3.abrupt("return", privateKey);
4176
4171
  case 35:
4177
4172
  case "end":
4178
- return _context2.stop();
4173
+ return _context3.stop();
4179
4174
  }
4180
- }, _callee2);
4175
+ }, _callee3);
4181
4176
  }));
4182
4177
  return _getPrivateKey.apply(this, arguments);
4183
4178
  }
4184
- function saveKey(_x3, _x4, _x5) {
4179
+ var deleteKeyAcl = /*#__PURE__*/function () {
4180
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc) {
4181
+ var keyAclDoc, response;
4182
+ return _regenerator["default"].wrap(function _callee$(_context) {
4183
+ while (1) switch (_context.prev = _context.next) {
4184
+ case 0:
4185
+ _context.next = 2;
4186
+ return _solidLogic.store.fetcher.load(keyDoc);
4187
+ case 2:
4188
+ keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
4189
+ if (!keyAclDoc) {
4190
+ _context.next = 16;
4191
+ break;
4192
+ }
4193
+ _context.prev = 4;
4194
+ _context.next = 7;
4195
+ return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
4196
+ case 7:
4197
+ response = _context.sent;
4198
+ // this may fail if webId is not an owner
4199
+ debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
4200
+ _context.next = 16;
4201
+ break;
4202
+ case 11:
4203
+ _context.prev = 11;
4204
+ _context.t0 = _context["catch"](4);
4205
+ if (!(_context.t0.response.status !== 404)) {
4206
+ _context.next = 15;
4207
+ break;
4208
+ }
4209
+ throw new Error(_context.t0);
4210
+ case 15:
4211
+ debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
4212
+ case 16:
4213
+ case "end":
4214
+ return _context.stop();
4215
+ }
4216
+ }, _callee, null, [[4, 11]]);
4217
+ }));
4218
+ return function deleteKeyAcl(_x3) {
4219
+ return _ref.apply(this, arguments);
4220
+ };
4221
+ }();
4222
+
4223
+ /**
4224
+ * delete acl if keydoc exists
4225
+ * create/edit keyDoc
4226
+ * set keyDoc acl
4227
+ */
4228
+ function saveKey(_x4, _x5, _x6) {
4185
4229
  return _saveKey.apply(this, arguments);
4186
4230
  }
4187
4231
  function _saveKey() {
4188
4232
  _saveKey = (0, _asyncToGenerator2["default"])(function (keyDoc, del, add) {
4189
4233
  var me = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
4190
- return /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
4191
- var keyAclDoc, response, aclBody;
4192
- return _regenerator["default"].wrap(function _callee3$(_context3) {
4193
- while (1) switch (_context3.prev = _context3.next) {
4234
+ return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
4235
+ var aclBody;
4236
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
4237
+ while (1) switch (_context4.prev = _context4.next) {
4194
4238
  case 0:
4195
- _context3.next = 2;
4196
- return _solidLogic.store.fetcher.load(keyDoc);
4239
+ _context4.next = 2;
4240
+ return deleteKeyAcl(keyDoc);
4197
4241
  case 2:
4198
- _context3.prev = 2;
4199
- // get keyAcldoc
4200
- keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
4201
- if (!keyAclDoc) {
4202
- _context3.next = 17;
4203
- break;
4204
- }
4205
- _context3.prev = 5;
4206
- _context3.next = 8;
4207
- return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
4208
- case 8:
4209
- response = _context3.sent;
4210
- // this may fail if webId is not an owner
4211
- debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
4212
- _context3.next = 17;
4213
- break;
4214
- case 12:
4215
- _context3.prev = 12;
4216
- _context3.t0 = _context3["catch"](5);
4217
- if (!(_context3.t0.response.status !== 404)) {
4218
- _context3.next = 16;
4219
- break;
4220
- }
4221
- throw new Error(_context3.t0);
4222
- case 16:
4223
- debug.log('delete ' + keyAclDoc.value + ' ' + _context3.t0.response.status); // should test 404 and 2xx
4224
- case 17:
4225
- _context3.next = 19;
4242
+ _context4.next = 4;
4226
4243
  return _solidLogic.store.updater.updateMany(del, add);
4227
- case 19:
4244
+ case 4:
4228
4245
  // or a promise store.updater.update ?
4229
4246
  // create READ only ACL
4230
4247
  aclBody = (0, _acl.keyAclBody)(keyDoc, me);
4231
- _context3.next = 22;
4248
+ _context4.next = 7;
4232
4249
  return (0, _acl.setAcl)(keyDoc, aclBody);
4233
- case 22:
4234
- _context3.next = 27;
4235
- break;
4236
- case 24:
4237
- _context3.prev = 24;
4238
- _context3.t1 = _context3["catch"](2);
4239
- throw new Error(_context3.t1);
4240
- case 27:
4250
+ case 7:
4241
4251
  case "end":
4242
- return _context3.stop();
4252
+ return _context4.stop();
4243
4253
  }
4244
- }, _callee3, null, [[2, 24], [5, 12]]);
4254
+ }, _callee4);
4245
4255
  })();
4246
4256
  });
4247
4257
  return _saveKey.apply(this, arguments);
@@ -13256,7 +13266,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13256
13266
  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; }
13257
13267
  var getPodRoot = /*#__PURE__*/function () {
13258
13268
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
13259
- var _podRoot;
13260
13269
  var webIdURL, storages, podRoot, path, _res$headers$get, res;
13261
13270
  return _regenerator["default"].wrap(function _callee$(_context) {
13262
13271
  while (1) switch (_context.prev = _context.next) {
@@ -13302,7 +13311,7 @@ var getPodRoot = /*#__PURE__*/function () {
13302
13311
  });
13303
13312
  if (!podRoot) podRoot = storages[0];
13304
13313
  case 21:
13305
- return _context.abrupt("return", (_podRoot = podRoot) === null || _podRoot === void 0 ? void 0 : _podRoot.value);
13314
+ return _context.abrupt("return", podRoot);
13306
13315
  case 22:
13307
13316
  case "end":
13308
13317
  return _context.stop();
@@ -13323,7 +13332,7 @@ var pubKeyUrl = /*#__PURE__*/function () {
13323
13332
  _context2.next = 3;
13324
13333
  return getPodRoot(webId);
13325
13334
  case 3:
13326
- _context2.t0 = _context2.sent;
13335
+ _context2.t0 = _context2.sent.value;
13327
13336
  return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
13328
13337
  case 7:
13329
13338
  _context2.prev = 7;
@@ -13369,7 +13378,7 @@ var privKeyUrl = /*#__PURE__*/function () {
13369
13378
  _context3.next = 3;
13370
13379
  return getPodRoot(webId);
13371
13380
  case 3:
13372
- _context3.t0 = _context3.sent;
13381
+ _context3.t0 = _context3.sent.value;
13373
13382
  return _context3.abrupt("return", _context3.t0 + 'profile/keys/privateKey.ttl');
13374
13383
  case 7:
13375
13384
  _context3.prev = 7;
@@ -13501,7 +13510,7 @@ function setAcl(_x, _x2) {
13501
13510
  */
13502
13511
  function _setAcl() {
13503
13512
  _setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc, aclBody) {
13504
- var keyAclDoc, response, aclResponse;
13513
+ var keyAclDoc, _err$response;
13505
13514
  return _regenerator["default"].wrap(function _callee$(_context) {
13506
13515
  while (1) switch (_context.prev = _context.next) {
13507
13516
  case 0:
@@ -13519,36 +13528,28 @@ function _setAcl() {
13519
13528
  case 6:
13520
13529
  _context.prev = 6;
13521
13530
  _context.next = 9;
13522
- return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
13531
+ return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
13532
+ data: aclBody,
13533
+ contentType: 'text/turtle'
13534
+ });
13523
13535
  case 9:
13524
- response = _context.sent;
13525
- // this may fail if webId is not an owner
13526
- debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
13527
- _context.next = 18;
13536
+ _context.next = 16;
13528
13537
  break;
13529
- case 13:
13530
- _context.prev = 13;
13538
+ case 11:
13539
+ _context.prev = 11;
13531
13540
  _context.t0 = _context["catch"](6);
13532
- if (!(_context.t0.response.status !== 404)) {
13533
- _context.next = 17;
13541
+ if (!((_context.t0 === null || _context.t0 === void 0 ? void 0 : (_err$response = _context.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) !== 404)) {
13542
+ _context.next = 15;
13534
13543
  break;
13535
13544
  }
13536
13545
  throw new Error(_context.t0);
13537
- case 17:
13546
+ case 15:
13538
13547
  debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
13539
- case 18:
13540
- _context.next = 20;
13541
- return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
13542
- data: aclBody,
13543
- contentType: 'text/turtle'
13544
- });
13545
- case 20:
13546
- aclResponse = _context.sent;
13547
- case 21:
13548
+ case 16:
13548
13549
  case "end":
13549
13550
  return _context.stop();
13550
13551
  }
13551
- }, _callee, null, [[6, 13]]);
13552
+ }, _callee, null, [[6, 11]]);
13552
13553
  }));
13553
13554
  return _setAcl.apply(this, arguments);
13554
13555
  }
@@ -13703,8 +13704,8 @@ Object.defineProperty(exports, "__esModule", ({
13703
13704
  }));
13704
13705
  exports.versionInfo = void 0;
13705
13706
  var versionInfo = {
13706
- buildTime: '2023-05-17T09:06:38Z',
13707
- commit: '70090f2023b45d5656d749a1af527ae2dccf0d00',
13707
+ buildTime: '2023-05-18T16:22:51Z',
13708
+ commit: '75062170392eec4bb1af60f905cf115adc5e2daf',
13708
13709
  npmInfo: {
13709
13710
  'solid-ui': '2.4.27',
13710
13711
  npm: '8.19.4',