@rvoh/psychic-workers 0.2.8 → 0.3.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.
@@ -9,7 +9,7 @@ const ioredis_1 = require("ioredis");
9
9
  const NoQueueForSpecifiedQueueName_js_1 = require("../error/background/NoQueueForSpecifiedQueueName.js");
10
10
  const NoQueueForSpecifiedWorkstream_js_1 = require("../error/background/NoQueueForSpecifiedWorkstream.js");
11
11
  const EnvInternal_js_1 = require("../helpers/EnvInternal.js");
12
- const index_js_1 = require("../psychic-application-workers/index.js");
12
+ const index_js_1 = require("../psychic-app-workers/index.js");
13
13
  class DefaultBullMQNativeOptionsMissingQueueConnectionAndDefaultQueueConnection extends Error {
14
14
  get message() {
15
15
  return `
@@ -273,7 +273,7 @@ class Background {
273
273
  throw new ActivatingBackgroundWorkersWithoutDefaultWorkerConnection();
274
274
  const workerCount = nativeBullMQ.defaultWorkerCount ?? 1;
275
275
  for (let i = 0; i < workerCount; i++) {
276
- this._workers.push(new Background.Worker(formattedQueueName, job => this.doWork(job), {
276
+ this._workers.push(new Background.Worker(formattedQueueName, async (job) => await this.doWork(job), {
277
277
  ...(backgroundOptions.nativeBullMQ.defaultWorkerOptions || {}),
278
278
  connection: defaultWorkerConnection,
279
279
  }));
@@ -315,7 +315,7 @@ class Background {
315
315
  if (!namedWorkerConnection)
316
316
  throw new ActivatingNamedQueueBackgroundWorkersWithoutWorkerConnection(queueName);
317
317
  for (let i = 0; i < extraWorkerCount; i++) {
318
- this._workers.push(new Background.Worker(formattedQueuename, job => this.doWork(job), {
318
+ this._workers.push(new Background.Worker(formattedQueuename, async (job) => await this.doWork(job), {
319
319
  ...extraWorkerOptions,
320
320
  connection: namedWorkerConnection,
321
321
  }));
@@ -493,7 +493,7 @@ class Background {
493
493
  case 'BackgroundJobQueueStaticJob':
494
494
  if (globalName) {
495
495
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
496
- objectClass = psychic_1.PsychicApplication.lookupClassByGlobalName(globalName);
496
+ objectClass = psychic_1.PsychicApp.lookupClassByGlobalName(globalName);
497
497
  }
498
498
  if (!objectClass)
499
499
  return;
@@ -502,7 +502,7 @@ class Background {
502
502
  break;
503
503
  case 'BackgroundJobQueueModelInstanceJob':
504
504
  if (globalName) {
505
- dreamClass = psychic_1.PsychicApplication.lookupClassByGlobalName(globalName);
505
+ dreamClass = psychic_1.PsychicApp.lookupClassByGlobalName(globalName);
506
506
  }
507
507
  if (dreamClass) {
508
508
  const modelInstance = await dreamClass.connection('primary').find(id);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoQueueForSpecifiedWorkstream = exports.NoQueueForSpecifiedQueueName = exports.PsychicApplicationWorkers = exports.BaseScheduledService = exports.BaseBackgroundedService = exports.BaseBackgroundedModel = exports.stopBackgroundWorkers = exports.Background = exports.background = void 0;
3
+ exports.NoQueueForSpecifiedWorkstream = exports.NoQueueForSpecifiedQueueName = exports.PsychicAppWorkers = exports.BaseScheduledService = exports.BaseBackgroundedService = exports.BaseBackgroundedModel = exports.stopBackgroundWorkers = exports.Background = exports.background = void 0;
4
4
  var index_js_1 = require("./background/index.js");
5
5
  Object.defineProperty(exports, "background", { enumerable: true, get: function () { return index_js_1.default; } });
6
6
  Object.defineProperty(exports, "Background", { enumerable: true, get: function () { return index_js_1.Background; } });
@@ -11,8 +11,8 @@ var BaseBackgroundedService_js_1 = require("./background/BaseBackgroundedService
11
11
  Object.defineProperty(exports, "BaseBackgroundedService", { enumerable: true, get: function () { return BaseBackgroundedService_js_1.default; } });
12
12
  var BaseScheduledService_js_1 = require("./background/BaseScheduledService.js");
13
13
  Object.defineProperty(exports, "BaseScheduledService", { enumerable: true, get: function () { return BaseScheduledService_js_1.default; } });
14
- var index_js_2 = require("./psychic-application-workers/index.js");
15
- Object.defineProperty(exports, "PsychicApplicationWorkers", { enumerable: true, get: function () { return index_js_2.default; } });
14
+ var index_js_2 = require("./psychic-app-workers/index.js");
15
+ Object.defineProperty(exports, "PsychicAppWorkers", { enumerable: true, get: function () { return index_js_2.default; } });
16
16
  var NoQueueForSpecifiedQueueName_js_1 = require("./error/background/NoQueueForSpecifiedQueueName.js");
17
17
  Object.defineProperty(exports, "NoQueueForSpecifiedQueueName", { enumerable: true, get: function () { return NoQueueForSpecifiedQueueName_js_1.default; } });
18
18
  var NoQueueForSpecifiedWorkstream_js_1 = require("./error/background/NoQueueForSpecifiedWorkstream.js");
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cachePsychicWorkersApp = cachePsychicWorkersApp;
4
+ exports.getCachedPsychicWorkersApp = getCachedPsychicWorkersApp;
5
+ exports.getCachedPsychicWorkersAppOrFail = getCachedPsychicWorkersAppOrFail;
6
+ let _psychicWorkersApp = undefined;
7
+ function cachePsychicWorkersApp(psychicWorkersApp) {
8
+ _psychicWorkersApp = psychicWorkersApp;
9
+ }
10
+ function getCachedPsychicWorkersApp() {
11
+ return _psychicWorkersApp;
12
+ }
13
+ function getCachedPsychicWorkersAppOrFail() {
14
+ if (!_psychicWorkersApp)
15
+ throw new Error('must call `cachePsychicWorkersApp` before loading cached psychic application workers');
16
+ return _psychicWorkersApp;
17
+ }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const bullmq_1 = require("bullmq");
4
4
  const index_js_1 = require("../background/index.js");
5
5
  const cache_js_1 = require("./cache.js");
6
- class PsychicApplicationWorkers {
6
+ class PsychicAppWorkers {
7
7
  static async init(psychicApp, cb) {
8
- const psychicWorkersApp = new PsychicApplicationWorkers(psychicApp);
8
+ const psychicWorkersApp = new PsychicAppWorkers(psychicApp);
9
9
  await cb(psychicWorkersApp);
10
10
  psychicApp.on('sync', () => {
11
11
  index_js_1.default.connect();
@@ -18,17 +18,17 @@ class PsychicApplicationWorkers {
18
18
  psychicApp.on('server:shutdown', async () => {
19
19
  await index_js_1.default.closeAllRedisConnections();
20
20
  });
21
- (0, cache_js_1.cachePsychicWorkersApplication)(psychicWorkersApp);
21
+ (0, cache_js_1.cachePsychicWorkersApp)(psychicWorkersApp);
22
22
  return psychicWorkersApp;
23
23
  }
24
24
  /**
25
25
  * Returns the cached psychic application if it has been set.
26
26
  * If it has not been set, an exception is raised.
27
27
  *
28
- * The psychic application can be set by calling PsychicApplication#init
28
+ * The psychic application can be set by calling PsychicApp#init
29
29
  */
30
30
  static getOrFail() {
31
- return (0, cache_js_1.getCachedPsychicWorkersApplicationOrFail)();
31
+ return (0, cache_js_1.getCachedPsychicWorkersAppOrFail)();
32
32
  }
33
33
  psychicApp;
34
34
  constructor(psychicApp) {
@@ -53,7 +53,7 @@ class PsychicApplicationWorkers {
53
53
  this._hooks.workerShutdown.push(cb);
54
54
  break;
55
55
  default:
56
- throw new Error(`unrecognized event provided to PsychicWorkersApplication#on: ${hookEventType}`);
56
+ throw new Error(`unrecognized event provided to PsychicWorkersApp#on: ${hookEventType}`);
57
57
  }
58
58
  }
