How to use the ses.confine function in ses

To help you get started, we’ve selected a few ses 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 jimpick / cabal-ses-bot / ses-bot.js View on Github external
emit(message)
                }
              }
            }
            Object.assign(endowments, makeUtilsEndowments())
            if (pid === 0) { // Root bot extra endowments
              Object.assign(endowments, makeRootBotEndowments({
                processes,
                debugLog,
                storageDir,
                register,
                updateHandlerFunc,
                updateKilled
              }))
            }
            return SES
              .confine(
                `${handlerFunc}; module.exports(botName, message, state, refs)`,
                endowments
              )
              .then(result => {
                handlerLog('Success:', result)
                if (pid === 0 || !state[pid]) return {result}
                const jsonStateFile = path.join(
                  storageDir, 'bots', `${pid}`, 'state.json'
                )
                const json = JSON.stringify(state[pid], null, 2)
                return writeFile(jsonStateFile, json).then(() => {result})
              })
              .catch(err => {
                handlerLog('Fail:', err.name, err.message, err.stack)
                log(chalk.red(`PID ${pid} ${botName}:`),

ses

Hardened JavaScript for Fearless Cooperation

Apache-2.0
Latest version published 8 days ago

Package Health Score

87 / 100
Full package analysis

Popular ses functions