///
import { CheckedConfiguration, Configuration, Row_Article, Row_Emission, Row_Receipt, Row_Store, Row_StoreSection, SystemStatus, UserRole } from "jm-castle-warehouse-types";
import { ImageFileStore } from "../../image-store/ImageFileStore.mjs";
import { Persistence, TableRowsChangeConsumer } from "../../persistence/Types.mjs";
import { ArticleStock } from "../../stock/ArticleStock.mjs";
export interface ExportImportActiveConsumer {
onExportImportChange: (state: {
exportActive: boolean;
importActive: boolean;
}) => void;
}
export declare const setCurrentSystem: (system: CastleWarehouse) => void;
export declare const getCurrentSystem: () => CastleWarehouse;
export declare class CastleWarehouse {
constructor(configuration: Configuration);
private systemName;
private startedAt;
private configuration;
private configErrors;
private validConfig;
private isExportActive;
private isImportActive;
private isSetupActive;
private imageStore;
private articleStock;
private persistence;
private defaultPersistence;
private mailSenders;
private defaultMailSender;
private exportImportActiveConsumers;
private caCert;
private serverCert;
private serverKey;
addTableRowsChangeConsumer: (consumer: TableRowsChangeConsumer) => void;
removeTableRowsChangeConsumer: (consumer: TableRowsChangeConsumer) => void;
addExportImportActiveConsumer: (consumer: ExportImportActiveConsumer) => void;
removeExportImportActiveConsumer: (consumer: ExportImportActiveConsumer) => void;
api: {
insertArticle: (row: Row_Article) => Promise>;
updateArticle: (row: Row_Article) => Promise>;
insertStore: (row: Row_Store) => Promise>;
updateStore: (row: Row_Store) => Promise>;
insertStoreSection: (row: Row_StoreSection) => Promise>;
updateStoreSection: (row: Row_StoreSection) => Promise>;
insertReceipt: (row: Row_Receipt) => Promise>;
insertEmission: (row: Row_Emission) => Promise>;
};
clientPath: () => string;
start: () => Promise;
isImportInProgress: () => boolean;
isExportInProgress: () => boolean;
postImport: () => Promise;
preImport: () => Promise;
postExport: () => Promise;
preExport: () => Promise;
postSetup: () => Promise;
preSetup: () => Promise;
authenticateClient: (clientId: string, clientIp: string) => false | {
user: string;
};
authenticateUser: (username: string, password: string) => false | {
roles: UserRole[];
};
getUserRoles: (username: string) => undefined | UserRole[];
getImageStorePath: () => string;
getTempFilePath: () => string;
getSystemBackupStorePath: () => string;
getOwnApiUrl: () => string;
getOwnPort: () => number;
getCACertificate: () => Buffer | null | undefined;
getServerCertificate: () => Buffer;
getServerKey: () => Buffer;
private disconnectFromAllPersistences;
private disconnectFromAllMailSenders;
/**
* Disconnect all persistences and remove all
* Disconnect all mail senders and remove all
* Start again
*/
restart: () => Promise;
private checkSystemSpec;
private checkClientSpec;
private checkUserSpec;
private checkImageStoreSpec;
private checkSystemBackupStoreSpec;
private checkTempStoreSpec;
private checkPersistenceSpec;
private checkMailingSpec;
checkConfiguration: (configuration: Configuration) => {
validConfig: CheckedConfiguration;
errors: string[] | undefined;
};
private setupPersistence;
private setupImageStore;
private setupArticleStock;
private setupMailSenders;
getImageStore: () => ImageFileStore;
getArticleStock: () => ArticleStock;
getStatus: () => Promise;
getDefaultPersistence: () => Persistence | undefined;
}