solid-ui 2.4.28-21f105c8 → 2.4.28-4687e65a

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
@@ -4127,32 +4127,39 @@ function _infiniteMessageArea() {
4127
4127
  date = extremity.messageTable.date; // day in mssecs
4128
4128
  // Are we at the top of a thread?
4129
4129
  if (!(backwards && earliest.limit && date <= earliest.limit)) {
4130
- _context4.next = 4;
4130
+ _context4.next = 7;
4131
4131
  break;
4132
4132
  }
4133
+ if (liveMessageTable) {
4134
+ _context4.next = 6;
4135
+ break;
4136
+ }
4137
+ _context4.next = 6;
4138
+ return appendCurrentMessages();
4139
+ case 6:
4133
4140
  return _context4.abrupt("return", true);
4134
- case 4:
4141
+ case 7:
4135
4142
  debug.log(' insertPreviousMessages: loadPrevious given date ' + date);
4136
- _context4.next = 7;
4143
+ _context4.next = 10;
4137
4144
  return dateFolder.loadPrevious(date, backwards);
4138
- case 7:
4145
+ case 10:
4139
4146
  date = _context4.sent;
4140
4147
  // backwards
4141
4148
  debug.log(' insertPreviousMessages: loadPrevious returns date ' + date);
4142
4149
  debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
4143
4150
  if (!(!date && !backwards && !liveMessageTable)) {
4144
- _context4.next = 13;
4151
+ _context4.next = 16;
4145
4152
  break;
4146
4153
  }
4147
- _context4.next = 13;
4154
+ _context4.next = 16;
4148
4155
  return appendCurrentMessages();
4149
- case 13:
4156
+ case 16:
4150
4157
  if (date) {
4151
- _context4.next = 15;
4158
+ _context4.next = 18;
4152
4159
  break;
4153
4160
  }
4154
4161
  return _context4.abrupt("return", true);
4155
- case 15:
4162
+ case 18:
4156
4163
  // done
4157
4164
  live = false;
4158
4165
  if (!backwards) {
@@ -4160,9 +4167,9 @@ function _infiniteMessageArea() {
4160
4167
  doc = dateFolder.leafDocumentFromDate(date);
4161
4168
  live = doc.sameTerm(todayDoc); // Is this todays?
4162
4169
  }
4163
- _context4.next = 19;
4170
+ _context4.next = 22;
4164
4171
  return createMessageTable(date, live);
4165
- case 19:
4172
+ case 22:
4166
4173
  newMessageTable = _context4.sent;
4167
4174
  extremity.messageTable = newMessageTable; // move pointer to earliest
4168
4175
  if (backwards ? newestFirst : !newestFirst) {
@@ -4173,7 +4180,7 @@ function _infiniteMessageArea() {
4173
4180
  div.insertBefore(newMessageTable, div.firstChild);
4174
4181
  }
4175
4182
  return _context4.abrupt("return", live);
4176
- case 23:
4183
+ case 26:
4177
4184
  case "end":
4178
4185
  return _context4.stop();
4179
4186
  }
@@ -4848,13 +4855,13 @@ function _renderMessageRow() {
4848
4855
  if (straightReplies.length > 1) {
4849
4856
  debug.log('renderMessageRow: found normal replies: ', straightReplies);
4850
4857
  }
4851
- debug.log('@@@@ alain thread');
4852
- // debug.log(replies)
4853
- // debug.log(thread)
4854
- thread = _solidLogic.store.any(msgId, ns.sioc('has_reply')); // if (!thread)
4855
- debug.log(thread);
4858
+ debug.log('@@@@ is thread');
4859
+ if (!thread) {
4860
+ // thread = store.any(message, ns.sioc('has_reply'))
4861
+ thread = _solidLogic.store.any(null, ns.sioc('has_member'), message);
4862
+ }
4856
4863
  // get signature
4857
- signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue"))); // set message object
4864
+ signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue"))); // set proof message object
4858
4865
  msg = (0, _signature.getBlankMsg)();
4859
4866
  msg.id = msgId.uri;
4860
4867
  msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
@@ -4880,9 +4887,9 @@ function _renderMessageRow() {
4880
4887
  else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
4881
4888
  });
4882
4889
  }
4883
- _context10.next = 39;
4890
+ _context10.next = 38;
4884
4891
  return (0, _chatLogic.originalVersion)(message);
4885
- case 39:
4892
+ case 38:
4886
4893
  originalMessage = _context10.sent;
4887
4894
  edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
4888
4895
  // @@@ kludge!
@@ -4939,9 +4946,9 @@ function _renderMessageRow() {
4939
4946
  bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
4940
4947
  para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
4941
4948
  }
4942
- _context10.next = 60;
4949
+ _context10.next = 59;
4943
4950
  return (0, _messageTools.sentimentStripLinked)(message, message.doc());
4944
- case 60:
4951
+ case 59:
4945
4952
  strip = _context10.sent;
4946
4953
  if (strip.children.length) {
4947
4954
  td2.appendChild(dom.createElement('br'));
@@ -5006,7 +5013,7 @@ function _renderMessageRow() {
5006
5013
  }));