59
59
  set(option, value) {
@@ -70,8 +70,8 @@ class PsychicApplicationWorkers {
70
70
  };
71
71
  break;
72
72
  default:
73
- throw new Error(`Unhandled option type passed to PsychicWorkersApplication#set: ${option}`);
73
+ throw new Error(`Unhandled option type passed to PsychicWorkersApp#set: ${option}`);
74
74
  }
75
75
  }
76
76
  }
77
- exports.default = PsychicApplicationWorkers;
77
+ exports.default = PsychicAppWorkers;
@@ -1,11 +1,11 @@
1
1
  import { closeAllDbConnections, compact, pascalize } from '@rvoh/dream';
2
- import { PsychicApplication } from '@rvoh/psychic';
2
+ import { PsychicApp } from '@rvoh/psychic';
3
3
  import { Job, Queue, Worker } from 'bullmq';
4
4
  import { Cluster } from 'ioredis';
5
5
  import NoQueueForSpecifiedQueueName from '../error/background/NoQueueForSpecifiedQueueName.js';
6
6
  import NoQueueForSpecifiedWorkstream from '../error/background/NoQueueForSpecifiedWorkstream.js';
7
7
  import EnvInternal from '../helpers/EnvInternal.js';
8
- import PsychicApplicationWorkers from '../psychic-application-workers/index.js';
8
+ import PsychicAppWorkers from '../psychic-app-workers/index.js';
9
9
  class DefaultBullMQNativeOptionsMissingQueueConnectionAndDefaultQueueConnection extends Error {
10
10
  get message() {
11
11
  return `
@@ -51,15 +51,15 @@ For example, it may be omitted on webserver instances, but is required on worker
51
51
  }
52
52
  export class Background {
53
53
  static get defaultQueueName() {
54
- const psychicWorkersApp = PsychicApplicationWorkers.getOrFail();
54
+ const psychicWorkersApp = PsychicAppWorkers.getOrFail();
55
55
  return `${pascalize(psychicWorkersApp.psychicApp.appName)}BackgroundJobQueue`;
56
56
  }
57
57
  static get Worker() {
58
- const psychicWorkersApp = PsychicApplicationWorkers.getOrFail();
58
+ const psychicWorkersApp = PsychicAppWorkers.getOrFail();
59
59
  return (psychicWorkersApp.backgroundOptions.providers?.Worker || Worker);
60
60
  }
61
61
  static get Queue() {
62
- const psychicWorkersApp = PsychicApplicationWorkers.getOrFail();
62
+ const psychicWorkersApp = PsychicAppWorkers.getOrFail();
63
63
  return (psychicWorkersApp.backgroundOptions.providers?.Queue || Queue);
64
64
  }
65
65
  /**
@@ -85,7 +85,7 @@ export class Background {
85
85
  connect({ activateWorkers = false, } = {}) {
86
86
  if (this.defaultQueue)
87
87
  return;
88
- const psychicWorkersApp = PsychicApplicationWorkers.getOrFail();
88
+ const psychicWorkersApp = PsychicAppWorkers.getOrFail();
89
89
  const defaultBullMQQueueOptions = psychicWorkersApp.backgroundOptions.defaultBullMQQueueOptions || {};
90
90
  if (psychicWorkersApp.backgroundOptions.nativeBullMQ) {
91
91
  this.nativeBullMQConnect(defaultBullMQQueueOptions, psychicWorkersApp.backgroundOptions, { activateWorkers });
@@ -111,7 +111,7 @@ export class Background {
111
111
  }
112
112
  async shutdown() {
113
113
  await Promise.all(this._workers.map(worker => worker.close()));
114
- const psychicWorkersApp = PsychicApplicationWorkers.getOrFail();
114
+ const psychicWorkersApp = PsychicAppWorkers.getOrFail();
115
115
  for (const hook of psychicWorkersApp.hooks.workerShutdown) {
116
116
  await hook();
117
117
  }
@@ -269,7 +269,7 @@ export class Background {
269
269
  throw new ActivatingBackgroundWorkersWithoutDefaultWorkerConnection();
270
270
  const workerCount = nativeBullMQ.defaultWorkerCount ?? 1;
271
271
  for (let i = 0; i < workerCount; i++) {
272
- this._workers.push(new Background.Worker(formattedQueueName, job => this.doWork(job), {
272
+ this._workers.push(new Background.Worker(formattedQueueName, async (job) => await this.doWork(job), {
273
273
  ...(backgroundOptions.nativeBullMQ.defaultWorkerOptions || {}),
274
274
  connection: defaultWorkerConnection,
275
275
  }));
@@ -311,7 +311,7 @@ export class Background {
311
311
  if (!namedWorkerConnection)
312
312
  throw new ActivatingNamedQueueBackgroundWorkersWithoutWorkerConnection(queueName);
313
313
  for (let i = 0; i < extraWorkerCount; i++) {
314
- this._workers.push(new Background.Worker(formattedQueuename, job => this.doWork(job), {
314
+ this._workers.push(new Background.Worker(formattedQueuename, async (job) => await this.doWork(job), {
315
315
  ...extraWorkerOptions,
316
316
  connection: namedWorkerConnection,
317
317
  }));
@@ -489,7 +489,7 @@ export class Background {
489
489
  case 'BackgroundJobQueueStaticJob':
490
490
  if (globalName) {
491
491
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
492
- objectClass = PsychicApplication.lookupClassByGlobalName(globalName);
492
+ objectClass = PsychicApp.lookupClassByGlobalName(globalName);
493
493
  }
494
494
  if (!objectClass)
495
495
  return;
@@ -498,7 +498,7 @@ export class Background {
498
498
  break;
499
499
  case 'BackgroundJobQueueModelInstanceJob':
500
500
  if (globalName) {
501
- dreamClass = PsychicApplication.lookupClassByGlobalName(globalName);
501
+ dreamClass = PsychicApp.lookupClassByGlobalName(globalName);
502
502
  }
503
503
  if (dreamClass) {
504
504
  const modelInstance = await dreamClass.connection('primary').find(id);
@@ -2,6 +2,6 @@ export { default as background, Background, stopBackgroundWorkers, } from './bac
2
2
  export { default as BaseBackgroundedModel } from './background/BaseBackgroundedModel.js';
3
3
  export { default as BaseBackgroundedService } from './background/BaseBackgroundedService.js';
4
4
  export { default as BaseScheduledService } from './background/BaseScheduledService.js';
5
- export { default as PsychicApplicationWorkers, } from './psychic-application-workers/index.js';
5
+ export { default as PsychicAppWorkers, } from './psychic-app-workers/index.js';
6
6
  export { default as NoQueueForSpecifiedQueueName } from './error/background/NoQueueForSpecifiedQueueName.js';
7
7
  export { default as NoQueueForSpecifiedWorkstream } from './error/background/NoQueueForSpecifiedWorkstream.js';
@@ -0,0 +1,12 @@
1
+ let _psychicWorkersApp = undefined;
2
+ export function cachePsychicWorkersApp(psychicWorkersApp) {
3
+ _psychicWorkersApp = psychicWorkersApp;
4
+ }
5
+ export function getCachedPsychicWorkersApp() {
6
+ return _psychicWorkersApp;
7
+ }
8
+ export function getCachedPsychicWorkersAppOrFail() {
9
+ if (!_psychicWorkersApp)
10
+ throw new Error('must call `cachePsychicWorkersApp` before loading cached psychic application workers');
11
+ return _psychicWorkersApp;
12
+ }
@@ -1,9 +1,9 @@
1
1
  import { Queue, Worker } from 'bullmq';
2
2
  import background from '../background/index.js';
3
- import { cachePsychicWorkersApplication, getCachedPsychicWorkersApplicationOrFail } from './cache.js';
4
- export default class PsychicApplicationWorkers {
3
+ import { cachePsychicWorkersApp, getCachedPsychicWorkersAppOrFail } from './cache.js';
4
+ export default class PsychicAppWorkers {
5
5
  static async init(psychicApp, cb) {
6
- const psychicWorkersApp = new PsychicApplicationWorkers(psychicApp);
6
+ const psychicWorkersApp = new PsychicAppWorkers(psychicApp);
7
7
  await cb(psychicWorkersApp);
8
8
  psychicApp.on('sync', () => {
9
9
  background.connect();
@@ -16,17 +16,17 @@ export default class PsychicApplicationWorkers {
16
16
  psychicApp.on('server:shutdown', async () => {
17
17
  await background.closeAllRedisConnections();
18
18
  });
19
- cachePsychicWorkersApplication(psychicWorkersApp);
19
+ cachePsychicWorkersApp(psychicWorkersApp);
20
20
  return psychicWorkersApp;
21
21
  }
22
22
  /**
23
23
  * Returns the cached psychic application if it has been set.
24
24
  * If it has not been set, an exception is raised.
25
25
  *
26
- * The psychic application can be set by calling PsychicApplication#init
26
+ * The psychic application can be set by calling PsychicApp#init
27
27
  */
28
28
  static getOrFail() {
29
- return getCachedPsychicWorkersApplicationOrFail();
29
+ return getCachedPsychicWorkersAppOrFail();
30
30
  }
31
31
  psychicApp;
32
32
  constructor(psychicApp) {
@@ -51,7 +51,7 @@ export default class PsychicApplicationWorkers {
51
51
  this._hooks.workerShutdown.push(cb);
52
52
  break;
53
53
  default:
54
- throw new Error(`unrecognized event provided to PsychicWorkersApplication#on: ${hookEventType}`);
54
+ throw new Error(`unrecognized event provided to PsychicWorkersApp#on: ${hookEventType}`);
55
55
  }
56
56
  }
