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

harperdb-node

v1.1.1

Published

JavaScript library written in TypeScript for generating HarperDB requests

Downloads

8

Readme

HarperDB for Node

Ease the use of HarperDB Operations in a Node.js environment. Simplistic in design, it can be quickly added to any application.

Install

Install with npm

$ npm install harperdb-node

Install with yarn

$ yarn add harperdb-node

Start using in your Node.js app

// ESM
import { Harper } from 'harperdb-node';

// CommonJs
const { Harper } = require('harperdb-node');

const harper = new Harper({
    url: 'HARPERDB_URL',
    authorization: 'Basic HARPERDB_AUTHORIZATION',
});

const schema = harper.schema('NAME_OF_SCHEMA');
const table = schema.table('NAME_OF_TABLE');

// ...

HarperDB URL and Authorization can be found within your HarperDB Studio configuration.

Usage

import { Harper } from 'harperdb-node';

const harper = new Harper({
    url: 'HARPERDB_URL',
    authorization: 'Basic HARPERDB_AUTHORIZATION',
});

const testSchema = harper.schema('test');
const personTable = testSchema.table('person');

const person = { name: 'Bruce Wayne' };
const people = [ { name: 'Barry Allen' }, { name: 'Kent Clark' } ];

(async () => {
	await testSchema.create();
    await personTable.create();

    await personTable.insert(person);
    await personTable.insert(people);

    const peopleList = await personTable.getAll();

    await personTable.drop();
    await testSchema.drop();
})();

Docs

Harper object

schema(schema_name: string) -> Schema
sql(raw_sql_statement: string) -> Promise

  

Schema object

create() -> Promise
drop() -> Promise
table(table_name: string, hash_attribute: string?) -> Table

  

Table object

create() -> Promise
drop() -> Promise

  

select(attributes: string[]) -> Table
where(search_attribute: string, search_value: string) -> Table
where(search_conditions: Array<{search_attribute: string, search_value: any, search_type: string?}>) -> Table

  

getById(id: string) -> Promise
getById(ids: string[]) -> Promise
get(search_clauses: {operator: string, offset: number, limit: number}) -> Promise
getAll() -> Promise

  

insert(record: object) -> Promise
insert(records: Array<object>) -> Promise

  

upsert(record: object) -> Promise
upsert(records: Array<object>) -> Promise

  

update(id: string, record: object) -> Promise
update(record: {id: string, ... }) -> Promise
update(records: Array<{id: string, ... }>) -> Promise

  

delete(id: string) -> Promise
delete(ids: string[]) -> Promise