mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Normalise tool IDs and fix file history to render IDs properly (#4470)
# Description of Changes Normalise tool IDs and fix file history to render IDs properly
This commit is contained in:
@@ -14,7 +14,7 @@ export const buildAdjustPageScaleFormData = (parameters: AdjustPageScaleParamete
|
||||
export const adjustPageScaleOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildAdjustPageScaleFormData,
|
||||
operationType: 'adjustPageScale',
|
||||
operationType: 'scalePages',
|
||||
endpoint: '/api/v1/general/scale-pages',
|
||||
defaultParameters,
|
||||
} as const;
|
||||
|
||||
@@ -113,7 +113,7 @@ describe('useChangePermissionsOperation', () => {
|
||||
test.each([
|
||||
{ property: 'toolType' as const, expectedValue: ToolType.singleFile },
|
||||
{ property: 'endpoint' as const, expectedValue: '/api/v1/security/add-password' },
|
||||
{ property: 'operationType' as const, expectedValue: 'change-permissions' }
|
||||
{ property: 'operationType' as const, expectedValue: 'changePermissions' }
|
||||
])('should configure $property correctly', ({ property, expectedValue }) => {
|
||||
renderHook(() => useChangePermissionsOperation());
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export const buildChangePermissionsFormData = (parameters: ChangePermissionsPara
|
||||
export const changePermissionsOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildChangePermissionsFormData,
|
||||
operationType: 'change-permissions',
|
||||
operationType: 'changePermissions',
|
||||
endpoint: '/api/v1/security/add-password', // Change Permissions is a fake endpoint for the Add Password tool
|
||||
defaultParameters,
|
||||
} as const;
|
||||
|
||||
@@ -17,7 +17,7 @@ export const buildRemoveBlanksFormData = (parameters: RemoveBlanksParameters, fi
|
||||
export const removeBlanksOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildRemoveBlanksFormData,
|
||||
operationType: 'remove-blanks',
|
||||
operationType: 'removeBlanks',
|
||||
endpoint: '/api/v1/misc/remove-blanks',
|
||||
defaultParameters,
|
||||
} as const satisfies ToolOperationConfig<RemoveBlanksParameters>;
|
||||
|
||||
@@ -14,7 +14,7 @@ export const buildRemoveCertificateSignFormData = (_parameters: RemoveCertificat
|
||||
export const removeCertificateSignOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildRemoveCertificateSignFormData,
|
||||
operationType: 'remove-certificate-sign',
|
||||
operationType: 'removeCertSign',
|
||||
endpoint: '/api/v1/security/remove-cert-sign',
|
||||
defaultParameters,
|
||||
} as const;
|
||||
|
||||
@@ -15,7 +15,7 @@ export const buildRemovePagesFormData = (parameters: RemovePagesParameters, file
|
||||
export const removePagesOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildRemovePagesFormData,
|
||||
operationType: 'remove-pages',
|
||||
operationType: 'removePages',
|
||||
endpoint: '/api/v1/general/remove-pages',
|
||||
defaultParameters,
|
||||
} as const satisfies ToolOperationConfig<RemovePagesParameters>;
|
||||
|
||||
@@ -9,6 +9,8 @@ import { extractErrorMessage } from '../../../utils/toolErrorHandler';
|
||||
import { StirlingFile, extractFiles, FileId, StirlingFileStub, createStirlingFile, createNewStirlingFileStub } from '../../../types/fileContext';
|
||||
import { ResponseHandler } from '../../../utils/toolResponseProcessor';
|
||||
import { createChildStub, generateProcessedFileMetadata } from '../../../contexts/file/fileActions';
|
||||
import { ToolOperation } from '../../../types/file';
|
||||
import { ToolId } from '../../../types/toolId';
|
||||
|
||||
// Re-export for backwards compatibility
|
||||
export type { ProcessingProgress, ResponseHandler };
|
||||
@@ -29,7 +31,7 @@ export enum ToolType {
|
||||
*/
|
||||
interface BaseToolOperationConfig<TParams> {
|
||||
/** Operation identifier for tracking and logging */
|
||||
operationType: string;
|
||||
operationType: ToolId;
|
||||
|
||||
/**
|
||||
* Prefix added to processed filenames (e.g., 'compressed_', 'split_').
|
||||
@@ -274,8 +276,8 @@ export const useToolOperation = <TParams>(
|
||||
}
|
||||
|
||||
// Create new tool operation
|
||||
const newToolOperation = {
|
||||
toolName: config.operationType,
|
||||
const newToolOperation: ToolOperation = {
|
||||
toolId: config.operationType,
|
||||
timestamp: Date.now()
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export const buildSingleLargePageFormData = (_parameters: SingleLargePageParamet
|
||||
export const singleLargePageOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildSingleLargePageFormData,
|
||||
operationType: 'single-large-page',
|
||||
operationType: 'pdfToSinglePage',
|
||||
endpoint: '/api/v1/general/pdf-to-single-page',
|
||||
defaultParameters,
|
||||
} as const;
|
||||
|
||||
@@ -71,7 +71,7 @@ export const getSplitEndpoint = (parameters: SplitParameters): string => {
|
||||
export const splitOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildSplitFormData,
|
||||
operationType: 'splitPdf',
|
||||
operationType: 'split',
|
||||
endpoint: getSplitEndpoint,
|
||||
defaultParameters,
|
||||
} as const;
|
||||
|
||||
@@ -14,7 +14,7 @@ export const buildUnlockPdfFormsFormData = (_parameters: UnlockPdfFormsParameter
|
||||
export const unlockPdfFormsOperationConfig = {
|
||||
toolType: ToolType.singleFile,
|
||||
buildFormData: buildUnlockPdfFormsFormData,
|
||||
operationType: 'unlock-pdf-forms',
|
||||
operationType: 'unlockPDFForms',
|
||||
endpoint: '/api/v1/misc/unlock-pdf-forms',
|
||||
defaultParameters,
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user