@cloudbase/cloudbase-mcp 2.3.1 → 2.4.0

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 (4) hide show
  1. package/dist/cli.cjs +973 -72
  2. package/dist/index.cjs +973 -72
  3. package/dist/index.js +8715 -8515
  4. package/package.json +2 -1
package/dist/cli.cjs CHANGED
@@ -102,6 +102,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
102
102
  Object.defineProperty(exports, "__esModule", ({ value: true }));
103
103
  exports.CloudRunService = void 0;
104
104
  exports.codeToZip = codeToZip;
105
+ exports.parseObjectToDiffConfigItem = parseObjectToDiffConfigItem;
105
106
  const archiver_1 = __importDefault(__webpack_require__(99133));
106
107
  const fs_extra_1 = __webpack_require__(21605);
107
108
  const path_1 = __importDefault(__webpack_require__(39902));
@@ -270,7 +271,7 @@ class CloudRunService {
270
271
  /**
271
272
  * 上传部署包
272
273
  */
273
- const zipFile = await codeToZip(targetPath, { installDependency: true });
274
+ const zipFile = await codeToZip(targetPath, { installDependency: (serverConfig === null || serverConfig === void 0 ? void 0 : serverConfig.InstallDependency) !== undefined ? serverConfig.InstallDependency : true });
274
275
  await (0, utils_1.upload)({
275
276
  url: uploadUrl,
276
277
  file: zipFile,
@@ -286,8 +287,14 @@ class CloudRunService {
286
287
  if (await this._checkFunctionExist(serverName)) {
287
288
  // 更新
288
289
  const serverDetail = await this.detail({ serverName });
289
- const _serverConfig = Object.assign(Object.assign(Object.assign({}, ((serverDetail === null || serverDetail === void 0 ? void 0 : serverDetail.ServerConfig) || {})), serverConfig), ((serverDetail === null || serverDetail === void 0 ? void 0 : serverDetail.ServerConfig.Tag) === 'function:' ? { Port: 3000 } : {}) // 函数型不能指定端口,需要固定为3000
290
+ const _serverConfig = Object.assign(Object.assign(Object.assign({}, serverConfig), { OpenAccessTypes: ['OA', 'PUBLIC', 'MINIAPP'] }), ((serverDetail === null || serverDetail === void 0 ? void 0 : serverDetail.ServerConfig.Tag) === 'function:' ? { Port: 3000 } : {}) // 函数型不能指定端口,需要固定为3000
290
291
  );
292
+ if ((serverDetail === null || serverDetail === void 0 ? void 0 : serverDetail.ServerConfig.Tag) === 'function:') {
293
+ deployInfo.BuildPacks = {
294
+ LanguageVersion: '20.18',
295
+ RepoLanguage: 'Node.js'
296
+ };
297
+ }
291
298
  deployInfo.ReleaseType = 'FULL';
292
299
  return this._upsertFunction(false, {
293
300
  name: serverName,
@@ -315,7 +322,13 @@ class CloudRunService {
315
322
  RepoLanguage: 'Node.js'
316
323
  };
317
324
  }
318
- const _serverConfig = Object.assign(Object.assign(Object.assign({ OpenAccessTypes: ['OA', 'PUBLIC'], Cpu: 0, Mem: 0, MinNum: 0, MaxNum: 0, PolicyDetails: [], EnvParams: JSON.stringify({}), InitialDelaySeconds: 0, CustomLogs: '', HasDockerfile: true, CreateTime: '', EnvId: envConfig.EnvId, ServerName: serverName, Port: type === 'container' ? 80 : 3000, Dockerfile: 'Dockerfile', BuildDir: '' }, serverConfig), (type === 'function' ? { Port: 3000 } : {})), { Tag: type === 'container' ? '' : 'function:' });
325
+ const _serverConfig = Object.assign(Object.assign(Object.assign({ OpenAccessTypes: ['OA', 'PUBLIC', 'MINIAPP'],
326
+ // Cpu: 0,
327
+ // Mem: 0,
328
+ MinNum: 0,
329
+ // MaxNum: 0,
330
+ // PolicyDetails: [],
331
+ EnvParams: JSON.stringify({}), InitialDelaySeconds: 0, CustomLogs: '', HasDockerfile: true, CreateTime: '', EnvId: envConfig.EnvId, ServerName: serverName, Port: type === 'container' ? 80 : 3000, Dockerfile: 'Dockerfile', BuildDir: '' }, serverConfig), (type === 'function' ? { Port: 3000 } : {})), { Tag: type === 'container' ? '' : 'function:' });
319
332
  return this._upsertFunction(true, {
320
333
  name: serverName,
321
334
  deployInfo,
@@ -349,11 +362,12 @@ class CloudRunService {
349
362
  _upsertFunction(isNew, data) {
350
363
  const { name, deployInfo, serverConfig } = data;
351
364
  const envConfig = this.environment.lazyEnvironmentConfig;
365
+ const Items = parseObjectToDiffConfigItem(serverConfig);
352
366
  return this.tcbrService.request(isNew ? 'CreateCloudRunServer' : 'UpdateCloudRunServer', {
353
367
  EnvId: envConfig.EnvId,
354
368
  ServerName: name,
355
369
  DeployInfo: deployInfo,
356
- ServerConfig: serverConfig
370
+ Items,
357
371
  });
358
372
  }
359
373
  }
@@ -426,6 +440,63 @@ async function codeToZip(cwd, options) {
426
440
  await archive.finalize();
427
441
  return bufferPromise;
428
442
  }
443
+ /**
444
+ * 提交参数变化映射
445
+ */
446
+ const SUBMIT_DIFF_MAP = {
447
+ Cpu: 'CpuSpecs',
448
+ Mem: 'MemSpecs',
449
+ OpenAccessTypes: 'AccessTypes',
450
+ EnvParams: 'EnvParam',
451
+ CustomLogs: 'LogPath'
452
+ };
453
+ /**
454
+ * 将 object 参数转为 [{key:"Port", IntValue:80}] 的格式,并且剔除空字符串
455
+ */
456
+ function parseObjectToDiffConfigItem(data) {
457
+ const kvs = Object.entries(data);
458
+ const Items = [];
459
+ kvs.forEach(([k, v]) => {
460
+ const Key = SUBMIT_DIFF_MAP[k] || k;
461
+ if ([
462
+ 'CustomLogs',
463
+ 'EnvParams',
464
+ 'CreateTime',
465
+ 'Dockerfile',
466
+ 'BuildDir',
467
+ 'LogType',
468
+ 'LogSetId',
469
+ 'LogTopicId',
470
+ 'LogParseType',
471
+ 'Tag',
472
+ 'InternalAccess',
473
+ 'InternalDomain',
474
+ 'OperationMode',
475
+ 'SessionAffinity'
476
+ ].includes(k)) {
477
+ !!v && Items.push({ Key, Value: v });
478
+ }
479
+ else if (['MinNum', 'MaxNum', 'InitialDelaySeconds', 'Port'].includes(k)) {
480
+ Items.push({ Key, IntValue: v });
481
+ }
482
+ else if (['HasDockerfile'].includes(k)) {
483
+ Items.push({ Key, BoolValue: v });
484
+ }
485
+ else if (['Cpu', 'Mem'].includes(k)) {
486
+ Items.push({ Key, FloatValue: v });
487
+ }
488
+ else if (['OpenAccessTypes', 'EntryPoint', 'Cmd'].includes(k)) {
489
+ Items.push({ Key, ArrayValue: v });
490
+ }
491
+ else if (['PolicyDetails'].includes(k)) {
492
+ Items.push({ Key, PolicyDetails: v });
493
+ }
494
+ else if (['TimerScale'].includes(k)) {
495
+ Items.push({ Key, TimerScale: v });
496
+ }
497
+ });
498
+ return Items;
499
+ }
429
500
 
430
501
 
431
502
  /***/ }),
@@ -1679,6 +1750,7 @@ function registerEnvTools(server) {
1679
1750
  Channels: ['dcloud', 'iotenable', 'tem', 'scene_module'] // Filter special channels
1680
1751
  }
1681
1752
  });
1753
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1682
1754
  // Transform response format to match original listEnvs() format
1683
1755
  if (result && result.EnvList) {
1684
1756
  result = { EnvList: result.EnvList };
@@ -1690,6 +1762,7 @@ function registerEnvTools(server) {
1690
1762
  // Fallback to original method if format is unexpected
1691
1763
  (0, logger_js_1.debug)('Unexpected response format, falling back to listEnvs()');
1692
1764
  result = await cloudbaseList.env.listEnvs();
1765
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1693
1766
  }
1694
1767
  }
1695
1768
  catch (error) {
@@ -1698,10 +1771,12 @@ function registerEnvTools(server) {
1698
1771
  try {
1699
1772
  const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId: true });
1700
1773
  result = await cloudbaseList.env.listEnvs();
1774
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1701
1775
  }
1702
1776
  catch (fallbackError) {
1703
1777
  (0, logger_js_1.debug)('降级到 listEnvs() 也失败:', fallbackError);
1704
- return { content: [{ type: "text", text: "获取环境列表时出错: " + (fallbackError instanceof Error ? fallbackError.message : String(fallbackError)) }]
1778
+ return {
1779
+ content: [{ type: "text", text: "获取环境列表时出错: " + (fallbackError instanceof Error ? fallbackError.message : String(fallbackError)) }]
1705
1780
  };
1706
1781
  }
1707
1782
  }
@@ -1709,14 +1784,17 @@ function registerEnvTools(server) {
1709
1784
  case "info":
1710
1785
  const cloudbaseInfo = await getManager();
1711
1786
  result = await cloudbaseInfo.env.getEnvInfo();
1787
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1712
1788
  break;
1713
1789
  case "domains":
1714
1790
  const cloudbaseDomains = await getManager();
1715
1791
  result = await cloudbaseDomains.env.getEnvAuthDomains();
1792
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1716
1793
  break;
1717
1794
  case "hosting":
1718
1795
  const cloudbaseHosting = await getManager();
1719
1796
  result = await cloudbaseHosting.hosting.getWebsiteConfig();
1797
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1720
1798
  break;
1721
1799
  default:
1722
1800
  throw new Error(`不支持的查询类型: ${action}`);
@@ -1774,9 +1852,11 @@ function registerEnvTools(server) {
1774
1852
  switch (action) {
1775
1853
  case "create":
1776
1854
  result = await cloudbase.env.createEnvDomain(domains);
1855
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1777
1856
  break;
1778
1857
  case "delete":
1779
1858
  result = await cloudbase.env.deleteEnvDomain(domains);
1859
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1780
1860
  break;
1781
1861
  default:
1782
1862
  throw new Error(`不支持的操作类型: ${action}`);
@@ -23414,6 +23494,8 @@ exports.getEnvId = getEnvId;
23414
23494
  exports.resetCloudBaseManagerCache = resetCloudBaseManagerCache;
23415
23495
  exports.getCloudBaseManager = getCloudBaseManager;
23416
23496
  exports.createCloudBaseManagerWithOptions = createCloudBaseManagerWithOptions;
23497
+ exports.extractRequestId = extractRequestId;
23498
+ exports.logCloudBaseResult = logCloudBaseResult;
23417
23499
  const manager_node_1 = __importDefault(__webpack_require__(95492));
23418
23500
  const auth_js_1 = __webpack_require__(77291);
23419
23501
  const interactive_js_1 = __webpack_require__(3461);
@@ -23576,6 +23658,39 @@ function createCloudBaseManagerWithOptions(cloudBaseOptions) {
23576
23658
  });
23577
23659
  return manager;
23578
23660
  }
23661
+ /**
23662
+ * Extract RequestId from result object
23663
+ */
23664
+ function extractRequestId(result) {
23665
+ if (!result || typeof result !== 'object') {
23666
+ return undefined;
23667
+ }
23668
+ // Try common RequestId field names
23669
+ if ('RequestId' in result && result.RequestId) {
23670
+ return String(result.RequestId);
23671
+ }
23672
+ if ('requestId' in result && result.requestId) {
23673
+ return String(result.requestId);
23674
+ }
23675
+ if ('request_id' in result && result.request_id) {
23676
+ return String(result.request_id);
23677
+ }
23678
+ return undefined;
23679
+ }
23680
+ /**
23681
+ * Log CloudBase manager call result with RequestId
23682
+ */
23683
+ function logCloudBaseResult(logger, result) {
23684
+ if (!logger) {
23685
+ return;
23686
+ }
23687
+ const requestId = extractRequestId(result);
23688
+ logger({
23689
+ type: 'capiResult',
23690
+ requestId,
23691
+ result,
23692
+ });
23693
+ }
23579
23694
 
23580
23695
 
23581
23696
  /***/ }),
@@ -23696,6 +23811,7 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, server) {
23696
23811
  Channels: ['dcloud', 'iotenable', 'tem', 'scene_module'] // Filter special channels
23697
23812
  }
23698
23813
  });
23814
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server?.logger, envResult);
23699
23815
  // Transform response format to match original listEnvs() format
