solid-logic 3.1.1-ecb4985 → 3.1.1-f3e6173

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.
Files changed (56) hide show
  1. package/README.md +7 -12
  2. package/dist/acl/aclLogic.d.ts.map +1 -1
  3. package/dist/acl/aclLogic.js +0 -1
  4. package/dist/acl/aclLogic.js.map +1 -1
  5. package/dist/authn/SolidAuthnLogic.js +1 -2
  6. package/dist/authn/SolidAuthnLogic.js.map +1 -1
  7. package/dist/authn/authUtil.d.ts.map +1 -1
  8. package/dist/authn/authUtil.js +1 -4
  9. package/dist/authn/authUtil.js.map +1 -1
  10. package/dist/chat/chatLogic.d.ts.map +1 -1
  11. package/dist/chat/chatLogic.js +6 -6
  12. package/dist/chat/chatLogic.js.map +1 -1
  13. package/dist/inbox/inboxLogic.d.ts.map +1 -1
  14. package/dist/inbox/inboxLogic.js +0 -1
  15. package/dist/inbox/inboxLogic.js.map +1 -1
  16. package/dist/logic/CustomError.js +0 -1
  17. package/dist/logic/CustomError.js.map +1 -1
  18. package/dist/logic/solidLogic.d.ts.map +1 -1
  19. package/dist/logic/solidLogic.js +0 -1
  20. package/dist/logic/solidLogic.js.map +1 -1
  21. package/dist/logic/solidLogicSingleton.d.ts +2 -1
  22. package/dist/logic/solidLogicSingleton.d.ts.map +1 -1
  23. package/dist/logic/solidLogicSingleton.js +15 -2
  24. package/dist/logic/solidLogicSingleton.js.map +1 -1
  25. package/dist/profile/profileLogic.d.ts.map +1 -1
  26. package/dist/profile/profileLogic.js +0 -1
  27. package/dist/profile/profileLogic.js.map +1 -1
  28. package/dist/{solid-logic.esm.external.js → solid-logic.esm.js} +50 -39
  29. package/dist/solid-logic.esm.js.map +1 -0
  30. package/dist/{solid-logic.esm.external.min.js → solid-logic.esm.min.js} +2 -2
  31. package/dist/solid-logic.esm.min.js.map +1 -0
  32. package/dist/solid-logic.js +5560 -28370
  33. package/dist/solid-logic.js.map +1 -1
  34. package/dist/solid-logic.min.js +11 -20
  35. package/dist/solid-logic.min.js.map +1 -1
  36. package/dist/typeIndex/typeIndexLogic.d.ts.map +1 -1
  37. package/dist/typeIndex/typeIndexLogic.js +4 -8
  38. package/dist/typeIndex/typeIndexLogic.js.map +1 -1
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/util/debug.js +0 -1
  41. package/dist/util/debug.js.map +1 -1
  42. package/dist/versionInfo.js +2 -2
  43. package/package.json +11 -22
  44. package/dist/789.solid-logic.js +0 -11
  45. package/dist/789.solid-logic.js.map +0 -1
  46. package/dist/789.solid-logic.min.js +0 -1
  47. package/dist/841.solid-logic.js +0 -12133
  48. package/dist/841.solid-logic.js.map +0 -1
  49. package/dist/841.solid-logic.min.js +0 -73
  50. package/dist/841.solid-logic.min.js.map +0 -1
  51. package/dist/solid-logic.esm.external.js.map +0 -1
  52. package/dist/solid-logic.esm.external.min.js.map +0 -1
  53. package/dist/solid-logic.external.js +0 -7404
  54. package/dist/solid-logic.external.js.map +0 -1
  55. package/dist/solid-logic.external.min.js +0 -32
  56. package/dist/solid-logic.external.min.js.map +0 -1
@@ -685,6 +685,18 @@ e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=
685
685
  /******/ };
686
686
  /******/ })();
687
687
  /******/
