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.2.0 to 0.3.0

2

dist/index.js

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

var z=Object.create;var P=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ne=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})},U=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ee(t))!re.call(e,o)&&o!==r&&P(e,o,{get:()=>t[o],enumerable:!(l=h(t,o))||l.enumerable});return e};var F=(e,t,r)=>(r=e!=null?z(te(e)):{},U(t||!e||!e.__esModule?P(r,"default",{value:e,enumerable:!0}):r,e)),le=e=>U(P({},"__esModule",{value:!0}),e);var b=_(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});var ue=(e,t=5381)=>{let r=e.length;for(;r;){let l=e.charCodeAt(--r);t=t*33^l}return t};K.default=ue});var A=_(m=>{"use strict";var fe=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});var c=fe(b()),v=(e,t=5381,r=52711)=>{if(Array.isArray(e))for(let l=0;l<e.length;l++){let o=e[l],u=typeof o;if(u==="string"){let n=l+":"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="number"){let n=l+"n:"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="object")if(o===null){let n=l+"v:null";t=c.default(n,t),r=c.default(n,r)}else{let n=v(o,t,r);t=c.default(l+"o:",n[0]),r=c.default(l+"o:",n[1])}else if(u==="boolean"){let n=l+"b:"+(o?"true":"false");t=c.default(n,t),r=c.default(n,r)}}else for(let l in e){let o=e[l],u=typeof o;if(u==="string"){let n=l+":"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="number"){let n=l+"n:"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="object")if(o===null){let n=l+"v:null";t=c.default(n,t),r=c.default(n,r)}else{let n=v(o,t,r);t=c.default(l+"o:",n[0]),r=c.default(l+"o:",n[1])}else if(u==="boolean"){let n=l+"b:"+(o?"true":"false");t=c.default(n,t),r=c.default(n,r)}}return[t,r]};m.default=v});var k=_(O=>{"use strict";var se=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(O,"__esModule",{value:!0});var ie=se(A()),ce=e=>{let t=ie.default(e);return(t[0]>>>0)*4096+t[1]};O.default=ce});var I=_(j=>{"use strict";var R=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});var ae=R(k()),$=R(b()),de=(e,t)=>{let r;if(typeof e=="object"?e===null?r=0:r=ae.default(e):typeof e=="boolean"?r=($.default(e?":true":":false")>>>0)*4096:typeof e=="number"?r=($.default("n:"+e)>>>0)*4096+($.default("n:"+e,52711)>>>0):r=($.default(e)>>>0)*4096+($.default(e,52711)>>>0),t){let l=Math.ceil(Math.log10(r+1));if(l<t)return r*Math.pow(10,t-l)}return r};j.default=de});var J=_(M=>{"use strict";var N=M&&M.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(M,"__esModule",{value:!0});var E=N(I()),S=N(b()),_e=N(k()),W=H(),ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",G=e=>{let t="",r;do r=e%62,t=ye.charAt(r)+t,e=Math.floor(e/62);while(e>0);return t},ge=(e,t,r)=>{let l;if(typeof e=="object")if(e===null)l=0;else if(t&&t>9&&e.constructor===Array){let n="",f=e.length;for(let s=0;s<f;s++)n+=G(r&&e[s]&&typeof e[s]=="object"?W.hashObjectIgnoreKeyOrder(e[s]):E.default(e[s]));let a=n.length;if(a<t)n+="x",a+1<t&&(n+=new Array(t-a).join("0"));else if(a>t)return n.slice(0,t);return n}else l=(r?W.hashObjectIgnoreKeyOrder(e):_e.default(e))>>>0;else typeof e=="boolean"?l=S.default(e?":true":":false")*4096:typeof e=="number"?l=(S.default("n:"+e)>>>0)*4096:l=S.default(e)>>>0;let o=G(l),u=o.length;return u<t&&(o+="x",u+1<t&&(o+=new Array(t-u).join("0"))),o};M.default=ge});var x=_(q=>{"use strict";var be=q&&q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});var i=be(b()),B=(e,t=5381,r=52711)=>{if(Array.isArray(e)){let l="__len:"+e.length+1;t=i.default(l,t),r=i.default(l,r);for(let o=0;o<e.length;o++){let u=e[o],n=typeof u;if(n==="string"){let f=o+":"+u;t=i.default(f,t),r=i.default(f,r)}else if(n==="number"){let f=o+"n:"+u;t=i.default(f,t),r=i.default(f,r)}else if(n==="object")if(u===null){let f=o+"v:null";t=i.default(f,t),r=i.default(f,r)}else{let f=B(u,t,r),a=o+"o:";t=i.default(a,f[0]),r=i.default(a,f[1])}else if(n==="boolean"){let f=o+"b:"+(u?"true":"false");t=i.default(f,t),r=i.default(f,r)}}}else{let l=Object.keys(e).sort(),o="__len:"+l.length+1;t=i.default(o,t),r=i.default(o,r);for(let u=0;u<l.length;u++){let n=l[u],f=e[n],a=typeof f;if(a==="string"){let s=n+":"+f;t=i.default(s,t),r=i.default(s,r)}else if(a==="number"){let s=n+"n:"+f;t=i.default(s,t),r=i.default(s,r)}else if(a==="object")if(f===null){let s=n+"v:null";t=i.default(s,t),r=i.default(s,r)}else{let s=B(f,t,r),D=n+"o:";t=i.default(D,s[0]),r=i.default(D,s[1])}else if(a==="boolean"){let s=n+"b:"+(f?"true":"false");t=i.default(s,t),r=i.default(s,r)}}}return[t,r]};q.default=B});var L=_(w=>{"use strict";var pe=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(w,"__esModule",{value:!0});var me=pe(x()),Oe=e=>{let t=me.default(e);return(t[0]>>>0)*4096+(t[1]>>>0)};w.default=Oe});var H=_(d=>{"use strict";var y=d&&d.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0});var $e=y(I());d.hash=$e.default;var je=y(J());d.hashCompact=je.default;var Me=y(k());d.hashObject=Me.default;var qe=y(L());d.hashObjectIgnoreKeyOrder=qe.default;var we=y(x());d.hashObjectIgnoreKeyOrderNest=we.default;var De=y(A());d.hashObjectNest=De.default;var Pe=y(b());d.stringHash=Pe.default});var He={};ne(He,{default:()=>Ne,getServicePort:()=>C});module.exports=le(He);var T=F(require("cross-fetch")),p=require("@saulx/utils");var oe=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);let l=t>>>0;for(;l>65535;)l=l/10;return Math.round(l)},C=(e,t,r,l,o="allServices",u=0)=>oe(`${o}-${e}-${t}-${r}-${l}-${u}`);var V=F(H()),ke=Array.from(Array(10)).map((e,t)=>String(t)),Ce=["localhost","based.io","based.dev","@based","/env-hub","admin","hub","-",",",".","?"],X=e=>e||"@based/env-hub",{encode:Ke}=(0,p.createEncoder)(Ce,ke),ve=e=>{let t={name:X(e.name)};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 Ke(r)},Ae=async(e,t,r)=>{try{let l=Math.floor(Math.random()*1e4),o=await(0,T.default)(`${e}/status/${l}`,{headers:{"sequence-id":ve(t),...t.headers}});if(o.ok){let u=o.headers.get("x-request-id");if(!u)return 1;let{decode:n}=(0,p.createEncoder)(Se,u.slice(0,6).split("")),f=n(u.slice(6)).split(","),a=[];for(let g=0;g<Math.floor(f.length/2);g++)a.push([f[g],encodeURIComponent(f[f.length-1-g])]);let[s,D]=a[~~(Math.random()*a.length)];return r?`${/^https/.test(e)?"https":"http"}://${s}`:`${/^https/.test(e)?"wss":"ws"}://${s}/${D}`}else return!1}catch{return!1}},Q=/^ws/,Ie=({cluster:e="production",org:t,project:r,env:l,name:o})=>{if(e==="local")return[`http://localhost:${C(t,r,l,X(o).includes("env-")?"@based/env-hub-discovery":"@based/hub-discovery","allServices")}`];let u=`-${(0,V.stringHash)(`${e}:${t}:${r}:${l}`).toString(36)}`;e&&e!=="production"&&(u+=`-${e}`),u+="-status";let n=`${t}-${r}-${l}`,f=n.length+u.length;return f>63&&(n=n.substring(0,63-f)),[`https://${n}${u}.based.dev`]},Y=async(e,t=!1,r=0)=>{if(e.url){let o;return typeof e.url=="function"?o=await e.url():o=e.url,t&&o&&Q.test(o)?o.replace(Q,"http"):o}let l=e.discoveryUrls||Ie(e);for(let o=0;o<l.length;o++){let u=l[o],n=await Promise.race([Ae(u,e,t),(0,p.wait)(3e3)]);if(n===1||!n&&o===l.length-1)return await(0,p.wait)(Math.min(r*r*50+500,5e3)),Y(e,t,++r);if(n)return n}},Se=[",",".based.dev","localhost:","localhost","based.io","based.dev","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?","."],Z=Y;var Ne=async(e,t)=>Z(e,t);0&&(module.exports={getServicePort});
var h=Object.create;var D=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),le=(e,t)=>{for(var r in t)D(e,r,{get:t[r],enumerable:!0})},F=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of te(t))!ne.call(e,o)&&o!==r&&D(e,o,{get:()=>t[o],enumerable:!(l=ee(t,o))||l.enumerable});return e};var R=(e,t,r)=>(r=e!=null?h(re(e)):{},F(t||!e||!e.__esModule?D(r,"default",{value:e,enumerable:!0}):r,e)),oe=e=>F(D({},"__esModule",{value:!0}),e);var b=_(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});var fe=(e,t=5381)=>{let r=e.length;for(;r;){let l=e.charCodeAt(--r);t=t*33^l}return t};K.default=fe});var A=_(m=>{"use strict";var se=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});var c=se(b()),v=(e,t=5381,r=52711)=>{if(Array.isArray(e))for(let l=0;l<e.length;l++){let o=e[l],u=typeof o;if(u==="string"){let n=l+":"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="number"){let n=l+"n:"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="object")if(o===null){let n=l+"v:null";t=c.default(n,t),r=c.default(n,r)}else{let n=v(o,t,r);t=c.default(l+"o:",n[0]),r=c.default(l+"o:",n[1])}else if(u==="boolean"){let n=l+"b:"+(o?"true":"false");t=c.default(n,t),r=c.default(n,r)}}else for(let l in e){let o=e[l],u=typeof o;if(u==="string"){let n=l+":"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="number"){let n=l+"n:"+o;t=c.default(n,t),r=c.default(n,r)}else if(u==="object")if(o===null){let n=l+"v:null";t=c.default(n,t),r=c.default(n,r)}else{let n=v(o,t,r);t=c.default(l+"o:",n[0]),r=c.default(l+"o:",n[1])}else if(u==="boolean"){let n=l+"b:"+(o?"true":"false");t=c.default(n,t),r=c.default(n,r)}}return[t,r]};m.default=v});var P=_(O=>{"use strict";var ie=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(O,"__esModule",{value:!0});var ce=ie(A()),ae=e=>{let t=ce.default(e);return(t[0]>>>0)*4096+t[1]};O.default=ae});var I=_(j=>{"use strict";var E=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});var de=E(P()),$=E(b()),_e=(e,t)=>{let r;if(typeof e=="object"?e===null?r=0:r=de.default(e):typeof e=="boolean"?r=($.default(e?":true":":false")>>>0)*4096:typeof e=="number"?r=($.default("n:"+e)>>>0)*4096+($.default("n:"+e,52711)>>>0):r=($.default(e)>>>0)*4096+($.default(e,52711)>>>0),t){let l=Math.ceil(Math.log10(r+1));if(l<t)return r*Math.pow(10,t-l)}return r};j.default=_e});var L=_(M=>{"use strict";var N=M&&M.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(M,"__esModule",{value:!0});var W=N(I()),S=N(b()),ge=N(P()),G=H(),ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",J=e=>{let t="",r;do r=e%62,t=ye.charAt(r)+t,e=Math.floor(e/62);while(e>0);return t},be=(e,t,r)=>{let l;if(typeof e=="object")if(e===null)l=0;else if(t&&t>9&&e.constructor===Array){let n="",f=e.length;for(let s=0;s<f;s++)n+=J(r&&e[s]&&typeof e[s]=="object"?G.hashObjectIgnoreKeyOrder(e[s]):W.default(e[s]));let a=n.length;if(a<t)n+="x",a+1<t&&(n+=new Array(t-a).join("0"));else if(a>t)return n.slice(0,t);return n}else l=(r?G.hashObjectIgnoreKeyOrder(e):ge.default(e))>>>0;else typeof e=="boolean"?l=S.default(e?":true":":false")*4096:typeof e=="number"?l=(S.default("n:"+e)>>>0)*4096:l=S.default(e)>>>0;let o=J(l),u=o.length;return u<t&&(o+="x",u+1<t&&(o+=new Array(t-u).join("0"))),o};M.default=be});var B=_(q=>{"use strict";var pe=q&&q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});var i=pe(b()),x=(e,t=5381,r=52711)=>{if(Array.isArray(e)){let l="__len:"+e.length+1;t=i.default(l,t),r=i.default(l,r);for(let o=0;o<e.length;o++){let u=e[o],n=typeof u;if(n==="string"){let f=o+":"+u;t=i.default(f,t),r=i.default(f,r)}else if(n==="number"){let f=o+"n:"+u;t=i.default(f,t),r=i.default(f,r)}else if(n==="object")if(u===null){let f=o+"v:null";t=i.default(f,t),r=i.default(f,r)}else{let f=x(u,t,r),a=o+"o:";t=i.default(a,f[0]),r=i.default(a,f[1])}else if(n==="boolean"){let f=o+"b:"+(u?"true":"false");t=i.default(f,t),r=i.default(f,r)}}}else{let l=Object.keys(e).sort(),o="__len:"+l.length+1;t=i.default(o,t),r=i.default(o,r);for(let u=0;u<l.length;u++){let n=l[u],f=e[n],a=typeof f;if(a==="string"){let s=n+":"+f;t=i.default(s,t),r=i.default(s,r)}else if(a==="number"){let s=n+"n:"+f;t=i.default(s,t),r=i.default(s,r)}else if(a==="object")if(f===null){let s=n+"v:null";t=i.default(s,t),r=i.default(s,r)}else{let s=x(f,t,r),C=n+"o:";t=i.default(C,s[0]),r=i.default(C,s[1])}else if(a==="boolean"){let s=n+"b:"+(f?"true":"false");t=i.default(s,t),r=i.default(s,r)}}}return[t,r]};q.default=x});var Q=_(w=>{"use strict";var me=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(w,"__esModule",{value:!0});var Oe=me(B()),$e=e=>{let t=Oe.default(e);return(t[0]>>>0)*4096+(t[1]>>>0)};w.default=$e});var H=_(d=>{"use strict";var g=d&&d.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0});var je=g(I());d.hash=je.default;var Me=g(L());d.hashCompact=Me.default;var qe=g(P());d.hashObject=qe.default;var we=g(Q());d.hashObjectIgnoreKeyOrder=we.default;var Ce=g(B());d.hashObjectIgnoreKeyOrderNest=Ce.default;var De=g(A());d.hashObjectNest=De.default;var Pe=g(b());d.stringHash=Pe.default});var He={};le(He,{default:()=>Ne,genCache:()=>U,getServicePort:()=>k});module.exports=oe(He);var V=R(require("cross-fetch")),p=require("@saulx/utils");var ue=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);let l=t>>>0;for(;l>65535;)l=l/10;return Math.round(l)},k=(e,t,r,l,o="allServices",u=0)=>ue(`${o}-${e}-${t}-${r}-${l}-${u}`);var X=R(H()),ke=Array.from(Array(10)).map((e,t)=>String(t)),Ke=["localhost","based.io","based.dev","@based","/env-hub","admin","hub","-",",",".","?"],Y=e=>e||"@based/env-hub",{encode:ve}=(0,p.createEncoder)(Ke,ke),U=e=>{let t={name:Y(e.name)};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 ve(r)},Ae=async(e,t,r)=>{try{let l=Math.floor(Math.random()*1e4),o=await(0,V.default)(`${e}/status/${l}`,{headers:{"sequence-id":U(t),...t.headers}});if(o.ok){let u=o.headers.get("x-request-id");if(!u)return 1;let{decode:n}=(0,p.createEncoder)(Se,u.slice(0,6).split("")),f=n(u.slice(6)).split(","),a=[];for(let y=0;y<Math.floor(f.length/2);y++)a.push([f[y],encodeURIComponent(f[f.length-1-y])]);let[s,C]=a[~~(Math.random()*a.length)];return r?`${/^https/.test(e)?"https":"http"}://${s}`:`${/^https/.test(e)?"wss":"ws"}://${s}/${C}`}else return!1}catch{return!1}},T=/^ws/,Ie=({cluster:e="production",org:t,project:r,env:l,name:o})=>{if(e==="local")return[`http://localhost:${k(t,r,l,Y(o).includes("env-")?"@based/env-hub-discovery":"@based/hub-discovery","allServices")}`];let u=`-${(0,X.stringHash)(`${e}:${t}:${r}:${l}`).toString(36)}`;e&&e!=="production"&&(u+=`-${e}`),u+="-status";let n=`${t}-${r}-${l}`,f=n.length+u.length;return f>63&&(n=n.substring(0,63-f)),[`https://${n}${u}.based.dev`]},Z=async(e,t=!1,r=0)=>{if(e.url){let o;return typeof e.url=="function"?o=await e.url():o=e.url,t&&o&&T.test(o)?o.replace(T,"http"):o}let l=e.discoveryUrls||Ie(e);for(let o=0;o<l.length;o++){let u=l[o],n=await Promise.race([Ae(u,e,t),(0,p.wait)(3e3)]);if(n===1||!n&&o===l.length-1)return await(0,p.wait)(Math.min(r*r*50+500,5e3)),Z(e,t,++r);if(n)return n}},Se=[",",".based.dev","localhost:","localhost","based.io","based.dev","@based","/env-hub","admin","hub","900","90","443","80",":","%","/","=","<","?","."],z=Z;var Ne=async(e,t)=>z(e,t);0&&(module.exports={genCache,getServicePort});
{
"name": "@based/opts",
"version": "0.2.0",
"version": "0.3.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

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