@plolink/sdk 0.0.8 → 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 (58) hide show
  1. package/README.md +58 -4
  2. package/dist/{chunk-LHNCGCWW.js → chunk-4H4RACSE.js} +3 -137
  3. package/dist/chunk-4H4RACSE.js.map +1 -0
  4. package/dist/{chunk-WFBN23AH.cjs → chunk-NS3DJP2O.cjs} +2 -141
  5. package/dist/chunk-NS3DJP2O.cjs.map +1 -0
  6. package/dist/chunk-PJAJFV7D.js +139 -0
  7. package/dist/chunk-PJAJFV7D.js.map +1 -0
  8. package/dist/chunk-V6NFRYO2.cjs +145 -0
  9. package/dist/chunk-V6NFRYO2.cjs.map +1 -0
  10. package/dist/client-CAjIQKPm.d.cts +193 -0
  11. package/dist/client-CwNikk7i.d.ts +193 -0
  12. package/dist/common/index.cjs +19 -18
  13. package/dist/common/index.d.cts +2 -126
  14. package/dist/common/index.d.ts +2 -126
  15. package/dist/common/index.js +2 -1
  16. package/dist/index.cjs +18 -751
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +4 -410
  19. package/dist/index.d.ts +4 -410
  20. package/dist/index.js +4 -735
  21. package/dist/index.js.map +1 -1
  22. package/dist/modules/billing/index.cjs +1 -1
  23. package/dist/modules/billing/index.d.cts +1 -1
  24. package/dist/modules/billing/index.d.ts +1 -1
  25. package/dist/modules/billing/index.js +1 -1
  26. package/dist/modules/info-sync/index.cjs +275 -0
  27. package/dist/modules/info-sync/index.cjs.map +1 -0
  28. package/dist/modules/info-sync/index.d.cts +431 -0
  29. package/dist/modules/info-sync/index.d.ts +431 -0
  30. package/dist/modules/info-sync/index.js +269 -0
  31. package/dist/modules/info-sync/index.js.map +1 -0
  32. package/dist/modules/psychology-test/index.cjs +475 -0
  33. package/dist/modules/psychology-test/index.cjs.map +1 -0
  34. package/dist/{client-DXKAtLg1.d.ts → modules/psychology-test/index.d.cts} +32 -196
  35. package/dist/{client-l6cekf09.d.cts → modules/psychology-test/index.d.ts} +32 -196
  36. package/dist/modules/psychology-test/index.js +473 -0
  37. package/dist/modules/psychology-test/index.js.map +1 -0
  38. package/dist/modules/rbac/index.d.cts +1 -1
  39. package/dist/modules/rbac/index.d.ts +1 -1
  40. package/dist/modules/report-writer/index.cjs +282 -0
  41. package/dist/modules/report-writer/index.cjs.map +1 -0
  42. package/dist/modules/report-writer/index.d.cts +476 -0
  43. package/dist/modules/report-writer/index.d.ts +476 -0
  44. package/dist/modules/report-writer/index.js +280 -0
  45. package/dist/modules/report-writer/index.js.map +1 -0
  46. package/dist/modules/team/index.d.cts +1 -1
  47. package/dist/modules/team/index.d.ts +1 -1
  48. package/dist/modules/video-psych-analysis/index.cjs +1 -1
  49. package/dist/modules/video-psych-analysis/index.d.cts +1 -1
  50. package/dist/modules/video-psych-analysis/index.d.ts +1 -1
  51. package/dist/modules/video-psych-analysis/index.js +1 -1
  52. package/dist/modules/virtual-account/index.d.cts +1 -1
  53. package/dist/modules/virtual-account/index.d.ts +1 -1
  54. package/dist/signature-B5LL3Zij.d.cts +126 -0
  55. package/dist/signature-B5LL3Zij.d.ts +126 -0
  56. package/package.json +16 -1
  57. package/dist/chunk-LHNCGCWW.js.map +0 -1
  58. package/dist/chunk-WFBN23AH.cjs.map +0 -1
