Skip to content

Commit 9761027

Browse files
committed
✨ ev: emit MD_DETECT namespace when MD on session without proper config #2492
1 parent a80cf60 commit 9761027

File tree

3 files changed

+238
-234
lines changed

3 files changed

+238
-234
lines changed

src/cli/cli-options.ts

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
import { AnyFlag } from "meow";
2+
import { Merge } from "type-fest";
3+
4+
export const optionList:
5+
Merge<Merge<{
6+
name?: string,
7+
description?: string,
8+
typeLabel?: string,
9+
}, AnyFlag>, {
10+
type?: typeof Boolean | typeof Number | typeof String
11+
}>[] = [{
12+
name: 'no-api',
13+
default: false,
14+
alias: 'n',
15+
type: Boolean,
16+
description: "Don't expose the api. This may be useful if you just want to set the webhooks."
17+
},{
18+
name: 'bot-press-url',
19+
alias: 'b',
20+
type: String,
21+
typeLabel: '{blue {underline http://localhost:3000/api/v1/bots/cool-bot}}',
22+
description: "The Botpress URL that ends with your bot id."
23+
},{
24+
name: 'twilio-webhook',
25+
alias: 't',
26+
type: String,
27+
typeLabel: '{blue {underline http://localhost:5555/incoming}}',
28+
description: "Send twillio payloads to this URL. EASY API will also parse and processes twillio response message payloads."
29+
},{
30+
name: 'chatwoot-url',
31+
type: String,
32+
typeLabel: '{blue {underline http://localhost:3000/api/v1/accounts/3/inboxes/1}}',
33+
description: "The URL of the specific Chatwoot inbox you set up for this session"
34+
},{
35+
name: 'chatwoot-api-access-token',
36+
type: String,
37+
typeLabel: '{blue {underline mEEwUGEEML2ZThMm252rLg1M}}',
38+
description: "The access token of the specific Chatwoot inbox you set up for this session"
39+
},
40+
{
41+
name: 'port',
42+
alias: 'p',
43+
default: 8002,
44+
type: Number,
45+
typeLabel: '{blue {underline 8080}}',
46+
description: "Set the port for the api. Default to 8002."
47+
},
48+
{
49+
name: 'api-host',
50+
type: String,
51+
typeLabel: '{yellow {underline localhost}}',
52+
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."
53+
},
54+
{
55+
name: 'host',
56+
alias: 'h',
57+
default: 'localhost',
58+
type: String,
59+
typeLabel: '{red {underline localhost}}',
60+
description: "Set the hostname for the api documantation and statistics. Overrides --api-host. Default: localhost."
61+
},
62+
{
63+
name: 'webhook',
64+
alias: 'w',
65+
type: String,
66+
typeLabel: '{yellow {underline https://webhook.site/....}}',
67+
description: "Webhook to use for the listeners."
68+
},
69+
{
70+
name: 'ev',
71+
alias: 'e',
72+
type: String,
73+
typeLabel: '{green {underline https://webhook.site/....}}',
74+
description: "Send launch events to this URL."
75+
},
76+
{
77+
name: 'ef',
78+
type: String,
79+
//@ts-ignore
80+
default: ["qr", "STARTUP", "MD_DETECT"],
81+
isMultiple: true,
82+
typeLabel: '{blueBright {underline qr,STARTUP}}',
83+
description: "Filters which namespaces trigger the webhook set in -e/--ev."
84+
},
85+
{
86+
name: 'allow-session-data-wh',
87+
alias: 'x',
88+
default: false,
89+
type: Boolean,
90+
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."
91+
},
92+
{
93+
name: 'key',
94+
alias: 'k',
95+
type: String,
96+
typeLabel: '{redBright {underline apikey}}',
97+
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."
98+
},
99+
{
100+
name: 'config',
101+
alias: 'c',
102+
type: String,
103+
typeLabel: '{yellowBright {underline ./config.json}}',
104+
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'."
105+
},
106+
{
107+
name: 'session',
108+
alias: 's',
109+
type: String,
110+
typeLabel: '{magentaBright {underline BASE64}}',
111+
description: "A base64 string representing the session data."
112+
},
113+
{
114+
name: 'keep-alive',
115+
alias: 'a',
116+
type: Boolean,
117+
description: "If true, the system will force the session to refocus in this process. This will prevent you from opening a session elsewhere."
118+
},
119+
{
120+
name: 'use-session-id-in-path',
121+
alias: 'i',
122+
type: Boolean,
123+
description: "If true, all API paths will include the session id. default to false and the default session Id is 'session'."
124+
},
125+
{
126+
name: 'generate-api-docs',
127+
alias: 'd',
128+
type: Boolean,
129+
default: true,
130+
description: "Generate postman collection and expose api docs to open in browser."
131+
},
132+
{
133+
name: 'session-data-only',
134+
alias: 'o',
135+
type: Boolean,
136+
description: "Kill the process when the session data is saved.",
137+
default: false
138+
},
139+
{
140+
name: 'skip-save-postman-collection',
141+
type: Boolean,
142+
description: "Don't save the postman collection.",
143+
default: false
144+
},
145+
{
146+
name: 'headful',
147+
type: Boolean,
148+
description: "Show the browser window on your machine.",
149+
default: false
150+
},
151+
{
152+
name: 'pre-auth-docs',
153+
type: Boolean,
154+
description: "Pre authenticate documentation site [High security risk]."
155+
},
156+
{
157+
name: 'stats',
158+
type: Boolean,
159+
description: "Exposes API swagger-statistics.",
160+
default: false
161+
},
162+
{
163+
name: 'pre-auth-docs',
164+
type: Boolean,
165+
description: "Grab config options from the environment variables.",
166+
default: false
167+
},
168+
{
169+
name: 'no-kill-on-logout',
170+
type: Boolean,
171+
description: "Keeps the process alive when host account logs out of session. default is false",
172+
default: false
173+
},
174+
{
175+
name: 'debug',
176+
type: Boolean,
177+
description: "Print out the CLI flag values and the WA_* env vars. default is false",
178+
default: false
179+
},
180+
{
181+
name: 'cors',
182+
type: Boolean,
183+
description: "Enable all cors requests",
184+
default: false
185+
},
186+
{
187+
name: 'socket',
188+
type: Boolean,
189+
description: "Expose a socket.io middleware on the server.",
190+
default: false
191+
},
192+
{
193+
name: 'license-key',
194+
alias: 'l',
195+
type: String,
196+
typeLabel: '{yellowBright {underline B2BJ4JFB-2UN2J3ND-2J5I.....}}',
197+
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"
198+
},
199+
{
200+
name: 'ready-webhook',
201+
type: String,
202+
typeLabel: '{yellow {underline https://webhook.site/....}}',
203+
description: "Webhook that fires when the EASY API is completely ready"
204+
},
205+
{
206+
name: 'on-call',
207+
type: String,
208+
typeLabel: '{yellow {underline "Please do not call this number"}}',
209+
description: "A default message to send to any number that is trying to call the host account"
210+
},
211+
{
212+
name: 'auto-reject',
213+
type: Boolean,
214+
description: "Automatically reject incoming phone and video calls to the host account."
215+
},
216+
{
217+
name: 'emit-unread',
218+
type: Boolean,
219+
description: "Emit all unread messages via onMessage webhooks on launch.",
220+
default: false
221+
},
222+
{
223+
name: 'skip-url-check',
224+
type: Boolean,
225+
description: "Don't validate webhook URLs. Enables use of non-FQDNs."
226+
},
227+
{
228+
name: 'tunnel',
229+
type: Boolean,
230+
description: "Expose a tunnel to your EASY API session - this is for testing and it is unsecured."
231+
},
232+
{
233+
name: 'help',
234+
description: 'Print this usage guide.'
235+
}
236+
]

0 commit comments

Comments
 (0)