///
///
///
import express from 'express';
import cache from 'memory-cache';
import rp from 'request-promise-native';
import winston from 'winston';
import { Compartment, DataListResponse, SimpleResponse } from '../../';
import { Datamart } from '../../api/core/datamart/Datamart';
import { AdLayoutProperty, AssetFileProperty, AssetFolderProperty, BooleanProperty, DataFileProperty, DoubleProperty, IntProperty, NativeDataProperty, NativeImageProperty, NativeTitleProperty, PluginProperty, PropertyType, StringProperty, UrlProperty } from '../../api/core/plugin/PluginPropertyInterface';
import { Index, Option } from '../../utils';
export interface InitUpdateResponse {
status: ResponseStatusCode;
msg?: string;
}
export interface LogLevelUpdateResponse {
status: ResponseStatusCode;
msg?: string;
}
export interface Credentials {
authentication_token: string;
worker_id: string;
}
export type ResponseStatusCode = 'ok' | 'error';
export interface ResponseError {
name: string;
response: {
statusCode: number;
statusMessage: string;
body: unknown;
};
}
export declare class ResourceNotFoundError extends Error {
constructor(message: string);
}
export declare class PropertiesWrapper {
readonly values: Array;
readonly normalized: Index;
constructor(values: Array);
get: (key: string) => Option;
ofType: (typeName: PropertyType) => Option;
findAssetFileProperty: (key?: string) => Option;
findAssetFolderProperty: (key?: string) => Option;
findDataFileProperty: (key?: string) => Option;
findUrlProperty: (key?: string) => Option;
findStringProperty: (key?: string) => Option;
findAdLayoutProperty: (key?: string) => Option;
findBooleanProperty: (key?: string) => Option;
findDoubleProperty: (key?: string) => Option;
findIntProperty: (key?: string) => Option;
findNativeDataProperty: (key?: string) => Option;
findNativeTitleProperty: (key?: string) => Option;
findNativeImageProperty: (key?: string) => Option;
}
export declare abstract class BasePlugin {
multiThread: boolean;
INSTANCE_CONTEXT_CACHE_EXPIRATION: number;
pluginCache: cache.CacheClass>;
gatewayHost: string;
gatewayPort: number;
outboundPlatformUrl: string;
app: express.Application;
logger: winston.Logger;
credentials: Credentials;
_transport: rp.RequestPromiseAPI;
enableThrottling: boolean;
constructor(enableThrottling?: boolean);
getInstanceContextCacheExpiration(): number;
onLogLevelUpdate(level: string): void;
fetchDataFile(uri: string): Promise;
fetchConfigurationFileOptional(fileName: string): Promise;
fetchConfigurationFile(fileName: string): Promise;
upsertConfigurationFile(fileName: string, fileContent: Buffer): Promise;
requestGatewayHelper(method: string, uri: string, body?: unknown, qs?: unknown, isJson?: boolean, isBinary?: boolean): Promise;
requestPublicMicsApiHelper(apiToken: string, options: rp.OptionsWithUri): Promise;
fetchDatamarts(apiToken: string, organisationId: string): Promise>;
fetchDatamartCompartments(apiToken: string, datamartId: string): Promise>;
onInitRequest(creds: Credentials): void;
start(): void;
protected httpIsReady(): string;
protected onLogLevelUpdateHandler(req: express.Request, res: express.Response): express.Response> | undefined;
protected onLogLevelRequest(req: express.Request, res: express.Response): void;
protected onStatusRequest(req: express.Request, res: express.Response): void;
protected asyncMiddleware: (fn: (req: express.Request, res: express.Response, next: express.NextFunction) => unknown) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
protected setErrorHandler(): void;
private initLogLevelUpdateRoute;
private initLogLevelGetRoute;
private initStatusRoute;
private initInitRoute;
getMetadata(): {
runtime: string;
runtime_version: string;
group_id: string | undefined;
artifact_id: string | undefined;
plugin_type: string | undefined;
plugin_version: string | undefined;
plugin_build: string | undefined;
dependencies: any;
};
private initMetadataRoute;
}