@open-wa/wa-automate 4.30.11 → 4.30.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.
@@ -0,0 +1,9 @@
1
+ import { AnyFlag } from "meow";
2
+ import { Merge } from "type-fest";
3
+ export declare const optionList: Merge<Merge<{
4
+ name?: string;
5
+ description?: string;
6
+ typeLabel?: string;
7
+ }, AnyFlag>, {
8
+ type?: typeof Boolean | typeof Number | typeof String;
9
+ }>[];
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optionList = void 0;
4
+ exports.optionList = [{
5
+ name: 'no-api',
6
+ default: false,
7
+ alias: 'n',
8
+ type: Boolean,
9
+ description: "Don't expose the api. This may be useful if you just want to set the webhooks."
10
+ }, {
11
+ name: 'bot-press-url',
12
+ alias: 'b',
13
+ type: String,
14
+ typeLabel: '{blue {underline http://localhost:3000/api/v1/bots/cool-bot}}',
15
+ description: "The Botpress URL that ends with your bot id."
16
+ }, {
17
+ name: 'twilio-webhook',
18
+ alias: 't',
19
+ type: String,
20
+ typeLabel: '{blue {underline http://localhost:5555/incoming}}',
21
+ description: "Send twillio payloads to this URL. EASY API will also parse and processes twillio response message payloads."
22
+ }, {
23
+ name: 'chatwoot-url',
24
+ type: String,
25
+ typeLabel: '{blue {underline http://localhost:3000/api/v1/accounts/3/inboxes/1}}',
26
+ description: "The URL of the specific Chatwoot inbox you set up for this session"
27
+ }, {
28
+ name: 'chatwoot-api-access-token',
29
+ type: String,
30
+ typeLabel: '{blue {underline mEEwUGEEML2ZThMm252rLg1M}}',
31
+ description: "The access token of the specific Chatwoot inbox you set up for this session"
32
+ },
33
+ {
34
+ name: 'port',
35
+ alias: 'p',
36
+ default: 8002,
37
+ type: Number,
38
+ typeLabel: '{blue {underline 8080}}',
39
+ description: "Set the port for the api. Default to 8002."
40
+ },
41
+ {
42
+ name: 'api-host',
43
+ type: String,
44
+ typeLabel: '{yellow {underline localhost}}',
45
+ description: "The easy API may be sitting behind a reverse proxy. In this case set --api-host in order to make sure the api docs and api explorer are working properly. You will need to include the protocol as well."
46
+ },
47
+ {
48
+ name: 'host',
49
+ alias: 'h',
50
+ default: 'localhost',
51
+ type: String,
52
+ typeLabel: '{red {underline localhost}}',
53
+ description: "Set the hostname for the api documantation and statistics. Overrides --api-host. Default: localhost."
54
+ },
55
+ {
56
+ name: 'webhook',
57
+ alias: 'w',
58
+ type: String,
59
+ typeLabel: '{yellow {underline https://webhook.site/....}}',
60
+ description: "Webhook to use for the listeners."
61
+ },
62
+ {
63
+ name: 'ev',
64
+ alias: 'e',
65
+ type: String,
66
+ typeLabel: '{green {underline https://webhook.site/....}}',
67
+ description: "Send launch events to this URL."
68
+ },
69
+ {
70
+ name: 'ef',
71
+ type: String,
72
+ //@ts-ignore
73
+ default: ["qr", "STARTUP", "MD_DETECT"],
74
+ isMultiple: true,
75
+ typeLabel: '{blueBright {underline qr,STARTUP}}',
76
+ description: "Filters which namespaces trigger the webhook set in -e/--ev."
77
+ },
78
+ {
79
+ name: 'allow-session-data-wh',
80
+ alias: 'x',
81
+ default: false,
82
+ type: Boolean,
83
+ description: "By default, if you set -e flag, the session data is not transferred to the webhook as it is extremely sensitive data. In order to bypass this security measure, use this flag."
84
+ },
85
+ {
86
+ name: 'key',
87
+ alias: 'k',
88
+ type: String,
89
+ typeLabel: '{redBright {underline apikey}}',
90
+ description: "Specify an api key to use as a check for all requests. If you add -k by itself, a key will be autogenerated for you."
91
+ },
92
+ {
93
+ name: 'config',
94
+ alias: 'c',
95
+ type: String,
96
+ typeLabel: '{yellowBright {underline ./config.json}}',
97
+ description: "The relative json file that contains the config. By default the system will look for config.json which will override any config variables set. Default: './config.json'."
98
+ },
99
+ {
100
+ name: 'session',
101
+ alias: 's',
102
+ type: String,
103
+ typeLabel: '{magentaBright {underline BASE64}}',
104
+ description: "A base64 string representing the session data."
105
+ },
106
+ {
107
+ name: 'keep-alive',
108
+ alias: 'a',
109
+ type: Boolean,
110
+ description: "If true, the system will force the session to refocus in this process. This will prevent you from opening a session elsewhere."
111
+ },
112
+ {
113
+ name: 'use-session-id-in-path',
114
+ alias: 'i',
115
+ type: Boolean,
116
+ description: "If true, all API paths will include the session id. default to false and the default session Id is 'session'."
117
+ },
118
+ {
119
+ name: 'generate-api-docs',
120
+ alias: 'd',
121
+ type: Boolean,
122
+ default: true,
123
+ description: "Generate postman collection and expose api docs to open in browser."
124
+ },
125
+ {
126
+ name: 'session-data-only',
127
+ alias: 'o',
128
+ type: Boolean,
129
+ description: "Kill the process when the session data is saved.",
130
+ default: false
131
+ },
132
+ {
133
+ name: 'skip-save-postman-collection',
134
+ type: Boolean,
135
+ description: "Don't save the postman collection.",
136
+ default: false
137
+ },
138
+ {
139
+ name: 'headful',
140
+ type: Boolean,
141
+ description: "Show the browser window on your machine.",
142
+ default: false
143
+ },
144
+ {
145
+ name: 'pre-auth-docs',
146
+ type: Boolean,
147
+ description: "Pre authenticate documentation site [High security risk]."
148
+ },
149
+ {
150
+ name: 'stats',
151
+ type: Boolean,
152
+ description: "Exposes API swagger-statistics.",
153
+ default: false
154
+ },
155
+ {
156
+ name: 'pre-auth-docs',
157
+ type: Boolean,
158
+ description: "Grab config options from the environment variables.",
159
+ default: false
160
+ },
161
+ {
162
+ name: 'no-kill-on-logout',
163
+ type: Boolean,
164
+ description: "Keeps the process alive when host account logs out of session. default is false",
165
+ default: false
166
+ },
167
+ {
168
+ name: 'debug',
169
+ type: Boolean,
170
+ description: "Print out the CLI flag values and the WA_* env vars. default is false",
171
+ default: false
172
+ },
173
+ {
174
+ name: 'cors',
175
+ type: Boolean,
176
+ description: "Enable all cors requests",
177
+ default: false
178
+ },
179
+ {
180
+ name: 'socket',
181
+ type: Boolean,
182
+ description: "Expose a socket.io middleware on the server.",
183
+ default: false
184
+ },
185
+ {
186
+ name: 'license-key',
187
+ alias: 'l',
188
+ type: String,
189
+ typeLabel: '{yellowBright {underline B2BJ4JFB-2UN2J3ND-2J5I.....}}',
190
+ description: "The license key you want to use for this server. License keys are used to unlock features. Learn more here https://github.com/open-wa/wa-automate-nodejs#license-key"
191
+ },
192
+ {
193
+ name: 'ready-webhook',
194
+ type: String,
195
+ typeLabel: '{yellow {underline https://webhook.site/....}}',
196
+ description: "Webhook that fires when the EASY API is completely ready"
197
+ },
198
+ {
199
+ name: 'on-call',
200
+ type: String,
201
+ typeLabel: '{yellow {underline "Please do not call this number"}}',
202
+ description: "A default message to send to any number that is trying to call the host account"
203
+ },
204
+ {
205
+ name: 'auto-reject',
206
+ type: Boolean,
207
+ description: "Automatically reject incoming phone and video calls to the host account."
208
+ },
209
+ {
210
+ name: 'emit-unread',
211
+ type: Boolean,
212
+ description: "Emit all unread messages via onMessage webhooks on launch.",
213
+ default: false
214
+ },
215
+ {
216
+ name: 'skip-url-check',
217
+ type: Boolean,
218
+ description: "Don't validate webhook URLs. Enables use of non-FQDNs."
219
+ },
220
+ {
221
+ name: 'tunnel',
222
+ type: Boolean,
223
+ description: "Expose a tunnel to your EASY API session - this is for testing and it is unsecured."
224
+ },
225
+ {
226
+ name: 'help',
227
+ description: 'Print this usage guide.'
228
+ }
229
+ ];
@@ -14,7 +14,7 @@ export declare const cliOptionNames: import("type-fest").Simplify<import("type-f
14
14
  description?: string;
15
15
  typeLabel?: string;
16
16
  }, meow.AnyFlag>>, {
17
- type?: typeof Boolean | typeof Number | typeof String;
17
+ type?: StringConstructor | BooleanConstructor | NumberConstructor;
18
18
  }>>;
