How to use the @ibm-functions/composer.wsk function in @ibm-functions/composer

To help you get started, we’ve selected a few @ibm-functions/composer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ibm-functions / shell / app / plugins / modules / composer / lib / create-from-source.js View on Github external
const vm = require('vm'),
      fs = require('fs'),
      path = require('path'),
      expandHomeDir = require('expand-home-dir'),
      openwhiskComposer = require('@ibm-functions/composer'),
      { isValidFSM } = require('./composer')

//
// just in case, block any use of wsk from within sandboxed compilations
//
const nope = {
    create: () => true,
    update: () => true,
    invoke: () => true
}
openwhiskComposer.wsk = {
    actions: nope,
    packages: nope,
    rules: nope,
    triggers: nope
}

const patterns = {
    require: /(const [^\s]+)\s*=\s*require\('@ibm-functions\/composer'\)/,
    constAppEquals: /.*const ([^\s]+)\s*=\s+composer(.*)/,
    return: /^return\s+/
}

/** override values in A with those from B, returning any overwritten values */
const save = (A, B) => {
    const overwritten = {}
    for (let key in B) {