Files
Stirling-PDF/shared-operations/src/index.ts

62 lines
2.2 KiB
TypeScript
Raw Normal View History

2023-11-10 21:08:07 +03:00
import {
sortPagesWithPreset, SortPagesWithPresetParamsType,
rearrangePages, RearrangePagesParamsType,
selectPages, SelectPagesParamsType,
removePages, RemovePagesParamsType,
removeBlankPages, RemoveBlankPagesParamsType
} from "./functions/subDocumentFunctions";
import { impose, ImposeParamsBaseType, ImposeParamsType } from "./functions/impose";
import { mergePDFs, MergeParamsType } from './functions/mergePDFs';
import { rotatePages, RotateParamsType } from './functions/rotatePages';
import { scaleContent, ScaleContentParamsType} from './functions/scaleContent';
import { scalePage, ScalePageParamsType } from './functions/scalePage';
import { splitOn, SplitOnParamsType } from './functions/splitOn';
import { splitPDF, SplitPdfParamsType } from './functions/splitPDF';
import { updateMetadata, UpdateMetadataParams } from "./functions/updateMetadata";
import { PdfFile } from "./wrappers/PdfFile";
import { Override } from '../declarations/TypeScriptUtils'
2023-11-10 21:08:07 +03:00
// Import injected libraries here!
2023-11-10 21:08:07 +03:00
const toExport = {
sortPagesWithPreset, rearrangePages, selectPages, removePages, removeBlankPages,
2023-11-10 21:08:07 +03:00
impose,
mergePDFs,
rotatePages,
scaleContent,
scalePage,
splitOn,
splitPDF,
updateMetadata,
}
export default toExport;
export type OperationsParametersBaseType = {
sortPagesWithPreset: SortPagesWithPresetParamsType;
rearrangePages: RearrangePagesParamsType;
selectPages: SelectPagesParamsType;
removePages: RemovePagesParamsType;
removeBlankPages: RemoveBlankPagesParamsType;
impose: ImposeParamsBaseType;
mergePDFs: MergeParamsType;
rotatePages: RotateParamsType;
scaleContent: ScaleContentParamsType;
scalePage: ScalePageParamsType;
splitOn: SplitOnParamsType;
splitPDF: SplitPdfParamsType;
updateMetadata: UpdateMetadataParams;
}
export type OperationsBaseType = typeof toExport;
// Overide fields in the type of toExport, with the given fields and types. This seems to magically work!
export type OperationsType = Override<OperationsBaseType, {
impose: (params: ImposeParamsType) => Promise<PdfFile>;
}>;
export type OperationsParametersType = Override<OperationsParametersBaseType, {
impose: ImposeParamsType;
}>;