@cloudglab/yapi-cli 0.0.7 → 0.0.9

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +31 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.js +43 -5
  5. package/dist/cli.js.map +1 -1
  6. package/dist/core/changelog.js +7 -14
  7. package/dist/core/changelog.js.map +1 -1
  8. package/dist/core/cli-output.js +7 -6
  9. package/dist/core/cli-output.js.map +1 -1
  10. package/dist/core/cli-registry.js +61 -8
  11. package/dist/core/cli-registry.js.map +1 -1
  12. package/dist/core/manifest.js +14 -4
  13. package/dist/core/manifest.js.map +1 -1
  14. package/dist/core/output.d.ts +2 -2
  15. package/dist/core/output.js +12 -45
  16. package/dist/core/output.js.map +1 -1
  17. package/dist/core/tool-registry.js +5 -0
  18. package/dist/core/tool-registry.js.map +1 -1
  19. package/dist/core/update-probe.d.ts +3 -1
  20. package/dist/core/update-probe.js +9 -4
  21. package/dist/core/update-probe.js.map +1 -1
  22. package/dist/core/url-parser.js +10 -0
  23. package/dist/core/url-parser.js.map +1 -1
  24. package/dist/install.d.ts +9 -1
  25. package/dist/install.js +74 -20
  26. package/dist/install.js.map +1 -1
  27. package/dist/manifest.json +42 -1
  28. package/dist/services/yapi/api.d.ts +255 -79
  29. package/dist/services/yapi/api.js +162 -58
  30. package/dist/services/yapi/api.js.map +1 -1
  31. package/dist/services/yapi/auth.d.ts +8 -3
  32. package/dist/services/yapi/auth.js +10 -6
  33. package/dist/services/yapi/auth.js.map +1 -1
  34. package/dist/services/yapi/authCache.js +9 -2
  35. package/dist/services/yapi/authCache.js.map +1 -1
  36. package/dist/services/yapi/config.d.ts +6 -0
  37. package/dist/services/yapi/config.js +85 -8
  38. package/dist/services/yapi/config.js.map +1 -1
  39. package/dist/services/yapi/index.d.ts +3 -3
  40. package/dist/services/yapi/index.js +2 -3
  41. package/dist/services/yapi/index.js.map +1 -1
  42. package/dist/services/yapi/types.d.ts +38 -0
  43. package/dist/tools/shared.d.ts +17 -1
  44. package/dist/tools/shared.js +25 -6
  45. package/dist/tools/shared.js.map +1 -1
  46. package/dist/tools/yapi/docs-sync.js +3 -0
  47. package/dist/tools/yapi/docs-sync.js.map +1 -1
  48. package/dist/tools/yapi/groups.d.ts +1 -1
  49. package/dist/tools/yapi/groups.js +1 -1
  50. package/dist/tools/yapi/groups.js.map +1 -1
  51. package/dist/tools/yapi/register-auth.js +116 -104
  52. package/dist/tools/yapi/register-auth.js.map +1 -1
  53. package/dist/tools/yapi/register-group.js +118 -93
  54. package/dist/tools/yapi/register-group.js.map +1 -1
  55. package/dist/tools/yapi/register-interface.js +433 -199
  56. package/dist/tools/yapi/register-interface.js.map +1 -1
  57. package/dist/tools/yapi/register-mock.d.ts +2 -0
  58. package/dist/tools/yapi/register-mock.js +240 -0
  59. package/dist/tools/yapi/register-mock.js.map +1 -0
  60. package/dist/tools/yapi/register-project.js +344 -223
  61. package/dist/tools/yapi/register-project.js.map +1 -1
  62. package/dist/tools/yapi/register-test.js +33 -25
  63. package/dist/tools/yapi/register-test.js.map +1 -1
  64. package/dist/tools/yapi/register-util.js +444 -350
  65. package/dist/tools/yapi/register-util.js.map +1 -1
  66. package/dist/tools/yapi/register.js +3 -0
  67. package/dist/tools/yapi/register.js.map +1 -1
  68. package/dist/tools/yapi/utils.d.ts +49 -0
  69. package/dist/tools/yapi/utils.js +124 -2
  70. package/dist/tools/yapi/utils.js.map +1 -1
  71. package/dist/version.d.ts +1 -1
  72. package/dist/version.js +1 -1
  73. package/package.json +18 -5
  74. package/skills/yapi-cli/SKILL.md +37 -12
  75. package/skills/yapi-cli/reference/auth.md +34 -45
  76. package/skills/yapi-cli/reference/cheatsheet.md +156 -0
  77. package/skills/yapi-cli/reference/cli.md +43 -39
  78. package/skills/yapi-cli/reference/commands.md +35 -124
  79. package/skills/yapi-cli/reference/group.md +46 -19
  80. package/skills/yapi-cli/reference/index.md +32 -0
  81. package/skills/yapi-cli/reference/install.md +30 -6
  82. package/skills/yapi-cli/reference/interface.md +71 -145
  83. package/skills/yapi-cli/reference/mock.md +93 -0
  84. package/skills/yapi-cli/reference/overview.md +7 -5
  85. package/skills/yapi-cli/reference/project.md +67 -87
  86. package/skills/yapi-cli/reference/scenarios.md +184 -0
  87. package/skills/yapi-cli/reference/test.md +20 -17
  88. package/skills/yapi-cli/reference/tooling.md +89 -0
  89. package/dist/services/yapi/cache.d.ts +0 -27
  90. package/dist/services/yapi/cache.js +0 -88
  91. package/dist/services/yapi/cache.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { YApiResponse, ApiInterface, ProjectInfo, CategoryInfo, ApiSearchResultItem } from './types.js';
