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.7 to 0.0.8

2

dist/index.js

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

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={});
var p=Object.create;var i=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of k(t))!w.call(e,r)&&r!==n&&i(e,r,{get:()=>t[r],enumerable:!(s=$(t,r))||s.enumerable});return e};var x=(e,t,n)=>(n=e!=null?p(v(e)):{},h(t||!e||!e.__esModule?i(n,"default",{value:e,enumerable:!0}):n,e)),O=e=>h(i({},"__esModule",{value:!0}),e);var R={};C(R,{default:()=>A});module.exports=O(R);var m=x(require("cross-fetch")),c=require("@saulx/utils"),B=Array.from(Array(10)).map((e,t)=>String(t)),K=["localhost","based.io","@based","/env-hub","admin","hub","-",",",".","?"],{encode:P}=(0,c.createEncoder)(K,B),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 n=t.optionalKey?`${t.name},${t.key}?`:t.key?`${t.name},${t.key}`:t.name;return P(n)},q=async(e,t,n)=>{try{let s=await(0,m.default)(`${e}/status`,{headers:{"sequence-id":U(t)}});if(s.ok){let r=s.headers.get(M);if(!r)return 1;let{decode:l}=(0,c.createEncoder)(j,r.slice(0,6).split("")),o=l(r.slice(6)).split(","),u=[];for(let a=0;a<Math.floor(o.length/2);a++)u.push([o[a],encodeURIComponent(o[o.length-1-a])]);let[d,b]=u[~~(Math.random()*o.length)];return n?`${/^https/.test(e)?"https":"http"}://${d}`:`${/^https/.test(e)?"wss":"ws"}://${d}/${b}`}else return!1}catch{return!1}},f=/^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&&f.test(r)?r.replace(f,"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 l=s[r],o=await Promise.race([q(l,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}},M="x-request-id",j=[",",".based.io","localhost:","localhost","based.io","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?"],g=y;var A=async(e,t)=>g(e,t);0&&(module.exports={});
{
"name": "@based/opts",
"version": "0.0.7",
"version": "0.0.8",
"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