23700
23816
  if (envResult && envResult.EnvList) {
23701
23817
  envResult = { EnvList: envResult.EnvList };
@@ -23707,6 +23823,7 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, server) {
23707
23823
  // Fallback to original method if format is unexpected
23708
23824
  (0, logger_js_1.debug)('Unexpected response format, falling back to listEnvs()');
23709
23825
  envResult = await cloudbase.env.listEnvs();
23826
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server?.logger, envResult);
23710
23827
  }
23711
23828
  }
23712
23829
  catch (error) {
@@ -23714,6 +23831,7 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, server) {
23714
23831
  // Fallback to original method on error
23715
23832
  try {
23716
23833
  envResult = await cloudbase.env.listEnvs();
23834
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server?.logger, envResult);
23717
23835
  }
23718
23836
  catch (fallbackError) {
23719
23837
  (0, logger_js_1.debug)('降级到 listEnvs() 也失败:', fallbackError);
@@ -33515,6 +33633,7 @@ function registerSecurityRuleTools(server) {
33515
33633
  EnvId: envId,
33516
33634
  },
33517
33635
  });
33636
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33518
33637
  }
33519
33638
  else if (resourceType === "function") {
33520
33639
  // 查询云函数安全规则
@@ -33525,6 +33644,7 @@ function registerSecurityRuleTools(server) {
33525
33644
  EnvId: envId,
33526
33645
  },
33527
33646
  });
33647
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33528
33648
  }
33529
33649
  else if (resourceType === "storage") {
33530
33650
  // 查询存储安全规则
@@ -33535,6 +33655,7 @@ function registerSecurityRuleTools(server) {
33535
33655
  EnvId: envId,
33536
33656
  },
33537
33657
  });
33658
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33538
33659
  }
33539
33660
  else if (resourceType === "sqlDatabase") {
33540
33661
  // TODO: 考虑是否有支持指定其他 instance、schema 的需求
@@ -33550,6 +33671,7 @@ function registerSecurityRuleTools(server) {
33550
33671
  RoleIdentityList: ["allUser"],
33551
33672
  },
33552
33673
  });
33674
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33553
33675
  }
33554
33676
  else {
33555
33677
  throw new Error(`不支持的资源类型: ${resourceType}`);
@@ -33626,6 +33748,7 @@ function registerSecurityRuleTools(server) {
33626
33748
  Rule: rule,
33627
33749
  },
33628
33750
  });
33751
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33629
33752
  }
33630
33753
  else {
33631
33754
  result = await cloudbase.commonService().call({
@@ -33636,6 +33759,7 @@ function registerSecurityRuleTools(server) {
33636
33759
  AclTag: aclTag,
33637
33760
  },
33638
33761
  });
33762
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33639
33763
  }
33640
33764
  }
33641
33765
  else if (resourceType === "function") {
@@ -33652,6 +33776,7 @@ function registerSecurityRuleTools(server) {
33652
33776
  Rule: rule,
33653
33777
  },
33654
33778
  });
33779
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33655
33780
  }
33656
33781
  else if (resourceType === "storage") {
33657
33782
  if (aclTag === "CUSTOM") {
@@ -33666,6 +33791,7 @@ function registerSecurityRuleTools(server) {
33666
33791
  Rule: rule,
33667
33792
  },
33668
33793
  });
33794
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33669
33795
  }
33670
33796
  else {
33671
33797
  result = await cloudbase.commonService().call({
@@ -33676,6 +33802,7 @@ function registerSecurityRuleTools(server) {
33676
33802
  AclTag: aclTag,
33677
33803
  },
33678
33804
  });
33805
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33679
33806
  }
33680
33807
  }
33681
33808
  else if (resourceType === "sqlDatabase") {
@@ -33708,6 +33835,7 @@ function registerSecurityRuleTools(server) {
33708
33835
  PolicyList: policyList,
33709
33836
  },
33710
33837
  });
33838
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
33711
33839
  function getRowPermission(policy) {
33712
33840
  return {
33713
33841
  READONLY: [
@@ -38354,6 +38482,7 @@ function registerSQLDatabaseTools(server) {
38354
38482
  },
38355
38483
  },
38356
38484
  });
38485
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
38357
38486
  return {
38358
38487
  content: [
38359
38488
  {
@@ -38417,6 +38546,7 @@ function registerSQLDatabaseTools(server) {
38417
38546
  },
38418
38547
  },
38419
38548
  });
