pp-robot-module 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +34 -0
  2. package/dist/MR/Ai.d.ts +8 -0
  3. package/dist/MR/Ai.js +24 -0
  4. package/dist/MR/Clipboard.d.ts +20 -0
  5. package/dist/MR/Clipboard.js +60 -0
  6. package/dist/MR/Csv.d.ts +20 -0
  7. package/dist/MR/Csv.js +56 -0
  8. package/dist/MR/Date.d.ts +60 -0
  9. package/dist/MR/Date.js +94 -0
  10. package/dist/MR/DbClient.d.ts +97 -0
  11. package/dist/MR/DbClient.js +269 -0
  12. package/dist/MR/Dialog.d.ts +0 -0
  13. package/dist/MR/Dialog.js +40 -0
  14. package/dist/MR/Excel.d.ts +110 -0
  15. package/dist/MR/Excel.js +316 -0
  16. package/dist/MR/File.d.ts +162 -0
  17. package/dist/MR/File.js +399 -0
  18. package/dist/MR/Hash.d.ts +12 -0
  19. package/dist/MR/Hash.js +21 -0
  20. package/dist/MR/Html.d.ts +38 -0
  21. package/dist/MR/Html.js +163 -0
  22. package/dist/MR/Http.d.ts +33 -0
  23. package/dist/MR/Http.js +121 -0
  24. package/dist/MR/Imap.d.ts +15 -0
  25. package/dist/MR/Imap.js +52 -0
  26. package/dist/MR/Ini.d.ts +31 -0
  27. package/dist/MR/Ini.js +55 -0
  28. package/dist/MR/Keyboard.d.ts +59 -0
  29. package/dist/MR/Keyboard.js +515 -0
  30. package/dist/MR/Log.d.ts +7 -0
  31. package/dist/MR/Log.js +52 -0
  32. package/dist/MR/Mouse.d.ts +51 -0
  33. package/dist/MR/Mouse.js +152 -0
  34. package/dist/MR/Net.d.ts +17 -0
  35. package/dist/MR/Net.js +74 -0
  36. package/dist/MR/Pdf.d.ts +113 -0
  37. package/dist/MR/Pdf.js +197 -0
  38. package/dist/MR/Process.d.ts +46 -0
  39. package/dist/MR/Process.js +106 -0
  40. package/dist/MR/QRcode.d.ts +13 -0
  41. package/dist/MR/QRcode.js +37 -0
  42. package/dist/MR/RedisClient.d.ts +40 -0
  43. package/dist/MR/RedisClient.js +183 -0
  44. package/dist/MR/Regex.d.ts +16 -0
  45. package/dist/MR/Regex.js +20 -0
  46. package/dist/MR/Robot.d.ts +19 -0
  47. package/dist/MR/Robot.js +31 -0
  48. package/dist/MR/Screen.d.ts +20 -0
  49. package/dist/MR/Screen.js +79 -0
  50. package/dist/MR/Smtp.d.ts +21 -0
  51. package/dist/MR/Smtp.js +83 -0
  52. package/dist/MR/String.d.ts +104 -0
  53. package/dist/MR/String.js +166 -0
  54. package/dist/MR/System.d.ts +31 -0
  55. package/dist/MR/System.js +201 -0
  56. package/dist/MR/Validator.d.ts +30 -0
  57. package/dist/MR/Validator.js +104 -0
  58. package/dist/MR/WebBrowser.d.ts +210 -0
  59. package/dist/MR/WebBrowser.js +484 -0
  60. package/dist/MR/WebBrowser2.d.ts +0 -0
  61. package/dist/MR/WebBrowser2.js +504 -0
  62. package/dist/MR/WebElement.d.ts +123 -0
  63. package/dist/MR/WebElement.js +172 -0
  64. package/dist/MR/WebKeyboard.d.ts +21 -0
  65. package/dist/MR/WebKeyboard.js +48 -0
  66. package/dist/MR/WebMouse.d.ts +46 -0
  67. package/dist/MR/WebMouse.js +79 -0
  68. package/dist/MR/Window.d.ts +8 -0
  69. package/dist/MR/Window.js +34 -0
  70. package/dist/MR/Word.d.ts +56 -0
  71. package/dist/MR/Word.js +220 -0
  72. package/dist/MR/Zip.d.ts +25 -0
  73. package/dist/MR/Zip.js +89 -0
  74. package/dist/bin/inputting-method.exe +0 -0
  75. package/dist/bin/keyboard-password.exe +0 -0
  76. package/dist/bin/lock-window.exe +0 -0
  77. package/dist/bin/printer-pdf.exe +0 -0
  78. package/dist/dotenv.d.ts +0 -0
  79. package/dist/dotenv.js +2 -0
  80. package/dist/index.d.ts +54 -0
  81. package/dist/index.js +63 -0
  82. package/dist/util.d.ts +17 -0
  83. package/dist/util.js +41 -0
  84. package/package.json +120 -0
