@open-wa/wa-automate 4.31.2 → 4.31.3

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.
@@ -59,6 +59,13 @@ exports.optionList = [{
59
59
  typeLabel: '{yellow {underline https://webhook.site/....}}',
60
60
  description: "Webhook to use for the listeners."
61
61
  },
62
+ {
63
+ name: 'verbose',
64
+ alias: 'v',
65
+ default: false,
66
+ type: Boolean,
67
+ description: "Enable console transport for internal logger."
68
+ },
62
69
  {
63
70
  name: 'ev',
64
71
  alias: 'e',
package/dist/cli/setup.js CHANGED
@@ -161,7 +161,11 @@ const cli = () => {
161
161
  cli_options_1.optionList.filter(option => option.default);
162
162
  const cliConfig = Object.assign(Object.assign(Object.assign({ sessionId: "session" }, nonCliConfigs), _cli.flags), exports.optionKeysWithDefalts.reduce((p, c) => nonCliConfigs.hasOwnProperty(c) ? Object.assign(Object.assign({}, p), { [c]: nonCliConfigs[c] }) : p, {}));
163
163
  //firstly set up logger
164
- if (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) {
164
+ if ((cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) || (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.verbose)) {
165
+ if (!(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) && (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.verbose))
166
+ cliConfig.logging = [];
167
+ if ((cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) && !((cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) || []).find(transport => transport.type === "console"))
168
+ cliConfig.logging.push({ type: 'console' });
165
169
  if (Array.isArray(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging))
166
170
  cliConfig.logging = (0, logging_1.setupLogging)(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging, `easy-api-${(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.sessionId) || 'session'}`);
167
171
  }
@@ -132,14 +132,19 @@ function initPage(sessionId, config, customUserAgent, spinner, _page, skipAuth)
132
132
  if (interceptAuthentication || proxyAddr || blockCrashLogs || true) {
133
133
  yield waPage.setRequestInterception(true);
134
134
  waPage.on('response', (response) => __awaiter(this, void 0, void 0, function* () {
135
- if (response.request().url() == "https://web.whatsapp.com/") {
136
- const t = yield response.text();
137
- if (t.includes(`class="no-js"`) && t.includes(`self.`) && !dumbCache) {
138
- //this is a valid response, save it for later
139
- dumbCache = t;
140
- logging_1.log.info("saving valid page to dumb cache");
135
+ try {
136
+ if (response.request().url() == "https://web.whatsapp.com/") {
137
+ const t = yield response.text();
138
+ if (t.includes(`class="no-js"`) && t.includes(`self.`) && !dumbCache) {
139
+ //this is a valid response, save it for later
140
+ dumbCache = t;
141
+ logging_1.log.info("saving valid page to dumb cache");
142
+ }
141
143
  }
142
144
  }
145
+ catch (error) {
146
+ logging_1.log.error("dumb cache error", error);
147
+ }
143
148
  }));
144
149
  const authCompleteEv = new events_1.EvEmitter(sessionId, 'AUTH');
145
150
  waPage.on('request', (request) => __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.31.2",
3
+ "version": "4.31.3",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",