UNPKG

@restorecommerce/chassis-srv

Version:

Restore Commerce microservice chassis

112 lines 3.98 kB
import { Server } from './../microservice/server.js'; import { Events, Topic } from '@restorecommerce/kafka-client'; import { Logger } from 'winston'; import { RedisClientType } from 'redis'; import { CommandRequest, CommandInterfaceServiceImplementation } from '@restorecommerce/rc-grpc-clients/dist/generated-server/io/restorecommerce/commandinterface.js'; import { CallContext } from 'nice-grpc'; import { HealthCheckResponse_ServingStatus } from '@restorecommerce/rc-grpc-clients/dist/generated-server/grpc/health/v1/health.js'; /** * Base implementation. * Currently includes: * * 'check' - returns UNKNOWN, SERVING or NOT_SERVING * * 'version' - returns NPM service version and Node.js version * * 'reset' - truncated all DB instances specified in config files * * 'restore' - re-reads Kafka events to restore a set of ArangoDB collections' data * Unimplemented: * * reconfigure * * In case of custom data/events handling or service-specific operations regarding * a certain method, such method should be extended or overriden. */ export declare class CommandInterface implements CommandInterfaceServiceImplementation { logger: Logger; config: any; health: any; service: any; kafkaEvents: Events; commands: any; commandTopic: Topic; bufferedCollection: Map<string, string>; redisClient: RedisClientType<any, any>; constructor(server: Server, config: any, logger: Logger, events: Events, redisClient: RedisClientType<any, any>); /** * Generic command operation, which demultiplexes a command by its name and parameters. */ command(request: CommandRequest, context: CallContext): Promise<{ typeUrl?: string; value?: Buffer; }>; /** * Reconfigure service * @param call * @param context */ reconfigure(): any; /** * Restore the system by re-reading Kafka messages. * This base implementation restores documents from a set of * ArangoDB database collections, using the chassis-srv database provider. * @param topics list of Kafka topics to be restored */ restore(payload: any): Promise<any>; private startToReceiveRestoreMessages; /** * Reset system data related to a service. Default implementation truncates * a set of ArangoDB instances, using the chassis-srv database provider. */ reset(): Promise<any>; /** * Check the service status */ check(payload: { service?: string; }): Promise<{ status: HealthCheckResponse_ServingStatus; }>; /** * Retrieve current NPM package and Node version of service */ version(): Promise<any>; /** * Update config for acs-client to disable it * @param payload JSON object containing key value pairs for configuration */ configUpdate(payload: any): Promise<any>; /** * Sets provided authentication apiKey on configuration * @param payload JSON object containing key value pairs for authentication apiKey */ setApiKey(payload: any): Promise<any>; /** * Flush the cache based on DB index and prefix passed, if no dbIndex is passed * then the complete Cache is flushed. * * @param prefix An optional prefix to flush instead of entire cache */ flushCache(payload: any): Promise<any>; /** * Generic resource restore setup. * @param db * @param resource */ makeResourcesRestoreSetup(db: any, resource: string): any; /** * Check if the message contains buffered field, if so decode it. * @param message * @param collectionName */ decodeBufferField(message: any, resource: string): any; /** * * @param msg google.protobuf.Any * @returns Arbitrary JSON */ decodeMsg(msg: any): any; /** * * @param msg Arbitrary JSON * @returns google.protobuf.Any formatted message */ encodeMsg(msg: any): any; } //# sourceMappingURL=index.d.ts.map