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

wbb-mysql

v0.0.1

Published

Use this integration to either save form values into a specified table in a MySQL database, or use values entered to query data.

Downloads

2

Readme

Aims / Intro

The aim of this project is to create a handler ( perhaps called save-row ) that will add a configurable amount of data into a row of a MySQL database.

The data will come from a combination of values entered by the user, and values provided in the function arguments. ie, dynamic ( from the form ) and static ( from the function arguments );

The function will need configuration arguments for things like database host, username, password etc. A sample of these is below..

host : andyfeltham.me
port : 3306
username : afeltham
password : Nt7cugec
database_name : logicdialog_integration
database_table : names

Start by cloing the repository and getting things running locally. You'll need to run npm i to install the dependancies, and then npm run watch in one terminal to build the code. In another terminal run npm start to start the function. This process will need to be restarted with every change.

Also run ngrok http 8080 to expose a public url that connects to your laptop. You can download ngrok from here -> https://ngrok.com/download

The notes below are a good place to start in terms of things to change. Specifically look at src/handlers/example.ts and src/handlers/index.ts.

const requiredParameters = checkRequiredParameters(
    [ webhookReq.args?.responseText ] ,
    INTEGRATION_BLOCKS.ERROR_BLOCK, 
    false, false
  );

Code like the sample above will check to ensure that the responseText parameter is set in the function arguments. This is useful for ensuring things like database hostname and password etc are set correctly.

For now i would just use the simple example we've made so far to reply with a confirmation message, but eventually we'd need to expand the configuration so that we had a concept of being able to configure a next block, or error block to handle either of these cases. These integrations are intended to be building blocks to be used in lots of scenarios and so the more configurable they are the better.

Good luck!

WBB Sample Public Integration Template

This project is a template for creating new integrations via cloud functions. The files should be modified as follows :

  • Update the package.json file
    • change the name. Please ensure everything is prefixed with wbb-
    • change the deploy-dev and deploy-prod tasks. Specifically change the deploy option from wbb-integration-template to something specific to the function. This again should be prefixed with wbb- for example wbb-mailchimp.
  • Update the README.md, see notes and instructions for the template below.
  • Create src/handlers/my-integration.ts - create a file to handle the integration, giving it an appropriate name. An example is provided in src/handlers/example.ts
  • Update src/handlers/index.ts - update the root file to reference the handlers that you've created.

Various functions exist in the src/util/validation.ts file that will help validate parameters required, as well as perform string substitution if required.

Development

  • run npm run watch to start building the code and watching for changes.
  • In a separate terminal run npm start to start the functions framework and make the code accessible via HTTP
  • Use ngrok to make the webserver public, ie ngrok http 8080.

Setup

Complete any setup instructions here.

Blocks Provided

Provide a list of the blocks provided as part of this integration. This should be a list of block name, and its description.

Handler Names

The following handler names and their functions are available :

|Handler Name|Purpose| |------------|-------|

Configuration Options

( Provide a list of the configuration options for each of the handlers mentioned above )

Within the function there are a number of options that can be set to configure the behaviour of the integration. The tables below show the settings that are available for each handler.

handler-one

|Property|Required|Description| |--------|--------|-----------|