mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-22 23:45:02 +00:00
Fixed Typping for tsc
This commit is contained in:
parent
3fb8c6c6eb
commit
b9b7f0d5ea
@ -29,7 +29,7 @@ function handleEndpoint(req: Request, res: Response) {
|
||||
pdfFiles = PdfFile.fromMulterFiles(Object.values(req.files).flatMap(va => va));
|
||||
}
|
||||
|
||||
const operator: typeof Operator = getOperatorByName(req.params.func);
|
||||
const operator = getOperatorByName(req.params.func);
|
||||
if(operator) {
|
||||
const operation = new operator({type: req.params.func, values: req.body});
|
||||
const validationResults = operation.validate();
|
||||
|
@ -7,8 +7,8 @@ export const Operators = {
|
||||
}
|
||||
|
||||
// TODO: Convert this to a map or similar
|
||||
export function getOperatorByName(name: string): typeof Operator {
|
||||
let foundClass: typeof Operator = null;
|
||||
export function getOperatorByName(name: string): typeof Operator | undefined {
|
||||
let foundClass: typeof Operator | undefined = undefined;
|
||||
|
||||
// Loop over each default export
|
||||
Object.entries(Operators).some(([className, exportedClass]) => {
|
||||
@ -27,5 +27,5 @@ export function getOperatorByName(name: string): typeof Operator {
|
||||
|
||||
export function listOperatorNames(): string[] {
|
||||
// TODO: Implement this
|
||||
return
|
||||
return [];
|
||||
}
|
@ -18,17 +18,14 @@ export async function traverseOperations(operations: Action[], input: PdfFile[],
|
||||
return results;
|
||||
|
||||
async function nextOperation(actions: Action[] | undefined, input: PdfFile[], progressCallback: (state: Progress) => void): Promise<void> {
|
||||
console.log("Next Operation");
|
||||
if(actions === undefined || (Array.isArray(actions) && actions.length == 0)) { // isEmpty
|
||||
console.log("Last Operation");
|
||||
if(Array.isArray(input)) {
|
||||
console.log("ArrayOut: ", input);
|
||||
if(!actions || (Array.isArray(actions) && actions.length == 0)) { // isEmpty
|
||||
if(input && Array.isArray(input)) {
|
||||
console.log("operation done: " + input[0].filename + (input.length > 1 ? "+" : ""));
|
||||
results = results.concat(input);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
await computeOperation(actions[i], Object.assign([], input), progressCallback); // structuredClone-like for ts TODO: test if this really works
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user