@godspeedsystems/core
Version:
> 4th Generation Declarative Microservice Framework
86 lines (85 loc) • 3.03 kB
TypeScript
import 'dotenv/config';
import { logger } from './logger';
import { NativeFunctions } from './core/functionLoader';
import { GSActor, GSCloudEvent, GSContext, GSStatus, GSResponse } from './core/interfaces';
import { GSDataSource, GSCachingDataSource, GSEventSource, GSDataSourceAsEventSource, EventSources, RedisOptions } from './core/_interfaces/sources';
import { PlainObject } from './types';
import { generateSwaggerJSON } from './router/swagger';
import yamlLoader from './core/yamlLoader';
export interface GodspeedParams {
eventsFolderPath?: string;
workflowsFolderPath: string;
definitionsFolderPath?: string;
datasourcesFolderPath?: string;
configFolderPath: string;
eventsourcesFolderPath?: string;
mappingsFolderPath?: string;
pluginsFolderPath?: String;
}
declare class Godspeed {
datasources: {
[key: string]: GSDataSource;
};
eventsources: EventSources;
withoutEventSource: boolean;
plugins: PlainObject;
workflows: {
[key: string]: Function;
};
nativeFunctions: NativeFunctions;
events: PlainObject;
definitions: PlainObject;
config: PlainObject;
mappings: PlainObject;
isProd: boolean;
folderPaths: {
events: string;
workflows: string;
definitions: string;
config: string;
datasources: string;
eventsources: string;
mappings: string;
plugins: string;
};
constructor(params?: GodspeedParams, withoutEventSource?: boolean);
initialize(): Promise<void>;
_loadMappings(): Promise<PlainObject>;
private _loadEvents;
private _loadDefinitions;
private _loadFunctions;
private _loadPlugins;
private _loadDatasources;
private _loadEventsources;
private subscribeToEvents;
private saveHttpEventsSwaggerJson;
/**
* For executing a workflow directly without an eventsource from a Nodejs project
*/
executeWorkflow(name: string, args: PlainObject): Promise<GSStatus>;
/**
* Sanitizes response data to handle non-serializable types like bigint, functions, etc.
* @param status GSStatus object to sanitize
* @returns Sanitized GSStatus object
*/
private sanitizeResponseData;
private deepSerialize;
private processEvent;
/**
*
* @param event
* @param eventConfig
* @returns All the log attributes specific to this event
*/
private getLogAttributes;
/**
*
* @param event
* @returns Attributes common to all events, based on `log.attributes` spec in config
*/
private getCommonAttrs;
}
export { GSActor, GSCloudEvent, GSStatus, PlainObject, GSContext, GSResponse, GSDataSourceAsEventSource, // kafk, it share the client with datasource
GSEventSource, // express. it has own mechanisim for initClient
GSDataSource, GSCachingDataSource, yamlLoader, logger, RedisOptions, generateSwaggerJSON };
export default Godspeed;