19
19
  export declare const meowFlags: () => AnyFlags;
20
20
  export declare const helptext: string;
package/dist/cli/setup.js CHANGED
@@ -44,242 +44,17 @@ const events_1 = require("../controllers/events");
44
44
  const is_url_superb_1 = __importDefault(require("is-url-superb"));
45
45
  const path = __importStar(require("path"));
46
46
  const logging_1 = require("../logging/logging");
47
+ const cli_options_1 = require("./cli-options");
47
48
  let checkUrl = url => typeof url === 'string' ? (0, is_url_superb_1.default)(url) : false;
48
49
  const configWithCases = (0, fs_extra_1.readJsonSync)(path.join(__dirname, '../../bin/config-schema.json'));
49
- const optionList = [{
50
- name: 'no-api',
51
- default: false,
52
- alias: 'n',
53
- type: Boolean,
54
- description: "Don't expose the api. This may be useful if you just want to set the webhooks."
55
- }, {
56
- name: 'bot-press-url',
57
- alias: 'b',
58
- type: String,
59
- typeLabel: '{blue {underline http://localhost:3000/api/v1/bots/cool-bot}}',
60
- description: "The Botpress URL that ends with your bot id."
61
- }, {
62
- name: 'twilio-webhook',
63
- alias: 't',
64
- type: String,
65
- typeLabel: '{blue {underline http://localhost:5555/incoming}}',
66
- description: "Send twillio payloads to this URL. EASY API will also parse and processes twillio response message payloads."
67
- }, {
68
- name: 'chatwoot-url',
69
- type: String,
70
- typeLabel: '{blue {underline http://localhost:3000/api/v1/accounts/3/inboxes/1}}',
71
- description: "The URL of the specific Chatwoot inbox you set up for this session"
72
- }, {
73
- name: 'chatwoot-api-access-token',
74
- type: String,
75
- typeLabel: '{blue {underline mEEwUGEEML2ZThMm252rLg1M}}',
76
- description: "The access token of the specific Chatwoot inbox you set up for this session"
77
- },
78
- {
79
- name: 'port',
80
- alias: 'p',
81
- default: 8002,
82
- type: Number,
83
- typeLabel: '{blue {underline 8080}}',
84
- description: "Set the port for the api. Default to 8002."
85
- },
86
- {
87
- name: 'api-host',
88
- type: String,
89
- typeLabel: '{yellow {underline localhost}}',
90
- description: "The easy API may be sitting behind a reverse proxy. In this case set --api-host in order to make sure the api docs and api explorer are working properly. You will need to include the protocol as well."
91
- },
92
- {
93
- name: 'host',
94
- alias: 'h',
95
- default: 'localhost',
96
- type: String,
97
- typeLabel: '{red {underline localhost}}',
98
- description: "Set the hostname for the api documantation and statistics. Overrides --api-host. Default: localhost."
99
- },
100
- {
101
- name: 'webhook',
102
- alias: 'w',
103
- type: String,
104
- typeLabel: '{yellow {underline https://webhook.site/....}}',
105
- description: "Webhook to use for the listeners."
106
- },
107
- {
108
- name: 'ev',
109
- alias: 'e',
110
- type: String,
111
- typeLabel: '{green {underline https://webhook.site/....}}',
112
- description: "Send launch events to this URL."
113
- },
114
- {
115
- name: 'ef',
116
- type: String,
117
- //@ts-ignore
118
- default: ["qr", "STARTUP"],
119
- isMultiple: true,
120
- typeLabel: '{blueBright {underline qr,STARTUP}}',
121
- description: "Filters which namespaces trigger the webhook set in -e/--ev."
122
- },
123
- {
124
- name: 'allow-session-data-wh',
125
- alias: 'x',
126
- default: false,
127
- type: Boolean,
128
- description: "By default, if you set -e flag, the session data is not transferred to the webhook as it is extremely sensitive data. In order to bypass this security measure, use this flag."
129
- },
130
- {
131
- name: 'key',
132
- alias: 'k',
133
- type: String,
134
- typeLabel: '{redBright {underline apikey}}',
135
- description: "Specify an api key to use as a check for all requests. If you add -k by itself, a key will be autogenerated for you."
136
- },
137
- {
138
- name: 'config',
139
- alias: 'c',
140
- type: String,
141
- typeLabel: '{yellowBright {underline ./config.json}}',
142
- description: "The relative json file that contains the config. By default the system will look for config.json which will override any config variables set. Default: './config.json'."
143
- },
144
- {
145
- name: 'session',
146
- alias: 's',
147
- type: String,
148
- typeLabel: '{magentaBright {underline BASE64}}',
149
- description: "A base64 string representing the session data."
150
- },
151
- {
152
- name: 'keep-alive',
153
- alias: 'a',
154
- type: Boolean,
155
- description: "If true, the system will force the session to refocus in this process. This will prevent you from opening a session elsewhere."
156
- },
157
- {
158
- name: 'use-session-id-in-path',
159
- alias: 'i',
160
- type: Boolean,
161
- description: "If true, all API paths will include the session id. default to false and the default session Id is 'session'."
162
- },
163
- {
164
- name: 'generate-api-docs',
165
- alias: 'd',
166
- type: Boolean,
167
- default: true,
168
- description: "Generate postman collection and expose api docs to open in browser."
169
- },
170
- {
171
- name: 'session-data-only',
172
- alias: 'o',
173
- type: Boolean,
174
- description: "Kill the process when the session data is saved.",
175
- default: false
176
- },
177
- {
178
- name: 'skip-save-postman-collection',
179
- type: Boolean,
180
- description: "Don't save the postman collection.",
181
- default: false
182
- },
183
- {
184
- name: 'headful',
185
- type: Boolean,
186
- description: "Show the browser window on your machine.",
187
- default: false
188
- },
189
- {
190
- name: 'headful',
191
- type: Boolean,
192
- description: "Pre authenticate documentation site [High security risk]."
193
- },
194
- {
195
- name: 'stats',
196
- type: Boolean,
197
- description: "Exposes API swagger-statistics.",
198
- default: false
199
- },
200
- {
201
- name: 'pre-auth-docs',
202
- type: Boolean,
203
- description: "Grab config options from the environment variables.",
204
- default: false
205
- },
206
- {
207
- name: 'no-kill-on-logout',
208
- type: Boolean,
209
- description: "Keeps the process alive when host account logs out of session. default is false",
210
- default: false
211
- },
212
- {
213
- name: 'debug',
214
- type: Boolean,
215
- description: "Print out the CLI flag values and the WA_* env vars. default is false",
216
- default: false
217
- },
218
- {
219
- name: 'cors',
220
- type: Boolean,
221
- description: "Enable all cors requests",
222
- default: false
223
- },
224
- {
225
- name: 'socket',
226
- type: Boolean,
227
- description: "Expose a socket.io middleware on the server.",
228
- default: false
229
- },
230
- {
231
- name: 'license-key',
232
- alias: 'l',
233
- type: String,
234
- typeLabel: '{yellowBright {underline B2BJ4JFB-2UN2J3ND-2J5I.....}}',
235
- description: "The license key you want to use for this server. License keys are used to unlock features. Learn more here https://github.com/open-wa/wa-automate-nodejs#license-key"
236
- },
237
- {
238
- name: 'ready-webhook',
239
- type: String,
240
- typeLabel: '{yellow {underline https://webhook.site/....}}',
241
- description: "Webhook that fires when the EASY API is completely ready"
242
- },
243
- {
244
- name: 'on-call',
245
- type: String,
246
- typeLabel: '{yellow {underline "Please do not call this number"}}',
247
- description: "A default message to send to any number that is trying to call the host account"
248
- },
249
- {
250
- name: 'auto-reject',
251
- type: Boolean,
252
- description: "Automatically reject incoming phone and video calls to the host account."
253
- },
254
- {
255
- name: 'emit-unread',
256
- type: Boolean,
257
- description: "Emit all unread messages via onMessage webhooks on launch.",
258
- default: false
259
- },
260
- {
261
- name: 'skip-url-check',
262
- type: Boolean,
263
- description: "Don't validate webhook URLs. Enables use of non-FQDNs."
264
- },
265
- {
266
- name: 'tunnel',
267
- type: Boolean,
268
- description: "Expose a tunnel to your EASY API session - this is for testing and it is unsecured."
269
- },
270
- {
271
- name: 'help',
272
- description: 'Print this usage guide.'
273
- }
274
- ];
275
- exports.optionKeys = optionList.map(({ name }) => (0, tools_1.camelize)(name));
276
- exports.optionKeysWithDefalts = [...optionList.filter(o => o.hasOwnProperty('default')).map(({ name }) => (0, tools_1.camelize)(name)), 'popup'];
50
+ exports.optionKeys = cli_options_1.optionList.map(({ name }) => (0, tools_1.camelize)(name));
51
+ exports.optionKeysWithDefalts = [...cli_options_1.optionList.filter(o => o.hasOwnProperty('default')).map(({ name }) => (0, tools_1.camelize)(name)), 'popup'];
277
52
  exports.PrimitiveConverter = {
278
53
  Number: 1,
279
54
  Boolean: true,
280
55
  String: "hello"
281
56
  };