1
+ import type { YApiResponse, ApiInterface, ProjectInfo, CategoryInfo, ApiSearchResultItem, AdvancedMockScript, AdvancedMockCase } from './types.js';
2
2
  /**
3
3
  * PBKDF2 密码加密(YApi LDAP 模式用)。
4
4
  * YApi 服务端使用固定的 salt 和迭代次数。
@@ -10,16 +10,21 @@ export declare function encryptNativePassword(password: string, publicKey?: stri
10
10
  export declare class YApiError extends Error {
11
11
  readonly code?: string | undefined;
12
12
  readonly statusCode?: number | undefined;
13
- constructor(message: string, code?: string | undefined, statusCode?: number | undefined);
13
+ readonly responseBody?: unknown | undefined;
14
+ constructor(message: string, code?: string | undefined, statusCode?: number | undefined, responseBody?: unknown | undefined);
14
15
  }
15
16
  export declare class YApiAuthError extends YApiError {
16
- constructor(message?: string);
17
+ constructor(message?: string, responseBody?: unknown);
17
18
  }
18
19
  export declare class YApiNetworkError extends YApiError {
19
- constructor(cause: Error);
20
+ constructor(cause: Error, responseBody?: unknown);
20
21
  }
21
22
  export declare class YApiTimeoutError extends YApiError {
22
- constructor(url: string);
23
+ constructor(url: string, responseBody?: unknown);
24
+ }
25
+ /** Token 存储接口:401/402 重试时调用方提供以便清空本地 token。 */
26
+ export interface YApiTokenStore {
27
+ clearToken(): void;
23
28
  }
24
29
  /** YApi API 客户端 */
