@cloudbase/cli 2.12.9-beta.0 → 2.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -326328,7 +326328,7 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
326328
326328
  /***/ ((module) => {
326329
326329
 
326330
326330
  "use strict";
326331
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.12.9-beta.0","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"node ./scripts/check-publish-source.js","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs && node build/scripts/copy-figlet-fonts.js","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","package:npm":"npm run build && npm run build:bundle && bash build/scripts/prepare-publish.sh","out:prune":"bash build/scripts/prune-out.sh","i18n:scan":"i18next-scanner --config locales/i18next-scanner.config.js && node locales/scripts/generate.js","i18n:sync":"node locales/scripts/sync.js sync","publish":"node ./scripts/publish.js"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^2.7.3","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.14","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.10.6","@cloudbase/toolbox":"0.7.17","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","os-locale":"5.0.0","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@babel/parser":"^7.28.4","@babel/traverse":"^7.28.4","@babel/types":"^7.28.4","@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","i18next-scanner":"^4.6.0","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557","ai":{"skills":"./skills","skillsIndex":"./skills/index.json","compatible":["codebuddy","cursor","copilot","claude","windsurf"],"description":"CloudBase CLI - 腾讯云云开发命令行工具,支持云函数、云数据库、静态托管等全栈云开发能力"}}');
326331
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.12.9","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"node ./scripts/check-publish-source.js","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs && node build/scripts/copy-figlet-fonts.js","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","package:npm":"npm run build && npm run build:bundle && bash build/scripts/prepare-publish.sh","out:prune":"bash build/scripts/prune-out.sh","i18n:scan":"i18next-scanner --config locales/i18next-scanner.config.js && node locales/scripts/generate.js","i18n:sync":"node locales/scripts/sync.js sync","publish":"node ./scripts/publish.js"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^2.7.3","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.14","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.10.6","@cloudbase/toolbox":"0.7.19","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","os-locale":"5.0.0","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@babel/parser":"^7.28.4","@babel/traverse":"^7.28.4","@babel/types":"^7.28.4","@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","i18next-scanner":"^4.6.0","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557","ai":{"skills":"./skills","skillsIndex":"./skills/index.json","compatible":["codebuddy","cursor","copilot","claude","windsurf"],"description":"CloudBase CLI - 腾讯云云开发命令行工具,支持云函数、云数据库、静态托管等全栈云开发能力"}}');
326332
326332
 
326333
326333
  /***/ }),
326334
326334
 
