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

@based/get-service

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@based/get-service - npm Package Compare versions

Comparing version 0.1.7 to 0.2.0

1

dist/index.d.ts

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

export declare const getClusterUrl: (cluster?: string) => string;
export declare type ServiceUrl = {

@@ -2,0 +3,0 @@ protocol: string;

@@ -6,3 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getClusterUrl = void 0;
const cross_fetch_1 = __importDefault(require("cross-fetch"));
const DEV_CLUSTER = 'https://dg194mksjrqfz.cloudfront.net';
const parsUrlRe = /^(?:(tcp|wss?|https?):\/\/)?([a-z0-9.-]*)(?::(\d+))?$/;

@@ -12,10 +14,28 @@ const wait = (t = 1e3) => new Promise((resolve) => {

});
// this has to be fixed - has to come from machine env var (should be there)
if (!process.env.SERVICE_SELECTOR_LIST && typeof window === 'undefined') {
if (process.env.CLUSTER === 'dev') {
process.env.SERVICE_SELECTOR_LIST = DEV_CLUSTER;
}
}
const SELECTOR_LIST = process.env.CLUSTER === 'local'
? 'http://localhost:7022'
: // : process.env.SERVICE_SELECTOR_LIST
// ? `https://${process.env.SERVICE_SELECTOR_LIST}`
'https://dg194mksjrqfz.cloudfront.net';
? `http://${process.env.SERVICE_SELECTOR_LIST}`
: `https://${process.env.SERVICE_SELECTOR_LIST}`;
let registryIndex = 0;
const getClusterUrl = (cluster) => {
if (!cluster) {
return DEV_CLUSTER;
}
if (cluster === 'local') {
return 'http://localhost:7022';
}
if (cluster === 'localSpesh') {
return 'http://localhost:9022';
}
return cluster;
};
exports.getClusterUrl = getClusterUrl;
async function getService(opts, retries = 0, cluster = SELECTOR_LIST) {
if (!cluster) {
throw new Error('No cluster url defined');
}
try {

@@ -22,0 +42,0 @@ const registryUrls = await Promise.race([

2

package.json
{
"name": "@based/get-service",
"version": "0.1.7",
"version": "0.2.0",
"main": "dist/index.js",

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

import fetch from 'cross-fetch'
const DEV_CLUSTER = 'https://dg194mksjrqfz.cloudfront.net'
const parsUrlRe = /^(?:(tcp|wss?|https?):\/\/)?([a-z0-9.-]*)(?::(\d+))?$/

@@ -9,12 +11,28 @@ const wait = (t = 1e3) =>

// this has to be fixed - has to come from machine env var (should be there)
if (!process.env.SERVICE_SELECTOR_LIST && typeof window === 'undefined') {
if (process.env.CLUSTER === 'dev') {
process.env.SERVICE_SELECTOR_LIST = DEV_CLUSTER
}
}
const SELECTOR_LIST =
process.env.CLUSTER === 'local'
? 'http://localhost:7022'
: // : process.env.SERVICE_SELECTOR_LIST
// ? `https://${process.env.SERVICE_SELECTOR_LIST}`
'https://dg194mksjrqfz.cloudfront.net'
? `http://${process.env.SERVICE_SELECTOR_LIST}`
: `https://${process.env.SERVICE_SELECTOR_LIST}`
let registryIndex = 0
export const getClusterUrl = (cluster?: string): string => {
if (!cluster) {
return DEV_CLUSTER
}
if (cluster === 'local') {
return 'http://localhost:7022'
}
if (cluster === 'localSpesh') {
return 'http://localhost:9022'
}
return cluster
}
export type ServiceUrl = {

@@ -41,2 +59,6 @@ protocol: string

): Promise<ServiceUrl> {
if (!cluster) {
throw new Error('No cluster url defined')
}
try {

@@ -43,0 +65,0 @@ const registryUrls = await Promise.race([

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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