57
57
  set(option, value) {
@@ -68,7 +68,7 @@ export default class PsychicApplicationWorkers {
68
68
  };
69
69
  break;
70
70
  default:
71
- throw new Error(`Unhandled option type passed to PsychicWorkersApplication#set: ${option}`);
71
+ throw new Error(`Unhandled option type passed to PsychicWorkersApp#set: ${option}`);
72
72
  }
73
73
  }
74
74
  }
@@ -1,6 +1,6 @@
1
1
  import { Dream, IdType } from '@rvoh/dream';
2
2
  import { Job, Queue, Worker } from 'bullmq';
3
- import { PsychicBackgroundNativeBullMQOptions, PsychicBackgroundSimpleOptions } from '../psychic-application-workers/index.js';
3
+ import { PsychicBackgroundNativeBullMQOptions, PsychicBackgroundSimpleOptions } from '../psychic-app-workers/index.js';
4
4
  import BaseBackgroundedService from './BaseBackgroundedService.js';
5
5
  import BaseScheduledService from './BaseScheduledService.js';
6
6
  import { Either } from './types.js';
@@ -1,7 +1,7 @@
1
- export { default as background, Background, type BackgroundJobConfig, type BackgroundQueuePriority, stopBackgroundWorkers, } from './background/index.js';
1
+ export { default as background, Background, stopBackgroundWorkers, type BackgroundJobConfig, type BackgroundQueuePriority, } from './background/index.js';
2
2
  export { default as BaseBackgroundedModel } from './background/BaseBackgroundedModel.js';
