@hg-ts/redis 0.1.88 → 0.1.93

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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './redis.module';
2
2
  export * from './redis.client';
3
+ export * from './config';
4
+ export * from './redis.config.module';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -3,4 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./redis.module"), exports);
5
5
  tslib_1.__exportStar(require("./redis.client"), exports);
6
+ tslib_1.__exportStar(require("./config"), exports);
7
+ tslib_1.__exportStar(require("./redis.config.module"), exports);
6
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,yDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,yDAA+B;AAC/B,mDAAyB;AACzB,gEAAsC"}
@@ -1,4 +1,9 @@
1
+ import { DESTROY_HOOK, INIT_HOOK } from '@hg-ts/ioc';
1
2
  import Redis from 'ioredis';
3
+ import { RedisConfig } from './config';
2
4
  export declare class RedisClient extends Redis {
5
+ constructor(config: RedisConfig);
6
+ [INIT_HOOK](): Promise<void>;
7
+ [DESTROY_HOOK](): Promise<void>;
3
8
  }
4
9
  //# sourceMappingURL=redis.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redis.client.d.ts","sourceRoot":"","sources":["../src/redis.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,qBAAa,WAAY,SAAQ,KAAK;CAAG"}
1
+ {"version":3,"file":"redis.client.d.ts","sourceRoot":"","sources":["../src/redis.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,YAAY,EACZ,SAAS,EACT,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,qBACa,WAAY,SAAQ,KAAK;gBAClB,MAAM,EAAE,WAAW;IAUzB,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5C"}
@@ -2,8 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RedisClient = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const ioc_1 = require("@hg-ts/ioc");
5
6
  const ioredis_1 = tslib_1.__importDefault(require("ioredis"));
6
- class RedisClient extends ioredis_1.default {
7
- }
7
+ const config_1 = require("./config");
8
+ let RedisClient = class RedisClient extends ioredis_1.default {
9
+ constructor(config) {
10
+ super({
11
+ host: config.host,
12
+ port: config.port,
13
+ db: config.database,
14
+ enableReadyCheck: true,
15
+ lazyConnect: true,
16
+ });
17
+ }
18
+ async [ioc_1.INIT_HOOK]() {
19
+ await this.connect();
20
+ }
21
+ async [ioc_1.DESTROY_HOOK]() {
22
+ await this.quit();
23
+ }
24
+ };
8
25
  exports.RedisClient = RedisClient;
26
+ exports.RedisClient = RedisClient = tslib_1.__decorate([
27
+ (0, ioc_1.Dependant)(),
28
+ tslib_1.__metadata("design:paramtypes", [config_1.RedisConfig])
29
+ ], RedisClient);
9
30
  //# sourceMappingURL=redis.client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redis.client.js","sourceRoot":"","sources":["../src/redis.client.ts"],"names":[],"mappings":";;;;AAAA,8DAA4B;AAE5B,MAAa,WAAY,SAAQ,iBAAK;CAAG;AAAzC,kCAAyC"}
1
+ {"version":3,"file":"redis.client.js","sourceRoot":"","sources":["../src/redis.client.ts"],"names":[],"mappings":";;;;AAAA,oCAIoB;AACpB,8DAA4B;AAC5B,qCAAuC;AAGhC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,iBAAK;IACrC,YAAmB,MAAmB;QACrC,KAAK,CAAC;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,EAAE,EAAE,MAAM,CAAC,QAAQ;YACnB,gBAAgB,EAAE,IAAI;YACtB,WAAW,EAAE,IAAI;SACjB,CAAC,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,CAAC,eAAS,CAAC;QACvB,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,CAAC,kBAAY,CAAC;QAC1B,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;CACD,CAAA;AAlBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,eAAS,GAAE;6CAEgB,oBAAW;GAD1B,WAAW,CAkBvB"}
@@ -0,0 +1,3 @@
1
+ export declare class RedisConfigModule {
2
+ }
3
+ //# sourceMappingURL=redis.config.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.config.module.d.ts","sourceRoot":"","sources":["../src/redis.config.module.ts"],"names":[],"mappings":"AAQA,qBAYa,iBAAiB;CAAG"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RedisConfigModule = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const config_loader_1 = require("@hg-ts/config-loader");
6
+ const ioc_1 = require("@hg-ts/ioc");
7
+ const config_1 = require("./config");
8
+ let RedisConfigModule = class RedisConfigModule {
9
+ };
10
+ exports.RedisConfigModule = RedisConfigModule;
11
+ exports.RedisConfigModule = RedisConfigModule = tslib_1.__decorate([
12
+ (0, ioc_1.Module)({
13
+ providers: [
14
+ {
15
+ provide: config_1.RedisConfig,
16
+ async useFactory(configLoader) {
17
+ return configLoader.load(config_1.REDIS_CONFIG_SCHEMA, 'redis');
18
+ },
19
+ inject: [config_loader_1.ConfigLoader],
20
+ },
21
+ ],
22
+ exports: [config_1.RedisConfig],
23
+ })
24
+ ], RedisConfigModule);
25
+ //# sourceMappingURL=redis.config.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.config.module.js","sourceRoot":"","sources":["../src/redis.config.module.ts"],"names":[],"mappings":";;;;AAAA,wDAAoD;AACpD,oCAAoC;AAEpC,qCAGkB;AAcX,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAZ7B,IAAA,YAAM,EAAC;QACP,SAAS,EAAE;YACV;gBACC,OAAO,EAAE,oBAAW;gBACpB,KAAK,CAAC,UAAU,CAAC,YAA0B;oBAC1C,OAAO,YAAY,CAAC,IAAI,CAAC,4BAAmB,EAAE,OAAO,CAAC,CAAC;gBACxD,CAAC;gBACD,MAAM,EAAE,CAAC,4BAAY,CAAC;aACtB;SACD;QACD,OAAO,EAAE,CAAC,oBAAW,CAAC;KACtB,CAAC;GACW,iBAAiB,CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"redis.module.d.ts","sourceRoot":"","sources":["../src/redis.module.ts"],"names":[],"mappings":"AASA,qBAuBa,WAAW;CAAG"}
1
+ {"version":3,"file":"redis.module.d.ts","sourceRoot":"","sources":["../src/redis.module.ts"],"names":[],"mappings":"AAOA,qBAMa,WAAW;CAAG"}
@@ -2,33 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RedisModule = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const config_loader_1 = require("@hg-ts/config-loader");
6
5
  const ioc_1 = require("@hg-ts/ioc");
7
- const config_1 = require("./config");
8
6
  const redis_client_1 = require("./redis.client");
7
+ const redis_config_module_1 = require("./redis.config.module");
9
8
  let RedisModule = class RedisModule {
10
9
  };
11
10
  exports.RedisModule = RedisModule;
12
11
  exports.RedisModule = RedisModule = tslib_1.__decorate([
13
12
  (0, ioc_1.Global)(),
14
13
  (0, ioc_1.Module)({
15
- providers: [
16
- {
17
- provide: redis_client_1.RedisClient,
18
- async useFactory(configLoader) {
19
- const config = await configLoader.load(config_1.REDIS_CONFIG_SCHEMA, 'redis');
20
- const redis = new redis_client_1.RedisClient({
21
- host: config.host,
22
- port: config.port,
23
- db: config.database,
24
- enableReadyCheck: true,
25
- });
26
- await redis.connect();
27
- return redis;
28
- },
29
- inject: [config_loader_1.ConfigLoader],
30
- },
31
- ],
14
+ imports: [redis_config_module_1.RedisConfigModule],
15
+ providers: [redis_client_1.RedisClient],
32
16
  exports: [redis_client_1.RedisClient],
33
17
  })
34
18
  ], RedisModule);
@@ -1 +1 @@
1
- {"version":3,"file":"redis.module.js","sourceRoot":"","sources":["../src/redis.module.ts"],"names":[],"mappings":";;;;AAAA,wDAAoD;AACpD,oCAGoB;AAEpB,qCAA+C;AAC/C,iDAA6C;AAyBtC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IAvBvB,IAAA,YAAM,GAAE;IACR,IAAA,YAAM,EAAC;QACP,SAAS,EAAE;YACV;gBACC,OAAO,EAAE,0BAAW;gBACpB,KAAK,CAAC,UAAU,CAAC,YAA0B;oBAC1C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,4BAAmB,EAAE,OAAO,CAAC,CAAC;oBACrE,MAAM,KAAK,GAAG,IAAI,0BAAW,CAAC;wBAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,EAAE,EAAE,MAAM,CAAC,QAAQ;wBACnB,gBAAgB,EAAE,IAAI;qBACtB,CAAC,CAAC;oBAEH,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;oBAEtB,OAAO,KAAK,CAAC;gBACd,CAAC;gBACD,MAAM,EAAE,CAAC,4BAAY,CAAC;aACtB;SACD;QACD,OAAO,EAAE,CAAC,0BAAW,CAAC;KACtB,CAAC;GACW,WAAW,CAAG"}
1
+ {"version":3,"file":"redis.module.js","sourceRoot":"","sources":["../src/redis.module.ts"],"names":[],"mappings":";;;;AAAA,oCAGoB;AACpB,iDAA6C;AAC7C,+DAA0D;AAQnD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IANvB,IAAA,YAAM,GAAE;IACR,IAAA,YAAM,EAAC;QACP,OAAO,EAAE,CAAC,uCAAiB,CAAC;QAC5B,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACtB,CAAC;GACW,WAAW,CAAG"}
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@hg-ts/redis",
3
- "version": "0.1.88",
3
+ "version": "0.1.93",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
7
7
  },