25
30
  export declare class YApiService {
@@ -30,7 +35,9 @@ export declare class YApiService {
30
35
  private readonly maxRetries;
31
36
  private requestId;
32
37
  private readonly getCache;
33
- constructor(serverUrl: string, getHeaders: () => Record<string, string>, getToken: () => string | undefined, timeoutMs?: number, maxRetries?: number);
38
+ /** 可选:401/402 重试时回调清空本地 token。 */
39
+ tokenStoreRef?: YApiTokenStore;
40
+ constructor(serverUrl: string, getHeaders: () => Record<string, string>, getToken: () => string | undefined, timeoutMs?: number, maxRetries?: number, tokenStoreRef?: YApiTokenStore);
34
41
  /**
35
42
  * 清空 GET 缓存。
36
43
  * 登录/登出/账号切换时调用,避免跨账号复用响应。
@@ -63,6 +70,11 @@ export declare class YApiService {
63
70
  uid: string;
64
71
  username: string;
65
72
  }>;
73
+ /**
74
+ * 登录类 POST 请求的统一发送入口。
75
+ * 复用 keepAlive dispatcher,并加超时控制,避免原生 fetch 在服务端无响应时无限挂起。
76
+ */
77
+ private postLoginRequest;
66
78
  private loginWithPasswordAttempt;
67
79
  private shouldRetryNativeWithRsa;
68
80
  /** LDAP 登录(密码已加密) */
@@ -121,33 +133,37 @@ export declare class YApiService {
121
133
  /** 创建分组 */
122
134
  groupAdd(data: {
123
135
  group_name: string;
124
- desc?: string;
136
+ group_desc?: string;
137
+ owner_uids?: number[];
125
138
  }): Promise<YApiResponse<{
126
139
  _id: number;
127
140
  }>>;
128
141
  /** 更新分组 */
129
142
  groupUp(data: {
130
- group_id: number;
143
+ id: number;
131
144
  group_name?: string;
132
- desc?: string;
145
+ group_desc?: string;
146
+ custom_field1?: string;
147
+ custom_field2?: string;
148
+ custom_field3?: string;
133
149
  }): Promise<YApiResponse<unknown>>;
134
150
  /** 删除分组 */
135
151
  groupDel(groupId: number): Promise<YApiResponse<unknown>>;
136
152
  /** 添加分组成员 */
137
153
  groupAddMember(data: {
138
154
  id: number;
139
- uid: number;
155
+ member_uids: number[];
140
156
  role?: string;
141
157
  }): Promise<YApiResponse<unknown>>;
142
158
  /** 修改分组成员角色 */
143
159
  groupChangeMemberRole(data: {
144
- group_id: number;
160
+ id: number;
145
161
  member_uid: number;
146
162
  role: string;
147
163
  }): Promise<YApiResponse<unknown>>;
148
164
  /** 删除分组成员 */
149
165
  groupDelMember(data: {
150
- group_id: number;
166
+ id: number;
151
167
  member_uid: number;
152
168
  }): Promise<YApiResponse<unknown>>;
153
169
  /** 获取项目列表 */
@@ -166,11 +182,22 @@ export declare class YApiService {
166
182
  name: string;
167
183
  basepath?: string;
168
184
  group_id: number;
185
+ group_name?: string;
169
186
  project_type?: string;
170
187
  desc?: string;
171
188
  icon?: string;
172
189
  color?: string;
173
190
  tag?: string[];
191
+ pre_script?: string;
192
+ after_script?: string;
193
+ env?: Array<{
194
+ name: string;
195
+ domain: string;
196
+ header?: Array<{
197
+ name: string;
198
+ value: string;
199
+ }>;
200
+ }>;
174
201
  }): Promise<YApiResponse<{
175
202
  _id: number;
176
203
  }>>;
@@ -179,25 +206,36 @@ export declare class YApiService {
179
206
  id: number;
180
207
  name?: string;
181
208
  basepath?: string;
209
+ group_id?: number;
182
210
  desc?: string;
183
211
  icon?: string;
184
212
  color?: string;
185
213
  tag?: string[];
214
+ pre_script?: string;
215
+ after_script?: string;
216
+ project_mock_script?: string;
186
217
  }): Promise<YApiResponse<ProjectInfo>>;
187
218
  /** 搜索项目 */
188
219
  searchProjects(query: string): Promise<YApiResponse<ProjectInfo[]>>;
189
220
  /** 更新项目环境 */
190
221
  updateProjectEnv(data: {
191
- project_id: number;
222
+ id: number;
192
223
  env: Array<{
193
224
  name: string;
194
225
  domain: string;
226
+ header?: Array<{
227
+ name: string;
228
+ value: string;
229
+ }>;
195
230
  }>;
196
231
  }): Promise<YApiResponse<unknown>>;
197
232
  /** 更新项目标签 */
198
233
  updateProjectTag(data: {
199
- project_id: number;
200
- tag: string[];
234
+ id: number;
235
+ tag: Array<{
236
+ name: string;
237
+ desc?: string;
238
+ }>;
201
239
  }): Promise<YApiResponse<unknown>>;
202
240
  /** 更新项目 Token(重新生成) */
203
241
  updateProjectToken(projectId: number): Promise<YApiResponse<{
@@ -206,15 +244,37 @@ export declare class YApiService {
206
244
  /** 检查项目名是否可用 */
207
245
  checkProjectName(name: string, groupId: number): Promise<YApiResponse<unknown>>;
208
246
  /** 复制项目 */
209
- copyProject(projectId: number, name?: string): Promise<YApiResponse<{
247
+ copyProject(data: {
248
+ _id: number;
249
+ name?: string;
250
+ group_id?: number;
251
+ group_name?: string;
252
+ basepath?: string;
253
+ desc?: string;
254
+ icon?: string;
255
+ color?: string;
256
+ project_type?: string;
257
+ pre_script?: string;
258
+ after_script?: string;
259
+ env?: Array<{
260
+ name: string;
261
+ domain: string;
262
+ }>;
263
+ cat?: Array<{
264
+ _id: number;
265
+ name?: string;
266
+ desc?: string;
267
+ }>;
268
+ preName?: string;
269
+ }): Promise<YApiResponse<{
210
270
  _id: number;
211
271
  }>>;
212
272
  /** 获取 Swagger URL */
213
- getProjectSwaggerUrl(projectId: number): Promise<YApiResponse<unknown>>;
273
+ getProjectSwaggerUrl(url: string): Promise<YApiResponse<unknown>>;
214
274
  /** 添加项目成员 */
215
275
  addProjectMember(data: {
216
- project_id: number;
217
- uid: number;
276
+ id: number;
277
+ member_uids: number[];
218
278
  role?: string;
219
279
  }): Promise<YApiResponse<unknown>>;
220
280
  /** 更新项目设置(upset 覆盖全部字段) */
@@ -223,20 +283,20 @@ export declare class YApiService {
223
283
  deleteProject(projectId: number): Promise<YApiResponse<unknown>>;
224
284
  /** 删除项目成员 */
225
285
  delProjectMember(data: {
226
- project_id: number;
227
- uid: number;
286
+ id: number;
287
+ member_uid: number;
228
288
  }): Promise<YApiResponse<unknown>>;
229
289
  /** 修改项目成员角色 */
230
290
  changeProjectMemberRole(data: {
231
- project_id: number;
291
+ id: number;
232
292
  member_uid: number;
233
293
  role: string;
234
294
  }): Promise<YApiResponse<unknown>>;
235
295
  /** 修改成员邮件通知 */
236
296
  changeProjectMemberEmailNotice(data: {
237
297
  project_id: number;
238
- uid: number;
239
- email_notice: boolean;
298
+ member_uid: number;
299
+ notice: boolean;
240
300
  }): Promise<YApiResponse<unknown>>;
241
301
  /** 获取分类(目录)列表 */
242
302
  listCategories(projectId: number): Promise<YApiResponse<CategoryInfo[]>>;
@@ -255,7 +315,6 @@ export declare class YApiService {
255
315
  catid: number;
256
316
  name?: string;
257
317
  desc?: string;
258
- status?: string;
259
318
  }): Promise<YApiResponse<unknown>>;
260
319
  /** 删除分类 */
261
320
  deleteCategory(catId: number): Promise<YApiResponse<unknown>>;
@@ -286,6 +345,9 @@ export declare class YApiService {
286
345
  status?: string;
287
346
  tag?: string[];
288
347
  desc?: string;
348
+ markdown?: string;
349
+ api_opened?: boolean;
350
+ custom_field_value?: string;
289
351
  req_query?: Array<{
290
352
  name: string;
291
353
  example?: string;
@@ -293,19 +355,36 @@ export declare class YApiService {
293
355
  required?: string;
294
356
  }>;
295
357
  req_headers?: Array<{
358
+ name: string;
359
+ value?: string;
360
+ example?: string;
361
+ desc?: string;
362
+ required?: string;
363
+ }>;
364
+ req_params?: Array<{
296
365
  name: string;
297
366
  example?: string;
298
367
  desc?: string;
299
368
  required?: string;
300
369
  }>;
301
370
  req_body_type?: string;
371
+ req_body_form?: Array<{
372
+ name: string;
373
+ type?: string;
374
+ example?: string;
375
+ desc?: string;
376
+ required?: string;
377
+ }>;
302
378
  req_body_other?: string;
379
+ req_body_is_json_schema?: boolean;
303
380
  res_body_type?: string;
304
381
  res_body?: string;
382
+ res_body_is_json_schema?: boolean;
305
383
  }): Promise<YApiResponse<ApiInterface>>;
306
384
  /** 更新接口 */
307
385
  updateInterface(data: {
308
386
  id: number;
387
+ project_id?: number;
309
388
  title?: string;
310
389
  path?: string;
311
390
  method?: string;
@@ -313,6 +392,11 @@ export declare class YApiService {
313
392
  status?: string;
314
393
  tag?: string[];
315
394
  desc?: string;
395
+ markdown?: string;
396
+ api_opened?: boolean;
397
+ custom_field_value?: string;
398
+ switch_notice?: boolean;
399
+ message?: string;
316
400
  req_query?: Array<{
317
401
  name: string;
318
402
  example?: string;
@@ -320,15 +404,31 @@ export declare class YApiService {
320
404
  required?: string;
321
405
  }>;
322
406
  req_headers?: Array<{
407
+ name: string;
408
+ value?: string;
409
+ example?: string;
410
+ desc?: string;
411
+ required?: string;
412
+ }>;
413
+ req_params?: Array<{
323
414
  name: string;
324
415
  example?: string;
325
416
  desc?: string;
326
417
  required?: string;
327
418
  }>;
328
419
  req_body_type?: string;
420
+ req_body_form?: Array<{
421
+ name: string;
422
+ type?: string;
423
+ example?: string;
424
+ desc?: string;
425
+ required?: string;
426
+ }>;
329
427
  req_body_other?: string;
428
+ req_body_is_json_schema?: boolean;
330
429
  res_body_type?: string;
331
430
  res_body?: string;
431
+ res_body_is_json_schema?: boolean;
332
432
  /** 是否开启 Mock */
333
433
  is_mock_open?: boolean;
334
434
  /** 自定义 Mock 脚本(沙箱执行) */
@@ -346,17 +446,52 @@ export declare class YApiService {
346
446
  saveInterface(data: {
347
447
  id?: number;
348
448
  project_id: number;
349
- title: string;
350
- path: string;
351
- method: string;
449
+ title?: string;
450
+ path?: string;
451
+ method?: string;
352
452
  catid?: number;
353
453
  status?: string;
354
454
  tag?: string[];
355
455
  desc?: string;
456
+ markdown?: string;
457
+ api_opened?: boolean;
458
+ custom_field_value?: string;
459
+ req_query?: Array<{
460
+ name: string;
461
+ example?: string;
462
+ desc?: string;
463
+ required?: string;
464
+ }>;
465
+ req_headers?: Array<{
466
+ name: string;
467
+ value?: string;
468
+ example?: string;
469
+ desc?: string;
470
+ required?: string;
471
+ }>;
472
+ req_params?: Array<{
473
+ name: string;
474
+ example?: string;
475
+ desc?: string;
476
+ required?: string;
477
+ }>;
356
478
  req_body_type?: string;
479
+ req_body_form?: Array<{
480
+ name: string;
481
+ type?: string;
482
+ example?: string;
483
+ desc?: string;
484
+ required?: string;
485
+ }>;
357
486
  req_body_other?: string;
487
+ req_body_is_json_schema?: boolean;
358
488
  res_body_type?: string;
359
489
  res_body?: string;
490
+ res_body_is_json_schema?: boolean;
491
+ is_mock_open?: boolean;
492
+ mock_custom_script?: string;
493
+ switch_notice?: boolean;
494
+ message?: string;
360
495
  }): Promise<YApiResponse<ApiInterface>>;
361
496
  /** 获取接口列表(公开项目) */
362
497
  listPublicInterfaces(params: {
@@ -369,7 +504,10 @@ export declare class YApiService {
369
504
  total: number;
370
505
  }>>;
371
506
  /** schema 转 JSON */
372
- schemaToJson(schema: string): Promise<YApiResponse<unknown>>;
507
+ schemaToJson(data: {
508
+ schema: string;
509
+ required?: boolean;
510
+ }): Promise<YApiResponse<unknown>>;
373
511
  /** 获取接口列表(菜单模式) */
374
512
  listInterfacesByMenu(projectId: number): Promise<YApiResponse<Array<{
375
513
  _id: number;
@@ -380,16 +518,16 @@ export declare class YApiService {
380
518
  }>>>;
381
519
  /** 获取自定义字段 */
382
520
  getCustomField(projectId: number): Promise<YApiResponse<unknown>>;
383
- /** 更新接口排序 */
384
- upInterfaceIndex(data: {
521
+ /** 更新接口排序(后端接收数组) */
522
+ upInterfaceIndex(items: Array<{
385
523
  id: number;
386
524
  index: number;
387
- }): Promise<YApiResponse<unknown>>;
388
- /** 更新分类排序 */
389
- upCatIndex(data: {
390
- catid: number;
525
+ }>): Promise<YApiResponse<unknown>>;
526
+ /** 更新分类排序(后端接收数组) */
527
+ upCatIndex(items: Array<{
528
+ id: number;
391
529
  index: number;
392
- }): Promise<YApiResponse<unknown>>;
530
+ }>): Promise<YApiResponse<unknown>>;
393
531
  /** 导入接口(swagger 等格式) */
394
532
  interUpload(data: {
395
533
  project_id: number;
@@ -397,7 +535,7 @@ export declare class YApiService {
397
535
  type: string;
398
536
  }): Promise<YApiResponse<unknown>>;
399
537
  /** 下载浏览器扩展 CRX */
400
- downloadCrx(): Promise<YApiResponse<any>>;
538
+ downloadCrx(): Promise<YApiResponse<unknown>>;
401
539
  /** 获取接口变更日志 */
402
540
  listInterfaceLogs(params: {
403
541
  type: string;
@@ -419,8 +557,12 @@ export declare class YApiService {
419
557
  /** 获取日志列表(按更新时间排序) */
420
558
  listLogsByUpdate(params: {
421
559
  type: string;
422
- apid: number;
560
+ typeid: number;
423
561
  limit?: number;
562
+ apis?: Array<{
563
+ method: string;
564
+ path: string;
565
+ }>;
424
566
  }): Promise<YApiResponse<Array<{
425
567
  _id: number;
426
568
  uid: number;
@@ -503,6 +645,7 @@ export declare class YApiService {
503
645
  }): Promise<YApiResponse<unknown>>;
504
646
  /** 修改密码 */
505
647
  changePassword(data: {
648
+ uid?: number;
506
649
  old_password: string;
507
650
  new_password: string;
508
651
  }): Promise<YApiResponse<unknown>>;
@@ -537,7 +680,7 @@ export declare class YApiService {
537
680
  /** 上传头像 */
538
681
  uploadUserAvatar(data: {
539
682
  uid: number;
540
- base64: string;
683
+ basecode: string;
541
684
  }): Promise<YApiResponse<unknown>>;
542
685
  /** 获取项目测试集合列表 */
543
686
  listCollections(projectId: number): Promise<YApiResponse<Array<{
@@ -566,17 +709,11 @@ export declare class YApiService {
566
709
  }>>>;
567
710
  /** 添加测试用例 */
568
711
  addTestCase(data: {
712
+ project_id: number;
569
713
  col_id: number;
570
- case_type?: string;
571
- project_id?: number;
572
- req_url?: string;
573
- req_method?: string;
574
- req_params?: any[];
575
- req_query?: any[];
576
- req_headers?: any[];
577
- req_body_type?: string;
578
- req_body_form?: any[];
579
- req_body_other?: string;
714
+ interface_id: number;
715
+ casename: string;
716
+ case_env?: string;
580
717
  }): Promise<YApiResponse<{
581
718
  _id: number;
582
719
  }>>;
@@ -586,13 +723,13 @@ export declare class YApiService {
586
723
  case_type?: string;
587
724
  req_url?: string;
588
725
  req_method?: string;
589
- [key: string]: any;
726
+ [key: string]: unknown;
590
727
  }): Promise<YApiResponse<unknown>>;
591
728
  /** 获取测试用例详情 */
592
- getTestCase(caseId: number): Promise<YApiResponse<any>>;
729
+ getTestCase(caseId: number): Promise<YApiResponse<unknown>>;
593
730
  /** 更新测试集合 */
594
731
  updateCollection(data: {
595
- id: number;
732
+ col_id: number;
596
733
  name?: string;
597
734
  desc?: string;
598
735
  }): Promise<YApiResponse<unknown>>;
@@ -604,7 +741,7 @@ export declare class YApiService {
604
741
  addTestCaseList(data: {
605
742
  col_id: number;
606
743
  project_id: number;
607
- case_list: any[];
744
+ case_list: unknown[];
608
745
  }): Promise<YApiResponse<{
609
746
  count: number;
610
747
  }>>;
@@ -619,12 +756,12 @@ export declare class YApiService {
619
756
  /** 运行测试用例脚本 */
620
757
  runTestCaseScript(data: {
621
758
  col_id: number;
622
- params?: any;
623
- }): Promise<YApiResponse<any>>;
759
+ params?: unknown;
760
+ }): Promise<YApiResponse<unknown>>;
624
761
  /** 获取测试用例环境变量列表 */
625
- getTestCaseEnvList(caseId: number): Promise<YApiResponse<any>>;
762
+ getTestCaseEnvList(colId: number): Promise<YApiResponse<unknown>>;
626
763
  /** 获取用例列表(支持变量参数) */
627
- getCaseListByVariableParams(colId: number): Promise<YApiResponse<any>>;
764
+ getCaseListByVariableParams(colId: number): Promise<YApiResponse<unknown>>;
628
765
  /** 更新用例排序 */
629
766
  upCaseIndex(data: {
630
767
  col_id: number;
@@ -636,21 +773,22 @@ export declare class YApiService {
636
773
  ids: number[];
637
774
  }): Promise<YApiResponse<unknown>>;
638
775
  /** 导出项目 JSON 格式 */
639
- exportProjectJson(projectId: number): Promise<any>;
776
+ exportProjectJson(projectId: number): Promise<unknown>;
640
777
  /** 导出项目 Swagger 格式 */
641
- exportProjectSwagger(projectId: number): Promise<any>;
778
+ exportProjectSwagger(projectId: number): Promise<unknown>;
642
779
  /** 导出项目 OpenAPI 3.0 格式 */
643
- exportProjectOpenAPI3(projectId: number): Promise<any>;
780
+ exportProjectOpenAPI3(projectId: number): Promise<unknown>;
781
+ /** 通过 yapi-plugin-export-data 插件导出项目数据(html / markdown / json) */
782
+ exportProjectData(projectId: number, type: 'html' | 'markdown' | 'json', status?: string): Promise<unknown>;
644
783
  /** 导入数据到项目 */
645
784
  importData(data: {
646
785
  project_id: number;
647
786
  type: string;
648
787
  content: string;
649
788
  merge: 'normal' | 'good' | 'merge';
650
- }): Promise<YApiResponse<any>>;
789
+ }): Promise<YApiResponse<unknown>>;
651
790
  /** 获取开放接口数据(Open API) */
652
- projectInterfaceData(params: {
653
- project_id: number;
791
+ projectInterfaceData(projectId: number, params?: {
654
792
  page?: number;
655
793
  limit?: number;
656
794
  keyword?: string;
@@ -660,24 +798,28 @@ export declare class YApiService {
660
798
  }>>;
661
799
  /** 运行自动测试(Open API) */
662
800
  runAutoTest(params: {
663
- pid: number;
664
- col_id: number;
665
- env_params_id?: number;
666
- }): Promise<YApiResponse<any>>;
801
+ id: number;
802
+ project_id: number;
803
+ token?: string;
804
+ mode?: 'html' | 'json';
805
+ email?: boolean;
806
+ download?: boolean;
807
+ env?: Record<string, string>;
808
+ }): Promise<YApiResponse<unknown>>;
667
809
  /** 测试 POST 请求 */
668
- testPost(url: string, body?: unknown): Promise<YApiResponse<any>>;
810
+ testPost(url: string, body?: unknown): Promise<YApiResponse<unknown>>;
669
811
  /** 测试 GET 请求 */
670
- testGet(url: string): Promise<YApiResponse<any>>;
812
+ testGet(url: string): Promise<YApiResponse<unknown>>;
671
813
  /** 测试 PUT 请求 */
672
- testPut(url: string, body?: unknown): Promise<YApiResponse<any>>;
814
+ testPut(url: string, body?: unknown): Promise<YApiResponse<unknown>>;
673
815
  /** 测试 DELETE 请求 */
674
- testDelete(url: string): Promise<YApiResponse<any>>;
816
+ testDelete(url: string): Promise<YApiResponse<unknown>>;
675
817
  /** 测试 HEAD 请求 */
676
- testHead(url: string): Promise<YApiResponse<any>>;
818
+ testHead(url: string): Promise<YApiResponse<unknown>>;
677
819
  /** 测试 OPTIONS 请求 */
678
- testOptions(url: string): Promise<YApiResponse<any>>;
820
+ testOptions(url: string): Promise<YApiResponse<unknown>>;
679
821
  /** 测试 PATCH 请求 */
680
- testPatch(url: string, body?: unknown): Promise<YApiResponse<any>>;
822
+ testPatch(url: string, body?: unknown): Promise<YApiResponse<unknown>>;
681
823
  /** 测试文件上传 */
682
824
  testFilesUpload(data: {
683
825
  url: string;
@@ -685,23 +827,57 @@ export declare class YApiService {
685
827
  name: string;
686
828
  path: string;
687
829
  }>;
688
- }): Promise<YApiResponse<any>>;
830
+ }): Promise<YApiResponse<unknown>>;
689
831
  /** 测试单文件上传 */
690
832
  testSingleUpload(data: {
691
833
  url: string;
692
834
  file: string;
693
- }): Promise<YApiResponse<any>>;
835
+ }): Promise<YApiResponse<unknown>>;
694
836
  /** 测试 HTTP 状态码 */
695
837
  testHttpCode(data: {
696
838
  url: string;
697
839
  code: number;
698
- }): Promise<YApiResponse<any>>;
840
+ }): Promise<YApiResponse<unknown>>;
699
841
  /** 测试原始请求 */
700
842
  testRaw(data: {
701
843
  url: string;
702
844
  raw: string;
703
845
  type?: string;
704
- }): Promise<YApiResponse<any>>;
846
+ }): Promise<YApiResponse<unknown>>;
705
847
  /** 获取测试响应 */
706
- testResponse(url: string): Promise<YApiResponse<any>>;
848
+ testResponse(url: string): Promise<YApiResponse<unknown>>;
849
+ /** 获取接口级高级 Mock 脚本 */
850
+ getAdvancedMockScript(interfaceId: number): Promise<YApiResponse<AdvancedMockScript | null>>;
851
+ /** 保存/更新接口级高级 Mock 脚本 */
852
+ saveAdvancedMockScript(data: {
853
+ interface_id: number;
854
+ project_id: number;
855
+ mock_script?: string;
856
+ enable?: boolean;
857
+ }): Promise<YApiResponse<AdvancedMockScript>>;
858
+ /** 获取接口下的 Mock 期望列表 */
859
+ listAdvancedMockCases(interfaceId: number): Promise<YApiResponse<AdvancedMockCase[]>>;
860
+ /** 获取单个 Mock 期望详情 */
861
+ getAdvancedMockCase(caseId: string): Promise<YApiResponse<AdvancedMockCase | null>>;
862
+ /** 保存/更新 Mock 期望 */
863
+ saveAdvancedMockCase(data: {
864
+ interface_id: number;
865
+ project_id: number;
866
+ name: string;
867
+ res_body: string;
868
+ params?: Record<string, unknown> | unknown[];
869
+ ip_enable?: boolean;
870
+ ip?: string;
871
+ code?: number;
872
+ delay?: number;
873
+ headers?: Array<{
874
+ name: string;
875
+ value: string;
876
+ }>;
877
+ id?: string;
878
+ }): Promise<YApiResponse<AdvancedMockCase>>;
879
+ /** 删除 Mock 期望 */
880
+ deleteAdvancedMockCase(caseId: string): Promise<YApiResponse<unknown>>;
881
+ /** 启用/禁用 Mock 期望 */
882
+ toggleAdvancedMockCase(caseId: string, enable: boolean): Promise<YApiResponse<unknown>>;
707
883
  }