@zeewain/3d-avatar-sdk 1.2.5 → 2.1.2

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.
@@ -113,6 +113,8 @@
113
113
  ResourceErrorCode[ResourceErrorCode["NOT_FOUND"] = 3003] = "NOT_FOUND";
114
114
  /** 资源格式不支持 */
115
115
  ResourceErrorCode[ResourceErrorCode["UNSUPPORTED_FORMAT"] = 3004] = "UNSUPPORTED_FORMAT";
116
+ /** 资源版本不兼容 */
117
+ ResourceErrorCode[ResourceErrorCode["VERSION_INCOMPATIBLE"] = 3005] = "VERSION_INCOMPATIBLE";
116
118
  })(exports.ResourceErrorCode || (exports.ResourceErrorCode = {}));
117
119
  /**
118
120
  * 系统错误码 (4xxx)
@@ -219,6 +221,10 @@
219
221
  category: exports.ErrorCategory.RESOURCE,
220
222
  message: '资源格式不支持'
221
223
  },
224
+ [exports.ResourceErrorCode.VERSION_INCOMPATIBLE]: {
225
+ category: exports.ErrorCategory.RESOURCE,
226
+ message: '资源版本不兼容'
227
+ },
222
228
  // 系统错误
223
229
  [exports.SystemErrorCode.OUT_OF_MEMORY]: {
224
230
  category: exports.ErrorCategory.SYSTEM,
@@ -407,6 +413,44 @@
407
413
  }
408
414
  }
409
415
 
416
+ /**
417
+ * Unity服务日志级别枚举
418
+ * @enum {string}
419
+ * @description 定义日志记录的级别
420
+ */
421
+ var LogLevel;
422
+ (function (LogLevel) {
423
+ LogLevel["DEBUG"] = "debug";
424
+ LogLevel["INFO"] = "info";
425
+ LogLevel["WARN"] = "warn";
426
+ LogLevel["ERROR"] = "error";
427
+ })(LogLevel || (LogLevel = {}));
428
+ /**
429
+ * 简单日志记录器实现
430
+ * @class SimpleLogger
431
+ * @implements {ISimpleLogger}
432
+ * @description 提供基础的日志记录功能
433
+ */
434
+ class SimpleLogger {
435
+ constructor(enableDebug = false) {
436
+ this.enableDebug = enableDebug;
437
+ }
438
+ debug(message, data) {
439
+ if (this.enableDebug) {
440
+ console.debug(`[SDK DEBUG] ${message}`, data);
441
+ }
442
+ }
443
+ info(message, data) {
444
+ console.info(`[SDK INFO] ${message}`, data);
445
+ }
446
+ warn(message, data) {
447
+ console.warn(`[SDK WARN] ${message}`, data);
448
+ }
449
+ error(message, error, data) {
450
+ console.error(`[SDK ERROR] ${message}`, error, error instanceof SDKError ? error.code : null, data);
451
+ }
452
+ }
453
+
410
454
  /**
411
455
  * @fileoverview Unity服务基础类型定义
412
456
  * @description 定义Unity服务的通用接口和类型,为所有Unity服务提供统一的基础类型
@@ -427,18 +471,6 @@
427
471
  /** 操作取消 */
428
472
  UnityOperationStatus[UnityOperationStatus["CANCELLED"] = 3] = "CANCELLED";
429
473
  })(exports.UnityOperationStatus || (exports.UnityOperationStatus = {}));
430
- /**
431
- * Unity服务日志级别枚举
432
- * @enum {string}
433
- * @description 定义日志记录的级别
434
- */
435
- exports.LogLevel = void 0;
436
- (function (LogLevel) {
437
- LogLevel["DEBUG"] = "debug";
438
- LogLevel["INFO"] = "info";
439
- LogLevel["WARN"] = "warn";
440
- LogLevel["ERROR"] = "error";
441
- })(exports.LogLevel || (exports.LogLevel = {}));
442
474
 
