@ecobee/nodejs-gcloud-pubsub-module
Version:
A GCloud Pub/Sub module for NestJS
46 lines (45 loc) • 1.56 kB
TypeScript
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 declare 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[];
}
export {};