@maiyunnet/kebab 6.0.0 → 6.2.0

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "6.0.0";
8
+ export declare const VER = "6.2.0";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  export declare const LIB_PATH: string;
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '6.0.0';
9
+ export const VER = '6.2.0';
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
@@ -6,6 +6,27 @@
6
6
  import * as redis from '@litert/redis';
7
7
  import * as kebab from '#kebab/index.js';
8
8
  import * as sCtr from '#kebab/sys/ctr.js';
9
+ export interface IZRangeOptions {
10
+ /**
11
+ * Range query type.
12
+ *
13
+ * - SCORE: Query by score range
14
+ * - LEX: Query by lexicographical range
15
+ */
16
+ 'by'?: 'SCORE' | 'LEX';
17
+ /**
18
+ * Whether to return results in reverse order.
19
+ */
20
+ 'rev'?: boolean;
21
+ /**
22
+ * Pagination offset. Must be used together with count.
23
+ */
24
+ 'offset'?: number;
25
+ /**
26
+ * Pagination count. Must be used together with offset.
27
+ */
28
+ 'count'?: number;
29
+ }
9
30
  /**
10
31
  * --- 键值存储操作类 ---
11
32
  *
@@ -209,6 +230,48 @@ export declare class Kv {
209
230
  bRPop(key: string | string[], timeout: number): Promise<Record<string, string> | false>;
210
231
  lRange(key: string, start: number, stop: number): Promise<string[] | false>;
211
232
  lLen(key: string): Promise<number | false>;
233
+ /**
234
+ * --- 添加有序集合元素(单个元素) ---
235
+ * @param key key 名
236
+ * @param score 分数
237
+ * @param member 成员
238
+ */
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>;
270
+ zRangeWithScores(key: string, start: number, stop: number, options?: IZRangeOptions): Promise<Array<{
271
+ member: string;
272
+ score: number;
273
+ }> | false>;
274
+ zRem(key: string, members: Array<string | Buffer>): Promise<number | false>;
212
275
  /**
213
276
  * --- 从连接池中获取一个符合要求的连接 ---
214
277
  */
package/lib/kv.js CHANGED
@@ -728,6 +728,50 @@ end`;
728
728
  return false;
729
729
  }
730
730
  }
731
+ /**
732
+ * --- 添加有序集合元素 ---
733
+ */
734
+ async zAdd(key, scoreOrItems, memberOrOptions) {
735
+ const conn = await this._getConnection();
736
+ if (!conn) {
737
+ return false;
738
+ }
739
+ try {
740
+ return await conn.zAdd(this._etc.pre + key, scoreOrItems, memberOrOptions);
741
+ }
742
+ catch {
743
+ return false;
744
+ }
745
+ }
746
+ async zRangeWithScores(key, start, stop, options) {
747
+ const conn = await this._getConnection();
748
+ if (!conn) {
749
+ return false;
750
+ }
751
+ try {
752
+ return await conn.zRangeWithScores(this._etc.pre + key, start, stop, {
753
+ 'by': options?.by,
754
+ 'reverse': options?.rev,
755
+ 'offset': options?.offset,
756
+ 'count': options?.count,
757
+ });
758
+ }
759
+ catch {
760
+ return false;
761
+ }
762
+ }
763
+ async zRem(key, members) {
764
+ const conn = await this._getConnection();
765
+ if (!conn) {
766
+ return false;
767
+ }
768
+ try {
769
+ return await conn.zRem(this._etc.pre + key, members);
770
+ }
771
+ catch {
772
+ return false;
773
+ }
774
+ }
731
775
  /**
732
776
  * --- 从连接池中获取一个符合要求的连接 ---
733
777
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
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": [
@@ -22,28 +22,28 @@
22
22
  "#kebab/*": "./*"
23
23
  },
24
24
  "dependencies": {
25
- "@aws-sdk/client-s3": "^3.927.0",
26
- "@aws-sdk/lib-storage": "^3.927.0",
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.5",
29
+ "@litert/redis": "^3.1.0",
30
30
  "@litert/websocket": "^0.2.8",
31
31
  "@types/ssh2": "^1.15.5",
32
- "@zilliz/milvus2-sdk-node": "^2.6.4",
32
+ "@zilliz/milvus2-sdk-node": "^2.6.5",
33
33
  "ejs": "^3.1.10",
34
34
  "jszip": "^3.10.1",
35
35
  "mysql2": "^3.15.3",
36
36
  "node-cron": "^4.2.1",
37
- "openai": "^6.8.1",
37
+ "openai": "^6.9.1",
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.140"
41
+ "tencentcloud-sdk-nodejs": "^4.1.149"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@litert/eslint-plugin-rules": "^0.3.1",
45
45
  "@types/ejs": "^3.1.5",
46
- "@types/node": "^24.10.0",
46
+ "@types/node": "^24.10.1",
47
47
  "@types/pg": "^8.15.6",
48
48
  "typedoc": "^0.28.14",
49
49
  "typedoc-plugin-markdown": "^4.9.0",