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));
|
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) {
|
if(operator) {
|
||||||
const operation = new operator({type: req.params.func, values: req.body});
|
const operation = new operator({type: req.params.func, values: req.body});
|
||||||
const validationResults = operation.validate();
|
const validationResults = operation.validate();
|
||||||
|
@ -7,8 +7,8 @@ export const Operators = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Convert this to a map or similar
|
// TODO: Convert this to a map or similar
|
||||||
export function getOperatorByName(name: string): typeof Operator {
|
export function getOperatorByName(name: string): typeof Operator | undefined {
|
||||||
let foundClass: typeof Operator = null;
|
let foundClass: typeof Operator | undefined = undefined;
|
||||||
|
|
||||||
// Loop over each default export
|
// Loop over each default export
|
||||||
Object.entries(Operators).some(([className, exportedClass]) => {
|
Object.entries(Operators).some(([className, exportedClass]) => {
|
||||||
@ -27,5 +27,5 @@ export function getOperatorByName(name: string): typeof Operator {
|
|||||||
|
|
||||||
export function listOperatorNames(): string[] {
|
export function listOperatorNames(): string[] {
|
||||||
// TODO: Implement this
|
// TODO: Implement this
|
||||||
return
|
return [];
|
||||||
}
|
}
|
@ -18,17 +18,14 @@ export async function traverseOperations(operations: Action[], input: PdfFile[],
|
|||||||
return results;
|
return results;
|
||||||
|
|
||||||
async function nextOperation(actions: Action[] | undefined, input: PdfFile[], progressCallback: (state: Progress) => void): Promise<void> {
|
async function nextOperation(actions: Action[] | undefined, input: PdfFile[], progressCallback: (state: Progress) => void): Promise<void> {
|
||||||
console.log("Next Operation");
|
if(!actions || (Array.isArray(actions) && actions.length == 0)) { // isEmpty
|
||||||
if(actions === undefined || (Array.isArray(actions) && actions.length == 0)) { // isEmpty
|
if(input && Array.isArray(input)) {
|
||||||
console.log("Last Operation");
|
|
||||||
if(Array.isArray(input)) {
|
|
||||||
console.log("ArrayOut: ", input);
|
|
||||||
console.log("operation done: " + input[0].filename + (input.length > 1 ? "+" : ""));
|
console.log("operation done: " + input[0].filename + (input.length > 1 ? "+" : ""));
|
||||||
results = results.concat(input);
|
results = results.concat(input);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < actions.length; i++) {
|
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
|
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