@based/opts
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -1,25 +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); | ||
//# sourceMappingURL=index.js.map | ||
var $=Object.create;var i=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},f=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of v(t))!C.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(s=k(t,n))||s.enumerable});return e};var x=(e,t,r)=>(r=e!=null?$(w(e)):{},f(t||!e||!e.__esModule?i(r,"default",{value:e,enumerable:!0}):r,e)),B=e=>f(i({},"__esModule",{value:!0}),e);var S={};O(S,{default:()=>R});module.exports=B(S);var g=x(require("cross-fetch")),c=require("@saulx/utils"),K=Array.from(Array(10)).map((e,t)=>String(t)),l=["localhost","based.io","@based","/env-hub","admin","hub","-",",",".","?"],{encode:P}=(0,c.createEncoder)(l,K),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 r=t.optionalKey?`${t.name},${t.key}?`:t.key?`${t.name},${t.key}`:t.name;return P(r)},M=async(e,t,r)=>{try{let s=await(0,g.default)(`${e}/status`,{headers:{"if-none-match-since":U(t)}});if(s.ok){let n=s.headers.get(j);if(!n)return 1;let{decode:u}=(0,c.createEncoder)(A,n.slice(0,6).split("")),o=u(n.slice(6)).split(","),h=[];for(let a=0;a<Math.floor(o.length/2);a++)h.push([o[a],encodeURIComponent(o[o.length-1-a])]);let[m,p]=h[~~(Math.random()*o.length)];return r?`${/^https/.test(e)?"https":"http"}://${m}`:`${/^https/.test(e)?"wss":"ws"}://${m}/${p}`}else return!1}catch{return!1}},d=/^ws/,y=async(e,t=!1,r=0)=>{if(e.url){let n;return typeof e.url=="function"?n=await e.url():n=e.url,t&&n&&d.test(n)?n.replace(d,"http"):n}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 n=0;n<s.length;n++){let u=s[n],o=await Promise.race([M(u,e,t),(0,c.wait)(3e3)]);if(o===1||!o&&n===s.length-1)return await(0,c.wait)(Math.min(r*r*50+500,5e3)),y(e,t,++r);if(o)return o}},j=l[2][4]+l[0][8]+l[1][1]+"g",A=[",",".based.io","localhost:","localhost","based.io","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?"],b=y;var R=async(e,t)=>b(e,t);0&&(module.exports={}); |
{ | ||
"name": "@based/opts", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/index.js", | ||
@@ -8,3 +8,4 @@ "public": true, | ||
"build": "npx tsc", | ||
"watch": "npx tsc --watch" | ||
"watch": "npx tsc --watch", | ||
"build-for-publish": "rm -rf ./dist/ & esbuild ./src/index.ts --bundle --minify --outdir=./dist/ --external:@saulx/utils --external:cross-fetch --platform=node" | ||
}, | ||
@@ -16,4 +17,5 @@ "dependencies": { | ||
"devDependencies": { | ||
"ts-node": "^10.9.1" | ||
"ts-node": "^10.9.1", | ||
"esbuild": "0.16.8" | ||
} | ||
} |
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
2796
2
3
9
3
1