import { MariaInterface } from "jm-castle-mariadb"; import { InsertResponse, SelectResponse, Table, UpdateResponse } from "jm-castle-types"; import { DbExportData, DbImportData, ErrorCode, MariaDatabaseSpec, PersistentRow, Row_Article, Row_Attribute, Row_Costunit, Row_Emission, Row_Hashtag, Row_ImageContent, Row_ImageReference, Row_Manufacturer, Row_Receipt, Row_Receiver, Row_Store, Row_StoreSection } from "jm-castle-warehouse-types"; import { Pool } from "mariadb"; import { AggregationFunction, MasterdataInsertOptions, MasterdataUpdateOptions, Persistence, StockdataInsertOptions, TableRowsChangeConsumer } from "../Types.mjs"; import { Filter_At_FromTo_Seconds, Filter_Hashtag, Filter_ImageExtension, Filter_ImageId, Filter_NameLike, Filter_Reference } from "./query/QueryUtils.mjs"; export interface RunPartsResponse { duration: number; errors?: string[]; } export declare const MasterdataTables: { [x: string]: Table; }; export declare const AllTables: Table[]; export interface MariaDbClientProps { persistenceId: string; spec: MariaDatabaseSpec; } export declare class MariaDbClient implements Persistence, MariaInterface { constructor(props: MariaDbClientProps); version: string; private setupPool; private databasePool; private tableStats; private tableRowsChangeConsumers; private spec; private handlePoolError; type: () => string; getDatabaseName: () => string; getDatabasePool: () => Pool; getSetupPool: () => Pool; getTableStats: (tableId: string) => { countOfRows?: number; lastChangeAt?: number; }; addTableRowsChangeConsumer: (consumer: TableRowsChangeConsumer) => void; removeTableRowsChangeConsumer: (consumer: TableRowsChangeConsumer) => void; changedTableStats: (tableId: string, updates: { countOfRows?: number; lastChangeAt?: number; }) => void; countOfRowsForTable: (tableId: string, countOfRows: number) => void; private exportSingleTableData; private importSingleTableStockdata; private importSingleTableMasterdata; exportTableData: () => Promise<{ tables: DbExportData["tables"]; } | { error: string; errorCode: ErrorCode; }>; importTableData: (tables: DbExportData["tables"]) => Promise<(DbImportData & { error?: never; errorCode?: never; }) | { error: string; errorCode: ErrorCode; tables?: never; }>; tables: { stats: { countOfRowsForTables: (...tables: Table[]) => Promise[]>; }; pagination: { selectPage: >>(table: Table, page: number, pageSize: number) => Promise>; }; masterdata: { selectEditedAtFromTo: (source: keyof typeof MasterdataTables, filter: Filter_At_FromTo_Seconds) => Promise>; }; imageReference: { insert: (values: Row_ImageReference & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_ImageReference & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; updateImageReferences: (reference: string, previous: string | null, current: string | null) => Promise; insertImageReferences: (reference: string, current: string | null) => Promise; select: (filter: Filter_ImageId | Filter_Reference) => Promise>; all: () => Promise>; }; imageContent: { insert: (values: Row_ImageContent & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_ImageContent & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_ImageId | Filter_ImageExtension) => Promise>; selectLikeImageId: (filter: Filter_ImageId) => Promise>; all: () => Promise>; }; attribute: { insert: (values: Row_Attribute & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Attribute & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (attributeId: string) => Promise>; all: () => Promise>; }; store: { insert: (values: Row_Store & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Store & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (storeId: string) => Promise>; all: () => Promise>; }; storeSection: { insert: (values: Row_StoreSection & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_StoreSection & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (sectionId: string) => Promise>; all: () => Promise>; }; article: { insert: (values: Row_Article & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Article & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike & Partial) => Promise>; selectByKey: (articleId: string) => Promise>; all: () => Promise>; }; hashtag: { insert: (values: Row_Hashtag & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Hashtag & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (articleId: string) => Promise>; all: () => Promise>; }; costunit: { insert: (values: Row_Costunit & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Costunit & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (articleId: string) => Promise>; all: () => Promise>; }; receiver: { insert: (values: Row_Receiver & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Receiver & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (articleId: string) => Promise>; all: () => Promise>; }; manufacturer: { insert: (values: Row_Manufacturer & PersistentRow, options?: MasterdataInsertOptions) => Promise>; update: (values: Row_Manufacturer & PersistentRow, options?: MasterdataUpdateOptions) => Promise>; select: (filter: Filter_NameLike) => Promise>; selectByKey: (articleId: string) => Promise>; all: () => Promise>; }; receipt: { insert: (values: Row_Receipt & PersistentRow, options?: StockdataInsertOptions) => Promise>; select: (filter: Filter_At_FromTo_Seconds) => Promise>; selectBySectionAndArticle: (sectionId: string, articleId: string) => Promise>; selectGroupBy: (filter: Filter_At_FromTo_Seconds, groupBy: Array, aggregate: Array<{ col: keyof Row_Receipt; fn: AggregationFunction; }>) => Promise>>; all: () => Promise>; }; emission: { insert: (values: Row_Emission & PersistentRow, options?: StockdataInsertOptions) => Promise>; select: (filter: Filter_At_FromTo_Seconds) => Promise>; selectGroupBy: (filter: Filter_At_FromTo_Seconds, groupBy: Array, aggregate: Array<{ col: keyof Row_Emission; fn: AggregationFunction; }>) => Promise>>; all: () => Promise>; }; }; disconnect: () => Promise; }