@maiyunnet/kebab 6.1.0 → 6.2.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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/kv.d.ts +36 -0
- package/lib/kv.js +5 -2
- package/package.json +7 -7
- package/sys/mod.d.ts +0 -11
- package/sys/mod.js +0 -4
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '6.1
|
|
9
|
+
export const VER = '6.2.1';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/kv.d.ts
CHANGED
|
@@ -230,7 +230,43 @@ export declare class Kv {
|
|
|
230
230
|
bRPop(key: string | string[], timeout: number): Promise<Record<string, string> | false>;
|
|
231
231
|
lRange(key: string, start: number, stop: number): Promise<string[] | false>;
|
|
232
232
|
lLen(key: string): Promise<number | false>;
|
|
233
|
+
/**
|
|
234
|
+
* --- 添加有序集合元素(单个元素) ---
|
|
235
|
+
* @param key key 名
|
|
236
|
+
* @param score 分数
|
|
237
|
+
* @param member 成员
|
|
238
|
+
*/
|
|
233
239
|
zAdd(key: string, score: number, member: string | Buffer): Promise<boolean>;
|
|
240
|
+
/**
|
|
241
|
+
* --- 添加有序集合元素(多个元素,含 INCR 选项) ---
|
|
242
|
+
* @param key key 名
|
|
243
|
+
* @param elements 元素数组
|
|
244
|
+
* @param options 选项,需要 INCR
|
|
245
|
+
*/
|
|
246
|
+
zAdd(key: string, elements: Array<{
|
|
247
|
+
'score': number;
|
|
248
|
+
'member': string | Buffer;
|
|
249
|
+
}>, options: redis.IZAddOptionsIncr): Promise<number | false>;
|
|
250
|
+
/**
|
|
251
|
+
* --- 添加有序集合元素(多个元素,含 INCR 选项,可空) ---
|
|
252
|
+
* @param key key 名
|
|
253
|
+
* @param elements 元素数组
|
|
254
|
+
* @param options 选项,需要 INCR Nullable
|
|
255
|
+
*/
|
|
256
|
+
zAdd(key: string, elements: Array<{
|
|
257
|
+
'score': number;
|
|
258
|
+
'member': string | Buffer;
|
|
259
|
+
}>, options: redis.IZAddOptionsIncrNullable): Promise<number | null | false>;
|
|
260
|
+
/**
|
|
261
|
+
* --- 添加有序集合元素(多个元素) ---
|
|
262
|
+
* @param key key 名
|
|
263
|
+
* @param elements 元素数组
|
|
264
|
+
* @param options 选项
|
|
265
|
+
*/
|
|
266
|
+
zAdd(key: string, elements: Array<{
|
|
267
|
+
'score': number;
|
|
268
|
+
'member': string | Buffer;
|
|
269
|
+
}>, options?: redis.IZAddOptions): Promise<number | false>;
|
|
234
270
|
zRangeWithScores(key: string, start: number, stop: number, options?: IZRangeOptions): Promise<Array<{
|
|
235
271
|
member: string;
|
|
236
272
|
score: number;
|
package/lib/kv.js
CHANGED
|
@@ -728,13 +728,16 @@ end`;
|
|
|
728
728
|
return false;
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
|
-
|
|
731
|
+
/**
|
|
732
|
+
* --- 添加有序集合元素 ---
|
|
733
|
+
*/
|
|
734
|
+
async zAdd(key, scoreOrItems, memberOrOptions) {
|
|
732
735
|
const conn = await this._getConnection();
|
|
733
736
|
if (!conn) {
|
|
734
737
|
return false;
|
|
735
738
|
}
|
|
736
739
|
try {
|
|
737
|
-
return await conn.zAdd(this._etc.pre + key,
|
|
740
|
+
return await conn.zAdd(this._etc.pre + key, scoreOrItems, memberOrOptions);
|
|
738
741
|
}
|
|
739
742
|
catch {
|
|
740
743
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "6.1
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"types": "./index.d.ts",
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build-
|
|
16
|
+
"build-doc": "bash ./utils/build-doc.sh"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
19
|
"kebab": "./bin/kebab.js"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"#kebab/*": "./*"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/client-s3": "^3.
|
|
26
|
-
"@aws-sdk/lib-storage": "^3.
|
|
25
|
+
"@aws-sdk/client-s3": "^3.940.0",
|
|
26
|
+
"@aws-sdk/lib-storage": "^3.940.0",
|
|
27
27
|
"@litert/http-client": "^1.1.2",
|
|
28
28
|
"@litert/mime": "^0.1.3",
|
|
29
|
-
"@litert/redis": "^3.0
|
|
29
|
+
"@litert/redis": "^3.1.0",
|
|
30
30
|
"@litert/websocket": "^0.2.8",
|
|
31
31
|
"@types/ssh2": "^1.15.5",
|
|
32
32
|
"@zilliz/milvus2-sdk-node": "^2.6.5",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"pg": "^8.16.3",
|
|
39
39
|
"ssh2": "^1.17.0",
|
|
40
40
|
"svg-captcha": "^1.4.0",
|
|
41
|
-
"tencentcloud-sdk-nodejs": "^4.1.
|
|
41
|
+
"tencentcloud-sdk-nodejs": "^4.1.152"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@litert/eslint-plugin-rules": "^0.3.1",
|
|
45
45
|
"@types/ejs": "^3.1.5",
|
|
46
46
|
"@types/node": "^24.10.1",
|
|
47
47
|
"@types/pg": "^8.15.6",
|
|
48
|
-
"typedoc": "^0.28.
|
|
48
|
+
"typedoc": "^0.28.15",
|
|
49
49
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
51
51
|
}
|
package/sys/mod.d.ts
CHANGED
|
@@ -78,7 +78,6 @@ export default class Mod {
|
|
|
78
78
|
'key': string;
|
|
79
79
|
'list': string[];
|
|
80
80
|
};
|
|
81
|
-
'raw'?: boolean;
|
|
82
81
|
'pre'?: string;
|
|
83
82
|
});
|
|
84
83
|
/** --- 创建字段对象 --- */
|
|
@@ -118,7 +117,6 @@ export default class Mod {
|
|
|
118
117
|
* @param opt 选项
|
|
119
118
|
*/
|
|
120
119
|
static removeByWhere(db: lDb.Pool | lDb.Transaction, where: string | kebab.Json, opt?: {
|
|
121
|
-
'raw'?: boolean;
|
|
122
120
|
'pre'?: string;
|
|
123
121
|
'ctr'?: sCtr.Ctr;
|
|
124
122
|
'index'?: string | string[];
|
|
@@ -132,7 +130,6 @@ export default class Mod {
|
|
|
132
130
|
* @param opt 选项
|
|
133
131
|
*/
|
|
134
132
|
static removeByWhereSql(db: lDb.Pool | lDb.Transaction, where: string | kebab.Json, opt?: {
|
|
135
|
-
'raw'?: boolean;
|
|
136
133
|
'pre'?: string;
|
|
137
134
|
'ctr'?: sCtr.Ctr;
|
|
138
135
|
'index'?: string;
|
|
@@ -147,7 +144,6 @@ export default class Mod {
|
|
|
147
144
|
* @param opt 选项
|
|
148
145
|
*/
|
|
149
146
|
static updateByWhere(db: lDb.Pool | lDb.Transaction, data: kebab.Json, where: string | kebab.Json, opt?: {
|
|
150
|
-
'raw'?: boolean;
|
|
151
147
|
'pre'?: string;
|
|
152
148
|
'ctr'?: sCtr.Ctr;
|
|
153
149
|
'index'?: string | string[];
|
|
@@ -162,7 +158,6 @@ export default class Mod {
|
|
|
162
158
|
* @param opt 选项
|
|
163
159
|
*/
|
|
164
160
|
static updateByWhereSql(db: lDb.Pool | lDb.Transaction, data: kebab.Json, where: string | kebab.Json, opt?: {
|
|
165
|
-
'raw'?: boolean;
|
|
166
161
|
'pre'?: string;
|
|
167
162
|
'ctr'?: sCtr.Ctr;
|
|
168
163
|
'index'?: string;
|
|
@@ -205,7 +200,6 @@ export default class Mod {
|
|
|
205
200
|
*/
|
|
206
201
|
static where<T extends Mod>(db: lDb.Pool | lDb.Transaction, s?: string | kebab.Json, opt?: {
|
|
207
202
|
'ctr'?: sCtr.Ctr;
|
|
208
|
-
'raw'?: boolean;
|
|
209
203
|
'pre'?: string;
|
|
210
204
|
'index'?: string | string[];
|
|
211
205
|
'alias'?: string;
|
|
@@ -233,7 +227,6 @@ export default class Mod {
|
|
|
233
227
|
static find<T extends Mod>(db: lDb.Pool | lDb.Transaction, val: string | number | null, opt?: {
|
|
234
228
|
'ctr'?: sCtr.Ctr;
|
|
235
229
|
'lock'?: boolean;
|
|
236
|
-
'raw'?: boolean;
|
|
237
230
|
'pre'?: string;
|
|
238
231
|
'index'?: string | string[];
|
|
239
232
|
/** --- 通过 key 字段获取,默认为 false,即从主键获取 --- */
|
|
@@ -241,7 +234,6 @@ export default class Mod {
|
|
|
241
234
|
}): Promise<false | null | (T & Record<string, any>)>;
|
|
242
235
|
static one(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt: {
|
|
243
236
|
'ctr'?: sCtr.Ctr;
|
|
244
|
-
'raw'?: boolean;
|
|
245
237
|
'pre'?: string;
|
|
246
238
|
'index'?: string | string[];
|
|
247
239
|
'select'?: string | string[];
|
|
@@ -250,7 +242,6 @@ export default class Mod {
|
|
|
250
242
|
}): Promise<false | null | Record<string, any>>;
|
|
251
243
|
static one<T extends Mod>(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt: {
|
|
252
244
|
'ctr'?: sCtr.Ctr;
|
|
253
|
-
'raw'?: boolean;
|
|
254
245
|
'pre'?: string;
|
|
255
246
|
'index'?: string | string[];
|
|
256
247
|
'select'?: string | string[];
|
|
@@ -265,7 +256,6 @@ export default class Mod {
|
|
|
265
256
|
*/
|
|
266
257
|
static oneArray(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt?: {
|
|
267
258
|
'ctr'?: sCtr.Ctr;
|
|
268
|
-
'raw'?: boolean;
|
|
269
259
|
'pre'?: string;
|
|
270
260
|
'index'?: string | string[];
|
|
271
261
|
'select'?: string | string[];
|
|
@@ -278,7 +268,6 @@ export default class Mod {
|
|
|
278
268
|
*/
|
|
279
269
|
static primarys(db: lDb.Pool | lDb.Transaction, where?: string | kebab.Json, opt?: {
|
|
280
270
|
'ctr'?: sCtr.Ctr;
|
|
281
|
-
'raw'?: boolean;
|
|
282
271
|
'pre'?: string;
|
|
283
272
|
'index'?: string;
|
|
284
273
|
}): Promise<any[] | false>;
|
package/sys/mod.js
CHANGED
|
@@ -374,7 +374,6 @@ export default class Mod {
|
|
|
374
374
|
'ctr': opt.ctr,
|
|
375
375
|
'pre': opt.pre,
|
|
376
376
|
'where': s,
|
|
377
|
-
'raw': opt.raw,
|
|
378
377
|
'index': opt.index,
|
|
379
378
|
'contain': opt.contain,
|
|
380
379
|
'alias': opt.alias,
|
|
@@ -411,7 +410,6 @@ export default class Mod {
|
|
|
411
410
|
'where': [{
|
|
412
411
|
[opt.key ? this._$key : this._$primary]: val,
|
|
413
412
|
}],
|
|
414
|
-
'raw': opt.raw,
|
|
415
413
|
'index': opt.index,
|
|
416
414
|
}).first(opt.lock);
|
|
417
415
|
}
|
|
@@ -430,7 +428,6 @@ export default class Mod {
|
|
|
430
428
|
'ctr': opt.ctr,
|
|
431
429
|
'pre': opt.pre,
|
|
432
430
|
'where': s,
|
|
433
|
-
'raw': opt.raw
|
|
434
431
|
});
|
|
435
432
|
if (opt.by) {
|
|
436
433
|
o.by(opt.by[0], opt.by[1]);
|
|
@@ -445,7 +442,6 @@ export default class Mod {
|
|
|
445
442
|
'ctr': opt.ctr,
|
|
446
443
|
'pre': opt.pre,
|
|
447
444
|
'where': s,
|
|
448
|
-
'raw': opt.raw,
|
|
449
445
|
'index': item,
|
|
450
446
|
});
|
|
451
447
|
if (opt.by) {
|