@cloudbase/manager-node 4.2.3 → 4.2.4
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/CHANGELOG.md +4 -0
- package/package.json +4 -3
- package/lib/access/index.js +0 -141
- package/lib/access/types.js +0 -2
- package/lib/billing/index.js +0 -36
- package/lib/cam/index.js +0 -77
- package/lib/cloudBaseRun/index.js +0 -36
- package/lib/cloudBaseRun/types.js +0 -2
- package/lib/common/index.js +0 -39
- package/lib/constant.js +0 -51
- package/lib/context.js +0 -14
- package/lib/database/index.js +0 -244
- package/lib/debug.js +0 -34
- package/lib/env/index.js +0 -488
- package/lib/environment.js +0 -124
- package/lib/environmentManager.js +0 -44
- package/lib/error.js +0 -16
- package/lib/function/index.js +0 -1022
- package/lib/function/packer.js +0 -129
- package/lib/function/types.js +0 -2
- package/lib/hosting/index.js +0 -461
- package/lib/index.js +0 -83
- package/lib/interfaces/base.interface.js +0 -2
- package/lib/interfaces/billing.interface.js +0 -2
- package/lib/interfaces/cam.interface.js +0 -2
- package/lib/interfaces/flexdb.interface.js +0 -2
- package/lib/interfaces/function.interface.js +0 -2
- package/lib/interfaces/index.js +0 -19
- package/lib/interfaces/storage.interface.js +0 -2
- package/lib/interfaces/tcb.interface.js +0 -2
- package/lib/storage/index.js +0 -1037
- package/lib/third/index.js +0 -18
- package/lib/user/index.js +0 -136
- package/lib/user/types.js +0 -2
- package/lib/utils/auth.js +0 -97
- package/lib/utils/cloud-api-request.js +0 -205
- package/lib/utils/cloudbase-request.js +0 -69
- package/lib/utils/envLazy.js +0 -18
- package/lib/utils/fs.js +0 -64
- package/lib/utils/http-request.js +0 -44
- package/lib/utils/index.js +0 -103
- package/lib/utils/parallel.js +0 -69
- package/lib/utils/uuid.js +0 -18
- package/src/access/index.ts +0 -168
- package/src/access/types.ts +0 -55
- package/src/billing/index.ts +0 -43
- package/src/cam/index.ts +0 -106
- package/src/cloudBaseRun/index.ts +0 -40
- package/src/cloudBaseRun/types.ts +0 -24
- package/src/common/index.ts +0 -54
- package/src/constant.ts +0 -56
- package/src/context.ts +0 -18
- package/src/database/index.ts +0 -369
- package/src/debug.ts +0 -34
- package/src/env/index.ts +0 -614
- package/src/environment.ts +0 -156
- package/src/environmentManager.ts +0 -50
- package/src/error.ts +0 -27
- package/src/function/index.ts +0 -1378
- package/src/function/packer.ts +0 -164
- package/src/function/types.ts +0 -165
- package/src/hosting/index.ts +0 -698
- package/src/index.ts +0 -127
- package/src/interfaces/base.interface.ts +0 -8
- package/src/interfaces/billing.interface.ts +0 -21
- package/src/interfaces/cam.interface.ts +0 -28
- package/src/interfaces/flexdb.interface.ts +0 -104
- package/src/interfaces/function.interface.ts +0 -75
- package/src/interfaces/index.ts +0 -7
- package/src/interfaces/storage.interface.ts +0 -29
- package/src/interfaces/tcb.interface.ts +0 -642
- package/src/storage/index.ts +0 -1290
- package/src/third/index.ts +0 -24
- package/src/user/index.ts +0 -174
- package/src/user/types.ts +0 -21
- package/src/utils/auth.ts +0 -112
- package/src/utils/cloud-api-request.ts +0 -252
- package/src/utils/cloudbase-request.ts +0 -109
- package/src/utils/envLazy.ts +0 -15
- package/src/utils/fs.ts +0 -57
- package/src/utils/http-request.ts +0 -37
- package/src/utils/index.ts +0 -103
- package/src/utils/parallel.ts +0 -82
- package/src/utils/uuid.ts +0 -14
- package/types/access/index.d.ts +0 -38
- package/types/access/types.d.ts +0 -42
- package/types/billing/index.d.ts +0 -21
- package/types/cam/index.d.ts +0 -63
- package/types/cloudBaseRun/index.d.ts +0 -12
- package/types/cloudBaseRun/types.d.ts +0 -21
- package/types/common/index.d.ts +0 -18
- package/types/constant.d.ts +0 -37
- package/types/context.d.ts +0 -17
- package/types/database/index.d.ts +0 -66
- package/types/debug.d.ts +0 -1
- package/types/env/index.d.ts +0 -144
- package/types/environment.d.ts +0 -51
- package/types/environmentManager.d.ts +0 -13
- package/types/error.d.ts +0 -18
- package/types/function/index.d.ts +0 -379
- package/types/function/packer.d.ts +0 -37
- package/types/function/types.d.ts +0 -156
- package/types/hosting/index.d.ts +0 -253
- package/types/index.d.ts +0 -52
- package/types/interfaces/base.interface.d.ts +0 -7
- package/types/interfaces/billing.interface.d.ts +0 -18
- package/types/interfaces/cam.interface.d.ts +0 -24
- package/types/interfaces/flexdb.interface.d.ts +0 -67
- package/types/interfaces/function.interface.d.ts +0 -65
- package/types/interfaces/index.d.ts +0 -7
- package/types/interfaces/storage.interface.d.ts +0 -26
- package/types/interfaces/tcb.interface.d.ts +0 -305
- package/types/storage/index.d.ts +0 -324
- package/types/third/index.d.ts +0 -11
- package/types/user/index.d.ts +0 -52
- package/types/user/types.d.ts +0 -20
- package/types/utils/auth.d.ts +0 -8
- package/types/utils/cloud-api-request.d.ts +0 -21
- package/types/utils/cloudbase-request.d.ts +0 -14
- package/types/utils/envLazy.d.ts +0 -1
- package/types/utils/fs.d.ts +0 -7
- package/types/utils/http-request.d.ts +0 -2
- package/types/utils/index.d.ts +0 -20
- package/types/utils/parallel.d.ts +0 -17
- package/types/utils/uuid.d.ts +0 -2
package/src/utils/envLazy.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function preLazy() {
|
|
2
|
-
return function(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
3
|
-
let oldFunc = descriptor.value
|
|
4
|
-
descriptor.value = async function() {
|
|
5
|
-
// 检查当前环境对象上是否已加载好环境信息
|
|
6
|
-
const currentEnvironment = this.environment
|
|
7
|
-
|
|
8
|
-
if (!currentEnvironment.inited) {
|
|
9
|
-
await currentEnvironment.lazyInit()
|
|
10
|
-
}
|
|
11
|
-
let result = await oldFunc.apply(this, arguments)
|
|
12
|
-
return result
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
package/src/utils/fs.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { CloudBaseError } from '../error'
|
|
3
|
-
import del from 'del'
|
|
4
|
-
|
|
5
|
-
type SizeUnit = 'MB' | 'GB'
|
|
6
|
-
|
|
7
|
-
// 检查路径是否可以访问(读、写)
|
|
8
|
-
export function checkFullAccess(dest: string, throwError = false): boolean {
|
|
9
|
-
try {
|
|
10
|
-
// 可见、可写
|
|
11
|
-
fs.accessSync(dest, fs.constants.F_OK)
|
|
12
|
-
fs.accessSync(dest, fs.constants.W_OK)
|
|
13
|
-
fs.accessSync(dest, fs.constants.R_OK)
|
|
14
|
-
return true
|
|
15
|
-
} catch (e) {
|
|
16
|
-
if (throwError) {
|
|
17
|
-
throw new CloudBaseError(`路径不存在或无读写权限:${dest}`)
|
|
18
|
-
} else {
|
|
19
|
-
return false
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// 检查路径是否可以写
|
|
25
|
-
export function checkReadable(dest: string, throwError = false): boolean {
|
|
26
|
-
try {
|
|
27
|
-
// 可见、可读
|
|
28
|
-
fs.accessSync(dest, fs.constants.F_OK)
|
|
29
|
-
fs.accessSync(dest, fs.constants.R_OK)
|
|
30
|
-
return true
|
|
31
|
-
} catch (e) {
|
|
32
|
-
if (throwError) {
|
|
33
|
-
throw new CloudBaseError(`路径不存在或无读权限:${dest}`)
|
|
34
|
-
} else {
|
|
35
|
-
return false
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function isDirectory(dest: string) {
|
|
41
|
-
checkFullAccess(dest, true)
|
|
42
|
-
return fs.statSync(dest).isDirectory()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function formateFileSize(size: number, unit: SizeUnit) {
|
|
46
|
-
const unitMap = {
|
|
47
|
-
KB: 1024,
|
|
48
|
-
MB: Math.pow(1024, 2),
|
|
49
|
-
GB: Math.pow(1024, 3)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return Number(size / unitMap[unit]).toFixed(2)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function delSync(patterns: string | readonly string[]) {
|
|
56
|
-
del.sync(patterns, { force: true })
|
|
57
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { URL } from 'url'
|
|
2
|
-
import _fetch from 'node-fetch'
|
|
3
|
-
import HttpsProxyAgent from 'https-proxy-agent'
|
|
4
|
-
import { CloudBaseError } from '../error'
|
|
5
|
-
|
|
6
|
-
// 使用 fetch + 代理
|
|
7
|
-
export async function fetch(url: string, config: Record<string, any> = {}, proxy) {
|
|
8
|
-
if (proxy || process.env.http_proxy) {
|
|
9
|
-
config.agent = new HttpsProxyAgent(proxy || process.env.http_proxy)
|
|
10
|
-
}
|
|
11
|
-
// 解决中文编码问题
|
|
12
|
-
const escapeUrl = new URL(url).toString()
|
|
13
|
-
let json
|
|
14
|
-
let text
|
|
15
|
-
try {
|
|
16
|
-
const res = await _fetch(escapeUrl, config)
|
|
17
|
-
text = await res.text()
|
|
18
|
-
json = JSON.parse(text)
|
|
19
|
-
} catch (e) {
|
|
20
|
-
// 某些情况下回返回 HTML 文本异常
|
|
21
|
-
// JSON 解析错误,抛出原响应文本
|
|
22
|
-
if (e.name === 'SyntaxError') {
|
|
23
|
-
throw new CloudBaseError(text)
|
|
24
|
-
}
|
|
25
|
-
throw new CloudBaseError(e)
|
|
26
|
-
}
|
|
27
|
-
return json
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function fetchStream(url: string, config: Record<string, any> = {}, proxy) {
|
|
31
|
-
if (proxy || process.env.http_proxy) {
|
|
32
|
-
config.agent = new HttpsProxyAgent(proxy || process.env.http_proxy)
|
|
33
|
-
}
|
|
34
|
-
// 解决中文编码问题
|
|
35
|
-
const escapeUrl = new URL(url).toString()
|
|
36
|
-
return _fetch(escapeUrl, config)
|
|
37
|
-
}
|
package/src/utils/index.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import archiver from 'archiver'
|
|
3
|
-
import crypto from 'crypto'
|
|
4
|
-
import { PUBLIC_RSA_KEY, ENV_NAME } from '../constant'
|
|
5
|
-
|
|
6
|
-
export { guid6 } from './uuid'
|
|
7
|
-
export * from './cloud-api-request'
|
|
8
|
-
export * from './auth'
|
|
9
|
-
export * from './cloudbase-request'
|
|
10
|
-
export * from './http-request'
|
|
11
|
-
export * from './envLazy'
|
|
12
|
-
export * from './fs'
|
|
13
|
-
|
|
14
|
-
interface IZipOption {
|
|
15
|
-
dirPath: string
|
|
16
|
-
outputPath: string
|
|
17
|
-
ignore?: string | string[]
|
|
18
|
-
pattern?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function compressToZip(option: IZipOption) {
|
|
22
|
-
const { dirPath, outputPath, ignore, pattern = '**/*' } = option
|
|
23
|
-
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
const output = fs.createWriteStream(outputPath)
|
|
26
|
-
const archive = archiver('zip')
|
|
27
|
-
|
|
28
|
-
output.on('close', function () {
|
|
29
|
-
resolve({
|
|
30
|
-
zipPath: outputPath,
|
|
31
|
-
size: Math.ceil(archive.pointer() / 1024)
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
archive.on('error', function (err) {
|
|
36
|
-
reject(err)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
archive.pipe(output)
|
|
40
|
-
// append files from a glob pattern
|
|
41
|
-
archive.glob(pattern, {
|
|
42
|
-
// 目标路径
|
|
43
|
-
cwd: dirPath,
|
|
44
|
-
ignore: ignore,
|
|
45
|
-
dot: true
|
|
46
|
-
})
|
|
47
|
-
archive.finalize()
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function getRuntime(): string {
|
|
52
|
-
return process.env[ENV_NAME.ENV_RUNENV]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function getEnvVar(envName: string): string {
|
|
56
|
-
return process.env[envName]
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function rsaEncrypt(data: string): string {
|
|
60
|
-
const buffer = Buffer.from(data)
|
|
61
|
-
const encrypted = crypto.publicEncrypt(
|
|
62
|
-
{
|
|
63
|
-
key: PUBLIC_RSA_KEY,
|
|
64
|
-
padding: crypto.constants.RSA_PKCS1_PADDING
|
|
65
|
-
},
|
|
66
|
-
buffer
|
|
67
|
-
)
|
|
68
|
-
return encrypted.toString('base64')
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function sleep(time: number): Promise<void> {
|
|
72
|
-
return new Promise(resolve => {
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
resolve()
|
|
75
|
-
}, time)
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function upperCaseStringFisrt(str: string) {
|
|
80
|
-
return str.slice(0, 1).toUpperCase().concat(str.slice(1))
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function upperCaseObjKey(object: any) {
|
|
84
|
-
const type = Object.prototype.toString.call(object).slice(8, -1)
|
|
85
|
-
if (type === 'Object') {
|
|
86
|
-
let newObj = {}
|
|
87
|
-
// eslint-disable-next-line guard-for-in
|
|
88
|
-
for (let key in object) {
|
|
89
|
-
newObj[upperCaseStringFisrt(key)] = upperCaseObjKey(object[key])
|
|
90
|
-
}
|
|
91
|
-
return newObj
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (type === 'Array') {
|
|
95
|
-
let newArr = []
|
|
96
|
-
for (let item of object) {
|
|
97
|
-
newArr.push(upperCaseObjKey(item))
|
|
98
|
-
}
|
|
99
|
-
return newArr
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return object
|
|
103
|
-
}
|
package/src/utils/parallel.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export type AsyncTask = () => Promise<any>
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 异步任务并发控制器,以一定的并发数执行所有任务
|
|
5
|
-
* 不具备队列性质,异步任务随机执行
|
|
6
|
-
* 单个任务异常,错误会返回,单不会退出执行
|
|
7
|
-
* 所有任务执行
|
|
8
|
-
*/
|
|
9
|
-
export class AsyncTaskParallelController {
|
|
10
|
-
// 任务最大并发数
|
|
11
|
-
maxParallel: number
|
|
12
|
-
// 异步任务队列
|
|
13
|
-
tasks: AsyncTask[]
|
|
14
|
-
// 检查间隔时间,单位 ms
|
|
15
|
-
checkInterval: number
|
|
16
|
-
// 所有任务数量
|
|
17
|
-
totalTasks: number
|
|
18
|
-
|
|
19
|
-
constructor(maxParallel: number, checkInterval = 20) {
|
|
20
|
-
this.tasks = []
|
|
21
|
-
this.maxParallel = Number(maxParallel) || 20
|
|
22
|
-
this.checkInterval = checkInterval
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
loadTasks(tasks: AsyncTask[]) {
|
|
26
|
-
this.tasks.push(...tasks)
|
|
27
|
-
this.totalTasks = this.tasks.length
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
push(task: AsyncTask) {
|
|
31
|
-
this.tasks.push(task)
|
|
32
|
-
this.totalTasks = this.tasks.length
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// 开始执行任务
|
|
36
|
-
async run(): Promise<any[]> {
|
|
37
|
-
// 存储任务执行结果
|
|
38
|
-
const results = []
|
|
39
|
-
// 记录已经运行的任务
|
|
40
|
-
const taskHasRun = []
|
|
41
|
-
// 记录任务是否执行完成
|
|
42
|
-
const taskDone = []
|
|
43
|
-
// 当前正在运行的任务数量
|
|
44
|
-
let runningTask = 0
|
|
45
|
-
|
|
46
|
-
return new Promise(resolve => {
|
|
47
|
-
// 使用定时器,不阻塞线程
|
|
48
|
-
const timer = setInterval(() => {
|
|
49
|
-
// 全部任务运行完成
|
|
50
|
-
const taskDoneLength = taskDone.filter(item => item).length
|
|
51
|
-
if (runningTask === 0 && taskDoneLength === this.totalTasks) {
|
|
52
|
-
clearInterval(timer)
|
|
53
|
-
resolve(results)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 当前运行任务数超过最大并发,不再执行新的任务
|
|
57
|
-
if (runningTask >= this.maxParallel) {
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// 遍历任务列表,开始执行还没有执行的任务
|
|
62
|
-
this.tasks.forEach((task, index) => {
|
|
63
|
-
if (!taskHasRun[index] && runningTask < this.maxParallel) {
|
|
64
|
-
runningTask++
|
|
65
|
-
taskHasRun[index] = 1
|
|
66
|
-
task()
|
|
67
|
-
.then(res => {
|
|
68
|
-
results[index] = res
|
|
69
|
-
})
|
|
70
|
-
.catch(err => {
|
|
71
|
-
results[index] = err
|
|
72
|
-
})
|
|
73
|
-
.then(() => {
|
|
74
|
-
runningTask--
|
|
75
|
-
taskDone[index] = 1
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
}, this.checkInterval)
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
}
|
package/src/utils/uuid.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// 环境 uuid
|
|
2
|
-
export function guid6() {
|
|
3
|
-
return Math.floor((1 + Math.random()) * 0x1000000)
|
|
4
|
-
.toString(16)
|
|
5
|
-
.substring(1)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function uuidv4() {
|
|
9
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
10
|
-
const r = (Math.random() * 16) | 0
|
|
11
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8
|
|
12
|
-
return v.toString(16)
|
|
13
|
-
})
|
|
14
|
-
}
|
package/types/access/index.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Environment } from '../environment';
|
|
2
|
-
import { ICreateAccessOptions, IApi, IUpdateOptions, IService, IDeleteOptions, IGetOptions, IDomainOptions } from './types';
|
|
3
|
-
import { IResponseInfo } from '../interfaces';
|
|
4
|
-
export declare class AccessService {
|
|
5
|
-
private tcbService;
|
|
6
|
-
private environment;
|
|
7
|
-
constructor(environment: Environment);
|
|
8
|
-
createAccess(options: ICreateAccessOptions): Promise<{
|
|
9
|
-
APIId: string;
|
|
10
|
-
RequestId: string;
|
|
11
|
-
}>;
|
|
12
|
-
getDomainList(): Promise<{
|
|
13
|
-
RequestId: string;
|
|
14
|
-
DefaultDomain: string;
|
|
15
|
-
EnableService: boolean;
|
|
16
|
-
ServiceSet: IService[];
|
|
17
|
-
}>;
|
|
18
|
-
getAccessList(options?: IGetOptions): Promise<{
|
|
19
|
-
RequestId: string;
|
|
20
|
-
APISet: IApi[];
|
|
21
|
-
Total: number;
|
|
22
|
-
Limit: number;
|
|
23
|
-
Offset: number;
|
|
24
|
-
EnableService: boolean;
|
|
25
|
-
}>;
|
|
26
|
-
switchAuth(auth: boolean): Promise<{
|
|
27
|
-
Count: number;
|
|
28
|
-
RequestId: string;
|
|
29
|
-
}>;
|
|
30
|
-
switchPathAuth(options: IUpdateOptions): Promise<{
|
|
31
|
-
Count: number;
|
|
32
|
-
RequestId: string;
|
|
33
|
-
}>;
|
|
34
|
-
deleteAccess(options: IDeleteOptions): Promise<IResponseInfo>;
|
|
35
|
-
addCustomDomain(options: IDomainOptions): Promise<IResponseInfo>;
|
|
36
|
-
deleteCustomDomain(domain: string): Promise<IResponseInfo>;
|
|
37
|
-
private getEnvInfo;
|
|
38
|
-
}
|
package/types/access/types.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export interface ICreateAccessOptions {
|
|
2
|
-
path: string;
|
|
3
|
-
name: string;
|
|
4
|
-
type?: 1 | 2;
|
|
5
|
-
auth?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface IApi {
|
|
8
|
-
ServiceId: string;
|
|
9
|
-
APIId: string;
|
|
10
|
-
Path: string;
|
|
11
|
-
Type: number;
|
|
12
|
-
Name: string;
|
|
13
|
-
CreateTime: number;
|
|
14
|
-
EnvId: string;
|
|
15
|
-
EnableAuth: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface IUpdateOptions {
|
|
18
|
-
apiIds: string[];
|
|
19
|
-
auth: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface IService {
|
|
22
|
-
ServiceId: string;
|
|
23
|
-
Domain: string;
|
|
24
|
-
OpenTime: number;
|
|
25
|
-
Status?: number;
|
|
26
|
-
}
|
|
27
|
-
export interface IDeleteOptions {
|
|
28
|
-
name?: string;
|
|
29
|
-
type?: number;
|
|
30
|
-
apiId?: string;
|
|
31
|
-
path?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface IGetOptions {
|
|
34
|
-
path?: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
limit?: number;
|
|
37
|
-
offset?: number;
|
|
38
|
-
}
|
|
39
|
-
export interface IDomainOptions {
|
|
40
|
-
domain: string;
|
|
41
|
-
certId?: string;
|
|
42
|
-
}
|
package/types/billing/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CloudBaseContext } from '../context';
|
|
2
|
-
import { IServiceVersion, IGoodItem, IGenerateDealsRes, IPayDealsRes } from '../interfaces';
|
|
3
|
-
export declare class BillingService {
|
|
4
|
-
static billServiceVersion: IServiceVersion;
|
|
5
|
-
private billService;
|
|
6
|
-
constructor(context: CloudBaseContext);
|
|
7
|
-
/**
|
|
8
|
-
* 创建订单
|
|
9
|
-
* @param {Array<IGoodItem>} goods
|
|
10
|
-
* @returns {Promise<IGenerateDealsRes>}
|
|
11
|
-
* @memberof BillingService
|
|
12
|
-
*/
|
|
13
|
-
GenerateDeals(goods: Array<IGoodItem>): Promise<IGenerateDealsRes>;
|
|
14
|
-
/**
|
|
15
|
-
* 支付订单
|
|
16
|
-
* @param {Array<string>} orderIds
|
|
17
|
-
* @returns {Promise<IPayDealsRes>}
|
|
18
|
-
* @memberof BillingService
|
|
19
|
-
*/
|
|
20
|
-
PayDeals(orderIds: Array<string>): Promise<IPayDealsRes>;
|
|
21
|
-
}
|
package/types/cam/index.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { CloudBaseContext } from '../context';
|
|
2
|
-
import { IServiceVersion, IRoleListRes, ICreateRoleRes, IResponseInfo, IGetRoleRes } from '../interfaces';
|
|
3
|
-
export declare class CamService {
|
|
4
|
-
static camServiceVersion: IServiceVersion;
|
|
5
|
-
private camService;
|
|
6
|
-
constructor(context: CloudBaseContext);
|
|
7
|
-
/**
|
|
8
|
-
* 查询账户角色列表
|
|
9
|
-
* @param {number} page
|
|
10
|
-
* @param {number} rp
|
|
11
|
-
* @returns {Promise<IRoleListRes>}
|
|
12
|
-
* @memberof CamService
|
|
13
|
-
*/
|
|
14
|
-
describeRoleList(page: number, rp: number): Promise<IRoleListRes>;
|
|
15
|
-
/**
|
|
16
|
-
* 获取角色详情
|
|
17
|
-
* @param {string} roleName
|
|
18
|
-
* @returns {Promise<IGetRoleRes>}
|
|
19
|
-
* @memberof CamService
|
|
20
|
-
*/
|
|
21
|
-
getRole(roleName: string): Promise<IGetRoleRes>;
|
|
22
|
-
/**
|
|
23
|
-
* 创建角色
|
|
24
|
-
* @param {{
|
|
25
|
-
* RoleName: string
|
|
26
|
-
* PolicyDocument: string
|
|
27
|
-
* Description: string
|
|
28
|
-
* }} param
|
|
29
|
-
* @returns {Promise<ICreateRoleRes>}
|
|
30
|
-
* @memberof CamService
|
|
31
|
-
*/
|
|
32
|
-
createRole(param: {
|
|
33
|
-
RoleName: string;
|
|
34
|
-
PolicyDocument: string;
|
|
35
|
-
Description: string;
|
|
36
|
-
}): Promise<ICreateRoleRes>;
|
|
37
|
-
/**
|
|
38
|
-
* 绑定角色策略
|
|
39
|
-
* @param {{
|
|
40
|
-
* PolicyId: number
|
|
41
|
-
* AttachRoleName: string
|
|
42
|
-
* }} param
|
|
43
|
-
* @returns {Promise<IResponseInfo>}
|
|
44
|
-
* @memberof CamService
|
|
45
|
-
*/
|
|
46
|
-
attachRolePolicy(param: {
|
|
47
|
-
PolicyId: number;
|
|
48
|
-
AttachRoleName: string;
|
|
49
|
-
}): Promise<IResponseInfo>;
|
|
50
|
-
attachRolePolicies(param: {
|
|
51
|
-
RoleId?: number;
|
|
52
|
-
RoleName?: string;
|
|
53
|
-
PolicyId?: number[];
|
|
54
|
-
PolicyName?: string[];
|
|
55
|
-
}): Promise<IResponseInfo>;
|
|
56
|
-
/**
|
|
57
|
-
* 删除角色
|
|
58
|
-
* @param {string} roleName
|
|
59
|
-
* @returns {Promise<IResponseInfo>}
|
|
60
|
-
* @memberof CamService
|
|
61
|
-
*/
|
|
62
|
-
deleteRole(roleName: string): Promise<IResponseInfo>;
|
|
63
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Environment } from '../environment';
|
|
2
|
-
import { IModifyServerFlowOption } from './types';
|
|
3
|
-
export declare class CloudBaseRunService {
|
|
4
|
-
private tcbService;
|
|
5
|
-
private environment;
|
|
6
|
-
constructor(environment: Environment);
|
|
7
|
-
modifyServerFlow(options: IModifyServerFlowOption): Promise<{
|
|
8
|
-
Result: string;
|
|
9
|
-
RequestId: string;
|
|
10
|
-
}>;
|
|
11
|
-
private getEnvInfo;
|
|
12
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface IModifyServerFlowOption {
|
|
2
|
-
serverName: string;
|
|
3
|
-
versionFlowItems?: ICloudBaseRunVersionFlowItem[];
|
|
4
|
-
trafficType?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ICloudBaseRunVersionFlowItem {
|
|
7
|
-
versionName: string;
|
|
8
|
-
flowRatio: number;
|
|
9
|
-
urlParam?: IObjectKV;
|
|
10
|
-
priority?: number;
|
|
11
|
-
isDefaultPriority?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface IObjectKV {
|
|
14
|
-
key: string;
|
|
15
|
-
value: string;
|
|
16
|
-
}
|
|
17
|
-
export interface IClouBaseRunKVPriority {
|
|
18
|
-
key: string;
|
|
19
|
-
value: string;
|
|
20
|
-
priority: number;
|
|
21
|
-
}
|
package/types/common/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Environment } from '../environment';
|
|
2
|
-
interface ICommonApiServiceOption {
|
|
3
|
-
Action: string;
|
|
4
|
-
Param: Record<string, any>;
|
|
5
|
-
}
|
|
6
|
-
export declare class CommonService {
|
|
7
|
-
private commonService;
|
|
8
|
-
private environment;
|
|
9
|
-
constructor(environment: Environment, serviceType: string, serviceVersion: string);
|
|
10
|
-
/**
|
|
11
|
-
* 公共方法调用
|
|
12
|
-
* @param {ICommonApiServiceParam} param
|
|
13
|
-
* @returns {Promise<any>}
|
|
14
|
-
* @memberof CommonService
|
|
15
|
-
*/
|
|
16
|
-
call(options: ICommonApiServiceOption): Promise<any>;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
package/types/constant.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare const ENV_NAME: {
|
|
2
|
-
ENV_SECRETID: string;
|
|
3
|
-
ENV_SECRETKEY: string;
|
|
4
|
-
ENV_SESSIONTOKEN: string;
|
|
5
|
-
ENV_TCB_ENV_ID: string;
|
|
6
|
-
ENV_RUNENV: string;
|
|
7
|
-
ENV_RUNENV_SCF: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const SDK_VERSION = "TCB-NODE-MANAGER/1.0.O";
|
|
10
|
-
export declare const RUN_ENV: {
|
|
11
|
-
SCF: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const ENDPOINT: {
|
|
14
|
-
TCB: string;
|
|
15
|
-
SCF: string;
|
|
16
|
-
COS: string;
|
|
17
|
-
FLEXDB: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const SERVICE_TYPE: {
|
|
20
|
-
TCB: string;
|
|
21
|
-
};
|
|
22
|
-
export declare const ERROR: {
|
|
23
|
-
MISS_SECRET_INFO_IN_ENV: string;
|
|
24
|
-
MISS_SECRET_INFO_IN_ARGS: string;
|
|
25
|
-
CURRENT_ENVIRONMENT_IS_NULL: string;
|
|
26
|
-
ENV_ID_NOT_EXISTS: string;
|
|
27
|
-
};
|
|
28
|
-
export declare const PUBLIC_RSA_KEY = "\n-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0ZLB0ZpWWFsHPnDDw++Nc2wI3\nnl2uyOrIJ5FUfxt4GAmt1Faf5pgMxAnL9exEUrrUDUX8Ri1R0KyfnHQQwCvKt8T8\nbgILIJe9UB8e9dvFqgqH2oA8Vqwi0YqDcvFLFJk2BJbm/0QYtZ563FumW8LEXAgu\nUeHi/0OZN9vQ33jWMQIDAQAB\n-----END PUBLIC KEY-----\n";
|
|
29
|
-
export declare const ROLE_NAME: {
|
|
30
|
-
TCB: string;
|
|
31
|
-
};
|
|
32
|
-
export declare const SCF_STATUS: {
|
|
33
|
-
ACTIVE: string;
|
|
34
|
-
CREATING: string;
|
|
35
|
-
UPDATING: string;
|
|
36
|
-
CREATE_FAILED: string;
|
|
37
|
-
};
|
package/types/context.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare class CloudBaseContext {
|
|
2
|
-
readonly secretId: string;
|
|
3
|
-
readonly secretKey: string;
|
|
4
|
-
readonly token: string;
|
|
5
|
-
readonly proxy: string;
|
|
6
|
-
readonly envId: string;
|
|
7
|
-
readonly region: string;
|
|
8
|
-
readonly envType: string;
|
|
9
|
-
constructor({ secretId, secretKey, token, proxy, region, envType }: {
|
|
10
|
-
secretId?: string;
|
|
11
|
-
secretKey?: string;
|
|
12
|
-
token?: string;
|
|
13
|
-
proxy?: string;
|
|
14
|
-
region?: string;
|
|
15
|
-
envType?: string;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { IServiceVersion, IExistsRes, CreateIndex, DropIndex, IndexInfo, TableInfo, Pager, IResponseInfo, CollectionDispension } from '../interfaces/';
|
|
2
|
-
import { Environment } from '../environment';
|
|
3
|
-
interface IDatabaseConfig {
|
|
4
|
-
Tag: string;
|
|
5
|
-
}
|
|
6
|
-
interface IIndexiesInfo {
|
|
7
|
-
CreateIndexes?: Array<CreateIndex>;
|
|
8
|
-
DropIndexes?: Array<DropIndex>;
|
|
9
|
-
}
|
|
10
|
-
interface ITableInfo extends IResponseInfo {
|
|
11
|
-
Indexes?: Array<IndexInfo>;
|
|
12
|
-
IndexNum?: number;
|
|
13
|
-
}
|
|
14
|
-
interface IMgoQueryInfo {
|
|
15
|
-
MgoLimit?: number;
|
|
16
|
-
MgoOffset?: number;
|
|
17
|
-
}
|
|
18
|
-
interface ICollectionInfo extends IResponseInfo {
|
|
19
|
-
Collections: Array<TableInfo>;
|
|
20
|
-
Pager: Pager;
|
|
21
|
-
}
|
|
22
|
-
interface ICollectionExistInfo extends IResponseInfo {
|
|
23
|
-
IsCreated: boolean;
|
|
24
|
-
ExistsResult: IExistsRes;
|
|
25
|
-
}
|
|
26
|
-
interface IDistributionInfo extends IResponseInfo {
|
|
27
|
-
Collections: CollectionDispension;
|
|
28
|
-
Count: number;
|
|
29
|
-
Total: number;
|
|
30
|
-
}
|
|
31
|
-
interface IDatabaseMigrateQueryInfo extends IResponseInfo {
|
|
32
|
-
Status: string;
|
|
33
|
-
RecordSuccess: number;
|
|
34
|
-
RecordFail: number;
|
|
35
|
-
ErrorMsg: string;
|
|
36
|
-
FileUrl: string;
|
|
37
|
-
}
|
|
38
|
-
interface IDatabaseImportAndExportInfo extends IResponseInfo {
|
|
39
|
-
JobId: number;
|
|
40
|
-
}
|
|
41
|
-
export declare class DatabaseService {
|
|
42
|
-
static tcbServiceVersion: IServiceVersion;
|
|
43
|
-
static flexdbServiceVersion: IServiceVersion;
|
|
44
|
-
private environment;
|
|
45
|
-
private envId;
|
|
46
|
-
private dbOpService;
|
|
47
|
-
private collOpService;
|
|
48
|
-
private DEFAULT_MGO_OFFSET;
|
|
49
|
-
private DEFAULT_MGO_LIMIT;
|
|
50
|
-
constructor(environment: Environment);
|
|
51
|
-
getCurrEnvironment(): Environment;
|
|
52
|
-
getDatabaseConfig(): IDatabaseConfig;
|
|
53
|
-
checkCollectionExists(collectionName: string): Promise<IExistsRes>;
|
|
54
|
-
createCollection(collectionName: string): Promise<any>;
|
|
55
|
-
deleteCollection(collectionName: string): Promise<any>;
|
|
56
|
-
updateCollection(collectionName: string, indexiesInfo: IIndexiesInfo): Promise<any>;
|
|
57
|
-
describeCollection(collectionName: string): Promise<ITableInfo>;
|
|
58
|
-
listCollections(options?: IMgoQueryInfo): Promise<ICollectionInfo>;
|
|
59
|
-
createCollectionIfNotExists(collectionName: string): Promise<ICollectionExistInfo>;
|
|
60
|
-
checkIndexExists(collectionName: string, indexName: string): Promise<IExistsRes>;
|
|
61
|
-
distribution(): Promise<IDistributionInfo>;
|
|
62
|
-
migrateStatus(jobId: number): Promise<IDatabaseMigrateQueryInfo>;
|
|
63
|
-
import(collectionName: string, file: any, options: any): Promise<IDatabaseImportAndExportInfo>;
|
|
64
|
-
export(collectionName: string, file: any, options: any): Promise<IDatabaseImportAndExportInfo>;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
package/types/debug.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|