@quanticjs/redis 2.0.0 → 3.0.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.
@@ -1,9 +1,7 @@
1
- import { Result, PipelineBehavior, PipelineScope } from '@quanticjs/core';
1
+ import { Result, PipelineBehavior } from '@quanticjs/core';
2
2
  import type { Redis } from 'ioredis';
3
3
  export declare class CacheBehavior implements PipelineBehavior {
4
4
  private readonly redis?;
5
- readonly order: 60;
6
- readonly scope: PipelineScope;
7
5
  private readonly logger;
8
6
  constructor(redis?: Redis | undefined);
9
7
  execute<T>(command: object, next: () => Promise<Result<T>>): Promise<Result<T>>;
@@ -18,8 +18,6 @@ const common_1 = require("@nestjs/common");
18
18
  const core_1 = require("@quanticjs/core");
19
19
  let CacheBehavior = CacheBehavior_1 = class CacheBehavior {
20
20
  redis;
21
- order = core_1.BehaviorOrder.CACHE;
22
- scope = 'both';
23
21
  logger = new common_1.Logger(CacheBehavior_1.name);
24
22
  constructor(redis) {
25
23
  this.redis = redis;
@@ -62,6 +60,7 @@ let CacheBehavior = CacheBehavior_1 = class CacheBehavior {
62
60
  exports.CacheBehavior = CacheBehavior;
63
61
  exports.CacheBehavior = CacheBehavior = CacheBehavior_1 = __decorate([
64
62
  (0, common_1.Injectable)(),
63
+ (0, core_1.Behavior)({ order: core_1.BehaviorOrder.CACHE, scope: 'both' }),
65
64
  __param(0, (0, common_1.Optional)()),
66
65
  __param(0, (0, common_1.Inject)(core_1.REDIS_CLIENT)),
67
66
  __metadata("design:paramtypes", [Function])
@@ -1,9 +1,7 @@
1
- import { Result, PipelineBehavior, PipelineScope } from '@quanticjs/core';
1
+ import { Result, PipelineBehavior } from '@quanticjs/core';
2
2
  import type { Redis } from 'ioredis';
3
3
  export declare class DistributedLockBehavior implements PipelineBehavior {
4
4
  private readonly redis?;
5
- readonly order: 70;
6
- readonly scope: PipelineScope;
7
5
  private readonly logger;
8
6
  constructor(redis?: Redis | undefined);
9
7
  execute<T>(command: object, next: () => Promise<Result<T>>): Promise<Result<T>>;
@@ -19,8 +19,6 @@ const core_1 = require("@quanticjs/core");
19
19
  const uuid_1 = require("uuid");
20
20
  let DistributedLockBehavior = DistributedLockBehavior_1 = class DistributedLockBehavior {
21
21
  redis;
22
- order = core_1.BehaviorOrder.DISTRIBUTED_LOCK;
23
- scope = 'command';
24
22
  logger = new common_1.Logger(DistributedLockBehavior_1.name);
25
23
  constructor(redis) {
26
24
  this.redis = redis;
@@ -83,6 +81,7 @@ let DistributedLockBehavior = DistributedLockBehavior_1 = class DistributedLockB
83
81
  exports.DistributedLockBehavior = DistributedLockBehavior;
84
82
  exports.DistributedLockBehavior = DistributedLockBehavior = DistributedLockBehavior_1 = __decorate([
85
83
  (0, common_1.Injectable)(),
84
+ (0, core_1.Behavior)({ order: core_1.BehaviorOrder.DISTRIBUTED_LOCK, scope: 'command' }),
86
85
  __param(0, (0, common_1.Optional)()),
87
86
  __param(0, (0, common_1.Inject)(core_1.REDIS_CLIENT)),
88
87
  __metadata("design:paramtypes", [Function])
@@ -1,9 +1,7 @@
1
- import { Result, PipelineBehavior, PipelineScope } from '@quanticjs/core';
1
+ import { Result, PipelineBehavior } from '@quanticjs/core';
2
2
  import type { Redis } from 'ioredis';
3
3
  export declare class InvalidateCacheBehavior implements PipelineBehavior {
4
4
  private readonly redis?;
5
- readonly order: 5;
6
- readonly scope: PipelineScope;
7
5
  private readonly logger;
8
6
  constructor(redis?: Redis | undefined);
9
7
  execute<T>(command: object, next: () => Promise<Result<T>>): Promise<Result<T>>;
@@ -18,8 +18,6 @@ const common_1 = require("@nestjs/common");
18
18
  const core_1 = require("@quanticjs/core");
19
19
  let InvalidateCacheBehavior = InvalidateCacheBehavior_1 = class InvalidateCacheBehavior {
20
20
  redis;
21
- order = core_1.BehaviorOrder.INVALIDATE_CACHE;
22
- scope = 'command';
23
21
  logger = new common_1.Logger(InvalidateCacheBehavior_1.name);
24
22
  constructor(redis) {
25
23
  this.redis = redis;
@@ -56,6 +54,7 @@ let InvalidateCacheBehavior = InvalidateCacheBehavior_1 = class InvalidateCacheB
56
54
  exports.InvalidateCacheBehavior = InvalidateCacheBehavior;
57
55
  exports.InvalidateCacheBehavior = InvalidateCacheBehavior = InvalidateCacheBehavior_1 = __decorate([
58
56
  (0, common_1.Injectable)(),
57
+ (0, core_1.Behavior)({ order: core_1.BehaviorOrder.INVALIDATE_CACHE, scope: 'command' }),
59
58
  __param(0, (0, common_1.Optional)()),
60
59
  __param(0, (0, common_1.Inject)(core_1.REDIS_CLIENT)),
61
60
  __metadata("design:paramtypes", [Function])
@@ -9,7 +9,6 @@ var QuanticRedisModule_1;
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.QuanticRedisModule = void 0;
11
11
  const common_1 = require("@nestjs/common");
12
- const core_1 = require("@quanticjs/core");
13
12
  const redis_module_1 = require("./redis.module");
14
13
  const CacheBehavior_1 = require("./CacheBehavior");
15
14
  const InvalidateCacheBehavior_1 = require("./InvalidateCacheBehavior");
@@ -21,11 +20,8 @@ let QuanticRedisModule = QuanticRedisModule_1 = class QuanticRedisModule {
21
20
  imports: [redis_module_1.RedisModule.forRoot(options)],
22
21
  providers: [
23
22
  CacheBehavior_1.CacheBehavior,
24
- { provide: core_1.PIPELINE_BEHAVIOR, useExisting: CacheBehavior_1.CacheBehavior, multi: true },
25
23
  InvalidateCacheBehavior_1.InvalidateCacheBehavior,
26
- { provide: core_1.PIPELINE_BEHAVIOR, useExisting: InvalidateCacheBehavior_1.InvalidateCacheBehavior, multi: true },
27
24
  DistributedLockBehavior_1.DistributedLockBehavior,
28
- { provide: core_1.PIPELINE_BEHAVIOR, useExisting: DistributedLockBehavior_1.DistributedLockBehavior, multi: true },
29
25
  ],
30
26
  exports: [
31
27
  redis_module_1.RedisModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quanticjs/redis",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Redis integration for quanticjs — cache, invalidation, distributed locks",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "clean": "rm -rf dist"
19
19
  },
20
20
  "dependencies": {
21
- "@quanticjs/core": "^2.0.0",
21
+ "@quanticjs/core": "^3.0.0",
22
22
  "uuid": "^11.1.0"
23
23
  },
24
24
  "peerDependencies": {