示例#1
0
      statements.forEach(cmd => {
        cmd = cleanCommand(cmd)
        const requestId = v4()
        const cmdId = v4()
        const whitelistedCommands = [`${cmdchar}param`]
        const isWhitelisted =
          whitelistedCommands.filter(wcmd => !!cmd.startsWith(wcmd)).length > 0

        // Ignore client commands that aren't whitelisted
        const ignore = !!cmd.startsWith(cmdchar) && !isWhitelisted

        let { action, interpreted } = buildCommandObject(
          { cmd, ignore },
          helper.interpret,
          getCmdChar(store.getState())
        )
        action.requestId = requestId
        action.parentId = parentId
        action.id = cmdId
        store.dispatch(
          addFrame({ ...action, requestId, type: interpreted.name })
        )
        store.dispatch(updateQueryResult(requestId, null, 'waiting'))
        jobs.push({
          workFn: () =>
            interpreted.exec(action, cmdchar, store.dispatch, store),
          onStart: () => {},
          onSkip: () =>
            store.dispatch(updateQueryResult(requestId, null, 'skipped'))
        })
      })
示例#2
0
 .map(action =>
   buildCommandObject(action, helper.interpret, getCmdChar(store.getState()))