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

@bernardo.paroli/nestjs-inswitch-sdk

v1.0.15-alpha

Published

Inswitch sdk for NestJS

Downloads

22

Readme

NestJS Inswitch SDK

Wrapper oficial de NestJS para el SDK de Inswitch. Proporciona integración nativa con el framework NestJS mediante decoradores, inyección de dependencias y configuración modular.

Instalación

npm install @bernardo.paroli/nestjs-inswitch-sdk

Características

  • 🏗️ Integración NestJS nativa - Módulo global con inyección de dependencias
  • TypeScript completo - Tipado completo heredado del SDK base
  • 🔧 Configuración flexible - Soporte para configuración síncrona y asíncrona
  • 🔐 Autenticación automática - Manejo automático de tokens y renovación
  • 🌍 Multi-ambiente - Soporte para sandbox y producción
  • Cliente HTTP optimizado - Basado en el SDK oficial de Inswitch

Inicio Rápido

1. Configuración del Módulo

Configuración Síncrona

import { Module } from '@nestjs/common';
import { InswitchModule } from '@bernardo.paroli/nestjs-inswitch-sdk';

@Module({
  imports: [
    InswitchModule.register({
      env: 'sbx', // 'sbx' para sandbox, 'prod' para producción
      credentials: {
        user: process.env.INSWITCH_USER,
        password: process.env.INSWITCH_PASSWORD,
        apikey: process.env.INSWITCH_API_KEY,
      },
      usageType: 'client', // 'client' o 'management'
      autoFetchToken: true
    })
  ],
})
export class AppModule {}

Configuración Asíncrona

import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { InswitchModule } from '@bernardo.paroli/nestjs-inswitch-sdk';

@Module({
  imports: [
    ConfigModule.forRoot(),
    InswitchModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        env: configService.get('INSWITCH_ENV'),
        credentials: {
          user: configService.get('INSWITCH_USER'),
          password: configService.get('INSWITCH_PASSWORD'),
          apikey: configService.get('INSWITCH_API_KEY'),
        },
        usageType: configService.get('INSWITCH_USAGE_TYPE'),
        autoFetchToken: true
      }),
      inject: [ConfigService],
    }),
  ],
})
export class AppModule {}

2. Uso en Servicios

import { Injectable } from '@nestjs/common';
import { InjectInswitchAPISDKProvider } from '@bernardo.paroli/nestjs-inswitch-sdk';
import { InswitchAPISDK } from '@bernardo.paroli/inswich-sdk';

@Injectable()
export class EntityService {
  constructor(
    @InjectInswitchAPISDKProvider()
    private readonly inswitchSDK: InswitchAPISDK
  ) {}

  async getAllEntities() {
    return await this.inswitchSDK.entities.getEntities();
  }

  async createEntity(entityData: any) {
    return await this.inswitchSDK.entities.createEntity(entityData);
  }

  async createWallet(walletData: any) {
    return await this.inswitchSDK.wallets.createWallet(walletData);
  }
}

3. Uso en Controladores

import { Controller, Get, Post, Body } from '@nestjs/common';
import { InjectInswitchAPISDKProvider } from '@bernardo.paroli/nestjs-inswitch-sdk';
import { InswitchAPISDK } from '@bernardo.paroli/inswich-sdk';

@Controller('entities')
export class EntityController {
  constructor(
    @InjectInswitchAPISDKProvider()
    private readonly inswitchSDK: InswitchAPISDK
  ) {}

  @Get()
  async getEntities() {
    const result = await this.inswitchSDK.entities.getEntities();
    return result.data;
  }

  @Post()
  async createEntity(@Body() entityData: any) {
    return await this.inswitchSDK.entities.createEntity(entityData);
  }
}

Configuración Avanzada

Configuración con Factory Class

import { Injectable } from '@nestjs/common';
import { 
  InswitchModuleOptionsFactory, 
  InswitchModuleOptions 
} from '@bernardo.paroli/nestjs-inswitch-sdk';