38549
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
38420
38550
  return {
38421
38551
  content: [
38422
38552
  {
@@ -48545,7 +48675,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
48545
48675
  exports.cloudBaseRequest = cloudBaseRequest;
48546
48676
  const auth_1 = __webpack_require__(23506);
48547
48677
  const http_request_1 = __webpack_require__(72088);
48548
- const SUPPORT_REGIONS = ['ap-shanghai', 'ap-guangzhou'];
48678
+ const SUPPORT_REGIONS = ['ap-shanghai', 'ap-guangzhou', 'ap-singapore'];
48549
48679
  async function cloudBaseRequest(options) {
48550
48680
  // const url = 'https://tcb-admin.tencentcloudapi.com/admin'
48551
48681
  const { config, params = {}, method = 'POST', headers = {} } = options;
@@ -48559,11 +48689,11 @@ async function cloudBaseRequest(options) {
48559
48689
  let internalRegionEndpoint = '';
48560
48690
  if (finalRegion) {
48561
48691
  if (SUPPORT_REGIONS.includes(finalRegion)) {
48562
- internetRegionEndpoint = `${finalRegion}.tcb-api.tencentcloudapi.com`;
48563
- internalRegionEndpoint = `internal.${finalRegion}.tcb-api.tencentcloudapi.com`;
48692
+ internetRegionEndpoint = `${envId}.${finalRegion}.tcb-api.tencentcloudapi.com`;
48693
+ internalRegionEndpoint = `${envId}.internal.${finalRegion}.tcb-api.tencentcloudapi.com`;
48564
48694
  }
48565
48695
  else {
48566
- console.warn('当前仅支持上海,广州地域,其他地域默认解析到固定域名(上海地域)');
48696
+ console.warn('当前仅支持上海,广州,新加坡地域,其他地域默认解析到固定域名(上海地域)');
48567
48697
  internetRegionEndpoint = `tcb-api.tencentcloudapi.com`;
48568
48698
  internalRegionEndpoint = `internal.tcb-api.tencentcloudapi.com`;
48569
48699
  }
@@ -53485,6 +53615,7 @@ const fs_1 = __importDefault(__webpack_require__(29021));
53485
53615
  const os_1 = __importDefault(__webpack_require__(21820));
53486
53616
  const path_1 = __importDefault(__webpack_require__(39902));
53487
53617
  const winston_1 = __importDefault(__webpack_require__(555));
53618
+ const cloud_mode_js_1 = __webpack_require__(89684);
53488
53619
  // Use require for winston-daily-rotate-file to avoid webpack bundling issues
53489
53620
  // Handle both CommonJS and ES module exports
53490
53621
  const DailyRotateFileModule = __webpack_require__(55622);
@@ -53536,16 +53667,18 @@ if (shouldUseConsole()) {
53536
53667
  stderrLevels: ['error', 'warn', 'info', 'debug'], // All logs go to stderr
53537
53668
  }));
53538
53669
  }
53539
- // File transport with daily rotation
53540
- transports.push(new DailyRotateFile({
53541
- dirname: logDir,
53542
- filename: 'cloudbase-mcp-%DATE%.log',
53543
- datePattern: 'YYYY-MM-DD',
53544
- format: winston_1.default.format.combine(winston_1.default.format.timestamp({ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' }), logFormat),
53545
- maxFiles: '30d', // Keep logs for 30 days
53546
- maxSize: '20m', // Max file size before rotation
53547
- zippedArchive: false, // Don't compress old logs
53548
- }));
53670
+ if (!(0, cloud_mode_js_1.isCloudMode)()) {
53671
+ // File transport with daily rotation
53672
+ transports.push(new DailyRotateFile({
53673
+ dirname: logDir,
53674
+ filename: 'cloudbase-mcp-%DATE%.log',
53675
+ datePattern: 'YYYY-MM-DD',
53676
+ format: winston_1.default.format.combine(winston_1.default.format.timestamp({ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' }), logFormat),
53677
+ maxFiles: '30d', // Keep logs for 30 days
53678
+ maxSize: '20m', // Max file size before rotation
53679
+ zippedArchive: false, // Don't compress old logs
53680
+ }));
53681
+ }
53549
53682
  // Create winston logger instance
53550
53683
  const logger = winston_1.default.createLogger({
53551
53684
  level: getLogLevel(),
@@ -87084,6 +87217,7 @@ function registerFunctionTools(server) {
87084
87217
  const cloudbase = await getManager();
87085
87218
  if (action === "list") {
87086
87219
  const result = await cloudbase.functions.getFunctionList(limit, offset);
87220
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87087
87221
  return {
87088
87222
  content: [
87089
87223
  {
@@ -87098,6 +87232,7 @@ function registerFunctionTools(server) {
87098
87232
  throw new Error("获取函数详情时,name 参数是必需的");
87099
87233
  }
87100
87234
  const result = await cloudbase.functions.getFunctionDetail(name, codeSecret);
87235
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87101
87236
  return {
87102
87237
  content: [
87103
87238
  {
@@ -87179,6 +87314,7 @@ function registerFunctionTools(server) {
87179
87314
  functionRootPath: processedRootPath,
87180
87315
  force
87181
87316
  });
87317
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87182
87318
  return {
87183
87319
  content: [
87184
87320
  {
@@ -87226,6 +87362,7 @@ function registerFunctionTools(server) {
87226
87362
  // 使用闭包中的 cloudBaseOptions
87227
87363
  const cloudbase = await getManager();
87228
87364
  const result = await cloudbase.functions.updateFunctionCode(updateParams);
87365
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87229
87366
  return {
87230
87367
  content: [
87231
87368
  {
@@ -87266,6 +87403,7 @@ function registerFunctionTools(server) {
87266
87403
  // 使用闭包中的 cloudBaseOptions
87267
87404
  const cloudbase = await getManager();
87268
87405
  const result = await cloudbase.functions.updateFunctionConfig(funcParam);
87406
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87269
87407
  return {
87270
87408
  content: [
87271
87409
  {
@@ -87294,6 +87432,7 @@ function registerFunctionTools(server) {
87294
87432
  // 使用闭包中的 cloudBaseOptions
87295
87433
  const cloudbase = await getManager();
87296
87434
  const result = await cloudbase.functions.invokeFunction(name, params);
87435
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87297
87436
  return {
87298
87437
  content: [
87299
87438
  {
@@ -87334,6 +87473,7 @@ function registerFunctionTools(server) {
87334
87473
  }
87335
87474
  const cloudbase = await getManager();
87336
87475
  const result = await cloudbase.functions.getFunctionLogsV2({ name, offset, limit, startTime, endTime, requestId, qualifier });
87476
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87337
87477
  return {
87338
87478
  content: [
87339
87479
  {
@@ -87371,6 +87511,7 @@ function registerFunctionTools(server) {
87371
87511
  endTime,
87372
87512
  logRequestId: requestId
87373
87513
  });
87514
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87374
87515
  return {
87375
87516
  content: [
87376
87517
  {
@@ -87409,6 +87550,7 @@ function registerFunctionTools(server) {
87409
87550
  throw new Error("创建触发器时,triggers 参数是必需的");
87410
87551
  }
87411
87552
  const result = await cloudbase.functions.createFunctionTriggers(name, triggers);
87553
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87412
87554
  return {
87413
87555
  content: [
87414
87556
  {
@@ -87423,6 +87565,7 @@ function registerFunctionTools(server) {
87423
87565
  throw new Error("删除触发器时,triggerName 参数是必需的");
87424
87566
  }
87425
87567
  const result = await cloudbase.functions.deleteFunctionTrigger(name, triggerName);
87568
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
87426
87569
  return {
87427
87570
  content: [
87428
87571
  {
@@ -90156,19 +90299,20 @@ class EnvService {
90156
90299
  });
90157
90300
  }
90158
90301
  getCos() {
90302
+ const internalEndpoint = this.environment.cloudBaseContext.isInternalEndpoint();
90159
90303
  const { secretId, secretKey, token } = this.environment.getAuthConfig();
90160
90304
  const cosConfig = {
90161
90305
  SecretId: secretId,
90162
90306
  SecretKey: secretKey,
90163
90307
  SecurityToken: token,
90164
- Domain: constant_1.USE_INTERNAL_ENDPOINT ? "{Bucket}.cos-internal.{Region}.tencentcos.cn" /* COS_ENDPOINT.INTERNAL */ : "{Bucket}.cos.{Region}.tencentcos.cn" /* COS_ENDPOINT.PUBLIC */,
90308
+ Domain: internalEndpoint ? "{Bucket}.cos-internal.{Region}.tencentcos.cn" /* COS_ENDPOINT.INTERNAL */ : "{Bucket}.cos.{Region}.tencentcos.cn" /* COS_ENDPOINT.PUBLIC */,
90165
90309
  };
90166
90310
  if (constant_1.COS_SDK_PROTOCOL) {
90167
90311
  cosConfig.Protocol = (constant_1.COS_SDK_PROTOCOL.endsWith(':')
90168
90312
  ? constant_1.COS_SDK_PROTOCOL.toLowerCase()
90169
90313
  : constant_1.COS_SDK_PROTOCOL.toLowerCase() + ':');
90170
90314
  }
90171
- if (constant_1.USE_INTERNAL_ENDPOINT) {
90315
+ if (internalEndpoint) {
90172
90316
  cosConfig.Protocol = 'http:';
90173
90317
  }
90174
90318
  return new cos_nodejs_sdk_v5_1.default(cosConfig);
@@ -100395,7 +100539,7 @@ function parseEnabledPlugins() {
100395
100539
  * await server.connect(transport);
100396
100540
  */
100397
100541
  async function createCloudBaseMcpServer(options) {
100398
- const { name = "cloudbase-mcp", version = "1.0.0", enableTelemetry = true, cloudBaseOptions, cloudMode = false, ide, } = options ?? {};
100542
+ const { name = "cloudbase-mcp", version = "1.0.0", enableTelemetry = true, cloudBaseOptions, cloudMode = false, ide, logger, } = options ?? {};
100399
100543
  // Enable cloud mode if specified
100400
100544
  if (cloudMode) {
100401
100545
  (0, cloud_mode_js_1.enableCloudMode)();
@@ -100425,6 +100569,10 @@ async function createCloudBaseMcpServer(options) {
100425
100569
  if (ide) {
100426
100570
  server.ide = ide;
100427
100571
  }
100572
+ // Store logger in server instance for tools to access
100573
+ if (logger) {
100574
+ server.logger = logger;
100575
+ }
100428
100576
  // Enable telemetry if requested
100429
100577
  if (enableTelemetry) {
100430
100578
  (0, tool_wrapper_js_1.wrapServerWithTelemetry)(server);
@@ -106898,6 +107046,7 @@ function registerDataModelTools(server) {
106898
107046
  Name: name,
106899
107047
  },
106900
107048
  });
107049
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
106901
107050
  // 只保留基础字段,过滤掉冗余信息,并简化Schema
106902
107051
  let simplifiedSchema = null;
106903
107052
  // 解析并简化Schema
@@ -107036,6 +107185,7 @@ function registerDataModelTools(server) {
107036
107185
  Action: "DescribeDataSourceList",
107037
107186
  Param: listParams,
107038
107187
  });
107188
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
107039
107189
  const models = result.Data?.Rows || [];
107040
107190
  // 只保留基础字段,list操作不返回Schema
107041
107191
  const simplifiedModels = models.map((model) => ({
@@ -107072,6 +107222,7 @@ function registerDataModelTools(server) {
107072
107222
  Name: name,
107073
107223
  },
107074
107224
  });
107225
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
107075
107226
  if (!result.Data) {
107076
107227
  throw new Error(`数据模型 ${name} 不存在`);
107077
107228
  }
@@ -107276,6 +107427,7 @@ classDiagram
107276
107427
  EnvId: currentEnvId,
107277
107428
  },
107278
107429
  });
107430
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
107279
107431
  const taskId = result.Data?.TaskId;
107280
107432
  if (!taskId) {
107281
107433
  return {
@@ -107306,6 +107458,7 @@ classDiagram
107306
107458
  TaskId: taskId,
107307
107459
  },
107308
107460
  });
107461
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, statusResult);
107309
107462
  status = statusResult.Data?.Status || "init";
107310
107463
  }
107311
107464
  // 返回最终结果
@@ -115036,8 +115189,10 @@ function registerHostingTools(server) {
115036
115189
  files,
115037
115190
  ignore
115038
115191
  });
115192
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115039
115193
  // 获取环境信息
115040
115194
  const envInfo = await cloudbase.env.getEnvInfo();
115195
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, envInfo);
115041
115196
  const staticDomain = envInfo.EnvInfo?.StaticStorages?.[0]?.StaticDomain;
115042
115197
  const accessUrl = staticDomain ? `https://${staticDomain}/${cloudPath || ''}` : "";
115043
115198
  // Send deployment notification to CodeBuddy IDE
@@ -115111,6 +115266,7 @@ function registerHostingTools(server) {
115111
115266
  cloudPath,
115112
115267
  isDir
115113
115268
  });
115269
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115114
115270
  return {
115115
115271
  content: [
115116
115272
  {
@@ -115141,6 +115297,7 @@ function registerHostingTools(server) {
115141
115297
  marker,
115142
115298
  maxKeys
115143
115299
  });
115300
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115144
115301
  return {
115145
115302
  content: [
115146
115303
  {
@@ -115206,6 +115363,7 @@ function registerHostingTools(server) {
115206
115363
  domain,
115207
115364
  certId
115208
115365
  });
115366
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115209
115367
  break;
115210
115368
  case "delete":
115211
115369
  if (!domain) {
@@ -115214,6 +115372,7 @@ function registerHostingTools(server) {
115214
115372
  result = await cloudbase.hosting.deleteHostingDomain({
115215
115373
  domain
115216
115374
  });
115375
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115217
115376
  break;
115218
115377
  case "check":
115219
115378
  if (!domains || domains.length === 0) {
@@ -115222,6 +115381,7 @@ function registerHostingTools(server) {
115222
115381
  result = await cloudbase.hosting.tcbCheckResource({
115223
115382
  domains
115224
115383
  });
115384
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115225
115385
  break;
115226
115386
  case "modify":
115227
115387
  if (!domain || domainId === undefined || !domainConfig) {
@@ -115232,6 +115392,7 @@ function registerHostingTools(server) {
115232
115392
  domainId,
115233
115393
  domainConfig
115234
115394
  });
115395
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
115235
115396
  break;
115236
115397
  default:
115237
115398
  throw new Error(`不支持的操作类型: ${action}`);
@@ -130366,6 +130527,7 @@ function registerInviteCodeTools(server) {
130366
130527
  Action: 'ActivateInviteCode',
130367
130528
  Param: { InviteCode, EnvId }
130368
130529
  });
130530
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
130369
130531
  return {
130370
130532
  content: [
130371
130533
  {
@@ -135012,7 +135174,7 @@ class TelemetryReporter {
135012
135174
  const nodeVersion = process.version; // Node.js版本
135013
135175
  const arch = os_1.default.arch(); // 系统架构
135014
135176
  // 从构建时注入的版本号获取MCP版本信息
135015
- const mcpVersion = process.env.npm_package_version || "2.3.1" || 0;
135177
+ const mcpVersion = process.env.npm_package_version || "2.4.0" || 0;
135016
135178
  return {
135017
135179
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
135018
135180
  deviceId: this.deviceId,
@@ -179610,6 +179772,7 @@ exports.sleep = sleep;
179610
179772
  exports.upperCaseStringFisrt = upperCaseStringFisrt;
179611
179773
  exports.upperCaseObjKey = upperCaseObjKey;
179612
179774
  exports.fetchTemplates = fetchTemplates;
179775
+ exports.successLog = successLog;
179613
179776
  const archiver_1 = __importDefault(__webpack_require__(99133));
179614
179777
  const crypto_1 = __importDefault(__webpack_require__(55511));
179615
179778
  const fs_extra_1 = __importDefault(__webpack_require__(21605));
@@ -179888,6 +180051,10 @@ const getCompleteTimeRange = (timeRange) => {
179888
180051
  };
179889
180052
  };
179890
180053
  exports.getCompleteTimeRange = getCompleteTimeRange;
180054
+ function successLog(msg) {
180055
+ // 空格,兼容中文字符编码长度问题
180056
+ console.log(`${msg}`);
180057
+ }
179891
180058
 
179892
180059
 
179893
180060
  /***/ }),
@@ -185489,6 +185656,7 @@ exports.getClaudePrompt = getClaudePrompt;
185489
185656
  exports.registerRagTools = registerRagTools;
185490
185657
  const adm_zip_1 = __importDefault(__webpack_require__(30283));
185491
185658
  const fs = __importStar(__webpack_require__(79748));
185659
+ const lockfile_1 = __importDefault(__webpack_require__(80127));
185492
185660
  const os = __importStar(__webpack_require__(21820));
185493
185661
  const path = __importStar(__webpack_require__(39902));
185494
185662
  const zod_1 = __webpack_require__(21614);
@@ -185505,7 +185673,39 @@ const KnowledgeBaseIdMap = {
185505
185673
  // ============ 缓存配置 ============
185506
185674
  const CACHE_BASE_DIR = path.join(os.homedir(), ".cloudbase-mcp");
185507
185675
  const CACHE_META_FILE = path.join(CACHE_BASE_DIR, "cache-meta.json");
185676
+ const LOCK_FILE = path.join(CACHE_BASE_DIR, ".download.lock");
185508
185677
  const DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 默认 24 小时
185678
+ // Promise wrapper for lockfile methods
185679
+ function acquireLock(lockPath, options) {
185680
+ return new Promise((resolve, reject) => {
185681
+ if (options) {
185682
+ lockfile_1.default.lock(lockPath, options, (err) => {
185683
+ if (err)
185684
+ reject(err);
185685
+ else
185686
+ resolve();
185687
+ });
185688
+ }
185689
+ else {
185690
+ lockfile_1.default.lock(lockPath, (err) => {
185691
+ if (err)
185692
+ reject(err);
185693
+ else
185694
+ resolve();
185695
+ });
185696
+ }
185697
+ });
185698
+ }
185699
+ function releaseLock(lockPath) {
185700
+ return new Promise((resolve, reject) => {
185701
+ lockfile_1.default.unlock(lockPath, (err) => {
185702
+ if (err)
185703
+ reject(err);
185704
+ else
185705
+ resolve();
185706
+ });
185707
+ });
185708
+ }
185509
185709
  // 支持环境变量 CLOUDBASE_MCP_CACHE_TTL_MS 控制缓存过期时间(毫秒)
185510
185710
  const parsedCacheTTL = process.env.CLOUDBASE_MCP_CACHE_TTL_MS
185511
185711
  ? parseInt(process.env.CLOUDBASE_MCP_CACHE_TTL_MS, 10)
@@ -185675,14 +185875,19 @@ async function _doDownloadResources() {
185675
185875
  async function downloadResources() {
185676
185876
  const webTemplateDir = path.join(CACHE_BASE_DIR, "web-template");
185677
185877
  const openAPIDir = path.join(CACHE_BASE_DIR, "openapi");
185678
- // 检查缓存是否有效
185878
+ // 如果已有下载任务在进行中,共享该 Promise
185879
+ if (resourceDownloadPromise) {
185880
+ (0, logger_js_1.debug)("[downloadResources] 共享已有下载任务");
185881
+ return resourceDownloadPromise;
185882
+ }
185883
+ // 先快速检查缓存(不需要锁,因为只是读取)
185679
185884
  if (await canUseCache()) {
185680
185885
  try {
185681
185886
  // 检查两个目录都存在
185682
185887
  await Promise.all([fs.access(webTemplateDir), fs.access(openAPIDir)]);
185683
185888
  const files = await fs.readdir(openAPIDir);
185684
185889
  if (files.length > 0) {
185685
- (0, logger_js_1.debug)("[downloadResources] 使用缓存");
185890
+ (0, logger_js_1.debug)("[downloadResources] 使用缓存(快速路径)");
185686
185891
  return {
185687
185892
  webTemplateDir,
185688
185893
  openAPIDocs: OPENAPI_SOURCES.map((source) => ({
@@ -185697,21 +185902,61 @@ async function downloadResources() {
185697
185902
  // 缓存无效,需要重新下载
185698
185903
  }
185699
185904
  }
185700
- // 如果已有下载任务在进行中,共享该 Promise
185701
- if (resourceDownloadPromise) {
185702
- (0, logger_js_1.debug)("[downloadResources] 共享已有下载任务");
185703
- return resourceDownloadPromise;
185704
- }
185705
- // 创建新的下载任务
185905
+ // 创建新的下载任务,使用文件锁保护
185706
185906
  (0, logger_js_1.debug)("[downloadResources] 开始新下载任务");
185707
185907
  await fs.mkdir(CACHE_BASE_DIR, { recursive: true });
185708
- resourceDownloadPromise = _doDownloadResources()
185709
- .then(async (result) => {
185710
- await updateCache();
185711
- (0, logger_js_1.debug)("[downloadResources] 缓存已更新");
185712
- return result;
185713
- })
185714
- .finally(() => {
185908
+ resourceDownloadPromise = (async () => {
185909
+ // 尝试获取文件锁,最多等待 6 秒(30 次 × 200ms),每 200ms 轮询一次
185910
+ let lockAcquired = false;
185911
+ try {
185912
+ await acquireLock(LOCK_FILE, {
185913
+ wait: 30 * 200, // 总等待时间:6000ms (6 秒)
185914
+ pollPeriod: 200, // 轮询间隔:200ms
185915
+ stale: 5 * 60 * 1000, // 5 分钟,如果锁文件超过这个时间认为是过期的
185916
+ });
185917
+ lockAcquired = true;
185918
+ (0, logger_js_1.debug)("[downloadResources] 文件锁已获取");
185919
+ // 在持有锁的情况下再次检查缓存(可能其他进程已经下载完成)
185920
+ if (await canUseCache()) {
185921
+ try {
185922
+ // 检查两个目录都存在
185923
+ await Promise.all([fs.access(webTemplateDir), fs.access(openAPIDir)]);
185924
+ const files = await fs.readdir(openAPIDir);
185925
+ if (files.length > 0) {
185926
+ (0, logger_js_1.debug)("[downloadResources] 使用缓存(在锁保护下检查)");
185927
+ return {
185928
+ webTemplateDir,
185929
+ openAPIDocs: OPENAPI_SOURCES.map((source) => ({
185930
+ name: source.name,
185931
+ description: source.description,
185932
+ absolutePath: path.join(openAPIDir, `${source.name}.openapi.yaml`),
185933
+ })).filter((item) => files.includes(`${item.name}.openapi.yaml`)),
185934
+ };
185935
+ }
185936
+ }
185937
+ catch {
185938
+ // 缓存无效,需要重新下载
185939
+ }
185940
+ }
185941
+ // 执行下载
185942
+ const result = await _doDownloadResources();
185943
+ await updateCache();
185944
+ (0, logger_js_1.debug)("[downloadResources] 缓存已更新");
185945
+ return result;
185946
+ }
185947
+ finally {
185948
+ // 释放文件锁
185949
+ if (lockAcquired) {
185950
+ try {
185951
+ await releaseLock(LOCK_FILE);
185952
+ (0, logger_js_1.debug)("[downloadResources] 文件锁已释放");
185953
+ }
185954
+ catch (error) {
185955
+ (0, logger_js_1.warn)("[downloadResources] 释放文件锁失败", { error });
185956
+ }
185957
+ }
185958
+ }
185959
+ })().finally(() => {
185715
185960
  resourceDownloadPromise = null;
185716
185961
  });
185717
185962
  return resourceDownloadPromise;
@@ -191310,20 +191555,25 @@ function callSuccessCallback(callback, result) {
191310
191555
  /***/ }),
191311
191556
 
191312
191557
  /***/ 65607:
191313
- /***/ ((__unused_webpack_module, exports) => {
191558
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
191314
191559
 
191315
191560
  "use strict";
191316
191561
 
191317
191562
  Object.defineProperty(exports, "__esModule", ({ value: true }));
191318
191563
  exports.CloudBaseContext = void 0;
191564
+ const constant_1 = __webpack_require__(40762);
191319
191565
  class CloudBaseContext {
191320
- constructor({ secretId = '', secretKey = '', token = '', proxy = '', region = '', envType = '' }) {
191566
+ constructor({ secretId = '', secretKey = '', token = '', proxy = '', region = '', envType = '', useInternalEndpoint = undefined }) {
191321
191567
  this.secretId = secretId;
191322
191568
  this.secretKey = secretKey;
191323
191569
  this.token = token;
191324
191570
  this.proxy = proxy;
191325
191571
  this.region = region;
191326
191572
  this.envType = envType;
191573
+ this.useInternalEndpoint = useInternalEndpoint;
191574
+ }
191575
+ isInternalEndpoint() {
191576
+ return this.useInternalEndpoint !== undefined ? this.useInternalEndpoint : constant_1.USE_INTERNAL_ENDPOINT;
191327
191577
  }
191328
191578
  }
191329
191579
  exports.CloudBaseContext = CloudBaseContext;
@@ -200805,11 +201055,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
200805
201055
  };
200806
201056
  Object.defineProperty(exports, "__esModule", ({ value: true }));
200807
201057
  exports.wrapServerWithTelemetry = wrapServerWithTelemetry;
200808
- const telemetry_js_1 = __webpack_require__(45880);
200809
- const logger_js_1 = __webpack_require__(13039);
201058
+ const os_1 = __importDefault(__webpack_require__(21820));
200810
201059
  const cloudbase_manager_js_1 = __webpack_require__(3431);
200811
201060
  const cloud_mode_js_1 = __webpack_require__(89684);
200812
- const os_1 = __importDefault(__webpack_require__(21820));
201061
+ const logger_js_1 = __webpack_require__(13039);
201062
+ const telemetry_js_1 = __webpack_require__(45880);
200813
201063
  /**
200814
201064
  * 生成 GitHub Issue 创建链接
200815
201065
  * @param toolName 工具名称
@@ -200850,7 +201100,7 @@ ${envIdSection}
200850
201100
  ## 环境信息
200851
201101
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
200852
201102
  - Node.js版本: ${process.version}
200853
- - MCP 版本:${process.env.npm_package_version || "2.3.1" || 0}
201103
+ - MCP 版本:${process.env.npm_package_version || "2.4.0" || 0}
200854
201104
  - 系统架构: ${os_1.default.arch()}
200855
201105
  - 时间: ${new Date().toISOString()}
200856
201106
  - 请求ID: ${requestId}
@@ -200888,10 +201138,13 @@ function createWrappedHandler(name, handler, server) {
200888
201138
  let requestId;
200889
201139
  try {
200890
201140
  (0, logger_js_1.debug)(`开始执行工具: ${name}`, { args: sanitizeArgs(args) });
201141
+ server.logger?.({ type: 'beforeToolCall', toolName: name, args: sanitizeArgs(args) });
200891
201142
  // 执行原始处理函数
200892
201143
  const result = await handler(args);
200893
201144
  success = true;
200894
- (0, logger_js_1.debug)(`工具执行成功: ${name}`, { duration: Date.now() - startTime });
201145
+ const duration = Date.now() - startTime;
201146
+ (0, logger_js_1.debug)(`工具执行成功: ${name}`, { duration });
201147
+ server.logger?.({ type: 'afterToolCall', toolName: name, args: sanitizeArgs(args), result: result, duration });
200895
201148
  return result;
200896
201149
  }
200897
201150
  catch (error) {
@@ -200902,6 +201155,7 @@ function createWrappedHandler(name, handler, server) {
200902
201155
  error: errorMessage,
200903
201156
  duration: Date.now() - startTime
200904
201157
  });
201158
+ server.logger?.({ type: 'errorToolCall', toolName: name, args: sanitizeArgs(args), message: errorMessage, duration: Date.now() - startTime });
200905
201159
  // 生成 GitHub Issue 创建链接
200906
201160
  const issueLink = await generateGitHubIssueLink(name, errorMessage, args, server.cloudBaseOptions, {
200907
201161
  requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
@@ -203742,6 +203996,7 @@ class StorageService {
203742
203996
  * 获取 COS 配置
203743
203997
  */
203744
203998
  getCos(parallel = 20) {
203999
+ const internalEndpoint = this.environment.cloudBaseContext.isInternalEndpoint();
203745
204000
  const { secretId, secretKey, token, proxy } = this.environment.getAuthConfig();
203746
204001
  const cosProxy = process.env.TCB_COS_PROXY;
203747
204002
  const cosConfig = {
@@ -203750,14 +204005,14 @@ class StorageService {
203750
204005
  SecretKey: secretKey,
203751
204006
  Proxy: cosProxy || proxy,
203752
204007
  SecurityToken: token,
203753
- Domain: constant_1.USE_INTERNAL_ENDPOINT ? "{Bucket}.cos-internal.{Region}.tencentcos.cn" /* COS_ENDPOINT.INTERNAL */ : "{Bucket}.cos.{Region}.tencentcos.cn" /* COS_ENDPOINT.PUBLIC */,
204008
+ Domain: internalEndpoint ? "{Bucket}.cos-internal.{Region}.tencentcos.cn" /* COS_ENDPOINT.INTERNAL */ : "{Bucket}.cos.{Region}.tencentcos.cn" /* COS_ENDPOINT.PUBLIC */,
203754
204009
  };
203755
204010
  if (constant_1.COS_SDK_PROTOCOL) {
203756
204011
  cosConfig.Protocol = (constant_1.COS_SDK_PROTOCOL.endsWith(':')
203757
204012
  ? constant_1.COS_SDK_PROTOCOL.toLowerCase()
203758
204013
  : constant_1.COS_SDK_PROTOCOL.toLowerCase() + ':');
203759
204014
  }
203760
- if (constant_1.USE_INTERNAL_ENDPOINT) {
204015
+ if (internalEndpoint) {
203761
204016
  cosConfig.Protocol = 'http:';
203762
204017
  }
203763
204018
  // COSSDK 默认开启 KeepAlive,这里提供关闭的方式
@@ -208806,6 +209061,7 @@ async function getDatabaseInstanceId(getManager) {
208806
209061
  function registerDatabaseTools(server) {
208807
209062
  // 获取 cloudBaseOptions,如果没有则为 undefined
208808
209063
  const cloudBaseOptions = server.cloudBaseOptions;
209064
+ const logger = server.logger;
208809
209065
  // 创建闭包函数来获取 CloudBase Manager
208810
209066
  const getManager = () => (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions });
208811
209067
  // readNoSqlDatabaseStructure
@@ -208853,6 +209109,7 @@ checkIndex: 检查索引是否存在`),
208853
209109
  MgoOffset: offset,
208854
209110
  MgoLimit: limit,
208855
209111
  });
209112
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
208856
209113
  return {
208857
209114
  content: [
208858
209115
  {
@@ -208873,6 +209130,7 @@ checkIndex: 检查索引是否存在`),
208873
209130
  throw new Error("检查集合时必须提供 collectionName");
208874
209131
  }
208875
209132
  const result = await cloudbase.database.checkCollectionExists(collectionName);
209133
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
208876
209134
  return {
208877
209135
  content: [
208878
209136
  {
@@ -208894,6 +209152,7 @@ checkIndex: 检查索引是否存在`),
208894
209152
  throw new Error("查看集合详情时必须提供 collectionName");
208895
209153
  }
208896
209154
  const result = await cloudbase.database.describeCollection(collectionName);
209155
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
208897
209156
  return {
208898
209157
  content: [
208899
209158
  {
@@ -208914,6 +209173,7 @@ checkIndex: 检查索引是否存在`),
208914
209173
  throw new Error("获取索引列表时必须提供 collectionName");
208915
209174
  }
208916
209175
  const result = await cloudbase.database.describeCollection(collectionName);
209176
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
208917
209177
  return {
208918
209178
  content: [
208919
209179
  {
@@ -208934,6 +209194,7 @@ checkIndex: 检查索引是否存在`),
208934
209194
  throw new Error("检查索引时必须提供 collectionName 和 indexName");
208935
209195
  }
208936
209196
  const result = await cloudbase.database.checkIndexExists(collectionName, indexName);
209197
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
208937
209198
  return {
208938
209199
  content: [
208939
209200
  {
@@ -208994,6 +209255,7 @@ updateCollection: 更新集合`),
208994
209255
  const cloudbase = await getManager();
208995
209256
  if (action === "createCollection") {
208996
209257
  const result = await cloudbase.database.createCollection(collectionName);
209258
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
208997
209259
  return {
208998
209260
  content: [
208999
209261
  {
@@ -209013,6 +209275,7 @@ updateCollection: 更新集合`),
209013
209275
  throw new Error("更新集合时必须提供 options");
209014
209276
  }
209015
209277
  const result = await cloudbase.database.updateCollection(collectionName, updateOptions);
209278
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
209016
209279
  return {
209017
209280
  content: [
209018
209281
  {
@@ -209089,6 +209352,7 @@ updateCollection: 更新集合`),
209089
209352
  Tag: instanceId,
209090
209353
  },
209091
209354
  });
209355
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
209092
209356
  return {
209093
209357
  content: [
209094
209358
  {
@@ -209166,6 +209430,7 @@ deleteCollection: 删除数据`),
209166
209430
  collectionName,
209167
209431
  documents,
209168
209432
  getManager,
209433
+ logger,
209169
209434
  });
209170
209435
  return {
209171
209436
  content: [
@@ -209190,6 +209455,7 @@ deleteCollection: 删除数据`),
209190
209455
  isMulti,
209191
209456
  upsert,
209192
209457
  getManager,
209458
+ logger,
209193
209459
  });
209194
209460
  return {
209195
209461
  content: [
@@ -209209,6 +209475,7 @@ deleteCollection: 删除数据`),
209209
209475
  query,
209210
209476
  isMulti,
209211
209477
  getManager,
209478
+ logger,
209212
209479
  });
209213
209480
  return {
209214
209481
  content: [
@@ -209222,7 +209489,7 @@ deleteCollection: 删除数据`),
209222
209489
  throw new Error(`不支持的操作类型: ${action}`);
209223
209490
  });
209224
209491
  }
209225
- async function insertDocuments({ collectionName, documents, getManager, }) {
209492
+ async function insertDocuments({ collectionName, documents, getManager, logger, }) {
209226
209493
  try {
209227
209494
  const cloudbase = await getManager();
209228
209495
  const instanceId = await getDatabaseInstanceId(getManager);
@@ -209236,6 +209503,7 @@ async function insertDocuments({ collectionName, documents, getManager, }) {
209236
209503
  Tag: instanceId,
209237
209504
  },
209238
209505
  });
209506
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(logger, result);
209239
209507
  return JSON.stringify({
209240
209508
  success: true,
209241
209509
  requestId: result.RequestId,
@@ -209251,7 +209519,7 @@ async function insertDocuments({ collectionName, documents, getManager, }) {
209251
209519
  }, null, 2);
209252
209520
  }
209253
209521
  }
209254
- async function updateDocuments({ collectionName, query, update, isMulti, upsert, getManager, }) {
209522
+ async function updateDocuments({ collectionName, query, update, isMulti, upsert, getManager, logger, }) {
209255
209523
  try {
209256
209524
  const cloudbase = await getManager();
209257
209525
  const instanceId = await getDatabaseInstanceId(getManager);
@@ -209267,6 +209535,7 @@ async function updateDocuments({ collectionName, query, update, isMulti, upsert,
209267
209535
  Tag: instanceId,
209268
209536
  },
209269
209537
  });
209538
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(logger, result);
209270
209539
  return JSON.stringify({
209271
209540
  success: true,
209272
209541
  requestId: result.RequestId,
@@ -209284,7 +209553,7 @@ async function updateDocuments({ collectionName, query, update, isMulti, upsert,
209284
209553
  }, null, 2);
209285
209554
  }
209286
209555
  }
209287
- async function deleteDocuments({ collectionName, query, isMulti, getManager, }) {
209556
+ async function deleteDocuments({ collectionName, query, isMulti, getManager, logger, }) {
209288
209557
  try {
209289
209558
  const cloudbase = await getManager();
209290
209559
  const instanceId = await getDatabaseInstanceId(getManager);
@@ -209298,6 +209567,7 @@ async function deleteDocuments({ collectionName, query, isMulti, getManager, })
209298
209567
  Tag: instanceId,
209299
209568
  },
209300
209569
  });
209570
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(logger, result);
209301
209571
  return JSON.stringify({
209302
209572
  success: true,
209303
209573
  requestId: result.RequestId,
@@ -215191,6 +215461,7 @@ const IDE_TYPES = [
215191
215461
  "qoder", // Qoder AI编辑器
215192
215462
  "antigravity", // Google Antigravity AI编辑器
215193
215463
  "vscode", // Visual Studio Code
215464
+ "kiro", // Kiro AI编辑器
215194
215465
  ];
215195
215466
  // IDE到文件的映射关系
215196
215467
  // 注意:以 "/" 结尾的路径表示目录,会包含该目录下的所有文件
@@ -215224,6 +215495,7 @@ const IDE_FILE_MAPPINGS = {
215224
215495
  qoder: [".qoder/rules/"],
215225
215496
  antigravity: [".agent/rules/"],
215226
215497
  vscode: [".vscode/mcp.json", ".vscode/settings.json"],
215498
+ kiro: [".kiro/settings/mcp.json", ".kiro/steering/"],
215227
215499
  };
215228
215500
  // 所有IDE配置文件的完整列表 - 通过IDE_FILE_MAPPINGS计算得出
215229
215501
  const ALL_IDE_FILES = Array.from(new Set(Object.values(IDE_FILE_MAPPINGS).flat()));
@@ -215250,6 +215522,7 @@ const IDE_DESCRIPTIONS = {
215250
215522
  qoder: "Qoder AI编辑器",
215251
215523
  antigravity: "Google Antigravity AI编辑器",
215252
215524
  vscode: "Visual Studio Code",
215525
+ kiro: "Kiro AI编辑器",
215253
215526
  };
215254
215527
  // INTEGRATION_IDE 环境变量值到 IDE 类型的映射
215255
215528
  const INTEGRATION_IDE_MAPPING = {
@@ -215273,6 +215546,7 @@ const INTEGRATION_IDE_MAPPING = {
215273
215546
  Qoder: "qoder",
215274
215547
  Antigravity: "antigravity",
215275
215548
  VSCode: "vscode",
215549
+ Kiro: "kiro",
215276
215550
  };
215277
215551
  // 根据 INTEGRATION_IDE 环境变量获取默认 IDE 类型
215278
215552
  function getDefaultIDEFromEnv() {
@@ -215495,7 +215769,7 @@ function registerSetupTools(server) {
215495
215769
  title: "下载项目模板",
215496
215770
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
215497
215771
 
215498
- **CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.3.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
215772
+ **CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.4.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
215499
215773
  inputSchema: {
215500
215774
  template: zod_1.z
215501
215775
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
@@ -224540,6 +224814,333 @@ function resolveIds(schema) {
224540
224814
  }
224541
224815
 
224542
224816
 
224817
+ /***/ }),
224818
+
224819
+ /***/ 80127:
224820
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
224821
+
224822
+ var fs = __webpack_require__(29021)
224823
+
224824
+ var wx = 'wx'
224825
+ if (process.version.match(/^v0\.[0-6]/)) {
224826
+ var c = __webpack_require__(81115)
224827
+ wx = c.O_TRUNC | c.O_CREAT | c.O_WRONLY | c.O_EXCL
224828
+ }
224829
+
224830
+ var os = __webpack_require__(21820)
224831
+ exports.filetime = 'ctime'
224832
+ if (os.platform() == "win32") {
224833
+ exports.filetime = 'mtime'
224834
+ }
224835
+
224836
+ var debug
224837
+ var util = __webpack_require__(28354)
224838
+ if (util.debuglog)
224839
+ debug = util.debuglog('LOCKFILE')
224840
+ else if (/\blockfile\b/i.test(process.env.NODE_DEBUG))
224841
+ debug = function() {
224842
+ var msg = util.format.apply(util, arguments)
224843
+ console.error('LOCKFILE %d %s', process.pid, msg)
224844
+ }
224845
+ else
224846
+ debug = function() {}
224847
+
224848
+ var locks = {}
224849
+
224850
+ function hasOwnProperty (obj, prop) {
224851
+ return Object.prototype.hasOwnProperty.call(obj, prop)
224852
+ }
224853
+
224854
+ var onExit = __webpack_require__(29468)
224855
+ onExit(function () {
224856
+ debug('exit listener')
224857
+ // cleanup
224858
+ Object.keys(locks).forEach(exports.unlockSync)
224859
+ })
224860
+
224861
+ // XXX https://github.com/joyent/node/issues/3555
224862
+ // Remove when node 0.8 is deprecated.
224863
+ if (/^v0\.[0-8]\./.test(process.version)) {
224864
+ debug('uncaughtException, version = %s', process.version)
224865
+ process.on('uncaughtException', function H (er) {
224866
+ debug('uncaughtException')
224867
+ var l = process.listeners('uncaughtException').filter(function (h) {
224868
+ return h !== H
224869
+ })
224870
+ if (!l.length) {
224871
+ // cleanup
224872
+ try { Object.keys(locks).forEach(exports.unlockSync) } catch (e) {}
224873
+ process.removeListener('uncaughtException', H)
224874
+ throw er
224875
+ }
224876
+ })
224877
+ }
224878
+
224879
+ exports.unlock = function (path, cb) {
224880
+ debug('unlock', path)
224881
+ // best-effort. unlocking an already-unlocked lock is a noop
224882
+ delete locks[path]
224883
+ fs.unlink(path, function (unlinkEr) { cb && cb() })
224884
+ }
224885
+
224886
+ exports.unlockSync = function (path) {
224887
+ debug('unlockSync', path)
224888
+ // best-effort. unlocking an already-unlocked lock is a noop
224889
+ try { fs.unlinkSync(path) } catch (er) {}
224890
+ delete locks[path]
224891
+ }
224892
+
224893
+
224894
+ // if the file can be opened in readonly mode, then it's there.
224895
+ // if the error is something other than ENOENT, then it's not.
224896
+ exports.check = function (path, opts, cb) {
224897
+ if (typeof opts === 'function') cb = opts, opts = {}
224898
+ debug('check', path, opts)
224899
+ fs.open(path, 'r', function (er, fd) {
224900
+ if (er) {
224901
+ if (er.code !== 'ENOENT') return cb(er)
224902
+ return cb(null, false)
224903
+ }
224904
+
224905
+ if (!opts.stale) {
224906
+ return fs.close(fd, function (er) {
224907
+ return cb(er, true)
224908
+ })
224909
+ }
224910
+
224911
+ fs.fstat(fd, function (er, st) {
224912
+ if (er) return fs.close(fd, function (er2) {
224913
+ return cb(er)
224914
+ })
224915
+
224916
+ fs.close(fd, function (er) {
224917
+ var age = Date.now() - st[exports.filetime].getTime()
224918
+ return cb(er, age <= opts.stale)
224919
+ })
224920
+ })
224921
+ })
224922
+ }
224923
+
224924
+ exports.checkSync = function (path, opts) {
224925
+ opts = opts || {}
224926
+ debug('checkSync', path, opts)
224927
+ if (opts.wait) {
224928
+ throw new Error('opts.wait not supported sync for obvious reasons')
224929
+ }
224930
+
224931
+ try {
224932
+ var fd = fs.openSync(path, 'r')
224933
+ } catch (er) {
224934
+ if (er.code !== 'ENOENT') throw er
224935
+ return false
224936
+ }
224937
+
224938
+ if (!opts.stale) {
224939
+ try { fs.closeSync(fd) } catch (er) {}
224940
+ return true
224941
+ }
224942
+
224943
+ // file exists. however, might be stale
224944
+ if (opts.stale) {
224945
+ try {
224946
+ var st = fs.fstatSync(fd)
224947
+ } finally {
224948
+ fs.closeSync(fd)
224949
+ }
224950
+ var age = Date.now() - st[exports.filetime].getTime()
224951
+ return (age <= opts.stale)
224952
+ }
224953
+ }
224954
+
224955
+
224956
+
224957
+ var req = 1
224958
+ exports.lock = function (path, opts, cb) {
224959
+ if (typeof opts === 'function') cb = opts, opts = {}
224960
+ opts.req = opts.req || req++
224961
+ debug('lock', path, opts)
224962
+ opts.start = opts.start || Date.now()
224963
+
224964
+ if (typeof opts.retries === 'number' && opts.retries > 0) {
224965
+ debug('has retries', opts.retries)
224966
+ var retries = opts.retries
224967
+ opts.retries = 0
224968
+ cb = (function (orig) { return function cb (er, fd) {
224969
+ debug('retry-mutated callback')
224970
+ retries -= 1
224971
+ if (!er || retries < 0) return orig(er, fd)
224972
+
224973
+ debug('lock retry', path, opts)
224974
+
224975
+ if (opts.retryWait) setTimeout(retry, opts.retryWait)
224976
+ else retry()
224977
+
224978
+ function retry () {
224979
+ opts.start = Date.now()
224980
+ debug('retrying', opts.start)
224981
+ exports.lock(path, opts, cb)
224982
+ }
224983
+ }})(cb)
224984
+ }
224985
+
224986
+ // try to engage the lock.
224987
+ // if this succeeds, then we're in business.
224988
+ fs.open(path, wx, function (er, fd) {
224989
+ if (!er) {
224990
+ debug('locked', path, fd)
224991
+ locks[path] = fd
224992
+ return fs.close(fd, function () {
224993
+ return cb()
224994
+ })
224995
+ }
224996
+
224997
+ debug('failed to acquire lock', er)
224998
+
224999
+ // something other than "currently locked"
225000
+ // maybe eperm or something.
225001
+ if (er.code !== 'EEXIST') {
225002
+ debug('not EEXIST error', er)
225003
+ return cb(er)
225004
+ }
225005
+
225006
+ // someone's got this one. see if it's valid.
225007
+ if (!opts.stale) return notStale(er, path, opts, cb)
225008
+
225009
+ return maybeStale(er, path, opts, false, cb)
225010
+ })
225011
+ debug('lock return')
225012
+ }
225013
+
225014
+
225015
+ // Staleness checking algorithm
225016
+ // 1. acquire $lock, fail
225017
+ // 2. stat $lock, find that it is stale
225018
+ // 3. acquire $lock.STALE
225019
+ // 4. stat $lock, assert that it is still stale
225020
+ // 5. unlink $lock
225021
+ // 6. link $lock.STALE $lock
225022
+ // 7. unlink $lock.STALE
225023
+ // On any failure, clean up whatever we've done, and raise the error.
225024
+ function maybeStale (originalEr, path, opts, hasStaleLock, cb) {
225025
+ fs.stat(path, function (statEr, st) {
225026
+ if (statEr) {
225027
+ if (statEr.code === 'ENOENT') {
225028
+ // expired already!
225029
+ opts.stale = false
225030
+ debug('lock stale enoent retry', path, opts)
225031
+ exports.lock(path, opts, cb)
225032
+ return
225033
+ }
225034
+ return cb(statEr)
225035
+ }
225036
+
225037
+ var age = Date.now() - st[exports.filetime].getTime()
225038
+ if (age <= opts.stale) return notStale(originalEr, path, opts, cb)
225039
+
225040
+ debug('lock stale', path, opts)
225041
+ if (hasStaleLock) {
225042
+ exports.unlock(path, function (er) {
225043
+ if (er) return cb(er)
225044
+ debug('lock stale retry', path, opts)
225045
+ fs.link(path + '.STALE', path, function (er) {
225046
+ fs.unlink(path + '.STALE', function () {
225047
+ // best effort. if the unlink fails, oh well.
225048
+ cb(er)
225049
+ })
225050
+ })
225051
+ })
225052
+ } else {
225053
+ debug('acquire .STALE file lock', opts)
225054
+ exports.lock(path + '.STALE', opts, function (er) {
225055
+ if (er) return cb(er)
225056
+ maybeStale(originalEr, path, opts, true, cb)
225057
+ })
225058
+ }
225059
+ })
225060
+ }
225061
+
225062
+ function notStale (er, path, opts, cb) {
225063
+ debug('notStale', path, opts)
225064
+
225065
+ // if we can't wait, then just call it a failure
225066
+ if (typeof opts.wait !== 'number' || opts.wait <= 0) {
225067
+ debug('notStale, wait is not a number')
225068
+ return cb(er)
225069
+ }
225070
+
225071
+ // poll for some ms for the lock to clear
225072
+ var now = Date.now()
225073
+ var start = opts.start || now
225074
+ var end = start + opts.wait
225075
+
225076
+ if (end <= now)
225077
+ return cb(er)
225078
+
225079
+ debug('now=%d, wait until %d (delta=%d)', start, end, end-start)
225080
+ var wait = Math.min(end - start, opts.pollPeriod || 100)
225081
+ var timer = setTimeout(poll, wait)
225082
+
225083
+ function poll () {
225084
+ debug('notStale, polling', path, opts)
225085
+ exports.lock(path, opts, cb)
225086
+ }
225087
+ }
225088
+
225089
+ exports.lockSync = function (path, opts) {
225090
+ opts = opts || {}
225091
+ opts.req = opts.req || req++
225092
+ debug('lockSync', path, opts)
225093
+ if (opts.wait || opts.retryWait) {
225094
+ throw new Error('opts.wait not supported sync for obvious reasons')
225095
+ }
225096
+
225097
+ try {
225098
+ var fd = fs.openSync(path, wx)
225099
+ locks[path] = fd
225100
+ try { fs.closeSync(fd) } catch (er) {}
225101
+ debug('locked sync!', path, fd)
225102
+ return
225103
+ } catch (er) {
225104
+ if (er.code !== 'EEXIST') return retryThrow(path, opts, er)
225105
+
225106
+ if (opts.stale) {
225107
+ var st = fs.statSync(path)
225108
+ var ct = st[exports.filetime].getTime()
225109
+ if (!(ct % 1000) && (opts.stale % 1000)) {
225110
+ // probably don't have subsecond resolution.
225111
+ // round up the staleness indicator.
225112
+ // Yes, this will be wrong 1/1000 times on platforms
225113
+ // with subsecond stat precision, but that's acceptable
225114
+ // in exchange for not mistakenly removing locks on
225115
+ // most other systems.
225116
+ opts.stale = 1000 * Math.ceil(opts.stale / 1000)
225117
+ }
225118
+ var age = Date.now() - ct
225119
+ if (age > opts.stale) {
225120
+ debug('lockSync stale', path, opts, age)
225121
+ exports.unlockSync(path)
225122
+ return exports.lockSync(path, opts)
225123
+ }
225124
+ }
225125
+
225126
+ // failed to lock!
225127
+ debug('failed to lock', path, opts, er)
225128
+ return retryThrow(path, opts, er)
225129
+ }
225130
+ }
225131
+
225132
+ function retryThrow (path, opts, er) {
225133
+ if (typeof opts.retries === 'number' && opts.retries > 0) {
225134
+ var newRT = opts.retries - 1
225135
+ debug('retryThrow', path, opts, newRT)
225136
+ opts.retries = newRT
225137
+ return exports.lockSync(path, opts)
225138
+ }
225139
+ throw er
225140
+ }
225141
+
225142
+
225143
+
224543
225144
  /***/ }),
224544
225145
 
224545
225146
  /***/ 80280:
@@ -226551,6 +227152,7 @@ class CloudService {
226551
227152
  this.cloudBaseContext = context;
226552
227153
  }
226553
227154
  get baseUrl() {
227155
+ const internalEndpoint = this.cloudBaseContext.isInternalEndpoint();
226554
227156
  const tcb = process.env.TCB_BASE_URL || 'https://tcb.tencentcloudapi.com';
226555
227157
  const urlMap = {
226556
227158
  tcb,
@@ -226564,7 +227166,7 @@ class CloudService {
226564
227166
  const intranetUrlMap = Object.keys(urlMap).map((service) => ({
226565
227167
  [service]: `https://${service}.internal.tencentcloudapi.com`,
226566
227168
  })).reduce((acc, cur) => (Object.assign(Object.assign({}, acc), cur)), {});
226567
- if (constant_1.USE_INTERNAL_ENDPOINT) {
227169
+ if (internalEndpoint) {
226568
227170
  return intranetUrlMap[this.service];
226569
227171
  }
226570
227172
  if (urlMap[this.service]) {
@@ -233358,6 +233960,7 @@ function registerGatewayTools(server) {
233358
233960
  name,
233359
233961
  path
233360
233962
  });
233963
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
233361
233964
  return {
233362
233965
  content: [
233363
233966
  {
@@ -270197,7 +270800,7 @@ class CloudBase {
270197
270800
  }
270198
270801
  constructor(config = {}) {
270199
270802
  this.cloudBaseConfig = {};
270200
- let { secretId, secretKey, token, envId, proxy, region, envType } = config;
270803
+ let { secretId, secretKey, token, envId, proxy, region, envType, useInternalEndpoint } = config;
270201
270804
  // config 中传入的 secretId secretkey 必须同时存在
270202
270805
  if ((secretId && !secretKey) || (!secretId && secretKey)) {
270203
270806
  throw new Error('secretId and secretKey must be a pair');
@@ -270209,7 +270812,8 @@ class CloudBase {
270209
270812
  envId,
270210
270813
  envType,
270211
270814
  proxy,
270212
- region
270815
+ region,
270816
+ useInternalEndpoint
270213
270817
  };
270214
270818
  // 初始化 context
270215
270819
  this.context = new context_1.CloudBaseContext(this.cloudBaseConfig);
@@ -270264,6 +270868,9 @@ class CloudBase {
270264
270868
  getManagerConfig() {
270265
270869
  return this.cloudBaseConfig;
270266
270870
  }
270871
+ get isInternalEndpoint() {
270872
+ return this.context.isInternalEndpoint();
270873
+ }
270267
270874
  }
270268
270875
  module.exports = CloudBase;
270269
270876
 
@@ -272342,6 +272949,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
272342
272949
  exports.FunctionService = void 0;
272343
272950
  const fs_1 = __importDefault(__webpack_require__(29021));
272344
272951
  const path_1 = __importDefault(__webpack_require__(39902));
272952
+ const lodash_1 = __importDefault(__webpack_require__(2543));
272345
272953
  const packer_1 = __webpack_require__(5147);
272346
272954
  const error_1 = __webpack_require__(40430);
272347
272955
  const utils_1 = __webpack_require__(62358);
@@ -272588,20 +273196,96 @@ class FunctionService {
272588
273196
  });
272589
273197
  return data;
272590
273198
  }
273199
+ /**
273200
+ * 列出所有函数
273201
+ * @param {IListFunctionOptions} options
273202
+ * @returns {Promise<Record<string, string>[]>}
273203
+ */
273204
+ async listAllFunctions(options) {
273205
+ const allFunctions = [];
273206
+ let currentOffset = 0;
273207
+ const pageSize = 20;
273208
+ const { envId } = options;
273209
+ while (true) {
273210
+ try {
273211
+ const res = await this.scfService.request('ListFunctions', {
273212
+ Namespace: envId,
273213
+ Limit: pageSize,
273214
+ Offset: currentOffset
273215
+ });
273216
+ const { Functions = [], TotalCount } = res;
273217
+ if (Functions.length === 0) {
273218
+ break;
273219
+ }
273220
+ allFunctions.push(...Functions);
273221
+ // 检查是否已获取所有函数
273222
+ if (allFunctions.length >= TotalCount || Functions.length < pageSize) {
273223
+ break;
273224
+ }
273225
+ currentOffset += pageSize;
273226
+ }
273227
+ catch (error) {
273228
+ throw new error_1.CloudBaseError(`获取函数列表失败: ${error.message}`);
273229
+ }
273230
+ }
273231
+ // 格式化数据
273232
+ const data = [];
273233
+ allFunctions.forEach(func => {
273234
+ const { FunctionId, FunctionName, Runtime, AddTime, ModTime, Status } = func;
273235
+ data.push({
273236
+ FunctionId,
273237
+ FunctionName,
273238
+ Runtime,
273239
+ AddTime,
273240
+ ModTime,
273241
+ Status
273242
+ });
273243
+ });
273244
+ return data;
273245
+ }
272591
273246
  /**
272592
273247
  * 删除云函数
272593
273248
  * @param {string} name 云函数名称
272594
273249
  * @param {string} qualifier 需要删除的版本号,不填默认删除函数下全部版本。
272595
273250
  * @returns {Promise<IResponseInfo>}
272596
273251
  */
272597
- async deleteFunction(name, qualifier) {
273252
+ async deleteFunction({ name }) {
273253
+ var _a;
272598
273254
  const { namespace } = this.getFunctionConfig();
272599
- return this.scfService.request('DeleteFunction', {
273255
+ // 检测是否绑定了 API 网关
273256
+ const accessService = this.environment.getAccessService();
273257
+ const res = await accessService.getAccessList({
273258
+ name
273259
+ });
273260
+ // 删除绑定的 API 网关
273261
+ if (((_a = res === null || res === void 0 ? void 0 : res.APISet) === null || _a === void 0 ? void 0 : _a.length) > 0) {
273262
+ await accessService.deleteAccess({
273263
+ name
273264
+ });
273265
+ }
273266
+ await this.scfService.request('DeleteFunction', {
272600
273267
  FunctionName: name,
272601
- Namespace: namespace,
272602
- Qualifier: qualifier
273268
+ Namespace: namespace
272603
273269
  });
272604
273270
  }
273271
+ /**
273272
+ * 批量删除云函数
273273
+ * @param {Object} options
273274
+ * @param {string[]} options.names 云函数名称列表
273275
+ * @returns {Promise<void>}
273276
+ */
273277
+ async batchDeleteFunctions({ names }) {
273278
+ const promises = names.map(name => (async () => {
273279
+ try {
273280
+ await this.deleteFunction({ name });
273281
+ (0, utils_1.successLog)(`[${name}] 函数删除成功!`);
273282
+ }
273283
+ catch (e) {
273284
+ throw new error_1.CloudBaseError(e.message);
273285
+ }
273286
+ })());
273287
+ await Promise.all(promises);
273288
+ }
272605
273289
  /**
272606
273290
  * 获取云函数详细信息
272607
273291
  * @param {string} name 云函数名称
@@ -272636,13 +273320,35 @@ class FunctionService {
272636
273320
  }
272637
273321
  catch (e) {
272638
273322
  data.VpcConfig = {
272639
- vpc: '',
272640
- subnet: ''
273323
+ vpc: 'VpcId',
273324
+ subnet: 'SubnetId'
272641
273325
  };
272642
273326
  }
272643
273327
  }
272644
273328
  return data;
272645
273329
  }
273330
+ /**
273331
+ * 批量获取云函数详细信息
273332
+ * @param {Object} options
273333
+ * @param {string[]} options.names 云函数名称列表
273334
+ * @param {string} options.envId 环境 ID
273335
+ * @param {string} options.codeSecret
273336
+ * @returns {Promise<IFunctionInfo[]>}
273337
+ */
273338
+ async batchGetFunctionsDetail({ names, envId, codeSecret }) {
273339
+ const data = [];
273340
+ const promises = names.map(name => (async () => {
273341
+ try {
273342
+ const info = await this.getFunctionDetail(name, codeSecret);
273343
+ data.push(info);
273344
+ }
273345
+ catch (e) {
273346
+ throw new error_1.CloudBaseError(`${name} 获取信息失败:${e.message}`);
273347
+ }
273348
+ })());
273349
+ await Promise.all(promises);
273350
+ return data;
273351
+ }
272646
273352
  /**
272647
273353
  * 获取函数日志
272648
273354
  * @deprecated 请使用 getFunctionLogsV2 代替
@@ -272739,6 +273445,33 @@ class FunctionService {
272739
273445
  const res = await this.tcbService.request('GetFunctionLogDetail', params);
272740
273446
  return res;
272741
273447
  }
273448
+ /**
273449
+ * 获取函数的完整调用日志
273450
+ * 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
273451
+ * @param {IFunctionLogOptionsV2} options - 查询选项
273452
+ * @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
273453
+ */
273454
+ async getCompleteFunctionLogs(options) {
273455
+ // 调用 getFunctionLogsV2 获取日志请求ID列表
273456
+ const { name } = options;
273457
+ const logs = await this.getFunctionLogsV2(options);
273458
+ // 如果没有日志,直接返回空数组
273459
+ if (logs.LogList.length === 0) {
273460
+ return [];
273461
+ }
273462
+ const detailPromises = logs.LogList.map(async (log) => {
273463
+ // 对每一个日志ID,调用 getFunctionLogDetail
273464
+ const res = await this.getFunctionLogDetail({
273465
+ logRequestId: log.RequestId,
273466
+ startTime: options.startTime,
273467
+ endTime: options.endTime
273468
+ });
273469
+ return Object.assign(Object.assign({}, res), { RetCode: log.RetCode, FunctionName: name });
273470
+ });
273471
+ // 并发执行所有详情查询,等待它们全部完成
273472
+ const detailedLogs = await Promise.all(detailPromises);
273473
+ return detailedLogs;
273474
+ }
272742
273475
  /**
272743
273476
  * 更新云函数配置
272744
273477
  * @param {ICloudFunction} func 云函数配置
@@ -272874,6 +273607,28 @@ class FunctionService {
272874
273607
  throw new error_1.CloudBaseError(`[${name}] 调用失败:\n${e.message}`);
272875
273608
  }
272876
273609
  }
273610
+ /**
273611
+ * 批量调用云函数
273612
+ * @param {IFunctionBatchOptions} options
273613
+ * @returns {Promise<IFunctionInvokeRes[]>}
273614
+ */
273615
+ async batchInvokeFunctions(options) {
273616
+ const { functions, envId, log = false } = options;
273617
+ const promises = functions.map(func => (async () => {
273618
+ try {
273619
+ const result = await this.invokeFunction(func.name, func.params);
273620
+ if (log) {
273621
+ (0, utils_1.successLog)(`[${func.name}] 调用成功\n响应结果:\n`);
273622
+ console.log(result);
273623
+ }
273624
+ return result;
273625
+ }
273626
+ catch (e) {
273627
+ throw new error_1.CloudBaseError(`${func.name} 函数调用失败:${e.message}`);
273628
+ }
273629
+ })());
273630
+ return Promise.all(promises);
273631
+ }
272877
273632
  /**
272878
273633
  * 复制云函数
272879
273634
  * @param {string} name 云函数名称
@@ -272916,12 +273671,34 @@ class FunctionService {
272916
273671
  TriggerDesc: item.config
272917
273672
  };
272918
273673
  });
272919
- return this.scfService.request('BatchCreateTrigger', {
272920
- FunctionName: name,
272921
- Namespace: namespace,
272922
- Triggers: JSON.stringify(parsedTriggers),
272923
- Count: parsedTriggers.length
272924
- });
273674
+ try {
273675
+ return await this.scfService.request('BatchCreateTrigger', {
273676
+ FunctionName: name,
273677
+ Namespace: namespace,
273678
+ Triggers: JSON.stringify(parsedTriggers),
273679
+ Count: parsedTriggers.length
273680
+ });
273681
+ }
273682
+ catch (e) {
273683
+ throw new error_1.CloudBaseError(`[${name}] 创建触发器失败:${e.message}`, {
273684
+ action: e.action,
273685
+ code: e.code
273686
+ });
273687
+ }
273688
+ }
273689
+ // 批量部署函数触发器
273690
+ async batchCreateTriggers(options) {
273691
+ const { functions, envId } = options;
273692
+ const promises = functions.map(func => (async () => {
273693
+ try {
273694
+ await this.createFunctionTriggers(func.name, func.triggers);
273695
+ (0, utils_1.successLog)(`[${func.name}] 创建云函数触发器成功!`);
273696
+ }
273697
+ catch (e) {
273698
+ throw new error_1.CloudBaseError(e.message);
273699
+ }
273700
+ })());
273701
+ await Promise.all(promises);
272925
273702
  }
272926
273703
  /**
272927
273704
  * 删除云函数触发器
@@ -272931,12 +273708,50 @@ class FunctionService {
272931
273708
  */
272932
273709
  async deleteFunctionTrigger(name, triggerName) {
272933
273710
  const { namespace } = this.getFunctionConfig();
272934
- return this.scfService.request('DeleteTrigger', {
272935
- FunctionName: name,
272936
- Namespace: namespace,
272937
- TriggerName: triggerName,
272938
- Type: 'timer'
273711
+ try {
273712
+ await this.scfService.request('DeleteTrigger', {
273713
+ FunctionName: name,
273714
+ Namespace: namespace,
273715
+ TriggerName: triggerName,
273716
+ Type: 'timer'
273717
+ });
273718
+ (0, utils_1.successLog)(`[${name}] 删除云函数触发器 ${triggerName} 成功!`);
273719
+ }
273720
+ catch (e) {
273721
+ throw new error_1.CloudBaseError(`[${name}] 删除触发器失败:${e.message}`);
273722
+ }
273723
+ }
273724
+ async batchDeleteTriggers(options) {
273725
+ const { functions, envId } = options;
273726
+ const promises = functions.map(func => (async () => {
273727
+ try {
273728
+ func.triggers.forEach(async (trigger) => {
273729
+ await this.deleteFunctionTrigger(func.name, trigger.name);
273730
+ });
273731
+ }
273732
+ catch (e) {
273733
+ throw new error_1.CloudBaseError(e.message);
273734
+ }
273735
+ })());
273736
+ await Promise.all(promises);
273737
+ }
273738
+ /**
273739
+ * 下载云函数代码
273740
+ * @param {IFunctionCodeOptions} options
273741
+ * @returns {Promise<void>}
273742
+ */
273743
+ async downloadFunctionCode(options) {
273744
+ const { destPath, envId, functionName, codeSecret } = options;
273745
+ // 检验路径是否存在
273746
+ (0, utils_1.checkFullAccess)(destPath, true);
273747
+ // 获取下载链接
273748
+ const { Url } = await this.scfService.request('GetFunctionAddress', {
273749
+ FunctionName: functionName,
273750
+ Namespace: envId,
273751
+ CodeSecret: codeSecret
272939
273752
  });
273753
+ // 下载文件
273754
+ return (0, utils_1.downloadAndExtractRemoteZip)(Url, destPath);
272940
273755
  }
272941
273756
  /**
272942
273757
  * 获取云函数代码下载 链接
@@ -272962,6 +273777,68 @@ class FunctionService {
272962
273777
  throw new error_1.CloudBaseError(`[${functionName}] 获取函数代码下载链接失败:\n${e.message}`);
272963
273778
  }
272964
273779
  }
273780
+ // 函数绑定文件层
273781
+ async attachLayer(options) {
273782
+ const { envId, functionName, layerName, layerVersion, codeSecret } = options;
273783
+ let { Layers = [] } = await this.getFunctionDetail(functionName, codeSecret);
273784
+ Layers = Layers.map(item => lodash_1.default.pick(item, ['LayerName', 'LayerVersion']));
273785
+ // 新加的文件层添加到最后
273786
+ Layers.push({
273787
+ LayerName: layerName,
273788
+ LayerVersion: layerVersion
273789
+ });
273790
+ const res = await this.scfService.request('UpdateFunctionConfiguration', {
273791
+ Layers,
273792
+ Namespace: envId,
273793
+ FunctionName: functionName
273794
+ });
273795
+ return res;
273796
+ }
273797
+ // 函数解绑文件层
273798
+ async unAttachLayer(options) {
273799
+ const { envId, functionName, layerName, layerVersion, codeSecret } = options;
273800
+ let { Layers } = await this.getFunctionDetail(functionName, codeSecret);
273801
+ Layers = Layers.map(item => lodash_1.default.pick(item, ['LayerName', 'LayerVersion']));
273802
+ const index = Layers.findIndex(item => item.LayerName === layerName && item.LayerVersion === layerVersion);
273803
+ if (index === -1) {
273804
+ throw new error_1.CloudBaseError('层不存在');
273805
+ }
273806
+ // 删除指定的层
273807
+ Layers.splice(index, 1);
273808
+ const apiParams = {
273809
+ Namespace: envId,
273810
+ FunctionName: functionName,
273811
+ Layers: Layers.length > 0 ? Layers : [{
273812
+ LayerName: '',
273813
+ LayerVersion: 0
273814
+ }]
273815
+ };
273816
+ return this.scfService.request('UpdateFunctionConfiguration', apiParams);
273817
+ }
273818
+ // 更新云函数层
273819
+ async updateFunctionLayer(options) {
273820
+ const { envId, functionName, layers } = options;
273821
+ return this.scfService.request('UpdateFunctionConfiguration', {
273822
+ Layers: layers,
273823
+ Namespace: envId,
273824
+ FunctionName: functionName
273825
+ });
273826
+ }
273827
+ // 下载文件层 ZIP 文件
273828
+ async downloadLayer(options) {
273829
+ const { name, version, destPath } = options;
273830
+ const res = await this.scfService.request('GetLayerVersion', {
273831
+ LayerName: name,
273832
+ LayerVersion: version
273833
+ });
273834
+ const url = res === null || res === void 0 ? void 0 : res.Location;
273835
+ const zipPath = path_1.default.join(destPath, `${name}-${version}.zip`);
273836
+ if ((0, utils_1.checkFullAccess)(zipPath)) {
273837
+ throw new error_1.CloudBaseError(`文件已存在:${zipPath}`);
273838
+ }
273839
+ // 下载文件
273840
+ return (0, utils_1.downloadAndExtractRemoteZip)(url, destPath);
273841
+ }
272965
273842
  // 创建文件层版本
272966
273843
  async createLayer(options) {
272967
273844
  const { env } = this.getFunctionConfig();
@@ -273034,7 +273911,7 @@ class FunctionService {
273034
273911
  Limit: limit,
273035
273912
  Offset: offset,
273036
273913
  SearchKey: searchKey,
273037
- SearchSrc: `TCB_${env}`
273914
+ // SearchSrc: `TCB_${env}`
273038
273915
  };
273039
273916
  if (runtime) {
273040
273917
  param.CompatibleRuntime = runtime;
@@ -273363,12 +274240,18 @@ __decorate([
273363
274240
  __decorate([
273364
274241
  (0, utils_1.preLazy)()
273365
274242
  ], FunctionService.prototype, "listFunctions", null);
274243
+ __decorate([
274244
+ (0, utils_1.preLazy)()
274245
+ ], FunctionService.prototype, "listAllFunctions", null);
273366
274246
  __decorate([
273367
274247
  (0, utils_1.preLazy)()
273368
274248
  ], FunctionService.prototype, "deleteFunction", null);
273369
274249
  __decorate([
273370
274250
  (0, utils_1.preLazy)()
273371
274251
  ], FunctionService.prototype, "getFunctionDetail", null);
274252
+ __decorate([
274253
+ (0, utils_1.preLazy)()
274254
+ ], FunctionService.prototype, "batchGetFunctionsDetail", null);
273372
274255
  __decorate([
273373
274256
  (0, utils_1.preLazy)()
273374
274257
  ], FunctionService.prototype, "getFunctionLogs", null);
@@ -273378,6 +274261,9 @@ __decorate([
273378
274261
  __decorate([
273379
274262
  (0, utils_1.preLazy)()
273380
274263
  ], FunctionService.prototype, "getFunctionLogDetail", null);
274264
+ __decorate([
274265
+ (0, utils_1.preLazy)()
274266
+ ], FunctionService.prototype, "getCompleteFunctionLogs", null);
273381
274267
  __decorate([
273382
274268
  (0, utils_1.preLazy)()
273383
274269
  ], FunctionService.prototype, "updateFunctionConfig", null);
@@ -273387,6 +274273,9 @@ __decorate([
273387
274273
  __decorate([
273388
274274
  (0, utils_1.preLazy)()
273389
274275
  ], FunctionService.prototype, "invokeFunction", null);
274276
+ __decorate([
274277
+ (0, utils_1.preLazy)()
274278
+ ], FunctionService.prototype, "batchInvokeFunctions", null);
273390
274279
  __decorate([
273391
274280
  (0, utils_1.preLazy)()
273392
274281
  ], FunctionService.prototype, "copyFunction", null);
@@ -273399,6 +274288,18 @@ __decorate([
273399
274288
  __decorate([
273400
274289
  (0, utils_1.preLazy)()
273401
274290
  ], FunctionService.prototype, "getFunctionDownloadUrl", null);
274291
+ __decorate([
274292
+ (0, utils_1.preLazy)()
274293
+ ], FunctionService.prototype, "attachLayer", null);
274294
+ __decorate([
274295
+ (0, utils_1.preLazy)()
274296
+ ], FunctionService.prototype, "unAttachLayer", null);
274297
+ __decorate([
274298
+ (0, utils_1.preLazy)()
274299
+ ], FunctionService.prototype, "updateFunctionLayer", null);
274300
+ __decorate([
274301
+ (0, utils_1.preLazy)()
274302
+ ], FunctionService.prototype, "downloadLayer", null);
273402
274303
  __decorate([
273403
274304
  (0, utils_1.preLazy)()
273404
274305
  ], FunctionService.prototype, "createLayer", null);