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

neo4j-wrapper

v1.0.2

Published

Neo4j simple wrapper for nodejs that returns normalized data

Downloads

6

Readme

neo4j-wrapper

Neo4j simple wrapper that returns normalized data.

Install

$ npm install neo4j-wrapper

Usage

const { Session } = require('neo4j-wrapper')

const connection = {
  host: '127.0.0.1',
  user: 'neo4j',
  password: 'neo4j',
  port: 7687
}

const options = {
  disableLosslessIntegers: true,
  maxConnectionLifetime: 1 * 60 * 10 * 1000, // 1 hour
  maxConnectionPoolSize: 100,
  connectionAcquisitionTimeout: 1 * 60 * 1000, // 60 seconds
  connectionTimeout: 20 * 1000, // 20 seconds
  maxTransactionRetryTime: 15 * 1000 // 15 seconds
}

const session = new Session({ connection, options })

// Export session to run queries outside this file
module.exports = session

// Or run query in the same file
async function run () {
  try {
    await session.run({ query: 'CREATE (n:Car {name: $name, model: $model})', params: { name: 'Audi', model: 'A3'} })
    const data = await session.run({ query: 'MATCH (c:Car) RETURN c AS car' })
    console.log(data)
  } catch (err) {
    console.log(err)
  }
}

run()

Options

  • maxConnectionLifetime: Pooled connections older than this threshold will be closed and removed from the pool. The actual removal happens during connection acquisition so that the new session returned is never backed by an old connection. Setting this option to a low value will cause a high connection churn, and can result in a performance drop. It is recommended to pick a value smaller than the maximum lifetime exposed by the surrounding system infrastructure (such as operating system, router, load balancer, proxy and firewall). Negative values result in lifetime not being checked. Default value: 1 hour.

  • maxConnectionPoolSize: This setting defines the maximum total number of connections allowed, per host, to be managed by the connection pool. In other words, for a direct driver, this sets the maximum number of connections towards a single database server. For a routing driver this sets the maximum amount of connections per cluster member. If a session or transaction tries to acquire a connection at a time when the pool size is at its full capacity, it must wait until a free connection is available in the pool or the request to acquire a new connection times out. The connection acquiring timeout is configured via ConnectionAcquisitionTimeout. Default value: This is different for different drivers, but is a number in the order of 100.

  • connectionAcquisitionTimeout: This setting limits the amount of time a session or transaction can spend waiting for a free connection to appear in the pool before throwing an exception. The exception thrown in this case is ClientException. Timeout only applies when connection pool is at its max capacity. Default value: 60 seconds.

  • connectionTimeout: To configure the maximum time allowed to establish a connection, pass a duration value to the driver configuration. Default value: 20 seconds.

  • maxTransactionRetryTime: To configure retry behavior, supply a value for the maximum time in which to keep attempting retries of transaction functions. Default value: 15 seconds.