medusajs-documents-plugin 1.1.29 → 1.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [1.1.31] - 2026-11-01
11
+
12
+ ### HTTP HEAD Request Handling, Accept-Ranges Byte Streaming & Order Fallback
13
+ - **HEAD Method Route Handlers & Unauthenticated Allowlist**: Exported `export const HEAD = GET;` across all document streaming and template preview routes (`/admin/documents/:id/document`, `/admin/documents/templates/preview`, `/api/admin/documents/:id/document`, `/documents/:id/document`, `/documents/templates/preview`) and added `HEAD` and `OPTIONS` to `src/api/middlewares.ts`. This resolves HTTP 401 Unauthorized errors caused when browsers, PDF viewers, or proxies issue HTTP HEAD requests to verify content type before fetching the PDF body.
14
+ - **HTTP Range & Accept-Ranges Streaming**: Added `Accept-Ranges: bytes` and HTTP 206 Partial Content byte-range slicing to stream handlers, supporting native PDF viewers and media pre-loaders requesting partial byte ranges.
15
+ - **Order Lookup Fallback in Admin Stream Route**: Extended `/admin/documents/:id/document` route lookup to query `order_id` in both database query layers.
16
+ - **Admin Document Navigation Alignment**: Restored `src/admin/routes/documents/page.tsx` view and preview handlers to use `/admin/documents/...` endpoints directly.
17
+ - **Zoho PDF Magic Bytes Verification**: Enforced `%PDF` header validation on buffers received from Zoho Books before invoking PDF post-processing.
18
+
19
+ ## [1.1.30] - 2026-11-01
20
+
21
+ ### Unauthenticated PDF Document Streaming & Robust Fallback Handling
22
+ - **Unauthenticated PDF Streaming**: Added `export const AUTHENTICATE = false;` to `/admin/documents/:id/document` and template preview routes, and registered matching allowlist middlewares in `src/api/middlewares.ts`. This prevents 401 Unauthorized errors when viewing documents via `window.open` or direct browser links without Bearer authorization headers.
23
+ - **Admin UI Streaming URLs**: Updated `src/admin/routes/documents/page.tsx` to point `window.open` targets to the dedicated public document streaming route `/documents/:id/document` and `/documents/templates/preview`.
24
+ - **Defensive PDFKit Fallback**: Hardened `PDFKitGenerator.generate` and all underlying template renderers (`zoho_exact`, `modern`, `classic`, `minimal`, `job_card`, `service_report`) to gracefully handle zero items (`[]`), missing items (`undefined`), and incomplete item properties (missing title, unit_price, quantity) without throwing unhandled exceptions.
25
+ - **Resilient Currency Formatting**: Enhanced `PDFKitGenerator.formatCurrency` to safely guard against `undefined`, `null`, and `NaN` values, preventing formatting runtime errors.
26
+ - **Service Document Retrieval & Knex String Parsing**: Made `DocumentModuleService.getPdfForRecord` resilient to stringified JSON metadata and template failures with automatic fallback to the modern template.
27
+ - **Repair Module Lookup Fallback**: Extended `/admin/documents/:id/document` to resolve document records via repair ticket tokens or ticket IDs if the primary ID lookup does not immediately match.
28
+
10
29
  ## [1.1.27] - 2026-11-01
11
30
 
12
31
  ### Repair Sync, 3-Column Template Gallery & Preset Previews
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medusajs-documents-plugin",
3
- "version": "1.1.29",
3
+ "version": "1.1.31",
4
4
  "description": "Comprehensive document generation and management module for Medusa v2 with Zoho Books integration, PDFKit fallback, QR codes, shortlinks, multi-channel notifications and unified admin hub.",
5
5
  "author": "Urban Device Care <info@urbandevicecare.co.uk>",
6
6
  "license": "MIT",