5007
5014
  }
5008
5015
  return _context10.abrupt("return", messageRow);
5009
- case 69:
5016
+ case 68:
5010
5017
  case "end":
5011
5018
  return _context10.stop();
5012
5019
  }
@@ -14025,176 +14032,96 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
14025
14032
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
14026
14033
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
14027
14034
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
14035
+ var _otherHelpers = __webpack_require__(/*! ./otherHelpers */ "./lib/utils/keyHelpers/otherHelpers.js");
14028
14036
  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); }
14029
14037
  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; }
14030
- /* export const getPodRoot = async (webId: NamedNode) => {
14031
- const webIdURL = new URL(webId.uri)
14032
- // find storages in webId document
14033
- await store.fetcher.load(webId.uri)
14034
- const storages = store.each(webId, ns.space('storage'), null, webId.doc())
14035
- var podRoot: NamedNode | undefined
14036
- if (!storages?.length) {
14037
- // find storage recursively in webId URL
14038
- let path = webIdURL.pathname
14039
- while (path.length) {
14040
- path = path.substring(0, path.lastIndexOf('/'))
14041
- podRoot = store.sym(webIdURL.origin + path + '/')
14042
- const res = await store.fetcher.webOperation('HEAD', podRoot.uri)
14043
- if (res.headers.get('link')?.includes(ns.space('Storage').value)) break
14044
- if (!path) debug.warn(`Current user storage not found for\n${webId}`)
14045
- }
14046
- } else {
14047
- // give preference to storage in webId root
14048
- podRoot = storages.find((storage) => webIdURL.origin === new URL(storage.value).origin) as NamedNode
14049
- if (!podRoot) podRoot = storages[0] as NamedNode
14038
+ var pubKeyUrl = function pubKeyUrl(webId) {
14039
+ var url;
14040
+ try {
14041
+ var root = (0, _otherHelpers.getRootIfPreferencesExist)(webId);
14042
+ url = "".concat(root, "/profile/keys/publicKey.ttl");
14043
+ } catch (err) {
14044
+ debug.error(err);
14050
14045
  }
14051
-
14052
- return podRoot as NamedNode
14053
- } */
14054
-
14055
- var pubKeyUrl = /*#__PURE__*/function () {
14056
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
14057
- var _store$any, _parentSettings;
14058
- var parentSettings;
14059
- return _regenerator["default"].wrap(function _callee$(_context) {
14060
- while (1) switch (_context.prev = _context.next) {
14061
- case 0:
14062
- parentSettings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
14063
- parentSettings = (_parentSettings = parentSettings) === null || _parentSettings === void 0 ? void 0 : _parentSettings.split('/').slice(0, -2).join('/');
14064
- if (parentSettings) {
14065
- _context.next = 4;
14066
- break;
14067
- }
14068
- throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
14069
- case 4:
14070
- return _context.abrupt("return", "".concat(parentSettings, "/profile/keys/publicKey.ttl"));
14071
- case 5:
14072
- case "end":
14073
- return _context.stop();
14074
- }
14075
- }, _callee);
14076
- }));
14077
- return function pubKeyUrl(_x) {
14078
- return _ref.apply(this, arguments);
14079
- };
14080
- }();
14046
+ return url;
14047
+ };
14081
14048
  exports.pubKeyUrl = pubKeyUrl;
