solid-ui 2.4.22-dc79c0e3 → 2.4.22-e594bdfb

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,14 +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
7994
+ * Returns promise of context with arrays of symbols
7995
+ *
7996
+ * leaving the `isPublic` param undefined will bring in community index things, too
7997
+ */
7998
+
7999
+ /**
8000
+ * @deprecated Since version 2.4.17 Will be deleted in version 3.0. Use solid-logic getAppInstances instead.
8015
8001
  */
8016
8002
 
8017
8003
 
@@ -8076,210 +8062,141 @@ function _ensureLoadedProfile() {
8076
8062
  return _ensureLoadedProfile.apply(this, arguments);
8077
8063
  }
8078
8064
 
8079
- function findAppInstances(_x4, _x5, _x6) {
8065
+ function findAppInstances(_x3, _x4, _x5) {
8080
8066
  return _findAppInstances.apply(this, arguments);
8081
8067
  }
8082
- /**
8083
- * UI to control registration of instance
8084
- */
8085
-
8086
8068
 
8087
8069
  function _findAppInstances() {
8088
8070
  _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;
8071
+ var items;
8090
8072
  return _regenerator["default"].wrap(function _callee6$(_context6) {
8091
8073
  while (1) {
8092
8074
  switch (_context6.prev = _context6.next) {
8093
8075
  case 0:
8094
- unique = function _unique(arr) {
8095
- return Array.from(new Set(arr));
8096
- };
8076
+ debug.warn('Calling deprecated function findAppInstances! Use solid-logic getAppInstances instead.');
8097
8077
 
8098
- if (!(isPublic === undefined)) {
8078
+ if (!context.me) {
8099
8079
  _context6.next = 7;
8100
8080
  break;
8101
8081
  }
8102
8082
 
8103
8083
  _context6.next = 4;
8104
- return findAppInstances(context, theClass, true);
8084
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
8105
8085
 
8106
8086
  case 4:
8107
- _context6.next = 6;
8108
- return findAppInstances(context, theClass, false);
8109
-
8110
- case 6:
8111
- return _context6.abrupt("return", context);
8112
-
8113
- 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));
8126
-
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;
8087
+ _context6.t0 = _context6.sent;
8088
+ _context6.next = 8;
8136
8089
  break;
8137
8090
 
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)
8091
+ case 7:
8092
+ _context6.t0 = [];
8190
8093
 
8191
- case 45:
8192
- i = 0;
8094
+ case 8:
8095
+ items = _context6.t0;
8193
8096
 
8194
- case 46:
8195
- if (!(i < containers.length)) {
8196
- _context6.next = 56;
8197
- break;
8097
+ if (isPublic === true) {
8098
+ // old API - not recommended!
8099
+ items = items.filter(function (item) {
8100
+ return item.scope.label === 'public';
8101
+ });
8102
+ } else if (isPublic === false) {
8103
+ items = items.filter(function (item) {
8104
+ return item.scope.label === 'private';
8105
+ });
8198
8106
  }
8199
8107
 
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);
8108
+ context.instances = items.map(function (item) {
8109
+ return item.instance;
8208
8110
  });
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
8111
  return _context6.abrupt("return", context);
8218
8112
 
8219
- case 57:
8113
+ case 12:
8220
8114
  case "end":
8221
8115
  return _context6.stop();
8222
8116
  }
8223
8117
  }
8224
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
8118
+ }, _callee6);
8225
8119
  }));
8226
8120
  return _findAppInstances.apply(this, arguments);
8227
8121
  }
8228
8122
 
8229
- function registrationControl(_x7, _x8, _x9) {
8230
- return _registrationControl.apply(this, arguments);
8123
+ function scopeLabel(context, scope) {
8124
+ var mine = context.me && context.me.sameTerm(scope.agent);
8125
+ var name = mine ? '' : utils.label(scope.agent) + ' ';
8126
+ return "".concat(name).concat(scope.label);
8231
8127
  }
8232
8128
  /**
8233
- * UI to List at all registered things
8129
+ * UI to control registration of instance
8234
8130
  */
8235
8131
 
8236
8132
 
8133
+ function registrationControl(_x6, _x7, _x8) {
8134
+ return _registrationControl.apply(this, arguments);
8135
+ }
8136
+
8237
8137
  function _registrationControl() {
8238
8138
  _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;
8139
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
8240
8140
 
8241
8141
  return _regenerator["default"].wrap(function _callee7$(_context7) {
8242
8142
  while (1) {
8243
8143
  switch (_context7.prev = _context7.next) {
8244
8144
  case 0:
8145
+ renderScopeCheckbox = function _renderScopeCheckbox(scope) {
8146
+ var statements = registrationStatements(scope.index);
8147
+ var name = scopeLabel(context, scope);
8148
+ var label = "".concat(name, " link to this ").concat(context.noun);
8149
+ return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
8150
+ };
8151
+
8152
+ registrationStatements = function _registrationStatemen(index) {
8153
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8154
+
8155
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8156
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8157
+ };
8158
+
8159
+ /// / body of registrationControl
8245
8160
  dom = context.dom;
8246
8161
 
8247
8162
  if (!(!dom || !context.div)) {
8248
- _context7.next = 3;
8163
+ _context7.next = 5;
8249
8164
  break;
8250
8165
  }
8251
8166
 
8252
- return _context7.abrupt("return", context);
8167
+ throw new Error('registrationControl: need dom and div');
8253
8168
 
8254
- case 3:
8169
+ case 5:
8255
8170
  box = dom.createElement('div');
8256
8171
  context.div.appendChild(box);
8257
8172
  context.me = _solidLogic.authn.currentUser(); // @@
8258
8173
 
8259
- if (context.me) {
8260
- _context7.next = 9;
8174
+ me = context.me;
8175
+
8176
+ if (me) {
8177
+ _context7.next = 12;
8261
8178
  break;
8262
8179
  }
8263
8180
 
8264
8181
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
8265
8182
  return _context7.abrupt("return", context);
8266
8183
 
8267
- case 9:
8268
- _context7.prev = 9;
8269
- _context7.next = 12;
8270
- return (0, _solidLogic.ensureTypeIndexes)(context);
8271
-
8272
8184
  case 12:
8273
- context2 = _context7.sent;
8274
- _context7.next = 19;
8275
- break;
8185
+ _context7.prev = 12;
8186
+ _context7.next = 15;
8187
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
8276
8188
 
8277
8189
  case 15:
8278
- _context7.prev = 15;
8279
- _context7.t0 = _context7["catch"](9);
8190
+ scopes = _context7.sent;
8191
+ _context7.next = 23;
8192
+ break;
8193
+
8194
+ case 18:
8195
+ _context7.prev = 18;
8196
+ _context7.t0 = _context7["catch"](12);
8280
8197
 
8281
8198
  if (context.div && context.preferencesFileError) {
8282
- msg = '(Preferences not available)';
8199
+ msg = '(Lists of stuff not available)';
8283
8200
  context.div.appendChild(dom.createElement('p')).textContent = msg;
8284
8201
  } else if (context.div) {
8285
8202
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -8287,168 +8204,201 @@ function _registrationControl() {
8287
8204
  }
8288
8205
 
8289
8206
  debug.log(msg);
8207
+ return _context7.abrupt("return", context);
8290
8208
 
8291
- case 19:
8292
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
8209
+ case 23:
8210
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8293
8211
 
8294
8212
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
8295
8213
  tbody = box.children[0].children[0];
8296
8214
  form = new _rdflib.BlankNode(); // @@ say for now
8297
8215
 
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
- };
8216
+ _iterator = _createForOfIteratorHelper(scopes);
8304
8217
 
8305
8218
  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));
8219
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8220
+ scope = _step.value;
8221
+ row = tbody.appendChild(dom.createElement('tr'));
8222
+ row.appendChild(renderScopeCheckbox(scope)); // @@ index
8310
8223
  }
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));
8322
- }
8323
-
8324
- debug.log(_msg);
8224
+ } catch (err) {
8225
+ _iterator.e(err);
8226
+ } finally {
8227
+ _iterator.f();
8325
8228
  }
