@cloudbase/manager-node 5.6.3 → 5.6.5
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/agent/index.js +16 -20
- package/lib/database/index.js +192 -0
- package/lib/database/type.js +2 -0
- package/lib/function/index.js +52 -102
- package/package.json +1 -1
- package/types/agent/index.d.ts +6 -4
- package/types/agent/type.d.ts +8 -6
- package/types/database/index.d.ts +43 -0
- package/types/database/type.d.ts +212 -0
- package/types/function/index.d.ts +26 -21
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/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
|
@@ -290,7 +290,7 @@ class FunctionService {
|
|
|
290
290
|
async createFunction(funcParam) {
|
|
291
291
|
var _a, _b, _c;
|
|
292
292
|
const { namespace } = this.getFunctionConfig();
|
|
293
|
-
const { func, functionRootPath, force = false, base64Code, codeSecret, functionPath, deployMode } = funcParam;
|
|
293
|
+
const { func, functionRootPath, force = false, base64Code, codeSecret, functionPath, deployMode, code } = funcParam;
|
|
294
294
|
const funcName = func.name;
|
|
295
295
|
const { TopicId, LogsetId } = this.getClsServiceConfig();
|
|
296
296
|
const params = configToParams({
|
|
@@ -304,20 +304,30 @@ class FunctionService {
|
|
|
304
304
|
ClsLogsetId: LogsetId
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
|
+
const customCode = code;
|
|
308
|
+
const customImageCode = customCode === null || customCode === void 0 ? void 0 : customCode.ImageConfig;
|
|
309
|
+
const funcImageCode = (_a = params.Code) === null || _a === void 0 ? void 0 : _a.ImageConfig;
|
|
307
310
|
// 根据部署方式处理 Code 参数
|
|
308
|
-
//
|
|
309
|
-
const isImageDeploy = deployMode === 'image' || (!deployMode && (
|
|
311
|
+
// 优先级:deployMode=image > 显式传入 code > 原有自动打包逻辑(base64Code/functionPath/functionRootPath)
|
|
312
|
+
const isImageDeploy = deployMode === 'image' || Boolean(customImageCode) || (!deployMode && Boolean(funcImageCode));
|
|
310
313
|
if (isImageDeploy) {
|
|
311
|
-
//
|
|
314
|
+
// 镜像部署优先使用显式 code.ImageConfig;未传时回退到 func.imageConfig(configToParams 生成)
|
|
315
|
+
if (customImageCode) {
|
|
316
|
+
params.Code = customCode;
|
|
317
|
+
}
|
|
312
318
|
if (!((_c = (_b = params.Code) === null || _b === void 0 ? void 0 : _b.ImageConfig) === null || _c === void 0 ? void 0 : _c.ImageUri)) {
|
|
313
319
|
throw new error_1.CloudBaseError('镜像部署需要配置 imageConfig.imageUri');
|
|
314
320
|
}
|
|
315
|
-
//
|
|
316
|
-
// 镜像函数不需要 Handler
|
|
321
|
+
// 镜像函数不需要 Handler / InstallDependency
|
|
317
322
|
delete params.Handler;
|
|
318
|
-
// 镜像函数不需要安装依赖
|
|
319
323
|
delete params.InstallDependency;
|
|
320
324
|
}
|
|
325
|
+
else if (customCode) {
|
|
326
|
+
if (base64Code || functionPath || functionRootPath) {
|
|
327
|
+
console.warn(`[${funcName}] 检测到同时传入 code 与本地打包参数,已优先使用 code 参数`);
|
|
328
|
+
}
|
|
329
|
+
params.Code = customCode;
|
|
330
|
+
}
|
|
321
331
|
else {
|
|
322
332
|
// 代码部署:通过 getCodeParams 获取代码参数
|
|
323
333
|
params.Code = await this.getCodeParams({
|
|
@@ -372,7 +382,8 @@ class FunctionService {
|
|
|
372
382
|
functionPath,
|
|
373
383
|
functionRootPath,
|
|
374
384
|
codeSecret: codeSecret,
|
|
375
|
-
deployMode: isImageDeploy ? 'image' :
|
|
385
|
+
deployMode: isImageDeploy ? 'image' : deployMode,
|
|
386
|
+
code
|
|
376
387
|
});
|
|
377
388
|
// 等待函数状态正常
|
|
378
389
|
await this.waitFunctionActive(funcName, codeSecret);
|
|
@@ -612,48 +623,27 @@ class FunctionService {
|
|
|
612
623
|
return data;
|
|
613
624
|
}
|
|
614
625
|
/**
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
async getFunctionLogs(
|
|
630
|
-
|
|
631
|
-
const { namespace } = this.getFunctionConfig();
|
|
632
|
-
if (startTime && !endTime) {
|
|
633
|
-
// 自动补 endTime 为 startTime + 1d
|
|
634
|
-
endTime = (0, utils_1.formatTimeByMs)(new Date(startTime).getTime() + 24 * 3600 * 1000);
|
|
635
|
-
}
|
|
636
|
-
if (endTime && !startTime) {
|
|
637
|
-
// 自动补 startTime 为 endTime - 1d
|
|
638
|
-
startTime = (0, utils_1.formatTimeByMs)(new Date(endTime).getTime() - 24 * 3600 * 1000);
|
|
639
|
-
}
|
|
640
|
-
const params = {
|
|
641
|
-
Namespace: namespace,
|
|
642
|
-
FunctionName: name,
|
|
643
|
-
Offset: offset,
|
|
644
|
-
Limit: limit,
|
|
645
|
-
Order: order,
|
|
646
|
-
OrderBy: orderBy,
|
|
647
|
-
StartTime: startTime,
|
|
648
|
-
EndTime: endTime,
|
|
649
|
-
FunctionRequestId: requestId
|
|
650
|
-
};
|
|
651
|
-
const res = await this.scfService.request('GetFunctionLogs', params);
|
|
652
|
-
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() 查询云函数日志');
|
|
653
642
|
}
|
|
654
643
|
/**
|
|
655
|
-
|
|
656
|
-
|
|
644
|
+
* 获取函数日志 ID 列表
|
|
645
|
+
* @deprecated 底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
646
|
+
* @param {{
|
|
657
647
|
* name: string
|
|
658
648
|
* offset: number
|
|
659
649
|
* limit: number
|
|
@@ -664,28 +654,12 @@ class FunctionService {
|
|
|
664
654
|
* }} options
|
|
665
655
|
* @returns {Promise<IFunctionLogResV2>}
|
|
666
656
|
*/
|
|
667
|
-
async getFunctionLogsV2(
|
|
668
|
-
|
|
669
|
-
const { env } = this.getFunctionConfig();
|
|
670
|
-
({ startTime, endTime } = (0, utils_1.getCompleteTimeRange)({
|
|
671
|
-
startTime,
|
|
672
|
-
endTime
|
|
673
|
-
}));
|
|
674
|
-
const params = {
|
|
675
|
-
EnvId: env,
|
|
676
|
-
FunctionName: name,
|
|
677
|
-
Offset: offset,
|
|
678
|
-
Limit: limit,
|
|
679
|
-
StartTime: startTime,
|
|
680
|
-
EndTime: endTime,
|
|
681
|
-
LogRequestId: requestId,
|
|
682
|
-
Qualifier: qualifier || "$LATEST" // 云函数版本,不传则用 $LATEST
|
|
683
|
-
};
|
|
684
|
-
const res = await this.tcbService.request('GetFunctionLogs', params);
|
|
685
|
-
return res;
|
|
657
|
+
async getFunctionLogsV2(_options) {
|
|
658
|
+
throw new error_1.CloudBaseError('getFunctionLogsV2 已废弃:底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
686
659
|
}
|
|
687
660
|
/**
|
|
688
661
|
* 根据函数日志 ID 查询日志详情
|
|
662
|
+
* @deprecated 底层 GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
689
663
|
* @param {{
|
|
690
664
|
* startTime: string
|
|
691
665
|
* endTime: string
|
|
@@ -693,46 +667,18 @@ class FunctionService {
|
|
|
693
667
|
* }} options
|
|
694
668
|
* @returns {Promise<IFunctionLogDetailRes>}
|
|
695
669
|
*/
|
|
696
|
-
async getFunctionLogDetail(
|
|
697
|
-
|
|
698
|
-
({ startTime, endTime } = (0, utils_1.getCompleteTimeRange)({
|
|
699
|
-
startTime,
|
|
700
|
-
endTime
|
|
701
|
-
}));
|
|
702
|
-
const params = {
|
|
703
|
-
StartTime: startTime,
|
|
704
|
-
LogRequestId: logRequestId,
|
|
705
|
-
EndTime: endTime
|
|
706
|
-
};
|
|
707
|
-
const res = await this.tcbService.request('GetFunctionLogDetail', params);
|
|
708
|
-
return res;
|
|
670
|
+
async getFunctionLogDetail(_options) {
|
|
671
|
+
throw new error_1.CloudBaseError('getFunctionLogDetail 已废弃:底层 GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
709
672
|
}
|
|
710
673
|
/**
|
|
711
674
|
* 获取函数的完整调用日志
|
|
712
675
|
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
676
|
+
* @deprecated 底层 GetFunctionLogs/GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
713
677
|
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
714
678
|
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
715
679
|
*/
|
|
716
|
-
async getCompleteFunctionLogs(
|
|
717
|
-
|
|
718
|
-
const { name } = options;
|
|
719
|
-
const logs = await this.getFunctionLogsV2(options);
|
|
720
|
-
// 如果没有日志,直接返回空数组
|
|
721
|
-
if (logs.LogList.length === 0) {
|
|
722
|
-
return [];
|
|
723
|
-
}
|
|
724
|
-
const detailPromises = logs.LogList.map(async (log) => {
|
|
725
|
-
// 对每一个日志ID,调用 getFunctionLogDetail
|
|
726
|
-
const res = await this.getFunctionLogDetail({
|
|
727
|
-
logRequestId: log.RequestId,
|
|
728
|
-
startTime: options.startTime,
|
|
729
|
-
endTime: options.endTime
|
|
730
|
-
});
|
|
731
|
-
return Object.assign(Object.assign({}, res), { RetCode: log.RetCode, FunctionName: name });
|
|
732
|
-
});
|
|
733
|
-
// 并发执行所有详情查询,等待它们全部完成
|
|
734
|
-
const detailedLogs = await Promise.all(detailPromises);
|
|
735
|
-
return detailedLogs;
|
|
680
|
+
async getCompleteFunctionLogs(_options) {
|
|
681
|
+
throw new error_1.CloudBaseError('getCompleteFunctionLogs 已废弃:底层 GetFunctionLogs/GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志');
|
|
736
682
|
}
|
|
737
683
|
/**
|
|
738
684
|
* 更新云函数配置
|
|
@@ -877,7 +823,7 @@ class FunctionService {
|
|
|
877
823
|
* @memberof FunctionService
|
|
878
824
|
*/
|
|
879
825
|
async updateFunctionCode(funcParam) {
|
|
880
|
-
const { func, functionRootPath, base64Code, codeSecret, functionPath, deployMode } = funcParam;
|
|
826
|
+
const { func, functionRootPath, base64Code, codeSecret, functionPath, deployMode, code } = funcParam;
|
|
881
827
|
const funcName = func.name;
|
|
882
828
|
const { namespace } = this.getFunctionConfig();
|
|
883
829
|
// 镜像部署:使用镜像配置更新函数代码
|
|
@@ -904,6 +850,10 @@ class FunctionService {
|
|
|
904
850
|
});
|
|
905
851
|
}
|
|
906
852
|
}
|
|
853
|
+
const customCode = code;
|
|
854
|
+
if (customCode && (base64Code || functionPath || functionRootPath)) {
|
|
855
|
+
console.warn(`[${funcName}] 检测到同时传入 code 与本地打包参数,已优先使用 code 参数`);
|
|
856
|
+
}
|
|
907
857
|
// 代码部署:原有逻辑
|
|
908
858
|
let installDependency;
|
|
909
859
|
// Node 函数默认安装依赖
|
|
@@ -912,7 +862,7 @@ class FunctionService {
|
|
|
912
862
|
if (func.installDependency !== undefined) {
|
|
913
863
|
installDependency = toBooleanString(func.installDependency);
|
|
914
864
|
}
|
|
915
|
-
const codeParams = await this.getCodeParams({
|
|
865
|
+
const codeParams = customCode || await this.getCodeParams({
|
|
916
866
|
func,
|
|
917
867
|
functionPath,
|
|
918
868
|
functionRootPath,
|
package/package.json
CHANGED
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
|
|
@@ -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
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
2
|
import { IResponseInfo, ICloudFunction, ICloudFunctionV2, IFunctionLogOptions, ICloudFunctionTrigger, IFunctionInvokeRes, IFunctionLogRes, IFunctionDownloadUrlRes, IFunctionLogDetailOptions, IFunctionLogDetailRes, IFunctionLogOptionsV2, IFunctionLogResV2 } from '../interfaces';
|
|
3
|
-
import { IFunctionInfo } from './types';
|
|
3
|
+
import { IFunctionInfo, IFunctionCode as IScfFunctionCode } from './types';
|
|
4
4
|
export interface IFunctionCode {
|
|
5
5
|
func: ICloudFunction;
|
|
6
6
|
functionRootPath?: string;
|
|
@@ -18,6 +18,7 @@ export interface ICreateFunctionParam {
|
|
|
18
18
|
functionPath?: string;
|
|
19
19
|
codeSecret?: string;
|
|
20
20
|
deployMode?: 'cos' | 'zip' | 'image';
|
|
21
|
+
code?: IScfFunctionCode;
|
|
21
22
|
}
|
|
22
23
|
export interface IUpdateFunctionCodeParam {
|
|
23
24
|
func: ICloudFunction;
|
|
@@ -26,6 +27,7 @@ export interface IUpdateFunctionCodeParam {
|
|
|
26
27
|
base64Code?: string;
|
|
27
28
|
codeSecret?: string;
|
|
28
29
|
deployMode?: 'cos' | 'zip' | 'image';
|
|
30
|
+
code?: IScfFunctionCode;
|
|
29
31
|
}
|
|
30
32
|
export interface IUpdateFunctionIncrementalCodeParam {
|
|
31
33
|
func: ICloudFunction;
|
|
@@ -309,24 +311,25 @@ export declare class FunctionService {
|
|
|
309
311
|
codeSecret: any;
|
|
310
312
|
}): Promise<IFunctionInfo[]>;
|
|
311
313
|
/**
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
* @param {{
|
|
315
|
-
* name: string
|
|
316
|
-
* offset: number
|
|
317
|
-
* limit: number
|
|
318
|
-
* order: string
|
|
319
|
-
* orderBy: string
|
|
320
|
-
* startTime: string
|
|
321
|
-
* endTime: string
|
|
322
|
-
* requestId: string
|
|
323
|
-
* }} options
|
|
324
|
-
* @returns {Promise<IFunctionLogRes>}
|
|
325
|
-
*/
|
|
326
|
-
getFunctionLogs(options: IFunctionLogOptions): Promise<IFunctionLogRes>;
|
|
327
|
-
/**
|
|
328
|
-
* 获取函数日志 ID 列表
|
|
314
|
+
* 获取函数日志
|
|
315
|
+
* @deprecated 底层 GetFunctionLogs 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
329
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 {{
|
|
330
333
|
* name: string
|
|
331
334
|
* offset: number
|
|
332
335
|
* limit: number
|
|
@@ -337,9 +340,10 @@ export declare class FunctionService {
|
|
|
337
340
|
* }} options
|
|
338
341
|
* @returns {Promise<IFunctionLogResV2>}
|
|
339
342
|
*/
|
|
340
|
-
getFunctionLogsV2(
|
|
343
|
+
getFunctionLogsV2(_options: IFunctionLogOptionsV2): Promise<IFunctionLogResV2>;
|
|
341
344
|
/**
|
|
342
345
|
* 根据函数日志 ID 查询日志详情
|
|
346
|
+
* @deprecated 底层 GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
343
347
|
* @param {{
|
|
344
348
|
* startTime: string
|
|
345
349
|
* endTime: string
|
|
@@ -347,14 +351,15 @@ export declare class FunctionService {
|
|
|
347
351
|
* }} options
|
|
348
352
|
* @returns {Promise<IFunctionLogDetailRes>}
|
|
349
353
|
*/
|
|
350
|
-
getFunctionLogDetail(
|
|
354
|
+
getFunctionLogDetail(_options: IFunctionLogDetailOptions): Promise<IFunctionLogDetailRes>;
|
|
351
355
|
/**
|
|
352
356
|
* 获取函数的完整调用日志
|
|
353
357
|
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
358
|
+
* @deprecated 底层 GetFunctionLogs/GetFunctionLogDetail 接口已下线,请使用 env.getLogService().searchClsLog() 查询云函数日志
|
|
354
359
|
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
355
360
|
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
356
361
|
*/
|
|
357
|
-
getCompleteFunctionLogs(
|
|
362
|
+
getCompleteFunctionLogs(_options: IFunctionLogOptionsV2): Promise<IFunctionLogDetailRes[]>;
|
|
358
363
|
/**
|
|
359
364
|
* 更新云函数配置
|
|
360
365
|
* @param {ICloudFunction} func 云函数配置
|