@open-wa/wa-automate 4.30.8 → 4.30.9
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 +3 -2
- package/package.json +1 -1
package/dist/api/Client.js
CHANGED
@@ -434,6 +434,7 @@ class Client {
|
|
434
434
|
pup(pageFunction, ...args) {
|
435
435
|
var _a, _b, _c, _d, _e;
|
436
436
|
return __awaiter(this, void 0, void 0, function* () {
|
437
|
+
const invocation_id = (0, uuid_1.v4)().slice(-5);
|
437
438
|
const { safeMode, callTimeout, idCorrection, logging } = this._createConfig;
|
438
439
|
let _t;
|
439
440
|
if (safeMode) {
|
@@ -472,13 +473,13 @@ class Client {
|
|
472
473
|
if (logging) {
|
473
474
|
const wapis = (_e = (((_d = pageFunction === null || pageFunction === void 0 ? void 0 : pageFunction.toString()) === null || _d === void 0 ? void 0 : _d.match(/WAPI\.(\w*)\(/g)) || [])) === null || _e === void 0 ? void 0 : _e.map(s => s.replace(/WAPI|\.|\(/g, ''));
|
474
475
|
_t = Date.now();
|
475
|
-
logging_1.log.info(`
|
476
|
+
logging_1.log.info(`IN ${invocation_id}`, Object.assign({ _method: (wapis === null || wapis === void 0 ? void 0 : wapis.length) === 1 ? wapis[0] : wapis }, args[0]));
|
476
477
|
}
|
477
478
|
if (callTimeout)
|
478
479
|
return yield Promise.race([this._page.evaluate(pageFunction, ...args), new Promise((resolve, reject) => { var _a; return setTimeout(reject, (_a = this._createConfig) === null || _a === void 0 ? void 0 : _a.callTimeout, new errors_1.PageEvaluationTimeout()); })]);
|
479
480
|
const res = yield this._page.evaluate(pageFunction, ...args);
|
480
481
|
if (_t && logging) {
|
481
|
-
logging_1.log.info(`
|
482
|
+
logging_1.log.info(`OUT ${invocation_id}: ${Date.now() - _t}ms`, { res });
|
482
483
|
}
|
483
484
|
if (this._createConfig.onError && typeof res == "string" && (res.startsWith("Error") || res.startsWith("ERROR"))) {
|
484
485
|
const e = this._createConfig.onError;
|
package/package.json
CHANGED