8326
8229
 
8327
- return _context7.abrupt("return", context2);
8230
+ return _context7.abrupt("return", context);
8328
8231
 
8329
- case 26:
8232
+ case 30:
8330
8233
  case "end":
8331
8234
  return _context7.stop();
8332
8235
  }
8333
8236
  }
8334
- }, _callee7, null, [[9, 15]]);
8237
+ }, _callee7, null, [[12, 18]]);
8335
8238
  }));
8336
8239
  return _registrationControl.apply(this, arguments);
8337
8240
  }
8338
8241
 
8339
- function registrationList(_x10, _x11) {
8242
+ function renderScopeHeadingRow(context, store, scope) {
8243
+ var backgroundColor = {
8244
+ "private": '#fee',
8245
+ "public": '#efe'
8246
+ };
8247
+ var dom = context.dom;
8248
+ var name = scopeLabel(context, scope);
8249
+ var row = dom.createElement('tr');
8250
+ var cell = row.appendChild(dom.createElement('td'));
8251
+ cell.setAttribute('colspan', '3');
8252
+ cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
8253
+ var header = cell.appendChild(dom.createElement('h3'));
8254
+ header.textContent = name + ' links';
8255
+ header.style.textAlign = 'left';
8256
+ return row;
8257
+ }
8258
+ /**
8259
+ * UI to List at all registered things
8260
+ */
8261
+
8262
+
8263
+ function registrationList(_x9, _x10) {
8340
8264
  return _registrationList.apply(this, arguments);
8341
- }
8265
+ } // registrationList
8266
+
8342
8267
 
8343
8268
  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) {
8269
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
8270
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
8271
+
8272
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
8347
8273
  while (1) {
8348
- switch (_context8.prev = _context8.next) {
8274
+ switch (_context9.prev = _context9.next) {
8349
8275
  case 0:
8350
- dom = context0.dom;
8351
- div = context0.div;
8276
+ dom = context.dom;
8277
+ div = context.div;
8352
8278
  box = dom.createElement('div');
8353
8279
  div.appendChild(box);
8354
- context0.me = _solidLogic.authn.currentUser(); // @@
8280
+ context.me = _solidLogic.authn.currentUser(); // @@
8355
8281
 
8356
- if (context0.me) {
8357
- _context8.next = 8;
8282
+ if (context.me) {
8283
+ _context9.next = 8;
8358
8284
  break;
8359
8285
  }
8360
8286
 
8361
8287
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
8362
- return _context8.abrupt("return", context0);
8288
+ return _context9.abrupt("return", context);
8363
8289
 
8364
8290
  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
- });
8291
+ _context9.next = 10;
8292
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
8380
8293
 
8381
- var _loop = function _loop(i) {
8382
- var statement = sts[i];
8294
+ case 10:
8295
+ scopes = _context9.sent;
8296
+ // includes community indexes
8297
+ // console.log('@@ registrationList ', scopes)
8298
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8383
8299
 
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
8300
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8301
+ table = box.firstChild;
8302
+ tbody = table.firstChild;
8303
+ _iterator2 = _createForOfIteratorHelper(scopes);
8304
+ _context9.prev = 16;
8390
8305
 
8306
+ _iterator2.s();
8391
8307
 
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');
8308
+ case 18:
8309
+ if ((_step2 = _iterator2.n()).done) {
8310
+ _context9.next = 30;
8311
+ break;
8312
+ }
8313
+
8314
+ scope = _step2.value;
8315
+ // need some predicate for listing/adding agents
8316
+ headingRow = renderScopeHeadingRow(context, store, scope);
8317
+ tbody.appendChild(headingRow);
8318
+ _context9.next = 24;
8319
+ return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
8320
+
8321
+ case 24:
8322
+ items = _context9.sent;
8323
+ // any class
8324
+ if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
8325
+
8326
+ _iterator3 = _createForOfIteratorHelper(items);
8327
+
8328
+ try {
8329
+ _loop = function _loop() {
8330
+ var item = _step3.value;
8331
+ var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
8332
+ deleteFunction: function () {
8333
+ var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
8334
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
8335
+ while (1) {
8336
+ switch (_context8.prev = _context8.next) {
8337
+ case 0:
8338
+ _context8.next = 2;
8339
+ return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
8340
+
8341
+ case 2:
8342
+ tbody.removeChild(row);
8343
+
8344
+ case 3:
8345
+ case "end":
8346
+ return _context8.stop();
8347
+ }
8348
+ }
8349
+ }, _callee8);
8350
+ }));
8351
+
8352
+ function deleteFunction() {
8353
+ return _deleteFunction.apply(this, arguments);
8398
8354
  }
8399
8355
 
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
- }));
8356
+ return deleteFunction;
8357
+ }()
8358
+ });
8359
+ row.children[0].style.paddingLeft = '3em';
8360
+ tbody.appendChild(row);
8409
8361
  };
8410
8362
 
8411
- for (var i = 0; i < sts.length; i++) {
8412
- var _ret = _loop(i);
8363
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
8364
+ _loop();
8365
+ }
8366
+ } catch (err) {
8367
+ _iterator3.e(err);
8368
+ } finally {
8369
+ _iterator3.f();
8370
+ }
8413
8371
 
8414
- if (_ret === "continue") continue;
8415
- } // registrationList
8372
+ case 28:
8373
+ _context9.next = 18;
8374
+ break;
8416
8375
 
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
- */
8376
+ case 30:
8377
+ _context9.next = 35;
8378
+ break;
8428
8379
 
8380
+ case 32:
8381
+ _context9.prev = 32;
8382
+ _context9.t0 = _context9["catch"](16);
8429
8383
 
8430
- // registrationList
8384
+ _iterator2.e(_context9.t0);
8431
8385
 
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
- }));
8386
+ case 35:
8387
+ _context9.prev = 35;
8445
8388
 
8446
- case 9:
8389
+ _iterator2.f();
8390
+
8391
+ return _context9.finish(35);
8392
+
8393
+ case 38:
8394
+ return _context9.abrupt("return", context);
8395
+
8396
+ case 39:
8447
8397
  case "end":
8448
- return _context8.stop();
8398
+ return _context9.stop();
8449
8399
  }
8450
8400
  }
8451
- }, _callee8);
8401
+ }, _callee9, null, [[16, 32, 35, 38]]);
8452
8402
  }));
8453
8403
  return _registrationList.apply(this, arguments);
8454
8404
  }
@@ -8605,7 +8555,7 @@ function renderSignInPopup(dom) {
8605
8555
  }, _callee, null, [[0, 8]]);
8606
8556
  }));
8607
8557
 
8608
- return function loginToIssuer(_x12) {
8558
+ return function loginToIssuer(_x11) {
8609
8559
  return _ref.apply(this, arguments);
8610
8560
  };
8611
8561
  }();