8
8
  "repository": "git@gitlab.com:hyper-graph/framework.git",
9
9
  "scripts": {
10
- "prepack": "yarn build && yarn lint:ts",
10
+ "publishPackage": "npm publish",
11
+ "prepack": "yarn clear && yarn build && yarn lint:ts && yarn test",
12
+ "clear": "rm -rf dist",
11
13
  "build": "tsc",
12
14
  "build:dev": "tsc-watch",
13
15
  "lint:ts": "lint-ts",
@@ -16,13 +18,14 @@
16
18
  "test:dev": "yarn build:dev --onSuccess \"yarn test\""
17
19
  },
18
20
  "devDependencies": {
19
- "@hg-ts-config/typescript": "0.1.88",
20
- "@hg-ts/config-loader": "0.1.88",
21
- "@hg-ts/exception": "0.1.88",
22
- "@hg-ts/ioc": "0.1.88",
23
- "@hg-ts/linter": "0.1.88",
24
- "@hg-ts/types": "0.1.88",
25
- "@hg-ts/validation": "0.1.88",
21
+ "@hg-ts-config/typescript": "workspace:*",
22
+ "@hg-ts/config-loader": "workspace:*",
23
+ "@hg-ts/exception": "workspace:*",
24
+ "@hg-ts/ioc": "workspace:*",
25
+ "@hg-ts/linter": "workspace:*",
26
+ "@hg-ts/tests": "workspace:*",
27
+ "@hg-ts/types": "workspace:*",
28
+ "@hg-ts/validation": "workspace:*",
26
29
  "@types/node": "22.10.6",
27
30
  "eslint": "9.18.0",
28
31
  "reflect-metadata": "0.2.2",
@@ -32,9 +35,9 @@
32
35
  "typescript": "5.7.3"
33
36
  },
34
37
  "peerDependencies": {
35
- "@hg-ts/config-loader": "0.1.88",
36
- "@hg-ts/ioc": "0.1.88",
37
- "@hg-ts/validation": "0.1.88",
38
+ "@hg-ts/config-loader": "workspace:*",
39
+ "@hg-ts/ioc": "workspace:*",
40
+ "@hg-ts/validation": "workspace:*",
38
41
  "reflect-metadata": "*",
39
42
  "rxjs": "*",
40
43
  "tslib": "*"
@@ -42,4 +45,4 @@
42
45
  "dependencies": {
43
46
  "ioredis": "5.5.0"
44
47
  }
45
- }
48
+ }