@@ -0,0 +1,473 @@
1
+ import { PlolinkError } from '../../chunk-MD4O7FWT.js';
2
+
3
+ // src/modules/psychology-test/index.ts
4
+ var PsychologyTest = class {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * 创建心理评测会话
10
+ *
11
+ * @description
12
+ * 创建心理评测会话记录(不返回题目)。
13
+ * 创建后需要调用 getSessionQuestions() 获取题目列表。
14
+ *
15
+ * @param params - 创建会话参数
16
+ * @returns 会话信息,包含会话ID
17
+ * @throws {PlolinkError} 当参数验证失败或创建失败时抛出
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // 1. 创建会话
22
+ * const { sessionId } = await client.psychologyTest.createTestSession({
23
+ * groupCodes: ['family_parenting', 'disc'],
24
+ * businessModule: 'talent_assessment',
25
+ * businessCode: 'job_match',
26
+ * businessId: 'clxxxx123456',
27
+ * needAnalysis: true,
28
+ * analysisPrompt: '请结合家庭养育方式和DISC行为模式,分析候选人的性格特点。'
29
+ * });
30
+ *
31
+ * console.log(`评测会话已创建: ${sessionId}`);
32
+ *
33
+ * // 2. 获取题目
34
+ * const questions = await client.psychologyTest.getSessionQuestions(sessionId);
35
+ * ```
36
+ */
37
+ async createTestSession(params) {
38
+ this.client.logger.info("Creating psychology test session", {
39
+ groupCodes: params.groupCodes,
40
+ businessModule: params.businessModule,
41
+ businessCode: params.businessCode,
42
+ needAnalysis: params.needAnalysis
43
+ });
44
+ if (!params.groupCodes || params.groupCodes.length === 0) {
45
+ throw new PlolinkError(
46
+ "groupCodes is required and cannot be empty",
47
+ "VALIDATION_ERROR"
48
+ );
49
+ }
50
+ if (!params.businessModule || !params.businessCode || !params.businessId) {
51
+ throw new PlolinkError(
52
+ "businessModule, businessCode, and businessId are required",
53
+ "VALIDATION_ERROR"
54
+ );
55
+ }
56
+ if (params.needAnalysis && !params.analysisPrompt) {
57
+ throw new PlolinkError(
58
+ "analysisPrompt is required when needAnalysis is true",
59
+ "VALIDATION_ERROR"
60
+ );
61
+ }
62
+ try {
63
+ const response = await this.client.axiosInstance.post(
64
+ "/api/v1/psychology/test-sessions",
65
+ params
66
+ );
67
+ this.client.logger.info("Psychology test session created successfully", {
68
+ sessionId: response.sessionId
69
+ });
70
+ return response;
71
+ } catch (error) {
72
+ this.client.logger.error("Failed to create psychology test session", { error });
73
+ throw error;
74
+ }
75
+ }
76
+ /**
77
+ * 获取会话题目
78
+ *
79
+ * @description
80
+ * 获取心理评测会话的题目列表(动态生成,每次调用都会重新打乱题目顺序)。
81
+ *
82
+ * @param sessionId - 评测会话ID
83
+ * @returns 题目列表和题组摘要
84
+ * @throws {PlolinkError} 当会话不存在或获取失败时抛出
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const questions = await client.psychologyTest.getSessionQuestions('clxxxx789012');
89
+ *
90
+ * console.log(`共 ${questions.totalCount} 道题目`);
91
+ * console.log('题组摘要:', questions.groupSummary);
92
+ *
93
+ * // 展示题目
94
+ * questions.questions.forEach((q, index) => {
95
+ * console.log(`题目 ${index + 1}: ${q.content}`);
96
+ * });
97
+ * ```
98
+ */
99
+ async getSessionQuestions(sessionId) {
100
+ this.client.logger.info("Getting session questions", { sessionId });
101
+ if (!sessionId) {
102
+ throw new PlolinkError("sessionId is required", "VALIDATION_ERROR");
103
+ }
104
+ try {
105
+ const response = await this.client.axiosInstance.get(
106
+ `/api/v1/psychology/test-sessions/${sessionId}/questions`
107
+ );
108
+ this.client.logger.info("Session questions retrieved successfully", {
109
+ sessionId,
110
+ totalCount: response.totalCount
111
+ });
112
+ return response;
113
+ } catch (error) {
114
+ this.client.logger.error("Failed to get session questions", { error, sessionId });
115
+ throw error;
116
+ }
117
+ }
118
+ /**
119
+ * 发起心理评测(已废弃)
120
+ *
121
+ * @deprecated 此方法已废弃,将在 v2.0 中移除。请使用 createTestSession() + getSessionQuestions() 替代。
122
+ *
123
+ * @description
124
+ * 根据题组代码列表发起心理评测会话,系统会自动生成打乱后的题目列表并返回。
125
+ *
126
+ * **迁移建议**:
127
+ * ```typescript
128
+ * // 旧方式(已废弃)
129
+ * const result = await client.psychologyTest.initiate(params);
130
+ *
131
+ * // 新方式(推荐)
132
+ * const { sessionId } = await client.psychologyTest.createTestSession(params);
133
+ * const result = await client.psychologyTest.getSessionQuestions(sessionId);
134
+ * ```
135
+ *
136
+ * @param params - 发起评测参数
137
+ * @returns 评测会话信息,包含会话ID和题目列表
138
+ * @throws {PlolinkError} 当参数验证失败或发起失败时抛出
139
+ */
140
+ async initiate(params) {
141
+ this.client.logger.warn("Using deprecated initiate() method. Please use createTestSession() + getSessionQuestions() instead.");
142
+ this.client.logger.info("Initiating psychology test (deprecated)", {
143
+ groupCodes: params.groupCodes,
144
+ businessModule: params.businessModule,
145
+ businessCode: params.businessCode,
146
+ needAnalysis: params.needAnalysis
147
+ });
148
+ if (!params.groupCodes || params.groupCodes.length === 0) {
149
+ throw new PlolinkError(
150
+ "groupCodes is required and cannot be empty",
151
+ "VALIDATION_ERROR"
152
+ );
153
+ }
154
+ if (!params.businessModule || !params.businessCode || !params.businessId) {
155
+ throw new PlolinkError(
156
+ "businessModule, businessCode, and businessId are required",
157
+ "VALIDATION_ERROR"
158
+ );
159
+ }
160
+ if (params.needAnalysis && !params.analysisPrompt) {
161
+ throw new PlolinkError(
162
+ "analysisPrompt is required when needAnalysis is true",
163
+ "VALIDATION_ERROR"
164
+ );
165
+ }
166
+ try {
167
+ const { sessionId } = await this.createTestSession(params);
168
+ const questionsData = await this.getSessionQuestions(sessionId);
169
+ const response = {
170
+ sessionId,
171
+ ...questionsData
172
+ };
173
+ this.client.logger.info("Psychology test initiated successfully (deprecated)", {
174
+ sessionId: response.sessionId,
175
+ totalCount: response.totalCount
176
+ });
177
+ return response;
178
+ } catch (error) {
179
+ this.client.logger.error("Failed to initiate psychology test", { error });
180
+ throw error;
181
+ }
182
+ }
183
+ /**
184
+ * 提交心理评测
185
+ *
186
+ * @description
187
+ * 提交心理评测答题数据,系统会自动计算得分并生成 Markdown 描述。
188
+ * 如需 AI 分析则会加入异步队列,分析完成后会通过 Webhook 通知。
189
+ *
190
+ * @param params - 提交评测参数
191
+ * @returns 提交结果,包含计算结果和得分描述
192
+ * @throws {PlolinkError} 当参数验证失败或提交失败时抛出
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * const result = await client.psychologyTest.submit({
197
+ * sessionId: 'clxxxx789012',
198
+ * answers: [
199
+ * {
200
+ * groupCode: 'family_parenting',
201
+ * bankId: 'bank_123',
202
+ * questionId: 'q_001',
203
+ * questionCode: 'FP001A',
204
+ * answer: '1',
205
+ * timeSpent: 3500
206
+ * },
207
+ * // ... 更多答题记录
208
+ * ],
209
+ * duration: 480000
210
+ * });
211
+ *
212
+ * console.log('得分描述:', result.scoreDescription);
213
+ * console.log('计算结果:', result.calculationResults);
214
+ * ```
215
+ */
216
+ async submit(params) {
217
+ this.client.logger.info("Submitting psychology test", {
218
+ sessionId: params.sessionId,
219
+ answersCount: params.answers.length
220
+ });
221
+ if (!params.sessionId) {
222
+ throw new PlolinkError(
223
+ "sessionId is required",
224
+ "VALIDATION_ERROR"
225
+ );
226
+ }
227
+ if (!params.answers || params.answers.length === 0) {
228
+ throw new PlolinkError(
229
+ "answers is required and cannot be empty",
230
+ "VALIDATION_ERROR"
231
+ );
232
+ }
233
+ try {
234
+ const response = await this.client.axiosInstance.post(
235
+ "/api/v1/psychology/test-sessions/submit",
236
+ params
237
+ );
238
+ this.client.logger.info("Psychology test submitted successfully", {
239
+ sessionId: response.sessionId
240
+ });
241
+ return response;
242
+ } catch (error) {
243
+ this.client.logger.error("Failed to submit psychology test", { error });
244
+ throw error;
245
+ }
246
+ }
247
+ /**
248
+ * 获取心理评测详情
249
+ *
250
+ * @description
251
+ * 获取心理评测会话的完整信息,包括基本信息、计算结果、得分描述、AI分析结果等。
252
+ *
253
+ * @param sessionId - 评测会话ID
254
+ * @returns 评测会话详情
255
+ * @throws {PlolinkError} 当会话不存在或查询失败时抛出
256
+ *
257
+ * @example
258
+ * ```typescript
259
+ * const detail = await client.psychologyTest.getDetail('clxxxx789012');
260
+ *
261
+ * console.log('评测状态:', detail.status);
262
+ * console.log('得分描述:', detail.scoreDescription);
263
+ *
264
+ * // 检查分析状态
265
+ * if (detail.analysisStatus === 'COMPLETED') {
266
+ * console.log('AI分析结果:', detail.analysisResult);
267
+ * } else if (detail.analysisStatus === 'ANALYZING') {
268
+ * console.log('AI分析进行中,请稍后查询');
269
+ * } else if (detail.analysisStatus === 'FAILED') {
270
+ * console.error('分析失败:', detail.analysisError);
271
+ * }
272
+ * ```
273
+ */
274
+ async getDetail(sessionId) {
275
+ this.client.logger.info("Getting psychology test detail", { sessionId });
276
+ if (!sessionId) {
277
+ throw new PlolinkError(
278
+ "sessionId is required",
279
+ "VALIDATION_ERROR"
280
+ );
281
+ }
282
+ try {
283
+ const response = await this.client.axiosInstance.get(
284
+ `/api/v1/psychology/test-sessions/${sessionId}`
285
+ );
286
+ this.client.logger.info("Psychology test detail retrieved successfully", {
287
+ sessionId,
288
+ status: response.status,
289
+ analysisStatus: response.analysisStatus
290
+ });
291
+ return response;
292
+ } catch (error) {
293
+ this.client.logger.error("Failed to get psychology test detail", { error });
294
+ throw error;
295
+ }
296
+ }
297
+ /**
298
+ * 获取心理评测答题记录
299
+ *
300
+ * @description
301
+ * 获取心理评测会话的所有答题记录。
302
+ *
303
+ * @param sessionId - 评测会话ID
304
+ * @returns 答题记录列表
305
+ * @throws {PlolinkError} 当会话不存在或查询失败时抛出
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * const answers = await client.psychologyTest.getAnswers('clxxxx789012');
310
+ *
311
+ * console.log(`共 ${answers.length} 条答题记录`);
312
+ * answers.forEach(answer => {
313
+ * console.log(`题目 ${answer.questionCode}: ${answer.answer}`);
314
+ * });
315
+ * ```
316
+ */
317
+ async getAnswers(sessionId) {
318
+ this.client.logger.info("Getting psychology test answers", { sessionId });
319
+ if (!sessionId) {
320
+ throw new PlolinkError(
321
+ "sessionId is required",
322
+ "VALIDATION_ERROR"
323
+ );
324
+ }
325
+ try {
326
+ const response = await this.client.axiosInstance.get(
327
+ `/api/v1/psychology/test-sessions/${sessionId}/answers`
328
+ );
329
+ this.client.logger.info("Psychology test answers retrieved successfully", {
330
+ sessionId,
331
+ count: response.length
332
+ });
333
+ return response;
334
+ } catch (error) {
335
+ this.client.logger.error("Failed to get psychology test answers", { error });
336
+ throw error;
337
+ }
338
+ }
339
+ /**
340
+ * 列表查询心理评测会话
341
+ *
342
+ * @description
343
+ * 查询心理评测会话列表,支持分页和多条件筛选。
344
+ * 此接口通常用于管理后台或业务系统查询评测记录。
345
+ *
346
+ * @param params - 查询参数
347
+ * @returns 会话列表和分页信息
348
+ * @throws {PlolinkError} 当查询失败时抛出
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * // 查询所有评测会话
353
+ * const result = await client.psychologyTest.listTestSessions({
354
+ * page: 1,
355
+ * size: 20
356
+ * });
357
+ *
358
+ * console.log(`共 ${result.total} 条记录`);
359
+ * result.list.forEach(session => {
360
+ * console.log(`会话ID: ${session.id}, 状态: ${session.status}`);
361
+ * });
362
+ *
363
+ * // 按条件筛选
364
+ * const filtered = await client.psychologyTest.listTestSessions({
365
+ * page: 1,
366
+ * size: 20,
367
+ * businessModule: 'talent_assessment',
368
+ * status: 'COMPLETED',
369
+ * analysisStatus: 'COMPLETED'
370
+ * });
371
+ * ```
372
+ */
373
+ async listTestSessions(params = {}) {
374
+ this.client.logger.info("Listing psychology test sessions", { params });
375
+ try {
376
+ const queryParams = new URLSearchParams();
377
+ if (params.page !== void 0) queryParams.append("page", String(params.page));
378
+ if (params.size !== void 0) queryParams.append("size", String(params.size));
379
+ if (params.businessModule) queryParams.append("businessModule", params.businessModule);
380
+ if (params.businessCode) queryParams.append("businessCode", params.businessCode);
381
+ if (params.status) queryParams.append("status", params.status);
382
+ if (params.analysisStatus) queryParams.append("analysisStatus", params.analysisStatus);
383
+ if (params.startDate) queryParams.append("startDate", params.startDate);
384
+ if (params.endDate) queryParams.append("endDate", params.endDate);
385
+ if (params.teamId) queryParams.append("teamId", params.teamId);
386
+ const url = `/api/admin/psychology/test-sessions${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
387
+ const response = await this.client.axiosInstance.get(url);
388
+ this.client.logger.info("Psychology test sessions listed successfully", {
389
+ total: response.total,
390
+ count: response.list.length
391
+ });
392
+ return response;
393
+ } catch (error) {
394
+ this.client.logger.error("Failed to list psychology test sessions", { error });
395
+ throw error;
396
+ }
397
+ }
398
+ /**
399
+ * 删除心理评测会话
400
+ *
401
+ * @description
402
+ * 软删除心理评测会话记录。删除后数据不会真正从数据库移除,
403
+ * 但在正常查询中不会显示。此接口通常用于管理后台。
404
+ *
405
+ * @param sessionId - 评测会话ID
406
+ * @returns void
407
+ * @throws {PlolinkError} 当会话不存在或删除失败时抛出
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * // 删除评测会话
412
+ * await client.psychologyTest.deleteTestSession('clxxxx789012');
413
+ * console.log('评测会话已删除');
414
+ * ```
415
+ */
416
+ async deleteTestSession(sessionId) {
417
+ this.client.logger.info("Deleting psychology test session", { sessionId });
418
+ if (!sessionId) {
419
+ throw new PlolinkError(
420
+ "sessionId is required",
421
+ "VALIDATION_ERROR"
422
+ );
423
+ }
424
+ try {
425
+ await this.client.axiosInstance.delete(
426
+ `/api/admin/psychology/test-sessions/${sessionId}`
427
+ );
428
+ this.client.logger.info("Psychology test session deleted successfully", {
429
+ sessionId
430
+ });
431
+ } catch (error) {
432
+ this.client.logger.error("Failed to delete psychology test session", { error });
433
+ throw error;
434
+ }
435
+ }
436
+ /**
437
+ * 获取题库组列表
438
+ *
439
+ * @description
440
+ * 获取所有启用状态的题库组列表,返回基本信息用于选择。
441
+ * 此接口不需要管理员权限,普通用户即可调用。
442
+ *
443
+ * @returns 题库组列表
444
+ * @throws {PlolinkError} 当查询失败时抛出
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const groups = await client.psychologyTest.listBankGroups();
449
+ * groups.forEach(g => {
450
+ * console.log(`${g.name} (${g.code}): ${g.testObjective}`);
451
+ * });
452
+ * ```
453
+ */
454
+ async listBankGroups() {
455
+ this.client.logger.info("Listing psychology bank groups");
456
+ try {
457
+ const response = await this.client.axiosInstance.get(
458
+ "/api/v1/psychology/bank-groups"
459
+ );
460
+ this.client.logger.info("Psychology bank groups listed successfully", {
461
+ count: response.length
462
+ });
463
+ return response;
464
+ } catch (error) {
465
+ this.client.logger.error("Failed to list psychology bank groups", { error });
466
+ throw error;
467
+ }
468
+ }
469
+ };
470
+
471
+ export { PsychologyTest };
472
+ //# sourceMappingURL=index.js.map
473
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"s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EA,MAAA,IAAA,CAAK,MAAA,CAAO,MAAA,CAAO,IAAA,CAAK,4CAAA,EAA8C;AAAA,QACpE,OAAO,QAAA,CAAS;AAAA,OACjB,CAAA;AAED,MAAA,OAAO,QAAA;AAAA,IACT,SAAS,KAAA,EAAO;AACd,MAAA,IAAA,CAAK,OAAO,MAAA,CAAO,KAAA,CAAM,uCAAA,EAAyC,EAAE,OAAO,CAAA;AAC3E,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF","file":"index.js","sourcesContent":["/**\n * 心理评测模块\n * \n * @description\n * 提供心理评测相关功能,包括:\n * - 发起心理评测会话\n * - 提交心理评测答题\n * - 获取评测详情和结果\n * - 获取答题记录\n * \n * @example\n * ```typescript\n * import { PlolinkClient } from '@plolink/sdk';\n * \n * const client = new PlolinkClient({\n * token: 'sk-your-api-key'\n * });\n * \n * // 发起心理评测\n * const initResult = await client.psychologyTest.initiate({\n * groupCodes: ['family_parenting', 'disc'],\n * businessModule: 'talent_assessment',\n * businessCode: 'job_match',\n * businessId: 'clxxxx123456',\n * needAnalysis: true,\n * analysisPrompt: '请结合家庭养育方式和DISC行为模式,分析候选人的性格特点。'\n * });\n * console.log(`评测会话已创建: ${initResult.sessionId}`);\n * console.log(`共 ${initResult.totalCount} 道题目`);\n * \n * // 用户答题...\n * const answers = initResult.questions.map(q => ({\n * groupCode: q.groupCode,\n * bankId: q.bankId,\n * questionId: q.questionId,\n * questionCode: q.questionCode,\n * answer: getUserAnswer(q), // 获取用户答案\n * timeSpent: getTimeSpent(q) // 获取答题时间\n * }));\n * \n * // 提交心理评测\n * const submitResult = await client.psychologyTest.submit({\n * sessionId: initResult.sessionId,\n * answers,\n * duration: 480000\n * });\n * console.log('得分描述:', submitResult.scoreDescription);\n * \n * // 查询评测详情\n * const detail = await client.psychologyTest.getDetail(initResult.sessionId);\n * if (detail.analysisStatus === 'COMPLETED') {\n * console.log('AI分析结果:', detail.analysisResult);\n * }\n * ```\n * \n * @module psychology-test\n */\n\nimport { PlolinkClient } from '../../core/client';\nimport { PlolinkError } from '../../core/error';\nimport type {\n CreatePsychologyTestSessionParams,\n CreatePsychologyTestSessionResponse,\n GetSessionQuestionsResponse,\n InitiatePsychologyTestParams,\n InitiatePsychologyTestResponse,\n SubmitPsychologyTestParams,\n SubmitPsychologyTestResponse,\n PsychologyTestDetail,\n PsychologyTestAnswerDetail,\n ListPsychologyTestSessionsParams,\n ListPsychologyTestSessionsResponse,\n PsychologyBankGroupSummary,\n} from '../../types/psychology-test';\n\nexport type {\n PsychologyTestStatus,\n PsychologyAnalysisStatus,\n QuestionType,\n QuestionDependency,\n QuestionOption,\n QuestionMetadata,\n QuestionInfo,\n GroupSummary,\n CreatePsychologyTestSessionParams,\n CreatePsychologyTestSessionResponse,\n GetSessionQuestionsResponse,\n InitiatePsychologyTestParams,\n InitiatePsychologyTestResponse,\n AnswerRecord,\n SubmitPsychologyTestParams,\n TestCalculationResult,\n SubmitPsychologyTestResponse,\n PsychologyTestAnswerDetail,\n PsychologyTestDetail,\n PsychologyTestWebhookData,\n ListPsychologyTestSessionsParams,\n ListPsychologyTestSessionsResponse,\n PsychologyBankGroupSummary,\n} from '../../types/psychology-test';\n\n/**\n * 心理评测模块\n */\nexport class PsychologyTest {\n private client: PlolinkClient;\n\n constructor(client: PlolinkClient) {\n this.client = client;\n }\n\n /**\n * 创建心理评测会话\n * \n * @description\n * 创建心理评测会话记录(不返回题目)。\n * 创建后需要调用 getSessionQuestions() 获取题目列表。\n * \n * @param params - 创建会话参数\n * @returns 会话信息,包含会话ID\n * @throws {PlolinkError} 当参数验证失败或创建失败时抛出\n * \n * @example\n * ```typescript\n * // 1. 创建会话\n * const { sessionId } = await client.psychologyTest.createTestSession({\n * groupCodes: ['family_parenting', 'disc'],\n * businessModule: 'talent_assessment',\n * businessCode: 'job_match',\n * businessId: 'clxxxx123456',\n * needAnalysis: true,\n * analysisPrompt: '请结合家庭养育方式和DISC行为模式,分析候选人的性格特点。'\n * });\n * \n * console.log(`评测会话已创建: ${sessionId}`);\n * \n * // 2. 获取题目\n * const questions = await client.psychologyTest.getSessionQuestions(sessionId);\n * ```\n */\n public async createTestSession(params: CreatePsychologyTestSessionParams): Promise<CreatePsychologyTestSessionResponse> {\n this.client.logger.info('Creating psychology test session', {\n groupCodes: params.groupCodes,\n businessModule: params.businessModule,\n businessCode: params.businessCode,\n needAnalysis: params.needAnalysis,\n });\n\n // 参数校验\n if (!params.groupCodes || params.groupCodes.length === 0) {\n throw new PlolinkError(\n 'groupCodes is required and cannot be empty',\n 'VALIDATION_ERROR'\n );\n }\n\n if (!params.businessModule || !params.businessCode || !params.businessId) {\n throw new PlolinkError(\n 'businessModule, businessCode, and businessId are required',\n 'VALIDATION_ERROR'\n );\n }\n\n if (params.needAnalysis && !params.analysisPrompt) {\n throw new PlolinkError(\n 'analysisPrompt is required when needAnalysis is true',\n 'VALIDATION_ERROR'\n );\n }\n\n try {\n const response = await this.client.axiosInstance.post<CreatePsychologyTestSessionResponse>(\n '/api/v1/psychology/test-sessions',\n params\n );\n\n this.client.logger.info('Psychology test session created successfully', {\n sessionId: response.sessionId,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to create psychology test session', { error });\n throw error;\n }\n }\n\n /**\n * 获取会话题目\n * \n * @description\n * 获取心理评测会话的题目列表(动态生成,每次调用都会重新打乱题目顺序)。\n * \n * @param sessionId - 评测会话ID\n * @returns 题目列表和题组摘要\n * @throws {PlolinkError} 当会话不存在或获取失败时抛出\n * \n * @example\n * ```typescript\n * const questions = await client.psychologyTest.getSessionQuestions('clxxxx789012');\n * \n * console.log(`共 ${questions.totalCount} 道题目`);\n * console.log('题组摘要:', questions.groupSummary);\n * \n * // 展示题目\n * questions.questions.forEach((q, index) => {\n * console.log(`题目 ${index + 1}: ${q.content}`);\n * });\n * ```\n */\n public async getSessionQuestions(sessionId: string): Promise<GetSessionQuestionsResponse> {\n this.client.logger.info('Getting session questions', { sessionId });\n\n if (!sessionId) {\n throw new PlolinkError('sessionId is required', 'VALIDATION_ERROR');\n }\n\n try {\n const response = await this.client.axiosInstance.get<GetSessionQuestionsResponse>(\n `/api/v1/psychology/test-sessions/${sessionId}/questions`\n );\n\n this.client.logger.info('Session questions retrieved successfully', {\n sessionId,\n totalCount: response.totalCount,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to get session questions', { error, sessionId });\n throw error;\n }\n }\n\n /**\n * 发起心理评测(已废弃)\n * \n * @deprecated 此方法已废弃,将在 v2.0 中移除。请使用 createTestSession() + getSessionQuestions() 替代。\n * \n * @description\n * 根据题组代码列表发起心理评测会话,系统会自动生成打乱后的题目列表并返回。\n * \n * **迁移建议**:\n * ```typescript\n * // 旧方式(已废弃)\n * const result = await client.psychologyTest.initiate(params);\n * \n * // 新方式(推荐)\n * const { sessionId } = await client.psychologyTest.createTestSession(params);\n * const result = await client.psychologyTest.getSessionQuestions(sessionId);\n * ```\n * \n * @param params - 发起评测参数\n * @returns 评测会话信息,包含会话ID和题目列表\n * @throws {PlolinkError} 当参数验证失败或发起失败时抛出\n */\n public async initiate(params: InitiatePsychologyTestParams): Promise<InitiatePsychologyTestResponse> {\n this.client.logger.warn('Using deprecated initiate() method. Please use createTestSession() + getSessionQuestions() instead.');\n \n this.client.logger.info('Initiating psychology test (deprecated)', {\n groupCodes: params.groupCodes,\n businessModule: params.businessModule,\n businessCode: params.businessCode,\n needAnalysis: params.needAnalysis,\n });\n\n // 参数校验\n if (!params.groupCodes || params.groupCodes.length === 0) {\n throw new PlolinkError(\n 'groupCodes is required and cannot be empty',\n 'VALIDATION_ERROR'\n );\n }\n\n if (!params.businessModule || !params.businessCode || !params.businessId) {\n throw new PlolinkError(\n 'businessModule, businessCode, and businessId are required',\n 'VALIDATION_ERROR'\n );\n }\n\n if (params.needAnalysis && !params.analysisPrompt) {\n throw new PlolinkError(\n 'analysisPrompt is required when needAnalysis is true',\n 'VALIDATION_ERROR'\n );\n }\n\n try {\n // 内部调用新方法实现兼容\n const { sessionId } = await this.createTestSession(params);\n const questionsData = await this.getSessionQuestions(sessionId);\n\n const response: InitiatePsychologyTestResponse = {\n sessionId,\n ...questionsData,\n };\n\n this.client.logger.info('Psychology test initiated successfully (deprecated)', {\n sessionId: response.sessionId,\n totalCount: response.totalCount,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to initiate psychology test', { error });\n throw error;\n }\n }\n\n /**\n * 提交心理评测\n * \n * @description\n * 提交心理评测答题数据,系统会自动计算得分并生成 Markdown 描述。\n * 如需 AI 分析则会加入异步队列,分析完成后会通过 Webhook 通知。\n * \n * @param params - 提交评测参数\n * @returns 提交结果,包含计算结果和得分描述\n * @throws {PlolinkError} 当参数验证失败或提交失败时抛出\n * \n * @example\n * ```typescript\n * const result = await client.psychologyTest.submit({\n * sessionId: 'clxxxx789012',\n * answers: [\n * {\n * groupCode: 'family_parenting',\n * bankId: 'bank_123',\n * questionId: 'q_001',\n * questionCode: 'FP001A',\n * answer: '1',\n * timeSpent: 3500\n * },\n * // ... 更多答题记录\n * ],\n * duration: 480000\n * });\n * \n * console.log('得分描述:', result.scoreDescription);\n * console.log('计算结果:', result.calculationResults);\n * ```\n */\n public async submit(params: SubmitPsychologyTestParams): Promise<SubmitPsychologyTestResponse> {\n this.client.logger.info('Submitting psychology test', {\n sessionId: params.sessionId,\n answersCount: params.answers.length,\n });\n\n // 参数校验\n if (!params.sessionId) {\n throw new PlolinkError(\n 'sessionId is required',\n 'VALIDATION_ERROR'\n );\n }\n\n if (!params.answers || params.answers.length === 0) {\n throw new PlolinkError(\n 'answers is required and cannot be empty',\n 'VALIDATION_ERROR'\n );\n }\n\n try {\n const response = await this.client.axiosInstance.post<SubmitPsychologyTestResponse>(\n '/api/v1/psychology/test-sessions/submit',\n params\n );\n\n this.client.logger.info('Psychology test submitted successfully', {\n sessionId: response.sessionId,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to submit psychology test', { error });\n throw error;\n }\n }\n\n /**\n * 获取心理评测详情\n * \n * @description\n * 获取心理评测会话的完整信息,包括基本信息、计算结果、得分描述、AI分析结果等。\n * \n * @param sessionId - 评测会话ID\n * @returns 评测会话详情\n * @throws {PlolinkError} 当会话不存在或查询失败时抛出\n * \n * @example\n * ```typescript\n * const detail = await client.psychologyTest.getDetail('clxxxx789012');\n * \n * console.log('评测状态:', detail.status);\n * console.log('得分描述:', detail.scoreDescription);\n * \n * // 检查分析状态\n * if (detail.analysisStatus === 'COMPLETED') {\n * console.log('AI分析结果:', detail.analysisResult);\n * } else if (detail.analysisStatus === 'ANALYZING') {\n * console.log('AI分析进行中,请稍后查询');\n * } else if (detail.analysisStatus === 'FAILED') {\n * console.error('分析失败:', detail.analysisError);\n * }\n * ```\n */\n public async getDetail(sessionId: string): Promise<PsychologyTestDetail> {\n this.client.logger.info('Getting psychology test detail', { sessionId });\n\n if (!sessionId) {\n throw new PlolinkError(\n 'sessionId is required',\n 'VALIDATION_ERROR'\n );\n }\n\n try {\n const response = await this.client.axiosInstance.get<PsychologyTestDetail>(\n `/api/v1/psychology/test-sessions/${sessionId}`\n );\n\n this.client.logger.info('Psychology test detail retrieved successfully', {\n sessionId,\n status: response.status,\n analysisStatus: response.analysisStatus,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to get psychology test detail', { error });\n throw error;\n }\n }\n\n /**\n * 获取心理评测答题记录\n * \n * @description\n * 获取心理评测会话的所有答题记录。\n * \n * @param sessionId - 评测会话ID\n * @returns 答题记录列表\n * @throws {PlolinkError} 当会话不存在或查询失败时抛出\n * \n * @example\n * ```typescript\n * const answers = await client.psychologyTest.getAnswers('clxxxx789012');\n * \n * console.log(`共 ${answers.length} 条答题记录`);\n * answers.forEach(answer => {\n * console.log(`题目 ${answer.questionCode}: ${answer.answer}`);\n * });\n * ```\n */\n public async getAnswers(sessionId: string): Promise<PsychologyTestAnswerDetail[]> {\n this.client.logger.info('Getting psychology test answers', { sessionId });\n\n if (!sessionId) {\n throw new PlolinkError(\n 'sessionId is required',\n 'VALIDATION_ERROR'\n );\n }\n\n try {\n const response = await this.client.axiosInstance.get<PsychologyTestAnswerDetail[]>(\n `/api/v1/psychology/test-sessions/${sessionId}/answers`\n );\n\n this.client.logger.info('Psychology test answers retrieved successfully', {\n sessionId,\n count: response.length,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to get psychology test answers', { error });\n throw error;\n }\n }\n\n /**\n * 列表查询心理评测会话\n * \n * @description\n * 查询心理评测会话列表,支持分页和多条件筛选。\n * 此接口通常用于管理后台或业务系统查询评测记录。\n * \n * @param params - 查询参数\n * @returns 会话列表和分页信息\n * @throws {PlolinkError} 当查询失败时抛出\n * \n * @example\n * ```typescript\n * // 查询所有评测会话\n * const result = await client.psychologyTest.listTestSessions({\n * page: 1,\n * size: 20\n * });\n * \n * console.log(`共 ${result.total} 条记录`);\n * result.list.forEach(session => {\n * console.log(`会话ID: ${session.id}, 状态: ${session.status}`);\n * });\n * \n * // 按条件筛选\n * const filtered = await client.psychologyTest.listTestSessions({\n * page: 1,\n * size: 20,\n * businessModule: 'talent_assessment',\n * status: 'COMPLETED',\n * analysisStatus: 'COMPLETED'\n * });\n * ```\n */\n public async listTestSessions(\n params: ListPsychologyTestSessionsParams = {}\n ): Promise<ListPsychologyTestSessionsResponse> {\n this.client.logger.info('Listing psychology test sessions', { params });\n\n try {\n // 构建查询参数\n const queryParams = new URLSearchParams();\n if (params.page !== undefined) queryParams.append('page', String(params.page));\n if (params.size !== undefined) queryParams.append('size', String(params.size));\n if (params.businessModule) queryParams.append('businessModule', params.businessModule);\n if (params.businessCode) queryParams.append('businessCode', params.businessCode);\n if (params.status) queryParams.append('status', params.status);\n if (params.analysisStatus) queryParams.append('analysisStatus', params.analysisStatus);\n if (params.startDate) queryParams.append('startDate', params.startDate);\n if (params.endDate) queryParams.append('endDate', params.endDate);\n if (params.teamId) queryParams.append('teamId', params.teamId);\n\n const url = `/api/admin/psychology/test-sessions${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;\n const response = await this.client.axiosInstance.get<ListPsychologyTestSessionsResponse>(url);\n\n this.client.logger.info('Psychology test sessions listed successfully', {\n total: response.total,\n count: response.list.length,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to list psychology test sessions', { error });\n throw error;\n }\n }\n\n /**\n * 删除心理评测会话\n * \n * @description\n * 软删除心理评测会话记录。删除后数据不会真正从数据库移除,\n * 但在正常查询中不会显示。此接口通常用于管理后台。\n * \n * @param sessionId - 评测会话ID\n * @returns void\n * @throws {PlolinkError} 当会话不存在或删除失败时抛出\n * \n * @example\n * ```typescript\n * // 删除评测会话\n * await client.psychologyTest.deleteTestSession('clxxxx789012');\n * console.log('评测会话已删除');\n * ```\n */\n public async deleteTestSession(sessionId: string): Promise<void> {\n this.client.logger.info('Deleting psychology test session', { sessionId });\n\n if (!sessionId) {\n throw new PlolinkError(\n 'sessionId is required',\n 'VALIDATION_ERROR'\n );\n }\n\n try {\n await this.client.axiosInstance.delete(\n `/api/admin/psychology/test-sessions/${sessionId}`\n );\n\n this.client.logger.info('Psychology test session deleted successfully', {\n sessionId,\n });\n } catch (error) {\n this.client.logger.error('Failed to delete psychology test session', { error });\n throw error;\n }\n }\n\n /**\n * 获取题库组列表\n * \n * @description\n * 获取所有启用状态的题库组列表,返回基本信息用于选择。\n * 此接口不需要管理员权限,普通用户即可调用。\n * \n * @returns 题库组列表\n * @throws {PlolinkError} 当查询失败时抛出\n * \n * @example\n * ```typescript\n * const groups = await client.psychologyTest.listBankGroups();\n * groups.forEach(g => {\n * console.log(`${g.name} (${g.code}): ${g.testObjective}`);\n * });\n * ```\n */\n public async listBankGroups(): Promise<PsychologyBankGroupSummary[]> {\n this.client.logger.info('Listing psychology bank groups');\n\n try {\n const response = await this.client.axiosInstance.get<PsychologyBankGroupSummary[]>(\n '/api/v1/psychology/bank-groups'\n );\n\n this.client.logger.info('Psychology bank groups listed successfully', {\n count: response.length,\n });\n\n return response;\n } catch (error) {\n this.client.logger.error('Failed to list psychology bank groups', { error });\n throw error;\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { P as PlolinkClient } from '../../client-l6cekf09.cjs';
1
+ import { P as PlolinkClient } from '../../client-CAjIQKPm.cjs';
2
2
  import { S as ScopeType, R as RoleType, A as AssignRoleParams } from '../../shared-6ZepUSPW.cjs';
3
3
  import '../../core-77EbLgbp.cjs';
4
4
  import 'axios';
@@ -1,4 +1,4 @@
1
- import { P as PlolinkClient } from '../../client-DXKAtLg1.js';
1
+ import { P as PlolinkClient } from '../../client-CwNikk7i.js';
2
2
  import { S as ScopeType, R as RoleType, A as AssignRoleParams } from '../../shared-6ZepUSPW.js';
3
3
  import '../../core-77EbLgbp.js';
4
4
  import 'axios';