@botmock/export
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -25,3 +25,2 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const assert_1 = require("assert"); | ||
var Dirpaths; | ||
@@ -81,4 +80,4 @@ (function (Dirpaths) { | ||
_combinePayloads.set(this, (message) => { | ||
return Object.values(message.payload.en).reduce((acc, { blocks }) => { | ||
return [...acc, ...blocks]; | ||
return Object.values(message.payload).flatMap(v => Object.values(v)).reduce((acc, value) => { | ||
return [...acc, ...value.blocks]; | ||
}, []); | ||
@@ -92,8 +91,2 @@ }); | ||
.flatMap(__classPrivateFieldGet(this, _combinePayloads)); | ||
try { | ||
assert_1.notStrictEqual(responsesConnectedToIntent.length, 0); | ||
} | ||
catch (_b) { | ||
console.error(`${intent.name} must be connected to at least 1 response.`); | ||
} | ||
return { | ||
@@ -106,3 +99,5 @@ description: uuid_1.v4(), | ||
}, | ||
sampleUtterances: intent.utterances.en.map(utterance => utterance.text), | ||
sampleUtterances: Object.values(intent.utterances) | ||
.flatMap(v => v) | ||
.map(utterance => utterance.text), | ||
slots: (_a = intent.slots) === null || _a === void 0 ? void 0 : _a.filter(slot => slot.is_required).flatMap(slot => { | ||
@@ -109,0 +104,0 @@ var _a, _b; |
{ | ||
"name": "@botmock/export", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -10,3 +10,2 @@ import { v4 } from "uuid"; | ||
import { wrapEntitiesWithChar } from "../util"; | ||
import { notStrictEqual } from "assert"; | ||
@@ -71,9 +70,9 @@ enum Dirpaths { | ||
/** | ||
* | ||
* @param message {@link Botmock.Message} | ||
* Combine payload across languages and platforms. | ||
* @param {Botmock.Message} message Message object | ||
*/ | ||
#combinePayloads = (message: Botmock.Message): Botmock.Block[] => { | ||
return Object.values(message.payload.en).reduce( | ||
(acc: Botmock.Block[], { blocks }) => { | ||
return [...acc, ...blocks]; | ||
return Object.values(message.payload).flatMap(v => Object.values(v)).reduce( | ||
(acc: Botmock.Block[], value) => { | ||
return [...acc, ...value.blocks]; | ||
}, | ||
@@ -84,4 +83,3 @@ [] | ||
/** | ||
* | ||
* @param intent {@link Botmock.Intent} | ||
* @param {Botmock.Intent} intent Intent object | ||
*/ | ||
@@ -94,7 +92,2 @@ #transformIntent = (intent: Botmock.Intent): Lex.Intent => { | ||
.flatMap(this.#combinePayloads); | ||
try { | ||
notStrictEqual(responsesConnectedToIntent.length, 0); | ||
} catch { | ||
console.error(`${intent.name} must be connected to at least 1 response.`); | ||
} | ||
return { | ||
@@ -107,3 +100,5 @@ description: v4(), | ||
}, | ||
sampleUtterances: intent.utterances.en.map(utterance => utterance.text), | ||
sampleUtterances: Object.values(intent.utterances) | ||
.flatMap(v => v) | ||
.map(utterance => utterance.text), | ||
slots: intent.slots?.filter(slot => slot.is_required) | ||
@@ -110,0 +105,0 @@ .flatMap(slot => { |
Sorry, the diff of this file is not supported yet
331837
6776