@cnbcool/cnb-api-generate 2.7.1 → 2.7.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.
@@ -1,5 +1,5 @@
1
1
  import { helpData } from './help-data';
2
- import { tryParseJSON } from './parsers';
2
+ import { tryParseJSON, tryReadFileRef } from './parsers';
3
3
  import { buildNestedFieldMap } from '../utils/build-nested-field-map';
4
4
  import type { NestedFieldMapping } from '../utils/build-nested-field-map';
5
5
  import { restoreOriginalKeys } from '../utils/restore-original-keys';
@@ -156,7 +156,8 @@ export function formatParams(
156
156
  } else if (bodyProps[key].type === 'string') {
157
157
  // schema 定义为 string 类型时,保持原始字符串,不做 JSON 解析
158
158
  // 避免纯数字字符串(如 "123")被转为 number
159
- formatted.data[key] = value;
159
+ // 支持 @file 语法:从文件读取长文本内容(避免 shell 长参数截断)
160
+ formatted.data[key] = tryReadFileRef(value as string);
160
161
  } else {
161
162
  formatted.data[key] = tryParseJSON(value as string);
162
163
  }
@@ -19,6 +19,7 @@ export async function refreshAccessToken(store: TokenStore): Promise<string> {
19
19
  form.set('refresh_token', store.refresh_token);
20
20
  form.set('client_id', clientID);
21
21
 
22
+ const nowSec = Math.floor(Date.now() / 1000);
22
23
  const resp = await fetch(tokenURL, {
23
24
  method: 'POST',
24
25
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
@@ -31,7 +32,6 @@ export async function refreshAccessToken(store: TokenStore): Promise<string> {
31
32
  }
32
33
 
33
34
  const tok: TokenResponse = await resp.json();
34
- const nowSec = Math.floor(Date.now() / 1000);
35
35
 
36
36
  const newStore: TokenStore = {
37
37
  access_token: tok.access_token,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnbcool/cnb-api-generate",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "main": "./built/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./src/index.ts",