solid-ui 2.4.16-eb82ec38 → 2.4.18-707601b1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"access-controller.d.ts","sourceRoot":"","sources":["../../src/acl/access-controller.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAS,SAAS,EAAiB,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAKlD;;GAEG;AACH,qBAAa,gBAAgB;IASlB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,kBAAkB;IAClC,OAAO,CAAC,aAAa;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,OAAO;IACjC,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,wBAAwB;IACzB,KAAK;IACL,GAAG;IApBL,SAAS,EAAE,YAAY,CAAA;IACvB,aAAa,EAAE,YAAY,GAAG,IAAI,CAAA;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,eAAe,CAAS;gBAGvB,OAAO,EAAE,SAAS,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,EAC1B,aAAa,EAAE,WAAW,EAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,iBAAiB,EAAE,OAAO,EACzB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,SAAS,GAAG,IAAI,EAC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cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,eAAe,CAAS;gBAGvB,OAAO,EAAE,SAAS,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,EAC1B,aAAa,EAAE,WAAW,EAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,iBAAiB,EAAE,OAAO,EACzB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,SAAS,GAAG,IAAI,EAC/B,aAAa,EAAE,SAAS,GAAG,IAAI,EAC/B,wBAAwB,EAAE,SAAS,GAAG,SAAS,EAChD,KAAK,KAAA,EACL,GAAG,KAAA;IAmBZ,IAAW,UAAU,IAAK,OAAO,CAEhC;IAEM,MAAM,IAAK,WAAW;IA6B7B,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,2BAA2B;IAgBnC,OAAO,CAAC,8BAA8B;IAiB/B,qBAAqB,CAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAa7C,YAAY,CAAE,OAAO,EAAE,MAAM,GAAG,IAAI;YAM7B,OAAO;YAmBP,WAAW;YAKX,UAAU;YAiBV,cAAc;IAcrB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;CA0C9B"}
@@ -423,8 +423,12 @@ var AccessController = /*#__PURE__*/function () {
423
423
  } else {
424
424
  // Linked controls
425
425
  (0, _acl.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true, true);
426
- }
426
+ } // add authenticated fetcher
427
+
427
428
 
429
+ newAClGraph.fetcher = (0, _rdflib.fetcher)(newAClGraph, {
430
+ fetch: this.store.fetcher._fetch
431
+ });
428
432
  var updater = newAClGraph.updater || new _rdflib.UpdateManager(newAClGraph); // save ACL resource
429
433
 
430
434
  return new Promise(function (resolve, reject) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/acl/access-controller.ts"],"names":["AccessController","subject","noun","context","statusElement","classes","targetIsProtected","targetDoc","targetACLDoc","defaultHolder","defaultACLDoc","prospectiveDefaultHolder","store","dom","rootElement","createElement","classList","add","aclGroupContent","isContainer","uri","slice","isUsingDefaults","aclDefaultStore","mainCombo","AccessGroups","defaults","defaultsCombo","defaultsDiffer","aclMap","innerHTML","renderStatus","defaultHolderLink","appendChild","href","innerText","render","renderRemoveDefaultsController","isEditable","renderAddDefaultsController","renderAddAclsController","renderRemoveAclsController","useDefaultButton","utils","label","bigButton","addEventListener","removeAcls","then","error","addAclButton","addAcls","containerElement","defaultsController","noticeElement","defaultsControllerNotice","button","addDefaults","removeDefaults","message","aclControlBoxStatusRevealed","temporaryStatusInit","setTimeout","temporaryStatusEnd","toggle","debug","Promise","reject","aclGraph","statements","forEach","st","predicate","object","fetcher","putBack","resolve","warn","fallbackCombo","save","newAClGraph","byCombo","updater","UpdateManager","put","statementsMatching","undefined","ok","Error","unload","requested","log"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;AACA;;AAUA;AACA;AACA;IACaA,gB;AAQX,4BACSC,OADT,EAESC,IAFT,EAGSC,OAHT,EAIUC,aAJV,EAKSC,OALT,EAMSC,iBANT,EAOUC,SAPV,EAQUC,YARV,EASUC,aATV,EAUUC,aAVV,EAWUC,wBAXV,EAYSC,KAZT,EAaSC,GAbT,EAcE;AAAA;AAAA,SAbOZ,OAaP,GAbOA,OAaP;AAAA,SAZOC,IAYP,GAZOA,IAYP;AAAA,SAXOC,OAWP,GAXOA,OAWP;AAAA,SAVQC,aAUR,GAVQA,aAUR;AAAA,SATOC,OASP,GATOA,OASP;AAAA,SAROC,iBAQP,GAROA,iBAQP;AAAA,SAPQC,SAOR,GAPQA,SAOR;AAAA,SANQC,YAMR,GANQA,YAMR;AAAA,SALQC,aAKR,GALQA,aAKR;AAAA,SAJQC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AAD,EAAMmE,EAAN,EAAU5B,OAAV,EAAsB;AACpB,cAAI,CAAC4B,EAAL,EAAS;AACP,mBAAOpB,MAAM,CAAC,IAAIqB,KAAJ,iCAAmC7B,OAAnC,EAAD,CAAb;AACD;;AACD,UAAA,MAAI,CAAC/C,KAAL,CAAW8D,OAAX,CAAmBe,MAAnB,CAA0B,MAAI,CAACjF,YAA/B;;AACA,UAAA,MAAI,CAACI,KAAL,CAAWK,GAAX,CAAe+D,WAAW,CAACX,UAA3B;;AACA,UAAA,MAAI,CAACzD,KAAL,CAAW8D,OAAX,CAAmBgB,SAAnB,CAA6B,MAAI,CAAClF,YAAL,CAAkBY,GAA/C,IAAsD,MAAtD,CANoB,CAMyC;;AAC7D,UAAA,MAAI,CAACI,SAAL,CAAeZ,KAAf,GAAuB,MAAI,CAACA,KAA5B;;AACA,cAAI,MAAI,CAACe,aAAT,EAAwB;AACtB,YAAA,MAAI,CAACA,aAAL,CAAmBf,KAAnB,GAA2B,MAAI,CAACA,KAAhC;AACD;;AACD,UAAA,MAAI,CAACgB,cAAL,GAAsB,CAAC,CAAC,MAAI,CAACD,aAAP,IAAwB,CAAC,kBAAQ,MAAI,CAACH,SAAL,CAAeK,MAAvB,EAA+B,MAAI,CAACF,aAAL,CAAmBE,MAAlD,CAA/C;AACAoC,UAAAA,KAAK,CAAC0B,GAAN,CAAU,4BAAV;AACAf,UAAAA,OAAO;AACR,SAlBH;AAoBD,OArBM,CAAP;AAsBD","sourcesContent":["/**\n * Contains the [[AccessController]] class\n * @packageDocumentation\n */\n\nimport { adoptACLDefault, getProspectiveHolder, makeACLGraphbyCombo, sameACL } from './acl'\nimport { graph, NamedNode, UpdateManager } from 'rdflib'\nimport { AccessGroups } from './access-groups'\nimport { DataBrowserContext } from 'pane-registry'\nimport { shortNameForFolder } from './acl-control'\nimport * as utils from '../utils'\nimport * as debug from '../debug'\n\n/**\n * Rendered HTML component used in the databrowser's Sharing pane.\n */\nexport class AccessController {\n public mainCombo: AccessGroups\n public defaultsCombo: AccessGroups | null\n private readonly isContainer: boolean\n private defaultsDiffer: boolean\n private readonly rootElement: HTMLElement\n private isUsingDefaults: boolean\n\n constructor (\n public subject: NamedNode,\n public noun: string,\n public context: DataBrowserContext,\n private statusElement: HTMLElement,\n public classes: Record<string, string>,\n public targetIsProtected: boolean,\n private targetDoc: NamedNode,\n private targetACLDoc: NamedNode,\n private defaultHolder: NamedNode | null,\n private defaultACLDoc: NamedNode | null,\n private prospectiveDefaultHolder: NamedNode | undefined,\n public store,\n public dom\n ) {\n this.rootElement = dom.createElement('div')\n this.rootElement.classList.add(classes.aclGroupContent)\n this.isContainer = targetDoc.uri.slice(-1) === '/' // Give default for all directories\n if (defaultHolder && defaultACLDoc) {\n this.isUsingDefaults = true\n const aclDefaultStore = adoptACLDefault(this.targetDoc, targetACLDoc, defaultHolder, defaultACLDoc)\n this.mainCombo = new AccessGroups(targetDoc, targetACLDoc, this, aclDefaultStore, { defaults: this.isContainer })\n this.defaultsCombo = null\n this.defaultsDiffer = false\n } else {\n this.isUsingDefaults = false\n this.mainCombo = new AccessGroups(targetDoc, targetACLDoc, this, store)\n this.defaultsCombo = new AccessGroups(targetDoc, targetACLDoc, this, store, { defaults: this.isContainer })\n this.defaultsDiffer = !sameACL(this.mainCombo.aclMap, this.defaultsCombo.aclMap)\n }\n }\n\n public get isEditable (): boolean {\n return !this.isUsingDefaults\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n if (this.isUsingDefaults) {\n this.renderStatus(`The sharing for this ${this.noun} is the default for folder `)\n if (this.defaultHolder) {\n const defaultHolderLink = this.statusElement.appendChild(this.dom.createElement('a'))\n defaultHolderLink.href = this.defaultHolder.uri\n defaultHolderLink.innerText = shortNameForFolder(this.defaultHolder)\n }\n } else if (!this.defaultsDiffer && this.isContainer) {\n this.renderStatus('This is also the default for things in this folder.')\n } else {\n this.renderStatus('')\n }\n this.rootElement.appendChild(this.mainCombo.render())\n if (this.defaultsCombo && this.defaultsDiffer) {\n this.rootElement.appendChild(this.renderRemoveDefaultsController())\n this.rootElement.appendChild(this.defaultsCombo.render())\n } else if (this.isEditable && this.isContainer) {\n this.rootElement.appendChild(this.renderAddDefaultsController())\n }\n if (!this.targetIsProtected && this.isUsingDefaults) {\n this.rootElement.appendChild(this.renderAddAclsController())\n } else if (!this.targetIsProtected) {\n this.rootElement.appendChild(this.renderRemoveAclsController())\n }\n return this.rootElement\n }\n\n private renderRemoveAclsController (): HTMLElement {\n const useDefaultButton = this.dom.createElement('button')\n useDefaultButton.innerText = `Remove custom sharing settings for this ${this.noun} -- just use default${this.prospectiveDefaultHolder ? ` for ${utils.label(this.prospectiveDefaultHolder)}` : ''}`\n useDefaultButton.classList.add(this.classes.bigButton)\n useDefaultButton.addEventListener('click', () => this.removeAcls()\n .then(() => this.render())\n .catch(error => this.renderStatus(error)))\n return useDefaultButton\n }\n\n private renderAddAclsController (): HTMLElement {\n const addAclButton = this.dom.createElement('button')\n addAclButton.innerText = `Set specific sharing for this ${this.noun}`\n addAclButton.classList.add(this.classes.bigButton)\n addAclButton.addEventListener('click', () => this.addAcls()\n .then(() => this.render())\n .catch(error => this.renderStatus(error)))\n return addAclButton\n }\n\n private renderAddDefaultsController (): HTMLElement {\n const containerElement = this.dom.createElement('div')\n containerElement.classList.add(this.classes.defaultsController)\n\n const noticeElement = containerElement.appendChild(this.dom.createElement('div'))\n noticeElement.innerText = 'Sharing for things within the folder currently tracks sharing for the folder.'\n noticeElement.classList.add(this.classes.defaultsControllerNotice)\n\n const button = containerElement.appendChild(this.dom.createElement('button'))\n button.innerText = 'Set the sharing of folder contents separately from the sharing for the folder'\n button.classList.add(this.classes.bigButton)\n button.addEventListener('click', () => this.addDefaults()\n .then(() => this.render()))\n return containerElement\n }\n\n private renderRemoveDefaultsController (): HTMLElement {\n const containerElement = this.dom.createElement('div')\n containerElement.classList.add(this.classes.defaultsController)\n\n const noticeElement = containerElement.appendChild(this.dom.createElement('div'))\n noticeElement.innerText = 'Access to things within this folder:'\n noticeElement.classList.add(this.classes.defaultsControllerNotice)\n\n const button = containerElement.appendChild(this.dom.createElement('button'))\n button.innerText = 'Set default for folder contents to just track the sharing for the folder'\n button.classList.add(this.classes.bigButton)\n button.addEventListener('click', () => this.removeDefaults()\n .then(() => this.render())\n .catch(error => this.renderStatus(error)))\n return containerElement\n }\n\n public renderTemporaryStatus (message: string): void {\n // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87\n this.statusElement.classList.add(this.classes.aclControlBoxStatusRevealed)\n this.statusElement.innerText = message\n this.statusElement.classList.add(this.classes.temporaryStatusInit)\n setTimeout(() => {\n this.statusElement.classList.add(this.classes.temporaryStatusEnd)\n })\n setTimeout(() => {\n this.statusElement.innerText = ''\n }, 5000)\n }\n\n public renderStatus (message: string): void {\n // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87\n this.statusElement.classList.toggle(this.classes.aclControlBoxStatusRevealed, !!message)\n this.statusElement.innerText = message\n }\n\n private async addAcls (): Promise<void> {\n if (!this.defaultHolder || !this.defaultACLDoc) {\n const message = 'Unable to find defaults to copy'\n debug.error(message)\n return Promise.reject(message)\n }\n const aclGraph = adoptACLDefault(this.targetDoc, this.targetACLDoc, this.defaultHolder, this.defaultACLDoc)\n aclGraph.statements.forEach(st => this.store.add(st.subject, st.predicate, st.object, this.targetACLDoc))\n try {\n await this.store.fetcher.putBack(this.targetACLDoc)\n this.isUsingDefaults = false\n return Promise.resolve()\n } catch (error) {\n const message = ` Error writing back access control file! ${error}`\n debug.error(message)\n return Promise.reject(message)\n }\n }\n\n private async addDefaults (): Promise<void> {\n this.defaultsCombo = new AccessGroups(this.targetDoc, this.targetACLDoc, this, this.store, { defaults: true })\n this.defaultsDiffer = true\n }\n\n private async removeAcls (): Promise<void> {\n try {\n await this.store.fetcher.delete(this.targetACLDoc.uri, {})\n this.isUsingDefaults = true\n try {\n this.prospectiveDefaultHolder = await getProspectiveHolder(this.targetDoc.uri)\n } catch (error) {\n // No need to show this error in status, but good to warn about it in console\n debug.warn(error)\n }\n } catch (error) {\n const message = `Error deleting access control file: ${this.targetACLDoc}: ${error}`\n debug.error(message)\n return Promise.reject(message)\n }\n }\n\n private async removeDefaults (): Promise<void> {\n const fallbackCombo = this.defaultsCombo\n try {\n this.defaultsCombo = null\n this.defaultsDiffer = false\n await this.save()\n } catch (error) {\n this.defaultsCombo = fallbackCombo\n this.defaultsDiffer = true\n debug.error(error)\n return Promise.reject(error)\n }\n }\n\n public save (): Promise<void> {\n // build graph\n const newAClGraph = graph()\n if (!this.isContainer) {\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true)\n } else if (this.defaultsCombo && this.defaultsDiffer) {\n // Pair of controls\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true)\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.defaultsCombo.byCombo, this.targetACLDoc, false, true)\n } else {\n // Linked controls\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true, true)\n }\n\n const updater = newAClGraph.updater || new UpdateManager(newAClGraph)\n\n // save ACL resource\n return new Promise((resolve, reject) => {\n updater.put(\n this.targetACLDoc,\n newAClGraph.statementsMatching(undefined, undefined, undefined, this.targetACLDoc),\n 'text/turtle',\n (uri, ok, message) => {\n if (!ok) {\n return reject(new Error(`ACL file save failed: ${message}`))\n }\n this.store.fetcher.unload(this.targetACLDoc)\n this.store.add(newAClGraph.statements)\n this.store.fetcher.requested[this.targetACLDoc.uri] = 'done' // missing: save headers\n this.mainCombo.store = this.store\n if (this.defaultsCombo) {\n this.defaultsCombo.store = this.store\n }\n this.defaultsDiffer = !!this.defaultsCombo && !sameACL(this.mainCombo.aclMap, this.defaultsCombo.aclMap)\n debug.log('ACL modification: success!')\n resolve()\n }\n )\n })\n }\n}\n"],"file":"access-controller.js"}
