UNPKG

lexica-dialog-core

Version:
18 lines 712 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const lodash_1 = require("lodash"); const newIntentMiddleware = async (context, next) => { const { uni, commands, intentRepository, sessionService } = context; await Promise.all(commands .toArray() .filter(command => lodash_1.isNil(command.intent)) .map(async (command) => { if (!lodash_1.isNil(command.name)) { const intent = await intentRepository.findByUniCommandName(uni, command.name); command.intent = intent == null ? undefined : intent; } })); await next(); }; exports.default = newIntentMiddleware; //# sourceMappingURL=NewIntentMiddleware.js.map