New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@botmock/export

Package Overview
Dependencies
Maintainers
4
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@botmock/export

Exports Botmock project data to development platform format.

  • 0.3.0
  • npm
  • Socket score

Version published
Weekly downloads
76
increased by744.44%
Maintainers
4
Weekly downloads
 
Created
Source

@botmock/export

Exports Botmock project data to development platform format.

Supported platforms

  • Dialogflow
  • Luis
  • Rasa
  • Watson
  • Skills Kit
  • Lex

Install

npm install @botmock/export

Import

import { DialogflowExporter } from "@botmock/export";

Migrating from the standalone exporters

Previous standalone exporters were designed to transform your Botmock project directly into the format required by the end platform. The exporters included in the SDK, however, have been redesigned to be more granular and developer-friendly.

Key Differences

Use as a module

As opposed to being exclusively runnable as a Node.js script, the exporters are now available as individual classes in @botmock/export.

They can be imported like:

import { DialogflowExporter } from "@botmock/export";

const exporter = new DialogflowExporter({
  token: process.env.BOTMOCK_TOKEN,
});
Combine output

The output of an exporter's export method can be consumed by a method on FileWriter.

Export method

Each class has an export async public method, that takes a description of a project and outputs an object containing an unique id for the export, a timestamp, and a data object.

Data object

A data object is an object where keys are names of directories that contents of files should go into, and values are objects containing relevant filename and data describing what can utimately become file contents.

Project description

A project description is an object with the following signature:

export interface ProjectDescription<M, R = any> {
  teamId: string;
  projectId: string;
  boardId?: string;
  meta?: M;
  apiResponse?: R;
}
File writer

This class, importable as:

import { FileWriter } from "@botmock/export";

has a public method writeAllResourcesToFile on its instances, which takes an object containing key data, and value data object, and returns a result object describing the success or failure of the write.

const writer = new FileWriter({ dir: "../relative/path/to/desired/output/location" });

const { data } = await exporter.export({
  teamId: process.env.TEAM_ID,
  projectId: process.env.PROJECT_ID,
  boardId: process.env.BOARD_ID,
});
const res = await writer.writeAllResourcesToFile({ data });

A successful write will contain a write summary in the value property of the response, which is a string containing a relative path to the location of the successful write.

Result object

An object with the following signature:

interface Ok<V> {
  kind: Kind.OK;
  value: V;
}

interface Err<V> {
  kind: Kind.ERR;
  value: V;
}

export type Result<O, V> = Ok<O> | Err<V>;

The Result is Ok over a write summary in the case that there were no errors unpacking, or Err over an Error object in the case that there was an error.

Write summary

An object with the following signature

{
  bytesWritten: number;
  location: string;
}

FAQs

Package last updated on 20 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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