solid-ui 2.4.22-21ace821 → 2.4.22-22876355

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 CHANGED
@@ -2745,8 +2745,7 @@ function updatePromise(del, ins) {
2745
2745
  }); // callback
2746
2746
 
2747
2747
  }); // promise
2748
- } // export findBookmarkDocument,
2749
-
2748
+ }
2750
2749
  /* Bookmarking
2751
2750
  */
2752
2751
 
@@ -7105,8 +7104,9 @@ var _debug = __webpack_require__(/*! ./debug */ "./lib/debug.js");
7105
7104
  */
7106
7105
 
7107
7106
  /* eslint-disable multiline-ternary */
7108
- // Do not export. lways us this module to find the icons, as it varies
7109
- var iconsOnGithub = 'https://solidos.github.io/solid-ui/src';
7107
+ // Do not export. Always us this module to find the icons, as they vary
7108
+ var iconsOnGithub = 'https://solidos.github.io/solid-ui/src'; // changed org 2022-05
7109
+
7110
7110
  var icons = module.scriptURI // Firefox extension
7111
7111
  ? {
7112
7112
  iconBase: module.scriptURI.slice(0, module.scriptURI.lastIndexOf('/')) + '/icons/',
@@ -7754,7 +7754,9 @@ exports.loginStatusBox = loginStatusBox;
7754
7754
  exports.newAppInstance = newAppInstance;
7755
7755
  exports.registrationControl = registrationControl;
7756
7756
  exports.registrationList = registrationList;
7757
+ exports.renderScopeHeadingRow = renderScopeHeadingRow;
7757
7758
  exports.renderSignInPopup = renderSignInPopup;
7759
+ exports.scopeLabel = scopeLabel;
7758
7760
  exports.selectWorkspace = selectWorkspace;
7759
7761
 
7760
7762
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
@@ -7775,7 +7777,7 @@ var _signup = __webpack_require__(/*! ../signup/signup.js */ "./lib/signup/signu
7775
7777
 
7776
7778
  var _style = __webpack_require__(/*! ../style */ "./lib/style.js");
7777
7779
 
7778
- var _index = __webpack_require__(/*! ../utils/index */ "./lib/utils/index.js");
7780
+ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
7779
7781
 
7780
7782
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
7781
7783
 
@@ -7783,39 +7785,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
7783
7785
 
7784
7786
  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; }
7785
7787
 
7786
- /* eslint-disable camelcase */
7788
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
7787
7789
 
7788
- /**
7789
- * Signing in, signing up, profile and preferences reloading
7790
- * Type index management
7791
- *
7792
- * Many functions in this module take a context object which
7793
- * holds various RDF symbols, add to it, and return a promise of it.
7794
- *
7795
- * * `me` RDF symbol for the user's WebID
7796
- * * `publicProfile` The user's public profile, iff loaded
7797
- * * `preferencesFile` The user's personal preference file, iff loaded
7798
- * * `index.public` The user's public type index file
7799
- * * `index.private` The user's private type index file
7800
- *
7801
- * Not RDF symbols:
7802
- * * `noun` A string in english for the type of thing -- like "address book"
7803
- * * `instance` An array of nodes which are existing instances
7804
- * * `containers` An array of nodes of containers of instances
7805
- * * `div` A DOM element where UI can be displayed
7806
- * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
7807
- * *
7808
- * * Vocabulary: "load" loads a file if it exists;
7809
- * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
7810
- * @packageDocumentation
7811
- */
7790
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7791
+
7792
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7812
7793
 
7794
+ var store = _solidLogic.solidLogicSingleton.store;
7813
7795
  /**
7814
7796
  * Resolves with the logged in user's WebID
7815
7797
  *
7816
7798
  * @param context
7817
7799
  */
7818
7800
  // used to be logIn
7801
+
7819
7802
  function ensureLoggedIn(context) {
7820
7803
  var me = _solidLogic.authn.currentUser();
7821
7804
 
@@ -7857,7 +7840,7 @@ function ensureLoggedIn(context) {
7857
7840
  // used to be logInLoadPreferences
7858
7841
 
7859
7842
 
7860
- function ensureLoadedPreferences(_x2) {
7843
+ function ensureLoadedPreferences(_x) {
7861
7844
  return _ensureLoadedPreferences.apply(this, arguments);
7862
7845
  }
7863
7846
  /**
@@ -8004,15 +7987,17 @@ function _ensureLoadedPreferences() {
8004
7987
  return _ensureLoadedPreferences.apply(this, arguments);
8005
7988
  }
8006
7989
 
8007
- function ensureLoadedProfile(_x3) {
7990
+ function ensureLoadedProfile(_x2) {
8008
7991
  return _ensureLoadedProfile.apply(this, arguments);
8009
7992
  }
8010
7993
  /**
8011
- * Returns promise of context with arrays of symbols
8012
- *
8013
- * 2016-12-11 change to include forClass arc a la
8014
- * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
8015
- */
7994
+ * Returns promise of context with arrays of symbols
7995
+ *
7996
+ * 2016-12-11 change to include forClass arc a la
7997
+ * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
7998
+ * This is now legacy; should instead use solid-logic getAppInstances
7999
+ * leaving the `isPublic` param undefined will bring in community index things, too
8000
+ */
8016
8001
 
8017
8002
 
8018
8003
  function _ensureLoadedProfile() {
@@ -8076,210 +8061,139 @@ function _ensureLoadedProfile() {
8076
8061
  return _ensureLoadedProfile.apply(this, arguments);
8077
8062
  }
8078
8063
 
8079
- function findAppInstances(_x4, _x5, _x6) {
8064
+ function findAppInstances(_x3, _x4, _x5) {
8080
8065
  return _findAppInstances.apply(this, arguments);
8081
8066
  }
8082
- /**
8083
- * UI to control registration of instance
8084
- */
8085
-
8086
8067
 
8087
8068
  function _findAppInstances() {
8088
8069
  _findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
8089
- var visibility, index, thisIndex, registrations, instances, containers, unique, e, i, cont;
8070
+ var items;
8090
8071
  return _regenerator["default"].wrap(function _callee6$(_context6) {
8091
8072
  while (1) {
8092
8073
  switch (_context6.prev = _context6.next) {
8093
8074
  case 0:
8094
- unique = function _unique(arr) {
8095
- return Array.from(new Set(arr));
8096
- };
8097
-
8098
- if (!(isPublic === undefined)) {
8099
- _context6.next = 7;
8075
+ if (!context.me) {
8076
+ _context6.next = 6;
8100
8077
  break;
8101
8078
  }
8102
8079
 
8103
- _context6.next = 4;
8104
- return findAppInstances(context, theClass, true);
8080
+ _context6.next = 3;
8081
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
8105
8082
 
8106
- case 4:
8107
- _context6.next = 6;
8108
- return findAppInstances(context, theClass, false);
8083
+ case 3:
8084
+ _context6.t0 = _context6.sent;
8085
+ _context6.next = 7;
8086
+ break;
8109
8087
 
8110
8088
  case 6:
8111
- return _context6.abrupt("return", context);
8089
+ _context6.t0 = [];
8112
8090
 
8113
8091
  case 7:
8114
- _context6.prev = 7;
8115
- _context6.next = 10;
8116
- return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
8117
-
8118
- case 10:
8119
- _context6.next = 15;
8120
- break;
8121
-
8122
- case 12:
8123
- _context6.prev = 12;
8124
- _context6.t0 = _context6["catch"](7);
8125
- widgets.complain(context, "loadIndex: login and load problem ".concat(_context6.t0));
8092
+ items = _context6.t0;
8126
8093
 
8127
- case 15:
8128
- // console.log('awaited LogInLoad!', context)
8129
- visibility = isPublic ? 'public' : 'private';
8130
- _context6.prev = 16;
8131
- _context6.next = 19;
8132
- return (0, _solidLogic.loadIndex)(context, isPublic);
8133
-
8134
- case 19:
8135
- _context6.next = 24;
8136
- break;
8137
-
8138
- case 21:
8139
- _context6.prev = 21;
8140
- _context6.t1 = _context6["catch"](16);
8141
- debug.error(_context6.t1);
8142
-
8143
- case 24:
8144
- index = context.index;
8145
- thisIndex = index[visibility];
8146
- registrations = thisIndex.map(function (ix) {
8147
- return _solidLogic.solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix);
8148
- }).reduce(function (acc, curr) {
8149
- return acc.concat(curr);
8150
- }, []);
8151
- instances = registrations.map(function (reg) {
8152
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instance'));
8153
- }).reduce(function (acc, curr) {
8154
- return acc.concat(curr);
8155
- }, []);
8156
- containers = registrations.map(function (reg) {
8157
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instanceContainer'));
8158
- }).reduce(function (acc, curr) {
8159
- return acc.concat(curr);
8160
- }, []);
8161
- context.instances = context.instances || [];
8162
- context.instances = unique(context.instances.concat(instances));
8163
- context.containers = context.containers || [];
8164
- context.containers = unique(context.containers.concat(containers));
8165
-
8166
- if (containers.length) {
8167
- _context6.next = 35;
8168
- break;
8169
- }
8170
-
8171
- return _context6.abrupt("return", context);
8172
-
8173
- case 35:
8174
- _context6.prev = 35;
8175
- _context6.next = 38;
8176
- return _solidLogic.solidLogicSingleton.load(containers);
8177
-
8178
- case 38:
8179
- _context6.next = 45;
8180
- break;
8181
-
8182
- case 40:
8183
- _context6.prev = 40;
8184
- _context6.t2 = _context6["catch"](35);
8185
- e = new Error("[FAI] Unable to load containers".concat(_context6.t2));
8186
- debug.log(e); // complain
8187
-
8188
- widgets.complain(context, "Error looking for ".concat(_index.utils.label(theClass), ": ").concat(_context6.t2)); // but then ignore it
8189
- // throw new Error(e)
8190
-
8191
- case 45:
8192
- i = 0;
8193
-
8194
- case 46:
8195
- if (!(i < containers.length)) {
8196
- _context6.next = 56;
8197
- break;
8094
+ if (isPublic === true) {
8095
+ // old API - not recommended!
8096
+ items = items.filter(function (item) {
8097
+ return item.scope.label === 'public';
8098
+ });
8099
+ } else if (isPublic === false) {
8100
+ items = items.filter(function (item) {
8101
+ return item.scope.label === 'private';
8102
+ });
8198
8103
  }
8199
8104
 
8200
- cont = containers[i];
8201
- _context6.t3 = context.instances;
8202
- _context6.next = 51;
8203
- return _solidLogic.solidLogicSingleton.getContainerMembers(cont.value);
8204
-
8205
- case 51:
8206
- _context6.t4 = _context6.sent.map(function (uri) {
8207
- return _solidLogic.solidLogicSingleton.store.sym(uri);
8105
+ context.instances = items.map(function (item) {
8106
+ return item.instance;
8208
8107
  });
8209
- context.instances = _context6.t3.concat.call(_context6.t3, _context6.t4);
8210
-
8211
- case 53:
8212
- i++;
8213
- _context6.next = 46;
8214
- break;
8215
-
8216
- case 56:
8217
8108
  return _context6.abrupt("return", context);
8218
8109
 
8219
- case 57:
8110
+ case 11:
8220
8111
  case "end":
8221
8112
  return _context6.stop();
8222
8113
  }
8223
8114
  }
8224
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
8115
+ }, _callee6);
8225
8116
  }));
8226
8117
  return _findAppInstances.apply(this, arguments);
8227
8118
  }
8228
8119
 
8229
- function registrationControl(_x7, _x8, _x9) {
8230
- return _registrationControl.apply(this, arguments);
8120
+ function scopeLabel(context, scope) {
8121
+ var mine = context.me && context.me.sameTerm(scope.agent);
8122
+ var name = mine ? '' : utils.label(scope.agent) + ' ';
8123
+ return "".concat(name).concat(scope.label);
8231
8124
  }
8232
8125
  /**
8233
- * UI to List at all registered things
8126
+ * UI to control registration of instance
8234
8127
  */
8235
8128
 
8236
8129
 
8130
+ function registrationControl(_x6, _x7, _x8) {
8131
+ return _registrationControl.apply(this, arguments);
8132
+ }
8133
+
8237
8134
  function _registrationControl() {
8238
8135
  _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
8239
- var dom, box, context2, msg, tbody, form, registrationStatements, index, statements, _msg;
8136
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
8240
8137
 
8241
8138
  return _regenerator["default"].wrap(function _callee7$(_context7) {
8242
8139
  while (1) {
8243
8140
  switch (_context7.prev = _context7.next) {
8244
8141
  case 0:
8142
+ renderScopeCheckbox = function _renderScopeCheckbox(scope) {
8143
+ var statements = registrationStatements(scope.index);
8144
+ var name = scopeLabel(context, scope);
8145
+ var label = "".concat(name, " link to this ").concat(context.noun);
8146
+ return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
8147
+ };
8148
+
8149
+ registrationStatements = function _registrationStatemen(index) {
8150
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8151
+
8152
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8153
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8154
+ };
8155
+
8156
+ /// / body of registrationControl
8245
8157
  dom = context.dom;
8246
8158
 
8247
8159
  if (!(!dom || !context.div)) {
8248
- _context7.next = 3;
8160
+ _context7.next = 5;
8249
8161
  break;
8250
8162
  }
8251
8163
 
8252
- return _context7.abrupt("return", context);
8164
+ throw new Error('registrationControl: need dom and div');
8253
8165
 
8254
- case 3:
8166
+ case 5:
8255
8167
  box = dom.createElement('div');
8256
8168
  context.div.appendChild(box);
8257
8169
  context.me = _solidLogic.authn.currentUser(); // @@
8258
8170
 
8259
- if (context.me) {
8260
- _context7.next = 9;
8171
+ me = context.me;
8172
+
8173
+ if (me) {
8174
+ _context7.next = 12;
8261
8175
  break;
8262
8176
  }
8263
8177
 
8264
8178
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
8265
8179
  return _context7.abrupt("return", context);
8266
8180
 
8267
- case 9:
8268
- _context7.prev = 9;
8269
- _context7.next = 12;
8270
- return (0, _solidLogic.ensureTypeIndexes)(context);
8271
-
8272
8181
  case 12:
8273
- context2 = _context7.sent;
8274
- _context7.next = 19;
8275
- break;
8182
+ _context7.prev = 12;
8183
+ _context7.next = 15;
8184
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
8276
8185
 
8277
8186
  case 15:
8278
- _context7.prev = 15;
8279
- _context7.t0 = _context7["catch"](9);
8187
+ scopes = _context7.sent;
8188
+ _context7.next = 23;
8189
+ break;
8190
+
8191
+ case 18:
8192
+ _context7.prev = 18;
8193
+ _context7.t0 = _context7["catch"](12);
8280
8194
 
8281
8195
  if (context.div && context.preferencesFileError) {
8282
- msg = '(Preferences not available)';
8196
+ msg = '(Lists of stuff not available)';
8283
8197
  context.div.appendChild(dom.createElement('p')).textContent = msg;
8284
8198
  } else if (context.div) {
8285
8199
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -8287,168 +8201,201 @@ function _registrationControl() {
8287
8201
  }
8288
8202
 
8289
8203
  debug.log(msg);
8204
+ return _context7.abrupt("return", context);
8290
8205
 
8291
- case 19:
8292
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
8206
+ case 23:
8207
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8293
8208
 
8294
8209
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
8295
8210
  tbody = box.children[0].children[0];
8296
8211
  form = new _rdflib.BlankNode(); // @@ say for now
8297
8212
 
8298
- registrationStatements = function registrationStatements(index) {
8299
- var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8300
-
8301
- var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8302
- return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8303
- };
8213
+ _iterator = _createForOfIteratorHelper(scopes);
8304
8214
 
8305
8215
  try {
8306
- if (context2.index && context2.index["public"] && context2.index["public"].length > 0) {
8307
- index = context2.index["public"][0];
8308
- statements = registrationStatements(index);
8309
- tbody.children[0].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context2.noun), null, statements, form, index));
8310
- }
8311
-
8312
- if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
8313
- index = context2.index["private"][0];
8314
- statements = registrationStatements(index);
8315
- tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
8316
- }
8317
- } catch (e) {
8318
- _msg = "registrationControl: Error making panel: ".concat(e);
8319
-
8320
- if (context.div) {
8321
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
8216
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8217
+ scope = _step.value;
8218
+ row = tbody.appendChild(dom.createElement('tr'));
8219
+ row.appendChild(renderScopeCheckbox(scope)); // @@ index
8322
8220
  }
8323
-
8324
- debug.log(_msg);
8221
+ } catch (err) {
8222
+ _iterator.e(err);
8223
+ } finally {
8224
+ _iterator.f();
8325
8225
  }
8326
8226
 
8327
- return _context7.abrupt("return", context2);
8227
+ return _context7.abrupt("return", context);
8328
8228
 
8329
- case 26:
8229
+ case 30:
8330
8230
  case "end":
8331
8231
  return _context7.stop();
8332
8232
  }
8333
8233
  }
8334
- }, _callee7, null, [[9, 15]]);
8234
+ }, _callee7, null, [[12, 18]]);
8335
8235
  }));
8336
8236
  return _registrationControl.apply(this, arguments);
8337
8237
  }
