New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

antiflux

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antiflux - npm Package Compare versions

Comparing version 0.1.18 to 0.1.19

2

dist/index.js

@@ -1,2 +0,2 @@

var Antiflux;System.register("crypto",["crypto"],(function(t,e){"use strict";var s,r;return e&&e.id,{setters:[function(t){s=t}],execute:function(){r="aes-256-gcm",t("encrypt",((t,e)=>{try{if(t){if(e){"string"!=typeof e&&(e=JSON.stringify(e));const i=s.default.randomBytes(12),n=s.default.createCipheriv(r,t,i);let o=n.update(e,"utf8","base64");return o+=n.final("base64"),{enc:o,iv:i,tag:n.getAuthTag()}}return void(process.env.DEBUG&&console.log("No data to encrypt"))}throw new Error("You must specify an encryption key")}catch(t){throw console.error(t),t}})),t("decrypt",((t,e)=>{try{if(t){if(e){const{enc:i,iv:n,tag:o}=e,c=s.default.createDecipheriv(r,t,Buffer.from(n));c.setAuthTag(Buffer.from(o));let u=c.update(i,"base64","utf8");return u+=c.final("utf8"),JSON.parse(u)}return void(process.env.DEBUG&&console.log("No data to decrypt"))}throw new Error("You must specify an encryption key")}catch(t){throw console.error(t),t}}))}}})),System.register("io",["fs","crypto"],(function(t,e){"use strict";var s,r,i,n;return e&&e.id,{setters:[function(t){s=t},function(t){r=t}],execute:function(){i=s.default.readFileSync,n=s.default.writeFileSync,t("write",((t,e,s)=>{try{s&&(e=r.encrypt(s,e)),n(t,JSON.stringify(e),"utf8")}catch(t){throw new Error("Could not write to file")}})),t("read",((t,e)=>{try{if(s.default.existsSync(t)){let s=i(t,"utf8");return s=JSON.parse(s),e&&(s=r.decrypt(e,s)),n=s,Object.keys(n).sort().reduce((function(t,e){return t[e]=n[e],t}),{})}throw new Error("File does not exist")}catch(t){console.error(t)}var n}))}}})),System.register("util",[],(function(t,e){"use strict";return e&&e.id,{setters:[],execute:function(){t("deepset",((t,e,s)=>{if(e.includes(".")){const r=e.split("."),i=t[r[0]];let n="";if(r.length>1){let e=1;for(;e<r.length;)n+=`{ "${r[e]}": `,e++;for(n+="string"==typeof s?`"${s}"`:JSON.stringify(s),e=1;e<r.length;)n+=" }",e++;return n=JSON.parse(n),t[r[0]]=Object.assign(i,n),t||{}}}}))}}})),System.register("store",["events","fs","io","util"],(function(t,e){"use strict";var s,r,i,n;return e&&e.id,{setters:[function(t){s=t},function(t){r=t},function(t){i=t},function(t){n=t}],execute:function(){t("default",class{constructor(t={},e={},n={}){if(this.state={},this.options=e,e.debug&&process.env.DEBUG,this.watch=new s.EventEmitter,e.debug&&(this.watch.on("set",(t=>{console.log(`(Store) ${t.key}: ${t.prior} ➟ ${t.value}`)})),this.watch.on("delete",(t=>{console.log(`(Store) ${t.key}: ${t.prior} ➟ DELETED`)})),this.watch.on("clear",(()=>{console.log("(Store) STATE ➟ CLEARED")}))),e.persist){const t=()=>{const t=this.dump();e.debug&&(console.log("Writing to disk:"),console.log(t)),i.write(e.persist,t,e.encryptKey)};this.watch.on("set",(()=>t())),this.watch.on("delete",(()=>t())),this.watch.on("clear",(()=>t()))}if(e.persist&&r.existsSync(e.persist)){const t=i.read(e.persist,e.encryptKey);for(const e in t)this.set(e,t[e])}else for(const e in t)this.set(e,t[e]);n&&(this.getters=n)}get(t){if(this.state[t])return this.state[t];if(t.includes(".")){const e=t.split(".");let s;for(const t in e)s=s?s[e[t]]:this.state[e[t]];return s}}getter(t){if(this.getters&&this.getters[t])return this.getters[t](this.dump())}dump(){return Object.assign({},this.state)}set(t,e){const s=this.get(t);t.includes(".")?this.state=n.deepset(this.state,t,e):this.state[t]=e,this.watch.emit("set",{key:t,value:e,prior:s})}has(t){if(t.includes(".")){const e=t.split(".");let s={};for(const t in e)s=s?s[e[t]]:this.state[e[t]];return void 0!==s}return Object.prototype.hasOwnProperty.call(this.state,t)}delete(t){const e=this.get(t);delete this.state[t],this.watch.emit("delete",{key:t,prior:e})}clear(){for(const t in this.state)delete this.state[t];this.watch.emit("clear")}})}}})),System.register("index",["store"],(function(t,e){"use strict";var s;return e&&e.id,{setters:[function(t){s=t}],execute:function(){t("default",s.default)}}})),Antiflux={};
var Antiflux;(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var s in r)t.o(r,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>h});const r=require("events"),s=require("fs");var o=t.n(s);const i=require("crypto");var n=t.n(i);const c="aes-256-gcm",a=o().readFileSync,l=o().writeFileSync,h=class{constructor(t={},e={},i={}){if(this.state={},this.options=e,e.debug&&process.env.DEBUG,this.watch=new r.EventEmitter,e.debug&&(this.watch.on("set",(t=>{console.log(`(Store) ${t.key}: ${t.prior} ➟ ${t.value}`)})),this.watch.on("delete",(t=>{console.log(`(Store) ${t.key}: ${t.prior} ➟ DELETED`)})),this.watch.on("clear",(()=>{console.log("(Store) STATE ➟ CLEARED")}))),e.persist){const t=()=>{const t=this.dump();e.debug&&(console.log("Writing to disk:"),console.log(t)),((t,e,r)=>{try{r&&(e=((t,e)=>{try{if(t){if(e){"string"!=typeof e&&(e=JSON.stringify(e));const r=n().randomBytes(12),s=n().createCipheriv(c,t,r);let o=s.update(e,"utf8","base64");return o+=s.final("base64"),{enc:o,iv:r,tag:s.getAuthTag()}}return void(process.env.DEBUG&&console.log("No data to encrypt"))}throw new Error("You must specify an encryption key")}catch(t){throw console.error(t),t}})(r,e)),l(t,JSON.stringify(e),"utf8")}catch(t){throw new Error("Could not write to file")}})(e.persist,t,e.encryptKey)};this.watch.on("set",(()=>t())),this.watch.on("delete",(()=>t())),this.watch.on("clear",(()=>t()))}if(e.persist&&(0,s.existsSync)(e.persist)){const t=((t,e)=>{try{if(o().existsSync(t)){let s=a(t,"utf8");return s=JSON.parse(s),e&&(s=((t,e)=>{try{if(t){if(e){const{enc:r,iv:s,tag:o}=e,i=n().createDecipheriv(c,t,Buffer.from(s));i.setAuthTag(Buffer.from(o));let a=i.update(r,"base64","utf8");return a+=i.final("utf8"),JSON.parse(a)}return void(process.env.DEBUG&&console.log("No data to decrypt"))}throw new Error("You must specify an encryption key")}catch(t){throw console.error(t),t}})(e,s)),r=s,Object.keys(r).sort().reduce((function(t,e){return t[e]=r[e],t}),{})}throw new Error("File does not exist")}catch(t){console.error(t)}var r})(e.persist,e.encryptKey);for(const e in t)this.set(e,t[e])}else for(const e in t)this.set(e,t[e]);i&&(this.getters=i)}get(t){if(this.state[t])return this.state[t];if(t.includes(".")){const e=t.split(".");let r;for(const t in e)r=r?r[e[t]]:this.state[e[t]];return r}}getter(t){if(this.getters&&this.getters[t])return this.getters[t](this.dump())}dump(){return Object.assign({},this.state)}set(t,e){const r=this.get(t);t.includes(".")?this.state=((t,e,r)=>{if(e.includes(".")){const s=e.split("."),o=t[s[0]];let i="";if(s.length>1){let e=1;for(;e<s.length;)i+=`{ "${s[e]}": `,e++;for(i+="string"==typeof r?`"${r}"`:JSON.stringify(r),e=1;e<s.length;)i+=" }",e++;return i=JSON.parse(i),t[s[0]]=Object.assign(o,i),t||{}}}})(this.state,t,e):this.state[t]=e,this.watch.emit("set",{key:t,value:e,prior:r})}has(t){if(t.includes(".")){const e=t.split(".");let r={};for(const t in e)r=r?r[e[t]]:this.state[e[t]];return void 0!==r}return Object.prototype.hasOwnProperty.call(this.state,t)}delete(t){const e=this.get(t);delete this.state[t],this.watch.emit("delete",{key:t,prior:e})}clear(){for(const t in this.state)delete this.state[t];this.watch.emit("clear")}};Antiflux=e})();
//# sourceMappingURL=index.js.map
{
"name": "antiflux",
"version": "0.1.18",
"version": "0.1.19",
"keywords": [

@@ -47,2 +47,3 @@ "store",

"@typescript-eslint/parser": "^5.8.1",
"babel-loader": "^8.2.3",
"eslint": "^8.5.0",

@@ -49,0 +50,0 @@ "eslint-config-prettier": "^8.3.0",

# Antiflux
A lightweight (<10kb bundled), zero-dependency, in-memory store and observable
A lightweight (<20kb bundled), zero-dependency, in-memory store and observable
state manager, exclusively for Node.js, for when reactive state managers and

@@ -5,0 +5,0 @@ their attendant boilerplate are overkill.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc