@plolink/sdk 0.0.5 → 0.0.6

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 (56) hide show
  1. package/README.md +40 -26
  2. package/dist/{chunk-4H4RACSE.js → chunk-LHNCGCWW.js} +137 -3
  3. package/dist/chunk-LHNCGCWW.js.map +1 -0
  4. package/dist/{chunk-NS3DJP2O.cjs → chunk-WFBN23AH.cjs} +141 -2
  5. package/dist/chunk-WFBN23AH.cjs.map +1 -0
  6. package/dist/client-BuUQTr8R.d.cts +766 -0
  7. package/dist/client-D2HlV7GT.d.ts +766 -0
  8. package/dist/common/index.cjs +18 -14
  9. package/dist/common/index.d.cts +126 -1
  10. package/dist/common/index.d.ts +126 -1
  11. package/dist/common/index.js +1 -1
  12. package/dist/index.cjs +647 -13
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +410 -3
  15. package/dist/index.d.ts +410 -3
  16. package/dist/index.js +631 -3
  17. package/dist/index.js.map +1 -1
  18. package/dist/modules/billing/index.cjs +1 -1
  19. package/dist/modules/billing/index.d.cts +1 -1
  20. package/dist/modules/billing/index.d.ts +1 -1
  21. package/dist/modules/billing/index.js +1 -1
  22. package/dist/modules/rbac/index.d.cts +1 -1
  23. package/dist/modules/rbac/index.d.ts +1 -1
  24. package/dist/modules/team/index.d.cts +1 -1
  25. package/dist/modules/team/index.d.ts +1 -1
  26. package/dist/modules/video-psych-analysis/index.cjs +123 -4
  27. package/dist/modules/video-psych-analysis/index.cjs.map +1 -1
  28. package/dist/modules/video-psych-analysis/index.d.cts +231 -93
  29. package/dist/modules/video-psych-analysis/index.d.ts +231 -93
  30. package/dist/modules/video-psych-analysis/index.js +123 -4
  31. package/dist/modules/video-psych-analysis/index.js.map +1 -1
  32. package/dist/modules/virtual-account/index.d.cts +1 -1
  33. package/dist/modules/virtual-account/index.d.ts +1 -1
  34. package/package.json +1 -16
  35. package/dist/chunk-4H4RACSE.js.map +0 -1
  36. package/dist/chunk-NS3DJP2O.cjs.map +0 -1
  37. package/dist/client-CAjIQKPm.d.cts +0 -193
  38. package/dist/client-CwNikk7i.d.ts +0 -193
  39. package/dist/modules/agent/index.cjs +0 -21
  40. package/dist/modules/agent/index.cjs.map +0 -1
  41. package/dist/modules/agent/index.d.cts +0 -71
  42. package/dist/modules/agent/index.d.ts +0 -71
  43. package/dist/modules/agent/index.js +0 -19
  44. package/dist/modules/agent/index.js.map +0 -1
  45. package/dist/modules/chat/index.cjs +0 -20
  46. package/dist/modules/chat/index.cjs.map +0 -1
  47. package/dist/modules/chat/index.d.cts +0 -68
  48. package/dist/modules/chat/index.d.ts +0 -68
  49. package/dist/modules/chat/index.js +0 -18
  50. package/dist/modules/chat/index.js.map +0 -1
  51. package/dist/modules/psych/index.cjs +0 -20
  52. package/dist/modules/psych/index.cjs.map +0 -1
  53. package/dist/modules/psych/index.d.cts +0 -69
  54. package/dist/modules/psych/index.d.ts +0 -69
  55. package/dist/modules/psych/index.js +0 -18
  56. package/dist/modules/psych/index.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkNS3DJP2O_cjs = require('./chunk-NS3DJP2O.cjs');
4
- var chunkJR4HYYQI_cjs = require('./chunk-JR4HYYQI.cjs');
5
3
  var chunkY3UJVC2L_cjs = require('./chunk-Y3UJVC2L.cjs');
4
+ var chunkWFBN23AH_cjs = require('./chunk-WFBN23AH.cjs');
5
+ var chunkJR4HYYQI_cjs = require('./chunk-JR4HYYQI.cjs');
6
6
  var axios = require('axios');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -192,6 +192,370 @@ function createAxiosInstance(config, logger) {
192
192
  return instance;
193
193
  }
