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

@lokalise/background-jobs-common

Package Overview
Dependencies
Maintainers
10
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lokalise/background-jobs-common - npm Package Compare versions

Comparing version 2.0.6 to 3.0.0

2

dist/background-job-processor/processors/AbstractBackgroundJobProcessor.d.ts

@@ -13,3 +13,3 @@ import type { CommonLogger } from '@lokalise/node-core';

private readonly redis;
private readonly newRelicBackgroundTransactionManager;
private readonly transactionObservabilityManager;
private readonly errorReporter;

@@ -16,0 +16,0 @@ private readonly config;

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

redis;
newRelicBackgroundTransactionManager;
transactionObservabilityManager;
errorReporter;

@@ -52,3 +52,3 @@ config;

this.redis = dependencies.redis;
this.newRelicBackgroundTransactionManager = dependencies.transactionObservabilityManager;
this.transactionObservabilityManager = dependencies.transactionObservabilityManager;
this.logger = dependencies.logger;

@@ -116,2 +116,3 @@ this.errorReporter = dependencies.errorReporter;

catch {
/* v8 ignore next 3 */
// do nothing

@@ -132,7 +133,7 @@ }

queueId: this.config.queueId,
}, 'Processor ${this.constructor.name} is not started, starting with lazy loading');
}, `Processor ${this.constructor.name} is not started, starting with lazy loading`);
await this.start();
}
const jobs = await this.queue?.addBulk(jobData.map((data) => ({
name: this.constructor.name,
name: this.config.queueId,
data,

@@ -142,2 +143,3 @@ opts: this.prepareJobOptions(options ?? {}),

const jobIds = jobs?.map((job) => job.id) ?? [];
/* v8 ignore next 3 */
if (jobIds.length === 0 || !jobIds.every((id) => !!id)) {

@@ -156,2 +158,3 @@ // Practically unreachable, but we want to simplify the signature of the method and avoid

};
/* v8 ignore next 7 */
if (this.config.isTest && typeof preparedOptions.backoff === 'object') {

@@ -177,3 +180,4 @@ preparedOptions.backoff.delay = 1;

try {
this.newRelicBackgroundTransactionManager.start(job.name);
const transactionName = `bg_job:${this.config.ownerName}:${this.config.queueId}`;
this.transactionObservabilityManager.start(transactionName, jobId);
job.requestContext.logger.info({

@@ -190,3 +194,3 @@ origin: this.constructor.name,

job.requestContext.logger.info({ isSuccess, jobId }, `Finished job ${job.name}`);
this.newRelicBackgroundTransactionManager.stop(job.name);
this.transactionObservabilityManager.stop(jobId);
}

@@ -193,0 +197,0 @@ }

@@ -11,3 +11,7 @@ "use strict";

redis: dependencies.redis,
transactionObservabilityManager: { start: () => { }, stop: () => { } },
transactionObservabilityManager: {
start: () => { },
startWithGroup: () => { },
stop: () => { },
},
logger: dependencies.logger,

@@ -18,2 +22,3 @@ errorReporter: dependencies.errorReporter,

queueId: queueName,
ownerName: 'testOwner',
isTest,

@@ -20,0 +25,0 @@ workerOptions: { concurrency: 1 },

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

import type { CommonLogger, ErrorReporter } from '@lokalise/node-core';
import type { CommonLogger, ErrorReporter, TransactionObservabilityManager } from '@lokalise/node-core';
import type { Job, FinishedStatus, Queue, QueueOptions, Worker, WorkerOptions, JobsOptions } from 'bullmq';

@@ -10,9 +10,7 @@ import type Redis from 'ioredis';

isTest: boolean;
ownerName: string;
queueOptions?: Partial<QueueOptionsType>;
workerOptions: Partial<WorkerOptionsType>;
};
export type TransactionObservabilityManager = {
start: (transactionSpanId: string) => unknown;
stop: (transactionSpanId: string) => unknown;
};
export { TransactionObservabilityManager };
export type SafeJob<T = any, R = any, N extends string = string> = Omit<Job<T, R, N>, 'scripts'> & {

@@ -19,0 +17,0 @@ requestContext?: RequestContext;

{
"name": "@lokalise/background-jobs-common",
"version": "2.0.6",
"version": "3.0.0",
"files": [

@@ -38,4 +38,4 @@ "dist",

"@lokalise/id-utils": "1.0.0",
"@lokalise/node-core": "^9.16.0",
"pino": "^8.21.0",
"@lokalise/node-core": "^9.17.0",
"pino": "^9.0.0",
"ts-deepmerge": "^7.0.0"

@@ -49,3 +49,3 @@ },

"@lokalise/eslint-config": "latest",
"@lokalise/fastify-extras": "^17.0.3",
"@lokalise/fastify-extras": "^20.0.0",
"@lokalise/prettier-config": "latest",

@@ -59,5 +59,5 @@ "@lokalise/package-vite-config": "latest",

"typescript": "5.4.5",
"vitest": "^1.5.0"
"vitest": "^1.5.2"
},
"prettier": "@lokalise/prettier-config"
}
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