1 | import { CloudBaseError } from './error'
|
2 |
|
3 | export type CustomEvent = 'logout'
|
4 |
|
5 |
|
6 | declare global {
|
7 | namespace NodeJS {
|
8 | interface Process extends EventEmitter {
|
9 | IS_DEBUG: boolean
|
10 | CLI_VERSION: string
|
11 | on(event: CustomEvent, listener: BeforeExitListener)
|
12 | emit(event: CustomEvent, message?: any)
|
13 | }
|
14 | }
|
15 | }
|
16 |
|
17 |
|
18 | export type TExportFunctionVoid = () => Promise<void | CloudBaseError>
|
19 |
|
20 | export interface PermanentCredential {
|
21 | secretId?: string
|
22 | secretKey?: string
|
23 | }
|
24 |
|
25 | export interface TmpCredential {
|
26 | tmpSecretId?: string
|
27 | tmpSecretKey?: string
|
28 | tmpToken?: string
|
29 | tmpExpired?: string
|
30 | expired?: string
|
31 | authTime?: string
|
32 | refreshToken?: string
|
33 | uin?: string
|
34 | hash?: string
|
35 | }
|
36 |
|
37 | export type Credential = TmpCredential & PermanentCredential
|
38 |
|
39 | export interface AuthSecret {
|
40 | secretId: string
|
41 | secretKey: string
|
42 | token?: string
|
43 | }
|
44 |
|
45 | export interface SSH {
|
46 | host: string
|
47 | port: string
|
48 | username: string
|
49 | password: string
|
50 | }
|
51 |
|
52 | export interface IConfig {
|
53 | credential?: Credential
|
54 | ssh?: SSH
|
55 | }
|
56 |
|
57 | export interface ICloudBaseConfig {
|
58 | envId: string
|
59 | functionRoot?: string
|
60 | functions?: ICloudFunction[]
|
61 | servers?: ServerConfig[]
|
62 | }
|
63 |
|
64 | export interface IGetCredential {
|
65 | secretId?: string
|
66 | secretKey?: string
|
67 | token: string
|
68 | }
|
69 |
|
70 | export enum ServerLanguageType {
|
71 | node = 'node'
|
72 | }
|
73 |
|
74 | export interface ServerConfig {
|
75 | type: ServerLanguageType.node
|
76 | name: string
|
77 | path: string
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | export interface IFunctionPackResult {
|
84 | success: boolean
|
85 | assets: string[]
|
86 | vemo?: boolean
|
87 | }
|
88 |
|
89 | export interface IFunctionVPC {
|
90 | subnetId: string
|
91 | vpcId: string
|
92 | }
|
93 |
|
94 | export interface ICloudFunctionConfig {
|
95 | timeout?: number
|
96 | envVariables?: Record<string, string | number | boolean>
|
97 | runtime?: string
|
98 | vpc?: IFunctionVPC
|
99 | installDependency?: boolean
|
100 | l5?: boolean
|
101 | }
|
102 |
|
103 | export interface ICloudFunctionTrigger {
|
104 | name: string
|
105 | type: string
|
106 | config: string
|
107 | }
|
108 |
|
109 | export interface ICloudFunction {
|
110 | name: string
|
111 | config?: ICloudFunctionConfig
|
112 | triggers?: ICloudFunctionTrigger[]
|
113 | params?: Record<string, string>
|
114 | handler?: string
|
115 | ignore?: string | string[]
|
116 | timeout?: number
|
117 | envVariables?: Record<string, string | number | boolean>
|
118 | runtime?: string
|
119 | vpc?: IFunctionVPC
|
120 | l5?: boolean
|
121 | installDependency?: boolean
|
122 | isWaitInstall?: boolean
|
123 | }
|
124 |
|
125 | export interface ICreateFunctionOptions {
|
126 |
|
127 | func?: ICloudFunction
|
128 | functions?: ICloudFunction[]
|
129 | functionRootPath?: string
|
130 | envId: string
|
131 | force?: boolean
|
132 | base64Code?: string
|
133 | log?: boolean
|
134 | codeSecret?: string
|
135 | }
|
136 |
|
137 | export interface IListFunctionOptions {
|
138 | limit?: number
|
139 | offset?: number
|
140 | envId: string
|
141 | }
|
142 |
|
143 | export interface IFunctionLogOptions {
|
144 | functionName: string
|
145 | envId: string
|
146 | offset?: number
|
147 | limit?: number
|
148 | order?: string
|
149 | orderBy?: string
|
150 | startTime?: string
|
151 | endTime?: string
|
152 | functionRequestI?: string
|
153 | }
|
154 |
|
155 | export interface IUpdateFunctionConfigOptions {
|
156 | functionName: string
|
157 | config: ICloudFunctionConfig
|
158 | envId: string
|
159 | }
|
160 |
|
161 | export interface InvokeFunctionOptions {
|
162 | functionName: string
|
163 | params?: Record<string, any>
|
164 | envId: string
|
165 | }
|
166 |
|
167 | export interface IFunctionBatchOptions {
|
168 | functions: ICloudFunction[]
|
169 | envId: string
|
170 | log?: boolean
|
171 | }
|
172 |
|
173 | export interface IFunctionTriggerOptions {
|
174 | functionName: string
|
175 | triggers?: ICloudFunctionTrigger[]
|
176 | triggerName?: string
|
177 | envId: string
|
178 | }
|
179 |
|
180 | export interface ILoginOptions {
|
181 | key?: boolean
|
182 | secretId?: string
|
183 | secretKey?: string
|
184 | // 修改浏览器登录打开的链接
|
185 | getAuthUrl?: (url: string) => string
|
186 | }
|
187 |
|
188 | export interface GatewayContext {
|
189 |
|
190 | envId: string
|
191 |
|
192 | config: ICloudBaseConfig
|
193 | }
|
194 |
|
195 | export interface ICreateFunctionGatewayOptions {
|
196 | envId: string
|
197 | path: string
|
198 | name: string
|
199 | }
|
200 |
|
201 | export interface IQueryGatewayOptions {
|
202 | envId: string
|
203 | domain?: string
|
204 | path?: string
|
205 | gatewayId?: string
|
206 | name?: string
|
207 | }
|
208 |
|
209 | export interface IDeleteGatewayOptions {
|
210 | envId: string
|
211 | path?: string
|
212 | gatewayId?: string
|
213 | name?: string
|
214 | }
|
215 |
|
216 | export interface IBindGatewayDomainOptions {
|
217 | envId: string
|
218 | domain: string
|
219 | }
|
220 |
|
221 | export interface IQueryGatewayDomainOptions {
|
222 | envId: string
|
223 | domain?: string
|
224 | }
|
225 |
|
226 | export interface IUnbindGatewayDomainOptions {
|
227 | envId: string
|
228 | domain: string
|
229 | }
|