@vendure/job-queue-plugin 2.0.0-next.1 → 2.0.0-next.10

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.
@@ -1,5 +1,3 @@
1
- import { HealthCheckRegistryService } from '@vendure/core';
2
- import { RedisHealthIndicator } from './redis-health-indicator';
3
1
  import { BullMQPluginOptions } from './types';
4
2
  /**
5
3
  * @description
@@ -92,13 +90,10 @@ import { BullMQPluginOptions } from './types';
92
90
  * @docsCategory job-queue-plugin
93
91
  */
94
92
  export declare class BullMQJobQueuePlugin {
95
- private registry;
96
- private redis;
97
93
  static options: BullMQPluginOptions;
98
94
  /**
99
95
  * @description
100
96
  * Configures the plugin.
101
97
  */
102
98
  static init(options: BullMQPluginOptions): typeof BullMQJobQueuePlugin;
103
- constructor(registry: HealthCheckRegistryService, redis: RedisHealthIndicator);
104
99
  }
@@ -5,15 +5,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
8
  var BullMQJobQueuePlugin_1;
12
9
  Object.defineProperty(exports, "__esModule", { value: true });
13
10
  exports.BullMQJobQueuePlugin = void 0;
14
11
  const core_1 = require("@vendure/core");
15
12
  const bullmq_job_queue_strategy_1 = require("./bullmq-job-queue-strategy");
16
13
  const constants_1 = require("./constants");
14
+ const redis_health_check_strategy_1 = require("./redis-health-check-strategy");
17
15
  const redis_health_indicator_1 = require("./redis-health-indicator");
18
16
  const redis_job_buffer_storage_strategy_1 = require("./redis-job-buffer-storage-strategy");
19
17
  /**
@@ -107,11 +105,6 @@ const redis_job_buffer_storage_strategy_1 = require("./redis-job-buffer-storage-
107
105
  * @docsCategory job-queue-plugin
108
106
  */
