baja-lite 1.3.51 → 1.3.53

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 void-soul
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 void-soul
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/code.js CHANGED
@@ -104,7 +104,7 @@ console.log(`
104
104
  splitName // 字符串,event/main/info
105
105
  SplitName // 字符串,event/mainInfo
106
106
 
107
- columns // 数组, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,Type:表示JS类型}
107
+ columns // 数组, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,JSField_name, JSFieldName 分别表示JS的注解,Type:表示JS类型}
108
108
  column_names // 数组, 元素是列名字符串,格式是 sku_id,sku_name
109
109
  ColumnNames // 数组, 元素是列名字符串,格式是 skuId,skuName
110
110
  column_names_join // 字符串,列名join的字符串,格式是 "sku_id,sku_name"
@@ -113,20 +113,20 @@ console.log(`
113
113
  column_names_joinT // 字符串,列名join的字符串,格式是 "t.sku_id,t.sku_name"
114
114
  ColumnNames_joinT // 字符串,列名join的字符串,格式是 "t.skuId,t.skuName"
115
115
 
116
- columns_no_id // 数组, 不含主键, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,Type:表示JS类型}
116
+ columns_no_id // 数组, 不含主键, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,JSField_name, JSFieldName 分别表示JS的注解,Type:表示JS类型}
117
117
  column_names_no_id // 数组, 不含主键, 元素是列名字符串,格式是 sku_id,sku_name
118
118
  ColumnNames_no_id // 数组, 不含主键, 元素是列名字符串,格式是 skuId,skuName
119
119
  column_names_no_id_join // 字符串, 不含主键, 列名join的字符串,格式是 "sku_id,sku_name"
120
120
  ColumnNames_no_id_join // 字符串, 不含主键, 列名join的字符串,格式是 "skuId,skuName"
121
121
 
122
122
 
123
- columns_no_skip // 数组, 不含跳过的列,元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,Type:表示JS类型}
123
+ columns_no_skip // 数组, 不含跳过的列,元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,JSField_name, JSFieldName 分别表示JS的注解,Type:表示JS类型}
124
124
  column_names_no_skip // 数组, 不含跳过的列, 元素是列名字符串,格式是 sku_id,sku_name
125
125
  ColumnNames_no_skip // 数组, 不含跳过的列, 元素是列名字符串,格式是 skuId,skuName
126
126
  column_names_no_skip_join // 数组, 不含跳过的列, 元素是列名字符串,格式是 "sku_id,sku_name"
127
127
  ColumnNames_no_skip_join // 数组, 不含跳过的列, 元素是列名字符串,格式是 "skuId,skuName"
128
128
 
129
- ids // 数组, 只有主键, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,Type:表示JS类型}
129
+ ids // 数组, 只有主键, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,JSField_name, JSFieldName 分别表示JS的注解,Type:表示JS类型}
130
130
  id_names // 数组, 只有主键, 元素是列名字符串,格式是 sku_id,sku_name
131
131
  IdNames // 数组, 只有主键, 元素是列名字符串,格式是 skuId,skuName
132
132
  id_names_join // 字符串,列名join的字符串,格式是 "sku_id,sku_name"
@@ -262,9 +262,11 @@ try {
262
262
  fields.push(`comment: '${r.comment}'`);
263
263
  }
264
264
  r.comment = r.comment ?? '';
265
- r.Field = `@Field({${fields.join(',')}})`;
266
265
  r.Name = r.name.replace(/_(\w)/g, (a, b) => b.toUpperCase());
267
266
  r.NAME = r.Name.replace(/\w/, (v) => v.toUpperCase());
267
+ r.Field = `@Field({${fields.join(',')}})`;
268
+ r.JSField_name = `{${fields.join(',')}, P: '${r.name}'}`;
269
+ r.JSFieldName = `{${fields.join(',')}, P: '${r.Name}'}`;
268
270
  return r;
269
271
  });
270
272
  conn.release();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.3.51",
