@tsed/adapters-redis 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.
- package/lib/types-esm/adapters/OIDCRedisAdapter.d.ts +16 -0
- package/lib/types-esm/adapters/RedisAdapter.d.ts +36 -0
- package/lib/types-esm/domain/RedisAdaptersSettings.d.ts +13 -0
- package/lib/types-esm/index.d.ts +6 -0
- package/package.json +21 -17
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -14
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -45
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AdapterModel } from "@tsed/adapters";
|
|
2
|
+
import { Configuration } from "@tsed/di";
|
|
3
|
+
import { ChainableCommander } from "ioredis";
|
|
4
|
+
import { IORedis } from "@tsed/ioredis";
|
|
5
|
+
import { RedisAdapter, RedisAdapterConstructorOptions } from "./RedisAdapter.js";
|
|
6
|
+
export declare class OIDCRedisAdapter<T extends AdapterModel> extends RedisAdapter<T> {
|
|
7
|
+
protected configuration: Configuration;
|
|
8
|
+
protected isGrantable: boolean;
|
|
9
|
+
constructor(options: RedisAdapterConstructorOptions, connections: IORedis[], configuration: Configuration);
|
|
10
|
+
onInsert(multi: ChainableCommander, payload: T, expiresIn: number): Promise<ChainableCommander>;
|
|
11
|
+
findByUid(uid: string): Promise<"" | T | null | undefined>;
|
|
12
|
+
findByUserCode(userCode: string): Promise<"" | T | null | undefined>;
|
|
13
|
+
destroy(id: string): Promise<void>;
|
|
14
|
+
revokeByGrantId(grantId: string): Promise<void>;
|
|
15
|
+
consume(id: string): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Adapter, AdapterConstructorOptions, AdapterModel } from "@tsed/adapters";
|
|
2
|
+
import { Hooks } from "@tsed/core";
|
|
3
|
+
import { Configuration } from "@tsed/di";
|
|
4
|
+
import { IORedis } from "@tsed/ioredis";
|
|
5
|
+
import type { ChainableCommander, Redis } from "ioredis";
|
|
6
|
+
export interface RedisAdapterConstructorOptions extends AdapterConstructorOptions {
|
|
7
|
+
connectionName?: string;
|
|
8
|
+
useHash?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class RedisAdapter<Model extends AdapterModel> extends Adapter<Model> {
|
|
11
|
+
protected configuration: Configuration;
|
|
12
|
+
readonly hooks: Hooks;
|
|
13
|
+
readonly connectionName: string;
|
|
14
|
+
readonly connection: IORedis;
|
|
15
|
+
protected useHash: boolean;
|
|
16
|
+
constructor(options: RedisAdapterConstructorOptions, connections: IORedis[], configuration: Configuration);
|
|
17
|
+
get db(): Redis;
|
|
18
|
+
key(id: string): string;
|
|
19
|
+
create(payload: Partial<Model>, expiresAt?: Date): Promise<Model>;
|
|
20
|
+
upsert(id: string, payload: Model, expiresAt?: Date): Promise<Model>;
|
|
21
|
+
update(id: string, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
|
|
22
|
+
updateOne(predicate: Partial<Model & any>, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
|
|
23
|
+
findOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
|
|
24
|
+
findById(_id: string): Promise<Model | undefined>;
|
|
25
|
+
findAll(predicate?: Partial<Model & any>): Promise<Model[]>;
|
|
26
|
+
deleteOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
|
|
27
|
+
deleteById(_id: string): Promise<Model | undefined>;
|
|
28
|
+
deleteMany(predicate: Partial<Model>): Promise<Model[]>;
|
|
29
|
+
protected findKeys(props: any): Promise<string[]>;
|
|
30
|
+
protected insert(payload: Partial<Model>, expiresAt?: Date): Promise<any>;
|
|
31
|
+
protected getAllIndex(id: string): Promise<string[]>;
|
|
32
|
+
protected getAllIndex(id: string, pipeline: ChainableCommander): ChainableCommander;
|
|
33
|
+
protected getIndexedKey(id: string, propertyKey: string, value: any): string;
|
|
34
|
+
protected getAll(): Promise<Model[]>;
|
|
35
|
+
protected findAllBy(props: Partial<Model & any>): Promise<Model[]>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AdaptersSettings } from "@tsed/adapters";
|
|
2
|
+
import { RedisOptions } from "ioredis";
|
|
3
|
+
declare global {
|
|
4
|
+
namespace TsED {
|
|
5
|
+
interface AdaptersOptions extends AdaptersSettings {
|
|
6
|
+
redis: RedisOptions & {
|
|
7
|
+
indexes?: {
|
|
8
|
+
[propertyKey: string]: Record<string, any>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/adapters-redis",
|
|
3
|
-
"version": "7.79.4",
|
|
4
3
|
"description": "Redis adapter 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
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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": "
|
|
19
|
-
"build:ts": "tsc --build tsconfig.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
|
-
"@tsed/adapters": "7.
|
|
23
|
-
"@tsed/ioredis": "7.
|
|
25
|
+
"@tsed/adapters": "7.80.1",
|
|
26
|
+
"@tsed/ioredis": "7.80.1",
|
|
24
27
|
"tslib": "2.6.1"
|
|
25
28
|
},
|
|
26
29
|
"devDependencies": {
|
|
27
|
-
"@tsed/barrels": "7.
|
|
28
|
-
"@tsed/core": "7.
|
|
29
|
-
"@tsed/typescript": "7.
|
|
30
|
+
"@tsed/barrels": "7.80.1",
|
|
31
|
+
"@tsed/core": "7.80.1",
|
|
32
|
+
"@tsed/typescript": "7.80.1",
|
|
30
33
|
"eslint": "^8.57.0",
|
|
31
|
-
"
|
|
34
|
+
"typescript": "4.9.5",
|
|
35
|
+
"vitest": "2.0.4"
|
|
32
36
|
},
|
|
33
37
|
"peerDependencies": {
|
|
34
|
-
"@tsed/adapters": "7.
|
|
35
|
-
"@tsed/common": "7.
|
|
36
|
-
"@tsed/core": "7.
|
|
37
|
-
"@tsed/di": "7.
|
|
38
|
+
"@tsed/adapters": "7.80.1",
|
|
39
|
+
"@tsed/common": "7.80.1",
|
|
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
|
"uuid": "^9.0.1"
|
|
@@ -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: 93.68,
|
|
9
|
-
functions: 100,
|
|
10
|
-
lines: 100,
|
|
11
|
-
statements: 100
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
package/tsconfig.esm.json
DELETED
|
@@ -1,45 +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": "../adapters"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../platform/common"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../core"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../di"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../ioredis"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|