@rvoh/psychic-workers 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,6 +207,7 @@ export class Background {
207
207
  for (let i = 0; i < workerCount; i++) {
208
208
  this._workers.push(new Background.Worker(formattedQueueName, async (job) => await this.doWork(job), {
209
209
  autorun: !EnvInternal.isTest,
210
+ ...backgroundOptions.defaultBullMQWorkerOptions,
210
211
  connection: defaultWorkerConnection,
211
212
  concurrency: backgroundOptions.defaultWorkstream?.concurrency || DEFAULT_CONCURRENCY,
212
213
  }));
@@ -251,6 +252,7 @@ export class Background {
251
252
  for (let i = 0; i < workerCount; i++) {
252
253
  this._workers.push(new Background.Worker(namedWorkstreamFormattedQueueName, async (job) => await this.doWork(job), {
253
254
  autorun: !EnvInternal.isTest,
255
+ ...backgroundOptions.defaultBullMQWorkerOptions,
254
256
  group: {
255
257
  id: namedWorkstream.name,
256
258
  limit: namedWorkstream.rateLimit,
@@ -298,7 +300,7 @@ export class Background {
298
300
  //////////////////////////
299
301
  this.defaultQueue = new Background.Queue(formattedQueueName, {
300
302
  ...defaultBullMQQueueOptions,
301
- ...(nativeBullMQ.defaultQueueOptions || {}),
303
+ ...nativeBullMQ.defaultQueueOptions,
302
304
  connection: defaultQueueConnection,
303
305
  });
304
306
  ///////////////////////////////
@@ -314,7 +316,8 @@ export class Background {
314
316
  for (let i = 0; i < workerCount; i++) {
315
317
  this._workers.push(new Background.Worker(formattedQueueName, async (job) => await this.doWork(job), {
316
318
  autorun: !EnvInternal.isTest,
317
- ...(backgroundOptions.nativeBullMQ.defaultWorkerOptions || {}),
319
+ ...backgroundOptions.defaultBullMQWorkerOptions,
320
+ ...backgroundOptions.nativeBullMQ.defaultWorkerOptions,
318
321
  connection: defaultWorkerConnection,
319
322
  }));
320
323
  }
@@ -357,6 +360,7 @@ export class Background {
357
360
  for (let i = 0; i < extraWorkerCount; i++) {
358
361
  this._workers.push(new Background.Worker(formattedQueuename, async (job) => await this.doWork(job), {
359
362
  autorun: !EnvInternal.isTest,
363
+ ...backgroundOptions.defaultBullMQWorkerOptions,
360
364
  ...extraWorkerOptions,
361
365
  connection: namedWorkerConnection,
362
366
  }));
@@ -207,6 +207,7 @@ export class Background {
207
207
  for (let i = 0; i < workerCount; i++) {
208
208
  this._workers.push(new Background.Worker(formattedQueueName, async (job) => await this.doWork(job), {
209
209
  autorun: !EnvInternal.isTest,
210
+ ...backgroundOptions.defaultBullMQWorkerOptions,
210
211
  connection: defaultWorkerConnection,
211
212
  concurrency: backgroundOptions.defaultWorkstream?.concurrency || DEFAULT_CONCURRENCY,
212
213
  }));
@@ -251,6 +252,7 @@ export class Background {
251
252
  for (let i = 0; i < workerCount; i++) {
252
253
  this._workers.push(new Background.Worker(namedWorkstreamFormattedQueueName, async (job) => await this.doWork(job), {
253
254
  autorun: !EnvInternal.isTest,
255
+ ...backgroundOptions.defaultBullMQWorkerOptions,
254
256
  group: {
255
257
  id: namedWorkstream.name,
256
258
  limit: namedWorkstream.rateLimit,
@@ -298,7 +300,7 @@ export class Background {
298
300
  //////////////////////////
299
301
  this.defaultQueue = new Background.Queue(formattedQueueName, {
300
302
  ...defaultBullMQQueueOptions,
301
- ...(nativeBullMQ.defaultQueueOptions || {}),
303
+ ...nativeBullMQ.defaultQueueOptions,
302
304
  connection: defaultQueueConnection,
303
305
  });
304
306
  ///////////////////////////////
@@ -314,7 +316,8 @@ export class Background {
314
316
  for (let i = 0; i < workerCount; i++) {
315
317
  this._workers.push(new Background.Worker(formattedQueueName, async (job) => await this.doWork(job), {
316
318
  autorun: !EnvInternal.isTest,
317
- ...(backgroundOptions.nativeBullMQ.defaultWorkerOptions || {}),
319
+ ...backgroundOptions.defaultBullMQWorkerOptions,
320
+ ...backgroundOptions.nativeBullMQ.defaultWorkerOptions,
318
321
  connection: defaultWorkerConnection,
319
322
  }));
320
323
  }
@@ -357,6 +360,7 @@ export class Background {
357
360
  for (let i = 0; i < extraWorkerCount; i++) {
358
361
  this._workers.push(new Background.Worker(formattedQueuename, async (job) => await this.doWork(job), {
359
362
  autorun: !EnvInternal.isTest,
363
+ ...backgroundOptions.defaultBullMQWorkerOptions,
360
364
  ...extraWorkerOptions,
361
365
  connection: namedWorkerConnection,
362
366
  }));
@@ -117,6 +117,7 @@ interface PsychicBackgroundSharedOptions {
117
117
  Worker: any;
118
118
  };
119
119
  defaultBullMQQueueOptions?: Omit<QueueOptions, 'connection'>;
120
+ defaultBullMQWorkerOptions?: Omit<WorkerOptions, 'connection'>;
120
121
  }
121
122
  export type QueueOptionsWithConnectionInstance = Omit<QueueOptions, 'connection'> & {
122
123
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@rvoh/psychic-workers",
4
4
  "description": "Background job system for Psychic applications",
5
- "version": "2.1.0",
5
+ "version": "2.2.0",
6
6
  "author": "RVO Health",
7
7
  "repository": {
8
8
  "type": "git",
@@ -38,17 +38,17 @@
38
38
  "dist/**/*"
39
39
  ],
40
40
  "scripts": {
41
- "psy": "NODE_ENV=${NODE_ENV:-test} yarn psy:ts",
41
+ "psy": "NODE_ENV=${NODE_ENV:-test} pnpm psy:ts",
42
42
  "psy:js": "node ./dist/test-app/src/cli/index.js",
43
43
  "psy:ts": "tsx ./test-app/src/cli/index.ts",
44
44
  "build": "echo \"building cjs...\" && rm -rf dist && npx tsc -p ./tsconfig.cjs.build.json && echo \"building esm...\" && npx tsc -p ./tsconfig.esm.build.json",
45
45
  "build:test-app": "rm -rf dist && echo \"building test app to esm...\" && npx tsc -p ./tsconfig.esm.build.test-app.json && echo \"building test app to cjs...\" && npx tsc -p ./tsconfig.cjs.build.test-app.json",
46
46
  "uspec": "vitest --config ./spec/unit/vite.config.ts",
47
- "format": "yarn run prettier . --write",
48
- "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" && yarn run prettier . --check",
47
+ "format": "pnpm prettier . --write",
48
+ "lint": "pnpm eslint --no-warn-ignored \"src/**/*.ts\" && pnpm prettier . --check",
49
49
  "console": "tsx ./src/conf/repl.ts",
50
50
  "console:js": "node ./dist/src/conf/repl.js",
51
- "prepack": "yarn build",
51
+ "prepack": "pnpm build",
52
52
  "dev-worker": "NODE_ENV=development WORKER_COUNT=1 tsx ./test-app/worker.ts"
53
53
  },
54
54
  "peerDependencies": {
@@ -58,23 +58,24 @@
58
58
  "ioredis": "^5.8.2"
59
59
  },
60
60
  "devDependencies": {
61
- "@eslint/js": "=9.0.0",
61
+ "@eslint/js": "^9.0.0",
62
62
  "@rvoh/dream": "^2.0.1",
63
63
  "@rvoh/dream-spec-helpers": "^2.0.0",
64
64
  "@rvoh/psychic": "^2.0.1",
65
65
  "@rvoh/psychic-spec-helpers": "^1.1.3",
66
66
  "@socket.io/redis-adapter": "^8.3.0",
67
67
  "@socket.io/redis-emitter": "^5.1.0",
68
- "@types/express": "^4",
69
- "@types/node": "^22.5.1",
68
+ "@types/express": "^5.0.6",
69
+ "@types/node": "^22.12.0",
70
70
  "@types/pg": "^8",
71
71
  "@types/supertest": "^6.0.3",
72
+ "@typescript-eslint/parser": "^8.48.1",
72
73
  "bullmq": "^5.64.0",
73
- "eslint": "^9.9.1",
74
- "express": "^4.21.2",
74
+ "eslint": "^9.39.1",
75
+ "express": "^5.2.1",
75
76
  "ioredis": "^5.8.2",
76
77
  "kysely": "^0.28.7",
77
- "kysely-codegen": "^0.17.0",
78
+ "kysely-codegen": "^0.19.0",
78
79
  "luxon-jest-matchers": "^0.1.14",
79
80
  "openapi-typescript": "^7.9.1",
80
81
  "pg": "^8.13.1",
@@ -86,8 +87,13 @@
86
87
  "tsx": "^4.20.6",
87
88
  "typedoc": "^0.28.15",
88
89
  "typescript": "^5.8.2",
89
- "typescript-eslint": "=7.18.0",
90
+ "typescript-eslint": "^8.48.1",
90
91
  "vitest": "^4.0.10"
91
92
  },
92
- "packageManager": "yarn@4.7.0"
93
+ "packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a",
94
+ "dependencies": {
95
+ "commander": "^14.0.2",
96
+ "dotenv": "^17.2.3",
97
+ "pluralize-esm": "^9.0.5"
98
+ }
93
99
  }