UNPKG

4.5 kBPlain TextView Raw
1import { CloudBaseError } from './error'
2
3export type CustomEvent = 'logout'
4
5/* eslint-disable */
6declare 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/* eslint-enable */
17
18export type TExportFunctionVoid = () => Promise<void | CloudBaseError>
19
20export interface PermanentCredential {
21 secretId?: string
22 secretKey?: string
23}
24
25export 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
37export type Credential = TmpCredential & PermanentCredential
38
39export interface AuthSecret {
40 secretId: string
41 secretKey: string
42 token?: string
43}
44
45export interface SSH {
46 host: string
47 port: string
48 username: string
49 password: string
50}
51
52export interface IConfig {
53 credential?: Credential
54 ssh?: SSH
55}
56
57export interface ICloudBaseConfig {
58 envId: string
59 functionRoot?: string
60 functions?: ICloudFunction[]
61 servers?: ServerConfig[]
62}
63
64export interface IGetCredential {
65 secretId?: string
66 secretKey?: string
67 token: string
68}
69
70export enum ServerLanguageType {
71 node = 'node'
72}
73
74export interface ServerConfig {
75 type: ServerLanguageType.node
76 name: string
77 path: string
78}
79
80/**
81 * 函数
82 */
83export interface IFunctionPackResult {
84 success: boolean
85 assets: string[]
86 vemo?: boolean
87}
88
89export interface IFunctionVPC {
90 subnetId: string
91 vpcId: string
92}
93
94export 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
103export interface ICloudFunctionTrigger {
104 name: string
105 type: string
106 config: string
107}
108
109export 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
125export 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
137export interface IListFunctionOptions {
138 limit?: number
139 offset?: number
140 envId: string
141}
142
143export 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
155export interface IUpdateFunctionConfigOptions {
156 functionName: string
157 config: ICloudFunctionConfig
158 envId: string
159}
160
161export interface InvokeFunctionOptions {
162 functionName: string
163 params?: Record<string, any>
164 envId: string
165}
166
167export interface IFunctionBatchOptions {
168 functions: ICloudFunction[]
169 envId: string
170 log?: boolean
171}
172
173export interface IFunctionTriggerOptions {
174 functionName: string
175 triggers?: ICloudFunctionTrigger[]
176 triggerName?: string
177 envId: string
178}
179
180export interface ILoginOptions {
181 key?: boolean
182 secretId?: string
183 secretKey?: string
184 // 修改浏览器登录打开的链接
185 getAuthUrl?: (url: string) => string
186}
187
188export interface GatewayContext {
189 // 环境 id
190 envId: string
191 // 整体配置
192 config: ICloudBaseConfig
193}
194
195export interface ICreateFunctionGatewayOptions {
196 envId: string
197 path: string
198 name: string
199}
200
201export interface IQueryGatewayOptions {
202 envId: string
203 domain?: string
204 path?: string
205 gatewayId?: string
206 name?: string
207}
208
209export interface IDeleteGatewayOptions {
210 envId: string
211 path?: string
212 gatewayId?: string
213 name?: string
214}
215
216export interface IBindGatewayDomainOptions {
217 envId: string
218 domain: string
219}
220
221export interface IQueryGatewayDomainOptions {
222 envId: string
223 domain?: string
224}
225
226export interface IUnbindGatewayDomainOptions {
227 envId: string
228 domain: string
229}