transform botmock api flow structure
npm install @botmock-api/flow
> transform botmock api flow structure
``bash`
npm i @botmock-api/flow
Class that fosters flow generation. Exposes methods to ensure the generated flow has certain qualities.
`ts
import { Simulator } from "@botmock-api/flow";
let flow: any;
const generator = new Simulator().createConnectedFlowGenerator();
for (const [i] of new Array(100).entries()) {
flow = generator.next();
}
`
#### Methods
##### createConnectedFlowGenerator
Creates generator that can only ever produce connected flows
##### createCompleteFlowGenerator
Creates generator that can only ever produce complete flows
##### createDisconnectedFlowGenerator
Creates generator that can only ever produce disconnected flows
Base class that provides abstractions of flow project structure through a variety of methods.
This class can be extended in the following way:
`ts
import { AbstractProject } from "@botmock-api/flow";
export default class FileWriter extends AbstractProject {
constructor(config) {
super({ projectData: config.projectData });
}
}
`
#### Methods
##### getMessage(messageId: string): flow.Message
Gets message from the board from messageId
##### getIntent(intentId: string): flow.Intent
Gets a full intent from intentId
##### gatherMessagesUpToNextIntent(message: flow.Message): flow.Message[]
Gathers all messages connected to message that are not separated by an intent in the flow
##### segmentizeBoardFromIntents(): Map
Segmentizes board by relating intents to all messages they are connected to in the flow
##### segmentizeBoardFromMessages(): Map
Segmentizes board by relating messages to the intents connected to them in the flow
##### representRequirementsForIntents(): Map
Relates intent ids to the slots that are required on them
##### topoSort(): flow.Message[]
Topologically sorts messages on the board. If a message is connected to another message, it will appear before it in the sorted result.
##### representFlowAsAdjMatrix(): boolean[][]`
Describes flow as an adjacency matrix. Each ij where there is a link between node i and node j in the original flow is truthy.