@medable/mdctl-sandbox

Medable Developer Tools :: Sandbox

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@medable/mdctl-sandbox
7541.0.69a month ago4 years agoMinified + gzip package size for @medable/mdctl-sandbox in KB

Readme

mdctl-sandbox
Developer Tools Sandbox Module for Medable This module will let you run scripts into the Medable's sandbox.

Usage

``` const { Client } = require('@medable/mdctl-api'),
sandbox = require('@medable/mdctl-sandbox'),
options = {
  client: new Client({
    strictSSL: false,
    environment: {
      endpoint: 'https://localhost',
      env: 'test'
    },
    credentials: {
      type: 'password',
      apiKey: 'abcdefghijklmnopqrstuv',
      username: 'test@medable.com',
      password: 'password'
    }
  }),
  stats: true,
  body: `
    const sum = (param1, param2) => {
      return param1 + param2
    }
    
    return sum(5,1)
  `,
  arguments: [],
  script: '',
  optimize: false,
  format: 'json'
},
response = {}
try { Object.assign(response, await sandbox.run(options)) } catch (e) { response.err = e.toJSON() }
console.log(JSON.stringify(response)) ```