solid-ui 2.4.15-348f23a8 → 2.4.15-cc171500

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.
@@ -55,8 +55,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
55
55
  * Common code for a chat (discussion area of messages about something)
56
56
  * This version runs over a series of files for different time periods
57
57
  *
58
- * Parameters for the whole chat -- like its title -- are stored at
59
- * index.ttl#this and the chat messages are stored in YYYY/MM/DD/chat.ttl
58
+ * Parameters for the whole chat like its title are stored on
59
+ * index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
60
60
  *
61
61
  */
62
62
  var ChatChannel = /*#__PURE__*/function () {
@@ -98,7 +98,7 @@ var ChatChannel = /*#__PURE__*/function () {
98
98
  }()
99
99
  /* Store a new message in the web,
100
100
  as a replacement for an existing one.
101
- The old one is left, and the two are linked
101
+ The old one iis left, and the two are linked
102
102
  */
103
103
 
104
104
  }, {
@@ -132,7 +132,7 @@ var ChatChannel = /*#__PURE__*/function () {
132
132
  me = _index.authn.currentUser(); // If already logged on
133
133
 
134
134
  if (oldMsg) {
135
- // edited message replaces old one
135
+ // edit message replaces old one
136
136
  sts.push($rdf.st(mostRecentVersion(oldMsg), ns.dct('isReplacedBy'), message, chatDocument));
137
137
 
138
138
  if (deleteIt) {
@@ -184,7 +184,7 @@ var ChatChannel = /*#__PURE__*/function () {
184
184
  return updateMessage;
185
185
  }()
186
186
  /* Mark a message as deleted
187
- * We add a new version of the message, with a deletion flag (deletion date)
187
+ * Wee add a new version of the message,m witha deletion flag (deletion date)
188
188
  * so that the deletion can be revoked by adding another non-deleted update
189
189
  */
190
190
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/chat/chatLogic.js"],"names":["ChatChannel","channel","options","channelRoot","doc","dateFolder","DateFolder","div","text","updateMessage","oldMsg","deleteIt","sts","now","Date","timestamp","getTime","dateStamp","$rdf","term","chatDocument","leafDocumentFromDate","message","store","sym","uri","me","authn","currentUser","push","st","mostRecentVersion","ns","dct","schema","wf","sioc","literal","foaf","updater","update","msg","debug","warn","alert","Error","originalVersion","any","isDeleted","holds","isReplaced","isHidden","nick","person","s","value","utils","label","_createIfNotExists","contentType","data","fetcher","load","response","status","log","webOperation","requested"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;AACA;AAO+B;;AAG/B;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEaA,W;AACX,uBAAaC,OAAb,EAAsBC,OAAtB,EAA+B;AAAA;AAC7B,SAAKD,OAAL,GAAeA,OAAf;AACA,SAAKE,WAAL,GAAmBF,OAAO,CAACG,GAAR,EAAnB;AACA,SAAKF,OAAL,GAAeA,OAAf;AACA,SAAKG,UAAL,GAAkB,IAAIC,sBAAJ,CAAe,KAAKH,WAApB,EAAiC,UAAjC,CAAlB;AACA,SAAKI,GAAL,GAAW,IAAX,CAL6B,CAKb;AACjB;AAED;AACF;;;;;;yGACE,iBAAqBC,IAArB;AAAA;AAAA;AAAA;AAAA;AAAA,iDACS,KAAKC,aAAL,CAAmBD,IAAnB,CADT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;AAIA;AACF;AACA;AACA;;;;;yGACE,kBAAqBA,IAArB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA2BE,gBAAAA,MAA3B,8DAAoC,IAApC;AAA0CC,gBAAAA,QAA1C;AACQC,gBAAAA,GADR,GACc,EADd;AAEQC,gBAAAA,GAFR,GAEc,IAAIC,IAAJ,EAFd;AAGQC,gBAAAA,SAHR,GAGoB,KAAKF,GAAG,CAACG,OAAJ,EAHzB;AAIQC,gBAAAA,SAJR,GAIoBC,IAAI,CAACC,IAAL,CAAUN,GAAV,CAJpB;AAKQO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GcrC,aAAMsC,OAAN,CAAcC,IAAd,CAAmB1D,GAAnB,CAHd;;AAAA;AAGH2D,YAAAA,QAHG;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA,kBAKC,aAAIA,QAAJ,CAAaC,MAAb,KAAwB,GALzB;AAAA;AAAA;AAAA;;AAMDtB,YAAAA,KAAK,CAACuB,GAAN,CACE,2DAA2D7D,GAD7D;AANC;AAAA;AAAA,mBAUkBmB,aAAMsC,OAAN,CAAcK,YAAd,CAA2B,KAA3B,EAAkC9D,GAAG,CAACqB,GAAtC,EAA2C;AAC1DmC,cAAAA,IAAI,EAAJA,IAD0D;AAE1DD,cAAAA,WAAW,EAAXA;AAF0D,aAA3C,CAVlB;;AAAA;AAUCI,YAAAA,QAVD;AAAA;AAAA;;AAAA;AAAA;AAAA;AAeCrB,YAAAA,KAAK,CAACuB,GAAN,CAAU,mCAAmC7D,GAAnC,GAAyC,IAAzC,eAAV;AAfD;;AAAA;AAkBD,mBAAOmB,aAAMsC,OAAN,CAAcM,SAAd,CAAwB/D,GAAG,CAACqB,GAA5B,CAAP,CAlBC,CAkBuC;AACxC;;AAnBC,8CAoBMsC,QApBN;;AAAA;AAsBDrB,YAAAA,KAAK,CAACuB,GAAN,CACE,gDAAgD7D,GAAhD,GAAsD,IAAtD,eADF;AAtBC;;AAAA;AAAA,8CA6BE2D,QA7BF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["/**\n * Contains the [[ChatChannel]] class and logic for Solid Chat\n * @packageDocumentation\n */\n\nimport * as debug from '../debug'\nimport { authn } from '../authn/index'\nimport { DateFolder } from './dateFolder'\nimport { store } from '../logic'\nimport * as ns from '../ns'\nimport * as $rdf from 'rdflib' // pull in first avoid cross-refs\nimport * as utils from '../utils'\n\n/* The Solid logic for a 'LongChat'\n*/\n/**\n * Common code for a chat (discussion area of messages about something)\n * This version runs over a series of files for different time periods\n *\n * Parameters for the whole chat -- like its title -- are stored at\n * index.ttl#this and the chat messages are stored in YYYY/MM/DD/chat.ttl\n *\n */\n\nexport class ChatChannel {\n constructor (channel, options) {\n this.channel = channel\n this.channelRoot = channel.doc()\n this.options = options\n this.dateFolder = new DateFolder(this.channelRoot, 'chat.ttl')\n this.div = null // : HTMLElement\n }\n\n /* Store a new message in the web,\n */\n async createMessage (text) {\n return this.updateMessage(text)\n }\n\n /* Store a new message in the web,\n as a replacement for an existing one.\n The old one is left, and the two are linked\n */\n async updateMessage (text, oldMsg = null, deleteIt) {\n const sts = []\n const now = new Date()\n const timestamp = '' + now.getTime()\n const dateStamp = $rdf.term(now)\n const chatDocument = oldMsg ? oldMsg.doc() : this.dateFolder.leafDocumentFromDate(now)\n const message = store.sym(chatDocument.uri + '#' + 'Msg' + timestamp)\n // const content = store.literal(text)\n\n const me = authn.currentUser() // If already logged on\n\n if (oldMsg) { // edited message replaces old one\n sts.push($rdf.st(mostRecentVersion(oldMsg), ns.dct('isReplacedBy'), message, chatDocument))\n if (deleteIt) {\n sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument))\n }\n } else { // link new message to channel\n sts.push($rdf.st(this.channel, ns.wf('message'), message, chatDocument))\n }\n sts.push(\n $rdf.st(message, ns.sioc('content'), store.literal(text), chatDocument)\n )\n sts.push(\n $rdf.st(message, ns.dct('created'), dateStamp, chatDocument)\n )\n if (me) {\n sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument))\n }\n try {\n await store.updater.update([], sts)\n } catch (err) {\n const msg = 'Error saving chat message: ' + err\n debug.warn(msg)\n alert(msg)\n throw new Error(msg)\n }\n return message\n }\n\n /* Mark a message as deleted\n * We add a new version of the message, with a deletion flag (deletion date)\n * so that the deletion can be revoked by adding another non-deleted update\n */\n async deleteMessage (message) {\n return this.updateMessage('(message deleted)', message, true)\n }\n} // class ChatChannel\n\nexport function originalVersion (message) {\n let msg = message\n while (msg) {\n message = msg\n msg = store.any(null, ns.dct('isReplacedBy'), message, message.doc())\n }\n return message\n}\n\nexport function mostRecentVersion (message) {\n let msg = message\n while (msg) {\n message = msg\n msg = store.any(message, ns.dct('isReplacedBy'), null, message.doc())\n }\n return message\n}\n\nexport function isDeleted (message) {\n return store.holds(message, ns.schema('dateDeleted'), null, message.doc())\n}\n\nexport function isReplaced (message) {\n return store.holds(message, ns.dct('isReplacedBy'), null, message.doc())\n}\n\nexport function isHidden (message) {\n return this.isDeleted(message) || this.isReplaced(message)\n}\n\n// A Nickname for a person\n\nexport function nick (person) {\n const s = store.any(person, ns.foaf('nick'))\n if (s) return '' + s.value\n return '' + utils.label(person)\n}\n\nexport async function _createIfNotExists (doc, contentType = 'text/turtle', data = '') {\n let response\n try {\n response = await store.fetcher.load(doc)\n } catch (err) {\n if (err.response.status === 404) {\n debug.log(\n 'createIfNotExists: doc does NOT exist, will create... ' + doc\n )\n try {\n response = await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType\n })\n } catch (err) {\n debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)\n throw err\n }\n delete store.fetcher.requested[doc.uri] // delete cached 404 error\n // debug.log('createIfNotExists doc created ok ' + doc)\n return response\n } else {\n debug.log(\n 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err\n )\n throw err\n }\n }\n // debug.log('createIfNotExists: doc exists, all good: ' + doc)\n return response\n}\n// ends\n"],"file":"chatLogic.js"}
1
+ {"version":3,"sources":["../../src/chat/chatLogic.js"],"names":["ChatChannel","channel","options","channelRoot","doc","dateFolder","DateFolder","div","text","updateMessage","oldMsg","deleteIt","sts","now","Date","timestamp","getTime","dateStamp","$rdf","term","chatDocument","leafDocumentFromDate","message","store","sym","uri","me","authn","currentUser","push","st","mostRecentVersion","ns","dct","schema","wf","sioc","literal","foaf","updater","update","msg","debug","warn","alert","Error","originalVersion","any","isDeleted","holds","isReplaced","isHidden","nick","person","s","value","utils","label","_createIfNotExists","contentType","data","fetcher","load","response","status","log","webOperation","requested"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;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2D7D,GAD7D;AANC;AAAA;AAAA,mBAUkBmB,aAAMsC,OAAN,CAAcK,YAAd,CAA2B,KAA3B,EAAkC9D,GAAG,CAACqB,GAAtC,EAA2C;AAC1DmC,cAAAA,IAAI,EAAJA,IAD0D;AAE1DD,cAAAA,WAAW,EAAXA;AAF0D,aAA3C,CAVlB;;AAAA;AAUCI,YAAAA,QAVD;AAAA;AAAA;;AAAA;AAAA;AAAA;AAeCrB,YAAAA,KAAK,CAACuB,GAAN,CAAU,mCAAmC7D,GAAnC,GAAyC,IAAzC,eAAV;AAfD;;AAAA;AAkBD,mBAAOmB,aAAMsC,OAAN,CAAcM,SAAd,CAAwB/D,GAAG,CAACqB,GAA5B,CAAP,CAlBC,CAkBuC;AACxC;;AAnBC,8CAoBMsC,QApBN;;AAAA;AAsBDrB,YAAAA,KAAK,CAACuB,GAAN,CACE,gDAAgD7D,GAAhD,GAAsD,IAAtD,eADF;AAtBC;;AAAA;AAAA,8CA6BE2D,QA7BF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["/**\n * Contains the [[ChatChannel]] class and logic for Solid Chat\n * @packageDocumentation\n */\n\nimport * as debug from '../debug'\nimport { authn } from '../authn/index'\nimport { DateFolder } from './dateFolder'\nimport { store } from '../logic'\nimport * as ns from '../ns'\nimport * as $rdf from 'rdflib' // pull in first avoid cross-refs\nimport * as utils from '../utils'\n\n/* The Solid logic for a 'LongChat'\n*/\n/**\n * Common code for a chat (discussion area of messages about something)\n * This version runs over a series of files for different time periods\n *\n * Parameters for the whole chat like its title are stored on\n * index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl\n *\n */\n\nexport class ChatChannel {\n constructor (channel, options) {\n this.channel = channel\n this.channelRoot = channel.doc()\n this.options = options\n this.dateFolder = new DateFolder(this.channelRoot, 'chat.ttl')\n this.div = null // : HTMLElement\n }\n\n /* Store a new message in the web,\n */\n async createMessage (text) {\n return this.updateMessage(text)\n }\n\n /* Store a new message in the web,\n as a replacement for an existing one.\n The old one iis left, and the two are linked\n */\n async updateMessage (text, oldMsg = null, deleteIt) {\n const sts = []\n const now = new Date()\n const timestamp = '' + now.getTime()\n const dateStamp = $rdf.term(now)\n const chatDocument = oldMsg ? oldMsg.doc() : this.dateFolder.leafDocumentFromDate(now)\n const message = store.sym(chatDocument.uri + '#' + 'Msg' + timestamp)\n // const content = store.literal(text)\n\n const me = authn.currentUser() // If already logged on\n\n if (oldMsg) { // edit message replaces old one\n sts.push($rdf.st(mostRecentVersion(oldMsg), ns.dct('isReplacedBy'), message, chatDocument))\n if (deleteIt) {\n sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument))\n }\n } else { // link new message to channel\n sts.push($rdf.st(this.channel, ns.wf('message'), message, chatDocument))\n }\n sts.push(\n $rdf.st(message, ns.sioc('content'), store.literal(text), chatDocument)\n )\n sts.push(\n $rdf.st(message, ns.dct('created'), dateStamp, chatDocument)\n )\n if (me) {\n sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument))\n }\n try {\n await store.updater.update([], sts)\n } catch (err) {\n const msg = 'Error saving chat message: ' + err\n debug.warn(msg)\n alert(msg)\n throw new Error(msg)\n }\n return message\n }\n\n /* Mark a message as deleted\n * Wee add a new version of the message,m witha deletion flag (deletion date)\n * so that the deletion can be revoked by adding another non-deleted update\n */\n async deleteMessage (message) {\n return this.updateMessage('(message deleted)', message, true)\n }\n} // class ChatChannel\n\nexport function originalVersion (message) {\n let msg = message\n while (msg) {\n message = msg\n msg = store.any(null, ns.dct('isReplacedBy'), message, message.doc())\n }\n return message\n}\n\nexport function mostRecentVersion (message) {\n let msg = message\n while (msg) {\n message = msg\n msg = store.any(message, ns.dct('isReplacedBy'), null, message.doc())\n }\n return message\n}\n\nexport function isDeleted (message) {\n return store.holds(message, ns.schema('dateDeleted'), null, message.doc())\n}\n\nexport function isReplaced (message) {\n return store.holds(message, ns.dct('isReplacedBy'), null, message.doc())\n}\n\nexport function isHidden (message) {\n return this.isDeleted(message) || this.isReplaced(message)\n}\n\n// A Nickname for a person\n\nexport function nick (person) {\n const s = store.any(person, ns.foaf('nick'))\n if (s) return '' + s.value\n return '' + utils.label(person)\n}\n\nexport async function _createIfNotExists (doc, contentType = 'text/turtle', data = '') {\n let response\n try {\n response = await store.fetcher.load(doc)\n } catch (err) {\n if (err.response.status === 404) {\n debug.log(\n 'createIfNotExists: doc does NOT exist, will create... ' + doc\n )\n try {\n response = await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType\n })\n } catch (err) {\n debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)\n throw err\n }\n delete store.fetcher.requested[doc.uri] // delete cached 404 error\n // debug.log('createIfNotExists doc created ok ' + doc)\n return response\n } else {\n debug.log(\n 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err\n )\n throw err\n }\n }\n // debug.log('createIfNotExists: doc exists, all good: ' + doc)\n return response\n}\n// ends\n"],"file":"chatLogic.js"}
package/lib/logic.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/logic.ts"],"names":["thisFetch","url","requestInit","omitCreds","credentials","authSession","info","webId","fetch","window","solidLogicSingleton","SolidLogic","store","kb","authn","chat","profile","debug","log"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;;;;;AALA;AACA;SAMeA,S;;;;;6FAAf,iBAA0BC,GAA1B,EAA+BC,WAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AACQC,YAAAA,SADR,GACoBD,WAAW,IAAIA,WAAW,CAACE,WAA3B,IAA0CF,WAAW,CAACE,WAAZ,KAA4B,MAD1F;;AAAA,kBAEMC,wBAAYC,IAAZ,CAAiBC,KAAjB,IAA0B,CAACJ,SAFjC;AAAA;AAAA;AAAA;;AAAA,6CAIWE,wBAAYG,KAAZ,CAAkBP,GAAlB,EAAuBC,WAAvB,CAJX;;AAAA;AAAA,6CAMWO,MAAM,CAACD,KAAP,CAAaP,GAAb,EAAkBC,WAAlB,CANX;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAUO,IAAMQ,mBAAmB,GAAG,IAAIC,sBAAJ,CAAe;AAAEH,EAAAA,KAAK,EAAER;AAAT,CAAf,EAAqCK,uBAArC,CAA5B,C,CAEP;;;AACO,IAAMO,KAAK,GAAGF,mBAAmB,CAACE,KAAlC;;AACA,IAAMC,EAAE,GAAGD,KAAX,C,CAAiB;;;AAEjB,IAAME,KAAK,GAAGJ,mBAAmB,CAACI,KAAlC;;AACA,IAAMC,IAAI,GAAGL,mBAAmB,CAACK,IAAjC,C,CAEP;;;AAEO,IAAMC,OAAO,GAAGN,mBAAmB,CAACM,OAApC;;AAEPC,KAAK,CAACC,GAAN,CAAU,+BAAV,E,CAEA","sourcesContent":["// This module of solid-ui has a main quadstore for the app to use\n//\n\nimport * as debug from './debug'\nimport authSession from './authn/authSession'\nimport { SolidLogic } from 'solid-logic'\n\nasync function thisFetch (url, requestInit) {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials === 'omit'\n if (authSession.info.webId && !omitCreds) { // see https://github.com/solid/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n return authSession.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\nexport const solidLogicSingleton = new SolidLogic({ fetch: thisFetch }, authSession)\n\n// Make this directly accessible as it is what you need most of the time\nexport const store = solidLogicSingleton.store\nexport const kb = store // Very commonly used synonym of store - Knowledge Base\n\nexport const authn = solidLogicSingleton.authn\nexport const chat = solidLogicSingleton.chat\n\n// export const language = solidLogicSingleton.language // Does not work\n\nexport const profile = solidLogicSingleton.profile\n\ndebug.log('Unique quadstore initialized.')\n\n// ends\n"],"file":"logic.js"}
1
+ {"version":3,"sources":["../src/logic.ts"],"names":["thisFetch","url","requestInit","omitCreds","credentials","authSession","info","webId","fetch","window","solidLogicSingleton","SolidLogic","store","kb","authn","chat","profile","debug","log"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;;;;;AALA;AACA;SAMeA,S;;;;;6FAAf,iBAA0BC,GAA1B,EAA+BC,WAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AACQC,YAAAA,SADR,GACoBD,WAAW,IAAIA,WAAW,CAACE,WAA3B,IAA0CF,WAAW,CAACE,WAAZ,KAA4B,MAD1F;;AAAA,kBAEMC,wBAAYC,IAAZ,CAAiBC,KAAjB,IAA0B,CAACJ,SAFjC;AAAA;AAAA;AAAA;;AAAA,6CAIWE,wBAAYG,KAAZ,CAAkBP,GAAlB,EAAuBC,WAAvB,CAJX;;AAAA;AAAA,6CAMWO,MAAM,CAACD,KAAP,CAAaP,GAAb,EAAkBC,WAAlB,CANX;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAUO,IAAMQ,mBAAmB,GAAG,IAAIC,sBAAJ,CAAe;AAAEH,EAAAA,KAAK,EAAER;AAAT,CAAf,EAAqCK,uBAArC,CAA5B,C,CAEP;;;AACO,IAAMO,KAAK,GAAGF,mBAAmB,CAACE,KAAlC;;AACA,IAAMC,EAAE,GAAGD,KAAX,C,CAAiB;;;AAEjB,IAAME,KAAK,GAAGJ,mBAAmB,CAACI,KAAlC;;AACA,IAAMC,IAAI,GAAGL,mBAAmB,CAACK,IAAjC,C,CAEP;;;AAEO,IAAMC,OAAO,GAAGN,mBAAmB,CAACM,OAApC;;AAEPC,KAAK,CAACC,GAAN,CAAU,+BAAV,E,CAEA","sourcesContent":["// This module of solid-ui has a main quadstore for the app to use\n//\n\nimport * as debug from './debug'\nimport authSession from './authn/authSession'\nimport { SolidLogic } from 'solid-logic'\n\nasync function thisFetch (url, requestInit) {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials === 'omit'\n if (authSession.info.webId && !omitCreds) { // see https://github.com/solid/solidos/issues/114\n // In fact ftech should respect crentials omit itself\n return authSession.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\nexport const solidLogicSingleton = new SolidLogic({ fetch: thisFetch }, authSession)\n\n// Make this directly accessible as it is what you need most of the time\nexport const store = solidLogicSingleton.store\nexport const kb = store // Very commonly used synonym of store - Knowledge Base\n\nexport const authn = solidLogicSingleton.authn\nexport const chat = solidLogicSingleton.chat\n\n// export const language = solidLogicSingleton.language // Does not work\n\nexport const profile = solidLogicSingleton.profile\n\ndebug.log('Unique quadstore initialized.')\n\n// ends\n"],"file":"logic.js"}
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- buildTime: '2022-01-28T13:51:09Z',
9
- commit: '348f23a849caa9010004b6874dfb6cbcbda56bce',
8
+ buildTime: '2022-01-28T17:29:06Z',
9
+ commit: 'cc1715002d72e1cc9b739700569e70275c3d7c6d',
10
10
  npmInfo: {
11
11
  'solid-ui': '2.4.15',
12
12
  npm: '6.14.15',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/versionInfo.ts"],"names":["buildTime","commit","npmInfo","npm","ares","brotli","cldr","icu","llhttp","modules","napi","nghttp2","node","openssl","tz","unicode","uv","v8","zlib"],"mappings":";;;;;;eAAe;AACbA,EAAAA,SAAS,EAAE,sBADE;AAEbC,EAAAA,MAAM,EAAE,0CAFK;AAGbC,EAAAA,OAAO,EACT;AACE,gBAAY,QADd;AAEEC,IAAAA,GAAG,EAAE,SAFP;AAGEC,IAAAA,IAAI,EAAE,QAHR;AAIEC,IAAAA,MAAM,EAAE,OAJV;AAKEC,IAAAA,IAAI,EAAE,MALR;AAMEC,IAAAA,GAAG,EAAE,MANP;AAOEC,IAAAA,MAAM,EAAE,OAPV;AAQEC,IAAAA,OAAO,EAAE,IARX;AASEC,IAAAA,IAAI,EAAE,GATR;AAUEC,IAAAA,OAAO,EAAE,QAVX;AAWEC,IAAAA,IAAI,EAAE,SAXR;AAYEC,IAAAA,OAAO,EAAE,QAZX;AAaEC,IAAAA,EAAE,EAAE,OAbN;AAcEC,IAAAA,OAAO,EAAE,MAdX;AAeEC,IAAAA,EAAE,EAAE,QAfN;AAgBEC,IAAAA,EAAE,EAAE,oBAhBN;AAiBEC,IAAAA,IAAI,EAAE;AAjBR;AAJe,C","sourcesContent":["export default {\n buildTime: '2022-01-28T13:51:09Z',\n commit: '348f23a849caa9010004b6874dfb6cbcbda56bce',\n npmInfo:\n{\n 'solid-ui': '2.4.15',\n npm: '6.14.15',\n ares: '1.18.1',\n brotli: '1.0.9',\n cldr: '39.0',\n icu: '69.1',\n llhttp: '2.1.4',\n modules: '83',\n napi: '8',\n nghttp2: '1.42.0',\n node: '14.18.3',\n openssl: '1.1.1l',\n tz: '2021a',\n unicode: '13.0',\n uv: '1.42.0',\n v8: '8.4.371.23-node.85',\n zlib: '1.2.11'\n}\n}\n"],"file":"versionInfo.js"}
1
+ {"version":3,"sources":["../src/versionInfo.ts"],"names":["buildTime","commit","npmInfo","npm","ares","brotli","cldr","icu","llhttp","modules","napi","nghttp2","node","openssl","tz","unicode","uv","v8","zlib"],"mappings":";;;;;;eAAe;AACbA,EAAAA,SAAS,EAAE,sBADE;AAEbC,EAAAA,MAAM,EAAE,0CAFK;AAGbC,EAAAA,OAAO,EACT;AACE,gBAAY,QADd;AAEEC,IAAAA,GAAG,EAAE,SAFP;AAGEC,IAAAA,IAAI,EAAE,QAHR;AAIEC,IAAAA,MAAM,EAAE,OAJV;AAKEC,IAAAA,IAAI,EAAE,MALR;AAMEC,IAAAA,GAAG,EAAE,MANP;AAOEC,IAAAA,MAAM,EAAE,OAPV;AAQEC,IAAAA,OAAO,EAAE,IARX;AASEC,IAAAA,IAAI,EAAE,GATR;AAUEC,IAAAA,OAAO,EAAE,QAVX;AAWEC,IAAAA,IAAI,EAAE,SAXR;AAYEC,IAAAA,OAAO,EAAE,QAZX;AAaEC,IAAAA,EAAE,EAAE,OAbN;AAcEC,IAAAA,OAAO,EAAE,MAdX;AAeEC,IAAAA,EAAE,EAAE,QAfN;AAgBEC,IAAAA,EAAE,EAAE,oBAhBN;AAiBEC,IAAAA,IAAI,EAAE;AAjBR;AAJe,C","sourcesContent":["export default {\n buildTime: '2022-01-28T17:29:06Z',\n commit: 'cc1715002d72e1cc9b739700569e70275c3d7c6d',\n npmInfo:\n{\n 'solid-ui': '2.4.15',\n npm: '6.14.15',\n ares: '1.18.1',\n brotli: '1.0.9',\n cldr: '39.0',\n icu: '69.1',\n llhttp: '2.1.4',\n modules: '83',\n napi: '8',\n nghttp2: '1.42.0',\n node: '14.18.3',\n openssl: '1.1.1l',\n tz: '2021a',\n unicode: '13.0',\n uv: '1.42.0',\n v8: '8.4.371.23-node.85',\n zlib: '1.2.11'\n}\n}\n"],"file":"versionInfo.js"}