@cloudbase/manager-node 5.5.2-beta.0 → 5.5.3
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/jest.config.js +1 -1
- package/lib/database/index.js +25 -13
- package/lib/environment.js +0 -5
- package/lib/index.js +0 -3
- package/lib/user/index.js +3 -1
- package/package.json +1 -1
- package/types/database/index.d.ts +2 -1
- package/types/environment.d.ts +0 -3
- package/types/index.d.ts +0 -2
- package/types/user/types.d.ts +1 -0
- package/lib/talosSandbox/index.js +0 -1121
- package/lib/talosSandbox/type.js +0 -3
- package/types/talosSandbox/index.d.ts +0 -182
- package/types/talosSandbox/type.d.ts +0 -689
package/jest.config.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = {
|
|
|
12
12
|
testEnvironment: 'node',
|
|
13
13
|
testPathIgnorePatterns: [
|
|
14
14
|
// PG 集成测试 / smoke 测试需要 PostgreSQL 环境,流水线默认跳过
|
|
15
|
-
'
|
|
15
|
+
'pg-storage-integration\\.test\\.ts$'
|
|
16
16
|
],
|
|
17
17
|
// https://github.com/facebook/jest/issues/5164
|
|
18
18
|
globalSetup: './test/global-setup-hook.ts',
|
package/lib/database/index.js
CHANGED
|
@@ -46,6 +46,14 @@ class DatabaseService {
|
|
|
46
46
|
Tag: Databases[0].InstanceId
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
+
getMongoConnector() {
|
|
50
|
+
const currEnv = this.environment;
|
|
51
|
+
const { Databases } = currEnv.lazyEnvironmentConfig;
|
|
52
|
+
return {
|
|
53
|
+
DatabaseName: Databases[0].InstanceId,
|
|
54
|
+
InstanceId: 'flexdb'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
49
57
|
async checkCollectionExists(collectionName) {
|
|
50
58
|
try {
|
|
51
59
|
const result = await this.describeCollection(collectionName);
|
|
@@ -63,10 +71,10 @@ class DatabaseService {
|
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
async createCollection(collectionName) {
|
|
66
|
-
|
|
74
|
+
const MongoConnector = this.getMongoConnector();
|
|
67
75
|
const res = await this.dbOpService.request('CreateTable', {
|
|
68
76
|
EnvId: this.envId,
|
|
69
|
-
|
|
77
|
+
MongoConnector,
|
|
70
78
|
TableName: collectionName
|
|
71
79
|
});
|
|
72
80
|
return res;
|
|
@@ -75,10 +83,10 @@ class DatabaseService {
|
|
|
75
83
|
// 先检查当前集合是否存在
|
|
76
84
|
const existRes = await this.checkCollectionExists(collectionName);
|
|
77
85
|
if (existRes.Exists) {
|
|
78
|
-
|
|
86
|
+
const MongoConnector = this.getMongoConnector();
|
|
79
87
|
const res = await this.dbOpService.request('DeleteTable', {
|
|
80
88
|
EnvId: this.envId,
|
|
81
|
-
|
|
89
|
+
MongoConnector,
|
|
82
90
|
TableName: collectionName
|
|
83
91
|
});
|
|
84
92
|
return res;
|
|
@@ -88,15 +96,15 @@ class DatabaseService {
|
|
|
88
96
|
}
|
|
89
97
|
}
|
|
90
98
|
async updateCollection(collectionName, indexiesInfo) {
|
|
91
|
-
|
|
92
|
-
const res = await this.dbOpService.request('UpdateTable', Object.assign({ EnvId: this.envId,
|
|
99
|
+
const MongoConnector = this.getMongoConnector();
|
|
100
|
+
const res = await this.dbOpService.request('UpdateTable', Object.assign({ EnvId: this.envId, MongoConnector, TableName: collectionName }, indexiesInfo));
|
|
93
101
|
return res;
|
|
94
102
|
}
|
|
95
103
|
async describeCollection(collectionName) {
|
|
96
|
-
|
|
104
|
+
const MongoConnector = this.getMongoConnector();
|
|
97
105
|
return this.dbOpService.request('DescribeTable', {
|
|
98
106
|
EnvId: this.envId,
|
|
99
|
-
|
|
107
|
+
MongoConnector,
|
|
100
108
|
TableName: collectionName
|
|
101
109
|
});
|
|
102
110
|
}
|
|
@@ -105,14 +113,14 @@ class DatabaseService {
|
|
|
105
113
|
MgoLimit: this.DEFAULT_MGO_LIMIT,
|
|
106
114
|
MgoOffset: this.DEFAULT_MGO_OFFSET
|
|
107
115
|
}) {
|
|
108
|
-
|
|
116
|
+
const MongoConnector = this.getMongoConnector();
|
|
109
117
|
if (options.MgoLimit === undefined) {
|
|
110
118
|
options.MgoLimit = this.DEFAULT_MGO_LIMIT;
|
|
111
119
|
}
|
|
112
120
|
if (options.MgoOffset === undefined) {
|
|
113
121
|
options.MgoOffset = this.DEFAULT_MGO_OFFSET;
|
|
114
122
|
}
|
|
115
|
-
const res = await this.dbOpService.request('ListTables', Object.assign({ EnvId: this.envId,
|
|
123
|
+
const res = await this.dbOpService.request('ListTables', Object.assign({ EnvId: this.envId, MongoConnector }, options));
|
|
116
124
|
if (res.Tables === null) {
|
|
117
125
|
// 无集合
|
|
118
126
|
res.Collections = [];
|
|
@@ -277,12 +285,16 @@ class DatabaseService {
|
|
|
277
285
|
}
|
|
278
286
|
/**
|
|
279
287
|
* 执行文档型数据库命令
|
|
280
|
-
* @param options 命令参数(命令列表、可选的
|
|
288
|
+
* @param options 命令参数(命令列表、可选的 EnvId/MongoConnector)
|
|
281
289
|
* @returns 执行结果,Data 为 JSON 字符串数组
|
|
282
290
|
*/
|
|
283
291
|
async runCommands(options) {
|
|
284
|
-
|
|
285
|
-
return this.dbOpService.request('RunCommands',
|
|
292
|
+
const MongoConnector = options.MongoConnector || this.getMongoConnector();
|
|
293
|
+
return this.dbOpService.request('RunCommands', {
|
|
294
|
+
MgoCommands: options.MgoCommands,
|
|
295
|
+
MongoConnector,
|
|
296
|
+
EnvId: options.EnvId || this.envId,
|
|
297
|
+
});
|
|
286
298
|
}
|
|
287
299
|
/**
|
|
288
300
|
* 在 PostgreSQL 数据库上执行 SQL 语句
|
package/lib/environment.js
CHANGED
|
@@ -22,7 +22,6 @@ const cloudApp_1 = require("./cloudApp");
|
|
|
22
22
|
const permission_1 = require("./permission");
|
|
23
23
|
const sandbox_1 = require("./sandbox");
|
|
24
24
|
const aiModel_1 = require("./aiModel");
|
|
25
|
-
const talosSandbox_1 = require("./talosSandbox");
|
|
26
25
|
class Environment {
|
|
27
26
|
constructor(context, envId) {
|
|
28
27
|
this.inited = false;
|
|
@@ -48,7 +47,6 @@ class Environment {
|
|
|
48
47
|
this.cloudAppService = new cloudApp_1.CloudAppService(this);
|
|
49
48
|
this.sandboxService = new sandbox_1.SandboxService(this);
|
|
50
49
|
this.aiModelService = new aiModel_1.AiModelService(this);
|
|
51
|
-
this.talosSandboxService = new talosSandbox_1.TalosSandboxService(this);
|
|
52
50
|
}
|
|
53
51
|
async lazyInit() {
|
|
54
52
|
if (!this.inited) {
|
|
@@ -123,9 +121,6 @@ class Environment {
|
|
|
123
121
|
getAiModelService() {
|
|
124
122
|
return this.aiModelService;
|
|
125
123
|
}
|
|
126
|
-
getTalosSandboxService() {
|
|
127
|
-
return this.talosSandboxService;
|
|
128
|
-
}
|
|
129
124
|
getCommonService(serviceType = 'tcb', serviceVersion) {
|
|
130
125
|
return new common_1.CommonService(this, serviceType, serviceVersion);
|
|
131
126
|
}
|
package/lib/index.js
CHANGED
|
@@ -122,9 +122,6 @@ class CloudBase {
|
|
|
122
122
|
get aiModel() {
|
|
123
123
|
return this.currentEnvironment().getAiModelService();
|
|
124
124
|
}
|
|
125
|
-
get talosSandbox() {
|
|
126
|
-
return this.currentEnvironment().getTalosSandboxService();
|
|
127
|
-
}
|
|
128
125
|
get docs() {
|
|
129
126
|
if (!this.docsService) {
|
|
130
127
|
this.docsService = new docs_1.DocsService();
|
package/lib/user/index.js
CHANGED
|
@@ -188,7 +188,7 @@ class UserService {
|
|
|
188
188
|
}
|
|
189
189
|
async describeUserList(options = {}) {
|
|
190
190
|
const { EnvId } = this.environment.lazyEnvironmentConfig;
|
|
191
|
-
const { pageNo = 1, pageSize = 20, name, nickName, phone, email } = options;
|
|
191
|
+
const { pageNo = 1, pageSize = 20, name, nickName, phone, email, uidList } = options;
|
|
192
192
|
if (!Number.isInteger(pageNo) || pageNo < 1) {
|
|
193
193
|
throw new Error('Invalid pageNo');
|
|
194
194
|
}
|
|
@@ -208,6 +208,8 @@ class UserService {
|
|
|
208
208
|
reqData.Phone = phone;
|
|
209
209
|
if (this.isValidStr(email))
|
|
210
210
|
reqData.Email = email;
|
|
211
|
+
if (Array.isArray(uidList) && uidList.length > 0)
|
|
212
|
+
reqData.UidList = uidList;
|
|
211
213
|
return this.tcbService.request('DescribeUserList', reqData);
|
|
212
214
|
}
|
|
213
215
|
async modifyUser(options) {
|
package/package.json
CHANGED
|
@@ -155,6 +155,7 @@ export declare class DatabaseService {
|
|
|
155
155
|
constructor(environment: Environment);
|
|
156
156
|
getCurrEnvironment(): Environment;
|
|
157
157
|
getDatabaseConfig(): IDatabaseConfig;
|
|
158
|
+
getMongoConnector(): IMongoConnector;
|
|
158
159
|
checkCollectionExists(collectionName: string): Promise<IExistsRes>;
|
|
159
160
|
createCollection(collectionName: string): Promise<any>;
|
|
160
161
|
deleteCollection(collectionName: string): Promise<any>;
|
|
@@ -197,7 +198,7 @@ export declare class DatabaseService {
|
|
|
197
198
|
restoreTables(time: string, modifyTableNamesInfo: IModifyTableNamesInfo[], instanceId?: string): Promise<IRestoreTCBTablesResult>;
|
|
198
199
|
/**
|
|
199
200
|
* 执行文档型数据库命令
|
|
200
|
-
* @param options 命令参数(命令列表、可选的
|
|
201
|
+
* @param options 命令参数(命令列表、可选的 EnvId/MongoConnector)
|
|
201
202
|
* @returns 执行结果,Data 为 JSON 字符串数组
|
|
202
203
|
*/
|
|
203
204
|
runCommands(options: IRunCommandsOptions): Promise<IRunCommandsResult>;
|
package/types/environment.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ import { EnvInfo } from './interfaces';
|
|
|
18
18
|
import { PermissionService } from './permission';
|
|
19
19
|
import { SandboxService } from './sandbox';
|
|
20
20
|
import { AiModelService } from './aiModel';
|
|
21
|
-
import { TalosSandboxService } from './talosSandbox';
|
|
22
21
|
export declare class Environment {
|
|
23
22
|
inited: boolean;
|
|
24
23
|
cloudBaseContext: CloudBaseContext;
|
|
@@ -42,7 +41,6 @@ export declare class Environment {
|
|
|
42
41
|
private cloudAppService;
|
|
43
42
|
private sandboxService;
|
|
44
43
|
private aiModelService;
|
|
45
|
-
private talosSandboxService;
|
|
46
44
|
constructor(context: CloudBaseContext, envId: string);
|
|
47
45
|
lazyInit(): Promise<any>;
|
|
48
46
|
getEnvId(): string;
|
|
@@ -64,7 +62,6 @@ export declare class Environment {
|
|
|
64
62
|
getPermissionService(): PermissionService;
|
|
65
63
|
getSandboxService(): SandboxService;
|
|
66
64
|
getAiModelService(): AiModelService;
|
|
67
|
-
getTalosSandboxService(): TalosSandboxService;
|
|
68
65
|
getCommonService(serviceType: string, serviceVersion: any): CommonService;
|
|
69
66
|
getServicesEnvInfo(): Promise<any>;
|
|
70
67
|
getAuthConfig(): {
|
package/types/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { PermissionService } from './permission';
|
|
|
19
19
|
import { SandboxService } from './sandbox';
|
|
20
20
|
import { CloudAppService } from './cloudApp';
|
|
21
21
|
import { AiModelService } from './aiModel';
|
|
22
|
-
import { TalosSandboxService } from './talosSandbox';
|
|
23
22
|
interface CloudBaseConfig {
|
|
24
23
|
secretId?: string;
|
|
25
24
|
secretKey?: string;
|
|
@@ -85,7 +84,6 @@ declare class CloudBase {
|
|
|
85
84
|
get permission(): PermissionService;
|
|
86
85
|
get sandbox(): SandboxService;
|
|
87
86
|
get aiModel(): AiModelService;
|
|
88
|
-
get talosSandbox(): TalosSandboxService;
|
|
89
87
|
get docs(): DocsService;
|
|
90
88
|
getEnvironmentManager(): EnvironmentManager;
|
|
91
89
|
getManagerConfig(): CloudBaseConfig;
|