@cloudbase/manager-node 5.3.0 → 5.3.1
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/env/index.js +46 -19
- package/lib/log/index.js +5 -9
- package/package.json +1 -1
- package/types/env/index.d.ts +11 -1
- package/types/interfaces/tcb.interface.d.ts +64 -0
- package/types/log/index.d.ts +2 -2
- package/.claude/settings.local.json +0 -9
- package/cloudbase-manager-node/.claude/settings.local.json +0 -9
- package/cloudbase-manager-node/.editorconfig +0 -8
- package/cloudbase-manager-node/.eslintignore +0 -3
- package/cloudbase-manager-node/.eslintrc.js +0 -27
- package/cloudbase-manager-node/.prettierrc.js +0 -31
- package/cloudbase-manager-node/CHANGELOG.md +0 -109
- package/cloudbase-manager-node/LICENSE +0 -6
- package/cloudbase-manager-node/README.md +0 -46
- package/cloudbase-manager-node/jest.config.js +0 -18
- package/cloudbase-manager-node/package.json +0 -70
- package/cloudbase-manager-node/scripts/link.js +0 -98
- package/cloudbase-manager-node/tsconfig.json +0 -19
- package/cloudbase-manager-node/tsconfig.test.json +0 -14
package/lib/env/index.js
CHANGED
|
@@ -136,18 +136,33 @@ class EnvService {
|
|
|
136
136
|
* @returns {Promise<IEnvInfoRes>}
|
|
137
137
|
*/
|
|
138
138
|
async getEnvInfo() {
|
|
139
|
-
|
|
139
|
+
var _a;
|
|
140
|
+
// 使用 DescribeEnvInfo 进行单环境查询
|
|
140
141
|
const params = {
|
|
141
142
|
EnvId: this.envId
|
|
142
143
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const
|
|
144
|
+
const response = await this.describeEnvInfo(params);
|
|
145
|
+
const envBaseInfo = (_a = response === null || response === void 0 ? void 0 : response.EnvInfo) === null || _a === void 0 ? void 0 : _a.EnvBaseInfo;
|
|
146
|
+
// 成功获取环境信息,将 EnvBaseInfo 映射到 EnvInfo 类型
|
|
147
|
+
const envInfo = {
|
|
148
|
+
EnvId: envBaseInfo.EnvId,
|
|
149
|
+
Alias: envBaseInfo.Alias,
|
|
150
|
+
Status: envBaseInfo.Status,
|
|
151
|
+
Databases: envBaseInfo.Databases,
|
|
152
|
+
Storages: envBaseInfo.Storages,
|
|
153
|
+
Functions: envBaseInfo.Functions,
|
|
154
|
+
PackageId: envBaseInfo.PackageId || '',
|
|
155
|
+
PackageName: envBaseInfo.PackageName || '',
|
|
156
|
+
LogServices: envBaseInfo.LogServices || [],
|
|
157
|
+
CustomLogServices: envBaseInfo.CustomLogServices || [],
|
|
158
|
+
Region: envBaseInfo.Region || '',
|
|
159
|
+
Source: envBaseInfo.Source,
|
|
160
|
+
CreateTime: envBaseInfo.CreateTime,
|
|
161
|
+
UpdateTime: envBaseInfo.UpdateTime
|
|
162
|
+
};
|
|
147
163
|
return {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
RequestId
|
|
164
|
+
EnvInfo: envInfo,
|
|
165
|
+
RequestId: response.RequestId || ''
|
|
151
166
|
};
|
|
152
167
|
}
|
|
153
168
|
/**
|
|
@@ -156,6 +171,18 @@ class EnvService {
|
|
|
156
171
|
async describeEnvs(params) {
|
|
157
172
|
return this.cloudService.request('DescribeEnvs', params);
|
|
158
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* 查询单个环境信息
|
|
176
|
+
*
|
|
177
|
+
* 用于单个环境查询时,规避 DescribeEnvs 的 backend issues。
|
|
178
|
+
* 当 EnvId 参数存在时,应优先使用本方法而非 describeEnvs。
|
|
179
|
+
*
|
|
180
|
+
* @param params 查询参数,必须包含 EnvId
|
|
181
|
+
* @returns 环境信息响应
|
|
182
|
+
*/
|
|
183
|
+
async describeEnvInfo(params) {
|
|
184
|
+
return this.cloudService.request('DescribeEnvInfo', params);
|
|
185
|
+
}
|
|
159
186
|
/**
|
|
160
187
|
* 修改环境名称
|
|
161
188
|
* @param {string} alias 环境名称
|
|
@@ -476,28 +503,28 @@ class EnvService {
|
|
|
476
503
|
async calculatePackageRenewPrice(params) {
|
|
477
504
|
var _a, _b, _c, _d, _e, _f;
|
|
478
505
|
const { envId, period = 1, currency = 'CNY' } = params;
|
|
479
|
-
const [packageRes,
|
|
506
|
+
const [packageRes, envInfoRes, billingRes] = await Promise.all([
|
|
480
507
|
this.describeBaasPackageList({
|
|
481
508
|
Source: 'qcloud',
|
|
482
509
|
PackageTypeList: ['default', 'vip', 'basic', 'trial']
|
|
483
510
|
}),
|
|
484
|
-
this.
|
|
511
|
+
this.describeEnvInfo({
|
|
485
512
|
EnvId: envId
|
|
486
513
|
}),
|
|
487
514
|
this.describeBillingInfo({
|
|
488
515
|
EnvId: envId
|
|
489
516
|
})
|
|
490
517
|
]);
|
|
491
|
-
const
|
|
518
|
+
const envBaseInfo = (_a = envInfoRes === null || envInfoRes === void 0 ? void 0 : envInfoRes.EnvInfo) === null || _a === void 0 ? void 0 : _a.EnvBaseInfo;
|
|
492
519
|
const billingInfo = (_b = billingRes.EnvBillingInfoList) === null || _b === void 0 ? void 0 : _b[0];
|
|
493
|
-
if (!
|
|
520
|
+
if (!(envBaseInfo === null || envBaseInfo === void 0 ? void 0 : envBaseInfo.EnvId) || !billingInfo) {
|
|
494
521
|
throw new error_1.CloudBaseError(`Invalid env id: ${envId}`);
|
|
495
522
|
}
|
|
496
|
-
const packageInfo = (_c = packageRes.PackageList) === null || _c === void 0 ? void 0 : _c.find(item => item.PackageName ===
|
|
523
|
+
const packageInfo = (_c = packageRes.PackageList) === null || _c === void 0 ? void 0 : _c.find(item => item.PackageName === envBaseInfo.PackageId);
|
|
497
524
|
if (!packageInfo) {
|
|
498
525
|
throw new error_1.CloudBaseError(`Invalid env id: ${envId}`);
|
|
499
526
|
}
|
|
500
|
-
const region =
|
|
527
|
+
const region = envBaseInfo.Region;
|
|
501
528
|
const extPackageData = ((_d = billingInfo.ExtPackageCode) === null || _d === void 0 ? void 0 : _d.reduce((acc, { Code, Num }) => {
|
|
502
529
|
acc[Code] = Num;
|
|
503
530
|
return acc;
|
|
@@ -530,21 +557,21 @@ class EnvService {
|
|
|
530
557
|
async calculatePackageModifyPrice(params) {
|
|
531
558
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
532
559
|
const { newPackageId, envId, currency = 'CNY' } = params;
|
|
533
|
-
const [packageRes,
|
|
560
|
+
const [packageRes, envInfoRes, billingRes] = await Promise.all([
|
|
534
561
|
this.describeBaasPackageList({
|
|
535
562
|
Source: 'qcloud',
|
|
536
563
|
PackageTypeList: ['default', 'vip', 'basic', 'trial']
|
|
537
564
|
}),
|
|
538
|
-
this.
|
|
565
|
+
this.describeEnvInfo({
|
|
539
566
|
EnvId: envId
|
|
540
567
|
}),
|
|
541
568
|
this.describeBillingInfo({
|
|
542
569
|
EnvId: envId
|
|
543
570
|
})
|
|
544
571
|
]);
|
|
545
|
-
const
|
|
572
|
+
const envBaseInfo = (_a = envInfoRes === null || envInfoRes === void 0 ? void 0 : envInfoRes.EnvInfo) === null || _a === void 0 ? void 0 : _a.EnvBaseInfo;
|
|
546
573
|
const billingInfo = (_b = billingRes.EnvBillingInfoList) === null || _b === void 0 ? void 0 : _b[0];
|
|
547
|
-
if (!
|
|
574
|
+
if (!(envBaseInfo === null || envBaseInfo === void 0 ? void 0 : envBaseInfo.EnvId) || !billingInfo || !billingInfo.PackageId) {
|
|
548
575
|
throw new error_1.CloudBaseError(`Invalid env id: ${envId}`);
|
|
549
576
|
}
|
|
550
577
|
const oldPackageInfo = (_c = packageRes.PackageList) === null || _c === void 0 ? void 0 : _c.find(item => item.PackageName === billingInfo.PackageId);
|
|
@@ -555,7 +582,7 @@ class EnvService {
|
|
|
555
582
|
if (!newPackageInfo) {
|
|
556
583
|
throw new error_1.CloudBaseError(`Invalid package id: ${newPackageId}`);
|
|
557
584
|
}
|
|
558
|
-
const region =
|
|
585
|
+
const region = envBaseInfo.Region;
|
|
559
586
|
const newBillTags = this.parseBillTags(newPackageInfo.BillTags);
|
|
560
587
|
const oldBillTags = this.parseBillTags(oldPackageInfo.BillTags);
|
|
561
588
|
let userNumber = 0;
|
package/lib/log/index.js
CHANGED
|
@@ -19,7 +19,7 @@ exports.isLogServiceEnabled = isLogServiceEnabled;
|
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
21
21
|
/**
|
|
22
|
-
* 纯函数:根据
|
|
22
|
+
* 纯函数:根据 DescribeEnvInfo 返回的 LogServices 列表判断日志服务是否已开通。
|
|
23
23
|
* 已开通条件:至少一个条目有有效的 TopicId。
|
|
24
24
|
*/
|
|
25
25
|
function isLogServiceEnabled(logServices) {
|
|
@@ -36,21 +36,17 @@ class LogService {
|
|
|
36
36
|
/**
|
|
37
37
|
* 检查当前环境的日志服务是否已开通
|
|
38
38
|
*
|
|
39
|
-
* 通过
|
|
39
|
+
* 通过 DescribeEnvInfo 接口获取环境信息,判断 LogServices 字段中是否包含有效的
|
|
40
40
|
* 日志主题(TopicId 不为空)。
|
|
41
41
|
*
|
|
42
42
|
* @returns true 表示已开通,false 表示未开通或开通中
|
|
43
43
|
*/
|
|
44
44
|
async checkLogServiceEnabled() {
|
|
45
|
-
var _a;
|
|
46
|
-
const res = await this.cloudService.request('
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const res = await this.cloudService.request('DescribeEnvInfo', {
|
|
47
47
|
EnvId: this.envId
|
|
48
48
|
});
|
|
49
|
-
const
|
|
50
|
-
if (!envInfo) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
const logServices = envInfo.LogServices;
|
|
49
|
+
const logServices = (_b = (_a = res === null || res === void 0 ? void 0 : res.EnvInfo) === null || _a === void 0 ? void 0 : _a.EnvBaseInfo) === null || _b === void 0 ? void 0 : _b.LogServices;
|
|
54
50
|
if (!logServices || logServices.length === 0) {
|
|
55
51
|
return false;
|
|
56
52
|
}
|
package/package.json
CHANGED
package/types/env/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
2
|
import { IResponseInfo, AuthDomain, EnvInfo, LoginConfigItem, ICheckTcbServiceRes, ICreatePostpayRes, EnvBillingInfoItem, PriceResult } from '../interfaces';
|
|
3
3
|
import { CalculatePackageCreatePriceParams, CalculatePackageRenewPriceParams, CalculatePackageModifyPriceParams, DescribeHttpServiceRouteParams, DescribeHttpServiceRouteRes, CreateHttpServiceRouteParams, CreateHttpServiceRouteRes, ModifyHttpServiceRouteParams, ModifyHttpServiceRouteRes, DeleteHttpServiceRouteParams, DeleteHttpServiceRouteRes, BindCustomDomainParams, BindCustomDomainRes, DeleteCustomDomainParams, DeleteCustomDomainRes } from './type';
|
|
4
|
-
import { CreateBillingDealParams, CreateEnvParams, BaasPackageInfo, DescribeBaasPackageListParams, ModifyEnvPlanParams, RenewEnvParams, DestroyEnvParams, DescribeEnvsParams, DescribeEnvAccountCircleParams, DescribeEnvAccountCircleRes, DescribeCreditsUsageDetailParams, EnvPkgCreditsUsage } from '../interfaces/tcb.interface';
|
|
4
|
+
import { CreateBillingDealParams, CreateEnvParams, BaasPackageInfo, DescribeBaasPackageListParams, ModifyEnvPlanParams, RenewEnvParams, DestroyEnvParams, DescribeEnvsParams, DescribeEnvInfoParams, DescribeEnvInfoResponse, DescribeEnvAccountCircleParams, DescribeEnvAccountCircleRes, DescribeCreditsUsageDetailParams, EnvPkgCreditsUsage } from '../interfaces/tcb.interface';
|
|
5
5
|
type SOURCE = 'miniapp' | 'qcloud';
|
|
6
6
|
interface IDeleteDomainRes {
|
|
7
7
|
RequestId: string;
|
|
@@ -629,6 +629,16 @@ export declare class EnvService {
|
|
|
629
629
|
EnvList: EnvInfo[];
|
|
630
630
|
Total: number;
|
|
631
631
|
}>;
|
|
632
|
+
/**
|
|
633
|
+
* 查询单个环境信息
|
|
634
|
+
*
|
|
635
|
+
* 用于单个环境查询时,规避 DescribeEnvs 的 backend issues。
|
|
636
|
+
* 当 EnvId 参数存在时,应优先使用本方法而非 describeEnvs。
|
|
637
|
+
*
|
|
638
|
+
* @param params 查询参数,必须包含 EnvId
|
|
639
|
+
* @returns 环境信息响应
|
|
640
|
+
*/
|
|
641
|
+
describeEnvInfo(params: DescribeEnvInfoParams): Promise<DescribeEnvInfoResponse>;
|
|
632
642
|
/**
|
|
633
643
|
* 修改环境名称
|
|
634
644
|
* @param {string} alias 环境名称
|
|
@@ -460,3 +460,67 @@ export interface EnvPkgCreditsUsage {
|
|
|
460
460
|
ReportValue?: number;
|
|
461
461
|
OriginCredits?: number;
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* DescribeEnvInfo API - 查询单个环境信息
|
|
465
|
+
* 替代 DescribeEnvs 用于单环境查询,用于规避 backend issues when filtering by EnvId
|
|
466
|
+
*/
|
|
467
|
+
export interface DescribeEnvInfoParams {
|
|
468
|
+
EnvId: string;
|
|
469
|
+
}
|
|
470
|
+
export interface EnvBaseInfo {
|
|
471
|
+
EnvId?: string;
|
|
472
|
+
Alias?: string;
|
|
473
|
+
Status?: string;
|
|
474
|
+
EnvType?: string;
|
|
475
|
+
Region?: string;
|
|
476
|
+
PackageId?: string;
|
|
477
|
+
PackageName?: string;
|
|
478
|
+
Databases?: DatabasesInfo[];
|
|
479
|
+
Storages?: StorageInfo[];
|
|
480
|
+
Functions?: FunctionInfo[];
|
|
481
|
+
PayMode?: string;
|
|
482
|
+
Source?: string;
|
|
483
|
+
Tags?: Array<{
|
|
484
|
+
Key: string;
|
|
485
|
+
Value: string;
|
|
486
|
+
}>;
|
|
487
|
+
CreateTime?: string;
|
|
488
|
+
UpdateTime?: string;
|
|
489
|
+
EnvPreferences?: Record<string, any>;
|
|
490
|
+
IsAutoDegrade?: boolean;
|
|
491
|
+
IsDauPackage?: boolean;
|
|
492
|
+
PostgreSQL?: Record<string, any>;
|
|
493
|
+
LogServices?: Array<{
|
|
494
|
+
LogsetId?: string;
|
|
495
|
+
TopicId?: string;
|
|
496
|
+
TopicName?: string;
|
|
497
|
+
Region?: string;
|
|
498
|
+
}> | null;
|
|
499
|
+
CustomLogServices?: Array<{
|
|
500
|
+
CreateTime: string;
|
|
501
|
+
ClsLogsetId: string;
|
|
502
|
+
ClsTopicId: string;
|
|
503
|
+
ClsRegion: string;
|
|
504
|
+
}> | null;
|
|
505
|
+
}
|
|
506
|
+
export interface BillingInfo {
|
|
507
|
+
StartTime?: string;
|
|
508
|
+
EndTime?: string;
|
|
509
|
+
Status?: string;
|
|
510
|
+
}
|
|
511
|
+
export interface UserInfo {
|
|
512
|
+
AppId?: string;
|
|
513
|
+
Uin?: string;
|
|
514
|
+
WxAppId?: string;
|
|
515
|
+
}
|
|
516
|
+
export interface DescribeEnvInfoResponse extends IResponseInfo {
|
|
517
|
+
EnvInfo?: {
|
|
518
|
+
EnvBaseInfo?: EnvBaseInfo;
|
|
519
|
+
BillingInfo?: BillingInfo;
|
|
520
|
+
UserInfo?: UserInfo;
|
|
521
|
+
Eid?: number;
|
|
522
|
+
CircleStartTime?: string;
|
|
523
|
+
CircleEndTime?: string;
|
|
524
|
+
SiteFlag?: number;
|
|
525
|
+
};
|
|
526
|
+
}
|
package/types/log/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface ILogServiceEntry {
|
|
|
11
11
|
Region?: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* 纯函数:根据
|
|
14
|
+
* 纯函数:根据 DescribeEnvInfo 返回的 LogServices 列表判断日志服务是否已开通。
|
|
15
15
|
* 已开通条件:至少一个条目有有效的 TopicId。
|
|
16
16
|
*/
|
|
17
17
|
export declare function isLogServiceEnabled(logServices?: ILogServiceEntry[]): boolean;
|
|
@@ -23,7 +23,7 @@ export declare class LogService {
|
|
|
23
23
|
/**
|
|
24
24
|
* 检查当前环境的日志服务是否已开通
|
|
25
25
|
*
|
|
26
|
-
* 通过
|
|
26
|
+
* 通过 DescribeEnvInfo 接口获取环境信息,判断 LogServices 字段中是否包含有效的
|
|
27
27
|
* 日志主题(TopicId 不为空)。
|
|
28
28
|
*
|
|
29
29
|
* @returns true 表示已开通,false 表示未开通或开通中
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
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] 支持创建云函数自动安装依赖
|
|
@@ -1,6 +0,0 @@
|
|
|
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.
|
|
@@ -1,46 +0,0 @@
|
|
|
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)查看详细的文档。
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cloudbase/manager-node",
|
|
3
|
-
"version": "5.3.0",
|
|
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
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
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()
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|