V1.1.0#91
Open
lbrzezinski wants to merge 36 commits into
Open
Conversation
This change introduces a REST API to the project, allowing users to generate PDF invoices and UPO documents from XML files via HTTP requests. The API is built with Express.js and includes two endpoints: - `/api/generate-invoice`: Accepts a multipart/form-data request with a JSON metadata part and an XML file part. - `/api/generate-upo`: Accepts a multipart/form-data request with a single XML file. The core PDF generation logic has been refactored to be compatible with both the browser and Node.js environments.
This change introduces a REST API to the project, allowing users to generate PDF invoices and UPO documents from XML files via HTTP requests. The API is built with Express.js and includes two endpoints: - `/api/generate-invoice`: Accepts a multipart/form-data request with a JSON metadata part and an XML file part. - `/api/generate-upo`: Accepts a multipart/form-data request with a single XML file. The core PDF generation logic has been refactored to be compatible with both the browser and Node.js environments. File uploads are handled using `multer`'s `DiskStorage` to prevent memory exhaustion, and temporary files are cleaned up after each request.
Adds `swagger-ui-express` and `swagger-jsdoc` to generate and serve OpenAPI documentation for the REST API. The interactive documentation is available at the `/api-docs` endpoint.
Add OpenAPI Documentation
This commit introduces a multi-stage Dockerfile to containerize the application for production. - The `builder` stage installs dependencies, builds the frontend assets, and compiles the TypeScript server. - The `runner` stage creates a lean image with only production dependencies and the compiled application. - An `entrypoint.sh` script is included to start the server.
Previously, if the metadata file uploaded to the `/api/generate-invoice` endpoint contained malformed JSON, the `JSON.parse` function would throw an error, resulting in a 500 Internal Server Error. This change wraps the `JSON.parse` call in a specific `try...catch` block. If an error is caught during parsing, the server now returns a 400 Bad Request, which is semantically correct as the client has provided invalid data. Additionally, a new test case has been added to ensure that the endpoint correctly returns a 400 status code when a malformed JSON file is provided. The server code has also been refactored to allow for easier testing of the Express app.
Fix JSON.parse Vulnerability in /api/generate-invoice
Add Production Dockerfile
This commit introduces a multi-stage Dockerfile to containerize the application for production. - A dedicated `tsconfig.server.json` is added to compile only the server-side code, preventing build conflicts with the frontend. - The `Dockerfile` uses a multi-stage build to create a lean final image. The `builder` stage installs dependencies, builds the frontend assets, and compiles the TypeScript server. The `runner` stage creates a minimal image with only production dependencies and the compiled application. - An `entrypoint.sh` script is included to start the server.
feat: Add Dockerfile and entrypoint for production
This commit introduces a multi-stage Dockerfile to containerize the application for production and resolves a critical TypeScript build error. - A dedicated `tsconfig.server.json` is added to compile only the server-side code, preventing build conflicts with the frontend. - The `tsconfig.base.json` is corrected by removing an invalid `include` property from `compilerOptions`, which was the root cause of the build failure. - The `Dockerfile` uses a multi-stage build to create a lean final image. The `builder` stage installs dependencies, builds the frontend assets, and compiles the TypeScript server using the dedicated server configuration. The `runner` stage creates a minimal image with only production dependencies and the compiled application. - An `entrypoint.sh` script is included to start the server.
feat: Add Dockerfile and entrypoint for production
This commit introduces a multi-stage Dockerfile to containerize the application for production and resolves critical build errors. - A dedicated `tsconfig.server.json` is added to compile only the server-side code, preventing build conflicts with the frontend. - The `tsconfig.base.json` is corrected by removing an invalid `include` property from `compilerOptions`, which was the root cause of the initial build failure. - The `Dockerfile` is updated to correctly copy the build artifacts from the `dist` directory. It uses a multi-stage build to create a lean final image. The `builder` stage installs dependencies, builds the frontend assets, and compiles the TypeScript server using the dedicated server configuration. The `runner` stage creates a minimal image with only production dependencies and the compiled application. - An `entrypoint.sh` script is included to start the server.
feat: Add Dockerfile and entrypoint for production
This commit introduces a multi-stage Dockerfile to containerize the application for production and resolves critical build and runtime errors. - A dedicated `tsconfig.server.json` is added to compile only the server-side code, preventing build conflicts with the frontend. - The `tsconfig.base.json` is corrected by removing an invalid `include` property from `compilerOptions`, which was the root cause of the initial build failure. - The `Dockerfile` is updated to correctly copy the build artifacts to a `dist` directory in the final image, resolving a `MODULE_NOT_FOUND` runtime error. - The `Dockerfile` uses a multi-stage build to create a lean final image. The `builder` stage installs dependencies, builds the frontend assets, and compiles the TypeScript server. The `runner` stage creates a minimal image with only production dependencies and the compiled application. - An `entrypoint.sh` script is included to start the server.
feat: Add Dockerfile and entrypoint for production
This commit introduces a multi-stage Dockerfile to containerize the application for production and resolves critical build and runtime errors.
- A dedicated `tsconfig.server.json` is added to compile only the server-side code, preventing build conflicts with the frontend.
- The `tsconfig.base.json` is corrected by removing an invalid `include` property from `compilerOptions`, which was the root cause of the initial build failure.
- A `package.json` with `{"type": "commonjs"}` is added to the `dist` directory during the build process. This resolves a `ReferenceError: exports is not defined` runtime error by ensuring the compiled CommonJS code is correctly interpreted in a project where the root `package.json` specifies `"type": "module"`.
- The `Dockerfile` is updated to correctly copy the build artifacts to a `dist` directory in the final image, resolving a `MODULE_NOT_FOUND` runtime error.
- The `Dockerfile` uses a multi-stage build to create a lean final image. The `builder` stage installs dependencies, builds the frontend assets, and compiles the TypeScript server. The `runner` stage creates a minimal image with only production dependencies and the compiled application.
- An `entrypoint.sh` script is included to start the server.
feat: Add Dockerfile and entrypoint for production
…I files. - Simplify /api/generate-invoice file handling by directly parsing metadata from the request body, improving efficiency. - Refactor /api/generate-invoice and /api/generate-upo endpoints to better handle errors and ensure clean-up of uploaded files. - Add graceful shutdown support to the server for SIGTERM and SIGINT signals. - Update Dockerfile to use exec form for proper signal handling.
…age instructions.
Feat/rest api fix
…e-upo` endpoints to use memory storage and remove disk dependency. - Add file type validation and update error handling for more robust responses. - Enhance server startup by allowing port configuration via environment variables. - Improve graceful shutdown process and update error middleware for better error reporting.
…invoice generation endpoint
…erformance and maintainability.
Fix for starting rest app in docker container
fix stawek vat
Aktualizacja z wersja 1.0.0
|
Co to za PR? Może jakiś opis? Wersja 1.1.0 jest już w historii: 5b40799 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.