@graffiti-garden/implementation-local 0.2.4 → 0.2.5

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,2 +1,2 @@
1
- class t{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized");this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}}export{t as GraffitiLocalSessionManager};
1
+ class t{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized",{detail:{}});this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}}export{t as GraffitiLocalSessionManager};
2
2
  //# sourceMappingURL=session-manager.browser.js.map
@@ -1,2 +1,2 @@
1
- "use strict";exports.GraffitiLocalSessionManager=class{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized");this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}};
1
+ "use strict";exports.GraffitiLocalSessionManager=class{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized",{detail:{}});this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}};
2
2
  //# sourceMappingURL=session-manager.cjs.js.map
@@ -1,2 +1,2 @@
1
- class t{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized");this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}}export{t as GraffitiLocalSessionManager};
1
+ class t{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized",{detail:{}});this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}}export{t as GraffitiLocalSessionManager};
2
2
  //# sourceMappingURL=session-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAIT,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,qBAAa,2BAA2B;IACtC,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAqB;;IAwB7D,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B,SAAS,CAAC,iBAAiB,IAAI,MAAM,EAAE;IAWvC,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE;IAW5C,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CA+BtB;IAEF,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAoBxB;CACH"}
1
+ {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAIT,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,qBAAa,2BAA2B;IACtC,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAqB;;IAyB7D,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B,SAAS,CAAC,iBAAiB,IAAI,MAAM,EAAE;IAWvC,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE;IAW5C,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CA+BtB;IAEF,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAoBxB;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graffiti-garden/implementation-local",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "A local implementation of the Graffiti API using PouchDB",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "module": "./dist/index.js",
@@ -35,6 +35,7 @@ export class GraffitiLocalSessionManager {
35
35
 
36
36
  const event: GraffitiSessionInitializedEvent = new CustomEvent(
37
37
  "initialized",
38
+ { detail: {} },
38
39
  );
39
40
  this.sessionEvents.dispatchEvent(event);
40
41
  };