443
475
  /**
444
476
  * @fileoverview Unity服务抽象基类
@@ -723,31 +755,6 @@
723
755
  });
724
756
  }
725
757
  }
726
- /**
727
- * 简单日志记录器实现
728
- * @class SimpleLogger
729
- * @implements {IUnityLogger}
730
- * @description 提供基础的日志记录功能
731
- */
732
- class SimpleLogger {
733
- constructor(enableDebug = false) {
734
- this.enableDebug = enableDebug;
735
- }
736
- debug(message, data) {
737
- if (this.enableDebug) {
738
- console.debug(`[Unity Debug] ${message}`, data);
739
- }
740
- }
741
- info(message, data) {
742
- console.info(`[Unity Info] ${message}`, data);
743
- }
744
- warn(message, data) {
745
- console.warn(`[Unity Warning] ${message}`, data);
746
- }
747
- error(message, error, data) {
748
- console.error(`[Unity Error] ${message}`, error, error instanceof SDKError ? error.code : null, data);
749
- }
750
- }
751
758
 
752
759
  /**
753
760
  * @fileoverview Avatar API接口定义
@@ -842,6 +849,9 @@
842
849
  }
843
850
  });
844
851
  }
852
+ handleCallback(operation, code, message, data) {
853
+ super.handleCallback(operation, code, message, data);
854
+ }
845
855
  /**
846
856
  * 播放数字人动作
847
857
  * @param clipCode - 动作编码
@@ -1079,6 +1089,16 @@
1079
1089
  setConfig(config) {
1080
1090
  this.config = Object.assign(Object.assign({}, config), { env: config.env || 'prod', containerId: config.containerId || 'unity-container' });
1081
1091
  }
1092
+ /**
1093
+ * 更新SDK配置
1094
+ * @param config - SDK配置对象
1095
+ * @description 更新全局SDK配置
1096
+ */
1097
+ updateConfig(config) {
1098
+ if (this.config) {
1099
+ this.config = Object.assign(Object.assign({}, this.config), config);
1100
+ }
1101
+ }
1082
1102
  /**
1083
1103
  * 获取SDK配置
1084
1104
  * @returns IAvatarSDKConfig | null SDK配置对象或null
@@ -1087,24 +1107,6 @@
1087
1107
  getConfig() {
1088
1108
  return this.config;
1089
1109
  }
1090
- /**
1091
- * 获取认证token
1092
- * @returns string 认证token
1093
- * @description 获取当前配置的认证token
1094
- */
1095
- getToken() {
1096
- var _a;
1097
- return ((_a = this.config) === null || _a === void 0 ? void 0 : _a.token) || '';
1098
- }
1099
- /**
1100
- * 获取环境类型
1101
- * @returns string 环境类型
1102
- * @description 获取当前配置的环境类型
1103
- */
1104
- getEnv() {
1105
- var _a;
1106
- return ((_a = this.config) === null || _a === void 0 ? void 0 : _a.env) || 'prod';
1107
- }
1108
1110
  /**
1109
1111
  * 获取API基础URL
1110
1112
  * @param withApiModule 是否包含模块路径
@@ -1119,15 +1121,6 @@
1119
1121
  }
1120
1122
  return ((_d = getEnvConfig(((_c = this.config) === null || _c === void 0 ? void 0 : _c.env) || 'prod', withApiModule)) === null || _d === void 0 ? void 0 : _d.apiBaseUrl) || '';
1121
1123
  }
1122
- /**
1123
- * 获取自定义API URL
1124
- * @returns string | undefined 自定义API URL
1125
- * @description 获取自定义API URL配置
1126
- */
1127
- getCustomApiUrl() {
1128
- var _a;
1129
- return (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiUrl;
1130
- }
1131
1124
  /**
1132
1125
  * 重置配置
1133
1126
  * @description 清空当前配置
@@ -1897,6 +1890,7 @@
1897
1890
  */
1898
1891
  startTaskRequest(task) {
1899
1892
  return __awaiter(this, void 0, void 0, function* () {
1893
+ var _a;
1900
1894
  task.status = BroadcastTaskStatus.REQUESTING;
1901
1895
  this.logger.debug('Starting task request', { taskId: task.id });
1902
1896
  try {
@@ -1905,7 +1899,8 @@
1905
1899
  humanCode: task.params.humanCode,
1906
1900
  speed: task.params.speed,
1907
1901
  volume: task.params.volume >= 0 ? task.params.volume * 100 : undefined,
1908
- isSubtitle: task.params.isSubtitle
1902
+ isSubtitle: task.params.isSubtitle,
1903
+ audioDrivenVersion: ConfigManager.getInstance().getConfig().audioDrivenVersion
1909
1904
  };
1910
1905
  // 根据播报类型设置特定参数
1911
1906
  if (task.params.type === exports.BroadcastType.TEXT) {
@@ -1921,11 +1916,24 @@
1921
1916
  method: 'POST',
1922
1917
  headers: {
1923
1918
  'Content-Type': 'application/json',
1924
- 'x_auth_token': ConfigManager.getInstance().getToken()
1919
+ 'x_auth_token': ((_a = ConfigManager.getInstance().getConfig()) === null || _a === void 0 ? void 0 : _a.token) || ''
1925
1920
  },
1926
1921
  body: JSON.stringify(requestBody),
1927
1922
  signal: task.controller.signal,
1928
1923
  openWhenHidden: true,
1924
+ /**
1925
+ * 连接建立时的回调,用于检查 HTTP 状态码
1926
+ * @param response - HTTP 响应对象
1927
+ * @throws {SDKError} 当 HTTP 状态码异常时抛出对应的 SDKError
1928
+ */
1929
+ onopen: (response) => __awaiter(this, void 0, void 0, function* () {
1930
+ // 检查 HTTP 状态码,处理 401 token 过期等异常
1931
+ if (!response.ok) {
1932
+ const error = this.createHttpError(response.status, response.statusText, task.id);
1933
+ this.handleTaskError(task, error);
1934
+ throw error;
1935
+ }
1936
+ }),
1929
1937
  onmessage: (event) => {
1930
1938
  this.handleTaskResponse(task, event.data);
1931
1939
  },
@@ -1933,13 +1941,17 @@
1933
1941
  this.handleTaskClose(task);
1934
1942
  },
1935
1943
  onerror: (error) => {
1936
- this.handleTaskError(task, error);
1937
- throw new Error(`Task ${task.id} request failed: ${error}`);
1944
+ // 将所有异常统一转换为 SDKError
1945
+ const sdkError = this.convertToSDKError(error, task.id);
1946
+ this.handleTaskError(task, sdkError);
1947
+ throw sdkError;
1938
1948
  }
1939
1949
  });
1940
1950
  }
1941
1951
  catch (error) {
1942
- this.handleTaskError(task, error);
1952
+ // 将所有异常统一转换为 SDKError
1953
+ const sdkError = this.convertToSDKError(error, task.id);
1954
+ this.handleTaskError(task, sdkError);
1943
1955
  }
1944
1956
  });