8338
8238
 
8339
- function registrationList(_x10, _x11) {
8239
+ function renderScopeHeadingRow(context, store, scope) {
8240
+ var backgroundColor = {
8241
+ "private": '#fee',
8242
+ "public": '#efe'
8243
+ };
8244
+ var dom = context.dom;
8245
+ var name = scopeLabel(context, scope);
8246
+ var row = dom.createElement('tr');
8247
+ var cell = row.appendChild(dom.createElement('td'));
8248
+ cell.setAttribute('colspan', '3');
8249
+ cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
8250
+ var header = cell.appendChild(dom.createElement('h3'));
8251
+ header.textContent = name + ' links';
8252
+ header.style.textAlign = 'left';
8253
+ return row;
8254
+ }
8255
+ /**
8256
+ * UI to List at all registered things
8257
+ */
8258
+
8259
+
8260
+ function registrationList(_x9, _x10) {
8340
8261
  return _registrationList.apply(this, arguments);
8341
- }
8262
+ } // registrationList
8263
+
8342
8264
 
8343
8265
  function _registrationList() {
8344
- _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(context0, options) {
8345
- var dom, div, box;
8346
- return _regenerator["default"].wrap(function _callee8$(_context8) {
8266
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
8267
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
8268
+
8269
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
8347
8270
  while (1) {
8348
- switch (_context8.prev = _context8.next) {
8271
+ switch (_context9.prev = _context9.next) {
8349
8272
  case 0:
8350
- dom = context0.dom;
8351
- div = context0.div;
8273
+ dom = context.dom;
8274
+ div = context.div;
8352
8275
  box = dom.createElement('div');
8353
8276
  div.appendChild(box);
8354
- context0.me = _solidLogic.authn.currentUser(); // @@
8277
+ context.me = _solidLogic.authn.currentUser(); // @@
8355
8278
 
8356
- if (context0.me) {
8357
- _context8.next = 8;
8279
+ if (context.me) {
8280
+ _context9.next = 8;
8358
8281
  break;
8359
8282
  }
8360
8283
 
8361
8284
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
8362
- return _context8.abrupt("return", context0);
8285
+ return _context9.abrupt("return", context);
8363
8286
 
8364
8287
  case 8:
8365
- return _context8.abrupt("return", (0, _solidLogic.ensureTypeIndexes)(context0).then(function (context) {
8366
- box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8367
-
8368
- // tbody will be inserted anyway
8369
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8370
- var table = box.firstChild;
8371
- var ix = [];
8372
- var sts = [];
8373
- var vs = ['private', 'public'];
8374
- vs.forEach(function (visibility) {
8375
- if (context.index && context.index[visibility].length > 0 && options[visibility]) {
8376
- ix = ix.concat(context.index[visibility][0]);
8377
- sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
8378
- }
8379
- });
8288
+ _context9.next = 10;
8289
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
8290
+
8291
+ case 10:
8292
+ scopes = _context9.sent;
8293
+ // includes community indexes
8294
+ // console.log('@@ registrationList ', scopes)
8295
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8380
8296
 
8381
- var _loop = function _loop(i) {
8382
- var statement = sts[i];
8297
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8298
+ table = box.firstChild;
8299
+ tbody = table.firstChild;
8300
+ _iterator2 = _createForOfIteratorHelper(scopes);
8301
+ _context9.prev = 16;
8383
8302
 
8384
- if (options.type) {
8385
- // now check terms:forClass
8386
- if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
8387
- return "continue"; // skip irrelevant ones
8388
- }
8389
- } // const cla = statement.subject
8303
+ _iterator2.s();
8304
+
8305
+ case 18:
8306
+ if ((_step2 = _iterator2.n()).done) {
8307
+ _context9.next = 30;
8308
+ break;
8309
+ }
8310
+
8311
+ scope = _step2.value;
8312
+ // need some predicate for listing/adding agents
8313
+ headingRow = renderScopeHeadingRow(context, store, scope);
8314
+ tbody.appendChild(headingRow);
8315
+ _context9.next = 24;
8316
+ return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
8390
8317
 
8318
+ case 24:
8319
+ items = _context9.sent;
8320
+ // any class
8321
+ if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
8322
+
8323
+ _iterator3 = _createForOfIteratorHelper(items);
8324
+
8325
+ try {
8326
+ _loop = function _loop() {
8327
+ var item = _step3.value;
8328
+ var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
8329
+ deleteFunction: function () {
8330
+ var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
8331
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
8332
+ while (1) {
8333
+ switch (_context8.prev = _context8.next) {
8334
+ case 0:
8335
+ _context8.next = 2;
8336
+ return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
8337
+
8338
+ case 2:
8339
+ tbody.removeChild(row);
8340
+
8341
+ case 3:
8342
+ case "end":
8343
+ return _context8.stop();
8344
+ }
8345
+ }
8346
+ }, _callee8);
8347
+ }));
8391
8348
 
8392
- // const cla = statement.subject
8393
- var inst = statement.object;
8394
- table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
8395
- deleteFunction: function deleteFunction(_x) {
8396
- if (!_solidLogic.solidLogicSingleton.store.updater) {
8397
- throw new Error('Cannot delete this, store has no updater');
8349
+ function deleteFunction() {
8350
+ return _deleteFunction.apply(this, arguments);
8398
8351
  }
8399
8352
 
8400
- _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
8401
- if (ok) {
8402
- debug.log("Removed from index: ".concat(statement.subject));
8403
- } else {
8404
- debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
8405
- }
8406
- });
8407
- }
8408
- }));
8353
+ return deleteFunction;
8354
+ }()
8355
+ });
8356
+ row.children[0].style.paddingLeft = '3em';
8357
+ tbody.appendChild(row);
8409
8358
  };
8410
8359
 
8411
- for (var i = 0; i < sts.length; i++) {
8412
- var _ret = _loop(i);
8360
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
8361
+ _loop();
8362
+ }
8363
+ } catch (err) {
8364
+ _iterator3.e(err);
8365
+ } finally {
8366
+ _iterator3.f();
8367
+ }
8413
8368
 
