@blueking/chat-helper 0.0.12-beta.30 → 0.0.12-beta.32

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.
@@ -1,7 +1,7 @@
1
1
  /** 含此版本起走 pv_files/upload;更早版本继续走旧 upload/{fileName}/ */
2
2
  export declare const PV_FILE_UPLOAD_MIN_SDK_VERSION = "2.2.2rc25";
3
3
  /**
4
- * agent_sdk_version 2.2.2rc25 才支持 pv_files/upload。
5
- * 缺省或无法解析时走旧接口,避免旧后端被打到不存在的新路径。
4
+ * 仅当能解析出版本且低于 2.2.2rc25 时走旧 upload/{fileName}/。
5
+ * 空字符串、缺省或无法解析一律走 pv_files/upload。
6
6
  */
7
7
  export declare const isPvFileUploadSupported: (version?: null | string) => boolean;
@@ -52,16 +52,13 @@ const compareSdkVersion = (left, right)=>{
52
52
  return left.preNum - right.preNum;
53
53
  };
54
54
  /**
55
- * agent_sdk_version 2.2.2rc25 才支持 pv_files/upload。
56
- * 缺省或无法解析时走旧接口,避免旧后端被打到不存在的新路径。
55
+ * 仅当能解析出版本且低于 2.2.2rc25 时走旧 upload/{fileName}/。
56
+ * 空字符串、缺省或无法解析一律走 pv_files/upload。
57
57
  */ export const isPvFileUploadSupported = (version)=>{
58
- if (!version) {
59
- return false;
60
- }
61
- const parsed = parseSdkVersion(version);
58
+ const parsed = version ? parseSdkVersion(version) : null;
62
59
  const min = parseSdkVersion(PV_FILE_UPLOAD_MIN_SDK_VERSION);
63
60
  if (!parsed || !min) {
64
- return false;
61
+ return true;
65
62
  }
66
63
  return compareSdkVersion(parsed, min) >= 0;
67
64
  };
@@ -335,7 +335,7 @@ import { isPvFileUploadSupported } from './pv-file-upload.ts.js';
335
335
  };
336
336
  /**
337
337
  * 上传文件到会话。
338
- * agent_sdk_version 2.2.2rc25 pv_files/upload;更早或缺失版本走旧 upload/{fileName}/。
338
+ * 能解析且 agent_sdk_version < 2.2.2rc25 走旧 upload/{fileName}/;否则(含空字符串 / 缺省)走 pv_files/upload。
339
339
  */ const uploadFile = (sessionCode, file)=>{
340
340
  var _mediator_agent_info_value, _mediator_agent, _mediator_http;
341
341
  const sdkVersion = (_mediator_agent = mediator.agent) === null || _mediator_agent === void 0 ? void 0 : (_mediator_agent_info_value = _mediator_agent.info.value) === null || _mediator_agent_info_value === void 0 ? void 0 : _mediator_agent_info_value.agentSdkVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/chat-helper",
3
- "version": "0.0.12-beta.30",
3
+ "version": "0.0.12-beta.32",
4
4
  "description": "",
5
5
  "main": "./dist/index.ts.js",
6
6
  "types": "./dist/index.d.ts",