Skip to content

V1.1.0#91

Open
lbrzezinski wants to merge 36 commits into
CIRFMF:mainfrom
ptr07:v1.1.0
Open

V1.1.0#91
lbrzezinski wants to merge 36 commits into
CIRFMF:mainfrom
ptr07:v1.1.0

Conversation

@lbrzezinski

Copy link
Copy Markdown

No description provided.

google-labs-jules Bot and others added 30 commits December 5, 2025 11:45
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.
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
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.
…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.
Fix for starting rest app in docker container
@niutech

niutech commented Apr 10, 2026

Copy link
Copy Markdown

Co to za PR? Może jakiś opis? Wersja 1.1.0 jest już w historii: 5b40799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants