diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4cb2b95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +################################################################################ +# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。 +################################################################################ + +/.vs +/node_modules diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6a5c710 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# node-mysql78 + +>+ 十八年ERP开发经验 十年云开发经验 十五年股票期货投资经验 十年投资分析平台开发经验 +>+ 技术不高 了解业务 擅长解决生产经营实际问题 +>+ 逐步把多年开发优化 并且在一直稳定运行中的项目开源 +>+ 合作 商务 问题 讨论 欢迎联系email:657225485@qq.com qq群:323397913 +>+ [完整框架 开源改造中 未完成...](https://github.com/www778878net/NODE78) + + + +>## 框架特色 +>+ 稳定:运行数年 二台单核1G机器搞定数千并发 +>+ 开发快:几行代码搞定增删查改 线程池 +>+ 效率高:有完善的低代码前后端框架 在框架下开发 1后端可轻松配合4前端以上 +>+ 易扩展:业务表与数据表对应 一个目录就是一套小功能 一个文件就是一个数据表 +>+ 适应强:同时运行在阿里云和腾迅云 +>+ 易调试:可设置追踪某几个用户或某表或某目录的所有调用 +>+ 易学习:十行代码搞定 想装不会都难 +>+ 易运维:有完善的api调用计数和耗时统计 还有出错微信报警机制 +>+ 更新快:主要运营中的项目 如有bug或新功能 必然及时更新 +>+ 易重构:一个目录一个小系统 一个版本一个路径 新旧api可长期共存 边开车边换胎 + +>## 安装 install +``` +npm i node-mysql78 +``` + +>## 使用 +>>### 初始化 +``` +import Mysql78 from "node-mysql78"; +let config={host:"127.0.0.1",password:"test",database:"testdb"} +let mysql = new Mysql78(config); +``` + +*** +>## 框架简要说明 +>![后端服务](https://github.com/www778878net/node-date78/blob/main/assets/pic/services.jpeg) +>![后端代码示例](https://github.com/www778878net/node-date78/blob/main/assets/pic/nodejs.png) +>![前端代码示例](https://github.com/www778878net/node-date78/blob/main/assets/pic/js.png) + + + +*** +# 以下为非必需内容 ++[read more...](https://github.com/www778878net/node-mysql78/READMORE.md) \ No newline at end of file diff --git a/READMORE.md b/READMORE.md new file mode 100644 index 0000000..e69de29 diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..9a0f144 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,400 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Util = require('util'); +const mysql = require('mysql'); +const md5 = require("md5"); +class Mysql78 { + /* + * ��Сʾ�� + *let config={host:"127.0.0.1",password:"test",database:"testdb"} + * + */ + constructor(config) { + this._host = config["host"]; + let port = config.port || 3306; + let max = config.max || 200; + let user = config.user || "root"; + this.isLog = config.isLog || false; + this.isCount = config.isCount || false; + this._pool = mysql.createPool({ + 'connectionLimit': max, + 'host': this._host, + 'port': port, + 'user': user, + 'password': config.password, + 'database': config.database, + 'dateStrings': true, + 'connectTimeout': 30 * 1000 + }); + } + /** + * sql get���� + * @param cmdtext sql��� + * @param values ���� + * @param up �û��ϴ�������(��Ҫ������־) + */ + doGet(cmdtext, values, up) { + values = values || []; + let debug = up.debug || false; + let self = this; + return new Promise(function (resolve, reject) { + let dstart = new Date(); + self._pool.getConnection(function (err, client) { + if (err) { + console.error(new Date() + 'mysql pool getcon Error: ' + Util.inspect(err)); + reject(err); + return; + } + //console.log(cmdtext) + client.query(cmdtext, values, function (err, back) { + if (debug) { + //console.log(cmdtext + " v:" + values.join(",") + " r:" + Util.inspect(back)); + self._addWarn(Util.inspect(back) + " c:" + cmdtext + " v" + values.join(","), "debug_" + up.apisys, up); + } + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql GetData Error: ' + cmdtext + Util.inspect(err)); + self._addWarn(Util.inspect(err) + " c:" + cmdtext + " v" + values.join(","), "err_" + up.apisys, up); + reject(err); + return; + } + else { + if (!back) { + back = []; + } + //����Ϊ��ȥ�����һ������ + var str = JSON.stringify(back); + let lendown = str.length; + back = JSON.parse(str); + self._saveLog(cmdtext, values, new Date().getTime() - dstart.getTime(), lendown, up); + resolve(back); + } + }); + }); + }); + } + ; + /** + * ���񷵻ز����ɹ� ��ʧ����Ϣ + * @param cmds ��������� + * @param values ������� + * @param errtexts ���������ʾ + * @param logtext log�� + * @param logvalue log�� + * @param up �û��ϴ� + */ + doT(cmds, values, errtexts, logtext, logvalue, up) { + let debug = up.debug || false; + let self = this; + return new Promise((resolve, reject) => { + this._pool.getConnection((err, con) => { + if (err) { + //console.error(new Date() + 'mysql pool getcon Error: ' + Util.inspect(err)); + reject(err); + return; + } + let dstart = new Date(); + con.beginTransaction((err) => { + if (err) + throw err; + let promises = []; + for (var i = 0; i < cmds.length; i++) { + promises.push(self.doTran(cmds[i], values[i], con, up)); + } + Promise.all(promises).then((back) => { + self._saveLog(logtext, logvalue, new Date().getTime() - dstart.getTime(), 1, up); + var errmsg = "����ʧ��!"; + var haveAff0 = false; + for (var i = 0; i < back.length; i++) { + if (back[i].affectedRows === 0) { + errmsg += errtexts[i]; + //errmsg += i; + haveAff0 = true; + break; + } + } + if (haveAff0 || back.length < cmds.length) { + con.rollback(); + con.release(); + resolve(errmsg); + return; + } + con.commit(); + con.release(); + resolve("�����ɹ�"); + }).catch(function (err) { + //console.log(err); + resolve(err); + //reject(err); + }); + }); + }); + }); + } + /** + * sql update���� ������Ӱ������ + * @param cmdtext sql��� + * @param values ���� + * @param up �û��ϴ����� + */ + doM(cmdtext, values, up) { + const self = this; + let debug = up.debug || false; + return new Promise(function (resolve, reject) { + let dstart = new Date(); + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + client.query(cmdtext, values, function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql doM Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + self._addWarn(Util.inspect(err) + " c:" + cmdtext + " v" + values.join(","), "err" + up.apisys, up); + resolve(0); + } + else { + //����Ϊ��ȥ�����һ������ + let str = JSON.stringify(results); + let lendown = str.length; + results = JSON.parse(str); + self._saveLog(cmdtext, values, new Date().getTime() - dstart.getTime(), lendown, up); + resolve(results.affectedRows); + } + if (debug) { + //console.log(cmdtext + " v:" + Util.inspect(values) + " r:" + Util.inspect(results)); + self._addWarn(Util.inspect(results) + " c:" + cmdtext + " v" + values.join(","), "debug_" + up.apisys, up); + } + }); + }); + }); + } + /** + * ����һ�� ���ز�����к� + * @param cmdtext + * @param values + * @param up + */ + doMAdd(cmdtext, values, up) { + const self = this; + let debug = up.debug || false; + return new Promise(function (resolve, reject) { + let dstart = new Date(); + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + client.query(cmdtext, values, function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql doM Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + self._addWarn(Util.inspect(err) + " c:" + cmdtext + " v" + values.join(","), "err" + up.apisys, up); + resolve(0); + } + else { + //����Ϊ��ȥ�����һ�� + let str = JSON.stringify(results); + let lendown = str.length; + results = JSON.parse(str); + self._saveLog(cmdtext, values, new Date().getTime() - dstart.getTime(), lendown, up); + resolve(results.insertId); + } + if (debug) { + //console.log(cmdtext + " v:" + Util.inspect(values) + " r:" + Util.inspect(results)); + self._addWarn(Util.inspect(results) + " c:" + cmdtext + " v" + values.join(","), "debug_" + up.apisys, up); + } + }); + }); + }); + } + /** + * �����װ һ����ִ��(һ�㲻�� doT���� ) + * ��Ҫ�Լ��ͷ����� + * �����и��ӵij�����Ҫ�õ� �����һ��ִ�гɹ� ����ʲô��������� ����Ҫ�ع����� + * @param cmdtext + * @param values + * @param con + * @param up + */ + doTran(cmdtext, values, con, up) { + let debug = up.debug || false; + return new Promise(function (resolve, reject) { + con.query(cmdtext, values, function (err, result) { + if (debug) { + //console.log(cmdtext + " v:" + values.join(",") + " r:" + Util.inspect(result)); + } + if (err) { + //console.error('mysql doTran Error: ' + Util.inspect(err)); + reject(Util.inspect(err)); + return; + } + else + resolve(result); + }); + }); + } + ; + /** + * doget doM����Ҫ�ֶ��ͷ� + * getConnection����Ҫ + * */ + releaseConnection(client) { + let self = this; + return new Promise(function (resolve, reject) { + self._pool.releaseConnection(client); + resolve("ok"); + }); + } + /** + * ��ȡ����(�ǵ��ͷ�) + * */ + getConnection() { + let self = this; + return new Promise(function (resolve, reject) { + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + resolve(client); + }); + }); + } + /** + * debug���� ׷��SQL���� ���ߵ�������(�����ø����û������Ŀ¼������) + * �򿪻�Ӱ������ ������Ҫ���ٿ�����Ա�����ڿ�����Ŀ¼ + * ����sys_warn ��������ں����� + * @param info log + * @param kind �����ѯlog + * @param up �û��ϴ����� + */ + _addWarn(info, kind, up) { + let self = this; + return new Promise(function (resolve, reject) { + if (!self.isLog) { + resolve("isLog is false"); + return; + } + let cmdtext = "INSERT INTO sys_warn (`kind`,apisys,apiobj,`content`,`upby`,`uptime`,`id`,upid)VALUES(?,?,?,?,?,?,?,?)"; + let values = [kind, up.apisys, up.apiobj, info, up.uname, up.uptime, up.getNewid(), up.upid]; + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + client.query(cmdtext, values, function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql doM Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + reject(err); + } + else { + try { + //����Ϊ��ȥ�����һ������ + let str = JSON.stringify(results); + results = JSON.parse(str); + resolve(results.affectedRows); + } + catch (e) { + //console.log(kind + "mysql78__addWarn:" + info); + resolve("0"); + } + } + }); + }); + }); + /* + * CREATE TABLE `sys_warn` ( + `uid` varchar(36) NOT NULL DEFAULT '', + `kind` varchar(100) NOT NULL DEFAULT '', + `apisys` varchar(100) NOT NULL DEFAULT '', + `apiobj` varchar(100) NOT NULL DEFAULT '', + `content` text NOT NULL, + `upid` varchar(36) NOT NULL DEFAULT '', + `upby` varchar(50) DEFAULT '', + `uptime` datetime NOT NULL, + `idpk` int(11) NOT NULL AUTO_INCREMENT, + `id` varchar(36) NOT NULL, + `remark` varchar(200) NOT NULL DEFAULT '', + `remark2` varchar(200) NOT NULL DEFAULT '', + `remark3` varchar(200) NOT NULL DEFAULT '', + `remark4` varchar(200) NOT NULL DEFAULT '', + `remark5` varchar(200) NOT NULL DEFAULT '', + `remark6` varchar(200) NOT NULL DEFAULT '', + PRIMARY KEY (`idpk`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + */ + } + /** + * ͳ�ƹ���(����sys_sql ��������ں����� �򿪻�Ӱ������) + * @param cmdtext SQL��� + * @param values ֵ + * @param dlong ��ʱ + * @param lendown �����ֽ� + * @param up �û��ϴ����� + */ + _saveLog(cmdtext, values, dlong, lendown, up) { + let self = this; + return new Promise(function (resolve, reject) { + if (!self.isCount) { + resolve("isCount is false"); + return; + } + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + let cmdtextmd5 = md5(cmdtext); + let sb = "INSERT INTO sys_sql(apiv,apisys,apiobj,cmdtext,num,dlong,downlen,id,uptime,cmdtextmd5)VALUES(?,?,?,?,?,?,?,?,?,?)" + + "ON DUPLICATE KEY UPDATE num=num+1,dlong=dlong+?,downlen=downlen+?"; + client.query(sb, [up.apiv, up.apisys, up.apiobj, cmdtext, 1, dlong, lendown, up.getNewid(), new Date(), cmdtextmd5, + dlong, lendown], function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql _saveLog Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + reject(err); + return; + } + else + resolve("ok"); + }); + }); + }); + /* + * CREATE TABLE `sys_sql` ( + `cid` varchar(36) NOT NULL DEFAULT '', + `apiv` varchar(50) NOT NULL DEFAULT '', + `apisys` varchar(50) NOT NULL DEFAULT '', + `apiobj` varchar(50) NOT NULL DEFAULT '', + `cmdtext` varchar(200) NOT NULL, + `uname` varchar(50) NOT NULL DEFAULT '', + `num` int(11) NOT NULL DEFAULT '0', + `dlong` int(32) NOT NULL DEFAULT '0', + `downlen` int(32) NOT NULL DEFAULT '0', + `upby` varchar(50) NOT NULL DEFAULT '', + `cmdtextmd5` varchar(50) NOT NULL DEFAULT '', + `uptime` datetime NOT NULL, + `idpk` int(11) NOT NULL AUTO_INCREMENT, + `id` varchar(36) NOT NULL, + `remark` varchar(200) NOT NULL DEFAULT '', + `remark2` varchar(200) NOT NULL DEFAULT '', + `remark3` varchar(200) NOT NULL DEFAULT '', + `remark4` varchar(200) NOT NULL DEFAULT '', + `remark5` varchar(200) NOT NULL DEFAULT '', + `remark6` varchar(200) NOT NULL DEFAULT '', + PRIMARY KEY (`idpk`), + UNIQUE KEY `u_v_sys_obj_cmdtext` (`apiv`,`apisys`,`apiobj`,`cmdtext`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + */ + } +} +exports.default = Mysql78; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..7bf4ba6 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAA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IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,IAAI,EAAE,EAAE,UAAU;oBAC5G,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,EAAE,OAAO;oBACrC,2BAA2B;oBAC3B,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;oBACrC,IAAI,GAAG,EAAE;wBACL,4GAA4G;wBAC5G,MAAM,CAAC,GAAG,CAAC,CAAC;wBACZ,OAAO;qBACV;;wBAEG,OAAO,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEF;;;;;;;;;;;;;;;;;;;;;;;;;UAyBE;IACP,CAAC;CACJ;AAraD,0BAqaC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5d86e5e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,956 @@ +{ + "name": "node-mysql78", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "14.17.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.4.tgz", + "integrity": "sha512-8kQ3+wKGRNN0ghtEn7EGps/B8CzuBz1nXZEIGGLP2GnwbqYn4dbTs7k+VKLTq1HvZLRCIDtN3Snx1Ege8B7L5A==", + "dev": true + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npm.taobao.org/@ungap/promise-all-settled/download/@ungap/promise-all-settled-1.1.2.tgz", + "integrity": "sha1-qlgEJxHW4ydd033Fl+XTHowpCkQ=", + "dev": true + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npm.taobao.org/ansi-colors/download/ansi-colors-4.1.1.tgz", + "integrity": "sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-3.0.0.tgz?cache=0&sync_timestamp=1618552978881&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz", + "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npm.taobao.org/anymatch/download/anymatch-3.1.2.tgz", + "integrity": "sha1-wFV8CWrzLxBhmPT04qODU343hxY=", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/argparse/download/argparse-2.0.1.tgz", + "integrity": "sha1-JG9Q88p4oyQPbJl+ipvR6sSeSzg=", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npm.taobao.org/assertion-error/download/assertion-error-1.1.0.tgz", + "integrity": "sha1-5gtrDo8wG9l+U3UhW9pAbIURjAs=", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.2.tgz?cache=0&sync_timestamp=1617714298273&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbalanced-match%2Fdownload%2Fbalanced-match-1.0.2.tgz", + "integrity": "sha1-6D46fj8wCzTLnYf2FfoMvzV2kO4=", + "dev": true + }, + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npm.taobao.org/binary-extensions/download/binary-extensions-2.2.0.tgz?cache=0&sync_timestamp=1610299640881&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbinary-extensions%2Fdownload%2Fbinary-extensions-2.2.0.tgz", + "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz?cache=0&sync_timestamp=1614010713935&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbrace-expansion%2Fdownload%2Fbrace-expansion-1.1.11.tgz", + "integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npm.taobao.org/braces/download/braces-3.0.2.tgz", + "integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npm.taobao.org/browser-stdout/download/browser-stdout-1.3.1.tgz", + "integrity": "sha1-uqVZ7hTO1zRSIputcyZGfGH6vWA=", + "dev": true + }, + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.nlark.com/camelcase/download/camelcase-6.2.0.tgz", + "integrity": "sha1-kkr4gcnVJaydh/QNlk5c6pgqGAk=", + "dev": true + }, + "chai": { + "version": "4.3.4", + "resolved": "https://registry.npm.taobao.org/chai/download/chai-4.3.4.tgz", + "integrity": "sha1-tV5lWzHh6scJm+TAjCGWT84ubEk=", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.1.tgz?cache=0&sync_timestamp=1618995384030&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.1.tgz", + "integrity": "sha1-yAs/qyi/Y3HmhjMl7uZ+YYt35q0=", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1622293670728&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", + "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/check-error/download/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.nlark.com/chokidar/download/chokidar-3.5.2.tgz", + "integrity": "sha1-26OXb8rbAW9m/TZQIdkWANAcHnU=", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npm.taobao.org/cliui/download/cliui-7.0.4.tgz?cache=0&sync_timestamp=1604880226973&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcliui%2Fdownload%2Fcliui-7.0.4.tgz", + "integrity": "sha1-oCZe5lVHb8gHrqnfPfjfd4OAi08=", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz?cache=0&sync_timestamp=1618552978881&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-fullwidth-code-point%2Fdownload%2Fis-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npm.taobao.org/string-width/download/string-width-4.2.2.tgz?cache=0&sync_timestamp=1618558856477&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring-width%2Fdownload%2Fstring-width-4.2.2.tgz", + "integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz?cache=0&sync_timestamp=1618553351145&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz", + "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz", + "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.nlark.com/debug/download/debug-4.3.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&sync_timestamp=1607433912031&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/decamelize/download/decamelize-4.0.0.tgz?cache=0&sync_timestamp=1610348638646&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdecamelize%2Fdownload%2Fdecamelize-4.0.0.tgz", + "integrity": "sha1-qkcte/Zg6xXzSU79UxyrfypwmDc=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npm.taobao.org/deep-eql/download/deep-eql-3.0.1.tgz", + "integrity": "sha1-38lARACtHI/gI+faHfHBR8S0RN8=", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/diff/download/diff-5.0.0.tgz", + "integrity": "sha1-ftatdthZ0DB4fsNYVfWx2vMdhSs=", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-8.0.0.tgz?cache=0&sync_timestamp=1614682818988&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Femoji-regex%2Fdownload%2Femoji-regex-8.0.0.tgz", + "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npm.taobao.org/escalade/download/escalade-3.1.1.tgz", + "integrity": "sha1-2M/ccACWXFoBdLSoLqpcBVJ0LkA=", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-4.0.0.tgz?cache=0&sync_timestamp=1618677243201&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npm.taobao.org/fill-range/download/fill-range-7.0.1.tgz", + "integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/find-up/download/find-up-5.0.0.tgz", + "integrity": "sha1-TJKBnstwg1YeT0okCoa+UZj1Nvw=", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npm.taobao.org/flat/download/flat-5.0.2.tgz", + "integrity": "sha1-jKb+MyBp/6nTJMMnGYxZglnOskE=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npm.taobao.org/fsevents/download/fsevents-2.3.2.tgz?cache=0&sync_timestamp=1612536422255&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffsevents%2Fdownload%2Ffsevents-2.3.2.tgz", + "integrity": "sha1-ilJveLj99GI7cJ4Ll1xSwkwC/Ro=", + "dev": true, + "optional": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npm.taobao.org/get-caller-file/download/get-caller-file-2.0.5.tgz", + "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/get-func-name/download/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.nlark.com/glob/download/glob-7.1.7.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob%2Fdownload%2Fglob-7.1.7.tgz", + "integrity": "sha1-Oxk+kjPwHULQs/eClLvutBj5SpA=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.nlark.com/glob-parent/download/glob-parent-5.1.2.tgz?cache=0&sync_timestamp=1620073245729&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob-parent%2Fdownload%2Fglob-parent-5.1.2.tgz", + "integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ=", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npm.taobao.org/growl/download/growl-1.10.5.tgz", + "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz?cache=0&sync_timestamp=1618559697170&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhas-flag%2Fdownload%2Fhas-flag-4.0.0.tgz", + "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npm.taobao.org/he/download/he-1.2.0.tgz", + "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npm.taobao.org/is-binary-path/download/is-binary-path-2.1.0.tgz", + "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npm.taobao.org/is-extglob/download/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-fullwidth-code-point%2Fdownload%2Fis-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.nlark.com/is-glob/download/is-glob-4.0.1.tgz", + "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npm.taobao.org/is-number/download/is-number-7.0.0.tgz", + "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npm.taobao.org/is-plain-obj/download/is-plain-obj-2.1.0.tgz?cache=0&sync_timestamp=1618600554597&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-plain-obj%2Fdownload%2Fis-plain-obj-2.1.0.tgz", + "integrity": "sha1-ReQuN/zPH0Dajl927iFRWEDAkoc=", + "dev": true + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.nlark.com/is-unicode-supported/download/is-unicode-supported-0.1.0.tgz", + "integrity": "sha1-PybHaoCVk7Ur+i7LVxDtJ3m1Iqc=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-4.1.0.tgz?cache=0&sync_timestamp=1618847165988&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-4.1.0.tgz", + "integrity": "sha1-wftl+PUBeQHN0slRhkuhhFihBgI=", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-6.0.0.tgz", + "integrity": "sha1-VTIeswn+u8WcSAHZMackUqaB0oY=", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.nlark.com/log-symbols/download/log-symbols-4.1.0.tgz", + "integrity": "sha1-P727lbRoOsn8eFER55LlWNSr1QM=", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mocha": { + "version": "9.0.2", + "resolved": "https://registry.nlark.com/mocha/download/mocha-9.0.2.tgz?cache=0&sync_timestamp=1625300904944&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmocha%2Fdownload%2Fmocha-9.0.2.tgz", + "integrity": "sha1-6EhJth9AamgM7YWvdkJfbzEI0aA=", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.23", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.3.tgz?cache=0&sync_timestamp=1607433912031&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.3.tgz", + "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=", + "dev": true + }, + "mysql": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "requires": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "nanoid": { + "version": "3.1.23", + "resolved": "https://registry.nlark.com/nanoid/download/nanoid-3.1.23.tgz", + "integrity": "sha1-90QIbOfCvEfuCoRyV01ceOQYOoE=", + "dev": true + }, + "node-date78": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/node-date78/-/node-date78-2.0.0.tgz", + "integrity": "sha512-xtp9a31LXFoWSHglt9BNVsDYruWJlEeSCWmWNJEVZqUhxjmOXSthGoaWyy70fXZa2Xc6ziAa3ovrlM/iw9VjgQ==", + "requires": { + "typescript": "^3.0.3" + } + }, + "node-upinfo": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-upinfo/-/node-upinfo-2.0.1.tgz", + "integrity": "sha512-+g4SWi2upZJgFA+97QselXAlGBN6svanxb4+4W/eOrxZXvzP7p7hgoAhZwPDLOS025aJsj3ROhBAVHDDu3wZFg==", + "requires": { + "node-date78": "^2.0.0" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/normalize-path/download/normalize-path-3.0.0.tgz", + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npm.taobao.org/p-limit/download/p-limit-3.1.0.tgz?cache=0&sync_timestamp=1606288370125&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-limit%2Fdownload%2Fp-limit-3.1.0.tgz", + "integrity": "sha1-4drMvnjQ0TiMoYxk/qOOPlfjcGs=", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/p-locate/download/p-locate-5.0.0.tgz", + "integrity": "sha1-g8gxXGeFAF470CGDlBHJ4RDm2DQ=", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/path-exists/download/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/pathval/download/pathval-1.1.1.tgz", + "integrity": "sha1-hTTnenfOesWiUS6iHg/bj89sPY0=", + "dev": true + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.nlark.com/picomatch/download/picomatch-2.3.0.tgz", + "integrity": "sha1-8fBh3o9qS/AiiS4tEoI0+5gwKXI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npm.taobao.org/randombytes/download/randombytes-2.1.0.tgz", + "integrity": "sha1-32+ENy8CcNxlzfYpE0mrekc9Tyo=", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.nlark.com/readdirp/download/readdirp-3.6.0.tgz", + "integrity": "sha1-dKNwvYVxFuJFspzJc0DNQxoCpsc=", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.2.1.tgz", + "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=", + "dev": true + }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.nlark.com/serialize-javascript/download/serialize-javascript-6.0.0.tgz", + "integrity": "sha1-765diPRdeSQUHai1w6en5mP+/rg=", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=" + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npm.taobao.org/string-width/download/string-width-2.1.1.tgz?cache=0&sync_timestamp=1618558856477&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring-width%2Fdownload%2Fstring-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-4.0.0.tgz?cache=0&sync_timestamp=1618553351145&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-3.1.1.tgz", + "integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.nlark.com/supports-color/download/supports-color-8.1.1.tgz?cache=0&sync_timestamp=1622293670728&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-8.1.1.tgz", + "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw=", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-5.0.1.tgz", + "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npm.taobao.org/type-detect/download/type-detect-4.0.8.tgz", + "integrity": "sha1-dkb7XxiHHPu3dJ5pvTmmOI63RQw=", + "dev": true + }, + "typescript": { + "version": "3.9.10", + "resolved": "https://registry.nlark.com/typescript/download/typescript-3.9.10.tgz", + "integrity": "sha1-cPORCselHta+952ngAaQsZv3eLg=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npm.taobao.org/which/download/which-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwhich%2Fdownload%2Fwhich-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.nlark.com/wide-align/download/wide-align-1.1.3.tgz", + "integrity": "sha1-rgdOa9wMFKQx6ATmJFScYzsABFc=", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "workerpool": { + "version": "6.1.5", + "resolved": "https://registry.nlark.com/workerpool/download/workerpool-6.1.5.tgz", + "integrity": "sha1-D3zwdrYhX9fh2pA/9vIt3RiGtYE=", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-7.0.0.tgz?cache=0&sync_timestamp=1618558923406&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwrap-ansi%2Fdownload%2Fwrap-ansi-7.0.0.tgz", + "integrity": "sha1-Z+FFz/UQpqaYS98RUpEdadLrnkM=", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz?cache=0&sync_timestamp=1618552978881&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-fullwidth-code-point%2Fdownload%2Fis-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npm.taobao.org/string-width/download/string-width-4.2.2.tgz?cache=0&sync_timestamp=1618558856477&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring-width%2Fdownload%2Fstring-width-4.2.2.tgz", + "integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz?cache=0&sync_timestamp=1618553351145&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz?cache=0&sync_timestamp=1619133505879&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwrappy%2Fdownload%2Fwrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npm.taobao.org/y18n/download/y18n-5.0.8.tgz", + "integrity": "sha1-f0k00PfKjFb5UxSTndzS3ZHOHVU=", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.nlark.com/yargs/download/yargs-16.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyargs%2Fdownload%2Fyargs-16.2.0.tgz", + "integrity": "sha1-HIK/D2tqZur85+8w43b0mhJHf2Y=", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz?cache=0&sync_timestamp=1618552978881&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-fullwidth-code-point%2Fdownload%2Fis-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npm.taobao.org/string-width/download/string-width-4.2.2.tgz?cache=0&sync_timestamp=1618558856477&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring-width%2Fdownload%2Fstring-width-4.2.2.tgz", + "integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz?cache=0&sync_timestamp=1618553351145&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.nlark.com/yargs-parser/download/yargs-parser-20.2.4.tgz?cache=0&sync_timestamp=1624233275366&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyargs-parser%2Fdownload%2Fyargs-parser-20.2.4.tgz", + "integrity": "sha1-tCiQ8UVmeW+Fro46JSkNIF8VSlQ=", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/yargs-unparser/download/yargs-unparser-2.0.0.tgz", + "integrity": "sha1-8TH5ImkRrl2a04xDL+gJNmwjJes=", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npm.taobao.org/yocto-queue/download/yocto-queue-0.1.0.tgz?cache=0&sync_timestamp=1606290538096&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fyocto-queue%2Fdownload%2Fyocto-queue-0.1.0.tgz", + "integrity": "sha1-ApTrPe4FAo0x7hpfosVWpqrxChs=", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6203efa --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "node-mysql78", + "version": "1.0.0", + "description": "node-mysql78", + "main": "dist/index.js", + "types": "src/index.ts", + "author": { + "name": "Frieda.Hu<657225485@qq.com>" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/www778878net/node-mysql78.git" + }, + "bugs": { + "url": "https://github.com/www778878net/node-mysql78/issues" + }, + "homepage": "https://github.com/www778878net/node-mysql78#readme", + "license": "Apache-2.0", + "files": [ + "src", + "dist" + ], + "keywords": [ + "typescript", + "mysql", + "nodejs" + ], + "scripts": { + "postpublish": "git push origin --all && git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "mocha --reporter spec", + "build": "tsc" + }, + "engines": { + "node": ">=14.0.0" + }, + "bundledDependencies": false, + "devDependencies": { + "@types/node": "^14.17.3", + "chai": "^4.3.4", + "mocha": "^9.0.2", + "typescript": "^3.0.3" + }, + "dependencies": { + "md5": "^2.3.0", + "mysql": "^2.18.1", + "node-upinfo": "^2.0.1" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..f533bcc --- /dev/null +++ b/src/index.ts @@ -0,0 +1,427 @@ +import UpInfo from "node-upinfo"; +const Util = require('util'); +const mysql = require('mysql'); +import md5 = require("md5"); +import { promises } from "fs"; +export default class Mysql78 { + _pool: any;//ӳ + _host: string;//ַ + isLog: boolean;//Ƿ׷ٵü¼(Ĭдsys_warn Ӱ) + isCount: boolean;//Ƿü(Ĭдsys_sql Ӱ) + /* + * Сʾ + *let config={host:"127.0.0.1",password:"test",database:"testdb"} + * + */ + constructor(config: any) { + this._host = config["host"]; + let port:number = config.port || 3306; + let max: number = config.max || 200; + let user: string = config.user || "root"; + this.isLog = config.isLog || false; + this.isCount = config.isCount || false; + + this._pool = mysql.createPool({ + 'connectionLimit': max, + 'host': this._host, + 'port': port, + 'user': user, + 'password': config.password, + 'database': config.database + , 'dateStrings': true + , 'connectTimeout': 30 * 1000 + }); + } + + /** + * sql get + * @param cmdtext sql + * @param values + * @param up ûϴ(Ҫ־) + */ + doGet(cmdtext: string, values: string[], up: UpInfo): Promise { + values = values || []; + let debug = up.debug || false; + let self = this; + + return new Promise(function (resolve, reject) { + let dstart = new Date(); + self._pool.getConnection(function (err, client) { + if (err) { + console.error(new Date() + 'mysql pool getcon Error: ' + Util.inspect(err)); + reject(err); + return; + } + //console.log(cmdtext) + client.query(cmdtext, values, function (err, back) { + if (debug) { + //console.log(cmdtext + " v:" + values.join(",") + " r:" + Util.inspect(back)); + + self._addWarn(Util.inspect(back) + " c:" + cmdtext + " v" + values.join(","), "debug_" + up.apisys, up); + } + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql GetData Error: ' + cmdtext + Util.inspect(err)); + self._addWarn(Util.inspect(err) + " c:" + cmdtext + " v" + values.join(","), "err_" + up.apisys, up); + + reject(err); + return; + } + else { + if (!back) { + back = []; + } + //Ϊȥһ + var str = JSON.stringify(back); + let lendown = str.length; + back = JSON.parse(str); + + self._saveLog(cmdtext, values, new Date().getTime() - dstart.getTime(), lendown, up); + resolve(back); + } + }); + }); + }); + }; + + /** + * 񷵻زɹ ʧϢ + * @param cmds + * @param values + * @param errtexts ʾ + * @param logtext log + * @param logvalue log + * @param up ûϴ + */ + doT(cmds: string[], values: string[][], errtexts: string[] + , logtext: string, logvalue: string[], up: UpInfo): Promise { + let debug = up.debug || false; + let self = this; + return new Promise((resolve, reject) => { + this._pool.getConnection((err, con) => { + if (err) { + //console.error(new Date() + 'mysql pool getcon Error: ' + Util.inspect(err)); + reject(err); + return; + } + let dstart = new Date(); + con.beginTransaction((err) => { + if (err) throw err; + + let promises: Promise[] = []; + for (var i = 0; i < cmds.length; i++) { + promises.push(self.doTran(cmds[i], values[i], con, up)); + } + Promise.all(promises).then((back: any[]) => { + self._saveLog(logtext, logvalue, new Date().getTime() - dstart.getTime(), 1, up); + var errmsg = "ʧ!"; + var haveAff0 = false; + for (var i = 0; i < back.length; i++) { + if (back[i].affectedRows === 0) { + errmsg += errtexts[i]; + //errmsg += i; + haveAff0 = true; + break; + } + } + if (haveAff0 || back.length < cmds.length) { + con.rollback(); + con.release(); + resolve(errmsg); + return; + } + con.commit(); + con.release(); + resolve("ɹ"); + }).catch(function (err) { + //console.log(err); + resolve(err); + //reject(err); + }) + }); + }); + }); + } + + /** + * sql update Ӱ + * @param cmdtext sql + * @param values + * @param up ûϴ + */ + doM(cmdtext: string, values: string[], up: UpInfo): Promise { + const self = this; + let debug: boolean = up.debug || false; + + return new Promise(function (resolve, reject) { + let dstart = new Date(); + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + client.query(cmdtext, values, function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql doM Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + self._addWarn(Util.inspect(err) + " c:" + cmdtext + " v" + values.join(","), "err" + up.apisys, up); + + resolve(0); + } + else { + //Ϊȥһ + let str = JSON.stringify(results); + let lendown = str.length; + results = JSON.parse(str); + self._saveLog(cmdtext, values, new Date().getTime() - dstart.getTime(), lendown, up); + resolve(results.affectedRows); + } + if (debug) { + //console.log(cmdtext + " v:" + Util.inspect(values) + " r:" + Util.inspect(results)); + self._addWarn(Util.inspect(results) + " c:" + cmdtext + " v" + values.join(","), "debug_" + up.apisys, up); + } + }); + }); + }); + } + + /** + * һ زк + * @param cmdtext + * @param values + * @param up + */ + doMAdd(cmdtext: string, values: string[], up: UpInfo): Promise { + const self = this; + let debug: boolean = up.debug || false; + + return new Promise(function (resolve, reject) { + let dstart = new Date(); + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + client.query(cmdtext, values, function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql doM Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + self._addWarn(Util.inspect(err) + " c:" + cmdtext + " v" + values.join(","), "err" + up.apisys, up); + + resolve(0); + } + else { + //Ϊȥһ + let str = JSON.stringify(results); + let lendown = str.length; + results = JSON.parse(str); + self._saveLog(cmdtext, values, new Date().getTime() - dstart.getTime(), lendown, up); + resolve(results.insertId); + } + if (debug) { + //console.log(cmdtext + " v:" + Util.inspect(values) + " r:" + Util.inspect(results)); + self._addWarn(Util.inspect(results) + " c:" + cmdtext + " v" + values.join(","), "debug_" + up.apisys, up); + } + }); + }); + }); + } + + + /** + * װ һִ(һ㲻 doT ) + * ҪԼͷ + * иӵijҪõ һִгɹ ʲô Ҫع + * @param cmdtext + * @param values + * @param con + * @param up + */ + doTran(cmdtext: string, values: string[], con: any, up: UpInfo): Promise { + let debug = up.debug || false; + return new Promise(function (resolve, reject) { + con.query(cmdtext, values, function (err, result) { + if (debug) { + //console.log(cmdtext + " v:" + values.join(",") + " r:" + Util.inspect(result)); + } + + if (err) { + //console.error('mysql doTran Error: ' + Util.inspect(err)); + reject(Util.inspect(err)); + return; + } + else + resolve(result); + }); + }); + + }; + + /** + * doget doMҪֶͷ + * getConnectionҪ + * */ + releaseConnection(client:any): Promise { + let self = this; + return new Promise(function (resolve, reject) { + self._pool.releaseConnection(client); + resolve("ok") + }) + } + /** + * ȡ(ǵͷ) + * */ + getConnection(): Promise { + let self = this; + return new Promise(function (resolve, reject) { + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + resolve(client) + }) + }) + } + + + /** + * debug ׷SQL ߵ(øûĿ¼) + * 򿪻Ӱ ҪٿԱڿĿ¼ + * sys_warn ں + * @param info log + * @param kind ѯlog + * @param up ûϴ + */ + _addWarn(info: string, kind: string, up: UpInfo): Promise { + let self = this; + + return new Promise(function (resolve, reject) { + if (!self.isLog) { + resolve("isLog is false"); + return; + } + let cmdtext = "INSERT INTO sys_warn (`kind`,apisys,apiobj,`content`,`upby`,`uptime`,`id`,upid)VALUES(?,?,?,?,?,?,?,?)"; + let values = [kind, up.apisys, up.apiobj, info, up.uname, up.uptime, up.getNewid(), up.upid]; + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + client.query(cmdtext, values, function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql doM Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + reject(err); + } + else { + try { + //Ϊȥһ + let str = JSON.stringify(results); + results = JSON.parse(str); + resolve(results.affectedRows); + } + catch (e) { + //console.log(kind + "mysql78__addWarn:" + info); + resolve("0"); + } + } + }); + }); + }); + /* + * CREATE TABLE `sys_warn` ( + `uid` varchar(36) NOT NULL DEFAULT '', + `kind` varchar(100) NOT NULL DEFAULT '', + `apisys` varchar(100) NOT NULL DEFAULT '', + `apiobj` varchar(100) NOT NULL DEFAULT '', + `content` text NOT NULL, + `upid` varchar(36) NOT NULL DEFAULT '', + `upby` varchar(50) DEFAULT '', + `uptime` datetime NOT NULL, + `idpk` int(11) NOT NULL AUTO_INCREMENT, + `id` varchar(36) NOT NULL, + `remark` varchar(200) NOT NULL DEFAULT '', + `remark2` varchar(200) NOT NULL DEFAULT '', + `remark3` varchar(200) NOT NULL DEFAULT '', + `remark4` varchar(200) NOT NULL DEFAULT '', + `remark5` varchar(200) NOT NULL DEFAULT '', + `remark6` varchar(200) NOT NULL DEFAULT '', + PRIMARY KEY (`idpk`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + */ + } + + + /** + * ͳƹ(sys_sql ں 򿪻Ӱ) + * @param cmdtext SQL + * @param values ֵ + * @param dlong ʱ + * @param lendown ֽ + * @param up ûϴ + */ + _saveLog(cmdtext: string, values: string[], dlong: number, lendown: number, up: UpInfo ): Promise { + let self = this; + + return new Promise(function (resolve, reject) { + if (!self.isCount) { + resolve("isCount is false"); + return; + } + self._pool.getConnection(function (err, client) { + if (err) { + reject(err); + return; + } + + let cmdtextmd5 = md5(cmdtext); + let sb = "INSERT INTO sys_sql(apiv,apisys,apiobj,cmdtext,num,dlong,downlen,id,uptime,cmdtextmd5)VALUES(?,?,?,?,?,?,?,?,?,?)" + + "ON DUPLICATE KEY UPDATE num=num+1,dlong=dlong+?,downlen=downlen+?"; + client.query(sb, [up.apiv, up.apisys, up.apiobj, cmdtext, 1, dlong, lendown, up.getNewid(), new Date(), cmdtextmd5 + , dlong, lendown], function (err, results) { + //client.release();//.end() + self._pool.releaseConnection(client); + if (err) { + //console.error(new Date() + 'mysql _saveLog Error: ' + cmdtext + Util.inspect(err) + Util.inspect(values)); + reject(err); + return; + } + else + resolve("ok"); + }); + }); + }); + + /* + * CREATE TABLE `sys_sql` ( + `cid` varchar(36) NOT NULL DEFAULT '', + `apiv` varchar(50) NOT NULL DEFAULT '', + `apisys` varchar(50) NOT NULL DEFAULT '', + `apiobj` varchar(50) NOT NULL DEFAULT '', + `cmdtext` varchar(200) NOT NULL, + `uname` varchar(50) NOT NULL DEFAULT '', + `num` int(11) NOT NULL DEFAULT '0', + `dlong` int(32) NOT NULL DEFAULT '0', + `downlen` int(32) NOT NULL DEFAULT '0', + `upby` varchar(50) NOT NULL DEFAULT '', + `cmdtextmd5` varchar(50) NOT NULL DEFAULT '', + `uptime` datetime NOT NULL, + `idpk` int(11) NOT NULL AUTO_INCREMENT, + `id` varchar(36) NOT NULL, + `remark` varchar(200) NOT NULL DEFAULT '', + `remark2` varchar(200) NOT NULL DEFAULT '', + `remark3` varchar(200) NOT NULL DEFAULT '', + `remark4` varchar(200) NOT NULL DEFAULT '', + `remark5` varchar(200) NOT NULL DEFAULT '', + `remark6` varchar(200) NOT NULL DEFAULT '', + PRIMARY KEY (`idpk`), + UNIQUE KEY `u_v_sys_obj_cmdtext` (`apiv`,`apisys`,`apiobj`,`cmdtext`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + */ + } +} \ No newline at end of file diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..291b282 --- /dev/null +++ b/test/test.js @@ -0,0 +1,11 @@ +'use strict'; +const expect = require('chai').expect; +//const add = require('../dist/index').add; +//ȹ ŪߵСݿһ + +describe('ts-hi function test', () => { + it('should return 3', () => { + const result = 3;// add(1, 1); + expect(result).to.equal(3); + }); +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..ecdc3bf --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "./dist", + "skipLibCheck": true, + "noImplicitAny": false, + "sourceMap": true, + "strict": true + }, + + "exclude": [ + "node_modules" + ] +}