@@ -8892,7 +8842,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
8892
8842
 
8893
8843
  function displayOptions(context) {
8894
8844
  // console.log('displayOptions!', context)
8895
- function makeNewWorkspace(_x13) {
8845
+ function makeNewWorkspace(_x12) {
8896
8846
  return _makeNewWorkspace.apply(this, arguments);
8897
8847
  } // const status = ''
8898
8848
 
@@ -9161,77 +9111,77 @@ function getUserRoles() {
9161
9111
 
9162
9112
 
9163
9113
  function _getUserRoles() {
9164
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
9114
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
9165
9115
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
9166
9116
 
9167
- return _regenerator["default"].wrap(function _callee9$(_context9) {
9117
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
9168
9118
  while (1) {
9169
- switch (_context9.prev = _context9.next) {
9119
+ switch (_context10.prev = _context10.next) {
9170
9120
  case 0:
9171
- _context9.prev = 0;
9172
- _context9.next = 3;
9121
+ _context10.prev = 0;
9122
+ _context10.next = 3;
9173
9123
  return ensureLoadedPreferences({});
9174
9124
 
9175
9125
  case 3:
9176
- _yield$ensureLoadedPr = _context9.sent;
9126
+ _yield$ensureLoadedPr = _context10.sent;
9177
9127
  me = _yield$ensureLoadedPr.me;
9178
9128
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
9179
9129
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
9180
9130
 
9181
9131
  if (!(!preferencesFile || preferencesFileError)) {
9182
- _context9.next = 9;
9132
+ _context10.next = 9;
9183
9133
  break;
9184
9134
  }
9185
9135
 
9186
9136
  throw new Error(preferencesFileError);
9187
9137
 
9188
9138
  case 9:
9189
- return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9139
+ return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9190
9140
 
9191
9141
  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);
9142
+ _context10.prev = 12;
9143
+ _context10.t0 = _context10["catch"](0);
9144
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
9195
9145
 
9196
9146
  case 15:
9197
- return _context9.abrupt("return", []);
9147
+ return _context10.abrupt("return", []);
9198
9148
 
9199
9149
  case 16:
9200
9150
  case "end":
9201
- return _context9.stop();
9151
+ return _context10.stop();
9202
9152
  }
9203
9153
  }
9204
- }, _callee9, null, [[0, 12]]);
9154
+ }, _callee10, null, [[0, 12]]);
9205
9155
  }));
9206
9156
  return _getUserRoles.apply(this, arguments);
9207
9157
  }
9208
9158
 
9209
- function filterAvailablePanes(_x14) {
9159
+ function filterAvailablePanes(_x13) {
9210
9160
  return _filterAvailablePanes.apply(this, arguments);
9211
9161
  }
9212
9162
 
9213
9163
  function _filterAvailablePanes() {
9214
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
9164
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
9215
9165
  var userRoles;
9216
- return _regenerator["default"].wrap(function _callee10$(_context10) {
9166
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
9217
9167
  while (1) {
9218
- switch (_context10.prev = _context10.next) {
9168
+ switch (_context11.prev = _context11.next) {
9219
9169
  case 0:
9220
- _context10.next = 2;
9170
+ _context11.next = 2;
9221
9171
  return getUserRoles();
9222
9172
 
9223
9173
  case 2:
9224
- userRoles = _context10.sent;
9225
- return _context10.abrupt("return", panes.filter(function (pane) {
9174
+ userRoles = _context11.sent;
9175
+ return _context11.abrupt("return", panes.filter(function (pane) {
9226
9176
  return isMatchingAudience(pane, userRoles);
9227
9177
  }));
9228
9178
 
9229
9179
  case 4:
9230
9180
  case "end":
9231
- return _context10.stop();
9181
+ return _context11.stop();
9232
9182
  }
9233
9183
  }
9234
- }, _callee10);
9184
+ }, _callee11);
9235
9185
  }));
9236
9186
  return _filterAvailablePanes.apply(this, arguments);
9237
9187
  }
@@ -15282,8 +15232,8 @@ Object.defineProperty(exports, "__esModule", ({
15282
15232
  }));
15283
15233
  exports.versionInfo = void 0;