194
194
 
195
+ // src/modules/psychology-test/index.ts
196
+ var PsychologyTest = class {
197
+ constructor(client) {
198
+ this.client = client;
199
+ }
200
+ /**
201
+ * 发起心理评测
202
+ *
203
+ * @description
204
+ * 根据题组代码列表发起心理评测会话,系统会自动生成打乱后的题目列表并返回。
205
+ *
206
+ * @param params - 发起评测参数
207
+ * @returns 评测会话信息,包含会话ID和题目列表
208
+ * @throws {PlolinkError} 当参数验证失败或发起失败时抛出
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * const result = await client.psychologyTest.initiate({
213
+ * groupCodes: ['family_parenting', 'disc'],
214
+ * businessModule: 'talent_assessment',
215
+ * businessCode: 'job_match',
216
+ * businessId: 'clxxxx123456',
217
+ * needAnalysis: true,
218
+ * analysisPrompt: '请结合家庭养育方式和DISC行为模式,分析候选人的性格特点。'
219
+ * });
220
+ *
221
+ * console.log(`评测会话ID: ${result.sessionId}`);
222
+ * console.log(`共 ${result.totalCount} 道题目`);
223
+ * console.log('题组摘要:', result.groupSummary);
224
+ *
225
+ * // 展示题目
226
+ * result.questions.forEach((q, index) => {
227
+ * console.log(`题目 ${index + 1}: ${q.content}`);
228
+ * });
229
+ * ```
230
+ */
231
+ async initiate(params) {
232
+ this.client.logger.info("Initiating psychology test", {
233
+ groupCodes: params.groupCodes,
234
+ businessModule: params.businessModule,
235
+ businessCode: params.businessCode,
236
+ needAnalysis: params.needAnalysis
237
+ });
238
+ if (!params.groupCodes || params.groupCodes.length === 0) {
239
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
240
+ "groupCodes is required and cannot be empty",
241
+ "VALIDATION_ERROR"
242
+ );
243
+ }
244
+ if (!params.businessModule || !params.businessCode || !params.businessId) {
245
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
246
+ "businessModule, businessCode, and businessId are required",
247
+ "VALIDATION_ERROR"
248
+ );
249
+ }
250
+ if (params.needAnalysis && !params.analysisPrompt) {
251
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
252
+ "analysisPrompt is required when needAnalysis is true",
253
+ "VALIDATION_ERROR"
254
+ );
255
+ }
256
+ try {
257
+ const response = await this.client.axiosInstance.post(
258
+ "/api/v1/psychology/test-sessions/initiate",
259
+ params
260
+ );
261
+ this.client.logger.info("Psychology test initiated successfully", {
262
+ sessionId: response.sessionId,
263
+ totalCount: response.totalCount
264
+ });
265
+ return response;
266
+ } catch (error) {
267
+ this.client.logger.error("Failed to initiate psychology test", { error });
268
+ throw error;
269
+ }
270
+ }
271
+ /**
272
+ * 提交心理评测
273
+ *
274
+ * @description
275
+ * 提交心理评测答题数据,系统会自动计算得分并生成 Markdown 描述。
276
+ * 如需 AI 分析则会加入异步队列,分析完成后会通过 Webhook 通知。
277
+ *
278
+ * @param params - 提交评测参数
279
+ * @returns 提交结果,包含计算结果和得分描述
280
+ * @throws {PlolinkError} 当参数验证失败或提交失败时抛出
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const result = await client.psychologyTest.submit({
285
+ * sessionId: 'clxxxx789012',
286
+ * answers: [
287
+ * {
288
+ * groupCode: 'family_parenting',
289
+ * bankId: 'bank_123',
290
+ * questionId: 'q_001',
291
+ * questionCode: 'FP001A',
292
+ * answer: '1',
293
+ * timeSpent: 3500
294
+ * },
295
+ * // ... 更多答题记录
296
+ * ],
297
+ * duration: 480000
298
+ * });
299
+ *
300
+ * console.log('得分描述:', result.scoreDescription);
301
+ * console.log('计算结果:', result.calculationResults);
302
+ * ```
303
+ */
304
+ async submit(params) {
305
+ this.client.logger.info("Submitting psychology test", {
306
+ sessionId: params.sessionId,
307
+ answersCount: params.answers.length
308
+ });
309
+ if (!params.sessionId) {
310
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
311
+ "sessionId is required",
312
+ "VALIDATION_ERROR"
313
+ );
314
+ }
315
+ if (!params.answers || params.answers.length === 0) {
316
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
317
+ "answers is required and cannot be empty",
318
+ "VALIDATION_ERROR"
319
+ );
320
+ }
321
+ try {
322
+ const response = await this.client.axiosInstance.post(
323
+ "/api/v1/psychology/test-sessions/submit",
324
+ params
325
+ );
326
+ this.client.logger.info("Psychology test submitted successfully", {
327
+ sessionId: response.sessionId
328
+ });
329
+ return response;
330
+ } catch (error) {
331
+ this.client.logger.error("Failed to submit psychology test", { error });
332
+ throw error;
333
+ }
334
+ }
335
+ /**
336
+ * 获取心理评测详情
337
+ *
338
+ * @description
339
+ * 获取心理评测会话的完整信息,包括基本信息、计算结果、得分描述、AI分析结果等。
340
+ *
341
+ * @param sessionId - 评测会话ID
342
+ * @returns 评测会话详情
343
+ * @throws {PlolinkError} 当会话不存在或查询失败时抛出
344
+ *
345
+ * @example
346
+ * ```typescript
347
+ * const detail = await client.psychologyTest.getDetail('clxxxx789012');
348
+ *
349
+ * console.log('评测状态:', detail.status);
350
+ * console.log('得分描述:', detail.scoreDescription);
351
+ *
352
+ * // 检查分析状态
353
+ * if (detail.analysisStatus === 'COMPLETED') {
354
+ * console.log('AI分析结果:', detail.analysisResult);
355
+ * } else if (detail.analysisStatus === 'ANALYZING') {
356
+ * console.log('AI分析进行中,请稍后查询');
357
+ * } else if (detail.analysisStatus === 'FAILED') {
358
+ * console.error('分析失败:', detail.analysisError);
359
+ * }
360
+ * ```
361
+ */
362
+ async getDetail(sessionId) {
363
+ this.client.logger.info("Getting psychology test detail", { sessionId });
364
+ if (!sessionId) {
365
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
366
+ "sessionId is required",
367
+ "VALIDATION_ERROR"
368
+ );
369
+ }
370
+ try {
371
+ const response = await this.client.axiosInstance.get(
372
+ `/api/v1/psychology/test-sessions/${sessionId}`
373
+ );
374
+ this.client.logger.info("Psychology test detail retrieved successfully", {
375
+ sessionId,
376
+ status: response.status,
377
+ analysisStatus: response.analysisStatus
378
+ });
379
+ return response;
380
+ } catch (error) {
381
+ this.client.logger.error("Failed to get psychology test detail", { error });
382
+ throw error;
383
+ }
384
+ }
385
+ /**
386
+ * 获取心理评测答题记录
387
+ *
388
+ * @description
389
+ * 获取心理评测会话的所有答题记录。
390
+ *
391
+ * @param sessionId - 评测会话ID
392
+ * @returns 答题记录列表
393
+ * @throws {PlolinkError} 当会话不存在或查询失败时抛出
394
+ *
395
+ * @example
396
+ * ```typescript
397
+ * const answers = await client.psychologyTest.getAnswers('clxxxx789012');
398
+ *
399
+ * console.log(`共 ${answers.length} 条答题记录`);
400
+ * answers.forEach(answer => {
401
+ * console.log(`题目 ${answer.questionCode}: ${answer.answer}`);
402
+ * });
403
+ * ```
404
+ */
405
+ async getAnswers(sessionId) {
406
+ this.client.logger.info("Getting psychology test answers", { sessionId });
407
+ if (!sessionId) {
408
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
409
+ "sessionId is required",
410
+ "VALIDATION_ERROR"
411
+ );
412
+ }
413
+ try {
414
+ const response = await this.client.axiosInstance.get(
415
+ `/api/v1/psychology/test-sessions/${sessionId}/answers`
416
+ );
417
+ this.client.logger.info("Psychology test answers retrieved successfully", {
418
+ sessionId,
419
+ count: response.length
420
+ });
421
+ return response;
422
+ } catch (error) {
423
+ this.client.logger.error("Failed to get psychology test answers", { error });
424
+ throw error;
425
+ }
426
+ }
427
+ /**
428
+ * 列表查询心理评测会话
429
+ *
430
+ * @description
431
+ * 查询心理评测会话列表,支持分页和多条件筛选。
432
+ * 此接口通常用于管理后台或业务系统查询评测记录。
433
+ *
434
+ * @param params - 查询参数
435
+ * @returns 会话列表和分页信息
436
+ * @throws {PlolinkError} 当查询失败时抛出
437
+ *
438
+ * @example
439
+ * ```typescript
440
+ * // 查询所有评测会话
441
+ * const result = await client.psychologyTest.listTestSessions({
442
+ * page: 1,
443
+ * size: 20
444
+ * });
445
+ *
446
+ * console.log(`共 ${result.total} 条记录`);
447
+ * result.list.forEach(session => {
448
+ * console.log(`会话ID: ${session.id}, 状态: ${session.status}`);
449
+ * });
450
+ *
451
+ * // 按条件筛选
452
+ * const filtered = await client.psychologyTest.listTestSessions({
453
+ * page: 1,
454
+ * size: 20,
455
+ * businessModule: 'talent_assessment',
456
+ * status: 'COMPLETED',
457
+ * analysisStatus: 'COMPLETED'
458
+ * });
459
+ * ```
460
+ */
461
+ async listTestSessions(params = {}) {
462
+ this.client.logger.info("Listing psychology test sessions", { params });
463
+ try {
464
+ const queryParams = new URLSearchParams();
465
+ if (params.page !== void 0) queryParams.append("page", String(params.page));
466
+ if (params.size !== void 0) queryParams.append("size", String(params.size));
467
+ if (params.businessModule) queryParams.append("businessModule", params.businessModule);
468
+ if (params.businessCode) queryParams.append("businessCode", params.businessCode);
469
+ if (params.status) queryParams.append("status", params.status);
470
+ if (params.analysisStatus) queryParams.append("analysisStatus", params.analysisStatus);
471
+ if (params.startDate) queryParams.append("startDate", params.startDate);
472
+ if (params.endDate) queryParams.append("endDate", params.endDate);
473
+ if (params.teamId) queryParams.append("teamId", params.teamId);
474
+ const url = `/api/admin/psychology/test-sessions${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
475
+ const response = await this.client.axiosInstance.get(url);
476
+ this.client.logger.info("Psychology test sessions listed successfully", {
477
+ total: response.total,
478
+ count: response.list.length
479
+ });
480
+ return response;
481
+ } catch (error) {
482
+ this.client.logger.error("Failed to list psychology test sessions", { error });
483
+ throw error;
484
+ }
485
+ }
486
+ /**
487
+ * 删除心理评测会话
488
+ *
489
+ * @description
490
+ * 软删除心理评测会话记录。删除后数据不会真正从数据库移除,
491
+ * 但在正常查询中不会显示。此接口通常用于管理后台。
492
+ *
493
+ * @param sessionId - 评测会话ID
494
+ * @returns void
495
+ * @throws {PlolinkError} 当会话不存在或删除失败时抛出
496
+ *
497
+ * @example
498
+ * ```typescript
499
+ * // 删除评测会话
500
+ * await client.psychologyTest.deleteTestSession('clxxxx789012');
501
+ * console.log('评测会话已删除');
502
+ * ```
503
+ */
504
+ async deleteTestSession(sessionId) {
505
+ this.client.logger.info("Deleting psychology test session", { sessionId });
506
+ if (!sessionId) {
507
+ throw new chunkY3UJVC2L_cjs.PlolinkError(
508
+ "sessionId is required",
509
+ "VALIDATION_ERROR"
510
+ );
511
+ }
512
+ try {
513
+ await this.client.axiosInstance.delete(
514
+ `/api/admin/psychology/test-sessions/${sessionId}`
515
+ );
516
+ this.client.logger.info("Psychology test session deleted successfully", {
517
+ sessionId
518
+ });
519
+ } catch (error) {
520
+ this.client.logger.error("Failed to delete psychology test session", { error });
521
+ throw error;
522
+ }
523
+ }
524
+ /**
525
+ * 获取题库组列表
526
+ *
527
+ * @description
528
+ * 获取所有启用状态的题库组列表,返回基本信息用于选择。
529
+ * 此接口不需要管理员权限,普通用户即可调用。
530
+ *
531
+ * @returns 题库组列表
532
+ * @throws {PlolinkError} 当查询失败时抛出
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * const groups = await client.psychologyTest.listBankGroups();
537
+ * groups.forEach(g => {
538
+ * console.log(`${g.name} (${g.code}): ${g.testObjective}`);
539
+ * });
540
+ * ```
541
+ */
542
+ async listBankGroups() {
543
+ this.client.logger.info("Listing psychology bank groups");
544
+ try {
545
+ const response = await this.client.axiosInstance.get(
546
+ "/api/v1/psychology/bank-groups"
547
+ );
548
+ this.client.logger.info("Psychology bank groups listed successfully", {
549
+ count: response.length
550
+ });
551
+ return response;
552
+ } catch (error) {
553
+ this.client.logger.error("Failed to list psychology bank groups", { error });
554
+ throw error;
555
+ }
556
+ }
557
+ };
558
+
195
559
  // src/core/client.ts
196
560
  var PlolinkClient = class {
197
561
  /**
@@ -226,6 +590,7 @@ var PlolinkClient = class {
226
590
  this.config,
227
591
  this.logger
228
592
  );
593
+ this.psychologyTest = new PsychologyTest(this);
229
594
  }
230
595
  /**
231
596
  * 验证 SDK 配置
@@ -296,6 +661,269 @@ var PlolinkClient = class {
296
661
  }
297
662
  };
298
663
 
664
+ // src/modules/info-sync/index.ts
665
+ var InfoSync = class {
666
+ constructor(client) {
667
+ this.client = client;
668
+ }
669
+ // ==================== Webhook 配置管理 ====================
670
+ /**
671
+ * 创建 Webhook 配置
672
+ *
673
+ * @description
674
+ * 为当前团队创建一个新的 Webhook 配置。
675
+ * 返回的 secretKey 仅在创建时返回一次,请立即保存。
676
+ *
677
+ * 每个团队最多可以创建 10 个 Webhook 配置。
678
+ *
679
+ * ⚠️ 重要: secretKey 仅在创建时返回,后续无法再次获取,请妥善保存
680
+ *
681
+ * @param params - 创建参数
682
+ * @returns 创建结果,包含配置 ID 和密钥
683
+ * @throws {PlolinkError} 当参数无效、配置数量超限或权限不足时抛出
684
+ *
685
+ * @example
686
+ * ```typescript
687
+ * const result = await infoSync.createWebhookConfig({
688
+ * name: 'Production Webhook',
689
+ * url: 'https://example.com/webhook/plolink',
690
+ * modules: ['report-writer', 'video-psych-analysis']
691
+ * });
692
+ *
693
+ * console.log(`配置 ID: ${result.id}`);
694
+ * console.log(`SecretKey: ${result.secretKey}`);
695
+ * // 请立即保存 secretKey,后续无法再次获取
696
+ * ```
697
+ */
698
+ async createWebhookConfig(params) {
699
+ if (!params.name || params.name.trim().length === 0) {
700
+ throw new chunkY3UJVC2L_cjs.PlolinkError("name is required and cannot be empty", "INVALID_PARAMS");
701
+ }
702
+ if (!params.url || params.url.trim().length === 0) {
703
+ throw new chunkY3UJVC2L_cjs.PlolinkError("url is required and cannot be empty", "INVALID_PARAMS");
704
+ }
705
+ if (!params.url.startsWith("http://") && !params.url.startsWith("https://")) {
706
+ throw new chunkY3UJVC2L_cjs.PlolinkError("url must start with http:// or https://", "INVALID_PARAMS");
707
+ }
708
+ if (!Array.isArray(params.modules)) {
709
+ throw new chunkY3UJVC2L_cjs.PlolinkError("modules must be an array", "INVALID_PARAMS");
710
+ }
711
+ return this.client.axiosInstance.post("/api/v1/info-sync/webhook-configs", params);
712
+ }
713
+ /**
714
+ * 获取 Webhook 配置列表
715
+ *
716
+ * @description
717
+ * 获取当前团队的所有 Webhook 配置。
718
+ * 注意:列表中不包含 secretKey。
719
+ *
720
+ * @returns Webhook 配置列表
721
+ * @throws {PlolinkError} 当权限不足时抛出
722
+ *
723
+ * @example
724
+ * ```typescript
725
+ * const configs = await infoSync.listWebhookConfigs();
726
+ * configs.forEach(config => {
727
+ * console.log(`${config.name}: ${config.url}`);
728
+ * console.log(`订阅模块: ${config.modules.join(', ')}`);
729
+ * console.log(`状态: ${config.enabled ? '启用' : '禁用'}`);
730
+ * });
731
+ * ```
732
+ */
733
+ async listWebhookConfigs() {
734
+ return this.client.axiosInstance.get("/api/v1/info-sync/webhook-configs");
735
+ }
736
+ /**
737
+ * 获取 Webhook 配置详情
738
+ *
739
+ * @description
740
+ * 获取指定 Webhook 配置的详细信息。
741
+ * 注意:不包含 secretKey。
742
+ *
743
+ * @param id - 配置 ID
744
+ * @returns Webhook 配置详情
745
+ * @throws {PlolinkError} 当配置不存在或权限不足时抛出
746
+ *
747
+ * @example
748
+ * ```typescript
749
+ * const config = await infoSync.getWebhookConfig('config-123');
750
+ * console.log(`名称: ${config.name}`);
751
+ * console.log(`URL: ${config.url}`);
752
+ * console.log(`订阅模块: ${config.modules.join(', ')}`);
753
+ * ```
754
+ */
755
+ async getWebhookConfig(id) {
756
+ if (!id) {
757
+ throw new chunkY3UJVC2L_cjs.PlolinkError("id is required", "INVALID_PARAMS");
758
+ }
759
+ return this.client.axiosInstance.get(`/api/v1/info-sync/webhook-configs/${id}`);
760
+ }
761
+ /**
762
+ * 更新 Webhook 配置
763
+ *
764
+ * @description
765
+ * 更新指定 Webhook 配置的信息。
766
+ * 注意:不能更新 secretKey,如需更换密钥请删除后重新创建。
767
+ *
768
+ * @param id - 配置 ID
769
+ * @param params - 更新参数
770
+ * @throws {PlolinkError} 当参数无效、配置不存在或权限不足时抛出
771
+ *
772
+ * @example
773
+ * ```typescript
774
+ * // 禁用配置
775
+ * await infoSync.updateWebhookConfig('config-123', {
776
+ * enabled: false
777
+ * });
778
+ *
779
+ * // 更新订阅模块
780
+ * await infoSync.updateWebhookConfig('config-123', {
781
+ * modules: ['report-writer']
782
+ * });
783
+ *
784
+ * // 更新 URL
785
+ * await infoSync.updateWebhookConfig('config-123', {
786
+ * url: 'https://new-url.example.com/webhook'
787
+ * });
788
+ * ```
789
+ */
790
+ async updateWebhookConfig(id, params) {
791
+ if (!id) {
792
+ throw new chunkY3UJVC2L_cjs.PlolinkError("id is required", "INVALID_PARAMS");
793
+ }
794
+ if (params.url && (!params.url.startsWith("http://") && !params.url.startsWith("https://"))) {
795
+ throw new chunkY3UJVC2L_cjs.PlolinkError("url must start with http:// or https://", "INVALID_PARAMS");
796
+ }
797
+ if (params.modules !== void 0 && !Array.isArray(params.modules)) {
798
+ throw new chunkY3UJVC2L_cjs.PlolinkError("modules must be an array", "INVALID_PARAMS");
799
+ }
800
+ await this.client.axiosInstance.put(`/api/v1/info-sync/webhook-configs/${id}`, params);
801
+ }
802
+ /**
803
+ * 删除 Webhook 配置
804
+ *
805
+ * @description
806
+ * 永久删除指定的 Webhook 配置(软删除)。
807
+ * 删除后该配置将不再接收 Webhook 通知。
808
+ *
809
+ * ⚠️ 警告: 此操作不可逆,请确认后再执行
810
+ *
811
+ * @param id - 配置 ID
812
+ * @throws {PlolinkError} 当配置不存在或权限不足时抛出
813
+ *
814
+ * @example
815
+ * ```typescript
816
+ * await infoSync.deleteWebhookConfig('config-123');
817
+ * console.log('Webhook 配置已删除');
818
+ * ```
819
+ */
820
+ async deleteWebhookConfig(id) {
821
+ if (!id) {
822
+ throw new chunkY3UJVC2L_cjs.PlolinkError("id is required", "INVALID_PARAMS");
823
+ }
824
+ await this.client.axiosInstance.delete(`/api/v1/info-sync/webhook-configs/${id}`);
825
+ }
826
+ // ==================== 同步记录查询 ====================
827
+ /**
828
+ * 查询同步记录列表
829
+ *
830
+ * @description
831
+ * 查询当前团队的同步记录,支持多种过滤条件和分页。
832
+ *
833
+ * @param params - 查询参数
834
+ * @returns 分页的同步记录列表
835
+ * @throws {PlolinkError} 当参数无效或权限不足时抛出
836
+ *
837
+ * @example
838
+ * ```typescript
839
+ * // 查询所有记录
840
+ * const result = await infoSync.listSyncRecords();
841
+ * console.log(`共 ${result.total} 条记录`);
842
+ *
843
+ * // 查询失败的 Webhook 同步记录
844
+ * const failed = await infoSync.listSyncRecords({
845
+ * type: 'WEBHOOK',
846
+ * status: 'FAILED'
847
+ * });
848
+ * console.log(`${failed.total} 条 Webhook 同步失败`);
849
+ *
850
+ * // 查询报告写作模块的记录
851
+ * const reports = await infoSync.listSyncRecords({
852
+ * businessModule: 'report-writer',
853
+ * page: 1,
854
+ * pageSize: 20
855
+ * });
856
+ * ```
857
+ */
858
+ async listSyncRecords(params) {
859
+ return this.client.axiosInstance.get("/api/v1/info-sync/sync-records", {
860
+ params: params || {}
861
+ });
862
+ }
863
+ /**
864
+ * 获取同步记录详情
865
+ *
866
+ * @description
867
+ * 获取指定同步记录的详细信息,包括完整的历史记录。
868
+ *
869
+ * @param id - 记录 ID
870
+ * @returns 同步记录详情
871
+ * @throws {PlolinkError} 当记录不存在或权限不足时抛出
872
+ *
873
+ * @example
874
+ * ```typescript
875
+ * const record = await infoSync.getSyncRecord('record-123');
876
+ * console.log(`业务模块: ${record.businessModule}`);
877
+ * console.log(`业务代码: ${record.businessCode}`);
878
+ * console.log(`状态: ${record.status}`);
879
+ * console.log(`历史记录:`);
880
+ * record.history.forEach(item => {
881
+ * console.log(` ${new Date(item.time).toLocaleString()}: ${item.status} - ${item.message || ''}`);
882
+ * });
883
+ * ```
884
+ */
885
+ async getSyncRecord(id) {
886
+ if (!id) {
887
+ throw new chunkY3UJVC2L_cjs.PlolinkError("id is required", "INVALID_PARAMS");
888
+ }
889
+ return this.client.axiosInstance.get(`/api/v1/info-sync/sync-records/${id}`);
890
+ }
891
+ /**
892
+ * 手动重试同步任务
893
+ *
894
+ * @description
895
+ * 手动重试失败的同步任务。
896
+ * 只能重试状态为 FAILED 的记录。
897
+ *
898
+ * 重试后记录状态将变为 PENDING,并重新提交到队列处理。
899
+ *
900
+ * @param id - 记录 ID
901
+ * @throws {PlolinkError} 当记录不存在、状态不是 FAILED 或权限不足时抛出
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * // 查询失败记录
906
+ * const failed = await infoSync.listSyncRecords({ status: 'FAILED' });
907
+ *
908
+ * // 重试所有失败记录
909
+ * for (const record of failed.list) {
910
+ * try {
911
+ * await infoSync.retrySyncRecord(record.id);
912
+ * console.log(`已重试: ${record.id}`);
913
+ * } catch (error) {
914
+ * console.error(`重试失败: ${record.id}`, error);
915
+ * }
916
+ * }
917
+ * ```
918
+ */
919
+ async retrySyncRecord(id) {
920
+ if (!id) {
921
+ throw new chunkY3UJVC2L_cjs.PlolinkError("id is required", "INVALID_PARAMS");
922
+ }
923
+ await this.client.axiosInstance.post(`/api/v1/info-sync/sync-records/${id}/retry`);
924
+ }
925
+ };
926
+
299
927
  // src/index.ts
300
928
  var VERSION = "1.0.0";
301
929
  var DEFAULT_CONFIG = {
@@ -306,45 +934,51 @@ var DEFAULT_CONFIG = {
306
934
  backoffFactor: 1.5
307
935
  };
308
936
 
937
+ Object.defineProperty(exports, "PlolinkError", {
938
+ enumerable: true,
939
+ get: function () { return chunkY3UJVC2L_cjs.PlolinkError; }
940
+ });
309
941
  Object.defineProperty(exports, "EventEmitter", {
310
942
  enumerable: true,
311
- get: function () { return chunkNS3DJP2O_cjs.EventEmitter; }
943
+ get: function () { return chunkWFBN23AH_cjs.EventEmitter; }
944
+ });
945
+ Object.defineProperty(exports, "InfoSyncSignature", {
946
+ enumerable: true,
947
+ get: function () { return chunkWFBN23AH_cjs.InfoSyncSignature; }
312
948
  });
313
949
  Object.defineProperty(exports, "TypedEventEmitter", {
314
950
  enumerable: true,
315
- get: function () { return chunkNS3DJP2O_cjs.TypedEventEmitter; }
951
+ get: function () { return chunkWFBN23AH_cjs.TypedEventEmitter; }
316
952
  });
317
953
  Object.defineProperty(exports, "environmentInfo", {
318
954
  enumerable: true,
319
- get: function () { return chunkNS3DJP2O_cjs.environmentInfo; }
955
+ get: function () { return chunkWFBN23AH_cjs.environmentInfo; }
320
956
  });
321
957
  Object.defineProperty(exports, "getEnvironment", {
322
958
  enumerable: true,
323
- get: function () { return chunkNS3DJP2O_cjs.getEnvironment; }
959
+ get: function () { return chunkWFBN23AH_cjs.getEnvironment; }
324
960
  });
325
961
  Object.defineProperty(exports, "isBrowser", {
326
962
  enumerable: true,
327
- get: function () { return chunkNS3DJP2O_cjs.isBrowser; }
963
+ get: function () { return chunkWFBN23AH_cjs.isBrowser; }
328
964
  });
329
965
  Object.defineProperty(exports, "isNode", {
330
966
  enumerable: true,
331
- get: function () { return chunkNS3DJP2O_cjs.isNode; }
967
+ get: function () { return chunkWFBN23AH_cjs.isNode; }
332
968
  });
333
969
  Object.defineProperty(exports, "isWebWorker", {
334
970
  enumerable: true,
335
- get: function () { return chunkNS3DJP2O_cjs.isWebWorker; }
971
+ get: function () { return chunkWFBN23AH_cjs.isWebWorker; }
336
972
  });
337
973
  Object.defineProperty(exports, "Poller", {
338
974
  enumerable: true,
339
975
  get: function () { return chunkJR4HYYQI_cjs.Poller; }
340
976
  });
341
- Object.defineProperty(exports, "PlolinkError", {
342
- enumerable: true,
343
- get: function () { return chunkY3UJVC2L_cjs.PlolinkError; }
344
- });
345
977
  exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
978
+ exports.InfoSync = InfoSync;
346
979
  exports.InternalLogger = InternalLogger;
347
980
  exports.PlolinkClient = PlolinkClient;
981
+ exports.PsychologyTest = PsychologyTest;
348
982
  exports.VERSION = VERSION;
349
983
  //# sourceMappingURL=index.cjs.map
350
984
  //# sourceMappingURL=index.cjs.map