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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@redactive/redactive

v1.4.10

Published

Redactive AI Node SDK

Readme

Redactive Node SDK

The Redactive Node SDK provides a robust and intuitive interface for interacting with the Redactive platform, enabling developers to seamlessly integrate powerful data redaction and anonymization capabilities into their Node applications.

Installation

In order to use the package to integrate with Redactive.ai, run:

npm install redactive

There is no need to clone this repository.

If you would like to modify this package, clone the repo and install from source:

npm install ./sdks/node

Requirements

  • Node v20+

Usage

The library has following components.

  • AuthClient - provides functionality to interact with data sources
  • SearchClient - provides functionality to search chunks with Redactive search service in gRPC
  • MultiUserClient - provides functionality manage multi-user search with Redactive search service

AuthClient

AuthClient needs to be configured with your account's API key which is available in the Apps page at Redactive Dashboard.

import { AuthClient } from "@redactive/redactive";

// Establish an connection to data source
// Possible data sources: confluence, google-drive, jira, zendesk, slack, sharepoint
const redirectUri = "https://url-debugger.vercel.app";
const provider = "confluence";
const signInUrl = await client.beginConnection({ provider, redirectUri });

// Navigate User to signInUrl
// User will receive an oauth2 auth code after consenting the app's data source access permissions.
// Use this code to exchange Redactive access_token with Redactive API
const response = await client.exchangeTokens("OAUTH2-AUTH-CODE");

SearchClient

With the Redactive access_token, you can perform three types of searches using the Redactive Search service:

  1. Semantic Query Search: Retrieve relevant chunks of information that are semantically related to a user query.
  2. URL-based Search: Obtain all the chunks from a document by specifying its URL.
  3. Document Name Search: Query for all the chunks from a document based on the name of the document.
import { SearchClient } from "@redactive/redactive";

const client = new SearchClient();
const accessToken = "REDACTIVE-ACCESS-TOKEN";

// Semantic Search: retrieve text extracts (chunks) from various documents pertaining to the user query
const semanticQuery = "Tell me about AI";
await client.queryChunks({ accessToken, semanticQuery });

// URL-based Search: retrieve all chunks of the document at that URL
const url = "https://example.com/document";
await client.getChunksByUrl({ accessToken, url });

// Document Name Search : retrieve all chunks of a document identified by its name
const documentName = "AI Research Paper";
await client.queryChunksByDocumentName({ accessToken, documentName });

Filters

Query methods, i.e. queryChunks, queryChunksByDocumentName, support a set of optional filters. The filters are applied in a logical 'AND' operation. If a data source provider does not support a filter-type, then no results from that provider are returned.

import { Filters } from "@redactive/redactive/grpc/search";

// Query chunks from Confluence only, that are from documents created before last week, modified since last week,
// and that are from documents associated with a user's email. Include chunks from trashed documents.
const lastWeek = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
const filters: Filters = {
  scope: ["confluence"],
  created: {
    before: lastWeek
  },
  modified: {
    after: lastWeek
  },
  userEmails: ["[email protected]"],
  includeContentInTrash: true
};
await client.queryChunks({ accessToken, semanticQuery, filters });

Multi-User Client

The MultiUserClient class helps manage multiple users' authentication and access to the Redactive search service.

import { MultiUserClient } from "@redactive/redactive";

const multiUserClient = MultiUserClient(
  "REDACTIVE-API-KEY",
  "https://example.com/callback/",
  readUserData,
  multiUserClient
);

// Present `connection_url` in browser for user to interact with:
const userId = "myUserId";
const connectionUrl = await multiUserClient.getBeginConnectionUrl(userId, "confluence");

// On user return from OAuth connection flow:
let [signInCode, state] = ["", ""]; // from URL query parameters
const isConnectionSuccessful = await multiUserClient.handleConnectionCallback(userId, signInCode, state);

// User can now use Redactive search service via `MultiUserClient`'s other methods:
const semanticQuery = "Tell me about the missing research vessel, the Borealis";
const chunks = await multiUserClient.queryChunks({ userId, semanticQuery });

Development

The Node SDK code can be found thesdks/node directory in Redactive Github Repository.

In order to comply with the repository style guide, we recommend running the following tools.

To format your code, run:

pnpm format:fix

To lint your code, run:

pnpm lint:fix

To test changes, run:

pnpm test

To build Python SDK, run:

pnpm build

To install local version, run:

npm install ./sdks/node

Contribution Guide

Please check here