@pi-r/redis 0.8.1 → 0.8.3
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/README.md +6 -6
- package/client/pool.d.ts +8 -8
- package/package.json +28 -28
- package/types/index.d.ts +90 -90
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
### @pi-r/redis
|
|
2
|
-
|
|
3
|
-
https://e-mc.readthedocs.io/en/latest/db/redis.html
|
|
4
|
-
|
|
5
|
-
### LICENSE
|
|
6
|
-
|
|
1
|
+
### @pi-r/redis
|
|
2
|
+
|
|
3
|
+
https://e-mc.readthedocs.io/en/latest/db/redis.html
|
|
4
|
+
|
|
5
|
+
### LICENSE
|
|
6
|
+
|
|
7
7
|
MIT
|
package/client/pool.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { DbPoolConstructor } from '@e-mc/types/lib/db';
|
|
2
|
-
|
|
3
|
-
import type { DbPoolCredential, RedisDataSource } from '../types';
|
|
4
|
-
|
|
5
|
-
import type { RedisClientType } from 'redis';
|
|
6
|
-
|
|
7
|
-
declare const RedisPool: DbPoolConstructor<RedisDataSource, RedisClientType, RedisClientType, DbPoolCredential>;
|
|
8
|
-
|
|
1
|
+
import type { DbPoolConstructor } from '@e-mc/types/lib/db';
|
|
2
|
+
|
|
3
|
+
import type { DbPoolCredential, RedisDataSource } from '../types';
|
|
4
|
+
|
|
5
|
+
import type { RedisClientType } from 'redis';
|
|
6
|
+
|
|
7
|
+
declare const RedisPool: DbPoolConstructor<RedisDataSource, RedisClientType, RedisClientType, DbPoolCredential>;
|
|
8
|
+
|
|
9
9
|
export = RedisPool;
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pi-r/redis",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Redis client driver for E-mc.",
|
|
5
|
-
"main": "client/index.js",
|
|
6
|
-
"types": "client/index.d.ts",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
13
|
-
"directory": "src/db/redis"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"squared",
|
|
17
|
-
"e-mc",
|
|
18
|
-
"squared-functions"
|
|
19
|
-
],
|
|
20
|
-
"author": "An Pham <anpham6@gmail.com>",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@e-mc/db": "^0.10.
|
|
25
|
-
"@e-mc/types": "^0.10.
|
|
26
|
-
"redis": "^4.7.0"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-r/redis",
|
|
3
|
+
"version": "0.8.3",
|
|
4
|
+
"description": "Redis client driver for E-mc.",
|
|
5
|
+
"main": "client/index.js",
|
|
6
|
+
"types": "client/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
13
|
+
"directory": "src/db/redis"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"squared",
|
|
17
|
+
"e-mc",
|
|
18
|
+
"squared-functions"
|
|
19
|
+
],
|
|
20
|
+
"author": "An Pham <anpham6@gmail.com>",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@e-mc/db": "^0.10.3",
|
|
25
|
+
"@e-mc/types": "^0.10.3",
|
|
26
|
+
"redis": "^4.7.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import type { DbDataSource } from '@e-mc/types/lib/squared';
|
|
2
|
-
|
|
3
|
-
import type { IdentifierAction } from '@e-mc/types/lib/core';
|
|
4
|
-
import type { CascadeAction, ServerAuth } from '@e-mc/types/lib/db';
|
|
5
|
-
|
|
6
|
-
import type { ClientCommandOptions } from '@redis/client/dist/lib/client';
|
|
7
|
-
import type { RedisCommandArgument } from '@redis/client/dist/lib/commands';
|
|
8
|
-
import type { CommandOptions } from '@redis/client/dist/lib/command-options';
|
|
9
|
-
import type { RedisClientOptions } from '@redis/client';
|
|
10
|
-
import type { RedisJSON } from '@redis/json/dist/commands';
|
|
11
|
-
import type { AggregateOptions } from '@redis/search/dist/commands/AGGREGATE';
|
|
12
|
-
import type { HScanTuple } from '@redis//client/dist/lib/commands/HSCAN';
|
|
13
|
-
import type { ScanOptions } from '@redis/client/dist/lib/commands/generic-transformers';
|
|
14
|
-
import type { RediSearchSchema, SearchOptions, SetOptions } from 'redis';
|
|
15
|
-
|
|
16
|
-
export interface RedisDataSource extends DbDataSource<string, PlainObject, ArrayOf<RedisSetValue> | ArrayOf<RedisJSONValue>, RedisCredential, string>, CascadeAction, AuthValue {
|
|
17
|
-
source: "redis";
|
|
18
|
-
key?: ArrayOf<RedisCommandArgument>;
|
|
19
|
-
field?: RedisCommandArgument;
|
|
20
|
-
path?: string;
|
|
21
|
-
format?: RedisFormat | "HKEYS" | "HVALS" | "HSCAN";
|
|
22
|
-
search?: RedisQuery;
|
|
23
|
-
aggregate?: RedisQuery;
|
|
24
|
-
cursor?: ArrayOf<number>;
|
|
25
|
-
iterations?: ArrayOf<number>;
|
|
26
|
-
options?: {
|
|
27
|
-
client?: RedisClientOptions;
|
|
28
|
-
command?: RedisCommandOptions;
|
|
29
|
-
get?: PlainObject;
|
|
30
|
-
search?: SearchOptions;
|
|
31
|
-
aggregate?: AggregateOptions;
|
|
32
|
-
scan?: ScanOptions;
|
|
33
|
-
};
|
|
34
|
-
database?: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type RedisCredential = ServerAuth;
|
|
38
|
-
|
|
39
|
-
export interface RedisCommand<T = "HASH" | "JSON" | undefined, U = unknown, V = unknown> {
|
|
40
|
-
format: T;
|
|
41
|
-
command?: string;
|
|
42
|
-
key?: U;
|
|
43
|
-
value?: V;
|
|
44
|
-
NX?: boolean;
|
|
45
|
-
XX?: boolean;
|
|
46
|
-
options?: {
|
|
47
|
-
set?: SetOptions;
|
|
48
|
-
expire?: { [K in RedisExpireCondition]?: boolean; };
|
|
49
|
-
command?: RedisCommandOptions;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface RedisSetValue extends RedisCommand<"HASH", RedisCommandArgument, RedisCommandValue | RedisHSETObject> {
|
|
54
|
-
field?: RedisCommandValue | RedisHSETObject;
|
|
55
|
-
EX?: number;
|
|
56
|
-
PX?: number;
|
|
57
|
-
EXAT?: number;
|
|
58
|
-
PXAT?: number;
|
|
59
|
-
KEEPTTL?: boolean;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface RedisJSONValue extends RedisCommand<"JSON", string, ArrayOf<RedisJSON>> {
|
|
63
|
-
command?: RedisCommandJSON;
|
|
64
|
-
path?: string;
|
|
65
|
-
start?: number | string;
|
|
66
|
-
stop?: number | string;
|
|
67
|
-
index?: number | string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface RedisQuery {
|
|
71
|
-
index?: string;
|
|
72
|
-
schema?: RediSearchSchema | string;
|
|
73
|
-
query?: string;
|
|
74
|
-
options?: PlainObject;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface JsonMSetItem {
|
|
78
|
-
key: RedisCommandArgument;
|
|
79
|
-
path: RedisCommandArgument;
|
|
80
|
-
value: RedisJSON;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export type RedisFormat = "HASH" | "JSON";
|
|
84
|
-
export type RedisCommandJSON = "ARRAPPEND" | "ARRINDEX" | "ARRINSERT" | "ARRPOP" | "ARRTRIM" | "DEL" | "FORGET" | "MERGE" | "MSET" | "NUMINCRBY" | "NUMMULTBY" | "SET" | "STRAPPEND";
|
|
85
|
-
export type RedisExpireCondition = "NX" | "XX" | "GT" | "LT";
|
|
86
|
-
export type RedisCommandValue = RedisCommandArgument | number;
|
|
87
|
-
export type RedisCommandOptions = CommandOptions<ClientCommandOptions>;
|
|
88
|
-
export type RedisHSETObject = Record<number | string, RedisCommandValue>;
|
|
89
|
-
export type DbPoolCredential = RedisClientOptions & IdentifierAction;
|
|
90
|
-
|
|
1
|
+
import type { DbDataSource } from '@e-mc/types/lib/squared';
|
|
2
|
+
|
|
3
|
+
import type { IdentifierAction } from '@e-mc/types/lib/core';
|
|
4
|
+
import type { CascadeAction, ServerAuth } from '@e-mc/types/lib/db';
|
|
5
|
+
|
|
6
|
+
import type { ClientCommandOptions } from '@redis/client/dist/lib/client';
|
|
7
|
+
import type { RedisCommandArgument } from '@redis/client/dist/lib/commands';
|
|
8
|
+
import type { CommandOptions } from '@redis/client/dist/lib/command-options';
|
|
9
|
+
import type { RedisClientOptions } from '@redis/client';
|
|
10
|
+
import type { RedisJSON } from '@redis/json/dist/commands';
|
|
11
|
+
import type { AggregateOptions } from '@redis/search/dist/commands/AGGREGATE';
|
|
12
|
+
import type { HScanTuple } from '@redis//client/dist/lib/commands/HSCAN';
|
|
13
|
+
import type { ScanOptions } from '@redis/client/dist/lib/commands/generic-transformers';
|
|
14
|
+
import type { RediSearchSchema, SearchOptions, SetOptions } from 'redis';
|
|
15
|
+
|
|
16
|
+
export interface RedisDataSource extends DbDataSource<string, PlainObject, ArrayOf<RedisSetValue> | ArrayOf<RedisJSONValue>, RedisCredential, string>, CascadeAction, AuthValue {
|
|
17
|
+
source: "redis";
|
|
18
|
+
key?: ArrayOf<RedisCommandArgument>;
|
|
19
|
+
field?: RedisCommandArgument;
|
|
20
|
+
path?: string;
|
|
21
|
+
format?: RedisFormat | "HKEYS" | "HVALS" | "HSCAN";
|
|
22
|
+
search?: RedisQuery;
|
|
23
|
+
aggregate?: RedisQuery;
|
|
24
|
+
cursor?: ArrayOf<number>;
|
|
25
|
+
iterations?: ArrayOf<number>;
|
|
26
|
+
options?: {
|
|
27
|
+
client?: RedisClientOptions;
|
|
28
|
+
command?: RedisCommandOptions;
|
|
29
|
+
get?: PlainObject;
|
|
30
|
+
search?: SearchOptions;
|
|
31
|
+
aggregate?: AggregateOptions;
|
|
32
|
+
scan?: ScanOptions;
|
|
33
|
+
};
|
|
34
|
+
database?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type RedisCredential = ServerAuth;
|
|
38
|
+
|
|
39
|
+
export interface RedisCommand<T = "HASH" | "JSON" | undefined, U = unknown, V = unknown> {
|
|
40
|
+
format: T;
|
|
41
|
+
command?: string;
|
|
42
|
+
key?: U;
|
|
43
|
+
value?: V;
|
|
44
|
+
NX?: boolean;
|
|
45
|
+
XX?: boolean;
|
|
46
|
+
options?: {
|
|
47
|
+
set?: SetOptions;
|
|
48
|
+
expire?: { [K in RedisExpireCondition]?: boolean; };
|
|
49
|
+
command?: RedisCommandOptions;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface RedisSetValue extends RedisCommand<"HASH", RedisCommandArgument, RedisCommandValue | RedisHSETObject> {
|
|
54
|
+
field?: RedisCommandValue | RedisHSETObject;
|
|
55
|
+
EX?: number;
|
|
56
|
+
PX?: number;
|
|
57
|
+
EXAT?: number;
|
|
58
|
+
PXAT?: number;
|
|
59
|
+
KEEPTTL?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface RedisJSONValue extends RedisCommand<"JSON", string, ArrayOf<RedisJSON>> {
|
|
63
|
+
command?: RedisCommandJSON;
|
|
64
|
+
path?: string;
|
|
65
|
+
start?: number | string;
|
|
66
|
+
stop?: number | string;
|
|
67
|
+
index?: number | string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface RedisQuery {
|
|
71
|
+
index?: string;
|
|
72
|
+
schema?: RediSearchSchema | string;
|
|
73
|
+
query?: string;
|
|
74
|
+
options?: PlainObject;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface JsonMSetItem {
|
|
78
|
+
key: RedisCommandArgument;
|
|
79
|
+
path: RedisCommandArgument;
|
|
80
|
+
value: RedisJSON;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type RedisFormat = "HASH" | "JSON";
|
|
84
|
+
export type RedisCommandJSON = "ARRAPPEND" | "ARRINDEX" | "ARRINSERT" | "ARRPOP" | "ARRTRIM" | "DEL" | "FORGET" | "MERGE" | "MSET" | "NUMINCRBY" | "NUMMULTBY" | "SET" | "STRAPPEND";
|
|
85
|
+
export type RedisExpireCondition = "NX" | "XX" | "GT" | "LT";
|
|
86
|
+
export type RedisCommandValue = RedisCommandArgument | number;
|
|
87
|
+
export type RedisCommandOptions = CommandOptions<ClientCommandOptions>;
|
|
88
|
+
export type RedisHSETObject = Record<number | string, RedisCommandValue>;
|
|
89
|
+
export type DbPoolCredential = RedisClientOptions & IdentifierAction;
|
|
90
|
+
|
|
91
91
|
export type { HScanTuple, RedisCommandArgument, RedisJSON, ScanOptions };
|