baja-lite 1.3.27 → 1.3.28
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/boot-remote.d.ts +2 -0
- package/{src/boot-remote.ts → boot-remote.js} +6 -7
- package/boot.d.ts +2 -0
- package/{src/boot.ts → boot.js} +31 -38
- package/code.d.ts +2 -0
- package/{src/code.ts → code.js} +71 -66
- package/convert-xml.d.ts +10 -0
- package/{src/convert-xml.ts → convert-xml.js} +105 -155
- package/enum.d.ts +18 -0
- package/enum.js +59 -0
- package/error.d.ts +5 -0
- package/error.js +13 -0
- package/fn.d.ts +128 -0
- package/fn.js +172 -0
- package/{src/index.ts → index.d.ts} +11 -12
- package/index.js +11 -0
- package/list.d.ts +10 -0
- package/{src/list.ts → list.js} +8 -9
- package/math.d.ts +83 -0
- package/math.js +451 -0
- package/object.d.ts +83 -0
- package/object.js +221 -0
- package/package.json +1 -1
- package/snowflake.d.ts +12 -0
- package/{src/snowflake.ts → snowflake.js} +33 -52
- package/sql.d.ts +1798 -0
- package/sql.js +4802 -0
- package/sqlite.d.ts +32 -0
- package/{src/sqlite.ts → sqlite.js} +53 -52
- package/string.d.ts +17 -0
- package/string.js +105 -0
- package/test-mysql.d.ts +2 -0
- package/test-mysql.js +109 -0
- package/test-postgresql.d.ts +2 -0
- package/{src/test-postgresql.ts → test-postgresql.js} +91 -80
- package/test-sqlite.d.ts +1 -0
- package/{src/test-sqlite.ts → test-sqlite.js} +90 -80
- package/test-xml.d.ts +1 -0
- package/{src/test-xml.ts → test-xml.js} +1 -1
- package/test.d.ts +1 -0
- package/{src/test.ts → test.js} +2 -3
- package/wx/base.d.ts +11 -0
- package/wx/base.js +78 -0
- package/wx/mini.d.ts +52 -0
- package/wx/mini.js +112 -0
- package/wx/organ.d.ts +65 -0
- package/wx/organ.js +171 -0
- package/{src/wx/types.ts → wx/types.d.ts} +21 -10
- package/wx/types.js +1 -0
- package/wx.js +3 -0
- package/.eslintignore +0 -7
- package/.eslintrc.cjs +0 -89
- package/.prettierrc +0 -4
- package/.vscode/settings.json +0 -8
- package/ci.js +0 -29
- package/package-cjs.json +0 -17
- package/src/enum.ts +0 -71
- package/src/error.ts +0 -11
- package/src/fn.ts +0 -295
- package/src/math.ts +0 -405
- package/src/object.ts +0 -247
- package/src/sql.ts +0 -5023
- package/src/string.ts +0 -111
- package/src/test-mysql.ts +0 -144
- package/src/wx/base.ts +0 -76
- package/src/wx/mini.ts +0 -147
- package/src/wx/organ.ts +0 -290
- package/tsconfig.cjs.json +0 -42
- package/tsconfig.json +0 -44
- package/tsconfig.tsbuildinfo +0 -1
- package/xml/event-report.xml +0 -13
- package/yarn.lock +0 -1757
- /package/{Readme.md → README.md} +0 -0
- /package/{src/wx.ts → wx.d.ts} +0 -0
package/wx/organ.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { BaseWx } from './base.js';
|
|
2
|
+
export class WxOrgan extends BaseWx {
|
|
3
|
+
// private aesKey: Buffer | undefined;
|
|
4
|
+
// private iv: Buffer | undefined;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super();
|
|
7
|
+
this.name = 'wxOrgan';
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.tokenUrl = `https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${this.config.corpid}&corpsecret=${this.config.corpsecret}`;
|
|
10
|
+
this.miniMessCache = {};
|
|
11
|
+
this.messCache = {};
|
|
12
|
+
// if (this.config.msHook) {
|
|
13
|
+
// this.aesKey = Buffer.from(this.config.encodingAESKey + '=', 'base64');
|
|
14
|
+
// this.iv = this.aesKey.slice(0, 16);
|
|
15
|
+
// }
|
|
16
|
+
if (this.config.miniMessages) {
|
|
17
|
+
for (const item of this.config.miniMessages) {
|
|
18
|
+
if (!this.miniMessCache[item.name]) {
|
|
19
|
+
this.miniMessCache[item.name] = [];
|
|
20
|
+
}
|
|
21
|
+
this.miniMessCache[item.name].push({
|
|
22
|
+
appid: this.config.appid,
|
|
23
|
+
page: `pages/${item.model}/${item.page}/${item.page}`
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (this.config.messages) {
|
|
28
|
+
for (const item of this.config.messages) {
|
|
29
|
+
if (!this.messCache[item.name]) {
|
|
30
|
+
this.messCache[item.name] = [];
|
|
31
|
+
}
|
|
32
|
+
this.messCache[item.name].push({
|
|
33
|
+
agentid: this.config.agentid,
|
|
34
|
+
...item
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
this.mock = this.config.mock === true;
|
|
39
|
+
}
|
|
40
|
+
async createDepartment(param) {
|
|
41
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token=${token}`, 'post', param);
|
|
42
|
+
return data.id;
|
|
43
|
+
}
|
|
44
|
+
async updateDepartment(param) {
|
|
45
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/department/update?access_token=${token}`, 'post', param);
|
|
46
|
+
}
|
|
47
|
+
async deleteDepartment(id) {
|
|
48
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/department/delete?access_token=${token}`, 'get', { id });
|
|
49
|
+
}
|
|
50
|
+
async getDepartmentList(id) {
|
|
51
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=${token}`, 'get', { id });
|
|
52
|
+
return data.department;
|
|
53
|
+
}
|
|
54
|
+
async createUser(param) {
|
|
55
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/create?access_token=${token}`, 'post', param);
|
|
56
|
+
return data.id;
|
|
57
|
+
}
|
|
58
|
+
async getUser(userid) {
|
|
59
|
+
return await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=${token}`, 'get', { userid });
|
|
60
|
+
}
|
|
61
|
+
async updateUser(param) {
|
|
62
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token=${token}`, 'post', param);
|
|
63
|
+
}
|
|
64
|
+
async deleteUser(userid) {
|
|
65
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/delete?access_token=${token}`, 'get', { userid });
|
|
66
|
+
}
|
|
67
|
+
async batchDeleteUser(useridlist) {
|
|
68
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/batchdelete?access_token=${token}`, 'post', { useridlist });
|
|
69
|
+
}
|
|
70
|
+
async getDeptUserSimply(department_id, fetch_child) {
|
|
71
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token=${token}`, 'get', { department_id, fetch_child: fetch_child ? 'FETCH_CHILD' : undefined });
|
|
72
|
+
return data.userlist;
|
|
73
|
+
}
|
|
74
|
+
async getDeptUser(department_id, fetch_child) {
|
|
75
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=${token}`, 'get', { department_id, fetch_child: fetch_child ? 'FETCH_CHILD' : undefined });
|
|
76
|
+
return data.userlist;
|
|
77
|
+
}
|
|
78
|
+
async userid2openid(userid) {
|
|
79
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid?access_token=${token}`, 'post', { userid });
|
|
80
|
+
return data.openid;
|
|
81
|
+
}
|
|
82
|
+
async openid2userid(openid) {
|
|
83
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_userid?access_token=${token}`, 'post', { openid });
|
|
84
|
+
return data.userid;
|
|
85
|
+
}
|
|
86
|
+
async authsucc(userid) {
|
|
87
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/user/authsucc?access_token=${token}`, 'get', { userid });
|
|
88
|
+
}
|
|
89
|
+
async inviteUsers({ user, party, tag }) {
|
|
90
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/batch/invite?access_token=${token}`, 'post', { user, party, tag });
|
|
91
|
+
return {
|
|
92
|
+
invaliduser: data.invaliduser,
|
|
93
|
+
invalidparty: data.invalidparty,
|
|
94
|
+
invalidtag: data.invalidtag
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async createTag(tagname, tagid) {
|
|
98
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/create?access_token=${token}`, 'post', { tagname, tagid });
|
|
99
|
+
return data.id;
|
|
100
|
+
}
|
|
101
|
+
async updateTag(tagname, tagid) {
|
|
102
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/update?access_token=${token}`, 'post', { tagname, tagid });
|
|
103
|
+
}
|
|
104
|
+
async deleteTag(tagid) {
|
|
105
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/delete?access_token=${token}`, 'get', { tagid });
|
|
106
|
+
}
|
|
107
|
+
async createTagUser(tagid, userlist) {
|
|
108
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers?access_token=${token}`, 'post', { tagid, userlist });
|
|
109
|
+
}
|
|
110
|
+
async deleteTagUser(tagid, userlist) {
|
|
111
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/deltagusers?access_token=${token}`, 'post', { tagid, userlist });
|
|
112
|
+
}
|
|
113
|
+
async getTagUser(tagid) {
|
|
114
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/get?access_token=${token}`, 'get', { tagid });
|
|
115
|
+
return data;
|
|
116
|
+
}
|
|
117
|
+
async getTag() {
|
|
118
|
+
const data = await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/tag/list?access_token=${token}`, 'get', {});
|
|
119
|
+
return data.taglist;
|
|
120
|
+
}
|
|
121
|
+
async updateTaskCard(userids, task_id, clicked_key) {
|
|
122
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/message/update_taskcard?access_token=${token}`, 'post', { userids, task_id, clicked_key });
|
|
123
|
+
}
|
|
124
|
+
async sendMiniMs({ touser, toparty, totag, name, scene, ms }) {
|
|
125
|
+
const touser_ = touser ? touser.join('|') : undefined;
|
|
126
|
+
const toparty_ = toparty ? toparty.join('|') : undefined;
|
|
127
|
+
const totag_ = totag ? totag.join('|') : undefined;
|
|
128
|
+
if (scene) {
|
|
129
|
+
scene = `?${scene}`;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
scene = '';
|
|
133
|
+
}
|
|
134
|
+
if (ms.content_item) {
|
|
135
|
+
for (const [key, value] of Object.entries(ms.content_item)) {
|
|
136
|
+
ms.content_item[key] = value ?? '';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const temps = this.miniMessCache[name];
|
|
140
|
+
for (const item of temps) {
|
|
141
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${token}`, 'post', {
|
|
142
|
+
touser: touser_,
|
|
143
|
+
toparty: toparty_,
|
|
144
|
+
totag: totag_,
|
|
145
|
+
'msgtype': 'miniprogram_notice',
|
|
146
|
+
miniprogram_notice: {
|
|
147
|
+
...item,
|
|
148
|
+
page: `${item.page}${scene}`,
|
|
149
|
+
...ms
|
|
150
|
+
},
|
|
151
|
+
enable_id_trans: 0
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async sendMs({ touser, toparty, totag, name, ms }) {
|
|
156
|
+
const touser_ = touser ? touser.join('|') : undefined;
|
|
157
|
+
const toparty_ = toparty ? toparty.join('|') : undefined;
|
|
158
|
+
const totag_ = totag ? totag.join('|') : undefined;
|
|
159
|
+
const temps = this.messCache[name];
|
|
160
|
+
for (const item of temps) {
|
|
161
|
+
await this.fetch((token) => `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${token}`, 'post', {
|
|
162
|
+
touser: touser_,
|
|
163
|
+
toparty: toparty_,
|
|
164
|
+
totag: totag_,
|
|
165
|
+
...item,
|
|
166
|
+
[item.msgtype]: ms,
|
|
167
|
+
enable_id_trans: 0
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -15,9 +15,13 @@ export interface WxOrganUser {
|
|
|
15
15
|
telephone?: string;
|
|
16
16
|
avatar_mediaid?: string;
|
|
17
17
|
enable?: 1 | 0;
|
|
18
|
-
extattr?: {
|
|
18
|
+
extattr?: {
|
|
19
|
+
[key: string]: string | number;
|
|
20
|
+
};
|
|
19
21
|
to_invite?: boolean;
|
|
20
|
-
external_profile?: {
|
|
22
|
+
external_profile?: {
|
|
23
|
+
[key: string]: string | number;
|
|
24
|
+
};
|
|
21
25
|
external_position?: string;
|
|
22
26
|
address?: string;
|
|
23
27
|
}
|
|
@@ -88,7 +92,6 @@ export interface WxCreatedorder {
|
|
|
88
92
|
};
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
|
-
|
|
92
95
|
export interface WxPayToUserResponse {
|
|
93
96
|
payment_no: string;
|
|
94
97
|
partner_trade_no: string;
|
|
@@ -131,7 +134,7 @@ export interface WxCreateOrderResult {
|
|
|
131
134
|
mweb_url?: string;
|
|
132
135
|
dataCacheId?: string;
|
|
133
136
|
devCacheId?: string;
|
|
134
|
-
}/** 微信退款返回结果 */
|
|
137
|
+
} /** 微信退款返回结果 */
|
|
135
138
|
export interface WxRefResult {
|
|
136
139
|
dataCacheId?: string;
|
|
137
140
|
devCacheId?: string;
|
|
@@ -273,7 +276,9 @@ export interface WxPay {
|
|
|
273
276
|
* 通过这个参数可以将 当前支付发起时用户 追加到回调的上下文中
|
|
274
277
|
* @memberof WxPay
|
|
275
278
|
*/
|
|
276
|
-
unifiedorder(wxOrderOption: WxCreatedorder, dataCache?: {
|
|
279
|
+
unifiedorder(wxOrderOption: WxCreatedorder, dataCache?: {
|
|
280
|
+
[key: string]: any;
|
|
281
|
+
}, devid?: string): Promise<WxCreateOrderResult>;
|
|
277
282
|
/**
|
|
278
283
|
*
|
|
279
284
|
* https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2
|
|
@@ -315,7 +320,9 @@ export interface WxPay {
|
|
|
315
320
|
* @returns {Promise<void>}
|
|
316
321
|
* @memberof WxPay
|
|
317
322
|
*/
|
|
318
|
-
refund(option: WxCreateRefundOrder, dataCache?: {
|
|
323
|
+
refund(option: WxCreateRefundOrder, dataCache?: {
|
|
324
|
+
[key: string]: any;
|
|
325
|
+
}, devid?: string): Promise<WxRefResult>;
|
|
319
326
|
/**
|
|
320
327
|
*
|
|
321
328
|
* https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5
|
|
@@ -332,7 +339,6 @@ export interface WxPay {
|
|
|
332
339
|
resetDataCache(dataCache: {
|
|
333
340
|
[key: string]: any;
|
|
334
341
|
}, dataCacheId: string): Promise<void>;
|
|
335
|
-
|
|
336
342
|
/**
|
|
337
343
|
* 修改支付、退款时缓存的会话id
|
|
338
344
|
* @param devid
|
|
@@ -346,7 +352,11 @@ export interface WxMiniConfig {
|
|
|
346
352
|
/** 小程序二维码设置 */
|
|
347
353
|
qrcode?: {
|
|
348
354
|
/** 线条颜色 */
|
|
349
|
-
lineColor?: {
|
|
355
|
+
lineColor?: {
|
|
356
|
+
r: number;
|
|
357
|
+
g: number;
|
|
358
|
+
b: number;
|
|
359
|
+
};
|
|
350
360
|
/** 宽度 */
|
|
351
361
|
width?: number;
|
|
352
362
|
};
|
|
@@ -458,7 +468,6 @@ export interface WxOrganConfig {
|
|
|
458
468
|
msgtype: 'text' | 'image' | 'voice' | 'video' | 'file' | 'textcard' | 'news' | 'mpnews' | 'markdown' | 'taskcard';
|
|
459
469
|
safe?: 0 | 1;
|
|
460
470
|
}>;
|
|
461
|
-
|
|
462
471
|
/**
|
|
463
472
|
*
|
|
464
473
|
* 接口模拟调用?
|
|
@@ -471,7 +480,9 @@ export interface WxOrganConfig {
|
|
|
471
480
|
export interface WxOrganMini {
|
|
472
481
|
title: string;
|
|
473
482
|
description?: string;
|
|
474
|
-
content_item?: {
|
|
483
|
+
content_item?: {
|
|
484
|
+
[key: string]: string;
|
|
485
|
+
};
|
|
475
486
|
emphasis_first_item?: boolean;
|
|
476
487
|
}
|
|
477
488
|
export interface WxOrganText {
|
package/wx/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/wx.js
ADDED
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
|
3
|
-
// This option interrupts the configuration hierarchy at this file
|
|
4
|
-
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
|
5
|
-
root: true,
|
|
6
|
-
|
|
7
|
-
// https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
|
|
8
|
-
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
|
|
9
|
-
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
|
|
10
|
-
parserOptions: {
|
|
11
|
-
parser: require.resolve('@typescript-eslint/parser'),
|
|
12
|
-
extraFileExtensions: [ '.vue' ]
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
env: {
|
|
16
|
-
browser: true,
|
|
17
|
-
es2021: true,
|
|
18
|
-
node: true
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
// Rules order is important, please avoid shuffling them
|
|
22
|
-
extends: [
|
|
23
|
-
// Base ESLint recommended rules
|
|
24
|
-
// 'eslint:recommended',
|
|
25
|
-
|
|
26
|
-
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
|
|
27
|
-
// ESLint typescript rules
|
|
28
|
-
'plugin:@typescript-eslint/recommended',
|
|
29
|
-
|
|
30
|
-
// Uncomment any of the lines below to choose desired strictness,
|
|
31
|
-
// but leave only one uncommented!
|
|
32
|
-
// See https://eslint.vuejs.org/rules/#available-rules
|
|
33
|
-
'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
|
|
34
|
-
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
|
35
|
-
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
|
36
|
-
|
|
37
|
-
// https://github.com/prettier/eslint-config-prettier#installation
|
|
38
|
-
// usage with Prettier, provided by 'eslint-config-prettier'.
|
|
39
|
-
'prettier'
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
plugins: [
|
|
43
|
-
// required to apply rules which need type information
|
|
44
|
-
'@typescript-eslint',
|
|
45
|
-
|
|
46
|
-
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
|
|
47
|
-
// required to lint *.vue files
|
|
48
|
-
'vue'
|
|
49
|
-
|
|
50
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
|
|
51
|
-
// Prettier has not been included as plugin to avoid performance impact
|
|
52
|
-
// add it as an extension for your IDE
|
|
53
|
-
|
|
54
|
-
],
|
|
55
|
-
|
|
56
|
-
globals: {
|
|
57
|
-
ga: 'readonly', // Google Analytics
|
|
58
|
-
cordova: 'readonly',
|
|
59
|
-
__statics: 'readonly',
|
|
60
|
-
__QUASAR_SSR__: 'readonly',
|
|
61
|
-
__QUASAR_SSR_SERVER__: 'readonly',
|
|
62
|
-
__QUASAR_SSR_CLIENT__: 'readonly',
|
|
63
|
-
__QUASAR_SSR_PWA__: 'readonly',
|
|
64
|
-
process: 'readonly',
|
|
65
|
-
Capacitor: 'readonly',
|
|
66
|
-
chrome: 'readonly'
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
// add your custom rules here
|
|
70
|
-
rules: {
|
|
71
|
-
|
|
72
|
-
'prefer-promise-reject-errors': 'off',
|
|
73
|
-
|
|
74
|
-
quotes: ['warn', 'single', { avoidEscape: true }],
|
|
75
|
-
|
|
76
|
-
// this rule, if on, would require explicit return type on the `render` function
|
|
77
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
78
|
-
|
|
79
|
-
// in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
|
|
80
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
81
|
-
|
|
82
|
-
// The core 'no-unused-vars' rules (in the eslint:recommended ruleset)
|
|
83
|
-
// does not work with type definitions
|
|
84
|
-
'no-unused-vars': 'off',
|
|
85
|
-
|
|
86
|
-
// allow debugger during development only
|
|
87
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
|
88
|
-
}
|
|
89
|
-
}
|
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// 控制相关文件嵌套展示
|
|
3
|
-
"explorer.fileNesting.enabled": true,
|
|
4
|
-
"explorer.fileNesting.expand": false,
|
|
5
|
-
"explorer.fileNesting.patterns": {
|
|
6
|
-
"package.json": "nest-cli.json,.eslintrc.cjs,.eslintignore,eslint.config.js,package-cjs.json,bun.lockb,baja.code.json,.prettierrc,.eslintrc.js,$(capture).env.*,,pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc,yarn.lock,verify-commit.mjs,tsconfig.json,nuxt.config.ts,uno.config.ts",
|
|
7
|
-
}
|
|
8
|
-
}
|
package/ci.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// import { rm, exec, cp } from 'shelljs';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import pkg from 'shelljs';
|
|
4
|
-
import cjs from './package-cjs.json' with { type: "json" };
|
|
5
|
-
import def from './package.json' with { type: "json" };
|
|
6
|
-
const { rm, exec, cp } = pkg;
|
|
7
|
-
|
|
8
|
-
rm('-rf', './dist/');
|
|
9
|
-
rm('-rf', './tsconfig.tsbuildinfo');
|
|
10
|
-
exec('yarn tsc');
|
|
11
|
-
rm('-rf', './tsconfig.tsbuildinfo');
|
|
12
|
-
cp('./package.json', './dist/package.json');
|
|
13
|
-
cp('./README.md', './dist/README.md');
|
|
14
|
-
cp('./LICENSE', './dist/LICENSE');
|
|
15
|
-
rm('-rf', './dist/tsconfig.tsbuildinfo');
|
|
16
|
-
|
|
17
|
-
rm('-rf', './dist-cjs/');
|
|
18
|
-
rm('-rf', './tsconfig.cjs.tsbuildinfo');
|
|
19
|
-
exec('yarn tsc -p tsconfig.cjs.json');
|
|
20
|
-
rm('-rf', './tsconfig.cjs.tsbuildinfo');
|
|
21
|
-
fs.writeFileSync('./dist-cjs/package.json', JSON.stringify(Object.assign(def, cjs), null, 2));
|
|
22
|
-
cp('./README.md', './dist-cjs/README.md');
|
|
23
|
-
cp('./LICENSE', './dist-cjs/LICENSE');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
cp('-R', './dist/*', 'E:\\pro\\v\\apps-services\\fast-start\\node_modules\\baja-lite');
|
|
27
|
-
cp('-R', './dist/*', 'E:\\pro\\v\\apps-services\\attack-service\\node_modules\\baja-lite');
|
|
28
|
-
cp('-R', './dist/*', 'E:\\pro\\v\\apps-services\\attack-front\\node_modules\\baja-lite');
|
|
29
|
-
console.log('cp over');
|
package/package-cjs.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "baja-lite-cjs",
|
|
3
|
-
"type": "commonjs",
|
|
4
|
-
"exports": {
|
|
5
|
-
".": {
|
|
6
|
-
"require": "./index.js"
|
|
7
|
-
},
|
|
8
|
-
"./boot.js":"./boot.js",
|
|
9
|
-
"./boot-remote.js":"./boot-remote.js",
|
|
10
|
-
"./wx.js": "./wx.js"
|
|
11
|
-
},
|
|
12
|
-
"types": "./index.d.ts",
|
|
13
|
-
"bin": {
|
|
14
|
-
"baja": "./code.js"
|
|
15
|
-
},
|
|
16
|
-
"main": "./index.js"
|
|
17
|
-
}
|
package/src/enum.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { _enums } from "./sql.js";
|
|
2
|
-
|
|
3
|
-
export class Enum {
|
|
4
|
-
private _value: string;
|
|
5
|
-
private _desc: string;
|
|
6
|
-
private _config: string[];
|
|
7
|
-
constructor(value: string, desc: string, ...config: string[]) {
|
|
8
|
-
this._value = value;
|
|
9
|
-
this._desc = desc;
|
|
10
|
-
this._config = config;
|
|
11
|
-
}
|
|
12
|
-
eq(value: string | number | undefined | null): boolean {
|
|
13
|
-
if (value === undefined) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (value === null) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (typeof value === 'number') {
|
|
20
|
-
return this._value === `${value}`;
|
|
21
|
-
}
|
|
22
|
-
return this._value === `${value}`;
|
|
23
|
-
}
|
|
24
|
-
value(): string {
|
|
25
|
-
return this._value;
|
|
26
|
-
}
|
|
27
|
-
desc(): string {
|
|
28
|
-
return this._desc;
|
|
29
|
-
}
|
|
30
|
-
config(): string[] {
|
|
31
|
-
return this._config;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export type EnumMap = Record<string, Enum>;
|
|
35
|
-
export type GlobalArray = Record<string, Array<[string, string]>>;
|
|
36
|
-
export type GlobalMap = Record<string, Record<string, string>>;
|
|
37
|
-
export interface EnmuJson {
|
|
38
|
-
GlobalArray: GlobalArray;
|
|
39
|
-
GlobalMap: GlobalMap;
|
|
40
|
-
}
|
|
41
|
-
let configData: EnmuJson | null = null;
|
|
42
|
-
export const getEnums = (GlobalValues?: EnumMap): EnmuJson => {
|
|
43
|
-
if (!GlobalValues) {
|
|
44
|
-
return globalThis[_enums];
|
|
45
|
-
}
|
|
46
|
-
if (configData) {
|
|
47
|
-
return configData;
|
|
48
|
-
}
|
|
49
|
-
const result: EnmuJson = {
|
|
50
|
-
GlobalArray: {},
|
|
51
|
-
GlobalMap: {}
|
|
52
|
-
};
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
54
|
-
Object.keys(GlobalValues).forEach((item) => {
|
|
55
|
-
// const guess = /([\w\W]+)_([^_]+)$/.exec(item);
|
|
56
|
-
const guess = item.replace(new RegExp(`_${GlobalValues[item]!.value()}`, 'i'), '');
|
|
57
|
-
if (guess) {
|
|
58
|
-
if (!result.GlobalArray[guess]) {
|
|
59
|
-
result.GlobalArray[guess] = [];
|
|
60
|
-
}
|
|
61
|
-
result.GlobalArray[guess]!.push([GlobalValues[item]!.value(), GlobalValues[item]!.desc()]);
|
|
62
|
-
|
|
63
|
-
if (!result.GlobalMap[guess]) {
|
|
64
|
-
result.GlobalMap[guess] = {};
|
|
65
|
-
}
|
|
66
|
-
result.GlobalMap[guess]![GlobalValues[item]!.value()] = GlobalValues[item]!.desc();
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
configData = result;
|
|
70
|
-
return result;
|
|
71
|
-
};
|
package/src/error.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const Throw = {
|
|
2
|
-
if(test: boolean, message: string | Error | any) {
|
|
3
|
-
if (test === true) this.now(message);
|
|
4
|
-
},
|
|
5
|
-
ifNot(test: boolean, message: string | Error | any) {
|
|
6
|
-
if (test !== true) this.now(message);
|
|
7
|
-
},
|
|
8
|
-
now(message: string | Error | any) {
|
|
9
|
-
throw typeof message === 'string' ? new Error(message) : message;
|
|
10
|
-
}
|
|
11
|
-
};
|