-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgcloud-pub-sub.interface.ts
49 lines (42 loc) · 1.4 KB
/
gcloud-pub-sub.interface.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
40
41
42
43
44
45
46
47
48
49
import { Type } from '@nestjs/common'
import { ModuleMetadata } from '@nestjs/common/interfaces'
import { PublishOptions } from '@google-cloud/pubsub/build/src/topic'
import { SubscriberOptions } from '@google-cloud/pubsub/build/src/subscriber'
export interface GCloudPubSubServerOptions {
authOptions: GoogleAuthOptions
subscriptionIds: string[]
subscriberOptions?: SubscriberOptions
}
export type GcloudPubSubModuleOptions = {
authOptions: GoogleAuthOptions
publishOptions?: PublishOptions
}
export interface Message {
topic: string
message: string
attributes: { [key: string]: string }
}
interface CredentialBody {
client_email?: string
private_key?: string
}
export interface GoogleAuthOptions {
/** Path to a .json, .pem, or .p12 key file */
keyFilename?: string
/** Path to a .json, .pem, or .p12 key file */
keyFile?: string
credentials?: CredentialBody
/** Required scopes for the desired API request */
scopes?: string | string[]
projectId?: string
uri?: string
}
export interface GcloudPubSubOptionsFactory {
createGcloudPubSubOptions(): Promise<GcloudPubSubModuleOptions> | GcloudPubSubModuleOptions
}
export interface GcloudPubSubModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useExisting?: Type<GcloudPubSubOptionsFactory>
useClass?: Type<GcloudPubSubOptionsFactory>
useFactory?: (...args: any[]) => Promise<GcloudPubSubModuleOptions> | GcloudPubSubModuleOptions
inject?: any[]
}