@maiyunnet/kebab 8.6.3 → 8.6.5

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/doc/kebab-rag.md CHANGED
@@ -1410,7 +1410,7 @@ index/variables/VER.md
1410
1410
 
1411
1411
  # Variable: VER
1412
1412
 
1413
- > `const` **VER**: `"8.6.3"` = `'8.6.3'`
1413
+ > `const` **VER**: `"8.6.5"` = `'8.6.5'`
1414
1414
 
1415
1415
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1416
1416
 
@@ -6332,7 +6332,7 @@ Defined in: [lib/db/conn.ts:59](https://github.com/maiyunnet/kebab/blob/master/l
6332
6332
 
6333
6333
  > **beginTransaction**(): `Promise`\<`boolean`\>
6334
6334
 
6335
- Defined in: [lib/db/conn.ts:317](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L317)
6335
+ Defined in: [lib/db/conn.ts:319](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L319)
6336
6336
 
6337
6337
  #### Returns
6338
6338
 
@@ -6344,7 +6344,7 @@ Defined in: [lib/db/conn.ts:317](https://github.com/maiyunnet/kebab/blob/master/
6344
6344
 
6345
6345
  > **commit**(): `Promise`\<`boolean`\>
6346
6346
 
6347
- Defined in: [lib/db/conn.ts:338](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L338)
6347
+ Defined in: [lib/db/conn.ts:340](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L340)
6348
6348
 
6349
6349
  #### Returns
6350
6350
 
@@ -6356,7 +6356,7 @@ Defined in: [lib/db/conn.ts:338](https://github.com/maiyunnet/kebab/blob/master/
6356
6356
 
6357
6357
  > **end**(): `Promise`\<`boolean`\>
6358
6358
 
6359
- Defined in: [lib/db/conn.ts:306](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L306)
6359
+ Defined in: [lib/db/conn.ts:308](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L308)
6360
6360
 
6361
6361
  关闭连接,一般情况下不使用
6362
6362
 
@@ -6370,7 +6370,7 @@ Defined in: [lib/db/conn.ts:306](https://github.com/maiyunnet/kebab/blob/master/
6370
6370
 
6371
6371
  > **execute**(`sql`, `values?`): `Promise`\<[`IPacket`](../../interfaces/IPacket.md)\>
6372
6372
 
6373
- Defined in: [lib/db/conn.ts:233](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L233)
6373
+ Defined in: [lib/db/conn.ts:235](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L235)
6374
6374
 
6375
6375
  执行一条 SQL 并获得影响行数对象 packet
6376
6376
 
@@ -6560,7 +6560,7 @@ Defined in: [lib/db/conn.ts:146](https://github.com/maiyunnet/kebab/blob/master/
6560
6560
 
6561
6561
  > **rollback**(): `Promise`\<`boolean`\>
6562
6562
 
6563
- Defined in: [lib/db/conn.ts:356](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L356)
6563
+ Defined in: [lib/db/conn.ts:358](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L358)
6564
6564
 
6565
6565
  #### Returns
6566
6566
 
@@ -22612,7 +22612,7 @@ Defined in: [sys/mod.ts:637](https://github.com/maiyunnet/kebab/blob/master/sys/
22612
22612
 
22613
22613
  #### Call Signature
22614
22614
 
22615
- > `static` **one**\<`T`\>(`db`, `s`, `opt`): `Promise`\<`false` \| `T` & `Record`\<`string`, `any`\> \| `null`\>
22615
+ > `static` **one**\<`T`\>(`db`, `s`, `opt?`): `Promise`\<`false` \| `T` & `Record`\<`string`, `any`\> \| `null`\>
22616
22616
 
22617
22617
  Defined in: [sys/mod.ts:649](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L649)
22618
22618
 
@@ -22632,7 +22632,7 @@ Defined in: [sys/mod.ts:649](https://github.com/maiyunnet/kebab/blob/master/sys/
22632
22632
 
22633
22633
  `any`
22634
22634
 
22635
- ###### opt
22635
+ ###### opt?
22636
22636
 
22637
22637
  ###### array?
22638
22638
 
@@ -23313,7 +23313,7 @@ Defined in: [sys/mod.ts:33](https://github.com/maiyunnet/kebab/blob/master/sys/m
23313
23313
 
23314
23314
  ### map()
23315
23315
 
23316
- > **map**\<`TU`\>(`allbackfn`): `TU`[]
23316
+ > **map**\<`TU`\>(`callbackfn`): `TU`[]
23317
23317
 
23318
23318
  Defined in: [sys/mod.ts:48](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L48)
23319
23319
 
@@ -23327,7 +23327,7 @@ Defined in: [sys/mod.ts:48](https://github.com/maiyunnet/kebab/blob/master/sys/m
23327
23327
 
23328
23328
  #### Parameters
23329
23329
 
23330
- ##### allbackfn
23330
+ ##### callbackfn
23331
23331
 
23332
23332
  (`value`, `index`) => `TU`
23333
23333
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "8.6.3";
8
+ export declare const VER = "8.6.5";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '8.6.3';
9
+ export const VER = '8.6.5';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/db/conn.js CHANGED
@@ -172,10 +172,12 @@ export class Connection {
172
172
  else {
173
173
  const res = await this._link.execute(sql, values);
174
174
  rtn.rows = res[0];
175
- rtn.fields = res[1].map(item => ({
176
- 'name': item.orgName || item.name,
177
- 'length': item.length ?? -1,
178
- }));
175
+ if (res[1]) {
176
+ rtn.fields = res[1].map(item => ({
177
+ 'name': item.orgName || item.name,
178
+ 'length': item.length ?? -1,
179
+ }));
180
+ }
179
181
  }
180
182
  if (Date.now() - time > 200) {
181
183
  lCore.log({}, '[WARNING][DB][Connection][query] slow sql 200ms: ' + sql, '-warning');
@@ -184,7 +186,7 @@ export class Connection {
184
186
  catch (e) {
185
187
  rtn.error = {
186
188
  'message': e.message,
187
- 'errno': e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, '')),
189
+ 'errno': e.errno ?? (e.code ? Number(e.code.replace(/[a-zA-Z]/g, '')) : 0),
188
190
  };
189
191
  rtn.result = -500;
190
192
  }
@@ -251,7 +253,7 @@ export class Connection {
251
253
  }
252
254
  }
253
255
  catch (e) {
254
- let errno = e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, ''));
256
+ let errno = e.errno ?? (e.code ? Number(e.code.replace(/[a-zA-Z]/g, '')) : 0);
255
257
  if (errno === 23505) {
256
258
  errno = 1062;
257
259
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "8.6.3",
3
+ "version": "8.6.5",
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": [
package/sys/mod.d.ts CHANGED
@@ -24,7 +24,7 @@ export declare class Rows<T extends Mod> implements IRows<T> {
24
24
  /** --- 根据规则筛掉项,predicate 返回 true 代表保留 --- */
25
25
  filter(predicate: (value: T, index: number) => boolean): Rows<T>;
26
26
  /** --- 重塑对象内容为数组 --- */
27
- map<TU>(allbackfn: (value: T, index: number) => TU): TU[];
27
+ map<TU>(callbackfn: (value: T, index: number) => TU): TU[];
28
28
  /** --- for of --- */
29
29
  [Symbol.iterator](): IterableIterator<T>;
30
30
  }
@@ -246,7 +246,7 @@ export default class Mod {
246
246
  'by'?: [string | string[], 'DESC' | 'ASC'];
247
247
  'array': true;
248
248
  }): Promise<false | null | Record<string, any>>;
249
- static one<T extends Mod>(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt: {
249
+ static one<T extends Mod>(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt?: {
250
250
  'ctr'?: sCtr.Ctr;
251
251
  'pre'?: string;
252
252
  'index'?: string | string[];
package/sys/mod.js CHANGED
@@ -30,10 +30,10 @@ export class Rows {
30
30
  return new Rows(this._items.filter(predicate));
31
31
  }
32
32
  /** --- 重塑对象内容为数组 --- */
33
- map(allbackfn) {
33
+ map(callbackfn) {
34
34
  const items = [];
35
35
  for (let i = 0; i < this._items.length; ++i) {
36
- items.push(allbackfn(this._items[i], i));
36
+ items.push(callbackfn(this._items[i], i));
37
37
  }
38
38
  return items;
39
39
  }
@@ -885,7 +885,7 @@ export default class Mod {
885
885
  }
886
886
  let count = 0;
887
887
  for (const item of tr.rows) {
888
- count += item.count;
888
+ count += Number(item.count);
889
889
  }
890
890
  this._total.push(count);
891
891
  if (remain === 0) {
@@ -1049,7 +1049,7 @@ export default class Mod {
1049
1049
  }
1050
1050
  let count = 0;
1051
1051
  for (const item of tr.rows) {
1052
- count += item.count;
1052
+ count += Number(item.count);
1053
1053
  }
1054
1054
  this._total.push(count);
1055
1055
  if (remain === 0) {
@@ -1208,7 +1208,7 @@ export default class Mod {
1208
1208
  }
1209
1209
  let count = 0;
1210
1210
  for (const item of r.rows) {
1211
- count += item.count;
1211
+ count += Number(item.count);
1212
1212
  }
1213
1213
  return count;
1214
1214
  }
@@ -1227,7 +1227,7 @@ export default class Mod {
1227
1227
  }
1228
1228
  let count = 0;
1229
1229
  for (const item of r.rows) {
1230
- count += item.count;
1230
+ count += Number(item.count);
1231
1231
  }
1232
1232
  return count;
1233
1233
  }