Socket
Socket
Sign inDemoInstall

bullmq

Package Overview
Dependencies
Maintainers
1
Versions
531
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bullmq - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

8

CHANGELOG.md

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

## [1.4.2](https://github.com/taskforcesh/bullmq/compare/v1.4.1...v1.4.2) (2019-11-21)
### Bug Fixes
* avoid Job<->Queue circular json error ([5752727](https://github.com/taskforcesh/bullmq/commit/5752727a6294e1b8d35f6a49e4953375510e10e6))
* avoid the .toJSON serializer interface [#70](https://github.com/taskforcesh/bullmq/issues/70) ([5941b82](https://github.com/taskforcesh/bullmq/commit/5941b82b646e46d53970197a404e5ea54f09d008))
## [1.4.1](https://github.com/taskforcesh/bullmq/compare/v1.4.0...v1.4.1) (2019-11-08)

@@ -2,0 +10,0 @@

3

dist/classes/job.d.ts

@@ -42,3 +42,4 @@ import { JobsOptions } from '../interfaces';

static fromId(queue: QueueBase, jobId: string): Promise<Job>;
toJSON(): JobJson;
toJSON(): Pick<this, Exclude<keyof this, "queue">>;
asJSON(): JobJson;
update(data: any): Promise<void>;

@@ -45,0 +46,0 @@ updateProgress(progress: number | object): Promise<void>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const util_1 = require("util");

@@ -78,2 +79,6 @@ const enums_1 = require("../enums");

toJSON() {
const _a = this, { queue } = _a, withoutQueue = tslib_1.__rest(_a, ["queue"]);
return withoutQueue;
}
asJSON() {
return {

@@ -318,3 +323,3 @@ id: this.id,

const queue = this.queue;
const jobData = this.toJSON();
const jobData = this.asJSON();
return scripts_1.Scripts.addJob(client, queue, jobData, this.opts, this.id);

@@ -321,0 +326,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

cmd: 'start',
job: job.toJSON(),
job: job.asJSON(),
});

@@ -13,0 +13,0 @@ const done = new Promise((resolve, reject) => {

@@ -59,2 +59,23 @@ /*eslint-env node */

});
mocha_1.describe('JSON.stringify', () => {
mocha_1.it('retains property types', async () => {
const data = { foo: 'bar' };
const job = await classes_1.Job.create(queue, 'test', data);
job.returnvalue = 1;
job.progress = 20;
const json = JSON.stringify(job);
const parsed = JSON.parse(json);
chai_1.expect(parsed).to.have.deep.property('data', data);
chai_1.expect(parsed).to.have.property('name', 'test');
chai_1.expect(parsed).to.have.property('returnvalue', 1);
chai_1.expect(parsed).to.have.property('progress', 20);
});
mocha_1.it('omits the queue property to avoid a circular json error on node 8', async () => {
const data = { foo: 'bar' };
const job = await classes_1.Job.create(queue, 'test', data);
const json = JSON.stringify(job);
const parsed = JSON.parse(json);
chai_1.expect(parsed).not.to.have.property('queue');
});
});
mocha_1.describe('.update', function () {

@@ -61,0 +82,0 @@ mocha_1.it('should allow updating job data', async function () {

{
"name": "bullmq",
"version": "1.4.1",
"version": "1.4.2",
"description": "Queue for messages and jobs based on Redis",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -147,3 +147,8 @@ import IORedis from 'ioredis';

toJSON(): JobJson {
toJSON() {
const { queue, ...withoutQueue } = this;
return withoutQueue;
}
asJSON(): JobJson {
return {

@@ -456,3 +461,3 @@ id: this.id,

const jobData = this.toJSON();
const jobData = this.asJSON();

@@ -459,0 +464,0 @@ return Scripts.addJob(client, queue, jobData, this.opts, this.id);

@@ -9,3 +9,3 @@ const sandbox = (processFile: any, childPool: any) => {

cmd: 'start',
job: job.toJSON(),
job: job.asJSON(),
});

@@ -12,0 +12,0 @@

@@ -70,2 +70,25 @@ /*eslint-env node */

describe('JSON.stringify', () => {
it('retains property types', async () => {
const data = { foo: 'bar' };
const job = await Job.create(queue, 'test', data);
job.returnvalue = 1;
job.progress = 20;
const json = JSON.stringify(job);
const parsed = JSON.parse(json);
expect(parsed).to.have.deep.property('data', data);
expect(parsed).to.have.property('name', 'test');
expect(parsed).to.have.property('returnvalue', 1);
expect(parsed).to.have.property('progress', 20);
});
it('omits the queue property to avoid a circular json error on node 8', async () => {
const data = { foo: 'bar' };
const job = await Job.create(queue, 'test', data);
const json = JSON.stringify(job);
const parsed = JSON.parse(json);
expect(parsed).not.to.have.property('queue');
});
});
describe('.update', function() {

@@ -72,0 +95,0 @@ it('should allow updating job data', async function() {

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