UNPKG

@energyweb/node-red-contrib-green-proof-worker

Version:

## Peer dependencies

286 lines (285 loc) 9.56 kB
import type { Kysely } from 'kysely'; import * as z from 'zod'; import type { Api } from '../api'; import type { SqliteDatabase } from '../types'; declare const InputMessage: z.ZodUnion<[z.ZodObject<{ topic: z.ZodLiteral<"get_ledger_entries">; payload: z.ZodObject<{ ledgerQuery: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; }, "strip", z.ZodTypeAny, { rootUnitId: string; accountId: string; }, { rootUnitId: string; accountId: string; }>, "many">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ ledgerQuery: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; }, "strip", z.ZodTypeAny, { rootUnitId: string; accountId: string; }, { rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ ledgerQuery: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; }, "strip", z.ZodTypeAny, { rootUnitId: string; accountId: string; }, { rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">>; }, "strip", z.ZodTypeAny, { topic: "get_ledger_entries"; payload: { ledgerQuery: { rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }, { topic: "get_ledger_entries"; payload: { ledgerQuery: { rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }>, z.ZodObject<{ topic: z.ZodLiteral<"update_ledger">; payload: z.ZodObject<{ ledgerUpdate: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; volume: z.ZodNumber; }, "strip", z.ZodTypeAny, { volume: number; rootUnitId: string; accountId: string; }, { volume: number; rootUnitId: string; accountId: string; }>, "many">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ ledgerUpdate: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; volume: z.ZodNumber; }, "strip", z.ZodTypeAny, { volume: number; rootUnitId: string; accountId: string; }, { volume: number; rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ ledgerUpdate: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; volume: z.ZodNumber; }, "strip", z.ZodTypeAny, { volume: number; rootUnitId: string; accountId: string; }, { volume: number; rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">>; }, "strip", z.ZodTypeAny, { topic: "update_ledger"; payload: { ledgerUpdate: { volume: number; rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }, { topic: "update_ledger"; payload: { ledgerUpdate: { volume: number; rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }>]>; declare const Config: z.ZodObject<{ sqliteConfig: z.ZodString; }, "strip", z.ZodTypeAny, { sqliteConfig: string; }, { sqliteConfig: string; }>; export declare const LedgerSqlite: (api: Api) => { new (config: z.infer<typeof Config>): { database: Promise<Kysely<SqliteDatabase>>; onInput(message: z.infer<typeof InputMessage>): Promise<void>; api: Api; nodeConfig: unknown; messageZod: z.ZodUnion<[z.ZodObject<{ topic: z.ZodLiteral<"get_ledger_entries">; payload: z.ZodObject<{ ledgerQuery: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; }, "strip", z.ZodTypeAny, { rootUnitId: string; accountId: string; }, { rootUnitId: string; accountId: string; }>, "many">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ ledgerQuery: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; }, "strip", z.ZodTypeAny, { rootUnitId: string; accountId: string; }, { rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ ledgerQuery: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; }, "strip", z.ZodTypeAny, { rootUnitId: string; accountId: string; }, { rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">>; }, "strip", z.ZodTypeAny, { topic: "get_ledger_entries"; payload: { ledgerQuery: { rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }, { topic: "get_ledger_entries"; payload: { ledgerQuery: { rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }>, z.ZodObject<{ topic: z.ZodLiteral<"update_ledger">; payload: z.ZodObject<{ ledgerUpdate: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; volume: z.ZodNumber; }, "strip", z.ZodTypeAny, { volume: number; rootUnitId: string; accountId: string; }, { volume: number; rootUnitId: string; accountId: string; }>, "many">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ ledgerUpdate: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; volume: z.ZodNumber; }, "strip", z.ZodTypeAny, { volume: number; rootUnitId: string; accountId: string; }, { volume: number; rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ ledgerUpdate: z.ZodArray<z.ZodObject<{ accountId: z.ZodString; rootUnitId: z.ZodString; volume: z.ZodNumber; }, "strip", z.ZodTypeAny, { volume: number; rootUnitId: string; accountId: string; }, { volume: number; rootUnitId: string; accountId: string; }>, "many">; }, z.ZodTypeAny, "passthrough">>; }, "strip", z.ZodTypeAny, { topic: "update_ledger"; payload: { ledgerUpdate: { volume: number; rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }, { topic: "update_ledger"; payload: { ledgerUpdate: { volume: number; rootUnitId: string; accountId: string; }[]; } & { [k: string]: unknown; }; }>]>; 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; onDestroy?(): void | Promise<void>; handleMaybePromise<T>(maybePromiseCb: () => T | Promise<T>, done: (err?: Error | undefined) => void): void; }; }; export {};