Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vf-to-ubf

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vf-to-ubf - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

lib/Bot.js

2

package.json
{
"name": "vf-to-ubf",
"version": "1.0.1",
"version": "1.0.2",
"description": "Convert Voiceflow (.vf) diagram into a universal format!",

@@ -5,0 +5,0 @@ "main": "voiceflowToBotFormat.js",

@@ -13,9 +13,11 @@ # What is this?

```
import {voiceflowToBotFormat} from 'vf-to-ubf';
import {voiceflowToBotFormat, voiceflowToBot} from 'vf-to-ubf';
universal_format = voiceflowToBotFormat(diagram)
bot_definition = voiceflowToBot(diagram)
```
Where `diagram` is your Voiceflow file.
Where `diagram` is your Voiceflow file in JSON format.

@@ -22,0 +24,0 @@ # Format Example

@@ -0,1 +1,4 @@

const validate = require("./lib/validate.js")
const Bot = require("./lib/Bot.js")
/**

@@ -73,5 +76,17 @@ * Returns all the nodes found under the root diagram id.

*
* @param {Object} diagram - Voiceflow diagram.
* @param {Object} - Voiceflow diagram. `null` on error
*/
async function voiceflowToBotFormat(diagram){
try{
if ((await validate.validateDiagram(diagram)) === false){
return null
}
if ((await validate.validateDiagramWithSchema(diagram)) === false){
return null
}
} catch (e){
return null
}
var botFormat = {"project": {"nodes": {}}}

@@ -101,2 +116,26 @@ botFormat["project"]["name"] = diagram["project"]["name"]

module.exports = {voiceflowToBotFormat}
/**
* Takes a Voiceflow diagram and returns it in a
* Bot definition.
*
* @param {Object} - Initialised bot without number or id.
*/
async function voiceflowToBot(diagram){
var bot = new Bot()
var botDiagram = await voiceflowToBotFormat(diagram)
if(botDiagram == null){
return null
}
bot.name = botDiagram["project"]["name"]
bot.timestamp = new Date().getTime()
bot.diagram = botDiagram
console.log(bot)
return bot
}
module.exports = {voiceflowToBotFormat, voiceflowToBot}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc