Skip to content

Commit

Permalink
chore: bump packages
Browse files Browse the repository at this point in the history
  • Loading branch information
half-shell committed Jan 6, 2022
1 parent 95c73a0 commit 8800620
Show file tree
Hide file tree
Showing 5 changed files with 1,537 additions and 3,012 deletions.
17 changes: 5 additions & 12 deletions __tests__/unit/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import * as redis from 'redis';
import { RedisClient } from 'redis';
import { Request } from 'express';
import { ApiCache, ERedisFlag } from '../../src';

describe('apiCache.ts', () => {
let redisClient: redis.RedisClient;
let apiCache: ApiCache;

beforeAll(() => {
jest.spyOn(redis, 'createClient').mockReturnValue(<redis.RedisClient>{
get: (key: string): boolean => true,
set: (key: string, value: string): boolean => true,
quit: (): boolean => true,
});
redisClient = redis.createClient();
apiCache = new ApiCache(redisClient);
const mockRedisClient: RedisClient = <RedisClient>(<unknown>{
get: jest.fn().mockResolvedValue(''),
set: jest.fn().mockResolvedValue('OK'),
quit: jest.fn().mockResolvedValue(undefined),
});

afterEach(() => {
Expand Down
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"access": "public"
},
"devDependencies": {
"@types/express": "4.17.11",
"@types/jest": "26.0.23",
"@types/lodash": "4.14.168",
"@types/express": "4.17.13",
"@types/jest": "27.4.0",
"@types/lodash": "4.14.178",
"@types/redis": "2.8.28",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"eslint": "7.25.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"eslint": "8.6.0",
"eslint-config-prettier": "8.3.0",
"jest": "26.6.3",
"prettier": "2.2.1",
"ts-jest": "26.5.5",
"typescript": "4.2.4"
"jest": "27.4.7",
"prettier": "2.5.1",
"ts-jest": "27.1.2",
"typescript": "4.5.4"
},
"scripts": {
"clean": "rm -rf dist coverage",
Expand All @@ -38,8 +38,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
"express": "4.17.1",
"lodash": "4.17.21",
"redis": "2.8.0"
"redis": "3.1.2"
}
}
6 changes: 3 additions & 3 deletions src/classes/apiCache/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { brotliCompress, brotliDecompress } from 'zlib';
import { RedisClient } from 'redis';
import * as redis from 'redis';
import { promisify } from 'util';
import { Request } from 'express';
import { toPairs } from 'lodash';
Expand All @@ -12,7 +12,7 @@ import { defaultConfiguration } from './config';
* @description Get and set redis cache for a given express route.
*/
export class ApiCache {
private readonly redis: RedisClient;
private readonly redis: redis.RedisClient;
private readonly compressAsync: (buffer: Buffer) => Promise<Buffer>;
private readonly decompressAsync: (buffer: Buffer) => Promise<Buffer>;
private config: IApiCacheConfiguration;
Expand All @@ -24,7 +24,7 @@ export class ApiCache {
* @param {RedisClient} redis
* @param {IApiCacheConfiguration} config
*/
constructor(redis: RedisClient, config?: IApiCacheConfiguration) {
constructor(redis: redis.RedisClient, config?: IApiCacheConfiguration) {
this.redis = redis;
this.config = { ...defaultConfiguration, ...config };
this.redisSetAsync = promisify(this.redis.set).bind(this.redis);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"baseUrl": ".",
"outDir": "dist",
"lib": ["ESNext"],
"target": "ES5",
"target": "esnext",
"module": "CommonJS",
"moduleResolution": "Node",
"strict": true,
Expand Down
Loading

0 comments on commit 8800620

Please sign in to comment.