UNPKG

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