Commit Graph
32 Commits
Author SHA1 Message Date
yyh 41857cf9cd Fix retry handling for request bodies 2026-01-05 14:31:57 +08:00
yyh 78ab09b521 fix(nodejs-client): handle malformed JSON responses gracefully
Fix critical bugs in response body parsing:

1. Error responses (non-OK status):
   - Response body can only be read once
   - Previous code: response.json() fails → response.text() throws 'Body already read'
   - Fix: Read as text first, then parse JSON with fallback to raw text

2. Success responses (OK status):
   - Malformed JSON was not caught, causing NetworkError misclassification
   - Fix: Wrap JSON.parse in try-catch, fallback to raw text

These fixes prevent unhandled promise rejections and provide better error
messages when servers return malformed JSON responses.

Reported-by: gemini-code-assist
Severity: Critical (issue 1), High (issue 2)
2026-01-05 14:23:20 +08:00
yyh 249a491743 fix(nodejs-client): fix timeout handling in retry loop
Fix critical bug in retry loop timeout control:
- Move AbortController creation inside while loop to ensure each retry uses a fresh controller
- Previous implementation caused retries to use an already-aborted controller, making retries fail immediately
- Add eslint-disable comments to explain necessary type assertions
- Improve code comments explaining DOM ReadableStream type conversion

This fix ensures the retry mechanism works correctly with independent timeout control for each attempt.
2026-01-05 14:13:22 +08:00
yyh df67842fae fix(nodejs-client): fix all test mocks for fetch API
- Add createMockResponse helper to properly mock fetch responses
- Update all test cases to use the mock helper with all required methods
- Fix timeout error test to use AbortError instead of fake timers
- Ensure beforeEach restores real timers to avoid test interference
- All 85 tests now passing
2026-01-05 14:04:57 +08:00
yyh a4495ab586 chore(nodejs-client): update pnpm-lock.yaml to remove axios 2026-01-05 13:58:25 +08:00
yyh 7c3f15c507 chore(nodejs-client): bump version to 3.1.0 2026-01-05 13:57:45 +08:00
yyh 5db66ad033 refactor(nodejs-client): replace axios with native fetch API
- Replace axios with Node.js native fetch API for HTTP requests
- Update HttpClient to use fetch instead of axios instance
- Convert axios-specific error handling to fetch-based error mapping
- Update response type handling for streams, JSON, text, etc.
- Remove axios from package.json dependencies
- Update all test files to mock fetch instead of axios

