@fonoster/ctl 0.7.42 → 0.7.44

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.
Files changed (75) hide show
  1. package/README.md +8 -410
  2. package/bin/run.js +21 -3
  3. package/package.json +6 -7
  4. package/dist/BaseCommand.d.ts +0 -15
  5. package/dist/BaseCommand.js +0 -80
  6. package/dist/Help.d.ts +0 -6
  7. package/dist/Help.js +0 -52
  8. package/dist/commands/applications/create.d.ts +0 -6
  9. package/dist/commands/applications/create.js +0 -164
  10. package/dist/commands/applications/delete.d.ts +0 -9
  11. package/dist/commands/applications/delete.js +0 -99
  12. package/dist/commands/applications/get.d.ts +0 -9
  13. package/dist/commands/applications/get.js +0 -120
  14. package/dist/commands/applications/list.d.ts +0 -9
  15. package/dist/commands/applications/list.js +0 -112
  16. package/dist/commands/applications/update.d.ts +0 -9
  17. package/dist/commands/applications/update.js +0 -187
  18. package/dist/commands/bug.d.ts +0 -6
  19. package/dist/commands/bug.js +0 -42
  20. package/dist/commands/feedback.d.ts +0 -6
  21. package/dist/commands/feedback.js +0 -45
  22. package/dist/commands/numbers/get.d.ts +0 -9
  23. package/dist/commands/numbers/get.js +0 -125
  24. package/dist/commands/numbers/linkTwilioNumber.d.ts +0 -10
  25. package/dist/commands/numbers/linkTwilioNumber.js +0 -155
  26. package/dist/commands/numbers/list.d.ts +0 -9
  27. package/dist/commands/numbers/list.js +0 -116
  28. package/dist/commands/workspaces/current.d.ts +0 -6
  29. package/dist/commands/workspaces/current.js +0 -46
  30. package/dist/commands/workspaces/list.d.ts +0 -6
  31. package/dist/commands/workspaces/list.js +0 -53
  32. package/dist/commands/workspaces/login.d.ts +0 -8
  33. package/dist/commands/workspaces/login.js +0 -145
  34. package/dist/commands/workspaces/logout.d.ts +0 -9
  35. package/dist/commands/workspaces/logout.js +0 -54
  36. package/dist/commands/workspaces/use.d.ts +0 -9
  37. package/dist/commands/workspaces/use.js +0 -57
  38. package/dist/config/addWorkspace.d.ts +0 -3
  39. package/dist/config/addWorkspace.js +0 -15
  40. package/dist/config/getConfig.d.ts +0 -3
  41. package/dist/config/getConfig.js +0 -34
  42. package/dist/config/getCurrentWorkspace.d.ts +0 -3
  43. package/dist/config/getCurrentWorkspace.js +0 -10
  44. package/dist/config/index.d.ts +0 -7
  45. package/dist/config/index.js +0 -41
  46. package/dist/config/removeWorkspace.d.ts +0 -3
  47. package/dist/config/removeWorkspace.js +0 -6
  48. package/dist/config/saveConfig.d.ts +0 -3
  49. package/dist/config/saveConfig.js +0 -32
  50. package/dist/config/setCurrentWorkspace.d.ts +0 -3
  51. package/dist/config/setCurrentWorkspace.js +0 -11
  52. package/dist/config/types.d.ts +0 -4
  53. package/dist/config/types.js +0 -2
  54. package/dist/config/validations.d.ts +0 -27
  55. package/dist/config/validations.js +0 -34
  56. package/dist/constants.d.ts +0 -6
  57. package/dist/constants.js +0 -29
  58. package/dist/utils/assignTwilioNumberToTrunk.d.ts +0 -3
  59. package/dist/utils/assignTwilioNumberToTrunk.js +0 -33
  60. package/dist/utils/createTwilioTrunk.d.ts +0 -4
  61. package/dist/utils/createTwilioTrunk.js +0 -54
  62. package/dist/utils/getFonosterNumberByTelUrl.d.ts +0 -4
  63. package/dist/utils/getFonosterNumberByTelUrl.js +0 -76
  64. package/dist/utils/getFonosterTrunkByInboundUri.d.ts +0 -4
  65. package/dist/utils/getFonosterTrunkByInboundUri.js +0 -76
  66. package/dist/utils/getTwilioNumber.d.ts +0 -4
  67. package/dist/utils/getTwilioNumber.js +0 -23
  68. package/dist/utils/getTwilioTrunk.d.ts +0 -4
  69. package/dist/utils/getTwilioTrunk.js +0 -23
  70. package/dist/utils/index.d.ts +0 -8
  71. package/dist/utils/index.js +0 -42
  72. package/dist/utils/linkTwilioNumberToApplication.d.ts +0 -5
  73. package/dist/utils/linkTwilioNumberToApplication.js +0 -128
  74. package/dist/utils/types.d.ts +0 -14
  75. package/dist/utils/types.js +0 -2
