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

@cubejs-backend/shared

Package Overview
Dependencies
Maintainers
2
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cubejs-backend/shared - npm Package Compare versions

Comparing version 0.25.18 to 0.25.22

17

CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

## [0.25.22](https://github.com/cube-js/cube.js/compare/v0.25.21...v0.25.22) (2021-01-21)
### Bug Fixes
* **server:** Unexpected kill on graceful shutdown ([fc99239](https://github.com/cube-js/cube.js/commit/fc992398037719e5d7cc56b35f5e52e59d7c71f2))
### Features
* Log warnings from createCancelableInterval ([44d09c4](https://github.com/cube-js/cube.js/commit/44d09c44da6ddfa845dd457bb766172698c8f334))
* **@cubejs-client/playground:** Database connection wizard ([#1671](https://github.com/cube-js/cube.js/issues/1671)) ([ba30883](https://github.com/cube-js/cube.js/commit/ba30883617c806c9f19ed6c879d0b0c2d656aae1))
## [0.25.18](https://github.com/cube-js/cube.js/compare/v0.25.17...v0.25.18) (2021-01-14)

@@ -8,0 +25,0 @@

5

dist/src/promises.d.ts

@@ -21,3 +21,6 @@ export interface CancelablePromise<T> extends Promise<T> {

*/
export declare function createCancelableInterval<T>(fn: (token: CancelToken) => Promise<T>, interval: number): CancelableInterval;
export declare function createCancelableInterval<T>(fn: (token: CancelToken) => Promise<T>, options: {
interval: number;
onDuplicatedExecution?: () => any;
}): CancelableInterval;
interface RetryWithTimeoutOptions {

@@ -24,0 +27,0 @@ timeout: number;

42

dist/src/promises.js

@@ -9,4 +9,7 @@ "use strict";

const promise = new Promise((resolve) => {
cancel = resolve;
setTimeout(resolve, ms);
const timeout = setTimeout(resolve, ms);
cancel = () => {
clearTimeout(timeout);
resolve();
};
});

@@ -32,6 +35,3 @@ promise.cancel = cancel;

if (this.withQueue.length) {
// eslint-disable-next-line no-restricted-syntax
for (const queued of this.withQueue) {
await queued.cancel(false);
}
await Promise.all(this.withQueue.map((queued) => queued.cancel()));
}

@@ -68,13 +68,19 @@ }

*/
function createCancelableInterval(fn, interval) {
function createCancelableInterval(fn, options) {
let execution = null;
const timeout = setInterval(async () => {
if (execution) {
process.emitWarning('Execution of previous interval was not finished, new execution will be skipped', 'UnexpectedBehaviour');
if (options.onDuplicatedExecution) {
options.onDuplicatedExecution();
}
return;
}
execution = createCancelablePromise(fn);
await execution;
execution = null;
}, interval);
try {
execution = createCancelablePromise(fn);
await execution;
}
finally {
execution = null;
}
}, options.interval);
return {

@@ -93,5 +99,11 @@ cancel: async (waitExecution = true) => {

let cancel = () => { };
const promise = new Promise(() => {
const timer = setTimeout(fn, timeout);
cancel = () => clearTimeout(timer);
const promise = new Promise((resolve) => {
const timer = setTimeout(() => {
fn();
resolve();
}, timeout);
cancel = () => {
clearTimeout(timer);
resolve();
};
});

@@ -98,0 +110,0 @@ promise.cancel = cancel;

@@ -55,2 +55,7 @@ "use strict";

async function track(opts) {
// fixes the issue with async tests
// the promise returned from this function can be executed after the test has finished
if (process.env.CI) {
return Promise.resolve();
}
trackEvents.push(Object.assign(Object.assign({}, opts), { id: crypto_1.default.randomBytes(16).toString('hex'), clientTimestamp: new Date().toJSON(), platform: process.platform, nodeVersion: process.version, anonymousId }));

@@ -57,0 +62,0 @@ const currentPromise = (flushPromise || Promise.resolve()).then(() => flush()).then(() => {

{
"name": "@cubejs-backend/shared",
"version": "0.25.18",
"version": "0.25.22",
"description": "Shared code for Cube.js backend packages",

@@ -42,3 +42,6 @@ "main": "dist/src/index.js",

},
"gitHead": "e05c391097e6579d0c5ace1c01b7006454bc400a"
"jest": {
"testEnvironment": "node"
},
"gitHead": "7966d4abead09896fc24228ec3980608b7f07cd2"
}

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

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