UNPKG

2.27 kBJavaScriptView Raw
1"use strict";
2var __importStar = (this && this.__importStar) || function (mod) {
3 if (mod && mod.__esModule) return mod;
4 var result = {};
5 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6 result["default"] = mod;
7 return result;
8};
9require("./commands");
10const auth_1 = require("./auth");
11const env_1 = require("./env");
12const third_1 = require("./third");
13const function_1 = require("./function");
14const storage = __importStar(require("./storage"));
15const utils_1 = require("./utils");
16module.exports = class CloudBase {
17 constructor(secretId, secretKey) {
18 this.login = auth_1.login;
19 this.logout = auth_1.logout;
20 this.env = {
21 list: env_1.listEnvs,
22 create: env_1.createEnv,
23 domain: {
24 list: env_1.getEnvAuthDomains,
25 create: env_1.createEnvDomain,
26 delete: env_1.deleteEnvDomain
27 },
28 login: {
29 list: env_1.getLoginConfigList,
30 create: env_1.createLoginConfig,
31 update: env_1.updateLoginConfig
32 }
33 };
34 this.third = {
35 deleteThirdPartAttach: third_1.deleteThirdPartAttach
36 };
37 this.functions = {
38 invoke: function_1.invokeFunction,
39 deploy: function_1.createFunction,
40 list: function_1.listFunction,
41 delete: function_1.deleteFunction,
42 detail: function_1.getFunctionDetail,
43 log: function_1.getFunctionLog,
44 code: {
45 update: function_1.updateFunctionCode
46 },
47 config: {
48 update: function_1.updateFunctionConfig
49 },
50 trigger: {
51 create: function_1.createFunctionTriggers,
52 delete: function_1.deleteFunctionTrigger
53 },
54 download: function_1.downloadFunctionCode,
55 copy: function_1.copyFunction
56 };
57 this.storage = storage;
58 if (secretId && secretKey) {
59 const credential = {
60 secretId,
61 secretKey
62 };
63 utils_1.getSyncDB('auth').set('credential', credential).write();
64 }
65 }
66};