282
- exports.cliOptionNames = optionList.reduce((acc, c) => {
57
+ exports.cliOptionNames = cli_options_1.optionList.reduce((acc, c) => {
283
58
  if (!c.type)
284
59
  return acc;
285
60
  acc[(0, tools_1.camelize)(c.name)] = typeof exports.PrimitiveConverter[c.type.name];
@@ -299,7 +74,7 @@ const meowFlags = () => {
299
74
  };
300
75
  });
301
76
  const res = {};
302
- optionList.map(option => {
77
+ cli_options_1.optionList.map(option => {
303
78
  var _a, _b;
304
79
  res[(0, tools_1.camelize)(option.name)] = Object.assign(Object.assign({}, option), {
305
80
  //@ts-ignore
@@ -314,7 +89,7 @@ exports.helptext = (0, command_line_usage_1.default)([{
314
89
  },
315
90
  {
316
91
  header: '',
317
- optionList
92
+ optionList: cli_options_1.optionList
318
93
  },
319
94
  {
320
95
  header: "Session config flags",
@@ -383,7 +158,7 @@ const cli = () => {
383
158
  * 3. CLI flags
384
159
  */
385
160
  const nonCliConfigs = Object.assign(Object.assign({}, (0, exports.envArgs)()), ((0, exports.configFile)(_cli.flags.config) || {}));
386
- optionList.filter(option => option.default);
161
+ cli_options_1.optionList.filter(option => option.default);
387
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, {}));
388
163
  //firstly set up logger
389
164
  if (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) {
@@ -205,6 +205,7 @@ class QRManager {
205
205
  const fn = (qrData) => __awaiter(this, void 0, void 0, function* () {
206
206
  if (qrData.length > 200 && !(config === null || config === void 0 ? void 0 : config.multiDevice)) {
207
207
  spinner.fail(`Multi-Device detected, please set multiDevice to true in your config or add the --multi-device flag`);
208
+ spinner.emit(true, "MD_DETECT");
208
209
  return resolve(md);
209
210
  }
210
211
  if (!gotResult && (qrData === 'QR_CODE_SUCCESS' || qrData === md)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.30.11",
3
+ "version": "4.30.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",