@cloudbase/manager-node 4.11.0-alpha.5 → 4.11.0-alpha.7
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 +607 -16
- package/lib/agent/type.js +1 -0
- package/lib/environment.js +5 -0
- package/lib/function/index.js +84 -25
- package/lib/index.js +3 -0
- package/lib/log/index.js +57 -0
- package/lib/log/types.js +24 -0
- package/lib/user/index.js +200 -0
- package/package.json +1 -1
- package/types/agent/index.d.ts +115 -5
- package/types/agent/type.d.ts +389 -0
- package/types/environment.d.ts +3 -0
- package/types/function/index.d.ts +30 -1
- package/types/index.d.ts +2 -0
- package/types/log/index.d.ts +21 -0
- package/types/log/types.d.ts +177 -0
- package/types/user/index.d.ts +17 -1
- package/types/user/types.d.ts +62 -0
package/types/agent/type.d.ts
CHANGED
|
@@ -1,3 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent 类型
|
|
3
|
+
*/
|
|
4
|
+
export type AgentType = 'scf' | 'tcbr';
|
|
5
|
+
/**
|
|
6
|
+
* 运行时版本
|
|
7
|
+
*/
|
|
8
|
+
export type RuntimeVersion = 'Nodejs20.19' | 'Nodejs18.15' | 'Nodejs16.13' | 'Nodejs14.18' | 'Python3.10' | 'Python3.9' | 'Python3.7' | 'Php8.0' | 'Php7.4' | 'Go1' | 'Java11' | 'Java8';
|
|
9
|
+
/**
|
|
10
|
+
* 会话来源
|
|
11
|
+
*/
|
|
12
|
+
export type SessionSource = 'HEADER' | 'COOKIE' | 'QUERY_STRING';
|
|
13
|
+
/**
|
|
14
|
+
* 会话配置
|
|
15
|
+
*/
|
|
16
|
+
export interface ISessionConfig {
|
|
17
|
+
/** 会话来源,默认 'HEADER' */
|
|
18
|
+
SessionSource?: SessionSource;
|
|
19
|
+
/** 会话名称,5-40字符,字母开头 */
|
|
20
|
+
SessionName?: string;
|
|
21
|
+
/** 单实例并发会话数,1-100,默认 1 */
|
|
22
|
+
MaximumConcurrencySessionPerInstance?: number;
|
|
23
|
+
/** 会话最长生命周期(秒),1-604800,默认 21600 */
|
|
24
|
+
MaximumTTLInSeconds?: number;
|
|
25
|
+
/** 会话最长空闲时间(秒),不超过 TTL,默认 1800 */
|
|
26
|
+
MaximumIdleTimeInSeconds?: number;
|
|
27
|
+
/** 单实例最大并发数,1-100,默认 50 */
|
|
28
|
+
MaxConcurrency?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 创建 SCF Agent 的参数
|
|
32
|
+
* 支持两种方式:
|
|
33
|
+
* 1. 传入 cwd 代码目录,自动打包上传
|
|
34
|
+
* 2. 传入 ZipFile / CosBucketRegion + TempCosObjectName,直接上传
|
|
35
|
+
*/
|
|
36
|
+
export interface ICreateScfAgentParams {
|
|
37
|
+
/** Agent 名称 */
|
|
38
|
+
Name: string;
|
|
39
|
+
/** Agent ID,不传则自动生成 */
|
|
40
|
+
AgentId?: string;
|
|
41
|
+
/** 环境变量 */
|
|
42
|
+
envVariables?: Record<string, string>;
|
|
43
|
+
/** 运行时版本 */
|
|
44
|
+
Runtime: RuntimeVersion;
|
|
45
|
+
/** 超时时间(秒),1-900,默认 3 */
|
|
46
|
+
Timeout?: number;
|
|
47
|
+
/** 函数运行时内存大小(MB),可选 64、128-3072(128为阶梯),默认 128 */
|
|
48
|
+
MemorySize?: number;
|
|
49
|
+
/** 是否自动安装依赖,默认 false */
|
|
50
|
+
InstallDependency?: boolean;
|
|
51
|
+
/** 会话配置 */
|
|
52
|
+
SessionConfig?: ISessionConfig;
|
|
53
|
+
/** 代码目录路径 */
|
|
54
|
+
cwd?: string;
|
|
55
|
+
/** 忽略的文件模式 */
|
|
56
|
+
ignore?: string | string[];
|
|
57
|
+
/** 部署方式:zip(直接上传)或 cos(COS 上传,大文件推荐) */
|
|
58
|
+
deployMode?: 'zip' | 'cos';
|
|
59
|
+
/** Base64 编码的 ZIP 文件内容 */
|
|
60
|
+
ZipFile?: string;
|
|
61
|
+
/** COS Bucket 区域 */
|
|
62
|
+
CosBucketRegion?: string;
|
|
63
|
+
/** COS 临时对象名称 */
|
|
64
|
+
TempCosObjectName?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 仓库信息
|
|
68
|
+
*/
|
|
69
|
+
export interface IRepoInfo {
|
|
70
|
+
/** Git 仓库地址或模板下载地址 */
|
|
71
|
+
Repo: string;
|
|
72
|
+
/** 来源标识,如 'template' */
|
|
73
|
+
Source: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 通过镜像创建 TCBR Agent 的参数
|
|
77
|
+
*/
|
|
78
|
+
export interface ICreateTcbrAgentByImageParams {
|
|
79
|
+
/** Agent 名称 */
|
|
80
|
+
Name: string;
|
|
81
|
+
/** Agent ID */
|
|
82
|
+
AgentId: string;
|
|
83
|
+
/** 模板标识符 */
|
|
84
|
+
Template: string;
|
|
85
|
+
/** 环境变量 */
|
|
86
|
+
envVariables?: Record<string, string>;
|
|
87
|
+
/** Docker 镜像 URL */
|
|
88
|
+
ImageUrl: string;
|
|
89
|
+
/** 仓库信息 */
|
|
90
|
+
RepoInfo: IRepoInfo;
|
|
91
|
+
/** 头像 URL */
|
|
92
|
+
Avatar?: string;
|
|
93
|
+
/** 简介 */
|
|
94
|
+
Introduction?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 通过代码包创建 TCBR Agent 的参数
|
|
98
|
+
*/
|
|
99
|
+
export interface ICreateTcbrAgentByPackageParams {
|
|
100
|
+
/** Agent 名称 */
|
|
101
|
+
Name: string;
|
|
102
|
+
/** Agent ID */
|
|
103
|
+
AgentId: string;
|
|
104
|
+
/** 模板标识符 */
|
|
105
|
+
Template: string;
|
|
106
|
+
/** 环境变量 */
|
|
107
|
+
envVariables?: Record<string, string>;
|
|
108
|
+
/** 代码包名称(上传后获取) */
|
|
109
|
+
PackageName: string;
|
|
110
|
+
/** 代码包版本(上传后获取) */
|
|
111
|
+
PackageVersion: string;
|
|
112
|
+
/** 来源标识,如 'aiAgentWithConfigYaml' */
|
|
113
|
+
Source?: string;
|
|
114
|
+
/** 头像 URL */
|
|
115
|
+
Avatar?: string;
|
|
116
|
+
/** 简介 */
|
|
117
|
+
Introduction?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 通过本地代码创建 TCBR Agent 的参数(自动上传)
|
|
121
|
+
*/
|
|
122
|
+
export interface ICreateTcbrAgentByCodeParams {
|
|
123
|
+
/** Agent 名称 */
|
|
124
|
+
Name: string;
|
|
125
|
+
/** Agent ID */
|
|
126
|
+
AgentId: string;
|
|
127
|
+
/** 模板标识符 */
|
|
128
|
+
Template: string;
|
|
129
|
+
/** 环境变量 */
|
|
130
|
+
envVariables?: Record<string, string>;
|
|
131
|
+
/** 来源标识 */
|
|
132
|
+
Source?: string;
|
|
133
|
+
/** 头像 URL */
|
|
134
|
+
Avatar?: string;
|
|
135
|
+
/** 简介 */
|
|
136
|
+
Introduction?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 查询 Agent 列表的参数
|
|
140
|
+
*/
|
|
141
|
+
export interface IDescribeAgentListParams {
|
|
142
|
+
/** 每页数量,默认 20 */
|
|
143
|
+
PageSize?: number;
|
|
144
|
+
/** 页码,默认 1 */
|
|
145
|
+
PageNumber?: number;
|
|
146
|
+
/** 指定 Agent ID(查询单个) */
|
|
147
|
+
AgentId?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Agent 信息
|
|
151
|
+
*/
|
|
152
|
+
export interface IAgentInfo {
|
|
153
|
+
/** Agent ID */
|
|
154
|
+
AgentId: string;
|
|
155
|
+
/** Agent 名称 */
|
|
156
|
+
Name: string;
|
|
157
|
+
/** Agent 类型 */
|
|
158
|
+
AgentType: AgentType;
|
|
159
|
+
/** 简介 */
|
|
160
|
+
Introduction?: string;
|
|
161
|
+
/** 头像 */
|
|
162
|
+
Avatar?: string;
|
|
163
|
+
/** 背景图 */
|
|
164
|
+
Background?: string;
|
|
165
|
+
/** 标签 */
|
|
166
|
+
Tags?: string[];
|
|
167
|
+
/** 创建时间 */
|
|
168
|
+
CreateTime?: string;
|
|
169
|
+
/** 更新时间 */
|
|
170
|
+
UpdateTime?: string;
|
|
171
|
+
/** 状态 */
|
|
172
|
+
Status?: string;
|
|
173
|
+
/** 服务 ID */
|
|
174
|
+
ServiceId?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Agent 列表响应
|
|
178
|
+
*/
|
|
179
|
+
export interface IDescribeAgentListResponse {
|
|
180
|
+
/** Agent 列表 */
|
|
181
|
+
AgentList: IAgentInfo[];
|
|
182
|
+
/** 总数 */
|
|
183
|
+
Total: number;
|
|
184
|
+
/** 请求 ID */
|
|
185
|
+
RequestId: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Agent 详情响应(包含底层资源状态)
|
|
189
|
+
*/
|
|
190
|
+
export interface IDescribeAgentResponse {
|
|
191
|
+
/** Agent 基本信息 */
|
|
192
|
+
AgentInfo: IAgentInfo | null;
|
|
193
|
+
/** Agent 是否已部署完成且可用 */
|
|
194
|
+
IsReady: boolean;
|
|
195
|
+
/** 不可用时的原因说明 */
|
|
196
|
+
NotReadyReason?: string;
|
|
197
|
+
/** 请求 ID */
|
|
198
|
+
RequestId: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 删除 Agent 的参数
|
|
202
|
+
*/
|
|
203
|
+
export interface IDeleteAgentParams {
|
|
204
|
+
/** Agent ID */
|
|
205
|
+
AgentId: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* 更新 Agent 的参数(通用)
|
|
209
|
+
* 会自动判断 Agent 类型并调用对应的更新方法
|
|
210
|
+
*/
|
|
211
|
+
export interface IUpdateAgentParams {
|
|
212
|
+
/** Agent ID(必填) */
|
|
213
|
+
AgentId: string;
|
|
214
|
+
/** 代码目录路径(可选,不传则不更新代码) */
|
|
215
|
+
cwd?: string;
|
|
216
|
+
/** Base64 编码的 ZIP 文件内容(与 cwd 二选一,仅 SCF 类型) */
|
|
217
|
+
ZipFile?: string;
|
|
218
|
+
/** 环境变量 */
|
|
219
|
+
envVariables?: Record<string, string>;
|
|
220
|
+
/** 运行时版本 */
|
|
221
|
+
Runtime?: RuntimeVersion;
|
|
222
|
+
/** 超时时间(秒),1-900 */
|
|
223
|
+
Timeout?: number;
|
|
224
|
+
/** 函数运行时内存大小(MB),可选 64、128-3072(128为阶梯) */
|
|
225
|
+
MemorySize?: number;
|
|
226
|
+
/** 是否自动安装依赖 */
|
|
227
|
+
InstallDependency?: boolean;
|
|
228
|
+
/** 忽略的文件模式(仅 cwd 方式有效,SCF 类型) */
|
|
229
|
+
Ignore?: string | string[];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 更新 SCF Agent 的参数
|
|
233
|
+
*/
|
|
234
|
+
export interface IUpdateScfAgentParams {
|
|
235
|
+
/** Agent ID */
|
|
236
|
+
AgentId: string;
|
|
237
|
+
/** 代码目录路径(与 ZipFile 二选一) */
|
|
238
|
+
cwd?: string;
|
|
239
|
+
/** Base64 编码的 ZIP 文件内容(与 cwd 二选一) */
|
|
240
|
+
ZipFile?: string;
|
|
241
|
+
/** 环境变量 */
|
|
242
|
+
envVariables?: Record<string, string>;
|
|
243
|
+
/** 运行时版本 */
|
|
244
|
+
Runtime?: RuntimeVersion;
|
|
245
|
+
/** 函数超时时间(秒),1-900 */
|
|
246
|
+
Timeout?: number;
|
|
247
|
+
/** 函数运行时内存大小(MB),可选 64、128-3072(128为阶梯) */
|
|
248
|
+
MemorySize?: number;
|
|
249
|
+
/** 是否自动安装依赖 */
|
|
250
|
+
InstallDependency?: boolean;
|
|
251
|
+
/** 忽略的文件模式(仅 cwd 方式有效) */
|
|
252
|
+
Ignore?: string | string[];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 更新 SCF Agent 的返回结果
|
|
256
|
+
*/
|
|
257
|
+
export interface IUpdateScfAgentResponse {
|
|
258
|
+
/** 请求 ID */
|
|
259
|
+
RequestId: string;
|
|
260
|
+
/** 总耗时(毫秒) */
|
|
261
|
+
elapsedTime: number;
|
|
262
|
+
/** 结果消息 */
|
|
263
|
+
message: string;
|
|
264
|
+
/** 详细步骤信息 */
|
|
265
|
+
details: string[];
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* 更新 TCBR Agent 的参数
|
|
269
|
+
*/
|
|
270
|
+
export interface IUpdateTcbrAgentParams {
|
|
271
|
+
/** Agent ID */
|
|
272
|
+
AgentId: string;
|
|
273
|
+
/** 代码目录路径(与 ImageUrl 二选一) */
|
|
274
|
+
cwd?: string;
|
|
275
|
+
/** Docker 镜像 URL */
|
|
276
|
+
ImageUrl?: string;
|
|
277
|
+
/** 环境变量 */
|
|
278
|
+
envVariables?: Record<string, string>;
|
|
279
|
+
/** 是否安装依赖,默认 true(仅代码包部署时有效) */
|
|
280
|
+
InstallDependency?: boolean;
|
|
281
|
+
/** CPU 规格(核),如 0.25、0.5、1、2 */
|
|
282
|
+
Cpu?: number;
|
|
283
|
+
/** 内存规格(GB),如 0.5、1、2、4 */
|
|
284
|
+
Mem?: number;
|
|
285
|
+
/** 最小副本数 */
|
|
286
|
+
MinNum?: number;
|
|
287
|
+
/** 最大副本数 */
|
|
288
|
+
MaxNum?: number;
|
|
289
|
+
/** 服务端口 */
|
|
290
|
+
Port?: number;
|
|
291
|
+
/** 延迟检测时间(秒) */
|
|
292
|
+
InitialDelaySeconds?: number;
|
|
293
|
+
/** 日志采集路径,如 "stdout" */
|
|
294
|
+
CustomLogs?: string;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* 获取上传信息的参数
|
|
298
|
+
*/
|
|
299
|
+
export interface IDescribeCloudBaseBuildServiceParams {
|
|
300
|
+
/** 服务名(即 AgentId) */
|
|
301
|
+
ServiceName: string;
|
|
302
|
+
/** build 类型 */
|
|
303
|
+
CIBusiness?: 'cloudbaserun' | 'framework-ci';
|
|
304
|
+
/** 服务版本 */
|
|
305
|
+
ServiceVersion?: string;
|
|
306
|
+
/** 文件后缀 */
|
|
307
|
+
Suffix?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* 上传信息响应
|
|
311
|
+
*/
|
|
312
|
+
export interface IDescribeCloudBaseBuildServiceResponse {
|
|
313
|
+
/** 上传 URL */
|
|
314
|
+
UploadUrl: string;
|
|
315
|
+
/** 上传请求头 */
|
|
316
|
+
UploadHeaders: Array<{
|
|
317
|
+
Key: string;
|
|
318
|
+
Value: string;
|
|
319
|
+
}>;
|
|
320
|
+
/** 包名 */
|
|
321
|
+
PackageName: string;
|
|
322
|
+
/** 包版本 */
|
|
323
|
+
PackageVersion: string;
|
|
324
|
+
/** 下载链接 */
|
|
325
|
+
DownloadUrl?: string;
|
|
326
|
+
/** 下载链接是否过期 */
|
|
327
|
+
OutDate?: boolean;
|
|
328
|
+
/** 请求 ID */
|
|
329
|
+
RequestId: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* 创建 Agent 响应
|
|
333
|
+
*/
|
|
334
|
+
export interface ICreateAgentResponse {
|
|
335
|
+
/** Agent ID */
|
|
336
|
+
AgentId: string;
|
|
337
|
+
/** 请求 ID */
|
|
338
|
+
RequestId: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* 通用操作响应
|
|
342
|
+
*/
|
|
343
|
+
export interface ICommonResponse {
|
|
344
|
+
/** 请求 ID */
|
|
345
|
+
RequestId: string;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* 删除 Agent 响应
|
|
349
|
+
*/
|
|
350
|
+
export interface IDeleteAgentResponse {
|
|
351
|
+
/** 请求 ID */
|
|
352
|
+
RequestId: string;
|
|
353
|
+
/** Agent 记录是否删除成功 */
|
|
354
|
+
AgentDeleted: boolean;
|
|
355
|
+
/** 底层资源删除结果,无底层资源时为 undefined */
|
|
356
|
+
ResourceResult?: {
|
|
357
|
+
/** 资源类型 */
|
|
358
|
+
Type: 'scf' | 'tcbr';
|
|
359
|
+
/** 资源名称 */
|
|
360
|
+
Name: string;
|
|
361
|
+
/** 是否删除成功 */
|
|
362
|
+
Deleted: boolean;
|
|
363
|
+
/** 删除失败时的错误信息 */
|
|
364
|
+
Error?: string;
|
|
365
|
+
/** 删除失败时的清理提示 */
|
|
366
|
+
CleanupHint?: string;
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* 获取 Agent 日志的参数
|
|
371
|
+
*/
|
|
372
|
+
export interface IGetAgentLogsParams {
|
|
373
|
+
/** Agent ID */
|
|
374
|
+
AgentId: string;
|
|
375
|
+
/** 偏移量,默认 0 */
|
|
376
|
+
offset?: number;
|
|
377
|
+
/** 返回数量,默认 10 */
|
|
378
|
+
limit?: number;
|
|
379
|
+
/** 开始时间,如 "2024-01-01 00:00:00" */
|
|
380
|
+
startTime?: string;
|
|
381
|
+
/** 结束时间,如 "2024-01-01 23:59:59" */
|
|
382
|
+
endTime?: string;
|
|
383
|
+
/** 按 RequestId 筛选(仅 SCF Agent) */
|
|
384
|
+
requestId?: string;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @deprecated 请使用 ICreateTcbrAgentByCodeParams
|
|
388
|
+
* 创建函数型 Agent 的参数(旧版)
|
|
389
|
+
*/
|
|
1
390
|
export interface ICreateFunctionAgentParams {
|
|
2
391
|
/**
|
|
3
392
|
* 智能体名称
|
package/types/environment.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { AgentService } from './agent';
|
|
|
5
5
|
import { StorageService } from './storage';
|
|
6
6
|
import { EnvService } from './env';
|
|
7
7
|
import { CommonService } from './common';
|
|
8
|
+
import { LogService } from './log';
|
|
8
9
|
import { CloudBaseContext } from './context';
|
|
9
10
|
import { HostingService } from './hosting';
|
|
10
11
|
import { ThirdService } from './third';
|
|
@@ -25,6 +26,7 @@ export declare class Environment {
|
|
|
25
26
|
private databaseService;
|
|
26
27
|
private storageService;
|
|
27
28
|
private envService;
|
|
29
|
+
private logService;
|
|
28
30
|
private hostingService;
|
|
29
31
|
private thirdService;
|
|
30
32
|
private accessService;
|
|
@@ -41,6 +43,7 @@ export declare class Environment {
|
|
|
41
43
|
getCloudRunService(): CloudRunService;
|
|
42
44
|
getAgentService(): AgentService;
|
|
43
45
|
getEnvService(): EnvService;
|
|
46
|
+
getLogService(): LogService;
|
|
44
47
|
getHostingService(): HostingService;
|
|
45
48
|
getThirdService(): ThirdService;
|
|
46
49
|
getAccessService(): AccessService;
|
|
@@ -368,6 +368,27 @@ export declare class FunctionService {
|
|
|
368
368
|
* @memberof FunctionService
|
|
369
369
|
*/
|
|
370
370
|
updateFunctionCode(funcParam: IUpdateFunctionCodeParam): Promise<IResponseInfo>;
|
|
371
|
+
/**
|
|
372
|
+
* 更新函数代码和配置(带进度信息)
|
|
373
|
+
* 支持同时更新代码和配置,按顺序执行:等待就绪 → 更新代码 → 等待就绪 → 更新配置 → 等待就绪
|
|
374
|
+
* @param options 更新选项
|
|
375
|
+
* @returns 更新结果,包含耗时信息
|
|
376
|
+
*/
|
|
377
|
+
updateFunctionWithProgress(options: {
|
|
378
|
+
/** 函数名称 */
|
|
379
|
+
name: string;
|
|
380
|
+
/** 代码相关参数(可选),复用 IUpdateFunctionCodeParam(排除 func,由 name 替代) */
|
|
381
|
+
code?: Omit<IUpdateFunctionCodeParam, 'func'>;
|
|
382
|
+
/** 配置相关参数(可选),复用 ICloudFunction(排除 name,由外层 name 替代) */
|
|
383
|
+
config?: Omit<ICloudFunction, 'name'>;
|
|
384
|
+
}): Promise<{
|
|
385
|
+
/** 总耗时(毫秒) */
|
|
386
|
+
elapsedTime: number;
|
|
387
|
+
/** 结果消息 */
|
|
388
|
+
message: string;
|
|
389
|
+
/** 详细步骤信息 */
|
|
390
|
+
details: string[];
|
|
391
|
+
}>;
|
|
371
392
|
/**
|
|
372
393
|
* 调用云函数
|
|
373
394
|
* @param {string} name 云函数名称
|
|
@@ -496,8 +517,16 @@ export declare class FunctionService {
|
|
|
496
517
|
uploadFunctionZipToCos(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
|
|
497
518
|
UnixTimestamp: string;
|
|
498
519
|
}>;
|
|
520
|
+
getCodeParams(options: IFunctionCode, installDependency: 'TRUE' | 'FALSE'): Promise<{
|
|
521
|
+
ZipFile: string;
|
|
522
|
+
CosBucketRegion?: undefined;
|
|
523
|
+
TempCosObjectName?: undefined;
|
|
524
|
+
} | {
|
|
525
|
+
CosBucketRegion: string;
|
|
526
|
+
TempCosObjectName: string;
|
|
527
|
+
ZipFile?: undefined;
|
|
528
|
+
}>;
|
|
499
529
|
private createAccessPath;
|
|
500
|
-
private getCodeParams;
|
|
501
530
|
private getTempCosInfo;
|
|
502
531
|
private retryCreateTrigger;
|
|
503
532
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CloudRunService } from './cloudrun';
|
|
|
4
4
|
import { AgentService } from './agent';
|
|
5
5
|
import { StorageService } from './storage';
|
|
6
6
|
import { DatabaseService } from './database';
|
|
7
|
+
import { LogService } from './log';
|
|
7
8
|
import { CommonService } from './common';
|
|
8
9
|
import { HostingService } from './hosting';
|
|
9
10
|
import { Environment } from './environment';
|
|
@@ -54,6 +55,7 @@ declare class CloudBase {
|
|
|
54
55
|
get cloudApp(): CloudBaseRunService;
|
|
55
56
|
commonService(service?: string, version?: string): CommonService;
|
|
56
57
|
get env(): EnvService;
|
|
58
|
+
get log(): LogService;
|
|
57
59
|
get third(): ThirdService;
|
|
58
60
|
get user(): UserService;
|
|
59
61
|
get docs(): DocsService;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Environment } from '../environment';
|
|
2
|
+
import { ISearchClsLogParams, ISearchClsLogResponse } from './types';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export declare class LogService {
|
|
5
|
+
private envId;
|
|
6
|
+
private cloudService;
|
|
7
|
+
private tcbrService;
|
|
8
|
+
constructor(environment: Environment);
|
|
9
|
+
/**
|
|
10
|
+
* 搜索 CLS 日志
|
|
11
|
+
*
|
|
12
|
+
* @param params 查询参数,通过 queryString 使用 CLS 原生检索分析语法
|
|
13
|
+
* @returns 日志搜索结果
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* - 纯检索结果在 `LogResults.Results` 中
|
|
17
|
+
* - SQL 分析结果(queryString 含 `| select ...`)在 `LogResults.AnalysisRecords` 中
|
|
18
|
+
* - 详细的 QueryString 语法参考见 README.md
|
|
19
|
+
*/
|
|
20
|
+
searchClsLog(params: ISearchClsLogParams): Promise<ISearchClsLogResponse>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 单个 module 的查询 schema 描述
|
|
3
|
+
*/
|
|
4
|
+
export interface ClsModuleQuerySchema {
|
|
5
|
+
/** module 中文名 */
|
|
6
|
+
label: string;
|
|
7
|
+
/** 可用的 eventType(没有则为 never) */
|
|
8
|
+
eventType: string;
|
|
9
|
+
/** 可用的 logType(没有则为 never) */
|
|
10
|
+
logType: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 各 module 的完整查询 schema 映射
|
|
14
|
+
*
|
|
15
|
+
* 用法示例:
|
|
16
|
+
* ```ts
|
|
17
|
+
* // 获取某个 module 下可用的 eventType
|
|
18
|
+
* type DbEvents = ClsModuleSchema['database']['eventType'] // 'MongoSlowQuery'
|
|
19
|
+
* type RdbEvents = ClsModuleSchema['rdb']['eventType'] // 'MysqlFreeze' | 'MysqlRecover' | 'MysqlSlowQuery'
|
|
20
|
+
* type AppEvents = ClsModuleSchema['app']['eventType'] // 'AppProdPub' | 'AppProdDel'
|
|
21
|
+
* type LlmLogType = ClsModuleSchema['llm']['logType'] // 'llm-tracelog'
|
|
22
|
+
*
|
|
23
|
+
* // 获取所有 module 名
|
|
24
|
+
* type Modules = ClsLogModule // 'database' | 'rdb' | 'model' | ...
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* 查询语句示例(CLS 语法):
|
|
28
|
+
* - 查询云数据库[文档型]:`module:database`
|
|
29
|
+
* - 查询文档型慢查询:`module:database AND eventType:MongoSlowQuery`
|
|
30
|
+
* - 查询云数据库[SQL型]:`module:rdb`
|
|
31
|
+
* - 查询SQL型事件:`module:rdb AND eventType:(MysqlFreeze OR MysqlRecover OR MysqlSlowQuery)`
|
|
32
|
+
* - 查询审批流:`module:workflow`
|
|
33
|
+
* - 查询数据模型:`module:model`
|
|
34
|
+
* - 查询用户权限:`module:auth`
|
|
35
|
+
* - 查询大模型:`module:llm AND logType:llm-tracelog`
|
|
36
|
+
* - 查询网关服务调用:`logType:accesslog`
|
|
37
|
+
* - 查询应用发布/删除:`module:app AND eventType:(AppProdPub OR AppProdDel)`
|
|
38
|
+
*/
|
|
39
|
+
export interface ClsModuleSchema {
|
|
40
|
+
/** 云数据库(文档型/MongoDB) */
|
|
41
|
+
database: {
|
|
42
|
+
label: '云数据库(文档型)';
|
|
43
|
+
/** MongoSlowQuery: 文档型数据库慢查询 */
|
|
44
|
+
eventType: 'MongoSlowQuery';
|
|
45
|
+
logType: never;
|
|
46
|
+
};
|
|
47
|
+
/** 云数据库(SQL型/MySQL) */
|
|
48
|
+
rdb: {
|
|
49
|
+
label: '云数据库(SQL型)';
|
|
50
|
+
/** MysqlFreeze: 数据库冻结 | MysqlRecover: 数据库恢复 | MysqlSlowQuery: 数据库慢查询 */
|
|
51
|
+
eventType: 'MysqlFreeze' | 'MysqlRecover' | 'MysqlSlowQuery';
|
|
52
|
+
logType: never;
|
|
53
|
+
};
|
|
54
|
+
/** 数据模型 */
|
|
55
|
+
model: {
|
|
56
|
+
label: '数据模型';
|
|
57
|
+
eventType: never;
|
|
58
|
+
logType: never;
|
|
59
|
+
};
|
|
60
|
+
/** 审批流 */
|
|
61
|
+
workflow: {
|
|
62
|
+
label: '审批流';
|
|
63
|
+
eventType: never;
|
|
64
|
+
logType: never;
|
|
65
|
+
};
|
|
66
|
+
/** 用户权限 */
|
|
67
|
+
auth: {
|
|
68
|
+
label: '用户权限';
|
|
69
|
+
eventType: never;
|
|
70
|
+
logType: never;
|
|
71
|
+
};
|
|
72
|
+
/** 大模型 */
|
|
73
|
+
llm: {
|
|
74
|
+
label: '大模型';
|
|
75
|
+
eventType: never;
|
|
76
|
+
/** llm-tracelog: 大模型追踪日志 */
|
|
77
|
+
logType: 'llm-tracelog';
|
|
78
|
+
};
|
|
79
|
+
/** 应用 */
|
|
80
|
+
app: {
|
|
81
|
+
label: '应用';
|
|
82
|
+
/** AppProdPub: 应用发布 | AppProdDel: 应用删除 */
|
|
83
|
+
eventType: 'AppProdPub' | 'AppProdDel';
|
|
84
|
+
logType: never;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** CLS 日志模块 */
|
|
88
|
+
export type ClsLogModule = keyof ClsModuleSchema;
|
|
89
|
+
/** CLS 日志事件类型(所有 module 的 eventType 联合) */
|
|
90
|
+
export type ClsEventType = ClsModuleSchema[ClsLogModule]['eventType'];
|
|
91
|
+
/** CLS 日志类型 */
|
|
92
|
+
export type ClsLogType = ClsModuleSchema[ClsLogModule]['logType'] | 'accesslog';
|
|
93
|
+
/** 获取指定 module 的 eventType */
|
|
94
|
+
export type EventTypeOf<M extends ClsLogModule> = ClsModuleSchema[M]['eventType'];
|
|
95
|
+
/** 获取指定 module 的 logType */
|
|
96
|
+
export type LogTypeOf<M extends ClsLogModule> = ClsModuleSchema[M]['logType'];
|
|
97
|
+
/**
|
|
98
|
+
* CLS 日志搜索基础参数
|
|
99
|
+
*/
|
|
100
|
+
export interface ISearchClsLogBaseParams {
|
|
101
|
+
/** 查询起始时间,格式 'YYYY-MM-DD HH:mm:ss' */
|
|
102
|
+
StartTime: string;
|
|
103
|
+
/** 查询结束时间,格式 'YYYY-MM-DD HH:mm:ss' */
|
|
104
|
+
EndTime: string;
|
|
105
|
+
/** 单次返回条数,最大 100 */
|
|
106
|
+
Limit: number;
|
|
107
|
+
/** 分页游标,首次为空,后续透传上次返回的 Context */
|
|
108
|
+
Context?: string;
|
|
109
|
+
/** 排序方式:'asc' 升序 / 'desc' 降序(默认 desc) */
|
|
110
|
+
Sort?: 'asc' | 'desc';
|
|
111
|
+
/** 是否使用 Lucene 语法(默认 false) */
|
|
112
|
+
UseLucene?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* 指定调用的后端服务(默认 'tcb')
|
|
115
|
+
* - 'tcb': 云函数、数据库等日志(默认)
|
|
116
|
+
* - 'tcbr': 云托管日志
|
|
117
|
+
*/
|
|
118
|
+
service?: 'tcb' | 'tcbr';
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* CLS 日志搜索参数
|
|
122
|
+
*/
|
|
123
|
+
export interface ISearchClsLogParams extends ISearchClsLogBaseParams {
|
|
124
|
+
/** CLS 检索分析语句(支持 `| select ...` SQL 分析) */
|
|
125
|
+
queryString: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* CLS 日志对象
|
|
129
|
+
*/
|
|
130
|
+
export interface IClsLogObject {
|
|
131
|
+
/** 日志所属的 Topic ID */
|
|
132
|
+
TopicId: string;
|
|
133
|
+
/** Topic 名称 */
|
|
134
|
+
TopicName: string;
|
|
135
|
+
/** 日志时间 */
|
|
136
|
+
Timestamp: string;
|
|
137
|
+
/** 日志内容(JSON 字符串,需 JSON.parse) */
|
|
138
|
+
Content: string;
|
|
139
|
+
/** 采集路径 */
|
|
140
|
+
FileName: string;
|
|
141
|
+
/** 日志来源设备 */
|
|
142
|
+
Source: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* CLS 日志搜索响应
|
|
146
|
+
*/
|
|
147
|
+
export interface ISearchClsLogResponse {
|
|
148
|
+
/** 日志结果 */
|
|
149
|
+
LogResults: {
|
|
150
|
+
/** 分页游标,用于获取下一页 */
|
|
151
|
+
Context: string;
|
|
152
|
+
/** 是否已返回全部结果 */
|
|
153
|
+
ListOver: boolean;
|
|
154
|
+
/** 日志列表(纯检索模式的结果) */
|
|
155
|
+
Results: IClsLogObject[];
|
|
156
|
+
/**
|
|
157
|
+
* SQL 分析结果(当 QueryString 包含 `| select ...` 管道时返回)
|
|
158
|
+
*
|
|
159
|
+
* 每个元素是一个 JSON 字符串,需 JSON.parse 解析
|
|
160
|
+
* 纯检索模式(无 `|` 管道)时为空数组
|
|
161
|
+
*/
|
|
162
|
+
AnalysisRecords?: string[];
|
|
163
|
+
};
|
|
164
|
+
/** 请求 ID */
|
|
165
|
+
RequestId: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* ClsModuleSchema 的运行时版本,用于动态生成查询条件 / MCP tool description
|
|
169
|
+
*
|
|
170
|
+
* - key 与 ClsLogModule 类型保持同步
|
|
171
|
+
* - eventTypes / logTypes 为字符串数组,空数组表示该维度不可过滤
|
|
172
|
+
*/
|
|
173
|
+
export declare const CLS_MODULE_SCHEMA: Record<ClsLogModule, {
|
|
174
|
+
label: string;
|
|
175
|
+
eventTypes: string[];
|
|
176
|
+
logTypes: string[];
|
|
177
|
+
}>;
|
package/types/user/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
|
-
import { EndUserInfo, EndUserStatus } from './types';
|
|
2
|
+
import { EndUserInfo, EndUserStatus, CreateUserOptions, CreateUserResp, DescribeUserListOptions, DescribeUserListResp, ModifyUserOptions, ModifyUserResp, DeleteUsersOptions, DeleteUsersResp } from './types';
|
|
3
3
|
export declare class UserService {
|
|
4
4
|
private environment;
|
|
5
5
|
private tcbService;
|
|
@@ -54,5 +54,21 @@ export declare class UserService {
|
|
|
54
54
|
WxAppId: string;
|
|
55
55
|
Channel: "ide" | "low_code";
|
|
56
56
|
}>;
|
|
57
|
+
createUser(options: CreateUserOptions): Promise<{
|
|
58
|
+
Data: CreateUserResp;
|
|
59
|
+
RequestId: string;
|
|
60
|
+
}>;
|
|
61
|
+
describeUserList(options?: DescribeUserListOptions): Promise<{
|
|
62
|
+
Data: DescribeUserListResp;
|
|
63
|
+
RequestId: string;
|
|
64
|
+
}>;
|
|
65
|
+
modifyUser(options: ModifyUserOptions): Promise<{
|
|
66
|
+
Data: ModifyUserResp | null;
|
|
67
|
+
RequestId: string;
|
|
68
|
+
}>;
|
|
69
|
+
deleteUsers(options: DeleteUsersOptions): Promise<{
|
|
70
|
+
Data: DeleteUsersResp;
|
|
71
|
+
RequestId: string;
|
|
72
|
+
}>;
|
|
57
73
|
private isValidStr;
|
|
58
74
|
}
|