npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

plugdo-node

v1.0.13

Published

plugdo node

Downloads

5

Readme

plugdo-node

A module that implements plugdo-platform web software architecture. It help you focus in the implementation of integration oriented programming for: integration, data transformation, in-memory solutions and realtime solutions. you must purchase the connectors available in ower website.

Compatibility: Node.js version 6+ and Express version 4+

Install with npm:

npm install plugdo-node

Integrations

The integration core platform creates a global message in JSON format. The message is passed from the plugdo-server platform to the integration component implemented by you. An example:

plugdo.integration("get-customer", (message, send) => {

    send({});

});

This example shows the following details:

1- message: the message parameter is a global object that includes the following information in JSON format (the example is in XML format for better understanding).

<Integration>
    <url>
        <protocol>http</protocol>
        <path>api/get-customer/xml</path>
        <host>localhost:3000</host>
        <fullPath>http://localhost:3000/api/get-customer/xml</fullPath>
    </url>
    <node>api</node>
    <integration>get-customer</integration>
    <responseType>xml</responseType>
    <querystring/>
    <post/>
    <ip>127.0.0.1</ip>
    <header>
        <host>localhost:3000</host>
        <connection>keep-alive</connection>
        <upgrade-insecure-requests>1</upgrade-insecure-requests>
        <user-agent>
        Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
        </user-agent>
        <accept>
        text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
        </accept>
        <accept-encoding>gzip, deflate, br</accept-encoding>
        <accept-language>en-US,en;q=0.9,es;q=0.8</accept-language>
        <cookie>io=Kli44tnwwnR7jIbJAAAB</cookie>
    </header>
    <device>
        <type>desktop</type>
        <name/>
    </device>
</Integration>

2- send: the send parameter is a function, it must be used to end a process of the integration implemented. You can pass the function throught the different callbacks, unless you execute it, the request will stay pending. Take care with the error handling logic, because if a try/catch is in place, you must execute the send({}, error) to exit the current request.

3- The "get-customer" is the name for the integration access point used in the URL.

The expected URL will be: http://domain.com/api/gwt-customer/xml

or http://domain.com/api/gwt-customer/json

the following example shows a complex logic with multiple collectors:

plugdo.integration("get-customer", (message, send) => {

    let response = {};

    // Collect from a file collector
    response.fromXML = plugdo.collect("customerFiles").get();

    // Collect from a sql server
    plugdo.collect("sqlserverGetBalanceByCustomerID").get(message, (data1, err) => {
        if(err !== undefined) {
            // End the current request if a error exists
            send({}, err);
        }
        else {
            response.Balance = data1;

            // Collect from sql server
            plugdo.collect("sqlserverGetGlobalInfo").get(message, (data2, err) => {
                if(err !== undefined) {
                    // End the current request if a error exists
                    send({}, err);
                }
                else {

                    // Collect from mysql server
                    response.GlobalInformation = data2;
                    plugdo.collect("mysqlGetAuditIntegrations").get(message, (data3, err) => {
                        if(err !== undefined) {
                            send({}, err);
                        }
                        else {
                            response.AuditIntegration = data3;
                
                            // End the current request
                            send(response);
                        }
                    });
               }
            });
        }
    });
});

Collectors

We are not including connectors, you must purchase the connectors in ower website or create it.

// Without callback
const myConnector = {
    callback: false,
    options: { 
        setting1: "",
        setting2: ""
    },
    get: function (message) {
        
    }
};

// With callback
const myConnector = {
    callback: true,
    options: { 
        setting1: "",
        setting2: ""
    },
    get: function (message, callback) {
        // Error
        callback({}, error);

        // Success
        callback(responseModel);
    }
};

// How to register a connector to be used in the framework
// plugdo.registerConnector("type", "action", myConnector);

// Add databases
plugdo.registerConnector("db", "mysql", mysqlConnector);
plugdo.registerConnector("db", "sqlserver", sqlserverConnector);
plugdo.registerConnector("db", "postgresql", postgresqlConnector);

How to use it?

Create a index.js or main.js file. The file simple example is:

const plugdo = require("plugdo-node").node();
const path = require("path");

// Register the connectors here!
const myDatabaseConnector = require("./connectors/myConnector.js");
plugdo.registerConnector("db", "mysql", myDatabaseConnector.mysql());

plugdo.start(80, path.resolve(__dirname));

Now you can follow the plugdo™ MVC and Server documentation https://docs.plugdo.com/#plugdo-node-mvc