Git Product home page Git Product logo

bzg's Introduction

bzg

A set of functions to help you build Bizagi custom connectors easier.

Installation

npm install --save bzg

API

createResponse(res, err, statusCode): Creates a Bizagi formatted response. This is a special format used by Bizagi studio.

  • res: Object: HTTP request object.
  • err: Object: Request error object.
  • statusCode: String: How's the statusCode property called in the response object passed in. ex: "status", "status-code", etc.

createError(): Creates a human readable error. This is the error that users will see once the exception occurs doing the action.

  • errorType: String: An object containing the type of error it will be passed on to Bizagi. The following errors are supported.
    • GLB.UNKNOW_ACTION
    • GLB.RESPONSE_ERROR
    • REQUIRED_PARAM
  • params: Object: The parameters needed to build that type of error.
    • { action: String }
    • { code: Number, errorMessage: String }
    • { paramName: String }

findMissingParams(params): Generic function that checks the user input the same way Bizagi studio expects. It returns a string error if there's a missing param.

  • params: Object: Bizagi user input

Use

import bzg from 'bzg';
import imgur from 'imgur';
import consumer from './some-path/consumer';

export function _action(handlers, services, authdata, input) {
    // handlers.findMissingParams({/**/});
    // services.imgur.setClientId('aCs53GSs4tga0ikp');
    // services.consumer.init(imgur);
    // ...
    // handlers.createResponse({ statusCode: 200 });
    // ...
    // Remenber to return a Promise.
}

export const invoke = bzg( [imgur, consumer], _action);

bzg's People

Contributors

platekun avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.