3
3
  export { default as BaseBackgroundedService } from './background/BaseBackgroundedService.js';
4
4
  export { default as BaseScheduledService } from './background/BaseScheduledService.js';
5
- export { type BullMQNativeWorkerOptions, default as PsychicApplicationWorkers, type PsychicBackgroundNativeBullMQOptions, type PsychicBackgroundSimpleOptions, type PsychicBackgroundWorkstreamOptions, type QueueOptionsWithConnectionInstance, type RedisOrRedisClusterConnection, type TransitionalPsychicBackgroundSimpleOptions, } from './psychic-application-workers/index.js';
5
+ export { default as PsychicAppWorkers, type BullMQNativeWorkerOptions, type PsychicBackgroundNativeBullMQOptions, type PsychicBackgroundSimpleOptions, type PsychicBackgroundWorkstreamOptions, type QueueOptionsWithConnectionInstance, type RedisOrRedisClusterConnection, type TransitionalPsychicBackgroundSimpleOptions, } from './psychic-app-workers/index.js';
6
6
  export { default as NoQueueForSpecifiedQueueName } from './error/background/NoQueueForSpecifiedQueueName.js';
7
7
  export { default as NoQueueForSpecifiedWorkstream } from './error/background/NoQueueForSpecifiedWorkstream.js';
