@cloudbase/manager-node 4.11.0-alpha.9 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(TCB_BASE_URL=https://tcb.pre.tencentcloudapi.woa.com npm test -- --testPathPattern=cloudApp 2>&1)",
5
+ "Bash(TCB_BASE_URL=https://tcb.pre.tencentcloudapi.woa.com npm test 2>&1)",
6
+ "Bash(TCB_BASE_URL=https://tcb.pre.tencentcloudapi.woa.com npm test -- --testPathPattern=cloudApp --testNamePattern=\"获取版本列表\")"
7
+ ]
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ root = true
2
+ [*]
3
+ indent_style = space
4
+ indent_size = 4
5
+ end_of_line = lf
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
@@ -0,0 +1,3 @@
1
+ lib/
2
+ types/
3
+ node_modules
@@ -0,0 +1,27 @@
1
+ module.exports = {
2
+ extends: ['alloy', 'alloy/typescript'],
3
+ rules: {
4
+ indent: ['error', 4],
5
+ semi: ['error', 'never'],
6
+ complexity: ['error', { max: 40 }],
7
+ 'no-useless-constructor': 'off',
8
+ '@typescript-eslint/explicit-member-accessibility': 'off',
9
+ '@typescript-eslint/explicit-function-return-type': 'off',
10
+ '@typescript-eslint/interface-name-prefix': 'off',
11
+ '@typescript-eslint/no-useless-constructor': 'off',
12
+ '@typescript-eslint/no-duplicate-imports': 'off'
13
+ },
14
+ env: {
15
+ es6: true,
16
+ node: true,
17
+ jest: true
18
+ },
19
+ overrides: [
20
+ {
21
+ files: ['*.js'],
22
+ rules: {
23
+ '@typescript-eslint/no-var-requires': 'off'
24
+ }
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,31 @@
1
+ module.exports = {
2
+ // 一行最多 100 字符
3
+ printWidth: 100,
4
+ // 使用 4 个空格缩进
5
+ tabWidth: 4,
6
+ // 不使用缩进符,而使用空格
7
+ useTabs: false,
8
+ // 行尾需要有分号
9
+ semi: false,
10
+ // 使用单引号
11
+ singleQuote: true,
12
+ // 对象的 key 仅在必要时用引号
13
+ quoteProps: 'as-needed',
14
+ // 末尾不需要逗号
15
+ trailingComma: 'none',
16
+ // 大括号内的首尾需要空格
17
+ bracketSpacing: true,
18
+ // 每个文件格式化的范围是文件的全部内容
19
+ rangeStart: 0,
20
+ rangeEnd: Infinity,
21
+ // 不需要写文件开头的 @prettier
22
+ requirePragma: false,
23
+ // 不需要自动在文件开头插入 @prettier
24
+ insertPragma: false,
25
+ // 使用默认的折行标准
26
+ proseWrap: 'preserve',
27
+ // 换行符使用 lf
28
+ endOfLine: 'lf',
29
+ // 箭头括号
30
+ arrowParens: 'avoid'
31
+ }
@@ -0,0 +1,109 @@
1
+ # 4.0.0
2
+ - 升级 https-proxy-agent 3->5 修复 https://github.com/TencentCloud/tencentcloud-sdk-nodejs/issues/47
3
+
4
+
5
+ # v3.9.2-beta
6
+ - 扩展禁用用户接口为变更用户状态接口
7
+ - 增加修改用户信息接口
8
+
9
+ # v3.5.0
10
+
11
+ - 新增获取云开发用户列表接口
12
+ - 新增停用云开发用户接口
13
+ - 新增批量删除云开发用户接口
14
+
15
+ # v3.4.0
16
+
17
+ - 增加云接入服务
18
+ - 创建函数支持同时创建云接入
19
+ - 优化请求错误栈
20
+
21
+ # v3.3.2
22
+
23
+ - 函数轮询状态时间修复 30s => 300s
24
+
25
+ # v3.3.0
26
+
27
+ - 静态托管支持配置重定向规则
28
+ - 新增删除静态托管自定义域名接口
29
+ - 新增获取静态网站配置接口
30
+ - 新增获取域名配置接口
31
+ - 新增域名配置接口
32
+
33
+ # v3.2.0
34
+
35
+ - 新增静态托管查询文件,配置文档,绑定自定义域名接口
36
+
37
+ # v3.1.1
38
+
39
+ - 优化文件夹删除接口
40
+ - 增加批量上传文件接口
41
+ - 修复静态网站上传单个文件没有回调的问题
42
+
43
+ # v3.0.0
44
+
45
+ - [fix] common 方法改造
46
+ - [add] 支持数据库 CRUD
47
+
48
+ # v2.4.1
49
+
50
+ - [fix] 修复并行调用 createFunction 接口报错的问题
51
+ - [add] 支持通过指定函数路径创建函数
52
+
53
+ # v2.4.0
54
+
55
+ - [add] 新增安全来源 API
56
+ - [fix] 修复云函数环境下取环境变量 bug (入口函数外部调用,未取到报错)
57
+
58
+ # v2.3.4
59
+
60
+ - [fix] 修复函数配置更新问题
61
+
62
+ # v2.3.2
63
+
64
+ - [fix] 修复更新函数 VPC 配置导致无法访问公网的问题
65
+
66
+ # v2.3.1
67
+
68
+ - [fix] 修复创建函数、更新函数代码,代码保护参数遗漏的问题
69
+
70
+ # v2.3.0
71
+
72
+ - [add] 支持文件层
73
+ - [add] 支持查询修改存储安全规则异步任务状态
74
+ - [fix] 文档订正
75
+
76
+ # v2.2.1
77
+
78
+ - [fix] 修复查询所有集合信息接口,集合为空时报错
79
+ - [fix] updateFunctionCode 支持自动安装依赖
80
+
81
+ # v2.2.0
82
+
83
+ - [fix] 修复上传文件夹等接口 `onFileFinish` 参数 TS 定义错误
84
+ - [add] 创建云函数返回 RequestId 响应值
85
+ - [add] 支持 L5 选项
86
+
87
+ # v2.1.0
88
+
89
+ - [add] 支持上传或更新函数时 等待依赖安装完成
90
+ - [add] 支持增量上传函数代码
91
+ - [add] 新增创建自定义登录私钥
92
+ - [add] 新增 HTTP Service API
93
+ - [add] 新增安全规则 API
94
+
95
+ # v2.0.0
96
+
97
+ - [refactor] 重构 storage , function 接口(breaking change)
98
+ - [add] 支持闭环完成环境创建
99
+ - [add] 支持函数操作代码保护
100
+ - [fix] 修复 windows 下上传文件路径 bug
101
+
102
+ # v1.3.0
103
+
104
+ - [add] 支持获取云函数代码下载链接
105
+
106
+ # v1.2.0
107
+
108
+ - [deprecated] env 创建环境功能暂时停用
109
+ - [add] 支持创建云函数自动安装依赖
@@ -0,0 +1,6 @@
1
+ ISC License (ISC)
2
+ Copyright <2019> <Tencent Cloud Base>
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # cloudbase-manager-node
2
+
3
+ 云开发 manager-node 支持开发者通过接口形式对云开发提供的云函数、数据库、文件存储等资源进行创建、管理、配置等操作。更多源码内容请参见 [cloudbase-manager-node](https://github.com/TencentCloudBase/cloudbase-manager-node)。
4
+
5
+ ## 安装
6
+
7
+ npm
8
+
9
+ ```bash
10
+ npm install @cloudbase/manager-node
11
+ ```
12
+
13
+ yarn
14
+
15
+ ```bash
16
+ yarn add @cloudbase/manager-node
17
+ ```
18
+
19
+ ## 使用
20
+
21
+ 要在你的代码内使用该模块:
22
+
23
+ ```js
24
+ const CloudBase = require('@cloudbase/manager-node')
25
+ ```
26
+
27
+
28
+
29
+ ```js
30
+ import CloudBase from '@cloudbase/manager-node'
31
+ ```
32
+
33
+ 初始化
34
+
35
+ ```js
36
+ const app = CloudBase.init({
37
+ secretId: 'Your SecretId',
38
+ secretKey: 'Your SecretKey',
39
+ token: 'Your SecretToken', // 使用临时凭证需要此字段
40
+ envId: 'Your envId' // 云环境 ID,可在腾讯云-云开发控制台获取
41
+ })
42
+ ```
43
+
44
+ ## 文档
45
+
46
+ 请访问新的[文档站点](https://docs.cloudbase.net/api-reference/manager/node/introduction.html)查看详细的文档。
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ roots: ['<rootDir>/test'],
3
+ globals: {
4
+ 'ts-jest': {
5
+ tsConfig: 'tsconfig.test.json'
6
+ }
7
+ },
8
+ transform: {
9
+ '^.+\\.ts?$': 'ts-jest'
10
+ },
11
+ transformIgnorePatterns: ['node_modules'],
12
+ testEnvironment: 'node',
13
+ forceExit: true,
14
+ // https://github.com/facebook/jest/issues/5164
15
+ globalSetup: './test/global-setup-hook.ts',
16
+ // globalTeardown: './test/global-teardown-hook.js',
17
+ coverageReporters: ['json', 'lcov', 'clover', 'text-summary']
18
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@cloudbase/manager-node",
3
+ "version": "5.0.2",
4
+ "description": "The node manage service api for cloudbase.",
5
+ "main": "lib/index.js",
6
+ "scripts": {
7
+ "build": "rimraf lib types && npx tsc",
8
+ "test:coverage": "jest --runInBand --detectOpenHandles --coverage --testTimeout=100000",
9
+ "test": "jest --runInBand --detectOpenHandles --testTimeout=100000",
10
+ "lint": "eslint \"./**/*.ts\"",
11
+ "lint:fix": "eslint --fix \"./**/*.ts\"",
12
+ "prepublishOnly": "npm run build",
13
+ "watch": "rimraf lib types && tsc -w",
14
+ "link": "node scripts/link.js",
15
+ "unlink": "node scripts/link.js -d"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/TencentCloudBase/cloudbase-manager-node.git"
20
+ },
21
+ "author": "Tencent CloudBase Team",
22
+ "license": "ISC",
23
+ "typings": "types/index.d.ts",
24
+ "devDependencies": {
25
+ "@lerna/create-symlink": "^6.4.1",
26
+ "@types/fs-extra": "^11.0.4",
27
+ "@types/jest": "^24.0.18",
28
+ "@types/node": "^12.7.4",
29
+ "@types/node-fetch": "^2.5.0",
30
+ "@types/unzipper": "^0.10.11",
31
+ "@typescript-eslint/eslint-plugin": "^3.7.1",
32
+ "@typescript-eslint/parser": "^3.7.1",
33
+ "eslint": "^7.6.0",
34
+ "eslint-config-alloy": "^3.7.4",
35
+ "husky": "^3.0.5",
36
+ "jest": "^24.9.0",
37
+ "lint-staged": "^9.2.5",
38
+ "rimraf": "^3.0.0",
39
+ "ts-jest": "^24.1.0",
40
+ "typescript": "^5.8.3"
41
+ },
42
+ "dependencies": {
43
+ "@cloudbase/database": "^0.6.2",
44
+ "archiver": "^3.1.1",
45
+ "cos-nodejs-sdk-v5": "^2.14.0",
46
+ "del": "^5.1.0",
47
+ "fs-extra": "^11.3.0",
48
+ "https-proxy-agent": "^5.0.1",
49
+ "lodash": "^4.17.21",
50
+ "make-dir": "^3.0.0",
51
+ "micromatch": "^4.0.2",
52
+ "node-fetch": "^2.6.0",
53
+ "query-string": "^6.8.3",
54
+ "unzipper": "^0.12.3",
55
+ "uuid": "^9.0.0",
56
+ "walkdir": "^0.4.1"
57
+ },
58
+ "husky": {
59
+ "hooks": {
60
+ "pre-commit": "npm run build && git add . && lint-staged"
61
+ }
62
+ },
63
+ "lint-staged": {
64
+ "*.ts": [
65
+ "eslint --fix",
66
+ "git add"
67
+ ]
68
+ },
69
+ "packageManager": "yarn@1.22.22"
70
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Tencent is pleased to support the open source community by making CloudBaseFramework - 云原生一体化部署工具 available.
3
+ *
4
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
5
+ *
6
+ * Please refer to license text included with this package for license details.
7
+ */
8
+
9
+ const os = require('os')
10
+ const fs = require('fs')
11
+ const fse = require('fs-extra')
12
+ const del = require('del')
13
+ const path = require('path')
14
+ const mkdirp = require('mkdirp')
15
+ const { execSync } = require('child_process')
16
+ const { createSymlink } = require('@lerna/create-symlink')
17
+
18
+ const globalNpmPath = execSync('npm root -g', {
19
+ encoding: 'utf-8'
20
+ }).trim()
21
+ // 如果不支持workspace 可以用下面写死
22
+ // const globalNpmPath = '/usr/local/lib/node_modules';
23
+
24
+ async function main() {
25
+ const unlink = process.argv?.[2] === '-d'
26
+ await linkCore(unlink)
27
+ }
28
+
29
+ async function linkCore(unlink = false) {
30
+ const jsonString = await fs.readFileSync(path.join(__dirname, '../package.json'))
31
+ const { name } = JSON.parse(jsonString)
32
+ await link(path.join(process.cwd()), path.join(globalNpmPath, '@cloudbase/cli'), name, unlink)
33
+ }
34
+
35
+ function isSymlink(path) {
36
+ const stats = fs.lstatSync(path)
37
+ return stats.isSymbolicLink()
38
+ }
39
+
40
+ // 将 global tcb cli 工具中的 framework-core link 到 packages/framework-core
41
+ async function link(src, dest, packageName, unlink = false) {
42
+ const prevCwd = process.cwd()
43
+ const destPlugin = path.join(dest, 'node_modules', '@cloudbase')
44
+ // 确保目录存在
45
+ mkdirp.sync(destPlugin)
46
+ // 切换 cwd
47
+ process.chdir(destPlugin)
48
+
49
+ const pathName = packageName.replace('@cloudbase/', '')
50
+ const backupPathName = `${pathName}_backup`
51
+
52
+ if (unlink) {
53
+ if (fs.existsSync(pathName) && !isSymlink(pathName)) {
54
+ console.log(`【失败】${pathName} 不是软链接`, process.cwd())
55
+ return
56
+ }
57
+
58
+ if (fs.existsSync(pathName) && fs.existsSync(backupPathName)) {
59
+ // 删除软链接
60
+ del.sync([pathName])
61
+
62
+ // 恢复备份
63
+ fse.moveSync(backupPathName, pathName)
64
+
65
+ // 删除软链接
66
+ console.log('【成功】删除软链接:', process.cwd())
67
+ } else {
68
+ console.info(
69
+ `不存在 ${pathName} 或 ${backupPathName},请重装安装 npm i @cloudbase/cli -g`,
70
+ process.cwd()
71
+ )
72
+ }
73
+ } else {
74
+ // 创建软链接
75
+
76
+ if (fs.existsSync(pathName)) {
77
+ if (!fs.existsSync(backupPathName)) {
78
+ // 不存在备份则进行备份
79
+
80
+ if (!isSymlink(pathName)) {
81
+ // 不是软链接才备份
82
+ fse.moveSync(pathName, backupPathName)
83
+ }
84
+ } else {
85
+ // 存在备份则直接删除
86
+ del.sync([pathName])
87
+ }
88
+ }
89
+
90
+ await createSymlink(src, pathName, 'junction')
91
+ console.log('【成功】创建软链接:', process.cwd())
92
+ }
93
+
94
+ // 切回源目录
95
+ process.chdir(prevCwd)
96
+ }
97
+
98
+ main()
@@ -0,0 +1,19 @@
1
+ {
2
+ "compileOnSave": true,
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "target": "ES2017",
6
+ "moduleResolution": "node",
7
+ "outDir": "lib",
8
+ "removeComments": false,
9
+ "types": ["node"],
10
+ "esModuleInterop": true,
11
+ "declaration": true,
12
+ "declarationDir": "./types",
13
+ "experimentalDecorators": true,
14
+ "newLine": "LF",
15
+ "skipLibCheck": true
16
+ },
17
+ "include": ["src/**/*"],
18
+ "exclude": ["node_modules", "test"]
19
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compileOnSave": true,
3
+ "compilerOptions": {
4
+ "experimentalDecorators": true,
5
+ "module": "commonjs",
6
+ "target": "ES2017",
7
+ "moduleResolution": "node",
8
+ "outDir": "lib",
9
+ "types": ["node", "jest"],
10
+ "esModuleInterop": true
11
+ },
12
+ "include": ["src/**/*", "test/**/*"],
13
+ "exclude": ["node_modules"]
14
+ }
package/jest.config.js CHANGED
@@ -10,6 +10,7 @@ module.exports = {
10
10
  },
11
11
  transformIgnorePatterns: ['node_modules'],
12
12
  testEnvironment: 'node',
13
+ forceExit: true,
13
14
  // https://github.com/facebook/jest/issues/5164
14
15
  globalSetup: './test/global-setup-hook.ts',
15
16
  // globalTeardown: './test/global-teardown-hook.js',
@@ -28,14 +28,14 @@ class AgentService {
28
28
  }
29
29
  // ==================== SCF 云函数部署 ====================
30
30
  /**
31
- * 创建 SCF Agent
31
+ * 创建 Agent
32
32
  * 支持两种方式:
33
33
  * 1. 传入 cwd 代码目录,自动打包上传
34
34
  * 2. 传入 ZipFile / CosBucketRegion + TempCosObjectName,直接上传
35
35
  * @param params 创建参数
36
36
  * @returns Agent 创建结果
37
37
  */
38
- async createScfAgent(params) {
38
+ async createAgent(params) {
39
39
  const envConfig = this.environment.lazyEnvironmentConfig;
40
40
  // 默认会话配置
41
41
  const defaultSessionConfig = {
@@ -622,7 +622,7 @@ class AgentService {
622
622
  exports.AgentService = AgentService;
623
623
  __decorate([
624
624
  (0, utils_1.preLazy)()
625
- ], AgentService.prototype, "createScfAgent", null);
625
+ ], AgentService.prototype, "createAgent", null);
626
626
  __decorate([
627
627
  (0, utils_1.preLazy)()
628
628
  ], AgentService.prototype, "describeAgentList", null);
@@ -346,34 +346,6 @@ class CloudRunService {
346
346
  async getTemplates() {
347
347
  return (0, utils_1.fetchTemplates)(['tcbrFunc', 'tcbrContainer']);
348
348
  }
349
- async _checkFunctionExist(name) {
350
- try {
351
- await this.detail({
352
- serverName: name
353
- });
354
- return true;
355
- }
356
- catch (e) {
357
- if (e.code === 'ResourceNotFound' ||
358
- e.code === 'ResourceNotFound.ServerNotFound' ||
359
- // 备注:以下条件当 NotFound 处理(已与 fisheryan 确认过)
360
- (e.code === 'InvalidParameter' && e.original.Message === 'service data illegal')) {
361
- return false;
362
- }
363
- throw e;
364
- }
365
- }
366
- _upsertFunction(isNew, data) {
367
- const { name, deployInfo, serverConfig } = data;
368
- const envConfig = this.environment.lazyEnvironmentConfig;
369
- const Items = parseObjectToDiffConfigItem(serverConfig);
370
- return this.tcbrService.request(isNew ? 'CreateCloudRunServer' : 'UpdateCloudRunServer', {
371
- EnvId: envConfig.EnvId,
372
- ServerName: name,
373
- DeployInfo: deployInfo,
374
- Items,
375
- });
376
- }
377
349
  /**
378
350
  * 获取部署记录列表,按部署时间倒序(最新在前)
379
351
  */
@@ -408,6 +380,34 @@ class CloudRunService {
408
380
  RunId: params.RunId,
409
381
  });
410
382
  }
383
+ async _checkFunctionExist(name) {
384
+ try {
385
+ await this.detail({
386
+ serverName: name
387
+ });
388
+ return true;
389
+ }
390
+ catch (e) {
391
+ if (e.code === 'ResourceNotFound' ||
392
+ e.code === 'ResourceNotFound.ServerNotFound' ||
393
+ // 备注:以下条件当 NotFound 处理(已与 fisheryan 确认过)
394
+ (e.code === 'InvalidParameter' && e.original.Message === 'service data illegal')) {
395
+ return false;
396
+ }
397
+ throw e;
398
+ }
399
+ }
400
+ _upsertFunction(isNew, data) {
401
+ const { name, deployInfo, serverConfig } = data;
402
+ const envConfig = this.environment.lazyEnvironmentConfig;
403
+ const Items = parseObjectToDiffConfigItem(serverConfig);
404
+ return this.tcbrService.request(isNew ? 'CreateCloudRunServer' : 'UpdateCloudRunServer', {
405
+ EnvId: envConfig.EnvId,
406
+ ServerName: name,
407
+ DeployInfo: deployInfo,
408
+ Items,
409
+ });
410
+ }
411
411
  }
412
412
  exports.CloudRunService = CloudRunService;
413
413
  __decorate([
package/lib/env/index.js CHANGED
@@ -508,6 +508,98 @@ class EnvService {
508
508
  async describeCreditsUsageDetail(params) {
509
509
  return this.cloudService.request('DescribeCreditsUsageDetail', Object.assign({}, params));
510
510
  }
511
+ /**
512
+ * 查询HTTP访问服务域名路由信息
513
+ * @param {DescribeHttpServiceRouteParams} params 查询参数
514
+ * @returns {Promise<DescribeHttpServiceRouteRes>}
515
+ */
516
+ async describeHttpServiceRoute(params) {
517
+ return this.cloudService.request('DescribeHTTPServiceRoute', Object.assign({}, params));
518
+ }
519
+ /**
520
+ * 创建HTTP访问服务域名路由
521
+ * @param {CreateHttpServiceRouteParams} params 创建参数
522
+ * @returns {Promise<CreateHttpServiceRouteRes>}
523
+ */
524
+ async createHttpServiceRoute(params) {
525
+ return this.cloudService.request('CreateHTTPServiceRoute', Object.assign({}, params));
526
+ }
527
+ /**
528
+ * 修改HTTP访问服务域名路由
529
+ * @param {ModifyHttpServiceRouteParams} params 修改参数
530
+ * @returns {Promise<ModifyHttpServiceRouteRes>}
531
+ */
532
+ async modifyHttpServiceRoute(params) {
533
+ return this.cloudService.request('ModifyHTTPServiceRoute', Object.assign({}, params));
534
+ }
535
+ /**
536
+ * 删除HTTP访问服务域名路由
537
+ * @param {DeleteHttpServiceRouteParams} params 删除参数
538
+ * @returns {Promise<DeleteHttpServiceRouteRes>}
539
+ */
540
+ async deleteHttpServiceRoute(params) {
541
+ return this.cloudService.request('DeleteHTTPServiceRoute', Object.assign({}, params));
542
+ }
543
+ /**
544
+ * 绑定自定义域名到HTTP访问服务
545
+ * 底层调用 CreateHTTPServiceRoute API,专用于域名绑定场景
546
+ * @param {BindCustomDomainParams} params 绑定参数
547
+ * @returns {Promise<BindCustomDomainRes>}
548
+ */
549
+ async bindCustomDomain(params) {
550
+ const { EnvId, Domain } = params;
551
+ // 构建域名参数,设置默认值
552
+ const domainParam = {
553
+ Domain: Domain.Domain,
554
+ CertId: Domain.CertId,
555
+ AccessType: Domain.AccessType || 'DIRECT',
556
+ Protocol: Domain.Protocol || 'HTTP_AND_HTTPS',
557
+ Enable: Domain.Enable !== undefined ? Domain.Enable : true
558
+ };
559
+ // 自定义接入类型时需要传入 CustomCname
560
+ if (domainParam.AccessType === 'CUSTOM' && Domain.CustomCname) {
561
+ domainParam.CustomCname = Domain.CustomCname;
562
+ }
563
+ return this.cloudService.request('CreateHTTPServiceRoute', {
564
+ EnvId,
565
+ Domain: domainParam
566
+ });
567
+ }
568
+ /**
569
+ * 删除自定义域名
570
+ * 仅当域名下无路由绑定时可删除,否则抛出错误
571
+ * @param {DeleteCustomDomainParams} params 删除参数
572
+ * @returns {Promise<DeleteCustomDomainRes>}
573
+ */
574
+ async deleteCustomDomain(params) {
575
+ const { EnvId, Domain } = params;
576
+ // 查询domain下的路由
577
+ const queryRes = await this.describeHttpServiceRoute({
578
+ EnvId,
579
+ Filters: [
580
+ {
581
+ Name: 'Domain',
582
+ Values: [Domain]
583
+ }
584
+ ]
585
+ });
586
+ const domains = queryRes.Domains || [];
587
+ const targetDomain = domains.find(d => d.Domain === Domain);
588
+ if (!targetDomain) {
589
+ throw new error_1.CloudBaseError(`Domain ${Domain} does not exist`);
590
+ }
591
+ // 检查是否有路由绑定
592
+ const routes = targetDomain.Routes || [];
593
+ if (routes.length > 0) {
594
+ const routePaths = routes.map(r => r.Path).join(', ');
595
+ throw new error_1.CloudBaseError(`Domain ${Domain} has ${routes.length} route binding(s) (${routePaths}). Please delete the routes before deleting the domain.`);
596
+ }
597
+ // 无路由绑定,可以删除域名
598
+ return this.cloudService.request('DeleteHTTPServiceRoute', {
599
+ EnvId,
600
+ Domain
601
+ });
602
+ }
511
603
  // 获取 COS CORS 域名
512
604
  async getCOSDomains() {
513
605
  const cos = this.getCos();
@@ -1477,14 +1477,16 @@ class FunctionService {
1477
1477
  });
1478
1478
  }
1479
1479
  /**
1480
- * 通过scf COS 上传方式(通过 GetTempCosInfo + COS SDK 上传)
1480
+ * 通过 SCF COS 上传方式(通过 GetTempCosInfo + COS SDK 上传)
1481
1481
  * 返回 TempCosObjectName 用于创建/更新函数
1482
1482
  */
1483
- async uploadFunctionZipToCosLegacy(options, installDependency) {
1483
+ async uploadFunctionZipToCos(options, installDependency) {
1484
1484
  const { func, functionPath, functionRootPath } = options;
1485
- const { env } = this.getFunctionConfig();
1486
- const { CloudAppId } = await this.userService.getTcbAccountInfo();
1487
- const objectPath = `${CloudAppId}/${env}/${func.name}.zip`;
1485
+ const { env, appId } = this.getFunctionConfig();
1486
+ if (!appId) {
1487
+ throw new error_1.CloudBaseError('无法获取 AppId,请确认环境已开通存储服务');
1488
+ }
1489
+ const objectPath = `${appId}/${env}/${func.name}.zip`;
1488
1490
  // 1. 生成存放函数包的临时 Cos 目录
1489
1491
  const { Date: cosDate, Sign } = await this.scfService.request('GetTempCosInfo', {
1490
1492
  ObjectPath: `${objectPath}`
@@ -1545,10 +1547,11 @@ class FunctionService {
1545
1547
  });
1546
1548
  }
1547
1549
  /**
1548
- * 新的 COS 上传方式(通过 DescribeBuildServiceCosInfo + PUT 上传)
1550
+ * 旧的 COS 上传方式(通过 DescribeBuildServiceCosInfo + PUT 上传)
1549
1551
  * 返回 CosTimestamp 用于创建/更新函数
1552
+ * @deprecated 请使用 uploadFunctionZipToCos 代替
1550
1553
  */
1551
- async uploadFunctionZipToCos(options, installDependency) {
1554
+ async uploadFunctionZipToCosLegacy(options, installDependency) {
1552
1555
  const { func, functionPath, functionRootPath } = options;
1553
1556
  const { env } = this.getFunctionConfig();
1554
1557
  // 1. 生成存放函数包的临时 Cos 目录
@@ -1649,13 +1652,13 @@ class FunctionService {
1649
1652
  ZipFile: base64
1650
1653
  };
1651
1654
  }
1652
- // 默认走 COS 上传
1655
+ // 默认走 COS 上传(GetTempCosInfo + COS SDK)
1653
1656
  console.log(`[${func.name}] 部署方式: COS 上传`);
1654
1657
  const region = this.environment.cloudBaseContext.region || constant_1.SCF_TEMP_COS.DEFAULT_REGION;
1655
- const legacyResult = await this.uploadFunctionZipToCosLegacy(options, installDependency);
1658
+ const result = await this.uploadFunctionZipToCos(options, installDependency);
1656
1659
  return {
1657
1660
  CosBucketRegion: region,
1658
- TempCosObjectName: `/${legacyResult.Key}`
1661
+ TempCosObjectName: `/${result.Key}`
1659
1662
  };
1660
1663
  }
1661
1664
  async createAccessPath(name, path) {
@@ -1717,11 +1720,14 @@ class FunctionService {
1717
1720
  * @memberof FunctionService
1718
1721
  */
1719
1722
  getFunctionConfig() {
1720
- var _a, _b, _c, _d;
1723
+ var _a, _b, _c, _d, _e;
1721
1724
  const envConfig = this.environment.lazyEnvironmentConfig;
1722
1725
  // Functions 可能为空
1723
1726
  const namespace = ((_b = (_a = envConfig.Functions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Namespace) || '';
1724
- const appId = (_d = (_c = envConfig.Storages) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.AppId;
1727
+ // AppId 可能为空字符串,从 Bucket 名称中提取
1728
+ // COS Bucket 格式: {BucketName}-{APPID},APPID 为纯数字
1729
+ const storage = (_c = envConfig.Storages) === null || _c === void 0 ? void 0 : _c[0];
1730
+ const appId = (storage === null || storage === void 0 ? void 0 : storage.AppId) || ((_e = (_d = storage === null || storage === void 0 ? void 0 : storage.Bucket) === null || _d === void 0 ? void 0 : _d.match(/-(\d+)$/)) === null || _e === void 0 ? void 0 : _e[1]) || '';
1725
1731
  const { proxy } = this.environment.cloudBaseContext;
1726
1732
  return {
1727
1733
  proxy,
@@ -1882,10 +1888,10 @@ __decorate([
1882
1888
  ], FunctionService.prototype, "getFunctionAlias", null);
1883
1889
  __decorate([
1884
1890
  (0, utils_1.preLazy)()
1885
- ], FunctionService.prototype, "uploadFunctionZipToCosLegacy", null);
1891
+ ], FunctionService.prototype, "uploadFunctionZipToCos", null);
1886
1892
  __decorate([
1887
1893
  (0, utils_1.preLazy)()
1888
- ], FunctionService.prototype, "uploadFunctionZipToCos", null);
1894
+ ], FunctionService.prototype, "uploadFunctionZipToCosLegacy", null);
1889
1895
  __decorate([
1890
1896
  (0, utils_1.preLazy)()
1891
1897
  ], FunctionService.prototype, "getCodeParams", null);
@@ -25,7 +25,9 @@ class PermissionService {
25
25
  if (!resourceType || !PERMISSION_BY_RESOURCE[resourceType]) {
26
26
  throw new Error('Invalid resourceType');
27
27
  }
28
- if (typeof resource !== 'string' || resource.trim().length === 0) {
28
+ const isFunctionResourceType = resourceType === 'function';
29
+ const hasValidResourceValue = typeof resource === 'string' && resource.trim().length > 0;
30
+ if (!isFunctionResourceType && !hasValidResourceValue) {
29
31
  throw new Error('Invalid resource');
30
32
  }
31
33
  const allowed = PERMISSION_BY_RESOURCE[resourceType];
@@ -43,12 +45,7 @@ class PermissionService {
43
45
  // throw new Error('securityRule must be a valid JSON string')
44
46
  // }
45
47
  }
46
- const reqData = {
47
- EnvId,
48
- ResourceType: resourceType,
49
- Resource: resource,
50
- Permission: permission
51
- };
48
+ const reqData = Object.assign({ EnvId, ResourceType: resourceType, Permission: permission }, (hasValidResourceValue || !isFunctionResourceType ? { Resource: resource } : {}));
52
49
  if (permission === 'CUSTOM') {
53
50
  reqData.SecurityRule = securityRule;
54
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.11.0-alpha.9",
3
+ "version": "5.0.2",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -52,7 +52,7 @@
52
52
  "node-fetch": "^2.6.0",
53
53
  "query-string": "^6.8.3",
54
54
  "unzipper": "^0.12.3",
55
- "uuid": "^13.0.0",
55
+ "uuid": "^9.0.0",
56
56
  "walkdir": "^0.4.1"
57
57
  },
58
58
  "husky": {
@@ -1,5 +1,5 @@
1
1
  import { Environment } from '../environment';
2
- import { ICreateFunctionAgentParams, ICreateScfAgentParams, ICreateTcbrAgentByImageParams, ICreateTcbrAgentByPackageParams, ICreateTcbrAgentByCodeParams, IDescribeAgentListParams, IDescribeAgentListResponse, IDescribeAgentResponse, IDeleteAgentParams, IDescribeCloudBaseBuildServiceParams, IDescribeCloudBaseBuildServiceResponse, ICreateAgentResponse, IDeleteAgentResponse, ICommonResponse, IUpdateAgentParams, IUpdateScfAgentParams, IUpdateScfAgentResponse, IUpdateTcbrAgentParams, IGetAgentLogsParams } from './type';
2
+ import { ICreateFunctionAgentParams, ICreateAgentParams, ICreateTcbrAgentByImageParams, ICreateTcbrAgentByPackageParams, ICreateTcbrAgentByCodeParams, IDescribeAgentListParams, IDescribeAgentListResponse, IDescribeAgentResponse, IDeleteAgentParams, IDescribeCloudBaseBuildServiceParams, IDescribeCloudBaseBuildServiceResponse, ICreateAgentResponse, IDeleteAgentResponse, ICommonResponse, IUpdateAgentParams, IUpdateScfAgentParams, IUpdateScfAgentResponse, IUpdateTcbrAgentParams, IGetAgentLogsParams } from './type';
3
3
  /**
4
4
  * Agent 管理类
5
5
  * 支持三种部署方式:
@@ -12,14 +12,14 @@ export declare class AgentService {
12
12
  private tcbService;
13
13
  constructor(environment: Environment);
14
14
  /**
15
- * 创建 SCF Agent
15
+ * 创建 Agent
16
16
  * 支持两种方式:
17
17
  * 1. 传入 cwd 代码目录,自动打包上传
18
18
  * 2. 传入 ZipFile / CosBucketRegion + TempCosObjectName,直接上传
19
19
  * @param params 创建参数
20
20
  * @returns Agent 创建结果
21
21
  */
22
- createScfAgent(params: ICreateScfAgentParams): Promise<ICreateAgentResponse>;
22
+ createAgent(params: ICreateAgentParams): Promise<ICreateAgentResponse>;
23
23
  /**
24
24
  * 查询 Agent 列表
25
25
  * @param params 查询参数
@@ -28,12 +28,12 @@ export interface ISessionConfig {
28
28
  MaxConcurrency?: number;
29
29
  }
30
30
  /**
31
- * 创建 SCF Agent 的参数
31
+ * 创建 Agent 的参数
32
32
  * 支持两种方式:
33
33
  * 1. 传入 cwd 代码目录,自动打包上传
34
34
  * 2. 传入 ZipFile / CosBucketRegion + TempCosObjectName,直接上传
35
35
  */
36
- export interface ICreateScfAgentParams {
36
+ export interface ICreateAgentParams {
37
37
  /** Agent 名称 */
38
38
  Name: string;
39
39
  /** Agent ID,不传则自动生成 */
@@ -135,8 +135,6 @@ export declare class CloudRunService {
135
135
  * @returns {Promise<ITemplate[]>} 返回模板数组
136
136
  */
137
137
  getTemplates(): Promise<ITemplate[]>;
138
- private _checkFunctionExist;
139
- private _upsertFunction;
140
138
  /**
141
139
  * 获取部署记录列表,按部署时间倒序(最新在前)
142
140
  */
@@ -150,6 +148,8 @@ export declare class CloudRunService {
150
148
  getProcessLog(params: {
151
149
  RunId: string;
152
150
  }): Promise<IProcessLogResponse>;
151
+ private _checkFunctionExist;
152
+ private _upsertFunction;
153
153
  }
154
154
  export declare function codeToZip(cwd: string, options?: {
155
155
  installDependency?: boolean;
@@ -38,10 +38,12 @@ export interface ICloudrunServerBaseInfo {
38
38
  */
39
39
  CustomDomainName: string;
40
40
  /**
41
- * 服务状态
42
- * @example "running" | "deploying" | "deploy_failed"
41
+ * 服务状态(来自 DescribeCloudRunServers)
42
+ * 常见值:"creating" | "create_failed" | "freezing" | "freeze_fail" | "froze" |
43
+ * "unfreezing" | "unfreeze_fail" | "normal" | "deleting" | "delete_failed" | "abnormal"
44
+ * @example "normal"
43
45
  */
44
- Status: 'running' | 'deploying' | 'deploy_failed';
46
+ Status: 'creating' | 'create_failed' | 'freezing' | 'freeze_fail' | 'froze' | 'unfreezing' | 'unfreeze_fail' | 'normal' | 'deleting' | 'delete_failed' | 'abnormal';
45
47
  /**
46
48
  * 更新时间
47
49
  * @example "2022-03-09 14:00:00"
@@ -1,6 +1,6 @@
1
1
  import { Environment } from '../environment';
2
2
  import { IResponseInfo, AuthDomain, EnvInfo, LoginConfigItem, ICheckTcbServiceRes, ICreatePostpayRes, EnvBillingInfoItem, PriceResult } from '../interfaces';
3
- import { CalculatePackageCreatePriceParams, CalculatePackageRenewPriceParams, CalculatePackageModifyPriceParams } from './type';
3
+ import { CalculatePackageCreatePriceParams, CalculatePackageRenewPriceParams, CalculatePackageModifyPriceParams, DescribeHttpServiceRouteParams, DescribeHttpServiceRouteRes, CreateHttpServiceRouteParams, CreateHttpServiceRouteRes, ModifyHttpServiceRouteParams, ModifyHttpServiceRouteRes, DeleteHttpServiceRouteParams, DeleteHttpServiceRouteRes, BindCustomDomainParams, BindCustomDomainRes, DeleteCustomDomainParams, DeleteCustomDomainRes } from './type';
4
4
  import { CreateBillingDealParams, CreateEnvParams, BaasPackageInfo, DescribeBaasPackageListParams, ModifyEnvPlanParams, RenewEnvParams, DestroyEnvParams, DescribeEnvsParams, DescribeEnvAccountCircleParams, DescribeEnvAccountCircleRes, DescribeCreditsUsageDetailParams, EnvPkgCreditsUsage } from '../interfaces/tcb.interface';
5
5
  type SOURCE = 'miniapp' | 'qcloud';
6
6
  interface IDeleteDomainRes {
@@ -264,6 +264,44 @@ export declare class EnvService {
264
264
  Usages: EnvPkgCreditsUsage[];
265
265
  RequestId: string;
266
266
  }>;
267
+ /**
268
+ * 查询HTTP访问服务域名路由信息
269
+ * @param {DescribeHttpServiceRouteParams} params 查询参数
270
+ * @returns {Promise<DescribeHttpServiceRouteRes>}
271
+ */
272
+ describeHttpServiceRoute(params: DescribeHttpServiceRouteParams): Promise<DescribeHttpServiceRouteRes>;
273
+ /**
274
+ * 创建HTTP访问服务域名路由
275
+ * @param {CreateHttpServiceRouteParams} params 创建参数
276
+ * @returns {Promise<CreateHttpServiceRouteRes>}
277
+ */
278
+ createHttpServiceRoute(params: CreateHttpServiceRouteParams): Promise<CreateHttpServiceRouteRes>;
279
+ /**
280
+ * 修改HTTP访问服务域名路由
281
+ * @param {ModifyHttpServiceRouteParams} params 修改参数
282
+ * @returns {Promise<ModifyHttpServiceRouteRes>}
283
+ */
284
+ modifyHttpServiceRoute(params: ModifyHttpServiceRouteParams): Promise<ModifyHttpServiceRouteRes>;
285
+ /**
286
+ * 删除HTTP访问服务域名路由
287
+ * @param {DeleteHttpServiceRouteParams} params 删除参数
288
+ * @returns {Promise<DeleteHttpServiceRouteRes>}
289
+ */
290
+ deleteHttpServiceRoute(params: DeleteHttpServiceRouteParams): Promise<DeleteHttpServiceRouteRes>;
291
+ /**
292
+ * 绑定自定义域名到HTTP访问服务
293
+ * 底层调用 CreateHTTPServiceRoute API,专用于域名绑定场景
294
+ * @param {BindCustomDomainParams} params 绑定参数
295
+ * @returns {Promise<BindCustomDomainRes>}
296
+ */
297
+ bindCustomDomain(params: BindCustomDomainParams): Promise<BindCustomDomainRes>;
298
+ /**
299
+ * 删除自定义域名
300
+ * 仅当域名下无路由绑定时可删除,否则抛出错误
301
+ * @param {DeleteCustomDomainParams} params 删除参数
302
+ * @returns {Promise<DeleteCustomDomainRes>}
303
+ */
304
+ deleteCustomDomain(params: DeleteCustomDomainParams): Promise<DeleteCustomDomainRes>;
267
305
  private getCOSDomains;
268
306
  private modifyCosCorsDomain;
269
307
  private getCos;
@@ -14,3 +14,190 @@ export interface CalculatePackageModifyPriceParams {
14
14
  envId: string;
15
15
  currency?: 'CNY' | 'USD';
16
16
  }
17
+ /**
18
+ * 客户端限频配置
19
+ */
20
+ export interface HTTPServiceQPSPerClient {
21
+ LimitBy?: 'UserID' | 'ClientIP';
22
+ LimitValue?: number;
23
+ }
24
+ /**
25
+ * QPS限频策略
26
+ */
27
+ export interface HTTPServiceRouteQPSPolicy {
28
+ QPSTotal?: number;
29
+ QPSPerClient?: HTTPServiceQPSPerClient;
30
+ }
31
+ /**
32
+ * 路径重写
33
+ */
34
+ export interface HTTPServicePathRewrite {
35
+ StaticStorePrefix?: string;
36
+ Prefix?: string;
37
+ }
38
+ /**
39
+ * HTTP访问服务路由信息
40
+ */
41
+ export interface HTTPServiceRoute {
42
+ Path: string;
43
+ PathRewrite?: HTTPServicePathRewrite;
44
+ UpstreamResourceType: 'SCF' | 'CBR' | 'STATIC_STORE' | 'WEB_SCF' | 'LH';
45
+ UpstreamResourceName: string;
46
+ EnableSafeDomain: boolean;
47
+ EnableAuth: boolean;
48
+ EnablePathTransmission: boolean;
49
+ QPSPolicy?: HTTPServiceRouteQPSPolicy;
50
+ Enable: boolean;
51
+ CreateTime: string;
52
+ UpdateTime: string;
53
+ }
54
+ /**
55
+ * 域名路由信息
56
+ */
57
+ export interface HTTPServiceDomain {
58
+ Domain: string;
59
+ DomainType: 'HTTPSERVICE' | 'CBR' | 'ANYSERVICE' | 'AI_AGENT' | 'VM' | 'INTEGRATION_CALLBACK';
60
+ AccessType: 'DIRECT' | 'CDN' | 'CUSTOM';
61
+ CertId: string;
62
+ Protocol: 'HTTP_AND_HTTPS' | 'HTTP_TO_HTTPS' | 'HTTPS_TO_HTTP';
63
+ Cname: string;
64
+ IsDefault: boolean;
65
+ Enable: boolean;
66
+ Status: 'PROCESSING' | 'FAIL' | 'SUCCESS';
67
+ DNSStatus: 'OK' | 'INVALID';
68
+ Routes?: HTTPServiceRoute[];
69
+ CreateTime: string;
70
+ UpdateTime: string;
71
+ }
72
+ /**
73
+ * 过滤条件
74
+ */
75
+ export interface HTTPServiceRouteFilter {
76
+ Name?: 'Domain' | 'Path' | 'DomainType' | 'UpstreamResourceType';
77
+ Values?: string[];
78
+ }
79
+ /**
80
+ * DescribeHTTPServiceRoute 请求参数
81
+ */
82
+ export interface DescribeHttpServiceRouteParams {
83
+ EnvId: string;
84
+ Filters?: HTTPServiceRouteFilter[];
85
+ Offset?: number;
86
+ Limit?: number;
87
+ }
88
+ /**
89
+ * DescribeHTTPServiceRoute 返回结果
90
+ */
91
+ export interface DescribeHttpServiceRouteRes {
92
+ Domains?: HTTPServiceDomain[];
93
+ OriginDomain: string;
94
+ TotalCount: number;
95
+ RequestId: string;
96
+ }
97
+ /**
98
+ * HTTP访问服务路由参数(创建/修改)
99
+ */
100
+ export interface HTTPServiceRouteParam {
101
+ Path: string;
102
+ UpstreamResourceType?: 'SCF' | 'CBR' | 'STATIC_STORE' | 'WEB_SCF' | 'LH';
103
+ UpstreamResourceName?: string;
104
+ PathRewrite?: HTTPServicePathRewrite;
105
+ EnableSafeDomain?: boolean;
106
+ EnableAuth?: boolean;
107
+ EnablePathTransmission?: boolean;
108
+ QPSPolicy?: HTTPServiceRouteQPSPolicy;
109
+ Enable?: boolean;
110
+ }
111
+ /**
112
+ * HTTP访问服务域名参数(创建/修改)
113
+ */
114
+ export interface HTTPServiceDomainParam {
115
+ Domain: string;
116
+ AccessType?: 'DIRECT' | 'CDN' | 'CUSTOM';
117
+ CertId?: string;
118
+ Protocol?: 'HTTP_AND_HTTPS' | 'HTTP_TO_HTTPS' | 'HTTPS_TO_HTTP';
119
+ CustomCname?: string;
120
+ Enable?: boolean;
121
+ Routes?: HTTPServiceRouteParam[];
122
+ }
123
+ /**
124
+ * CreateHTTPServiceRoute 请求参数
125
+ */
126
+ export interface CreateHttpServiceRouteParams {
127
+ EnvId: string;
128
+ Domain: HTTPServiceDomainParam;
129
+ }
130
+ /**
131
+ * CreateHTTPServiceRoute 返回结果
132
+ */
133
+ export interface CreateHttpServiceRouteRes {
134
+ RequestId: string;
135
+ }
136
+ /**
137
+ * ModifyHTTPServiceRoute 请求参数
138
+ */
139
+ export interface ModifyHttpServiceRouteParams {
140
+ EnvId: string;
141
+ Domain: HTTPServiceDomainParam;
142
+ }
143
+ /**
144
+ * ModifyHTTPServiceRoute 返回结果
145
+ */
146
+ export interface ModifyHttpServiceRouteRes {
147
+ RequestId: string;
148
+ }
149
+ /**
150
+ * DeleteHTTPServiceRoute 请求参数
151
+ */
152
+ export interface DeleteHttpServiceRouteParams {
153
+ EnvId: string;
154
+ Domain: string;
155
+ Paths?: string[];
156
+ }
157
+ /**
158
+ * DeleteHTTPServiceRoute 返回结果
159
+ */
160
+ export interface DeleteHttpServiceRouteRes {
161
+ RequestId: string;
162
+ }
163
+ /**
164
+ * 绑定自定义域名的域名参数
165
+ * 与 HTTPServiceDomainParam 类似,但不包含 Routes(绑定域名场景)
166
+ */
167
+ export interface BindCustomDomainDomainParam {
168
+ Domain: string;
169
+ CertId: string;
170
+ AccessType?: 'DIRECT' | 'CDN' | 'CUSTOM';
171
+ Protocol?: 'HTTP_AND_HTTPS' | 'HTTP_TO_HTTPS' | 'HTTPS_TO_HTTP';
172
+ Enable?: boolean;
173
+ CustomCname?: string;
174
+ }
175
+ /**
176
+ * BindCustomDomain 请求参数
177
+ * 用于绑定自定义域名到 HTTP 访问服务
178
+ * 底层调用 CreateHTTPServiceRoute API,但参数配置不同
179
+ */
180
+ export interface BindCustomDomainParams {
181
+ EnvId: string;
182
+ Domain: BindCustomDomainDomainParam;
183
+ }
184
+ /**
185
+ * BindCustomDomain 返回结果
186
+ */
187
+ export interface BindCustomDomainRes {
188
+ RequestId: string;
189
+ }
190
+ /**
191
+ * DeleteCustomDomain 请求参数
192
+ * 用于删除自定义域名(仅当域名下无路由绑定时可删除)
193
+ */
194
+ export interface DeleteCustomDomainParams {
195
+ EnvId: string;
196
+ Domain: string;
197
+ }
198
+ /**
199
+ * DeleteCustomDomain 返回结果
200
+ */
201
+ export interface DeleteCustomDomainRes {
202
+ RequestId: string;
203
+ }
@@ -504,17 +504,18 @@ export declare class FunctionService {
504
504
  */
505
505
  getFunctionAlias(params: IGetFunctionAlias): Promise<IGetFunctionAliasRes>;
506
506
  /**
507
- * 通过scf COS 上传方式(通过 GetTempCosInfo + COS SDK 上传)
507
+ * 通过 SCF COS 上传方式(通过 GetTempCosInfo + COS SDK 上传)
508
508
  * 返回 TempCosObjectName 用于创建/更新函数
509
509
  */
510
- uploadFunctionZipToCosLegacy(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
510
+ uploadFunctionZipToCos(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
511
511
  Key: string;
512
512
  }>;
513
513
  /**
514
- * 新的 COS 上传方式(通过 DescribeBuildServiceCosInfo + PUT 上传)
514
+ * 旧的 COS 上传方式(通过 DescribeBuildServiceCosInfo + PUT 上传)
515
515
  * 返回 CosTimestamp 用于创建/更新函数
516
+ * @deprecated 请使用 uploadFunctionZipToCos 代替
516
517
  */
517
- uploadFunctionZipToCos(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
518
+ uploadFunctionZipToCosLegacy(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
518
519
  UnixTimestamp: string;
519
520
  }>;
520
521
  getCodeParams(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
@@ -2,7 +2,7 @@ export type PermissionResourceType = 'function' | 'storage' | 'table' | 'collect
2
2
  export type BasePermission = 'READONLY' | 'PRIVATE' | 'ADMINWRITE' | 'ADMINONLY' | 'CUSTOM';
3
3
  export interface ModifyResourcePermissionOptions {
4
4
  resourceType: PermissionResourceType;
5
- resource: string;
5
+ resource?: string;
6
6
  permission: BasePermission;
7
7
  securityRule?: string;
8
8
  }