@cloudbase/manager-node 4.2.4 → 4.2.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.
Files changed (85) hide show
  1. package/lib/access/index.js +141 -0
  2. package/lib/access/types.js +2 -0
  3. package/lib/billing/index.js +36 -0
  4. package/lib/cam/index.js +77 -0
  5. package/lib/cloudBaseRun/index.js +36 -0
  6. package/lib/cloudBaseRun/types.js +2 -0
  7. package/lib/common/index.js +39 -0
  8. package/lib/constant.js +55 -0
  9. package/lib/context.js +14 -0
  10. package/lib/database/index.js +244 -0
  11. package/lib/debug.js +34 -0
  12. package/lib/env/index.js +288 -0
  13. package/lib/environment.js +124 -0
  14. package/lib/environmentManager.js +44 -0
  15. package/lib/error.js +16 -0
  16. package/lib/function/index.js +1019 -0
  17. package/lib/function/packer.js +129 -0
  18. package/lib/function/types.js +2 -0
  19. package/lib/hosting/index.js +461 -0
  20. package/lib/index.js +83 -0
  21. package/lib/interfaces/base.interface.js +2 -0
  22. package/lib/interfaces/billing.interface.js +2 -0
  23. package/lib/interfaces/cam.interface.js +2 -0
  24. package/lib/interfaces/flexdb.interface.js +2 -0
  25. package/lib/interfaces/function.interface.js +2 -0
  26. package/lib/interfaces/index.js +19 -0
  27. package/lib/interfaces/storage.interface.js +2 -0
  28. package/lib/interfaces/tcb.interface.js +2 -0
  29. package/lib/storage/index.js +1051 -0
  30. package/lib/third/index.js +18 -0
  31. package/lib/user/index.js +136 -0
  32. package/lib/user/types.js +2 -0
  33. package/lib/utils/auth.js +97 -0
  34. package/lib/utils/cloud-api-request.js +212 -0
  35. package/lib/utils/cloudbase-request.js +69 -0
  36. package/lib/utils/envLazy.js +18 -0
  37. package/lib/utils/fs.js +64 -0
  38. package/lib/utils/http-request.js +44 -0
  39. package/lib/utils/index.js +103 -0
  40. package/lib/utils/parallel.js +69 -0
  41. package/lib/utils/runenv.js +8 -0
  42. package/lib/utils/uuid.js +18 -0
  43. package/package.json +1 -1
  44. package/types/access/index.d.ts +38 -0
  45. package/types/access/types.d.ts +42 -0
  46. package/types/billing/index.d.ts +21 -0
  47. package/types/cam/index.d.ts +63 -0
  48. package/types/cloudBaseRun/index.d.ts +12 -0
  49. package/types/cloudBaseRun/types.d.ts +21 -0
  50. package/types/common/index.d.ts +18 -0
  51. package/types/constant.d.ts +44 -0
  52. package/types/context.d.ts +17 -0
  53. package/types/database/index.d.ts +66 -0
  54. package/types/debug.d.ts +1 -0
  55. package/types/env/index.d.ts +127 -0
  56. package/types/environment.d.ts +51 -0
  57. package/types/environmentManager.d.ts +13 -0
  58. package/types/error.d.ts +18 -0
  59. package/types/function/index.d.ts +379 -0
  60. package/types/function/packer.d.ts +37 -0
  61. package/types/function/types.d.ts +154 -0
  62. package/types/hosting/index.d.ts +253 -0
  63. package/types/index.d.ts +52 -0
  64. package/types/interfaces/base.interface.d.ts +7 -0
  65. package/types/interfaces/billing.interface.d.ts +18 -0
  66. package/types/interfaces/cam.interface.d.ts +24 -0
  67. package/types/interfaces/flexdb.interface.d.ts +67 -0
  68. package/types/interfaces/function.interface.d.ts +65 -0
  69. package/types/interfaces/index.d.ts +7 -0
  70. package/types/interfaces/storage.interface.d.ts +26 -0
  71. package/types/interfaces/tcb.interface.d.ts +305 -0
  72. package/types/storage/index.d.ts +324 -0
  73. package/types/third/index.d.ts +11 -0
  74. package/types/user/index.d.ts +52 -0
  75. package/types/user/types.d.ts +20 -0
  76. package/types/utils/auth.d.ts +8 -0
  77. package/types/utils/cloud-api-request.d.ts +21 -0
  78. package/types/utils/cloudbase-request.d.ts +14 -0
  79. package/types/utils/envLazy.d.ts +1 -0
  80. package/types/utils/fs.d.ts +7 -0
  81. package/types/utils/http-request.d.ts +2 -0
  82. package/types/utils/index.d.ts +20 -0
  83. package/types/utils/parallel.d.ts +17 -0
  84. package/types/utils/runenv.d.ts +1 -0
  85. package/types/utils/uuid.d.ts +2 -0
