0

I was browsing through the code of node-wit and came across this

const validateActions = (logger, actions) => {
  if (typeof actions !== 'object') {
    throw new Error('Actions should be an object. ' + learnMore);
  }
  if (!actions.send) {
    throw new Error('The \'send\' action is missing. ' + learnMore);
  }

  Object.keys(actions).forEach(key => {
    if (typeof actions[key] !== 'function') {
      logger.warn('The \'' + key + '\' action should be a function.');
    }

    if (key === 'say' && actions[key].length > 2 ||
      key === 'merge' && actions[key].length > 2 ||
      key === 'error' && actions[key].length > 2
    ) {
      logger.warn('The \'' + key + '\' action has been deprecated. ' + learnMore);
    }

    if (key === 'send') {
      if (actions[key].length !== 2) {
        logger.warn('The \'send\' action should accept 2 arguments: request and response. ' + learnMore);
      }
    } else if (actions[key].length !== 1) {
      logger.warn('The \'' + key + '\' action should accept 1 argument: request. ' + learnMore);
    }
  });

  return actions;
};

Notice the part where it says key===merge and the logger prints deprecated. Does this mean the merge action is deprecated? If yes, what would be the alternative way of handling multiple stories?

PirateApp
  • 5,433
  • 4
  • 57
  • 90

1 Answers1

0

According to https://wit.ai/docs/http/20160526#post--converse-link, merge is deprecated as of July 27th 2017, when stories were deprecated. (https://wit.ai/blog/2017/07/27/sunsetting-stories) And since stories are deprecated there's no way of handling multiple stories; any state will have to be kept by you, through e.g. a database.

Mikal Madsen
  • 569
  • 1
  • 7
  • 18