@energyweb/node-red-contrib-green-proof-worker
Version:
62 lines (61 loc) • 2.45 kB
TypeScript
import type { Kysely } from 'kysely';
import { z } from 'zod';
import type { RuntimeApi } from '../api';
import type { SqliteDatabase } from '../types';
declare const InputMessage: z.ZodUnion<readonly [z.ZodObject<{
topic: z.ZodLiteral<"finished-processing">;
payload: z.ZodObject<{
httpApiMessageId: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
topic: z.ZodLiteral<"force-reset">;
}, z.core.$strip>]>;
declare const Config: z.ZodObject<{
host: z.ZodString;
sqliteConfig: z.ZodOptional<z.ZodString>;
appId: z.ZodString;
}, z.core.$strip>;
export declare const SourceHttpApi: (api: RuntimeApi) => {
new (config: any): {
/** Used to orchestrate consumer retry */
isDestroying: boolean;
nextMessageWaitTime: number;
pendingProcessing: {
messageId: string;
resolve: VoidFunction;
reject: (err: Error) => void;
} | null;
config: Promise<z.infer<typeof Config>>;
database: Promise<Kysely<SqliteDatabase>>;
parsedConfig: z.infer<typeof Config>;
getMessageLoop(): Promise<void>;
setStatus(status: "waiting" | "pending" | "error"): void;
/**
* Input is responsible for resolving promise that http api is waiting for
*/
onInput(message: z.infer<typeof InputMessage>): void;
getMessage(): Promise<unknown | null>;
buildGetMessageUrl(): Promise<{
url: URL;
headers: Record<string, string>;
}>;
getLastAckedMessageId(): Promise<string | null>;
ackMessage(messageId: string): Promise<void>;
onDestroy(): void;
api: RuntimeApi;
nodeConfig: unknown;
messageZod: z.ZodUnion<readonly [z.ZodObject<{
topic: z.ZodLiteral<"finished-processing">;
payload: z.ZodObject<{
httpApiMessageId: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
topic: z.ZodLiteral<"force-reset">;
}, z.core.$strip>]>;
getBaseUrls(): Promise<z.core.output<typeof import("../node").BaseUrlsConfig>>;
getNodeEnvConfig(): import("../node").NodeEnvConfig;
sendBuilder(inputMessage: import("../types").NodeMessage<any>): import("../node").SendBuilder;
handleMaybePromise<T>(maybePromiseCb: () => (T | Promise<T>), done: (err?: Error) => void): void;
};
};
export {};