1945
1957
  }
@@ -2027,15 +2039,19 @@
2027
2039
  * 处理任务错误
2028
2040
  * @param task - 播报任务
2029
2041
  * @param error - 错误对象
2030
- * @description 处理任务执行过程中的错误
2042
+ * @description 处理任务执行过程中的错误,防止重复触发错误回调
2031
2043
  * @private
2032
2044
  */
2033
2045
  handleTaskError(task, error) {
2034
2046
  var _a, _b;
2047
+ // 如果任务已经是失败或取消状态,不再重复处理,防止回调被多次触发
2048
+ if (task.status === BroadcastTaskStatus.FAILED || task.status === BroadcastTaskStatus.CANCELLED) {
2049
+ return;
2050
+ }
2035
2051
  task.status = BroadcastTaskStatus.FAILED;
2036
2052
  task.error = error;
2037
2053
  this.logger.error(`Task failed - ${task.id}`, error);
2038
- // 触发错误回调
2054
+ // 触发错误回调(只触发一次)
2039
2055
  (_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
2040
2056
  }
2041
2057
  /**
@@ -2083,7 +2099,6 @@
2083
2099
  * @private
2084
2100
  */
2085
2101
  getBroadcastApiPath(type) {
2086
- ConfigManager.getInstance().getEnv();
2087
2102
  switch (type) {
2088
2103
  case exports.BroadcastType.TEXT:
2089
2104
  return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
@@ -2160,6 +2175,71 @@
2160
2175
  this.queueProcessTimer = null;
2161
2176
  }
2162
2177
  }
2178
+ /**
2179
+ * 根据 HTTP 状态码创建对应的 SDKError
2180
+ * @param status - HTTP 状态码
2181
+ * @param statusText - HTTP 状态文本
2182
+ * @param taskId - 任务 ID(用于日志记录)
2183
+ * @returns SDKError 实例
2184
+ * @description 将 HTTP 错误状态码映射为对应的 SDKError
2185
+ * @private
2186
+ */
2187
+ createHttpError(status, statusText, taskId) {
2188
+ this.logger.warn(`HTTP error occurred - Task: ${taskId}, Status: ${status}`, { status, statusText });
2189
+ switch (status) {
2190
+ case 401:
2191
+ // Token 过期或未授权
2192
+ return new SDKError(exports.NetworkErrorCode.UNAUTHORIZED, `Token 已过期或无效,请重新授权 (HTTP ${status})`);
2193
+ case 403:
2194
+ // 禁止访问
2195
+ return new SDKError(exports.NetworkErrorCode.UNAUTHORIZED, `无权限访问该资源 (HTTP ${status})`);
2196
+ case 404:
2197
+ // 资源不存在
2198
+ return new SDKError(exports.NetworkErrorCode.SERVER_ERROR, `请求的资源不存在 (HTTP ${status})`);
2199
+ case 500:
2200
+ case 502:
2201
+ case 503:
2202
+ case 504:
2203
+ // 服务器错误
2204
+ return new SDKError(exports.NetworkErrorCode.SERVER_ERROR, `服务器错误,请稍后重试 (HTTP ${status})`);
2205
+ default:
2206
+ // 其他 HTTP 错误
2207
+ return new SDKError(exports.NetworkErrorCode.CONNECTION_FAILED, `网络请求失败: ${statusText || 'Unknown Error'} (HTTP ${status})`);
2208
+ }
2209
+ }
2210
+ /**
2211
+ * 将任意错误转换为 SDKError
2212
+ * @param error - 原始错误对象
2213
+ * @param taskId - 任务 ID(用于日志记录)
2214
+ * @returns SDKError 实例
2215
+ * @description 统一将各种类型的错误转换为 SDKError,便于上层统一处理
2216
+ * @private
2217
+ */
2218
+ convertToSDKError(error, taskId) {
2219
+ // 如果已经是 SDKError,直接返回
2220
+ if (error instanceof SDKError) {
2221
+ return error;
2222
+ }
2223
+ // 如果是普通 Error 对象
2224
+ if (error instanceof Error) {
2225
+ // 检查是否是网络相关的错误
2226
+ const errorMessage = error.message.toLowerCase();
2227
+ if (errorMessage.includes('timeout') || errorMessage.includes('timed out')) {
2228
+ return new SDKError(exports.NetworkErrorCode.REQUEST_TIMEOUT, `请求超时 - Task: ${taskId}`, error);
2229
+ }
2230
+ if (errorMessage.includes('network') || errorMessage.includes('fetch') || errorMessage.includes('connection')) {
2231
+ return new SDKError(exports.NetworkErrorCode.CONNECTION_FAILED, `网络连接失败 - Task: ${taskId}: ${error.message}`, error);
2232
+ }
2233
+ if (errorMessage.includes('abort') || errorMessage.includes('cancel')) {
2234
+ return new SDKError(exports.OperationErrorCode.OPERATION_CANCELLED, `操作已取消 - Task: ${taskId}`, error);
2235
+ }
2236
+ // 默认作为操作失败处理
2237
+ return new SDKError(exports.OperationErrorCode.OPERATION_FAILED, `播报任务执行失败 - Task: ${taskId}: ${error.message}`, error);
2238
+ }
2239
+ // 如果是字符串或其他类型
2240
+ const errorMessage = String(error);
2241
+ return new SDKError(exports.OperationErrorCode.OPERATION_FAILED, `播报任务执行失败 - Task: ${taskId}: ${errorMessage}`);
2242
+ }
2163
2243
  }