This change reduces external dependencies and uses the built-in
fetch API available in Node.js 18+, which is already the minimum
required version for this SDK.
2026-01-05 13:57:22 +08:00
Stephen ZhouandGitHub a46dc2f37e chore(sdk/nodejs): update deps (#30291) 2025-12-29 10:13:19 +08:00
yyhGitHubautofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
4d48791f3c refactor: nodejs sdk (#30036)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-23 23:24:38 +08:00
yyhandGitHub 034e3e85e9 Fix Node.js SDK routes and multipart handling (#28573) 2025-11-24 21:00:40 +08:00
Asuka MinatoGitHubautofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>Copilot
77ba3e8f26 add autofix pnpm (#25557)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
2025-09-12 09:37:54 +08:00
sheeyandGitHub 9d6ce3065d fix: files parameter in JavaScript sdk incorrectly annotated as the File type in WebAPI (#24644) 2025-08-27 20:01:28 +08:00
yihongandGitHub 4c1ad40f8e docs: format all md files (#24195)
Signed-off-by: yihong0618 <[email protected]>
2025-08-20 13:49:11 +08:00
QuantumGhostandGitHub bd1bbfee4b Enhance Code Consistency Across Repository with .editorconfig (#19023) 2025-04-29 18:04:33 +08:00
+110 403e2d58b9 Introduce Plugins (#13836)
Signed-off-by: yihong0618 <[email protected]>
Signed-off-by: -LAN- <[email protected]>
Signed-off-by: xhe <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: takatost <[email protected]>
Co-authored-by: kurokobo <[email protected]>
Co-authored-by: Novice Lee <[email protected]>
Co-authored-by: zxhlyh <[email protected]>
Co-authored-by: AkaraChen <[email protected]>
Co-authored-by: Yi <[email protected]>
Co-authored-by: Joel <[email protected]>
Co-authored-by: JzoNg <[email protected]>
Co-authored-by: twwu <[email protected]>
Co-authored-by: Hiroshi Fujita <[email protected]>
Co-authored-by: AkaraChen <[email protected]>
Co-authored-by: NFish <[email protected]>
Co-authored-by: Wu Tianwei <[email protected]>
Co-authored-by: 非法操作 <[email protected]>
Co-authored-by: Novice <[email protected]>
Co-authored-by: Hiroki Nagai <[email protected]>
Co-authored-by: Gen Sato <[email protected]>
Co-authored-by: eux <[email protected]>
Co-authored-by: huangzhuo1949 <[email protected]>
Co-authored-by: huangzhuo <[email protected]>
Co-authored-by: lotsik <[email protected]>
Co-authored-by: crazywoola <[email protected]>
Co-authored-by: nite-knite <[email protected]>
Co-authored-by: Jyong <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: gakkiyomi <[email protected]>
Co-authored-by: CN-P5 <[email protected]>
Co-authored-by: CN-P5 <[email protected]>
Co-authored-by: Chuehnone <[email protected]>
Co-authored-by: yihong <[email protected]>
Co-authored-by: Kevin9703 <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: Boris Feld <[email protected]>
Co-authored-by: mbo <[email protected]>
Co-authored-by: mabo <[email protected]>
Co-authored-by: Warren Chen <[email protected]>
Co-authored-by: JzoNgKVO <[email protected]>
Co-authored-by: jiandanfeng <[email protected]>
Co-authored-by: zhu-an <[email protected]>
Co-authored-by: zhaoqingyu.1075 <[email protected]>
Co-authored-by: 海狸大師 <[email protected]>
Co-authored-by: Xu Song <[email protected]>
Co-authored-by: rayshaw001 <[email protected]>
Co-authored-by: Ding Jiatong <[email protected]>
Co-authored-by: Bowen Liang <[email protected]>
Co-authored-by: JasonVV <[email protected]>
Co-authored-by: le0zh <[email protected]>
Co-authored-by: zhuxinliang <[email protected]>
Co-authored-by: k-zaku <[email protected]>
Co-authored-by: luckylhb90 <[email protected]>
Co-authored-by: hobo.l <[email protected]>
Co-authored-by: jiangbo721 <[email protected]>
Co-authored-by: 刘江波 <[email protected]>
Co-authored-by: Shun Miyazawa <[email protected]>
Co-authored-by: EricPan <[email protected]>
Co-authored-by: crazywoola <[email protected]>
Co-authored-by: sino <[email protected]>
Co-authored-by: Jhvcc <[email protected]>
Co-authored-by: lowell <[email protected]>
Co-authored-by: Boris Polonsky <[email protected]>
Co-authored-by: Ademílson Tonato <[email protected]>
Co-authored-by: Ademílson Tonato <[email protected]>
Co-authored-by: IWAI, Masaharu <[email protected]>
Co-authored-by: Yueh-Po Peng (Yabi) <[email protected]>
Co-authored-by: Jason <[email protected]>
Co-authored-by: Xin Zhang <[email protected]>
Co-authored-by: yjc980121 <[email protected]>
Co-authored-by: heyszt <[email protected]>
Co-authored-by: Abdullah AlOsaimi <[email protected]>
Co-authored-by: Abdullah AlOsaimi <[email protected]>
Co-authored-by: Yingchun Lai <[email protected]>
Co-authored-by: Hash Brown <[email protected]>
Co-authored-by: zuodongxu <[email protected]>
Co-authored-by: Masashi Tomooka <[email protected]>
Co-authored-by: aplio <[email protected]>
Co-authored-by: Obada Khalili <[email protected]>
Co-authored-by: Nam Vu <[email protected]>
Co-authored-by: Kei YAMAZAKI <[email protected]>
Co-authored-by: TechnoHouse <[email protected]>
Co-authored-by: Riddhimaan-Senapati <[email protected]>
Co-authored-by: MaFee921 <[email protected]>
Co-authored-by: te-chan <[email protected]>
Co-authored-by: HQidea <[email protected]>
Co-authored-by: Joshbly <[email protected]>
Co-authored-by: xhe <[email protected]>
Co-authored-by: weiwenyan-dev <[email protected]>
Co-authored-by: ex_wenyan.wei <[email protected]>
Co-authored-by: engchina <[email protected]>
Co-authored-by: engchina <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 呆萌闷油瓶 <[email protected]>
Co-authored-by: Kemal <[email protected]>
Co-authored-by: Lazy_Frog <[email protected]>
Co-authored-by: Yi Xiao <[email protected]>
Co-authored-by: Steven sun <[email protected]>
Co-authored-by: steven <[email protected]>
Co-authored-by: Kalo Chin <[email protected]>
Co-authored-by: Katy Tao <[email protected]>
Co-authored-by: depy <[email protected]>
Co-authored-by: 胡春东 <[email protected]>
Co-authored-by: Junjie.M <[email protected]>
Co-authored-by: MuYu <[email protected]>
Co-authored-by: Naoki Takashima <[email protected]>
Co-authored-by: Summer-Gu <[email protected]>
Co-authored-by: Fei He <[email protected]>
Co-authored-by: ybalbert001 <[email protected]>
Co-authored-by: Yuanbo Li <[email protected]>
Co-authored-by: douxc <[email protected]>
Co-authored-by: liuzhenghua <[email protected]>
Co-authored-by: Wu Jiayang <[email protected]>
Co-authored-by: Your Name <[email protected]>
Co-authored-by: kimjion <[email protected]>
Co-authored-by: AugNSo <[email protected]>
Co-authored-by: llinvokerl <[email protected]>
Co-authored-by: liusurong.lsr <[email protected]>
Co-authored-by: Vasu Negi <[email protected]>
Co-authored-by: Hundredwz <[email protected]>
Co-authored-by: Xiyuan Chen <[email protected]>
2025-02-17 17:05:13 +08:00
Nam VuandGitHub 2d7954c7da Fix variable typo (#8084) 2024-09-08 13:14:11 +08:00
Krasus.ChenandGitHub 7d4a0a417a add workflowClient ,fix rename bug (#7352) 2024-08-16 20:21:08 +08:00
JoelandGitHub 69190e088e fix: update npm version to fix Incorrect argument types in createChatMessage (#4865) 2024-06-03 08:22:27 +08:00
Kishida TakashiandGitHub 41e536109b fix: Incorrect argument types in createChatMessage (#4861) 2024-06-02 21:03:42 +08:00
Valerio NarcisiandGitHub af026c5953 fix: node.js sdk if request is a get data must not exist (#4618) 2024-05-27 08:48:07 +08:00
JoelandGitHub 80e390b906 feat: add workflow api in Node.js sdk (#3584) 2024-04-18 11:23:18 +08:00
0b8dcaba8f Chore: Add type files and unit test ci for Node.js SDK (#2268)
Co-authored-by: xieweicheng <[email protected]>
2024-02-18 15:54:14 +08:00
JoelandGitHub d76d1adb59 feat: Nodejs sdk support auto rename conversation api (#2265) 2024-01-29 12:57:39 +08:00
5b7071e4b0 Feat/sdk vision support (#1531)
Co-authored-by: Joel <[email protected]>
2023-11-20 17:54:01 +08:00
5b06ded0b1 build: improve dockerfile (#851)
Co-authored-by: MatriQi <[email protected]>
2023-08-17 10:25:11 +08:00
crazywoolaandGitHub cb6e73347e Feat/add ruby sdk (#583) 2023-07-18 10:18:58 +08:00
JoelandGitHub 299c51ebc4 feat: npm sdk to 2.0 to fix steaming problem (#326) 2023-06-09 14:36:48 +08:00
crazywoolaandGitHub 3a7f58d2a6 Feature/fix streaming mode (#324) 2023-06-09 14:24:59 +08:00
crazywoolaandGitHub 3117619ef3 Feature/add test to nodejs sdk (#31) 2023-05-16 09:22:47 +08:00
JoelandGitHub c2e7fe107a fix: nodejs endpoint (#20) 2023-05-15 16:57:05 +08:00
AresandGitHub 367ef145d6 fix: Fix symbol errors in the nodejs-client's README.md file of the SDK (#3) 2023-05-15 11:20:12 +08:00
John Wang db896255d6 Initial commit 2023-05-15 08:51:32 +08:00