-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
39 lines (38 loc) · 1.42 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import SQS from 'aws-sdk/clients/sqs'
import SNS from 'aws-sdk/clients/sns'
declare module '@rfcx/message-queue' {
function MessageHandler(message: any): boolean | Promise<boolean>
type clientType = 'sns' | 'sqs'
interface MessageQueueOptions {
topicPrefix?: string
topicPostfix?: string
}
class SQSMessageQueueClient {
constructor(options: object)
sqs: SQS
cachedQueueUrls: object
createQueue(queueName: string): Promise<String>
queueUrl(queueName: string): Promise<String>
publish(queueName: string, message: unknown): Promise<SQS.Types.SendMessageResult>
subscribe(queueName: string, messageHandler: typeof MessageHandler): void
}
class SNSMessageQueueClient {
constructor(options: object)
sns: SNS
cachedTopicArns: object
createTopic(name: string): Promise<string>
combineTopicArn(name: string): string
topicArn(name: string): string
publish(topicName: string, message: unknown): Promise<SNS.Types.PublishResponse>
subscribe(topicName: string, messageHandler: typeof MessageHandler): void
}
class MessageQueue {
constructor(clientType: clientType, options?: MessageQueueOptions)
topicPrefix?: string
topicPostfix?: string
client: SQSMessageQueueClient | SNSMessageQueueClient
queueName(): string
publish(eventName: string, message: unknown): void
subscribe(eventName: string, messageHandler: typeof MessageHandler): boolean
}
}