@@ -0,0 +1,4 @@
1
+ import PsychicAppWorkers from './index.js';
2
+ export declare function cachePsychicWorkersApp(psychicWorkersApp: PsychicAppWorkers): void;
3
+ export declare function getCachedPsychicWorkersApp(): PsychicAppWorkers | undefined;
4
+ export declare function getCachedPsychicWorkersAppOrFail(): PsychicAppWorkers;
@@ -1,35 +1,35 @@
1
- import { PsychicApplication } from '@rvoh/psychic';
1
+ import { PsychicApp } from '@rvoh/psychic';
2
2
  import { QueueOptions, WorkerOptions } from 'bullmq';
3
3
  import { Cluster, Redis } from 'ioredis';
4
4
  import { PsychicBackgroundOptions } from '../background/index.js';
5
- export default class PsychicApplicationWorkers {
6
- static init(psychicApp: PsychicApplication, cb: (app: PsychicApplicationWorkers) => void | Promise<void>): Promise<PsychicApplicationWorkers>;
5
+ export default class PsychicAppWorkers {
6
+ static init(psychicApp: PsychicApp, cb: (app: PsychicAppWorkers) => void | Promise<void>): Promise<PsychicAppWorkers>;
7
7
  /**
8
8
  * Returns the cached psychic application if it has been set.
9
9
  * If it has not been set, an exception is raised.
10
10
  *
11
- * The psychic application can be set by calling PsychicApplication#init
11
+ * The psychic application can be set by calling PsychicApp#init
12
12
  */
13
- static getOrFail(): PsychicApplicationWorkers;
14
- psychicApp: PsychicApplication;
15
- constructor(psychicApp: PsychicApplication);
13
+ static getOrFail(): PsychicAppWorkers;
14
+ psychicApp: PsychicApp;
15
+ constructor(psychicApp: PsychicApp);
16
16
  /**
17
17
  * Returns the background options provided by the user
18
18
  */
19
19
  get backgroundOptions(): PsychicBackgroundOptions;
20
20
  private _backgroundOptions;
21
21
  private _hooks;
22
- get hooks(): PsychicWorkersApplicationHooks;
22
+ get hooks(): PsychicWorkersAppHooks;
23
23
  on<T extends PsychicWorkersHookEventType>(hookEventType: T, cb: T extends 'workers:shutdown' ? () => void | Promise<void> : never): void;
24
- set<Opt extends PsychicWorkersApplicationOption>(option: Opt, value: unknown): void;
24
+ set<Opt extends PsychicWorkersAppOption>(option: Opt, value: unknown): void;
25
25
  }
26
26
  export interface PsychicWorkersTypeSync {
27
27
  workstreamNames: string[];
28
28
  queueGroupMap: Record<string, string[]>;
29
29
  }
30
- export type PsychicWorkersApplicationOption = 'background';
30
+ export type PsychicWorkersAppOption = 'background';
31
31
  export type PsychicWorkersHookEventType = 'workers:shutdown';
32
- export interface PsychicWorkersApplicationHooks {
32
+ export interface PsychicWorkersAppHooks {
33
33
  workerShutdown: (() => void | Promise<void>)[];
34
34
  }
35
35
  export interface BullMQNativeWorkerOptions extends WorkerOptions {
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": "0.2.8",
5
+ "version": "0.3.0",
6
6
  "author": "RVO Health",
7
7
  "repository": {
8
8
  "type": "git",
@@ -23,17 +23,17 @@
23
23
  "dist/**/*"
24
24
  ],
25
25
  "scripts": {
26
- "psy": "NODE_ENV=${NODE_ENV:-test} yarn psyts",
27
- "psyjs": "node ./dist/test-app/src/cli/index.js",
28
- "psyts": "node --experimental-specifier-resolution=node --import ./bin/esm.js ./test-app/src/cli/index.ts",
26
+ "psy": "NODE_ENV=${NODE_ENV:-test} yarn psy:ts",
27
+ "psy:js": "node ./dist/test-app/src/cli/index.js",
28
+ "psy:ts": "tsx ./test-app/src/cli/index.ts",
29
29
  "build": "echo \"building cjs...\" && rm -rf dist && npx tsc -p ./tsconfig.cjs.build.json && echo \"building esm...\" && npx tsc -p ./tsconfig.esm.build.json",
30
30
  "uspec": "vitest --config ./spec/unit/vite.config.ts",
31
31
  "format": "yarn run prettier . --write",
32
32
  "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" && yarn run prettier . --check",
33
33
  "console": "tsx ./src/conf/repl.ts",
34
- "consolejs": "node ./dist/src/conf/repl.js",
34
+ "console:js": "node ./dist/src/conf/repl.js",
35
35
  "prepack": "yarn build",
36
- "dev-worker": "NODE_ENV=development WORKER_COUNT=1 ts-node --transpile-only ./test-app/worker.ts"
36
+ "dev-worker": "NODE_ENV=development WORKER_COUNT=1 tsx ./test-app/worker.ts"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@rvoh/dream": "*",
@@ -43,10 +43,10 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@eslint/js": "=9.0.0",
46
- "@rvoh/dream": "^0.33.0",
47
- "@rvoh/dream-spec-helpers": "^0.2.0",
48
- "@rvoh/psychic": "^0.28.0",
49
- "@rvoh/psychic-spec-helpers": "^0.3.0",
46
+ "@rvoh/dream": "^0.39.0",
47
+ "@rvoh/dream-spec-helpers": "^0.2.4",
48
+ "@rvoh/psychic": "^0.31.0",
49
+ "@rvoh/psychic-spec-helpers": "^0.6.0",
50
50
  "@socket.io/redis-adapter": "^8.3.0",
51
51
  "@socket.io/redis-emitter": "^5.1.0",
52
52
  "@types/express": "^4",
@@ -65,8 +65,8 @@
65
65
  "socket.io": "^4.8.1",
66
66
  "socket.io-adapter": "^2.5.5",
67
67
  "supertest": "^7.0.0",
68
- "ts-node": "^10.9.2",
69
68
  "tslib": "^2.7.0",
69
+ "tsx": "^4.19.3",
70
70
  "typedoc": "^0.26.6",
71
71
  "typescript": "^5.8.2",
72
72
  "typescript-eslint": "=7.18.0",
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cachePsychicWorkersApplication = cachePsychicWorkersApplication;
4
- exports.getCachedPsychicWorkersApplication = getCachedPsychicWorkersApplication;
5
- exports.getCachedPsychicWorkersApplicationOrFail = getCachedPsychicWorkersApplicationOrFail;
6
- let _psychicWorkersApp = undefined;
7
- function cachePsychicWorkersApplication(psychicWorkersApp) {
8
- _psychicWorkersApp = psychicWorkersApp;
9
- }
10
- function getCachedPsychicWorkersApplication() {
11
- return _psychicWorkersApp;
12
- }
13
- function getCachedPsychicWorkersApplicationOrFail() {
14
- if (!_psychicWorkersApp)
15
- throw new Error('must call `cachePsychicWorkersApplication` before loading cached psychic application workers');
16
- return _psychicWorkersApp;
17
- }
@@ -1,12 +0,0 @@
1
- let _psychicWorkersApp = undefined;
2
- export function cachePsychicWorkersApplication(psychicWorkersApp) {
3
- _psychicWorkersApp = psychicWorkersApp;
4
- }
5
- export function getCachedPsychicWorkersApplication() {
6
- return _psychicWorkersApp;
7
- }
8
- export function getCachedPsychicWorkersApplicationOrFail() {
9
- if (!_psychicWorkersApp)
10
- throw new Error('must call `cachePsychicWorkersApplication` before loading cached psychic application workers');
11
- return _psychicWorkersApp;
12
- }
@@ -1,4 +0,0 @@
1
- import PsychicApplicationWorkers from './index.js';
2
- export declare function cachePsychicWorkersApplication(psychicWorkersApp: PsychicApplicationWorkers): void;
3
- export declare function getCachedPsychicWorkersApplication(): PsychicApplicationWorkers | undefined;
4
- export declare function getCachedPsychicWorkersApplicationOrFail(): PsychicApplicationWorkers;