3
+ "version": "1.3.53",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/baja-lite",
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  "dependencies": {
38
38
  "@msgpack/msgpack": "3.1.2",
39
39
  "@types/request-promise": "4.1.51",
40
- "axios": "1.9.0",
41
- "baja-lite-field": "1.3.39",
40
+ "axios": "1.10.0",
41
+ "baja-lite-field": "1.3.40",
42
42
  "decimal.js": "10.5.0",
43
43
  "html-parse-stringify": "3.0.1",
44
44
  "iterare": "1.2.1",
@@ -49,7 +49,7 @@
49
49
  "reflect-metadata": "0.2.2",
50
50
  "request": "2.88.2",
51
51
  "request-promise": "4.2.6",
52
- "sql-formatter": "15.6.2",
52
+ "sql-formatter": "15.6.4",
53
53
  "sqlstring": "2.3.3",
54
54
  "tslib": "2.8.1"
55
55
  },
@@ -57,15 +57,14 @@
57
57
  "@types/better-sqlite3": "7.6.13",
58
58
  "@types/lodash.get": "4.4.9",
59
59
  "@types/mustache": "4.2.6",
60
- "@types/node": "22.15.21",
61
- "@types/pg-pool": "2.0.6",
60
+ "@types/node": "24.0.2",
62
61
  "@types/shelljs": "0.8.16",
63
62
  "@types/sqlstring": "2.3.2",
64
- "@typescript-eslint/eslint-plugin": "8.32.1",
65
- "@typescript-eslint/parser": "8.32.1",
63
+ "@typescript-eslint/eslint-plugin": "8.34.0",
64
+ "@typescript-eslint/parser": "8.34.0",
66
65
  "better-sqlite3": "11.10.0",
67
66
  "ioredis": "5.6.1",
68
- "mongodb": "6.16.0",
67
+ "mongodb": "6.17.0",
69
68
  "mysql2": "3.14.1",
70
69
  "pg": "8.16.0",
71
70
  "pg-pool": "3.10.0",
package/sql.js CHANGED
@@ -1771,7 +1771,7 @@ function P(skipConn = false) {
1771
1771
  }
1772
1772
  try {
1773
1773
  const result = fn.call(this, ...args);
1774
- logger.info(`${propertyKey}:${option.tableName}:use ${+new Date() - startTime}ms`);
1774
+ logger.info(`${propertyKey}:${option.sqlId ?? option.tableName}:use ${+new Date() - startTime}ms`);
1775
1775
  return result;
1776
1776
  }
1777
1777
  catch (error) {
@@ -1779,7 +1779,7 @@ function P(skipConn = false) {
1779
1779
  console.error(`service ${propertyKey} have an error:${error}`);
1780
1780
  }
1781
1781
  catch (error) {
1782
- console.error(`${option.tableName} service ${propertyKey} have an error:${error}`);
1782
+ console.error(`${option.sqlId ?? option.tableName} service ${propertyKey} have an error:${error}`);
1783
1783
  }
1784
1784
  throw error;
1785
1785
  }
@@ -1814,12 +1814,12 @@ function P(skipConn = false) {
1814
1814
  }
1815
1815
  try {
1816
1816
  const result = await fn.call(this, ...args);
1817
- logger.info(`${propertyKey}:${option.tableName}:use ${+new Date() - startTime}ms`);
1817
+ logger.info(`${propertyKey}:${option.sqlId ?? option.tableName}:use ${+new Date() - startTime}ms`);
1818
1818
  resolve(result);
1819
1819
  }
1820
1820
  catch (error) {
1821
1821
  // console.error(`service ${propertyKey} have an error:${error}, it's argumens: ${JSON.stringify(args.filter(i => typeof i !== 'object' || (typeof i === 'object' && !i.insert)))}`)
1822
- console.error(`${option.tableName} service ${propertyKey} have an error:${error}`);
1822
+ console.error(`${option.sqlId ?? option.tableName} service ${propertyKey} have an error:${error}`);
1823
1823
  reject(error);
1824
1824
  }
1825
1825
  finally {
@@ -1845,12 +1845,12 @@ function P(skipConn = false) {
1845
1845
  needRealseConn = false;
1846
1846
  }
1847
1847
  const result = await fn.call(this, ...args);
1848
- logger.info(`${propertyKey}:${option.tableName}:use ${+new Date() - startTime}ms`);
1848
+ logger.info(`${propertyKey}:${option.sqlId ?? option.tableName}:use ${+new Date() - startTime}ms`);
1849
1849
  resolve(result);
1850
1850
  }