14082
- function getExistingPublicKey(_x2, _x3) {
14049
+ var privKeyUrl = function privKeyUrl(webId) {
14050
+ var url;
14051
+ try {
14052
+ var root = (0, _otherHelpers.getRootIfPreferencesExist)(webId);
14053
+ url = "".concat(root, "/keys/privateKey.ttl");
14054
+ } catch (err) {
14055
+ debug.error(err);
14056
+ }
14057
+ return url;
14058
+ };
14059
+ exports.privKeyUrl = privKeyUrl;
14060
+ function getExistingPublicKey(_x, _x2) {
14083
14061
  return _getExistingPublicKey.apply(this, arguments);
14084
14062
  }
14085
14063
  function _getExistingPublicKey() {
14086
- _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, publicKeyUrl) {
14087
- return _regenerator["default"].wrap(function _callee3$(_context3) {
14088
- while (1) switch (_context3.prev = _context3.next) {
14064
+ _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId, publicKeyUrl) {
14065
+ return _regenerator["default"].wrap(function _callee$(_context) {
14066
+ while (1) switch (_context.prev = _context.next) {
14089
14067
  case 0:
14090
- _context3.next = 2;
14068
+ _context.next = 2;
14091
14069
  return getKeyIfExists(webId, publicKeyUrl, 'publicKey');
14092
14070
  case 2:
14093
- return _context3.abrupt("return", _context3.sent);
14071
+ return _context.abrupt("return", _context.sent);
14094
14072
  case 3:
14095
14073
  case "end":
14096
- return _context3.stop();
14074
+ return _context.stop();
14097
14075
  }
14098
- }, _callee3);
14076
+ }, _callee);
14099
14077
  }));
14100
14078
  return _getExistingPublicKey.apply(this, arguments);
14101
14079
  }
14102
- var privKeyUrl = /*#__PURE__*/function () {
14103
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
14104
- var _store$any2, _settings;
14105
- var settings;
14106
- return _regenerator["default"].wrap(function _callee2$(_context2) {
14107
- while (1) switch (_context2.prev = _context2.next) {
14108
- case 0:
14109
- settings = (_store$any2 = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any2 === void 0 ? void 0 : _store$any2.value;
14110
- settings = (_settings = settings) === null || _settings === void 0 ? void 0 : _settings.split('/').slice(0, -1).join('/');
14111
- if (settings) {
14112
- _context2.next = 4;
14113
- break;
14114
- }
14115
- throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
14116
- case 4:
14117
- return _context2.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
14118
- case 5:
14119
- case "end":
14120
- return _context2.stop();
14121
- }
14122
- }, _callee2);
14123
- }));
14124
- return function privKeyUrl(_x4) {
14125
- return _ref2.apply(this, arguments);
14126
- };
14127
- }();
14128
- exports.privKeyUrl = privKeyUrl;
14129
- function getExistingPrivateKey(_x5, _x6) {
14080
+ function getExistingPrivateKey(_x3, _x4) {
14130
14081
  return _getExistingPrivateKey.apply(this, arguments);
14131
14082
  }
14132
14083
  function _getExistingPrivateKey() {
14133
- _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, privateKeyUrl) {
14134
- return _regenerator["default"].wrap(function _callee4$(_context4) {
14135
- while (1) switch (_context4.prev = _context4.next) {
14084
+ _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId, privateKeyUrl) {
14085
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
14086
+ while (1) switch (_context2.prev = _context2.next) {
14136
14087
  case 0:
14137
- _context4.next = 2;
14088
+ _context2.next = 2;
14138
14089
  return getKeyIfExists(webId, privateKeyUrl, 'privateKey');
14139
14090
  case 2:
14140
- return _context4.abrupt("return", _context4.sent);
14091
+ return _context2.abrupt("return", _context2.sent);
14141
14092
  case 3:
14142
14093
  case "end":
14143
- return _context4.stop();
14094
+ return _context2.stop();
14144
14095
  }
14145
- }, _callee4);
14096
+ }, _callee2);
14146
14097
  }));
14147
14098
  return _getExistingPrivateKey.apply(this, arguments);
14148
14099
  }
