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.14 to 0.0.15

2

dist/index.js

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

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