UNPKG

2.38 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("reflect-metadata");
10const commands_1 = require("./commands");
11commands_1.registerCommands();
12const auth_1 = require("./auth");
13const env_1 = require("./env");
14const third_1 = require("./third");
15const function_1 = require("./function");
16const storage = __importStar(require("./storage"));
17const utils_1 = require("./utils");
18module.exports = class CloudBase {
19 constructor(secretId, secretKey) {
20 this.login = auth_1.login;
21 this.logout = auth_1.logout;
22 this.env = {
23 list: env_1.listEnvs,
24 create: env_1.createEnv,
25 domain: {
26 list: env_1.getEnvAuthDomains,
27 create: env_1.createEnvDomain,
28 delete: env_1.deleteEnvDomain
29 },
30 login: {
31 list: env_1.getLoginConfigList,
32 create: env_1.createLoginConfig,
33 update: env_1.updateLoginConfig
34 }
35 };
36 this.third = {
37 deleteThirdPartAttach: third_1.deleteThirdPartAttach
38 };
39 this.functions = {
40 invoke: function_1.invokeFunction,
41 deploy: function_1.createFunction,
42 list: function_1.listFunction,
43 delete: function_1.deleteFunction,
44 detail: function_1.getFunctionDetail,
45 log: function_1.getFunctionLog,
46 code: {
47 update: function_1.updateFunctionCode
48 },
49 config: {
50 update: function_1.updateFunctionConfig
51 },
52 trigger: {
53 create: function_1.createFunctionTriggers,
54 delete: function_1.deleteFunctionTrigger
55 },
56 download: function_1.downloadFunctionCode,
57 copy: function_1.copyFunction
58 };
59 this.storage = storage;
60 console.warn('');
61 if (secretId && secretKey) {
62 const credential = {
63 secretId,
64 secretKey
65 };
66 utils_1.getSyncDB('auth').set('credential', credential).write();
67 }
68 }
69};