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

arangojs-with-timeout

v6.10.0

Published

Folked from the official ArangoDB JavaScript driver with added query timeout support.

Downloads

9

Readme

ArangoDB JavaScript Driver

The official ArangoDB low-level JavaScript client.

license - APACHE-2.0 Dependencies

NPM status

Install

With Yarn or NPM

yarn add arangojs-with-timeout
## - or -
npm install --save arangojs-with-timeout

From source

git clone https://github.com/hkbarton/arangojs
cd arangojs
npm install
npm run dist

Basic usage example

// Modern JavaScript
import { Database, aql } from "arangojs";
const db = new Database();
(async function() {
  const now = Date.now();
  try {
    const cursor = await db.query(aql`RETURN ${now}`);
    const result = await cursor.next();
    // ...
  } catch (err) {
    // ...
  }
})();

// or plain old Node-style
var arangojs = require("arangojs");
var db = new arangojs.Database();
var now = Date.now();
db.query({
  query: "RETURN @value",
  bindVars: { value: now }
})
  .then(function(cursor) {
    return cursor.next().then(function(result) {
      // ...
    });
  })
  .catch(function(err) {
    // ...
  });

Common issues

TypeScript error TS2304: Cannot find name 'Blob'.

Even if your project doesn't contain any browser code, you need to add "dom" to the "lib" array in your tsconfig.json to make arangojs work. This is a known limitation because the library supports both browser and Node environments and there is no common binary format that works in both environments:

// tsconfig.json
- "lib": ["es6"],
+ "lib": ["es6", "dom"],

Documentation

Latest Documentation

Testing

Run the tests using the yarn test or npm test commands:

yarn test
# - or -
npm test

By default the tests will be run against a server listening on http://localhost:8529 (using username root with no password). To override this, you can set the environment variable TEST_ARANGODB_URL to something different:

TEST_ARANGODB_URL=http://myserver.local:8530 yarn test
# - or -
TEST_ARANGODB_URL=http://myserver.local:8530 npm test

For development arangojs tracks the development build of ArangoDB. This means tests may reflect behavior that does not match any existing public release of ArangoDB.

To run tests for a specific release of ArangoDB other than the latest development build, use the environment variable ARANGO_VERSION, e.g. for 3.3:

ARANGO_VERSION=30300 yarn test
# - or -
ARANGO_VERSION=30300 npm test

The value follows the same format as the arangoVersion config option, i.e. XYYZZ where X is the major version, YY is the two digit minor version and ZZ is the two digit patch version (both zero filled to two digits).

Any incompatible tests will appear as skipped (not failed) in the test result.

To run the resilience/failover tests you need to set the environment variables RESILIENCE_ARANGO_BASEPATH (to use a local build of ArangoDB) or RESILIENCE_DOCKER_IMAGE (to use a docker image by name):

RESILIENCE_ARANGO_BASEPATH=../arangodb yarn test
# - or -
RESILIENCE_ARANGO_BASEPATH=../arangodb npm test

This runs only the resilience/failover tests, without running any other tests.

Note that these tests are generally a lot slower than the regular test suite because they involve shutting down and restarting individual ArangoDB server instances.

License

The Apache License, Version 2.0. For more information, see the accompanying LICENSE file.