@stacksjs/ts-cloud 0.2.3 → 0.2.5
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/aws/acm.d.ts +215 -0
- package/dist/aws/application-autoscaling.d.ts +345 -0
- package/dist/aws/bedrock.d.ts +2672 -0
- package/dist/aws/client.d.ts +181 -0
- package/dist/aws/cloudformation.d.ts +187 -0
- package/dist/aws/cloudfront.d.ts +416 -0
- package/dist/aws/cloudwatch-logs.d.ts +70 -0
- package/dist/aws/comprehend.d.ts +616 -0
- package/dist/aws/connect.d.ts +533 -0
- package/dist/aws/deploy-imap.d.ts +26 -0
- package/dist/aws/dynamodb.d.ts +270 -0
- package/dist/aws/ec2.d.ts +545 -0
- package/dist/aws/ecr.d.ts +240 -0
- package/dist/aws/ecs.d.ts +267 -0
- package/dist/aws/efs.d.ts +36 -0
- package/dist/aws/elasticache.d.ts +112 -0
- package/dist/aws/elbv2.d.ts +389 -0
- package/dist/aws/email.d.ts +260 -0
- package/dist/aws/eventbridge.d.ts +197 -0
- package/dist/aws/iam.d.ts +1013 -0
- package/dist/aws/imap-server.d.ts +298 -0
- package/dist/aws/index.d.ts +53 -0
- package/dist/aws/kendra.d.ts +831 -0
- package/dist/aws/lambda.d.ts +319 -0
- package/dist/aws/opensearch.d.ts +121 -0
- package/dist/aws/personalize.d.ts +586 -0
- package/dist/aws/polly.d.ts +243 -0
- package/dist/aws/rds.d.ts +346 -0
- package/dist/aws/rekognition.d.ts +691 -0
- package/dist/aws/route53-domains.d.ts +161 -0
- package/dist/aws/route53.d.ts +330 -0
- package/dist/aws/s3.d.ts +535 -0
- package/dist/aws/scheduler.d.ts +224 -0
- package/dist/aws/secrets-manager.d.ts +267 -0
- package/dist/aws/ses.d.ts +441 -0
- package/dist/aws/setup-phone.d.ts +1 -0
- package/dist/aws/setup-sms.d.ts +116 -0
- package/dist/aws/sms.d.ts +477 -0
- package/dist/aws/smtp-server.d.ts +108 -0
- package/dist/aws/sns.d.ts +224 -0
- package/dist/aws/sqs.d.ts +107 -0
- package/dist/aws/ssm.d.ts +311 -0
- package/dist/aws/sts.d.ts +21 -0
- package/dist/aws/support.d.ts +139 -0
- package/dist/aws/test-imap.d.ts +15 -0
- package/dist/aws/textract.d.ts +477 -0
- package/dist/aws/transcribe.d.ts +79 -0
- package/dist/aws/translate.d.ts +424 -0
- package/dist/aws/voice.d.ts +361 -0
- package/dist/bin/cli.js +4500 -809
- package/dist/config.d.ts +5 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/static-site-external-dns.d.ts +70 -0
- package/dist/deploy/static-site.d.ts +110 -0
- package/dist/dns/cloudflare.d.ts +74 -0
- package/dist/dns/godaddy.d.ts +63 -0
- package/dist/dns/index.d.ts +67 -0
- package/dist/dns/porkbun.d.ts +43 -0
- package/dist/dns/route53-adapter.d.ts +67 -0
- package/dist/dns/types.d.ts +100 -0
- package/dist/dns/validator.d.ts +105 -0
- package/dist/generators/index.d.ts +4 -0
- package/dist/generators/infrastructure.d.ts +115 -0
- package/dist/index.d.ts +9 -165
- package/dist/index.js +24067 -6430
- package/dist/push/apns.d.ts +140 -0
- package/dist/push/fcm.d.ts +205 -0
- package/dist/push/index.d.ts +44 -0
- package/dist/security/pre-deploy-scanner.d.ts +97 -0
- package/dist/ssl/acme-client.d.ts +133 -0
- package/dist/ssl/index.d.ts +6 -0
- package/dist/ssl/letsencrypt.d.ts +96 -0
- package/dist/utils/cli.d.ts +121 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/template.d.ts +27 -0
- package/package.json +6 -6
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Voice Module
|
|
3
|
+
* Provides voice calling and voicemail with S3 storage
|
|
4
|
+
*
|
|
5
|
+
* Similar to the Email and SMS modules, this provides:
|
|
6
|
+
* - Making outbound calls via Connect
|
|
7
|
+
* - Receiving voicemails stored in S3
|
|
8
|
+
* - Voicemail management (list, read, delete)
|
|
9
|
+
* - Call recording storage
|
|
10
|
+
* - Text-to-speech for voice messages
|
|
11
|
+
*/
|
|
12
|
+
export interface VoiceClientConfig {
|
|
13
|
+
region?: string;
|
|
14
|
+
voicemailBucket?: string;
|
|
15
|
+
voicemailPrefix?: string;
|
|
16
|
+
recordingsPrefix?: string;
|
|
17
|
+
connectInstanceId?: string;
|
|
18
|
+
connectContactFlowId?: string;
|
|
19
|
+
defaultCallerId?: string;
|
|
20
|
+
enableTranscription?: boolean;
|
|
21
|
+
transcriptionLanguage?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Voicemail {
|
|
24
|
+
key: string;
|
|
25
|
+
from: string;
|
|
26
|
+
to: string;
|
|
27
|
+
duration: number;
|
|
28
|
+
timestamp: Date;
|
|
29
|
+
transcription?: string;
|
|
30
|
+
transcriptionStatus?: 'pending' | 'processing' | 'completed' | 'failed';
|
|
31
|
+
transcriptionJobName?: string;
|
|
32
|
+
audioUrl?: string;
|
|
33
|
+
read?: boolean;
|
|
34
|
+
readAt?: Date;
|
|
35
|
+
contentType?: string;
|
|
36
|
+
size?: number;
|
|
37
|
+
raw?: any;
|
|
38
|
+
}
|
|
39
|
+
export interface CallRecording {
|
|
40
|
+
key: string;
|
|
41
|
+
contactId: string;
|
|
42
|
+
from?: string;
|
|
43
|
+
to?: string;
|
|
44
|
+
duration: number;
|
|
45
|
+
timestamp: Date;
|
|
46
|
+
audioUrl?: string;
|
|
47
|
+
contentType?: string;
|
|
48
|
+
size?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface MakeCallOptions {
|
|
51
|
+
to: string;
|
|
52
|
+
from?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
voiceId?: string;
|
|
55
|
+
audioUrl?: string;
|
|
56
|
+
contactFlowId?: string;
|
|
57
|
+
attributes?: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
export interface SendVoiceMessageOptions {
|
|
60
|
+
to: string;
|
|
61
|
+
from?: string;
|
|
62
|
+
message: string;
|
|
63
|
+
voiceId?: string;
|
|
64
|
+
languageCode?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface VoicemailGreeting {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
type: 'default' | 'busy' | 'unavailable' | 'custom';
|
|
70
|
+
text?: string;
|
|
71
|
+
audioKey?: string;
|
|
72
|
+
audioUrl?: string;
|
|
73
|
+
voiceId?: string;
|
|
74
|
+
languageCode?: string;
|
|
75
|
+
isActive: boolean;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
updatedAt?: Date;
|
|
78
|
+
}
|
|
79
|
+
export interface CallForwardingRule {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
condition: 'always' | 'busy' | 'no_answer' | 'unreachable' | 'after_hours';
|
|
84
|
+
forwardTo: string;
|
|
85
|
+
ringTimeout?: number;
|
|
86
|
+
businessHours?: {
|
|
87
|
+
timezone: string;
|
|
88
|
+
schedule: Array<{
|
|
89
|
+
day: 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
|
|
90
|
+
start: string;
|
|
91
|
+
end: string;
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
priority: number;
|
|
95
|
+
createdAt: Date;
|
|
96
|
+
updatedAt?: Date;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Voice Client with S3 voicemail storage
|
|
100
|
+
*/
|
|
101
|
+
export declare class VoiceClient {
|
|
102
|
+
private config;
|
|
103
|
+
private connect?;
|
|
104
|
+
private s3?;
|
|
105
|
+
private transcribe?;
|
|
106
|
+
constructor(config?: VoiceClientConfig);
|
|
107
|
+
/**
|
|
108
|
+
* Make an outbound voice call via Connect
|
|
109
|
+
*/
|
|
110
|
+
call(options: MakeCallOptions): Promise<{
|
|
111
|
+
callId: string;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Send a voice message (one-way TTS call) via Connect
|
|
115
|
+
*
|
|
116
|
+
* Note: This requires a Contact Flow configured for TTS playback.
|
|
117
|
+
* The message is passed as an attribute that the Contact Flow can use.
|
|
118
|
+
*/
|
|
119
|
+
sendVoiceMessage(options: SendVoiceMessageOptions): Promise<{
|
|
120
|
+
messageId: string;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Send a TTS voice message (alias for sendVoiceMessage)
|
|
124
|
+
*/
|
|
125
|
+
speak(to: string, message: string, voiceId?: string): Promise<{
|
|
126
|
+
messageId: string;
|
|
127
|
+
}>;
|
|
128
|
+
/**
|
|
129
|
+
* Get voicemails from S3
|
|
130
|
+
*/
|
|
131
|
+
getVoicemails(options?: {
|
|
132
|
+
prefix?: string;
|
|
133
|
+
maxResults?: number;
|
|
134
|
+
}): Promise<Voicemail[]>;
|
|
135
|
+
/**
|
|
136
|
+
* Get a specific voicemail
|
|
137
|
+
*/
|
|
138
|
+
getVoicemail(key: string): Promise<Voicemail | null>;
|
|
139
|
+
/**
|
|
140
|
+
* Get voicemail audio as a signed URL
|
|
141
|
+
*/
|
|
142
|
+
getVoicemailAudioUrl(key: string, expiresIn?: number): Promise<string>;
|
|
143
|
+
/**
|
|
144
|
+
* Delete a voicemail
|
|
145
|
+
*/
|
|
146
|
+
deleteVoicemail(key: string): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Archive a voicemail
|
|
149
|
+
*/
|
|
150
|
+
archiveVoicemail(key: string): Promise<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Get voicemail count
|
|
153
|
+
*/
|
|
154
|
+
getVoicemailCount(): Promise<number>;
|
|
155
|
+
/**
|
|
156
|
+
* Get unread voicemail count
|
|
157
|
+
*/
|
|
158
|
+
getUnreadCount(): Promise<number>;
|
|
159
|
+
/**
|
|
160
|
+
* Mark a voicemail as read
|
|
161
|
+
*/
|
|
162
|
+
markAsRead(key: string): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Mark a voicemail as unread
|
|
165
|
+
*/
|
|
166
|
+
markAsUnread(key: string): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Batch mark voicemails as read
|
|
169
|
+
*/
|
|
170
|
+
markManyAsRead(keys: string[]): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Batch delete voicemails
|
|
173
|
+
*/
|
|
174
|
+
deleteMany(keys: string[]): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Start transcription for a voicemail
|
|
177
|
+
*/
|
|
178
|
+
transcribeVoicemail(key: string): Promise<{
|
|
179
|
+
jobName: string;
|
|
180
|
+
}>;
|
|
181
|
+
/**
|
|
182
|
+
* Get transcription status for a voicemail
|
|
183
|
+
*/
|
|
184
|
+
getTranscriptionStatus(jobName: string): Promise<{
|
|
185
|
+
status: 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
|
|
186
|
+
transcription?: string;
|
|
187
|
+
}>;
|
|
188
|
+
/**
|
|
189
|
+
* Update voicemail metadata with completed transcription
|
|
190
|
+
*/
|
|
191
|
+
updateTranscription(key: string, transcription: string): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Create a voicemail greeting
|
|
194
|
+
*/
|
|
195
|
+
createGreeting(greeting: {
|
|
196
|
+
name: string;
|
|
197
|
+
type: 'default' | 'busy' | 'unavailable' | 'custom';
|
|
198
|
+
text?: string;
|
|
199
|
+
audioData?: Buffer | string;
|
|
200
|
+
voiceId?: string;
|
|
201
|
+
languageCode?: string;
|
|
202
|
+
setActive?: boolean;
|
|
203
|
+
}): Promise<VoicemailGreeting>;
|
|
204
|
+
/**
|
|
205
|
+
* Get all voicemail greetings
|
|
206
|
+
*/
|
|
207
|
+
getGreetings(): Promise<VoicemailGreeting[]>;
|
|
208
|
+
/**
|
|
209
|
+
* Get a specific greeting
|
|
210
|
+
*/
|
|
211
|
+
getGreeting(id: string): Promise<VoicemailGreeting | null>;
|
|
212
|
+
/**
|
|
213
|
+
* Get the active greeting of a specific type
|
|
214
|
+
*/
|
|
215
|
+
getActiveGreeting(type: 'default' | 'busy' | 'unavailable' | 'custom'): Promise<VoicemailGreeting | null>;
|
|
216
|
+
/**
|
|
217
|
+
* Set a greeting as active
|
|
218
|
+
*/
|
|
219
|
+
setActiveGreeting(id: string): Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* Deactivate all greetings of a type
|
|
222
|
+
*/
|
|
223
|
+
private deactivateGreetingsOfType;
|
|
224
|
+
/**
|
|
225
|
+
* Update a greeting
|
|
226
|
+
*/
|
|
227
|
+
updateGreeting(id: string, updates: {
|
|
228
|
+
name?: string;
|
|
229
|
+
text?: string;
|
|
230
|
+
audioData?: Buffer | string;
|
|
231
|
+
}): Promise<VoicemailGreeting>;
|
|
232
|
+
/**
|
|
233
|
+
* Delete a greeting
|
|
234
|
+
*/
|
|
235
|
+
deleteGreeting(id: string): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Get a signed URL for a greeting audio
|
|
238
|
+
*/
|
|
239
|
+
getGreetingAudioUrl(id: string, expiresIn?: number): Promise<string | null>;
|
|
240
|
+
/**
|
|
241
|
+
* Create a call forwarding rule
|
|
242
|
+
*/
|
|
243
|
+
createForwardingRule(rule: {
|
|
244
|
+
name: string;
|
|
245
|
+
condition: 'always' | 'busy' | 'no_answer' | 'unreachable' | 'after_hours';
|
|
246
|
+
forwardTo: string;
|
|
247
|
+
ringTimeout?: number;
|
|
248
|
+
businessHours?: CallForwardingRule['businessHours'];
|
|
249
|
+
priority?: number;
|
|
250
|
+
enabled?: boolean;
|
|
251
|
+
}): Promise<CallForwardingRule>;
|
|
252
|
+
/**
|
|
253
|
+
* Get all forwarding rules
|
|
254
|
+
*/
|
|
255
|
+
getForwardingRules(): Promise<CallForwardingRule[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Get a specific forwarding rule
|
|
258
|
+
*/
|
|
259
|
+
getForwardingRule(id: string): Promise<CallForwardingRule | null>;
|
|
260
|
+
/**
|
|
261
|
+
* Update a forwarding rule
|
|
262
|
+
*/
|
|
263
|
+
updateForwardingRule(id: string, updates: Partial<Omit<CallForwardingRule, 'id' | 'createdAt' | 'updatedAt'>>): Promise<CallForwardingRule>;
|
|
264
|
+
/**
|
|
265
|
+
* Enable/disable a forwarding rule
|
|
266
|
+
*/
|
|
267
|
+
setForwardingRuleEnabled(id: string, enabled: boolean): Promise<void>;
|
|
268
|
+
/**
|
|
269
|
+
* Delete a forwarding rule
|
|
270
|
+
*/
|
|
271
|
+
deleteForwardingRule(id: string): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Get the applicable forwarding rule for current conditions
|
|
274
|
+
* Returns the highest priority enabled rule that matches current conditions
|
|
275
|
+
*/
|
|
276
|
+
getApplicableForwardingRule(currentConditions?: {
|
|
277
|
+
isBusy?: boolean;
|
|
278
|
+
isUnreachable?: boolean;
|
|
279
|
+
noAnswer?: boolean;
|
|
280
|
+
}): Promise<CallForwardingRule | null>;
|
|
281
|
+
/**
|
|
282
|
+
* Check if a time is within business hours
|
|
283
|
+
*/
|
|
284
|
+
private isWithinBusinessHours;
|
|
285
|
+
/**
|
|
286
|
+
* Get call recordings from S3
|
|
287
|
+
*/
|
|
288
|
+
getRecordings(options?: {
|
|
289
|
+
prefix?: string;
|
|
290
|
+
maxResults?: number;
|
|
291
|
+
}): Promise<CallRecording[]>;
|
|
292
|
+
/**
|
|
293
|
+
* Get a recording audio URL
|
|
294
|
+
*/
|
|
295
|
+
getRecordingUrl(key: string, expiresIn?: number): Promise<string>;
|
|
296
|
+
/**
|
|
297
|
+
* Store an incoming voicemail to S3
|
|
298
|
+
* This is typically called from a Lambda handler
|
|
299
|
+
*/
|
|
300
|
+
storeVoicemail(voicemail: {
|
|
301
|
+
from: string;
|
|
302
|
+
to: string;
|
|
303
|
+
audioData: Buffer | string;
|
|
304
|
+
duration?: number;
|
|
305
|
+
transcription?: string;
|
|
306
|
+
contentType?: string;
|
|
307
|
+
timestamp?: Date;
|
|
308
|
+
}): Promise<string>;
|
|
309
|
+
/**
|
|
310
|
+
* Store a call recording to S3
|
|
311
|
+
*/
|
|
312
|
+
storeRecording(recording: {
|
|
313
|
+
contactId: string;
|
|
314
|
+
from?: string;
|
|
315
|
+
to?: string;
|
|
316
|
+
audioData: Buffer | string;
|
|
317
|
+
duration?: number;
|
|
318
|
+
contentType?: string;
|
|
319
|
+
timestamp?: Date;
|
|
320
|
+
}): Promise<string>;
|
|
321
|
+
/**
|
|
322
|
+
* Get voicemail metadata from S3
|
|
323
|
+
*/
|
|
324
|
+
private getVoicemailMetadata;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Create a Lambda handler for processing incoming voicemails
|
|
328
|
+
* Use this with Connect's voicemail feature or custom IVR
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* // lambda.ts
|
|
333
|
+
* import { createVoicemailHandler } from 'ts-cloud/aws/voice'
|
|
334
|
+
*
|
|
335
|
+
* export const handler = createVoicemailHandler({
|
|
336
|
+
* bucket: 'my-voicemail-bucket',
|
|
337
|
+
* prefix: 'voicemail/',
|
|
338
|
+
* region: 'us-east-1',
|
|
339
|
+
* })
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
export declare function createVoicemailHandler(config: {
|
|
343
|
+
bucket: string;
|
|
344
|
+
prefix?: string;
|
|
345
|
+
region?: string;
|
|
346
|
+
onVoicemail?: (voicemail: Voicemail) => Promise<void>;
|
|
347
|
+
}): (event: any) => Promise<any>;
|
|
348
|
+
/**
|
|
349
|
+
* Create a Lambda handler for Connect recording events
|
|
350
|
+
* This processes call recordings uploaded to S3 by Connect
|
|
351
|
+
*/
|
|
352
|
+
export declare function createRecordingHandler(config: {
|
|
353
|
+
bucket: string;
|
|
354
|
+
prefix?: string;
|
|
355
|
+
region?: string;
|
|
356
|
+
onRecording?: (recording: CallRecording) => Promise<void>;
|
|
357
|
+
}): (event: any) => Promise<any>;
|
|
358
|
+
/**
|
|
359
|
+
* Convenience function to create a voice client
|
|
360
|
+
*/
|
|
361
|
+
export declare function createVoiceClient(config?: VoiceClientConfig): VoiceClient;
|