15284
15234
  var versionInfo = {
15285
- buildTime: '2022-05-25T21:53:40Z',
15286
- commit: 'dc79c0e3372c8084fe393d058672af8389e9559a',
15235
+ buildTime: '2022-06-14T10:02:44Z',
15236
+ commit: 'e594bdfbbf66562870e6d50cfa5a1e6aaa098b65',
15287
15237
  npmInfo: {
15288
15238
  'solid-ui': '2.4.22',
15289
15239
  npm: '6.14.17',
@@ -15295,8 +15245,8 @@ var versionInfo = {
15295
15245
  modules: '83',
15296
15246
  napi: '8',
15297
15247
  nghttp2: '1.42.0',
15298
- node: '14.19.2',
15299
- openssl: '1.1.1n',
15248
+ node: '14.19.3',
15249
+ openssl: '1.1.1o',
15300
15250
  tz: '2021a3',
15301
15251
  unicode: '14.0',
15302
15252
  uv: '1.42.0',
@@ -17139,7 +17089,7 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
17139
17089
  /*!******************************!*\
17140
17090
  !*** ./lib/widgets/error.js ***!
17141
17091
  \******************************/
17142
- /***/ ((__unused_webpack_module, exports) => {
17092
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
17143
17093
 
17144
17094
  "use strict";
17145
17095
 
@@ -17149,6 +17099,8 @@ Object.defineProperty(exports, "__esModule", ({
17149
17099
  }));
17150
17100
  exports.errorMessageBlock = errorMessageBlock;
17151
17101
 
17102
+ var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
17103
+
17152
17104
  /**
17153
17105
  * Create an error message block
17154
17106
  * @param dom The DOM on which dom.createElement will be called
@@ -17179,6 +17131,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
17179
17131
  div.textContent = err;
17180
17132
  }
17181
17133
 
17134
+ div.appendChild((0, _widgets.cancelButton)(dom, function () {
17135
+ if (div.parentNode) div.parentNode.removeChild(div);
17136
+ })).style = 'width: 2em; height: 2em; align: right;';
17182
17137
  div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
17183
17138
  return div;
17184
17139
  }
@@ -17217,6 +17172,12 @@ Object.defineProperty(exports, "field", ({
17217
17172
  return _fieldFunction.field;
17218
17173
  }
17219
17174
  }));
17175
+ Object.defineProperty(exports, "fieldFunction", ({
17176
+ enumerable: true,
17177
+ get: function get() {
17178
+ return _fieldFunction.fieldFunction;
17179
+ }
17180
+ }));
17220
17181
  Object.defineProperty(exports, "fieldLabel", ({
17221
17182
  enumerable: true,
17222
17183
  get: function get() {
@@ -17242,6 +17203,12 @@ exports.makeSelectForCategory = makeSelectForCategory;
17242
17203
  exports.makeSelectForChoice = makeSelectForChoice;
17243
17204
  exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
17244
17205
  exports.makeSelectForOptions = makeSelectForOptions;
17206
+ Object.defineProperty(exports, "mostSpecificClassURI", ({
17207
+ enumerable: true,
17208
+ get: function get() {
17209
+ return _fieldFunction.mostSpecificClassURI;
17210
+ }
17211
+ }));
17245
17212
  exports.newButton = newButton;
17246
17213
  exports.newThing = newThing;
17247
17214
  exports.promptForNew = promptForNew;
@@ -18262,8 +18229,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18262
18229
  }
18263
18230
 
18264
18231
  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?
18232
+ // const follow = kb.anyJS(form, ui('follow'), null, formDoc) // data doc moves to new subject?
18267
18233
 
18268
18234
  var opts = {
18269
18235
  form: form,
@@ -18326,14 +18292,14 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18326
18292
 
18327
18293
  var multiSelect = kb.any(form, ui('multiselect')); // Optional
18328
18294
 
18329
- var selector; // from ui:property
18330
-
18331
- var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18332
- return object.value;
18333
- });
18295
+ var selector;
18334
18296
 
18335
18297
  rhs.refresh = function () {
18336
- // from ui:from + ui:property
18298
+ // from ui:property
18299
+ var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18300
+ return object.value;
18301
+ }); // from ui:from + ui:property
18302
+
18337
18303
  var possibleOptions = getSelectorOptions();
18338
18304
  possibleOptions.push(selectedOptions);
18339
18305
  possibleOptions = sortByLabel(possibleOptions);
@@ -19124,7 +19090,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19124
19090
 
19125
19091
  log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
19126
19092
 
19127
- function determineFitstSelectOptionText() {
19093
+ function createDefaultSelectOptionText() {
19128
19094
  var firstSelectOptionText = '--- choice ---';
19129
19095
 
19130
19096
  if (predicate && !(predicate.termType === 'BlankNode')) {
@@ -19138,9 +19104,9 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19138
19104
  return firstSelectOptionText;
19139
19105
  }
19140
19106
 
19141
- function determinFirstSelectOption() {
19107
+ function createDefaultSelectOption() {
19142
19108
  var option = dom.createElement('option');
19143
- option.appendChild(dom.createTextNode(determineFitstSelectOptionText()));
19109
+ option.appendChild(dom.createTextNode(createDefaultSelectOptionText()));
19144
19110
  option.disabled = true;
19145
19111
  option.value = true;
19146
19112
  option.hidden = true;
@@ -19170,7 +19136,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19170
19136
  select.insertBefore(mint, select.firstChild);
19171
19137
  }
19172
19138
 
19173
- if (select.children.length === 0) select.insertBefore(determinFirstSelectOption(), select.firstChild);
19139
+ if (select.children.length === 0) select.insertBefore(createDefaultSelectOption(), select.firstChild);
19174
19140
 
19175
19141
  select.update = function (newSelectedOptions) {
19176
19142
  selectedOptions = newSelectedOptions;
@@ -19179,7 +19145,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19179
19145
 
19180
19146
  var removeValue = function removeValue(t) {
19181
19147
  if (kb.holds(subject, predicate, t, dataDoc)) {
19182
- ds.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value removed " + t)
19148
+ ds.push($rdf.st(subject, predicate, t, dataDoc));
19183
19149
  }
19184
19150
  };
19185
19151
 
@@ -19276,13 +19242,13 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19276
19242
  select.currentURI = opt.AJAR_uri;
19277
19243
  }
19278
19244
 
19279
- if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'false');
19245
+ if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.removeAttribute('selected');
19280
19246
  if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
19281
19247
  }
19282
19248
 
19283
19249
  log.info('selectForOptions: data doc = ' + dataDoc);
19284
19250
 
19285
- if (select.currentURI) {
19251
+ if (select.currentURI && options.subForm) {
19286
19252
  addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
19287
19253
  if (ok) {
19288
19254
  kb.updater.update([], is, function (uri, success, errorBody) {
@@ -19323,8 +19289,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
19323
19289
 
19324
19290
  option.AJAR_uri = uri;
19325
19291
 
19326
- if (c.value === '' + select.currentURI || containsObject(c.value, selectedOptions)) {
19327
- option.selected = true;
19292
+ if (containsObject(c.value, selectedOptions)) {
19328
19293
  option.setAttribute('selected', 'true');
19329
19294
  }
19330
19295
 
@@ -26957,31 +26922,6 @@ function freeze(object, oc) {
26957
26922
  return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
26958
26923
  }
26959
26924
 
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
26925
  /**
26986
26926
  * All mime types that are allowed as input to `DOMParser.parseFromString`
26987
26927
  *
@@ -27099,7 +27039,6 @@ var NAMESPACE = freeze({
27099
27039
  XMLNS: 'http://www.w3.org/2000/xmlns/',
27100
27040
  })
27101
27041
 
27102
- exports.assign = assign;
27103
27042
  exports.freeze = freeze;
27104
27043
  exports.MIME_TYPE = MIME_TYPE;
27105
27044
  exports.NAMESPACE = NAMESPACE;
@@ -28634,10 +28573,9 @@ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
28634
28573
  * are serialized as their entity references, so they will be preserved.
28635
28574
  * (In contrast to whitespace literals in the input which are normalized to spaces)
28636
28575
  * @see https://www.w3.org/TR/xml11/#AVNormalize
28637
- * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
28638
28576
  */
28639
28577
  function addSerializedAttribute(buf, qualifiedName, value) {
28640
- buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"')
28578
+ buf.push(' ', qualifiedName, '="', value.replace(/[<&"\t\n\r]/g, _xmlEncoder), '"')
28641
28579
  }
28642
28580
 
28643
28581
  function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
@@ -28782,10 +28720,10 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
28782
28720
  * and does not include the CDATA-section-close delimiter, `]]>`.
28783
28721
  *
28784
28722
  * @see https://www.w3.org/TR/xml/#NT-CharData
28785
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
28786
28723
  */
28787
28724
  return buf.push(node.data
28788
- .replace(/[<&>]/g,_xmlEncoder)
28725
+ .replace(/[<&]/g,_xmlEncoder)
28726
+ .replace(/]]>/g, ']]&gt;')
28789
28727
  );
28790
28728
  case CDATA_SECTION_NODE:
28791
28729
  return buf.push( '<![CDATA[',node.data,']]>');
@@ -45814,8 +45752,8 @@ class N3Parser {
45814
45752
  _saveContext(type, graph, subject, predicate, object) {
45815
45753
  const n3Mode = this._n3Mode;
45816
45754
  this._contextStack.push({
45817
- subject: subject, predicate: predicate, object: object,
45818
- graph: graph, type: type,
45755
+ type,
45756
+ subject, predicate, object, graph,
45819
45757
  inverse: n3Mode ? this._inversePredicate : false,
45820
45758
  blankPrefix: n3Mode ? this._prefixes._ : '',
45821
45759
  quantified: n3Mode ? this._quantified : null,
@@ -45834,14 +45772,20 @@ class N3Parser {
45834
45772
 
45835
45773
  // ### `_restoreContext` restores the parent context
45836
45774
  // when leaving a scope (list, blank node, formula)
45837
- _restoreContext() {
45838
- const context = this._contextStack.pop(), n3Mode = this._n3Mode;
45775
+ _restoreContext(type, token) {
45776
+ // Obtain the previous context
45777
+ const context = this._contextStack.pop();
45778
+ if (!context || context.type !== type)
45779
+ return this._error(`Unexpected ${token.type}`, token);
45780
+
45781
+ // Restore the quad of the previous context
45839
45782
  this._subject = context.subject;
45840
45783
  this._predicate = context.predicate;
45841
45784
  this._object = context.object;
45842
45785
  this._graph = context.graph;
45843
- // The settings below only apply to N3 streams
45844
- if (n3Mode) {
45786
+
45787
+ // Restore N3 context settings
45788
+ if (this._n3Mode) {
45845
45789
  this._inversePredicate = context.inverse;
45846
45790
  this._prefixes._ = context.blankPrefix;
45847
45791
  this._quantified = context.quantified;
@@ -46114,7 +46058,7 @@ class N3Parser {
46114
46058
 
46115
46059
  // Restore the parent context containing this blank node
46116
46060
  const empty = this._predicate === null;
46117
- this._restoreContext();
46061
+ this._restoreContext('blank', token);
46118
46062
  // If the blank node was the object, restore previous context and read punctuation
46119
46063
  if (this._object !== null)
46120
46064
  return this._getContextEndReader();
@@ -46165,7 +46109,7 @@ class N3Parser {
46165
46109
  break;
46166
46110
  case ')':
46167
46111
  // Closing the list; restore the parent context
46168
- this._restoreContext();
46112
+ this._restoreContext('list', token);
46169
46113
  // If this list is contained within a parent list, return the membership quad here.
46170
46114
  // This will be `<parent list element> rdf:first <this list>.`.
46171
46115
  if (stack.length !== 0 && stack[stack.length - 1].type === 'list')
@@ -46316,7 +46260,7 @@ class N3Parser {
46316
46260
  this._emit(this._subject, this._predicate, this._object, this._graph);
46317
46261
 
46318
46262
  // Restore the parent context containing this formula
46319
- this._restoreContext();
46263
+ this._restoreContext('formula', token);
46320
46264
  // If the formula was the subject, continue reading the predicate.
46321
46265
  // If the formula was the object, read punctuation.
46322
46266
  return this._object === null ? this._readPredicate : this._getContextEndReader();
@@ -46525,7 +46469,7 @@ class N3Parser {
46525
46469
  // The list item is the remaining subejct after reading the path
46526
46470
  const item = this._subject;
46527
46471
  // Switch back to the context of the list
46528
- this._restoreContext();
46472
+ this._restoreContext('item', token);
46529
46473
  // Output the list item
46530
46474
  this._emit(this._subject, this.RDF_FIRST, item, this._graph);
46531
46475
  }
@@ -46587,7 +46531,7 @@ class N3Parser {
46587
46531
  // Read the quad and restore the previous context
46588
46532
  const quad = this._quad(this._subject, this._predicate, this._object,
46589
46533
  this._graph || this.DEFAULTGRAPH);
46590
- this._restoreContext();
46534
+ this._restoreContext('<<', token);
46591
46535
  // If the triple was the subject, continue by reading the predicate.
46592
46536
  if (this._subject === null) {
46593
46537
  this._subject = quad;
@@ -66851,7 +66795,7 @@ var SolidAuthnLogic = /** @class */ (function () {
66851
66795
  if (app.viewingNoAuthPage) {
66852
66796
  return (0, rdflib_1.sym)(app.webId);
66853
66797
  }
66854
- if (this.session.info.webId && this.session.info.isLoggedIn) {
66798
+ if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
66855
66799
  return (0, rdflib_1.sym)(this.session.info.webId);
66856
66800
  }
66857
66801
  return (0, authUtil_1.offlineTestID)(); // null unless testing
@@ -67378,6 +67322,29 @@ exports.determineChatContainer = determineChatContainer;
67378
67322
 
67379
67323
  "use strict";
67380
67324
 
67325
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
67326
+ if (k2 === undefined) k2 = k;
67327
+ var desc = Object.getOwnPropertyDescriptor(m, k);
67328
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
67329
+ desc = { enumerable: true, get: function() { return m[k]; } };
67330
+ }
67331
+ Object.defineProperty(o, k2, desc);
67332
+ }) : (function(o, m, k, k2) {
67333
+ if (k2 === undefined) k2 = k;
67334
+ o[k2] = m[k];
67335
+ }));
67336
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
67337
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
67338
+ }) : function(o, v) {
67339
+ o["default"] = v;
67340
+ });
67341
+ var __importStar = (this && this.__importStar) || function (mod) {
67342
+ if (mod && mod.__esModule) return mod;
67343
+ var result = {};
67344
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
67345
+ __setModuleDefault(result, mod);
67346
+ return result;
67347
+ };
67381
67348
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
67382
67349
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
67383
67350
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -67414,16 +67381,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
67414
67381
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
67415
67382
  }
67416
67383
  };
67384
+ var __importDefault = (this && this.__importDefault) || function (mod) {
67385
+ return (mod && mod.__esModule) ? mod : { "default": mod };
67386
+ };
67417
67387
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67418
- exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = void 0;
67388
+ 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
67389
  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
- };
67390
+ var $rdf = __importStar(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
67391
+ var solidLogicSingleton_1 = __webpack_require__(/*! ../logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
67392
+ var uri_1 = __webpack_require__(/*! ../util/uri */ "./node_modules/solid-logic/lib/util/uri.js");
67393
+ var solid_namespace_1 = __importDefault(__webpack_require__(/*! solid-namespace */ "./node_modules/solid-namespace/index.js"));
67394
+ var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
67395
+ var currentUser = authn.currentUser;
67396
+ var ns = (0, solid_namespace_1.default)($rdf);
67397
+ /**
67398
+ * Create a resource if it really does not exist
67399
+ * Be absolutely sure something does not exist before creating a new empty file
67400
+ * as otherwise existing could be deleted.
67401
+ * @param doc {NamedNode} - The resource
67402
+ */
67403
+ function loadOrCreateIfNotExists(store, doc) {
67404
+ return __awaiter(this, void 0, void 0, function () {
67405
+ var response, err_1, msg, msg;
67406
+ return __generator(this, function (_a) {
67407
+ switch (_a.label) {
67408
+ case 0:
67409
+ _a.trys.push([0, 2, , 3]);
67410
+ return [4 /*yield*/, store.fetcher.load(doc)];
67411
+ case 1:
67412
+ response = _a.sent();
67413
+ return [3 /*break*/, 3];
67414
+ case 2:
67415
+ err_1 = _a.sent();
67416
+ if (err_1.response.status === 404) {
67417
+ try {
67418
+ store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
67419
+ }
67420
+ catch (err) {
67421
+ msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
67422
+ throw new Error(msg);
67423
+ }
67424
+ delete store.fetcher.requested[doc.uri]; // delete cached 404 error
67425
+ }
67426
+ else {
67427
+ msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
67428
+ throw new Error(msg); // @@ add nested errors
67429
+ }
67430
+ return [3 /*break*/, 3];
67431
+ case 3: return [2 /*return*/, response];
67432
+ }
67433
+ });
67434
+ });
67435
+ }
67436
+ exports.loadOrCreateIfNotExists = loadOrCreateIfNotExists;
67437
+ function suggestPreferencesFile(me) {
67438
+ var stripped = me.uri.replace('/profile/', '/').replace('/public/', '/');
67439
+ // const stripped = me.uri.replace(\/[p|P]rofile/\g, '/').replace(\/[p|P]ublic/\g, '/')
67440
+ var folderURI = stripped.split('/').slice(0, -1).join('/') + '/Settings/';
67441
+ var fileURI = folderURI + 'Preferences.ttl';
67442
+ return (0, rdflib_1.sym)(fileURI);
67443
+ }
67444
+ exports.suggestPreferencesFile = suggestPreferencesFile;
67445
+ function suggestPublicTypeIndex(me) {
67446
+ var _a;
67447
+ return (0, rdflib_1.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
67448
+ }
67449
+ exports.suggestPublicTypeIndex = suggestPublicTypeIndex;
67450
+ // Note this one is based off the pref file not the profile
67451
+ function suggestPrivateTypeIndex(preferencesFile) {
67452
+ var _a;
67453
+ return (0, rdflib_1.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
67454
+ }
67455
+ exports.suggestPrivateTypeIndex = suggestPrivateTypeIndex;
67456
+ /* Follow link from this doc to another thing, or else make a new link
67457
+ **
67458
+ ** return: null no ld one and failed to make a new one
67459
+ */
67460
+ function followOrCreateLink(store, subject, predicate, object, doc) {
67461
+ return __awaiter(this, void 0, void 0, function () {
67462
+ var result, err_2, err_3;
67463
+ return __generator(this, function (_a) {
67464
+ switch (_a.label) {
67465
+ case 0: return [4 /*yield*/, store.fetcher.load(doc)];
67466
+ case 1:
67467
+ _a.sent();
67468
+ result = store.any(subject, predicate, null, doc);
67469
+ if (result)
67470
+ return [2 /*return*/, result];
67471
+ if (!store.updater.editable(doc)) {
67472
+ return [2 /*return*/, null];
67473
+ }
67474
+ _a.label = 2;
67475
+ case 2:
67476
+ _a.trys.push([2, 4, , 5]);
67477
+ return [4 /*yield*/, store.updater.update([], [(0, rdflib_1.st)(subject, predicate, object, doc)])];
67478
+ case 3:
67479
+ _a.sent();
67480
+ return [3 /*break*/, 5];
67481
+ case 4:
67482
+ err_2 = _a.sent();
67483
+ console.warn("followOrCreateLink: Error making link in ".concat(doc, " to ").concat(object, ": ").concat(err_2));
67484
+ return [2 /*return*/, null];
67485
+ case 5:
67486
+ _a.trys.push([5, 7, , 8]);
67487
+ return [4 /*yield*/, loadOrCreateIfNotExists(store, object)
67488
+ // store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
67489
+ ];
67490
+ case 6:
67491
+ _a.sent();
67492
+ return [3 /*break*/, 8];
67493
+ case 7:
67494
+ err_3 = _a.sent();
67495
+ console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
67496
+ return [3 /*break*/, 8];
67497
+ case 8: return [2 /*return*/, object];
67498
+ }
67499
+ });
67500
+ });
67501
+ }
67502
+ exports.followOrCreateLink = followOrCreateLink;
67424
67503
  function loadProfile(store, user) {
67425
67504
  return __awaiter(this, void 0, void 0, function () {
67426
- var err_1;
67505
+ var err_4;
67427
67506
  return __generator(this, function (_a) {
67428
67507
  switch (_a.label) {
67429
67508
  case 0:
@@ -67438,8 +67517,8 @@ function loadProfile(store, user) {
67438
67517
  _a.sent();
67439
67518
  return [3 /*break*/, 4];
67440
67519
  case 3:
67441
- err_1 = _a.sent();
67442
- throw new Error("Unable to load profile of user <".concat(user, ">: ").concat(err_1));
67520
+ err_4 = _a.sent();
67521
+ throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
67443
67522
  case 4: return [2 /*return*/, user.doc()];
67444
67523
  }
67445
67524
  });
@@ -67448,27 +67527,32 @@ function loadProfile(store, user) {
67448
67527
  exports.loadProfile = loadProfile;
67449
67528
  function loadPreferences(store, user) {
67450
67529
  return __awaiter(this, void 0, void 0, function () {
67451
- var profile, preferencesFile;
67530
+ var possiblePreferencesFile, preferencesFile, message, err_5;
67452
67531
  return __generator(this, function (_a) {
67453
67532
  switch (_a.label) {
67454
67533
  case 0: return [4 /*yield*/, loadProfile(store, user)];
67455
67534
  case 1:
67456
- profile = _a.sent();
67457
- preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile);
67535
+ _a.sent();
67536
+ possiblePreferencesFile = suggestPreferencesFile(user);
67537
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
67538
+ case 2:
67539
+ preferencesFile = _a.sent();
67458
67540
  if (!preferencesFile) {
67459
- // throw new Error(`USer ${user} has no pointer in profile to preferences file.`)
67541
+ message = "User ".concat(user, " has no pointer in profile to preferences file.");
67542
+ console.warn(message);
67460
67543
  return [2 /*return*/, undefined];
67461
67544
  }
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];
67545
+ _a.label = 3;
67546
+ case 3:
67547
+ _a.trys.push([3, 5, , 6]);
67548
+ return [4 /*yield*/, store.fetcher.load(preferencesFile)];
67549
+ case 4:
67550
+ _a.sent();
67551
+ return [3 /*break*/, 6];
67552
+ case 5:
67553
+ err_5 = _a.sent();
67554
+ return [2 /*return*/, undefined];
67555
+ case 6: return [2 /*return*/, preferencesFile];
67472
67556
  }
67473
67557
  });
67474
67558
  });
@@ -67476,7 +67560,7 @@ function loadPreferences(store, user) {
67476
67560
  exports.loadPreferences = loadPreferences;
67477
67561
  function loadTypeIndexesFor(store, user) {
67478
67562
  return __awaiter(this, void 0, void 0, function () {
67479
- var profile, publicTypeIndex, _a, pub, preferencesFile, privateTypeIndexes, priv;
67563
+ var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_6, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_7;
67480
67564
  return __generator(this, function (_b) {
67481
67565
  switch (_b.label) {
67482
67566
  case 0:
@@ -67485,30 +67569,55 @@ function loadTypeIndexesFor(store, user) {
67485
67569
  return [4 /*yield*/, loadProfile(store, user)];
67486
67570
  case 1:
67487
67571
  profile = _b.sent();
67488
- publicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile);
67489
- if (!publicTypeIndex) return [3 /*break*/, 5];
67490
- _b.label = 2;
67572
+ suggestion = suggestPublicTypeIndex(user);
67573
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)];
67491
67574
  case 2:
67492
- _b.trys.push([2, 4, , 5]);
67493
- return [4 /*yield*/, store.fetcher.load(publicTypeIndex)];
67575
+ publicTypeIndex = _b.sent();
67576
+ publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
67577
+ _b.label = 3;
67494
67578
  case 3:
67495
- _b.sent();
67496
- return [3 /*break*/, 5];
67579
+ _b.trys.push([3, 5, , 6]);
67580
+ return [4 /*yield*/, loadPreferences(store, user)];
67497
67581
  case 4:
67498
- _a = _b.sent();
67499
- return [3 /*break*/, 5];
67582
+ preferencesFile = _b.sent();
67583
+ return [3 /*break*/, 6];
67500
67584
  case 5:
67501
- pub = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
67502
- return [4 /*yield*/, loadPreferences(store, user)];
67585
+ err_6 = _b.sent();
67586
+ preferencesFile = null;
67587
+ return [3 /*break*/, 6];
67503
67588
  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];
67589
+ if (!preferencesFile) return [3 /*break*/, 9];
67590
+ suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile);
67591
+ _a = store.any(user, ns.solid('privateTypeIndex'), undefined, profile);
67592
+ if (_a) return [3 /*break*/, 8];
67593
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile)];
67594
+ case 7:
67595
+ _a = (_b.sent());
67596
+ _b.label = 8;
67597
+ case 8:
67598
+ privateTypeIndex = _a;
67599
+ privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex, agent: user }] : [];
67600
+ return [3 /*break*/, 10];
67601
+ case 9:
67602
+ privateScopes = [];
67603
+ _b.label = 10;
67604
+ case 10:
67605
+ scopes = publicScopes.concat(privateScopes);
67606
+ if (scopes.length === 0)
67607
+ return [2 /*return*/, scopes];
67608
+ files = scopes.map(function (scope) { return scope.index; });
67609
+ _b.label = 11;
67610
+ case 11:
67611
+ _b.trys.push([11, 13, , 14]);
67612
+ return [4 /*yield*/, store.fetcher.load(files)];
67613
+ case 12:
67614
+ _b.sent();
67615
+ return [3 /*break*/, 14];
67616
+ case 13:
67617
+ err_7 = _b.sent();
67618
+ console.warn('Problems loading type index: ', err_7);
67619
+ return [3 /*break*/, 14];
67620
+ case 14: return [2 /*return*/, scopes];
67512
67621
  }
67513
67622
  });
67514
67623
  });
@@ -67516,44 +67625,30 @@ function loadTypeIndexesFor(store, user) {
67516
67625
  exports.loadTypeIndexesFor = loadTypeIndexesFor;
67517
67626
  function loadCommunityTypeIndexes(store, user) {
67518
67627
  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) {
67628
+ var preferencesFile, communities, result, _i, communities_1, org, _a, _b;
67629
+ return __generator(this, function (_c) {
67630
+ switch (_c.label) {
67523
67631
  case 0: return [4 /*yield*/, loadPreferences(store, user)];
67524
67632
  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*/, []];
67633
+ preferencesFile = _c.sent();
67634
+ if (!preferencesFile) return [3 /*break*/, 6];
67635
+ communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
67636
+ result = [];
67637
+ _i = 0, communities_1 = communities;
67638
+ _c.label = 2;
67639
+ case 2:
67640
+ if (!(_i < communities_1.length)) return [3 /*break*/, 5];
67641
+ org = communities_1[_i];
67642
+ _b = (_a = result).concat;
67643
+ return [4 /*yield*/, loadTypeIndexesFor(store, org)];
67644
+ case 3:
67645
+ result = _b.apply(_a, [_c.sent()]);
67646
+ _c.label = 4;
67647
+ case 4:
67648
+ _i++;
67649
+ return [3 /*break*/, 2];
67650
+ case 5: return [2 /*return*/, result];
67651
+ case 6: return [2 /*return*/, []]; // No communities
67557
67652
  }
67558
67653
  });
67559
67654
  });
@@ -67574,11 +67669,159 @@ function loadAllTypeIndexes(store, user) {
67574
67669
  });
67575
67670
  }
67576
67671
  exports.loadAllTypeIndexes = loadAllTypeIndexes;
67672
+ // Utility: remove duplicates from Array of NamedNodes
67673
+ function uniqueNodes(arr) {
67674
+ var uris = arr.map(function (x) { return x.uri; });
67675
+ var set = new Set(uris);
67676
+ var uris2 = Array.from(set);
67677
+ var arr2 = uris2.map(function (u) { return new rdflib_1.NamedNode(u); });
67678
+ return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
67679
+ }
67680
+ exports.uniqueNodes = uniqueNodes;
67681
+ function getScopedAppsFromIndex(store, scope, theClass) {
67682
+ return __awaiter(this, void 0, void 0, function () {
67683
+ var index, registrations, relevant, directInstances, instances, instanceContainers, containers, i, cont, contents;
67684
+ return __generator(this, function (_a) {
67685
+ switch (_a.label) {
67686
+ case 0:
67687
+ index = scope.index;
67688
+ registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
67689
+ .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
67690
+ .map(function (st) { return st.subject; });
67691
+ relevant = theClass ? registrations.filter(function (reg) { return store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass); })
67692
+ : registrations;
67693
+ directInstances = relevant.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
67694
+ instances = uniqueNodes(directInstances);
67695
+ instanceContainers = relevant.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
67696
+ containers = uniqueNodes(instanceContainers);
67697
+ if (containers.length > 0) {
67698
+ console.log('@@ getScopedAppsFromIndex containers ', containers);
67699
+ }
67700
+ i = 0;
67701
+ _a.label = 1;
67702
+ case 1:
67703
+ if (!(i < containers.length)) return [3 /*break*/, 4];
67704
+ cont = containers[i];
67705
+ return [4 /*yield*/, store.fetcher.load(cont)];
67706
+ case 2:
67707
+ _a.sent();
67708
+ contents = store.each(cont, ns.ldp('contains'), null, cont);
67709
+ instances = instances.concat(contents);
67710
+ _a.label = 3;
67711
+ case 3:
67712
+ i++;
67713
+ return [3 /*break*/, 1];
67714
+ case 4: return [2 /*return*/, instances.map(function (instance) { return { instance: instance, scope: scope }; })];
67715
+ }
67716
+ });
67717
+ });
67718
+ }
67719
+ exports.getScopedAppsFromIndex = getScopedAppsFromIndex;
67720
+ function getScopedAppInstances(store, klass, user) {
67721
+ return __awaiter(this, void 0, void 0, function () {
67722
+ var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
67723
+ return __generator(this, function (_a) {
67724
+ switch (_a.label) {
67725
+ case 0: return [4 /*yield*/, loadAllTypeIndexes(store, user)];
67726
+ case 1:
67727
+ scopes = _a.sent();
67728
+ scopedApps = [];
67729
+ _i = 0, scopes_1 = scopes;
67730
+ _a.label = 2;
67731
+ case 2:
67732
+ if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
67733
+ scope = scopes_1[_i];
67734
+ return [4 /*yield*/, getScopedAppsFromIndex(store, scope, klass)];
67735
+ case 3:
67736
+ scopedApps0 = _a.sent();
67737
+ scopedApps = scopedApps.concat(scopedApps0);
67738
+ _a.label = 4;
67739
+ case 4:
67740
+ _i++;
67741
+ return [3 /*break*/, 2];
67742
+ case 5: return [2 /*return*/, scopedApps];
67743
+ }
67744
+ });
67745
+ });
67746
+ }
67747
+ exports.getScopedAppInstances = getScopedAppInstances;
67748
+ // This is the function signature which used to be in solid-ui/logic
67749
+ // Recommended to use getScopedAppInstances instead as it provides more information.
67750
+ //
67751
+ function getAppInstances(store, klass) {
67752
+ return __awaiter(this, void 0, void 0, function () {
67753
+ var user, scopedAppInstances;
67754
+ return __generator(this, function (_a) {
67755
+ switch (_a.label) {
67756
+ case 0:
67757
+ user = currentUser();
67758
+ if (!user)
67759
+ throw new Error('getAppInstances: Must be logged in to find apps.');
67760
+ return [4 /*yield*/, getScopedAppInstances(store, klass, user)];
67761
+ case 1:
67762
+ scopedAppInstances = _a.sent();
67763
+ return [2 /*return*/, scopedAppInstances.map(function (scoped) { return scoped.instance; })];
67764
+ }
67765
+ });
67766
+ });
67767
+ }
67768
+ exports.getAppInstances = getAppInstances;
67577
67769
  /*
67578
- export async function getAppInstances (store:LiveStore, klass: NamedNode) {
67579
-
67770
+ * Register a new app in a type index
67771
+ * used in chat in bookmark.js (solid-ui)
67772
+ * Returns the registration object if successful else null
67773
+ */
67774
+ function registerInstanceInTypeIndex(store, instance, index, theClass) {
67775
+ return __awaiter(this, void 0, void 0, function () {
67776
+ var registration, ins, err_8, msg;
67777
+ return __generator(this, function (_a) {
67778
+ switch (_a.label) {
67779
+ case 0:
67780
+ registration = (0, uri_1.newThing)(index);
67781
+ ins = [
67782
+ // See https://github.com/solid/solid/blob/main/proposals/data-discovery.md
67783
+ (0, rdflib_1.st)(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),
67784
+ (0, rdflib_1.st)(registration, ns.solid('forClass'), theClass, index),
67785
+ (0, rdflib_1.st)(registration, ns.solid('instance'), instance, index)
67786
+ ];
67787
+ _a.label = 1;
67788
+ case 1:
67789
+ _a.trys.push([1, 3, , 4]);
67790
+ return [4 /*yield*/, store.updater.update([], ins)];
67791
+ case 2:
67792
+ _a.sent();
67793
+ return [3 /*break*/, 4];
67794
+ case 3:
67795
+ err_8 = _a.sent();
67796
+ msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_8);
67797
+ console.warn(msg);
67798
+ return [2 /*return*/, null];
67799
+ case 4: return [2 /*return*/, registration];
67800
+ }
67801
+ });
67802
+ });
67580
67803
  }
67581
- */
67804
+ exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
67805
+ function deleteTypeIndexRegistration(store, item) {
67806
+ return __awaiter(this, void 0, void 0, function () {
67807
+ var reg, statements;
67808
+ return __generator(this, function (_a) {
67809
+ switch (_a.label) {
67810
+ case 0:
67811
+ reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index);
67812
+ if (!reg)
67813
+ throw new Error("deleteTypeIndexRegistration: No registration found for ".concat(item.instance));
67814
+ statements = store.statementsMatching(reg, null, null, item.scope.index);
67815
+ return [4 /*yield*/, store.updater.update(statements, [])];
67816
+ case 1:
67817
+ _a.sent();
67818
+ return [2 /*return*/];
67819
+ }
67820
+ });
67821
+ });
67822
+ }
67823
+ exports.deleteTypeIndexRegistration = deleteTypeIndexRegistration;
67824
+ // ENDS
67582
67825
  //# sourceMappingURL=discoveryLogic.js.map
67583
67826
 
67584
67827
  /***/ }),
@@ -67592,7 +67835,7 @@ export async function getAppInstances (store:LiveStore, klass: NamedNode) {
67592
67835
  "use strict";
67593
67836
 
67594
67837
  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;
67838
+ 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
67839
  // Make these variables directly accessible as it is what you need most of the time
67597
67840
  // This also makes these variable globaly accesible in mashlib
67598
67841
  var solidLogicSingleton_1 = __webpack_require__(/*! ./logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
@@ -67614,12 +67857,25 @@ Object.defineProperty(exports, "ensureTypeIndexes", ({ enumerable: true, get: fu
67614
67857
  Object.defineProperty(exports, "loadTypeIndexes", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } }));
67615
67858
  Object.defineProperty(exports, "registerInTypeIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } }));
67616
67859
  Object.defineProperty(exports, "loadIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } }));
67860
+ // Generate by
67861
+ // 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
67862
  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; } }));
67863
+ Object.defineProperty(exports, "deleteTypeIndexRegistration", ({ enumerable: true, get: function () { return discoveryLogic_1.deleteTypeIndexRegistration; } }));
67864
+ Object.defineProperty(exports, "followOrCreateLink", ({ enumerable: true, get: function () { return discoveryLogic_1.followOrCreateLink; } }));
67865
+ Object.defineProperty(exports, "getAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getAppInstances; } }));
67866
+ Object.defineProperty(exports, "getScopedAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppInstances; } }));
67867
+ Object.defineProperty(exports, "getScopedAppsFromIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppsFromIndex; } }));
67868
+ Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67869
+ Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
67870
+ Object.defineProperty(exports, "loadOrCreateIfNotExists", ({ enumerable: true, get: function () { return discoveryLogic_1.loadOrCreateIfNotExists; } }));
67619
67871
  Object.defineProperty(exports, "loadPreferences", ({ enumerable: true, get: function () { return discoveryLogic_1.loadPreferences; } }));
67872
+ Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
67620
67873
  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; } }));
67874
+ Object.defineProperty(exports, "registerInstanceInTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.registerInstanceInTypeIndex; } }));
67875
+ Object.defineProperty(exports, "suggestPreferencesFile", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPreferencesFile; } }));
67876
+ Object.defineProperty(exports, "suggestPrivateTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPrivateTypeIndex; } }));
67877
+ Object.defineProperty(exports, "suggestPublicTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPublicTypeIndex; } }));
67878
+ Object.defineProperty(exports, "uniqueNodes", ({ enumerable: true, get: function () { return discoveryLogic_1.uniqueNodes; } }));
67623
67879
  var SolidLogic_1 = __webpack_require__(/*! ./logic/SolidLogic */ "./node_modules/solid-logic/lib/logic/SolidLogic.js");
67624
67880
  Object.defineProperty(exports, "SolidLogic", ({ enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } }));
67625
67881
  var authUtil_1 = __webpack_require__(/*! ./authn/authUtil */ "./node_modules/solid-logic/lib/authn/authUtil.js");
@@ -78108,9 +78364,8 @@ class LocalJWKSet {
78108
78364
  }
78109
78365
  async getKey(protectedHeader, token) {
78110
78366
  const { alg, kid } = { ...protectedHeader, ...token.header };
78111
- const kty = getKtyFromAlg(alg);
78112
78367
  const candidates = this._jwks.keys.filter((jwk) => {
78113
- let candidate = kty === jwk.kty;
78368
+ let candidate = jwk.kty === getKtyFromAlg(alg);
78114
78369
  if (candidate && typeof kid === 'string') {
78115
78370
  candidate = kid === jwk.kid;
78116
78371
  }
@@ -79327,15 +79582,21 @@ function lengthAndInput(input) {
79327
79582
  }
79328
79583
  async function concatKdf(secret, bits, value) {
79329
79584
  const iterations = Math.ceil((bits >> 3) / 32);
79330
- const res = new Uint8Array(iterations * 32);
79331
- for (let iter = 0; iter < iterations; iter++) {
79585
+ let res;
79586
+ for (let iter = 1; iter <= iterations; iter++) {
79332
79587
  const buf = new Uint8Array(4 + secret.length + value.length);
79333
- buf.set(uint32be(iter + 1));
79588
+ buf.set(uint32be(iter));
79334
79589
  buf.set(secret, 4);
79335
79590
  buf.set(value, 4 + secret.length);
79336
- res.set(await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf), iter * 32);
79591
+ if (!res) {
79592
+ res = await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf);
79593
+ }
79594
+ else {
79595
+ res = concat(res, await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf));
79596
+ }
79337
79597
  }
79338
- return res.slice(0, bits >> 3);
79598
+ res = res.slice(0, bits >> 3);
79599
+ return res;
79339
79600
  }
79340
79601
 
79341
79602
 
@@ -80550,12 +80811,9 @@ const encode = (input) => {
80550
80811
  return encodeBase64(input).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
80551
80812
  };
80552
80813
  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;
80814
+ return new Uint8Array(atob(encoded)
80815
+ .split('')
80816
+ .map((c) => c.charCodeAt(0)));
80559
80817
  };
80560
80818
  const decode = (input) => {
80561
80819
  let encoded = input;