@Injectable()
export class InswitchConfigService implements InswitchModuleOptionsFactory {
  createInswitchModuleOptions(): InswitchModuleOptions {
    return {
      env: process.env.NODE_ENV === 'production' ? 'prod' : 'sbx',
      credentials: {
        user: process.env.INSWITCH_USER,
        password: process.env.INSWITCH_PASSWORD,
        apikey: process.env.INSWITCH_API_KEY,
      },
      usageType: 'client',
      autoFetchToken: true
    };
  }
}

@Module({
  imports: [
    InswitchModule.registerAsync({
      useClass: InswitchConfigService,
    }),
  ],
})
export class AppModule {}

Configuración con Providers Adicionales

@Module({
  imports: [
    InswitchModule.registerAsync({
      useFactory: (configService: ConfigService, logger: Logger) => {
        logger.log('Configurando Inswitch SDK...');
        return {
          env: configService.get('INSWITCH_ENV'),
          credentials: {
            user: configService.get('INSWITCH_USER'),
            password: configService.get('INSWITCH_PASSWORD'),
            apikey: configService.get('INSWITCH_API_KEY'),
          },
          usageType: 'client',
          autoFetchToken: true
        };
      },
      inject: [ConfigService, Logger],
      extraProviders: [Logger],
    }),
  ],
})
export class AppModule {}

Servicios Disponibles

Una vez inyectado el SDK, tienes acceso a todos los servicios del SDK base:

🔐 Autenticación

const token = await this.inswitchSDK.auth.getToken();

🏢 Entidades

const entities = await this.inswitchSDK.entities.getEntities();
const entity = await this.inswitchSDK.entities.createEntity(data);

💰 Billeteras

const wallets = await this.inswitchSDK.wallets.getWallets();
const wallet = await this.inswitchSDK.wallets.createWallet(data);

🔍 KYC

const kycResult = await this.inswitchSDK.kyc.performCheck(data);

Tipos TypeScript

El módulo exporta todos los tipos necesarios:

import { 
  InswitchModuleOptions,
  InswitchModuleAsyncOptions,
  InswitchModuleOptionsFactory,
  InjectInswitchAPISDKProvider
} from '@bernardo.paroli/nestjs-inswitch-sdk';

// También tienes acceso a todos los tipos del SDK base
import { 
  Entity, 
  EntityRequest, 
  Wallet, 
  WalletRequest,
  KYCCheckResponse,
  Token 
} from '@bernardo.paroli/inswich-sdk';

Ejemplo Completo

// app.module.ts
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { InswitchModule } from '@bernardo.paroli/nestjs-inswitch-sdk';
import { EntityModule } from './entity/entity.module';

@Module({
  imports: [
    ConfigModule.forRoot(),
    InswitchModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        env: configService.get('INSWITCH_ENV', 'sbx'),
        credentials: {
          user: configService.get('INSWITCH_USER'),
          password: configService.get('INSWITCH_PASSWORD'),
          apikey: configService.get('INSWITCH_API_KEY'),
        },
        usageType: 'client',
        autoFetchToken: true
      }),
      inject: [ConfigService],
    }),
    EntityModule,
  ],
})
export class AppModule {}

// entity.service.ts
import { Injectable } from '@nestjs/common';
import { InjectInswitchAPISDKProvider } from '@bernardo.paroli/nestjs-inswitch-sdk';
import { InswitchAPISDK } from '@bernardo.paroli/inswich-sdk';

@Injectable()
export class EntityService {
  constructor(
    @InjectInswitchAPISDKProvider()
    private readonly inswitchSDK: InswitchAPISDK
  ) {}

  async findAll() {
    const result = await this.inswitchSDK.entities.getEntities();
    return result.data;
  }

  async create(createEntityDto: any) {
    return await this.inswitchSDK.entities.createEntity(createEntityDto);
  }
}

Dependencias

Este paquete es un wrapper del SDK oficial de Inswitch:

  • @bernardo.paroli/inswich-sdk: SDK base de Inswitch
  • @nestjs/common: Para decoradores y funcionalidades de NestJS

Soporte

Para soporte técnico y documentación adicional:

  • SDK base: Consulta la documentación de @bernardo.paroli/inswich-sdk
  • Wrapper NestJS: Contacta al equipo de desarrollo