@godspeedsystems/core
Version:
> 4th Generation Declarative Microservice Framework
43 lines (42 loc) • 1.78 kB
TypeScript
import { PlainObject } from "../../types";
import { GSCloudEvent, GSContext, GSStatus } from "../interfaces";
export type EventSources = {
[key: string]: GSEventSource | GSDataSourceAsEventSource;
};
export declare abstract class GSDataSource {
config: PlainObject;
client?: PlainObject;
constructor(config: PlainObject);
init(): Promise<void>;
protected abstract initClient(): Promise<PlainObject>;
abstract execute(ctx: GSContext, args: PlainObject): Promise<any>;
}
export type RedisOptions = {
EX?: number;
PX?: number;
EXAT?: number;
NX?: boolean;
XX?: boolean;
KEEPTTL?: boolean;
GET?: boolean;
};
export declare abstract class GSCachingDataSource extends GSDataSource {
abstract set(key: string, val: any, options: RedisOptions): any;
abstract get(key: string): any;
abstract del(key: string): any;
}
export declare abstract class GSDataSourceAsEventSource {
config: PlainObject;
client: false | PlainObject;
constructor(config: PlainObject, datasourceClient: PlainObject);
abstract subscribeToEvent(eventKey: string, eventConfig: PlainObject, processEvent: (event: GSCloudEvent, eventConfig: PlainObject) => Promise<GSStatus>, event?: PlainObject): Promise<void>;
}
export declare abstract class GSEventSource {
config: PlainObject;
client: false | PlainObject;
datasources: PlainObject;
constructor(config: PlainObject, datasources: PlainObject);
init(): Promise<void>;
protected abstract initClient(): Promise<PlainObject>;
abstract subscribeToEvent(eventKey: string, eventConfig: PlainObject, processEvent: (event: GSCloudEvent, eventConfig: PlainObject) => Promise<GSStatus>, event?: PlainObject): Promise<void>;
}