meeglesdk 0.2.2 → 0.2.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3 - 2026-07-11
4
+
5
+ ### Fixed
6
+
7
+ - Universal Search now accepts both upstream response formats observed in real environments: documented `datas` arrays and alternate stringified `data` payloads.
8
+ - Unknown Universal Search response shapes still fail explicitly instead of silently returning an empty result.
9
+
10
+ ### Tests
11
+
12
+ - Added coverage for documented `datas`, alternate stringified `data`, and unknown response rejection.
13
+ - Verified the documented flat request body remains `project_key + work_item_type_key + search_group`.
14
+
3
15
  ## 0.2.2 - 2026-07-11
4
16
 
5
17
  ### Added
package/RELEASE.md CHANGED
@@ -5,8 +5,8 @@ This document is the npm release checklist for `meeglesdk`.
5
5
  ## Current Release
6
6
 
7
7
  - Package: `meeglesdk`
8
- - Version: `0.2.2`
9
- - Registry latest checked before release: `0.2.1`
8
+ - Version: `0.2.3`
9
+ - Registry latest checked before release: `0.2.2`
10
10
  - Runtime requirement: Node.js 18+
11
11
  - Development runtime: Bun 1.3+
12
12
 
@@ -37,7 +37,7 @@ This document is the npm release checklist for `meeglesdk`.
37
37
 
38
38
  ```bash
39
39
  npm view meeglesdk version dist-tags --json
40
- npm view meeglesdk@0.2.2 dist.tarball
40
+ npm view meeglesdk@0.2.3 dist.tarball
41
41
  ```
42
42
 
43
43
  ## Notes
@@ -126,7 +126,7 @@ export declare abstract class BaseService {
126
126
  * POST 游标分页请求
127
127
  * 用于 datas + pagination(search_after) 的接口
128
128
  */
129
- protected postCursorPaginated<T>(path: string, body?: unknown, options?: ServiceRequestOptions<T>, dataKey?: string): Promise<SearchAfterPaginatedResult<T>>;
129
+ protected postCursorPaginated<T>(path: string, body?: unknown, options?: ServiceRequestOptions<T>, dataKeys?: string | readonly string[]): Promise<SearchAfterPaginatedResult<T>>;
130
130
  /**
131
131
  * GET 分页请求(data 为对象)
132
132
  * 用于 pagination 与 data 同级,但 data 为对象的接口
@@ -101,7 +101,7 @@ export class BaseService {
101
101
  * POST 游标分页请求
102
102
  * 用于 datas + pagination(search_after) 的接口
103
103
  */
104
- postCursorPaginated(path, body, options, dataKey = 'datas') {
104
+ postCursorPaginated(path, body, options, dataKeys = 'datas') {
105
105
  return this.requestHandler.requestCursorPaginated({
106
106
  method: 'POST',
107
107
  path,
@@ -115,7 +115,7 @@ export class BaseService {
115
115
  skipRetry: options?.skipRetry,
116
116
  retry: options?.retry,
117
117
  responseValidator: options?.responseValidator,
118
- }, dataKey);
118
+ }, dataKeys);
119
119
  }
120
120
  /**
121
121
  * GET 分页请求(data 为对象)
@@ -31,7 +31,7 @@ export declare class RequestHandler {
31
31
  * 发送游标分页请求
32
32
  * 用于 datas + pagination(search_after) 的接口
33
33
  */
34
- requestCursorPaginated<T>(config: RequestConfig<T>, dataKey?: string): Promise<SearchAfterPaginatedResult<T>>;
34
+ requestCursorPaginated<T>(config: RequestConfig<T>, dataKeys?: string | readonly string[]): Promise<SearchAfterPaginatedResult<T>>;
35
35
  /**
36
36
  * 发送请求(自定义响应字段)
37
37
  * 用于响应数据字段不是 data 的接口
@@ -56,8 +56,8 @@ export class RequestHandler {
56
56
  * 发送游标分页请求
57
57
  * 用于 datas + pagination(search_after) 的接口
58
58
  */
59
- async requestCursorPaginated(config, dataKey = 'datas') {
60
- return this.executeWithRetry(config, (context) => this.executeOnce(context, (response) => parseCursorPaginatedResponse(response, dataKey, config.responseValidator)));
59
+ async requestCursorPaginated(config, dataKeys = 'datas') {
60
+ return this.executeWithRetry(config, (context) => this.executeOnce(context, (response) => parseCursorPaginatedResponse(response, dataKeys, config.responseValidator)));
61
61
  }
62
62
  /**
63
63
  * 发送请求(自定义响应字段)
@@ -47,4 +47,4 @@ export declare function parseMultiFieldResponse<T extends object>(response: Resp
47
47
  * 解析游标分页响应
48
48
  * 用于 datas + pagination(search_after) 的接口
49
49
  */
50
- export declare function parseCursorPaginatedResponse<T>(response: Response, dataKey: string, validator?: ResponseValidator<T>): Promise<SearchAfterPaginatedResult<T>>;
50
+ export declare function parseCursorPaginatedResponse<T>(response: Response, dataKeys: string | readonly string[], validator?: ResponseValidator<T>): Promise<SearchAfterPaginatedResult<T>>;
@@ -154,10 +154,13 @@ export async function parseMultiFieldResponse(response, fields) {
154
154
  * 解析游标分页响应
155
155
  * 用于 datas + pagination(search_after) 的接口
156
156
  */
157
- export async function parseCursorPaginatedResponse(response, dataKey, validator) {
157
+ export async function parseCursorPaginatedResponse(response, dataKeys, validator) {
158
158
  const result = await parseEnvelope(response);
159
- if (!(dataKey in result)) {
160
- throw new MeegoError(`[-1] Response missing ${dataKey}`, -1, `Response missing ${dataKey}`, result.err, response.status);
159
+ const acceptedDataKeys = typeof dataKeys === 'string' ? [dataKeys] : [...dataKeys];
160
+ const dataKey = acceptedDataKeys.find((key) => key in result);
161
+ if (!dataKey) {
162
+ const expected = acceptedDataKeys.join(', ');
163
+ throw new MeegoError(`[-1] Response missing one of: ${expected}`, -1, `Response missing one of: ${expected}`, result.err, response.status);
161
164
  }
162
165
  const rawData = result[dataKey];
163
166
  let parsedData = rawData;
@@ -273,7 +273,7 @@ export class SearchService extends BaseService {
273
273
  * ```
274
274
  */
275
275
  async universalSearch(request, options) {
276
- const result = await this.postCursorPaginated(API_PATHS.UNIVERSAL_SEARCH, request, options, 'data');
276
+ const result = await this.postCursorPaginated(API_PATHS.UNIVERSAL_SEARCH, request, options, ['datas', 'data']);
277
277
  return {
278
278
  datas: result.data,
279
279
  pagination: result.pagination,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meeglesdk",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "飞书项目 Open API TypeScript SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",