@common_ch/common 1.0.227 → 1.0.228

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.
@@ -13,9 +13,9 @@ const currentUser = (req, res, next) => {
13
13
  }
14
14
  try {
15
15
  const token = authHeader.split(' ')[1];
16
- (0, redis_service_1.getCache)(token).then((result) => {
16
+ (0, redis_service_1.getCacheTokenAuth)(token).then((result) => {
17
17
  if (result) {
18
- console.log('user blocked.');
18
+ console.log('token blocked.');
19
19
  next();
20
20
  }
21
21
  else {
@@ -1,3 +1,3 @@
1
- export declare function setCache(key: string, value: any, ttlInSeconds?: number): Promise<void>;
2
- export declare function getCache(key: string): Promise<string | null>;
3
- export declare function delCache(key: string): Promise<void>;
1
+ export declare function setCacheTokenAuth(key: string, value: any, ttlInSeconds?: number): Promise<void>;
2
+ export declare function getCacheTokenAuth(key: string): Promise<string | null>;
3
+ export declare function delCacheTokenAuth(key: string): Promise<void>;
@@ -9,24 +9,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.setCache = setCache;
13
- exports.getCache = getCache;
14
- exports.delCache = delCache;
12
+ exports.setCacheTokenAuth = setCacheTokenAuth;
13
+ exports.getCacheTokenAuth = getCacheTokenAuth;
14
+ exports.delCacheTokenAuth = delCacheTokenAuth;
15
15
  const redisClient_1 = require("./redisClient");
16
- function setCache(key_1, value_1) {
16
+ function setCacheTokenAuth(key_1, value_1) {
17
17
  return __awaiter(this, arguments, void 0, function* (key, value, ttlInSeconds = 60 * 60 * 24) {
18
18
  yield redisClient_1.redisClient.set(key, value, {
19
19
  EX: ttlInSeconds,
20
20
  });
21
21
  });
22
22
  }
23
- function getCache(key) {
23
+ function getCacheTokenAuth(key) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  const data = yield redisClient_1.redisClient.get(key);
26
26
  return data;
27
27
  });
28
28
  }
29
- function delCache(key) {
29
+ function delCacheTokenAuth(key) {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
31
  yield redisClient_1.redisClient.del(key);
32
32
  });
@@ -2292,4 +2292,4 @@ export declare const redisClient: import("@redis/client").RedisClientType<{
2292
2292
  };
2293
2293
  };
2294
2294
  } & import("redis").RedisModules, import("redis").RedisFunctions, import("redis").RedisScripts, import("redis").RespVersions, import("redis").TypeMapping>;
2295
- export declare function connectRedis(): Promise<void>;
2295
+ export declare function connectRedisAuth(): Promise<void>;
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.redisClient = void 0;
16
- exports.connectRedis = connectRedis;
16
+ exports.connectRedisAuth = connectRedisAuth;
17
17
  const redis_1 = require("redis");
18
18
  const logger_1 = __importDefault(require("../logger"));
19
19
  exports.redisClient = (0, redis_1.createClient)({
@@ -22,7 +22,7 @@ exports.redisClient = (0, redis_1.createClient)({
22
22
  exports.redisClient.on('error', (err) => {
23
23
  logger_1.default.log('error', `❌ Redis Client Error:, ${err}`);
24
24
  });
25
- function connectRedis() {
25
+ function connectRedisAuth() {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
27
  if (!exports.redisClient.isOpen) {
28
28
  yield exports.redisClient.connect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.227",
3
+ "version": "1.0.228",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [