baja-lite 1.6.4 → 1.6.6

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.
Files changed (73) hide show
  1. package/boot-remote.d.ts +2 -0
  2. package/{src/boot-remote.ts → boot-remote.js} +66 -64
  3. package/boot.d.ts +2 -0
  4. package/{src/boot.ts → boot.js} +166 -170
  5. package/code.d.ts +2 -0
  6. package/{src/code.ts → code.js} +405 -414
  7. package/convert-xml.d.ts +10 -0
  8. package/{src/convert-xml.ts → convert-xml.js} +410 -460
  9. package/error.d.ts +5 -0
  10. package/error.js +13 -0
  11. package/event.d.ts +10 -0
  12. package/event.js +38 -0
  13. package/fn.d.ts +128 -0
  14. package/fn.js +172 -0
  15. package/{src/index.ts → index.d.ts} +10 -11
  16. package/index.js +10 -0
  17. package/math.d.ts +83 -0
  18. package/math.js +451 -0
  19. package/object.d.ts +126 -0
  20. package/object.js +321 -0
  21. package/package.json +13 -13
  22. package/snowflake.d.ts +12 -0
  23. package/{src/snowflake.ts → snowflake.js} +108 -127
  24. package/sql.d.ts +2151 -0
  25. package/sql.js +5371 -0
  26. package/sqlite.d.ts +32 -0
  27. package/{src/sqlite.ts → sqlite.js} +156 -157
  28. package/string.d.ts +17 -0
  29. package/string.js +105 -0
  30. package/test-mysql.d.ts +2 -0
  31. package/test-mysql.js +114 -0
  32. package/test-postgresql.d.ts +2 -0
  33. package/{src/test-postgresql.ts → test-postgresql.js} +91 -80
  34. package/test-sqlite.d.ts +1 -0
  35. package/{src/test-sqlite.ts → test-sqlite.js} +90 -80
  36. package/test-xml.d.ts +1 -0
  37. package/{src/test-xml.ts → test-xml.js} +2 -2
  38. package/test.d.ts +1 -0
  39. package/{src/test.ts → test.js} +2 -3
  40. package/wx/base.d.ts +11 -0
  41. package/wx/base.js +78 -0
  42. package/wx/mini.d.ts +52 -0
  43. package/wx/mini.js +112 -0
  44. package/wx/organ.d.ts +65 -0
  45. package/wx/organ.js +171 -0
  46. package/{src/wx/types.ts → wx/types.d.ts} +560 -549
  47. package/wx/types.js +1 -0
  48. package/{src/wx.ts → wx.d.ts} +3 -3
  49. package/wx.js +3 -0
  50. package/.eslintignore +0 -7
  51. package/.eslintrc.cjs +0 -89
  52. package/.prettierrc +0 -7
  53. package/.vscode/settings.json +0 -9
  54. package/ci.js +0 -33
  55. package/package-cjs.json +0 -17
  56. package/pnpm-lock.yaml +0 -2840
  57. package/pnpm-workspace.yaml +0 -2
  58. package/src/error.ts +0 -11
  59. package/src/event.ts +0 -34
  60. package/src/fn.ts +0 -295
  61. package/src/math.ts +0 -405
  62. package/src/object.ts +0 -342
  63. package/src/sql.ts +0 -5529
  64. package/src/string.ts +0 -111
  65. package/src/test-mysql.ts +0 -148
  66. package/src/wx/base.ts +0 -77
  67. package/src/wx/mini.ts +0 -147
  68. package/src/wx/organ.ts +0 -290
  69. package/tsconfig.cjs.json +0 -42
  70. package/tsconfig.json +0 -44
  71. package/xml/event-report.xml +0 -13
  72. package/yarn.lock +0 -1977
  73. /package/{Readme.md → README.md} +0 -0
