1 | import fetch from 'node-fetch';
|
2 | import { RequestInit } from 'node-fetch';
|
3 | import { ClassValidator, ValidationError } from './common';
|
4 | import { Application, Template, User, LogReadOpts, LogsResponse, CreateTicketResponse, TryTemplateResponse } from './interfaces';
|
5 | export interface Options extends Pick<RequestInit, 'agent' | 'redirect' | 'follow' | 'compress'> {
|
6 | fetchImplementation?: typeof fetch;
|
7 | timeoutMs?: number;
|
8 | headers?: Record<string, string>;
|
9 | }
|
10 | export declare class RequestError extends Error {
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 | readonly cause: any;
|
17 | readonly method: string;
|
18 | readonly options: any;
|
19 | readonly name = "RequestError";
|
20 | constructor(message: string,
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 | cause: any, method: string, options: any);
|
27 | }
|
28 | export declare class TimeoutError extends Error {
|
29 | readonly method: string;
|
30 | readonly options: any;
|
31 | readonly name = "TimeoutError";
|
32 | constructor(message: string, method: string, options: any);
|
33 | }
|
34 | export { ValidationError, };
|
35 | export interface Lycan {
|
36 | createTicket(): Promise<CreateTicketResponse>;
|
37 | claimTicket(ticket: string): Promise<string>;
|
38 | listTemplates(): Promise<Array<Template>>;
|
39 | tryTemplate(id: string): Promise<TryTemplateResponse>;
|
40 | whoami(): Promise<User>;
|
41 | listApps(): Promise<Array<Application>>;
|
42 | deployInitial(env: string, name: string, digest: string, envVars: Array<[string, string]>): Promise<Application>;
|
43 | deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>): Promise<Application>;
|
44 | claimApp(token: string): Promise<Application>;
|
45 | getLogs(appId: string, env: string, opts: LogReadOpts): Promise<LogsResponse>;
|
46 | }
|
47 | export declare class LycanClient {
|
48 | readonly serverUrl: string;
|
49 | protected readonly options: Options;
|
50 | static readonly methods: string[];
|
51 | static readonly validators: ClassValidator;
|
52 | protected readonly props: {
|
53 | "createTicket": {
|
54 | "description": string;
|
55 | "type": string;
|
56 | "properties": {
|
57 | "params": {
|
58 | "type": string;
|
59 | "properties": {};
|
60 | };
|
61 | "returns": {
|
62 | "$ref": string;
|
63 | };
|
64 | };
|
65 | "propertyOrder": string[];
|
66 | "required": string[];
|
67 | };
|
68 | "claimTicket": {
|
69 | "description": string;
|
70 | "type": string;
|
71 | "properties": {
|
72 | "params": {
|
73 | "type": string;
|
74 | "properties": {
|
75 | "ticket": {
|
76 | "type": string;
|
77 | };
|
78 | };
|
79 | "propertyOrder": string[];
|
80 | "required": string[];
|
81 | };
|
82 | "throws": {
|
83 | "$ref": string;
|
84 | };
|
85 | "returns": {
|
86 | "type": string;
|
87 | };
|
88 | };
|
89 | "propertyOrder": string[];
|
90 | "required": string[];
|
91 | };
|
92 | "listTemplates": {
|
93 | "type": string;
|
94 | "properties": {
|
95 | "params": {
|
96 | "type": string;
|
97 | "properties": {};
|
98 | };
|
99 | "returns": {
|
100 | "type": string;
|
101 | "items": {
|
102 | "$ref": string;
|
103 | };
|
104 | };
|
105 | };
|
106 | "propertyOrder": string[];
|
107 | "required": string[];
|
108 | };
|
109 | "tryTemplate": {
|
110 | "description": string;
|
111 | "type": string;
|
112 | "properties": {
|
113 | "params": {
|
114 | "type": string;
|
115 | "properties": {
|
116 | "id": {
|
117 | "minLength": number;
|
118 | "type": string;
|
119 | };
|
120 | };
|
121 | "propertyOrder": string[];
|
122 | "required": string[];
|
123 | };
|
124 | "throws": {
|
125 | "$ref": string;
|
126 | };
|
127 | "returns": {
|
128 | "$ref": string;
|
129 | };
|
130 | };
|
131 | "propertyOrder": string[];
|
132 | "required": string[];
|
133 | };
|
134 | "whoami": {
|
135 | "type": string;
|
136 | "properties": {
|
137 | "params": {
|
138 | "type": string;
|
139 | "properties": {};
|
140 | };
|
141 | "returns": {
|
142 | "$ref": string;
|
143 | };
|
144 | "throws": {
|
145 | "$ref": string;
|
146 | };
|
147 | };
|
148 | "propertyOrder": string[];
|
149 | "required": string[];
|
150 | };
|
151 | "listApps": {
|
152 | "type": string;
|
153 | "properties": {
|
154 | "params": {
|
155 | "type": string;
|
156 | "properties": {};
|
157 | };
|
158 | "throws": {
|
159 | "$ref": string;
|
160 | };
|
161 | "returns": {
|
162 | "type": string;
|
163 | "items": {
|
164 | "$ref": string;
|
165 | };
|
166 | };
|
167 | };
|
168 | "propertyOrder": string[];
|
169 | "required": string[];
|
170 | };
|
171 | "deployInitial": {
|
172 | "type": string;
|
173 | "properties": {
|
174 | "params": {
|
175 | "type": string;
|
176 | "properties": {
|
177 | "env": {
|
178 | "pattern": string;
|
179 | "type": string;
|
180 | };
|
181 | "name": {
|
182 | "minLength": number;
|
183 | "type": string;
|
184 | };
|
185 | "digest": {
|
186 | "minLength": number;
|
187 | "type": string;
|
188 | };
|
189 | "envVars": {
|
190 | "type": string;
|
191 | "items": {
|
192 | "type": string;
|
193 | "items": {
|
194 | "type": string;
|
195 | }[];
|
196 | "minItems": number;
|
197 | "additionalItems": {
|
198 | "anyOf": {
|
199 | "type": string;
|
200 | }[];
|
201 | };
|
202 | };
|
203 | };
|
204 | };
|
205 | "propertyOrder": string[];
|
206 | "required": string[];
|
207 | };
|
208 | "throws": {
|
209 | "anyOf": {
|
210 | "$ref": string;
|
211 | }[];
|
212 | };
|
213 | "returns": {
|
214 | "$ref": string;
|
215 | };
|
216 | };
|
217 | "propertyOrder": string[];
|
218 | "required": string[];
|
219 | };
|
220 | "deploy": {
|
221 | "type": string;
|
222 | "properties": {
|
223 | "params": {
|
224 | "type": string;
|
225 | "properties": {
|
226 | "appId": {
|
227 | "minLength": number;
|
228 | "type": string;
|
229 | };
|
230 | "env": {
|
231 | "pattern": string;
|
232 | "type": string;
|
233 | };
|
234 | "digest": {
|
235 | "minLength": number;
|
236 | "type": string;
|
237 | };
|
238 | "envVars": {
|
239 | "type": string;
|
240 | "items": {
|
241 | "type": string;
|
242 | "items": {
|
243 | "type": string;
|
244 | }[];
|
245 | "minItems": number;
|
246 | "additionalItems": {
|
247 | "anyOf": {
|
248 | "type": string;
|
249 | }[];
|
250 | };
|
251 | };
|
252 | };
|
253 | };
|
254 | "propertyOrder": string[];
|
255 | "required": string[];
|
256 | };
|
257 | "throws": {
|
258 | "anyOf": {
|
259 | "$ref": string;
|
260 | }[];
|
261 | };
|
262 | "returns": {
|
263 | "$ref": string;
|
264 | };
|
265 | };
|
266 | "propertyOrder": string[];
|
267 | "required": string[];
|
268 | };
|
269 | "claimApp": {
|
270 | "description": string;
|
271 | "type": string;
|
272 | "properties": {
|
273 | "params": {
|
274 | "type": string;
|
275 | "properties": {
|
276 | "token": {
|
277 | "minLength": number;
|
278 | "type": string;
|
279 | };
|
280 | };
|
281 | "propertyOrder": string[];
|
282 | "required": string[];
|
283 | };
|
284 | "throws": {
|
285 | "anyOf": {
|
286 | "$ref": string;
|
287 | }[];
|
288 | };
|
289 | "returns": {
|
290 | "$ref": string;
|
291 | };
|
292 | };
|
293 | "propertyOrder": string[];
|
294 | "required": string[];
|
295 | };
|
296 | "getLogs": {
|
297 | "type": string;
|
298 | "properties": {
|
299 | "params": {
|
300 | "type": string;
|
301 | "properties": {
|
302 | "appId": {
|
303 | "minLength": number;
|
304 | "type": string;
|
305 | };
|
306 | "env": {
|
307 | "pattern": string;
|
308 | "type": string;
|
309 | };
|
310 | "opts": {
|
311 | "$ref": string;
|
312 | };
|
313 | };
|
314 | "propertyOrder": string[];
|
315 | "required": string[];
|
316 | };
|
317 | "throws": {
|
318 | "anyOf": {
|
319 | "$ref": string;
|
320 | }[];
|
321 | };
|
322 | "returns": {
|
323 | "$ref": string;
|
324 | };
|
325 | };
|
326 | "propertyOrder": string[];
|
327 | "required": string[];
|
328 | };
|
329 | };
|
330 | readonly validators: ClassValidator;
|
331 | constructor(serverUrl: string, options?: Options);
|
332 | createTicket(options?: Options): Promise<CreateTicketResponse>;
|
333 | claimTicket(ticket: string, options?: Options): Promise<string>;
|
334 | listTemplates(options?: Options): Promise<Array<Template>>;
|
335 | tryTemplate(id: string, options?: Options): Promise<TryTemplateResponse>;
|
336 | whoami(options?: Options): Promise<User>;
|
337 | listApps(options?: Options): Promise<Array<Application>>;
|
338 | deployInitial(env: string, name: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise<Application>;
|
339 | deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise<Application>;
|
340 | claimApp(token: string, options?: Options): Promise<Application>;
|
341 | getLogs(appId: string, env: string, opts: LogReadOpts, options?: Options): Promise<LogsResponse>;
|
342 | }
|