mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-26 17:52:59 +02:00
Fix parameter type definitions and metadata validation
Updated parameter types in AutomationOperation and AutomationTool to allow undefined values. Fixed logic in useChangeMetadataParameters to use logical OR instead of nullish coalescing for metadata validation.
This commit is contained in:
parent
c3b604791a
commit
966d80b0fc
@ -89,6 +89,7 @@ const validateParameters = (params: ChangeMetadataParameters): boolean => {
|
||||
}
|
||||
|
||||
// At least one field should have content for the operation to be meaningful
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
const hasStandardMetadata = !!(
|
||||
params.title.trim()
|
||||
|| params.author.trim()
|
||||
@ -97,8 +98,8 @@ const validateParameters = (params: ChangeMetadataParameters): boolean => {
|
||||
|| params.creator.trim()
|
||||
|| params.producer.trim()
|
||||
|| params.creationDate
|
||||
?? params.modificationDate
|
||||
?? params.trapped !== TrappedStatus.UNKNOWN
|
||||
|| params.modificationDate
|
||||
|| params.trapped !== TrappedStatus.UNKNOWN
|
||||
);
|
||||
|
||||
const hasCustomMetadata = params.customMetadata.some(
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
export interface AutomationOperation {
|
||||
operation: string;
|
||||
parameters: Record<string, JsonValue>;
|
||||
parameters: Record<string, JsonValue | undefined>;
|
||||
}
|
||||
|
||||
export interface AutomationConfig {
|
||||
@ -22,7 +22,7 @@ export interface AutomationTool {
|
||||
operation: string;
|
||||
name: string;
|
||||
configured: boolean;
|
||||
parameters?: Record<string, JsonValue>;
|
||||
parameters?: Record<string, JsonValue | undefined>;
|
||||
}
|
||||
|
||||
export type AutomationStep = typeof import('../constants/automation').AUTOMATION_STEPS[keyof typeof import('../constants/automation').AUTOMATION_STEPS];
|
||||
@ -82,34 +82,4 @@ export type JsonValue =
|
||||
| JsonValue[]
|
||||
| { [key: string]: JsonValue };
|
||||
|
||||
export type JsonObject = Record<string, JsonValue>;
|
||||
|
||||
export interface AutomationOperation {
|
||||
operation: string;
|
||||
// Wurde von Record<string, string | number | boolean | null> auf JSON erweitert
|
||||
parameters: Record<string, JsonValue>;
|
||||
}
|
||||
|
||||
export interface AutomationConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
operations: AutomationOperation[];
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface AutomationStepData {
|
||||
step: AutomationStep;
|
||||
mode?: AutomationMode;
|
||||
automation?: AutomationConfig;
|
||||
}
|
||||
|
||||
export interface ExecutionStep {
|
||||
id: string;
|
||||
operation: string;
|
||||
name: string;
|
||||
status: 'pending' | 'running' | 'completed' | 'error';
|
||||
error?: string;
|
||||
}
|
||||
export type JsonObject = { [key: string]: JsonValue };
|
||||
|
Loading…
Reference in New Issue
Block a user