import * as z from 'zod'; import type { Api } from './api'; import type { NodeMessage } from './types'; export type SendBuilder = { setTopic(topic: string): SendBuilder; getMessage(): Record; /** * Payload is not deeply-merged with the input message payload, * but shallow-merged. */ addPayload(payload: Record): SendBuilder; sendToOutput(index: number): void; }; export declare const NodeEnvConfig: z.ZodObject<{ EWX_SOLUTION_ID: z.ZodOptional; EWX_SOLUTION_GROUP_ID: z.ZodOptional; EWX_WORKLOGIC_ID: z.ZodOptional; EWX_SQLITE_PATH: z.ZodOptional; EWX_WORKER_ADDRESS: z.ZodOptional; BASE_URL: z.ZodOptional; }, z.core.$strip>; export declare const BaseUrlsConfig: z.ZodObject<{ kafka_url: z.ZodOptional]>>; kafka_proxy_url: z.ZodOptional; base_indexer_url: z.ZodOptional; rpc_url: z.ZodOptional; }, z.core.$strip>; export type NodeEnvConfig = z.infer; export declare abstract class Node | z.ZodUnion> { nodeConfig: unknown; messageZod: T; api: Api; constructor(api: Api, nodeConfig: unknown, // this is NodeDef from node-red, but let's keep it unknown for convenience (we add custom types there) messageZod: T, { validateMessage }?: { validateMessage?: boolean; }); /** * Returns base_urls from a special endpoint maintained by EWF that contains configuration */ getBaseUrls(): Promise>; /** * Returns parsed `.__envConfig` from node's config. * node's config, is basically one entry in flow.json * Marketplace will be injecting that property to each node before node-red start * Note, that if `.__envConfig` is injected that way, even the slightest node change (through node-red GUI) removes that property * because it is unknown to node-red. */ getNodeEnvConfig(): NodeEnvConfig; /** * SendBuilder hides complexity of creating proper messages, and selecting output. * It is supposed to be used by all nodes to send messages to outputs * to ensure correct behavior. * * It uses message received on node input (passed manually), and then the payload should be only * >added< (not replaced!) to the input message. Optionally topic can be set. * * Note that if topic is not set explicitly, it will be removed (because topic is used * to describe what the node receiving it should do with the message, so it's not meant to be passed around * like message payload). */ sendBuilder(inputMessage: NodeMessage): SendBuilder; abstract onInput(message: z.infer): void | Promise; onDestroy?(): void | Promise; handleMaybePromise(maybePromiseCb: () => (T | Promise), done: (err?: Error) => void): void; }