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

@dveloxsoft/dvs-client

v0.0.4

Published

Framework-agnostic Node.js HTTP client for DVS-Auth, DVS-User and DVS-Notification microservices

Readme

@dveloxsoft/dvs-client

Framework-agnostic Node.js HTTP client for the DVS-Auth, DVS-User and DVS-Notification microservices.

The package no longer depends on NestJS for its core API. NestJS support is available through an optional adapter.

Installation

npm install @dveloxsoft/dvs-client

Optional Axios adapter:

npm install axios

Optional NestJS adapter:

npm install @nestjs/common @nestjs/core

Runtime requirements

  • Node.js >=18.17
  • Global fetch is used by the default HTTP client
  • CJS and ESM entrypoints are both published

Environment variables

| Variable | Description | Required | Default | | --- | --- | --- | --- | | DVELOXSOFT_MS_AUTH_TOKEN | Gateway token used as x-ms-authorization-token | Yes, unless a custom httpClient is supplied | none | | DVELOXSOFT_MS_BASE_URL | Gateway base URL | No | https://ms.dveloxsoft.com | | DVELOXSOFT_MS_ORIGIN | Default Origin header | No | none | | DVELOXSOFT_MS_REFERER | Default Referer header | No | none | | HTTP_REQUEST_TIMEOUT | Default timeout in milliseconds | No | 30000 |

Plain Node.js usage

ESM

import { createDVSClient } from '@dveloxsoft/dvs-client';

const dvs = createDVSClient({
  authToken: process.env.DVELOXSOFT_MS_AUTH_TOKEN,
  baseUrl: process.env.DVELOXSOFT_MS_BASE_URL,
  defaultOrigin: process.env.DVELOXSOFT_MS_ORIGIN,
  defaultReferer: process.env.DVELOXSOFT_MS_REFERER,
});

const auth = await dvs.auth.login({ email, password });
const users = await dvs.user.findAll({ page: 1, limit: 20 }, auth.access_token);
const emailResult = await dvs.notification.sendEmail(emailDto, auth.access_token);

CommonJS

const { createDVSClient } = require('@dveloxsoft/dvs-client');

const dvs = createDVSClient({
  authToken: process.env.DVELOXSOFT_MS_AUTH_TOKEN,
  baseUrl: process.env.DVELOXSOFT_MS_BASE_URL,
  defaultOrigin: process.env.DVELOXSOFT_MS_ORIGIN,
  defaultReferer: process.env.DVELOXSOFT_MS_REFERER,
});

const auth = await dvs.auth.login({ email, password });
const users = await dvs.user.findAll({ page: 1, limit: 20 }, auth.access_token);

Optional access-token provider

Protected methods still accept an explicit accessToken parameter. For non-Nest apps that already have a request/session context, you can also provide an async token provider:

const dvs = createDVSClient({
  authToken: process.env.DVELOXSOFT_MS_AUTH_TOKEN,
  accessTokenProvider: () => getCurrentUserAccessToken(),
});

await dvs.user.findOne(userId);

Explicit accessToken arguments take precedence over accessTokenProvider.

Custom HTTP client

The default client uses Node's built-in fetch. You can replace it with any implementation that satisfies HttpClient.

import { createDVSClient, type HttpClient, type HttpRequestConfig, type HttpResponse } from '@dveloxsoft/dvs-client';

class MyHttpClient implements HttpClient {
  async get<T = any>(url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
    return { data: {} as T, status: 200, statusText: 'OK', headers: {} };
  }

  async post<T = any>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
    return { data: {} as T, status: 200, statusText: 'OK', headers: {} };
  }

  async put<T = any>(url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
    return { data: {} as T, status: 200, statusText: 'OK', headers: {} };
  }

  async delete<T = any>(url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
    return { data: {} as T, status: 200, statusText: 'OK', headers: {} };
  }

  async request<T = any>(config: HttpRequestConfig & { method: any; url: string }): Promise<HttpResponse<T>> {
    return { data: {} as T, status: 200, statusText: 'OK', headers: {} };
  }
}

const dvs = createDVSClient({
  authToken: process.env.DVELOXSOFT_MS_AUTH_TOKEN,
  httpClient: new MyHttpClient(),
});

Optional Axios adapter

import { createDVSClient } from '@dveloxsoft/dvs-client';
import { createAxiosHttpClient } from '@dveloxsoft/dvs-client/axios';

const dvs = createDVSClient({
  authToken: process.env.DVELOXSOFT_MS_AUTH_TOKEN,
  httpClientFactory: createAxiosHttpClient,
});

NestJS adapter

The core package has no NestJS dependency. NestJS apps can use the optional adapter:

import { Module } from '@nestjs/common';
import { DVSClientModule } from '@dveloxsoft/dvs-client/nestjs';
import { DVSAuthClient, DVSUserClient } from '@dveloxsoft/dvs-client';