2164
2244
 
2165
2245
  /**
@@ -2177,13 +2257,11 @@
2177
2257
  * @param config - Unity配置对象
2178
2258
  * @description 初始化数字人加载器,创建Unity加载器实例
2179
2259
  */
2180
- constructor(config) {
2260
+ constructor() {
2181
2261
  /** Avatar API实例 */
2182
2262
  this.apiService = null;
2183
2263
  /** Unity实例 */
2184
2264
  this.unityInstance = null;
2185
- // 同时设置到配置管理器中
2186
- ConfigManager.getInstance().setConfig(config);
2187
2265
  this.loader = new UnityLoader();
2188
2266
  }
2189
2267
  /**
@@ -2286,17 +2364,61 @@
2286
2364
  * @protected
2287
2365
  */
2288
2366
  initGlobalConfig() {
2289
- const params = {
2290
- token: ConfigManager.getInstance().getToken(),
2367
+ const config = ConfigManager.getInstance().getConfig();
2368
+ const globalParams = {
2369
+ token: config === null || config === void 0 ? void 0 : config.token,
2291
2370
  apiBaseUrl: ConfigManager.getInstance().getApiBaseUrl(false),
2292
- idleMotionList: ConfigManager.getInstance().getConfig().idleMotionList,
2293
- assetsUrl: ConfigManager.getInstance().getConfig().assetsUrl
2371
+ idleMotionList: config === null || config === void 0 ? void 0 : config.idleMotionList
2372
+ // 純AB包方案在SDK 2.1.0 中已弃用
2373
+ // assetsUrl: config?.assetsUrl
2294
2374
  };
2295
- console.warn('[ Send Unity message ]: AvatarSDK.InitializeConfig', params);
2296
- this.unityInstance.SendMessage('AvatarSDK', 'InitializeConfig', JSON.stringify(params));
2375
+ const assetModuleParams = {
2376
+ isZip: true,
2377
+ assetBundlePath: config === null || config === void 0 ? void 0 : config.assetsUrl
2378
+ };
2379
+ this.unityInstance.SendMessage('AvatarSDK', 'InitializeConfig', JSON.stringify(globalParams));
2380
+ this.unityInstance.SendMessage('AvatarSDK', 'InitAssetBundleModule', JSON.stringify(assetModuleParams));
2381
+ console.warn('[ Send Unity message ]: AvatarSDK.InitializeConfig', globalParams);
2382
+ console.warn('[ Send Unity message ]: AvatarSDK.InitAssetBundleModule', assetModuleParams);
2297
2383
  }
2298
2384
  }
2299
2385
 
2386
+ // 深拷贝
2387
+ /**
2388
+ * 比较两个版本号的前两位(major.minor)是否一致
2389
+ * @param version1 版本号1,格式:x.x.x
2390
+ * @param version2 版本号2,格式:x.x.x
2391
+ * @returns boolean 如果前两位一致返回 true,否则返回 false
2392
+ * @description 用于检查 SDK 版本与资源版本是否兼容
2393
+ * @example
2394
+ * compareVersionCompatibility('2.1.0', '2.1.5') // true
2395
+ * compareVersionCompatibility('2.1.0', '2.2.0') // false
2396
+ * compareVersionCompatibility('2.1.0', '3.0.0') // false
2397
+ */
2398
+ function compareVersionCompatibility(version1, version2) {
2399
+ // 提取版本号的前两位(major.minor)
2400
+ const getMajorMinor = (version) => {
2401
+ const parts = version.split('.');
2402
+ if (parts.length < 2) {
2403
+ return version;
2404
+ }
2405
+ return `${parts[0]}.${parts[1]}`;
2406
+ };
2407
+ const v1MajorMinor = getMajorMinor(version1);
2408
+ const v2MajorMinor = getMajorMinor(version2);
2409
+ return v1MajorMinor === v2MajorMinor;
2410
+ }
2411
+
2412
+ /**
2413
+ * @fileoverview SDK 版本号常量
2414
+ * @description 此文件由构建脚本自动生成,请勿手动修改
2415
+ */
2416
+ /**
2417
+ * SDK 版本号
2418
+ * @const {string} SDK_VERSION
2419
+ */
2420
+ const SDK_VERSION = '2.1.2';
2421
+
2300
2422
  /**
2301
2423
  * @fileoverview 统一的3D数字人SDK入口类
2302
2424
  * @description 提供统一的SDK接口,内部通过组合模式调用各个服务模块
@@ -2329,10 +2451,12 @@
2329
2451
  this.unityInstance = null;
2330
2452
  /** SDK初始化状态 */
2331
2453
  this.isInitialized = false;
2332
- this.config = config;
2333
2454
  this.instanceId = generateUniqueId();
2334
2455
  // 设置全局配置
2335
2456
  ConfigManager.getInstance().setConfig(config);
2457
+ // 设置日志
2458
+ this.logger = new SimpleLogger(ConfigManager.getInstance().getConfig().enableDebugLog);
2459
+ this.logger.info('SDK版本', SDK_VERSION);
2336
2460
  }
