From 96f8b57564c5fa0b1bfc7c6cfa3406036ddb9d89 Mon Sep 17 00:00:00 2001 From: qpismont Date: Wed, 20 Mar 2024 20:21:35 +0100 Subject: [PATCH] upgrade to bun 1.0.33 + upgrade deps --- .woodpecker/.build.yml | 5 +++-- .woodpecker/.lint.yml | 2 +- .woodpecker/.test.yml | 5 +++-- biome.json | 2 +- bun.lockb | Bin 8403 -> 8404 bytes package.json | 2 +- src/adaptors/nats.ts | 1 + src/service.ts | 6 +++++- tsconfig.json | 36 ++++++++++++++++++------------------ 9 files changed, 33 insertions(+), 26 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index c50d477..abdc2cd 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -10,5 +10,6 @@ steps: matrix: BUN_VERSION: - - 1.0.25 - - 1.0.26 \ No newline at end of file + - 1.0.31 + - 1.0.32 + - 1.0.33 \ No newline at end of file diff --git a/.woodpecker/.lint.yml b/.woodpecker/.lint.yml index d6fbe08..5e06448 100644 --- a/.woodpecker/.lint.yml +++ b/.woodpecker/.lint.yml @@ -3,7 +3,7 @@ when: steps: lint: - image: oven/bun:1.0.26-slim + image: oven/bun:1.0.33-slim commands: - bun install - bun run ci diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml index 0ba051e..5ea367c 100644 --- a/.woodpecker/.test.yml +++ b/.woodpecker/.test.yml @@ -12,8 +12,9 @@ steps: matrix: BUN_VERSION: - - 1.0.25 - - 1.0.26 + - 1.0.31 + - 1.0.32 + - 1.0.33 services: nats: diff --git a/biome.json b/biome.json index 13fdba5..0473834 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.6.1/schema.json", "organizeImports": { "enabled": true }, diff --git a/bun.lockb b/bun.lockb index 5bb4e7fe1a23f45f22525f03209853f1b887e488..c576a94af446278d4f2c0ece22ad9fe2b701c12a 100755 GIT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ijUGChQaP6)em)3p>ei5YDI}8P7FS04x;`c0J;OLOCRBX?Iyu4U^OvfhQcNv0^f993dYe z-9tB~?B<6XsI8(k)H6i9l_?i8=y_HOPuSWYetXZvz9~4&!qnW<(i#AT8)TRT@1J(T z-WG=?TAG_$SeSA<;9EL_^(${IUx63Y*Jfa2F^P_DWSLi#Jf>MSd|J>(K>g8dRH<-_ zHfxcS_|CsezcUIyArBlr#GZ3E|2v~_oca=X2b}<$yzh*{lX`}@{FerJoSe}^gA}&q zz$qq0J=S~w{X;@1(bm-cCP!g*{s$aW$~>MM$g7|}<1l6?s%C7!@LaSrs@`Ns)|sHQ zGB(F}wl6EwnD7Ky5);2ZbQ82-v7ms(#93O4idae*&cYg=*Wt-_E*jKfVq?pv z>iNpi5+>;qVXodJd2R)J^)$zx7qYpK%Vx=+J> { + this.sub?.unsubscribe(); await this.nc?.drain(); } } diff --git a/src/service.ts b/src/service.ts index 1d95ff4..e57d05f 100644 --- a/src/service.ts +++ b/src/service.ts @@ -1,4 +1,4 @@ -import { z } from "zod"; +import type { z } from "zod"; import type Adaptor from "./adaptors/adaptor"; import { RequestError } from "./error"; import { @@ -36,6 +36,7 @@ export default class Service { async (rawReq) => { const rawReqJson = JSON.parse(rawReq); const internalRequestJson = InternalRequestSchema.safeParse(rawReqJson); + if (!internalRequestJson.success) { return JSON.stringify({ statusCode: 400, @@ -51,12 +52,14 @@ export default class Service { if (internalRequest.data && schema) { const validate = schema.safeParse(internalRequest.data); + if (!validate.success) { return JSON.stringify({ statusCode: 400, data: validate.error, } satisfies InternalResponse); } + req.data = validate.data; } @@ -75,6 +78,7 @@ export default class Service { data: err.message, } satisfies InternalResponse); } + return JSON.stringify({ statusCode: 500, data: "unknow error apend", diff --git a/tsconfig.json b/tsconfig.json index dcd8fc5..5adda45 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,22 @@ { - "compilerOptions": { - "lib": ["ESNext"], - "target": "ESNext", - "module": "ESNext", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, + "compilerOptions": { + "lib": ["ESNext"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, - /* Linting */ - "skipLibCheck": true, - "strict": true, - "noFallthroughCasesInSwitch": true, - "forceConsistentCasingInFileNames": true - } + /* Linting */ + "skipLibCheck": true, + "strict": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true + } }