1
+ {"version":3,"sources":["../../src/acl/access-controller.ts"],"names":["AccessController","subject","noun","context","statusElement","classes","targetIsProtected","targetDoc","targetACLDoc","defaultHolder","defaultACLDoc","prospectiveDefaultHolder","store","dom","rootElement","createElement","classList","add","aclGroupContent","isContainer","uri","slice","isUsingDefaults","aclDefaultStore","mainCombo","AccessGroups","defaults","defaultsCombo","defaultsDiffer","aclMap","innerHTML","renderStatus","defaultHolderLink","appendChild","href","innerText","render","renderRemoveDefaultsController","isEditable","renderAddDefaultsController","renderAddAclsController","renderRemoveAclsController","useDefaultButton","utils","label","bigButton","addEventListener","removeAcls","then","error","addAclButton","addAcls","containerElement","defaultsController","noticeElement","defaultsControllerNotice","button","addDefaults","removeDefaults","message","aclControlBoxStatusRevealed","temporaryStatusInit","setTimeout","temporaryStatusEnd","toggle","debug","Promise","reject","aclGraph","statements","forEach","st","predicate","object","fetcher","putBack","resolve","warn","fallbackCombo","save","newAClGraph","byCombo","fetch","_fetch","updater","UpdateManager","put","statementsMatching","undefined","ok","Error","unload","requested","log"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;AACA;;AAUA;AACA;AACA;IACaA,gB;AAQX,4BACSC,OADT,EAESC,IAFT,EAGSC,OAHT,EAIUC,aAJV,EAKSC,OALT,EAMSC,iBANT,EAOUC,SAPV,EAQUC,YARV,EASUC,aATV,EAUUC,aAVV,EAWUC,wBAXV,EAYSC,KAZT,EAaSC,GAbT,EAcE;AAAA;AAAA,SAbOZ,OAaP,GAbOA,OAaP;AAAA,SAZOC,IAYP,GAZOA,IAYP;AAAA,SAXOC,OAWP,GAXOA,OAWP;AAAA,SAVQC,aAUR,GAVQA,aAUR;AAAA,SATOC,OASP,GATOA,OASP;AAAA,SAROC,iBAQP,GAROA,iBAQP;AAAA,SAPQC,SAOR,GAPQA,SAOR;AAAA,SANQC,YAMR,GANQA,YAMR;AAAA,SALQC,aAKR,GALQA,aAKR;AAAA,SAJQC,aAIR,GAJQA,aAIR;AA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C9E,YADP,EAEEwE,WAAW,CAACO,kBAAZ,CAA+BC,SAA/B,EAA0CA,SAA1C,EAAqDA,SAArD,EAAgE,MAAI,CAAChF,YAArE,CAFF,EAGE,aAHF,EAIE,UAACY,GAAD,EAAMqE,EAAN,EAAU9B,OAAV,EAAsB;AACpB,cAAI,CAAC8B,EAAL,EAAS;AACP,mBAAOtB,MAAM,CAAC,IAAIuB,KAAJ,iCAAmC/B,OAAnC,EAAD,CAAb;AACD;;AACD,UAAA,MAAI,CAAC/C,KAAL,CAAW8D,OAAX,CAAmBiB,MAAnB,CAA0B,MAAI,CAACnF,YAA/B;;AACA,UAAA,MAAI,CAACI,KAAL,CAAWK,GAAX,CAAe+D,WAAW,CAACX,UAA3B;;AACA,UAAA,MAAI,CAACzD,KAAL,CAAW8D,OAAX,CAAmBkB,SAAnB,CAA6B,MAAI,CAACpF,YAAL,CAAkBY,GAA/C,IAAsD,MAAtD,CANoB,CAMyC;;AAC7D,UAAA,MAAI,CAACI,SAAL,CAAeZ,KAAf,GAAuB,MAAI,CAACA,KAA5B;;AACA,cAAI,MAAI,CAACe,aAAT,EAAwB;AACtB,YAAA,MAAI,CAACA,aAAL,CAAmBf,KAAnB,GAA2B,MAAI,CAACA,KAAhC;AACD;;AACD,UAAA,MAAI,CAACgB,cAAL,GAAsB,CAAC,CAAC,MAAI,CAACD,aAAP,IAAwB,CAAC,kBAAQ,MAAI,CAACH,SAAL,CAAeK,MAAvB,EAA+B,MAAI,CAACF,aAAL,CAAmBE,MAAlD,CAA/C;AACAoC,UAAAA,KAAK,CAAC4B,GAAN,CAAU,4BAAV;AACAjB,UAAAA,OAAO;AACR,SAlBH;AAoBD,OArBM,CAAP;AAsBD","sourcesContent":["/**\n * Contains the [[AccessController]] class\n * @packageDocumentation\n */\n\nimport { adoptACLDefault, getProspectiveHolder, makeACLGraphbyCombo, sameACL } from './acl'\nimport { fetcher, graph, NamedNode, UpdateManager } from 'rdflib'\nimport { AccessGroups } from './access-groups'\nimport { DataBrowserContext } from 'pane-registry'\nimport { shortNameForFolder } from './acl-control'\nimport * as utils from '../utils'\nimport * as debug from '../debug'\n\n/**\n * Rendered HTML component used in the databrowser's Sharing pane.\n */\nexport class AccessController {\n public mainCombo: AccessGroups\n public defaultsCombo: AccessGroups | null\n private readonly isContainer: boolean\n private defaultsDiffer: boolean\n private readonly rootElement: HTMLElement\n private isUsingDefaults: boolean\n\n constructor (\n public subject: NamedNode,\n public noun: string,\n public context: DataBrowserContext,\n private statusElement: HTMLElement,\n public classes: Record<string, string>,\n public targetIsProtected: boolean,\n private targetDoc: NamedNode,\n private targetACLDoc: NamedNode,\n private defaultHolder: NamedNode | null,\n private defaultACLDoc: NamedNode | null,\n private prospectiveDefaultHolder: NamedNode | undefined,\n public store,\n public dom\n ) {\n this.rootElement = dom.createElement('div')\n this.rootElement.classList.add(classes.aclGroupContent)\n this.isContainer = targetDoc.uri.slice(-1) === '/' // Give default for all directories\n if (defaultHolder && defaultACLDoc) {\n this.isUsingDefaults = true\n const aclDefaultStore = adoptACLDefault(this.targetDoc, targetACLDoc, defaultHolder, defaultACLDoc)\n this.mainCombo = new AccessGroups(targetDoc, targetACLDoc, this, aclDefaultStore, { defaults: this.isContainer })\n this.defaultsCombo = null\n this.defaultsDiffer = false\n } else {\n this.isUsingDefaults = false\n this.mainCombo = new AccessGroups(targetDoc, targetACLDoc, this, store)\n this.defaultsCombo = new AccessGroups(targetDoc, targetACLDoc, this, store, { defaults: this.isContainer })\n this.defaultsDiffer = !sameACL(this.mainCombo.aclMap, this.defaultsCombo.aclMap)\n }\n }\n\n public get isEditable (): boolean {\n return !this.isUsingDefaults\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n if (this.isUsingDefaults) {\n this.renderStatus(`The sharing for this ${this.noun} is the default for folder `)\n if (this.defaultHolder) {\n const defaultHolderLink = this.statusElement.appendChild(this.dom.createElement('a'))\n defaultHolderLink.href = this.defaultHolder.uri\n defaultHolderLink.innerText = shortNameForFolder(this.defaultHolder)\n }\n } else if (!this.defaultsDiffer && this.isContainer) {\n this.renderStatus('This is also the default for things in this folder.')\n } else {\n this.renderStatus('')\n }\n this.rootElement.appendChild(this.mainCombo.render())\n if (this.defaultsCombo && this.defaultsDiffer) {\n this.rootElement.appendChild(this.renderRemoveDefaultsController())\n this.rootElement.appendChild(this.defaultsCombo.render())\n } else if (this.isEditable && this.isContainer) {\n this.rootElement.appendChild(this.renderAddDefaultsController())\n }\n if (!this.targetIsProtected && this.isUsingDefaults) {\n this.rootElement.appendChild(this.renderAddAclsController())\n } else if (!this.targetIsProtected) {\n this.rootElement.appendChild(this.renderRemoveAclsController())\n }\n return this.rootElement\n }\n\n private renderRemoveAclsController (): HTMLElement {\n const useDefaultButton = this.dom.createElement('button')\n useDefaultButton.innerText = `Remove custom sharing settings for this ${this.noun} -- just use default${this.prospectiveDefaultHolder ? ` for ${utils.label(this.prospectiveDefaultHolder)}` : ''}`\n useDefaultButton.classList.add(this.classes.bigButton)\n useDefaultButton.addEventListener('click', () => this.removeAcls()\n .then(() => this.render())\n .catch(error => this.renderStatus(error)))\n return useDefaultButton\n }\n\n private renderAddAclsController (): HTMLElement {\n const addAclButton = this.dom.createElement('button')\n addAclButton.innerText = `Set specific sharing for this ${this.noun}`\n addAclButton.classList.add(this.classes.bigButton)\n addAclButton.addEventListener('click', () => this.addAcls()\n .then(() => this.render())\n .catch(error => this.renderStatus(error)))\n return addAclButton\n }\n\n private renderAddDefaultsController (): HTMLElement {\n const containerElement = this.dom.createElement('div')\n containerElement.classList.add(this.classes.defaultsController)\n\n const noticeElement = containerElement.appendChild(this.dom.createElement('div'))\n noticeElement.innerText = 'Sharing for things within the folder currently tracks sharing for the folder.'\n noticeElement.classList.add(this.classes.defaultsControllerNotice)\n\n const button = containerElement.appendChild(this.dom.createElement('button'))\n button.innerText = 'Set the sharing of folder contents separately from the sharing for the folder'\n button.classList.add(this.classes.bigButton)\n button.addEventListener('click', () => this.addDefaults()\n .then(() => this.render()))\n return containerElement\n }\n\n private renderRemoveDefaultsController (): HTMLElement {\n const containerElement = this.dom.createElement('div')\n containerElement.classList.add(this.classes.defaultsController)\n\n const noticeElement = containerElement.appendChild(this.dom.createElement('div'))\n noticeElement.innerText = 'Access to things within this folder:'\n noticeElement.classList.add(this.classes.defaultsControllerNotice)\n\n const button = containerElement.appendChild(this.dom.createElement('button'))\n button.innerText = 'Set default for folder contents to just track the sharing for the folder'\n button.classList.add(this.classes.bigButton)\n button.addEventListener('click', () => this.removeDefaults()\n .then(() => this.render())\n .catch(error => this.renderStatus(error)))\n return containerElement\n }\n\n public renderTemporaryStatus (message: string): void {\n // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87\n this.statusElement.classList.add(this.classes.aclControlBoxStatusRevealed)\n this.statusElement.innerText = message\n this.statusElement.classList.add(this.classes.temporaryStatusInit)\n setTimeout(() => {\n this.statusElement.classList.add(this.classes.temporaryStatusEnd)\n })\n setTimeout(() => {\n this.statusElement.innerText = ''\n }, 5000)\n }\n\n public renderStatus (message: string): void {\n // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87\n this.statusElement.classList.toggle(this.classes.aclControlBoxStatusRevealed, !!message)\n this.statusElement.innerText = message\n }\n\n private async addAcls (): Promise<void> {\n if (!this.defaultHolder || !this.defaultACLDoc) {\n const message = 'Unable to find defaults to copy'\n debug.error(message)\n return Promise.reject(message)\n }\n const aclGraph = adoptACLDefault(this.targetDoc, this.targetACLDoc, this.defaultHolder, this.defaultACLDoc)\n aclGraph.statements.forEach(st => this.store.add(st.subject, st.predicate, st.object, this.targetACLDoc))\n try {\n await this.store.fetcher.putBack(this.targetACLDoc)\n this.isUsingDefaults = false\n return Promise.resolve()\n } catch (error) {\n const message = ` Error writing back access control file! ${error}`\n debug.error(message)\n return Promise.reject(message)\n }\n }\n\n private async addDefaults (): Promise<void> {\n this.defaultsCombo = new AccessGroups(this.targetDoc, this.targetACLDoc, this, this.store, { defaults: true })\n this.defaultsDiffer = true\n }\n\n private async removeAcls (): Promise<void> {\n try {\n await this.store.fetcher.delete(this.targetACLDoc.uri, {})\n this.isUsingDefaults = true\n try {\n this.prospectiveDefaultHolder = await getProspectiveHolder(this.targetDoc.uri)\n } catch (error) {\n // No need to show this error in status, but good to warn about it in console\n debug.warn(error)\n }\n } catch (error) {\n const message = `Error deleting access control file: ${this.targetACLDoc}: ${error}`\n debug.error(message)\n return Promise.reject(message)\n }\n }\n\n private async removeDefaults (): Promise<void> {\n const fallbackCombo = this.defaultsCombo\n try {\n this.defaultsCombo = null\n this.defaultsDiffer = false\n await this.save()\n } catch (error) {\n this.defaultsCombo = fallbackCombo\n this.defaultsDiffer = true\n debug.error(error)\n return Promise.reject(error)\n }\n }\n\n public save (): Promise<void> {\n // build graph\n const newAClGraph = graph()\n if (!this.isContainer) {\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true)\n } else if (this.defaultsCombo && this.defaultsDiffer) {\n // Pair of controls\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true)\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.defaultsCombo.byCombo, this.targetACLDoc, false, true)\n } else {\n // Linked controls\n makeACLGraphbyCombo(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true, true)\n }\n\n // add authenticated fetcher\n newAClGraph.fetcher = fetcher(newAClGraph, { fetch: this.store.fetcher._fetch })\n const updater = newAClGraph.updater || new UpdateManager(newAClGraph)\n\n // save ACL resource\n return new Promise((resolve, reject) => {\n updater.put(\n this.targetACLDoc,\n newAClGraph.statementsMatching(undefined, undefined, undefined, this.targetACLDoc),\n 'text/turtle',\n (uri, ok, message) => {\n if (!ok) {\n return reject(new Error(`ACL file save failed: ${message}`))\n }\n this.store.fetcher.unload(this.targetACLDoc)\n this.store.add(newAClGraph.statements)\n this.store.fetcher.requested[this.targetACLDoc.uri] = 'done' // missing: save headers\n this.mainCombo.store = this.store\n if (this.defaultsCombo) {\n this.defaultsCombo.store = this.store\n }\n this.defaultsDiffer = !!this.defaultsCombo && !sameACL(this.mainCombo.aclMap, this.defaultsCombo.aclMap)\n debug.log('ACL modification: success!')\n resolve()\n }\n )\n })\n }\n}\n"],"file":"access-controller.js"}
@@ -3,7 +3,7 @@
3
3
  * and [[AccessGroupsOptions]] classes
4
4
  * @packageDocumentation
5
5
  */
6
- import { IndexedFormula, NamedNode, LiveStore } from 'rdflib';
6
+ import { NamedNode, LiveStore } from 'rdflib';
7
7
  import { AccessController } from './access-controller';
8
8
  import { AgentMapMap, ComboList } from './types';
9
9
  /**
@@ -27,7 +27,7 @@ export declare class AccessGroups {
27
27
  private readonly addAgentButton;
28
28
  private readonly rootElement;
29
29
  private _store;
30
- constructor(doc: NamedNode, aclDoc: NamedNode, controller: AccessController, store: IndexedFormula, options?: AccessGroupsOptions);
30
+ constructor(doc: NamedNode, aclDoc: NamedNode, controller: AccessController, store: LiveStore, options?: AccessGroupsOptions);
31
31
  get store(): LiveStore;
32
32
  set store(store: LiveStore);
33
33
  render(): HTMLElement;
@@ -1 +1 @@
1
- {"version":3,"file":"access-groups.d.ts","sourceRoot":"","sources":["../../src/acl/access-groups.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAW,cAAc,EAAE,SAAS,EAAO,SAAS,EAAE,MAAM,QAAQ,CAAA;AAI3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAsB,MAAM,SAAS,CAAA;AAgCpE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,qBAAa,YAAY;IASrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,MAAM;IACP,UAAU,EAAE,gBAAgB;IAEnC,OAAO,CAAC,OAAO;IAZjB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS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IAClB,MAAM,EAAE,WAAW,CAAA;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,MAAM,CAAW;gBAGf,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,SAAS,EAClB,UAAU,EAAE,gBAAgB,EACnC,KAAK,EAAE,SAAS,EACR,OAAO,GAAE,mBAAwB;IAW3C,IAAW,KAAK,cAEf;IAED,IAAW,KAAK,CAAE,KAAK,WAAA,EAItB;IAEM,MAAM,IAAK,WAAW;IAS7B,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,WAAW;YAWL,WAAW;IASZ,SAAS,CAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAKrC,iBAAiB;YASjB,gBAAgB;IAqB9B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,qBAAqB;CAY9B"}
@@ -89,11 +89,7 @@ var AccessGroups = /*#__PURE__*/function () {
89
89
  (0, _defineProperty2["default"])(this, "rootElement", void 0);
90
90
  (0, _defineProperty2["default"])(this, "_store", void 0);
91
91
  this.defaults = options.defaults || false;
92
- (0, _rdflib.fetcher)(store, {}); // The store will already have an updater at this point:
93
- // store.updater = new UpdateManager(store)
94
-
95
- this._store = store; // TODO hacky, find a better solution
96
-
92
+ this._store = store;
97
93
  this.aclMap = (0, _acl.readACL)(doc, aclDoc, store, this.defaults);
98
94
  this.byCombo = (0, _acl.ACLbyCombination)(this.aclMap);
99
95
  this.addAgentButton = new _addAgentButtons.AddAgentButtons(this);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/acl/access-groups.ts"],"names":["ACL","ns","acl","COLLOQUIAL","RECOMMENDED","EXPLANATION","AccessGroups","doc","aclDoc","controller","store","options","defaults","_store","aclMap","byCombo","addAgentButton","AddAgentButtons","rootElement","dom","createElement","classList","add","classes","accessGroupList","innerHTML","renderGroups","forEach","group","appendChild","isEditable","render","groupElements","comboIndex","combo","kToCombo","push","renderGroup","groupRow","accessGroupListItem","widgets","makeDropTarget","uris","handleDroppedUris","then","error","renderStatus","groupColumns","renderGroupElements","column","groupNameColumn","toggle","innerText","ktToList","groupAgentsColumn","groupAgentsTable","combos","map","pred","obj","renderAgent","agentElement","groupDescriptionElement","personRow","personTR","deleteFunction","deleteAgent","removeChild","comboToRemove","find","comboPred","comboObj","splice","indexOf","save","uri","handleDroppedUri","Promise","all","reject","secondAttempt","agent","findAgent","thing","debug","log","fetcher","load","message","Error","setACLCombo","subject","res","removeAgentFromCombos","k","i","length","y","sort","join","list","kb","types","findTypeURIs","ty","startsWith","split","endsWith","slice","vcard","sameTerm","foaf","rdf","owl","pref","any","solid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AAGA;;AACA;;;;;;AAbA;AACA;AACA;AACA;AACA;AAWA,IAAMA,GAAG,GAAGC,EAAE,CAACC,GAAf;AAEA,IAAMC,UAAU,GAAG;AACjB,MAAI,QADa;AAEjB,KAAG,uBAFc;AAGjB,KAAG,SAHc;AAIjB,KAAG,SAJc;AAKjB,KAAG,YALc;AAMjB,KAAG;AANc,CAAnB;AASA,IAAMC,WAAW,GAAG;AAClB,MAAI,IADc;AAElB,KAAG,IAFe;AAGlB,KAAG,IAHe;AAIlB,KAAG,IAJe;AAKlB,KAAG;AALe,CAApB;AAQA,IAAMC,WAAW,GAAG;AAClB,MAAI,uCADc;AAElB,KAAG,uDAFe;AAGlB,KAAG,iCAHe;AAIlB,KAAG,uEAJe;AAKlB,KAAG,0CALe;AAMlB,KAAG;AANe,CAApB;AASA;AACA;AACA;;AAKA;AACA;AACA;AACA;IACaC,Y;AAQX,wBACUC,GADV,EAEUC,MAFV,EAGSC,UAHT,EAIEC,KAJF,EAME;AAAA,QADQC,OACR,uEADuC,EACvC;AAAA;AAAA,SALQJ,GAKR,GALQA,GAKR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the [[AccessGroups]]\n * and [[AccessGroupsOptions]] classes\n * @packageDocumentation\n */\n\nimport { fetcher, IndexedFormula, NamedNode, sym, LiveStore } from 'rdflib'\nimport { ACLbyCombination, readACL } from './acl'\nimport * as widgets from '../widgets'\nimport * as ns from '../ns'\nimport { AccessController } from './access-controller'\nimport { AgentMapMap, ComboList, PartialAgentTriple } from './types'\nimport { AddAgentButtons } from './add-agent-buttons'\nimport * as debug from '../debug'\n\nconst ACL = ns.acl\n\nconst COLLOQUIAL = {\n 13: 'Owners',\n 9: 'Owners (write locked)',\n 5: 'Editors',\n 3: 'Posters',\n 2: 'Submitters',\n 1: 'Viewers'\n}\n\nconst RECOMMENDED = {\n 13: true,\n 5: true,\n 3: true,\n 2: true,\n 1: true\n}\n\nconst EXPLANATION = {\n 13: 'can read, write, and control sharing.',\n 9: 'can read and control sharing, currently write-locked.',\n 5: 'can read and change information',\n 3: 'can add new information, and read but not change existing information',\n 2: 'can add new information but not read any',\n 1: 'can read but not change information'\n}\n\n/**\n * Type for the options parameter of [[AccessGroups]]\n */\nexport interface AccessGroupsOptions {\n defaults?: boolean\n}\n\n/**\n * Renders the table of Owners, Editors, Posters, Submitters, Viewers\n * for https://github.com/solid/userguide/blob/main/views/sharing/userguide.md\n */\nexport class AccessGroups {\n private readonly defaults: boolean\n public byCombo: ComboList\n public aclMap: AgentMapMap\n private readonly addAgentButton: AddAgentButtons\n private readonly rootElement: HTMLElement\n private _store: LiveStore\n\n constructor (\n private doc: NamedNode,\n private aclDoc: NamedNode,\n public controller: AccessController,\n store: IndexedFormula,\n private options: AccessGroupsOptions = {}\n ) {\n this.defaults = options.defaults || false\n fetcher(store, {})\n\n // The store will already have an updater at this point:\n // store.updater = new UpdateManager(store)\n\n this._store = store as LiveStore // TODO hacky, find a better solution\n this.aclMap = readACL(doc, aclDoc, store, this.defaults)\n this.byCombo = ACLbyCombination(this.aclMap)\n this.addAgentButton = new AddAgentButtons(this)\n this.rootElement = this.controller.dom.createElement('div')\n this.rootElement.classList.add(this.controller.classes.accessGroupList)\n }\n\n public get store () {\n return this._store\n }\n\n public set store (store) {\n this._store = store\n this.aclMap = readACL(this.doc, this.aclDoc, store, this.defaults)\n this.byCombo = ACLbyCombination(this.aclMap)\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n this.renderGroups().forEach(group => this.rootElement.appendChild(group))\n if (this.controller.isEditable) {\n this.rootElement.appendChild(this.addAgentButton.render())\n }\n return this.rootElement\n }\n\n private renderGroups (): HTMLElement[] {\n const groupElements: HTMLElement[] = []\n for (let comboIndex = 15; comboIndex > 0; comboIndex--) {\n const combo = kToCombo(comboIndex)\n if ((this.controller.isEditable && RECOMMENDED[comboIndex]) || this.byCombo[combo]) {\n groupElements.push(this.renderGroup(comboIndex, combo))\n }\n }\n return groupElements\n }\n\n private renderGroup (comboIndex: number, combo: string): HTMLElement {\n const groupRow = this.controller.dom.createElement('div')\n groupRow.classList.add(this.controller.classes.accessGroupListItem)\n widgets.makeDropTarget(groupRow, (uris) => this.handleDroppedUris(uris, combo)\n .then(() => this.controller.render())\n .catch(error => this.controller.renderStatus(error)))\n const groupColumns = this.renderGroupElements(comboIndex, combo)\n groupColumns.forEach(column => groupRow.appendChild(column))\n return groupRow\n }\n\n private renderGroupElements (comboIndex, combo): HTMLElement[] {\n const groupNameColumn = this.controller.dom.createElement('div')\n groupNameColumn.classList.add(this.controller.classes.group)\n groupNameColumn.classList.toggle(this.controller.classes[`group-${comboIndex}`], this.controller.isEditable)\n groupNameColumn.innerText = COLLOQUIAL[comboIndex] || ktToList(comboIndex)\n\n const groupAgentsColumn = this.controller.dom.createElement('div')\n groupAgentsColumn.classList.add(this.controller.classes.group)\n groupAgentsColumn.classList.toggle(this.controller.classes[`group-${comboIndex}`], this.controller.isEditable)\n const groupAgentsTable = groupAgentsColumn.appendChild(this.controller.dom.createElement('table'))\n const combos = this.byCombo[combo] || []\n combos\n .map(([pred, obj]) => this.renderAgent(groupAgentsTable, combo, pred, obj))\n .forEach(agentElement => groupAgentsTable.appendChild(agentElement))\n\n const groupDescriptionElement = this.controller.dom.createElement('div')\n groupDescriptionElement.classList.add(this.controller.classes.group)\n groupDescriptionElement.classList.toggle(this.controller.classes[`group-${comboIndex}`], this.controller.isEditable)\n groupDescriptionElement.innerText = EXPLANATION[comboIndex] || 'Unusual combination'\n\n return [groupNameColumn, groupAgentsColumn, groupDescriptionElement]\n }\n\n private renderAgent (groupAgentsTable, combo, pred, obj): HTMLElement {\n const personRow = widgets.personTR(this.controller.dom, ACL(pred), sym(obj), this.controller.isEditable\n ? {\n deleteFunction: () => this.deleteAgent(combo, pred, obj)\n .then(() => groupAgentsTable.removeChild(personRow))\n .catch(error => this.controller.renderStatus(error))\n }\n : {})\n return personRow\n }\n\n private async deleteAgent (combo, pred, obj): Promise<void> {\n const combos = this.byCombo[combo] || []\n const comboToRemove = combos.find(([comboPred, comboObj]) => comboPred === pred && comboObj === obj)\n if (comboToRemove) {\n combos.splice(combos.indexOf(comboToRemove), 1)\n }\n await this.controller.save()\n }\n\n public async addNewURI (uri: string): Promise<void> {\n await this.handleDroppedUri(uri, kToCombo(1))\n await this.controller.save()\n }\n\n private async handleDroppedUris (uris: string[], combo: string): Promise<void> {\n try {\n await Promise.all(uris.map(uri => this.handleDroppedUri(uri, combo)))\n await this.controller.save()\n } catch (error) {\n return Promise.reject(error)\n }\n }\n\n private async handleDroppedUri (uri: string, combo: string, secondAttempt: boolean = false): Promise<void> {\n const agent = findAgent(uri, this.store) // eg 'agent', 'origin', agentClass'\n const thing = sym(uri)\n if (!agent && !secondAttempt) {\n debug.log(` Not obvious: looking up dropped thing ${thing}`)\n try {\n await this._store?.fetcher?.load(thing.doc())\n } catch (error) {\n const message = `Ignore error looking up dropped thing: ${error}`\n debug.error(message)\n return Promise.reject(new Error(message))\n }\n return this.handleDroppedUri(uri, combo, true)\n } else if (!agent) {\n const error = ` Error: Drop fails to drop appropriate thing! ${uri}`\n debug.error(error)\n return Promise.reject(new Error(error))\n }\n this.setACLCombo(combo, uri, agent, this.controller.subject)\n }\n\n private setACLCombo (combo: string, uri: string, res: PartialAgentTriple, subject: NamedNode): void {\n if (!(combo in this.byCombo)) {\n this.byCombo[combo] = []\n }\n this.removeAgentFromCombos(uri) // Combos are mutually distinct\n this.byCombo[combo].push([res.pred, res.obj.uri])\n debug.log(`ACL: setting access to ${subject} by ${res.pred}: ${res.obj}`)\n }\n\n private removeAgentFromCombos (uri: string): void {\n for (let k = 0; k < 16; k++) {\n const combos = this.byCombo[kToCombo(k)]\n if (combos) {\n for (let i = 0; i < combos.length; i++) {\n while (i < combos.length && combos[i][1] === uri) {\n combos.splice(i, 1)\n }\n }\n }\n }\n }\n}\n\nfunction kToCombo (k: number): string {\n const y = ['Read', 'Append', 'Write', 'Control']\n const combo: string[] = []\n for (let i = 0; i < 4; i++) {\n if (k & (1 << i)) {\n combo.push('http://www.w3.org/ns/auth/acl#' + y[i])\n }\n }\n combo.sort()\n return combo.join('\\n')\n}\n\nfunction ktToList (k: number): string {\n let list = ''\n const y = ['Read', 'Append', 'Write', 'Control']\n for (let i = 0; i < 4; i++) {\n if (k & (1 << i)) {\n list += y[i]\n }\n }\n return list\n}\n\nfunction findAgent (uri, kb): PartialAgentTriple | null {\n const obj = sym(uri)\n const types = kb.findTypeURIs(obj)\n for (const ty in types) {\n debug.log(' drop object type includes: ' + ty)\n }\n // An Origin URI is one like https://fred.github.io eith no trailing slash\n if (uri.startsWith('http') && uri.split('/').length === 3) {\n // there is no third slash\n return { pred: 'origin', obj: obj } // The only way to know an origin alas\n }\n // @@ This is an almighty kludge needed because drag and drop adds extra slashes to origins\n if (\n uri.startsWith('http') &&\n uri.split('/').length === 4 &&\n uri.endsWith('/')\n ) {\n // there IS third slash\n debug.log('Assuming final slash on dragged origin URI was unintended!')\n return { pred: 'origin', obj: sym(uri.slice(0, -1)) } // Fix a URI where the drag and drop system has added a spurious slash\n }\n\n if (ns.vcard('WebID').uri in types) return { pred: 'agent', obj: obj }\n\n if (ns.vcard('Group').uri in types) {\n return { pred: 'agentGroup', obj: obj } // @@ note vcard membership not RDFs\n }\n if (\n obj.sameTerm(ns.foaf('Agent')) ||\n obj.sameTerm(ns.acl('AuthenticatedAgent')) || // AuthenticatedAgent\n obj.sameTerm(ns.rdf('Resource')) ||\n obj.sameTerm(ns.owl('Thing'))\n ) {\n return { pred: 'agentClass', obj: obj }\n }\n if (\n ns.vcard('Individual').uri in types ||\n ns.foaf('Person').uri in types ||\n ns.foaf('Agent').uri in types\n ) {\n const pref = kb.any(obj, ns.foaf('preferredURI'))\n if (pref) return { pred: 'agent', obj: sym(pref) }\n return { pred: 'agent', obj: obj }\n }\n if (ns.solid('AppProvider').uri in types) {\n return { pred: 'origin', obj: obj }\n }\n if (ns.solid('AppProviderClass').uri in types) {\n return { pred: 'originClass', obj: obj }\n }\n debug.log(' Triage fails for ' + uri)\n return null\n}\n"],"file":"access-groups.js"}
1
+ {"version":3,"sources":["../../src/acl/access-groups.ts"],"names":["ACL","ns","acl","COLLOQUIAL","RECOMMENDED","EXPLANATION","AccessGroups","doc","aclDoc","controller","store","options","defaults","_store","aclMap","byCombo","addAgentButton","AddAgentButtons","rootElement","dom","createElement","classList","add","classes","accessGroupList","innerHTML","renderGroups","forEach","group","appendChild","isEditable","render","groupElements","comboIndex","combo","kToCombo","push","renderGroup","groupRow","accessGroupListItem","widgets","makeDropTarget","uris","handleDroppedUris","then","error","renderStatus","groupColumns","renderGroupElements","column","groupNameColumn","toggle","innerText","ktToList","groupAgentsColumn","groupAgentsTable","combos","map","pred","obj","renderAgent","agentElement","groupDescriptionElement","personRow","personTR","deleteFunction","deleteAgent","removeChild","comboToRemove","find","comboPred","comboObj","splice","indexOf","save","uri","handleDroppedUri","Promise","all","reject","secondAttempt","agent","findAgent","thing","debug","log","fetcher","load","message","Error","setACLCombo","subject","res","removeAgentFromCombos","k","i","length","y","sort","join","list","kb","types","findTypeURIs","ty","startsWith","split","endsWith","slice","vcard","sameTerm","foaf","rdf","owl","pref","any","sol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b;AACA,QAAIG,IAAJ,EAAU,OAAO;AAAExD,MAAAA,IAAI,EAAE,OAAR;AAAiBC,MAAAA,GAAG,EAAE,iBAAIuD,IAAJ;AAAtB,KAAP;AACV,WAAO;AAAExD,MAAAA,IAAI,EAAE,OAAR;AAAiBC,MAAAA,GAAG,EAAEA;AAAtB,KAAP;AACD;;AACD,MAAI1D,EAAE,CAACmH,KAAH,CAAS,aAAT,EAAwBzC,GAAxB,IAA+B2B,KAAnC,EAA0C;AACxC,WAAO;AAAE5C,MAAAA,IAAI,EAAE,QAAR;AAAkBC,MAAAA,GAAG,EAAEA;AAAvB,KAAP;AACD;;AACD,MAAI1D,EAAE,CAACmH,KAAH,CAAS,kBAAT,EAA6BzC,GAA7B,IAAoC2B,KAAxC,EAA+C;AAC7C,WAAO;AAAE5C,MAAAA,IAAI,EAAE,aAAR;AAAuBC,MAAAA,GAAG,EAAEA;AAA5B,KAAP;AACD;;AACDyB,EAAAA,KAAK,CAACC,GAAN,CAAU,0BAA0BV,GAApC;AACA,SAAO,IAAP;AACD","sourcesContent":["/**\n * Contains the [[AccessGroups]]\n * and [[AccessGroupsOptions]] classes\n * @packageDocumentation\n */\n\nimport { NamedNode, sym, LiveStore } from 'rdflib'\nimport { ACLbyCombination, readACL } from './acl'\nimport * as widgets from '../widgets'\nimport * as ns from '../ns'\nimport { AccessController } from './access-controller'\nimport { AgentMapMap, ComboList, PartialAgentTriple } from './types'\nimport { AddAgentButtons } from './add-agent-buttons'\nimport * as debug from '../debug'\n\nconst ACL = ns.acl\n\nconst COLLOQUIAL = {\n 13: 'Owners',\n 9: 'Owners (write locked)',\n 5: 'Editors',\n 3: 'Posters',\n 2: 'Submitters',\n 1: 'Viewers'\n}\n\nconst RECOMMENDED = {\n 13: true,\n 5: true,\n 3: true,\n 2: true,\n 1: true\n}\n\nconst EXPLANATION = {\n 13: 'can read, write, and control sharing.',\n 9: 'can read and control sharing, currently write-locked.',\n 5: 'can read and change information',\n 3: 'can add new information, and read but not change existing information',\n 2: 'can add new information but not read any',\n 1: 'can read but not change information'\n}\n\n/**\n * Type for the options parameter of [[AccessGroups]]\n */\nexport interface AccessGroupsOptions {\n defaults?: boolean\n}\n\n/**\n * Renders the table of Owners, Editors, Posters, Submitters, Viewers\n * for https://github.com/solid/userguide/blob/main/views/sharing/userguide.md\n */\nexport class AccessGroups {\n private readonly defaults: boolean\n public byCombo: ComboList\n public aclMap: AgentMapMap\n private readonly addAgentButton: AddAgentButtons\n private readonly rootElement: HTMLElement\n private _store: LiveStore\n\n constructor (\n private doc: NamedNode,\n private aclDoc: NamedNode,\n public controller: AccessController,\n store: LiveStore,\n private options: AccessGroupsOptions = {}\n ) {\n this.defaults = options.defaults || false\n this._store = store\n this.aclMap = readACL(doc, aclDoc, store, this.defaults)\n this.byCombo = ACLbyCombination(this.aclMap)\n this.addAgentButton = new AddAgentButtons(this)\n this.rootElement = this.controller.dom.createElement('div')\n this.rootElement.classList.add(this.controller.classes.accessGroupList)\n }\n\n public get store () {\n return this._store\n }\n\n public set store (store) {\n this._store = store\n this.aclMap = readACL(this.doc, this.aclDoc, store, this.defaults)\n this.byCombo = ACLbyCombination(this.aclMap)\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n this.renderGroups().forEach(group => this.rootElement.appendChild(group))\n if (this.controller.isEditable) {\n this.rootElement.appendChild(this.addAgentButton.render())\n }\n return this.rootElement\n }\n\n private renderGroups (): HTMLElement[] {\n const groupElements: HTMLElement[] = []\n for (let comboIndex = 15; comboIndex > 0; comboIndex--) {\n const combo = kToCombo(comboIndex)\n if ((this.controller.isEditable && RECOMMENDED[comboIndex]) || this.byCombo[combo]) {\n groupElements.push(this.renderGroup(comboIndex, combo))\n }\n }\n return groupElements\n }\n\n private renderGroup (comboIndex: number, combo: string): HTMLElement {\n const groupRow = this.controller.dom.createElement('div')\n groupRow.classList.add(this.controller.classes.accessGroupListItem)\n widgets.makeDropTarget(groupRow, (uris) => this.handleDroppedUris(uris, combo)\n .then(() => this.controller.render())\n .catch(error => this.controller.renderStatus(error)))\n const groupColumns = this.renderGroupElements(comboIndex, combo)\n groupColumns.forEach(column => groupRow.appendChild(column))\n return groupRow\n }\n\n private renderGroupElements (comboIndex, combo): HTMLElement[] {\n const groupNameColumn = this.controller.dom.createElement('div')\n groupNameColumn.classList.add(this.controller.classes.group)\n groupNameColumn.classList.toggle(this.controller.classes[`group-${comboIndex}`], this.controller.isEditable)\n groupNameColumn.innerText = COLLOQUIAL[comboIndex] || ktToList(comboIndex)\n\n const groupAgentsColumn = this.controller.dom.createElement('div')\n groupAgentsColumn.classList.add(this.controller.classes.group)\n groupAgentsColumn.classList.toggle(this.controller.classes[`group-${comboIndex}`], this.controller.isEditable)\n const groupAgentsTable = groupAgentsColumn.appendChild(this.controller.dom.createElement('table'))\n const combos = this.byCombo[combo] || []\n combos\n .map(([pred, obj]) => this.renderAgent(groupAgentsTable, combo, pred, obj))\n .forEach(agentElement => groupAgentsTable.appendChild(agentElement))\n\n const groupDescriptionElement = this.controller.dom.createElement('div')\n groupDescriptionElement.classList.add(this.controller.classes.group)\n groupDescriptionElement.classList.toggle(this.controller.classes[`group-${comboIndex}`], this.controller.isEditable)\n groupDescriptionElement.innerText = EXPLANATION[comboIndex] || 'Unusual combination'\n\n return [groupNameColumn, groupAgentsColumn, groupDescriptionElement]\n }\n\n private renderAgent (groupAgentsTable, combo, pred, obj): HTMLElement {\n const personRow = widgets.personTR(this.controller.dom, ACL(pred), sym(obj), this.controller.isEditable\n ? {\n deleteFunction: () => this.deleteAgent(combo, pred, obj)\n .then(() => groupAgentsTable.removeChild(personRow))\n .catch(error => this.controller.renderStatus(error))\n }\n : {})\n return personRow\n }\n\n private async deleteAgent (combo, pred, obj): Promise<void> {\n const combos = this.byCombo[combo] || []\n const comboToRemove = combos.find(([comboPred, comboObj]) => comboPred === pred && comboObj === obj)\n if (comboToRemove) {\n combos.splice(combos.indexOf(comboToRemove), 1)\n }\n await this.controller.save()\n }\n\n public async addNewURI (uri: string): Promise<void> {\n await this.handleDroppedUri(uri, kToCombo(1))\n await this.controller.save()\n }\n\n private async handleDroppedUris (uris: string[], combo: string): Promise<void> {\n try {\n await Promise.all(uris.map(uri => this.handleDroppedUri(uri, combo)))\n await this.controller.save()\n } catch (error) {\n return Promise.reject(error)\n }\n }\n\n private async handleDroppedUri (uri: string, combo: string, secondAttempt: boolean = false): Promise<void> {\n const agent = findAgent(uri, this.store) // eg 'agent', 'origin', agentClass'\n const thing = sym(uri)\n if (!agent && !secondAttempt) {\n debug.log(` Not obvious: looking up dropped thing ${thing}`)\n try {\n await this._store?.fetcher?.load(thing.doc())\n } catch (error) {\n const message = `Ignore error looking up dropped thing: ${error}`\n debug.error(message)\n return Promise.reject(new Error(message))\n }\n return this.handleDroppedUri(uri, combo, true)\n } else if (!agent) {\n const error = ` Error: Drop fails to drop appropriate thing! ${uri}`\n debug.error(error)\n return Promise.reject(new Error(error))\n }\n this.setACLCombo(combo, uri, agent, this.controller.subject)\n }\n\n private setACLCombo (combo: string, uri: string, res: PartialAgentTriple, subject: NamedNode): void {\n if (!(combo in this.byCombo)) {\n this.byCombo[combo] = []\n }\n this.removeAgentFromCombos(uri) // Combos are mutually distinct\n this.byCombo[combo].push([res.pred, res.obj.uri])\n debug.log(`ACL: setting access to ${subject} by ${res.pred}: ${res.obj}`)\n }\n\n private removeAgentFromCombos (uri: string): void {\n for (let k = 0; k < 16; k++) {\n const combos = this.byCombo[kToCombo(k)]\n if (combos) {\n for (let i = 0; i < combos.length; i++) {\n while (i < combos.length && combos[i][1] === uri) {\n combos.splice(i, 1)\n }\n }\n }\n }\n }\n}\n\nfunction kToCombo (k: number): string {\n const y = ['Read', 'Append', 'Write', 'Control']\n const combo: string[] = []\n for (let i = 0; i < 4; i++) {\n if (k & (1 << i)) {\n combo.push('http://www.w3.org/ns/auth/acl#' + y[i])\n }\n }\n combo.sort()\n return combo.join('\\n')\n}\n\nfunction ktToList (k: number): string {\n let list = ''\n const y = ['Read', 'Append', 'Write', 'Control']\n for (let i = 0; i < 4; i++) {\n if (k & (1 << i)) {\n list += y[i]\n }\n }\n return list\n}\n\nfunction findAgent (uri, kb): PartialAgentTriple | null {\n const obj = sym(uri)\n const types = kb.findTypeURIs(obj)\n for (const ty in types) {\n debug.log(' drop object type includes: ' + ty)\n }\n // An Origin URI is one like https://fred.github.io eith no trailing slash\n if (uri.startsWith('http') && uri.split('/').length === 3) {\n // there is no third slash\n return { pred: 'origin', obj: obj } // The only way to know an origin alas\n }\n // @@ This is an almighty kludge needed because drag and drop adds extra slashes to origins\n if (\n uri.startsWith('http') &&\n uri.split('/').length === 4 &&\n uri.endsWith('/')\n ) {\n // there IS third slash\n debug.log('Assuming final slash on dragged origin URI was unintended!')\n return { pred: 'origin', obj: sym(uri.slice(0, -1)) } // Fix a URI where the drag and drop system has added a spurious slash\n }\n\n if (ns.vcard('WebID').uri in types) return { pred: 'agent', obj: obj }\n\n if (ns.vcard('Group').uri in types) {\n return { pred: 'agentGroup', obj: obj } // @@ note vcard membership not RDFs\n }\n if (\n obj.sameTerm(ns.foaf('Agent')) ||\n obj.sameTerm(ns.acl('AuthenticatedAgent')) || // AuthenticatedAgent\n obj.sameTerm(ns.rdf('Resource')) ||\n obj.sameTerm(ns.owl('Thing'))\n ) {\n return { pred: 'agentClass', obj: obj }\n }\n if (\n ns.vcard('Individual').uri in types ||\n ns.foaf('Person').uri in types ||\n ns.foaf('Agent').uri in types\n ) {\n const pref = kb.any(obj, ns.foaf('preferredURI'))\n if (pref) return { pred: 'agent', obj: sym(pref) }\n return { pred: 'agent', obj: obj }\n }\n if (ns.solid('AppProvider').uri in types) {\n return { pred: 'origin', obj: obj }\n }\n if (ns.solid('AppProviderClass').uri in types) {\n return { pred: 'originClass', obj: obj }\n }\n debug.log(' Triage fails for ' + uri)\n return null\n}\n"],"file":"access-groups.js"}
@@ -1 +1 @@
1
- {"version":3,"file":"participation.d.ts","sourceRoot":"","sources":["../src/participation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE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AC,EAAE,MAAM,IAAI,CAAA;CACrB;AAGD;;;;;;;;EAQE;AACF,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,yBAAyB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,6BA2C/K;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,oBAkDxF;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OA0C3F;AAED;;;;;;;;;EASE;AACF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,SAAS,EAClB,EAAE,EAAE,SAAS,EACb,OAAO,EAAE,oBAAoB,oBAiB9B"}
@@ -28,6 +28,8 @@ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/w
28
28
 
29
29
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
30
30
 
31
+ var debug = _interopRequireWildcard(require("./debug"));
32
+
31
33
  var _authn = require("./authn/authn");
32
34
 
33
35
  var _rdflib = require("rdflib");
@@ -40,14 +42,18 @@ var _utils = require("./utils");
40
42
 
41
43
  var _pad = require("./pad");
42
44
 
43
- var _debug = require("./debug");
44
-
45
45
  var _logic = require("./logic");
46
46
 
47
47
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
48
48
 
49
49
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
50
50
 
51
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
52
+
53
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
54
+
55
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
56
+
51
57
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
52
58
 
53
59
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -74,7 +80,7 @@ var ParticipationTableElement = /*#__PURE__*/function (_HTMLTableElement) {
74
80
  return (0, _createClass2["default"])(ParticipationTableElement);
75
81
  }( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLTableElement));
76
82
 
77
- var kb = _logic.solidLogicSingleton.store;
83
+ var store = _logic.solidLogicSingleton.store;
78
84
  /** Manage participation in this session
79
85
  *
80
86
  * @param {Document} dom - the web page loaded into the browser
@@ -89,7 +95,7 @@ function renderPartipants(dom, table, unused1, subject, unused2, options) {
89
95
  table.setAttribute('style', 'margin: 0.8em;');
90
96
 
91
97
  var newRowForParticpation = function newRowForParticpation(parp) {
92
- var person = kb.any(parp, ns.wf('participant'));
98
+ var person = store.any(parp, ns.wf('participant'));
93
99
  var tr;
94
100
 
95
101
  if (!person) {
@@ -99,7 +105,7 @@ function renderPartipants(dom, table, unused1, subject, unused2, options) {
99
105
  return tr;
100
106
  }
101
107
 
102
- var bg = kb.anyValue(parp, ns.ui('backgroundColor')) || 'white';
108
+ var bg = store.anyValue(parp, ns.ui('backgroundColor')) || 'white';
103
109
  var block = dom.createElement('div');
104
110
  block.setAttribute('style', 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' + bg);
105
111
  tr = (0, _widgets.personTR)(dom, null, person, options);
@@ -112,9 +118,9 @@ function renderPartipants(dom, table, unused1, subject, unused2, options) {
112
118
  };
113
119
 
114
120
  var syncTable = function syncTable() {
115
- var parps = kb.each(subject, ns.wf('participation')).map(function (parp) {
116
- (0, _debug.log)('in participants');
117
- return [kb.anyValue(parp, ns.cal('dtstart')) || '9999-12-31', parp];
121
+ var parps = store.each(subject, ns.wf('participation')).map(function (parp) {
122
+ (0, debug.log)('in participants');
123
+ return [store.anyValue(parp, ns.cal('dtstart')) || '9999-12-31', parp];
118
124
  });
119
125
  parps.sort(); // List in order of joining
120
126
 
@@ -142,36 +148,57 @@ function renderPartipants(dom, table, unused1, subject, unused2, options) {
142
148
  function participationObject(subject, padDoc, me) {
143
149
  return new Promise(function (resolve, reject) {
144
150
  if (!me) {
145
- throw new Error('Not user id');
151
+ throw new Error('No user id');
146
152
  }
147
153
 
148
- var parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
149
- return kb.holds(pn, ns.wf('participant'), me);
154
+ var parps = store.each(subject, ns.wf('participation')).filter(function (pn) {
155
+ return store.holds(pn, ns.wf('participant'), me);
150
156
  });
151
157
 
152
158
  if (parps.length > 1) {
153
- throw new Error('Multiple records of your participation');
159
+ // This can happen. https://github.com/solid/chat-pane/issues/71
160
+ var candidates = [];
161
+
162
+ var _iterator = _createForOfIteratorHelper(parps),
163
+ _step;
164
+
165
+ try {
166
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
167
+ var participation = _step.value;
168
+ var date = store.anyValue(participation, ns.cal('dtstart'));
169
+
170
+ if (date) {
171
+ candidates.push([date, participation]);
172
+ }
173
+ }
174
+ } catch (err) {
175
+ _iterator.e(err);
176
+ } finally {
177
+ _iterator.f();
178
+ }
179
+
180
+ candidates.sort(); // Pick the earliest
181
+ // @@ Possibly, for extra credit, delete the others, if we have write access
182
+
183
+ debug.warn('Multiple particpation objects, picking earliest, in ' + padDoc);
184
+ resolve(candidates[0][1]); // throw new Error('Multiple records of your participation')
154
185
  }
155
186
 
156
187
  if (parps.length) {
157
188
  // If I am not already recorded
158
189
  resolve(parps[0]); // returns the particpation object
159
190
  } else {
160
- var participation = (0, _widgets.newThing)(padDoc);
161
- var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), participation, padDoc), (0, _rdflib.st)(participation, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(participation, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(participation, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
191
+ var _participation2 = (0, _widgets.newThing)(padDoc);
162
192
 
163
- if (!kb.updater) {
164
- throw new Error('kb has no updater');
165
- }
166
-
167
- kb.updater.update([], ins, function (uri, ok, errorMessage) {
193
+ var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), _participation2, padDoc), (0, _rdflib.st)(_participation2, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(_participation2, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(_participation2, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
194
+ store.updater.update([], ins, function (uri, ok, errorMessage) {
168
195
  if (!ok) {
169
196
  reject(new Error('Error recording your partipation: ' + errorMessage));
170
197
  } else {
171
- resolve(participation);
198
+ resolve(_participation2);
172
199
  }
173
200
  });
174
- resolve(participation);
201
+ resolve(_participation2);
175
202
  }
176
203
  });
177
204
  }
@@ -188,8 +215,8 @@ function recordParticipation(subject, padDoc, refreshable) {
188
215
  var me = (0, _authn.currentUser)();
189
216
  if (!me) return; // Not logged in
190
217
 
191
- var parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
192
- return kb.holds(pn, ns.wf('participant'), me);
218
+ var parps = store.each(subject, ns.wf('participation')).filter(function (pn) {
219
+ return store.holds(pn, ns.wf('participant'), me);
193
220
  });
194
221
 
195
222
  if (parps.length > 1) {
@@ -200,14 +227,14 @@ function recordParticipation(subject, padDoc, refreshable) {
200
227
  // If I am not already recorded
201
228
  return parps[0]; // returns the particpation object
202
229
  } else {
203
- var participation = (0, _widgets.newThing)(padDoc);
204
- var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), participation, padDoc), (0, _rdflib.st)(participation, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(participation, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(participation, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
205
-
206
- if (!kb.updater) {
207
- throw new Error('kb has no updater');
230
+ if (!store.updater.editable(padDoc)) {
231
+ debug.log('Not recording participation, as no write acesss as ' + me + ' to ' + padDoc);
232
+ return null;
208
233
  }
209
234
 
210
- kb.updater.update([], ins, function (uri, ok, errorMessage) {
235
+ var participation = (0, _widgets.newThing)(padDoc);
236
+ var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), participation, padDoc), (0, _rdflib.st)(participation, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(participation, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(participation, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
237
+ store.updater.update([], ins, function (uri, ok, errorMessage) {
211
238
  if (!ok) {
212
239
  throw new Error('Error recording your partipation: ' + errorMessage);
213
240
  }
@@ -237,8 +264,10 @@ function manageParticipation(dom, container, padDoc, subject, me, options) {
237
264
  container.appendChild(table);
238
265
  renderPartipants(dom, table, padDoc, subject, me, options);
239
266
 
267
+ var _participation;
268
+
240
269
  try {
241
- recordParticipation(subject, padDoc, table);
270
+ _participation = recordParticipation(subject, padDoc, table);
242
271
  } catch (e) {
243
272
  container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your partipation: ' + e)); // Clean up?
244
273
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/participation.ts"],"names":["ParticipationTableElement","HTMLTableElement","kb","solidLogicSingleton","store","renderPartipants","dom","table","unused1","subject","unused2","options","setAttribute","newRowForParticpation","parp","person","any","ns","wf","tr","createElement","textContent","bg","anyValue","ui","block","appendChild","td","insertBefore","firstChild","syncTable","parps","each","map","cal","sort","participations","p","refresh","participationObject","padDoc","me","Promise","resolve","reject","Error","filter","pn","holds","length","participation","ins","Date","updater","update","uri","ok","errorMessage","recordParticipation","refreshable","manageParticipation","container","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAQMA,yB;;;;;;;;;;;;;;;;;;;;kDAAkCC,gB;;AAGxC,IAAMC,EAAE,GAAGC,2BAAoBC,KAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,gBAAT,CAA2BC,GAA3B,EAA8CC,KAA9C,EAAgFC,OAAhF,EAAoGC,OAApG,EAAwHC,OAAxH,EAA4IC,OAA5I,EAA2K;AAChLJ,EAAAA,KAAK,CAACK,YAAN,CAAmB,OAAnB,EAA4B,gBAA5B;;AAEA,MAAMC,qBAAqB,GAAG,SAAxBA,qBAAwB,CAAUC,IAAV,EAAgB;AAC5C,QAAMC,MAAM,GAAGb,EAAE,CAACc,GAAH,CAAOF,IAAP,EAAaG,EAAE,CAACC,EAAH,CAAM,aAAN,CAAb,CAAf;AAEA,QAAIC,EAAJ;;AACA,QAAI,CAACJ,MAAL,EAAa;AACXI,MAAAA,EAAE,GAAGb,GAAG,CAACc,aAAJ,CAAkB,IAAlB,CAAL;AACAD,MAAAA,EAAE,CAACE,WAAH,GAAiB,KAAjB,CAFW,CAEY;;AACvB,aAAOF,EAAP;AACD;;AACD,QAAMG,EAAE,GAAGpB,EAAE,CAACqB,QAAH,CAAYT,IAAZ,EAAkBG,EAAE,CAACO,EAAH,CAAM,iBAAN,CAAlB,KAA+C,OAA1D;AAEA,QAAMC,KAAK,GAAGnB,GAAG,CAACc,aAAJ,CAAkB,KAAlB,CAAd;AACAK,IAAAA,KAAK,CAACb,YAAN,CACE,OADF,EAEE,6FACAU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AAb,EAAqB/B,OAArB,EAA8BgC,EAA9B,EAAkC9B,OAAlC,CAAhB;;AACA,MAAI;AACF+C,IAAAA,mBAAmB,CAACjD,OAAD,EAAU+B,MAAV,EAAkBjC,KAAlB,CAAnB;AACD,GAFD,CAEE,OAAOuD,CAAP,EAAU;AACVD,IAAAA,SAAS,CAACnC,WAAV,CACE,gCACEpB,GADF,EAEE,uCAAuCwD,CAFzC,CADF,EADU,CAMR;AACH;;AACD,SAAOvD,KAAP;AACD","sourcesContent":["/* Manage a UI for the particpation of a person in any thing\n*/\n\nimport { currentUser } from './authn/authn'\nimport { NamedNode, st } from 'rdflib'\nimport * as ns from './ns'\nimport { personTR, newThing, errorMessageBlock } from './widgets'\nimport { syncTableToArray } from './utils'\nimport { lightColorHash } from './pad'\nimport { log } from './debug'\nimport { solidLogicSingleton } from './logic'\n\ntype ParticipationOptions = {\n deleteFunction?: () => {}\n link?: string\n draggable?: boolean\n}\n\nclass ParticipationTableElement extends HTMLTableElement {\n refresh?: () => void\n}\nconst kb = solidLogicSingleton.store\n\n/** Manage participation in this session\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLTableElement} table - the table element\n* @param {NamedNode} unused1/document - the document to render (this argument is no longer used, but left in for backwards compatibility)\n* @param {NamedNode} subject - the thing in which the participation is happening\n* @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*/\nexport function renderPartipants (dom: HTMLDocument, table: ParticipationTableElement, unused1: NamedNode, subject: NamedNode, unused2: NamedNode, options: ParticipationOptions) {\n table.setAttribute('style', 'margin: 0.8em;')\n\n const newRowForParticpation = function (parp) {\n const person = kb.any(parp, ns.wf('participant'))\n\n let tr\n if (!person) {\n tr = dom.createElement('tr')\n tr.textContent = '???' // Don't crash - invalid part'n entry\n return tr\n }\n const bg = kb.anyValue(parp, ns.ui('backgroundColor')) || 'white'\n\n const block = dom.createElement('div')\n block.setAttribute(\n 'style',\n 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' +\n bg\n )\n tr = personTR(dom, null, person, options)\n table.appendChild(tr)\n const td = dom.createElement('td')\n td.setAttribute('style', 'vertical-align: middle;')\n td.appendChild(block)\n tr.insertBefore(td, tr.firstChild)\n return tr\n }\n\n const syncTable = function () {\n const parps = kb.each(subject, ns.wf('participation')).map(function (parp) {\n log('in participants')\n return [kb.anyValue(parp as any, ns.cal('dtstart')) || '9999-12-31', parp]\n })\n parps.sort() // List in order of joining\n const participations = parps.map(function (p) {\n return p[1]\n })\n syncTableToArray(table, participations, newRowForParticpation)\n }\n table.refresh = syncTable\n syncTable()\n return table\n}\n\n/** Record, or find old, Particpation object\n *\n * A particpaption object is a place to record things specifically about\n * subject and the user, such as preferences, start of membership, etc\n * @param {NamedNode} subject - the thing in which the participation is happening\n * @param {NamedNode} document - where to record the data\n * @param {NamedNode} me - the logged in user\n *\n */\nexport function participationObject (subject: NamedNode, padDoc: NamedNode, me: NamedNode) {\n return new Promise(function (resolve, reject) {\n if (!me) {\n throw new Error('Not user id')\n }\n\n const parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {\n return kb.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) {\n throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n resolve(parps[0]) // returns the particpation object\n } else {\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ]\n if (!kb.updater) {\n throw new Error('kb has no updater')\n }\n kb.updater.update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n reject(new Error('Error recording your partipation: ' + errorMessage))\n } else {\n resolve(participation)\n }\n })\n resolve(participation)\n }\n })\n}\n\n/** Record my participation and display participants\n *\n * @param {NamedNode} subject - the thing in which participation is happening\n * @param {NamedNode} padDoc - the document into which the particpation should be recorded\n * @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works\n *\n */\nexport function recordParticipation (subject: NamedNode, padDoc: NamedNode, refreshable: any) {\n const me = currentUser()\n if (!me) return // Not logged in\n\n const parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {\n return kb.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) {\n throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n return parps[0] // returns the particpation object\n } else {\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ]\n if (!kb.updater) {\n throw new Error('kb has no updater')\n }\n kb.updater.update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n throw new Error('Error recording your partipation: ' + errorMessage)\n }\n if (refreshable && refreshable.refresh) {\n refreshable.refresh()\n }\n // UI.pad.renderPartipants(dom, table, padDoc, subject, me, options)\n })\n return participation\n }\n}\n\n/** Record my participation and display participants\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLDivElement} container - the container element where the participants should be displayed\n* @param {NamedNode} document - the document into which the particpation should be shown\n* @param {NamedNode} subject - the thing in which participation is happening\n* @param {NamedNode} me - the logged in user\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*\n*/\nexport function manageParticipation (\n dom: Document,\n container: HTMLDivElement,\n padDoc: NamedNode,\n subject: NamedNode,\n me: NamedNode,\n options: ParticipationOptions\n) {\n const table = dom.createElement('table')\n container.appendChild(table)\n renderPartipants(dom, table, padDoc, subject, me, options)\n try {\n recordParticipation(subject, padDoc, table)\n } catch (e) {\n container.appendChild(\n errorMessageBlock(\n dom,\n 'Error recording your partipation: ' + e\n )\n ) // Clean up?\n }\n return table\n}\n"],"file":"participation.js"}
1
+ {"version":3,"sources":["../src/participation.ts"],"names":["ParticipationTableElement","HTMLTableElement","store","solidLogicSingleton","renderPartipants","dom","table","unused1","subject","unused2","options","setAttribute","newRowForParticpation","parp","person","any","ns","wf","tr","createElement","textContent","bg","anyValue","ui","block","appendChild","td","insertBefore","firstChild","syncTable","parps","each","map","cal","sort","participations","p","refresh","participationObject","padDoc","me","Promise","resolve","reject","Error","filter","pn","holds","length","candidates","participation","date","push","debug","warn","ins","Date","updater","update","uri","ok","errorMessage","recordParticipation","refreshable","editable","log","manageParticipation","container","_participation","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;IAQMA,yB;;;;;;;;;;;;;;;;;;;;kDAAkCC,gB;;AAGxC,IAAMC,KAAK,GAAGC,2BAAoBD,KAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASE,gBAAT,CAA2BC,GAA3B,EAA8CC,KAA9C,EAAgFC,OAAhF,EAAoGC,OAApG,EAAwHC,OAAxH,EAA4IC,OAA5I,EAA2K;AAChLJ,EAAAA,KAAK,CAACK,YAAN,CAAmB,OAAnB,EAA4B,gBAA5B;;AAEA,MAAMC,qBAAqB,GAAG,SAAxBA,qBAAwB,CAAUC,IAAV,EAAgB;AAC5C,QAAMC,MAAM,GAAGZ,KAAK,CAACa,GAAN,CAAUF,IAAV,EAAgBG,EAAE,CAACC,EAAH,CAAM,aAAN,CAAhB,CAAf;AAEA,QAAIC,EAAJ;;AACA,QAAI,CAACJ,MAAL,EAAa;AACXI,MAAAA,EAAE,GAAGb,GAAG,CAACc,aAAJ,CAAkB,IAAlB,CAAL;AACAD,MAAAA,EAAE,CAACE,WAAH,GAAiB,KAAjB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KV,gBACEW,aADF,EAEElC,EAAE,CAACO,EAAH,CAAM,iBAAN,CAFF,EAGE,yBAAeiB,EAAf,CAHF,EAIED,MAJF,CALU,CAAZ;AAYCrC,IAAAA,KAAK,CAACuD,OAAP,CAAiCC,MAAjC,CAAwC,EAAxC,EAA4CH,GAA5C,EAAiD,UAAUI,GAAV,EAA0CC,EAA1C,EAAuDC,YAAvD,EAA8E;AAC7H,UAAI,CAACD,EAAL,EAAS;AACP,cAAM,IAAIhB,KAAJ,CAAU,uCAAuCiB,YAAjD,CAAN;AACD;;AACD,UAAIE,WAAW,IAAIA,WAAW,CAAC1B,OAA/B,EAAwC;AACtC0B,QAAAA,WAAW,CAAC1B,OAAZ;AACD,OAN4H,CAO7H;;AACD,KARD;AASA,WAAOa,aAAP;AACD;AACF;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASgB,mBAAT,CACL7D,GADK,EAEL8D,SAFK,EAGL5B,MAHK,EAIL/B,OAJK,EAKLgC,EALK,EAML9B,OANK,EAOL;AACA,MAAMJ,KAAK,GAAGD,GAAG,CAACc,aAAJ,CAAkB,OAAlB,CAAd;AACAgD,EAAAA,SAAS,CAAC1C,WAAV,CAAsBnB,KAAtB;AACAF,EAAAA,gBAAgB,CAACC,GAAD,EAAMC,KAAN,EAAaiC,MAAb,EAAqB/B,OAArB,EAA8BgC,EAA9B,EAAkC9B,OAAlC,CAAhB;;AACA,MAAI0D,cAAJ;;AACA,MAAI;AACFA,IAAAA,cAAc,GAAGN,mBAAmB,CAACtD,OAAD,EAAU+B,MAAV,EAAkBjC,KAAlB,CAApC;AACD,GAFD,CAEE,OAAO+D,CAAP,EAAU;AACVF,IAAAA,SAAS,CAAC1C,WAAV,CACE,gCACEpB,GADF,EAEE,uCAAuCgE,CAFzC,CADF,EADU,CAMR;AACH;;AACD,SAAO/D,KAAP;AACD","sourcesContent":["/* Manage a UI for the particpation of a person in any thing\n*/\nimport * as debug from './debug'\nimport { currentUser } from './authn/authn'\nimport { LiveStore, NamedNode, st, UpdateManager } from 'rdflib'\nimport * as ns from './ns'\nimport { personTR, newThing, errorMessageBlock } from './widgets'\nimport { syncTableToArray } from './utils'\nimport { lightColorHash } from './pad'\nimport { log } from './debug'\nimport { solidLogicSingleton } from './logic'\n\ntype ParticipationOptions = {\n deleteFunction?: () => {}\n link?: string\n draggable?: boolean\n}\n\nclass ParticipationTableElement extends HTMLTableElement {\n refresh?: () => void\n}\nconst store = solidLogicSingleton.store as LiveStore\n\n/** Manage participation in this session\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLTableElement} table - the table element\n* @param {NamedNode} unused1/document - the document to render (this argument is no longer used, but left in for backwards compatibility)\n* @param {NamedNode} subject - the thing in which the participation is happening\n* @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*/\nexport function renderPartipants (dom: HTMLDocument, table: ParticipationTableElement, unused1: NamedNode, subject: NamedNode, unused2: NamedNode, options: ParticipationOptions) {\n table.setAttribute('style', 'margin: 0.8em;')\n\n const newRowForParticpation = function (parp) {\n const person = store.any(parp, ns.wf('participant'))\n\n let tr\n if (!person) {\n tr = dom.createElement('tr')\n tr.textContent = '???' // Don't crash - invalid part'n entry\n return tr\n }\n const bg = store.anyValue(parp, ns.ui('backgroundColor')) || 'white'\n\n const block = dom.createElement('div')\n block.setAttribute(\n 'style',\n 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' +\n bg\n )\n tr = personTR(dom, null, person, options)\n table.appendChild(tr)\n const td = dom.createElement('td')\n td.setAttribute('style', 'vertical-align: middle;')\n td.appendChild(block)\n tr.insertBefore(td, tr.firstChild)\n return tr\n }\n\n const syncTable = function () {\n const parps = store.each(subject, ns.wf('participation')).map(function (parp) {\n log('in participants')\n return [store.anyValue(parp as any, ns.cal('dtstart')) || '9999-12-31', parp]\n })\n parps.sort() // List in order of joining\n const participations = parps.map(function (p) {\n return p[1]\n })\n syncTableToArray(table, participations, newRowForParticpation)\n }\n table.refresh = syncTable\n syncTable()\n return table\n}\n\n/** Record, or find old, Particpation object\n *\n * A particpaption object is a place to record things specifically about\n * subject and the user, such as preferences, start of membership, etc\n * @param {NamedNode} subject - the thing in which the participation is happening\n * @param {NamedNode} document - where to record the data\n * @param {NamedNode} me - the logged in user\n *\n */\nexport function participationObject (subject: NamedNode, padDoc: NamedNode, me: NamedNode) {\n return new Promise(function (resolve, reject) {\n if (!me) {\n throw new Error('No user id')\n }\n\n const parps = store.each(subject, ns.wf('participation')).filter(function (pn) {\n return store.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) { // This can happen. https://github.com/solid/chat-pane/issues/71\n const candidates: (string | NamedNode) [][] = []\n for (const participation of parps) {\n const date = store.anyValue(participation as NamedNode, ns.cal('dtstart'))\n if (date) {\n candidates.push([date, participation as NamedNode])\n }\n }\n candidates.sort() // Pick the earliest\n // @@ Possibly, for extra credit, delete the others, if we have write access\n debug.warn('Multiple particpation objects, picking earliest, in ' + padDoc)\n resolve(candidates[0][1])\n // throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n resolve(parps[0]) // returns the particpation object\n } else {\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ];\n (store.updater as UpdateManager).update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n reject(new Error('Error recording your partipation: ' + errorMessage))\n } else {\n resolve(participation)\n }\n })\n resolve(participation)\n }\n })\n}\n\n/** Record my participation and display participants\n *\n * @param {NamedNode} subject - the thing in which participation is happening\n * @param {NamedNode} padDoc - the document into which the particpation should be recorded\n * @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works\n *\n */\nexport function recordParticipation (subject: NamedNode, padDoc: NamedNode, refreshable: any) {\n const me = currentUser()\n if (!me) return // Not logged in\n\n const parps = store.each(subject, ns.wf('participation')).filter(function (pn) {\n return store.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) {\n throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n return parps[0] // returns the particpation object\n } else {\n if (!(store.updater as UpdateManager).editable(padDoc)) {\n debug.log('Not recording participation, as no write acesss as ' + me + ' to ' + padDoc)\n return null\n }\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ];\n (store.updater as UpdateManager).update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n throw new Error('Error recording your partipation: ' + errorMessage)\n }\n if (refreshable && refreshable.refresh) {\n refreshable.refresh()\n }\n // UI.pad.renderPartipants(dom, table, padDoc, subject, me, options)\n })\n return participation\n }\n}\n\n/** Record my participation and display participants\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLDivElement} container - the container element where the participants should be displayed\n* @param {NamedNode} document - the document into which the particpation should be shown\n* @param {NamedNode} subject - the thing in which participation is happening\n* @param {NamedNode} me - the logged in user\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*\n*/\nexport function manageParticipation (\n dom: Document,\n container: HTMLDivElement,\n padDoc: NamedNode,\n subject: NamedNode,\n me: NamedNode,\n options: ParticipationOptions\n) {\n const table = dom.createElement('table')\n container.appendChild(table)\n renderPartipants(dom, table, padDoc, subject, me, options)\n let _participation\n try {\n _participation = recordParticipation(subject, padDoc, table)\n } catch (e) {\n container.appendChild(\n errorMessageBlock(\n dom,\n 'Error recording your partipation: ' + e\n )\n ) // Clean up?\n }\n return table\n}\n"],"file":"participation.js"}
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- buildTime: '2022-01-31T14:56:45Z',
9
- commit: 'eb82ec38b28b2e2feb872492149f48b6507ebf42',
8
+ buildTime: '2022-02-23T14:28:16Z',
9
+ commit: '707601b18fc26917752ae0150bdc55058a34312e',
10
10
  npmInfo: {
11
- 'solid-ui': '2.4.16',
12
- npm: '6.14.15',
11
+ 'solid-ui': '2.4.18',
12
+ npm: '6.14.16',
13
13
  ares: '1.18.1',
14
14
  brotli: '1.0.9',
15
- cldr: '39.0',
16
- icu: '69.1',
15
+ cldr: '40.0',
16
+ icu: '70.1',
17
17
  llhttp: '2.1.4',
18
18
  modules: '83',
19
19
  napi: '8',
20
20
  nghttp2: '1.42.0',
21
- node: '14.18.3',
22
- openssl: '1.1.1l',
23
- tz: '2021a',
24
- unicode: '13.0',
21
+ node: '14.19.0',
22
+ openssl: '1.1.1m',
23
+ tz: '2021a3',
24
+ unicode: '14.0',
25
25
  uv: '1.42.0',
26
26
  v8: '8.4.371.23-node.85',
27
27
  zlib: '1.2.11'