8414
- if (_ret === "continue") continue;
8415
- } // registrationList
8369
+ case 28:
8370
+ _context9.next = 18;
8371
+ break;
8416
8372
 
8417
- /*
8418
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8419
- if (containers.length) {
8420
- fetcher.load(containers).then(function(xhrs){
8421
- for (const i=0; i<containers.length; i++) {
8422
- const cont = containers[i];
8423
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8424
- }
8425
- });
8426
- }
8427
- */
8373
+ case 30:
8374
+ _context9.next = 35;
8375
+ break;
8428
8376
 
8377
+ case 32:
8378
+ _context9.prev = 32;
8379
+ _context9.t0 = _context9["catch"](16);
8429
8380
 
8430
- // registrationList
8381
+ _iterator2.e(_context9.t0);
8431
8382
 
8432
- /*
8433
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8434
- if (containers.length) {
8435
- fetcher.load(containers).then(function(xhrs){
8436
- for (const i=0; i<containers.length; i++) {
8437
- const cont = containers[i];
8438
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8439
- }
8440
- });
8441
- }
8442
- */
8443
- return context;
8444
- }));
8383
+ case 35:
8384
+ _context9.prev = 35;
8445
8385
 
8446
- case 9:
8386
+ _iterator2.f();
8387
+
8388
+ return _context9.finish(35);
8389
+
8390
+ case 38:
8391
+ return _context9.abrupt("return", context);
8392
+
8393
+ case 39:
8447
8394
  case "end":
8448
- return _context8.stop();
8395
+ return _context9.stop();
8449
8396
  }
8450
8397
  }
8451
- }, _callee8);
8398
+ }, _callee9, null, [[16, 32, 35, 38]]);
8452
8399
  }));
8453
8400
  return _registrationList.apply(this, arguments);
8454
8401
  }
@@ -8605,7 +8552,7 @@ function renderSignInPopup(dom) {
8605
8552
  }, _callee, null, [[0, 8]]);
8606
8553
  }));
8607
8554
 
8608
- return function loginToIssuer(_x12) {
8555
+ return function loginToIssuer(_x11) {
8609
8556
  return _ref.apply(this, arguments);
8610
8557
  };
8611
8558
  }();
@@ -8892,7 +8839,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
8892
8839
 
8893
8840
  function displayOptions(context) {
8894
8841
  // console.log('displayOptions!', context)
8895
- function makeNewWorkspace(_x13) {
8842
+ function makeNewWorkspace(_x12) {
8896
8843
  return _makeNewWorkspace.apply(this, arguments);
8897
8844
  } // const status = ''
8898
8845
 
@@ -9161,77 +9108,77 @@ function getUserRoles() {
9161
9108
 
9162
9109
 
9163
9110
  function _getUserRoles() {
9164
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
9111
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
9165
9112
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
9166
9113
 
9167
- return _regenerator["default"].wrap(function _callee9$(_context9) {
9114
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
9168
9115
  while (1) {
9169
- switch (_context9.prev = _context9.next) {
9116
+ switch (_context10.prev = _context10.next) {
9170
9117
  case 0:
9171
- _context9.prev = 0;
9172
- _context9.next = 3;
9118
+ _context10.prev = 0;
9119
+ _context10.next = 3;
9173
9120
  return ensureLoadedPreferences({});
9174
9121
 
9175
9122
  case 3:
9176
- _yield$ensureLoadedPr = _context9.sent;
9123
+ _yield$ensureLoadedPr = _context10.sent;
9177
9124
  me = _yield$ensureLoadedPr.me;
9178
9125
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
9179
9126
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
9180
9127
 
9181
9128
  if (!(!preferencesFile || preferencesFileError)) {
9182
- _context9.next = 9;
9129
+ _context10.next = 9;
9183
9130
  break;
9184
9131
  }
9185
9132
 
9186
9133
  throw new Error(preferencesFileError);
9187
9134
 
9188
9135
  case 9:
9189
- return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9136
+ return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9190
9137
 
9191
9138
  case 12:
9192
- _context9.prev = 12;
9193
- _context9.t0 = _context9["catch"](0);
9194
- debug.warn('Unable to fetch your preferences - this was the error: ', _context9.t0);
9139
+ _context10.prev = 12;
9140
+ _context10.t0 = _context10["catch"](0);
9141
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
9195
9142
 
9196
9143
  case 15:
9197
- return _context9.abrupt("return", []);
9144
+ return _context10.abrupt("return", []);
9198
9145
 
9199
9146
  case 16:
9200
9147
  case "end":
9201
- return _context9.stop();
9148
+ return _context10.stop();
9202
9149
  }
9203
9150
  }
9204
- }, _callee9, null, [[0, 12]]);
9151
+ }, _callee10, null, [[0, 12]]);
9205
9152
  }));
9206
9153
  return _getUserRoles.apply(this, arguments);
9207
9154
  }
9208
9155
 