@@ -398554,7 +398554,7 @@ class AuthSupervisor {
398554
398554
  */
398555
398555
  loginByWebAuth(options = {}) {
398556
398556
  return __awaiter(this, void 0, void 0, function* () {
398557
- const { getAuthUrl, throwError, noBrowser, callbackTimeout, flow = 'device', client_id, onDeviceCode, getOAuthEndpoint, silent } = options;
398557
+ const { getAuthUrl, throwError, noBrowser, callbackTimeout, flow = 'device', client_id, onDeviceCode, getOAuthEndpoint, silent, custom } = options;
398558
398558
  if (this.cacheCredential && this.needCache && !this.isCacheExpire()) {
398559
398559
  return this.cacheCredential;
398560
398560
  }
@@ -398572,7 +398572,7 @@ class AuthSupervisor {
398572
398572
  });
398573
398573
  }
398574
398574
  else {
398575
- credential = yield (0, oauth_1.getAuthTokenByDeviceFlow)({ client_id, onDeviceCode, getOAuthEndpoint, getAuthUrl, silent });
398575
+ credential = yield (0, oauth_1.getAuthTokenByDeviceFlow)({ client_id, onDeviceCode, getOAuthEndpoint, getAuthUrl, silent, custom });
398576
398576
  }
398577
398577
  credential = (0, common_1.resolveCredential)(credential);
398578
398578
  try {
@@ -440265,10 +440265,11 @@ const LoginRes = {
440265
440265
  };
440266
440266
  }
440267
440267
  };
440268
- function loginByWebAuth({ flow } = {}) {
440268
+ function loginByWebAuth({ flow, endpoint } = {}) {
440269
440269
  return __awaiter(this, void 0, void 0, function* () {
440270
440270
  try {
440271
440271
  const credential = yield utils_1.authSupevisor.loginByWebAuth({
440272
+ custom: Boolean(endpoint),
440272
440273
  flow,
440273
440274
  getAuthUrl: (rawUrl) => {
440274
440275
  if ((0, i18n_1.isIntl)()) {
@@ -440277,6 +440278,9 @@ function loginByWebAuth({ flow } = {}) {
440277
440278
  return rawUrl;
440278
440279
  },
440279
440280
  getOAuthEndpoint: (rawEndpoint) => {
440281
+ if (endpoint) {
440282
+ return endpoint;
440283
+ }
440280
440284
  if ((0, i18n_1.isIntl)()) {
440281
440285
  return rawEndpoint.replace('https://tcb-api.cloud.tencent.com', 'https://tcb-api.tencentcloud.com');
440282
440286
  }
@@ -440313,8 +440317,8 @@ function loginWithKey(secretId, secretKey, token) {
440313
440317
  exports.loginWithKey = loginWithKey;
440314
440318
  function login(options = {}) {
440315
440319
  return __awaiter(this, void 0, void 0, function* () {
440316
- const { secretId, secretKey, key, token, flow } = options;
440317
- return key ? loginWithKey(secretId, secretKey, token) : loginByWebAuth({ flow });
440320
+ const { secretId, secretKey, key, token, flow, endpoint } = options;
440321
+ return key ? loginWithKey(secretId, secretKey, token) : loginByWebAuth({ flow, endpoint });
440318
440322
  });
440319
440323
  }
440320
440324
  exports.login = login;
@@ -867089,25 +867093,64 @@ function sleep(ms) {
867089
867093
  setTimeout(resolve, ms);
867090
867094
  });
867091
867095
  }
867096
+ /**
867097
+ * 将接口原始返回值归一化为裸数据。
867098
+ * - 标准模式:从 { code, result, reqId } 中解包,校验 code
867099
+ * - custom 模式:返回值本身即为裸数据,直接透传
867100
+ */
867101
+ function unwrapDeviceCodeResponse(raw, custom) {
867102
+ if (custom) {
867103
+ if (!raw || !raw.device_code) {
867104
+ throw new error_1.CloudBaseError('Device Flow fetchDeviceCode failed (custom mode): 返回数据异常');
867105
+ }
867106
+ return { data: raw };
867107
+ }
867108
+ const resp = raw;
867109
+ if (resp.code !== SUCCESS_CODE) {
867110
+ throw new error_1.CloudBaseError('Device Flow fetchDeviceCode failed', {
867111
+ code: resp.code,
867112
+ requestId: resp.reqId,
867113
+ });
867114
+ }
867115
+ return { data: resp.result, reqId: resp.reqId };
867116
+ }
867117
+ function unwrapTokenResponse(raw, custom) {
867118
+ if (custom) {
867119
+ return { data: raw };
867120
+ }
867121
+ const resp = raw;
867122
+ // 标准模式下若外层 code 异常且无 result,直接抛错
867123
+ if (resp.code !== SUCCESS_CODE && !resp.result) {
867124
+ throw new error_1.CloudBaseError(`Device Flow 授权失败,错误码: ${resp.code}`, {
867125
+ code: resp.code,
867126
+ requestId: resp.reqId,
867127
+ });
867128
+ }
867129
+ return { data: resp.result, reqId: resp.reqId };
867130
+ }
867092
867131
  function getAuthTokenByDeviceFlow(options = {}) {
867093
867132
  return __awaiter(this, void 0, void 0, function* () {
867094
- const { client_id, onDeviceCode, getOAuthEndpoint, getAuthUrl, silent } = options;
867133
+ const { client_id, onDeviceCode, getOAuthEndpoint, getAuthUrl, silent, custom } = options;
867095
867134
  const endpoint = getOAuthEndpoint ? getOAuthEndpoint(OAUTH_ENDPOINT) : OAUTH_ENDPOINT;
867096
- const deviceCodeResp = yield fetchDeviceCode({ client_id, endpoint });
867097
- if (deviceCodeResp.code !== SUCCESS_CODE) {
867098
- throw new error_1.CloudBaseError('Device Flow fetchDeviceCode failed', {
867099
- code: deviceCodeResp.code,
867100
- requestId: deviceCodeResp.reqId,
867101
- });
867102
- }
867103
- const { device_code, user_code, expires_in, interval } = deviceCodeResp.result;
867104
- // 暂时不消费 verification_uri,由客户端控制跳转
867105
- const defaultVerificationUri = `${web_auth_1.CLI_AUTH_BASE_URL}#/cli-auth`;
867106
- // from=cli 后续考虑改用 client_id,因为 toolbox 作为公共依赖,可能被不同 client 所引用
867107
- const rawVerificationUri = `${defaultVerificationUri}?user_code=${user_code}&from=cli&flow=device`;
867108
- const verification_uri = getAuthUrl ? getAuthUrl(rawVerificationUri) : rawVerificationUri;
867135
+ // ---- 获取 device code ----
867136
+ const deviceCodeRaw = yield fetchDeviceCode({ client_id, endpoint });
867137
+ const { data: deviceCodeData } = unwrapDeviceCodeResponse(deviceCodeRaw, !!custom);
867138
+ const { device_code, user_code, expires_in, interval } = deviceCodeData;
867139
+ // ---- 构造 verification_uri ----
867140
+ let verification_uri;
867141
+ if (custom) {
867142
+ // custom 模式直接使用接口返回的 verification_uri
867143
+ const rawUri = deviceCodeData.verification_uri || '';
867144
+ verification_uri = getAuthUrl ? getAuthUrl(rawUri) : rawUri;
867145
+ }
867146
+ else {
867147
+ // 标准模式由客户端拼接 verification_uri
867148
+ const defaultVerificationUri = `${web_auth_1.CLI_AUTH_BASE_URL}#/cli-auth`;
867149
+ // from=cli 后续考虑改用 client_id,因为 toolbox 作为公共依赖,可能被不同 client 所引用
867150
+ const rawVerificationUri = `${defaultVerificationUri}?user_code=${user_code}&from=cli&flow=device`;
867151
+ verification_uri = getAuthUrl ? getAuthUrl(rawVerificationUri) : rawVerificationUri;
867152
+ }
867109
867153
  if (!silent) {
867110
- // 打印授权信息,引导用户操作
867111
867154
  console.log('\n\n若链接未自动打开,请手动复制至浏览器,或尝试其他登录方式:');
867112
867155
  console.log(`\n${verification_uri}`);
867113
867156
  console.log(`\n用户码: ${user_code}\n`);
@@ -867117,21 +867160,25 @@ function getAuthTokenByDeviceFlow(options = {}) {
867117
867160
  if (onDeviceCode) {
867118
867161
  onDeviceCode({ user_code, verification_uri, device_code, expires_in });
867119
867162
  }
867163
+ // ---- 轮询 token ----
867120
867164
  let pollInterval = interval;
867121
867165
  const deadline = Date.now() + expires_in * 1000;
867122
867166
  while (Date.now() < deadline) {
867123
867167
  yield sleep(pollInterval * 1000);
867124
- let resp;
867168
+ let tokenData;
867169
+ let reqId;
867125
867170
  try {
867126
- resp = yield fetchPollToken({ device_code, interval: pollInterval, client_id, endpoint });
867171
+ const tokenRaw = yield fetchPollToken({ device_code, interval: pollInterval, client_id, endpoint });
867172
+ ({ data: tokenData, reqId } = unwrapTokenResponse(tokenRaw, !!custom));
867127
867173
  }
867128
867174
  catch (e) {
867175
+ if (e instanceof error_1.CloudBaseError)
867176
+ throw e;
867129
867177
  throw new error_1.CloudBaseError('Device Flow 轮询请求失败', { original: e });
867130
867178
  }
867131
- const { code, result } = resp;
867132
- // 服务端返回业务错误(result 中携带 error 字段)
867133
- if (result && 'error' in result) {
867134
- const { error, error_description } = result;
867179
+ // 服务端返回业务错误(携带 error 字段)
867180
+ if (tokenData && 'error' in tokenData) {
867181
+ const { error, error_description } = tokenData;
867135
867182
  if (error === POLL_ERROR_CODES.AUTHORIZATION_PENDING) {
867136
867183
  continue;
867137
867184
  }
@@ -867147,17 +867194,14 @@ function getAuthTokenByDeviceFlow(options = {}) {
867147
867194
  }
867148
867195
  throw new error_1.CloudBaseError(error_description || `Device Flow 授权失败,错误: ${error}`, {
867149
867196
  code: error,
867150
- requestId: resp.reqId,
867197
+ requestId: reqId,
867151
867198
  });
867152
867199
  }
867153
- // 服务端返回成功的 Credential
867154
- if (code === SUCCESS_CODE && result) {
867155
- return result;
867200
+ // 成功拿到 Credential
867201
+ if (tokenData) {
867202
+ return tokenData;
867156
867203
  }
867157
- throw new error_1.CloudBaseError(`Device Flow 授权失败,错误码: ${code}`, {
867158
- code,
867159
- requestId: resp.reqId,
867160
- });
867204
+ throw new error_1.CloudBaseError('Device Flow 授权失败:返回数据异常', { requestId: reqId });
867161
867205
  }
867162
867206
  throw new error_1.CloudBaseError('授权超时,用户未在有效期内完成授权,请重试');
867163
867207
  });
@@ -913835,6 +913879,10 @@ let LoginCommand = class LoginCommand extends common_1.Command {
913835
913879
  {
913836
913880
  flags: '--flow <flow>',
913837
913881
  desc: (0, i18n_1.t)('Web 登录授权方式(device 或 web),默认 device')
913882
+ },
913883
+ {
913884
+ flags: '--endpoint <endpoint>',
913885
+ desc: (0, i18n_1.t)('自定义设备授权 Endpoint')
913838
913886
  }
913839
913887
  ],
913840
913888
  desc: (0, i18n_1.t)('登录腾讯云账号'),
@@ -913845,7 +913893,7 @@ let LoginCommand = class LoginCommand extends common_1.Command {
913845
913893
  execute(options, log) {
913846
913894
  return __awaiter(this, void 0, void 0, function* () {
913847
913895
  log.verbose(options);
913848
- const { apiKeyId, apiKey, token, flow } = options;
913896
+ const { apiKeyId, apiKey, token, flow, endpoint } = options;
913849
913897
  const loading = (0, utils_1.loadingFactory)();
913850
913898
  loading.start((0, i18n_1.t)('检验登录状态'));
913851
913899
  const credential = yield (0, utils_1.checkAndGetCredential)();
@@ -913907,7 +913955,7 @@ let LoginCommand = class LoginCommand extends common_1.Command {
913907
913955
  }
913908
913956
  else {
913909
913957
  loading.start((0, i18n_1.t)('请在浏览器中打开的授权页面进行授权...'));
913910
- const res = yield (0, auth_1.login)({ flow });
913958
+ const res = yield (0, auth_1.login)({ flow, endpoint });
913911
913959
  if (res.code === 'SUCCESS') {
913912
913960
  loading.succeed((0, i18n_1.t)('登录成功!'));
913913
913961
  yield askForCollectDataConfirm();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.12.9-beta.0",
3
+ "version": "2.12.9",
4
4
  "description": "CLI for Tencent CloudBase (standalone bundle)",
5
5
  "bin": {
6
6
  "tcb": "bin/tcb",