package/README.md CHANGED
@@ -1,419 +1,17 @@
1
- voice
1
+ ctl
2
2
  =================
3
3
 
4
- [![Voice](https://img.shields.io/badge/voice-api-brightgreen.svg)](https://fonoster.com)
5
- [![Version](https://img.shields.io/npm/v/@fonoster/voice.svg)](https://npmjs.org/package/@fonoster/voice)
6
- [![Downloads/week](https://img.shields.io/npm/dw/@fonoster/voice.svg)](https://npmjs.org/package/@fonoster/voice)
7
- [![License](https://img.shields.io/npm/l/@fonoster/voice.svg)](https://github.com/fonoster/fonoster/blob/main/package.json)
8
-
9
- The Voice module is a library for creating voice applications using the Fonoster API. It provides a simple way to create voice applications that can interact with the calling party using DTMF or speech recognition combined with simple verbs.
10
-
11
- * [Installation](#installation)
12
- * [Example](#example)
13
- * [Voice Response](#VoiceResponse)
4
+ [![command-line tool](https://img.shields.io/badge/ctl-oclif-brightgreen.svg)](https://fonoster.com)
5
+ [![Version](https://img.shields.io/npm/v/@fonoster/ctl.svg)](https://npmjs.org/package/@fonoster/voice)
6
+ [![Downloads/week](https://img.shields.io/npm/dw/@fonoster/ctl.svg)](https://npmjs.org/package/@fonoster/voice)
7
+ [![License](https://img.shields.io/npm/l/@fonoster/ctl.svg)](https://github.com/fonoster/fonoster/blob/main/package.json)
14
8
 
15
9
  ## Installation
16
10
 
17
11
  ```sh-session
18
- $ npm install --save @fonoster/voice
19
- ```
20
-
21
- ## Example
22
-
23
- A Voice Application is a server that controls a call's flow. A Voice Application can use any combination of the following verbs:
24
-
25
- - `Answer` - Accepts an incoming call
26
- - `Dial` - Passes the call to an Agent or a Number at the PSTN
27
- - `Hangup` - Closes the call
28
- - `Play` - Takes a URL or file and streams the sound back to the calling party
29
- - `Say` - Takes a text, synthesizes the text into audio, and streams back the result
30
- - `Gather` - Waits for DTMF or speech events and returns back the result
31
- - `SGather` - Returns a stream for future DTMF and speech results
32
- - `Stream` - Starts a stream to read and write audio into the call
33
- - `Record` - It records the voice of the calling party and saves the audio on the Storage sub-system
34
- - `Mute` - It tells the channel to stop sending media, effectively muting the channel
35
- - `Unmute` - It tells the channel to allow media flow
36
-
37
- Voice Application Example:
38
-
39
- ```typescript
40
- const VoiceServer = require("@fonoster/voice").default;
41
- const {
42
- GatherSource,
43
- VoiceRequest,
44
- VoiceResponse
45
- } = require("@fonoster/voice");
46
-
47
- new VoiceServer().listen(async (req: VoiceRequest, voice: VoiceResponse) => {
48
- const { ingressNumber, sessionRef, appRef } = req;
49
-
50
- await voice.answer();
51
-
52
- await voice.say("Hi there! What's your name?");
53
-
54
- const { speech: name } = await res.gather({
55
- source: GatherSource.SPEECH
56
- });
57
-
58
- await voice.say("Nice to meet you " + name + "!");
59
-
60
- await voice.say("Please enter your 4 digit pin.");
61
-
62
- const { digits } = await voice.gather({
63
- maxDigits: 4,
64
- finishOnKey: "#"
65
- });
66
-
67
- await voice.say("Your pin is " + digits);
68
-
69
- await voice.hangup();
70
- });
71
-
72
- // Your app will live at tcp://127.0.0.1:50061
73
- // and you can easily publish it to the Internet with:
74
- // ngrok tcp 50061
75
- ```
76
-
77
- <a name="VoiceResponse"></a>
78
-
79
- ## VoiceResponse ⇐ <code>Verb</code>
80
- Use the VoiceResponse object, to construct advance Interactive
81
- Voice Response (IVR) applications.
82
-
83
- **Kind**: global class
84
- **Extends**: <code>Verb</code>
85
- **See**: module:core:APIClient
86
-
87
- * [VoiceResponse](#VoiceResponse) ⇐ <code>Verb</code>
88
- * [new VoiceResponse(request, voice)](#new_VoiceResponse_new)
89
- * [.answer()](#VoiceResponse+answer)
90
- * [.hangup()](#VoiceResponse+hangup)
91
- * [.play(url, options)](#VoiceResponse+play)
92
- * [.playDtmf(digits)](#VoiceResponse+playDtmf)
93
- * [.playbackControl(playbackRef, action)](#VoiceResponse+playbackControl)
94
- * [.gather(options)](#VoiceResponse+gather)
95
- * [.say(text, options)](#VoiceResponse+say)
96
- * [.record(options)](#VoiceResponse+record) ⇒ <code>RecordResponse</code>
97
- * [.dial(destination, options)](#VoiceResponse+dial) ⇒ <code>Promise.&lt;DialStatusStream&gt;</code>
98
- * [.stream(options)](#VoiceResponse+stream) ⇒ <code>Promise.&lt;Stream&gt;</code>
99
- * [.sgather(options)](#VoiceResponse+sgather) ⇒ <code>Promise.&lt;StreamGatherStream&gt;</code>
100
- * [.mute(options)](#VoiceResponse+mute)
101
- * [.unmute(options)](#VoiceResponse+unmute)
102
- * [.on(event, listener)](#VoiceResponse+on)
103
-
104
- <a name="new_VoiceResponse_new"></a>
105
-
106
- ### new VoiceResponse(request, voice)
107
- Constructs a new VoiceResponse object.
108
-
109
-
110
- | Param | Type | Description |
111
- | --- | --- | --- |
112
- | request | <code>VoiceRequest</code> | Options to indicate the objects endpoint |
113
- | voice | <code>VoiceSessionStream</code> | The voice session stream |
114
-
115
- **Example**
116
- ```js
117
- import { VoiceServer } from "@fonoster/voice";
118
-
119
- async function handler (request, response) {
120
- await response.answer();
121
- await response.play("https://soundsserver:9000/sounds/hello-world.wav");
122
- }
123
-
124
- new VoiceServer().listen(handler, { port: 3000 })
125
- ```
126
- <a name="VoiceResponse+answer"></a>
127
-
128
- ### voiceResponse.answer()
129
- Answer the call. Before running any other verb you
130
- must run the anwer command.
131
-
132
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
133
- **Example**
134
- ```js
135
- async function handler (request, response) {
136
- await response.answer();
137
- }
138
- ```
139
- <a name="VoiceResponse+hangup"></a>
140
-
141
- ### voiceResponse.hangup()
142
- Hangup the call.
143
-
144
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
145
- **Example**
146
- ```js
147
- async function handler (request, response) {
148
- await response.hangup();
149
- }
150
- ```
151
- <a name="VoiceResponse+play"></a>
152
-
153
- ### voiceResponse.play(url, options)
154
- Play an audio in the call.
155
-
156
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
157
- **See**: Playback
158
-
159
- | Param | Type | Description |
160
- | --- | --- | --- |
161
- | url | <code>string</code> | The URL of the media to play |
162
- | options | <code>PlayOptions</code> | Options to control the playback |
163
- | options.playbackRef | <code>string</code> | Playback identifier to use in Playback operations |
164
-
165
- **Example**
166
- ```js
167
- async function handler (request, response) {
168
- await response.answer();
169
- await response.play("https://soundsserver:9000/sounds/hello-world.wav");
170
- }
171
- ```
172
- <a name="VoiceResponse+playDtmf"></a>
173
-
174
- ### voiceResponse.playDtmf(digits)
175
- Play a series of DTMF digits in a call.
176
-
177
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
178
-
179
- | Param | Type | Description |
180
- | --- | --- | --- |
181
- | digits | <code>string</code> | The DTMF digits to play (0-9, #, or *) |
182
-
183
- **Example**
184
- ```js
185
- async function handler (request, response) {
186
- await response.answer();
187
- await response.playDtmf("1234");
188
- }
189
- ```
190
- <a name="VoiceResponse+playbackControl"></a>
191
-
192
- ### voiceResponse.playbackControl(playbackRef, action)
193
- Control the playback of the currently playing media.
194
-
195
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
196
- **See**: play
197
-
198
- | Param | Type | Description |
199
- | --- | --- | --- |
200
- | playbackRef | <code>string</code> | The playback identifier |
201
- | action | <code>PlaybackControlAction</code> | The action to perform (STOP, RESTART, PAUSE, UNPAUSE, FORWARD) |
202
-
203
- **Example**
204
- ```js
205
- async function handler (request, response) {
206
- await response.answer();
207
- await response.play("https://s3.fonoster.io/uuid/hello-world.wav", { playbackRef: "playback-01" });
208
-
209
- // Pause the media
210
- await response.playbackControl("playback-01", PlaybackControlAction.PAUSE);
211
- }
212
- ```
213
- <a name="VoiceResponse+gather"></a>
214
-
215
- ### voiceResponse.gather(options)
216
- Waits for data entry from the user's keypad or from a speech provider.
217
-
218
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
219
- **Note**: When including `SPEECH` the default timeout is 10000 (10s).
220
-
221
- | Param | Type | Description |
222
- | --- | --- | --- |
223
- | options | <code>GatherOptions</code> | Options to select the maximum number of digits, final character, and timeout |
224
- | options.maxDigits | <code>number</code> | Maximum number of digits to collect. Defaults to 1 |
225
- | options.timeout | <code>number</code> | Milliseconds to wait before timeout. Defaults to 4000. Use zero for no timeout. |
226
- | options.finishOnKey | <code>string</code> | Optional last character to wait for. Defaults to '#'. It will not be included in the returned digits |
227
- | options.source | <code>GatherSource</code> | Where to listen as input source. This option accepts `DTMF` and `SPEECH`. A speech provider must be configure when including the `SPEECH` source. You might inclue both with `SPEECH_AND_DTMF`. Defaults to `SPEECH_AND_DTMF` |
228
-
229
- **Example**
230
- ```js
231
- async function handler (request, response) {
232
- await response.answer();
233
- const speech = await response.gather({ source: GatherSource.SPEECH, numDigits: 3 });
234
- console.log("speech: " + speech);
235
- await response.hangup();
236
- }
237
- ```
238
- <a name="VoiceResponse+say"></a>
239
-
240
- ### voiceResponse.say(text, options)
241
- Send a text for a TTS engine to convert to speech.
242
-
243
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
244
- **See**: Say
245
-
246
- | Param | Type | Description |
247
- | --- | --- | --- |
248
- | text | <code>string</code> | The text to convert to speech |
249
- | options | <code>SayOptions</code> | Options to control the TTS engine |
250
- | options.playbackRef | <code>string</code> | Playback identifier to use in Playback operations |
251
- | options.ttsOptions | <code>TTSOptions</code> | Options to control the TTS engine (specific to the TTS engine) |
252
-
253
- **Example**
254
- ```js
255
- async function handler (request, response) {
256
- await response.answer();
257
- const playbackRef = await response.say("Hello World");
258
-
259
- // Like the play verb, you can control the playback
260
- await response.playbackControl(playbackRef, PlaybackControlAction.STOP);
261
- }
262
- ```
263
- <a name="VoiceResponse+record"></a>
264
-
265
- ### voiceResponse.record(options) ⇒ <code>RecordResponse</code>
266
- Record the audio of the call.
267
-
268
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
269
- **Returns**: <code>RecordResponse</code> - The record response
270
-
271
- | Param | Type | Description |
272
- | --- | --- | --- |
273
- | options | <code>RecordOptions</code> | Options to control the record operation |
274
- | options.maxDuration | <code>number</code> | The maximum duration of the recording in seconds. Default is 60 |
275
- | options.maxSilence | <code>number</code> | The maximum duration of silence in seconds. Default is 5 |
276
- | options.beep | <code>boolean</code> | Play a beep before recording. Default is true |
277
- | options.finishOnKey | <code>string</code> | Stop recording when a DTMF digit is received. Default is '#' |
278
-
279
- **Example**
280
- ```js
281
- async function handler (request, response) {
282
- await response.answer();
283
- const record = await response.record();
284
- console.log("Recording: %s", record.name);
285
- }
286
- ```
287
- <a name="VoiceResponse+dial"></a>
288
-
289
- ### voiceResponse.dial(destination, options) ⇒ <code>Promise.&lt;DialStatusStream&gt;</code>
290
- Dials a destination and returns a stream of status.
291
-
292
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
293
- **Returns**: <code>Promise.&lt;DialStatusStream&gt;</code> - The dial status stream
294
-
295
- | Param | Type | Description |
296
- | --- | --- | --- |
297
- | destination | <code>string</code> | The destination to dial |
298
- | options | <code>DialOptions</code> | Options to control the dial operation |
299
- | options.timeout | <code>number</code> | The timeout in seconds. Default is 60 |
300
- | options.recordDirection | <code>RecordDirection</code> | The direction to record the call (IN, OUT, BOTH). Default is BOTH |
301
-
302
- <a name="VoiceResponse+stream"></a>
303
-
304
- ### voiceResponse.stream(options) ⇒ <code>Promise.&lt;Stream&gt;</code>
305
- Starts a bidirectional audio stream between the call and the application.
306
-
307
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
308
- **Returns**: <code>Promise.&lt;Stream&gt;</code> - The stream object
309
-
310
- | Param | Type | Description |
311
- | --- | --- | --- |
312
- | options | <code>StreamOptions</code> | Options to control the stream operation |
313
- | options.direction | <code>StreamDirection</code> | The direction to stream the audio (IN, OUT, BOTH). Default is BOTH |
314
- | options.format | <code>StreamAudioFormat</code> | The audio format to stream (WAV). Default is WAV |
315
-
316
- **Example**
317
- ```js
318
- async function handler (request, response) {
319
- await response.answer();
320
-
321
- const stream = await response.stream({
322
- direction: StreamDirection.BOTH
323
- });
324
-
325
- stream.onPayload((payload) => {
326
- // Use the payload
327
- });
328
-
329
- // Or write to the stream
330
- // stream.write({ type: StreamMessageType.AUDIO_OUT, payload: "\x00\x01\x02" });
331
- }
12
+ $ npm install --save @fonoster/ctl@next
332
13
  ```
333
- <a name="VoiceResponse+sgather"></a>
334
-
335
- ### voiceResponse.sgather(options) ⇒ <code>Promise.&lt;StreamGatherStream&gt;</code>
336
- Starts a server-side stream gather operation which sends transcription data to the voice server.
337
-
338
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
339
- **Returns**: <code>Promise.&lt;StreamGatherStream&gt;</code> - The stream gather object
340
- **See**: Gather
341
-
342
- | Param | Type | Description |
343
- | --- | --- | --- |
344
- | options | <code>StreamGatherOptions</code> | Options to control the stream gather operation |
345
- | options.source | <code>StreamGatherSource</code> | The source to gather data from (DTMF, SPEECH, SPEECH_AND_DTMF). Default is SPEECH |
346
-
347
- **Example**
348
- ```js
349
- async function handler (request, response) {
350
- await response.answer();
351
- const sGather = await response.streamGather({ source: StreamGatherSource.SPEECH });
352
- sGather.onPayload((payload) => {
353
- console.log("Payload: %s", payload);
354
- });
355
- }
356
- ```
357
- <a name="VoiceResponse+mute"></a>
358
-
359
- ### voiceResponse.mute(options)
360
- Mutes a call.
361
-
362
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
363
- **See**: unmute
364
-
365
- | Param | Type | Description |
366
- | --- | --- | --- |
367
- | options | <code>MuteOptions</code> | Options to control the mute operation |
368
- | options.direction | <code>MuteDirection</code> | The direction to mute the channel (IN, OUT, BOTH). Default is BOTH |
369
14
 
370
- **Example**
371
- ```js
372
- async function handler (request, response) {
373
- await response.answer();
374
- await response.mute(); // Will mute both directions
375
- }
376
- ```
377
- <a name="VoiceResponse+unmute"></a>
378
-
379
- ### voiceResponse.unmute(options)
380
- Unmutes a call.
381
-
382
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
383
- **See**: mute
384
-
385
- | Param | Type | Description |
386
- | --- | --- | --- |
387
- | options | <code>MuteOptions</code> | Options to control the unmute operation |
388
- | options.direction | <code>MuteDirection</code> | The direction to unmute the call (IN, OUT, BOTH). Default is BOTH |
389
-
390
- **Example**
391
- ```js
392
- async function handler (request, response) {
393
- await response.answer();
394
- await response.unmute(); // Will unmute both directions
395
- }
396
- ```
397
- <a name="VoiceResponse+on"></a>
398
-
399
- ### voiceResponse.on(event, listener)
400
- Register a listener for the given event.
401
-
402
- **Kind**: instance method of [<code>VoiceResponse</code>](#VoiceResponse)
403
-
404
- | Param | Type | Description |
405
- | --- | --- | --- |
406
- | event | <code>StreamEvent</code> | The event to listen for |
407
- | listener | <code>function</code> | The callback function |
408
-
409
- **Example**
410
- ```js
411
- async function handler (request, response) {
412
- ...
413
-
414
- response.on(StreamEvent.END, () => {
415
- console.log("Call ended");
416
- });
417
- }
418
- ```
15
+ ## Usage
419
16
 
17
+ Check the docs [here](https://github.com/fonoster/fonoster/blob/main/docs/early-access/link-twilio-number.md) for more information.
package/bin/run.js CHANGED
@@ -1,7 +1,25 @@
1
+ /*
2
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  #!/usr/bin/env node
2
20
 
3
21
  // eslint-disable-next-line unicorn/prefer-top-level-await
4
22
  (async () => {
5
- const oclif = await import('@oclif/core')
6
- await oclif.execute({dir: __dirname})
7
- })()
23
+ const oclif = await import("@oclif/core")
24
+ await oclif.execute({ dir: __dirname });
25
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/ctl",
3
- "version": "0.7.42",
3
+ "version": "0.7.44",
4
4
  "description": "Fonoster Control Tool",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -30,7 +30,7 @@
30
30
  "bugs": {
31
31
  "url": "https://github.com/fonoster/fonoster/issues"
32
32
  },
33
- "gitHead": "50867fa36ff09aedbbf44529d50c73c967defc78",
33
+ "gitHead": "020f1c745ce93acc27bbc1b8c9c0bdce1012cac4",
34
34
  "bin": {
35
35
  "fonoster": "./bin/run.js"
36
36
  },
@@ -42,7 +42,7 @@
42
42
  "helpClass": "./dist/help"
43
43
  },
44
44
  "dependencies": {
45
- "@fonoster/sdk": "^0.7.42",
45
+ "@fonoster/sdk": "^0.7.44",
46
46
  "@inquirer/prompts": "^7.1.0",
47
47
  "@oclif/core": "^4.0.34",
48
48
  "cliui": "^8.0.1",
@@ -50,13 +50,12 @@
50
50
  "moment": "^2.30.1",
51
51
  "phone": "^3.1.55",
52
52
  "terminal-link": "^3.0.0",
53
- "twilio": "^5.3.7",
54
- "zod": "^3.23.8"
53
+ "twilio": "^5.4.0",
54
+ "zod": "^3.24.1"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@oclif/test": "^4.1.3",
58
58
  "@types/figlet": "^1.7.0",
59
- "@types/node": "22.10.1",
60
- "ts-node": "^10.9.2"
59
+ "@types/node": "22.10.1"
61
60
  }
62
61
  }
@@ -1,15 +0,0 @@
1
- import { Command, Interfaces } from "@oclif/core";
2
- export type Args<T extends typeof Command> = Interfaces.InferredArgs<T["args"]>;
3
- export declare abstract class BaseCommand<T extends typeof Command> extends Command {
4
- static baseFlags: {
5
- insecure: Interfaces.BooleanFlag<boolean>;
6
- };
7
- protected flags: Flags<T>;
8
- protected args: Args<T>;
9
- init(): Promise<void>;
10
- protected catch(err: Error & {
11
- exitCode?: number;
12
- }): Promise<any>;
13
- protected finally(_: Error | undefined): Promise<any>;
14
- }
15
- export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)["baseFlags"] & T["flags"]>;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BaseCommand = void 0;
13
- /* eslint-disable import/no-unresolved */
14
- /*
15
- * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
16
- * http://github.com/fonoster/fonoster
17
- *
18
- * This file is part of Fonoster
19
- *
20
- * Licensed under the MIT License (the "License");
21
- * you may not use this file except in compliance with
22
- * the License. You may obtain a copy of the License at
23
- *
24
- * https://opensource.org/licenses/MIT
25
- *
26
- * Unless required by applicable law or agreed to in writing, software
27
- * distributed under the License is distributed on an "AS IS" BASIS,
28
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
- * See the License for the specific language governing permissions and
30
- * limitations under the License.
31
- */
32
- const core_1 = require("@oclif/core");
33
- class BaseCommand extends core_1.Command {
34
- init() {
35
- const _super = Object.create(null, {
36
- init: { get: () => super.init },
37
- ctor: { get: () => super.ctor }
38
- });
39
- return __awaiter(this, void 0, void 0, function* () {
40
- yield _super.init.call(this);
41
- const { args, flags } = yield this.parse({
42
- flags: this.ctor.flags,
43
- baseFlags: _super.ctor.baseFlags,
44
- enableJsonFlag: this.ctor.enableJsonFlag,
45
- args: this.ctor.args,
46
- strict: this.ctor.strict
47
- });
48
- this.flags = flags;
49
- this.args = args;
50
- });
51
- }
52
- catch(err) {
53
- const _super = Object.create(null, {
54
- catch: { get: () => super.catch }
55
- });
56
- return __awaiter(this, void 0, void 0, function* () {
57
- // add any custom logic to handle errors from the command
58
- // or simply return the parent class error handling
59
- return _super.catch.call(this, err);
60
- });
61
- }
62
- finally(_) {
63
- const _super = Object.create(null, {
64
- finally: { get: () => super.finally }
65
- });
66
- return __awaiter(this, void 0, void 0, function* () {
67
- // called after run and catch regardless of whether or not the command errored
68
- return _super.finally.call(this, _);
69
- });
70
- }
71
- }
72
- exports.BaseCommand = BaseCommand;
73
- // define flags that can be inherited by any command that extends BaseCommand
74
- BaseCommand.baseFlags = {
75
- insecure: core_1.Flags.boolean({
76
- char: "i",
77
- description: "allow connections to a server without TLS enabled",
78
- default: false
79
- })
80
- };
package/dist/Help.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Help } from "@oclif/core";
2
- export default class CustomHelp extends Help {
3
- protected showRootHelp(): Promise<void>;
4
- private showLogo;
5
- private get customCommands();
6
- }
package/dist/Help.js DELETED
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /*
7
- * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
8
- * http://github.com/fonoster/fonoster
9
- *
10
- * This file is part of Fonoster
11
- *
12
- * Licensed under the MIT License (the "License");
13
- * you may not use this file except in compliance with
14
- * the License. You may obtain a copy of the License at
15
- *
16
- * https://opensource.org/licenses/MIT
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- // eslint-disable-next-line import/no-unresolved
25
- const core_1 = require("@oclif/core");
26
- const figlet_1 = __importDefault(require("figlet"));
27
- class CustomHelp extends core_1.Help {
28
- showRootHelp() {
29
- this.showLogo();
30
- this.log(this.formatRoot());
31
- this.log("");
32
- this.log(this.formatCommands(this.customCommands));
33
- this.log("");
34
- return Promise.resolve();
35
- }
36
- showLogo() {
37
- this.log("\x1b[32m");
38
- this.log(figlet_1.default.textSync("Fonoster", {
39
- horizontalLayout: "default",
40
- verticalLayout: "default",
41
- width: 60,
42
- whitespaceBreak: true
43
- }));
44
- this.log("\x1b[0m");
45
- }
46
- get customCommands() {
47
- return this.sortedCommands
48
- .filter((c) => c.id)
49
- .sort((a, b) => (a.id.includes(":") ? 1 : b.id.includes(":") ? -1 : 0));
50
- }
51
- }
52
- exports.default = CustomHelp;
@@ -1,6 +0,0 @@
1
- import { BaseCommand } from "../../BaseCommand";
2
- export default class Create extends BaseCommand<typeof Create> {
3
- static description: string;
4
- static examples: string[];
5
- run(): Promise<void>;
6
- }