mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-22 23:45:02 +00:00
Merge pull request #778 from Stirling-Tools/full-browser-joi-test
fix: use fork of joi with full features on browser
This commit is contained in:
commit
244fb36195
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,4 +4,5 @@ node_modules/
|
||||
dist/
|
||||
android/
|
||||
ios/
|
||||
releases/
|
||||
releases/
|
||||
.vscode/
|
||||
|
@ -6,22 +6,22 @@ import i18next from "i18next";
|
||||
|
||||
function Dynamic() {
|
||||
const operators = ["impose"]; // TODO: Make this dynamic
|
||||
|
||||
|
||||
function selectionChanged(s: BaseSyntheticEvent) {
|
||||
const selectedValue = s.target.value;
|
||||
if(selectedValue == "none") return;
|
||||
|
||||
i18next.loadNamespaces("impose", (err, t) => {
|
||||
i18next.loadNamespaces("impose", (err, t) => {
|
||||
if (err) throw err;
|
||||
|
||||
const LoadingModule = import(`@stirling-pdf/shared-operations/src/functions/${selectedValue}`) as Promise<{ [key: string]: typeof Operator }>;
|
||||
LoadingModule.then((Module) => {
|
||||
const Operator = Module[capitalizeFirstLetter(selectedValue)];
|
||||
const description = Operator.schema.describe(); // TODO: The browser build of joi does not include describe.
|
||||
|
||||
const description = Operator.schema.describe();
|
||||
|
||||
console.log(description);
|
||||
// TODO: use description to generate fields
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -35,19 +35,19 @@ function Dynamic() {
|
||||
|
||||
<input type="file" id="pdfFile" accept=".pdf" multiple />
|
||||
<br />
|
||||
|
||||
|
||||
<br />
|
||||
<textarea name="workflow" id="workflow"></textarea>
|
||||
<br />
|
||||
<select id="pdfOptions" onChange={selectionChanged}>
|
||||
<option value="none">none</option>
|
||||
{ operators.map((operator, i) => {
|
||||
return (<option value={operator}>{operator}</option>)
|
||||
{ operators.map((operator, i) => {
|
||||
return (<option value={operator}>{operator}</option>)
|
||||
}) }
|
||||
</select>
|
||||
<button id="loadButton">Load</button>
|
||||
<br />
|
||||
|
||||
|
||||
<br />
|
||||
<button id="doneButton">Done</button>
|
||||
|
||||
@ -59,4 +59,4 @@ function Dynamic() {
|
||||
}
|
||||
|
||||
|
||||
export default Dynamic;
|
||||
export default Dynamic;
|
||||
|
54
package-lock.json
generated
54
package-lock.json
generated
@ -1924,6 +1924,32 @@
|
||||
"resolved": "shared-operations",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@stirling-tools/joi": {
|
||||
"version": "17.12.0",
|
||||
"resolved": "git+ssh://git@github.com/Stirling-Tools/joi.git#fc6eddf22e5535155080934ab21dba45c610f199",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@hapi/address": "^5.1.1",
|
||||
"@hapi/formula": "^3.0.2",
|
||||
"@hapi/hoek": "^11.0.2",
|
||||
"@hapi/pinpoint": "^2.0.1",
|
||||
"@hapi/tlds": "^1.0.2",
|
||||
"@hapi/topo": "^6.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@stirling-tools/joi/node_modules/@hapi/hoek": {
|
||||
"version": "11.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-11.0.4.tgz",
|
||||
"integrity": "sha512-PnsP5d4q7289pS2T2EgGz147BFJ2Jpb4yrEdkpz2IhgEUzos1S7HTl7ezWh1yfYzYlj89KzLdCRkqsP6SIryeQ=="
|
||||
},
|
||||
"node_modules/@stirling-tools/joi/node_modules/@hapi/topo": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-6.0.2.tgz",
|
||||
"integrity": "sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg==",
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^11.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core": {
|
||||
"version": "1.3.102",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.102.tgz",
|
||||
@ -2852,32 +2878,6 @@
|
||||
"vite": "^4.2.0 || ^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vizzly/joi": {
|
||||
"version": "17.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@vizzly/joi/-/joi-17.11.0.tgz",
|
||||
"integrity": "sha512-VpLziKclrc0ul9euaxhD0C+31CXwkmrKBxg7RKNEKnZi/iy4mQPERkxBHCaYksjoZKQEOAnB/IXY7PPbF/OiUw==",
|
||||
"dependencies": {
|
||||
"@hapi/address": "^5.1.1",
|
||||
"@hapi/formula": "^3.0.2",
|
||||
"@hapi/hoek": "^11.0.2",
|
||||
"@hapi/pinpoint": "^2.0.1",
|
||||
"@hapi/tlds": "^1.0.2",
|
||||
"@hapi/topo": "^6.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@vizzly/joi/node_modules/@hapi/hoek": {
|
||||
"version": "11.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-11.0.4.tgz",
|
||||
"integrity": "sha512-PnsP5d4q7289pS2T2EgGz147BFJ2Jpb4yrEdkpz2IhgEUzos1S7HTl7ezWh1yfYzYlj89KzLdCRkqsP6SIryeQ=="
|
||||
},
|
||||
"node_modules/@vizzly/joi/node_modules/@hapi/topo": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-6.0.2.tgz",
|
||||
"integrity": "sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg==",
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^11.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@wasmer/wasmfs": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@wasmer/wasmfs/-/wasmfs-0.12.0.tgz",
|
||||
@ -9380,7 +9380,7 @@
|
||||
"version": "0.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@vizzly/joi": "^17.11.0",
|
||||
"@stirling-tools/joi": "github:Stirling-Tools/joi",
|
||||
"i18next-resources-to-backend": "^1.2.0",
|
||||
"image-js": "^0.35.5",
|
||||
"next-i18next": "^15.1.1",
|
||||
|
@ -8,7 +8,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"dev-all": "concurrently --names \"node,tauri\" -c \"red.bold,cyan.bold\" --kill-others \"npm run -w server-node dev\" \"npm run -w client-tauri dev\"",
|
||||
"update-all-dependencies": "npm i --workspace=server-node --workspace=client-tauri --workspace=shared-operation",
|
||||
"update-all-dependencies": "npm i --workspace=stirling-pdf --workspace=server-node --workspace=client-tauri --workspace=shared-operation",
|
||||
"update-backend-dependencies": "npm i --workspace=server-node --workspace=shared-operation",
|
||||
"update-frontend-dependencies": "npm i --workspace=client-tauri --workspace=shared-operation"
|
||||
},
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { init } from "@stirling-pdf/shared-operations/src/i18next.config";
|
||||
init("./public/locales/");
|
||||
import "@stirling-pdf/shared-operations/src/i18next.config";
|
||||
|
||||
import express from "express";
|
||||
const app = express();
|
||||
|
@ -9,7 +9,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@vizzly/joi": "^17.11.0",
|
||||
"@stirling-tools/joi": "github:Stirling-Tools/joi",
|
||||
"i18next-resources-to-backend": "^1.2.0",
|
||||
"image-js": "^0.35.5",
|
||||
"next-i18next": "^15.1.1",
|
||||
|
@ -4,7 +4,7 @@ import { Operator, Progress, oneToOne } from ".";
|
||||
|
||||
import * as pdfcpuWrapper from "#pdfcpu"; // This is updated by tsconfig.json/paths for the context (browser, node, etc.) this module is used in.
|
||||
|
||||
import Joi from "joi";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
import i18next from "i18next";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Action } from "../../declarations/Action";
|
||||
import Joi from "joi";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
|
||||
export interface ValidationResult {
|
||||
valid: boolean,
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
import Joi from "joi";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { PDFPage } from "pdf-lib";
|
||||
import { PdfFile, RepresentationType, JoiPDFFileSchema } from "../wrappers/PdfFileJoi";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as PDFJS from "pdfjs-dist";
|
||||
import type { PDFDocumentProxy as PDFJSDocument } from "pdfjs-dist/types/src/display/api";
|
||||
import { PDFDocument as PDFLibDocument } from "pdf-lib";
|
||||
import Joi from "joi";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
|
||||
export enum RepresentationType {
|
||||
Uint8Array,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Joi from "joi";
|
||||
import Joi from "@stirling-tools/joi";
|
||||
import { PdfFile } from "./PdfFile";
|
||||
|
||||
export const JoiPDFFileSchema = Joi.custom((value: Express.Multer.File[] /* <- also handles single files */ | PdfFile[] | PdfFile, helpers) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user