@open-wa/wa-automate 4.30.1 → 4.30.2
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.js
CHANGED
@@ -3387,10 +3387,10 @@ class Client {
|
|
3387
3387
|
return yield Promise.all([
|
3388
3388
|
...Object.keys(this._registeredWebhooks).map(webhookId => this._registeredWebhooks[webhookId]).filter(webhookEntry => webhookEntry.events.includes(event))
|
3389
3389
|
].map(({ id, url, requestConfig }) => {
|
3390
|
-
const whStart =
|
3390
|
+
const whStart = (0, tools_1.now)();
|
3391
3391
|
return (0, axios_1.default)(Object.assign({ method: 'post', url, data: this.prepEventData(_data, event, { webhook_id: id }) }, requestConfig))
|
3392
3392
|
.then(({ status }) => {
|
3393
|
-
const t = (
|
3393
|
+
const t = ((0, tools_1.now)() - whStart).toFixed(0);
|
3394
3394
|
logging_1.log.info("Client Webhook", event, status, t);
|
3395
3395
|
})
|
3396
3396
|
.catch(err => console.error(`WEBHOOK ERROR: `, url, err.message));
|
package/dist/cli/index.js
CHANGED
@@ -80,7 +80,7 @@ function start() {
|
|
80
80
|
}
|
81
81
|
if (!cliConfig.allowSessionDataWebhook && (namespace == "sessionData" || namespace == "sessionDataBase64"))
|
82
82
|
return;
|
83
|
-
const whStart =
|
83
|
+
const whStart = (0, index_1.now)();
|
84
84
|
yield (0, axios_1.default)({
|
85
85
|
method: 'post',
|
86
86
|
url: cliConfig.ev,
|
@@ -91,7 +91,7 @@ function start() {
|
|
91
91
|
namespace
|
92
92
|
}
|
93
93
|
}).then(({ status }) => {
|
94
|
-
const t = (
|
94
|
+
const t = ((0, index_1.now)() - whStart).toFixed(0);
|
95
95
|
index_1.log.info("EV Webhook", namespace, status, t);
|
96
96
|
}).catch(err => console.error(`WEBHOOK ERROR: ${cliConfig.ev} ${err.message}`));
|
97
97
|
}));
|
@@ -60,12 +60,12 @@ function initPage(sessionId, config, customUserAgent, spinner, _page, skipAuth)
|
|
60
60
|
let waPage = _page;
|
61
61
|
if (!waPage) {
|
62
62
|
spinner === null || spinner === void 0 ? void 0 : spinner.info('Launching Browser');
|
63
|
-
const startBrowser =
|
63
|
+
const startBrowser = (0, tools_1.now)();
|
64
64
|
browser = yield initBrowser(sessionId, config, spinner);
|
65
|
-
spinner === null || spinner === void 0 ? void 0 : spinner.info(`Browser launched: ${(
|
65
|
+
spinner === null || spinner === void 0 ? void 0 : spinner.info(`Browser launched: ${((0, tools_1.now)() - startBrowser).toFixed(0)}ms`);
|
66
66
|
waPage = yield getWAPage(browser);
|
67
67
|
}
|
68
|
-
const postBrowserLaunchTs =
|
68
|
+
const postBrowserLaunchTs = (0, tools_1.now)();
|
69
69
|
spinner === null || spinner === void 0 ? void 0 : spinner.info('Setting Up Page');
|
70
70
|
if (config === null || config === void 0 ? void 0 : config.proxyServerCredentials) {
|
71
71
|
yield waPage.authenticate(config.proxyServerCredentials);
|
@@ -178,7 +178,7 @@ function initPage(sessionId, config, customUserAgent, spinner, _page, skipAuth)
|
|
178
178
|
if ((_e = config === null || config === void 0 ? void 0 : config.proxyServerCredentials) === null || _e === void 0 ? void 0 : _e.address)
|
179
179
|
spinner.succeed(`Active proxy: ${config.proxyServerCredentials.address}`);
|
180
180
|
yield Promise.all(setupPromises);
|
181
|
-
spinner === null || spinner === void 0 ? void 0 : spinner.info(`Pre page launch setup complete: ${(
|
181
|
+
spinner === null || spinner === void 0 ? void 0 : spinner.info(`Pre page launch setup complete: ${((0, tools_1.now)() - postBrowserLaunchTs).toFixed(0)}ms`);
|
182
182
|
spinner === null || spinner === void 0 ? void 0 : spinner.info('Navigating to WA');
|
183
183
|
try {
|
184
184
|
//try twice
|
@@ -166,7 +166,7 @@ function create(config = {}) {
|
|
166
166
|
spinner.info(`It is recommended to set useChrome: true or use the --use-chrome flag if you are experiencing issues with Multi device support`);
|
167
167
|
waPage = yield (0, browser_1.initPage)(sessionId, config, customUserAgent, spinner);
|
168
168
|
spinner.succeed('Page loaded');
|
169
|
-
const browserLaunchedTs =
|
169
|
+
const browserLaunchedTs = (0, tools_1.now)();
|
170
170
|
const throwOnError = config && config.throwErrorOnTosBlock == true;
|
171
171
|
const PAGE_UA = yield waPage.evaluate('navigator.userAgent');
|
172
172
|
const BROWSER_VERSION = yield waPage.browser().version();
|
@@ -213,7 +213,7 @@ function create(config = {}) {
|
|
213
213
|
debugInfo.CLI = process.env.OWA_CLI && true || false;
|
214
214
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
215
215
|
spinner.succeed('Use this easy pre-filled link to report an issue: ' + (0, tools_1.generateGHIssueLink)(config, debugInfo));
|
216
|
-
spinner.info(`Time to injection: ${(
|
216
|
+
spinner.info(`Time to injection: ${((0, tools_1.now)() - browserLaunchedTs).toFixed(0)}ms`);
|
217
217
|
if (canInjectEarly) {
|
218
218
|
if (attemptingReauth)
|
219
219
|
yield waPage.evaluate(`window.Store = {"Msg": true}`);
|
package/dist/utils/tools.d.ts
CHANGED
@@ -27,6 +27,8 @@ export declare const getDUrl: (url: string, optionsOverride?: AxiosRequestConfig
|
|
27
27
|
*/
|
28
28
|
export declare const base64MimeType: (dUrl: DataURL) => string;
|
29
29
|
export declare const processSend: (message: string) => void;
|
30
|
+
export declare const perf: () => DateConstructor | Performance;
|
31
|
+
export declare const now: () => number;
|
30
32
|
export declare function timePromise(fn: () => Promise<any>): Promise<string>;
|
31
33
|
export declare const processSendData: (data?: any) => void;
|
32
34
|
export declare const generateGHIssueLink: (config: ConfigObject, sessionInfo: SessionInfo, extras?: any) => string;
|
package/dist/utils/tools.js
CHANGED
@@ -23,7 +23,7 @@ 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.generateGHIssueLink = exports.processSendData = exports.timePromise = 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.timePromise = exports.now = exports.perf = 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
28
|
const child_process_1 = require("child_process");
|
29
29
|
//@ts-ignore
|
@@ -138,11 +138,15 @@ const processSend = (message) => {
|
|
138
138
|
return;
|
139
139
|
};
|
140
140
|
exports.processSend = processSend;
|
141
|
+
const perf = () => performance || Date;
|
142
|
+
exports.perf = perf;
|
143
|
+
const now = () => (0, exports.perf)().now();
|
144
|
+
exports.now = now;
|
141
145
|
function timePromise(fn) {
|
142
146
|
return __awaiter(this, void 0, void 0, function* () {
|
143
|
-
const start =
|
147
|
+
const start = (0, exports.now)();
|
144
148
|
yield fn();
|
145
|
-
return (
|
149
|
+
return ((0, exports.now)() - start).toFixed(0);
|
146
150
|
});
|
147
151
|
}
|
148
152
|
exports.timePromise = timePromise;
|
package/package.json
CHANGED