@@ -0,0 +1,220 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MR = void 0;
13
+ const fs = require("fs");
14
+ const path = require("path");
15
+ const Log_1 = require("./Log");
16
+ const docx_1 = require("docx");
17
+ const mammoth = require("mammoth");
18
+ var MR;
19
+ (function (MR) {
20
+ class Word {
21
+ constructor() { }
22
+ static text(params) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ Log_1.default.debug("Word.text", params);
25
+ const result = yield mammoth.extractRawText({ path: params._filename });
26
+ const _text = result.value;
27
+ return _text;
28
+ //var messages = result.messages;
29
+ });
30
+ }
31
+ static toHtml(params) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ Log_1.default.debug("Word.toHtml", params);
34
+ const parentPath = path.dirname(params._filename);
35
+ const fileNameWithoutExt = path.basename(params._filename, path.extname(params._filename));
36
+ const output = path.join(parentPath, fileNameWithoutExt + "-output.pdf");
37
+ const result = yield mammoth.convertToHtml({ path: params._filename });
38
+ const _text = result.value;
39
+ fs.writeFileSync(output, _text);
40
+ return output;
41
+ });
42
+ }
43
+ static buildHeaderFooter(params) {
44
+ Log_1.default.debug("Word.buildHeaderFooter", params);
45
+ //TODO
46
+ }
47
+ static buildImage(params) {
48
+ Log_1.default.debug("Word.buildImage", params);
49
+ const image = new docx_1.ImageRun({
50
+ data: fs.readFileSync(params._filename),
51
+ transformation: {
52
+ width: params._width || 100,
53
+ height: params._height || 100,
54
+ }
55
+ });
56
+ return image;
57
+ }
58
+ static buildTable(params) {
59
+ Log_1.default.debug("Word.buildTable", params);
60
+ if (!Array.isArray(params._rows)) {
61
+ return;
62
+ }
63
+ let mutli = false;
64
+ for (let i = 0; i < params._rows.length; i++) {
65
+ if (Array.isArray(params._rows[i])) {
66
+ mutli = true;
67
+ }
68
+ }
69
+ let _rows_ = [];
70
+ if (!mutli) {
71
+ let cells = [];
72
+ for (let i = 0; i < params._rows.length; i++) {
73
+ if (params._rows instanceof Array) { }
74
+ else {
75
+ let str = params._rows[i] || '';
76
+ let cell = new docx_1.TableCell({
77
+ children: [new docx_1.Paragraph(str)],
78
+ });
79
+ cells.push(cell);
80
+ }
81
+ }
82
+ _rows_.push(new docx_1.TableRow({ children: cells }));
83
+ }
84
+ else {
85
+ //二维数组
86
+ for (let i = 0; i < params._rows.length; i++) {
87
+ if (Array.isArray(params._rows[i])) {
88
+ let cells = [];
89
+ for (let j = 0; j < params._rows[i].length; j++) {
90
+ let str = params._rows[i][j] || '';
91
+ let cell = new docx_1.TableCell({ children: [new docx_1.Paragraph(str)], });
92
+ cells.push(cell);
93
+ }
94
+ _rows_.push(new docx_1.TableRow({ children: cells }));
95
+ }
96
+ }
97
+ }
98
+ const opt = { rows: _rows_ };
99
+ if (params._width) {
100
+ opt['width'] = {
101
+ size: params._width,
102
+ type: docx_1.WidthType.DXA,
103
+ };
104
+ }
105
+ if (params._indent) {
106
+ opt['indent'] = {
107
+ size: params._indent,
108
+ type: docx_1.WidthType.DXA,
109
+ };
110
+ }
111
+ return new docx_1.Table(opt);
112
+ }
113
+ static buildText(params) {
114
+ Log_1.default.debug("Word.buildText", params);
115
+ const opt = {};
116
+ opt['text'] = params._str;
117
+ if (params._bold)
118
+ opt['bold'] = params._bold;
119
+ if (params._italics)
120
+ opt['italics'] = params._italics;
121
+ if (params._strike)
122
+ opt['strike'] = params._strike;
123
+ if (params._doubleStrike)
124
+ opt['doubleStrike'] = params._doubleStrike;
125
+ if (params._superScript)
126
+ opt['superScript'] = params._superScript;
127
+ if (params._subScript)
128
+ opt['subScript'] = params._subScript;
129
+ if (params._allCaps)
130
+ opt['allCaps'] = params._allCaps;
131
+ if (params._smallCaps)
132
+ opt['smallCaps'] = params._smallCaps;
133
+ if (params._break)
134
+ opt['break'] = params._break;
135
+ if (params._emphasisMark)
136
+ opt['emphasisMark'] = params._emphasisMark;
137
+ if (params._underline)
138
+ opt['underline'] = params._underline;
139
+ if (params._shading)
140
+ opt['shading'] = params._shading;
141
+ const text = new docx_1.TextRun(opt);
142
+ return text;
143
+ }
144
+ static buildParagraph(params) {
145
+ Log_1.default.debug("Word.buildParagraph", params);
146
+ const children = [];
147
+ if (params._text) {
148
+ if (params._text instanceof Array) {
149
+ params._text.forEach((element, index, array) => {
150
+ children.push(element);
151
+ });
152
+ }
153
+ else {
154
+ children.push(params._text);
155
+ }
156
+ }
157
+ if (params._image) {
158
+ if (params._image instanceof Array) {
159
+ params._image.forEach((element, index, array) => {
160
+ children.push(element);
161
+ });
162
+ }
163
+ else {
164
+ children.push(params._image);
165
+ }
166
+ }
167
+ if (params._table) {
168
+ if (params._table instanceof Array) {
169
+ params._table.forEach((element, index, array) => {
170
+ children.push(element);
171
+ });
172
+ }
173
+ else {
174
+ children.push(params._table);
175
+ }
176
+ }
177
+ const para = new docx_1.Paragraph({
178
+ children
179
+ });
180
+ return para;
181
+ }
182
+ static create(params) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ Log_1.default.debug("Word.create", params);
185
+ const doc = new docx_1.Document({
186
+ sections: [
187
+ {
188
+ properties: {},
189
+ children: params._para,
190
+ },
191
+ ],
192
+ });
193
+ const buffer = yield docx_1.Packer.toBuffer(doc);
194
+ fs.writeFileSync(params._filename, buffer);
195
+ });
196
+ }
197
+ static template(params) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ Log_1.default.debug("Word.template", params);
200
+ const getPatches = (fields) => {
201
+ const patches = {};
202
+ for (const field in fields) {
203
+ patches[field] = {
204
+ type: docx_1.PatchType.PARAGRAPH,
205
+ children: [new docx_1.TextRun({ text: fields[field] })],
206
+ };
207
+ }
208
+ return patches;
209
+ };
210
+ const patches = getPatches(params._json);
211
+ const doc = yield (0, docx_1.patchDocument)(fs.readFileSync(params._tempfilename), {
212
+ patches,
213
+ });
214
+ fs.writeFileSync(params._filename, doc);
215
+ });
216
+ }
217
+ }
218
+ MR.Word = Word;
219
+ })(MR = exports.MR || (exports.MR = {}));
220
+ exports.default = MR.Word;
@@ -0,0 +1,25 @@
1
+ export declare namespace MR {
2
+ class Zip {
3
+ private static outDir;
4
+ private constructor();
5
+ private static writeFileSync;
6
+ /**
7
+ * Decompresses the specified zip file.
8
+ */
9
+ static decompress(params: {
10
+ _filename: string;
11
+ }): Promise<string[]>;
12
+ private static readDir;
13
+ /**
14
+ * compresses the specified folder
15
+ */
16
+ static compress(params: {
17
+ _sourcePath: string;
18
+ _zipName: string;
19
+ _targetPath: string;
20
+ _filter?: Array<string>;
21
+ }): Promise<void>;
22
+ }
23
+ }
24
+ declare const _default: typeof MR.Zip;
25
+ export default _default;
package/dist/MR/Zip.js ADDED
@@ -0,0 +1,89 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MR = void 0;
13
+ const path = require("path");
14
+ const fs = require("fs");
15
+ const unzipper = require("unzipper");
16
+ const Log_1 = require("./Log");
17
+ var JSZip = require("jszip");
18
+ var MR;
19
+ (function (MR) {
20
+ class Zip {
21
+ constructor() { } // eslint-disable-line no-useless-constructor, no-empty-function
22
+ static writeFileSync(file) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ fs.writeFileSync(path.join(this.outDir, file.path), yield file.buffer());
25
+ return file.path;
26
+ });
27
+ }
28
+ /**
29
+ * Decompresses the specified zip file.
30
+ */
31
+ static decompress(params) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const filePath = path.join(this.outDir, params._filename);
34
+ Log_1.default.debug("Zip.decompress", params);
35
+ const directory = yield unzipper.Open.file(filePath);
36
+ const results = [];
37
+ for (let i = 0; i < directory.files.length; i += 1) {
38
+ const file = directory.files[i];
39
+ if (file.path.slice(-1) === "/") {
40
+ fs.mkdirSync(path.join(this.outDir, file.path));
41
+ }
42
+ else {
43
+ results.push(this.writeFileSync(file));
44
+ }
45
+ }
46
+ return Promise.all(results);
47
+ });
48
+ }
49
+ // zip 递归读取文件夹下的文件流 排除部分文件或文件夹
50
+ static readDir(zip, nowPath, filterArr) {
51
+ // 同步操作
52
+ let files = fs.readdirSync(nowPath);
53
+ let exclude = name => !filterArr.includes(name);
54
+ files.filter(exclude).forEach((fileName, index) => {
55
+ console.log(fileName, index);
56
+ let fillPath = path.join(nowPath, fileName);
57
+ let file = fs.statSync(fillPath);
58
+ if (file.isDirectory()) {
59
+ let dirlist = zip.folder(fileName);
60
+ Zip.readDir(dirlist, fillPath, filterArr);
61
+ }
62
+ else {
63
+ // 压缩目录添加文件
64
+ zip.file(fileName, fs.readFileSync(fillPath));
65
+ }
66
+ });
67
+ }
68
+ /**
69
+ * compresses the specified folder
70
+ */
71
+ static compress(params) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const zip = new JSZip();
74
+ const output = params._targetPath + '/' + params._zipName;
75
+ Zip.readDir(zip, params._sourcePath, params._filter);
76
+ zip.generateAsync({
77
+ type: 'nodebuffer',
78
+ compression: 'DEFLATE',
79
+ compressionOptions: { level: 9, },
80
+ }).then(content => {
81
+ fs.writeFileSync(output, content, 'utf-8');
82
+ });
83
+ });
84
+ }
85
+ }
86
+ Zip.outDir = process.env.WORKSPACE_DIR || "./";
87
+ MR.Zip = Zip;
88
+ })(MR = exports.MR || (exports.MR = {}));
89
+ exports.default = MR.Zip;
Binary file
Binary file
Binary file
Binary file
File without changes
package/dist/dotenv.js ADDED
@@ -0,0 +1,2 @@
1
+ require('dotenv').config();
2
+ console.log(process.env); // remove this after you've confirmed it is working
@@ -0,0 +1,54 @@
1
+ import * as WebBrowserModule from "./MR/WebBrowser";
2
+ import SystemModule from "./MR/System";
3
+ import SmtpModule from "./MR/Smtp";
4
+ import ImapModule from "./MR/Imap";
5
+ import StringModule from "./MR/String";
6
+ import MouseModule from "./MR/Mouse";
7
+ import KeyboardModule from "./MR/Keyboard";
8
+ import ScreenModule from "./MR/Screen";
9
+ import WindowModule from "./MR/Window";
10
+ import ClipboardModule from "./MR/Clipboard";
11
+ import ZipModule from "./MR/Zip";
12
+ import FileModule from "./MR/File";
13
+ import ValidatorModule from "./MR/Validator";
14
+ import NetModule from "./MR/Net";
15
+ import CsvModule from "./MR/Csv";
16
+ import PdfModule from "./MR/Pdf";
17
+ import IniModule from "./MR/Ini";
18
+ import DateModule from "./MR/Date";
19
+ import ProcessModule from "./MR/Process";
20
+ import HttpModule from "./MR/Http";
21
+ import RegexModule from "./MR/Regex";
22
+ import WordModule from "./MR/Word";
23
+ import HtmlModule from "./MR/Html";
24
+ export declare namespace MR {
25
+ const Word: typeof WordModule;
26
+ const Html: typeof HtmlModule;
27
+ const Regex: typeof RegexModule;
28
+ const Http: typeof HttpModule;
29
+ const Web: WebBrowserModule.MR.WebBrowser;
30
+ const System: typeof SystemModule;
31
+ const Excel: import("./MR/Excel").MR.Excel;
32
+ const Smtp: typeof SmtpModule;
33
+ const Imap: typeof ImapModule;
34
+ const Date: typeof DateModule;
35
+ const String: typeof StringModule;
36
+ const Pdf: typeof PdfModule;
37
+ const Csv: typeof CsvModule;
38
+ const Net: typeof NetModule;
39
+ const Redis: import("./MR/RedisClient").MR.MyRedis;
40
+ const Db: import("./MR/DbClient").MR.DbClient;
41
+ const Validator: typeof ValidatorModule;
42
+ const Ini: typeof IniModule;
43
+ const sleep: (msec: number) => Promise<void>, prompt: (question: string) => Promise<string>, retry: <T>(asyncFunc: () => Promise<T>, retryCount?: number) => Promise<T>;
44
+ const Mouse: typeof MouseModule;
45
+ const Keyboard: typeof KeyboardModule;
46
+ const Screen: typeof ScreenModule;
47
+ const Window: typeof WindowModule;
48
+ const Clipboard: typeof ClipboardModule;
49
+ const Log: import("log4js").Logger;
50
+ const Zip: typeof ZipModule;
51
+ const File: typeof FileModule;
52
+ const Process: typeof ProcessModule;
53
+ }
54
+ export default MR;
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MR = void 0;
4
+ const WebBrowserModule = require("./MR/WebBrowser");
5
+ const System_1 = require("./MR/System");
6
+ const Smtp_1 = require("./MR/Smtp");
7
+ const Imap_1 = require("./MR/Imap");
8
+ const String_1 = require("./MR/String");
9
+ const util_1 = require("./util");
10
+ const Mouse_1 = require("./MR/Mouse");
11
+ const Keyboard_1 = require("./MR/Keyboard");
12
+ const Screen_1 = require("./MR/Screen");
13
+ const Window_1 = require("./MR/Window");
14
+ const Clipboard_1 = require("./MR/Clipboard");
15
+ const Log_1 = require("./MR/Log");
16
+ const Zip_1 = require("./MR/Zip");
17
+ const RedisClient_1 = require("./MR/RedisClient");
18
+ const DbClient_1 = require("./MR/DbClient");
19
+ const File_1 = require("./MR/File");
20
+ const Validator_1 = require("./MR/Validator");
21
+ const Net_1 = require("./MR/Net");
22
+ const Csv_1 = require("./MR/Csv");
23
+ const Pdf_1 = require("./MR/Pdf");
24
+ const Ini_1 = require("./MR/Ini");
25
+ const Date_1 = require("./MR/Date");
26
+ const Excel_1 = require("./MR/Excel");
27
+ const Process_1 = require("./MR/Process");
28
+ const Http_1 = require("./MR/Http");
29
+ const Regex_1 = require("./MR/Regex");
30
+ const Word_1 = require("./MR/Word");
31
+ const Html_1 = require("./MR/Html");
32
+ var MR;
33
+ (function (MR) {
34
+ MR.Word = Word_1.default;
35
+ MR.Html = Html_1.default;
36
+ MR.Regex = Regex_1.default;
37
+ MR.Http = Http_1.default;
38
+ MR.Web = WebBrowserModule.default;
39
+ MR.System = System_1.default;
40
+ MR.Excel = Excel_1.default;
41
+ MR.Smtp = Smtp_1.default;
42
+ MR.Imap = Imap_1.default;
43
+ MR.Date = Date_1.default;
44
+ MR.String = String_1.default;
45
+ MR.Pdf = Pdf_1.default;
46
+ MR.Csv = Csv_1.default;
47
+ MR.Net = Net_1.default;
48
+ MR.Redis = RedisClient_1.default;
49
+ MR.Db = DbClient_1.default;
50
+ MR.Validator = Validator_1.default;
51
+ MR.Ini = Ini_1.default;
52
+ MR.sleep = util_1.default.sleep, MR.prompt = util_1.default.prompt, MR.retry = util_1.default.retry;
53
+ MR.Mouse = Mouse_1.default;
54
+ MR.Keyboard = Keyboard_1.default;
55
+ MR.Screen = Screen_1.default;
56
+ MR.Window = Window_1.default;
57
+ MR.Clipboard = Clipboard_1.default;
58
+ MR.Log = Log_1.default;
59
+ MR.Zip = Zip_1.default;
60
+ MR.File = File_1.default;
61
+ MR.Process = Process_1.default;
62
+ })(MR = exports.MR || (exports.MR = {}));
63
+ exports.default = MR;
package/dist/util.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import * as lo from 'lodash';
2
+ export declare namespace MR {
3
+ /**
4
+ * Suspends execution for an interval of time.
5
+ */
6
+ const sleep: (msec: number) => Promise<void>;
7
+ /**
8
+ * Waits for user input to be provided to stdin then returns that.
9
+ */
10
+ const prompt: (question: string) => Promise<string>;
11
+ /**
12
+ * Executes up to `retryCount` times until `asyncFunc` resolves
13
+ */
14
+ const retry: <T>(asyncFunc: () => Promise<T>, retryCount?: number) => Promise<T>;
15
+ const _: lo.LoDashStatic;
16
+ }
17
+ export default MR;
package/dist/util.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MR = void 0;
4
+ const readline = require("readline");
5
+ const lo = require("lodash");
6
+ var MR;
7
+ (function (MR) {
8
+ /**
9
+ * Suspends execution for an interval of time.
10
+ */
11
+ MR.sleep = (msec) => new Promise((resolve) => {
12
+ setTimeout(() => {
13
+ resolve();
14
+ }, msec);
15
+ });
16
+ /**
17
+ * Waits for user input to be provided to stdin then returns that.
18
+ */
19
+ MR.prompt = (question) => {
20
+ const stdio = readline.createInterface(process.stdin, process.stdout);
21
+ return new Promise((resolve) => {
22
+ stdio.question(question, (answer) => {
23
+ stdio.close();
24
+ resolve(answer);
25
+ });
26
+ });
27
+ };
28
+ /**
29
+ * Executes up to `retryCount` times until `asyncFunc` resolves
30
+ */
31
+ MR.retry = (asyncFunc, retryCount = 3) => {
32
+ const nums = Array.from(Array(retryCount));
33
+ return nums.reduce((prm, _, i) => {
34
+ return prm.catch(() => MR.sleep(i * 1000).then(asyncFunc));
35
+ }, Promise.reject());
36
+ };
37
+ //适配gpt
38
+ //lodash 数组 集合 函数 语言 数学 对象 序列 字符串
39
+ MR._ = lo;
40
+ })(MR = exports.MR || (exports.MR = {}));
41
+ exports.default = MR;
package/package.json ADDED
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "pp-robot-module",
3
+ "version": "0.2.14",
4
+ "description": "makwing for inner testting",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/**/*"
8
+ ],
9
+ "scripts": {
10
+ "build": "rimraf ./dist && require-self && tsc && npm run copyFile",
11
+ "doc": "rimraf ./docs && typedoc",
12
+ "prepare": "npm run build",
13
+ "lint": "eslint '+(src|tests)/**' --ext .ts",
14
+ "fix": "eslint '+(src|tests)/**' --ext .ts --fix",
15
+ "test": "jest -w 1 --forceExit",
16
+ "copyFile": "xcopy /y /e /i .\\src\\bin .\\dist\\bin"
17
+ },
18
+ "jest": {
19
+ "testTimeout": 20000,
20
+ "testPathIgnorePatterns": [
21
+ "./dist/",
22
+ "./node_modules/"
23
+ ],
24
+ "transform": {
25
+ "^.+\\.(t|j)sx?$": "ts-jest"
26
+ },
27
+ "testRegex": "/test/.*\\.spec\\.(ts|js)$",
28
+ "moduleFileExtensions": [
29
+ "ts",
30
+ "js"
31
+ ],
32
+ "globals": {
33
+ "ts-jest": {
34
+ "tsConfig": "tsconfig.json"
35
+ }
36
+ },
37
+ "setupFiles": [
38
+ "<rootDir>/jest-env.js"
39
+ ]
40
+ },
41
+ "pre-commit": [],
42
+ "author": "makwing",
43
+ "license": "ISC",
44
+ "dependencies": {
45
+ "@nut-tree/nut-js": "3.1.1",
46
+ "cheerio": "1.0.0-rc.12",
47
+ "clipboard-sys": "1.2.0",
48
+ "csv": "5.1.1",
49
+ "csvtojson": "2.0.10",
50
+ "dayjs": "1.11.7",
51
+ "docx": "8.0.4",
52
+ "dotenv": "16.0.3",
53
+ "excel4node": "1.8.2",
54
+ "express": "4.18.2",
55
+ "file-type": "12.0.1",
56
+ "fkill": "7.2.1",
57
+ "form-data": "4.0.0",
58
+ "htmlparser2": "9.0.0",
59
+ "iconv-lite": "0.6.3",
60
+ "ini": "4.0.0",
61
+ "ioredis": "5.3.1",
62
+ "is-utf8": "0.2.1",
63
+ "json-2-csv": "4.0.0",
64
+ "jszip": "3.10.1",
65
+ "knex": "2.4.2",
66
+ "lodash": "4.17.21",
67
+ "log4js": "6.8.0",
68
+ "mail-listener2": "0.3.1",
69
+ "mammoth": "1.5.1",
70
+ "mime-stream": "1.0.1",
71
+ "muhammara": "3.8.0",
72
+ "mysql": "2.18.1",
73
+ "node-fetch": "2.6.9",
74
+ "node-forge": "1.3.1",
75
+ "nodemailer": "6.9.1",
76
+ "pdf-lib": "1.17.1",
77
+ "pdf.js-extract": "0.2.1",
78
+ "pg": "8.10.0",
79
+ "pkg": "5.8.1",
80
+ "pkginfo": "0.4.1",
81
+ "playwright": "1.34.3",
82
+ "redis": "4.6.5",
83
+ "require-self": "0.2.3",
84
+ "rimraf": "4.1.2",
85
+ "shelljs": "0.8.5",
86
+ "string": "3.3.3",
87
+ "systeminformation": "5.17.12",
88
+ "tableify": "1.1.1",
89
+ "tabletojson": "2.0.7",
90
+ "top-user-agents": "1.0.52",
91
+ "typescript": "4.9.5",
92
+ "unzipper": "0.10.11",
93
+ "validator": "13.9.0",
94
+ "xlsx": "0.18.5"
95
+ },
96
+ "devDependencies": {
97
+ "@types/jest": "29.4.0",
98
+ "@types/lodash": "4.14.191",
99
+ "@types/node": "16.18.25",
100
+ "@types/node-fetch": "2.6.2",
101
+ "@types/node-forge": "1.3.1",
102
+ "@types/nodemailer": "6.4.7",
103
+ "@typescript-eslint/eslint-plugin": "5.54.0",
104
+ "@typescript-eslint/parser": "5.54.0",
105
+ "eslint": "8.35.0",
106
+ "eslint-config-airbnb-base": "15.0.0",
107
+ "eslint-config-prettier": "8.6.0",
108
+ "eslint-import-resolver-typescript": "3.5.3",
109
+ "eslint-plugin-import": "2.27.5",
110
+ "eslint-plugin-jest": "27.2.1",
111
+ "eslint-plugin-prettier": "4.2.1",
112
+ "jest": "29.4.3",
113
+ "pre-commit": "1.2.2",
114
+ "prettier": "2.8.4",
115
+ "ts-jest": "29.0.5",
116
+ "ts-node": "10.9.1",
117
+ "typedoc": "0.23.26",
118
+ "typedoc-plugin-localization": "2.4.0"
119
+ }
120
+ }