feat(scanner): validate elevated live automation
This commit is contained in:
@@ -26,6 +26,7 @@ import type {
|
||||
ClickResult,
|
||||
ReviewSampleListResult,
|
||||
SaveScannerLearningRulesResult,
|
||||
GoodImportFileResult,
|
||||
} from "../../types/global";
|
||||
|
||||
const EMPTY_SNAPSHOT: AppSnapshot | null = null;
|
||||
@@ -67,6 +68,12 @@ const EMPTY_SAVE_RULES_RESULT: SaveScannerLearningRulesResult = {
|
||||
rules: {},
|
||||
total: 0,
|
||||
};
|
||||
const EMPTY_GOOD_IMPORT_FILE_RESULT: GoodImportFileResult = {
|
||||
ok: false,
|
||||
canceled: false,
|
||||
path: "",
|
||||
error: "Electron bridge unavailable.",
|
||||
};
|
||||
|
||||
async function createBridgeSafeCall<TResult>(
|
||||
callback: () => Promise<TResult> | TResult | null | undefined,
|
||||
@@ -205,6 +212,7 @@ export function createRendererRepositories(): RendererRepositories | null {
|
||||
|
||||
const exportRepo: ScanExportPort = {
|
||||
exportGood: (payload) => createBridgeSafeCall(() => bridge.exportGood(payload), EMPTY_SAVE_RESULT),
|
||||
importGoodFile: () => createBridgeSafeCall(() => bridge.importGoodFile(), EMPTY_GOOD_IMPORT_FILE_RESULT),
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user