9209
- function filterAvailablePanes(_x14) {
9156
+ function filterAvailablePanes(_x13) {
9210
9157
  return _filterAvailablePanes.apply(this, arguments);
9211
9158
  }
9212
9159
 
9213
9160
  function _filterAvailablePanes() {
9214
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
9161
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
9215
9162
  var userRoles;
9216
- return _regenerator["default"].wrap(function _callee10$(_context10) {
9163
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
9217
9164
  while (1) {
9218
- switch (_context10.prev = _context10.next) {
9165
+ switch (_context11.prev = _context11.next) {
9219
9166
  case 0:
9220
- _context10.next = 2;
9167
+ _context11.next = 2;
9221
9168
  return getUserRoles();
9222
9169
 
9223
9170
  case 2:
9224
- userRoles = _context10.sent;
9225
- return _context10.abrupt("return", panes.filter(function (pane) {
9171
+ userRoles = _context11.sent;
9172
+ return _context11.abrupt("return", panes.filter(function (pane) {
9226
9173
  return isMatchingAudience(pane, userRoles);
9227
9174
  }));
9228
9175
 
9229
9176
  case 4:
9230
9177
  case "end":
9231
- return _context10.stop();
9178
+ return _context11.stop();
9232
9179
  }
9233
9180
  }
9234
- }, _callee10);
9181
+ }, _callee11);
9235
9182
  }));
9236
9183
  return _filterAvailablePanes.apply(this, arguments);
9237
9184
  }
@@ -15282,8 +15229,8 @@ Object.defineProperty(exports, "__esModule", ({
15282
15229
  }));
15283
15230
  exports.versionInfo = void 0;
