solid-logic 4.0.8-0 → 4.0.8-2

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 (171) hide show
  1. package/README.md +3 -4
  2. package/dist/_virtual/_rolldown/runtime.cjs.js +1 -0
  3. package/dist/acl/aclLogic.cjs.js +2 -0
  4. package/dist/acl/aclLogic.cjs.js.map +1 -0
  5. package/dist/acl/aclLogic.esm.js +56 -0
  6. package/dist/acl/aclLogic.esm.js.map +1 -0
  7. package/dist/authSession/authSession.cjs.js +2 -0
  8. package/dist/authSession/authSession.cjs.js.map +1 -0
  9. package/dist/authSession/authSession.esm.js +22 -0
  10. package/dist/authSession/authSession.esm.js.map +1 -0
  11. package/dist/authSession/events.cjs.js +2 -0
  12. package/dist/authSession/events.cjs.js.map +1 -0
  13. package/dist/authSession/events.esm.js +19 -0
  14. package/dist/authSession/events.esm.js.map +1 -0
  15. package/dist/authSession/issuer.cjs.js +2 -0
  16. package/dist/authSession/issuer.cjs.js.map +1 -0
  17. package/dist/authSession/issuer.esm.js +18 -0
  18. package/dist/authSession/issuer.esm.js.map +1 -0
  19. package/dist/authSession/session.cjs.js +2 -0
  20. package/dist/authSession/session.cjs.js.map +1 -0
  21. package/dist/authSession/session.esm.js +102 -0
  22. package/dist/authSession/session.esm.js.map +1 -0
  23. package/dist/authn/SolidAuthnLogic.cjs.js +2 -0
  24. package/dist/authn/SolidAuthnLogic.cjs.js.map +1 -0
  25. package/dist/authn/SolidAuthnLogic.esm.js +104 -0
  26. package/dist/authn/SolidAuthnLogic.esm.js.map +1 -0
  27. package/dist/authn/authUtil.cjs.js +2 -0
  28. package/dist/authn/authUtil.cjs.js.map +1 -0
  29. package/dist/authn/authUtil.esm.js +33 -0
  30. package/dist/authn/authUtil.esm.js.map +1 -0
  31. package/dist/authn/serverLogout.cjs.js +2 -0
  32. package/dist/authn/serverLogout.cjs.js.map +1 -0
  33. package/dist/authn/serverLogout.esm.js +25 -0
  34. package/dist/authn/serverLogout.esm.js.map +1 -0
  35. package/dist/chat/chatLogic.cjs.js +21 -0
  36. package/dist/chat/chatLogic.cjs.js.map +1 -0
  37. package/dist/chat/chatLogic.esm.js +116 -0
  38. package/dist/chat/chatLogic.esm.js.map +1 -0
  39. package/dist/inbox/inboxLogic.cjs.js +2 -0
  40. package/dist/inbox/inboxLogic.cjs.js.map +1 -0
  41. package/dist/inbox/inboxLogic.esm.js +37 -0
  42. package/dist/inbox/inboxLogic.esm.js.map +1 -0
  43. package/dist/index.cjs.js +2 -0
  44. package/dist/index.cjs.js.map +1 -0
  45. package/dist/index.esm.js +13 -0
  46. package/dist/index.esm.js.map +1 -0
  47. package/dist/issuer/issuerLogic.cjs.js +2 -0
  48. package/dist/issuer/issuerLogic.cjs.js.map +1 -0
  49. package/dist/issuer/issuerLogic.esm.js +30 -0
  50. package/dist/issuer/issuerLogic.esm.js.map +1 -0
  51. package/dist/logic/CustomError.cjs.js +2 -0
  52. package/dist/logic/CustomError.cjs.js.map +1 -0
  53. package/dist/logic/CustomError.esm.js +14 -0
  54. package/dist/logic/CustomError.esm.js.map +1 -0
  55. package/dist/logic/solidLogic.cjs.js +2 -0
  56. package/dist/logic/solidLogic.cjs.js.map +1 -0
  57. package/dist/logic/solidLogic.esm.js +47 -0
  58. package/dist/logic/solidLogic.esm.js.map +1 -0
  59. package/dist/logic/solidLogicSingleton.cjs.js +2 -0
  60. package/dist/logic/solidLogicSingleton.cjs.js.map +1 -0
  61. package/dist/logic/solidLogicSingleton.esm.js +19 -0
  62. package/dist/logic/solidLogicSingleton.esm.js.map +1 -0
  63. package/dist/profile/profileAclDocuments.cjs.js +3 -0
  64. package/dist/profile/profileAclDocuments.cjs.js.map +1 -0
  65. package/dist/profile/profileAclDocuments.esm.js +17 -0
  66. package/dist/profile/profileAclDocuments.esm.js.map +1 -0
  67. package/dist/profile/profileDocuments.cjs.js +3 -0
  68. package/dist/profile/profileDocuments.cjs.js.map +1 -0
  69. package/dist/profile/profileDocuments.esm.js +15 -0
  70. package/dist/profile/profileDocuments.esm.js.map +1 -0
  71. package/dist/profile/profileLogic.cjs.js +2 -0
  72. package/dist/profile/profileLogic.cjs.js.map +1 -0
  73. package/dist/profile/profileLogic.esm.js +184 -0
  74. package/dist/profile/profileLogic.esm.js.map +1 -0
  75. package/dist/typeIndex/typeIndexAclDocuments.cjs.js +3 -0
  76. package/dist/typeIndex/typeIndexAclDocuments.cjs.js.map +1 -0
  77. package/dist/typeIndex/typeIndexAclDocuments.esm.js +35 -0
  78. package/dist/typeIndex/typeIndexAclDocuments.esm.js.map +1 -0
  79. package/dist/typeIndex/typeIndexDocuments.cjs.js +4 -0
  80. package/dist/typeIndex/typeIndexDocuments.cjs.js.map +1 -0
  81. package/dist/typeIndex/typeIndexDocuments.esm.js +21 -0
  82. package/dist/typeIndex/typeIndexDocuments.esm.js.map +1 -0
  83. package/dist/typeIndex/typeIndexLogic.cjs.js +2 -0
  84. package/dist/typeIndex/typeIndexLogic.cjs.js.map +1 -0
  85. package/dist/typeIndex/typeIndexLogic.esm.js +185 -0
  86. package/dist/typeIndex/typeIndexLogic.esm.js.map +1 -0
  87. package/dist/util/containerLogic.cjs.js +2 -0
  88. package/dist/util/containerLogic.cjs.js.map +1 -0
  89. package/dist/util/containerLogic.esm.js +37 -0
  90. package/dist/util/containerLogic.esm.js.map +1 -0
  91. package/dist/util/debug.cjs.js +2 -0
  92. package/dist/util/debug.cjs.js.map +1 -0
  93. package/dist/util/debug.esm.js +11 -0
  94. package/dist/util/debug.esm.js.map +1 -0
  95. package/dist/util/ns.cjs.js +2 -0
  96. package/dist/util/ns.cjs.js.map +1 -0
  97. package/dist/util/ns.esm.js +8 -0
  98. package/dist/util/ns.esm.js.map +1 -0
  99. package/dist/util/utilityLogic.cjs.js +6 -0
  100. package/dist/util/utilityLogic.cjs.js.map +1 -0
  101. package/dist/util/utilityLogic.esm.js +149 -0
  102. package/dist/util/utilityLogic.esm.js.map +1 -0
  103. package/dist/util/utils.cjs.js +2 -0
  104. package/dist/util/utils.cjs.js.map +1 -0
  105. package/dist/util/utils.esm.js +22 -0
  106. package/dist/util/utils.esm.js.map +1 -0
  107. package/package.json +25 -31
  108. package/dist/2729812e0bfc062ee77a.js +0 -1
  109. package/dist/a9c30b64ceaae48b72f0.js +0 -2045
  110. package/dist/acl/aclLogic.d.ts +0 -5
  111. package/dist/acl/aclLogic.d.ts.map +0 -1
  112. package/dist/authSession/authSession.d.ts +0 -42
  113. package/dist/authSession/authSession.d.ts.map +0 -1
  114. package/dist/authSession/events.d.ts +0 -24
  115. package/dist/authSession/events.d.ts.map +0 -1
  116. package/dist/authSession/issuer.d.ts +0 -8
  117. package/dist/authSession/issuer.d.ts.map +0 -1
  118. package/dist/authSession/session.d.ts +0 -45
  119. package/dist/authSession/session.d.ts.map +0 -1
  120. package/dist/authn/SolidAuthnLogic.d.ts +0 -42
  121. package/dist/authn/SolidAuthnLogic.d.ts.map +0 -1
  122. package/dist/authn/authUtil.d.ts +0 -17
  123. package/dist/authn/authUtil.d.ts.map +0 -1
  124. package/dist/authn/serverLogout.d.ts +0 -6
  125. package/dist/authn/serverLogout.d.ts.map +0 -1
  126. package/dist/chat/chatLogic.d.ts +0 -3
  127. package/dist/chat/chatLogic.d.ts.map +0 -1
  128. package/dist/inbox/inboxLogic.d.ts +0 -3
  129. package/dist/inbox/inboxLogic.d.ts.map +0 -1
  130. package/dist/index.d.ts +0 -14
  131. package/dist/index.d.ts.map +0 -1
  132. package/dist/issuer/issuerLogic.d.ts +0 -8
  133. package/dist/issuer/issuerLogic.d.ts.map +0 -1
  134. package/dist/logic/CustomError.d.ts +0 -21
  135. package/dist/logic/CustomError.d.ts.map +0 -1
  136. package/dist/logic/solidLogic.d.ts +0 -6
  137. package/dist/logic/solidLogic.d.ts.map +0 -1
  138. package/dist/logic/solidLogicSingleton.d.ts +0 -4
  139. package/dist/logic/solidLogicSingleton.d.ts.map +0 -1
  140. package/dist/profile/profileAclDocuments.d.ts +0 -2
  141. package/dist/profile/profileAclDocuments.d.ts.map +0 -1
  142. package/dist/profile/profileDocuments.d.ts +0 -2
  143. package/dist/profile/profileDocuments.d.ts.map +0 -1
  144. package/dist/profile/profileLogic.d.ts +0 -3
  145. package/dist/profile/profileLogic.d.ts.map +0 -1
  146. package/dist/solid-logic.esm.js +0 -2339
  147. package/dist/solid-logic.esm.js.map +0 -1
  148. package/dist/solid-logic.esm.min.js +0 -2
  149. package/dist/solid-logic.esm.min.js.map +0 -1
  150. package/dist/solid-logic.js +0 -7529
  151. package/dist/solid-logic.js.map +0 -1
  152. package/dist/solid-logic.min.js +0 -2
  153. package/dist/solid-logic.min.js.map +0 -1
  154. package/dist/typeIndex/typeIndexAclDocuments.d.ts +0 -2
  155. package/dist/typeIndex/typeIndexAclDocuments.d.ts.map +0 -1
  156. package/dist/typeIndex/typeIndexDocuments.d.ts +0 -3
  157. package/dist/typeIndex/typeIndexDocuments.d.ts.map +0 -1
  158. package/dist/typeIndex/typeIndexLogic.d.ts +0 -3
  159. package/dist/typeIndex/typeIndexLogic.d.ts.map +0 -1
  160. package/dist/types.d.ts +0 -113
  161. package/dist/types.d.ts.map +0 -1
  162. package/dist/util/containerLogic.d.ts +0 -11
  163. package/dist/util/containerLogic.d.ts.map +0 -1
  164. package/dist/util/debug.d.ts +0 -5
  165. package/dist/util/debug.d.ts.map +0 -1
  166. package/dist/util/ns.d.ts +0 -2
  167. package/dist/util/ns.d.ts.map +0 -1
  168. package/dist/util/utilityLogic.d.ts +0 -17
  169. package/dist/util/utilityLogic.d.ts.map +0 -1
  170. package/dist/util/utils.d.ts +0 -8
  171. package/dist/util/utils.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authUtil.cjs.js","names":[],"sources":["../../src/authn/authUtil.ts"],"sourcesContent":["import { NamedNode, sym } from 'rdflib'\nimport * as debug from '../util/debug'\n\n/**\n * find a user or app's context as set in window.SolidAppContext\n * this is a const, not a function, because we have problems to jest mock it otherwise\n * see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more\n * @return {any} - an appContext object\n */\nexport const appContext = ():any => {\n let { SolidAppContext }: any = window\n SolidAppContext ||= {}\n SolidAppContext.viewingNoAuthPage = false\n if (SolidAppContext.noAuth && window.document) {\n const currentPage = window.document.location.href\n if (currentPage.startsWith(SolidAppContext.noAuth)) {\n SolidAppContext.viewingNoAuthPage = true\n const params = new URLSearchParams(window.document.location.search)\n if (params) {\n let viewedPage = SolidAppContext.viewedPage = params.get('uri') || null\n if (viewedPage) {\n viewedPage = decodeURI(viewedPage)\n if (!viewedPage.startsWith(SolidAppContext.noAuth)) {\n const ary = viewedPage.split(/\\//)\n SolidAppContext.idp = ary[0] + '//' + ary[2]\n SolidAppContext.viewingNoAuthPage = false\n }\n }\n }\n }\n }\n return SolidAppContext\n}\n\n/**\n * Returns `sym($SolidTestEnvironment.username)` if\n * `$SolidTestEnvironment.username` is defined as a global\n * or \n * returns testID defined in the HTML page\n * @returns {NamedNode|null}\n */\nexport function offlineTestID (): NamedNode | null {\n const { $SolidTestEnvironment }: any = window\n if (\n typeof $SolidTestEnvironment !== 'undefined' &&\n $SolidTestEnvironment.username\n ) {\n // Test setup\n debug.log('Assuming the user is ' + $SolidTestEnvironment.username)\n return sym($SolidTestEnvironment.username)\n }\n // hack that makes SolidOS work in offline mode by adding the webId directly in html\n // example usage: https://github.com/solidos/mashlib/blob/29b8b53c46bf02e0e219f0bacd51b0e9951001dd/test/contact/local.html#L37\n if (\n typeof document !== 'undefined' &&\n document.location &&\n ('' + document.location).slice(0, 16) === 'http://localhost'\n ) {\n const div = document.getElementById('appTarget')\n if (!div) return null\n const id = div.getAttribute('testID')\n if (!id) return null\n debug.log('Assuming user is ' + id)\n return sym(id)\n }\n return null\n}\n"],"mappings":"gEASA,IAAa,MAAuB,CAChC,GAAI,CAAE,mBAAyB,OAG/B,GAFA,IAAoB,CAAC,EACrB,EAAgB,kBAAoB,GAChC,EAAgB,QAAU,OAAO,UACb,OAAO,SAAS,SAAS,KAC7B,WAAW,EAAgB,MAAM,EAAG,CACpD,EAAgB,kBAAoB,GACpC,IAAM,EAAS,IAAI,gBAAgB,OAAO,SAAS,SAAS,MAAM,EAClE,GAAI,EAAQ,CACR,IAAI,EAAa,EAAgB,WAAa,EAAO,IAAI,KAAK,GAAK,KACnE,GAAI,IACJ,EAAa,UAAU,CAAU,EAC7B,CAAC,EAAW,WAAW,EAAgB,MAAM,GAAG,CAChD,IAAM,EAAM,EAAW,MAAM,IAAI,EACjC,EAAgB,IAAM,EAAI,GAAK,KAAO,EAAI,GAC1C,EAAgB,kBAAoB,EACxC,CAEJ,CACA,CAEJ,OAAO,CACX,EASA,SAAgB,GAAmC,CAC/C,GAAM,CAAE,yBAA+B,OACvC,GACS,IAA0B,QACjC,EAAsB,SAItB,OADA,EAAA,IAAU,wBAA0B,EAAsB,QAAQ,GAClE,EAAA,EAAA,IAAA,CAAW,EAAsB,QAAQ,EAI3C,GACE,OAAO,SAAa,KACpB,SAAS,WACR,GAAK,SAAS,SAAA,CAAU,MAAM,EAAG,EAAE,IAAM,mBAC1C,CACA,IAAM,EAAM,SAAS,eAAe,WAAW,EAC/C,GAAI,CAAC,EAAK,OAAO,KACjB,IAAM,EAAK,EAAI,aAAa,QAAQ,EAGpC,OAFK,GACL,EAAA,IAAU,oBAAsB,CAAE,GAClC,EAAA,EAAA,IAAA,CAAW,CAAE,GAFG,IAGlB,CACA,OAAO,IACX"}
@@ -0,0 +1,33 @@
1
+ import { log as e } from "../util/debug.esm.js";
2
+ import { sym as t } from "rdflib";
3
+ //#region src/authn/authUtil.ts
4
+ var n = () => {
5
+ let { SolidAppContext: e } = window;
6
+ if (e ||= {}, e.viewingNoAuthPage = !1, e.noAuth && window.document && window.document.location.href.startsWith(e.noAuth)) {
7
+ e.viewingNoAuthPage = !0;
8
+ let t = new URLSearchParams(window.document.location.search);
9
+ if (t) {
10
+ let n = e.viewedPage = t.get("uri") || null;
11
+ if (n && (n = decodeURI(n), !n.startsWith(e.noAuth))) {
12
+ let t = n.split(/\//);
13
+ e.idp = t[0] + "//" + t[2], e.viewingNoAuthPage = !1;
14
+ }
15
+ }
16
+ }
17
+ return e;
18
+ };
19
+ function r() {
20
+ let { $SolidTestEnvironment: n } = window;
21
+ if (n !== void 0 && n.username) return e("Assuming the user is " + n.username), t(n.username);
22
+ if (typeof document < "u" && document.location && ("" + document.location).slice(0, 16) === "http://localhost") {
23
+ let n = document.getElementById("appTarget");
24
+ if (!n) return null;
25
+ let r = n.getAttribute("testID");
26
+ return r ? (e("Assuming user is " + r), t(r)) : null;
27
+ }
28
+ return null;
29
+ }
30
+ //#endregion
31
+ export { n as appContext, r as offlineTestID };
32
+
33
+ //# sourceMappingURL=authUtil.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authUtil.esm.js","names":[],"sources":["../../src/authn/authUtil.ts"],"sourcesContent":["import { NamedNode, sym } from 'rdflib'\nimport * as debug from '../util/debug'\n\n/**\n * find a user or app's context as set in window.SolidAppContext\n * this is a const, not a function, because we have problems to jest mock it otherwise\n * see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more\n * @return {any} - an appContext object\n */\nexport const appContext = ():any => {\n let { SolidAppContext }: any = window\n SolidAppContext ||= {}\n SolidAppContext.viewingNoAuthPage = false\n if (SolidAppContext.noAuth && window.document) {\n const currentPage = window.document.location.href\n if (currentPage.startsWith(SolidAppContext.noAuth)) {\n SolidAppContext.viewingNoAuthPage = true\n const params = new URLSearchParams(window.document.location.search)\n if (params) {\n let viewedPage = SolidAppContext.viewedPage = params.get('uri') || null\n if (viewedPage) {\n viewedPage = decodeURI(viewedPage)\n if (!viewedPage.startsWith(SolidAppContext.noAuth)) {\n const ary = viewedPage.split(/\\//)\n SolidAppContext.idp = ary[0] + '//' + ary[2]\n SolidAppContext.viewingNoAuthPage = false\n }\n }\n }\n }\n }\n return SolidAppContext\n}\n\n/**\n * Returns `sym($SolidTestEnvironment.username)` if\n * `$SolidTestEnvironment.username` is defined as a global\n * or \n * returns testID defined in the HTML page\n * @returns {NamedNode|null}\n */\nexport function offlineTestID (): NamedNode | null {\n const { $SolidTestEnvironment }: any = window\n if (\n typeof $SolidTestEnvironment !== 'undefined' &&\n $SolidTestEnvironment.username\n ) {\n // Test setup\n debug.log('Assuming the user is ' + $SolidTestEnvironment.username)\n return sym($SolidTestEnvironment.username)\n }\n // hack that makes SolidOS work in offline mode by adding the webId directly in html\n // example usage: https://github.com/solidos/mashlib/blob/29b8b53c46bf02e0e219f0bacd51b0e9951001dd/test/contact/local.html#L37\n if (\n typeof document !== 'undefined' &&\n document.location &&\n ('' + document.location).slice(0, 16) === 'http://localhost'\n ) {\n const div = document.getElementById('appTarget')\n if (!div) return null\n const id = div.getAttribute('testID')\n if (!id) return null\n debug.log('Assuming user is ' + id)\n return sym(id)\n }\n return null\n}\n"],"mappings":";;;AASA,IAAa,UAAuB;CAChC,IAAI,EAAE,uBAAyB;CAG/B,IAFA,MAAoB,CAAC,GACrB,EAAgB,oBAAoB,IAChC,EAAgB,UAAU,OAAO,YACb,OAAO,SAAS,SAAS,KAC7B,WAAW,EAAgB,MAAM,GAAG;EACpD,EAAgB,oBAAoB;EACpC,IAAM,IAAS,IAAI,gBAAgB,OAAO,SAAS,SAAS,MAAM;EAClE,IAAI,GAAQ;GACR,IAAI,IAAa,EAAgB,aAAa,EAAO,IAAI,KAAK,KAAK;GACnE,IAAI,MACJ,IAAa,UAAU,CAAU,GAC7B,CAAC,EAAW,WAAW,EAAgB,MAAM,IAAG;IAChD,IAAM,IAAM,EAAW,MAAM,IAAI;IAEjC,AADA,EAAgB,MAAM,EAAI,KAAK,OAAO,EAAI,IAC1C,EAAgB,oBAAoB;GACxC;EAEJ;CACA;CAEJ,OAAO;AACX;AASA,SAAgB,IAAmC;CAC/C,IAAM,EAAE,6BAA+B;CACvC,IACS,MAA0B,UACjC,EAAsB,UAItB,OADA,EAAU,0BAA0B,EAAsB,QAAQ,GAC3D,EAAI,EAAsB,QAAQ;CAI3C,IACE,OAAO,WAAa,OACpB,SAAS,aACR,KAAK,SAAS,SAAA,CAAU,MAAM,GAAG,EAAE,MAAM,oBAC1C;EACA,IAAM,IAAM,SAAS,eAAe,WAAW;EAC/C,IAAI,CAAC,GAAK,OAAO;EACjB,IAAM,IAAK,EAAI,aAAa,QAAQ;EAGpC,OAFK,KACL,EAAU,sBAAsB,CAAE,GAC3B,EAAI,CAAE,KAFG;CAGlB;CACA,OAAO;AACX"}
@@ -0,0 +1,2 @@
1
+ async function e(e={}){if(typeof window>`u`)return!1;let t=e.issuer||``,n=e.postLogoutRedirectPath||`/`;try{if(t){let e=new URL(t);e.pathname=`/.well-known/openid-configuration`;let n=await fetch(e.toString(),{credentials:`include`});if(n.status===200){let e=await n.json();e&&e.end_session_endpoint&&await fetch(e.end_session_endpoint,{credentials:`include`})}}}catch{}try{let e=await fetch(`/.well-known/solid/logout`,{credentials:`include`});if(e.ok||e.redirected)return window.location.assign(n),!0}catch{}return!1}exports.performServerSideLogout=e;
2
+ //# sourceMappingURL=serverLogout.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverLogout.cjs.js","names":[],"sources":["../../src/authn/serverLogout.ts"],"sourcesContent":["export type ServerLogoutOptions = {\n issuer?: string\n postLogoutRedirectPath?: string\n}\n\nexport async function performServerSideLogout (options: ServerLogoutOptions = {}): Promise<boolean> {\n if (typeof window === 'undefined') {\n return false\n }\n const issuer = options.issuer || ''\n const postLogoutRedirectPath = options.postLogoutRedirectPath || '/'\n\n // Provider-specific logout endpoint discovery (OIDC end_session_endpoint).\n try {\n if (issuer) {\n const wellKnownUri = new URL(issuer)\n wellKnownUri.pathname = '/.well-known/openid-configuration'\n const wellKnownResult = await fetch(wellKnownUri.toString(), { credentials: 'include' })\n\n if (wellKnownResult.status === 200) {\n const openidConfiguration = await wellKnownResult.json()\n if (openidConfiguration && openidConfiguration.end_session_endpoint) {\n await fetch(openidConfiguration.end_session_endpoint, { credentials: 'include' })\n }\n }\n }\n } catch (_err) {\n // Continue with local logout even if provider logout is unavailable.\n }\n\n // NSS well-known logout endpoint clears cookie-backed server sessions.\n try {\n const logoutResponse = await fetch('/.well-known/solid/logout', { credentials: 'include' })\n if (logoutResponse.ok || logoutResponse.redirected) {\n window.location.assign(postLogoutRedirectPath)\n return true\n }\n } catch (_err) {\n // Not all deployments expose this endpoint.\n }\n\n return false\n}"],"mappings":"AAKA,eAAsB,EAAyB,EAA+B,CAAC,EAAqB,CAClG,GAAI,OAAO,OAAW,IACpB,MAAO,GAET,IAAM,EAAS,EAAQ,QAAU,GAC3B,EAAyB,EAAQ,wBAA0B,IAGjE,GAAI,CACF,GAAI,EAAQ,CACV,IAAM,EAAe,IAAI,IAAI,CAAM,EACnC,EAAa,SAAW,oCACxB,IAAM,EAAkB,MAAM,MAAM,EAAa,SAAS,EAAG,CAAE,YAAa,SAAU,CAAC,EAEvF,GAAI,EAAgB,SAAW,IAAK,CAClC,IAAM,EAAsB,MAAM,EAAgB,KAAK,EACnD,GAAuB,EAAoB,sBAC7C,MAAM,MAAM,EAAoB,qBAAsB,CAAE,YAAa,SAAU,CAAC,CAEpF,CACF,CACF,MAAe,CAEf,CAGA,GAAI,CACF,IAAM,EAAiB,MAAM,MAAM,4BAA6B,CAAE,YAAa,SAAU,CAAC,EAC1F,GAAI,EAAe,IAAM,EAAe,WAEtC,OADA,OAAO,SAAS,OAAO,CAAsB,EACtC,EAEX,MAAe,CAEf,CAEA,MAAO,EACT"}
@@ -0,0 +1,25 @@
1
+ //#region src/authn/serverLogout.ts
2
+ async function e(e = {}) {
3
+ if (typeof window > "u") return !1;
4
+ let t = e.issuer || "", n = e.postLogoutRedirectPath || "/";
5
+ try {
6
+ if (t) {
7
+ let e = new URL(t);
8
+ e.pathname = "/.well-known/openid-configuration";
9
+ let n = await fetch(e.toString(), { credentials: "include" });
10
+ if (n.status === 200) {
11
+ let e = await n.json();
12
+ e && e.end_session_endpoint && await fetch(e.end_session_endpoint, { credentials: "include" });
13
+ }
14
+ }
15
+ } catch {}
16
+ try {
17
+ let e = await fetch("/.well-known/solid/logout", { credentials: "include" });
18
+ if (e.ok || e.redirected) return window.location.assign(n), !0;
19
+ } catch {}
20
+ return !1;
21
+ }
22
+ //#endregion
23
+ export { e as performServerSideLogout };
24
+
25
+ //# sourceMappingURL=serverLogout.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverLogout.esm.js","names":[],"sources":["../../src/authn/serverLogout.ts"],"sourcesContent":["export type ServerLogoutOptions = {\n issuer?: string\n postLogoutRedirectPath?: string\n}\n\nexport async function performServerSideLogout (options: ServerLogoutOptions = {}): Promise<boolean> {\n if (typeof window === 'undefined') {\n return false\n }\n const issuer = options.issuer || ''\n const postLogoutRedirectPath = options.postLogoutRedirectPath || '/'\n\n // Provider-specific logout endpoint discovery (OIDC end_session_endpoint).\n try {\n if (issuer) {\n const wellKnownUri = new URL(issuer)\n wellKnownUri.pathname = '/.well-known/openid-configuration'\n const wellKnownResult = await fetch(wellKnownUri.toString(), { credentials: 'include' })\n\n if (wellKnownResult.status === 200) {\n const openidConfiguration = await wellKnownResult.json()\n if (openidConfiguration && openidConfiguration.end_session_endpoint) {\n await fetch(openidConfiguration.end_session_endpoint, { credentials: 'include' })\n }\n }\n }\n } catch (_err) {\n // Continue with local logout even if provider logout is unavailable.\n }\n\n // NSS well-known logout endpoint clears cookie-backed server sessions.\n try {\n const logoutResponse = await fetch('/.well-known/solid/logout', { credentials: 'include' })\n if (logoutResponse.ok || logoutResponse.redirected) {\n window.location.assign(postLogoutRedirectPath)\n return true\n }\n } catch (_err) {\n // Not all deployments expose this endpoint.\n }\n\n return false\n}"],"mappings":";AAKA,eAAsB,EAAyB,IAA+B,CAAC,GAAqB;CAClG,IAAI,OAAO,SAAW,KACpB,OAAO;CAET,IAAM,IAAS,EAAQ,UAAU,IAC3B,IAAyB,EAAQ,0BAA0B;CAGjE,IAAI;EACF,IAAI,GAAQ;GACV,IAAM,IAAe,IAAI,IAAI,CAAM;GACnC,EAAa,WAAW;GACxB,IAAM,IAAkB,MAAM,MAAM,EAAa,SAAS,GAAG,EAAE,aAAa,UAAU,CAAC;GAEvF,IAAI,EAAgB,WAAW,KAAK;IAClC,IAAM,IAAsB,MAAM,EAAgB,KAAK;IACvD,AAAI,KAAuB,EAAoB,wBAC7C,MAAM,MAAM,EAAoB,sBAAsB,EAAE,aAAa,UAAU,CAAC;GAEpF;EACF;CACF,QAAe,CAEf;CAGA,IAAI;EACF,IAAM,IAAiB,MAAM,MAAM,6BAA6B,EAAE,aAAa,UAAU,CAAC;EAC1F,IAAI,EAAe,MAAM,EAAe,YAEtC,OADA,OAAO,SAAS,OAAO,CAAsB,GACtC;CAEX,QAAe,CAEf;CAEA,OAAO;AACT"}
@@ -0,0 +1,21 @@
1
+ const e=require("../util/ns.cjs.js"),t=require("../util/utils.cjs.js");let n=require("rdflib");var r=`index.ttl#this`;function i(i,a){let o=e.ns;async function s(e,t,r){await i.fetcher.load(e);let a=i.any(e,new n.NamedNode(`http://www.iana.org/assignments/link-relations/acl`));if(!a)throw Error(`Chat ACL doc not found!`);let o=`
2
+ @prefix acl: <http://www.w3.org/ns/auth/acl#>.
3
+ <#owner>
4
+ a acl:Authorization;
5
+ acl:agent <${t.value}>;
6
+ acl:accessTo <.>;
7
+ acl:default <.>;
8
+ acl:mode
9
+ acl:Read, acl:Write, acl:Control.
10
+ <#invitee>
11
+ a acl:Authorization;
12
+ acl:agent <${r.value}>;
13
+ acl:accessTo <.>;
14
+ acl:default <.>;
15
+ acl:mode
16
+ acl:Read, acl:Append.
17
+ `;await i.fetcher.webOperation(`PUT`,a.value,{data:o,contentType:`text/turtle`})}async function c(e,r){let a=i.any(r,o.solid(`privateTypeIndex`));if(!a)throw Error(`Private type index not found!`);await i.fetcher.load(a);let s=t.newThing(a),c=[(0,n.st)(s,o.rdf(`type`),o.solid(`TypeRegistration`),a.doc()),(0,n.st)(s,o.solid(`forClass`),o.meeting(`LongChat`),a.doc()),(0,n.st)(s,o.solid(`instance`),e,a.doc())];await new Promise((e,t)=>{i.updater.update([],c,function(n,r,i){r?e(null):t(Error(i))})})}async function l(e){let r=await a.loadMe(),o=t.determineChatContainer(e,await a.getPodRoot(r)),s=!0;try{await i.fetcher.load(new n.NamedNode(o.value+`index.ttl#this`))}catch{s=!1}return{me:r,chatContainer:o,exists:s}}async function u(e,t){return(await d({me:t,newBase:e.value})).newInstance}function d(e){let t=i,a=t.updater;if(e.me&&!e.me.uri)throw Error(`chat mintNew: Invalid userid `+e.me);let s=e.newInstance=e.newInstance||t.sym(e.newBase+r),c=s.doc();return t.add(s,o.rdf(`type`),o.meeting(`LongChat`),c),t.add(s,o.dc(`title`),`Chat channel`,c),t.add(s,o.dc(`created`),(0,n.term)(new Date(Date.now())),c),e.me&&t.add(s,o.dc(`author`),e.me,c),new Promise(function(n,r){a?.put(c,t.statementsMatching(void 0,void 0,void 0,c),`text/turtle`,function(t,i,a){i?n({...e,newInstance:s}):r(Error(`FAILED to save new chat channel at: `+t+` : `+a))})})}async function f(e,t=!0){let{me:i,chatContainer:a,exists:o}=await l(e);if(o)return new n.NamedNode(a.value+r);if(t){let t=await u(a,i);return await p(e,t),await s(a,i,e),await c(t,i),t}return null}async function p(e,t){await i.fetcher.load(e.doc());let n=i.any(e,o.ldp(`inbox`),void 0,e.doc());if(!n)throw Error(`Invitee inbox not found! ${e.value}`);let r=`
18
+ <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;
19
+ ${o.rdf(`seeAlso`)} <${t.value}> .
20
+ `,a=await i.fetcher?.webOperation(`POST`,n.value,{data:r,contentType:`text/turtle`});if(!a?.headers.get(`location`))throw Error(`Invite sending returned a ${a?.status}`)}return{setAcl:s,addToPrivateTypeIndex:c,findChat:l,createChatThing:u,getChat:f,sendInvite:p,mintNew:d}}exports.createChatLogic=i;
21
+ //# sourceMappingURL=chatLogic.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatLogic.cjs.js","names":[],"sources":["../../src/chat/chatLogic.ts"],"sourcesContent":["import { NamedNode, Node, st, term } from 'rdflib'\nimport { ChatLogic, CreatedPaneOptions, NewPaneOptions, Chat } from '../types'\nimport { ns as namespace } from '../util/ns'\nimport { determineChatContainer, newThing } from '../util/utils'\n\nconst CHAT_LOCATION_IN_CONTAINER = 'index.ttl#this'\n\nexport function createChatLogic(store, profileLogic): ChatLogic {\n const ns = namespace\n\n async function setAcl(\n chatContainer: NamedNode,\n me: NamedNode,\n invitee: NamedNode\n ): Promise<void> {\n // Some servers don't present a Link http response header\n // if the container doesn't exist yet, so refetch the container\n // now that it has been created:\n await store.fetcher.load(chatContainer)\n\n // FIXME: check the Why value on this quad:\n const chatAclDoc = store.any(\n chatContainer,\n new NamedNode('http://www.iana.org/assignments/link-relations/acl')\n )\n if (!chatAclDoc) {\n throw new Error('Chat ACL doc not found!')\n }\n\n const aclBody = `\n @prefix acl: <http://www.w3.org/ns/auth/acl#>.\n <#owner>\n a acl:Authorization;\n acl:agent <${me.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Write, acl:Control.\n <#invitee>\n a acl:Authorization;\n acl:agent <${invitee.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Append.\n `\n await store.fetcher.webOperation('PUT', chatAclDoc.value, {\n data: aclBody,\n contentType: 'text/turtle',\n })\n }\n\n async function addToPrivateTypeIndex(chatThing, me) {\n // Add to private type index\n const privateTypeIndex = store.any(\n me,\n ns.solid('privateTypeIndex')\n ) as NamedNode | null\n if (!privateTypeIndex) {\n throw new Error('Private type index not found!')\n }\n await store.fetcher.load(privateTypeIndex)\n const reg = newThing(privateTypeIndex)\n const ins = [\n st(\n reg,\n ns.rdf('type'),\n ns.solid('TypeRegistration'),\n privateTypeIndex.doc()\n ),\n st(\n reg,\n ns.solid('forClass'),\n ns.meeting('LongChat'),\n privateTypeIndex.doc()\n ),\n st(reg, ns.solid('instance'), chatThing, privateTypeIndex.doc()),\n ]\n await new Promise((resolve, reject) => {\n store.updater.update([], ins, function (_uri, ok, errm) {\n if (!ok) {\n reject(new Error(errm))\n } else {\n resolve(null)\n }\n })\n })\n }\n\n async function findChat(invitee: NamedNode): Promise<Chat> {\n const me = await profileLogic.loadMe()\n const podRoot = await profileLogic.getPodRoot(me)\n const chatContainer = determineChatContainer(invitee, podRoot)\n let exists = true\n try {\n await store.fetcher.load(\n new NamedNode(chatContainer.value + 'index.ttl#this')\n )\n } catch (e) {\n exists = false\n }\n return { me, chatContainer, exists }\n }\n\n async function createChatThing(\n chatContainer: NamedNode,\n me: NamedNode\n ): Promise<NamedNode> {\n const created = await mintNew({\n me,\n newBase: chatContainer.value,\n })\n return created.newInstance\n }\n\n function mintNew(newPaneOptions: NewPaneOptions): Promise<CreatedPaneOptions> {\n const kb = store\n const updater = kb.updater\n if (newPaneOptions.me && !newPaneOptions.me.uri) {\n throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)\n }\n\n const newInstance = (newPaneOptions.newInstance =\n newPaneOptions.newInstance ||\n kb.sym(newPaneOptions.newBase + CHAT_LOCATION_IN_CONTAINER))\n const newChatDoc = newInstance.doc()\n\n kb.add(\n newInstance,\n ns.rdf('type'),\n ns.meeting('LongChat'),\n newChatDoc\n )\n kb.add(newInstance, ns.dc('title'), 'Chat channel', newChatDoc)\n kb.add(\n newInstance,\n ns.dc('created'),\n term<Node>(new Date(Date.now())),\n newChatDoc\n )\n if (newPaneOptions.me) {\n kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)\n }\n\n return new Promise(function (resolve, reject) {\n updater?.put(\n newChatDoc,\n kb.statementsMatching(undefined, undefined, undefined, newChatDoc),\n 'text/turtle',\n function (uri2, ok, message) {\n if (ok) {\n resolve({\n ...newPaneOptions,\n newInstance,\n })\n } else {\n reject(\n new Error(\n 'FAILED to save new chat channel at: ' + uri2 + ' : ' + message\n )\n )\n }\n }\n )\n })\n }\n\n /**\n * Find (and optionally create) an individual chat between the current user and the given invitee\n * @param invitee - The person to chat with\n * @param createIfMissing - Whether the chat should be created, if missing\n * @returns null if missing, or a node referring to an already existing chat, or the newly created chat\n */\n async function getChat(\n invitee: NamedNode,\n createIfMissing = true\n ): Promise<NamedNode | null> {\n const { me, chatContainer, exists } = await findChat(invitee)\n if (exists) {\n return new NamedNode(chatContainer.value + CHAT_LOCATION_IN_CONTAINER)\n }\n\n if (createIfMissing) {\n const chatThing = await createChatThing(chatContainer, me)\n await sendInvite(invitee, chatThing)\n await setAcl(chatContainer, me, invitee)\n await addToPrivateTypeIndex(chatThing, me)\n return chatThing\n }\n return null\n }\n\n async function sendInvite(invitee: NamedNode, chatThing: NamedNode) {\n await store.fetcher.load(invitee.doc())\n const inviteeInbox = store.any(\n invitee,\n ns.ldp('inbox'),\n undefined,\n invitee.doc()\n )\n if (!inviteeInbox) {\n throw new Error(`Invitee inbox not found! ${invitee.value}`)\n }\n const inviteBody = `\n <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;\n ${ns.rdf('seeAlso')} <${chatThing.value}> .\n `\n\n const inviteResponse = await store.fetcher?.webOperation(\n 'POST',\n inviteeInbox.value,\n {\n data: inviteBody,\n contentType: 'text/turtle',\n }\n )\n const locationStr = inviteResponse?.headers.get('location')\n if (!locationStr) {\n throw new Error(`Invite sending returned a ${inviteResponse?.status}`)\n }\n }\n return {\n setAcl, addToPrivateTypeIndex, findChat, createChatThing, getChat, sendInvite, mintNew\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,116 @@
1
+ import { ns as e } from "../util/ns.esm.js";
2
+ import { determineChatContainer as t, newThing as n } from "../util/utils.esm.js";
3
+ import { NamedNode as r, st as i, term as a } from "rdflib";
4
+ //#region src/chat/chatLogic.ts
5
+ var o = "index.ttl#this";
6
+ function s(s, c) {
7
+ let l = e;
8
+ async function u(e, t, n) {
9
+ await s.fetcher.load(e);
10
+ let i = s.any(e, new r("http://www.iana.org/assignments/link-relations/acl"));
11
+ if (!i) throw Error("Chat ACL doc not found!");
12
+ let a = `
13
+ @prefix acl: <http://www.w3.org/ns/auth/acl#>.
14
+ <#owner>
15
+ a acl:Authorization;
16
+ acl:agent <${t.value}>;
17
+ acl:accessTo <.>;
18
+ acl:default <.>;
19
+ acl:mode
20
+ acl:Read, acl:Write, acl:Control.
21
+ <#invitee>
22
+ a acl:Authorization;
23
+ acl:agent <${n.value}>;
24
+ acl:accessTo <.>;
25
+ acl:default <.>;
26
+ acl:mode
27
+ acl:Read, acl:Append.
28
+ `;
29
+ await s.fetcher.webOperation("PUT", i.value, {
30
+ data: a,
31
+ contentType: "text/turtle"
32
+ });
33
+ }
34
+ async function d(e, t) {
35
+ let r = s.any(t, l.solid("privateTypeIndex"));
36
+ if (!r) throw Error("Private type index not found!");
37
+ await s.fetcher.load(r);
38
+ let a = n(r), o = [
39
+ i(a, l.rdf("type"), l.solid("TypeRegistration"), r.doc()),
40
+ i(a, l.solid("forClass"), l.meeting("LongChat"), r.doc()),
41
+ i(a, l.solid("instance"), e, r.doc())
42
+ ];
43
+ await new Promise((e, t) => {
44
+ s.updater.update([], o, function(n, r, i) {
45
+ r ? e(null) : t(Error(i));
46
+ });
47
+ });
48
+ }
49
+ async function f(e) {
50
+ let n = await c.loadMe(), i = t(e, await c.getPodRoot(n)), a = !0;
51
+ try {
52
+ await s.fetcher.load(new r(i.value + "index.ttl#this"));
53
+ } catch {
54
+ a = !1;
55
+ }
56
+ return {
57
+ me: n,
58
+ chatContainer: i,
59
+ exists: a
60
+ };
61
+ }
62
+ async function p(e, t) {
63
+ return (await m({
64
+ me: t,
65
+ newBase: e.value
66
+ })).newInstance;
67
+ }
68
+ function m(e) {
69
+ let t = s, n = t.updater;
70
+ if (e.me && !e.me.uri) throw Error("chat mintNew: Invalid userid " + e.me);
71
+ let r = e.newInstance = e.newInstance || t.sym(e.newBase + o), i = r.doc();
72
+ return t.add(r, l.rdf("type"), l.meeting("LongChat"), i), t.add(r, l.dc("title"), "Chat channel", i), t.add(r, l.dc("created"), a(new Date(Date.now())), i), e.me && t.add(r, l.dc("author"), e.me, i), new Promise(function(a, o) {
73
+ n?.put(i, t.statementsMatching(void 0, void 0, void 0, i), "text/turtle", function(t, n, i) {
74
+ n ? a({
75
+ ...e,
76
+ newInstance: r
77
+ }) : o(/* @__PURE__ */ Error("FAILED to save new chat channel at: " + t + " : " + i));
78
+ });
79
+ });
80
+ }
81
+ async function h(e, t = !0) {
82
+ let { me: n, chatContainer: i, exists: a } = await f(e);
83
+ if (a) return new r(i.value + o);
84
+ if (t) {
85
+ let t = await p(i, n);
86
+ return await g(e, t), await u(i, n, e), await d(t, n), t;
87
+ }
88
+ return null;
89
+ }
90
+ async function g(e, t) {
91
+ await s.fetcher.load(e.doc());
92
+ let n = s.any(e, l.ldp("inbox"), void 0, e.doc());
93
+ if (!n) throw Error(`Invitee inbox not found! ${e.value}`);
94
+ let r = `
95
+ <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;
96
+ ${l.rdf("seeAlso")} <${t.value}> .
97
+ `, i = await s.fetcher?.webOperation("POST", n.value, {
98
+ data: r,
99
+ contentType: "text/turtle"
100
+ });
101
+ if (!i?.headers.get("location")) throw Error(`Invite sending returned a ${i?.status}`);
102
+ }
103
+ return {
104
+ setAcl: u,
105
+ addToPrivateTypeIndex: d,
106
+ findChat: f,
107
+ createChatThing: p,
108
+ getChat: h,
109
+ sendInvite: g,
110
+ mintNew: m
111
+ };
112
+ }
113
+ //#endregion
114
+ export { s as createChatLogic };
115
+
116
+ //# sourceMappingURL=chatLogic.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatLogic.esm.js","names":[],"sources":["../../src/chat/chatLogic.ts"],"sourcesContent":["import { NamedNode, Node, st, term } from 'rdflib'\nimport { ChatLogic, CreatedPaneOptions, NewPaneOptions, Chat } from '../types'\nimport { ns as namespace } from '../util/ns'\nimport { determineChatContainer, newThing } from '../util/utils'\n\nconst CHAT_LOCATION_IN_CONTAINER = 'index.ttl#this'\n\nexport function createChatLogic(store, profileLogic): ChatLogic {\n const ns = namespace\n\n async function setAcl(\n chatContainer: NamedNode,\n me: NamedNode,\n invitee: NamedNode\n ): Promise<void> {\n // Some servers don't present a Link http response header\n // if the container doesn't exist yet, so refetch the container\n // now that it has been created:\n await store.fetcher.load(chatContainer)\n\n // FIXME: check the Why value on this quad:\n const chatAclDoc = store.any(\n chatContainer,\n new NamedNode('http://www.iana.org/assignments/link-relations/acl')\n )\n if (!chatAclDoc) {\n throw new Error('Chat ACL doc not found!')\n }\n\n const aclBody = `\n @prefix acl: <http://www.w3.org/ns/auth/acl#>.\n <#owner>\n a acl:Authorization;\n acl:agent <${me.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Write, acl:Control.\n <#invitee>\n a acl:Authorization;\n acl:agent <${invitee.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Append.\n `\n await store.fetcher.webOperation('PUT', chatAclDoc.value, {\n data: aclBody,\n contentType: 'text/turtle',\n })\n }\n\n async function addToPrivateTypeIndex(chatThing, me) {\n // Add to private type index\n const privateTypeIndex = store.any(\n me,\n ns.solid('privateTypeIndex')\n ) as NamedNode | null\n if (!privateTypeIndex) {\n throw new Error('Private type index not found!')\n }\n await store.fetcher.load(privateTypeIndex)\n const reg = newThing(privateTypeIndex)\n const ins = [\n st(\n reg,\n ns.rdf('type'),\n ns.solid('TypeRegistration'),\n privateTypeIndex.doc()\n ),\n st(\n reg,\n ns.solid('forClass'),\n ns.meeting('LongChat'),\n privateTypeIndex.doc()\n ),\n st(reg, ns.solid('instance'), chatThing, privateTypeIndex.doc()),\n ]\n await new Promise((resolve, reject) => {\n store.updater.update([], ins, function (_uri, ok, errm) {\n if (!ok) {\n reject(new Error(errm))\n } else {\n resolve(null)\n }\n })\n })\n }\n\n async function findChat(invitee: NamedNode): Promise<Chat> {\n const me = await profileLogic.loadMe()\n const podRoot = await profileLogic.getPodRoot(me)\n const chatContainer = determineChatContainer(invitee, podRoot)\n let exists = true\n try {\n await store.fetcher.load(\n new NamedNode(chatContainer.value + 'index.ttl#this')\n )\n } catch (e) {\n exists = false\n }\n return { me, chatContainer, exists }\n }\n\n async function createChatThing(\n chatContainer: NamedNode,\n me: NamedNode\n ): Promise<NamedNode> {\n const created = await mintNew({\n me,\n newBase: chatContainer.value,\n })\n return created.newInstance\n }\n\n function mintNew(newPaneOptions: NewPaneOptions): Promise<CreatedPaneOptions> {\n const kb = store\n const updater = kb.updater\n if (newPaneOptions.me && !newPaneOptions.me.uri) {\n throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)\n }\n\n const newInstance = (newPaneOptions.newInstance =\n newPaneOptions.newInstance ||\n kb.sym(newPaneOptions.newBase + CHAT_LOCATION_IN_CONTAINER))\n const newChatDoc = newInstance.doc()\n\n kb.add(\n newInstance,\n ns.rdf('type'),\n ns.meeting('LongChat'),\n newChatDoc\n )\n kb.add(newInstance, ns.dc('title'), 'Chat channel', newChatDoc)\n kb.add(\n newInstance,\n ns.dc('created'),\n term<Node>(new Date(Date.now())),\n newChatDoc\n )\n if (newPaneOptions.me) {\n kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)\n }\n\n return new Promise(function (resolve, reject) {\n updater?.put(\n newChatDoc,\n kb.statementsMatching(undefined, undefined, undefined, newChatDoc),\n 'text/turtle',\n function (uri2, ok, message) {\n if (ok) {\n resolve({\n ...newPaneOptions,\n newInstance,\n })\n } else {\n reject(\n new Error(\n 'FAILED to save new chat channel at: ' + uri2 + ' : ' + message\n )\n )\n }\n }\n )\n })\n }\n\n /**\n * Find (and optionally create) an individual chat between the current user and the given invitee\n * @param invitee - The person to chat with\n * @param createIfMissing - Whether the chat should be created, if missing\n * @returns null if missing, or a node referring to an already existing chat, or the newly created chat\n */\n async function getChat(\n invitee: NamedNode,\n createIfMissing = true\n ): Promise<NamedNode | null> {\n const { me, chatContainer, exists } = await findChat(invitee)\n if (exists) {\n return new NamedNode(chatContainer.value + CHAT_LOCATION_IN_CONTAINER)\n }\n\n if (createIfMissing) {\n const chatThing = await createChatThing(chatContainer, me)\n await sendInvite(invitee, chatThing)\n await setAcl(chatContainer, me, invitee)\n await addToPrivateTypeIndex(chatThing, me)\n return chatThing\n }\n return null\n }\n\n async function sendInvite(invitee: NamedNode, chatThing: NamedNode) {\n await store.fetcher.load(invitee.doc())\n const inviteeInbox = store.any(\n invitee,\n ns.ldp('inbox'),\n undefined,\n invitee.doc()\n )\n if (!inviteeInbox) {\n throw new Error(`Invitee inbox not found! ${invitee.value}`)\n }\n const inviteBody = `\n <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;\n ${ns.rdf('seeAlso')} <${chatThing.value}> .\n `\n\n const inviteResponse = await store.fetcher?.webOperation(\n 'POST',\n inviteeInbox.value,\n {\n data: inviteBody,\n contentType: 'text/turtle',\n }\n )\n const locationStr = inviteResponse?.headers.get('location')\n if (!locationStr) {\n throw new Error(`Invite sending returned a ${inviteResponse?.status}`)\n }\n }\n return {\n setAcl, addToPrivateTypeIndex, findChat, createChatThing, getChat, sendInvite, mintNew\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ const e=require("../util/utils.cjs.js");function t(t,n,r,i,a){async function o(e,t){let a=await n.loadMe(),o=`${(await n.getPodRoot(a)).value}p2p-inboxes/${encodeURIComponent(t)}/`;return await i.createContainer(o),await r.setSinglePeerAccess({ownerWebId:a.value,peerWebId:e,accessToModes:`acl:Append`,target:o}),o}async function s(e){e||=await n.loadMe();let t=await n.getMainInbox(e);return(await i.getContainerMembers(t)).filter(e=>!i.isContainer(e))}async function c(n,r){let i=await t.fetcher._fetch(n);if(i.status!==200)throw Error(`Not OK! ${n}`);let a=e.getArchiveUrl(n,r),o={method:`PUT`,body:await i.text(),headers:[[`Content-Type`,i.headers.get(`Content-Type`)||`application/octet-stream`]]};(await t.fetcher._fetch(a,o)).status.toString()[0]===`2`&&await t.fetcher._fetch(n,{method:`DELETE`})}return{createInboxFor:o,getNewMessages:s,markAsRead:c}}exports.createInboxLogic=t;
2
+ //# sourceMappingURL=inboxLogic.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inboxLogic.cjs.js","names":[],"sources":["../../src/inbox/inboxLogic.ts"],"sourcesContent":["import { NamedNode } from 'rdflib'\nimport { InboxLogic } from '../types'\nimport { getArchiveUrl } from '../util/utils'\n\nexport function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic): InboxLogic {\n\n async function createInboxFor(peerWebId: string, nick: string) {\n const myWebId: NamedNode = await profileLogic.loadMe()\n const podRoot: NamedNode = await profileLogic.getPodRoot(myWebId)\n const ourInbox = `${podRoot.value}p2p-inboxes/${encodeURIComponent(nick)}/`\n await containerLogic.createContainer(ourInbox)\n // const aclDocUrl = await aclLogic.findAclDocUrl(ourInbox);\n await utilityLogic.setSinglePeerAccess({\n ownerWebId: myWebId.value,\n peerWebId,\n accessToModes: 'acl:Append',\n target: ourInbox\n })\n return ourInbox\n }\n\n async function getNewMessages(\n user?: NamedNode\n ): Promise<NamedNode[]> {\n if (!user) {\n user = await profileLogic.loadMe()\n }\n const inbox = await profileLogic.getMainInbox(user)\n const urls = await containerLogic.getContainerMembers(inbox)\n return urls.filter(url => !containerLogic.isContainer(url))\n }\n\n async function markAsRead(url: string, date: Date) {\n const downloaded = await store.fetcher._fetch(url)\n if (downloaded.status !== 200) {\n throw new Error(`Not OK! ${url}`)\n }\n const archiveUrl = getArchiveUrl(url, date)\n const options = {\n method: 'PUT',\n body: await downloaded.text(),\n headers: [\n ['Content-Type', downloaded.headers.get('Content-Type') || 'application/octet-stream']\n ]\n }\n const uploaded = await store.fetcher._fetch(archiveUrl, options)\n if (uploaded.status.toString()[0] === '2') {\n await store.fetcher._fetch(url, {\n method: 'DELETE'\n })\n }\n }\n return {\n createInboxFor,\n getNewMessages,\n markAsRead\n }\n}\n"],"mappings":"wCAIA,SAAgB,EAAiB,EAAO,EAAc,EAAc,EAAgB,EAAsB,CAEtG,eAAe,EAAe,EAAmB,EAAc,CAC7D,IAAM,EAAqB,MAAM,EAAa,OAAO,EAE/C,EAAW,IAAG,MADa,EAAa,WAAW,CAAO,EAAA,CACpC,MAAM,cAAc,mBAAmB,CAAI,EAAE,GASzE,OARA,MAAM,EAAe,gBAAgB,CAAQ,EAE7C,MAAM,EAAa,oBAAoB,CACrC,WAAY,EAAQ,MACpB,YACA,cAAe,aACf,OAAQ,CACV,CAAC,EACM,CACX,CAEA,eAAe,EACX,EACsB,CACtB,AACE,IAAO,MAAM,EAAa,OAAO,EAEnC,IAAM,EAAQ,MAAM,EAAa,aAAa,CAAI,EAElD,OAAO,MADY,EAAe,oBAAoB,CAAK,EAAA,CAC/C,OAAO,GAAO,CAAC,EAAe,YAAY,CAAG,CAAC,CAC9D,CAEA,eAAe,EAAW,EAAa,EAAY,CACjD,IAAM,EAAa,MAAM,EAAM,QAAQ,OAAO,CAAG,EACjD,GAAI,EAAW,SAAW,IACxB,MAAU,MAAM,WAAW,GAAK,EAElC,IAAM,EAAa,EAAA,cAAc,EAAK,CAAI,EACpC,EAAU,CACd,OAAQ,MACR,KAAM,MAAM,EAAW,KAAK,EAC5B,QAAS,CACP,CAAC,eAAgB,EAAW,QAAQ,IAAI,cAAc,GAAK,0BAA0B,CACvF,CACF,GAEI,MADmB,EAAM,QAAQ,OAAO,EAAY,CAAO,EAAA,CAClD,OAAO,SAAS,CAAC,CAAC,KAAO,KACpC,MAAM,EAAM,QAAQ,OAAO,EAAK,CAC9B,OAAQ,QACV,CAAC,CAEL,CACA,MAAO,CACL,iBACA,iBACA,YACF,CACF"}
@@ -0,0 +1,37 @@
1
+ import { getArchiveUrl as e } from "../util/utils.esm.js";
2
+ //#region src/inbox/inboxLogic.ts
3
+ function t(t, n, r, i, a) {
4
+ async function o(e, t) {
5
+ let a = await n.loadMe(), o = `${(await n.getPodRoot(a)).value}p2p-inboxes/${encodeURIComponent(t)}/`;
6
+ return await i.createContainer(o), await r.setSinglePeerAccess({
7
+ ownerWebId: a.value,
8
+ peerWebId: e,
9
+ accessToModes: "acl:Append",
10
+ target: o
11
+ }), o;
12
+ }
13
+ async function s(e) {
14
+ e ||= await n.loadMe();
15
+ let t = await n.getMainInbox(e);
16
+ return (await i.getContainerMembers(t)).filter((e) => !i.isContainer(e));
17
+ }
18
+ async function c(n, r) {
19
+ let i = await t.fetcher._fetch(n);
20
+ if (i.status !== 200) throw Error(`Not OK! ${n}`);
21
+ let a = e(n, r), o = {
22
+ method: "PUT",
23
+ body: await i.text(),
24
+ headers: [["Content-Type", i.headers.get("Content-Type") || "application/octet-stream"]]
25
+ };
26
+ (await t.fetcher._fetch(a, o)).status.toString()[0] === "2" && await t.fetcher._fetch(n, { method: "DELETE" });
27
+ }
28
+ return {
29
+ createInboxFor: o,
30
+ getNewMessages: s,
31
+ markAsRead: c
32
+ };
33
+ }
34
+ //#endregion
35
+ export { t as createInboxLogic };
36
+
37
+ //# sourceMappingURL=inboxLogic.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inboxLogic.esm.js","names":[],"sources":["../../src/inbox/inboxLogic.ts"],"sourcesContent":["import { NamedNode } from 'rdflib'\nimport { InboxLogic } from '../types'\nimport { getArchiveUrl } from '../util/utils'\n\nexport function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic): InboxLogic {\n\n async function createInboxFor(peerWebId: string, nick: string) {\n const myWebId: NamedNode = await profileLogic.loadMe()\n const podRoot: NamedNode = await profileLogic.getPodRoot(myWebId)\n const ourInbox = `${podRoot.value}p2p-inboxes/${encodeURIComponent(nick)}/`\n await containerLogic.createContainer(ourInbox)\n // const aclDocUrl = await aclLogic.findAclDocUrl(ourInbox);\n await utilityLogic.setSinglePeerAccess({\n ownerWebId: myWebId.value,\n peerWebId,\n accessToModes: 'acl:Append',\n target: ourInbox\n })\n return ourInbox\n }\n\n async function getNewMessages(\n user?: NamedNode\n ): Promise<NamedNode[]> {\n if (!user) {\n user = await profileLogic.loadMe()\n }\n const inbox = await profileLogic.getMainInbox(user)\n const urls = await containerLogic.getContainerMembers(inbox)\n return urls.filter(url => !containerLogic.isContainer(url))\n }\n\n async function markAsRead(url: string, date: Date) {\n const downloaded = await store.fetcher._fetch(url)\n if (downloaded.status !== 200) {\n throw new Error(`Not OK! ${url}`)\n }\n const archiveUrl = getArchiveUrl(url, date)\n const options = {\n method: 'PUT',\n body: await downloaded.text(),\n headers: [\n ['Content-Type', downloaded.headers.get('Content-Type') || 'application/octet-stream']\n ]\n }\n const uploaded = await store.fetcher._fetch(archiveUrl, options)\n if (uploaded.status.toString()[0] === '2') {\n await store.fetcher._fetch(url, {\n method: 'DELETE'\n })\n }\n }\n return {\n createInboxFor,\n getNewMessages,\n markAsRead\n }\n}\n"],"mappings":";;AAIA,SAAgB,EAAiB,GAAO,GAAc,GAAc,GAAgB,GAAsB;CAEtG,eAAe,EAAe,GAAmB,GAAc;EAC7D,IAAM,IAAqB,MAAM,EAAa,OAAO,GAE/C,IAAW,IAAG,MADa,EAAa,WAAW,CAAO,EAAA,CACpC,MAAM,cAAc,mBAAmB,CAAI,EAAE;EASzE,OARA,MAAM,EAAe,gBAAgB,CAAQ,GAE7C,MAAM,EAAa,oBAAoB;GACrC,YAAY,EAAQ;GACpB;GACA,eAAe;GACf,QAAQ;EACV,CAAC,GACM;CACX;CAEA,eAAe,EACX,GACsB;EACtB,AACE,MAAO,MAAM,EAAa,OAAO;EAEnC,IAAM,IAAQ,MAAM,EAAa,aAAa,CAAI;EAElD,QAAO,MADY,EAAe,oBAAoB,CAAK,EAAA,CAC/C,QAAO,MAAO,CAAC,EAAe,YAAY,CAAG,CAAC;CAC9D;CAEA,eAAe,EAAW,GAAa,GAAY;EACjD,IAAM,IAAa,MAAM,EAAM,QAAQ,OAAO,CAAG;EACjD,IAAI,EAAW,WAAW,KACxB,MAAU,MAAM,WAAW,GAAK;EAElC,IAAM,IAAa,EAAc,GAAK,CAAI,GACpC,IAAU;GACd,QAAQ;GACR,MAAM,MAAM,EAAW,KAAK;GAC5B,SAAS,CACP,CAAC,gBAAgB,EAAW,QAAQ,IAAI,cAAc,KAAK,0BAA0B,CACvF;EACF;EAEA,CAAI,MADmB,EAAM,QAAQ,OAAO,GAAY,CAAO,EAAA,CAClD,OAAO,SAAS,CAAC,CAAC,OAAO,OACpC,MAAM,EAAM,QAAQ,OAAO,GAAK,EAC9B,QAAQ,SACV,CAAC;CAEL;CACA,OAAO;EACL;EACA;EACA;CACF;AACF"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./acl/aclLogic.cjs.js"),t=require("./authn/authUtil.cjs.js"),n=require("./logic/CustomError.cjs.js"),r=require("./typeIndex/typeIndexLogic.cjs.js"),i=require("./logic/solidLogicSingleton.cjs.js"),a=require("./authn/serverLogout.cjs.js"),o=require("./issuer/issuerLogic.cjs.js");var s=i.solidLogicSingleton.authn,c=i.solidLogicSingleton.authn.authSession,l=i.solidLogicSingleton.store;exports.ACL_LINK=e.ACL_LINK,exports.CrossOriginForbiddenError=n.CrossOriginForbiddenError,exports.FetchError=n.FetchError,exports.NotEditableError=n.NotEditableError,exports.NotFoundError=n.NotFoundError,exports.SameOriginForbiddenError=n.SameOriginForbiddenError,exports.UnauthorizedError=n.UnauthorizedError,exports.WebOperationError=n.WebOperationError,exports.appContext=t.appContext,exports.authSession=c,exports.authn=s,exports.createTypeIndexLogic=r.createTypeIndexLogic,exports.getSuggestedIssuers=o.getSuggestedIssuers,exports.offlineTestID=t.offlineTestID,exports.performServerSideLogout=a.performServerSideLogout,exports.solidLogicSingleton=i.solidLogicSingleton,exports.store=l;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Make these variables directly accessible as it is what you need most of the time\n// This also makes these variable globaly accesible in mashlib\nimport { solidLogicSingleton } from './logic/solidLogicSingleton'\n\nconst authn = solidLogicSingleton.authn\nconst authSession = solidLogicSingleton.authn.authSession\nconst store = solidLogicSingleton.store\n\nexport { ACL_LINK } from './acl/aclLogic'\nexport { offlineTestID, appContext } from './authn/authUtil'\nexport { performServerSideLogout } from './authn/serverLogout'\nexport { getSuggestedIssuers } from './issuer/issuerLogic'\nexport { createTypeIndexLogic } from './typeIndex/typeIndexLogic'\nexport type { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic, ChatLogic } from './types'\nexport { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'\n\nexport {\n solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes\n store,\n authn,\n authSession\n}\n\n"],"mappings":"0WAIA,IAAM,EAAQ,EAAA,oBAAoB,MAC5B,EAAc,EAAA,oBAAoB,MAAM,YACxC,EAAQ,EAAA,oBAAoB"}
@@ -0,0 +1,13 @@
1
+ import { ACL_LINK as e } from "./acl/aclLogic.esm.js";
2
+ import { appContext as t, offlineTestID as n } from "./authn/authUtil.esm.js";
3
+ import { CrossOriginForbiddenError as r, FetchError as i, NotEditableError as a, NotFoundError as o, SameOriginForbiddenError as s, UnauthorizedError as c, WebOperationError as l } from "./logic/CustomError.esm.js";
4
+ import { createTypeIndexLogic as u } from "./typeIndex/typeIndexLogic.esm.js";
5
+ import { solidLogicSingleton as d } from "./logic/solidLogicSingleton.esm.js";
6
+ import { performServerSideLogout as f } from "./authn/serverLogout.esm.js";
7
+ import { getSuggestedIssuers as p } from "./issuer/issuerLogic.esm.js";
8
+ //#region src/index.ts
9
+ var m = d.authn, h = d.authn.authSession, g = d.store;
10
+ //#endregion
11
+ export { e as ACL_LINK, r as CrossOriginForbiddenError, i as FetchError, a as NotEditableError, o as NotFoundError, s as SameOriginForbiddenError, c as UnauthorizedError, l as WebOperationError, t as appContext, h as authSession, m as authn, u as createTypeIndexLogic, p as getSuggestedIssuers, n as offlineTestID, f as performServerSideLogout, d as solidLogicSingleton, g as store };
12
+
13
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Make these variables directly accessible as it is what you need most of the time\n// This also makes these variable globaly accesible in mashlib\nimport { solidLogicSingleton } from './logic/solidLogicSingleton'\n\nconst authn = solidLogicSingleton.authn\nconst authSession = solidLogicSingleton.authn.authSession\nconst store = solidLogicSingleton.store\n\nexport { ACL_LINK } from './acl/aclLogic'\nexport { offlineTestID, appContext } from './authn/authUtil'\nexport { performServerSideLogout } from './authn/serverLogout'\nexport { getSuggestedIssuers } from './issuer/issuerLogic'\nexport { createTypeIndexLogic } from './typeIndex/typeIndexLogic'\nexport type { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic, ChatLogic } from './types'\nexport { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'\n\nexport {\n solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes\n store,\n authn,\n authSession\n}\n\n"],"mappings":";;;;;;;;AAIA,IAAM,IAAQ,EAAoB,OAC5B,IAAc,EAAoB,MAAM,aACxC,IAAQ,EAAoB"}
@@ -0,0 +1,2 @@
1
+ var e=[{name:`Solid Community`,uri:`https://solidcommunity.net`},{name:`Solid Web`,uri:`https://solidweb.org`},{name:`Solid Web ME`,uri:`https://solidweb.me`},{name:`Inrupt.com`,uri:`https://login.inrupt.com`}];function t(){let t=[...e],{host:n,origin:r}=new URL(location.href);return t.map(({uri:e})=>new URL(e).host).includes(n)||t.unshift({name:n,uri:r}),t}exports.getSuggestedIssuers=t;
2
+ //# sourceMappingURL=issuerLogic.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuerLogic.cjs.js","names":[],"sources":["../../src/issuer/issuerLogic.ts"],"sourcesContent":["const DEFAULT_ISSUERS = [\n {\n name: 'Solid Community',\n uri: 'https://solidcommunity.net'\n },\n {\n name: 'Solid Web',\n uri: 'https://solidweb.org'\n },\n {\n name: 'Solid Web ME',\n uri: 'https://solidweb.me'\n },\n {\n name: 'Inrupt.com',\n uri: 'https://login.inrupt.com'\n }\n]\n\n/**\n * @returns - A list of suggested OIDC issuers\n */\nexport function getSuggestedIssuers (): { name: string, uri: string }[] {\n // Suggest a default list of OIDC issuers\n const issuers = [...DEFAULT_ISSUERS]\n \n // Suggest the current host if not already included\n const { host, origin } = new URL(location.href)\n const hosts = issuers.map(({ uri }) => new URL(uri).host)\n if (!hosts.includes(host)) {\n issuers.unshift({ name: host, uri: origin })\n }\n \n return issuers\n }"],"mappings":"AAAA,IAAM,EAAkB,CACtB,CACE,KAAM,kBACN,IAAK,4BACP,EACA,CACE,KAAM,YACN,IAAK,sBACP,EACA,CACE,KAAM,eACN,IAAK,qBACP,EACA,CACE,KAAM,aACN,IAAK,0BACP,CACF,EAKA,SAAgB,GAAwD,CAEpE,IAAM,EAAU,CAAC,GAAG,CAAe,EAG7B,CAAE,OAAM,UAAW,IAAI,IAAI,SAAS,IAAI,EAM9C,OALc,EAAQ,KAAK,CAAE,SAAU,IAAI,IAAI,CAAG,CAAC,CAAC,IAC/C,CAAA,CAAM,SAAS,CAAI,GACtB,EAAQ,QAAQ,CAAE,KAAM,EAAM,IAAK,CAAO,CAAC,EAGtC,CACT"}
@@ -0,0 +1,30 @@
1
+ //#region src/issuer/issuerLogic.ts
2
+ var e = [
3
+ {
4
+ name: "Solid Community",
5
+ uri: "https://solidcommunity.net"
6
+ },
7
+ {
8
+ name: "Solid Web",
9
+ uri: "https://solidweb.org"
10
+ },
11
+ {
12
+ name: "Solid Web ME",
13
+ uri: "https://solidweb.me"
14
+ },
15
+ {
16
+ name: "Inrupt.com",
17
+ uri: "https://login.inrupt.com"
18
+ }
19
+ ];
20
+ function t() {
21
+ let t = [...e], { host: n, origin: r } = new URL(location.href);
22
+ return t.map(({ uri: e }) => new URL(e).host).includes(n) || t.unshift({
23
+ name: n,
24
+ uri: r
25
+ }), t;
26
+ }
27
+ //#endregion
28
+ export { t as getSuggestedIssuers };
29
+
30
+ //# sourceMappingURL=issuerLogic.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuerLogic.esm.js","names":[],"sources":["../../src/issuer/issuerLogic.ts"],"sourcesContent":["const DEFAULT_ISSUERS = [\n {\n name: 'Solid Community',\n uri: 'https://solidcommunity.net'\n },\n {\n name: 'Solid Web',\n uri: 'https://solidweb.org'\n },\n {\n name: 'Solid Web ME',\n uri: 'https://solidweb.me'\n },\n {\n name: 'Inrupt.com',\n uri: 'https://login.inrupt.com'\n }\n]\n\n/**\n * @returns - A list of suggested OIDC issuers\n */\nexport function getSuggestedIssuers (): { name: string, uri: string }[] {\n // Suggest a default list of OIDC issuers\n const issuers = [...DEFAULT_ISSUERS]\n \n // Suggest the current host if not already included\n const { host, origin } = new URL(location.href)\n const hosts = issuers.map(({ uri }) => new URL(uri).host)\n if (!hosts.includes(host)) {\n issuers.unshift({ name: host, uri: origin })\n }\n \n return issuers\n }"],"mappings":";AAAA,IAAM,IAAkB;CACtB;EACE,MAAM;EACN,KAAK;CACP;CACA;EACE,MAAM;EACN,KAAK;CACP;CACA;EACE,MAAM;EACN,KAAK;CACP;CACA;EACE,MAAM;EACN,KAAK;CACP;AACF;AAKA,SAAgB,IAAwD;CAEpE,IAAM,IAAU,CAAC,GAAG,CAAe,GAG7B,EAAE,SAAM,cAAW,IAAI,IAAI,SAAS,IAAI;CAM9C,OALc,EAAQ,KAAK,EAAE,aAAU,IAAI,IAAI,CAAG,CAAC,CAAC,IAC/C,CAAA,CAAM,SAAS,CAAI,KACtB,EAAQ,QAAQ;EAAE,MAAM;EAAM,KAAK;CAAO,CAAC,GAGtC;AACT"}
@@ -0,0 +1,2 @@
1
+ var e=class extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}},t=class extends e{},n=class extends e{},r=class extends e{},i=class extends e{},a=class extends e{},o=class extends e{},s=class extends e{constructor(e,t){super(t),this.status=e}};exports.CrossOriginForbiddenError=n,exports.FetchError=s,exports.NotEditableError=a,exports.NotFoundError=i,exports.SameOriginForbiddenError=r,exports.UnauthorizedError=t,exports.WebOperationError=o;
2
+ //# sourceMappingURL=CustomError.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomError.cjs.js","names":[],"sources":["../../src/logic/CustomError.ts"],"sourcesContent":["class CustomError extends Error {\n constructor(message?: string) {\n super(message)\n // see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html\n Object.setPrototypeOf(this, new.target.prototype) // restore prototype chain\n this.name = new.target.name // stack traces display correctly now\n }\n}\n\nexport class UnauthorizedError extends CustomError {}\n\nexport class CrossOriginForbiddenError extends CustomError {}\n\nexport class SameOriginForbiddenError extends CustomError {}\n\nexport class NotFoundError extends CustomError {}\n\nexport class NotEditableError extends CustomError { }\n\nexport class WebOperationError extends CustomError {}\n\nexport class FetchError extends CustomError {\n status: number\n\n constructor(status: number, message?: string) {\n super(message)\n this.status = status\n }\n}"],"mappings":"AAAA,IAAM,EAAN,cAA0B,KAAM,CAC5B,YAAY,EAAkB,CAC1B,MAAM,CAAO,EAEb,OAAO,eAAe,KAAM,IAAI,OAAO,SAAS,EAChD,KAAK,KAAO,IAAI,OAAO,IAC3B,CACJ,EAEa,EAAb,cAAuC,CAAY,CAAC,EAEvC,EAAb,cAA+C,CAAY,CAAC,EAE/C,EAAb,cAA8C,CAAY,CAAC,EAE9C,EAAb,cAAmC,CAAY,CAAC,EAEnC,EAAb,cAAsC,CAAY,CAAE,EAEvC,EAAb,cAAuC,CAAY,CAAC,EAEvC,EAAb,cAAgC,CAAY,CAGxC,YAAY,EAAgB,EAAkB,CAC1C,MAAM,CAAO,EACb,KAAK,OAAS,CAClB,CACJ"}
@@ -0,0 +1,14 @@
1
+ //#region src/logic/CustomError.ts
2
+ var e = class extends Error {
3
+ constructor(e) {
4
+ super(e), Object.setPrototypeOf(this, new.target.prototype), this.name = new.target.name;
5
+ }
6
+ }, t = class extends e {}, n = class extends e {}, r = class extends e {}, i = class extends e {}, a = class extends e {}, o = class extends e {}, s = class extends e {
7
+ constructor(e, t) {
8
+ super(t), this.status = e;
9
+ }
10
+ };
11
+ //#endregion
12
+ export { n as CrossOriginForbiddenError, s as FetchError, a as NotEditableError, i as NotFoundError, r as SameOriginForbiddenError, t as UnauthorizedError, o as WebOperationError };
13
+
14
+ //# sourceMappingURL=CustomError.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomError.esm.js","names":[],"sources":["../../src/logic/CustomError.ts"],"sourcesContent":["class CustomError extends Error {\n constructor(message?: string) {\n super(message)\n // see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html\n Object.setPrototypeOf(this, new.target.prototype) // restore prototype chain\n this.name = new.target.name // stack traces display correctly now\n }\n}\n\nexport class UnauthorizedError extends CustomError {}\n\nexport class CrossOriginForbiddenError extends CustomError {}\n\nexport class SameOriginForbiddenError extends CustomError {}\n\nexport class NotFoundError extends CustomError {}\n\nexport class NotEditableError extends CustomError { }\n\nexport class WebOperationError extends CustomError {}\n\nexport class FetchError extends CustomError {\n status: number\n\n constructor(status: number, message?: string) {\n super(message)\n this.status = status\n }\n}"],"mappings":";AAAA,IAAM,IAAN,cAA0B,MAAM;CAC5B,YAAY,GAAkB;EAI1B,AAHA,MAAM,CAAO,GAEb,OAAO,eAAe,MAAM,IAAI,OAAO,SAAS,GAChD,KAAK,OAAO,IAAI,OAAO;CAC3B;AACJ,GAEa,IAAb,cAAuC,EAAY,CAAC,GAEvC,IAAb,cAA+C,EAAY,CAAC,GAE/C,IAAb,cAA8C,EAAY,CAAC,GAE9C,IAAb,cAAmC,EAAY,CAAC,GAEnC,IAAb,cAAsC,EAAY,CAAE,GAEvC,IAAb,cAAuC,EAAY,CAAC,GAEvC,IAAb,cAAgC,EAAY;CAGxC,YAAY,GAAgB,GAAkB;EAE1C,AADA,MAAM,CAAO,GACb,KAAK,SAAS;CAClB;AACJ"}
@@ -0,0 +1,2 @@
1
+ const e=require("../_virtual/_rolldown/runtime.cjs.js"),t=require("../util/debug.cjs.js"),n=require("../acl/aclLogic.cjs.js"),r=require("../authn/SolidAuthnLogic.cjs.js"),i=require("../chat/chatLogic.cjs.js"),a=require("../inbox/inboxLogic.cjs.js"),o=require("../util/containerLogic.cjs.js"),s=require("../profile/profileLogic.cjs.js"),c=require("../typeIndex/typeIndexLogic.cjs.js"),l=require("../util/utilityLogic.cjs.js");let u=require("rdflib");u=e.__toESM(u);function d(e,d){t.log(`SolidLogic: Unique instance created. There should only be one of these.`);let f=u.graph();u.fetcher(f,{fetch:e.fetch}),f.updater=new u.UpdateManager(f),f.features=[];let p=new r.SolidAuthnLogic(d),m=n.createAclLogic(f),h=o.createContainerLogic(f),g=l.createUtilityLogic(f,m,h),_=s.createProfileLogic(f,p,g),v=i.createChatLogic(f,_),y=a.createInboxLogic(f,_,g,h,m),b=c.createTypeIndexLogic(f,p,_,g);t.log(`SolidAuthnLogic initialized`);function x(e){return f.fetcher.load(e)}function S(e,t=[]){return new Promise((n,r)=>{f.updater.update(e,t,function(e,t,i){t?n():r(Error(i))})})}function C(){f.statements.slice().forEach(f.remove.bind(f))}return{store:f,authn:p,acl:m,inbox:y,chat:v,profile:_,typeIndex:b,load:x,updatePromise:S,clearStore:C}}exports.createSolidLogic=d;
2
+ //# sourceMappingURL=solidLogic.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solidLogic.cjs.js","names":[],"sources":["../../src/logic/solidLogic.ts"],"sourcesContent":["import * as rdf from 'rdflib'\nimport { LiveStore, NamedNode, Statement } from 'rdflib'\nimport { createAclLogic } from '../acl/aclLogic'\nimport { SolidAuthnLogic } from '../authn/SolidAuthnLogic'\nimport type { SessionWithLegacyEvents } from '../authSession/authSession'\nimport { createChatLogic } from '../chat/chatLogic'\nimport { createInboxLogic } from '../inbox/inboxLogic'\nimport { createProfileLogic } from '../profile/profileLogic'\nimport { createTypeIndexLogic } from '../typeIndex/typeIndexLogic'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { createUtilityLogic } from '../util/utilityLogic'\nimport type { AuthnLogic, SolidLogic } from '../types'\nimport * as debug from '../util/debug'\n/*\n** It is important to distinquish `fetch`, a function provided by the browser\n** and `Fetcher`, a helper object for the rdflib Store which turns it\n** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is\n** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,\n*/\nexport function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: SessionWithLegacyEvents): SolidLogic {\n\n debug.log('SolidLogic: Unique instance created. There should only be one of these.')\n const store: LiveStore = rdf.graph() as LiveStore\n rdf.fetcher(store, {fetch: specialFetch.fetch}) // Attach a web I/O module, store.fetcher\n store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater\n store.features = [] // disable automatic node merging on store load\n\n const authn: AuthnLogic = new SolidAuthnLogic(session)\n \n const acl = createAclLogic(store)\n const containerLogic = createContainerLogic(store)\n const utilityLogic = createUtilityLogic(store, acl, containerLogic)\n const profile = createProfileLogic(store, authn, utilityLogic)\n const chat = createChatLogic(store, profile)\n const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)\n const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)\n debug.log('SolidAuthnLogic initialized')\n\n function load(doc: NamedNode | NamedNode[] | string) {\n return store.fetcher.load(doc)\n }\n\n // @@@@ use the one in rdflib.js when it is available and delete this\n function updatePromise(\n del: Array<Statement>,\n ins: Array<Statement> = []\n ): Promise<void> {\n return new Promise((resolve, reject) => {\n store.updater.update(del, ins, function (_uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }) // callback\n }) // promise\n }\n\n function clearStore() {\n store.statements.slice().forEach(store.remove.bind(store))\n }\n\n return {\n store,\n authn,\n acl,\n inbox,\n chat,\n profile,\n typeIndex,\n load,\n updatePromise,\n clearStore\n }\n}\n"],"mappings":"gdAmBA,SAAgB,EAAiB,EAA8D,EAA8C,CAEzI,EAAA,IAAU,0EAA0E,EACpF,IAAM,EAAmB,EAAI,MAAM,EACnC,EAAI,QAAQ,EAAO,CAAC,MAAO,EAAa,KAAK,CAAC,EAC9C,EAAM,QAAU,IAAI,EAAI,cAAc,CAAK,EAC3C,EAAM,SAAW,CAAC,EAElB,IAAM,EAAoB,IAAI,EAAA,gBAAgB,CAAO,EAE/C,EAAM,EAAA,eAAe,CAAK,EAC1B,EAAiB,EAAA,qBAAqB,CAAK,EAC3C,EAAe,EAAA,mBAAmB,EAAO,EAAK,CAAc,EAC5D,EAAU,EAAA,mBAAmB,EAAO,EAAO,CAAY,EACvD,EAAO,EAAA,gBAAgB,EAAO,CAAO,EACrC,EAAQ,EAAA,iBAAiB,EAAO,EAAS,EAAc,EAAgB,CAAG,EAC1E,EAAY,EAAA,qBAAqB,EAAO,EAAO,EAAS,CAAY,EAC1E,EAAA,IAAU,6BAA6B,EAEvC,SAAS,EAAK,EAAuC,CACjD,OAAO,EAAM,QAAQ,KAAK,CAAG,CACjC,CAGA,SAAS,EACL,EACA,EAAwB,CAAC,EACZ,CACb,OAAO,IAAI,SAAS,EAAS,IAAW,CACxC,EAAM,QAAQ,OAAO,EAAK,EAAK,SAAU,EAAM,EAAI,EAAW,CACrD,EAGL,EAAQ,EAFR,EAAW,MAAM,CAAS,CAAC,CAI/B,CAAC,CACD,CAAC,CACL,CAEA,SAAS,GAAa,CAClB,EAAM,WAAW,MAAM,CAAC,CAAC,QAAQ,EAAM,OAAO,KAAK,CAAK,CAAC,CAC7D,CAEA,MAAO,CACH,QACA,QACA,MACA,QACA,OACA,UACA,YACA,OACA,gBACA,YACJ,CACJ"}
@@ -0,0 +1,47 @@
1
+ import { log as e } from "../util/debug.esm.js";
2
+ import { createAclLogic as t } from "../acl/aclLogic.esm.js";
3
+ import { SolidAuthnLogic as n } from "../authn/SolidAuthnLogic.esm.js";
4
+ import { createChatLogic as r } from "../chat/chatLogic.esm.js";
5
+ import { createInboxLogic as i } from "../inbox/inboxLogic.esm.js";
6
+ import { createContainerLogic as a } from "../util/containerLogic.esm.js";
7
+ import { createProfileLogic as o } from "../profile/profileLogic.esm.js";
8
+ import { createTypeIndexLogic as s } from "../typeIndex/typeIndexLogic.esm.js";
9
+ import { createUtilityLogic as c } from "../util/utilityLogic.esm.js";
10
+ import * as l from "rdflib";
11
+ //#region src/logic/solidLogic.ts
12
+ function u(u, d) {
13
+ e("SolidLogic: Unique instance created. There should only be one of these.");
14
+ let f = l.graph();
15
+ l.fetcher(f, { fetch: u.fetch }), f.updater = new l.UpdateManager(f), f.features = [];
16
+ let p = new n(d), m = t(f), h = a(f), g = c(f, m, h), _ = o(f, p, g), v = r(f, _), y = i(f, _, g, h, m), b = s(f, p, _, g);
17
+ e("SolidAuthnLogic initialized");
18
+ function x(e) {
19
+ return f.fetcher.load(e);
20
+ }
21
+ function S(e, t = []) {
22
+ return new Promise((n, r) => {
23
+ f.updater.update(e, t, function(e, t, i) {
24
+ t ? n() : r(Error(i));
25
+ });
26
+ });
27
+ }
28
+ function C() {
29
+ f.statements.slice().forEach(f.remove.bind(f));
30
+ }
31
+ return {
32
+ store: f,
33
+ authn: p,
34
+ acl: m,
35
+ inbox: y,
36
+ chat: v,
37
+ profile: _,
38
+ typeIndex: b,
39
+ load: x,
40
+ updatePromise: S,
41
+ clearStore: C
42
+ };
43
+ }
44
+ //#endregion
45
+ export { u as createSolidLogic };
46
+
47
+ //# sourceMappingURL=solidLogic.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solidLogic.esm.js","names":[],"sources":["../../src/logic/solidLogic.ts"],"sourcesContent":["import * as rdf from 'rdflib'\nimport { LiveStore, NamedNode, Statement } from 'rdflib'\nimport { createAclLogic } from '../acl/aclLogic'\nimport { SolidAuthnLogic } from '../authn/SolidAuthnLogic'\nimport type { SessionWithLegacyEvents } from '../authSession/authSession'\nimport { createChatLogic } from '../chat/chatLogic'\nimport { createInboxLogic } from '../inbox/inboxLogic'\nimport { createProfileLogic } from '../profile/profileLogic'\nimport { createTypeIndexLogic } from '../typeIndex/typeIndexLogic'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { createUtilityLogic } from '../util/utilityLogic'\nimport type { AuthnLogic, SolidLogic } from '../types'\nimport * as debug from '../util/debug'\n/*\n** It is important to distinquish `fetch`, a function provided by the browser\n** and `Fetcher`, a helper object for the rdflib Store which turns it\n** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is\n** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,\n*/\nexport function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: SessionWithLegacyEvents): SolidLogic {\n\n debug.log('SolidLogic: Unique instance created. There should only be one of these.')\n const store: LiveStore = rdf.graph() as LiveStore\n rdf.fetcher(store, {fetch: specialFetch.fetch}) // Attach a web I/O module, store.fetcher\n store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater\n store.features = [] // disable automatic node merging on store load\n\n const authn: AuthnLogic = new SolidAuthnLogic(session)\n \n const acl = createAclLogic(store)\n const containerLogic = createContainerLogic(store)\n const utilityLogic = createUtilityLogic(store, acl, containerLogic)\n const profile = createProfileLogic(store, authn, utilityLogic)\n const chat = createChatLogic(store, profile)\n const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)\n const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)\n debug.log('SolidAuthnLogic initialized')\n\n function load(doc: NamedNode | NamedNode[] | string) {\n return store.fetcher.load(doc)\n }\n\n // @@@@ use the one in rdflib.js when it is available and delete this\n function updatePromise(\n del: Array<Statement>,\n ins: Array<Statement> = []\n ): Promise<void> {\n return new Promise((resolve, reject) => {\n store.updater.update(del, ins, function (_uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }) // callback\n }) // promise\n }\n\n function clearStore() {\n store.statements.slice().forEach(store.remove.bind(store))\n }\n\n return {\n store,\n authn,\n acl,\n inbox,\n chat,\n profile,\n typeIndex,\n load,\n updatePromise,\n clearStore\n }\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAgB,EAAiB,GAA8D,GAA8C;CAEzI,EAAU,0EAA0E;CACpF,IAAM,IAAmB,EAAI,MAAM;CAGnC,AAFA,EAAI,QAAQ,GAAO,EAAC,OAAO,EAAa,MAAK,CAAC,GAC9C,EAAM,UAAU,IAAI,EAAI,cAAc,CAAK,GAC3C,EAAM,WAAW,CAAC;CAElB,IAAM,IAAoB,IAAI,EAAgB,CAAO,GAE/C,IAAM,EAAe,CAAK,GAC1B,IAAiB,EAAqB,CAAK,GAC3C,IAAe,EAAmB,GAAO,GAAK,CAAc,GAC5D,IAAU,EAAmB,GAAO,GAAO,CAAY,GACvD,IAAO,EAAgB,GAAO,CAAO,GACrC,IAAQ,EAAiB,GAAO,GAAS,GAAc,GAAgB,CAAG,GAC1E,IAAY,EAAqB,GAAO,GAAO,GAAS,CAAY;CAC1E,EAAU,6BAA6B;CAEvC,SAAS,EAAK,GAAuC;EACjD,OAAO,EAAM,QAAQ,KAAK,CAAG;CACjC;CAGA,SAAS,EACL,GACA,IAAwB,CAAC,GACZ;EACb,OAAO,IAAI,SAAS,GAAS,MAAW;GACxC,EAAM,QAAQ,OAAO,GAAK,GAAK,SAAU,GAAM,GAAI,GAAW;IAC1D,AAAK,IAGL,EAAQ,IAFR,EAAW,MAAM,CAAS,CAAC;GAI/B,CAAC;EACD,CAAC;CACL;CAEA,SAAS,IAAa;EAClB,EAAM,WAAW,MAAM,CAAC,CAAC,QAAQ,EAAM,OAAO,KAAK,CAAK,CAAC;CAC7D;CAEA,OAAO;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;AACJ"}
@@ -0,0 +1,2 @@
1
+ const e=require("../util/debug.cjs.js"),t=require("../authSession/authSession.cjs.js"),n=require("./solidLogic.cjs.js");var r=async(e,n)=>{let r=n&&n.credentials&&n.credentials==`omit`,i=t.authSession;if((i?.info?.webId||i?.webId)&&!r){let t=typeof i.fetch==`function`?i.fetch.bind(i):typeof i.authFetch==`function`?i.authFetch.bind(i):null;return t?t(e,n):window.fetch(e,n)}else return window.fetch(e,n)},i=Symbol.for(`solid-logic-singleton`),a=typeof window<`u`?window:global;function o(){return a[i]?e.log(`SolidLogic: Using existing global singleton instance.`):(e.log(`SolidLogic: Creating new global singleton instance.`),a[i]=n.createSolidLogic({fetch:r},t.authSession),e.log(`Unique quadstore initialized.`)),a[i]}var s=o();exports.solidLogicSingleton=s;
2
+ //# sourceMappingURL=solidLogicSingleton.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solidLogicSingleton.cjs.js","names":[],"sources":["../../src/logic/solidLogicSingleton.ts"],"sourcesContent":["import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n const sessionWebId = sessionAny?.info?.webId || sessionAny?.webId\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }"],"mappings":"wHAKA,IAAM,EAAS,MAAO,EAAK,IAAgB,CACvC,IAAM,EAAY,GAAe,EAAY,aAAe,EAAY,aAAe,OACjF,EAAa,EAAA,YAEnB,IADqB,GAAY,MAAM,OAAS,GAAY,QACxC,CAAC,EAAW,CAE5B,IAAM,EAAsB,OAAO,EAAW,OAAU,WAClD,EAAW,MAAM,KAAK,CAAU,EAC/B,OAAO,EAAW,WAAc,WAAa,EAAW,UAAU,KAAK,CAAU,EAAI,KAI5F,OAHI,EACO,EAAmB,EAAK,CAAW,EAEvC,OAAO,MAAM,EAAK,CAAW,CACxC,MACI,OAAO,OAAO,MAAM,EAAK,CAAW,CAE5C,EAGM,EAAmB,OAAO,IAAI,uBAAuB,EAOrD,EAAgB,OAAO,OAAW,IAAc,OAAS,OAE/D,SAAS,GAAmC,CAQxC,OAPK,EAAa,GAKd,EAAA,IAAU,uDAAuD,GAJjE,EAAA,IAAU,qDAAqD,EAC/D,EAAa,GAAoB,EAAA,iBAAiB,CAAE,MAAO,CAAO,EAAG,EAAA,WAAW,EAChF,EAAA,IAAU,+BAA+B,GAItC,EAAa,EACxB,CAEA,IAAM,EAAsB,EAAqB"}
@@ -0,0 +1,19 @@
1
+ import { log as e } from "../util/debug.esm.js";
2
+ import { authSession as t } from "../authSession/authSession.esm.js";
3
+ import { createSolidLogic as n } from "./solidLogic.esm.js";
4
+ //#region src/logic/solidLogicSingleton.ts
5
+ var r = async (e, n) => {
6
+ let r = n && n.credentials && n.credentials == "omit", i = t;
7
+ if ((i?.info?.webId || i?.webId) && !r) {
8
+ let t = typeof i.fetch == "function" ? i.fetch.bind(i) : typeof i.authFetch == "function" ? i.authFetch.bind(i) : null;
9
+ return t ? t(e, n) : window.fetch(e, n);
10
+ } else return window.fetch(e, n);
11
+ }, i = Symbol.for("solid-logic-singleton"), a = typeof window < "u" ? window : global;
12
+ function o() {
13
+ return a[i] ? e("SolidLogic: Using existing global singleton instance.") : (e("SolidLogic: Creating new global singleton instance."), a[i] = n({ fetch: r }, t), e("Unique quadstore initialized.")), a[i];
14
+ }
15
+ var s = o();
16
+ //#endregion
17
+ export { s as solidLogicSingleton };
18
+
19
+ //# sourceMappingURL=solidLogicSingleton.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solidLogicSingleton.esm.js","names":[],"sources":["../../src/logic/solidLogicSingleton.ts"],"sourcesContent":["import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n const sessionWebId = sessionAny?.info?.webId || sessionAny?.webId\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }"],"mappings":";;;;AAKA,IAAM,IAAS,OAAO,GAAK,MAAgB;CACvC,IAAM,IAAY,KAAe,EAAY,eAAe,EAAY,eAAe,QACjF,IAAa;CAEnB,KADqB,GAAY,MAAM,SAAS,GAAY,UACxC,CAAC,GAAW;EAE5B,IAAM,IAAsB,OAAO,EAAW,SAAU,aAClD,EAAW,MAAM,KAAK,CAAU,IAC/B,OAAO,EAAW,aAAc,aAAa,EAAW,UAAU,KAAK,CAAU,IAAI;EAI5F,OAHI,IACO,EAAmB,GAAK,CAAW,IAEvC,OAAO,MAAM,GAAK,CAAW;CACxC,OACI,OAAO,OAAO,MAAM,GAAK,CAAW;AAE5C,GAGM,IAAmB,OAAO,IAAI,uBAAuB,GAOrD,IAAgB,OAAO,SAAW,MAAc,SAAS;AAE/D,SAAS,IAAmC;CAQxC,OAPK,EAAa,KAKd,EAAU,uDAAuD,KAJjE,EAAU,qDAAqD,GAC/D,EAAa,KAAoB,EAAiB,EAAE,OAAO,EAAO,GAAG,CAAW,GAChF,EAAU,+BAA+B,IAItC,EAAa;AACxB;AAEA,IAAM,IAAsB,EAAqB"}
@@ -0,0 +1,3 @@
1
+ function e(e){return[`@prefix acl: <http://www.w3.org/ns/auth/acl#>.`,``,`<#owner>`,`a acl:Authorization;`,`acl:agent <${e}>;`,`acl:accessTo <./>;`,`acl:default <./>;`,`acl:mode acl:Read, acl:Write, acl:Control.`].join(`
2
+ `)}exports.ownerOnlyContainerAclDocument=e;
3
+ //# sourceMappingURL=profileAclDocuments.cjs.js.map