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.15 to 0.0.16

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:()=>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});
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")),c=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",i=0)=>P(`${r}-${e}-${t}-${n}-${s}-${i}`);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,c.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:i}=(0,c.createEncoder)(F,r.slice(0,6).split("")),o=i(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!=="production"?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.dev`:`https://${e.org}-${e.project}-${e.env}.based.dev`],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 i=s[r],o=await Promise.race([q(i,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}},F=[",",".based.dev","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.15",
"version": "0.0.16",
"main": "dist/index.js",
"source": "src/index.ts",
"public": true,
"sideEffects": false,
"scripts": {

@@ -7,0 +9,0 @@ "build": "npx tsc",

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