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

harperive

v2.0.1

Published

A Node.Js client to connect HarperDB local or cloud simplifying api request

Downloads

61

Readme


Introduction

HarperDB is a SQL/NoSQL data management platform. It is fully indexed, doesn't duplicate data, and runs on any device- from the edge to the cloud.

It is built natively as a set of micro-services, making development and integration easy and seamless. HarperDB utilizes a single-endpoint for all operations. HarperDB’s RESTful nature makes it stateless, stable, and scalable.

Harperive is a node.js driver for HarperDb.

It is written in JavaScript, it natively supports promises and functions can be executed with callbacks. Each HarperDb operation is exposed as a function on the client object. All functions take query options and an optional callback function.

Documentation

See the official documentation website here

Installation

Follow the instructions on the HarperDB get started page for installation and get HarperDB up and running.

Harperive is available as an npm package.

# installs the package for your project

npm install harperive --save

Connection

You need to create a DB Client with following parameters passing the appropriate values and then you can perform any db operation.

DB_CONFIG

  • harperHost - host name of the harperdb server, example: https://harper-test-dev.harperdbcloud.com
  • username - username of your db user
  • password - password of the user
  • token (optional) - jwt authentication token, pass either username/password or token for authorised database operation.
  • schema (optional) - schema name, if not passed while creating client then need to be passed while calling operations. (Passing schema lets you perform CRUD operations on that schema)

Example

const harperive = require('harperive');

const DB_CONFIG = {
  harperHost: process.env.DB_HOST,
  username: process.env.DB_USER,
  password: process.env.DB_PASS,
  token: process.env.OPERATION_TOKEN, // pass either username/password or token
  schema: process.env.SCHEMA, // optional params
  
  /* Alternatively schema can be passed in the options while quering for any operations on specific schema. 
  *  Refer bewlow on how to execute operation for more clarification.
  */
}

const Client = harperive.Client;
const client = new Client(DB_CONFIG);

// function call with callback
client.dbOperation(options, (err, res) => {
  if(err) console.log(err);
  else console.log(res);
});

// function call expecting promise
client.dbOperation(options)
  .then(res => console.log(res))
  .catch(err => console.log(err));

// function call as async/await expecting promise
async function executeQuery() {
  try {
    const res = await client.dbOperation(options)
    console.log(res);
  } catch(err) {
    console.log(err);
  }
}

executeQuery();

Response Format

// success response (recieved in 2nd arg of the callback / resolved when called as promise)
{ 
  statusCode: 200,
  status: 'SUCCESS',
  operation: 'search_by_value',
  data: 
  [ 
    { 
      __createdtime__: 1591894774234,
       __updatedtime__: 1591894774234,
       country: 'BELGIUM',
       date: '1810-05-13',
       id: 15,
       image: '',
       name: 'BELGIAN SHEPHERD DOG',
       section: 'Sheepdogs'
    }
  ]
}

// failure(error) response (recieved in 1st arg of the callback / rejected when called as promise)
{ 
  error: 'unknown attribute \'address\'',
  statusCode: 500,
  status: 'FAILED',
  operation: 'search_by_value'
}

LICENSE - "MIT"

Copyright (c) 2020 Chandan Kumar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.