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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@logi.one/document-client

v0.7.0

Published

Client for LogiONE Document's API

Readme

LogiONE Document Client

Node.js client for the LogiONE Document API. It handles authentication for you: it finds your API token, gets access tokens, and refreshes them when they expire.

Requires Node.js 20.3 or later. TypeScript types are included.

Install

npm install @logi.one/document-client

Quick start

const { LogiONEDocumentClient } = require('@logi.one/document-client')

async function run() {
    const client = await LogiONEDocumentClient.create()
    const documents = await client.search('documents', {
        limit: 10,
        columnFilters: [{ column: 'extension', value: '.docx', match: true }]
    })
    console.table(documents)
}

run()

API token

LogiONEDocumentClient.create() looks for your API token in this order:

  1. The token file (.logione-document-api-token in the current directory by default), or your token storage.
  2. The LOGIONE_DOCUMENT_API_TOKEN environment variable.
  3. A prompt on the command line. If the input ends before a token is entered, it throws No LogiONE API token provided.

create() gets an access token before returning the client.

Each time the client refreshes its access token, it receives a new API token and saves it to the token file. The file always holds the latest token, so keep it between runs: after the first refresh, the original token is no longer valid.

On Linux and macOS, a token file created by the client can only be read by its owner (permissions 0600).

Configuration

create() takes the token file path (default: .logione-document-api-token) and the API URL (default: https://doc.logi.one/api/v2):

const client = await LogiONEDocumentClient.create('/var/lib/my-app/.logione-document-api-token')

// Only the API URL
const client = await LogiONEDocumentClient.create(undefined, 'https://my-server/api/v2')

Custom token storage

To keep the API token somewhere other than a file, such as a database or a secret store, pass a token storage with a load and a save function instead of the file path:

import { LogiONEDocumentClient } from '@logi.one/document-client'

const client = await LogiONEDocumentClient.create({
    load: () => db.getToken(), // the saved token, or undefined when there is none yet
    save: (newToken) => db.setToken(newToken) // called after every refresh
})

The API URL can be given as the second argument, as with a file path.

Both can be async. When load returns no token, the client falls back to the LOGIONE_DOCUMENT_API_TOKEN environment variable, then to the prompt, as with the token file.

Requests

Each method takes a resource path (for example documents or documents/${id}) and returns the parsed JSON response. With TypeScript, pass the expected type as a generic.

import { LogiONEDocumentClient } from '@logi.one/document-client'

const client = await LogiONEDocumentClient.create()

const document = await client.get<MyDocument>(`documents/${id}`)
const created = await client.post<MyDocument>('documents', newDocument)
await client.put(`documents/${id}`, updatedDocument)
await client.get(`documents/${id}/trash`) // documents can't be deleted, only moved to the trash
await client.delete(`addresses/${addressId}`)

If a request gets a 401 Unauthorized, the client refreshes the access token and retries once. Concurrent requests share a single refresh. GET, PUT and DELETE requests are also retried up to 2 times after a network error or a 408, 429, 500, 502, 503 or 504 response; POST requests are not, since they could be processed twice. Other HTTP errors are thrown as a RequestError from @logi.one/rest-client, with the HTTP code in status.

Search

search() sends a GET request with the query encoded in the URL and returns an array.

const documents = await client.search<MyDocument>('documents', {
    text: 'invoice',
    sortColumn: 'name',
    sortAsc: false,
    limit: 50,
    skip: 100,
    columnFilters: [
        { column: 'extension', value: '.pdf', match: true },
        { column: 'isDeleted', value: false, match: true },
        { column: 'deadline.date', value: { min: '2025-01-01', max: '2025-12-31' }, match: true }
    ]
})

| Option | Description | |---|---| | text | Full-text search | | sortColumn | Column to sort by | | sortAsc | Sort order, ascending by default. Set to false for descending | | limit | Maximum number of results | | skip | Number of results to skip, for paging | | complete | Set to true to return all fields. By default, results only contain the main fields | | columnFilters | List of filters, see below |

Each filter has a column, a value, and match. match: true keeps the rows that match the filter; match: false excludes them. The kind of filter depends on the type of value:

| value | Filter | |---|---| | string | Text | | number | Number | | boolean | Boolean | | { min: number, max: number } | Number range | | { min: string, max: string } | Text range (for example, ISO dates) |

Support

If you need support, contact us at [email protected]. We will be happy to help.