15284
15231
  var versionInfo = {
15285
- buildTime: '2022-05-25T22:07:30Z',
15286
- commit: '21ace821b259f508d02c65d74eb2e3200d7e92e3',
15232
+ buildTime: '2022-06-12T13:56:31Z',
15233
+ commit: '22876355a795685f38119d2f14a9abd8c68427bf',
15287
15234
  npmInfo: {
15288
15235
  'solid-ui': '2.4.22',
15289
15236
  npm: '6.14.17',
@@ -15295,8 +15242,8 @@ var versionInfo = {
15295
15242
  modules: '83',
15296
15243
  napi: '8',
15297
15244
  nghttp2: '1.42.0',
15298
- node: '14.19.2',
15299
- openssl: '1.1.1n',
15245
+ node: '14.19.3',
15246
+ openssl: '1.1.1o',
15300
15247
  tz: '2021a3',
15301
15248
  unicode: '14.0',
15302
15249
  uv: '1.42.0',
@@ -17139,7 +17086,7 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
17139
17086
  /*!******************************!*\
17140
17087
  !*** ./lib/widgets/error.js ***!
17141
17088
  \******************************/
17142
- /***/ ((__unused_webpack_module, exports) => {
17089
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
17143
17090
 
17144
17091
  "use strict";
17145
17092
 
@@ -17149,6 +17096,8 @@ Object.defineProperty(exports, "__esModule", ({
17149
17096
  }));
17150
17097
  exports.errorMessageBlock = errorMessageBlock;
17151
17098
 
17099
+ var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
17100
+
17152
17101
  /**
17153
17102
  * Create an error message block
17154
17103
  * @param dom The DOM on which dom.createElement will be called
@@ -17179,6 +17128,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
17179
17128
  div.textContent = err;
17180
17129
  }
17181
17130
 
17131
+ div.appendChild((0, _widgets.cancelButton)(dom, function () {
17132
+ if (div.parentNode) div.parentNode.removeChild(div);
17133
+ })).style = 'width: 2em; height: 2em; align: right;';
17182
17134
  div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
17183
17135
  return div;
17184
17136
  }
@@ -17217,6 +17169,12 @@ Object.defineProperty(exports, "field", ({
17217
17169
  return _fieldFunction.field;
17218
17170
  }
17219
17171
  }));
17172
+ Object.defineProperty(exports, "fieldFunction", ({
17173
+ enumerable: true,
17174
+ get: function get() {
17175
+ return _fieldFunction.fieldFunction;
17176
+ }
17177
+ }));
17220
17178
  Object.defineProperty(exports, "fieldLabel", ({
17221
17179
  enumerable: true,
17222
17180
  get: function get() {
@@ -17242,6 +17200,12 @@ exports.makeSelectForCategory = makeSelectForCategory;
17242
17200
  exports.makeSelectForChoice = makeSelectForChoice;
17243
17201
  exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
17244
17202
  exports.makeSelectForOptions = makeSelectForOptions;
17203
+ Object.defineProperty(exports, "mostSpecificClassURI", ({
17204
+ enumerable: true,
17205
+ get: function get() {
17206
+ return _fieldFunction.mostSpecificClassURI;
17207
+ }
17208
+ }));
17245
17209
  exports.newButton = newButton;
17246
17210
  exports.newThing = newThing;
17247
17211
  exports.promptForNew = promptForNew;
@@ -18262,8 +18226,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18262
18226
  }
18263
18227
 
18264
18228
  var subForm = kb.any(form, ui('use')); // Optional
18265
-
18266
- var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
18229
+ // const follow = kb.anyJS(form, ui('follow'), null, formDoc) // data doc moves to new subject?
18267
18230
 
18268
18231
  var opts = {
18269
18232
  form: form,
@@ -18326,14 +18289,14 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18326
18289
 
18327
18290
  var multiSelect = kb.any(form, ui('multiselect')); // Optional
18328
18291
 
18329
- var selector; // from ui:property
18330
-
18331
- var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18332
- return object.value;
18333
- });
18292
+ var selector;
18334
18293
 
18335
18294
  rhs.refresh = function () {
18336
- // from ui:from + ui:property
18295
+ // from ui:property
18296
+ var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18297
+ return object.value;
18298
+ }); // from ui:from + ui:property
18299
+
18337
18300
  var possibleOptions = getSelectorOptions();
18338
18301
  possibleOptions.push(selectedOptions);
18339
18302
  possibleOptions = sortByLabel(possibleOptions);
@@ -19124,7 +19087,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19124
19087
 
19125
19088
  log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
19126
19089
 
19127
- function determineFitstSelectOptionText() {
19090
+ function createDefaultSelectOptionText() {
19128
19091
  var firstSelectOptionText = '--- choice ---';
19129
19092
 
19130
19093
  if (predicate && !(predicate.termType === 'BlankNode')) {
@@ -19138,9 +19101,9 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19138
19101
  return firstSelectOptionText;
19139
19102
  }
19140
19103
 
19141
- function determinFirstSelectOption() {
19104
+ function createDefaultSelectOption() {
19142
19105
  var option = dom.createElement('option');
19143
- option.appendChild(dom.createTextNode(determineFitstSelectOptionText()));
19106
+ option.appendChild(dom.createTextNode(createDefaultSelectOptionText()));
19144
19107
  option.disabled = true;
19145
19108
  option.value = true;
19146
19109
  option.hidden = true;
@@ -19170,7 +19133,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19170
19133
  select.insertBefore(mint, select.firstChild);
19171
19134
  }
19172
19135
 
19173
- if (select.children.length === 0) select.insertBefore(determinFirstSelectOption(), select.firstChild);
19136
+ if (select.children.length === 0) select.insertBefore(createDefaultSelectOption(), select.firstChild);
19174
19137
 
19175
19138
  select.update = function (newSelectedOptions) {
19176
19139
  selectedOptions = newSelectedOptions;
@@ -19179,7 +19142,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19179
19142
 
19180
19143
  var removeValue = function removeValue(t) {
19181
19144
  if (kb.holds(subject, predicate, t, dataDoc)) {
19182
- ds.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value removed " + t)
19145
+ ds.push($rdf.st(subject, predicate, t, dataDoc));
19183
19146
  }
19184
19147
  };
19185
19148
 
@@ -19276,13 +19239,13 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19276
19239
  select.currentURI = opt.AJAR_uri;
19277
19240
  }
19278
19241
 
19279
- if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'false');
19242
+ if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.removeAttribute('selected');
19280
19243
  if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
19281
19244
  }
19282
19245
 
19283
19246
  log.info('selectForOptions: data doc = ' + dataDoc);
19284
19247
 
19285
- if (select.currentURI) {
19248
+ if (select.currentURI && options.subForm) {
19286
19249
  addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
19287
19250
  if (ok) {
19288
19251
  kb.updater.update([], is, function (uri, success, errorBody) {
@@ -19323,8 +19286,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19323
19286
 
19324
19287
  option.AJAR_uri = uri;
19325
19288
 
19326
- if (c.value === '' + select.currentURI || containsObject(c.value, selectedOptions)) {
19327
- option.selected = true;
19289
+ if (containsObject(c.value, selectedOptions)) {
19328
19290
  option.setAttribute('selected', 'true');
19329
19291
  }
19330
19292
 
@@ -26957,31 +26919,6 @@ function freeze(object, oc) {
26957
26919
  return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
26958
26920
  }
26959
26921
 
26960
- /**
26961
- * Since we can not rely on `Object.assign` we provide a simplified version
26962
- * that is sufficient for our needs.
26963
- *
26964
- * @param {Object} target
26965
- * @param {Object | null | undefined} source
26966
- *
26967
- * @returns {Object} target
26968
- * @throws TypeError if target is not an object
26969
- *
26970
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
26971
- * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
26972
- */
26973
- function assign(target, source) {
26974
- if (target === null || typeof target !== 'object') {
26975
- throw new TypeError('target is not an object')
26976
- }
26977
- for (var key in source) {
26978
- if (Object.prototype.hasOwnProperty.call(source, key)) {
26979
- target[key] = source[key]
26980
- }
26981
- }
26982
- return target
26983
- }
26984
-
26985
26922
  /**
26986
26923
  * All mime types that are allowed as input to `DOMParser.parseFromString`
26987
26924
  *
@@ -27099,7 +27036,6 @@ var NAMESPACE = freeze({
27099
27036
  XMLNS: 'http://www.w3.org/2000/xmlns/',
27100
27037
  })
27101
27038
 
27102
- exports.assign = assign;
27103
27039
  exports.freeze = freeze;
27104
27040
  exports.MIME_TYPE = MIME_TYPE;
27105
27041
  exports.NAMESPACE = NAMESPACE;
@@ -28634,10 +28570,9 @@ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
28634
28570
  * are serialized as their entity references, so they will be preserved.
28635
28571
  * (In contrast to whitespace literals in the input which are normalized to spaces)
28636
28572
  * @see https://www.w3.org/TR/xml11/#AVNormalize
28637
- * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
28638
28573
  */
28639
28574
  function addSerializedAttribute(buf, qualifiedName, value) {
28640
- buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"')
28575
+ buf.push(' ', qualifiedName, '="', value.replace(/[<&"\t\n\r]/g, _xmlEncoder), '"')
28641
28576
  }
28642
28577
 
28643
28578
  function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
@@ -28782,10 +28717,10 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
28782
28717
  * and does not include the CDATA-section-close delimiter, `]]>`.
28783
28718
  *
28784
28719
  * @see https://www.w3.org/TR/xml/#NT-CharData
28785
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
28786
28720
  */
28787
28721
  return buf.push(node.data
28788
- .replace(/[<&>]/g,_xmlEncoder)
28722
+ .replace(/[<&]/g,_xmlEncoder)
28723
+ .replace(/]]>/g, ']]&gt;')
28789
28724
  );
28790
28725
  case CDATA_SECTION_NODE:
28791
28726
  return buf.push( '<![CDATA[',node.data,']]>');
@@ -45814,8 +45749,8 @@ class N3Parser {
45814
45749
  _saveContext(type, graph, subject, predicate, object) {
45815
45750
  const n3Mode = this._n3Mode;
45816
45751
  this._contextStack.push({
45817
- subject: subject, predicate: predicate, object: object,
45818
- graph: graph, type: type,
45752
+ type,
45753
+ subject, predicate, object, graph,
45819
45754
  inverse: n3Mode ? this._inversePredicate : false,
45820
45755
  blankPrefix: n3Mode ? this._prefixes._ : '',
45821
45756
  quantified: n3Mode ? this._quantified : null,
@@ -45834,14 +45769,20 @@ class N3Parser {
45834
45769
 
45835
45770
  // ### `_restoreContext` restores the parent context
45836
45771
  // when leaving a scope (list, blank node, formula)
45837
- _restoreContext() {
45838
- const context = this._contextStack.pop(), n3Mode = this._n3Mode;
45772
+ _restoreContext(type, token) {
45773
+ // Obtain the previous context
45774
+ const context = this._contextStack.pop();
45775
+ if (!context || context.type !== type)
45776
+ return this._error(`Unexpected ${token.type}`, token);
45777
+
45778
+ // Restore the quad of the previous context
45839
45779
  this._subject = context.subject;
45840
45780
  this._predicate = context.predicate;
45841
45781
  this._object = context.object;
45842
45782
  this._graph = context.graph;
45843
- // The settings below only apply to N3 streams
45844
- if (n3Mode) {
45783
+
45784
+ // Restore N3 context settings
45785
+ if (this._n3Mode) {
45845
45786
  this._inversePredicate = context.inverse;
45846
45787
  this._prefixes._ = context.blankPrefix;
45847
45788
  this._quantified = context.quantified;
@@ -46114,7 +46055,7 @@ class N3Parser {
46114
46055
 
46115
46056
  // Restore the parent context containing this blank node
46116
46057
  const empty = this._predicate === null;
46117
- this._restoreContext();
46058
+ this._restoreContext('blank', token);
46118
46059
  // If the blank node was the object, restore previous context and read punctuation
46119
46060
  if (this._object !== null)
46120
46061
  return this._getContextEndReader();
@@ -46165,7 +46106,7 @@ class N3Parser {
46165
46106
  break;
46166
46107
  case ')':
46167
46108
  // Closing the list; restore the parent context
46168
- this._restoreContext();
46109
+ this._restoreContext('list', token);
46169
46110
  // If this list is contained within a parent list, return the membership quad here.
46170
46111
  // This will be `<parent list element> rdf:first <this list>.`.
46171
46112
  if (stack.length !== 0 && stack[stack.length - 1].type === 'list')
@@ -46316,7 +46257,7 @@ class N3Parser {
46316
46257
  this._emit(this._subject, this._predicate, this._object, this._graph);
46317
46258
 
46318
46259
  // Restore the parent context containing this formula
46319
- this._restoreContext();
46260
+ this._restoreContext('formula', token);
46320
46261
  // If the formula was the subject, continue reading the predicate.
46321
46262
  // If the formula was the object, read punctuation.
46322
46263
  return this._object === null ? this._readPredicate : this._getContextEndReader();
@@ -46525,7 +46466,7 @@ class N3Parser {
46525
46466
  // The list item is the remaining subejct after reading the path
46526
46467
  const item = this._subject;
46527
46468
  // Switch back to the context of the list
46528
- this._restoreContext();
46469
+ this._restoreContext('item', token);
46529
46470
  // Output the list item
46530
46471
  this._emit(this._subject, this.RDF_FIRST, item, this._graph);
46531
46472
  }
@@ -46587,7 +46528,7 @@ class N3Parser {
46587
46528
  // Read the quad and restore the previous context
46588
46529
  const quad = this._quad(this._subject, this._predicate, this._object,
46589
46530
  this._graph || this.DEFAULTGRAPH);
46590
- this._restoreContext();
46531
+ this._restoreContext('<<', token);
46591
46532
  // If the triple was the subject, continue by reading the predicate.
46592
46533
  if (this._subject === null) {
46593
46534
  this._subject = quad;
@@ -66851,7 +66792,7 @@ var SolidAuthnLogic = /** @class */ (function () {
66851
66792
  if (app.viewingNoAuthPage) {
66852
66793
  return (0, rdflib_1.sym)(app.webId);
66853
66794
  }
66854
- if (this.session.info.webId && this.session.info.isLoggedIn) {
66795
+ if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
66855
66796
  return (0, rdflib_1.sym)(this.session.info.webId);
66856
66797
  }
66857
66798
  return (0, authUtil_1.offlineTestID)(); // null unless testing
@@ -67378,6 +67319,29 @@ exports.determineChatContainer = determineChatContainer;
67378
67319
 
67379
67320
  "use strict";
67380
67321
 
67322
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
67323
+ if (k2 === undefined) k2 = k;
67324
+ var desc = Object.getOwnPropertyDescriptor(m, k);
67325
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
67326
+ desc = { enumerable: true, get: function() { return m[k]; } };
67327
+ }
67328
+ Object.defineProperty(o, k2, desc);
67329
+ }) : (function(o, m, k, k2) {
67330
+ if (k2 === undefined) k2 = k;
67331
+ o[k2] = m[k];
67332
+ }));
67333
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
67334
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
67335
+ }) : function(o, v) {
67336
+ o["default"] = v;
67337
+ });
67338
+ var __importStar = (this && this.__importStar) || function (mod) {
67339
+ if (mod && mod.__esModule) return mod;
67340
+ var result = {};
67341
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
67342
+ __setModuleDefault(result, mod);
67343
+ return result;
67344
+ };
67381
67345
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
67382
67346
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
67383
67347
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -67414,16 +67378,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
67414
67378
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
67415
67379
  }
67416
67380
  };
67381
+ var __importDefault = (this && this.__importDefault) || function (mod) {
67382
+ return (mod && mod.__esModule) ? mod : { "default": mod };
67383
+ };
67417
67384
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67418
- exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = void 0;
67385
+ exports.deleteTypeIndexRegistration = exports.registerInstanceInTypeIndex = exports.getAppInstances = exports.getScopedAppInstances = exports.getScopedAppsFromIndex = exports.uniqueNodes = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.followOrCreateLink = exports.suggestPrivateTypeIndex = exports.suggestPublicTypeIndex = exports.suggestPreferencesFile = exports.loadOrCreateIfNotExists = void 0;
67419
67386
  var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js");
67420
- var ns = {
67421
- solid: (0, rdflib_1.Namespace)('http://www.w3.org/ns/solid/terms#'),
67422
- space: (0, rdflib_1.Namespace)('http://www.w3.org/ns/pim/space#')
67423
- };
67387
+ var $rdf = __importStar(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
67388
+ var solidLogicSingleton_1 = __webpack_require__(/*! ../logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
67389
+ var uri_1 = __webpack_require__(/*! ../util/uri */ "./node_modules/solid-logic/lib/util/uri.js");
67390
+ var solid_namespace_1 = __importDefault(__webpack_require__(/*! solid-namespace */ "./node_modules/solid-namespace/index.js"));
67391
+ var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
67392
+ var currentUser = authn.currentUser;
67393
+ var ns = (0, solid_namespace_1.default)($rdf);
67394
+ /**
67395
+ * Create a resource if it really does not exist
67396
+ * Be absolutely sure something does not exist before creating a new empty file
67397
+ * as otherwise existing could be deleted.
67398
+ * @param doc {NamedNode} - The resource
67399
+ */
67400
+ function loadOrCreateIfNotExists(store, doc) {
67401
+ return __awaiter(this, void 0, void 0, function () {
67402
+ var response, err_1, msg, msg;
67403
+ return __generator(this, function (_a) {
67404
+ switch (_a.label) {
67405
+ case 0:
67406
+ _a.trys.push([0, 2, , 3]);
67407
+ return [4 /*yield*/, store.fetcher.load(doc)];
67408
+ case 1:
67409
+ response = _a.sent();
67410
+ return [3 /*break*/, 3];
67411
+ case 2:
67412
+ err_1 = _a.sent();
67413
+ if (err_1.response.status === 404) {
67414
+ try {
67415
+ store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
67416
+ }
67417
+ catch (err) {
67418
+ msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
67419
+ throw new Error(msg);
67420
+ }
67421
+ delete store.fetcher.requested[doc.uri]; // delete cached 404 error
67422
+ }
67423
+ else {
67424
+ msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
67425
+ throw new Error(msg); // @@ add nested errors
67426
+ }
67427
+ return [3 /*break*/, 3];
67428
+ case 3: return [2 /*return*/, response];
67429
+ }
67430
+ });
67431
+ });
67432
+ }
67433
+ exports.loadOrCreateIfNotExists = loadOrCreateIfNotExists;
67434
+ function suggestPreferencesFile(me) {
67435
+ var stripped = me.uri.replace('/profile/', '/').replace('/public/', '/');
67436
+ // const stripped = me.uri.replace(\/[p|P]rofile/\g, '/').replace(\/[p|P]ublic/\g, '/')
67437
+ var folderURI = stripped.split('/').slice(0, -1).join('/') + '/Settings/';
67438
+ var fileURI = folderURI + 'Preferences.ttl';
67439
+ return (0, rdflib_1.sym)(fileURI);
67440
+ }
67441
+ exports.suggestPreferencesFile = suggestPreferencesFile;
67442
+ function suggestPublicTypeIndex(me) {
67443
+ var _a;
67444
+ return (0, rdflib_1.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
67445
+ }
67446
+ exports.suggestPublicTypeIndex = suggestPublicTypeIndex;
67447
+ // Note this one is based off the pref file not the profile
67448
+ function suggestPrivateTypeIndex(preferencesFile) {
67449
+ var _a;
67450
+ return (0, rdflib_1.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
67451
+ }
67452
+ exports.suggestPrivateTypeIndex = suggestPrivateTypeIndex;
67453
+ /* Follow link from this doc to another thing, or else make a new link
67454
+ **
67455
+ ** return: null no ld one and failed to make a new one
67456
+ */
67457
+ function followOrCreateLink(store, subject, predicate, object, doc) {
67458
+ return __awaiter(this, void 0, void 0, function () {
67459
+ var result, err_2, err_3;
67460
+ return __generator(this, function (_a) {
67461
+ switch (_a.label) {
67462
+ case 0: return [4 /*yield*/, store.fetcher.load(doc)];
67463
+ case 1:
67464
+ _a.sent();
67465
+ result = store.any(subject, predicate, null, doc);
67466
+ if (result)
67467
+ return [2 /*return*/, result];
67468
+ if (!store.updater.editable(doc)) {
67469
+ return [2 /*return*/, null];
67470
+ }
67471
+ _a.label = 2;
67472
+ case 2:
67473
+ _a.trys.push([2, 4, , 5]);
67474
+ return [4 /*yield*/, store.updater.update([], [(0, rdflib_1.st)(subject, predicate, object, doc)])];
67475
+ case 3:
67476
+ _a.sent();
67477
+ return [3 /*break*/, 5];
67478
+ case 4:
67479
+ err_2 = _a.sent();
67480
+ console.warn("followOrCreateLink: Error making link in ".concat(doc, " to ").concat(object, ": ").concat(err_2));
67481
+ return [2 /*return*/, null];
67482
+ case 5:
67483
+ _a.trys.push([5, 7, , 8]);
67484
+ return [4 /*yield*/, loadOrCreateIfNotExists(store, object)
67485
+ // store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
67486
+ ];
67487
+ case 6:
67488
+ _a.sent();
67489
+ return [3 /*break*/, 8];
67490
+ case 7:
67491
+ err_3 = _a.sent();
67492
+ console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
67493
+ return [3 /*break*/, 8];
67494
+ case 8: return [2 /*return*/, object];
67495
+ }
67496
+ });
67497
+ });
67498
+ }
67499
+ exports.followOrCreateLink = followOrCreateLink;
67424
67500
  function loadProfile(store, user) {
67425
67501
  return __awaiter(this, void 0, void 0, function () {
67426
- var err_1;
67502
+ var err_4;
67427
67503
  return __generator(this, function (_a) {
67428
67504
  switch (_a.label) {
67429
67505
  case 0:
@@ -67438,8 +67514,8 @@ function loadProfile(store, user) {
67438
67514
  _a.sent();
67439
67515
  return [3 /*break*/, 4];
67440
67516
  case 3:
67441
- err_1 = _a.sent();
67442
- throw new Error("Unable to load profile of user <".concat(user, ">: ").concat(err_1));
67517
+ err_4 = _a.sent();
67518
+ throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
67443
67519
  case 4: return [2 /*return*/, user.doc()];
67444
67520
  }
67445
67521
  });
@@ -67448,27 +67524,32 @@ function loadProfile(store, user) {
67448
67524
  exports.loadProfile = loadProfile;
67449
67525
  function loadPreferences(store, user) {
67450
67526
  return __awaiter(this, void 0, void 0, function () {
67451
- var profile, preferencesFile;
67527
+ var possiblePreferencesFile, preferencesFile, message, err_5;
67452
67528
  return __generator(this, function (_a) {
67453
67529
  switch (_a.label) {
67454
67530
  case 0: return [4 /*yield*/, loadProfile(store, user)];
67455
67531
  case 1:
67456
- profile = _a.sent();
67457
- preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile);
67532
+ _a.sent();
67533
+ possiblePreferencesFile = suggestPreferencesFile(user);
67534
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
67535
+ case 2:
67536
+ preferencesFile = _a.sent();
67458
67537
  if (!preferencesFile) {
67459
- // throw new Error(`USer ${user} has no pointer in profile to preferences file.`)
67538
+ message = "User ".concat(user, " has no pointer in profile to preferences file.");
67539
+ console.warn(message);
67460
67540
  return [2 /*return*/, undefined];
67461
67541
  }
67462
- try {
67463
- store.fetcher.load(preferencesFile);
67464
- }
67465
- catch (err) { // Mabeb a permission propblem or origin problem
67466
- return [2 /*return*/, undefined
67467
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
67468
- ];
67469
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
67470
- }
67471
- return [2 /*return*/, preferencesFile];
67542
+ _a.label = 3;
67543
+ case 3:
67544
+ _a.trys.push([3, 5, , 6]);
67545
+ return [4 /*yield*/, store.fetcher.load(preferencesFile)];
67546
+ case 4:
67547
+ _a.sent();
67548
+ return [3 /*break*/, 6];
67549
+ case 5:
67550
+ err_5 = _a.sent();
67551
+ return [2 /*return*/, undefined];
67552
+ case 6: return [2 /*return*/, preferencesFile];
67472
67553
  }
67473
67554
  });
67474
67555
  });
@@ -67476,7 +67557,7 @@ function loadPreferences(store, user) {
67476
67557
  exports.loadPreferences = loadPreferences;
67477
67558
  function loadTypeIndexesFor(store, user) {
67478
67559
  return __awaiter(this, void 0, void 0, function () {
67479
- var profile, publicTypeIndex, _a, pub, preferencesFile, privateTypeIndexes, priv;
67560
+ var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_6, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_7;
67480
67561
  return __generator(this, function (_b) {
67481
67562
  switch (_b.label) {
67482
67563
  case 0:
@@ -67485,30 +67566,55 @@ function loadTypeIndexesFor(store, user) {
67485
67566
  return [4 /*yield*/, loadProfile(store, user)];
67486
67567
  case 1:
67487
67568
  profile = _b.sent();
67488
- publicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile);
67489
- if (!publicTypeIndex) return [3 /*break*/, 5];
67490
- _b.label = 2;
67569
+ suggestion = suggestPublicTypeIndex(user);
67570
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)];
67491
67571
  case 2:
67492
- _b.trys.push([2, 4, , 5]);
67493
- return [4 /*yield*/, store.fetcher.load(publicTypeIndex)];
67572
+ publicTypeIndex = _b.sent();
67573
+ publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
67574
+ _b.label = 3;
67494
67575
  case 3:
67495
- _b.sent();
67496
- return [3 /*break*/, 5];
67576
+ _b.trys.push([3, 5, , 6]);
67577
+ return [4 /*yield*/, loadPreferences(store, user)];
67497
67578
  case 4:
67498
- _a = _b.sent();
67499
- return [3 /*break*/, 5];
67579
+ preferencesFile = _b.sent();
67580
+ return [3 /*break*/, 6];
67500
67581
  case 5:
67501
- pub = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
67502
- return [4 /*yield*/, loadPreferences(store, user)];
67582
+ err_6 = _b.sent();
67583
+ preferencesFile = null;
67584
+ return [3 /*break*/, 6];
67503
67585
  case 6:
67504
- preferencesFile = _b.sent();
67505
- if (preferencesFile) { // watch out - can be in either as spec was not clear
67506
- privateTypeIndexes = store.each(user, ns.solid('privateTypeIndex'), undefined, preferencesFile)
67507
- .concat(store.each(user, ns.solid('privateTypeIndex'), undefined, profile));
67508
- priv = privateTypeIndexes.length > 0 ? [{ label: 'priSo @@@@@vate', index: privateTypeIndexes[0], agent: user }] : [];
67509
- return [2 /*return*/, pub.concat(priv)];
67510
- }
67511
- return [2 /*return*/, pub];
67586
+ if (!preferencesFile) return [3 /*break*/, 9];
67587
+ suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile);
67588
+ _a = store.any(user, ns.solid('privateTypeIndex'), undefined, profile);
67589
+ if (_a) return [3 /*break*/, 8];
67590
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile)];
67591
+ case 7:
67592
+ _a = (_b.sent());
67593
+ _b.label = 8;
67594
+ case 8:
67595
+ privateTypeIndex = _a;
67596
+ privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex, agent: user }] : [];
67597
+ return [3 /*break*/, 10];
67598
+ case 9:
67599
+ privateScopes = [];
67600
+ _b.label = 10;
67601
+ case 10:
67602
+ scopes = publicScopes.concat(privateScopes);
67603
+ if (scopes.length === 0)
67604
+ return [2 /*return*/, scopes];
67605
+ files = scopes.map(function (scope) { return scope.index; });
67606
+ _b.label = 11;
67607
+ case 11:
67608
+ _b.trys.push([11, 13, , 14]);
67609
+ return [4 /*yield*/, store.fetcher.load(files)];
67610
+ case 12:
67611
+ _b.sent();
67612
+ return [3 /*break*/, 14];
67613
+ case 13:
67614
+ err_7 = _b.sent();
67615
+ console.warn('Problems loading type index: ', err_7);
67616
+ return [3 /*break*/, 14];
67617
+ case 14: return [2 /*return*/, scopes];
67512
67618
  }
67513
67619
  });
67514
67620
  });
@@ -67516,44 +67622,30 @@ function loadTypeIndexesFor(store, user) {
67516
67622
  exports.loadTypeIndexesFor = loadTypeIndexesFor;
67517
67623
  function loadCommunityTypeIndexes(store, user) {
67518
67624
  return __awaiter(this, void 0, void 0, function () {
67519
- var preferencesFile, communities, communityTypeIndexesPromise, result1;
67520
- var _this = this;
67521
- return __generator(this, function (_a) {
67522
- switch (_a.label) {
67625
+ var preferencesFile, communities, result, _i, communities_1, org, _a, _b;
67626
+ return __generator(this, function (_c) {
67627
+ switch (_c.label) {
67523
67628
  case 0: return [4 /*yield*/, loadPreferences(store, user)];
67524
67629
  case 1:
67525
- preferencesFile = _a.sent();
67526
- if (preferencesFile) {
67527
- communities = store.each(user, ns.solid('community'), undefined, preferencesFile);
67528
- communityTypeIndexesPromise = communities.map(function (community) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
67529
- switch (_a.label) {
67530
- case 0: return [4 /*yield*/, loadTypeIndexesFor(store, community)];
67531
- case 1: return [2 /*return*/, _a.sent()];
67532
- }
67533
- }); }); });
67534
- result1 = Promise.all(communityTypeIndexesPromise);
67535
- // const result2 = Promise.all(result1)
67536
- // const flat = result2.flat()
67537
- return [2 /*return*/, result1
67538
- // const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
67539
- /*
67540
- let result = [] as TypeIndex[]
67541
- for(const community of communities) {
67542
- result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
67543
- }
67544
- */
67545
- // return communityTypeIndexesPromise.resolve()
67546
- ];
67547
- // const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
67548
- /*
67549
- let result = [] as TypeIndex[]
67550
- for(const community of communities) {
67551
- result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
67552
- }
67553
- */
67554
- // return communityTypeIndexesPromise.resolve()
67555
- }
67556
- return [2 /*return*/, []];
67630
+ preferencesFile = _c.sent();
67631
+ if (!preferencesFile) return [3 /*break*/, 6];
67632
+ communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
67633
+ result = [];
67634
+ _i = 0, communities_1 = communities;
67635
+ _c.label = 2;
67636
+ case 2:
67637
+ if (!(_i < communities_1.length)) return [3 /*break*/, 5];
67638
+ org = communities_1[_i];
67639
+ _b = (_a = result).concat;
67640
+ return [4 /*yield*/, loadTypeIndexesFor(store, org)];
67641
+ case 3:
67642
+ result = _b.apply(_a, [_c.sent()]);
67643
+ _c.label = 4;
67644
+ case 4:
67645
+ _i++;
67646
+ return [3 /*break*/, 2];
67647
+ case 5: return [2 /*return*/, result];
67648
+ case 6: return [2 /*return*/, []]; // No communities
67557
67649
  }
67558
67650
  });
67559
67651
  });
@@ -67574,11 +67666,159 @@ function loadAllTypeIndexes(store, user) {
67574
67666
  });
67575
67667
  }
67576
67668
  exports.loadAllTypeIndexes = loadAllTypeIndexes;
67669
+ // Utility: remove duplicates from Array of NamedNodes
67670
+ function uniqueNodes(arr) {
67671
+ var uris = arr.map(function (x) { return x.uri; });
67672
+ var set = new Set(uris);
67673
+ var uris2 = Array.from(set);
67674
+ var arr2 = uris2.map(function (u) { return new rdflib_1.NamedNode(u); });
67675
+ return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
67676
+ }
67677
+ exports.uniqueNodes = uniqueNodes;
67678
+ function getScopedAppsFromIndex(store, scope, theClass) {
67679
+ return __awaiter(this, void 0, void 0, function () {
67680
+ var index, registrations, relevant, directInstances, instances, instanceContainers, containers, i, cont, contents;
67681
+ return __generator(this, function (_a) {
67682
+ switch (_a.label) {
67683
+ case 0:
67684
+ index = scope.index;
67685
+ registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
67686
+ .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
67687
+ .map(function (st) { return st.subject; });
67688
+ relevant = theClass ? registrations.filter(function (reg) { return store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass); })
67689
+ : registrations;
67690
+ directInstances = relevant.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
67691
+ instances = uniqueNodes(directInstances);
67692
+ instanceContainers = relevant.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
67693
+ containers = uniqueNodes(instanceContainers);
67694
+ if (containers.length > 0) {
67695
+ console.log('@@ getScopedAppsFromIndex containers ', containers);
67696
+ }
67697
+ i = 0;
67698
+ _a.label = 1;
67699
+ case 1:
67700
+ if (!(i < containers.length)) return [3 /*break*/, 4];
67701
+ cont = containers[i];
67702
+ return [4 /*yield*/, store.fetcher.load(cont)];
67703
+ case 2:
67704
+ _a.sent();
67705
+ contents = store.each(cont, ns.ldp('contains'), null, cont);
67706
+ instances = instances.concat(contents);
67707
+ _a.label = 3;
67708
+ case 3:
67709
+ i++;
67710
+ return [3 /*break*/, 1];
67711
+ case 4: return [2 /*return*/, instances.map(function (instance) { return { instance: instance, scope: scope }; })];
67712
+ }
67713
+ });
67714
+ });
67715
+ }
67716
+ exports.getScopedAppsFromIndex = getScopedAppsFromIndex;
67717
+ function getScopedAppInstances(store, klass, user) {
67718
+ return __awaiter(this, void 0, void 0, function () {
67719
+ var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
67720
+ return __generator(this, function (_a) {
67721
+ switch (_a.label) {
67722
+ case 0: return [4 /*yield*/, loadAllTypeIndexes(store, user)];
67723
+ case 1:
67724
+ scopes = _a.sent();
67725
+ scopedApps = [];
67726
+ _i = 0, scopes_1 = scopes;
67727
+ _a.label = 2;
67728
+ case 2:
67729
+ if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
67730
+ scope = scopes_1[_i];
67731
+ return [4 /*yield*/, getScopedAppsFromIndex(store, scope, klass)];
67732
+ case 3:
67733
+ scopedApps0 = _a.sent();
67734
+ scopedApps = scopedApps.concat(scopedApps0);
67735
+ _a.label = 4;
67736
+ case 4:
67737
+ _i++;
67738
+ return [3 /*break*/, 2];
67739
+ case 5: return [2 /*return*/, scopedApps];
67740
+ }
67741
+ });
67742
+ });
67743
+ }
67744
+ exports.getScopedAppInstances = getScopedAppInstances;
67745
+ // This is the function signature which used to be in solid-ui/logic
67746
+ // Recommended to use getScopedAppInstances instead as it provides more information.
67747
+ //
67748
+ function getAppInstances(store, klass) {
67749
+ return __awaiter(this, void 0, void 0, function () {
67750
+ var user, scopedAppInstances;
67751
+ return __generator(this, function (_a) {
67752
+ switch (_a.label) {
67753
+ case 0:
67754
+ user = currentUser();
67755
+ if (!user)
67756
+ throw new Error('getAppInstances: Must be logged in to find apps.');
67757
+ return [4 /*yield*/, getScopedAppInstances(store, klass, user)];
67758
+ case 1:
67759
+ scopedAppInstances = _a.sent();
67760
+ return [2 /*return*/, scopedAppInstances.map(function (scoped) { return scoped.instance; })];
67761
+ }
67762
+ });
67763
+ });
67764
+ }
67765
+ exports.getAppInstances = getAppInstances;
67577
67766
  /*
67578
- export async function getAppInstances (store:LiveStore, klass: NamedNode) {
67579
-
67767
+ * Register a new app in a type index
67768
+ * used in chat in bookmark.js (solid-ui)
67769
+ * Returns the registration object if successful else null
67770
+ */
67771
+ function registerInstanceInTypeIndex(store, instance, index, theClass) {
67772
+ return __awaiter(this, void 0, void 0, function () {
67773
+ var registration, ins, err_8, msg;
67774
+ return __generator(this, function (_a) {
67775
+ switch (_a.label) {
67776
+ case 0:
67777
+ registration = (0, uri_1.newThing)(index);
67778
+ ins = [
67779
+ // See https://github.com/solid/solid/blob/main/proposals/data-discovery.md
67780
+ (0, rdflib_1.st)(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),
67781
+ (0, rdflib_1.st)(registration, ns.solid('forClass'), theClass, index),
67782
+ (0, rdflib_1.st)(registration, ns.solid('instance'), instance, index)
67783
+ ];
67784
+ _a.label = 1;
67785
+ case 1:
67786
+ _a.trys.push([1, 3, , 4]);
67787
+ return [4 /*yield*/, store.updater.update([], ins)];
67788
+ case 2:
67789
+ _a.sent();
67790
+ return [3 /*break*/, 4];
67791
+ case 3:
67792
+ err_8 = _a.sent();
67793
+ msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_8);
67794
+ console.warn(msg);
67795
+ return [2 /*return*/, null];
67796
+ case 4: return [2 /*return*/, registration];
67797
+ }
67798
+ });
67799
+ });
67580
67800
  }
67581
- */
67801
+ exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
67802
+ function deleteTypeIndexRegistration(store, item) {
67803
+ return __awaiter(this, void 0, void 0, function () {
67804
+ var reg, statements;
67805
+ return __generator(this, function (_a) {
67806
+ switch (_a.label) {
67807
+ case 0:
67808
+ reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index);
67809
+ if (!reg)
67810
+ throw new Error("deleteTypeIndexRegistration: No registration found for ".concat(item.instance));
67811
+ statements = store.statementsMatching(reg, null, null, item.scope.index);
67812
+ return [4 /*yield*/, store.updater.update(statements, [])];
67813
+ case 1:
67814
+ _a.sent();
67815
+ return [2 /*return*/];
67816
+ }
67817
+ });
67818
+ });
67819
+ }
67820
+ exports.deleteTypeIndexRegistration = deleteTypeIndexRegistration;
67821
+ // ENDS
67582
67822
  //# sourceMappingURL=discoveryLogic.js.map
67583
67823
 
67584
67824
  /***/ }),
@@ -67592,7 +67832,7 @@ export async function getAppInstances (store:LiveStore, klass: NamedNode) {
67592
67832
  "use strict";
67593
67833
 
67594
67834
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67595
- exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
67835
+ exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.uniqueNodes = exports.suggestPublicTypeIndex = exports.suggestPrivateTypeIndex = exports.suggestPreferencesFile = exports.registerInstanceInTypeIndex = exports.loadTypeIndexesFor = exports.loadProfile = exports.loadPreferences = exports.loadOrCreateIfNotExists = exports.loadCommunityTypeIndexes = exports.loadAllTypeIndexes = exports.getScopedAppsFromIndex = exports.getScopedAppInstances = exports.getAppInstances = exports.followOrCreateLink = exports.deleteTypeIndexRegistration = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
67596
67836
  // Make these variables directly accessible as it is what you need most of the time
67597
67837
  // This also makes these variable globaly accesible in mashlib
67598
67838
  var solidLogicSingleton_1 = __webpack_require__(/*! ./logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
@@ -67614,12 +67854,25 @@ Object.defineProperty(exports, "ensureTypeIndexes", ({ enumerable: true, get: fu
67614
67854
  Object.defineProperty(exports, "loadTypeIndexes", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } }));
67615
67855
  Object.defineProperty(exports, "registerInTypeIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } }));
67616
67856
  Object.defineProperty(exports, "loadIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } }));
67857
+ // Generate by
67858
+ // grep export src/discovery/discoveryLogic.ts | sed -e 's/export //g' | sed -e 's/async //g'| sed -e 's/function //g' | sed -e 's/ .*/,/g' | sort
67617
67859
  var discoveryLogic_1 = __webpack_require__(/*! ./discovery/discoveryLogic */ "./node_modules/solid-logic/lib/discovery/discoveryLogic.js");
67618
- Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
67860
+ Object.defineProperty(exports, "deleteTypeIndexRegistration", ({ enumerable: true, get: function () { return discoveryLogic_1.deleteTypeIndexRegistration; } }));
67861
+ Object.defineProperty(exports, "followOrCreateLink", ({ enumerable: true, get: function () { return discoveryLogic_1.followOrCreateLink; } }));
67862
+ Object.defineProperty(exports, "getAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getAppInstances; } }));
67863
+ Object.defineProperty(exports, "getScopedAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppInstances; } }));
67864
+ Object.defineProperty(exports, "getScopedAppsFromIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppsFromIndex; } }));
67865
+ Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67866
+ Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
67867
+ Object.defineProperty(exports, "loadOrCreateIfNotExists", ({ enumerable: true, get: function () { return discoveryLogic_1.loadOrCreateIfNotExists; } }));
67619
67868
  Object.defineProperty(exports, "loadPreferences", ({ enumerable: true, get: function () { return discoveryLogic_1.loadPreferences; } }));
67869
+ Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
67620
67870
  Object.defineProperty(exports, "loadTypeIndexesFor", ({ enumerable: true, get: function () { return discoveryLogic_1.loadTypeIndexesFor; } }));
67621
- Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
67622
- Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67871
+ Object.defineProperty(exports, "registerInstanceInTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.registerInstanceInTypeIndex; } }));
67872
+ Object.defineProperty(exports, "suggestPreferencesFile", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPreferencesFile; } }));
67873
+ Object.defineProperty(exports, "suggestPrivateTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPrivateTypeIndex; } }));
67874
+ Object.defineProperty(exports, "suggestPublicTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPublicTypeIndex; } }));
67875
+ Object.defineProperty(exports, "uniqueNodes", ({ enumerable: true, get: function () { return discoveryLogic_1.uniqueNodes; } }));
67623
67876
  var SolidLogic_1 = __webpack_require__(/*! ./logic/SolidLogic */ "./node_modules/solid-logic/lib/logic/SolidLogic.js");
67624
67877
  Object.defineProperty(exports, "SolidLogic", ({ enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } }));
67625
67878
  var authUtil_1 = __webpack_require__(/*! ./authn/authUtil */ "./node_modules/solid-logic/lib/authn/authUtil.js");
@@ -78108,9 +78361,8 @@ class LocalJWKSet {
78108
78361
  }
78109
78362
  async getKey(protectedHeader, token) {
78110
78363
  const { alg, kid } = { ...protectedHeader, ...token.header };
78111
- const kty = getKtyFromAlg(alg);
78112
78364
  const candidates = this._jwks.keys.filter((jwk) => {
78113
- let candidate = kty === jwk.kty;
78365
+ let candidate = jwk.kty === getKtyFromAlg(alg);
78114
78366
  if (candidate && typeof kid === 'string') {
78115
78367
  candidate = kid === jwk.kid;
78116
78368
  }
@@ -79327,15 +79579,21 @@ function lengthAndInput(input) {
79327
79579
  }
79328
79580
  async function concatKdf(secret, bits, value) {
79329
79581
  const iterations = Math.ceil((bits >> 3) / 32);
79330
- const res = new Uint8Array(iterations * 32);
79331
- for (let iter = 0; iter < iterations; iter++) {
79582
+ let res;
79583
+ for (let iter = 1; iter <= iterations; iter++) {
79332
79584
  const buf = new Uint8Array(4 + secret.length + value.length);
79333
- buf.set(uint32be(iter + 1));
79585
+ buf.set(uint32be(iter));
79334
79586
  buf.set(secret, 4);
79335
79587
  buf.set(value, 4 + secret.length);
79336
- res.set(await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf), iter * 32);
79588
+ if (!res) {
79589
+ res = await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf);
79590
+ }
79591
+ else {
79592
+ res = concat(res, await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf));
79593
+ }
79337
79594
  }
79338
- return res.slice(0, bits >> 3);
79595
+ res = res.slice(0, bits >> 3);
79596
+ return res;
79339
79597
  }
79340
79598
 
79341
79599
 
@@ -80550,12 +80808,9 @@ const encode = (input) => {
80550
80808
  return encodeBase64(input).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
80551
80809
  };
80552
80810
  const decodeBase64 = (encoded) => {
80553
- const binary = atob(encoded);
80554
- const bytes = new Uint8Array(binary.length);
80555
- for (let i = 0; i < binary.length; i++) {
80556
- bytes[i] = binary.charCodeAt(i);
80557
- }
80558
- return bytes;
80811
+ return new Uint8Array(atob(encoded)
80812
+ .split('')
80813
+ .map((c) => c.charCodeAt(0)));
80559
80814
  };
80560
80815
  const decode = (input) => {
80561
80816
  let encoded = input;