2337
2461
  /**
2338
2462
  * 初始化数字人
@@ -2343,12 +2467,14 @@
2343
2467
  */
2344
2468
  initializeAvatar(avatarCode_1) {
2345
2469
  return __awaiter(this, arguments, void 0, function* (avatarCode, cameraType = exports.AvatarCameraType.WHOLE) {
2470
+ var _a;
2346
2471
  if (this.isInitialized) {
2347
2472
  throw new SDKError(exports.OperationErrorCode.OPERATION_FAILED, 'SDK已经初始化,请勿重复初始化');
2348
2473
  }
2349
2474
  try {
2475
+ const config = ConfigManager.getInstance().getConfig();
2350
2476
  // 1. 创建Unity加载器
2351
- this.loader = new ZEEAvatarLoader(this.config);
2477
+ this.loader = new ZEEAvatarLoader();
2352
2478
  // 2. 初始化Unity实例
2353
2479
  yield this.loader.init();
2354
2480
  // 3. 获取Unity实例
@@ -2357,18 +2483,31 @@
2357
2483
  this.avatarService = new AvatarService({
2358
2484
  unityInstance: this.unityInstance,
2359
2485
  instanceId: this.instanceId,
2360
- enableDebugLog: this.config.enableDebugLog
2486
+ enableDebugLog: config.enableDebugLog
2361
2487
  });
2362
2488
  // 5. 创建带有唯一标识符的播报服务
2363
2489
  this.broadcastService = new BroadcastService({
2364
2490
  unityInstance: this.unityInstance,
2365
2491
  instanceId: this.instanceId,
2366
- callbacks: this.config.broadcastCallbacks,
2367
- enableDebugLog: this.config.enableDebugLog
2492
+ callbacks: config.broadcastCallbacks,
2493
+ enableDebugLog: config.enableDebugLog
2368
2494
  });
2369
2495
  // 6. 初始化数字人
2370
2496
  const result = yield this.avatarService.initializeAvatar(avatarCode, cameraType);
2371
2497
  if (result.success) {
2498
+ const audioDrivenVersion = (_a = result.data) === null || _a === void 0 ? void 0 : _a.audioDrivenVersion;
2499
+ config.audioDrivenVersion = audioDrivenVersion;
2500
+ this.logger.info('AudioDrivenVersion', audioDrivenVersion);
2501
+ // 7. 检查资源版本兼容性
2502
+ if (audioDrivenVersion) {
2503
+ const isCompatible = compareVersionCompatibility(SDK_VERSION, audioDrivenVersion);
2504
+ if (!isCompatible) {
2505
+ // 销毁SDK实例
2506
+ this.destroy();
2507
+ throw new SDKError(exports.ResourceErrorCode.VERSION_INCOMPATIBLE, `资源版本不兼容: SDK版本为 ${SDK_VERSION},WebGL资源版本为 ${audioDrivenVersion},前两位版本号必须一致`);
2508
+ }
2509
+ this.logger.info('版本兼容性检查通过', `SDK: ${SDK_VERSION}, 资源: ${audioDrivenVersion}`);
2510
+ }
2372
2511
  this.isInitialized = true;
2373
2512
  }
2374
2513
  return result;
@@ -2384,8 +2523,7 @@
2384
2523
  * @description 更新全局Token配置
2385
2524
  */
2386
2525
  updateToken(token) {
2387
- this.config.token = token;
2388
- ConfigManager.getInstance().setConfig(this.config);
2526
+ ConfigManager.getInstance().updateConfig({ token });
2389
2527
  // 如果loader已经初始化,也更新loader的token
2390
2528
  if (this.loader) {
2391
2529
  this.loader.updateToken(token);
@@ -2569,7 +2707,8 @@
2569
2707
  * @returns IAvatarSDKConfig 当前配置
2570
2708
  */
2571
2709
  getConfig() {
2572
- return Object.assign({}, this.config);
2710
+ const config = ConfigManager.getInstance().getConfig();
2711
+ return config ? Object.assign({}, config) : null;
2573
2712
  }
2574
2713
  // ===========================================
2575
2714
  // 私有方法
@@ -2589,6 +2728,7 @@
2589
2728
  exports.BroadcastService = BroadcastService;
2590
2729
  exports.ERROR_CODE_MAP = ERROR_CODE_MAP;
2591
2730
  exports.SDKError = SDKError;
2731
+ exports.SDK_VERSION = SDK_VERSION;
2592
2732
  exports.ZEEAvatarLoader = ZEEAvatarLoader;
2593
2733
  exports.ZEEAvatarSDK = ZEEAvatarSDK;
2594
2734
  exports.getErrorInfo = getErrorInfo;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zeewain/3d-avatar-sdk",
3
3
  "type": "module",
4
- "version": "1.2.5",
4
+ "version": "2.1.2",
5
5
  "description": "SDK for ZEE Avatar WebGL integration",
6
6
  "author": "ZEEWain",
7
7
  "license": "MIT",
@@ -44,10 +44,11 @@
44
44
  "dev": "cross-env NODE_ENV=development rollup -c -w",
45
45
  "dev:watch": "cross-env NODE_ENV=development rollup -c -w --watch.include='src/**'",
46
46
  "clean": "del-cli dist",
47
+ "generate:version": "node scripts/generate-version.js",
47
48
  "build": "npm run clean && cross-env NODE_ENV=production rollup -c",
48
49
  "test": "cross-env NODE_ENV=test rollup -c",
49
50
  "lint": "eslint \"./src/**/*.{ts,js}\" --fix",
50
- "prebuild": "npm run lint",
51
+ "prebuild": "npm run generate:version && npm run lint",
51
52
  "prepublishOnly": "npm run build",
52
53
  "start": "npm run test",
53
54
  "release": "release-it",
@@ -55,6 +56,9 @@
55
56
  "release:minor": "release-it minor",
56
57
  "release:major": "release-it major",
57
58
  "release:dry": "release-it --dry-run",
59
+ "release:internal": "release-it --config .release-it.internal.json",
60
+ "release:alpha": "npm run release:internal -- --preRelease=alpha",
61
+ "release:beta": "npm run release:internal -- --preRelease=beta",
58
62
  "version": "npm run build"
59
63
  },
60
64
  "dependencies": {
@@ -85,9 +89,5 @@
85
89
  "rollup-plugin-dts": "^6.1.0",
86
90
  "tslib": "^2.6.2",
87
91
  "typescript": "^5.8.3"
88
- },
89
- "publishConfig": {
90
- "registry": "https://registry.npmjs.org/",
91
- "access": "public"
92
92
  }
93
93
  }