apaas-oapi-client 0.1.10 → 0.1.12

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/dist/index.d.ts CHANGED
@@ -12,15 +12,6 @@ interface ClientOptions {
12
12
  /** 是否禁用 token 缓存, 每次调用强制刷新 token, 默认 false */
13
13
  disableTokenCache?: boolean;
14
14
  }
15
- /**
16
- * records_query 接口请求参数
17
- */
18
- interface RecordsQueryParams {
19
- /** 对象名称, 例如 object_store */
20
- object_name: string;
21
- /** 请求体数据 */
22
- data: any;
23
- }
24
15
  /**
25
16
  * aPaaS OpenAPI 客户端
26
17
  */
@@ -65,6 +56,11 @@ declare class Client {
65
56
  * 获取当前 accessToken
66
57
  */
67
58
  get token(): string | null;
59
+ /**
60
+ * 获取当前 token 剩余过期时间(单位:秒)
61
+ * @returns 剩余秒数,若无 token 则返回 null
62
+ */
63
+ get tokenExpireTime(): number | null;
68
64
  /**
69
65
  * 获取当前 namespace
70
66
  */
@@ -76,6 +72,7 @@ declare class Client {
76
72
  metadata: {
77
73
  /**
78
74
  * 获取指定对象下指定字段的元数据
75
+ * @description 查询指定对象下的单个字段元数据
79
76
  * @param params 请求参数 { object_name, field_name }
80
77
  * @returns 接口返回结果
81
78
  */
@@ -85,6 +82,7 @@ declare class Client {
85
82
  }) => Promise<any>;
86
83
  /**
87
84
  * 获取指定对象的所有字段信息
85
+ * @description 查询指定对象下的所有字段元数据
88
86
  * @param params 请求参数 { object_name }
89
87
  * @returns 接口返回结果
90
88
  */
@@ -95,6 +93,7 @@ declare class Client {
95
93
  search: {
96
94
  /**
97
95
  * 单条记录查询
96
+ * @description 查询指定对象下的单条记录
98
97
  * @param params 请求参数
99
98
  * @returns 接口返回结果
100
99
  */
@@ -104,17 +103,25 @@ declare class Client {
104
103
  select: string[];
105
104
  }) => Promise<any>;
106
105
  /**
107
- * records_query 接口
106
+ * 多条记录查询 - 最多传入 100 条
107
+ * @description 查询指定对象下的多条记录
108
108
  * @param params 请求参数
109
109
  * @returns 接口返回结果
110
110
  */
111
- records: (params: RecordsQueryParams) => Promise<any>;
111
+ records: (params: {
112
+ object_name: string;
113
+ data: any;
114
+ }) => Promise<any>;
112
115
  /**
113
- * 分页查询所有记录
116
+ * 查询所有记录 - 支持超过 100 条数据,自动分页查询
117
+ * @description 该方法会自动处理分页,直到没有更多数据为止
114
118
  * @param params 请求参数
115
119
  * @returns { total, items }
116
120
  */
117
- recordsWithIterator: (params: RecordsQueryParams) => Promise<{
121
+ recordsWithIterator: (params: {
122
+ object_name: string;
123
+ data: any;
124
+ }) => Promise<{
118
125
  total: number;
119
126
  items: any[];
120
127
  }>;
@@ -122,6 +129,7 @@ declare class Client {
122
129
  create: {
123
130
  /**
124
131
  * 单条记录创建
132
+ * @description 创建单条记录到指定对象中
125
133
  * @param params 请求参数 { object_name, record }
126
134
  * @returns 接口返回结果
127
135
  */
@@ -130,7 +138,8 @@ declare class Client {
130
138
  record: any;
131
139
  }) => Promise<any>;
132
140
  /**
133
- * 批量创建记录
141
+ * 批量创建记录 - 最多传入 100 条
142
+ * @description 创建多条记录到指定对象中
134
143
  * @param params 请求参数 { object_name, records }
135
144
  * @returns 接口返回结果
136
145
  */
@@ -139,7 +148,8 @@ declare class Client {
139
148
  records: any[];
140
149
  }) => Promise<any>;
141
150
  /**
142
- * 分批创建所有记录
151
+ * 分批创建所有记录 - 支持超过 100 条数据,自动拆分
152
+ * @description 创建多条记录到指定对象中,超过 100 条数据会自动拆分为多次请求
143
153
  * @param params 请求参数 { object_name, records }
144
154
  * @returns { total, items }
145
155
  */
@@ -154,6 +164,7 @@ declare class Client {
154
164
  update: {
155
165
  /**
156
166
  * 单条更新
167
+ * @description 更新指定对象下的单条记录
157
168
  * @param params 请求参数
158
169
  * @returns 接口返回结果
159
170
  */
@@ -163,11 +174,22 @@ declare class Client {
163
174
  record: any;
164
175
  }) => Promise<any>;
165
176
  /**
166
- * 批量更新
177
+ * 多条更新 - 最多传入 100 条
178
+ * @description 更新指定对象下的多条记录
179
+ * @param params 请求参数
180
+ * @returns 接口返回结果
181
+ */
182
+ records: (params: {
183
+ object_name: string;
184
+ records: any[];
185
+ }) => Promise<any>;
186
+ /**
187
+ * 批量更新 - 支持超过 100 条数据,自动拆分
188
+ * @description 更新指定对象下的多条记录,超过 100 条数据会自动拆分为多次请求
167
189
  * @param params 请求参数
168
190
  * @returns 所有子请求的返回结果数组
169
191
  */
170
- recordsBatchUpdate: (params: {
192
+ recordsWithIterator: (params: {
171
193
  object_name: string;
172
194
  records: any[];
173
195
  }) => Promise<any[]>;
@@ -175,6 +197,7 @@ declare class Client {
175
197
  delete: {
176
198
  /**
177
199
  * 单条删除
200
+ * @description 删除指定对象下的单条记录
178
201
  * @param params 请求参数
179
202
  * @returns 接口返回结果
180
203
  */
@@ -182,12 +205,23 @@ declare class Client {
182
205
  object_name: string;
183
206
  record_id: string;
184
207
  }) => Promise<any>;
208
+ /**
209
+ * 多条删除 - 最多传入 100 条
210
+ * @description 删除指定对象下的多条记录
211
+ * @param params 请求参数
212
+ * @returns 接口返回结果
213
+ */
214
+ records: (params: {
215
+ object_name: string;
216
+ ids: string[];
217
+ }) => Promise<any>;
185
218
  /**
186
219
  * 批量删除
220
+ * @description 删除指定对象下的多条记录,超过 100 条数据会自动拆分为多次请求
187
221
  * @param params 请求参数
188
222
  * @returns 所有子请求的返回结果数组
189
223
  */
190
- recordsBatchDelete: (params: {
224
+ recordsWithIterator: (params: {
191
225
  object_name: string;
192
226
  ids: string[];
193
227
  }) => Promise<any[]>;
package/dist/index.js CHANGED
@@ -62,6 +62,7 @@ class Client {
62
62
  metadata: {
63
63
  /**
64
64
  * 获取指定对象下指定字段的元数据
65
+ * @description 查询指定对象下的单个字段元数据
65
66
  * @param params 请求参数 { object_name, field_name }
66
67
  * @returns 接口返回结果
67
68
  */
@@ -79,6 +80,7 @@ class Client {
79
80
  },
80
81
  /**
81
82
  * 获取指定对象的所有字段信息
83
+ * @description 查询指定对象下的所有字段元数据
82
84
  * @param params 请求参数 { object_name }
83
85
  * @returns 接口返回结果
84
86
  */
@@ -98,6 +100,7 @@ class Client {
98
100
  search: {
99
101
  /**
100
102
  * 单条记录查询
103
+ * @description 查询指定对象下的单条记录
101
104
  * @param params 请求参数
102
105
  * @returns 接口返回结果
103
106
  */
@@ -115,7 +118,8 @@ class Client {
115
118
  return res;
116
119
  },
117
120
  /**
118
- * records_query 接口
121
+ * 多条记录查询 - 最多传入 100 条
122
+ * @description 查询指定对象下的多条记录
119
123
  * @param params 请求参数
120
124
  * @returns 接口返回结果
121
125
  */
@@ -133,7 +137,8 @@ class Client {
133
137
  return res.data;
134
138
  },
135
139
  /**
136
- * 分页查询所有记录
140
+ * 查询所有记录 - 支持超过 100 条数据,自动分页查询
141
+ * @description 该方法会自动处理分页,直到没有更多数据为止
137
142
  * @param params 请求参数
138
143
  * @returns { total, items }
139
144
  */
@@ -171,6 +176,7 @@ class Client {
171
176
  create: {
172
177
  /**
173
178
  * 单条记录创建
179
+ * @description 创建单条记录到指定对象中
174
180
  * @param params 请求参数 { object_name, record }
175
181
  * @returns 接口返回结果
176
182
  */
@@ -191,7 +197,8 @@ class Client {
191
197
  return res;
192
198
  },
193
199
  /**
194
- * 批量创建记录
200
+ * 批量创建记录 - 最多传入 100 条
201
+ * @description 创建多条记录到指定对象中
195
202
  * @param params 请求参数 { object_name, records }
196
203
  * @returns 接口返回结果
197
204
  */
@@ -208,7 +215,8 @@ class Client {
208
215
  return res.data;
209
216
  },
210
217
  /**
211
- * 分批创建所有记录
218
+ * 分批创建所有记录 - 支持超过 100 条数据,自动拆分
219
+ * @description 创建多条记录到指定对象中,超过 100 条数据会自动拆分为多次请求
212
220
  * @param params 请求参数 { object_name, records }
213
221
  * @returns { total, items }
214
222
  */
@@ -248,6 +256,7 @@ class Client {
248
256
  update: {
249
257
  /**
250
258
  * 单条更新
259
+ * @description 更新指定对象下的单条记录
251
260
  * @param params 请求参数
252
261
  * @returns 接口返回结果
253
262
  */
@@ -266,11 +275,28 @@ class Client {
266
275
  return res;
267
276
  },
268
277
  /**
269
- * 批量更新
278
+ * 多条更新 - 最多传入 100 条
279
+ * @description 更新指定对象下的多条记录
280
+ * @param params 请求参数
281
+ * @returns 接口返回结果
282
+ */
283
+ records: async (params) => {
284
+ const { object_name, records } = params;
285
+ const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records/records_batch`;
286
+ this.log(LoggerLevel.info, `[多条更新记录] 💾 开始更新 ${records.length} 条数据`);
287
+ const response = await this.axiosInstance.patch(url, { records }, { headers: { Authorization: `${this.accessToken}` } });
288
+ this.log(LoggerLevel.info, `[多条更新记录] 💾 更新 object_name=${object_name}, 调用完成`);
289
+ this.log(LoggerLevel.debug, `[多条更新记录] 💾 更新 object_name=${object_name}, 调用完成, 返回状态: ${response.data.code}`);
290
+ this.log(LoggerLevel.trace, `[多条更新记录] 💾 更新 object_name=${object_name}, 调用完成, 返回信息: ${JSON.stringify(response.data)}`);
291
+ return response.data;
292
+ },
293
+ /**
294
+ * 批量更新 - 支持超过 100 条数据,自动拆分
295
+ * @description 更新指定对象下的多条记录,超过 100 条数据会自动拆分为多次请求
270
296
  * @param params 请求参数
271
297
  * @returns 所有子请求的返回结果数组
272
298
  */
273
- recordsBatchUpdate: async (params) => {
299
+ recordsWithIterator: async (params) => {
274
300
  const { object_name, records } = params;
275
301
  const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records_batch`;
276
302
  const chunkSize = 100;
@@ -299,6 +325,7 @@ class Client {
299
325
  delete: {
300
326
  /**
301
327
  * 单条删除
328
+ * @description 删除指定对象下的单条记录
302
329
  * @param params 请求参数
303
330
  * @returns 接口返回结果
304
331
  */
@@ -316,12 +343,36 @@ class Client {
316
343
  });
317
344
  return res;
318
345
  },
346
+ /**
347
+ * 多条删除 - 最多传入 100 条
348
+ * @description 删除指定对象下的多条记录
349
+ * @param params 请求参数
350
+ * @returns 接口返回结果
351
+ */
352
+ records: async (params) => {
353
+ const { object_name, ids } = params;
354
+ const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records_batch`;
355
+ this.log(LoggerLevel.info, `[批量删除记录] 🗑️ 开始删除对象 ${object_name} 的 ${ids.length} 条记录`);
356
+ const res = await functionLimiter(async () => {
357
+ await this.ensureTokenValid();
358
+ const response = await this.axiosInstance.delete(url, {
359
+ data: { ids },
360
+ headers: { Authorization: `${this.accessToken}`, 'Content-Type': 'application/json' }
361
+ });
362
+ this.log(LoggerLevel.info, `[批量删除记录] 🗑️ 删除对象 ${object_name} 的 ${ids.length} 条记录记录, 调用完成`);
363
+ this.log(LoggerLevel.debug, `[批量删除记录] 🗑️ 删除对象 ${object_name} 的 ${ids.length} 条记录记录, 调用完成,返回状态: ${response.data.code}`);
364
+ this.log(LoggerLevel.trace, `[批量删除记录] 🗑️ 删除对象 ${object_name} 的 ${ids.length} 条记录记录, 调用完成,返回信息: ${JSON.stringify(response.data)}`);
365
+ return response.data;
366
+ });
367
+ return res;
368
+ },
319
369
  /**
320
370
  * 批量删除
371
+ * @description 删除指定对象下的多条记录,超过 100 条数据会自动拆分为多次请求
321
372
  * @param params 请求参数
322
373
  * @returns 所有子请求的返回结果数组
323
374
  */
324
- recordsBatchDelete: async (params) => {
375
+ recordsWithIterator: async (params) => {
325
376
  const { object_name, ids } = params;
326
377
  const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records_batch`;
327
378
  const chunkSize = 100;
@@ -523,6 +574,26 @@ class Client {
523
574
  get token() {
524
575
  return this.accessToken;
525
576
  }
577
+ /**
578
+ * 获取当前 token 剩余过期时间(单位:秒)
579
+ * @returns 剩余秒数,若无 token 则返回 null
580
+ */
581
+ get tokenExpireTime() {
582
+ if (!this.accessToken || !this.expireTime) {
583
+ this.log(LoggerLevel.warn, '[client] no valid token');
584
+ return null;
585
+ }
586
+ const now = dayjs().valueOf();
587
+ const remainMs = this.expireTime - now;
588
+ if (remainMs <= 0) {
589
+ this.log(LoggerLevel.warn, '[client] token expired');
590
+ return 0;
591
+ }
592
+ const remainSeconds = Math.floor(remainMs / 1000);
593
+ this.log(LoggerLevel.debug, `[client] token expire time: ${remainSeconds} seconds remaining`);
594
+ this.log(LoggerLevel.trace, `[client] token expire time: ${remainSeconds} seconds remaining, expireTime=${this.expireTime}, now=${now}`);
595
+ return remainSeconds;
596
+ }
526
597
  /**
527
598
  * 获取当前 namespace
528
599
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apaas-oapi-client",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
package/src/index.ts CHANGED
@@ -29,16 +29,6 @@ interface TokenResponse {
29
29
  msg: string;
30
30
  }
31
31
 
32
- /**
33
- * records_query 接口请求参数
34
- */
35
- interface RecordsQueryParams {
36
- /** 对象名称, 例如 object_store */
37
- object_name: string;
38
- /** 请求体数据 */
39
- data: any;
40
- }
41
-
42
32
  /**
43
33
  * aPaaS OpenAPI 客户端
44
34
  */
@@ -149,6 +139,30 @@ class Client {
149
139
  return this.accessToken;
150
140
  }
151
141
 
142
+ /**
143
+ * 获取当前 token 剩余过期时间(单位:秒)
144
+ * @returns 剩余秒数,若无 token 则返回 null
145
+ */
146
+ get tokenExpireTime() {
147
+ if (!this.accessToken || !this.expireTime) {
148
+ this.log(LoggerLevel.warn, '[client] no valid token');
149
+ return null;
150
+ }
151
+
152
+ const now = dayjs().valueOf();
153
+ const remainMs = this.expireTime - now;
154
+
155
+ if (remainMs <= 0) {
156
+ this.log(LoggerLevel.warn, '[client] token expired');
157
+ return 0;
158
+ }
159
+
160
+ const remainSeconds = Math.floor(remainMs / 1000);
161
+ this.log(LoggerLevel.debug, `[client] token expire time: ${remainSeconds} seconds remaining`);
162
+ this.log(LoggerLevel.trace, `[client] token expire time: ${remainSeconds} seconds remaining, expireTime=${this.expireTime}, now=${now}`);
163
+ return remainSeconds;
164
+ }
165
+
152
166
  /**
153
167
  * 获取当前 namespace
154
168
  */
@@ -164,6 +178,7 @@ class Client {
164
178
  metadata: {
165
179
  /**
166
180
  * 获取指定对象下指定字段的元数据
181
+ * @description 查询指定对象下的单个字段元数据
167
182
  * @param params 请求参数 { object_name, field_name }
168
183
  * @returns 接口返回结果
169
184
  */
@@ -185,6 +200,7 @@ class Client {
185
200
 
186
201
  /**
187
202
  * 获取指定对象的所有字段信息
203
+ * @description 查询指定对象下的所有字段元数据
188
204
  * @param params 请求参数 { object_name }
189
205
  * @returns 接口返回结果
190
206
  */
@@ -208,6 +224,7 @@ class Client {
208
224
  search: {
209
225
  /**
210
226
  * 单条记录查询
227
+ * @description 查询指定对象下的单条记录
211
228
  * @param params 请求参数
212
229
  * @returns 接口返回结果
213
230
  */
@@ -232,11 +249,12 @@ class Client {
232
249
  },
233
250
 
234
251
  /**
235
- * records_query 接口
252
+ * 多条记录查询 - 最多传入 100 条
253
+ * @description 查询指定对象下的多条记录
236
254
  * @param params 请求参数
237
255
  * @returns 接口返回结果
238
256
  */
239
- records: async (params: RecordsQueryParams): Promise<any> => {
257
+ records: async (params: { object_name: string; data: any }): Promise<any> => {
240
258
  const { object_name, data } = params;
241
259
  await this.ensureTokenValid();
242
260
 
@@ -253,11 +271,12 @@ class Client {
253
271
  },
254
272
 
255
273
  /**
256
- * 分页查询所有记录
274
+ * 查询所有记录 - 支持超过 100 条数据,自动分页查询
275
+ * @description 该方法会自动处理分页,直到没有更多数据为止
257
276
  * @param params 请求参数
258
277
  * @returns { total, items }
259
278
  */
260
- recordsWithIterator: async (params: RecordsQueryParams): Promise<{ total: number; items: any[] }> => {
279
+ recordsWithIterator: async (params: { object_name: string; data: any }): Promise<{ total: number; items: any[] }> => {
261
280
  const { object_name, data } = params;
262
281
 
263
282
  let results: any[] = [];
@@ -301,6 +320,7 @@ class Client {
301
320
  create: {
302
321
  /**
303
322
  * 单条记录创建
323
+ * @description 创建单条记录到指定对象中
304
324
  * @param params 请求参数 { object_name, record }
305
325
  * @returns 接口返回结果
306
326
  */
@@ -332,7 +352,8 @@ class Client {
332
352
  },
333
353
 
334
354
  /**
335
- * 批量创建记录
355
+ * 批量创建记录 - 最多传入 100 条
356
+ * @description 创建多条记录到指定对象中
336
357
  * @param params 请求参数 { object_name, records }
337
358
  * @returns 接口返回结果
338
359
  */
@@ -357,7 +378,8 @@ class Client {
357
378
  },
358
379
 
359
380
  /**
360
- * 分批创建所有记录
381
+ * 分批创建所有记录 - 支持超过 100 条数据,自动拆分
382
+ * @description 创建多条记录到指定对象中,超过 100 条数据会自动拆分为多次请求
361
383
  * @param params 请求参数 { object_name, records }
362
384
  * @returns { total, items }
363
385
  */
@@ -408,6 +430,7 @@ class Client {
408
430
  update: {
409
431
  /**
410
432
  * 单条更新
433
+ * @description 更新指定对象下的单条记录
411
434
  * @param params 请求参数
412
435
  * @returns 接口返回结果
413
436
  */
@@ -432,11 +455,33 @@ class Client {
432
455
  },
433
456
 
434
457
  /**
435
- * 批量更新
458
+ * 多条更新 - 最多传入 100 条
459
+ * @description 更新指定对象下的多条记录
460
+ * @param params 请求参数
461
+ * @returns 接口返回结果
462
+ */
463
+ records: async (params: { object_name: string; records: any[] }): Promise<any> => {
464
+ const { object_name, records } = params;
465
+ const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records/records_batch`;
466
+
467
+ this.log(LoggerLevel.info, `[多条更新记录] 💾 开始更新 ${records.length} 条数据`);
468
+
469
+ const response = await this.axiosInstance.patch(url, { records }, { headers: { Authorization: `${this.accessToken}` } });
470
+
471
+ this.log(LoggerLevel.info, `[多条更新记录] 💾 更新 object_name=${object_name}, 调用完成`);
472
+ this.log(LoggerLevel.debug, `[多条更新记录] 💾 更新 object_name=${object_name}, 调用完成, 返回状态: ${response.data.code}`);
473
+ this.log(LoggerLevel.trace, `[多条更新记录] 💾 更新 object_name=${object_name}, 调用完成, 返回信息: ${JSON.stringify(response.data)}`);
474
+
475
+ return response.data;
476
+ },
477
+
478
+ /**
479
+ * 批量更新 - 支持超过 100 条数据,自动拆分
480
+ * @description 更新指定对象下的多条记录,超过 100 条数据会自动拆分为多次请求
436
481
  * @param params 请求参数
437
482
  * @returns 所有子请求的返回结果数组
438
483
  */
439
- recordsBatchUpdate: async (params: { object_name: string; records: any[] }): Promise<any[]> => {
484
+ recordsWithIterator: async (params: { object_name: string; records: any[] }): Promise<any[]> => {
440
485
  const { object_name, records } = params;
441
486
  const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records_batch`;
442
487
 
@@ -474,6 +519,7 @@ class Client {
474
519
  delete: {
475
520
  /**
476
521
  * 单条删除
522
+ * @description 删除指定对象下的单条记录
477
523
  * @param params 请求参数
478
524
  * @returns 接口返回结果
479
525
  */
@@ -497,12 +543,43 @@ class Client {
497
543
  return res;
498
544
  },
499
545
 
546
+ /**
547
+ * 多条删除 - 最多传入 100 条
548
+ * @description 删除指定对象下的多条记录
549
+ * @param params 请求参数
550
+ * @returns 接口返回结果
551
+ */
552
+ records: async (params: { object_name: string; ids: string[] }): Promise<any> => {
553
+ const { object_name, ids } = params;
554
+ const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records_batch`;
555
+
556
+ this.log(LoggerLevel.info, `[批量删除记录] 🗑️ 开始删除对象 ${object_name} 的 ${ids.length} 条记录`);
557
+
558
+ const res = await functionLimiter(async () => {
559
+ await this.ensureTokenValid();
560
+
561
+ const response = await this.axiosInstance.delete(url, {
562
+ data: { ids },
563
+ headers: { Authorization: `${this.accessToken}`, 'Content-Type': 'application/json' }
564
+ });
565
+
566
+ this.log(LoggerLevel.info, `[批量删除记录] 🗑️ 删除对象 ${object_name} 的 ${ids.length} 条记录记录, 调用完成`);
567
+ this.log(LoggerLevel.debug, `[批量删除记录] 🗑️ 删除对象 ${object_name} 的 ${ids.length} 条记录记录, 调用完成,返回状态: ${response.data.code}`);
568
+ this.log(LoggerLevel.trace, `[批量删除记录] 🗑️ 删除对象 ${object_name} 的 ${ids.length} 条记录记录, 调用完成,返回信息: ${JSON.stringify(response.data)}`);
569
+
570
+ return response.data;
571
+ });
572
+
573
+ return res;
574
+ },
575
+
500
576
  /**
501
577
  * 批量删除
578
+ * @description 删除指定对象下的多条记录,超过 100 条数据会自动拆分为多次请求
502
579
  * @param params 请求参数
503
580
  * @returns 所有子请求的返回结果数组
504
581
  */
505
- recordsBatchDelete: async (params: { object_name: string; ids: string[] }): Promise<any[]> => {
582
+ recordsWithIterator: async (params: { object_name: string; ids: string[] }): Promise<any[]> => {
506
583
  const { object_name, ids } = params;
507
584
  const url = `/v1/data/namespaces/${this.namespace}/objects/${object_name}/records_batch`;
508
585