@jetthai/cuora 1.1.447-dev.1 → 1.1.447-dev.2

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.
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
package/AGENTS.md CHANGED
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
@@ -84,6 +84,12 @@
84
84
 
85
85
  **檔案**:`src/index.js`
86
86
 
87
+ - **Token 注入**:請求攔截器自動注入 `Bearer {token}`
88
+ - **API 版本控制**:`supportVersion2List` 陣列定義需轉換的端點,自動將 V1 camelCase 路徑轉為 V2 kebab-case
89
+ - **維護模式偵測**:`ERR_F108` 錯誤觸發 `isBlocked` 旗標,阻擋後續非設定請求
90
+ - **自訂序列化**:針對 `q` 參數避免雙重編碼
91
+ - **請求取消**:透過 `send()` 第二參數 `customToken` 選擇性啟用;預設**不**附加 CancelToken(axios <0.22 的取消 handler 永不退訂——共用長壽命 token 會隨請求數累積 handler,導致掛機過夜 OOM,TI-15555)
92
+
87
93
  ```js
88
94
  import api from './api/index.js'
89
95
  import machine from './machine/index.js'
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.447-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.447-dev.1...v1.1.447-dev.2) (2026-07-17)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **request:** send() 預設不再附加共用 CancelToken,杜絕取消 handler 累積(TI-15555) ([fb14330](https://github.com/jetthai/cuora-module/commit/fb1433087668559c8cb7f1f515c59a8caaa26351))
11
+
5
12
  ### [1.1.447-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.447-dev.0...v1.1.447-dev.1) (2026-07-16)
6
13
 
7
14
  ### [1.1.447-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.447...v1.1.447-dev.0) (2026-07-14)
package/CLAUDE.md CHANGED
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
package/GEMINI.md CHANGED
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.447-dev.1",
3
+ "version": "1.1.447-dev.2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -251,7 +251,10 @@ export default class Request {
251
251
 
252
252
  async send(req, customToken) {
253
253
  try {
254
- const cancelToken = customToken || this.source.token
254
+ // axios <0.22 對 cancelToken.promise 註冊的取消 handler 永不退訂(xhr.js 無 unsubscribe),
255
+ // 預設掛長壽命共用 token 會使 handler 隨請求數線性累積(掛機過夜 OOM,TI-15555)。
256
+ // 故預設不掛 cancelToken,僅呼叫端明確傳入 customToken(自行管理其生命週期)時才附加。
257
+ const cancelToken = customToken
255
258
  // ERR_A103 No token provided 改由後端回傳:不再於送出前自行 throw,
256
259
  // 無 token 的非 public 請求一律送後端,由後端判定並回 A103(前台再屏蔽/登出)。
257
260
  const requestConfig = this._createConfig(req, cancelToken)
@@ -280,6 +283,8 @@ export default class Request {
280
283
  }
281
284
  }
282
285
 
286
+ // 注意:send() 已不再預設附加 this.source.token(見 send 內註解),
287
+ // sourceUpdate 僅對「呼叫端明確以 this.source.token 為 customToken」的請求有效;保留以維持 API 相容。
283
288
  sourceUpdate() {
284
289
  this.source.cancel('Requests Cancelled')
285
290
  this.source = this.axios.CancelToken.source()