1 | interface SandboxOptions {
|
2 | /**
|
3 | * A token derived from your master token or a JWT token accepted by Extend server if you are using Security V2.
|
4 | */
|
5 | token: string,
|
6 | /**
|
7 | * The container with which this Sandbox instance should be associated.
|
8 | */
|
9 | container: string,
|
10 | /**
|
11 | * [optional] The URL of the webtask cluster. Defaults to the public 'webtask.it.auth0.com' cluster.
|
12 | */
|
13 | url?: string
|
14 | }
|
15 |
|
16 | interface SandboxMethodOptions {
|
17 | /**
|
18 | * The name of the webtask.
|
19 | */
|
20 | name: string,
|
21 | /**
|
22 | * [optional] Set the webtask container. Defaults to the profile's container.
|
23 | */
|
24 | container?: string
|
25 | }
|
26 |
|
27 | interface GetWebtaskOptions extends SandboxMethodOptions {
|
28 | /**
|
29 | * [optional] Decrypt the webtask's secrets.
|
30 | */
|
31 | decrypt?: boolean,
|
32 | /**
|
33 | * [optional] Fetch the code associated with the webtask.
|
34 | */
|
35 | fetch_code?: boolean
|
36 | }
|
37 |
|
38 | interface CreateWebtaskOptions extends SandboxMethodOptions {
|
39 | /**
|
40 | * Set the webtask secrets.
|
41 | */
|
42 | secrets: object,
|
43 | /**
|
44 | * Set the webtask metadata.
|
45 | */
|
46 | meta: object,
|
47 | /**
|
48 | * Set the webtask hostname.
|
49 | */
|
50 | host: string
|
51 | }
|
52 |
|
53 | interface RemoveWebtaskOptions extends SandboxMethodOptions { }
|
54 |
|
55 | interface ListWebtasksOptions {
|
56 | /**
|
57 | * [optional] Set the webtask container. Defaults to the profile's container.
|
58 | */
|
59 | container?: string,
|
60 | /**
|
61 | * [optional] Metadata describing the webtask. This is a set of string key value pairs. Only webtasks with matching metadata will be returned.
|
62 | */
|
63 | meta?: object,
|
64 | /**
|
65 | * [optional] Skip this many named webtasks
|
66 | */
|
67 | offset?: number,
|
68 | /**
|
69 | * [optional] Limit the results to this many named webtasks.
|
70 | */
|
71 | limit?: number
|
72 | }
|
73 |
|
74 | interface CreateCronJobOptions extends SandboxMethodOptions {
|
75 | /**
|
76 | * The name of the cron job.
|
77 | */
|
78 | name: string,
|
79 | /**
|
80 | * [optional] The webtask token that will be used to run the job.
|
81 | */
|
82 | token?: string,
|
83 | /**
|
84 | * The cron schedule that will be used to determine when the job will be run. For example: '5 4 * * *'.
|
85 | */
|
86 | schedule: string,
|
87 | /**
|
88 | * The cron timezone (IANA timezone).
|
89 | */
|
90 | tz: string,
|
91 | /**
|
92 | * The cron metadata (set of string key value pairs).
|
93 | */
|
94 | meta: string
|
95 | }
|
96 |
|
97 | interface RemoveCronJobOptions extends SandboxMethodOptions {
|
98 | /**
|
99 | * The name of the cron job.
|
100 | */
|
101 | name: string
|
102 | }
|
103 |
|
104 | interface SetCronJobStateOptions extends SandboxMethodOptions {
|
105 | /**
|
106 | * The name of the cron job.
|
107 | */
|
108 | name: string,
|
109 | /**
|
110 | * The new state of the cron job (active/inactive).
|
111 | */
|
112 | state: string
|
113 | }
|
114 |
|
115 | interface ListCronJobsOptions {
|
116 | /**
|
117 | * [optional] Set the webtask container. Defaults to the profile's container.
|
118 | */
|
119 | container?: string
|
120 | }
|
121 |
|
122 | interface GetCronJobOptions extends SandboxMethodOptions {
|
123 | /**
|
124 | * The name of the cron job.
|
125 | */
|
126 | name: string,
|
127 | }
|
128 |
|
129 | interface GetCronJobHistoryOptions extends SandboxMethodOptions {
|
130 | /**
|
131 | * The name of the cron job.
|
132 | */
|
133 | name: string,
|
134 | /**
|
135 | * [optional] The offset to use when paging through results.
|
136 | */
|
137 | offset?: number,
|
138 | /**
|
139 | * [optional] The limit to use when paging through results.
|
140 | */
|
141 | limit?: number
|
142 | }
|
143 |
|
144 | interface RevokeTokenOptions {
|
145 | /**
|
146 | * The token that should be revoked
|
147 | */
|
148 | token: string
|
149 | }
|
150 |
|
151 | interface ListNodeModuleVersionsOptions {
|
152 | /**
|
153 | * Name of the node module
|
154 | */
|
155 | name: string
|
156 | }
|
157 |
|
158 | interface EnsureNodeModulesOptions {
|
159 | /**
|
160 | * Array of { name, version } pairs
|
161 | */
|
162 | modules: object[],
|
163 | /**
|
164 | * Trigger a rebuild of the modules (Requires administrative token)
|
165 | */
|
166 | reset: boolean
|
167 | }
|
168 |
|
169 | interface WebtaskStorage {
|
170 | /**
|
171 | * The data to be stored
|
172 | */
|
173 | data: object,
|
174 | /**
|
175 | * [optional] Pass in an optional string to be used for optimistic concurrency control to prevent simultaneous updates of the same data.
|
176 | */
|
177 | etag?: number
|
178 | }
|
179 |
|
180 | interface UpdateStorageOptions extends SandboxMethodOptions {
|
181 | storage: WebtaskStorage
|
182 | }
|
183 |
|
184 | interface GetStorageOptions extends SandboxMethodOptions { }
|
185 |
|
186 | interface CreateLogStreamOptions {
|
187 | /**
|
188 | * Define if the data will shown as JSON or not.
|
189 | */
|
190 | json: boolean
|
191 | }
|
192 |
|
193 | interface SandboxResponseClaims {
|
194 | /**
|
195 | * The name of the webtask
|
196 | */
|
197 | jtn: string,
|
198 | /**
|
199 | * The container name
|
200 | */
|
201 | ten: string
|
202 | }
|
203 |
|
204 | interface GetWebtaskResponse {
|
205 | /**
|
206 | * The claims which are part of the webtask
|
207 | */
|
208 | claims: SandboxResponseClaims,
|
209 | /**
|
210 | * The meta associated to the webtask
|
211 | */
|
212 | meta: object,
|
213 | /**
|
214 | * The secrets associated to the webtask (only if `decrypt: true`)
|
215 | */
|
216 | secrets: object,
|
217 | /**
|
218 | * The code of the webtask (only if `fetch_code: true`)
|
219 | */
|
220 | code: string,
|
221 | /**
|
222 | * The container name
|
223 | */
|
224 | container: string,
|
225 | /**
|
226 | * The URL to execute the webtask
|
227 | */
|
228 | url: string
|
229 | }
|
230 |
|
231 | interface CreateWebtaskResponse {
|
232 | /**
|
233 | * The claims which are part of the webtask
|
234 | */
|
235 | claims: SandboxResponseClaims,
|
236 | /**
|
237 | * The meta associated to the webtask
|
238 | */
|
239 | meta: object,
|
240 | /**
|
241 | * The secrets associated to the webtask (only if `decrypt: true`)
|
242 | */
|
243 | container: string,
|
244 | /**
|
245 | * The URL to execute the webtask
|
246 | */
|
247 | url: string
|
248 | }
|
249 |
|
250 | interface ModuleResponse {
|
251 | /**
|
252 | * The name of the module
|
253 | */
|
254 | name: string,
|
255 | /**
|
256 | * The version of the module
|
257 | */
|
258 | version: string,
|
259 | /**
|
260 | * The state of the module (available, queued or failed)
|
261 | */
|
262 | state: string
|
263 | // "name": "express",
|
264 | // "version": "4.12.4",
|
265 | // "state": "available"
|
266 | }
|
267 |
|
268 | interface SandboxProfile {
|
269 | /**
|
270 | * [deprecated] Use 'createWebtask'.
|
271 | */
|
272 | create(options: object) : Promise<any>,
|
273 |
|
274 | /**
|
275 | * [deprecated] Use 'createWebtask'.
|
276 | */
|
277 | createRaw(options: object) : Promise<any>,
|
278 |
|
279 | /**
|
280 | * [deprecated] Use 'createWebtask'.
|
281 | */
|
282 | createUrl(options: object) : Promise<any>,
|
283 |
|
284 | /**
|
285 | * [deprecated] Use 'createWebtask'.
|
286 | */
|
287 | createTokenRaw(options: object) : Promise<any>,
|
288 |
|
289 | /**
|
290 | * Create a stream of logs from the webtask container
|
291 | *
|
292 | * Note that the logs will include messages from our infrastructure.
|
293 | */
|
294 | createLogStream(options: CreateLogStreamOptions) : any,
|
295 |
|
296 | /**
|
297 | * Read a named webtask
|
298 | */
|
299 | getWebtask(options: GetWebtaskOptions) : Promise<GetWebtaskResponse>,
|
300 |
|
301 | /**
|
302 | * Create a named webtask
|
303 | */
|
304 | createWebtask(options: CreateWebtaskOptions) : Promise<CreateWebtaskResponse>,
|
305 |
|
306 | /**
|
307 | * Remove a named webtask from the webtask container
|
308 | */
|
309 | removeWebtask(options: RemoveWebtaskOptions) : Promise<boolean>,
|
310 |
|
311 | /**
|
312 | * [deprecated] Update an existing webtask's code, secrets or other claims
|
313 | *
|
314 | * Note that this method should be used with caution as there is the potential for a race condition where another agent updates the webtask between the time that the webtask details and claims are resolved and when the webtask update is issued.
|
315 | */
|
316 | updateWebtask(options: object) : Promise<any>,
|
317 |
|
318 | /**
|
319 | * List named webtasks from the webtask container
|
320 | */
|
321 | listWebtasks(options: ListWebtasksOptions) : Promise<GetWebtaskResponse[]>,
|
322 |
|
323 | /**
|
324 | * Create a cron job from an already-existing webtask
|
325 | */
|
326 | createCronJob(options: CreateCronJobOptions) : Promise<any>,
|
327 |
|
328 | /**
|
329 | * Remove an existing cron job
|
330 | */
|
331 | removeCronJob(options: RemoveCronJobOptions) : Promise<any>,
|
332 |
|
333 | /**
|
334 | * Set an existing cron job's state
|
335 | */
|
336 | setCronJobState(options: SetCronJobStateOptions) : Promise<any>,
|
337 |
|
338 | /**
|
339 | * List cron jobs associated with this profile
|
340 | */
|
341 | listCronJobs(options: ListCronJobsOptions) : Promise<any>,
|
342 |
|
343 | /**
|
344 | * Get a CronJob instance associated with an existing cron job
|
345 | */
|
346 | getCronJob(options: GetCronJobOptions) : Promise<any>,
|
347 |
|
348 | /**
|
349 | * Get the historical results of executions of an existing cron job.
|
350 | */
|
351 | getCronJobHistory(options, GetCronJobHistoryOptions) : Promise<any>,
|
352 |
|
353 | /**
|
354 | * [deprecated] Use 'getWebtask'.
|
355 | */
|
356 | inspectToken(options: object) : Promise<any>,
|
357 |
|
358 | /**
|
359 | * [deprecated] Use 'getWebtask'.
|
360 | */
|
361 | inspectWebtask(options: object) : Promise<any>,
|
362 |
|
363 | /**
|
364 | * Revoke a webtask token
|
365 | */
|
366 | revokeToken(options: RevokeTokenOptions) : Promise<any>,
|
367 |
|
368 | /**
|
369 | * List versions of a given node module that are available on the platform
|
370 | */
|
371 | listNodeModuleVersions(options: ListNodeModuleVersionsOptions) : Promise<ModuleResponse[]>,
|
372 |
|
373 | /**
|
374 | * Ensure that a set of modules are available on the platform
|
375 | */
|
376 | ensureNodeModules(options: EnsureNodeModulesOptions) : Promise<ModuleResponse[]>,
|
377 |
|
378 | /**
|
379 | * Update the storage associated to the a webtask
|
380 | */
|
381 | updateStorage(options: UpdateStorageOptions) : Promise<any>,
|
382 |
|
383 | /**
|
384 | * Read the storage associated to the a webtask
|
385 | */
|
386 | getStorage(options: GetStorageOptions) : Promise<any>
|
387 | }
|
388 |
|
389 | declare var Sandbox: SandboxJS.SandboxStatic;
|
390 |
|
391 | declare module SandboxJS {
|
392 | interface SandboxStatic {
|
393 | /**
|
394 | * Create a Sandbox instance
|
395 | */
|
396 | init (options: SandboxOptions) : SandboxProfile,
|
397 |
|
398 | /**
|
399 | * [deprecated] Create a Sandbox instance from a webtask token
|
400 | */
|
401 | fromToken (token, options: SandboxOptions)
|
402 | }
|
403 | }
|
404 |
|
405 | declare module "sandboxjs" {
|
406 | export = Sandbox;
|
407 | } |
\ | No newline at end of file |