@plolink/sdk 0.0.6 → 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.
- package/README.md +58 -4
- package/dist/{chunk-LHNCGCWW.js → chunk-4H4RACSE.js} +3 -137
- package/dist/chunk-4H4RACSE.js.map +1 -0
- package/dist/{chunk-WFBN23AH.cjs → chunk-NS3DJP2O.cjs} +2 -141
- package/dist/chunk-NS3DJP2O.cjs.map +1 -0
- package/dist/chunk-PJAJFV7D.js +139 -0
- package/dist/chunk-PJAJFV7D.js.map +1 -0
- package/dist/chunk-V6NFRYO2.cjs +145 -0
- package/dist/chunk-V6NFRYO2.cjs.map +1 -0
- package/dist/client-CAjIQKPm.d.cts +193 -0
- package/dist/client-CwNikk7i.d.ts +193 -0
- package/dist/common/index.cjs +19 -18
- package/dist/common/index.d.cts +2 -126
- package/dist/common/index.d.ts +2 -126
- package/dist/common/index.js +2 -1
- package/dist/index.cjs +18 -647
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -410
- package/dist/index.d.ts +4 -410
- package/dist/index.js +4 -631
- package/dist/index.js.map +1 -1
- package/dist/modules/billing/index.cjs +1 -1
- package/dist/modules/billing/index.d.cts +1 -1
- package/dist/modules/billing/index.d.ts +1 -1
- package/dist/modules/billing/index.js +1 -1
- package/dist/modules/info-sync/index.cjs +275 -0
- package/dist/modules/info-sync/index.cjs.map +1 -0
- package/dist/modules/info-sync/index.d.cts +431 -0
- package/dist/modules/info-sync/index.d.ts +431 -0
- package/dist/modules/info-sync/index.js +269 -0
- package/dist/modules/info-sync/index.js.map +1 -0
- package/dist/modules/psychology-test/index.cjs +475 -0
- package/dist/modules/psychology-test/index.cjs.map +1 -0
- package/dist/{client-D2HlV7GT.d.ts → modules/psychology-test/index.d.cts} +124 -206
- package/dist/{client-BuUQTr8R.d.cts → modules/psychology-test/index.d.ts} +124 -206
- package/dist/modules/psychology-test/index.js +473 -0
- package/dist/modules/psychology-test/index.js.map +1 -0
- package/dist/modules/rbac/index.d.cts +1 -1
- package/dist/modules/rbac/index.d.ts +1 -1
- package/dist/modules/report-writer/index.cjs +282 -0
- package/dist/modules/report-writer/index.cjs.map +1 -0
- package/dist/modules/report-writer/index.d.cts +476 -0
- package/dist/modules/report-writer/index.d.ts +476 -0
- package/dist/modules/report-writer/index.js +280 -0
- package/dist/modules/report-writer/index.js.map +1 -0
- package/dist/modules/team/index.d.cts +1 -1
- package/dist/modules/team/index.d.ts +1 -1
- package/dist/modules/video-psych-analysis/index.cjs +1 -1
- package/dist/modules/video-psych-analysis/index.d.cts +1 -1
- package/dist/modules/video-psych-analysis/index.d.ts +1 -1
- package/dist/modules/video-psych-analysis/index.js +1 -1
- package/dist/modules/virtual-account/index.d.cts +1 -1
- package/dist/modules/virtual-account/index.d.ts +1 -1
- package/dist/signature-B5LL3Zij.d.cts +126 -0
- package/dist/signature-B5LL3Zij.d.ts +126 -0
- package/package.json +16 -1
- package/dist/chunk-LHNCGCWW.js.map +0 -1
- package/dist/chunk-WFBN23AH.cjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { P as PlolinkClient } from '../../client-CAjIQKPm.cjs';
|
|
2
|
+
import '../../core-77EbLgbp.cjs';
|
|
3
|
+
import 'axios';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* 心理评测模块类型定义
|
|
@@ -108,8 +109,44 @@ interface GroupSummary {
|
|
|
108
109
|
/** 题目数量 */
|
|
109
110
|
questionCount: number;
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* 创建心理评测会话参数
|
|
114
|
+
*/
|
|
115
|
+
interface CreatePsychologyTestSessionParams {
|
|
116
|
+
/** 题组代码列表 */
|
|
117
|
+
groupCodes: string[];
|
|
118
|
+
/** 业务模块 */
|
|
119
|
+
businessModule: string;
|
|
120
|
+
/** 业务码 */
|
|
121
|
+
businessCode: string;
|
|
122
|
+
/** 业务ID */
|
|
123
|
+
businessId: string;
|
|
124
|
+
/** 是否需要AI分析 */
|
|
125
|
+
needAnalysis: boolean;
|
|
126
|
+
/** 分析提示词(needAnalysis为true时必填) */
|
|
127
|
+
analysisPrompt?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* 创建心理评测会话响应
|
|
131
|
+
*/
|
|
132
|
+
interface CreatePsychologyTestSessionResponse {
|
|
133
|
+
/** 评测会话ID */
|
|
134
|
+
sessionId: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 获取会话题目响应
|
|
138
|
+
*/
|
|
139
|
+
interface GetSessionQuestionsResponse {
|
|
140
|
+
/** 题目列表 */
|
|
141
|
+
questions: QuestionInfo[];
|
|
142
|
+
/** 总题数 */
|
|
143
|
+
totalCount: number;
|
|
144
|
+
/** 题组摘要(按题组代码分组) */
|
|
145
|
+
groupSummary: Record<string, GroupSummary>;
|
|
146
|
+
}
|
|
111
147
|
/**
|
|
112
148
|
* 发起心理评测参数
|
|
149
|
+
* @deprecated 请使用 CreatePsychologyTestSessionParams
|
|
113
150
|
*/
|
|
114
151
|
interface InitiatePsychologyTestParams {
|
|
115
152
|
/** 题组代码列表 */
|
|
@@ -127,6 +164,7 @@ interface InitiatePsychologyTestParams {
|
|
|
127
164
|
}
|
|
128
165
|
/**
|
|
129
166
|
* 发起心理评测响应
|
|
167
|
+
* @deprecated 请使用 CreatePsychologyTestSessionResponse + GetSessionQuestionsResponse
|
|
130
168
|
*/
|
|
131
169
|
interface InitiatePsychologyTestResponse {
|
|
132
170
|
/** 评测会话ID */
|
|
@@ -266,6 +304,34 @@ interface PsychologyTestDetail {
|
|
|
266
304
|
/** 删除时间(软删除) */
|
|
267
305
|
deletedAt: string | null;
|
|
268
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Webhook 通知数据结构
|
|
309
|
+
*/
|
|
310
|
+
interface PsychologyTestWebhookData {
|
|
311
|
+
/** 事件类型 */
|
|
312
|
+
event: 'psychology_test.analysis_completed';
|
|
313
|
+
/** 时间戳(毫秒) */
|
|
314
|
+
timestamp: number;
|
|
315
|
+
/** 事件数据 */
|
|
316
|
+
data: {
|
|
317
|
+
/** 评测会话ID */
|
|
318
|
+
sessionId: string;
|
|
319
|
+
/** 业务模块 */
|
|
320
|
+
businessModule: string;
|
|
321
|
+
/** 业务码 */
|
|
322
|
+
businessCode: string;
|
|
323
|
+
/** 业务ID */
|
|
324
|
+
businessId: string;
|
|
325
|
+
/** 评测状态 */
|
|
326
|
+
status: string;
|
|
327
|
+
/** 分析状态 */
|
|
328
|
+
analysisStatus: string;
|
|
329
|
+
/** AI分析结果 */
|
|
330
|
+
analysisResult?: string;
|
|
331
|
+
/** 完成时间 */
|
|
332
|
+
completedAt: string;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
269
335
|
/**
|
|
270
336
|
* 题库组简要信息
|
|
271
337
|
*/
|
|
@@ -316,107 +382,6 @@ interface ListPsychologyTestSessionsResponse {
|
|
|
316
382
|
size: number;
|
|
317
383
|
}
|
|
318
384
|
|
|
319
|
-
/**
|
|
320
|
-
* SDK 内部日志器
|
|
321
|
-
*
|
|
322
|
-
* @description
|
|
323
|
-
* 提供统一的日志接口,支持用户自定义日志钩子。
|
|
324
|
-
* 默认使用 console 输出,用户可以通过配置自定义 logger 函数来集成 Sentry 等监控系统。
|
|
325
|
-
*
|
|
326
|
-
* @example
|
|
327
|
-
* ```typescript
|
|
328
|
-
* const logger = new InternalLogger((level, message, data) => {
|
|
329
|
-
* // 自定义日志处理,例如发送到 Sentry
|
|
330
|
-
* console.log(`[${level}] ${message}`, data);
|
|
331
|
-
* });
|
|
332
|
-
*
|
|
333
|
-
* logger.info('Operation started', { userId: '123' });
|
|
334
|
-
* logger.error('Operation failed', { error: 'Network timeout' });
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
declare class InternalLogger {
|
|
338
|
-
/**
|
|
339
|
-
* 用户自定义的日志钩子函数
|
|
340
|
-
*/
|
|
341
|
-
private readonly userLogger?;
|
|
342
|
-
/**
|
|
343
|
-
* 是否启用日志输出
|
|
344
|
-
* 可以通过环境变量 PLOLINK_SDK_DEBUG 控制
|
|
345
|
-
*/
|
|
346
|
-
private readonly isDebugEnabled;
|
|
347
|
-
/**
|
|
348
|
-
* 创建一个 InternalLogger 实例
|
|
349
|
-
*
|
|
350
|
-
* @param userLogger - 用户自定义的日志钩子函数
|
|
351
|
-
*/
|
|
352
|
-
constructor(userLogger?: LoggerFunction);
|
|
353
|
-
/**
|
|
354
|
-
* 记录信息级别日志
|
|
355
|
-
*
|
|
356
|
-
* @param message - 日志消息
|
|
357
|
-
* @param context - 附加上下文数据
|
|
358
|
-
*/
|
|
359
|
-
info(message: string, context?: unknown): void;
|
|
360
|
-
/**
|
|
361
|
-
* 记录警告级别日志
|
|
362
|
-
*
|
|
363
|
-
* @param message - 日志消息
|
|
364
|
-
* @param context - 附加上下文数据
|
|
365
|
-
*/
|
|
366
|
-
warn(message: string, context?: unknown): void;
|
|
367
|
-
/**
|
|
368
|
-
* 记录错误级别日志
|
|
369
|
-
*
|
|
370
|
-
* @param message - 日志消息
|
|
371
|
-
* @param context - 附加上下文数据
|
|
372
|
-
*/
|
|
373
|
-
error(message: string, context?: unknown): void;
|
|
374
|
-
/**
|
|
375
|
-
* 记录调试级别日志
|
|
376
|
-
* 只有在 debug 模式下才会输出
|
|
377
|
-
*
|
|
378
|
-
* @param message - 日志消息
|
|
379
|
-
* @param context - 附加上下文数据
|
|
380
|
-
*/
|
|
381
|
-
debug(message: string, context?: unknown): void;
|
|
382
|
-
/**
|
|
383
|
-
* 内部日志记录方法
|
|
384
|
-
*
|
|
385
|
-
* @param level - 日志级别
|
|
386
|
-
* @param message - 日志消息
|
|
387
|
-
* @param context - 附加上下文数据
|
|
388
|
-
*/
|
|
389
|
-
private log;
|
|
390
|
-
/**
|
|
391
|
-
* 创建一个带有固定上下文的子 logger
|
|
392
|
-
*
|
|
393
|
-
* @param context - 固定的上下文数据
|
|
394
|
-
* @returns 新的 logger 实例
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* ```typescript
|
|
398
|
-
* const logger = new InternalLogger();
|
|
399
|
-
* const moduleLogger = logger.withContext({ module: 'billing' });
|
|
400
|
-
* moduleLogger.info('Payment processed'); // 日志会自动带上 module: 'billing'
|
|
401
|
-
* ```
|
|
402
|
-
*/
|
|
403
|
-
withContext(context: Record<string, unknown>): InternalLogger;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* 为 Axios 实例添加类型安全的请求方法
|
|
408
|
-
*
|
|
409
|
-
* @description
|
|
410
|
-
* 这些方法封装了 Axios 的原始方法,提供更好的类型推断。
|
|
411
|
-
*/
|
|
412
|
-
interface TypedAxiosInstance extends AxiosInstance {
|
|
413
|
-
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
414
|
-
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
415
|
-
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
416
|
-
patch<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
417
|
-
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
385
|
/**
|
|
421
386
|
* 心理评测模块
|
|
422
387
|
*
|
|
@@ -482,18 +447,20 @@ declare class PsychologyTest {
|
|
|
482
447
|
private client;
|
|
483
448
|
constructor(client: PlolinkClient);
|
|
484
449
|
/**
|
|
485
|
-
*
|
|
450
|
+
* 创建心理评测会话
|
|
486
451
|
*
|
|
487
452
|
* @description
|
|
488
|
-
*
|
|
453
|
+
* 创建心理评测会话记录(不返回题目)。
|
|
454
|
+
* 创建后需要调用 getSessionQuestions() 获取题目列表。
|
|
489
455
|
*
|
|
490
|
-
* @param params -
|
|
491
|
-
* @returns
|
|
492
|
-
* @throws {PlolinkError}
|
|
456
|
+
* @param params - 创建会话参数
|
|
457
|
+
* @returns 会话信息,包含会话ID
|
|
458
|
+
* @throws {PlolinkError} 当参数验证失败或创建失败时抛出
|
|
493
459
|
*
|
|
494
460
|
* @example
|
|
495
461
|
* ```typescript
|
|
496
|
-
*
|
|
462
|
+
* // 1. 创建会话
|
|
463
|
+
* const { sessionId } = await client.psychologyTest.createTestSession({
|
|
497
464
|
* groupCodes: ['family_parenting', 'disc'],
|
|
498
465
|
* businessModule: 'talent_assessment',
|
|
499
466
|
* businessCode: 'job_match',
|
|
@@ -502,16 +469,59 @@ declare class PsychologyTest {
|
|
|
502
469
|
* analysisPrompt: '请结合家庭养育方式和DISC行为模式,分析候选人的性格特点。'
|
|
503
470
|
* });
|
|
504
471
|
*
|
|
505
|
-
* console.log(
|
|
506
|
-
*
|
|
507
|
-
*
|
|
472
|
+
* console.log(`评测会话已创建: ${sessionId}`);
|
|
473
|
+
*
|
|
474
|
+
* // 2. 获取题目
|
|
475
|
+
* const questions = await client.psychologyTest.getSessionQuestions(sessionId);
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
createTestSession(params: CreatePsychologyTestSessionParams): Promise<CreatePsychologyTestSessionResponse>;
|
|
479
|
+
/**
|
|
480
|
+
* 获取会话题目
|
|
481
|
+
*
|
|
482
|
+
* @description
|
|
483
|
+
* 获取心理评测会话的题目列表(动态生成,每次调用都会重新打乱题目顺序)。
|
|
484
|
+
*
|
|
485
|
+
* @param sessionId - 评测会话ID
|
|
486
|
+
* @returns 题目列表和题组摘要
|
|
487
|
+
* @throws {PlolinkError} 当会话不存在或获取失败时抛出
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```typescript
|
|
491
|
+
* const questions = await client.psychologyTest.getSessionQuestions('clxxxx789012');
|
|
492
|
+
*
|
|
493
|
+
* console.log(`共 ${questions.totalCount} 道题目`);
|
|
494
|
+
* console.log('题组摘要:', questions.groupSummary);
|
|
508
495
|
*
|
|
509
496
|
* // 展示题目
|
|
510
|
-
*
|
|
497
|
+
* questions.questions.forEach((q, index) => {
|
|
511
498
|
* console.log(`题目 ${index + 1}: ${q.content}`);
|
|
512
499
|
* });
|
|
513
500
|
* ```
|
|
514
501
|
*/
|
|
502
|
+
getSessionQuestions(sessionId: string): Promise<GetSessionQuestionsResponse>;
|
|
503
|
+
/**
|
|
504
|
+
* 发起心理评测(已废弃)
|
|
505
|
+
*
|
|
506
|
+
* @deprecated 此方法已废弃,将在 v2.0 中移除。请使用 createTestSession() + getSessionQuestions() 替代。
|
|
507
|
+
*
|
|
508
|
+
* @description
|
|
509
|
+
* 根据题组代码列表发起心理评测会话,系统会自动生成打乱后的题目列表并返回。
|
|
510
|
+
*
|
|
511
|
+
* **迁移建议**:
|
|
512
|
+
* ```typescript
|
|
513
|
+
* // 旧方式(已废弃)
|
|
514
|
+
* const result = await client.psychologyTest.initiate(params);
|
|
515
|
+
*
|
|
516
|
+
* // 新方式(推荐)
|
|
517
|
+
* const { sessionId } = await client.psychologyTest.createTestSession(params);
|
|
518
|
+
* const result = await client.psychologyTest.getSessionQuestions(sessionId);
|
|
519
|
+
* ```
|
|
520
|
+
*
|
|
521
|
+
* @param params - 发起评测参数
|
|
522
|
+
* @returns 评测会话信息,包含会话ID和题目列表
|
|
523
|
+
* @throws {PlolinkError} 当参数验证失败或发起失败时抛出
|
|
524
|
+
*/
|
|
515
525
|
initiate(params: InitiatePsychologyTestParams): Promise<InitiatePsychologyTestResponse>;
|
|
516
526
|
/**
|
|
517
527
|
* 提交心理评测
|
|
@@ -671,96 +681,4 @@ declare class PsychologyTest {
|
|
|
671
681
|
listBankGroups(): Promise<PsychologyBankGroupSummary[]>;
|
|
672
682
|
}
|
|
673
683
|
|
|
674
|
-
|
|
675
|
-
* Plolink SDK 客户端主类
|
|
676
|
-
*
|
|
677
|
-
* @description
|
|
678
|
-
* PlolinkClient 是 SDK 的核心类,负责:
|
|
679
|
-
* - 管理 SDK 配置(认证 Token、API 地址等)
|
|
680
|
-
* - 初始化 Axios 实例并配置拦截器
|
|
681
|
-
* - 提供统一的日志接口
|
|
682
|
-
* - 作为所有业务模块的基础依赖
|
|
683
|
-
*
|
|
684
|
-
* @example
|
|
685
|
-
* ```typescript
|
|
686
|
-
* // 使用 ApiKey
|
|
687
|
-
* const client = new PlolinkClient({
|
|
688
|
-
* token: 'sk-123456789',
|
|
689
|
-
* logger: (level, msg, data) => {
|
|
690
|
-
* console.log(`[${level}] ${msg}`, data);
|
|
691
|
-
* }
|
|
692
|
-
* });
|
|
693
|
-
*
|
|
694
|
-
* // 使用 SessionId (登录后获取)
|
|
695
|
-
* const client = new PlolinkClient({
|
|
696
|
-
* token: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
|
|
697
|
-
* baseUrl: 'https://api.plolink.com'
|
|
698
|
-
* });
|
|
699
|
-
* ```
|
|
700
|
-
*/
|
|
701
|
-
declare class PlolinkClient {
|
|
702
|
-
/**
|
|
703
|
-
* SDK 配置对象(已填充默认值)
|
|
704
|
-
*/
|
|
705
|
-
readonly config: Required<SDKConfig>;
|
|
706
|
-
/**
|
|
707
|
-
* Axios 实例,用于发起 HTTP 请求
|
|
708
|
-
*/
|
|
709
|
-
readonly axiosInstance: TypedAxiosInstance;
|
|
710
|
-
/**
|
|
711
|
-
* 内部日志记录器
|
|
712
|
-
*/
|
|
713
|
-
readonly logger: InternalLogger;
|
|
714
|
-
/**
|
|
715
|
-
* 心理评测模块
|
|
716
|
-
*/
|
|
717
|
-
readonly psychologyTest: PsychologyTest;
|
|
718
|
-
/**
|
|
719
|
-
* 创建一个 PlolinkClient 实例
|
|
720
|
-
*
|
|
721
|
-
* @param config - SDK 配置对象
|
|
722
|
-
* @throws {PlolinkError} 当配置验证失败时抛出
|
|
723
|
-
*
|
|
724
|
-
* @example
|
|
725
|
-
* ```typescript
|
|
726
|
-
* const client = new PlolinkClient({
|
|
727
|
-
* token: 'sk-your-api-key'
|
|
728
|
-
* });
|
|
729
|
-
* ```
|
|
730
|
-
*/
|
|
731
|
-
constructor(config: SDKConfig);
|
|
732
|
-
/**
|
|
733
|
-
* 验证 SDK 配置
|
|
734
|
-
*
|
|
735
|
-
* @param config - SDK 配置对象
|
|
736
|
-
* @throws {PlolinkError} 当配置不合法时抛出
|
|
737
|
-
* @private
|
|
738
|
-
*/
|
|
739
|
-
private validateConfig;
|
|
740
|
-
/**
|
|
741
|
-
* 获取当前 SDK 版本
|
|
742
|
-
*
|
|
743
|
-
* @returns SDK 版本号
|
|
744
|
-
*/
|
|
745
|
-
getVersion(): string;
|
|
746
|
-
/**
|
|
747
|
-
* 检查客户端健康状态
|
|
748
|
-
*
|
|
749
|
-
* @returns 健康状态信息
|
|
750
|
-
*
|
|
751
|
-
* @example
|
|
752
|
-
* ```typescript
|
|
753
|
-
* const health = client.healthCheck();
|
|
754
|
-
* console.log(health);
|
|
755
|
-
* // { status: 'ok', baseUrl: '...', version: '...' }
|
|
756
|
-
* ```
|
|
757
|
-
*/
|
|
758
|
-
healthCheck(): {
|
|
759
|
-
status: 'ok';
|
|
760
|
-
baseUrl: string;
|
|
761
|
-
version: string;
|
|
762
|
-
hasToken: boolean;
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
export { InternalLogger as I, PlolinkClient as P, PsychologyTest as a };
|
|
684
|
+
export { type AnswerRecord, type CreatePsychologyTestSessionParams, type CreatePsychologyTestSessionResponse, type GetSessionQuestionsResponse, type GroupSummary, type InitiatePsychologyTestParams, type InitiatePsychologyTestResponse, type ListPsychologyTestSessionsParams, type ListPsychologyTestSessionsResponse, PsychologyAnalysisStatus, type PsychologyBankGroupSummary, PsychologyTest, type PsychologyTestAnswerDetail, type PsychologyTestDetail, PsychologyTestStatus, type PsychologyTestWebhookData, type QuestionDependency, type QuestionInfo, type QuestionMetadata, type QuestionOption, type QuestionType, type SubmitPsychologyTestParams, type SubmitPsychologyTestResponse, type TestCalculationResult };
|