109
107
  let BullMQJobQueuePlugin = BullMQJobQueuePlugin_1 = class BullMQJobQueuePlugin {
110
- constructor(registry, redis) {
111
- this.registry = registry;
112
- this.redis = redis;
113
- registry.registerIndicatorFunction(() => this.redis.isHealthy('redis (job queue)'));
114
- }
115
108
  /**
116
109
  * @description
117
110
  * Configures the plugin.
@@ -127,14 +120,14 @@ BullMQJobQueuePlugin = BullMQJobQueuePlugin_1 = __decorate([
127
120
  configuration: config => {
128
121
  config.jobQueueOptions.jobQueueStrategy = new bullmq_job_queue_strategy_1.BullMQJobQueueStrategy();
129
122
  config.jobQueueOptions.jobBufferStorageStrategy = new redis_job_buffer_storage_strategy_1.RedisJobBufferStorageStrategy();
123
+ config.systemOptions.healthChecks.push(new redis_health_check_strategy_1.RedisHealthCheckStrategy());
130
124
  return config;
131
125
  },
132
126
  providers: [
133
127
  { provide: constants_1.BULLMQ_PLUGIN_OPTIONS, useFactory: () => BullMQJobQueuePlugin_1.options },
134
128
  redis_health_indicator_1.RedisHealthIndicator,
135
129
  ],
136
- }),
137
- __metadata("design:paramtypes", [core_1.HealthCheckRegistryService, redis_health_indicator_1.RedisHealthIndicator])
130
+ })
138
131
  ], BullMQJobQueuePlugin);
139
132
  exports.BullMQJobQueuePlugin = BullMQJobQueuePlugin;
140
133
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/bullmq/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,wCAA8F;AAE9F,2EAAqE;AACrE,2CAAoD;AACpD,qEAAgE;AAChE,2FAAoF;AAGpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAaH,IAAa,oBAAoB,4BAAjC,MAAa,oBAAoB;IAY7B,YAAoB,QAAoC,EAAU,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B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAXY,oBAAoB;IAbhC,IAAA,oBAAa,EAAC;QACX,OAAO,EAAE,CAAC,yBAAkB,CAAC;QAC7B,aAAa,EAAE,MAAM,CAAC,EAAE;YACpB,MAAM,CAAC,eAAe,CAAC,gBAAgB,GAAG,IAAI,kDAAsB,EAAE,CAAC;YACvE,MAAM,CAAC,eAAe,CAAC,wBAAwB,GAAG,IAAI,iEAA6B,EAAE,CAAC;YACtF,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,sDAAwB,EAAE,CAAC,CAAC;YACvE,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,SAAS,EAAE;YACP,EAAE,OAAO,EAAE,iCAAqB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,sBAAoB,CAAC,OAAO,EAAE;YAClF,6CAAoB;SACvB;KACJ,CAAC;GACW,oBAAoB,CAWhC;AAXY,oDAAoB"}
@@ -0,0 +1,6 @@
1
+ import { HealthIndicatorFunction } from '@nestjs/terminus';
2
+ import { HealthCheckStrategy, Injector } from '@vendure/core';
3
+ export declare class RedisHealthCheckStrategy implements HealthCheckStrategy {
4
+ init(injector: Injector): void;
5
+ getHealthIndicator(): HealthIndicatorFunction;
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RedisHealthCheckStrategy = void 0;
4
+ const redis_health_indicator_1 = require("./redis-health-indicator");
5
+ let indicator;
6
+ class RedisHealthCheckStrategy {
7
+ init(injector) {
8
+ indicator = injector.get(redis_health_indicator_1.RedisHealthIndicator);
9
+ }
10
+ getHealthIndicator() {
11
+ return () => indicator.isHealthy('redis (job queue)');
12
+ }
13
+ }
14
+ exports.RedisHealthCheckStrategy = RedisHealthCheckStrategy;
15
+ //# sourceMappingURL=redis-health-check-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis-health-check-strategy.js","sourceRoot":"","sources":["../../src/bullmq/redis-health-check-strategy.ts"],"names":[],"mappings":";;;AAGA,qEAAgE;AAEhE,IAAI,SAA+B,CAAC;AAEpC,MAAa,wBAAwB;IACjC,IAAI,CAAC,QAAkB;QACnB,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,6CAAoB,CAAC,CAAC;IACnD,CAAC;IACD,kBAAkB;QACd,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC1D,CAAC;CACJ;AAPD,4DAOC"}
@@ -62,7 +62,7 @@ let RedisHealthIndicator = class RedisHealthIndicator extends terminus_1.HealthI
62
62
  core_1.Logger.error(`Redis health check error closing connection: ${e.message}`, constants_1.loggerCtx, e.stack);
63
63
  }
64
64
  const result = this.getStatus(key, pingResult === 'PONG');
65
- if (pingResult) {
65
+ if (pingResult === 'PONG') {
66
66
  return result;
67
67
  }
68
68
  throw new terminus_1.HealthCheckError('Redis failed', result);
@@ -1 +1 @@
1
- {"version":3,"file":"redis-health-indicator.js","sourceRoot":"","sources":["../../src/bullmq/redis-health-indicator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,+CAA4F;AAC5F,wCAAuC;AACvC,mCAAyC;AAGzC,2CAA+D;AAI/D,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,0BAAe;IAErD,YAAmD,OAA4B;QAC3E,KAAK,EAAE,CAAC;QADuC,YAAO,GAAP,OAAO,CAAqB;IAE/E,CAAC;IACD,KAAK,CAAC,SAAS,CAAC,GAAW,EAAE,SAAS,GAAG,IAAI;QACzC,MAAM,UAAU,GAAG,IAAI,wBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3D,IA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,IAAA,mBAAU,GAAE;IAGI,WAAA,IAAA,eAAM,EAAC,iCAAqB,CAAC,CAAA;;GAFjC,oBAAoB,CAmDhC;AAnDY,oDAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendure/job-queue-plugin",
3
- "version": "2.0.0-next.1",
3
+ "version": "2.0.0-next.10",
4
4
  "license": "MIT",
5
5
  "main": "package/index.js",
6
6
  "types": "package/index.d.ts",
@@ -24,11 +24,12 @@
24
24
  "devDependencies": {
25
25
  "@google-cloud/pubsub": "^2.8.0",
26
26
  "@types/ioredis": "^4.28.8",
27
- "@vendure/common": "^2.0.0-next.1",
28
- "@vendure/core": "^2.0.0-next.1",
27
+ "@vendure/common": "^2.0.0-next.10",
28
+ "@vendure/core": "^2.0.0-next.10",
29
29
  "bullmq": "^1.74.3",
30
+ "redis": "^3.0.2",
30
31
  "rimraf": "^3.0.2",
31
32
  "typescript": "4.5.5"
32
33
  },
33
- "gitHead": "b4c89c2f48b93b2e1ae6ebf43ba5cc12cb7f4588"
34
+ "gitHead": "73604e37177100cbf756112f7448aafba8f413d8"
34
35
  }