@cloudbase/cli 2.10.0 → 2.11.0-beta.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.
- package/lib/auth/login.js +51 -65
- package/lib/auth/logout.js +3 -14
- package/lib/commands/account/login.js +136 -149
- package/lib/commands/account/logout.js +3 -14
- package/lib/commands/ag/base.js +203 -0
- package/lib/commands/ag/create.js +301 -0
- package/lib/commands/ag/debug/index.html +699 -0
- package/lib/commands/ag/delete.js +200 -0
- package/lib/commands/ag/deploy.js +185 -0
- package/lib/commands/ag/detail.js +113 -0
- package/lib/commands/ag/index.js +22 -0
- package/lib/commands/ag/list.js +155 -0
- package/lib/commands/ag/run.js +644 -0
- package/lib/commands/ai/index.js +76 -95
- package/lib/commands/cloudfunction/base.js +182 -203
- package/lib/commands/cloudrun/base.js +578 -603
- package/lib/commands/common.js +48 -63
- package/lib/commands/config/delete.js +16 -27
- package/lib/commands/config/get.js +13 -24
- package/lib/commands/config/list.js +16 -27
- package/lib/commands/config/set.js +33 -44
- package/lib/commands/db/base.js +221 -240
- package/lib/commands/env/base.js +36 -49
- package/lib/commands/env/domain.js +79 -94
- package/lib/commands/env/login.js +120 -135
- package/lib/commands/framework/index.js +32 -49
- package/lib/commands/fun/base.js +223 -244
- package/lib/commands/functions/alias/getRoute.js +33 -44
- package/lib/commands/functions/alias/setRoute.js +36 -47
- package/lib/commands/functions/code-download.js +43 -54
- package/lib/commands/functions/code-update.js +23 -34
- package/lib/commands/functions/concurrency/delete.js +11 -22
- package/lib/commands/functions/concurrency/list.js +20 -31
- package/lib/commands/functions/concurrency/set.js +13 -24
- package/lib/commands/functions/config-update.js +30 -41
- package/lib/commands/functions/copy.js +12 -23
- package/lib/commands/functions/delete.js +30 -41
- package/lib/commands/functions/deploy.js +184 -202
- package/lib/commands/functions/detail.js +23 -34
- package/lib/commands/functions/invoke.js +69 -75
- package/lib/commands/functions/layer/bind.js +102 -105
- package/lib/commands/functions/layer/create.js +29 -35
- package/lib/commands/functions/layer/delete.js +42 -48
- package/lib/commands/functions/layer/download.js +52 -58
- package/lib/commands/functions/layer/list.js +44 -50
- package/lib/commands/functions/layer/sort.js +39 -45
- package/lib/commands/functions/list.js +25 -36
- package/lib/commands/functions/log.js +65 -73
- package/lib/commands/functions/run.js +118 -116
- package/lib/commands/functions/trigger-create.js +32 -43
- package/lib/commands/functions/trigger-delete.js +50 -61
- package/lib/commands/functions/version/list.js +29 -40
- package/lib/commands/functions/version/publish.js +11 -22
- package/lib/commands/gateway/create.js +50 -61
- package/lib/commands/gateway/delete.js +38 -49
- package/lib/commands/gateway/domain.js +65 -80
- package/lib/commands/gateway/list.js +31 -42
- package/lib/commands/gateway/switch.js +48 -61
- package/lib/commands/helpers/init.js +226 -249
- package/lib/commands/helpers/new.js +35 -46
- package/lib/commands/helpers/open.js +22 -33
- package/lib/commands/hosting/hosting.js +157 -178
- package/lib/commands/index.js +1 -0
- package/lib/commands/lowcode/app.js +114 -144
- package/lib/commands/lowcode/comps.js +136 -127
- package/lib/commands/lowcode/utils.js +11 -22
- package/lib/commands/pull/pull.js +33 -46
- package/lib/commands/run/delete.js +35 -46
- package/lib/commands/run/image/delete.js +32 -39
- package/lib/commands/run/image/download.js +26 -33
- package/lib/commands/run/image/list.js +41 -48
- package/lib/commands/run/image/upload.js +26 -33
- package/lib/commands/run/list.js +32 -43
- package/lib/commands/run/service/config.js +17 -28
- package/lib/commands/run/service/deploy.js +15 -26
- package/lib/commands/run/service/list.js +48 -59
- package/lib/commands/run/service/update.js +7 -18
- package/lib/commands/run/standalonegateway/create.js +35 -42
- package/lib/commands/run/standalonegateway/destroy.js +23 -30
- package/lib/commands/run/standalonegateway/list.js +19 -26
- package/lib/commands/run/standalonegateway/package.js +31 -38
- package/lib/commands/run/standalonegateway/turn.js +27 -34
- package/lib/commands/run/version/create.js +198 -205
- package/lib/commands/run/version/delete.js +31 -38
- package/lib/commands/run/version/list.js +42 -49
- package/lib/commands/run/version/modify.js +27 -34
- package/lib/commands/run/version/update.js +201 -208
- package/lib/commands/runf/base.js +216 -237
- package/lib/commands/self-update.js +59 -72
- package/lib/commands/smart.js +66 -79
- package/lib/commands/storage/storage.js +192 -219
- package/lib/commands/third/thirdAttach.js +16 -27
- package/lib/commands/utils.js +119 -149
- package/lib/db/index.js +48 -67
- package/lib/decorators/captureError.js +10 -21
- package/lib/decorators/guard.js +11 -22
- package/lib/decorators/injectParams.js +29 -40
- package/lib/decorators/params/common.js +5 -2
- package/lib/decorators/params/index.js +3 -12
- package/lib/env/domain.js +13 -28
- package/lib/env/index.js +25 -44
- package/lib/env/login.js +30 -45
- package/lib/function/alias.js +31 -44
- package/lib/function/base.js +187 -215
- package/lib/function/code.js +8 -19
- package/lib/function/concurrency.js +43 -58
- package/lib/function/create.js +43 -53
- package/lib/function/delete.js +22 -35
- package/lib/function/layer/attach.js +33 -46
- package/lib/function/layer/create.js +34 -45
- package/lib/function/layer/delete.js +5 -16
- package/lib/function/layer/download.js +11 -22
- package/lib/function/layer/list.js +12 -25
- package/lib/function/layer/sort.js +6 -17
- package/lib/function/trigger.js +65 -82
- package/lib/function/update.js +24 -32
- package/lib/function/version.js +29 -42
- package/lib/function/vpc.js +12 -25
- package/lib/gateway/index.js +77 -104
- package/lib/hosting.js +157 -188
- package/lib/run/delete.js +3 -12
- package/lib/run/image/build.js +6 -15
- package/lib/run/image/delete.js +3 -12
- package/lib/run/image/info.js +3 -12
- package/lib/run/image/list.js +6 -15
- package/lib/run/list.js +19 -30
- package/lib/run/repo.js +6 -15
- package/lib/run/service/common.js +160 -173
- package/lib/run/service/config.js +44 -57
- package/lib/run/service/deployPackage.js +33 -44
- package/lib/run/service/list.js +8 -14
- package/lib/run/service/showLogs.js +69 -90
- package/lib/run/service/update.js +50 -63
- package/lib/run/standalonegateway/create.js +3 -12
- package/lib/run/standalonegateway/destroy.js +3 -12
- package/lib/run/standalonegateway/list.js +3 -12
- package/lib/run/standalonegateway/package/list.js +3 -12
- package/lib/run/standalonegateway/turn/off.js +3 -12
- package/lib/run/standalonegateway/turn/on.js +3 -12
- package/lib/run/version/create.js +41 -31
- package/lib/run/version/delete.js +3 -12
- package/lib/run/version/list.js +3 -12
- package/lib/run/version/modify.js +3 -12
- package/lib/run/version/repo.js +6 -15
- package/lib/run/version/update.js +37 -26
- package/lib/storage.js +62 -93
- package/lib/third/index.js +6 -17
- package/lib/utils/ai/banner.js +49 -60
- package/lib/utils/ai/claudeWindows.js +2 -2
- package/lib/utils/ai/config.js +169 -206
- package/lib/utils/ai/ensureFiles.js +6 -17
- package/lib/utils/ai/env.js +16 -27
- package/lib/utils/ai/envLocalManager.js +35 -52
- package/lib/utils/ai/router.js +927 -1005
- package/lib/utils/ai/setup.js +527 -563
- package/lib/utils/auth.js +3 -14
- package/lib/utils/checkTcbrEnv.js +20 -31
- package/lib/utils/cli-table.js +6 -1
- package/lib/utils/config.js +4 -13
- package/lib/utils/dts.js +98 -113
- package/lib/utils/env.js +154 -175
- package/lib/utils/function-packer.js +29 -42
- package/lib/utils/log.js +10 -21
- package/lib/utils/mcp-config-modifier.js +105 -120
- package/lib/utils/net/cloud-api-request.js +15 -23
- package/lib/utils/net/credential.js +26 -39
- package/lib/utils/net/http-request.js +63 -80
- package/lib/utils/net/manager-service.js +22 -35
- package/lib/utils/notice.js +16 -27
- package/lib/utils/output/loading.js +3 -12
- package/lib/utils/parallel.js +32 -43
- package/lib/utils/platform/mac.js +4 -15
- package/lib/utils/platform/port.js +4 -15
- package/lib/utils/prompt/select.js +6 -15
- package/lib/utils/report.js +28 -33
- package/lib/utils/reporter/agree.js +11 -22
- package/lib/utils/reporter/download.js +17 -28
- package/lib/utils/reporter/usage.js +12 -23
- package/lib/utils/store/auth.js +17 -30
- package/lib/utils/store/config.js +11 -25
- package/lib/utils/store/db.js +17 -36
- package/lib/utils/tcbrApi/callTcbrApi.js +19 -28
- package/lib/utils/template-manager.js +215 -242
- package/lib/utils/template.js +81 -96
- package/lib/utils/tools/common.js +45 -56
- package/lib/utils/tools/time.js +5 -16
- package/lib/utils/url.js +10 -4
- package/package.json +2 -2
- package/specs/ag-command/design.md +421 -0
- package/specs/ag-command/doc.md +204 -0
- package/specs/ag-command/requirements.md +173 -0
- package/specs/ag-command/summary.md +174 -0
- package/specs/ag-command/tasks.md +197 -0
- package/specs/ag-command/usage-guide.md +420 -0
- package/tsconfig.json +1 -1
- package/types/commands/ag/base.d.ts +44 -0
- package/types/commands/ag/create.d.ts +25 -0
- package/types/commands/ag/delete.d.ts +32 -0
- package/types/commands/ag/deploy.d.ts +31 -0
- package/types/commands/ag/detail.d.ts +28 -0
- package/types/commands/ag/index.d.ts +6 -0
- package/types/commands/ag/list.d.ts +35 -0
- package/types/commands/ag/run.d.ts +52 -0
- package/types/commands/cloudrun/base.d.ts +10 -0
- package/types/commands/index.d.ts +1 -0
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.IsPrivateEnv = exports.Config = exports.EnvId = exports.ArgsParams = exports.ArgsOptions = exports.CmdContext = exports.Log = exports.Credential = void 0;
|
|
13
4
|
const common_1 = require("./common");
|
|
14
5
|
const constants_1 = require("../constants");
|
|
15
6
|
const utils_1 = require("../../utils");
|
|
16
7
|
const EmptyValue = () => { };
|
|
17
|
-
exports.Credential = (0, common_1.createParamDecorator)(constants_1.ParamTypes.Credential, () =>
|
|
18
|
-
const credential =
|
|
8
|
+
exports.Credential = (0, common_1.createParamDecorator)(constants_1.ParamTypes.Credential, async () => {
|
|
9
|
+
const credential = await utils_1.authSupevisor.getLoginState();
|
|
19
10
|
return credential;
|
|
20
|
-
})
|
|
11
|
+
});
|
|
21
12
|
exports.Log = (0, common_1.createParamDecorator)(constants_1.ParamTypes.Log, () => {
|
|
22
13
|
const args = (0, utils_1.getArgs)();
|
|
23
14
|
const verbose = process.VERBOSE || args.verbose;
|
package/lib/env/domain.js
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.deleteEnvDomain = exports.createEnvDomain = exports.getEnvAuthDomains = void 0;
|
|
13
4
|
const net_1 = require("../utils/net");
|
|
14
5
|
const tcbService = net_1.CloudApiService.getInstance('tcb');
|
|
15
|
-
function getEnvAuthDomains({ envId }) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
EnvId: envId
|
|
19
|
-
});
|
|
20
|
-
return Domains;
|
|
6
|
+
async function getEnvAuthDomains({ envId }) {
|
|
7
|
+
const { Domains = [] } = await tcbService.request('DescribeAuthDomains', {
|
|
8
|
+
EnvId: envId
|
|
21
9
|
});
|
|
10
|
+
return Domains;
|
|
22
11
|
}
|
|
23
12
|
exports.getEnvAuthDomains = getEnvAuthDomains;
|
|
24
|
-
function createEnvDomain({ envId, domains }) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Domains: domains
|
|
29
|
-
});
|
|
13
|
+
async function createEnvDomain({ envId, domains }) {
|
|
14
|
+
await tcbService.request('CreateAuthDomain', {
|
|
15
|
+
EnvId: envId,
|
|
16
|
+
Domains: domains
|
|
30
17
|
});
|
|
31
18
|
}
|
|
32
19
|
exports.createEnvDomain = createEnvDomain;
|
|
33
|
-
function deleteEnvDomain({ envId, domainIds }) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
DomainIds: domainIds
|
|
38
|
-
});
|
|
39
|
-
return Deleted;
|
|
20
|
+
async function deleteEnvDomain({ envId, domainIds }) {
|
|
21
|
+
const { Deleted } = await tcbService.request('DeleteAuthDomain', {
|
|
22
|
+
EnvId: envId,
|
|
23
|
+
DomainIds: domainIds
|
|
40
24
|
});
|
|
25
|
+
return Deleted;
|
|
41
26
|
}
|
|
42
27
|
exports.deleteEnvDomain = deleteEnvDomain;
|
package/lib/env/index.js
CHANGED
|
@@ -13,68 +13,49 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
17
|
exports.getEnvLimit = exports.updateEnvInfo = exports.listEnvs = exports.getEnvInfo = exports.initTcb = void 0;
|
|
27
18
|
const net_1 = require("../utils/net");
|
|
28
19
|
__exportStar(require("./domain"), exports);
|
|
29
20
|
__exportStar(require("./login"), exports);
|
|
30
21
|
const tcbService = net_1.CloudApiService.getInstance('tcb');
|
|
31
|
-
function initTcb(skey) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Skey: skey
|
|
35
|
-
});
|
|
36
|
-
return res;
|
|
22
|
+
async function initTcb(skey) {
|
|
23
|
+
const res = await tcbService.request('InitTcb', {
|
|
24
|
+
Skey: skey
|
|
37
25
|
});
|
|
26
|
+
return res;
|
|
38
27
|
}
|
|
39
28
|
exports.initTcb = initTcb;
|
|
40
|
-
function getEnvInfo(envId) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
EnvId: envId
|
|
44
|
-
});
|
|
45
|
-
return (EnvList === null || EnvList === void 0 ? void 0 : EnvList.length) ? EnvList[0] : {};
|
|
29
|
+
async function getEnvInfo(envId) {
|
|
30
|
+
const { EnvList } = await tcbService.request('DescribeEnvs', {
|
|
31
|
+
EnvId: envId
|
|
46
32
|
});
|
|
33
|
+
return (EnvList === null || EnvList === void 0 ? void 0 : EnvList.length) ? EnvList[0] : {};
|
|
47
34
|
}
|
|
48
35
|
exports.getEnvInfo = getEnvInfo;
|
|
49
|
-
function listEnvs(options = {}) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Channels: ['dcloud']
|
|
55
|
-
});
|
|
56
|
-
let { EnvList = [] } = res;
|
|
57
|
-
if (source && Array.isArray(source)) {
|
|
58
|
-
EnvList = EnvList.filter((item) => source.includes(item.Source));
|
|
59
|
-
}
|
|
60
|
-
return EnvList;
|
|
36
|
+
async function listEnvs(options = {}) {
|
|
37
|
+
const { source } = options;
|
|
38
|
+
const res = await tcbService.request('DescribeEnvs', {
|
|
39
|
+
IsVisible: false,
|
|
40
|
+
Channels: ['dcloud']
|
|
61
41
|
});
|
|
42
|
+
let { EnvList = [] } = res;
|
|
43
|
+
if (source && Array.isArray(source)) {
|
|
44
|
+
EnvList = EnvList.filter((item) => source.includes(item.Source));
|
|
45
|
+
}
|
|
46
|
+
return EnvList;
|
|
62
47
|
}
|
|
63
48
|
exports.listEnvs = listEnvs;
|
|
64
|
-
function updateEnvInfo({ envId, alias }) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Alias: alias
|
|
69
|
-
});
|
|
49
|
+
async function updateEnvInfo({ envId, alias }) {
|
|
50
|
+
await tcbService.request('ModifyEnv', {
|
|
51
|
+
EnvId: envId,
|
|
52
|
+
Alias: alias
|
|
70
53
|
});
|
|
71
54
|
}
|
|
72
55
|
exports.updateEnvInfo = updateEnvInfo;
|
|
73
|
-
function getEnvLimit(source = 'qcloud') {
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
Source: source
|
|
77
|
-
});
|
|
56
|
+
async function getEnvLimit(source = 'qcloud') {
|
|
57
|
+
return tcbService.request('DescribeEnvLimit', {
|
|
58
|
+
Source: source
|
|
78
59
|
});
|
|
79
60
|
}
|
|
80
61
|
exports.getEnvLimit = getEnvLimit;
|
package/lib/env/login.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -33,46 +24,40 @@ function rsaEncrypt(data) {
|
|
|
33
24
|
return encrypted.toString('base64');
|
|
34
25
|
}
|
|
35
26
|
const tcbService = net_1.CloudApiService.getInstance('tcb');
|
|
36
|
-
function getLoginConfigList({ envId }) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
EnvId: envId
|
|
40
|
-
});
|
|
41
|
-
return ConfigList;
|
|
27
|
+
async function getLoginConfigList({ envId }) {
|
|
28
|
+
const { ConfigList = [] } = await tcbService.request('DescribeLoginConfigs', {
|
|
29
|
+
EnvId: envId
|
|
42
30
|
});
|
|
31
|
+
return ConfigList;
|
|
43
32
|
}
|
|
44
33
|
exports.getLoginConfigList = getLoginConfigList;
|
|
45
|
-
function createLoginConfig({ envId, platform, appId, appSecret }) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
yield tcbService.request('CreateLoginConfig', params);
|
|
59
|
-
});
|
|
34
|
+
async function createLoginConfig({ envId, platform, appId, appSecret }) {
|
|
35
|
+
const validPlatform = ['WECHAT-OPEN', 'WECHAT-PUBLIC', 'ANONYMOUS'];
|
|
36
|
+
if (!validPlatform.includes(platform)) {
|
|
37
|
+
throw new error_1.CloudBaseError(`Invalid platform value: ${platform}. Now only support 'WECHAT-OPEN', 'WECHAT-PUBLIC', 'ANONYMOUS`);
|
|
38
|
+
}
|
|
39
|
+
const params = {
|
|
40
|
+
EnvId: envId,
|
|
41
|
+
Platform: platform,
|
|
42
|
+
PlatformId: appId,
|
|
43
|
+
PlatformSecret: rsaEncrypt(appSecret),
|
|
44
|
+
Status: 'ENABLE'
|
|
45
|
+
};
|
|
46
|
+
await tcbService.request('CreateLoginConfig', params);
|
|
60
47
|
}
|
|
61
48
|
exports.createLoginConfig = createLoginConfig;
|
|
62
|
-
function updateLoginConfig({ configId, envId, status = 'ENABLE', appId = '', appSecret = '' }) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
yield tcbService.request('UpdateLoginConfig', params);
|
|
76
|
-
});
|
|
49
|
+
async function updateLoginConfig({ configId, envId, status = 'ENABLE', appId = '', appSecret = '' }) {
|
|
50
|
+
const validStatus = ['ENABLE', 'DISABLE'];
|
|
51
|
+
if (!validStatus.includes(status)) {
|
|
52
|
+
throw new error_1.CloudBaseError(`Invalid status value: ${status}. Only support 'ENABLE', 'DISABLE'`);
|
|
53
|
+
}
|
|
54
|
+
const params = {
|
|
55
|
+
EnvId: envId,
|
|
56
|
+
ConfigId: configId,
|
|
57
|
+
Status: status
|
|
58
|
+
};
|
|
59
|
+
appId && (params.PlatformId = appId);
|
|
60
|
+
appSecret && (params.PlatformSecret = rsaEncrypt(appSecret));
|
|
61
|
+
await tcbService.request('UpdateLoginConfig', params);
|
|
77
62
|
}
|
|
78
63
|
exports.updateLoginConfig = updateLoginConfig;
|
package/lib/function/alias.js
CHANGED
|
@@ -1,54 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getFunctionAliasConfig = exports.setFunctionAliasConfig = void 0;
|
|
13
4
|
const error_1 = require("../error");
|
|
14
5
|
const base_1 = require("./base");
|
|
15
6
|
const i18n_1 = require("../i18n");
|
|
16
|
-
function setFunctionAliasConfig(options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
});
|
|
7
|
+
async function setFunctionAliasConfig(options) {
|
|
8
|
+
const { envId, functionName, name, functionVersion, description, routingConfig } = options;
|
|
9
|
+
const scfService = await (0, base_1.getFunctionService)(envId);
|
|
10
|
+
try {
|
|
11
|
+
await scfService.updateFunctionAliasConfig({
|
|
12
|
+
functionName,
|
|
13
|
+
name,
|
|
14
|
+
functionVersion,
|
|
15
|
+
description,
|
|
16
|
+
routingConfig
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('[{{name}}] 设置函数流量配置失败: {{error}}', { name: functionName, error: e.message }), {
|
|
21
|
+
code: e.code
|
|
22
|
+
});
|
|
23
|
+
}
|
|
35
24
|
}
|
|
36
25
|
exports.setFunctionAliasConfig = setFunctionAliasConfig;
|
|
37
|
-
function getFunctionAliasConfig(options) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
});
|
|
26
|
+
async function getFunctionAliasConfig(options) {
|
|
27
|
+
const { envId, functionName, name } = options;
|
|
28
|
+
const scfService = await (0, base_1.getFunctionService)(envId);
|
|
29
|
+
try {
|
|
30
|
+
return scfService.getFunctionAlias({
|
|
31
|
+
functionName,
|
|
32
|
+
name
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('[{{name}}] 查询函数别名配置失败: {{error}}', { name: functionName, error: e.message }), {
|
|
37
|
+
code: e.code
|
|
38
|
+
});
|
|
39
|
+
}
|
|
53
40
|
}
|
|
54
41
|
exports.getFunctionAliasConfig = getFunctionAliasConfig;
|