1851
1851
  catch (error) {
1852
1852
  // console.error(`service ${propertyKey} have an error:${error}, it's argumens: ${JSON.stringify(args.filter(i => typeof i !== 'object' || (typeof i === 'object' && !i.insert)))}`)
1853
- console.error(`${option.tableName} service ${propertyKey} have an error:${error}`);
1853
+ console.error(`${option.sqlId ?? option.tableName} service ${propertyKey} have an error:${error}`);
1854
1854
  reject(error);
1855
1855
  }
1856
1856
  finally {
@@ -1876,12 +1876,12 @@ function P(skipConn = false) {
1876
1876
  needRealseConn = false;
1877
1877
  }
1878
1878
  const result = await fn.call(this, ...args);
1879
- logger.info(`${propertyKey}:${option.tableName}:use ${+new Date() - startTime}ms`);
1879
+ logger.info(`${propertyKey}:${option.sqlId ?? option.tableName}:use ${+new Date() - startTime}ms`);
1880
1880
  resolve(result);
1881
1881
  }
1882
1882
  catch (error) {
1883
1883
  //console.error(`service ${propertyKey} have an error:${error}, it's argumens: ${JSON.stringify(args.filter(i => typeof i !== 'object' || (typeof i === 'object' && !i.insert)))}`)
1884
- console.error(`${option.tableName} service ${propertyKey} have an error:${error}`);
1884
+ console.error(`${option.sqlId ?? option.tableName} service ${propertyKey} have an error:${error}`);
1885
1885
  reject(error);
1886
1886
  }
