Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@based/opts

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@based/opts - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

dist/index.js

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

var $=Object.create;var i=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},f=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of v(t))!C.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(s=k(t,n))||s.enumerable});return e};var x=(e,t,r)=>(r=e!=null?$(w(e)):{},f(t||!e||!e.__esModule?i(r,"default",{value:e,enumerable:!0}):r,e)),B=e=>f(i({},"__esModule",{value:!0}),e);var S={};O(S,{default:()=>R});module.exports=B(S);var g=x(require("cross-fetch")),c=require("@saulx/utils"),K=Array.from(Array(10)).map((e,t)=>String(t)),l=["localhost","based.io","@based","/env-hub","admin","hub","-",",",".","?"],{encode:P}=(0,c.createEncoder)(l,K),U=e=>{let t={name:e.name||"@based/env-hub"};e.key&&e.optionalKey?t.optionalKey=e.key:e.key&&(t.key=e.key);let r=t.optionalKey?`${t.name},${t.key}?`:t.key?`${t.name},${t.key}`:t.name;return P(r)},M=async(e,t,r)=>{try{let s=await(0,g.default)(`${e}/status`,{headers:{"if-none-match-since":U(t)}});if(s.ok){let n=s.headers.get(j);if(!n)return 1;let{decode:u}=(0,c.createEncoder)(A,n.slice(0,6).split("")),o=u(n.slice(6)).split(","),h=[];for(let a=0;a<Math.floor(o.length/2);a++)h.push([o[a],encodeURIComponent(o[o.length-1-a])]);let[m,p]=h[~~(Math.random()*o.length)];return r?`${/^https/.test(e)?"https":"http"}://${m}`:`${/^https/.test(e)?"wss":"ws"}://${m}/${p}`}else return!1}catch{return!1}},d=/^ws/,y=async(e,t=!1,r=0)=>{if(e.url){let n;return typeof e.url=="function"?n=await e.url():n=e.url,t&&n&&d.test(n)?n.replace(d,"http"):n}let s=e.discoveryUrls||[e.cluster?`https://${e.org}-${e.project}-${e.env}-${e.cluster}.based.io`:`https://${e.org}-${e.project}-${e.env}.based.io`];for(let n=0;n<s.length;n++){let u=s[n],o=await Promise.race([M(u,e,t),(0,c.wait)(3e3)]);if(o===1||!o&&n===s.length-1)return await(0,c.wait)(Math.min(r*r*50+500,5e3)),y(e,t,++r);if(o)return o}},j=l[2][4]+l[0][8]+l[1][1]+"g",A=[",",".based.io","localhost:","localhost","based.io","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?"],b=y;var R=async(e,t)=>b(e,t);0&&(module.exports={});
var $=Object.create;var i=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of C(t))!w.call(e,r)&&r!==n&&i(e,r,{get:()=>t[r],enumerable:!(s=k(t,r))||s.enumerable});return e};var x=(e,t,n)=>(n=e!=null?$(v(e)):{},m(t||!e||!e.__esModule?i(n,"default",{value:e,enumerable:!0}):n,e)),B=e=>m(i({},"__esModule",{value:!0}),e);var I={};O(I,{default:()=>A});module.exports=B(I);var g=x(require("cross-fetch")),c=require("@saulx/utils"),U=Array.from(Array(10)).map((e,t)=>String(t)),l=["localhost","based.io","@based","/env-hub","admin","hub","-",",",".","?"],{encode:K}=(0,c.createEncoder)(l,U),M=e=>{let t={name:e.name||"@based/env-hub"};e.key&&e.optionalKey?t.optionalKey=e.key:e.key&&(t.key=e.key);let n=t.optionalKey?`${t.name},${t.key}?`:t.key?`${t.name},${t.key}`:t.name;return K(n)},P=async(e,t,n)=>{try{let s=await(0,g.default)(`${e}/status`,{headers:{"If-None-Match-Since":M(t)}});if(s.ok){let r=s.headers.get(S);if(!r)return 1;let{decode:u}=(0,c.createEncoder)(j,r.slice(0,6).split("")),o=u(r.slice(6)).split(","),h=[];for(let a=0;a<Math.floor(o.length/2);a++)h.push([o[a],encodeURIComponent(o[o.length-1-a])]);let[f,b]=h[~~(Math.random()*o.length)];return n?`${/^https/.test(e)?"https":"http"}://${f}`:`${/^https/.test(e)?"wss":"ws"}://${f}/${b}`}else return!1}catch{return!1}},d=/^ws/,y=async(e,t=!1,n=0)=>{if(e.url){let r;return typeof e.url=="function"?r=await e.url():r=e.url,t&&r&&d.test(r)?r.replace(d,"http"):r}let s=e.discoveryUrls||[e.cluster?`https://${e.org}-${e.project}-${e.env}-${e.cluster}.based.io`:`https://${e.org}-${e.project}-${e.env}.based.io`];for(let r=0;r<s.length;r++){let u=s[r],o=await Promise.race([P(u,e,t),(0,c.wait)(3e3)]);if(o===1||!o&&r===s.length-1)return await(0,c.wait)(Math.min(n*n*50+500,5e3)),y(e,t,++n);if(o)return o}},S=l[2][4].toUpperCase()+l[0][8].toUpperCase()+l[1][1]+"g",j=[",",".based.io","localhost:","localhost","based.io","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?"],p=y;var A=async(e,t)=>p(e,t);0&&(module.exports={});
{
"name": "@based/opts",
"version": "0.0.6",
"version": "0.0.7",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "public": true,

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