@peninsula-med/beisen-ehr-plugin 1.1.7 → 1.1.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/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { OpenClawPlugin } from 'openclaw/plugin-sdk';
8
8
  */
9
9
 
10
10
  declare const pluginId = "beisen-ehr-plugin";
11
- declare const pluginVersion = "1.1.7";
11
+ declare const pluginVersion = "1.1.9";
12
12
  /**
13
13
  * 北森 EHR 插件配置接口
14
14
  */
package/dist/index.esm.js CHANGED
@@ -3457,7 +3457,7 @@ const Type = TypeBuilder;
3457
3457
  */
3458
3458
  // 插件元数据
3459
3459
  const pluginId = 'beisen-ehr-plugin';
3460
- const pluginVersion = '1.1.7';
3460
+ const pluginVersion = '1.1.9';
3461
3461
  /**
3462
3462
  * 默认配置
3463
3463
  */
@@ -3510,18 +3510,36 @@ class BeisenClient {
3510
3510
  ...(this.config.tenantId && { "tenantId": this.config.tenantId }),
3511
3511
  ...(options.headers || {}),
3512
3512
  };
3513
+ const requestBody = options.body ? JSON.stringify(options.body) : undefined;
3513
3514
  console.error(`📡 请求:${options.method || 'GET'} ${url}`);
3515
+ console.error(`🔑 Token: ${token ? token.substring(0, 20) + '...' : 'none'}`);
3514
3516
  console.error(`🏢 TenantId: ${this.config.tenantId}`);
3515
- const response = await fetch(url, {
3516
- ...options,
3517
- headers,
3518
- body: options.body ? JSON.stringify(options.body) : undefined,
3519
- });
3520
- if (!response.ok) {
3521
- const errorText = await response.text();
3522
- throw new Error(`北森 API 错误:${response.status} - ${errorText}`);
3517
+ if (requestBody) {
3518
+ console.error(`📦 请求体:${requestBody.substring(0, 200)}...`);
3519
+ }
3520
+ const controller = new AbortController();
3521
+ const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 秒超时
3522
+ try {
3523
+ const response = await fetch(url, {
3524
+ ...options,
3525
+ headers,
3526
+ body: requestBody,
3527
+ signal: controller.signal,
3528
+ });
3529
+ clearTimeout(timeoutId);
3530
+ if (!response.ok) {
3531
+ const errorText = await response.text();
3532
+ throw new Error(`北森 API 错误:${response.status} - ${errorText}`);
3533
+ }
3534
+ return response.json();
3535
+ }
3536
+ catch (error) {
3537
+ clearTimeout(timeoutId);
3538
+ if (error.name === 'AbortError') {
3539
+ throw new Error('北森 API 请求超时(30 秒)');
3540
+ }
3541
+ throw error;
3523
3542
  }
3524
- return response.json();
3525
3543
  }
3526
3544
  // 提交加班申请(推送至北森系统并发起审批)
3527
3545
  async submitOvertime(data) {
@@ -3617,7 +3635,9 @@ async function register(api) {
3617
3635
  properties: Type.Optional(Type.String({ description: '自定义字段 JSON 字符串' })),
3618
3636
  }),
3619
3637
  async execute(_id, params) {
3638
+ console.error('🔨 工具调用:beisen_submit_overtime', JSON.stringify(params));
3620
3639
  try {
3640
+ console.error('📡 正在提交加班申请...');
3621
3641
  const result = await client.submitOvertime({
3622
3642
  staffId: config.staffId,
3623
3643
  email: config.email,
@@ -3626,6 +3646,7 @@ async function register(api) {
3626
3646
  compensationType: params.compensationType,
3627
3647
  properties: params.properties,
3628
3648
  });
3649
+ console.error('✅ 加班申请提交成功:', result);
3629
3650
  if (result.code === "200" || result.code === 200) {
3630
3651
  const compTypeText = params.compensationType === 1 ? "加班费" : "调休假";
3631
3652
  return {
@@ -3737,6 +3758,14 @@ async function register(api) {
3737
3758
  },
3738
3759
  });
3739
3760
  console.error('✅ 已注册 4 个工具:beisen_submit_overtime, beisen_get_leave_balance, beisen_query_attendance, beisen_get_approval_status');
3761
+ // 调试:列出所有已注册的工具
3762
+ console.error('🔍 工具注册完成,插件 ID:', pluginId);
3763
+ console.error('🔍 配置:', JSON.stringify({
3764
+ apiUrl: config.apiUrl,
3765
+ staffId: config.staffId,
3766
+ tenantId: config.tenantId,
3767
+ email: config.email,
3768
+ }, null, 2));
3740
3769
  }
3741
3770
  /**
3742
3771
  * 插件停用函数