import mongoose from 'mongoose'; import Store, { OAuthSignaturesCollection, StoreCardItem, StoreGlobalTokenItem, StoreOAuthItem, StoreUrlSignatureItem, UrlSignaturesCollection } from './Store'; import { StoreOptions } from './StoreOptions'; export interface MongoStoreOptions extends StoreOptions { cache?: boolean; dbName?: string; dbHost?: string; dbPort?: string | number; dbAddress?: string; limit?: number; dbOptions?: Record; } /** * Simple Store using MongoDB */ declare class MongoStore extends Store { dbName: string; dbHost: string; dbPort: string | number; dbAddress: string; initLimit: number; connection: mongoose; Signature: mongoose.Schema; GlobalToken: mongoose.Schema; OAuthToken: mongoose.Schema; CardTicket: mongoose.Schema; constructor(options?: MongoStoreOptions); /** * Initialize wechat token, signature, etc... from mongodb */ initializeTokenFromDB(): Promise; getGlobalToken(force?: boolean): Promise; getCardTicket(force?: boolean): Promise; getUrlSignatures(limit?: number): Promise; getOAuthTokens(limit?: number): Promise; updateGlobalToken(info: StoreGlobalTokenItem): Promise; updateCardTicket(ticketInfo: StoreCardItem): Promise; saveSignature(url: string, signatureInfo: StoreUrlSignatureItem): Promise; getSignature(url: string): Promise; updateSignature(url: string, newInfo: StoreUrlSignatureItem): Promise; getOAuthAccessToken(key: string): Promise; saveOAuthAccessToken(key: string, info: StoreOAuthItem): Promise; updateOAuthAccessToken(key: string, newInfo: StoreOAuthItem): Promise; flushGlobalToken(): Promise; flushCardTicket(): Promise; flushSignatures(): Promise; flushOAuthTokens(): Promise; flush(): Promise; destroy(): void; toObject>(doc: T): T; } export default MongoStore;