1887
1887
  finally {
package/sqlite.js CHANGED
@@ -24,10 +24,10 @@ export class SqliteRemoteClass {
24
24
  return encode({ affectedRows: changes, insertId: lastInsertRowid ? BigInt(lastInsertRowid) : 0n }, { extensionCodec });
25
25
  }
26
26
  catch (error) {
27
- logger.error(`
28
- error: ${error},
29
- sql: ${sql},
30
- params: ${params}
27
+ logger.error(`
28
+ error: ${error},
29
+ sql: ${sql},
30
+ params: ${params}
31
31
  `);
32
32
  throw error;
33
33
  }
@@ -47,10 +47,10 @@ export class SqliteRemoteClass {
47
47
  return encode(this.dbList[dbName].prepare(sql).pluck().get(params ?? {}), { extensionCodec });
48
48
  }
49
49
  catch (error) {
50
- logger.error(`
51
- error: ${error},
52
- sql: ${sql},
53
- params: ${params}
50
+ logger.error(`
51
+ error: ${error},
52
+ sql: ${sql},
53
+ params: ${params}
54
54
  `);
55
55
  throw error;
56
56
  }
@@ -65,10 +65,10 @@ export class SqliteRemoteClass {
65
65
  return encode(this.dbList[dbName].prepare(sql).get(params ?? {}), { extensionCodec });
66
66
  }
67
67
  catch (error) {
68
- logger.error(`
69
- error: ${error},
70
- sql: ${sql},
71
- params: ${params}
68
+ logger.error(`
69
+ error: ${error},
70
+ sql: ${sql},
71
+ params: ${params}
72
72
  `);
73
73
  throw error;
74
74
  }
@@ -87,10 +87,10 @@ export class SqliteRemoteClass {
87
87
  return encode(this.dbList[dbName].prepare(sql).raw().all(params ?? {}), { extensionCodec });
88
88
  }
89
89
  catch (error) {
90
- logger.error(`
91
- error: ${error},
92
- sql: ${sql},
93
- params: ${params}
90
+ logger.error(`
91
+ error: ${error},
92
+ sql: ${sql},
93
+ params: ${params}
94
94
  `);
95
95
  throw error;
96
96
  }
@@ -109,10 +109,10 @@ export class SqliteRemoteClass {
109
109
  return encode(this.dbList[dbName].prepare(sql).all(params ?? {}), { extensionCodec });
110
110
  }
111
111
  catch (error) {
112
- logger.error(`
113
- error: ${error},
114
- sql: ${sql},
115
- params: ${params}
112
+ logger.error(`
113
+ error: ${error},
114
+ sql: ${sql},
115
+ params: ${params}
116
116
  `);
117
117
  throw error;
118
118
  }
@@ -121,15 +121,15 @@ export class SqliteRemoteClass {
121
121
  if (!this.dbList[dbName]) {
122
122
  this.dbList[dbName] = new this.BetterSqlite3(this.getStoreName(dbName), { fileMustExist: false });
123
123
  this.dbList[dbName].pragma('journal_mode = WAL');
124
- this.dbList[dbName].exec(`
125
- CREATE TABLE IF NOT EXISTS DUAL ( ______id INTEGER NOT NULL, PRIMARY KEY ( ______id ));
126
- DELETE FROM DUAL;
127
- INSERT INTO DUAL (______id ) VALUES ( 1 );
128
- CREATE TABLE IF NOT EXISTS TABLE_VERSION (
129
- ______tableName text NOT NULL,
130
- ______version text NOT NULL,
131
- PRIMARY KEY ( ______tableName )
132
- );
124
+ this.dbList[dbName].exec(`
125
+ CREATE TABLE IF NOT EXISTS DUAL ( ______id INTEGER NOT NULL, PRIMARY KEY ( ______id ));
126
+ DELETE FROM DUAL;
127
+ INSERT INTO DUAL (______id ) VALUES ( 1 );
128
+ CREATE TABLE IF NOT EXISTS TABLE_VERSION (
129
+ ______tableName text NOT NULL,
130
+ ______version text NOT NULL,
131
+ PRIMARY KEY ( ______tableName )
132
+ );
133
133
  `);
134
134
  }
135
135
  }
package/test-xml.js CHANGED
@@ -1,70 +1,70 @@
1
1
  import HTML from 'html-parse-stringify';
2
- console.log((HTML.parse(`
3
- <sql id="reportField">
4
- a.left_e_foul leftEFoul,
5
- a.right_e_foul rightEFoul,
6
- a.left_em_foul leftEmFoul,
7
- a.right_em_foul rightEmFoul,
8
- a.left_s_foul leftSFoul,
9
- a.right_s_foul rightSFoul,
10
- a.left_sb_foul leftSbFoul,
11
- a.right_sb_foul rightSbFoul,
12
- a.left_p_foul leftPFoul,
13
- a.right_p_foul rightPFoul,
14
- a.left_attack_goal leftAttackGoal,
15
- a.right_attack_goal rightAttackGoal,
16
- a.left_point_goal leftPointGoal,
17
- a.right_point_goal rightPointGoal,
18
- a.left_over_time_goal leftOverTimeGoal,
19
- a.right_over_time_goal rightOverTimeGoal,
20
- a.left_normal_goal leftNormalGoal,
21
- a.right_normal_goal rightNormalGoal,
22
- a.left_own_goal leftOwnGoal,
23
- a.right_own_goal rightOwnGoal,
24
- a.left_time_out leftTimeOut,
25
- a.right_time_out rightTimeOut,
26
- a.left_coach_y_card leftCoachYCard,
27
- a.right_coach_y_card rightCoachYCard,
28
- a.left_player_r_card leftPlayerRCard,
29
- a.right_player_r_card rightPlayerRCard,
30
- a.left_jump_ball leftJumpBall,
31
- a.right_jump_ball rightJumpBall
32
- </sql>
33
- <select id="matchReport" resultType="org.jeecg.modules.event.entity.EventMatchReport">
34
- select
35
- b.event_name eventName,
36
- a.match_id matchId,
37
- a.event_times eventTimes,
38
- a.team_left_id teamLeftId,
39
- a.team_RIGHt_id teamRightId,
40
- a.team_left_name teamLeftName,
41
- a.team_right_name teamRightName,
42
- a.team_left_image teamLeftImage,
43
- a.team_right_image teamRightImage,
44
- <include refid="reportField" />
45
- <if test="matchInfo.reportType!=null and matchInfo.reportType!=''">
46
- from view_match_report a
47
- </if>
48
- <if test="matchInfo.reportType==null or matchInfo.reportType==''">
49
- from event_match_report a
50
- </if>
51
- left join event_main_info b on a.event_id = b.id
52
- <where>
53
- <if test="matchInfo.id!=null and matchInfo.id!=''">
54
- and a.match_id = #{matchInfo.id}
55
- </if>
56
- <if test="matchInfo.eventId!=null and matchInfo.eventId!=''">
57
- and a.event_id = #{matchInfo.eventId}
58
- </if>
59
- <if test="matchInfo.teamLeftId!=null and matchInfo.teamLeftId!=''">
60
- and (a.team_left_id = #{matchInfo.teamLeftId} OR a.team_right_id = #{matchInfo.teamLeftId})
61
- </if>
62
- <if test="dataIdList!=null">
63
- and a.event_id in
64
- <foreach collection="dataIdList" item="item" open="(" close=")" separator=",">
65
- #{item}
66
- </foreach>
67
- </if>
68
- </where>
69
- </select>
2
+ console.log((HTML.parse(`
3
+ <sql id="reportField">
4
+ a.left_e_foul leftEFoul,
5
+ a.right_e_foul rightEFoul,
6
+ a.left_em_foul leftEmFoul,
7
+ a.right_em_foul rightEmFoul,
8
+ a.left_s_foul leftSFoul,
9
+ a.right_s_foul rightSFoul,
10
+ a.left_sb_foul leftSbFoul,
11
+ a.right_sb_foul rightSbFoul,
12
+ a.left_p_foul leftPFoul,
13
+ a.right_p_foul rightPFoul,
14
+ a.left_attack_goal leftAttackGoal,
15
+ a.right_attack_goal rightAttackGoal,
16
+ a.left_point_goal leftPointGoal,
17
+ a.right_point_goal rightPointGoal,
18
+ a.left_over_time_goal leftOverTimeGoal,
19
+ a.right_over_time_goal rightOverTimeGoal,
20
+ a.left_normal_goal leftNormalGoal,
21
+ a.right_normal_goal rightNormalGoal,
22
+ a.left_own_goal leftOwnGoal,
23
+ a.right_own_goal rightOwnGoal,
24
+ a.left_time_out leftTimeOut,
25
+ a.right_time_out rightTimeOut,
26
+ a.left_coach_y_card leftCoachYCard,
27
+ a.right_coach_y_card rightCoachYCard,
28
+ a.left_player_r_card leftPlayerRCard,
29
+ a.right_player_r_card rightPlayerRCard,
30
+ a.left_jump_ball leftJumpBall,
31
+ a.right_jump_ball rightJumpBall
32
+ </sql>
33
+ <select id="matchReport" resultType="org.jeecg.modules.event.entity.EventMatchReport">
34
+ select
35
+ b.event_name eventName,
36
+ a.match_id matchId,
37
+ a.event_times eventTimes,
38
+ a.team_left_id teamLeftId,
39
+ a.team_RIGHt_id teamRightId,
40
+ a.team_left_name teamLeftName,
41
+ a.team_right_name teamRightName,
42
+ a.team_left_image teamLeftImage,
43
+ a.team_right_image teamRightImage,
44
+ <include refid="reportField" />
45
+ <if test="matchInfo.reportType!=null and matchInfo.reportType!=''">
46
+ from view_match_report a
47
+ </if>
48
+ <if test="matchInfo.reportType==null or matchInfo.reportType==''">
49
+ from event_match_report a
50
+ </if>
51
+ left join event_main_info b on a.event_id = b.id
52
+ <where>
53
+ <if test="matchInfo.id!=null and matchInfo.id!=''">
54
+ and a.match_id = #{matchInfo.id}
55
+ </if>
56
+ <if test="matchInfo.eventId!=null and matchInfo.eventId!=''">
57
+ and a.event_id = #{matchInfo.eventId}
58
+ </if>
59
+ <if test="matchInfo.teamLeftId!=null and matchInfo.teamLeftId!=''">
60
+ and (a.team_left_id = #{matchInfo.teamLeftId} OR a.team_right_id = #{matchInfo.teamLeftId})
61
+ </if>
62
+ <if test="dataIdList!=null">
63
+ and a.event_id in
64
+ <foreach collection="dataIdList" item="item" open="(" close=")" separator=",">
65
+ #{item}
66
+ </foreach>
67
+ </if>
68
+ </where>
69
+ </select>
70
70
  >`)));