From ba8175204c2855849338e4dcc73f6d7c66be666e Mon Sep 17 00:00:00 2001 From: oom Date: Fri, 28 Jun 2024 10:39:52 +0700 Subject: [PATCH] fix Payload Too Large for convert file api --- app.ts | 2 +- compose.yaml | 7 +- libs/convert-libs.ts | 22 ++-- libs/create-swagger-spec.ts | 8 +- libs/docx-templates-lib.ts | 4 +- libs/swagger-specs.json | 25 ++-- libs/xlsx-template-lib.ts | 2 +- package-lock.json | 228 +++++++++++++++++++----------------- package.json | 28 ++--- 9 files changed, 169 insertions(+), 157 deletions(-) diff --git a/app.ts b/app.ts index 5e844b8..b552562 100644 --- a/app.ts +++ b/app.ts @@ -15,7 +15,7 @@ const app: Express = express() const port: number = Number(process.env.PORT) || 80; app.use(cors()); app.use(express.json({ limit: "200mb" })); //‘application/json’ -app.use(express.raw()); //‘application/octet-stream’ +app.use(express.raw({ limit: "200mb" })); //‘application/octet-stream’ app.use(express.urlencoded({ extended: true, limit: "200mb" })); app.use("/swagger", swaggerUi.serve, swaggerUi.setup(swaggerspecs,{ explorer: true })); app.get('/', (req: Request, res: Response) => { diff --git a/compose.yaml b/compose.yaml index 3a2f0c8..bf2e997 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,10 +1,9 @@ -version: "3.2" services: report-server: image: docker.frappet.com/demo/report-server:latest restart: unless-stopped - mem_limit: 500m + # mem_limit: 500m ports: - - 3000:80 + - 3001:80 volumes: - - ./templates:/app/templates \ No newline at end of file + - ./templates:/app/templates diff --git a/libs/convert-libs.ts b/libs/convert-libs.ts index fa2e5be..6145c0e 100644 --- a/libs/convert-libs.ts +++ b/libs/convert-libs.ts @@ -7,19 +7,19 @@ import { LibreOfficeFileConverter } from 'libreoffice-file-converter'; * @swagger * tags: * name: office-convert - * description: ใช้แปลงไฟล์จากเอกสารที่ libreoffice แปลงได้ x + * description: ใช้แปลงไฟล์จากเอกสารที่ libreoffice แปลงได้ เช่น docx เป็น pdf */ /** javascript-obfuscator:disable * @swagger * /api/v1/report-template/convert: * post: - * summary: Create document from template + * summary: แปลงฟอร์แม็ตเอกสารเช่นจาก docx เป็น pdf ให้ตั้งค่า Media type เป็นชนิดไฟล์ที่ต้องการ * tags: [office-convert] * parameters: - * - name: report_name + * - name: report-name * in: header - * description: นามสกุลไฟล์ที่อัปโหลดเข้ามา(ตอนนี้ไม่จำเป็นต้องใช้เพราะ soffice ตรวจสอบเอง) + * description: ชื่อไฟล์ที่ต้องการหลังแปลง * required: true * schema: * type: string @@ -59,25 +59,27 @@ import { LibreOfficeFileConverter } from 'libreoffice-file-converter'; * schema: * type: string * format: binary + * 400: + * description: Invalid format * 500: * description: Server error * */ -convertTemplateRoute.post("/convert", async function (req, res) { +convertTemplateRoute.post("/", async function (req, res) { try { if (!req.headers['content-type'] || !req.headers['accept'] || - !req.headers['report_name'] || + !req.headers['report-name'] || req.headers['content-type'] !== "application/octet-stream") { res.statusCode = 400; - res.statusMessage = 'Require header: content-type(application/octet-stream) accept, report_name'; + res.statusMessage = 'Require header: content-type(application/octet-stream) accept, report-name'; res.end(res.statusMessage); - console.log(req.headers['content-type'],req.headers['accept'],req.headers['report_name']) + console.log(req.headers['content-type'],req.headers['accept'],req.headers['report-name']) return } let outputMediaType = mimeToExtension(req.headers['accept']); - let reportName = req.headers['report_name'] - console.log('output: ' + outputMediaType); + let reportName = req.headers['report-name'] + console.log('convert output: ' + outputMediaType); const libreOfficeFileConverter = new LibreOfficeFileConverter({ childProcessOptions: { timeout: 60 * 1000, diff --git a/libs/create-swagger-spec.ts b/libs/create-swagger-spec.ts index d636621..16bcc7c 100644 --- a/libs/create-swagger-spec.ts +++ b/libs/create-swagger-spec.ts @@ -6,11 +6,11 @@ const swaggerOptions = { openapi: "3.1.0", info: { title: "Report Server", - version: "0.8.0", + version: "0.8.1", description: - "Advance create and convert document API for microservice era.", + "Technical preview releases - Report Server
Advance create and convert document API for microservice era. ", license: { - name: "by Frappet", + name: "by oom@Frappet", url: "https://frappet.com", }, }, @@ -18,7 +18,7 @@ const swaggerOptions = { {url: "https://report-server.frappet.synology.me"}, {url:"https://bma-ehr.frappet.synology.me/"}, {url: "http://localhost:3000"}, - {url: "http://192.168.2.100:3000"}, + {url: "http://192.168.2.101:3001"}, ], }, apis: ["./libs/*.ts"], diff --git a/libs/docx-templates-lib.ts b/libs/docx-templates-lib.ts index 9c60951..360be47 100644 --- a/libs/docx-templates-lib.ts +++ b/libs/docx-templates-lib.ts @@ -54,7 +54,7 @@ export async function docxTemplateX(base: string=".", tdata: templateData, outpu * @swagger * /api/v1/report-template/docx: * get: - * summary: list docx template + * summary: แสดงรายการ template ที่มีในโฟลเดอร์ templates * tags: [report-template] * responses: * 200: @@ -87,7 +87,7 @@ docxTemplateRoute.get("/", async function (req, res) { * @swagger * /api/v1/report-template/docx: * post: - * summary: Create document from docx template output can be docx pdf odt + * summary: สร้างเอกสารโดยใช้ template จากไฟล์ docx จะแทนค่าตัวแปรในเอกสาร หรือจะแปลงเป็นฟอร์แม็ตอื่นได้ด้วยรองรับ docx pdf odt, ค่า template เป็นชื่อของ template, reportName เป็นชื่อไฟล์ที่ต้องการ * tags: [report-template] * requestBody: * required: true diff --git a/libs/swagger-specs.json b/libs/swagger-specs.json index ce8bdab..4e5e30c 100644 --- a/libs/swagger-specs.json +++ b/libs/swagger-specs.json @@ -2,10 +2,10 @@ "openapi": "3.1.0", "info": { "title": "Report Server", - "version": "0.8.0", - "description": "Advance create and convert document API for microservice era.", + "version": "0.8.1", + "description": "Technical preview releases - Report Server
Advance create and convert document API for microservice era. ", "license": { - "name": "by Frappet", + "name": "by oom@Frappet", "url": "https://frappet.com" } }, @@ -20,21 +20,21 @@ "url": "http://localhost:3000" }, { - "url": "http://192.168.2.100:3000" + "url": "http://192.168.2.101:3001" } ], "paths": { "/api/v1/report-template/convert": { "post": { - "summary": "Create document from template", + "summary": "แปลงฟอร์แม็ตเอกสารเช่นจาก docx เป็น pdf ให้ตั้งค่า Media type เป็นชนิดไฟล์ที่ต้องการ", "tags": [ "office-convert" ], "parameters": [ { - "name": "report_name", + "name": "report-name", "in": "header", - "description": "นามสกุลไฟล์ที่อัปโหลดเข้ามา(ตอนนี้ไม่จำเป็นต้องใช้เพราะ soffice ตรวจสอบเอง)", + "description": "ชื่อไฟล์ที่ต้องการหลังแปลง", "required": true, "schema": { "type": "string", @@ -95,6 +95,9 @@ } } }, + "400": { + "description": "Invalid format" + }, "500": { "description": "Server error" } @@ -103,7 +106,7 @@ }, "/api/v1/report-template/docx": { "get": { - "summary": "list docx template", + "summary": "แสดงรายการ template ที่มีในโฟลเดอร์ templates", "tags": [ "report-template" ], @@ -130,7 +133,7 @@ } }, "post": { - "summary": "Create document from docx template output can be docx pdf odt", + "summary": "สร้างเอกสารโดยใช้ template จากไฟล์ docx จะแทนค่าตัวแปรในเอกสาร หรือจะแปลงเป็นฟอร์แม็ตอื่นได้ด้วยรองรับ docx pdf odt, ค่า template เป็นชื่อของ template, reportName เป็นชื่อไฟล์ที่ต้องการ", "tags": [ "report-template" ], @@ -242,7 +245,7 @@ } }, "post": { - "summary": "สร้าองเอกสารจาก xlsx template แล้วส่งกลับมาเป็น xlsx pdf odt", + "summary": "สร้างเอกสารจาก xlsx template แล้วส่งกลับมาเป็น xlsx pdf odt , ค่า template เป็นชื่อของ template ที่ใช้งาน, reportName เป็นชื่อไฟล์ที่ต้องการ", "tags": [ "report-template" ], @@ -372,7 +375,7 @@ "tags": [ { "name": "office-convert", - "description": "ใช้แปลงไฟล์จากเอกสารที่ libreoffice แปลงได้ x" + "description": "ใช้แปลงไฟล์จากเอกสารที่ libreoffice แปลงได้ เช่น docx เป็น pdf" }, { "name": "report-template", diff --git a/libs/xlsx-template-lib.ts b/libs/xlsx-template-lib.ts index 52a1abb..ab94803 100644 --- a/libs/xlsx-template-lib.ts +++ b/libs/xlsx-template-lib.ts @@ -76,7 +76,7 @@ xlsxTemplateRoute.get("/", async function (req, res) { * @swagger * /api/v1/report-template/xlsx: * post: - * summary: สร้าองเอกสารจาก xlsx template แล้วส่งกลับมาเป็น xlsx pdf odt + * summary: สร้างเอกสารจาก xlsx template แล้วส่งกลับมาเป็น xlsx pdf odt , ค่า template เป็นชื่อของ template ที่ใช้งาน, reportName เป็นชื่อไฟล์ที่ต้องการ * tags: [report-template] * requestBody: * required: true diff --git a/package-lock.json b/package-lock.json index 23495ed..bfb8f0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,23 +10,23 @@ "license": "ISC", "dependencies": { "cors": "^2.8.5", - "docx-templates": "^4.11.3", - "express": "^4.18.2", - "libreoffice-file-converter": "^1.2.1", + "docx-templates": "^4.13.0", + "express": "^4.19.2", + "libreoffice-file-converter": "^2.3.3", "swagger-jsdoc": "^6.2.8", - "swagger-ui-express": "^5.0.0", - "xlsx-template-next": "^0.1.2", + "swagger-ui-express": "^5.0.1", + "xlsx-template-next": "^1.0.3", "yaqrcode": "^0.2.1" }, "devDependencies": { - "@types/cors": "^2.8.14", - "@types/express": "^4.17.18", - "@types/node": "^20.8.2", - "@types/swagger-jsdoc": "^6.0.1", - "@types/swagger-ui-express": "^4.1.4", - "javascript-obfuscator": "^4.1.0", - "nodemon": "^3.0.1", - "ts-node": "^10.9.1", + "@types/cors": "^2.8.17", + "@types/express": "^4.17.21", + "@types/node": "^20.14.9", + "@types/swagger-jsdoc": "^6.0.4", + "@types/swagger-ui-express": "^4.1.6", + "javascript-obfuscator": "^4.1.1", + "nodemon": "^3.1.4", + "ts-node": "^10.9.2", "typescript": "^5.2.2" } }, @@ -183,18 +183,18 @@ } }, "node_modules/@types/cors": { - "version": "2.8.14", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.14.tgz", - "integrity": "sha512-RXHUvNWYICtbP6s18PnOCaqToK8y14DnLd75c6HfyKf228dxy7pHNOQkxPtvXKp/hINFMDjbYzsj63nnpPMSRQ==", + "version": "2.8.17", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz", + "integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/express": { - "version": "4.17.18", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.18.tgz", - "integrity": "sha512-Sxv8BSLLgsBYmcnGdGjjEjqET2U+AKAdCRODmMiq02FgjwuV75Ut85DRpvFjyw/Mk0vgUOliGRU0UUmuuZHByQ==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", "dev": true, "dependencies": { "@types/body-parser": "*", @@ -239,10 +239,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.8.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.2.tgz", - "integrity": "sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==", - "dev": true + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/qs": { "version": "6.9.8", @@ -278,15 +281,15 @@ } }, "node_modules/@types/swagger-jsdoc": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@types/swagger-jsdoc/-/swagger-jsdoc-6.0.1.tgz", - "integrity": "sha512-+MUpcbyxD528dECUBCEVm6abNuORdbuGjbrUdHDeAQ+rkPuo2a+L4N02WJHF3bonSSE6SJ3dUJwF2V6+cHnf0w==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@types/swagger-jsdoc/-/swagger-jsdoc-6.0.4.tgz", + "integrity": "sha512-W+Xw5epcOZrF/AooUM/PccNMSAFOKWZA5dasNyMujTwsBkU74njSJBpvCCJhHAJ95XRMzQrrW844Btu0uoetwQ==", "dev": true }, "node_modules/@types/swagger-ui-express": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.4.tgz", - "integrity": "sha512-h6dfIPFveCJKpStDtjrB+4pig4DAf9Uu2Z51RB7Fj3s6AifexmqhZxBoG50K/k3Afz7wyXsIAY5ZIDTlC2VjrQ==", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.6.tgz", + "integrity": "sha512-UVSiGYXa5IzdJJG3hrc86e8KdZWLYxyEsVoUI4iPXc7CO4VZ3AfNP8d/8+hrDRIqz+HAaSMtZSqAsF3Nq2X/Dg==", "dev": true, "dependencies": { "@types/express": "*", @@ -294,9 +297,9 @@ } }, "node_modules/@types/validator": { - "version": "13.11.2", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.2.tgz", - "integrity": "sha512-nIKVVQKT6kGKysnNt+xLobr+pFJNssJRi2s034wgWeFBUx01fI8BeHTW2TcRp7VcFu9QCYG8IlChTuovcm0oKQ==", + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.0.tgz", + "integrity": "sha512-nH45Lk7oPIJ1RVOF6JgFI6Dy0QpHEzq4QecZhvguxYPDwT8c93prCMqAtiIttm39voZ+DDR+qkNnMpJmMBRqag==", "dev": true }, "node_modules/abbrev": { @@ -480,12 +483,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -617,14 +620,14 @@ } }, "node_modules/class-validator": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.0.tgz", - "integrity": "sha512-ct3ltplN8I9fOwUd8GrP8UQixwff129BkEtuWDKL5W45cQuLd19xqmTLu5ge78YDm/fdje6FMt0hGOhl0lii3A==", + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.1.tgz", + "integrity": "sha512-2VEG9JICxIqTpoK1eMzZqaV+u/EiwEJkMGzTrZf6sU/fwsnOITVgYJ8yojSy6CaXtO9V0Cc6ZQZ8h8m4UBuLwQ==", "dev": true, "dependencies": { - "@types/validator": "^13.7.10", - "libphonenumber-js": "^1.10.14", - "validator": "^13.7.0" + "@types/validator": "^13.11.8", + "libphonenumber-js": "^1.10.53", + "validator": "^13.9.0" } }, "node_modules/color-convert": { @@ -807,12 +810,12 @@ } }, "node_modules/docx-templates": { - "version": "4.11.3", - "resolved": "https://registry.npmjs.org/docx-templates/-/docx-templates-4.11.3.tgz", - "integrity": "sha512-MphQX0jrqWsXQYUpTZxWaQbcTj7MksywZ6fg7g5ejyZpBbx5GxRJ/G+wv18gWn9bCa5OEKyIyxeejZrG/YGTvQ==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/docx-templates/-/docx-templates-4.13.0.tgz", + "integrity": "sha512-tTmR3WhROYctuyVReQ+PfCU3zprmC45/VuSVzn8EjovzpRkXYUdXiDatB9M8pasj0V+wuuOyY8bcSHvlQ2GNag==", "dependencies": { "jszip": "^3.10.1", - "sax": "1.2.4" + "sax": "1.3.0" }, "engines": { "node": ">=6" @@ -1003,9 +1006,9 @@ "dev": true }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -1244,9 +1247,9 @@ "dev": true }, "node_modules/image-size": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.2.tgz", - "integrity": "sha512-xfOoWjceHntRb3qFCrh5ZFORYH8XCdYpASltMhZ/Q0KZiOwjdE/Yl2QCiWdwD+lygV5bMCvauzgu5PxBX/Yerg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.1.1.tgz", + "integrity": "sha512-541xKlUw6jr/6gGuk92F+mYM5zaFAc5ahphvkqvNe2bQ6gVBkd6bfrmVJ2t4KDAfikAYZyIqTnktX3i6/aQDrQ==", "dependencies": { "queue": "6.0.2" }, @@ -1254,7 +1257,7 @@ "image-size": "bin/image-size.js" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.x" } }, "node_modules/immediate": { @@ -1418,9 +1421,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "node_modules/javascript-obfuscator": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/javascript-obfuscator/-/javascript-obfuscator-4.1.0.tgz", - "integrity": "sha512-ckC0VFKQ0/sFtLH9apW/ZLfsP8LuZqZhVEM4VTJ5KLzyLaodW6C1lTU8808eboDmddKyvd2uyRx5bzc0Me0GYg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/javascript-obfuscator/-/javascript-obfuscator-4.1.1.tgz", + "integrity": "sha512-gt+KZpIIrrxXHEQGD8xZrL8mTRwRY0U76/xz/YX0gZdPrSqQhT/c7dYLASlLlecT3r+FxE7je/+C0oLnTDCx4A==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -1430,7 +1433,7 @@ "assert": "2.0.0", "chalk": "4.1.2", "chance": "1.1.9", - "class-validator": "0.14.0", + "class-validator": "0.14.1", "commander": "10.0.0", "eslint-scope": "7.1.1", "eslint-visitor-keys": "3.3.0", @@ -1452,7 +1455,7 @@ "javascript-obfuscator": "bin/javascript-obfuscator" }, "engines": { - "node": "^12.22.0 || ^14.0.0 || ^16.0.0 || ^17.0.0 || >=18.0.0" + "node": ">=12.22.0" }, "funding": { "type": "opencollective", @@ -1525,20 +1528,20 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.10.47", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.47.tgz", - "integrity": "sha512-b4t7VQDV29xx/ni+58yl9KWPGjnDLDXCeCTLrD4V8vDpObXZRZBrg7uX/HWZ7YXiJKqdBDGgc+barUUTNB6Slw==", + "version": "1.11.4", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.4.tgz", + "integrity": "sha512-F/R50HQuWWYcmU/esP5jrH5LiWYaN7DpN0a/99U8+mnGGtnx8kmRE+649dQh3v+CowXXZc8vpkf5AmYkO0AQ7Q==", "dev": true }, "node_modules/libreoffice-file-converter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/libreoffice-file-converter/-/libreoffice-file-converter-1.2.1.tgz", - "integrity": "sha512-IxjapEZtpd9ShT6FlcwPIsF4KEAFFb4YywVXsw3sGipYAQQux09QmmOUXC4q6F+uTxXuDwPjXYFJ1e/imbRcPA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/libreoffice-file-converter/-/libreoffice-file-converter-2.3.3.tgz", + "integrity": "sha512-rfoVV07bvcfXp/kcXo+PorLSwocuUz564bJjyqdoow8+O2ga5h15UEoK0EI7v2GNuGy31uFjZwwBre+sp5iflg==", "dependencies": { - "tmp": "^0.2.1" + "tmp-promise": "^3.0.3" }, "engines": { - "node": ">=8" + "node": ">=14" } }, "node_modules/lie": { @@ -1703,13 +1706,13 @@ } }, "node_modules/nodemon": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.0.1.tgz", - "integrity": "sha512-g9AZ7HmkhQkqXkRc20w+ZfQ73cHLbE8hnPbtaFbFtCumZsjyMhKk9LajQ07U5Ux28lvFjZ5X7HvWR1xzU8jHVw==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", + "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", "dev": true, "dependencies": { "chokidar": "^3.5.2", - "debug": "^3.2.7", + "debug": "^4", "ignore-by-default": "^1.0.1", "minimatch": "^3.1.2", "pstree.remy": "^1.1.8", @@ -1731,18 +1734,26 @@ } }, "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/nodemon/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/nopt": { @@ -2021,20 +2032,6 @@ "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", "dev": true }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2060,9 +2057,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" }, "node_modules/semver": { "version": "7.5.4", @@ -2279,9 +2276,9 @@ "integrity": "sha512-NUHSYoe5XRTk/Are8jPJ6phzBh3l9l33nEyXosM17QInoV95/jng8+PuSGtbD407QoPf93MH3Bkh773OgesJpA==" }, "node_modules/swagger-ui-express": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.0.tgz", - "integrity": "sha512-tsU9tODVvhyfkNSvf03E6FAk+z+5cU3lXAzMy6Pv4av2Gt2xA0++fogwC4qo19XuFf6hdxevPuVCSKFuMHJhFA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.1.tgz", + "integrity": "sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA==", "dependencies": { "swagger-ui-dist": ">=5.0.0" }, @@ -2293,14 +2290,19 @@ } }, "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dependencies": { - "rimraf": "^3.0.0" - }, + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", "engines": { - "node": ">=8.17.0" + "node": ">=14.14" + } + }, + "node_modules/tmp-promise": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz", + "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", + "dependencies": { + "tmp": "^0.2.0" } }, "node_modules/to-regex-range": { @@ -2336,9 +2338,9 @@ } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -2427,6 +2429,12 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -2517,9 +2525,9 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/xlsx-template-next": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/xlsx-template-next/-/xlsx-template-next-0.1.2.tgz", - "integrity": "sha512-qlCkXdAZz3zL0Pkbij9bKQ6EPwTxR031UyU2DU4ZPZBmMqTonwJuE+Atgk85LXZ01YKkBZ7Ghvnj6rnkZQ/2BA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/xlsx-template-next/-/xlsx-template-next-1.0.3.tgz", + "integrity": "sha512-NjDtLeOetqT2brjIGIPHGJJdUkxWTOHW0uzCxVtpuJiXwcdd0LxWG3Oif4cbHlCXpl4hBkMDzt6wSn1A43A/dw==", "dependencies": { "elementtree": "^0.1.7", "image-size": "^1.0.2", diff --git a/package.json b/package.json index a9af52d..5af4de8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "docx-template มีปัญหากับ bun คาดว่าเป็นปัญหาจาก eval", "scripts": { - "dev": "PORT=3000 nodemon app.ts", + "dev": "PORT=3001 nodemon app.ts", "swaggergen": "ts-node libs/create-swagger-spec.ts ", "build": "ts-node libs/create-swagger-spec.ts && tsc && cp libs/swagger-specs.json dist/libs", "serve": "PORT=3000 node dist/app.js", @@ -17,23 +17,23 @@ "license": "ISC", "dependencies": { "cors": "^2.8.5", - "docx-templates": "^4.11.3", - "express": "^4.18.2", - "libreoffice-file-converter": "^1.2.1", + "docx-templates": "^4.13.0", + "express": "^4.19.2", + "libreoffice-file-converter": "^2.3.3", "swagger-jsdoc": "^6.2.8", - "swagger-ui-express": "^5.0.0", - "xlsx-template-next": "^0.1.2", + "swagger-ui-express": "^5.0.1", + "xlsx-template-next": "^1.0.3", "yaqrcode": "^0.2.1" }, "devDependencies": { - "@types/cors": "^2.8.14", - "@types/express": "^4.17.18", - "@types/node": "^20.8.2", - "@types/swagger-jsdoc": "^6.0.1", - "@types/swagger-ui-express": "^4.1.4", - "javascript-obfuscator": "^4.1.0", - "nodemon": "^3.0.1", - "ts-node": "^10.9.1", + "@types/cors": "^2.8.17", + "@types/express": "^4.17.21", + "@types/node": "^20.14.9", + "@types/swagger-jsdoc": "^6.0.4", + "@types/swagger-ui-express": "^4.1.6", + "javascript-obfuscator": "^4.1.1", + "nodemon": "^3.1.4", + "ts-node": "^10.9.2", "typescript": "^5.2.2" } }