@energyweb/node-red-contrib-green-proof-worker
Version:
## Peer dependencies
84 lines (83 loc) • 2.98 kB
TypeScript
import type { Kysely } from 'kysely';
import { z } from 'zod';
import type { Api } from '../api';
import type { SqliteDatabase } from '../types';
/**
* Self-acking HTTP source API, using configured SQLite config node or trying to find it in all nodes
*/
export declare const SourceHttpApi: (api: Api) => {
new (config: any): {
database: Promise<Kysely<SqliteDatabase>>;
buildGetMessageUrl(): Promise<URL>;
getLastAckedMessageId(): Promise<string | null>;
ackMessage(messageId: string): Promise<void>;
isDestroying: boolean;
nextMessageWaitTime: number;
pendingProcessing: {
messageId: string;
resolve: VoidFunction;
reject: (err: Error) => void;
} | null;
config: Promise<{
namespace: string;
host: string;
workerId: string;
}>;
getMessageLoop(): Promise<void>;
setStatus(status: "error" | "waiting" | "pending"): void;
onInput(message: {
topic: "finished-processing";
payload: {
httpApiMessageId: string;
};
} | {
topic: "force-reset";
}): void;
getMessage(): Promise<unknown>;
onDestroy(): void;
api: Api;
nodeConfig: unknown;
messageZod: z.ZodUnion<[z.ZodObject<{
topic: z.ZodLiteral<"finished-processing">;
payload: z.ZodObject<{
httpApiMessageId: z.ZodString;
}, "strip", z.ZodTypeAny, {
httpApiMessageId: string;
}, {
httpApiMessageId: string;
}>;
}, "strip", z.ZodTypeAny, {
topic: "finished-processing";
payload: {
httpApiMessageId: string;
};
}, {
topic: "finished-processing";
payload: {
httpApiMessageId: string;
};
}>, z.ZodObject<{
topic: z.ZodLiteral<"force-reset">;
}, "strip", z.ZodTypeAny, {
topic: "force-reset";
}, {
topic: "force-reset";
}>]>;
getBaseUrls(): Promise<{
kafka_url?: string | string[] | undefined;
kafka_proxy_url?: string | undefined;
indexer_url?: string | undefined;
rpc_url?: string | undefined;
}>;
getNodeEnvConfig(): {
BASE_URL_CDN?: string | undefined;
EWX_SOLUTION_ID?: string | undefined;
EWX_SOLUTION_GROUP_ID?: string | undefined;
EWX_WORKLOGIC_ID?: string | undefined;
EWX_SQLITE_PATH?: string | undefined;
EWX_WORKER_ADDRESS?: string | undefined;
};
sendBuilder(inputMessage: import("../types").NodeMessage<any>): import("../node").SendBuilder;
handleMaybePromise<T>(maybePromiseCb: () => T | Promise<T>, done: (err?: Error | undefined) => void): void;
};
};