@based/opts
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -1,1 +0,26 @@ | ||
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 O=(e,t,n)=>(n=e!=null?p(v(e)):{},h(t||!e||!e.__esModule?i(n,"default",{value:e,enumerable:!0}):n,e)),x=e=>h(i({},"__esModule",{value:!0}),e);var A={};C(A,{default:()=>j});module.exports=x(A);var m=O(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("x-request-id");if(!r)return 1;let{decode:l}=(0,c.createEncoder)(M,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()*u.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=[",",".based.io","localhost:","localhost","based.io","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?","."],g=y;var j=async(e,t)=>g(e,t);0&&(module.exports={}); | ||
"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 |
{ | ||
"name": "@based/opts", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "public": true, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
14932
18
217
2