package/src/wx/organ.ts DELETED
@@ -1,290 +0,0 @@
1
- import { BaseWx } from './base.js';
2
- import { WxDepartment, WxOrganConfig, WxOrganFile, WxOrganImage, WxOrganMarkDown, WxOrganMini, WxOrganMpNews, WxOrganNews, WxOrganTaskCard, WxOrganText, WxOrganTextCard, WxOrganUser, WxOrganUserSimply, WxOrganVideo, WxOrganVoice } from './types.js';
3
- export class WxOrgan extends BaseWx {
4
- protected name = 'wxOrgan';
5
- private config: WxOrganConfig;
6
- private miniMessCache: {[name: string]: Array<{appid: string; page: string}>}; // 小程序消息缓存
7
- private messCache: {[name: string]: Array<{agentid: number; msgtype: string; safe?: number}>}; // 非小程序消息缓存
8
- // private aesKey: Buffer | undefined;
9
- // private iv: Buffer | undefined;
10
- constructor (config: WxOrganConfig) {
11
- super();
12
- this.config = config;
13
- this.tokenUrl = `https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${ this.config.corpid }&corpsecret=${ this.config.corpsecret }`;
14
- this.miniMessCache = {};
15
- this.messCache = {};
16
- // if (this.config.msHook) {
17
- // this.aesKey = Buffer.from(this.config.encodingAESKey + '=', 'base64');
18
- // this.iv = this.aesKey.slice(0, 16);
19
- // }
20
- if (this.config.miniMessages) {
21
- for (const item of this.config.miniMessages) {
22
- if (!this.miniMessCache[item.name]) {
23
- this.miniMessCache[item.name] = [];
24
- }
25
- this.miniMessCache[item.name]!.push({
26
- appid: this.config.appid!,
27
- page: `pages/${ item.model }/${ item.page }/${ item.page }`
28
- });
29
- }
30
- }
31
- if (this.config.messages) {
32
- for (const item of this.config.messages) {
33
- if (!this.messCache[item.name]) {
34
- this.messCache[item.name] = [];
35
- }
36
- this.messCache[item.name]!.push({
37
- agentid: this.config.agentid!,
38
- ...item
39
- });
40
- }
41
- }
42
-
43
- this.mock = this.config.mock === true;
44
- }
45
- async createDepartment(param: WxDepartment): Promise<number> {
46
- const data = await this.fetch(
47
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token=${ token }`,
48
- 'post',
49
- param
50
- );
51
- return data.id;
52
- }
53
- async updateDepartment(param: WxDepartment): Promise<void> {
54
- await this.fetch(
55
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/department/update?access_token=${ token }`,
56
- 'post',
57
- param
58
- );
59
- }
60
- async deleteDepartment(id: number): Promise<void> {
61
- await this.fetch(
62
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/department/delete?access_token=${ token }`,
63
- 'get',
64
- {id}
65
- );
66
- }
67
- async getDepartmentList(id?: number): Promise<WxDepartment[]> {
68
- const data = await this.fetch(
69
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=${ token }`,
70
- 'get',
71
- {id}
72
- );
73
- return data.department;
74
- }
75
- async createUser(param: WxOrganUser): Promise<string | number> {
76
- const data = await this.fetch(
77
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/create?access_token=${ token }`,
78
- 'post',
79
- param
80
- );
81
- return data.id;
82
- }
83
- async getUser(userid: number | string): Promise<WxOrganUser> {
84
- return await this.fetch(
85
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=${ token }`,
86
- 'get',
87
- {userid}
88
- );
89
- }
90
- async updateUser(param: WxOrganUser): Promise<void> {
91
- await this.fetch(
92
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token=${ token }`,
93
- 'post',
94
- param
95
- );
96
- }
97
- async deleteUser(userid: number | string): Promise<void> {
98
- await this.fetch(
99
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/delete?access_token=${ token }`,
100
- 'get',
101
- {userid}
102
- );
103
- }
104
- async batchDeleteUser(useridlist: Array<number | string>): Promise<void> {
105
- await this.fetch(
106
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/batchdelete?access_token=${ token }`,
107
- 'post',
108
- {useridlist}
109
- );
110
- }
111
- async getDeptUserSimply(department_id: number, fetch_child: boolean): Promise<WxOrganUserSimply[]> {
112
- const data = await this.fetch(
113
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token=${ token }`,
114
- 'get',
115
- {department_id, fetch_child: fetch_child ? 'FETCH_CHILD' : undefined}
116
- );
117
- return data.userlist;
118
- }
119
- async getDeptUser(department_id: number, fetch_child: boolean): Promise<WxOrganUser[]> {
120
- const data = await this.fetch(
121
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=${ token }`,
122
- 'get',
123
- {department_id, fetch_child: fetch_child ? 'FETCH_CHILD' : undefined}
124
- );
125
- return data.userlist;
126
- }
127
- async userid2openid(userid: number | string): Promise<string> {
128
- const data = await this.fetch(
129
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid?access_token=${ token }`,
130
- 'post',
131
- {userid}
132
- );
133
- return data.openid;
134
- }
135
- async openid2userid(openid: string): Promise<number | string> {
136
- const data = await this.fetch(
137
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_userid?access_token=${ token }`,
138
- 'post',
139
- {openid}
140
- );
141
- return data.userid;
142
- }
143
- async authsucc(userid: string): Promise<void> {
144
- await this.fetch(
145
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/user/authsucc?access_token=${ token }`,
146
- 'get',
147
- {userid}
148
- );
149
- }
150
- async inviteUsers({user, party, tag}: {user?: Array<number | string>; party?: number[]; tag?: number[]}): Promise<{invaliduser?: Array<number | string>; invalidparty?: number[]; invalidtag?: number[]}> {
151
- const data = await this.fetch(
152
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/batch/invite?access_token=${ token }`,
153
- 'post',
154
- {user, party, tag}
155
- );
156
- return {
157
- invaliduser: data.invaliduser,
158
- invalidparty: data.invalidparty,
159
- invalidtag: data.invalidtag
160
- };
161
- }
162
- async createTag(tagname: string, tagid: number): Promise<number> {
163
- const data = await this.fetch(
164
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/create?access_token=${ token }`,
165
- 'post',
166
- {tagname, tagid}
167
- );
168
- return data.id;
169
- }
170
- async updateTag(tagname: string, tagid: number): Promise<void> {
171
- await this.fetch(
172
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/update?access_token=${ token }`,
173
- 'post',
174
- {tagname, tagid}
175
- );
176
- }
177
- async deleteTag(tagid: number): Promise<void> {
178
- await this.fetch(
179
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/delete?access_token=${ token }`,
180
- 'get',
181
- {tagid}
182
- );
183
- }
184
- async createTagUser(tagid: number, userlist: Array<string | number>): Promise<void> {
185
- await this.fetch(
186
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers?access_token=${ token }`,
187
- 'post',
188
- {tagid, userlist}
189
- );
190
- }
191
- async deleteTagUser(tagid: number, userlist: Array<string | number>): Promise<void> {
192
- await this.fetch(
193
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/deltagusers?access_token=${ token }`,
194
- 'post',
195
- {tagid, userlist}
196
- );
197
- }
198
- async getTagUser(tagid: number): Promise<{tagname: string; userlist: Array<{userid: string | number; name: string}>; partylist: number[]}> {
199
- const data = await this.fetch(
200
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/get?access_token=${ token }`,
201
- 'get',
202
- {tagid}
203
- );
204
- return data;
205
- }
206
- async getTag(): Promise<Array<{tagid: number; tagname: string}>> {
207
- const data = await this.fetch(
208
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/tag/list?access_token=${ token }`,
209
- 'get',
210
- {}
211
- );
212
- return data.taglist;
213
- }
214
- async updateTaskCard(userids: Array<string | number>, task_id: string, clicked_key: string): Promise<void> {
215
- await this.fetch(
216
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/message/update_taskcard?access_token=${ token }`,
217
- 'post',
218
- {userids, task_id, clicked_key}
219
- );
220
- }
221
- async sendMiniMs(
222
- {touser, toparty, totag, name, scene, ms}: {
223
- touser?: Array<number | string>;
224
- toparty?: number[];
225
- totag?: number[];
226
- name: string;
227
- scene?: string;
228
- ms: WxOrganMini;
229
- }): Promise<void> {
230
- const touser_ = touser ? touser.join('|') : undefined;
231
- const toparty_ = toparty ? toparty.join('|') : undefined;
232
- const totag_ = totag ? totag.join('|') : undefined;
233
- if (scene) {
234
- scene = `?${ scene }`;
235
- } else {
236
- scene = '';
237
- }
238
- if (ms.content_item) {
239
- for (const [key, value] of Object.entries(ms.content_item)) {
240
- ms.content_item[key] = value ?? '';
241
- }
242
- }
243
-
244
- const temps = this.miniMessCache[name];
245
- for (const item of temps!) {
246
- await this.fetch(
247
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${ token }`,
248
- 'post',
249
- {
250
- touser: touser_,
251
- toparty: toparty_,
252
- totag: totag_,
253
- 'msgtype': 'miniprogram_notice',
254
- miniprogram_notice: {
255
- ...item,
256
- page: `${ item.page }${ scene }`,
257
- ...ms
258
- },
259
- enable_id_trans: 0
260
- }
261
- );
262
- }
263
- }
264
- async sendMs(
265
- {touser, toparty, totag, name, ms}: {
266
- touser?: Array<number | string>;
267
- toparty?: number[];
268
- totag?: number[];
269
- name: string;
270
- ms: WxOrganText | WxOrganImage | WxOrganVoice | WxOrganVideo | WxOrganFile | WxOrganTextCard | WxOrganNews | WxOrganMpNews | WxOrganMarkDown | WxOrganTaskCard;
271
- }): Promise<void> {
272
- const touser_ = touser ? touser.join('|') : undefined;
273
- const toparty_ = toparty ? toparty.join('|') : undefined;
274
- const totag_ = totag ? totag.join('|') : undefined;
275
- const temps = this.messCache[name];
276
- for (const item of temps!) {
277
- await this.fetch(
278
- (token: string) => `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${ token }`,
279
- 'post',
280
- {
281
- touser: touser_,
282
- toparty: toparty_,
283
- totag: totag_,
284
- ...item,
285
- [item.msgtype]: ms,
286
- enable_id_trans: 0
287
- });
288
- }
289
- }
290
- }
package/tsconfig.cjs.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "include": [
3
- "src/**/*"
4
- ],
5
- "exclude": [
6
- "node_modules",
7
- "dist",
8
- "test/**/*",
9
- "*.spec.ts"
10
- ],
11
- "compilerOptions": {
12
- "target": "ES2020",
13
- "baseUrl": "./src",
14
- "rootDir": "./src",
15
- "sourceMap": false,
16
- "moduleResolution": "node",
17
- "allowJs": false,
18
- "strict": true,
19
- "declaration": true,
20
- "noUnusedLocals": true,
21
- "emitDecoratorMetadata": true,
22
- "strictNullChecks": true,
23
- "composite": true,
24
- "experimentalDecorators": true,
25
- "resolveJsonModule": true,
26
- "allowSyntheticDefaultImports": true,
27
- "noPropertyAccessFromIndexSignature": true,
28
- "useUnknownInCatchVariables": false,
29
- "noUncheckedIndexedAccess": true,
30
- "noImplicitAny": false,
31
- "esModuleInterop": true,
32
- "removeComments": false,
33
- "types": [],
34
- "paths": {
35
- "@element-plus/*": [
36
- "packages/*"
37
- ]
38
- },
39
- "module": "commonjs",
40
- "outDir": "./dist-cjs"
41
- }
42
- }
package/tsconfig.json DELETED
@@ -1,44 +0,0 @@
1
- {
2
- "include": [
3
- "src/**/*"
4
- ],
5
- "exclude": [
6
- "node_modules",
7
- "dist",
8
- "test/**/*",
9
- "*.spec.ts"
10
- ],
11
- "compilerOptions": {
12
- "target": "ES2020",
13
- "module": "esnext",
14
- "baseUrl": "./src",
15
- "rootDir": "./src",
16
- "sourceMap": false,
17
- "moduleResolution": "node",
18
- "allowJs": false,
19
- "strict": true,
20
- "declaration": true,
21
- "noUnusedLocals": true,
22
- "emitDecoratorMetadata": true,
23
- "strictNullChecks": true,
24
- "composite": true,
25
- "experimentalDecorators": true,
26
- "resolveJsonModule": true,
27
- "allowSyntheticDefaultImports": true,
28
- "noPropertyAccessFromIndexSignature": true,
29
- "useUnknownInCatchVariables": false,
30
- "noUncheckedIndexedAccess": true,
31
- "noImplicitAny": false,
32
- "esModuleInterop": true,
33
- "removeComments": false,
34
- "paths": {
35
- "@element-plus/*": [
36
- "packages/*"
37
- ]
38
- },
39
- "lib": ["ESNext"],
40
- "types": ["node"],
41
- "skipLibCheck": true,
42
- "outDir": "./dist"
43
- }
44
- }
@@ -1,13 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
- <mapper namespace="org.jeecg.modules.system.mapper.SysUserDataPermissionMapper">
4
- <insert id="addDataPermissionByDataId">
5
- insert into sys_user_data_permission (eventh_user_id,data_id,user_id,data_type)
6
- <foreach collection="dataPermission.userIds" open="(" close=")" item="userId" separator="),(" >
7
- UUID_SHORT(),#{dataPermission.dataId},#{userId},#{dataPermission.dataType}
8
- </foreach>
9
- </insert>
10
- <select id="getDataPermissionByDataId" resultType="java.lang.String">
11
- select user_id from sys_user_data_permission where #{dataId}
12
- </select>
13
- </mapper>