@tsed/ioredis 7.79.4 → 7.80.1

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,33 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.mockConnections = exports.mockConnection = void 0;
27
4
  const di_1 = require("@tsed/di");
28
5
  const registerConnectionProvider_js_1 = require("./registerConnectionProvider.js");
29
6
  async function mockConnection(token, name) {
30
- const { default: RealIORedis } = await Promise.resolve().then(() => __importStar(require("ioredis-mock")));
7
+ const { default: RealIORedis } = await import("ioredis-mock");
31
8
  const connection = new RealIORedis();
32
9
  connection.name = name;
33
10
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"mockConnections.js","sourceRoot":"","sources":["../../../src/utils/mockConnections.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAwD;AAGxD,mFAAoE;AAE7D,KAAK,UAAU,cAAc,CAAC,KA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C3D,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAC9E,CAAC;AACJ,CAAC;AAND,0CAMC"}
@@ -0,0 +1,20 @@
1
+ import { TokenProvider } from "@tsed/di";
2
+ import Redis, { Cluster, ClusterOptions, RedisOptions } from "ioredis";
3
+ export type ClusterConfiguration = {
4
+ nodes: string[];
5
+ } & ClusterOptions;
6
+ export interface BaseIORedisConfiguration {
7
+ name?: TokenProvider;
8
+ cache?: boolean;
9
+ }
10
+ export type IORedisConfiguration = BaseIORedisConfiguration & (RedisOptions | ClusterConfiguration) & {
11
+ redisInstance?: Redis | Cluster;
12
+ sentinelName?: string;
13
+ };
14
+ declare global {
15
+ namespace TsED {
16
+ interface Configuration {
17
+ ioredis?: IORedisConfiguration[];
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,36 @@
1
+ import type { Config, FactoryConfig, Store } from "cache-manager";
2
+ import Redis, { Cluster, ClusterNode, ClusterOptions, RedisOptions } from "ioredis";
3
+ export interface RedisClusterConfig {
4
+ nodes: ClusterNode[];
5
+ options?: ClusterOptions;
6
+ }
7
+ export type IORedisStoreCtrOptions = (RedisOptions | {
8
+ clusterConfig: RedisClusterConfig;
9
+ }) & Config & {
10
+ redisInstance?: Redis | Cluster;
11
+ };
12
+ export declare class IORedisStore implements Store {
13
+ name: string;
14
+ /**
15
+ * @deprecated
16
+ */
17
+ isCacheableValue: any;
18
+ isCacheable: any;
19
+ private redisCache;
20
+ private storeArgs;
21
+ constructor(options?: IORedisStoreCtrOptions);
22
+ get client(): Redis | Cluster;
23
+ getClient(): Redis | Cluster;
24
+ set(key: string, value: any, ttl?: number): Promise<void>;
25
+ get<T = any>(key: string, options?: any): Promise<T | undefined>;
26
+ del(key: string): Promise<void>;
27
+ mset(args: [string, unknown][], ttl?: number): Promise<void>;
28
+ mget(...args: string[]): Promise<unknown[]>;
29
+ mdel(...args: string[]): Promise<void>;
30
+ reset(): Promise<void>;
31
+ keys(pattern?: string): Promise<string[]>;
32
+ ttl(key: string): Promise<number>;
33
+ private getTtl;
34
+ private assertCacheable;
35
+ }
36
+ export declare const ioRedisStore: (config?: FactoryConfig<any>) => IORedisStore;
@@ -0,0 +1,4 @@
1
+ import { DITest } from "@tsed/di";
2
+ export declare class IORedisTest extends DITest {
3
+ static create(options?: Partial<TsED.Configuration>): Promise<void>;
4
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file Automatically generated by @tsed/barrels.
3
+ */
4
+ export * from "./domain/IORedisConfiguration.js";
5
+ export * from "./domain/IORedisStore.js";
6
+ export * from "./domain/IORedisTest.js";
7
+ export * from "./utils/mockConnections.js";
8
+ export * from "./utils/registerConnectionProvider.js";
@@ -0,0 +1,10 @@
1
+ import { TokenProvider } from "@tsed/di";
2
+ import Redis from "ioredis";
3
+ export declare function mockConnection(token: TokenProvider, name: string): Promise<{
4
+ token: any;
5
+ use: Redis;
6
+ }>;
7
+ export declare function mockConnections(): Promise<{
8
+ token: any;
9
+ use: Redis;
10
+ }[]>;
@@ -0,0 +1,11 @@
1
+ import { TokenProvider } from "@tsed/di";
2
+ import Redis from "ioredis";
3
+ export interface CreateConnectionProviderProps {
4
+ provide: TokenProvider;
5
+ name?: string;
6
+ }
7
+ export declare const IOREDIS_CONNECTIONS: unique symbol;
8
+ export type IORedis = Redis & {
9
+ name: string;
10
+ };
11
+ export declare function registerConnectionProvider({ provide, name }: CreateConnectionProviderProps): void;
package/package.json CHANGED
@@ -1,40 +1,44 @@
1
1
  {
2
2
  "name": "@tsed/ioredis",
3
- "version": "7.79.4",
4
3
  "description": "IO Redis connection for Ts.ED",
4
+ "type": "commonjs",
5
+ "version": "7.80.1",
5
6
  "source": "./src/index.ts",
6
7
  "main": "./lib/cjs/index.js",
7
8
  "module": "./lib/esm/index.js",
8
9
  "typings": "./lib/types/index.d.ts",
9
10
  "exports": {
10
- "types": "./lib/types/index.d.ts",
11
- "import": "./lib/esm/index.js",
12
- "require": "./lib/cjs/index.js",
13
- "default": "./lib/esm/index.js"
11
+ ".": {
12
+ "types": "./lib/types/index.d.ts",
13
+ "import": "./lib/esm/index.js",
14
+ "default": "./lib/cjs/index.js"
15
+ }
14
16
  },
15
17
  "scripts": {
16
18
  "build": "yarn barrels && yarn build:ts",
17
19
  "barrels": "barrels",
18
- "test": "jest && jest-coverage-thresholds-bumper",
19
- "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json"
20
+ "test": "vitest run",
21
+ "build:ts": "tsc --build tsconfig.json",
22
+ "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
20
23
  },
21
24
  "dependencies": {
22
25
  "tslib": "2.6.1"
23
26
  },
24
27
  "devDependencies": {
25
- "@tsed/barrels": "7.79.4",
26
- "@tsed/core": "7.79.4",
27
- "@tsed/di": "7.79.4",
28
- "@tsed/typescript": "7.79.4",
28
+ "@tsed/barrels": "7.80.1",
29
+ "@tsed/core": "7.80.1",
30
+ "@tsed/di": "7.80.1",
31
+ "@tsed/typescript": "7.80.1",
29
32
  "@types/ioredis-mock": "^5.6.0",
30
33
  "eslint": "^8.57.0",
31
34
  "ioredis": "5.3.2",
32
35
  "ioredis-mock": "8.9.0",
33
- "jest": "^29.7.0"
36
+ "typescript": "4.9.5",
37
+ "vitest": "2.0.4"
34
38
  },
35
39
  "peerDependencies": {
36
- "@tsed/core": "7.79.4",
37
- "@tsed/di": "7.79.4",
40
+ "@tsed/core": "7.80.1",
41
+ "@tsed/di": "7.80.1",
38
42
  "ioredis": ">=5.2.3",
39
43
  "ioredis-mock": ">=8.2.2"
40
44
  },
@@ -0,0 +1,21 @@
1
+ // @ts-ignore
2
+ import {presets} from "@tsed/vitest/presets";
3
+ import {defineConfig} from "vitest/config";
4
+
5
+ export default defineConfig(
6
+ {
7
+ ...presets,
8
+ test: {
9
+ ...presets.test,
10
+ coverage: {
11
+ ...presets.test.coverage,
12
+ thresholds: {
13
+ statements: 0,
14
+ branches: 0,
15
+ functions: 0,
16
+ lines: 0
17
+ }
18
+ }
19
+ }
20
+ }
21
+ );
package/jest.config.js DELETED
@@ -1,14 +0,0 @@
1
- // For a detailed explanation regarding each configuration property, visit:
2
- // https://jestjs.io/docs/en/configuration.html
3
-
4
- module.exports = {
5
- ...require("@tsed/jest-config"),
6
- coverageThreshold: {
7
- global: {
8
- branches: 0,
9
- functions: 0,
10
- lines: 0,
11
- statements: 0
12
- }
13
- }
14
- };
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/tsconfig.esm.json DELETED
@@ -1,36 +0,0 @@
1
- {
2
- "extends": "@tsed/typescript/tsconfig.node.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "module": "ES2020",
6
- "rootDir": "src",
7
- "outDir": "./lib/esm",
8
- "declaration": true,
9
- "declarationDir": "./lib/types",
10
- "composite": true,
11
- "noEmit": false
12
- },
13
- "include": ["src", "src/**/*.json"],
14
- "exclude": [
15
- "node_modules",
16
- "test",
17
- "lib",
18
- "benchmark",
19
- "coverage",
20
- "spec",
21
- "**/*.benchmark.ts",
22
- "**/*.spec.ts",
23
- "keys",
24
- "jest.config.js",
25
- "**/__mock__/**",
26
- "webpack.config.js"
27
- ],
28
- "references": [
29
- {
30
- "path": "../../core"
31
- },
32
- {
33
- "path": "../../di"
34
- }
35
- ]
36
- }