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

remote-storage

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remote-storage - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

./dist/index.js

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

import c from"cross-fetch";function a(){let s=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16;return s>0?(e=(s+e)%16|0,s=Math.floor(s/16)):(e=(t+e)%16|0,t=Math.floor(t/16)),(r=="x"?e:e&7|8).toString(16)})}function n(){return typeof window<"u"}var d="x-remote-storage-instance-id",x="x-remote-storage-user-id";var i="/entities/",o=class{constructor(t){let{serverAddress:r,instanceId:e,userId:u}=t??{};this.serverAddress=r??"https://rs.frigade.com",this.instanceId=e??"default",this.userId=u??this.getUserId()}async getItem(t){let r=await this.call("GET",`${i}${t}`,null);if(r.status===404)return null;let e=await r.text();return e.startsWith("{")?JSON.parse(e):e==="true"?!0:e==="false"?!1:isNaN(Number(e))?e:Number(e)}async setItem(t,r){await this.call("PUT",`${i}${t}`,r)}async removeItem(t){await this.call("DELETE",`${i}${t}`,null)}async call(t,r,e){return c(new URL(r,this.serverAddress).toString(),{method:t,headers:{"Content-Type":"application/json",[d]:this.instanceId,[x]:this.userId},body:e?JSON.stringify(e):void 0})}getUserId(){let t="rs-user-id";if(n()&&window.localStorage.getItem(t))return window.localStorage.getItem(t);let r=a();return n()&&window.localStorage.setItem(t,r),r}};export{d as HEADER_REMOTE_STORAGE_INSTANCE_ID,x as HEADER_REMOTE_STORAGE_USER_ID,o as RemoteStorage};
import c from"cross-fetch";function a(){let s=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16;return s>0?(e=(s+e)%16|0,s=Math.floor(s/16)):(e=(t+e)%16|0,t=Math.floor(t/16)),(r=="x"?e:e&7|8).toString(16)})}function n(){return typeof window<"u"}var d="x-remote-storage-instance-id",x="x-remote-storage-user-id";var i="/entities/",o=class{constructor(t){let{serverAddress:r,instanceId:e,userId:u}=t??{};this.serverAddress=r??"https://api.remote.storage",this.instanceId=e??"default",this.userId=u??this.getUserId()}async getItem(t){let r=await this.call("GET",`${i}${t}`,null);if(r.status===404)return null;let e=await r.text();return e.startsWith("{")?JSON.parse(e):e==="true"?!0:e==="false"?!1:isNaN(Number(e))?e:Number(e)}async setItem(t,r){await this.call("PUT",`${i}${t}`,r)}async removeItem(t){await this.call("DELETE",`${i}${t}`,null)}async call(t,r,e){return c(new URL(r,this.serverAddress).toString(),{method:t,headers:{"Content-Type":"application/json",[d]:this.instanceId,[x]:this.userId},body:e?JSON.stringify(e):void 0})}getUserId(){let t="rs-user-id";if(n()&&window.localStorage.getItem(t))return window.localStorage.getItem(t);let r=a();return n()&&window.localStorage.setItem(t,r),r}};export{d as HEADER_REMOTE_STORAGE_INSTANCE_ID,x as HEADER_REMOTE_STORAGE_USER_ID,o as RemoteStorage};
//# sourceMappingURL=index.js.map

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

