rewrote impose to use new Operator class,
dependencies (pdfcpu) can be made environment-aware using tsconfig.json
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import express, { Request, Response } from 'express';
|
||||
|
||||
import workflow from './workflow-controller';
|
||||
import operations from './operations-controller';
|
||||
import conversions from './conversions-controller';
|
||||
// import operations from './operations-controller';
|
||||
// import conversions from './conversions-controller';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
@@ -11,8 +11,8 @@ router.get("/", (req: Request, res: Response) => {
|
||||
res.status(501).json({"Error": "Unfinished Endpoint. This sould probably send some api docs?"});
|
||||
});
|
||||
|
||||
router.use("/operations", operations);
|
||||
router.use("/conversions", conversions);
|
||||
// router.use("/operations", operations);
|
||||
// router.use("/conversions", conversions);
|
||||
router.use("/workflow", workflow);
|
||||
|
||||
export default router;
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
import Operations from '../../utils/pdf-operations';
|
||||
import { respondWithPdfFile, respondWithPdfFiles, response_mustHaveExactlyOneFile } from '../../utils/endpoint-utils';
|
||||
import { PdfFile, /*PdfFileSchema*/ } from '@stirling-pdf/shared-operations/src/wrappers/PdfFile'
|
||||
//import { ScalePageSchema } from '@stirling-pdf/shared-operations/src/functions/scalePage'
|
||||
import { OperatorType } from '@stirling-pdf/shared-operations/src';
|
||||
|
||||
import express, { Request, Response, RequestHandler } from 'express';
|
||||
const router = express.Router();
|
||||
@@ -14,7 +12,7 @@ import Joi from 'joi';
|
||||
function registerEndpoint(endpoint: string,
|
||||
nameToAppend: string,
|
||||
fileHandler: RequestHandler,
|
||||
operator: OperatorType
|
||||
operator: any
|
||||
): void {
|
||||
router.post(endpoint, fileHandler, async function(req: Request, res: Response) {
|
||||
const body = req.body;
|
||||
@@ -79,7 +77,7 @@ registerEndpoint("/remove-pages", "", upload.single("file"), Operations.removePa
|
||||
pageSelector: Joi.string().required(),
|
||||
}).required());
|
||||
*/
|
||||
registerEndpoint("/impose", "", upload.single("file"), Operations.Impose);
|
||||
// registerEndpoint("/impose", "", upload.single("file"), Operations.Impose);
|
||||
/*
|
||||
registerEndpoint("/scale-pages", "", upload.single("file"), Operations.scalePage, ScalePageSchema.required());
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import crypto from 'crypto';
|
||||
import multer from 'multer'
|
||||
const upload = multer();
|
||||
|
||||
import Operations from "../../utils/pdf-operations";
|
||||
import { traverseOperations } from "@stirling-pdf/shared-operations/src/workflow/traverseOperations";
|
||||
import { PdfFile, RepresentationType } from '@stirling-pdf/shared-operations/src/wrappers/PdfFile';
|
||||
import { respondWithPdfFiles } from '../../utils/endpoint-utils';
|
||||
@@ -33,7 +32,7 @@ router.post("/:workflowUuid?", [
|
||||
if(req.body.async === "false") {
|
||||
console.log("Don't do async");
|
||||
|
||||
const traverse = traverseOperations(workflow.operations, inputs, Operations);
|
||||
const traverse = traverseOperations(workflow.operations, inputs);
|
||||
|
||||
let pdfResults;
|
||||
let iteration;
|
||||
@@ -74,7 +73,7 @@ router.post("/:workflowUuid?", [
|
||||
}
|
||||
});
|
||||
|
||||
const traverse = traverseOperations(workflow.operations, inputs, Operations);
|
||||
const traverse = traverseOperations(workflow.operations, inputs);
|
||||
|
||||
let pdfResults;
|
||||
let iteration;
|
||||
|
||||
Reference in New Issue
Block a user