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.1 to 1.0.2

2

./dist/index.js

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

import u 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({serverAddress:t,userId:r,instanceId:e}){this.serverAddress=t??"https://rs.frigade.com",this.instanceId=e??"default",this.userId=r??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 u(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://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};
//# sourceMappingURL=index.js.map

@@ -1,6 +0,6 @@

interface RemoteStorageProps {
interface RemoteStorageConfig {
/**
* The server address to use for remote storage. Defaults to https://rs.frigade.com
*/
serverAddress: string;
serverAddress?: string;
/**

@@ -20,3 +20,3 @@ * The user ID to use for remote storage. Defaults to a random UUID if not provided.

private readonly userId;
constructor({ serverAddress, userId, instanceId }: RemoteStorageProps);
constructor(config?: RemoteStorageConfig);
getItem<T>(key: string): Promise<T>;

@@ -23,0 +23,0 @@ setItem<T>(key: string, value: T): Promise<void>;

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

import u 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({serverAddress:t,userId:r,instanceId:e}){this.serverAddress=t??"https://rs.frigade.com",this.instanceId=e??"default",this.userId=r??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 u(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://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};
//# sourceMappingURL=index.js.map
{
"name": "remote-storage",
"version": "1.0.1",
"version": "1.0.2",
"description": "remoteStorage is a simple library that combines the localStorage API with a remote server to persist data across browsers and devices.",

@@ -5,0 +5,0 @@ "type": "module",

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