New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bull-monitor/root

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bull-monitor/root - npm Package Compare versions

Comparing version 4.1.1 to 5.0.0

11

CHANGELOG.md

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

# [5.0.0](https://github.com/s-r-x/bull-monitor/compare/v4.1.1...v5.0.0) (2022-04-08)
### Features
* search by any field ([f5d9960](https://github.com/s-r-x/bull-monitor/commit/f5d99607b987161428700bb8a29b8326486cd6d5))
## [4.1.1](https://github.com/s-r-x/bull-monitor/compare/v4.1.0...v4.1.1) (2022-04-01)

@@ -8,0 +19,0 @@

2

dist/bull-adapter.d.ts

@@ -10,2 +10,3 @@ /// <reference types="ioredis" />

constructor(_job: BullJob, _queue: Queue);
get rawJob(): BullJob;
get queue(): Queue;

@@ -54,2 +55,3 @@ get id(): JobId;

getJob(id: JobId): Promise<Maybe<Job>>;
jobFromJSON(json: any, jobId: JobId): Job;
getJobs(status: JobStatus, start?: number, end?: number, asc?: boolean): Promise<Job[]>;

@@ -56,0 +58,0 @@ getJobCounts(): Promise<JobCounts>;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BullAdapter = exports.BullJobAdapter = void 0;
const queue_1 = require("./queue");
// this is required due to bad bull typings
const Bull = __importStar(require("bull"));
class BullJobAdapter extends queue_1.Job {

@@ -11,2 +36,6 @@ constructor(_job, _queue) {

}
// getters
get rawJob() {
return this._job;
}
get queue() {

@@ -51,2 +80,3 @@ return this._queue;

}
// public methods
async getState() {

@@ -147,2 +177,6 @@ return this._job.getState();

}
jobFromJSON(json, jobId) {
// @ts-ignore
return this.normalizeJob(Bull.Job.fromJSON(this._queue, json, jobId));
}
async getJobs(status, start, end, asc) {

@@ -149,0 +183,0 @@ const jobs = await this._queue.getJobs([status], start, end, asc);

@@ -9,2 +9,3 @@ import { Queue as BullMQQueue, Job as BullMQJob } from 'bullmq';

constructor(_job: BullMQJob, _queue: Queue);
get rawJob(): BullMQJob;
get queue(): Queue;

@@ -55,2 +56,3 @@ get id(): JobId;

getJob(id: JobId): Promise<Maybe<Job>>;
jobFromJSON(json: any, jobId: JobId): Job;
getJobs(types: JobStatus | JobStatus[], start?: number, end?: number, asc?: boolean): Promise<Job[]>;

@@ -57,0 +59,0 @@ getJobCounts(): Promise<JobCounts>;

@@ -14,2 +14,5 @@ "use strict";

// getters
get rawJob() {
return this._job;
}
get queue() {

@@ -162,2 +165,5 @@ return this._queue;

}
jobFromJSON(json, jobId) {
return this.normalizeJob(bullmq_1.Job.fromJSON(this._queue, json, jobId));
}
async getJobs(types, start, end, asc) {

@@ -164,0 +170,0 @@ const jobs = await this._queue.getJobs(types, start, end, asc);

12

dist/data-search.d.ts

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

import type { Queue as BullQueue, JobStatus } from './queue';
import type { Maybe } from './typings/utils';
import type { Queue, JobStatus, Job } from './queue';
declare type TSearchArgs = {

@@ -10,9 +9,10 @@ status: JobStatus;

};
export declare class DataSearcher {
declare type TJobsList = Job[];
export declare class PowerSearch {
private _queue;
constructor(_queue: BullQueue);
search(args: TSearchArgs): Promise<Maybe<import("./queue").Job>[]>;
constructor(_queue: Queue);
search(args: TSearchArgs): Promise<TJobsList>;
private _getIterator;
private _matchData;
private _evalSearch;
}
export {};

@@ -6,8 +6,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DataSearcher = void 0;
exports.PowerSearch = void 0;
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
const jsonata_1 = __importDefault(require("jsonata"));
const json_1 = require("./services/json");
const constants_1 = require("./constants");
class DataSearcher {
class PowerSearch {
constructor(_queue) {

@@ -33,5 +32,4 @@ this._queue = _queue;

for (const job of jobs) {
const matched = this._matchData(job.data, expr);
if (matched) {
acc.push(job.id);
if (this._evalSearch(job, expr)) {
acc.push(job);
}

@@ -44,4 +42,3 @@ if (acc.length >= end) {

it.destroy();
const jobs = await Promise.all(acc.slice(start, end).map((id) => this._queue.getJob(id)));
return jobs;
return acc.slice(start, end);
}

@@ -64,5 +61,5 @@ _getIterator(args) {

}
_matchData(data, expr) {
_evalSearch(job, expr) {
try {
const result = expr.evaluate(json_1.JsonService.maybeParse(data));
const result = expr.evaluate(job.rawJob);
if (!result)

@@ -77,3 +74,3 @@ return false;

}
exports.DataSearcher = DataSearcher;
exports.PowerSearch = PowerSearch;
class AbstractIterator {

@@ -84,13 +81,10 @@ constructor(_queue, config) {

}
async _extractJobsData(ids) {
async _extractJobs(ids) {
const client = await this._queue.client;
const pipeline = client.pipeline();
ids.forEach((id) => pipeline.hmget(this._queue.toKey(id), 'data'));
const data = await pipeline.exec();
return data.reduce((acc, [error, [jobData]], idx) => {
if (!error && jobData && jobData !== '{}' && jobData !== '[]') {
acc.push({
data: jobData,
id: ids[idx],
});
ids.forEach((id) => pipeline.hgetall(this._queue.toKey(id)));
const jobs = await pipeline.exec();
return jobs.reduce((acc, [error, job], idx) => {
if (!error && job) {
acc.push(this._queue.jobFromJSON(job, ids[idx]));
}

@@ -114,4 +108,4 @@ return acc;

const filteredIds = ids.filter((_k, idx) => !(idx % 2));
const data = await this._extractJobsData(filteredIds);
yield data;
const jobs = await this._extractJobs(filteredIds);
yield jobs;
this._stream.resume();

@@ -141,5 +135,5 @@ }

}
const data = await this._extractJobsData(ids);
this._incCursor(data.length);
yield data;
const jobs = await this._extractJobs(ids);
this._incCursor(jobs.length);
yield jobs;
}

@@ -146,0 +140,0 @@ catch (e) {

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

if (status) {
const searcher = new data_search_1.DataSearcher(bullQueue);
const searcher = new data_search_1.PowerSearch(bullQueue);
return await searcher

@@ -53,0 +53,0 @@ .search({

@@ -32,2 +32,3 @@ import type { Redis, Cluster } from 'ioredis';

abstract get timestamp(): Maybe<number>;
abstract get rawJob(): any;
abstract getState(): Promise<JobStatus>;

@@ -62,2 +63,3 @@ abstract moveToCompleted(returnValue?: unknown): Promise<unknown>;

abstract getJob(id: JobId): Promise<Maybe<Job>>;
abstract jobFromJSON(json: any, jobId: JobId): Job;
abstract getJobs(types: JobStatus | JobStatus[], start?: number, end?: number, asc?: boolean): Promise<Job[]>;

@@ -64,0 +66,0 @@ abstract getJobCounts(): Promise<JobCounts>;

{
"name": "@bull-monitor/root",
"version": "4.1.1",
"version": "5.0.0",
"repository": {

@@ -46,3 +46,3 @@ "type": "git",

},
"gitHead": "0a229343d4fba6a8ea7912ebb892f7e7c644df1a"
"gitHead": "522cf37d67a72be132af9d97d72755f37763b937"
}

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

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