@cubejs-backend/shared
Advanced tools
Comparing version 0.25.0 to 0.25.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.25.2](https://github.com/cube-js/cube.js/compare/v0.25.1...v0.25.2) (2020-12-27) | ||
### Features | ||
* Ability to set timeouts for polling in BigQuery/Athena ([#1675](https://github.com/cube-js/cube.js/issues/1675)) ([dc944b1](https://github.com/cube-js/cube.js/commit/dc944b1aaacc69dd74a9d9d31ceaf43e16d37ccd)), closes [#1672](https://github.com/cube-js/cube.js/issues/1672) | ||
# [0.25.0](https://github.com/cube-js/cube.js/compare/v0.24.15...v0.25.0) (2020-12-21) | ||
@@ -8,0 +19,0 @@ |
@@ -0,1 +1,2 @@ | ||
export declare function convertTimeStrToMs(input: string, envName: string): number; | ||
declare const variables: { | ||
@@ -9,2 +10,4 @@ devMode: () => boolean; | ||
internalExceptions: () => "false" | "exit" | "log"; | ||
dbPollTimeout: () => number; | ||
dbPollMaxInterval: () => number; | ||
}; | ||
@@ -11,0 +14,0 @@ declare type Vars = typeof variables; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isDockerImage = exports.getEnv = void 0; | ||
exports.isDockerImage = exports.getEnv = exports.convertTimeStrToMs = void 0; | ||
const env_var_1 = require("env-var"); | ||
function convertTimeStrToMs(input, envName) { | ||
if (/^\d+$/.test(input)) { | ||
return parseInt(input, 10); | ||
} | ||
if (input.length > 1) { | ||
// eslint-disable-next-line default-case | ||
switch (input.substr(-1).toLowerCase()) { | ||
case 'h': | ||
return parseInt(input.slice(0, -1), 10) * 60 * 60; | ||
case 'm': | ||
return parseInt(input.slice(0, -1), 10) * 60; | ||
case 's': | ||
return parseInt(input.slice(0, -1), 10); | ||
} | ||
} | ||
throw new Error(`Unsupported time format in ${envName}`); | ||
} | ||
exports.convertTimeStrToMs = convertTimeStrToMs; | ||
const variables = { | ||
@@ -28,3 +46,11 @@ devMode: () => env_var_1.get('CUBEJS_DEV_MODE') | ||
.default('false') | ||
.asEnum(['exit', 'log', 'false']) | ||
.asEnum(['exit', 'log', 'false']), | ||
dbPollTimeout: () => { | ||
const value = process.env.CUBEJS_DB_POLL_TIMEOUT || '15m'; | ||
return convertTimeStrToMs(value, 'CUBEJS_DB_POLL_TIMEOUT'); | ||
}, | ||
dbPollMaxInterval: () => { | ||
const value = process.env.CUBEJS_DB_POLL_MAX_INTERVAL || '5s'; | ||
return convertTimeStrToMs(value, 'CUBEJS_DB_POLL_MAX_INTERVAL'); | ||
} | ||
}; | ||
@@ -31,0 +57,0 @@ function getEnv(key) { |
@@ -1,2 +0,2 @@ | ||
export * from './env'; | ||
export { getEnv, isDockerImage } from './env'; | ||
export * from './package'; | ||
@@ -3,0 +3,0 @@ export * from './track'; |
@@ -13,3 +13,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./env"), exports); | ||
exports.isDockerImage = exports.getEnv = void 0; | ||
var env_1 = require("./env"); | ||
Object.defineProperty(exports, "getEnv", { enumerable: true, get: function () { return env_1.getEnv; } }); | ||
Object.defineProperty(exports, "isDockerImage", { enumerable: true, get: function () { return env_1.isDockerImage; } }); | ||
__exportStar(require("./package"), exports); | ||
@@ -16,0 +19,0 @@ __exportStar(require("./track"), exports); |
{ | ||
"name": "@cubejs-backend/shared", | ||
"version": "0.25.0", | ||
"version": "0.25.2", | ||
"description": "Shared code for Cube.js backend packages", | ||
@@ -42,3 +42,3 @@ "main": "dist/src/index.js", | ||
}, | ||
"gitHead": "c97ba77f4238478beb2067e7570b35a9edccd569" | ||
"gitHead": "b809caa2c59bd42b7b7fb5d1d822cd861c2da166" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38051
324
9