mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-23 16:05:09 +00:00
Icons and clearer OperatorSchema
This commit is contained in:
parent
c2bcda925a
commit
227f46456b
shared-operations/src/functions
@ -1,27 +1,30 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "arrangePages" }),
|
||||
i18next.t("description", { ns: "arrangePages" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
arrangementConfig: Joi.string().valid(...[
|
||||
"REVERSE_ORDER",
|
||||
"DUPLEX_SORT",
|
||||
"BOOKLET_SORT",
|
||||
"SIDE_STITCH_BOOKLET_SORT",
|
||||
"ODD_EVEN_SPLIT",
|
||||
"REMOVE_FIRST",
|
||||
"REMOVE_LAST",
|
||||
"REMOVE_FIRST_AND_LAST"
|
||||
]).required()
|
||||
.label(i18next.t("values.arrangementConfig.friendlyName", { ns: "arrangePages" })).description(i18next.t("values.arrangementConfig.description", { ns: "arrangePages" }))
|
||||
.example("REVERSE_ORDER").example("DUPLEX_SORT").example("BOOKLET_SORT").required()
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
"list"
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "arrangePages" }),
|
||||
description: i18next.t("description", { ns: "arrangePages" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
arrangementConfig: Joi.string().valid(...[
|
||||
"REVERSE_ORDER",
|
||||
"DUPLEX_SORT",
|
||||
"BOOKLET_SORT",
|
||||
"SIDE_STITCH_BOOKLET_SORT",
|
||||
"ODD_EVEN_SPLIT",
|
||||
"REMOVE_FIRST",
|
||||
"REMOVE_LAST",
|
||||
"REMOVE_FIRST_AND_LAST"
|
||||
]).required()
|
||||
.label(i18next.t("values.arrangementConfig.friendlyName", { ns: "arrangePages" })).description(i18next.t("values.arrangementConfig.description", { ns: "arrangePages" }))
|
||||
.example("REVERSE_ORDER").example("DUPLEX_SORT").example("BOOKLET_SORT").required()
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "list",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
@ -6,14 +6,18 @@ import i18next from "i18next";
|
||||
|
||||
import CommaArrayJoiExt from "../wrappers/CommaArrayJoiExt";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "extractPages" }),
|
||||
i18next.t("description", { ns: "extractPages" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
pageIndexes: CommaArrayJoiExt.comma_array().items(Joi.number().integer()).required()
|
||||
.label(i18next.t("values.pageIndexes.friendlyName", { ns: "extractPages" })).description(i18next.t("values.pageIndexes.description", { ns: "extractPages" }))
|
||||
.example("1").example("1, 2, 3, 4").example("4, 2, 4, 3").required()
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "extractPages" }),
|
||||
description: i18next.t("description", { ns: "extractPages" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
pageIndexes: CommaArrayJoiExt.comma_array().items(Joi.number().integer()).required()
|
||||
.label(i18next.t("values.pageIndexes.friendlyName", { ns: "extractPages" })).description(i18next.t("values.pageIndexes.description", { ns: "extractPages" }))
|
||||
.example("1").example("1, 2, 3, 4").example("4, 2, 4, 3").required()
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "content_cut",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,14 +1,15 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "impose" }),
|
||||
i18next.t("description", { ns: "impose" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "impose" }),
|
||||
description: i18next.t("description", { ns: "impose" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
nup: Joi.number().integer().valid(2, 3, 4, 8, 9, 12, 16).required()
|
||||
.label(i18next.t("values.nup.friendlyName", { ns: "impose" })).description(i18next.t("values.nup.description", { ns: "impose" }))
|
||||
.example("3").example("4"),
|
||||
@ -55,5 +56,9 @@ export default new OperatorSchema(
|
||||
.label(i18next.t("values.format.friendlyName", { ns: "impose" })).description(i18next.t("values.format.description", { ns: "impose" }))
|
||||
.example("A4").example("A3L")
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "grid_view",
|
||||
availability: OperatorAvailability.Both
|
||||
}
|
||||
)
|
@ -31,18 +31,31 @@ export class Operator {
|
||||
}
|
||||
}
|
||||
|
||||
export enum OperatorAvailability {Serverside, Clientside, Both}
|
||||
|
||||
export class OperatorSchema {
|
||||
schema: Joi.ObjectSchema<any>;
|
||||
materialSymbolName: MaterialSymbolProps["icon"] | undefined;
|
||||
availability: OperatorAvailability;
|
||||
|
||||
constructor(label: string, description: string, inputSchema: Joi.Schema, valueSchema: Joi.Schema, outputSchema: Joi.Schema, materialSymbolName?: MaterialSymbolProps["icon"] | undefined) {
|
||||
constructor(params: {
|
||||
joi: {
|
||||
label: string;
|
||||
description: string;
|
||||
inputSchema: Joi.Schema;
|
||||
valueSchema: Joi.Schema;
|
||||
outputSchema: Joi.Schema;
|
||||
},
|
||||
materialSymbolName?: MaterialSymbolProps["icon"],
|
||||
availability: OperatorAvailability
|
||||
}) {
|
||||
this.schema = Joi.object({
|
||||
input: inputSchema,
|
||||
values: valueSchema.required(),
|
||||
output: outputSchema
|
||||
}).label(label).description(description);
|
||||
this.materialSymbolName = materialSymbolName;
|
||||
input: params.joi.inputSchema,
|
||||
values: params.joi.valueSchema.required(),
|
||||
output: params.joi.outputSchema
|
||||
}).label(params.joi.label).description(params.joi.description);
|
||||
this.materialSymbolName = params.materialSymbolName;
|
||||
this.availability = params.availability;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,18 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "merge" }),
|
||||
i18next.t("description", { ns: "merge" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "merge" }),
|
||||
description: i18next.t("description", { ns: "merge" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "cell_merge",
|
||||
availability: OperatorAvailability.Both
|
||||
}
|
||||
);
|
@ -1,17 +1,21 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "removeBlankPages" }),
|
||||
i18next.t("description", { ns: "removeBlankPages" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
whiteThreashold: Joi.number().min(0).max(255).required()
|
||||
.label(i18next.t("values.whiteThreashold.friendlyName", { ns: "removeBlankPages" })).description(i18next.t("values.whiteThreashold.description", { ns: "removeBlankPages" }))
|
||||
.example("10").example("0").example("255").required()
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "removeBlankPages" }),
|
||||
description: i18next.t("description", { ns: "removeBlankPages" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
whiteThreashold: Joi.number().min(0).max(255).required()
|
||||
.label(i18next.t("values.whiteThreashold.friendlyName", { ns: "removeBlankPages" })).description(i18next.t("values.whiteThreashold.description", { ns: "removeBlankPages" }))
|
||||
.example("10").example("0").example("255").required()
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "filter_alt",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
@ -6,14 +6,18 @@ import i18next from "i18next";
|
||||
|
||||
import CommaArrayJoiExt from "../wrappers/CommaArrayJoiExt";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "removePages" }),
|
||||
i18next.t("description", { ns: "removePages" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
pageIndexes: CommaArrayJoiExt.comma_array().items(Joi.number().integer()).required()
|
||||
.label(i18next.t("values.pageIndexes.friendlyName", { ns: "removePages" })).description(i18next.t("values.pageIndexes.description", { ns: "removePages" }))
|
||||
.example("1").example("1, 2, 3, 4").example("4, 2, 4, 3").required()
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "removePages" }),
|
||||
description: i18next.t("description", { ns: "removePages" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
pageIndexes: CommaArrayJoiExt.comma_array().items(Joi.number().integer()).required()
|
||||
.label(i18next.t("values.pageIndexes.friendlyName", { ns: "removePages" })).description(i18next.t("values.pageIndexes.description", { ns: "removePages" }))
|
||||
.example("1").example("1, 2, 3, 4").example("4, 2, 4, 3").required()
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "delete",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
@ -6,17 +6,21 @@ import i18next from "i18next";
|
||||
|
||||
import CommaArrayJoiExt from "../wrappers/CommaArrayJoiExt";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "rotatePages" }),
|
||||
i18next.t("description", { ns: "rotatePages" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
rotation: Joi.alternatives().try(
|
||||
Joi.number().integer().min(-360).max(360).required(),
|
||||
CommaArrayJoiExt.comma_array().items(Joi.number().integer().min(-360).max(360)).required()
|
||||
)
|
||||
.label(i18next.t("values.rotation.friendlyName", { ns: "rotatePages" })).description(i18next.t("values.rotation.description", { ns: "rotatePages" }))
|
||||
.example("90").example("-180").example("[90, 0, 270]"),
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "rotatePages" }),
|
||||
description: i18next.t("description", { ns: "rotatePages" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
rotation: Joi.alternatives().try(
|
||||
Joi.number().integer().min(-360).max(360).required(),
|
||||
CommaArrayJoiExt.comma_array().items(Joi.number().integer().min(-360).max(360)).required()
|
||||
)
|
||||
.label(i18next.t("values.rotation.friendlyName", { ns: "rotatePages" })).description(i18next.t("values.rotation.description", { ns: "rotatePages" }))
|
||||
.example("90").example("-180").example("[90, 0, 270]"),
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "rotate_right",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
@ -6,17 +6,21 @@ import i18next from "i18next";
|
||||
|
||||
import CommaArrayJoiExt from "../wrappers/CommaArrayJoiExt";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "scaleContent" }),
|
||||
i18next.t("description", { ns: "scaleContent" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
scaleFactor: Joi.alternatives().try(
|
||||
Joi.number().required(),
|
||||
CommaArrayJoiExt.comma_array().items(Joi.number()).required()
|
||||
)
|
||||
.label(i18next.t("values.scaleFactor.friendlyName", { ns: "scaleContent" })).description(i18next.t("values.scaleFactor.description", { ns: "scaleContent" }))
|
||||
.example("2").example("1.5").example("[1, 1.5, 0.9]"),
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "scaleContent" }),
|
||||
description: i18next.t("description", { ns: "scaleContent" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
scaleFactor: Joi.alternatives().try(
|
||||
Joi.number().required(),
|
||||
CommaArrayJoiExt.comma_array().items(Joi.number()).required()
|
||||
)
|
||||
.label(i18next.t("values.scaleFactor.friendlyName", { ns: "scaleContent" })).description(i18next.t("values.scaleFactor.description", { ns: "scaleContent" }))
|
||||
.example("2").example("1.5").example("[1, 1.5, 0.9]"),
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "center_focus_strong",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,20 +1,24 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "scalePage" }),
|
||||
i18next.t("description", { ns: "scalePage" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
height: Joi.number().min(0)
|
||||
.label(i18next.t("values.height.friendlyName", { ns: "scalePage" })).description(i18next.t("values.height.description", { ns: "scalePage" }))
|
||||
.example("842").example("595").example("1190"),
|
||||
width: Joi.number().min(0)
|
||||
.label(i18next.t("values.width.friendlyName", { ns: "scalePage" })).description(i18next.t("values.width.description", { ns: "scalePage" }))
|
||||
.example("595").example("420").example("842"),
|
||||
}).or("height", "width"),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "scalePage" }),
|
||||
description: i18next.t("description", { ns: "scalePage" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
height: Joi.number().min(0)
|
||||
.label(i18next.t("values.height.friendlyName", { ns: "scalePage" })).description(i18next.t("values.height.description", { ns: "scalePage" }))
|
||||
.example("842").example("595").example("1190"),
|
||||
width: Joi.number().min(0)
|
||||
.label(i18next.t("values.width.friendlyName", { ns: "scalePage" })).description(i18next.t("values.width.description", { ns: "scalePage" }))
|
||||
.example("595").example("420").example("842"),
|
||||
}).or("height", "width"),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "zoom_out_map",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,26 +1,30 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "splitPagesByPreset" }),
|
||||
i18next.t("description", { ns: "splitPagesByPreset" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.alternatives().try(
|
||||
Joi.object({
|
||||
type: Joi.string().valid("BAR_CODE").required()
|
||||
}),
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "splitPagesByPreset" }),
|
||||
description: i18next.t("description", { ns: "splitPagesByPreset" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.alternatives().try(
|
||||
Joi.object({
|
||||
type: Joi.string().valid("QR_CODE").required()
|
||||
}),
|
||||
Joi.object({
|
||||
type: Joi.string().valid("BLANK_PAGE").required(),
|
||||
whiteThreashold: Joi.number().min(0).max(255).required()
|
||||
}),
|
||||
)
|
||||
.label(i18next.t("values.splitSettings.friendlyName", { ns: "splitPagesByPreset" })).description(i18next.t("values.splitSettings.description", { ns: "splitPagesByPreset" })
|
||||
),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
type: Joi.string().valid("BAR_CODE").required()
|
||||
}),
|
||||
Joi.object({
|
||||
type: Joi.string().valid("QR_CODE").required()
|
||||
}),
|
||||
Joi.object({
|
||||
type: Joi.string().valid("BLANK_PAGE").required(),
|
||||
whiteThreashold: Joi.number().min(0).max(255).required()
|
||||
}),
|
||||
)
|
||||
.label(i18next.t("values.splitSettings.friendlyName", { ns: "splitPagesByPreset" })).description(i18next.t("values.splitSettings.description", { ns: "splitPagesByPreset" })
|
||||
),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "water",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
@ -6,14 +6,18 @@ import i18next from "i18next";
|
||||
|
||||
import CommaArrayJoiExt from "../wrappers/CommaArrayJoiExt";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "splitPdfByIndex" }),
|
||||
i18next.t("description", { ns: "splitPdfByIndex" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
pageIndexes: CommaArrayJoiExt.comma_array().items(Joi.number().integer()).required()
|
||||
.label(i18next.t("values.pageIndexes.friendlyName", { ns: "splitPdfByIndex" })).description(i18next.t("values.pageIndexes.description", { ns: "splitPdfByIndex" }))
|
||||
.example("1").example("1, 2, 3, 4").example("4, 2, 4, 3")
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "splitPdfByIndex" }),
|
||||
description: i18next.t("description", { ns: "splitPdfByIndex" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
pageIndexes: CommaArrayJoiExt.comma_array().items(Joi.number().integer()).required()
|
||||
.label(i18next.t("values.pageIndexes.friendlyName", { ns: "splitPdfByIndex" })).description(i18next.t("values.pageIndexes.description", { ns: "splitPdfByIndex" }))
|
||||
.example("1").example("1, 2, 3, 4").example("4, 2, 4, 3")
|
||||
}),
|
||||
outputSchema: JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "splitscreen",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
@ -1,45 +1,49 @@
|
||||
import { OperatorSchema } from ".";
|
||||
import { OperatorAvailability, OperatorSchema } from ".";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
||||
export default new OperatorSchema(
|
||||
i18next.t("friendlyName", { ns: "updateMetadata" }),
|
||||
i18next.t("description", { ns: "updateMetadata" }),
|
||||
JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
Joi.object({
|
||||
deleteAll: Joi.boolean().invalid(false)
|
||||
.label(i18next.t("values.deleteAll.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.deleteAll.description", { ns: "updateMetadata" }))
|
||||
.example("true").example("false"),
|
||||
author: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.author.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.author.description", { ns: "updateMetadata" }))
|
||||
.example("John Doe").example("Anthony Stirling"), // The author of the document
|
||||
creationDate: Joi.date().allow("").allow(null)
|
||||
.label(i18next.t("values.creationDate.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.creationDate.description", { ns: "updateMetadata" }))
|
||||
.example("YYYY-MM-DD").example("2023-01-27"), // The creation date of the document (format: yyyy/MM/dd HH:mm:ss)
|
||||
creator: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.creator.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.creator.description", { ns: "updateMetadata" }))
|
||||
.example("John Doe").example("Anthony Stirling"), // The creator of the document
|
||||
keywords: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.keywords.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.keywords.description", { ns: "updateMetadata" }))
|
||||
.example("General").example("finances, leisure").example("finances leisure"), // The keywords for the document
|
||||
modificationDate: Joi.date().allow("").allow(null)
|
||||
.label(i18next.t("values.modificationDate.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.modificationDate.description", { ns: "updateMetadata" }))
|
||||
.example("YYYY-MM-DD").example("2023-01-27"), // The modification date of the document (format: yyyy/MM/dd HH:mm:ss)
|
||||
producer: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.producer.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.producer.description", { ns: "updateMetadata" }))
|
||||
.example("John Doe").example("Anthony Stirling"), // The producer of the document
|
||||
subject: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.subject.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.subject.description", { ns: "updateMetadata" }))
|
||||
.example("Subject").example("This is an example Subject."), // The subject of the document
|
||||
title: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.title.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.title.description", { ns: "updateMetadata" }))
|
||||
.example("Title").example("This is an example title."), // The title of the document
|
||||
|
||||
// TODO: trapped?: string, // The trapped status of the document
|
||||
|
||||
// TODO: allRequestParams?: {[key: string]: [key: string]}, // Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard
|
||||
}),
|
||||
JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"))
|
||||
);
|
||||
export default new OperatorSchema({
|
||||
joi: {
|
||||
label: i18next.t("friendlyName", { ns: "updateMetadata" }),
|
||||
description: i18next.t("description", { ns: "updateMetadata" }),
|
||||
inputSchema: JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description")),
|
||||
valueSchema: Joi.object({
|
||||
deleteAll: Joi.boolean().invalid(false)
|
||||
.label(i18next.t("values.deleteAll.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.deleteAll.description", { ns: "updateMetadata" }))
|
||||
.example("true").example("false"),
|
||||
author: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.author.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.author.description", { ns: "updateMetadata" }))
|
||||
.example("John Doe").example("Anthony Stirling"), // The author of the document
|
||||
creationDate: Joi.date().allow("").allow(null)
|
||||
.label(i18next.t("values.creationDate.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.creationDate.description", { ns: "updateMetadata" }))
|
||||
.example("YYYY-MM-DD").example("2023-01-27"), // The creation date of the document (format: yyyy/MM/dd HH:mm:ss)
|
||||
creator: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.creator.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.creator.description", { ns: "updateMetadata" }))
|
||||
.example("John Doe").example("Anthony Stirling"), // The creator of the document
|
||||
keywords: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.keywords.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.keywords.description", { ns: "updateMetadata" }))
|
||||
.example("General").example("finances, leisure").example("finances leisure"), // The keywords for the document
|
||||
modificationDate: Joi.date().allow("").allow(null)
|
||||
.label(i18next.t("values.modificationDate.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.modificationDate.description", { ns: "updateMetadata" }))
|
||||
.example("YYYY-MM-DD").example("2023-01-27"), // The modification date of the document (format: yyyy/MM/dd HH:mm:ss)
|
||||
producer: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.producer.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.producer.description", { ns: "updateMetadata" }))
|
||||
.example("John Doe").example("Anthony Stirling"), // The producer of the document
|
||||
subject: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.subject.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.subject.description", { ns: "updateMetadata" }))
|
||||
.example("Subject").example("This is an example Subject."), // The subject of the document
|
||||
title: Joi.string().optional().allow('')
|
||||
.label(i18next.t("values.title.friendlyName", { ns: "updateMetadata" })).description(i18next.t("values.title.description", { ns: "updateMetadata" }))
|
||||
.example("Title").example("This is an example title."), // The title of the document
|
||||
|
||||
// TODO: trapped?: string, // The trapped status of the document
|
||||
|
||||
// TODO: allRequestParams?: {[key: string]: [key: string]}, // Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard
|
||||
}),
|
||||
outputSchema:JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description")),
|
||||
},
|
||||
materialSymbolName: "description",
|
||||
availability: OperatorAvailability.Both
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user