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.11 to 0.0.12

27

dist/index.js

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

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const getUrlFromOpts_1 = __importDefault(require("./getUrlFromOpts"));
exports.default = async (opts, http) => {
return (0, getUrlFromOpts_1.default)(opts, http);
};
__exportStar(require("./types"), exports);
__exportStar(require("./localPort"), exports);
//# sourceMappingURL=index.js.map
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,r)=>{for(var n in r)l(e,n,{get:r[n],enumerable:!0})},g=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of w(r))!x.call(e,t)&&t!==n&&l(e,t,{get:()=>r[t],enumerable:!(s=k(r,t))||s.enumerable});return e};var B=(e,r,n)=>(n=e!=null?v(C(e)):{},g(r||!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")),i=require("@saulx/utils");var P=e=>{let r=5381,n=e.length;for(;n;)r=r*33^e.charCodeAt(--n);let s=r>>>0;for(;s>65535;)s=s/10;return Math.round(s)},h=(e,r,n,s,t="allServices",c=0)=>P(`${t}-${e}-${r}-${n}-${s}-${c}`);var K=Array.from(Array(10)).map((e,r)=>String(r)),U=["localhost","based.io","@based","/env-hub","admin","hub","-",",",".","?"],y=e=>e||"@based/env-hub",{encode:M}=(0,i.createEncoder)(U,K),j=e=>{let r={name:y(e.name)};e.key&&e.optionalKey?r.optionalKey=e.key:e.key&&(r.key=e.key);let n=r.optionalKey?`${r.name},${r.key}?`:r.key?`${r.name},${r.key}`:r.name;return M(n)},q=async(e,r,n)=>{try{let s=await(0,f.default)(`${e}/status`,{headers:{"sequence-id":j(r),...r.headers}});if(s.ok){let t=s.headers.get("x-request-id");if(!t)return 1;let{decode:c}=(0,i.createEncoder)(F,t.slice(0,6).split("")),o=c(t.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,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"?`https://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,r=!1,n=0)=>{if(e.url){let t;return typeof e.url=="function"?t=await e.url():t=e.url,r&&t&&m.test(t)?t.replace(m,"http"):t}let s=e.discoveryUrls||A(e);for(let t=0;t<s.length;t++){let c=s[t],o=await Promise.race([q(c,e,r),(0,i.wait)(3e3)]);if(o===1||!o&&t===s.length-1)return await(0,i.wait)(Math.min(n*n*50+500,5e3)),b(e,r,++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,r)=>$(e,r);0&&(module.exports={getServicePort});

2

package.json
{
"name": "@based/opts",
"version": "0.0.11",
"version": "0.0.12",
"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