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 } 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<Application>;
|
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(accountId: string, appId: string): Promise<void>;
|
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 | "type": string;
|
111 | "properties": {
|
112 | "params": {
|
113 | "type": string;
|
114 | "properties": {
|
115 | "id": {
|
116 | "minLength": number;
|
117 | "type": string;
|
118 | };
|
119 | };
|
120 | "propertyOrder": string[];
|
121 | "required": string[];
|
122 | };
|
123 | "throws": {
|
124 | "$ref": string;
|
125 | };
|
126 | "returns": {
|
127 | "$ref": string;
|
128 | };
|
129 | };
|
130 | "propertyOrder": string[];
|
131 | "required": string[];
|
132 | };
|
133 | "whoami": {
|
134 | "type": string;
|
135 | "properties": {
|
136 | "params": {
|
137 | "type": string;
|
138 | "properties": {};
|
139 | };
|
140 | "returns": {
|
141 | "$ref": string;
|
142 | };
|
143 | "throws": {
|
144 | "$ref": string;
|
145 | };
|
146 | };
|
147 | "propertyOrder": string[];
|
148 | "required": string[];
|
149 | };
|
150 | "listApps": {
|
151 | "type": string;
|
152 | "properties": {
|
153 | "params": {
|
154 | "type": string;
|
155 | "properties": {};
|
156 | };
|
157 | "throws": {
|
158 | "$ref": string;
|
159 | };
|
160 | "returns": {
|
161 | "type": string;
|
162 | "items": {
|
163 | "$ref": string;
|
164 | };
|
165 | };
|
166 | };
|
167 | "propertyOrder": string[];
|
168 | "required": string[];
|
169 | };
|
170 | "deployInitial": {
|
171 | "type": string;
|
172 | "properties": {
|
173 | "params": {
|
174 | "type": string;
|
175 | "properties": {
|
176 | "env": {
|
177 | "pattern": string;
|
178 | "type": string;
|
179 | };
|
180 | "name": {
|
181 | "minLength": number;
|
182 | "type": string;
|
183 | };
|
184 | "digest": {
|
185 | "minLength": number;
|
186 | "type": string;
|
187 | };
|
188 | "envVars": {
|
189 | "type": string;
|
190 | "items": {
|
191 | "type": string;
|
192 | "items": {
|
193 | "type": string;
|
194 | }[];
|
195 | "minItems": number;
|
196 | "additionalItems": {
|
197 | "anyOf": {
|
198 | "type": string;
|
199 | }[];
|
200 | };
|
201 | };
|
202 | };
|
203 | };
|
204 | "propertyOrder": string[];
|
205 | "required": string[];
|
206 | };
|
207 | "throws": {
|
208 | "anyOf": {
|
209 | "$ref": string;
|
210 | }[];
|
211 | };
|
212 | "returns": {
|
213 | "$ref": string;
|
214 | };
|
215 | };
|
216 | "propertyOrder": string[];
|
217 | "required": string[];
|
218 | };
|
219 | "deploy": {
|
220 | "type": string;
|
221 | "properties": {
|
222 | "params": {
|
223 | "type": string;
|
224 | "properties": {
|
225 | "appId": {
|
226 | "minLength": number;
|
227 | "type": string;
|
228 | };
|
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 | "claimApp": {
|
269 | "description": string;
|
270 | "type": string;
|
271 | "properties": {
|
272 | "params": {
|
273 | "type": string;
|
274 | "properties": {
|
275 | "accountId": {
|
276 | "minLength": number;
|
277 | "type": string;
|
278 | };
|
279 | "appId": {
|
280 | "minLength": number;
|
281 | "type": string;
|
282 | };
|
283 | };
|
284 | "propertyOrder": string[];
|
285 | "required": string[];
|
286 | };
|
287 | "throws": {
|
288 | "anyOf": {
|
289 | "$ref": string;
|
290 | }[];
|
291 | };
|
292 | "returns": {
|
293 | "type": string;
|
294 | };
|
295 | };
|
296 | "propertyOrder": string[];
|
297 | "required": string[];
|
298 | };
|
299 | "getLogs": {
|
300 | "type": string;
|
301 | "properties": {
|
302 | "params": {
|
303 | "type": string;
|
304 | "properties": {
|
305 | "appId": {
|
306 | "minLength": number;
|
307 | "type": string;
|
308 | };
|
309 | "env": {
|
310 | "pattern": string;
|
311 | "type": string;
|
312 | };
|
313 | "opts": {
|
314 | "$ref": string;
|
315 | };
|
316 | };
|
317 | "propertyOrder": string[];
|
318 | "required": string[];
|
319 | };
|
320 | "throws": {
|
321 | "anyOf": {
|
322 | "$ref": string;
|
323 | }[];
|
324 | };
|
325 | "returns": {
|
326 | "$ref": string;
|
327 | };
|
328 | };
|
329 | "propertyOrder": string[];
|
330 | "required": string[];
|
331 | };
|
332 | };
|
333 | readonly validators: ClassValidator;
|
334 | constructor(serverUrl: string, options?: Options);
|
335 | createTicket(options?: Options): Promise<CreateTicketResponse>;
|
336 | claimTicket(ticket: string, options?: Options): Promise<string>;
|
337 | listTemplates(options?: Options): Promise<Array<Template>>;
|
338 | tryTemplate(id: string, options?: Options): Promise<Application>;
|
339 | whoami(options?: Options): Promise<User>;
|
340 | listApps(options?: Options): Promise<Array<Application>>;
|
341 | deployInitial(env: string, name: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise<Application>;
|
342 | deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise<Application>;
|
343 | claimApp(accountId: string, appId: string, options?: Options): Promise<void>;
|
344 | getLogs(appId: string, env: string, opts: LogReadOpts, options?: Options): Promise<LogsResponse>;
|
345 | }
|