@open-wa/wa-automate 4.28.8 → 4.28.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Client.d.ts +4 -0
- package/dist/api/Client.js +8 -0
- package/dist/api/model/sessionInfo.d.ts +3 -0
- package/dist/cli/index.js +1 -0
- package/dist/controllers/browser.js +1 -1
- package/dist/controllers/initializer.js +3 -15
- package/dist/utils/tools.d.ts +3 -1
- package/dist/utils/tools.js +23 -1
- package/package.json +4 -1
package/dist/api/Client.d.ts
CHANGED
@@ -794,6 +794,10 @@ export declare class Client {
|
|
794
794
|
*/
|
795
795
|
getAllContacts(): Promise<Contact[]>;
|
796
796
|
getWAVersion(): Promise<string>;
|
797
|
+
/**
|
798
|
+
* Generate a pre-filled github issue link to easily report a bug
|
799
|
+
*/
|
800
|
+
getIssueLink(): Promise<string>;
|
797
801
|
/**
|
798
802
|
* Retrieves if the phone is online. Please note that this may not be real time.
|
799
803
|
* @returns Boolean
|
package/dist/api/Client.js
CHANGED
@@ -1816,6 +1816,14 @@ class Client {
|
|
1816
1816
|
return yield this.pup(() => WAPI.getWAVersion());
|
1817
1817
|
});
|
1818
1818
|
}
|
1819
|
+
/**
|
1820
|
+
* Generate a pre-filled github issue link to easily report a bug
|
1821
|
+
*/
|
1822
|
+
getIssueLink() {
|
1823
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1824
|
+
return (0, tools_1.generateGHIssueLink)(this.getConfig(), this.getSessionInfo());
|
1825
|
+
});
|
1826
|
+
}
|
1819
1827
|
/**
|
1820
1828
|
* Retrieves if the phone is online. Please note that this may not be real time.
|
1821
1829
|
* @returns Boolean
|
package/dist/cli/index.js
CHANGED
@@ -39,6 +39,7 @@ const ready = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
39
|
function start() {
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
41
41
|
const { cliConfig, createConfig, PORT, spinner } = (0, setup_1.cli)();
|
42
|
+
process.env.OWA_CLI = "true";
|
42
43
|
spinner.start("Launching EASY API");
|
43
44
|
(0, server_1.setUpExpressApp)();
|
44
45
|
if (cliConfig.cors)
|
@@ -356,7 +356,7 @@ function initBrowser(sessionId, config = {}, spinner) {
|
|
356
356
|
try {
|
357
357
|
// const tunnel = await devtools.createTunnel(browser);
|
358
358
|
const tunnel = config.devtools == 'local' ? devtools.getLocalDevToolsUrl(browser) : (yield devtools.createTunnel(browser)).url;
|
359
|
-
const l = `\ndevtools URL: ${typeof config.devtools == 'object' ? Object.assign(Object.assign({}, config.devtools), { tunnel }) : tunnel}`;
|
359
|
+
const l = `\ndevtools URL: ${typeof config.devtools == 'object' ? JSON.stringify(Object.assign(Object.assign({}, config.devtools), { tunnel }), null, 2) : tunnel}`;
|
360
360
|
spinner.info(l);
|
361
361
|
}
|
362
362
|
catch (error) {
|
@@ -27,17 +27,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
27
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
28
28
|
});
|
29
29
|
};
|
30
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
31
|
-
var t = {};
|
32
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
33
|
-
t[p] = s[p];
|
34
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
35
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
36
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
37
|
-
t[p[i]] = s[p[i]];
|
38
|
-
}
|
39
|
-
return t;
|
40
|
-
};
|
41
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
42
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
43
32
|
};
|
@@ -218,11 +207,10 @@ function create(config = {}) {
|
|
218
207
|
console.table(debugInfo);
|
219
208
|
logging_1.log.info('Debug info:', debugInfo);
|
220
209
|
}
|
210
|
+
debugInfo.LATEST_VERSION = !((notifier === null || notifier === void 0 ? void 0 : notifier.update) && ((notifier === null || notifier === void 0 ? void 0 : notifier.update.latest) !== exports.pkg.version));
|
211
|
+
debugInfo.CLI = process.env.OWA_CLI && true || false;
|
221
212
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
222
|
-
spinner.succeed('Use this easy pre-filled link to report an issue: ' +
|
223
|
-
var { OS, PAGE_UA } = _a, o = __rest(_a, ["OS", "PAGE_UA"]);
|
224
|
-
return o;
|
225
|
-
})(debugInfo), null, 2))}&environment=${`-%20OS:%20${encodeURI(debugInfo.OS)}%0A-%20Node:%20${encodeURI(process.versions.node)}%0A-%20npm:%20%0A`}`);
|
213
|
+
spinner.succeed('Use this easy pre-filled link to report an issue: ' + (0, tools_1.generateGHIssueLink)(config, debugInfo));
|
226
214
|
if (canInjectEarly) {
|
227
215
|
if (attemptingReauth)
|
228
216
|
yield waPage.evaluate(`window.Store = {"Msg": true}`);
|
package/dist/utils/tools.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
import { DataURL } from '../api/model';
|
1
|
+
import { ConfigObject, DataURL } from '../api/model';
|
2
2
|
import { AxiosRequestConfig } from 'axios';
|
3
|
+
import { SessionInfo } from '../api/model/sessionInfo';
|
3
4
|
export declare const timeout: (ms: any) => Promise<unknown>;
|
4
5
|
/**
|
5
6
|
* Use this to generate a more likely valid user agent. It makes sure it has the WA part and replaces any windows or linux os info with mac.
|
@@ -27,3 +28,4 @@ export declare const getDUrl: (url: string, optionsOverride?: AxiosRequestConfig
|
|
27
28
|
export declare const base64MimeType: (dUrl: DataURL) => string;
|
28
29
|
export declare const processSend: (message: string) => void;
|
29
30
|
export declare const processSendData: (data?: any) => void;
|
31
|
+
export declare const generateGHIssueLink: (config: ConfigObject, sessionInfo: SessionInfo, extras?: any) => string;
|
package/dist/utils/tools.js
CHANGED
@@ -23,8 +23,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.processSendData = exports.processSend = exports.base64MimeType = exports.getDUrl = exports.isDataURL = exports.isBase64 = exports.camelize = exports.without = exports.getConfigFromProcessEnv = exports.smartUserAgent = exports.timeout = void 0;
|
26
|
+
exports.generateGHIssueLink = exports.processSendData = exports.processSend = exports.base64MimeType = exports.getDUrl = exports.isDataURL = exports.isBase64 = exports.camelize = exports.without = exports.getConfigFromProcessEnv = exports.smartUserAgent = exports.timeout = void 0;
|
27
27
|
const axios_1 = __importDefault(require("axios"));
|
28
|
+
const child_process_1 = require("child_process");
|
28
29
|
//@ts-ignore
|
29
30
|
process.send = process.send || function () { };
|
30
31
|
const timeout = ms => new Promise(resolve => setTimeout(resolve, ms, 'timeout'));
|
@@ -145,3 +146,24 @@ const processSendData = (data = {}) => {
|
|
145
146
|
return;
|
146
147
|
};
|
147
148
|
exports.processSendData = processSendData;
|
149
|
+
const generateGHIssueLink = (config, sessionInfo, extras = {}) => {
|
150
|
+
const npm_ver = (0, child_process_1.execSync)('npm -v');
|
151
|
+
const labels = [];
|
152
|
+
if (sessionInfo.CLI)
|
153
|
+
labels.push('CLI');
|
154
|
+
if (!sessionInfo.LATEST_VERSION)
|
155
|
+
labels.push('NCV');
|
156
|
+
labels.push(config.multiDevice ? 'MD' : 'Legacy');
|
157
|
+
if (sessionInfo.ACC_TYPE === 'BUSINESS')
|
158
|
+
labels.push('BHA');
|
159
|
+
if (sessionInfo.ACC_TYPE === 'PERSONAL')
|
160
|
+
labels.push('PHA');
|
161
|
+
const qp = Object.assign({ "template": "bug_report.yaml",
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
163
|
+
"d_info": `${encodeURI(JSON.stringify(((_a) => {
|
164
|
+
var { OS, PAGE_UA } = _a, o = __rest(_a, ["OS", "PAGE_UA"]);
|
165
|
+
return o;
|
166
|
+
})(sessionInfo), null, 2))}`, "enviro": `${`-%20OS:%20${encodeURI(sessionInfo.OS)}%0A-%20Node:%20${encodeURI(process.versions.node)}%0A-%20npm:%20${(String(npm_ver)).replace(/\s/g, '')}`}`, "labels": labels.join(',') }, extras);
|
167
|
+
return `https://github.com/open-wa/wa-automate-nodejs/issues/new?${Object.keys(qp).map(k => `${k}=${qp[k]}`).join('&')}`;
|
168
|
+
};
|
169
|
+
exports.generateGHIssueLink = generateGHIssueLink;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@open-wa/wa-automate",
|
3
|
-
"version": "4.28.
|
3
|
+
"version": "4.28.12",
|
4
4
|
"licenseCheckUrl": "https://openwa.dev/license-check",
|
5
5
|
"brokenMethodReportUrl": "https://openwa.dev/report-bm",
|
6
6
|
"patches": "https://cdn.openwa.dev/patches.json",
|
@@ -60,6 +60,9 @@
|
|
60
60
|
"node": ">=12.18.3",
|
61
61
|
"npm": ">=7.9.0"
|
62
62
|
},
|
63
|
+
"resolutions": {
|
64
|
+
"colors": "1.4.0"
|
65
|
+
},
|
63
66
|
"devDependencies": {
|
64
67
|
"@types/changelog-parser": "^2.7.1",
|
65
68
|
"@types/command-line-args": "^5.0.0",
|