1 | # mdctl-sandbox
|
2 |
|
3 | Developer Tools Sandbox Module for Medable
|
4 |
|
5 | This module will let you run scripts into the Medable's sandbox.
|
6 |
|
7 | ## Usage
|
8 |
|
9 | ```
|
10 | const { Client } = require('@medable/mdctl-api'),
|
11 | sandbox = require('@medable/mdctl-sandbox'),
|
12 | options = {
|
13 | client: new Client({
|
14 | strictSSL: false,
|
15 | environment: {
|
16 | endpoint: 'https://localhost',
|
17 | env: 'test'
|
18 | },
|
19 | credentials: {
|
20 | type: 'password',
|
21 | apiKey: 'abcdefghijklmnopqrstuv',
|
22 | username: 'test@medable.com',
|
23 | password: 'password'
|
24 | }
|
25 | }),
|
26 | stats: true,
|
27 | body: `
|
28 | const sum = (param1, param2) => {
|
29 | return param1 + param2
|
30 | }
|
31 |
|
32 | return sum(5,1)
|
33 | `,
|
34 | arguments: [],
|
35 | script: '',
|
36 | optimize: false,
|
37 | format: 'json'
|
38 | },
|
39 | response = {}
|
40 |
|
41 | try {
|
42 | Object.assign(response, await sandbox.run(options))
|
43 | } catch (e) {
|
44 | response.err = e.toJSON()
|
45 | }
|
46 |
|
47 | console.log(JSON.stringify(response))
|
48 | ```
|
49 |
|
\ | No newline at end of file |