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

@io.complyance/unify-sdk

v3.0.0

Published

TypeScript SDK for the Complyance Unified e-invoicing platform

Readme

Complyance TypeScript SDK

TypeScript SDK for the Complyance Unified e-invoicing platform. This SDK provides a native TypeScript interface for integrating e-invoicing compliance into your Node.js applications.

Installation

npm install @complyance/sdk
# or
yarn add @complyance/sdk

Quick Start

import {
  ComplyanceSDK,
  DocumentType,
  Environment,
  Mode,
  Operation,
  Purpose,
  SDKConfigBuilder,
} from '@complyance/sdk';

// Configure the SDK
const config = new SDKConfigBuilder()
  .apiKey('your-api-key')
  .environment(Environment.SANDBOX)
  .useRetryPreset('default')
  .build();

ComplyanceSDK.configure(config);

// Use the SDK
async function submitInvoice() {
  try {
    const response = await ComplyanceSDK.pushToUnify({
      source: {
        id: 'my-erp',
        type: 'first_party',
        name: 'My ERP System',
      },
      documentType: DocumentType.TAX_INVOICE,
      country: 'SA',
      operation: Operation.SINGLE,
      mode: Mode.DOCUMENTS,
      purpose: Purpose.INVOICING,
      payload: {
        // Your invoice data here
        invoice_number: 'INV-001',
        issue_date: '2023-09-15',
        // ...
      },
    });

    console.log('Response:', response);
  } catch (error) {
    console.error('Error:', error);
  }
}

submitInvoice();

Configuration

Using the Builder Pattern

import { Environment, SDKConfigBuilder } from '@complyance/sdk';

const config = new SDKConfigBuilder()
  .apiKey('your-api-key')
  .environment(Environment.SANDBOX)
  .addSource({
    id: 'my-erp',
    type: 'first_party',
    name: 'My ERP System',
  })
  .useRetryPreset('aggressive')
  .timeout(60000)
  .logLevel('debug')
  .build();

Using Environment Variables

import { SDKConfig } from '@complyance/sdk';

// Set environment variables
process.env.COMPLYANCE_API_KEY = 'your-api-key';
process.env.COMPLYANCE_ENVIRONMENT = 'sandbox';
process.env.COMPLYANCE_RETRY_PRESET = 'default';
process.env.COMPLYANCE_TIMEOUT = '30000';
process.env.COMPLYANCE_LOG_LEVEL = 'info';

const config = SDKConfig.fromEnv();

Express.js Integration

The SDK provides built-in middleware for Express.js applications:

import {
  ComplyanceSDK,
  Environment,
  SDKConfigBuilder,
  complyanceMiddleware,
} from '@complyance/sdk';
import express from 'express';

const app = express();
app.use(express.json());

// Configure the SDK
ComplyanceSDK.configure(
  new SDKConfigBuilder().apiKey('your-api-key').environment(Environment.SANDBOX).build()
);

// Use the middleware
app.post(
  '/api/documents',
  complyanceMiddleware({
    requestExtractor: (req) => req.body,
  })
);

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Custom Response Handling

app.post(
  '/api/documents',
  complyanceMiddleware({
    requestExtractor: (req) => req.body,
    responseHandler: (res, unifyResponse) => {
      res.status(200).json({
        success: true,
        documentId: unifyResponse.data?.document?.documentId,
        message: 'Document processed successfully',
      });
    },
  })
);

Validation Middleware

app.post(
  '/api/validate',
  complyanceValidationMiddleware({
    requestExtractor: (req) => req.body,
  }),
  (req, res) => {
    // This handler will only be called if validation passes
    res.status(200).json({
      valid: true,
      message: 'Request validation passed',
    });
  }
);

For more details, see the Express.js Middleware Documentation.

Error Handling

import { APIError, ComplyanceSDK, NetworkError, ValidationError } from '@complyance/sdk';

try {
  const response = await ComplyanceSDK.pushToUnify(request);
} catch (error) {
  if (error instanceof ValidationError) {
    console.error(`Validation error: ${error.message}`);
    console.error(`Suggestion: ${error.suggestion}`);
  } else if (error instanceof NetworkError) {
    console.error(`Network error: ${error.message}`);
    // Implement retry logic or fallback
  } else if (error instanceof APIError) {
    console.error(`API error (${error.statusCode}): ${error.message}`);
    console.error(`Error code: ${error.code}`);
  } else {
    console.error(`Unexpected error: ${error.message}`);
  }
}

Retry Configuration

import { SDKConfigBuilder, RetryPresets } from '@complyance/sdk';

// Use a preset
const config = new SDKConfigBuilder().apiKey('your-api-key').useRetryPreset('aggressive').build();

// Or customize retry behavior
const config = new SDKConfigBuilder()
  .apiKey('your-api-key')
  .retryConfig({
    maxAttempts: 5,
    baseDelay: 500,
    maxDelay: 30000,
    backoffMultiplier: 2,
    jitterFactor: 0.2,
    circuitBreakerEnabled: true,
    failureThreshold: 5,
    circuitBreakerTimeout: 60000,
    retryableHttpCodes: [408, 429, 500, 502, 503, 504],
  })
  .build();

License

Proprietary - Copyright © Complyance