@objectiv/queue-local-storage
Advanced tools
Comparing version 0.0.19-0 to 0.0.19
@@ -1,2 +0,2 @@ | ||
var n=class{constructor(t){this.queueStoreName="LocalStorageQueueStore";var e;if(typeof localStorage>"u")throw new Error(`${this.queueStoreName}: failed to initialize: localStorage is not available.`);this.localStorageKey=`objectiv-events-queue-${t.trackerId}`,(e=globalThis.objectiv)==null||e.TrackerConsole.log(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Initialized`,"font-weight: bold")}getEventsFromLocalStorage(){var t,e;try{return JSON.parse((t=localStorage.getItem(this.localStorageKey))!=null?t:"[]")}catch(r){(e=globalThis.objectiv)==null||e.TrackerConsole.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to parse Events from localStorage: ${r}`,"font-weight: bold")}return[]}writeEventsToLocalStorage(t){var e;try{localStorage.setItem(this.localStorageKey,JSON.stringify(t))}catch(r){(e=globalThis.objectiv)==null||e.TrackerConsole.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to write Events to localStorage: ${r}`,"font-weight: bold")}}get length(){return this.getEventsFromLocalStorage().length}async read(t,e){let r=this.getEventsFromLocalStorage();return e&&(r=r.filter(e)),r.slice(0,t)}async write(...t){let e=this.getEventsFromLocalStorage();e.push(...t),this.writeEventsToLocalStorage(e)}async delete(t){let e=this.getEventsFromLocalStorage();e=e.filter(r=>!t.includes(r.id)),this.writeEventsToLocalStorage(e)}async clear(){this.writeEventsToLocalStorage([])}};export{n as LocalStorageQueueStore}; | ||
import{TrackerConsole as o}from"@objectiv/tracker-core";var i=class{constructor(e){this.queueStoreName="LocalStorageQueueStore";if(typeof localStorage>"u")throw new Error(`${this.queueStoreName}: failed to initialize: localStorage is not available.`);this.localStorageKey=`objectiv-events-queue-${e.trackerId}`,o.log(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Initialized`,"font-weight: bold")}getEventsFromLocalStorage(){var e;try{return JSON.parse((e=localStorage.getItem(this.localStorageKey))!=null?e:"[]")}catch(t){o.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to parse Events from localStorage: ${t}`,"font-weight: bold")}return[]}writeEventsToLocalStorage(e){try{localStorage.setItem(this.localStorageKey,JSON.stringify(e))}catch(t){o.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to write Events to localStorage: ${t}`,"font-weight: bold")}}get length(){return this.getEventsFromLocalStorage().length}async read(e,t){let r=this.getEventsFromLocalStorage();return t&&(r=r.filter(t)),r.slice(0,e)}async write(...e){let t=this.getEventsFromLocalStorage();t.push(...e),this.writeEventsToLocalStorage(t)}async delete(e){let t=this.getEventsFromLocalStorage();t=t.filter(r=>!e.includes(r.id)),this.writeEventsToLocalStorage(t)}async clear(){this.writeEventsToLocalStorage([])}};export{i as LocalStorageQueueStore}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var g=r=>n(r,"__esModule",{value:!0});var S=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},v=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of c(e))!s.call(r,a)&&(t||a!=="default")&&n(r,a,{get:()=>e[a],enumerable:!(o=i(e,a))||o.enumerable});return r};var u=(r=>(e,t)=>r&&r.get(e)||(t=v(g({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var m={};S(m,{LocalStorageQueueStore:()=>l});var l=class{constructor(e){this.queueStoreName="LocalStorageQueueStore";var t;if(typeof localStorage>"u")throw new Error(`${this.queueStoreName}: failed to initialize: localStorage is not available.`);this.localStorageKey=`objectiv-events-queue-${e.trackerId}`,(t=globalThis.objectiv)==null||t.TrackerConsole.log(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Initialized`,"font-weight: bold")}getEventsFromLocalStorage(){var e,t;try{return JSON.parse((e=localStorage.getItem(this.localStorageKey))!=null?e:"[]")}catch(o){(t=globalThis.objectiv)==null||t.TrackerConsole.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to parse Events from localStorage: ${o}`,"font-weight: bold")}return[]}writeEventsToLocalStorage(e){var t;try{localStorage.setItem(this.localStorageKey,JSON.stringify(e))}catch(o){(t=globalThis.objectiv)==null||t.TrackerConsole.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to write Events to localStorage: ${o}`,"font-weight: bold")}}get length(){return this.getEventsFromLocalStorage().length}async read(e,t){let o=this.getEventsFromLocalStorage();return t&&(o=o.filter(t)),o.slice(0,e)}async write(...e){let t=this.getEventsFromLocalStorage();t.push(...e),this.writeEventsToLocalStorage(t)}async delete(e){let t=this.getEventsFromLocalStorage();t=t.filter(o=>!e.includes(o.id)),this.writeEventsToLocalStorage(t)}async clear(){this.writeEventsToLocalStorage([])}};module.exports=u(m);0&&(module.exports={LocalStorageQueueStore}); | ||
var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var S=r=>i(r,"__esModule",{value:!0});var u=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},v=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of s(e))!g.call(r,a)&&(t||a!=="default")&&i(r,a,{get:()=>e[a],enumerable:!(o=l(e,a))||o.enumerable});return r};var m=(r=>(e,t)=>r&&r.get(e)||(t=v(S({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var y={};u(y,{LocalStorageQueueStore:()=>c});var n=require("@objectiv/tracker-core"),c=class{constructor(e){this.queueStoreName="LocalStorageQueueStore";if(typeof localStorage>"u")throw new Error(`${this.queueStoreName}: failed to initialize: localStorage is not available.`);this.localStorageKey=`objectiv-events-queue-${e.trackerId}`,n.TrackerConsole.log(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Initialized`,"font-weight: bold")}getEventsFromLocalStorage(){var e;try{return JSON.parse((e=localStorage.getItem(this.localStorageKey))!=null?e:"[]")}catch(t){n.TrackerConsole.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to parse Events from localStorage: ${t}`,"font-weight: bold")}return[]}writeEventsToLocalStorage(e){try{localStorage.setItem(this.localStorageKey,JSON.stringify(e))}catch(t){n.TrackerConsole.error(`%c\uFF62objectiv:${this.queueStoreName}\uFF63 Failed to write Events to localStorage: ${t}`,"font-weight: bold")}}get length(){return this.getEventsFromLocalStorage().length}async read(e,t){let o=this.getEventsFromLocalStorage();return t&&(o=o.filter(t)),o.slice(0,e)}async write(...e){let t=this.getEventsFromLocalStorage();t.push(...e),this.writeEventsToLocalStorage(t)}async delete(e){let t=this.getEventsFromLocalStorage();t=t.filter(o=>!e.includes(o.id)),this.writeEventsToLocalStorage(t)}async clear(){this.writeEventsToLocalStorage([])}};module.exports=m(y);0&&(module.exports={LocalStorageQueueStore}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@objectiv/queue-local-storage", | ||
"version": "0.0.19-0", | ||
"version": "0.0.19", | ||
"description": "A TrackerQueueStore based on localStorage API", | ||
@@ -50,8 +50,7 @@ "license": "Apache-2.0", | ||
"check:dependencies": "npx depcheck", | ||
"npm-publish": "shx rm -f .npmrc && npm publish --access=public --tag=$TAG", | ||
"npm-publish:verdaccio": "shx cp ../../verdaccio/.npmrc .npmrc && npm publish --tag=$TAG && shx rm -f .npmrc" | ||
"npm-publish": "shx rm -f .npmrc && npm publish --access=public", | ||
"npm-publish:verdaccio": "shx cp ../../verdaccio/.npmrc .npmrc && npm publish && shx rm -f .npmrc" | ||
}, | ||
"devDependencies": { | ||
"@objectiv/developer-tools": "^0.0.19-0", | ||
"@objectiv/testing-tools": "^0.0.19-0", | ||
"@objectiv/testing-tools": "^0.0.19", | ||
"@types/jest": "^27.4.1", | ||
@@ -67,5 +66,4 @@ "jest": "^27.5.1", | ||
"dependencies": { | ||
"@objectiv/tracker-core": "~0.0.19-0" | ||
}, | ||
"stableVersion": "0.0.18" | ||
"@objectiv/tracker-core": "~0.0.19" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
14599
2
1