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, InteractionEvent, ViewEvent } 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 | reportAnalytics(events: Array<(InteractionEvent) | (ViewEvent)>): Promise<void>;
|
40 | tryTemplate(id: string): Promise<TryTemplateResponse>;
|
41 | whoami(): Promise<User>;
|
42 | listApps(): Promise<Array<Application>>;
|
43 | getApp(idOrName: string): Promise<Application>;
|
44 | deployInitial(env: string, digest: string, envVars: Array<[string, string]>): Promise<Application>;
|
45 | deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>): Promise<Application>;
|
46 | claimApp(token: string): Promise<Application>;
|
47 | getLogs(appIdOrName: string, env: string, opts: LogReadOpts): Promise<LogsResponse>;
|
48 | destroyApp(appIdOrName: string): Promise<void>;
|
49 | }
|
50 | export declare class LycanClient {
|
51 | readonly serverUrl: string;
|
52 | protected readonly options: Options;
|
53 | static readonly methods: string[];
|
54 | static readonly validators: ClassValidator;
|
55 | protected readonly props: {
|
56 | "createTicket": {
|
57 | "description": string;
|
58 | "type": string;
|
59 | "properties": {
|
60 | "params": {
|
61 | "type": string;
|
62 | "properties": {};
|
63 | };
|
64 | "returns": {
|
65 | "$ref": string;
|
66 | };
|
67 | };
|
68 | "propertyOrder": string[];
|
69 | "required": string[];
|
70 | };
|
71 | "claimTicket": {
|
72 | "description": string;
|
73 | "type": string;
|
74 | "properties": {
|
75 | "params": {
|
76 | "type": string;
|
77 | "properties": {
|
78 | "ticket": {
|
79 | "type": string;
|
80 | };
|
81 | };
|
82 | "propertyOrder": string[];
|
83 | "required": string[];
|
84 | };
|
85 | "throws": {
|
86 | "$ref": string;
|
87 | };
|
88 | "returns": {
|
89 | "type": string;
|
90 | };
|
91 | };
|
92 | "propertyOrder": string[];
|
93 | "required": string[];
|
94 | };
|
95 | "listTemplates": {
|
96 | "type": string;
|
97 | "properties": {
|
98 | "params": {
|
99 | "type": string;
|
100 | "properties": {};
|
101 | };
|
102 | "returns": {
|
103 | "type": string;
|
104 | "items": {
|
105 | "$ref": string;
|
106 | };
|
107 | };
|
108 | };
|
109 | "propertyOrder": string[];
|
110 | "required": string[];
|
111 | };
|
112 | "reportAnalytics": {
|
113 | "type": string;
|
114 | "properties": {
|
115 | "params": {
|
116 | "type": string;
|
117 | "properties": {
|
118 | "events": {
|
119 | "type": string;
|
120 | "items": {
|
121 | "anyOf": {
|
122 | "$ref": string;
|
123 | }[];
|
124 | };
|
125 | };
|
126 | };
|
127 | "propertyOrder": string[];
|
128 | "required": string[];
|
129 | };
|
130 | "returns": {
|
131 | "type": string;
|
132 | };
|
133 | };
|
134 | "propertyOrder": string[];
|
135 | "required": string[];
|
136 | };
|
137 | "tryTemplate": {
|
138 | "description": string;
|
139 | "type": string;
|
140 | "properties": {
|
141 | "params": {
|
142 | "type": string;
|
143 | "properties": {
|
144 | "id": {
|
145 | "minLength": number;
|
146 | "type": string;
|
147 | };
|
148 | };
|
149 | "propertyOrder": string[];
|
150 | "required": string[];
|
151 | };
|
152 | "throws": {
|
153 | "$ref": string;
|
154 | };
|
155 | "returns": {
|
156 | "$ref": string;
|
157 | };
|
158 | };
|
159 | "propertyOrder": string[];
|
160 | "required": string[];
|
161 | };
|
162 | "whoami": {
|
163 | "type": string;
|
164 | "properties": {
|
165 | "params": {
|
166 | "type": string;
|
167 | "properties": {};
|
168 | };
|
169 | "returns": {
|
170 | "$ref": string;
|
171 | };
|
172 | "throws": {
|
173 | "$ref": string;
|
174 | };
|
175 | };
|
176 | "propertyOrder": string[];
|
177 | "required": string[];
|
178 | };
|
179 | "listApps": {
|
180 | "type": string;
|
181 | "properties": {
|
182 | "params": {
|
183 | "type": string;
|
184 | "properties": {};
|
185 | };
|
186 | "throws": {
|
187 | "$ref": string;
|
188 | };
|
189 | "returns": {
|
190 | "type": string;
|
191 | "items": {
|
192 | "$ref": string;
|
193 | };
|
194 | };
|
195 | };
|
196 | "propertyOrder": string[];
|
197 | "required": string[];
|
198 | };
|
199 | "getApp": {
|
200 | "type": string;
|
201 | "properties": {
|
202 | "params": {
|
203 | "type": string;
|
204 | "properties": {
|
205 | "idOrName": {
|
206 | "minLength": number;
|
207 | "type": string;
|
208 | };
|
209 | };
|
210 | "propertyOrder": string[];
|
211 | "required": string[];
|
212 | };
|
213 | "throws": {
|
214 | "$ref": string;
|
215 | };
|
216 | "returns": {
|
217 | "$ref": string;
|
218 | };
|
219 | };
|
220 | "propertyOrder": string[];
|
221 | "required": string[];
|
222 | };
|
223 | "deployInitial": {
|
224 | "type": string;
|
225 | "properties": {
|
226 | "params": {
|
227 | "type": string;
|
228 | "properties": {
|
229 | "env": {
|
230 | "pattern": string;
|
231 | "type": string;
|
232 | };
|
233 | "digest": {
|
234 | "minLength": number;
|
235 | "type": string;
|
236 | };
|
237 | "envVars": {
|
238 | "type": string;
|
239 | "items": {
|
240 | "type": string;
|
241 | "items": {
|
242 | "type": string;
|
243 | }[];
|
244 | "minItems": number;
|
245 | "additionalItems": {
|
246 | "anyOf": {
|
247 | "type": string;
|
248 | }[];
|
249 | };
|
250 | };
|
251 | };
|
252 | };
|
253 | "propertyOrder": string[];
|
254 | "required": string[];
|
255 | };
|
256 | "throws": {
|
257 | "anyOf": {
|
258 | "$ref": string;
|
259 | }[];
|
260 | };
|
261 | "returns": {
|
262 | "$ref": string;
|
263 | };
|
264 | };
|
265 | "propertyOrder": string[];
|
266 | "required": string[];
|
267 | };
|
268 | "deploy": {
|
269 | "type": string;
|
270 | "properties": {
|
271 | "params": {
|
272 | "type": string;
|
273 | "properties": {
|
274 | "appId": {
|
275 | "minLength": number;
|
276 | "type": string;
|
277 | };
|
278 | "env": {
|
279 | "pattern": string;
|
280 | "type": string;
|
281 | };
|
282 | "digest": {
|
283 | "minLength": number;
|
284 | "type": string;
|
285 | };
|
286 | "envVars": {
|
287 | "type": string;
|
288 | "items": {
|
289 | "type": string;
|
290 | "items": {
|
291 | "type": string;
|
292 | }[];
|
293 | "minItems": number;
|
294 | "additionalItems": {
|
295 | "anyOf": {
|
296 | "type": string;
|
297 | }[];
|
298 | };
|
299 | };
|
300 | };
|
301 | };
|
302 | "propertyOrder": string[];
|
303 | "required": string[];
|
304 | };
|
305 | "throws": {
|
306 | "anyOf": {
|
307 | "$ref": string;
|
308 | }[];
|
309 | };
|
310 | "returns": {
|
311 | "$ref": string;
|
312 | };
|
313 | };
|
314 | "propertyOrder": string[];
|
315 | "required": string[];
|
316 | };
|
317 | "claimApp": {
|
318 | "description": string;
|
319 | "type": string;
|
320 | "properties": {
|
321 | "params": {
|
322 | "type": string;
|
323 | "properties": {
|
324 | "token": {
|
325 | "minLength": number;
|
326 | "type": string;
|
327 | };
|
328 | };
|
329 | "propertyOrder": string[];
|
330 | "required": string[];
|
331 | };
|
332 | "throws": {
|
333 | "anyOf": {
|
334 | "$ref": string;
|
335 | }[];
|
336 | };
|
337 | "returns": {
|
338 | "$ref": string;
|
339 | };
|
340 | };
|
341 | "propertyOrder": string[];
|
342 | "required": string[];
|
343 | };
|
344 | "getLogs": {
|
345 | "type": string;
|
346 | "properties": {
|
347 | "params": {
|
348 | "type": string;
|
349 | "properties": {
|
350 | "appIdOrName": {
|
351 | "minLength": number;
|
352 | "type": string;
|
353 | };
|
354 | "env": {
|
355 | "pattern": string;
|
356 | "type": string;
|
357 | };
|
358 | "opts": {
|
359 | "$ref": string;
|
360 | };
|
361 | };
|
362 | "propertyOrder": string[];
|
363 | "required": string[];
|
364 | };
|
365 | "throws": {
|
366 | "anyOf": {
|
367 | "$ref": string;
|
368 | }[];
|
369 | };
|
370 | "returns": {
|
371 | "$ref": string;
|
372 | };
|
373 | };
|
374 | "propertyOrder": string[];
|
375 | "required": string[];
|
376 | };
|
377 | "destroyApp": {
|
378 | "type": string;
|
379 | "properties": {
|
380 | "params": {
|
381 | "type": string;
|
382 | "properties": {
|
383 | "appIdOrName": {
|
384 | "minLength": number;
|
385 | "type": string;
|
386 | };
|
387 | };
|
388 | "propertyOrder": string[];
|
389 | "required": string[];
|
390 | };
|
391 | "throws": {
|
392 | "anyOf": {
|
393 | "$ref": string;
|
394 | }[];
|
395 | };
|
396 | "returns": {
|
397 | "type": string;
|
398 | };
|
399 | };
|
400 | "propertyOrder": string[];
|
401 | "required": string[];
|
402 | };
|
403 | };
|
404 | readonly validators: ClassValidator;
|
405 | constructor(serverUrl: string, options?: Options);
|
406 | createTicket(options?: Options): Promise<CreateTicketResponse>;
|
407 | claimTicket(ticket: string, options?: Options): Promise<string>;
|
408 | listTemplates(options?: Options): Promise<Array<Template>>;
|
409 | reportAnalytics(events: Array<(InteractionEvent) | (ViewEvent)>, options?: Options): Promise<void>;
|
410 | tryTemplate(id: string, options?: Options): Promise<TryTemplateResponse>;
|
411 | whoami(options?: Options): Promise<User>;
|
412 | listApps(options?: Options): Promise<Array<Application>>;
|
413 | getApp(idOrName: string, options?: Options): Promise<Application>;
|
414 | deployInitial(env: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise<Application>;
|
415 | deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise<Application>;
|
416 | claimApp(token: string, options?: Options): Promise<Application>;
|
417 | getLogs(appIdOrName: string, env: string, opts: LogReadOpts, options?: Options): Promise<LogsResponse>;
|
418 | destroyApp(appIdOrName: string, options?: Options): Promise<void>;
|
419 | }
|