14149
- function getKeyIfExists(_x7, _x8, _x9) {
14100
+ function getKeyIfExists(_x5, _x6, _x7) {
14150
14101
  return _getKeyIfExists.apply(this, arguments);
14151
14102
  }
14152
14103
  function _getKeyIfExists() {
14153
- _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, keyUrl, keyType) {
14104
+ _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, keyUrl, keyType) {
14154
14105
  var key;
14155
- return _regenerator["default"].wrap(function _callee5$(_context5) {
14156
- while (1) switch (_context5.prev = _context5.next) {
14106
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
14107
+ while (1) switch (_context3.prev = _context3.next) {
14157
14108
  case 0:
14158
- _context5.prev = 0;
14159
- _context5.next = 3;
14109
+ _context3.prev = 0;
14110
+ _context3.next = 3;
14160
14111
  return _solidLogic.store.fetcher.load(keyUrl);
14161
14112
  case 3:
14162
14113
  key = _solidLogic.store.any(webId, ns.solid(keyType)); // store.sym(CERT + keyType))
14163
- return _context5.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
14114
+ return _context3.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
14164
14115
  case 7:
14165
- _context5.prev = 7;
14166
- _context5.t0 = _context5["catch"](0);
14167
- if (!(_context5.t0.response.status === 404)) {
14168
- _context5.next = 24;
14169
- break;
14170
- }
14171
- debug.log('createIfNotExists: doc does NOT exist, will create... ' + keyUrl);
14172
- _context5.prev = 11;
14173
- _context5.next = 14;
14174
- return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
14175
- data: '',
14176
- contentType: 'text/turtle'
14177
- });
14178
- case 14:
14179
- _context5.next = 20;
14180
- break;
14181
- case 16:
14182
- _context5.prev = 16;
14183
- _context5.t1 = _context5["catch"](11);
14184
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t1);
14185
- throw _context5.t1;
14186
- case 20:
14187
- delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
14188
- // debug.log('createIfNotExists doc created ok ' + doc)
14189
- return _context5.abrupt("return", undefined);
14190
- case 24:
14191
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t0);
14192
- throw _context5.t0;
14193
- case 26:
14116
+ _context3.prev = 7;
14117
+ _context3.t0 = _context3["catch"](0);
14118
+ debug.error('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t0);
14119
+ return _context3.abrupt("return", undefined);
14120
+ case 11:
14194
14121
  case "end":
14195
- return _context5.stop();
14122
+ return _context3.stop();
14196
14123
  }
14197
- }, _callee5, null, [[0, 7], [11, 16]]);
14124
+ }, _callee3, null, [[0, 7]]);
14198
14125
  }));
14199
14126
  return _getKeyIfExists.apply(this, arguments);
14200
14127
  }
@@ -14305,6 +14232,39 @@ exports.keyAclBody = keyAclBody;
14305
14232
 
14306
14233
  /***/ }),
14307
14234
 
14235
+ /***/ "./lib/utils/keyHelpers/otherHelpers.js":
14236
+ /*!**********************************************!*\
14237
+ !*** ./lib/utils/keyHelpers/otherHelpers.js ***!
14238
+ \**********************************************/
14239
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
14240
+
14241
+ "use strict";
14242
+
14243
+
14244
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
14245
+ Object.defineProperty(exports, "__esModule", ({
14246
+ value: true
14247
+ }));
14248
+ exports.getRootIfPreferencesExist = void 0;
14249
+ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
14250
+ var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
14251
+ 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); }
14252
+ 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; }
14253
+ // Will rename this file later. We will probably be using solid-logic anyway
14254
+ // moved it out so I can mock
14255
+
14256
+ var getRootIfPreferencesExist = function getRootIfPreferencesExist(webId) {
14257
+ var _store$any, _root;
14258
+ var root = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
14259
+ root = (_root = root) === null || _root === void 0 ? void 0 : _root.split('/').slice(0, -2).join('/');
14260
+ if (!root) throw new Error("prefererencesFile is expected to exist in ".concat(webId));
14261
+ return root;
14262
+ };
14263
+ exports.getRootIfPreferencesExist = getRootIfPreferencesExist;
14264
+ //# sourceMappingURL=otherHelpers.js.map
14265
+
14266
+ /***/ }),
14267
+
14308
14268
  /***/ "./lib/utils/label.js":
14309
14269
  /*!****************************!*\
14310
14270
  !*** ./lib/utils/label.js ***!
@@ -14433,8 +14393,8 @@ Object.defineProperty(exports, "__esModule", ({
14433
14393
  }));
14434
14394
  exports.versionInfo = void 0;
14435
14395
  var versionInfo = {
14436
- buildTime: '2023-05-29T17:22:09Z',
14437
- commit: '21f105c85cf152232421970c17d78f5c8cfa3d20',
14396
+ buildTime: '2023-06-03T00:02:12Z',
14397
+ commit: '4687e65a003328b622aaf8135ed2ea2afb1c068f',
14438
14398
  npmInfo: {
14439
14399
  'solid-ui': '2.4.28',
14440
14400
  npm: '8.19.4',