688
+ /******/ /* webpack/runtime/global */
689
+ /******/ (() => {
690
+ /******/ __webpack_require__.g = (function() {
691
+ /******/ if (typeof globalThis === 'object') return globalThis;
692
+ /******/ try {
693
+ /******/ return this || new Function('return this')();
694
+ /******/ } catch (e) {
695
+ /******/ if (typeof window === 'object') return window;
696
+ /******/ }
697
+ /******/ })();
698
+ /******/ })();
699
+ /******/
688
700
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
689
701
  /******/ (() => {
690
702
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
@@ -694,7 +706,6 @@ e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=
694
706
  var __webpack_exports__ = {};
695
707
 
696
708
  ;// ./src/util/debug.ts
697
- /* eslint-disable @typescript-eslint/no-explicit-any */
698
709
  function log(...args) {
699
710
  console.log(...args);
700
711
  }
@@ -6052,10 +6063,10 @@ function getDefaultSession() {
6052
6063
  * @since 1.3.0
6053
6064
  */
6054
6065
  /* eslint-disable-next-line no-shadow */
6055
- const fetch$1 = (...args) => {
6066
+ function fetch$1(...args) {
6056
6067
  const session = getDefaultSession();
6057
6068
  return session.fetch(...args);
6058
- };
6069
+ }
6059
6070
  /**
6060
6071
  * Triggers the login process. Note that this method will redirect the user away from your app.
6061
6072
  *
@@ -6063,10 +6074,10 @@ const fetch$1 = (...args) => {
6063
6074
  * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]].
6064
6075
  * @since 1.3.0
6065
6076
  */
6066
- const login = (...args) => {
6077
+ function login(...args) {
6067
6078
  const session = getDefaultSession();
6068
6079
  return session.login(...args);
6069
- };
6080
+ }
6070
6081
  /**
6071
6082
  * Logs the user out of the application.
6072
6083
  *
@@ -6076,28 +6087,28 @@ const login = (...args) => {
6076
6087
  *
6077
6088
  * @since 1.3.0
6078
6089
  */
6079
- const logout = (...args) => {
6090
+ function logout(...args) {
6080
6091
  const session = getDefaultSession();
6081
6092
  return session.logout(...args);
6082
- };
6093
+ }
6083
6094
  /**
6084
6095
  * Completes the login process by processing the information provided by the Solid identity provider through redirect.
6085
6096
  *
6086
6097
  * @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login.
6087
6098
  * @since 1.3.0
6088
6099
  */
6089
- const handleIncomingRedirect = (...args) => {
6100
+ function handleIncomingRedirect(...args) {
6090
6101
  const session = getDefaultSession();
6091
6102
  return session.handleIncomingRedirect(...args);
6092
- };
6103
+ }
6093
6104
  /**
6094
6105
  * {@link SessionEventEmitter} instance to subscribe to events by the default session.
6095
6106
  *
6096
6107
  * @since 1.14.0
6097
6108
  */
6098
- const dist_events = () => {
6109
+ function dist_events() {
6099
6110
  return getDefaultSession().events;
6100
- };
6111
+ }
6101
6112
 
6102
6113
 
6103
6114
  //# sourceMappingURL=index.mjs.map
@@ -6184,7 +6195,6 @@ function createAclLogic(store) {
6184
6195
  }
6185
6196
  return fetcher.load(docURI).then(result => {
6186
6197
  if (!result.ok) {
6187
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6188
6198
  throw new Error('fetchACLRel: While loading:' + result.error);
6189
6199
  }
6190
6200
  const aclDoc = store.any(store.sym(docURI), ACL_LINK);
@@ -6245,11 +6255,9 @@ function createAclLogic(store) {
6245
6255
  * see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more
6246
6256
  * @return {any} - an appContext object
6247
6257
  */
6248
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6249
6258
  const appContext = () => {
6250
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6251
6259
  let { SolidAppContext } = window;
6252
- SolidAppContext ||= {};
6260
+ SolidAppContext || (SolidAppContext = {});
6253
6261
  SolidAppContext.viewingNoAuthPage = false;
6254
6262
  if (SolidAppContext.noAuth && window.document) {
6255
6263
  const currentPage = window.document.location.href;
@@ -6279,7 +6287,6 @@ const appContext = () => {
6279
6287
  * @returns {NamedNode|null}
6280
6288
  */
6281
6289
  function offlineTestID() {
6282
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6283
6290
  const { $SolidTestEnvironment } = window;
6284
6291
  if (typeof $SolidTestEnvironment !== 'undefined' &&
6285
6292
  $SolidTestEnvironment.username) {
@@ -6310,7 +6317,6 @@ function offlineTestID() {
6310
6317
 
6311
6318
 
6312
6319
  class SolidAuthnLogic {
6313
- session;
6314
6320
  constructor(solidAuthSession) {
6315
6321
  this.session = solidAuthSession;
6316
6322
  }
@@ -6410,7 +6416,7 @@ class SolidAuthnLogic {
6410
6416
  * @returns {Promise<string|null>} Resolves with WebID URI or null
6411
6417
  */
6412
6418
  webIdFromSession(session) {
6413
- const webId = session?.webId && session.isLoggedIn ? session.webId : null;
6419
+ const webId = (session === null || session === void 0 ? void 0 : session.webId) && session.isLoggedIn ? session.webId : null;
6414
6420
  return webId;
6415
6421
  }
6416
6422
  }
@@ -6525,7 +6531,6 @@ function createChatLogic(store, profileLogic) {
6525
6531
  let exists = true;
6526
6532
  try {
6527
6533
  await store.fetcher.load(new external_$rdf_namespaceObject.NamedNode(chatContainer.value + 'index.ttl#this'));
6528
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6529
6534
  }
6530
6535
  catch (e) {
6531
6536
  exists = false;
@@ -6556,7 +6561,7 @@ function createChatLogic(store, profileLogic) {
6556
6561
  kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc);
6557
6562
  }
6558
6563
  return new Promise(function (resolve, reject) {
6559
- updater?.put(newChatDoc, kb.statementsMatching(undefined, undefined, undefined, newChatDoc), 'text/turtle', function (uri2, ok, message) {
6564
+ updater === null || updater === void 0 ? void 0 : updater.put(newChatDoc, kb.statementsMatching(undefined, undefined, undefined, newChatDoc), 'text/turtle', function (uri2, ok, message) {
6560
6565
  if (ok) {
6561
6566
  resolve({
6562
6567
  ...newPaneOptions,
@@ -6590,6 +6595,7 @@ function createChatLogic(store, profileLogic) {
6590
6595
  return null;
6591
6596
  }
6592
6597
  async function sendInvite(invitee, chatThing) {
6598
+ var _a;
6593
6599
  await store.fetcher.load(invitee.doc());
6594
6600
  const inviteeInbox = store.any(invitee, ns.ldp('inbox'), undefined, invitee.doc());
6595
6601
  if (!inviteeInbox) {
@@ -6599,13 +6605,13 @@ function createChatLogic(store, profileLogic) {
6599
6605
  <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;
6600
6606
  ${ns.rdf('seeAlso')} <${chatThing.value}> .
6601
6607
  `;
6602
- const inviteResponse = await store.fetcher?.webOperation('POST', inviteeInbox.value, {
6608
+ const inviteResponse = await ((_a = store.fetcher) === null || _a === void 0 ? void 0 : _a.webOperation('POST', inviteeInbox.value, {
6603
6609
  data: inviteBody,
6604
6610
  contentType: 'text/turtle',
6605
- });
6606
- const locationStr = inviteResponse?.headers.get('location');
6611
+ }));
6612
+ const locationStr = inviteResponse === null || inviteResponse === void 0 ? void 0 : inviteResponse.headers.get('location');
6607
6613
  if (!locationStr) {
6608
- throw new Error(`Invite sending returned a ${inviteResponse?.status}`);
6614
+ throw new Error(`Invite sending returned a ${inviteResponse === null || inviteResponse === void 0 ? void 0 : inviteResponse.status}`);
6609
6615
  }
6610
6616
  }
6611
6617
  return {
@@ -6615,7 +6621,6 @@ function createChatLogic(store, profileLogic) {
6615
6621
 
6616
6622
  ;// ./src/inbox/inboxLogic.ts
6617
6623
 
6618
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6619
6624
  function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic) {
6620
6625
  async function createInboxFor(peerWebId, nick) {
6621
6626
  const myWebId = await profileLogic.loadMe();
@@ -6688,7 +6693,6 @@ class NotEditableError extends CustomError {
6688
6693
  class WebOperationError extends CustomError {
6689
6694
  }
6690
6695
  class FetchError extends CustomError {
6691
- status;
6692
6696
  constructor(status, message) {
6693
6697
  super(message);
6694
6698
  this.status = status;
@@ -6711,7 +6715,6 @@ function createProfileLogic(store, authn, utilityLogic) {
6711
6715
  async function silencedLoadPreferences(user) {
6712
6716
  try {
6713
6717
  return await loadPreferences(user);
6714
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6715
6718
  }
6716
6719
  catch (err) {
6717
6720
  return undefined;
@@ -6847,7 +6850,6 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6847
6850
  let publicTypeIndex;
6848
6851
  try {
6849
6852
  publicTypeIndex = await utilityLogic.followOrCreateLink(user, ns.solid('publicTypeIndex'), suggestion, profile);
6850
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6851
6853
  }
6852
6854
  catch (err) {
6853
6855
  const message = `User ${user} has no pointer in profile to publicTypeIndex file.`;
@@ -6857,7 +6859,6 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6857
6859
  let preferencesFile;
6858
6860
  try {
6859
6861
  preferencesFile = await profileLogic.silencedLoadPreferences(user);
6860
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6861
6862
  }
6862
6863
  catch (err) {
6863
6864
  preferencesFile = null;
@@ -6871,7 +6872,6 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6871
6872
  try {
6872
6873
  privateTypeIndex = store.any(user, ns.solid('privateTypeIndex'), undefined, profile) ||
6873
6874
  await utilityLogic.followOrCreateLink(user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile);
6874
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6875
6875
  }
6876
6876
  catch (err) {
6877
6877
  const message = `User ${user} has no pointer in preference file to privateTypeIndex file.`;
@@ -6898,7 +6898,6 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6898
6898
  let preferencesFile;
6899
6899
  try {
6900
6900
  preferencesFile = await profileLogic.silencedLoadPreferences(user);
6901
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6902
6901
  }
6903
6902
  catch (err) {
6904
6903
  const message = `User ${user} has no pointer in profile to preferences file.`;
@@ -6908,7 +6907,6 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6908
6907
  const communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
6909
6908
  let result = [];
6910
6909
  for (const org of communities) {
6911
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6912
6910
  result = result.concat(await loadTypeIndexesFor(org));
6913
6911
  }
6914
6912
  return result;
@@ -6922,7 +6920,6 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6922
6920
  const scopes = await loadAllTypeIndexes(user);
6923
6921
  let scopedApps = [];
6924
6922
  for (const scope of scopes) {
6925
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6926
6923
  const scopedApps0 = await getScopedAppsFromIndex(scope, klass);
6927
6924
  scopedApps = scopedApps.concat(scopedApps0);
6928
6925
  }
@@ -6939,11 +6936,13 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6939
6936
  return scopedAppInstances.map(scoped => scoped.instance);
6940
6937
  }
6941
6938
  function suggestPublicTypeIndex(me) {
6942
- return (0,external_$rdf_namespaceObject.sym)(me.doc().dir()?.uri + 'publicTypeIndex.ttl');
6939
+ var _a;
6940
+ return (0,external_$rdf_namespaceObject.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
6943
6941
  }
6944
6942
  // Note this one is based off the pref file not the profile
6945
6943
  function suggestPrivateTypeIndex(preferencesFile) {
6946
- return (0,external_$rdf_namespaceObject.sym)(preferencesFile.doc().dir()?.uri + 'privateTypeIndex.ttl');
6944
+ var _a;
6945
+ return (0,external_$rdf_namespaceObject.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
6947
6946
  }
6948
6947
  /*
6949
6948
  * Register a new app in a type index
@@ -7220,7 +7219,6 @@ function createUtilityLogic(store, aclLogic, containerLogic) {
7220
7219
  ** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
7221
7220
  ** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
7222
7221
  */
7223
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7224
7222
  function createSolidLogic(specialFetch, session) {
7225
7223
  log('SolidLogic: Unique instance created. There should only be one of these.');
7226
7224
  const store = external_$rdf_namespaceObject.graph();
@@ -7283,9 +7281,22 @@ const _fetch = async (url, requestInit) => {
7283
7281
  return window.fetch(url, requestInit);
7284
7282
  }
7285
7283
  };
7284
+ // Global singleton pattern to ensure unique store across library versions
7285
+ const SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton');
7286
+ const globalThis = (typeof window !== 'undefined' ? window : __webpack_require__.g);
7287
+ function getOrCreateSingleton() {
7288
+ if (!globalThis[SINGLETON_SYMBOL]) {
7289
+ log('SolidLogic: Creating new global singleton instance.');
7290
+ globalThis[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession);
7291
+ log('Unique quadstore initialized.');
7292
+ }
7293
+ else {
7294
+ log('SolidLogic: Using existing global singleton instance.');
7295
+ }
7296
+ return globalThis[SINGLETON_SYMBOL];
7297
+ }
7286
7298
  //this const makes solidLogicSingleton global accessible in mashlib
7287
- const solidLogicSingleton = createSolidLogic({ fetch: _fetch }, authSession);
7288
- log('Unique quadstore initialized.');
7299
+ const solidLogicSingleton = getOrCreateSingleton();
7289
7300
 
7290
7301
 
7291
7302
  ;// ./src/issuer/issuerLogic.ts
@@ -7342,4 +7353,4 @@ const store = solidLogicSingleton.store;
7342
7353
 
7343
7354
  export { ACL_LINK, CrossOriginForbiddenError, FetchError, NotEditableError, NotFoundError, SameOriginForbiddenError, UnauthorizedError, WebOperationError, appContext, src_authSession as authSession, authn, createTypeIndexLogic, getSuggestedIssuers, offlineTestID, solidLogicSingleton, store };
7344
7355
 
7345
- //# sourceMappingURL=solid-logic.esm.external.js.map
7356
+ //# sourceMappingURL=solid-logic.esm.js.map