@@ -0,0 +1,127 @@
1
+ import { Environment } from '../environment';
2
+ import { IResponseInfo, AuthDomain, EnvInfo, LoginConfigItem, ICheckTcbServiceRes, ICreatePostpayRes } from '../interfaces';
3
+ declare type SOURCE = 'miniapp' | 'qcloud';
4
+ interface IDeleteDomainRes {
5
+ RequestId: string;
6
+ Deleted: number;
7
+ }
8
+ interface IAuthDomainsRes {
9
+ RequestId: string;
10
+ Domains: AuthDomain[];
11
+ }
12
+ interface IListEnvRes {
13
+ RequestId: string;
14
+ EnvList: EnvInfo[];
15
+ }
16
+ interface IEnvLoginConfigRes {
17
+ RequestId: string;
18
+ ConfigList: LoginConfigItem[];
19
+ }
20
+ interface IInitParam {
21
+ Channel?: string;
22
+ Source?: string;
23
+ }
24
+ export declare class EnvService {
25
+ private environment;
26
+ private envId;
27
+ private cloudService;
28
+ private envType?;
29
+ constructor(environment: Environment);
30
+ /**
31
+ * 列出所有环境
32
+ * @returns {Promise<IListEnvRes>}
33
+ */
34
+ listEnvs(): Promise<IListEnvRes>;
35
+ /**
36
+ * 拉取安全域名列表
37
+ * @returns {Promise<IAuthDomainsRes>}
38
+ */
39
+ getEnvAuthDomains(): Promise<IAuthDomainsRes>;
40
+ /**
41
+ * 添加环境安全域名
42
+ * @param {string[]} domains 域名字符串数组
43
+ * @returns {Promise<IResponseInfo>}
44
+ */
45
+ createEnvDomain(domains: string[]): Promise<IResponseInfo>;
46
+ /**
47
+ * 删除环境安全域名
48
+ * @param {string[]} domainIds 域名字符串数组
49
+ * @returns {Promise<IDeleteDomainRes>}
50
+ */
51
+ deleteEnvDomain(domains: string[]): Promise<IDeleteDomainRes>;
52
+ /**
53
+ * 检查tcb服务是否开通
54
+ * @returns {Promise<ICheckTcbServiceRes>}
55
+ * @memberof CamService
56
+ */
57
+ checkTcbService(): Promise<ICheckTcbServiceRes>;
58
+ /**
59
+ * 初始化TCB
60
+ * @returns {Promise<IResponseInfo>}
61
+ * @memberof EnvService
62
+ */
63
+ initTcb(param: IInitParam): Promise<IResponseInfo>;
64
+ /**
65
+ * 开通后付费套餐
66
+ * @param {string} envId
67
+ * @param {SOURCE} [source]
68
+ * @returns {Promise<ICreatePostpayRes>}
69
+ * @memberof EnvService
70
+ */
71
+ CreatePostpayPackage(envId: string, source?: SOURCE): Promise<ICreatePostpayRes>;
72
+ /**
73
+ * 销毁环境
74
+ * @param {string} envId
75
+ * @returns {Promise<IResponseInfo>}
76
+ * @memberof EnvService
77
+ */
78
+ destroyEnv(envId: string): Promise<IResponseInfo>;
79
+ /**
80
+ * 获取环境信息
81
+ * @returns {Promise<IEnvInfoRes>}
82
+ */
83
+ getEnvInfo(): Promise<{
84
+ EnvInfo: EnvInfo;
85
+ RequestId: string;
86
+ }>;
87
+ /**
88
+ * 修改环境名称
89
+ * @param {string} alias 环境名称
90
+ * @returns {Promise<IResponseInfo>}
91
+ */
92
+ updateEnvInfo(alias: string): Promise<IResponseInfo>;
93
+ /**
94
+ * 拉取登录配置列表
95
+ * @returns {Promise<IEnvLoginConfigRes>}
96
+ */
97
+ getLoginConfigList(): Promise<IEnvLoginConfigRes>;
98
+ /**
99
+ * 创建登录方式
100
+ * 'WECHAT-OPEN':微信开放平台
101
+ * 'WECHAT-PUBLIC':微信公众平台
102
+ * @param {('WECHAT-OPEN' | 'WECHAT-PUBLIC')} platform 'WECHAT-OPEN' | 'WECHAT-PUBLIC'
103
+ * @param {string} appId 微信 appId
104
+ * @param {string} appSecret 微信 appSecret
105
+ * @returns {Promise<IResponseInfo>}
106
+ */
107
+ createLoginConfig(platform: 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'QQ' | 'ANONYMOUS' | 'USERNAME', appId: string, appSecret?: string): Promise<IResponseInfo>;
108
+ /**
109
+ * 更新登录方式配置
110
+ * @param {string} configId 配置 Id,从配置列表中获取
111
+ * @param {string} [status='ENABLE'] 是否启用 'ENABLE', 'DISABLE' ,可选
112
+ * @param {string} [appId=''] 微信 appId,可选
113
+ * @param {string} [appSecret=''] 微信 appSecret,可选
114
+ * @returns {Promise<IResponseInfo>}
115
+ */
116
+ updateLoginConfig(configId: string, status?: string, appId?: string, appSecret?: string): Promise<IResponseInfo>;
117
+ createCustomLoginKeys(): Promise<{
118
+ PrivateKey: string;
119
+ KeyID: string;
120
+ RequestId: string;
121
+ }>;
122
+ private getCOSDomains;
123
+ private modifyCosCorsDomain;
124
+ private getCos;
125
+ private getStorageConfig;
126
+ }
127
+ export {};
@@ -0,0 +1,51 @@
1
+ import { DatabaseService } from './database';
2
+ import { FunctionService } from './function';
3
+ import { StorageService } from './storage';
4
+ import { EnvService } from './env';
5
+ import { CommonService } from './common';
6
+ import { CloudBaseContext } from './context';
7
+ import { HostingService } from './hosting';
8
+ import { ThirdService } from './third';
9
+ import { AccessService } from './access';
10
+ import { UserService } from './user';
11
+ import { CloudBaseRunService } from './cloudBaseRun';
12
+ import { EnvInfo } from './interfaces';
13
+ export declare class Environment {
14
+ inited: boolean;
15
+ cloudBaseContext: CloudBaseContext;
16
+ lazyEnvironmentConfig: EnvInfo;
17
+ private envId;
18
+ private envType?;
19
+ private functionService;
20
+ private databaseService;
21
+ private storageService;
22
+ private envService;
23
+ private hostingService;
24
+ private thirdService;
25
+ private accessService;
26
+ private userService;
27
+ private cloudBaseRunService;
28
+ constructor(context: CloudBaseContext, envId: string);
29
+ lazyInit(): Promise<any>;
30
+ getEnvId(): string;
31
+ getEnvType(): string;
32
+ getStorageService(): StorageService;
33
+ getDatabaseService(): DatabaseService;
34
+ getFunctionService(): FunctionService;
35
+ getEnvService(): EnvService;
36
+ getHostingService(): HostingService;
37
+ getThirdService(): ThirdService;
38
+ getAccessService(): AccessService;
39
+ getUserService(): UserService;
40
+ getCloudBaseRunService(): CloudBaseRunService;
41
+ getCommonService(serviceType: string, serviceVersion: any): CommonService;
42
+ getServicesEnvInfo(): Promise<any>;
43
+ getAuthConfig(): {
44
+ envId: string;
45
+ secretId: string;
46
+ secretKey: string;
47
+ token: string;
48
+ proxy: string;
49
+ region: string;
50
+ };
51
+ }
@@ -0,0 +1,13 @@
1
+ import { Environment } from './environment';
2
+ import { CloudBaseContext } from './context';
3
+ export declare class EnvironmentManager {
4
+ private cloudBaseContext;
5
+ private envs;
6
+ private currentEnv;
7
+ constructor(context: CloudBaseContext);
8
+ getCurrentEnv(): Environment;
9
+ add(envId: string): void;
10
+ remove(envId: string): void;
11
+ get(envId: string): Environment | null;
12
+ switchEnv(envId: string): boolean;
13
+ }
@@ -0,0 +1,18 @@
1
+ interface Options {
2
+ exit?: number;
3
+ original?: Error | undefined;
4
+ code?: string | number;
5
+ requestId?: string;
6
+ action?: string;
7
+ }
8
+ export declare class CloudBaseError extends Error {
9
+ readonly exit: number;
10
+ readonly message: string;
11
+ readonly name = "CloudBaseError";
12
+ readonly original: Error | undefined;
13
+ readonly code: string | number;
14
+ readonly requestId: string;
15
+ readonly action: string;
16
+ constructor(message: string, options?: Options);
17
+ }
18
+ export {};
@@ -0,0 +1,379 @@
1
+ import { Environment } from '../environment';
2
+ import { IResponseInfo, ICloudFunction, IFunctionLogOptions, ICloudFunctionTrigger, IFunctionInvokeRes, IFunctionLogRes, IFunctionDownloadUrlRes } from '../interfaces';
3
+ import { IFunctionInfo } from './types';
4
+ export interface IFunctionCode {
5
+ func: ICloudFunction;
6
+ functionRootPath?: string;
7
+ base64Code?: string;
8
+ functionPath?: string;
9
+ }
10
+ export interface ICreateFunctionParam {
11
+ func: ICloudFunction & {
12
+ path?: string;
13
+ };
14
+ functionRootPath?: string;
15
+ force?: boolean;
16
+ base64Code?: string;
17
+ functionPath?: string;
18
+ codeSecret?: string;
19
+ }
20
+ export interface IUpdateFunctionCodeParam {
21
+ func: ICloudFunction;
22
+ functionPath?: string;
23
+ functionRootPath?: string;
24
+ base64Code?: string;
25
+ codeSecret?: string;
26
+ }
27
+ export interface IUpdateFunctionIncrementalCodeParam {
28
+ func: ICloudFunction;
29
+ functionRootPath: string;
30
+ deleteFiles?: Array<string>;
31
+ addFiles?: string;
32
+ }
33
+ export interface ICreateFunctionRes {
34
+ triggerRes: IResponseInfo;
35
+ configRes: IResponseInfo;
36
+ codeRes: IResponseInfo;
37
+ }
38
+ export interface IFunctionLayerOptions {
39
+ contentPath?: string;
40
+ base64Content?: string;
41
+ name: string;
42
+ runtimes: string[];
43
+ description?: string;
44
+ licenseInfo?: string;
45
+ }
46
+ export interface ICreateLayerResponse extends IResponseInfo {
47
+ LayerVersion: number;
48
+ }
49
+ export interface ILayerOptions {
50
+ name: string;
51
+ version: number;
52
+ }
53
+ export interface IVersionListOptions {
54
+ name: string;
55
+ runtimes?: string[];
56
+ }
57
+ export interface ILayerListOptions {
58
+ offset?: number;
59
+ limit?: number;
60
+ runtime?: string;
61
+ searchKey?: string;
62
+ }
63
+ export interface ILayerVersionInfo {
64
+ CompatibleRuntimes: string[];
65
+ AddTime: string;
66
+ Description: string;
67
+ LicenseInfo: string;
68
+ LayerVersion: number;
69
+ LayerName: string;
70
+ Status: string;
71
+ }
72
+ export interface IListLayerVersionsRes extends IResponseInfo {
73
+ LayerVersions: Array<ILayerVersionInfo>;
74
+ }
75
+ export interface IListLayerRes extends IResponseInfo {
76
+ Layers: Array<ILayerVersionInfo>;
77
+ TotalCount: number;
78
+ }
79
+ export interface IGetLayerVersionRes extends IResponseInfo {
80
+ CompatibleRuntimes: string[];
81
+ CodeSha256: string;
82
+ Location: string;
83
+ AddTime: string;
84
+ Description: string;
85
+ LicenseInfo: string;
86
+ LayerVersion: number;
87
+ LayerName: string;
88
+ Status: string;
89
+ }
90
+ export interface ISetProvisionedConcurrencyConfig {
91
+ functionName: string;
92
+ qualifier: string;
93
+ versionProvisionedConcurrencyNum: number;
94
+ }
95
+ export interface IGetProvisionedConcurrencyConfig {
96
+ functionName: string;
97
+ qualifier?: string;
98
+ }
99
+ export interface IVersionProvisionedConcurrencyInfo {
100
+ AllocatedProvisionedConcurrencyNum: number;
101
+ AvailableProvisionedConcurrencyNum: number;
102
+ Status: string;
103
+ StatusReason: string;
104
+ Qualifier: string;
105
+ }
106
+ export interface IGetProvisionedConcurrencyRes extends IResponseInfo {
107
+ UnallocatedConcurrencyNum: number;
108
+ Allocated: IVersionProvisionedConcurrencyInfo[];
109
+ }
110
+ export interface IPublishVersionParams {
111
+ functionName: string;
112
+ description?: string;
113
+ }
114
+ export interface IPublishVersionRes extends IResponseInfo {
115
+ FunctionVersion: string;
116
+ CodeSize: number;
117
+ MemorySize: number;
118
+ Description: string;
119
+ Handler: string;
120
+ Timeout: number;
121
+ Runtime: string;
122
+ Namespace: string;
123
+ }
124
+ export interface IListFunctionVersionParams {
125
+ functionName: string;
126
+ offset?: number;
127
+ limit?: number;
128
+ order?: string;
129
+ orderBy?: string;
130
+ }
131
+ export interface IFunctionVersion {
132
+ Version: string;
133
+ Description: string;
134
+ AddTime: string;
135
+ ModTime: string;
136
+ Status: string;
137
+ }
138
+ export interface IFunctionVersionsRes extends IResponseInfo {
139
+ FunctionVersion: string[];
140
+ Versions: IFunctionVersion[];
141
+ TotalCount: number;
142
+ }
143
+ export interface IVersionMatch {
144
+ Version: string;
145
+ Key: string;
146
+ Method: string;
147
+ Expression: string;
148
+ }
149
+ export interface IVersionWeight {
150
+ Version: string;
151
+ Weight: number;
152
+ }
153
+ export interface IRoutingConfig {
154
+ AdditionalVersionWeights?: IVersionWeight[];
155
+ AddtionVersionMatchs?: IVersionMatch[];
156
+ }
157
+ export interface IUpdateFunctionAliasConfig {
158
+ functionName: string;
159
+ name: string;
160
+ functionVersion: string;
161
+ description?: string;
162
+ routingConfig?: IRoutingConfig;
163
+ }
164
+ export interface IGetFunctionAlias {
165
+ functionName: string;
166
+ name: string;
167
+ }
168
+ export interface IGetFunctionAliasRes extends IResponseInfo {
169
+ FunctionVersion: string;
170
+ Name: string;
171
+ RoutingConfig: IRoutingConfig;
172
+ Description: string;
173
+ AddTime: string;
174
+ ModTime: string;
175
+ }
176
+ export declare class FunctionService {
177
+ private environment;
178
+ private vpcService;
179
+ private scfService;
180
+ constructor(environment: Environment);
181
+ /**
182
+ * 增量更新函数代码
183
+ * @param {IUpdateFunctionIncrementalCodeParam} funcParam
184
+ * @returns {Promise<void>}
185
+ * @memberof FunctionService
186
+ */
187
+ updateFunctionIncrementalCode(funcParam: IUpdateFunctionIncrementalCodeParam): Promise<IResponseInfo>;
188
+ /**
189
+ * 创建云函数
190
+ * @param {ICreateFunctionParam} funcParam
191
+ * @returns {(Promise<IResponseInfo | ICreateFunctionRes>)}
192
+ */
193
+ createFunction(funcParam: ICreateFunctionParam): Promise<IResponseInfo | ICreateFunctionRes>;
194
+ /**
195
+ * @param {number} [limit=20]
196
+ * @param {number} [offset=0]
197
+ * @returns {Promise<{
198
+ * Functions: Record<string, string>[]
199
+ * RequestId: string
200
+ * TotalCount: number
201
+ * }>}
202
+ * @memberof FunctionService
203
+ */
204
+ getFunctionList(limit?: number, offset?: number): Promise<{
205
+ Functions: Record<string, string>[];
206
+ RequestId: string;
207
+ TotalCount: number;
208
+ }>;
209
+ /**
210
+ * 列出函数
211
+ * @param {number} [limit=20]
212
+ * @param {number} [offset=0]
213
+ * @returns {Promise<Record<string, string>[]>}
214
+ */
215
+ listFunctions(limit?: number, offset?: number): Promise<Record<string, string>[]>;
216
+ /**
217
+ * 删除云函数
218
+ * @param {string} name 云函数名称
219
+ * @param {string} qualifier 需要删除的版本号,不填默认删除函数下全部版本。
220
+ * @returns {Promise<IResponseInfo>}
221
+ */
222
+ deleteFunction(name: string, qualifier?: string): Promise<IResponseInfo>;
223
+ /**
224
+ * 获取云函数详细信息
225
+ * @param {string} name 云函数名称
226
+ * @returns {Promise<Record<string, string>>}
227
+ */
228
+ getFunctionDetail(name: string, codeSecret?: string): Promise<IFunctionInfo>;
229
+ /**
230
+ * 获取函数日志
231
+ * @param {{
232
+ * name: string
233
+ * offset: number
234
+ * limit: number
235
+ * order: string
236
+ * orderBy: string
237
+ * startTime: string
238
+ * endTime: string
239
+ * requestId: string
240
+ * }} options
241
+ * @returns {Promise<IFunctionLogRes>}
242
+ */
243
+ getFunctionLogs(options: IFunctionLogOptions): Promise<IFunctionLogRes>;
244
+ /**
245
+ * 更新云函数配置
246
+ * @param {ICloudFunction} func 云函数配置
247
+ * @returns {Promise<IResponseInfo>}
248
+ */
249
+ updateFunctionConfig(func: ICloudFunction): Promise<IResponseInfo>;
250
+ /**
251
+ *
252
+ * @param {IUpdateFunctionCodeParam} funcParam
253
+ * @returns {Promise<IResponseInfo>}
254
+ * @memberof FunctionService
255
+ */
256
+ updateFunctionCode(funcParam: IUpdateFunctionCodeParam): Promise<IResponseInfo>;
257
+ /**
258
+ * 调用云函数
259
+ * @param {string} name 云函数名称
260
+ * @param {Record<string, any>} params 调用函数传入参数
261
+ * @returns {Promise<IFunctionInvokeRes>}
262
+ */
263
+ invokeFunction(name: string, params?: Record<string, any>): Promise<IFunctionInvokeRes>;
264
+ /**
265
+ * 复制云函数
266
+ * @param {string} name 云函数名称
267
+ * @param {string} newFunctionName 新的云函数名称
268
+ * @param {string} targetEnvId 目标环境 Id
269
+ * @param {boolean} [force=false] 是否覆盖同名云函数
270
+ * @returns {Promise<IResponseInfo>}
271
+ */
272
+ copyFunction(name: string, newFunctionName: string, targetEnvId?: string, force?: boolean): Promise<IResponseInfo>;
273
+ /**
274
+ * 创建云函数触发器
275
+ * @param {string} name 云函数名称
276
+ * @param {ICloudFunctionTrigger[]} triggers 云函数触发器配置
277
+ * @returns {Promise<IResponseInfo>}
278
+ */
279
+ createFunctionTriggers(name: string, triggers?: ICloudFunctionTrigger[]): Promise<IResponseInfo>;
280
+ /**
281
+ * 删除云函数触发器
282
+ * @param {string} name 云函数名称
283
+ * @param {string} triggerName 云函数触发器名称
284
+ * @returns {Promise<IResponseInfo>}
285
+ */
286
+ deleteFunctionTrigger(name: string, triggerName: string): Promise<IResponseInfo>;
287
+ /**
288
+ * 获取云函数代码下载 链接
289
+ * @param {string} functionName
290
+ * @param {string} [codeSecret]
291
+ * @returns {Promise<IFunctionDownloadUrlRes>}
292
+ * @memberof FunctionService
293
+ */
294
+ getFunctionDownloadUrl(functionName: string, codeSecret?: string): Promise<IFunctionDownloadUrlRes>;
295
+ createLayer(options: IFunctionLayerOptions): Promise<ICreateLayerResponse>;
296
+ deleteLayerVersion(options: ILayerOptions): Promise<IResponseInfo>;
297
+ listLayerVersions(options: IVersionListOptions): Promise<IListLayerVersionsRes>;
298
+ listLayers(options: ILayerListOptions): Promise<IListLayerRes>;
299
+ getLayerVersion(options: ILayerOptions): Promise<IGetLayerVersionRes>;
300
+ /**
301
+ * 设置预置并发
302
+ * @private
303
+ * @param {IProvisionedConcurrencyConfig} concurrencyConfig
304
+ * @returns
305
+ * @memberof FunctionService
306
+ */
307
+ setProvisionedConcurrencyConfig(concurrencyConfig: ISetProvisionedConcurrencyConfig): Promise<IResponseInfo>;
308
+ /**
309
+ * 获取函数预置并发详情
310
+ * @private
311
+ * @param {IGetProvisionedConcurrencyConfig} concurrencyConfig
312
+ * @returns {Promise<IGetProvisionedConcurrencyRes>}
313
+ * @memberof FunctionService
314
+ */
315
+ getProvisionedConcurrencyConfig(concurrencyConfig: IGetProvisionedConcurrencyConfig): Promise<IGetProvisionedConcurrencyRes>;
316
+ /**
317
+ * 删除预置并发
318
+ * @private
319
+ * @param {IGetProvisionedConcurrencyConfig} concurrencyConfig
320
+ * @returns {Promise<IResponseInfo>}
321
+ * @memberof FunctionService
322
+ */
323
+ deleteProvisionedConcurrencyConfig(concurrencyConfig: IGetProvisionedConcurrencyConfig): Promise<IResponseInfo>;
324
+ /**
325
+ * 发布新版本
326
+ * @param {IPublishVersionParams} publishParams
327
+ * @returns {Promise<IPublishVersionRes>}
328
+ * @memberof FunctionService
329
+ */
330
+ publishVersion(publishParams: IPublishVersionParams): Promise<IPublishVersionRes>;
331
+ /**
332
+ * 查询函数版本详情
333
+ * @param {IListFunctionVersionParams} listVersionParams
334
+ * @returns {Promise<IFunctionVersionsRes>}
335
+ * @memberof FunctionService
336
+ */
337
+ listVersionByFunction(listVersionParams: IListFunctionVersionParams): Promise<IFunctionVersionsRes>;
338
+ /**
339
+ *
340
+ * @param {IUpdateFunctionAliasConfig} updateVersionConfigParams
341
+ * @returns {Promise<IResponseInfo>}
342
+ * @memberof FunctionService
343
+ */
344
+ updateFunctionAliasConfig(updateVersionConfigParams: IUpdateFunctionAliasConfig): Promise<IResponseInfo>;
345
+ /**
346
+ * 查询函数别名详情
347
+ * @param {IGetFunctionAlias} params
348
+ * @returns {Promise<IGetFunctionAliasRes>}
349
+ * @memberof FunctionService
350
+ */
351
+ getFunctionAlias(params: IGetFunctionAlias): Promise<IGetFunctionAliasRes>;
352
+ private createAccessPath;
353
+ private getCodeParams;
354
+ private getTempCosInfo;
355
+ private retryCreateTrigger;
356
+ /**
357
+ * 获取函数配置信息
358
+ * @private
359
+ * @returns
360
+ * @memberof FunctionService
361
+ */
362
+ private getFunctionConfig;
363
+ /**
364
+ * 获取日志cls配置信息
365
+ */
366
+ private getClsServiceConfig;
367
+ /**
368
+ * 获取 vpc 信息
369
+ * @returns
370
+ */
371
+ private getVpcs;
372
+ /**
373
+ * 获取子网
374
+ * @param {string} vpcId
375
+ * @returns
376
+ */
377
+ private getSubnets;
378
+ private waitFunctionActive;
379
+ }
@@ -0,0 +1,37 @@
1
+ export declare const BIG_FILE_SIZE = 10485760;
2
+ export declare const API_MAX_SIZE = 52428800;
3
+ export declare enum CodeType {
4
+ File = 0,
5
+ JavaFile = 1
6
+ }
7
+ export interface IPackerOptions {
8
+ root?: string;
9
+ name?: string;
10
+ ignore: string | string[];
11
+ incrementalPath?: string;
12
+ functionPath?: string;
13
+ codeType: CodeType;
14
+ }
15
+ /**
16
+ * 将函数代码转换成 Base64 编码
17
+ * 普通文件:Node,PHP
18
+ * Java 文件:Jar,ZIP
19
+ */
20
+ export declare class FunctionPacker {
21
+ name: string;
22
+ type: CodeType;
23
+ funcPath: string;
24
+ zipFilePath: string;
25
+ tmpPath: string;
26
+ ignore: string | string[];
27
+ incrementalPath: string;
28
+ codeType: CodeType;
29
+ constructor(options: IPackerOptions);
30
+ compressFiles(): Promise<void>;
31
+ getJavaFile(): void;
32
+ build(): Promise<void>;
33
+ isBigFile(): Promise<boolean>;
34
+ isReachMaxSize(): Promise<boolean>;
35
+ getBase64Code(): Promise<string>;
36
+ clean(): Promise<void>;
37
+ }