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

@based/opts

Package Overview
Dependencies
Maintainers
0
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 1.0.0 to 1.1.0

2

dist/index.js

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

import e from"@based/fetch";import{wait as t,createEncoder as r}from"@saulx/utils";import{hashObjectIgnoreKeyOrder as s}from"@saulx/hash";const a=(e,t,r,s,a="allServices",o=0)=>(e=>{let t=5381,r=e.length;for(;r;)t=33*t^e.charCodeAt(--r);let s=t>>>0;for(;s>65535;)s/=10;return Math.round(s)})(`${a}-${e}-${t}-${r}-${s}-${o}`),o=e=>e||"@based/env-hub",n=/^ws/,l={"@based/env-hub":0,"@based/env-admin-hub":1,"@based/admin-hub":2,"@based/machine-hub":3},h=e=>{const t=l[o(e.name)]+""+Math.floor(1e4*Math.random());return e.key?t+"/"+(e.optionalKey?e.key+"$":e.key):t},c=async(t,s,a)=>{try{const o=await e(`${t}/status/${h(s)}`,{headers:s.headers});if(o.ok){const e=o.headers.get("x-request-id");if(!e)return 1;const{decode:s}=r(u,e.slice(0,6).split("")),n=s(e.slice(6)).split(","),l=[];for(let e=0;e<Math.floor(n.length/2);e++)l.push([n[e],encodeURIComponent(n[n.length-1-e])]);const[h,c]=l[~~(Math.random()*l.length)],d=/^https/.test(t)?"s":"";return a?`http${d}://${h}`:`ws${d}://${h}/${c}`}return!1}catch(e){return!1}},d=async(e,r=!1,l=0)=>{if(e.url){let t;return t="function"==typeof e.url?await e.url():e.url,r&&t&&n.test(t)?t.replace(n,"http"):t}const h=e.discoveryUrls||(({cluster:e="production",org:t,project:r,env:n,name:l})=>"local"===e?[`http://localhost:${a(t,r,n,o(l).includes("env-")?"@based/env-hub-discovery":"@based/hub-discovery","allServices")}`]:[`https://${s({org:t,project:r,env:n,cluster:e}).toString(36)}-status.based.dev`])(e);for(let s=0;s<h.length;s++){const a=h[s],o=await Promise.race([c(a,e,r),t(3e3)]);if(1===o||!o&&s===h.length-1)return await t(Math.min(l*l*50+500,5e3)),d(e,r,++l);if(o)return o}},u=[",",".based.dev","localhost:","localhost","based.io","based.dev","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?","."];var i=d,b=async(e,t)=>i(e,t);export{b as default,h as genCache,a as getServicePort};
import e from"@based/fetch";import{wait as t,createEncoder as s}from"@saulx/utils";import{hashObjectIgnoreKeyOrder as r}from"@saulx/hash";const a=(e,t,s,r,a="allServices",o=0)=>(e=>{let t=5381,s=e.length;for(;s;)t=33*t^e.charCodeAt(--s);let r=t>>>0;for(;r>65535;)r/=10;return Math.round(r)})(`${a}-${e}-${t}-${s}-${r}-${o}`),o=e=>e||"@based/env-hub",n=/^ws/,l={"@based/env-hub":0,"@based/env-admin-hub":1,"@based/admin-hub":2,"@based/machine-hub":3},h=e=>{const t=l[o(e.name)]+""+Math.floor(1e4*Math.random());return e.key?t+"/"+(e.optionalKey?e.key+"$":e.key):t},c=async(t,r,a)=>{try{const o=await e(`${t}/status/${h(r)}`,{headers:r.headers});if(o.ok){const e=o.headers.get("x-request-id");if(!e)return 1;const{decode:r}=s(u,e.slice(0,6).split("")),n=r(e.slice(6)).split(","),l=[];for(let e=0;e<Math.floor(n.length/2);e++)l.push([n[e],encodeURIComponent(n[n.length-1-e])]);const[h,c]=l[~~(Math.random()*l.length)],d=/^https/.test(t)?"s":"";return a?`http${d}://${h}`:`ws${d}://${h}/${c}`}return!1}catch(e){return!1}},d=async(e,s=!1,l=0)=>{if(e.url){let t;return t="function"==typeof e.url?await e.url():e.url,s&&t&&n.test(t)?t.replace(n,"http"):t}const h=e.discoveryUrls||(({cluster:e="production",org:t,project:s,env:n,name:l,host:h})=>"local"===e?[`http://${h||"localhost"}:${a(t,s,n,o(l).includes("env-")?"@based/env-hub-discovery":"@based/hub-discovery","allServices")}`]:[`https://${r({org:t,project:s,env:n,cluster:e}).toString(36)}-status.${h||"based.dev"}`])(e);for(let r=0;r<h.length;r++){const a=h[r],o=await Promise.race([c(a,e,s),t(3e3)]);if(1===o||!o&&r===h.length-1)return await t(Math.min(l*l*50+500,5e3)),d(e,s,++l);if(o)return o}},u=[",",".based.dev","localhost:","localhost","based.io","based.dev","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?","."];var i=d,b=async(e,t)=>i(e,t);export{b as default,h as genCache,a as getServicePort};
{
"name": "@based/opts",
"version": "1.0.0",
"version": "1.1.0",
"type": "module",

@@ -15,11 +15,6 @@ "main": "dist/index.js",

"dependencies": {
"@saulx/hash": "^3.0.0",
"@saulx/utils": "^4.0.4",
"@based/fetch": "^2.0.1"
},
"devDependencies": {
"microbundle": "^0.15.1",
"typescript": "^5.2.2",
"@saulx/tsconfig": "^1.0.6"
"@saulx/hash": "3.0.0",
"@saulx/utils": "4.2.1",
"@based/fetch": "2.0.0"
}
}
}
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