import c from"cross-fetch";function a(){let s=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16;return s>0?(e=(s+e)%16|0,s=Math.floor(s/16)):(e=(t+e)%16|0,t=Math.floor(t/16)),(r=="x"?e:e&7|8).toString(16)})}function n(){return typeof window<"u"}var d="x-remote-storage-instance-id",x="x-remote-storage-user-id";var i="/entities/",o=class{constructor(t){let{serverAddress:r,instanceId:e,userId:u}=t??{};this.serverAddress=r??"https://rs.frigade.com",this.instanceId=e??"default",this.userId=u??this.getUserId()}async getItem(t){let r=await this.call("GET",`${i}${t}`,null);if(r.status===404)return null;let e=await r.text();return e.startsWith("{")?JSON.parse(e):e==="true"?!0:e==="false"?!1:isNaN(Number(e))?e:Number(e)}async setItem(t,r){await this.call("PUT",`${i}${t}`,r)}async removeItem(t){await this.call("DELETE",`${i}${t}`,null)}async call(t,r,e){return c(new URL(r,this.serverAddress).toString(),{method:t,headers:{"Content-Type":"application/json",[d]:this.instanceId,[x]:this.userId},body:e?JSON.stringify(e):void 0})}getUserId(){let t="rs-user-id";if(n()&&window.localStorage.getItem(t))return window.localStorage.getItem(t);let r=a();return n()&&window.localStorage.setItem(t,r),r}};export{d as HEADER_REMOTE_STORAGE_INSTANCE_ID,x as HEADER_REMOTE_STORAGE_USER_ID,o as RemoteStorage};
import c from"cross-fetch";function a(){let s=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16;return s>0?(e=(s+e)%16|0,s=Math.floor(s/16)):(e=(t+e)%16|0,t=Math.floor(t/16)),(r=="x"?e:e&7|8).toString(16)})}function n(){return typeof window<"u"}var d="x-remote-storage-instance-id",x="x-remote-storage-user-id";var i="/entities/",o=class{constructor(t){let{serverAddress:r,instanceId:e,userId:u}=t??{};this.serverAddress=r??"https://api.remote.storage",this.instanceId=e??"default",this.userId=u??this.getUserId()}async getItem(t){let r=await this.call("GET",`${i}${t}`,null);if(r.status===404)return null;let e=await r.text();return e.startsWith("{")?JSON.parse(e):e==="true"?!0:e==="false"?!1:isNaN(Number(e))?e:Number(e)}async setItem(t,r){await this.call("PUT",`${i}${t}`,r)}async removeItem(t){await this.call("DELETE",`${i}${t}`,null)}async call(t,r,e){return c(new URL(r,this.serverAddress).toString(),{method:t,headers:{"Content-Type":"application/json",[d]:this.instanceId,[x]:this.userId},body:e?JSON.stringify(e):void 0})}getUserId(){let t="rs-user-id";if(n()&&window.localStorage.getItem(t))return window.localStorage.getItem(t);let r=a();return n()&&window.localStorage.setItem(t,r),r}};export{d as HEADER_REMOTE_STORAGE_INSTANCE_ID,x as HEADER_REMOTE_STORAGE_USER_ID,o as RemoteStorage};
//# sourceMappingURL=index.js.map
{
"name": "remote-storage",
"version": "1.0.2",
"version": "1.0.3",
"description": "remoteStorage is a simple library that combines the localStorage API with a remote server to persist data across browsers and devices.",

@@ -23,6 +23,14 @@ "type": "module",

"localStorage",
"local storage",
"remoteStorage",
"central",
"remote storage",
"local",
"remote",
"storage",
"Javascript"
"Javascript",
"feature flags",
"user flags",
"browser",
"device",
"web"
],

@@ -29,0 +37,0 @@ "devDependencies": {

@@ -11,5 +11,5 @@ [![npm version](https://img.shields.io/npm/v/remote-storage)](https://www.npmjs.com/package/remote-storage)

<div align="center">
<a href="https://github.com/FrigadeHQ/remote-storage">Website</a>
<a href="https://remote.storage">Website</a>
<span> · </span>
<a href="https://codesandbox.io/p/sandbox/remote-storage-demo-35hgqz?file=%2Fsrc%2Findex.ts">Demo</a>
<a href="https://codesandbox.io/p/sandbox/remote-storage-demo-35hgqz?file=%2Fsrc%2Findex.ts">Live Demo</a>
<span> · </span>

@@ -58,2 +58,3 @@ <a href="https://github.com/FrigadeHQ/remote-storage">Source</a>

await remoteStorage.setItem('hasSeenNewFeature', true)
// Show your new feature!
}

@@ -93,3 +94,3 @@ ```

We offer a free hosted community server at `https://rs.frigade.com` (the default behavior if no `serverAddress` is provided). This hosted server should not be used for production apps, but it's great for testing and prototyping.
We offer a free hosted community server at `https://api.remote.storage` (the default behavior if no `serverAddress` is provided). This hosted server should not be used for production apps, but it's great for testing and prototyping.

@@ -99,3 +100,3 @@ To use a different server, simply pass the `serverAddress` option when creating a new instance of remoteStorage:

const remoteStorage = new RemoteStorage({
serverAddress: 'https://rs.frigade.com',
serverAddress: 'https://api.remote.storage',
userId: '123e4567-e89b-12d3-a456-426614174000',

@@ -122,1 +123,2 @@ instanceId: 'my-cool-app'

Yes. For this reason, we recommend using a non-iterable UUID for your user IDs. This makes it nearly impossible for users to guess other user IDs and access their data unless they know the user ID.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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