@Module({
  imports: [
    DVSClientModule.forRoot({
      authToken: process.env.DVELOXSOFT_MS_AUTH_TOKEN,
      baseUrl: process.env.DVELOXSOFT_MS_BASE_URL,
      defaultOrigin: process.env.DVELOXSOFT_MS_ORIGIN,
      defaultReferer: process.env.DVELOXSOFT_MS_REFERER,
    }),
  ],
})
export class AppModule {}

Inject individual clients:

import { Injectable } from '@nestjs/common';
import { DVSAuthClient, DVSUserClient } from '@dveloxsoft/dvs-client';

@Injectable()
export class AuthService {
  constructor(
    private readonly authClient: DVSAuthClient,
    private readonly userClient: DVSUserClient,
  ) {}
}

Or inject the container:

import { Inject, Injectable } from '@nestjs/common';
import { DVS_CLIENT_CONTAINER, DVSClientContainer } from '@dveloxsoft/dvs-client/nestjs';

@Injectable()
export class MyService {
  constructor(@Inject(DVS_CLIENT_CONTAINER) private readonly dvs: DVSClientContainer) {}
}

Migration from the Nest-only package

Old:

import { DVSClientModule } from '@dveloxsoft/dvs-client-nestjs';

@Module({
  imports: [DVSClientModule.forRoot(config)],
})
export class AppModule {}

New:

import { DVSClientModule } from '@dveloxsoft/dvs-client/nestjs';

@Module({
  imports: [DVSClientModule.forRoot(config)],
})
export class AppModule {}

For non-Nest apps, use:

import { createDVSClient } from '@dveloxsoft/dvs-client';

const dvs = createDVSClient(config);

Public API

DVSAuthClient

  • login(dto: LoginDto)
  • register(dto: RegisterDto)
  • refreshToken(dto: RefreshTokenDto, accessToken?: string)
  • requestPasswordReset(dto: PasswordResetRequestDto, accessToken?: string)
  • validateResetToken(token: string)
  • resetPassword(dto: ResetPasswordDto, accessToken?: string)
  • activateAccount(code: string, pageId: string, accessToken?: string)
  • resendConfirmationToken(email: string, accessToken?: string)
  • verifyTwoFactor(dto: TwoFactorDto, accessToken?: string)
  • setupTwoFactor(userId: string, accessToken?: string)
  • confirmTwoFactorSetup(dto: TwoFactorDto, accessToken?: string)
  • disableTwoFactor(userId: string, accessToken?: string)
  • logout(refreshToken?: string, accessToken?: string)

DVSUserClient

  • create(dto: CreateUserDto)
  • search(email: string, companyId?: string, accessToken?: string)
  • getFullDetail(email: string, pages: string[], accessToken?: string)
  • findAll(options: PaginationOptions, accessToken: string)
  • findOne(id: string | number, accessToken: string)
  • findByEmail(email: string, accessToken: string, includePassword?: boolean)
  • update(id: string | number, dto: UpdateUserDto, accessToken: string)
  • delete(id: string | number, accessToken: string)
  • deleteWithData(id: string | number, accessToken: string)
  • findPartner(email: string, accessToken: string)
  • updateLastLogin(userId: string | number, accessToken: string)
  • resetPassword(email: string, accessToken: string, password: string, pageId?: string)
  • verifyTwoFactor(userId: string, code: string, accessToken: string)
  • setupTwoFactor(dto: SetupTwoFactorDto, accessToken: string)
  • confirmTwoFactorSetup(userId: string, code: string, accessToken: string)
  • enableTwoFactor(userId: string | number, accessToken: string)
  • disableTwoFactor(userId: string | number, accessToken: string)

DVSNotificationClient

  • sendEmail(dto: SendEmailDto, accessToken: string)
  • sendEmailByTrigger(dto: SendEmailTriggerDto, accessToken: string)
  • createTemplate(dto: CreateEmailTemplateDto, accessToken?: string)
  • getAllTemplates(options: PaginationOptions, accessToken?: string)
  • getTemplatesByCompany(companyId: string, options: PaginationOptions, accessToken?: string)
  • getTemplate(id: string, accessToken?: string)
  • updateTemplate(id: string, dto: UpdateEmailTemplateDto, accessToken?: string)
  • deleteTemplate(id: string, accessToken?: string)
  • testTemplate(template: string, accessToken: string)
  • testEmailConfig(config: TestEmailDto, accessToken: string)
  • deleteAllTemplates(ids: string[], accessToken?: string)
  • deleteTemplatesByCompany(companyId: string, accessToken?: string)

Build and test

npm run build
npm test

The test suite builds both CJS and ESM outputs, runs unit tests with Node's built-in test runner, and executes CJS/ESM smoke imports.