@cloudbase/manager-node 5.6.4 → 5.6.6
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 +23 -0
- package/lib/access/index.js +5 -0
- package/lib/agent/index.js +16 -20
- package/lib/cloudApp/index.js +10 -1
- package/lib/database/index.js +192 -0
- package/lib/database/type.js +2 -0
- package/lib/function/index.js +27 -92
- package/lib/index.js +4 -0
- package/package.json +1 -1
- package/types/access/index.d.ts +5 -0
- package/types/agent/index.d.ts +6 -4
- package/types/agent/type.d.ts +8 -6
- package/types/cloudApp/types.d.ts +17 -0
- package/types/database/index.d.ts +43 -0
- package/types/database/type.d.ts +212 -0
- package/types/function/index.d.ts +23 -20
- package/types/index.d.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## @cloudbase/manager-node v5.6.5 版本发布 🚀(2026-07-28)
|
|
2
|
+
|
|
3
|
+
- 新增 PostgreSQL 数据库迁移相关 API 与类型定义
|
|
4
|
+
- 新增 统一 SCF/TCBR Agent 日志查询走 CLS searchClsLog
|
|
5
|
+
- 新增 code 入参并完善相关文档与测试
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## @cloudbase/manager-node v5.6.4 版本发布 🚀(2026-07-23)
|
|
10
|
+
|
|
11
|
+
- 新增 code 入参并完善相关文档与测试
|
|
12
|
+
- 重构 更新默认 Runtime 为 Nodejs20.19
|
|
13
|
+
- 修复 移除创建云函数时 Timeout 默认值,改为透传 SCF 默认值
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## @cloudbase/manager-node v5.6.3 版本发布 🚀(2026-07-16)
|
|
18
|
+
|
|
19
|
+
- 重构 更新默认 Runtime 为 Nodejs20.19
|
|
20
|
+
- 修复 移除创建云函数时 Timeout 默认值,改为透传 SCF 默认值
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
1
24
|
## @cloudbase/manager-node v5.6.2 版本发布 🚀(2026-07-09)
|
|
2
25
|
|
|
3
26
|
- 新增 支持镜像部署模式
|
package/lib/access/index.js
CHANGED
|
@@ -8,6 +8,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AccessService = void 0;
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
|
+
/**
|
|
12
|
+
* HTTP Service(CloudBaseGW)访问服务。
|
|
13
|
+
* 注意:HTTP Service 模块自 v5.0.0 起已废弃,建议迁移到 EnvService 的域名与路由能力
|
|
14
|
+
* (如 createHttpServiceRoute / modifyHttpServiceRoute / deleteHttpServiceRoute)。
|
|
15
|
+
*/
|
|
11
16
|
class AccessService {
|
|
12
17
|
constructor(environment) {
|
|
13
18
|
this.environment = environment;
|
package/lib/agent/index.js
CHANGED
|
@@ -313,10 +313,11 @@ class AgentService {
|
|
|
313
313
|
// ==================== 日志查询方法 ====================
|
|
314
314
|
/**
|
|
315
315
|
* 获取 Agent 调用日志(自动判断类型)
|
|
316
|
+
*
|
|
317
|
+
* SCF / TCBR 均直接走 CLS `searchClsLog`,返回 CLS 原始检索结果 `ISearchClsLogResponse`。
|
|
318
|
+
* 分页请透传上次返回的 `LogResults.Context` 到入参 `context`。
|
|
316
319
|
* @param params 查询参数
|
|
317
|
-
* @returns
|
|
318
|
-
* - SCF: IFunctionLogDetailRes[]
|
|
319
|
-
* - TCBR: ISearchClsLogResponse
|
|
320
|
+
* @returns CLS 检索结果 ISearchClsLogResponse
|
|
320
321
|
* @example
|
|
321
322
|
* ```typescript
|
|
322
323
|
* const logs = await agentService.getAgentLogs({
|
|
@@ -336,25 +337,18 @@ class AgentService {
|
|
|
336
337
|
}
|
|
337
338
|
const agentInfo = agentListRes.AgentList[0];
|
|
338
339
|
const agentType = agentInfo.AgentType;
|
|
339
|
-
//
|
|
340
|
-
if (agentType === 'scf') {
|
|
341
|
-
const functionService = this.environment.getFunctionService();
|
|
342
|
-
return functionService.getCompleteFunctionLogs({
|
|
343
|
-
name: AgentId,
|
|
344
|
-
offset: params.offset,
|
|
345
|
-
limit: params.limit,
|
|
346
|
-
startTime: params.startTime,
|
|
347
|
-
endTime: params.endTime,
|
|
348
|
-
requestId: params.requestId
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
else if (agentType === 'tcbr') {
|
|
340
|
+
// scf / tcbr 均直接走 CLS searchClsLog(getFunctionLogs 系列接口已下线)
|
|
341
|
+
if (agentType === 'scf' || agentType === 'tcbr') {
|
|
352
342
|
const logService = this.environment.getLogService();
|
|
353
|
-
const { startTime, endTime, limit = 100, requestId } = params;
|
|
343
|
+
const { startTime, endTime, limit = 100, requestId, context, sort } = params;
|
|
354
344
|
// 构建查询语句
|
|
355
|
-
|
|
345
|
+
// 采用双引号短语检索保证精确匹配(AgentId/RequestId 含 '-' 会被分词,
|
|
346
|
+
// 不加引号会因分词命中相似 ID 的其它日志);并对入参做转义,避免检索语法被注入。
|
|
347
|
+
// CLS 双引号短语检索下需转义 '"'、'*' 与 '\\'。
|
|
348
|
+
const escapeClsPhrase = (value) => value.replace(/["*\\]/g, '\\$&');
|
|
349
|
+
let queryString = `SCF_FunctionName:"${escapeClsPhrase(AgentId)}"`;
|
|
356
350
|
if (requestId) {
|
|
357
|
-
queryString += ` AND SCF_RequestId
|
|
351
|
+
queryString += ` AND SCF_RequestId:"${escapeClsPhrase(requestId)}"`;
|
|
358
352
|
}
|
|
359
353
|
// 辅助函数:格式化时间
|
|
360
354
|
const formatDateTime = (date) => {
|
|
@@ -368,7 +362,9 @@ class AgentService {
|
|
|
368
362
|
StartTime: startTime || defaultStartTime,
|
|
369
363
|
EndTime: endTime || defaultEndTime,
|
|
370
364
|
queryString: queryString,
|
|
371
|
-
Limit: limit > 100 ? 100 : limit
|
|
365
|
+
Limit: limit > 100 ? 100 : limit,
|
|
366
|
+
Context: context,
|
|
367
|
+
Sort: sort
|
|
372
368
|
});
|
|
373
369
|
}
|
|
374
370
|
else {
|
package/lib/cloudApp/index.js
CHANGED
|
@@ -126,7 +126,7 @@ class CloudAppService {
|
|
|
126
126
|
* @param params 上传参数
|
|
127
127
|
*/
|
|
128
128
|
async uploadCode(params) {
|
|
129
|
-
const { serviceName, localPath, ignore = [] } = params;
|
|
129
|
+
const { serviceName, localPath, ignore = [], onPhase } = params;
|
|
130
130
|
// 1. 验证本地路径
|
|
131
131
|
if (!fs_1.default.existsSync(localPath)) {
|
|
132
132
|
throw new error_1.CloudBaseError(`本地路径不存在: ${localPath}`);
|
|
@@ -138,20 +138,27 @@ class CloudAppService {
|
|
|
138
138
|
// 2. 打包本地文件为 ZIP
|
|
139
139
|
const tmpZipPath = path_1.default.join(os_1.default.tmpdir(), `cloudapp-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`);
|
|
140
140
|
const defaultIgnore = ['node_modules/**', '.git/**', '.DS_Store', '**/.DS_Store'];
|
|
141
|
+
const packStart = Date.now();
|
|
141
142
|
await (0, utils_1.compressToZip)({
|
|
142
143
|
dirPath: localPath,
|
|
143
144
|
outputPath: tmpZipPath,
|
|
144
145
|
ignore: [...defaultIgnore, ...ignore]
|
|
145
146
|
});
|
|
147
|
+
const zipSize = fs_1.default.statSync(tmpZipPath).size;
|
|
148
|
+
onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'pack', durationMs: Date.now() - packStart, bytes: zipSize });
|
|
146
149
|
try {
|
|
147
150
|
// 3. 获取上传凭证
|
|
151
|
+
const credStart = Date.now();
|
|
148
152
|
const cosInfo = await this.describeCosInfo({
|
|
149
153
|
deployType: params.deployType,
|
|
150
154
|
serviceName,
|
|
151
155
|
suffix: '.zip'
|
|
152
156
|
});
|
|
157
|
+
onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'credential', durationMs: Date.now() - credStart });
|
|
153
158
|
// 4. 读取 ZIP 文件
|
|
159
|
+
const readStart = Date.now();
|
|
154
160
|
const zipBuffer = fs_1.default.readFileSync(tmpZipPath);
|
|
161
|
+
onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'read', durationMs: Date.now() - readStart, bytes: zipBuffer.length });
|
|
155
162
|
// 5. 构建请求头
|
|
156
163
|
const headers = {
|
|
157
164
|
'Content-Type': 'application/zip'
|
|
@@ -162,6 +169,7 @@ class CloudAppService {
|
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
// 6. 使用预签名 URL 上传
|
|
172
|
+
const putStart = Date.now();
|
|
165
173
|
const response = await (0, http_request_1.fetchStream)(cosInfo.UploadUrl, {
|
|
166
174
|
method: 'PUT',
|
|
167
175
|
body: zipBuffer,
|
|
@@ -178,6 +186,7 @@ class CloudAppService {
|
|
|
178
186
|
}
|
|
179
187
|
throw new error_1.CloudBaseError(`上传失败: ${response.status} ${response.statusText}${errorDetail}`);
|
|
180
188
|
}
|
|
189
|
+
onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'upload', durationMs: Date.now() - putStart, bytes: zipBuffer.length });
|
|
181
190
|
// 7. 返回结果(返回 cosTimestamp,用于创建应用)
|
|
182
191
|
return {
|
|
183
192
|
cosTimestamp: cosInfo.UnixTimestamp,
|
package/lib/database/index.js
CHANGED
|
@@ -329,6 +329,177 @@ class DatabaseService {
|
|
|
329
329
|
}
|
|
330
330
|
return this.dbOpService.request('ExecutePGSql', params);
|
|
331
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* 预览 PG 用户 migrations 的远端执行计划(不实际执行 SQL)
|
|
334
|
+
* @param options 预览参数
|
|
335
|
+
* @returns 预览结果(Pending、Applied、Conflicts、Executable)
|
|
336
|
+
*/
|
|
337
|
+
async previewPGUserMigrations(options) {
|
|
338
|
+
var _a;
|
|
339
|
+
const { EnvId, Migrations, IncludeAll } = options;
|
|
340
|
+
if (!Array.isArray(Migrations) || Migrations.length === 0) {
|
|
341
|
+
throw new error_1.CloudBaseError('Migrations 至少需要 1 条');
|
|
342
|
+
}
|
|
343
|
+
for (const migration of Migrations) {
|
|
344
|
+
if (!/^\d{14}$/.test(migration.Version)) {
|
|
345
|
+
throw new error_1.CloudBaseError('Migration.Version 必须是 14 位数字');
|
|
346
|
+
}
|
|
347
|
+
if (!/^[a-z_]+$/.test(migration.Name)) {
|
|
348
|
+
throw new error_1.CloudBaseError('Migration.Name 只允许小写字母和下划线');
|
|
349
|
+
}
|
|
350
|
+
if (!((_a = migration.Query) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
351
|
+
throw new error_1.CloudBaseError('Migration.Query 不能为空');
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return this.dbOpService.request('PreviewPGUserMigrations', Object.assign({ EnvId: EnvId || this.envId, Migrations }, (IncludeAll !== undefined ? { IncludeAll } : {})));
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* 批量应用 PG 用户 migrations
|
|
358
|
+
* @param options 批量 migration 参数
|
|
359
|
+
* @returns 任务信息(TaskId、RequestId)
|
|
360
|
+
*/
|
|
361
|
+
async pushPGUserMigrations(options) {
|
|
362
|
+
var _a;
|
|
363
|
+
const { EnvId, Migrations, LockTimeoutMs, StatementTimeoutMs, IncludeAll } = options;
|
|
364
|
+
if (!Array.isArray(Migrations) || Migrations.length === 0) {
|
|
365
|
+
throw new error_1.CloudBaseError('Migrations 至少需要 1 条');
|
|
366
|
+
}
|
|
367
|
+
for (const migration of Migrations) {
|
|
368
|
+
if (!/^\d{14}$/.test(migration.Version)) {
|
|
369
|
+
throw new error_1.CloudBaseError('Migration.Version 必须是 14 位数字');
|
|
370
|
+
}
|
|
371
|
+
if (!/^[a-z_]+$/.test(migration.Name)) {
|
|
372
|
+
throw new error_1.CloudBaseError('Migration.Name 只允许小写字母和下划线');
|
|
373
|
+
}
|
|
374
|
+
if (!((_a = migration.Query) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
375
|
+
throw new error_1.CloudBaseError('Migration.Query 不能为空');
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (LockTimeoutMs !== undefined && LockTimeoutMs < 0) {
|
|
379
|
+
throw new error_1.CloudBaseError('LockTimeoutMs 不能小于 0');
|
|
380
|
+
}
|
|
381
|
+
if (StatementTimeoutMs !== undefined && StatementTimeoutMs < 0) {
|
|
382
|
+
throw new error_1.CloudBaseError('StatementTimeoutMs 不能小于 0');
|
|
383
|
+
}
|
|
384
|
+
return this.dbOpService.request('PushPGUserMigrations', Object.assign(Object.assign(Object.assign({ EnvId: EnvId || this.envId, Migrations }, (LockTimeoutMs !== undefined ? { LockTimeoutMs } : {})), (StatementTimeoutMs !== undefined ? { StatementTimeoutMs } : {})), (IncludeAll !== undefined ? { IncludeAll } : {})));
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* 修复 PG 用户 migration history,仅维护 user_schema_migrations 记录,不执行 SQL
|
|
388
|
+
* @param options 修复参数
|
|
389
|
+
* @returns RequestId
|
|
390
|
+
*/
|
|
391
|
+
async repairPGUserMigrationHistory(options) {
|
|
392
|
+
const { EnvId, MigrationVersion, Name, Status, Reason, Query } = options;
|
|
393
|
+
if (!/^\d{14}$/.test(MigrationVersion)) {
|
|
394
|
+
throw new error_1.CloudBaseError('MigrationVersion 必须是 14 位数字');
|
|
395
|
+
}
|
|
396
|
+
if (!/^[a-z_]+$/.test(Name)) {
|
|
397
|
+
throw new error_1.CloudBaseError('Name 只允许小写字母和下划线');
|
|
398
|
+
}
|
|
399
|
+
if (Status !== 'applied' && Status !== 'reverted') {
|
|
400
|
+
throw new error_1.CloudBaseError('Status 只允许 applied 或 reverted');
|
|
401
|
+
}
|
|
402
|
+
if (!(Reason === null || Reason === void 0 ? void 0 : Reason.trim())) {
|
|
403
|
+
throw new error_1.CloudBaseError('Reason 不能为空');
|
|
404
|
+
}
|
|
405
|
+
if (Status === 'applied' && !(Query === null || Query === void 0 ? void 0 : Query.trim())) {
|
|
406
|
+
throw new error_1.CloudBaseError('Status=applied 时 Query 不能为空');
|
|
407
|
+
}
|
|
408
|
+
const params = {
|
|
409
|
+
EnvId: EnvId || this.envId,
|
|
410
|
+
MigrationVersion,
|
|
411
|
+
Name,
|
|
412
|
+
Status,
|
|
413
|
+
Reason
|
|
414
|
+
};
|
|
415
|
+
if (Status === 'applied') {
|
|
416
|
+
params.Query = Query;
|
|
417
|
+
}
|
|
418
|
+
return this.dbOpService.request('RepairPGUserMigrationHistory', params);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* 查询目标环境已应用的用户 migration 列表
|
|
422
|
+
* @param options 查询参数(EnvId 可选、Limit、Offset)
|
|
423
|
+
* @returns 已应用 migration 列表、总数量、最新版本号
|
|
424
|
+
*/
|
|
425
|
+
async listPGUserMigrations(options = {}) {
|
|
426
|
+
const { EnvId, Limit, Offset } = options;
|
|
427
|
+
if (Limit !== undefined && (Limit < 1 || Limit > 500)) {
|
|
428
|
+
throw new error_1.CloudBaseError('Limit 取值范围为 [1, 500]');
|
|
429
|
+
}
|
|
430
|
+
if (Offset !== undefined && Offset < 0) {
|
|
431
|
+
throw new error_1.CloudBaseError('Offset 不能小于 0');
|
|
432
|
+
}
|
|
433
|
+
return this.dbOpService.request('ListPGUserMigrations', Object.assign(Object.assign({ EnvId: EnvId || this.envId }, (Limit !== undefined ? { Limit } : {})), (Offset !== undefined ? { Offset } : {})));
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* 查询目标环境全部已应用的用户 migration 列表
|
|
437
|
+
* @param options 查询参数(EnvId 可选、PageSize)
|
|
438
|
+
* @returns 已应用 migration 列表、总数量、最新版本号
|
|
439
|
+
*/
|
|
440
|
+
async listAllPGUserMigrations(options = {}) {
|
|
441
|
+
const { EnvId, PageSize = 500 } = options;
|
|
442
|
+
if (PageSize < 1 || PageSize > 500) {
|
|
443
|
+
throw new error_1.CloudBaseError('PageSize 取值范围为 [1, 500]');
|
|
444
|
+
}
|
|
445
|
+
const migrations = [];
|
|
446
|
+
let offset = 0;
|
|
447
|
+
let latestVersion = '';
|
|
448
|
+
let total = 0;
|
|
449
|
+
let requestId = '';
|
|
450
|
+
while (true) {
|
|
451
|
+
const page = await this.listPGUserMigrations({
|
|
452
|
+
EnvId,
|
|
453
|
+
Limit: PageSize,
|
|
454
|
+
Offset: offset
|
|
455
|
+
});
|
|
456
|
+
const pageMigrations = page.Migrations || [];
|
|
457
|
+
migrations.push(...pageMigrations);
|
|
458
|
+
latestVersion = page.LatestVersion || latestVersion;
|
|
459
|
+
total += pageMigrations.length;
|
|
460
|
+
requestId = page.RequestId || requestId;
|
|
461
|
+
if (pageMigrations.length < PageSize) {
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
offset += PageSize;
|
|
465
|
+
}
|
|
466
|
+
return {
|
|
467
|
+
Total: total,
|
|
468
|
+
LatestVersion: latestVersion,
|
|
469
|
+
Migrations: migrations,
|
|
470
|
+
RequestId: requestId
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 查询目标环境指定 migration 详情
|
|
475
|
+
* @param options 查询参数(EnvId 可选、MigrationVersion 必填)
|
|
476
|
+
* @returns migration 详情(Version、Name、Query)
|
|
477
|
+
*/
|
|
478
|
+
async describePGUserMigration(options) {
|
|
479
|
+
const { EnvId, MigrationVersion } = options;
|
|
480
|
+
if (!/^\d{14}$/.test(MigrationVersion)) {
|
|
481
|
+
throw new error_1.CloudBaseError('MigrationVersion 必须是 14 位数字');
|
|
482
|
+
}
|
|
483
|
+
return this.dbOpService.request('DescribePGUserMigration', {
|
|
484
|
+
EnvId: EnvId || this.envId,
|
|
485
|
+
MigrationVersion
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 查询任务结果
|
|
490
|
+
* @param options 查询参数(EnvId 可选、TaskId 必填)
|
|
491
|
+
* @returns 任务状态详情(TaskType、Status、Phase、Reason 等)
|
|
492
|
+
*/
|
|
493
|
+
async describeTaskResult(options) {
|
|
494
|
+
const { EnvId, TaskId } = options;
|
|
495
|
+
if (!(TaskId === null || TaskId === void 0 ? void 0 : TaskId.trim())) {
|
|
496
|
+
throw new error_1.CloudBaseError('TaskId 不能为空');
|
|
497
|
+
}
|
|
498
|
+
return this.dbOpService.request('DescribeTaskResult', {
|
|
499
|
+
EnvId: EnvId || this.envId,
|
|
500
|
+
TaskId
|
|
501
|
+
});
|
|
502
|
+
}
|
|
332
503
|
}
|
|
333
504
|
exports.DatabaseService = DatabaseService;
|
|
334
505
|
DatabaseService.tcbServiceVersion = {
|
|
@@ -372,3 +543,24 @@ __decorate([
|
|
|
372
543
|
__decorate([
|
|
373
544
|
preLazy()
|
|
374
545
|
], DatabaseService.prototype, "executePGSql", null);
|
|
546
|
+
__decorate([
|
|
547
|
+
preLazy()
|
|
548
|
+
], DatabaseService.prototype, "previewPGUserMigrations", null);
|
|
549
|
+
__decorate([
|
|
550
|
+
preLazy()
|
|
551
|
+
], DatabaseService.prototype, "pushPGUserMigrations", null);
|
|
552
|
+
__decorate([
|
|
553
|
+
preLazy()
|
|
554
|
+
], DatabaseService.prototype, "repairPGUserMigrationHistory", null);
|
|
555
|
+
__decorate([
|
|
556
|
+
preLazy()
|
|
557
|
+
], DatabaseService.prototype, "listPGUserMigrations", null);
|
|
558
|
+
__decorate([
|
|
559
|
+
preLazy()
|
|
560
|
+
], DatabaseService.prototype, "listAllPGUserMigrations", null);
|
|
561
|
+
__decorate([
|
|
562
|
+
preLazy()
|
|
563
|
+
], DatabaseService.prototype, "describePGUserMigration", null);
|
|
564
|
+
__decorate([
|
|
565
|
+
preLazy()
|
|
566
|
+
], DatabaseService.prototype, "describeTaskResult", null);
|
package/lib/function/index.js
CHANGED
|
@@ -623,48 +623,27 @@ class FunctionService {
|
|
|
623
623
|
return data;
|
|
624
624
|
}
|
|
625
625
|
/**
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
async getFunctionLogs(
|
|
641
|
-
|
|
642
|
-
const { namespace } = this.getFunctionConfig();
|
|
643
|
-
if (startTime && !endTime) {
|
|
644
|
-
// 自动补 endTime 为 startTime + 1d
|
|
645
|
-
endTime = (0, utils_1.formatTimeByMs)(new Date(startTime).getTime() + 24 * 3600 * 1000);
|
|
646
|
-
}
|
|
647
|
-
if (endTime && !startTime) {
|
|
648
|
-
// 自动补 startTime 为 endTime - 1d
|
|
649
|
-
startTime = (0, utils_1.formatTimeByMs)(new Date(endTime).getTime() - 24 * 3600 * 1000);
|
|
650
|
-
}
|
|
651
|
-
const params = {
|
|
652
|
-
Namespace: namespace,
|
|
653
|
-
FunctionName: name,
|
|
654
|
-
Offset: offset,
|
|
655
|
-
Limit: limit,
|
|
656
|
-
Order: order,
|
|
657
|
-
OrderBy: orderBy,
|
|
658
|
-
StartTime: startTime,
|
|
659
|
-
EndTime: endTime,
|
|
660
|
-
FunctionRequestId: requestId
|
|
661
|
-
};
|
|
662
|
-
const res = await this.scfService.request('GetFunctionLogs', params);
|
|
663
|
-
return res;
|
|
626
|
+
* 获取函数日志
|
|
627
|
+
* @deprecated 底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
628
|
+
* @param {{
|
|
629
|
+
* name: string
|
|
630
|
+
* offset: number
|
|
631
|
+
* limit: number
|
|
632
|
+
* order: string
|
|
633
|
+
* orderBy: string
|
|
634
|
+
* startTime: string
|
|
635
|
+
* endTime: string
|
|
636
|
+
* requestId: string
|
|
637
|
+
* }} options
|
|
638
|
+
* @returns {Promise<IFunctionLogRes>}
|
|
639
|
+
*/
|
|
640
|
+
async getFunctionLogs(_options) {
|
|
641
|
+
throw new error_1.CloudBaseError('getFunctionLogs 已废弃:底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
664
642
|
}
|
|
665
643
|
/**
|
|
666
|
-
|
|
667
|
-
|
|
644
|
+
* 获取函数日志 ID 列表
|
|
645
|
+
* @deprecated 底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
646
|
+
* @param {{
|
|
668
647
|
* name: string
|
|
669
648
|
* offset: number
|
|
670
649
|
* limit: number
|
|
@@ -675,28 +654,12 @@ class FunctionService {
|
|
|
675
654
|
* }} options
|
|
676
655
|
* @returns {Promise<IFunctionLogResV2>}
|
|
677
656
|
*/
|
|
678
|
-
async getFunctionLogsV2(
|
|
679
|
-
|
|
680
|
-
const { env } = this.getFunctionConfig();
|
|
681
|
-
({ startTime, endTime } = (0, utils_1.getCompleteTimeRange)({
|
|
682
|
-
startTime,
|
|
683
|
-
endTime
|
|
684
|
-
}));
|
|
685
|
-
const params = {
|
|
686
|
-
EnvId: env,
|
|
687
|
-
FunctionName: name,
|
|
688
|
-
Offset: offset,
|
|
689
|
-
Limit: limit,
|
|
690
|
-
StartTime: startTime,
|
|
691
|
-
EndTime: endTime,
|
|
692
|
-
LogRequestId: requestId,
|
|
693
|
-
Qualifier: qualifier || "$LATEST" // 云函数版本,不传则用 $LATEST
|
|
694
|
-
};
|
|
695
|
-
const res = await this.tcbService.request('GetFunctionLogs', params);
|
|
696
|
-
return res;
|
|
657
|
+
async getFunctionLogsV2(_options) {
|
|
658
|
+
throw new error_1.CloudBaseError('getFunctionLogsV2 已废弃:底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
697
659
|
}
|
|
698
660
|
/**
|
|
699
661
|
* 根据函数日志 ID 查询日志详情
|
|
662
|
+
* @deprecated 底层 GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
700
663
|
* @param {{
|
|
701
664
|
* startTime: string
|
|
702
665
|
* endTime: string
|
|
@@ -704,46 +667,18 @@ class FunctionService {
|
|
|
704
667
|
* }} options
|
|
705
668
|
* @returns {Promise<IFunctionLogDetailRes>}
|
|
706
669
|
*/
|
|
707
|
-
async getFunctionLogDetail(
|
|
708
|
-
|
|
709
|
-
({ startTime, endTime } = (0, utils_1.getCompleteTimeRange)({
|
|
710
|
-
startTime,
|
|
711
|
-
endTime
|
|
712
|
-
}));
|
|
713
|
-
const params = {
|
|
714
|
-
StartTime: startTime,
|
|
715
|
-
LogRequestId: logRequestId,
|
|
716
|
-
EndTime: endTime
|
|
717
|
-
};
|
|
718
|
-
const res = await this.tcbService.request('GetFunctionLogDetail', params);
|
|
719
|
-
return res;
|
|
670
|
+
async getFunctionLogDetail(_options) {
|
|
671
|
+
throw new error_1.CloudBaseError('getFunctionLogDetail 已废弃:底层 GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
720
672
|
}
|
|
721
673
|
/**
|
|
722
674
|
* 获取函数的完整调用日志
|
|
723
675
|
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
676
|
+
* @deprecated 底层 GetFunctionLogs/GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
724
677
|
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
725
678
|
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
726
679
|
*/
|
|
727
|
-
async getCompleteFunctionLogs(
|
|
728
|
-
|
|
729
|
-
const { name } = options;
|
|
730
|
-
const logs = await this.getFunctionLogsV2(options);
|
|
731
|
-
// 如果没有日志,直接返回空数组
|
|
732
|
-
if (logs.LogList.length === 0) {
|
|
733
|
-
return [];
|
|
734
|
-
}
|
|
735
|
-
const detailPromises = logs.LogList.map(async (log) => {
|
|
736
|
-
// 对每一个日志ID,调用 getFunctionLogDetail
|
|
737
|
-
const res = await this.getFunctionLogDetail({
|
|
738
|
-
logRequestId: log.RequestId,
|
|
739
|
-
startTime: options.startTime,
|
|
740
|
-
endTime: options.endTime
|
|
741
|
-
});
|
|
742
|
-
return Object.assign(Object.assign({}, res), { RetCode: log.RetCode, FunctionName: name });
|
|
743
|
-
});
|
|
744
|
-
// 并发执行所有详情查询,等待它们全部完成
|
|
745
|
-
const detailedLogs = await Promise.all(detailPromises);
|
|
746
|
-
return detailedLogs;
|
|
680
|
+
async getCompleteFunctionLogs(_options) {
|
|
681
|
+
throw new error_1.CloudBaseError('getCompleteFunctionLogs 已废弃:底层 GetFunctionLogs/GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
747
682
|
}
|
|
748
683
|
/**
|
|
749
684
|
* 更新云函数配置
|
package/lib/index.js
CHANGED
|
@@ -64,6 +64,10 @@ class CloudBase {
|
|
|
64
64
|
get hosting() {
|
|
65
65
|
return this.currentEnvironment().getHostingService();
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* HTTP Service(CloudBaseGW)访问服务
|
|
69
|
+
* @deprecated 自 v5.0.0 起 HTTP Service 模块已废弃,请改用 env 下的域名与路由相关 API。
|
|
70
|
+
*/
|
|
67
71
|
get access() {
|
|
68
72
|
return this.currentEnvironment().getAccessService();
|
|
69
73
|
}
|
package/package.json
CHANGED
package/types/access/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
2
|
import { ICreateAccessOptions, IApi, IUpdateOptions, IService, IDeleteOptions, IGetOptions, IDomainOptions } from './types';
|
|
3
3
|
import { IResponseInfo } from '../interfaces';
|
|
4
|
+
/**
|
|
5
|
+
* HTTP Service(CloudBaseGW)访问服务。
|
|
6
|
+
* 注意:HTTP Service 模块自 v5.0.0 起已废弃,建议迁移到 EnvService 的域名与路由能力
|
|
7
|
+
* (如 createHttpServiceRoute / modifyHttpServiceRoute / deleteHttpServiceRoute)。
|
|
8
|
+
*/
|
|
4
9
|
export declare class AccessService {
|
|
5
10
|
private tcbService;
|
|
6
11
|
private environment;
|
package/types/agent/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
2
|
import { ICreateFunctionAgentParams, ICreateAgentParams, ICreateTcbrAgentByImageParams, ICreateTcbrAgentByPackageParams, ICreateTcbrAgentByCodeParams, IDescribeAgentListParams, IDescribeAgentListResponse, IDescribeAgentResponse, IDeleteAgentParams, IDescribeCloudBaseBuildServiceParams, IDescribeCloudBaseBuildServiceResponse, ICreateAgentResponse, IDeleteAgentResponse, ICommonResponse, IUpdateAgentParams, IUpdateScfAgentParams, IUpdateScfAgentResponse, IUpdateTcbrAgentParams, IGetAgentLogsParams } from './type';
|
|
3
|
+
import { ISearchClsLogResponse } from '../log';
|
|
3
4
|
/**
|
|
4
5
|
* Agent 管理类
|
|
5
6
|
* 支持三种部署方式:
|
|
@@ -64,10 +65,11 @@ export declare class AgentService {
|
|
|
64
65
|
updateScfAgent(params: IUpdateScfAgentParams): Promise<IUpdateScfAgentResponse>;
|
|
65
66
|
/**
|
|
66
67
|
* 获取 Agent 调用日志(自动判断类型)
|
|
68
|
+
*
|
|
69
|
+
* SCF / TCBR 均直接走 CLS `searchClsLog`,返回 CLS 原始检索结果 `ISearchClsLogResponse`。
|
|
70
|
+
* 分页请透传上次返回的 `LogResults.Context` 到入参 `context`。
|
|
67
71
|
* @param params 查询参数
|
|
68
|
-
* @returns
|
|
69
|
-
* - SCF: IFunctionLogDetailRes[]
|
|
70
|
-
* - TCBR: ISearchClsLogResponse
|
|
72
|
+
* @returns CLS 检索结果 ISearchClsLogResponse
|
|
71
73
|
* @example
|
|
72
74
|
* ```typescript
|
|
73
75
|
* const logs = await agentService.getAgentLogs({
|
|
@@ -78,7 +80,7 @@ export declare class AgentService {
|
|
|
78
80
|
* })
|
|
79
81
|
* ```
|
|
80
82
|
*/
|
|
81
|
-
getAgentLogs(params: IGetAgentLogsParams): Promise<
|
|
83
|
+
getAgentLogs(params: IGetAgentLogsParams): Promise<ISearchClsLogResponse>;
|
|
82
84
|
/**
|
|
83
85
|
* 通过镜像创建 TCBR Agent
|
|
84
86
|
* @internal 暂不对外暴露,后续版本开放
|
package/types/agent/type.d.ts
CHANGED
|
@@ -372,16 +372,18 @@ export interface IDeleteAgentResponse {
|
|
|
372
372
|
export interface IGetAgentLogsParams {
|
|
373
373
|
/** Agent ID */
|
|
374
374
|
AgentId: string;
|
|
375
|
-
/**
|
|
376
|
-
offset?: number;
|
|
377
|
-
/** 返回数量,默认 10 */
|
|
375
|
+
/** 单次返回条数,默认 100,最大 100 */
|
|
378
376
|
limit?: number;
|
|
379
|
-
/** 开始时间,如 "2024-01-01 00:00:00" */
|
|
377
|
+
/** 开始时间,如 "2024-01-01 00:00:00",默认最近 1 小时 */
|
|
380
378
|
startTime?: string;
|
|
381
|
-
/** 结束时间,如 "2024-01-01 23:59:59" */
|
|
379
|
+
/** 结束时间,如 "2024-01-01 23:59:59",默认当前时间 */
|
|
382
380
|
endTime?: string;
|
|
383
|
-
/** 按 RequestId
|
|
381
|
+
/** 按 RequestId 筛选 */
|
|
384
382
|
requestId?: string;
|
|
383
|
+
/** 分页游标,透传上次返回的 LogResults.Context 获取下一页 */
|
|
384
|
+
context?: string;
|
|
385
|
+
/** 按时间排序:'asc' 升序 / 'desc' 降序(默认 desc) */
|
|
386
|
+
sort?: 'asc' | 'desc';
|
|
385
387
|
}
|
|
386
388
|
/**
|
|
387
389
|
* @deprecated 请使用 ICreateTcbrAgentByCodeParams
|
|
@@ -299,6 +299,21 @@ export interface IProgressData {
|
|
|
299
299
|
total: number;
|
|
300
300
|
percent: number;
|
|
301
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* 代码上传的分步阶段
|
|
304
|
+
*/
|
|
305
|
+
export type UploadPhase = 'pack' | 'credential' | 'read' | 'upload';
|
|
306
|
+
/**
|
|
307
|
+
* 单个阶段计时信息(由 uploadCode 的 onPhase 回调触发)
|
|
308
|
+
*/
|
|
309
|
+
export interface IUploadPhaseTiming {
|
|
310
|
+
/** 阶段名 */
|
|
311
|
+
phase: UploadPhase;
|
|
312
|
+
/** 耗时(ms) */
|
|
313
|
+
durationMs: number;
|
|
314
|
+
/** 字节数(pack: zip 大小; read/upload: buffer 大小) */
|
|
315
|
+
bytes?: number;
|
|
316
|
+
}
|
|
302
317
|
/**
|
|
303
318
|
* 上传代码参数
|
|
304
319
|
*/
|
|
@@ -313,6 +328,8 @@ export interface IUploadCloudAppCodeParams {
|
|
|
313
328
|
ignore?: string[];
|
|
314
329
|
/** 进度回调 */
|
|
315
330
|
onProgress?: (progress: IProgressData) => void;
|
|
331
|
+
/** 分步计时回调(各阶段完成时触发,用于 verbose 模式输出耗时) */
|
|
332
|
+
onPhase?: (timing: IUploadPhaseTiming) => void;
|
|
316
333
|
}
|
|
317
334
|
/**
|
|
318
335
|
* 上传代码结果
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IServiceVersion, IExistsRes, CreateIndex, DropIndex, IndexInfo, TableInfo, Pager, IResponseInfo, CollectionDispension } from '../interfaces/';
|
|
2
2
|
import { Environment } from '../environment';
|
|
3
|
+
import { IDescribePGUserMigrationOptions, IDescribePGUserMigrationResult, IDescribeTaskResultOptions, IDescribeTaskResultResult, IListAllPGUserMigrationsOptions, IListPGUserMigrationsOptions, IListPGUserMigrationsResult, IPreviewPGUserMigrationsOptions, IPreviewPGUserMigrationsResult, IPushPGUserMigrationsOptions, IPushPGUserMigrationsResult, IRepairPGUserMigrationHistoryOptions } from './type';
|
|
3
4
|
interface IDatabaseConfig {
|
|
4
5
|
Tag: string;
|
|
5
6
|
}
|
|
@@ -226,5 +227,47 @@ export declare class DatabaseService {
|
|
|
226
227
|
* console.log(res.Rows) // ['["1","Alice"]']
|
|
227
228
|
*/
|
|
228
229
|
executePGSql(options: IExecutePGSqlOptions): Promise<IExecutePGSqlResult>;
|
|
230
|
+
/**
|
|
231
|
+
* 预览 PG 用户 migrations 的远端执行计划(不实际执行 SQL)
|
|
232
|
+
* @param options 预览参数
|
|
233
|
+
* @returns 预览结果(Pending、Applied、Conflicts、Executable)
|
|
234
|
+
*/
|
|
235
|
+
previewPGUserMigrations(options: IPreviewPGUserMigrationsOptions): Promise<IPreviewPGUserMigrationsResult>;
|
|
236
|
+
/**
|
|
237
|
+
* 批量应用 PG 用户 migrations
|
|
238
|
+
* @param options 批量 migration 参数
|
|
239
|
+
* @returns 任务信息(TaskId、RequestId)
|
|
240
|
+
*/
|
|
241
|
+
pushPGUserMigrations(options: IPushPGUserMigrationsOptions): Promise<IPushPGUserMigrationsResult>;
|
|
242
|
+
/**
|
|
243
|
+
* 修复 PG 用户 migration history,仅维护 user_schema_migrations 记录,不执行 SQL
|
|
244
|
+
* @param options 修复参数
|
|
245
|
+
* @returns RequestId
|
|
246
|
+
*/
|
|
247
|
+
repairPGUserMigrationHistory(options: IRepairPGUserMigrationHistoryOptions): Promise<IResponseInfo>;
|
|
248
|
+
/**
|
|
249
|
+
* 查询目标环境已应用的用户 migration 列表
|
|
250
|
+
* @param options 查询参数(EnvId 可选、Limit、Offset)
|
|
251
|
+
* @returns 已应用 migration 列表、总数量、最新版本号
|
|
252
|
+
*/
|
|
253
|
+
listPGUserMigrations(options?: IListPGUserMigrationsOptions): Promise<IListPGUserMigrationsResult>;
|
|
254
|
+
/**
|
|
255
|
+
* 查询目标环境全部已应用的用户 migration 列表
|
|
256
|
+
* @param options 查询参数(EnvId 可选、PageSize)
|
|
257
|
+
* @returns 已应用 migration 列表、总数量、最新版本号
|
|
258
|
+
*/
|
|
259
|
+
listAllPGUserMigrations(options?: IListAllPGUserMigrationsOptions): Promise<IListPGUserMigrationsResult>;
|
|
260
|
+
/**
|
|
261
|
+
* 查询目标环境指定 migration 详情
|
|
262
|
+
* @param options 查询参数(EnvId 可选、MigrationVersion 必填)
|
|
263
|
+
* @returns migration 详情(Version、Name、Query)
|
|
264
|
+
*/
|
|
265
|
+
describePGUserMigration(options: IDescribePGUserMigrationOptions): Promise<IDescribePGUserMigrationResult>;
|
|
266
|
+
/**
|
|
267
|
+
* 查询任务结果
|
|
268
|
+
* @param options 查询参数(EnvId 可选、TaskId 必填)
|
|
269
|
+
* @returns 任务状态详情(TaskType、Status、Phase、Reason 等)
|
|
270
|
+
*/
|
|
271
|
+
describeTaskResult(options: IDescribeTaskResultOptions): Promise<IDescribeTaskResultResult>;
|
|
229
272
|
}
|
|
230
273
|
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PushPGUserMigrations 的单条 migration 输入
|
|
3
|
+
*/
|
|
4
|
+
export interface IPGUserMigrationInput {
|
|
5
|
+
/** migration 版本,14 位数字时间串,如 20260526000000 */
|
|
6
|
+
Version: string;
|
|
7
|
+
/** migration 名称,仅允许小写字母和下划线 */
|
|
8
|
+
Name: string;
|
|
9
|
+
/** 要执行的 SQL */
|
|
10
|
+
Query: string;
|
|
11
|
+
/** 回滚 SQL(可选) */
|
|
12
|
+
Rollback?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 批量应用 PG 用户 migrations 请求参数
|
|
16
|
+
*/
|
|
17
|
+
export interface IPushPGUserMigrationsOptions {
|
|
18
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
19
|
+
EnvId?: string;
|
|
20
|
+
/** migration 列表(至少 1 条) */
|
|
21
|
+
Migrations: IPGUserMigrationInput[];
|
|
22
|
+
/** 获取数据库锁最长等待时间(毫秒) */
|
|
23
|
+
LockTimeoutMs?: number;
|
|
24
|
+
/** 单条 SQL 最长执行时间(毫秒) */
|
|
25
|
+
StatementTimeoutMs?: number;
|
|
26
|
+
/** 是否允许 out-of-order local migrations */
|
|
27
|
+
IncludeAll?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 批量应用 PG 用户 migrations 返回参数
|
|
31
|
+
*/
|
|
32
|
+
export interface IPushPGUserMigrationsResult {
|
|
33
|
+
/** 请求唯一 ID */
|
|
34
|
+
RequestId: string;
|
|
35
|
+
/** 异步任务 ID,可用于查询任务进度 */
|
|
36
|
+
TaskId: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 预览 PG 用户 migrations 请求参数
|
|
40
|
+
*/
|
|
41
|
+
export interface IPreviewPGUserMigrationsOptions {
|
|
42
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
43
|
+
EnvId?: string;
|
|
44
|
+
/** migration 列表(至少 1 条) */
|
|
45
|
+
Migrations: IPGUserMigrationInput[];
|
|
46
|
+
/** 是否允许 out-of-order local migrations */
|
|
47
|
+
IncludeAll?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* migration 计划项
|
|
51
|
+
*/
|
|
52
|
+
export interface IPGUserMigrationPlanItem {
|
|
53
|
+
/** migration 版本 */
|
|
54
|
+
Version: string;
|
|
55
|
+
/** migration 名称 */
|
|
56
|
+
Name: string;
|
|
57
|
+
/** 当前状态(例如 applied / pending) */
|
|
58
|
+
Status?: string;
|
|
59
|
+
/** 状态原因(例如 checksum_matched) */
|
|
60
|
+
Reason?: string;
|
|
61
|
+
/** migration 内容校验和 */
|
|
62
|
+
Checksum?: string;
|
|
63
|
+
/** 来源标记(响应字段,服务端可能返回) */
|
|
64
|
+
Source?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* migration 冲突项
|
|
68
|
+
*/
|
|
69
|
+
export interface IPGUserMigrationConflict {
|
|
70
|
+
/** 发生冲突的 migration 版本 */
|
|
71
|
+
Version: string;
|
|
72
|
+
/** 本地 migration 名称 */
|
|
73
|
+
Name?: string;
|
|
74
|
+
/** 远端(数据库已应用)migration 名称 */
|
|
75
|
+
RemoteName?: string;
|
|
76
|
+
/** 本次 SQL 计算出来的 checksum */
|
|
77
|
+
LocalChecksum?: string;
|
|
78
|
+
/** 数据库中已应用 migration 的 checksum */
|
|
79
|
+
RemoteChecksum?: string;
|
|
80
|
+
/** 冲突原因(如 checksum_mismatch) */
|
|
81
|
+
Reason?: string;
|
|
82
|
+
/** 冲突详情信息 */
|
|
83
|
+
Message?: string;
|
|
84
|
+
/** 兼容服务端未来扩展字段 */
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 预览 PG 用户 migrations 返回参数
|
|
89
|
+
*/
|
|
90
|
+
export interface IPreviewPGUserMigrationsResult {
|
|
91
|
+
/** 将要执行的 migration 列表 */
|
|
92
|
+
Pending: IPGUserMigrationPlanItem[] | null;
|
|
93
|
+
/** 已经应用过的 migration 列表 */
|
|
94
|
+
Applied: IPGUserMigrationPlanItem[] | null;
|
|
95
|
+
/** checksum 冲突列表 */
|
|
96
|
+
Conflicts: IPGUserMigrationConflict[] | null;
|
|
97
|
+
/** 是否可直接执行(当前主要表示无 checksum 冲突) */
|
|
98
|
+
Executable: boolean;
|
|
99
|
+
/** 请求唯一 ID */
|
|
100
|
+
RequestId: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 已应用的 PG 用户 migration 摘要项
|
|
104
|
+
*/
|
|
105
|
+
export interface IPGUserMigrationSummary {
|
|
106
|
+
/** migration 版本号,14 位数字时间串(如 20260526000000) */
|
|
107
|
+
Version: string;
|
|
108
|
+
/** migration 名称 */
|
|
109
|
+
Name: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 查询已应用 PG 用户 migrations 请求参数
|
|
113
|
+
*/
|
|
114
|
+
export interface IListPGUserMigrationsOptions {
|
|
115
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
116
|
+
EnvId?: string;
|
|
117
|
+
/** 查询条数,取值范围 [1, 500],默认 100 */
|
|
118
|
+
Limit?: number;
|
|
119
|
+
/** 分页偏移,默认 0 */
|
|
120
|
+
Offset?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 查询全部已应用 PG 用户 migrations 请求参数
|
|
124
|
+
*/
|
|
125
|
+
export interface IListAllPGUserMigrationsOptions {
|
|
126
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
127
|
+
EnvId?: string;
|
|
128
|
+
/** 内部翻页每页大小,取值范围 [1, 500],默认 500 */
|
|
129
|
+
PageSize?: number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 查询已应用 PG 用户 migrations 返回参数
|
|
133
|
+
*/
|
|
134
|
+
export interface IListPGUserMigrationsResult {
|
|
135
|
+
/** 总数量 */
|
|
136
|
+
Total: number;
|
|
137
|
+
/** 已应用的最新版本号,14 位数字时间串 */
|
|
138
|
+
LatestVersion: string;
|
|
139
|
+
/** 已应用 migration 列表 */
|
|
140
|
+
Migrations: IPGUserMigrationSummary[];
|
|
141
|
+
/** 请求唯一 ID */
|
|
142
|
+
RequestId: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 查询单条 PG 用户 migration 详情请求参数
|
|
146
|
+
*/
|
|
147
|
+
export interface IDescribePGUserMigrationOptions {
|
|
148
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
149
|
+
EnvId?: string;
|
|
150
|
+
/** migration 版本号,14 位数字时间串(如 20260526000000) */
|
|
151
|
+
MigrationVersion: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 查询单条 PG 用户 migration 详情返回参数
|
|
155
|
+
*/
|
|
156
|
+
export interface IDescribePGUserMigrationResult {
|
|
157
|
+
/** migration 版本号,14 位数字时间串 */
|
|
158
|
+
Version: string;
|
|
159
|
+
/** migration 名称(仅小写字母和下划线) */
|
|
160
|
+
Name: string;
|
|
161
|
+
/** migration SQL */
|
|
162
|
+
Query: string;
|
|
163
|
+
/** 请求唯一 ID */
|
|
164
|
+
RequestId: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* 查询任务结果请求参数
|
|
168
|
+
*/
|
|
169
|
+
export interface IDescribeTaskResultOptions {
|
|
170
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
171
|
+
EnvId?: string;
|
|
172
|
+
/** 任务 ID */
|
|
173
|
+
TaskId: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 查询任务结果返回参数
|
|
177
|
+
*/
|
|
178
|
+
export interface IDescribeTaskResultResult {
|
|
179
|
+
/** 任务 ID */
|
|
180
|
+
TaskId: string;
|
|
181
|
+
/** 任务类型(如 PGUserMigration) */
|
|
182
|
+
TaskType: string;
|
|
183
|
+
/** 任务状态:Failed / Succeed / Accepted / Running */
|
|
184
|
+
Status: 'Failed' | 'Succeed' | 'Accepted' | 'Running' | string;
|
|
185
|
+
/** 当前步骤 */
|
|
186
|
+
Phase: string;
|
|
187
|
+
/** 失败原因(成功时可能为空) */
|
|
188
|
+
Reason: string;
|
|
189
|
+
/** 创建时间(ISO 8601) */
|
|
190
|
+
CreatedAt: string;
|
|
191
|
+
/** 最后更新时间(ISO 8601) */
|
|
192
|
+
UpdatedAt: string;
|
|
193
|
+
/** 请求唯一 ID */
|
|
194
|
+
RequestId: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* 修复 PG 用户 migration history 请求参数
|
|
198
|
+
*/
|
|
199
|
+
export interface IRepairPGUserMigrationHistoryOptions {
|
|
200
|
+
/** 云开发环境 ID(可选,不传则自动使用当前环境 ID) */
|
|
201
|
+
EnvId?: string;
|
|
202
|
+
/** migration 版本,14 位数字时间串,如 20260526000000 */
|
|
203
|
+
MigrationVersion: string;
|
|
204
|
+
/** migration 版本名,仅允许小写字母和下划线 */
|
|
205
|
+
Name: string;
|
|
206
|
+
/** 修复状态:applied(写入 history)或 reverted(删除 history) */
|
|
207
|
+
Status: 'applied' | 'reverted';
|
|
208
|
+
/** 修复原因 */
|
|
209
|
+
Reason: string;
|
|
210
|
+
/** applied 时建议传入对应 SQL,reverted 时可不传 */
|
|
211
|
+
Query?: string;
|
|
212
|
+
}
|
|
@@ -311,24 +311,25 @@ export declare class FunctionService {
|
|
|
311
311
|
codeSecret: any;
|
|
312
312
|
}): Promise<IFunctionInfo[]>;
|
|
313
313
|
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
* @param {{
|
|
317
|
-
* name: string
|
|
318
|
-
* offset: number
|
|
319
|
-
* limit: number
|
|
320
|
-
* order: string
|
|
321
|
-
* orderBy: string
|
|
322
|
-
* startTime: string
|
|
323
|
-
* endTime: string
|
|
324
|
-
* requestId: string
|
|
325
|
-
* }} options
|
|
326
|
-
* @returns {Promise<IFunctionLogRes>}
|
|
327
|
-
*/
|
|
328
|
-
getFunctionLogs(options: IFunctionLogOptions): Promise<IFunctionLogRes>;
|
|
329
|
-
/**
|
|
330
|
-
* 获取函数日志 ID 列表
|
|
314
|
+
* 获取函数日志
|
|
315
|
+
* @deprecated 底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
331
316
|
* @param {{
|
|
317
|
+
* name: string
|
|
318
|
+
* offset: number
|
|
319
|
+
* limit: number
|
|
320
|
+
* order: string
|
|
321
|
+
* orderBy: string
|
|
322
|
+
* startTime: string
|
|
323
|
+
* endTime: string
|
|
324
|
+
* requestId: string
|
|
325
|
+
* }} options
|
|
326
|
+
* @returns {Promise<IFunctionLogRes>}
|
|
327
|
+
*/
|
|
328
|
+
getFunctionLogs(_options: IFunctionLogOptions): Promise<IFunctionLogRes>;
|
|
329
|
+
/**
|
|
330
|
+
* 获取函数日志 ID 列表
|
|
331
|
+
* @deprecated 底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
332
|
+
* @param {{
|
|
332
333
|
* name: string
|
|
333
334
|
* offset: number
|
|
334
335
|
* limit: number
|
|
@@ -339,9 +340,10 @@ export declare class FunctionService {
|
|
|
339
340
|
* }} options
|
|
340
341
|
* @returns {Promise<IFunctionLogResV2>}
|
|
341
342
|
*/
|
|
342
|
-
getFunctionLogsV2(
|
|
343
|
+
getFunctionLogsV2(_options: IFunctionLogOptionsV2): Promise<IFunctionLogResV2>;
|
|
343
344
|
/**
|
|
344
345
|
* 根据函数日志 ID 查询日志详情
|
|
346
|
+
* @deprecated 底层 GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
345
347
|
* @param {{
|
|
346
348
|
* startTime: string
|
|
347
349
|
* endTime: string
|
|
@@ -349,14 +351,15 @@ export declare class FunctionService {
|
|
|
349
351
|
* }} options
|
|
350
352
|
* @returns {Promise<IFunctionLogDetailRes>}
|
|
351
353
|
*/
|
|
352
|
-
getFunctionLogDetail(
|
|
354
|
+
getFunctionLogDetail(_options: IFunctionLogDetailOptions): Promise<IFunctionLogDetailRes>;
|
|
353
355
|
/**
|
|
354
356
|
* 获取函数的完整调用日志
|
|
355
357
|
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
358
|
+
* @deprecated 底层 GetFunctionLogs/GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
356
359
|
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
357
360
|
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
358
361
|
*/
|
|
359
|
-
getCompleteFunctionLogs(
|
|
362
|
+
getCompleteFunctionLogs(_options: IFunctionLogOptionsV2): Promise<IFunctionLogDetailRes[]>;
|
|
360
363
|
/**
|
|
361
364
|
* 更新云函数配置
|
|
362
365
|
* @param {ICloudFunction} func 云函数配置
|
package/types/index.d.ts
CHANGED
|
@@ -56,6 +56,10 @@ declare class CloudBase {
|
|
|
56
56
|
get storage(): StorageService;
|
|
57
57
|
get database(): DatabaseService;
|
|
58
58
|
get hosting(): HostingService;
|
|
59
|
+
/**
|
|
60
|
+
* HTTP Service(CloudBaseGW)访问服务
|
|
61
|
+
* @deprecated 自 v5.0.0 起 HTTP Service 模块已废弃,请改用 env 下的域名与路由相关 API。
|
|
62
|
+
*/
|
|
59
63
|
get access(): AccessService;
|
|
60
64
|
get mysql(): MysqlService;
|
|
61
65
|
/**
|