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

marklogic

v3.4.0

Published

The official MarkLogic Node.js client API.

Downloads

1,744

Readme

MarkLogic Node.js Client API

The MarkLogic Node.js Client API provides access to the MarkLogic database from Node.js applications.

Features

  • Writing, reading, patching, and deleting documents in JSON, XML, text, or binary formats
  • Querying over documents including parsing string queries, extracting properties, and calculating facets
  • Projecting tuples (like table rows) out of documents
  • Single transactions and multi-statement transactions for database changes
  • Writing, reading, and deleting graphs and executing SPARQL queries over graphs
  • Extending the built-in services or evaluating or invoking your own JavaScript or XQuery on the server
  • Basic, digest, certificate, Kerberos, and SAML authentication
  • Import libraries as JavaScript mjs modules
  • Data Services First - MarkLogic's support for microservices
  • Optic query DSL, document matching, relevance, multiple groups
  • Generate query based views, redaction on rows
  • Data Movement SDK - move large amounts of data into, out of, or within a MarkLogic cluster

Getting Started

You can install the marklogic package as a dependency for your Node.js project using npm:

npm install marklogic --save

For Windows OS please use the below for Node Client 2.9.1:

npm install marklogic --save --ignore-scripts

With the marklogic package installed, the following inserts two documents in a collection into the Documents database using MarkLogic's built-in REST server at port 8000:

const marklogic = require('marklogic');

const db = marklogic.createDatabaseClient({
  host:     'localhost',
  port:     '8000',
  database: 'Documents',
  user:     'admin',
  password: 'admin',
  authType: 'DIGEST',
  // enableGzippedResponses is optional and can be set to true in order to request MarkLogic to compress the response for better performance,
    // the client will automatically decompress the response before it returns a value.
  enableGzippedResponses: true
});

// For MarkLogic Cloud
const db = marklogic.createDatabaseClient({
    apiKey:   'changeme',
    host:     'example.beta.marklogic.com',
    authType: 'cloud',
    // basePath is optional.
    basePath: '/marklogic/test',
    // accessTokenDuration (in seconds) is optional and can be used to customize the expiration of the access token.
    accessTokenDuration: 10,
    // enableGzippedResponses is optional and can be set to true in order to request MarkLogic to compress the response for better performance,
    // the client will automatically decompress the response before it returns a value.
    enableGzippedResponses: true
});

// For OAUTH
const db = marklogic.createDatabaseClient({
    host:     'localhost',
    port:     '8000',
    authType: 'oauth',
    oauthToken: '<OAUTH Token>'
});

db.createCollection(
  '/books',
  {author: 'Beryl Markham', ...},
  {author: 'WG Sebald',     ...}
  )
.result(function(response) {
    console.log(JSON.stringify(response, null, 2));
  }, function (error) {
    console.log(JSON.stringify(error, null, 2));
  });

Resources

Code Examples

The Node.js Client API ships with code examples to supplement the examples in the online resources. To run the examples, follow the instructions here:

examples/1readme.txt

Generating Documentation Locally

After installing the project dependencies (including the gulp build system), you can build the reference documentation locally from the root directory of the marklogic package:

npm run doc

The documentation is generated in a doc subdirectory. The documentation can also be accessed online here.

Support

The MarkLogic Node.js Client API is maintained by MarkLogic Engineering. It is designed for use in production applications with MarkLogic Server. Everyone is encouraged to file bug reports, feature requests, and pull requests through GitHub. This input is critical and will be carefully considered, but we can’t promise a specific resolution or timeframe for any request. In addition, MarkLogic provides technical support for release tags of the Node.js Client API to licensed customers under the terms outlined in the Support Handbook. For more information or to sign up for support, visit help.marklogic.com.