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

cgs-compliance-sdk

v2.1.0

Published

Unified TypeScript SDK for CGS Compliance Platform - Geolocation, Risk Profile, and Compliance Orchestration

Readme

cgs-compliance-sdk - Unified CGS Compliance SDK

Comprehensive TypeScript SDK for CGS Compliance Platform - Geolocation, Risk Profiling, and Compliance Orchestration

Features

  • Geolocation Compliance - IP verification, VPN detection, jurisdiction checks, device fingerprinting
  • Risk Profiling - Automated customer risk profile creation and management
  • Compliance Orchestration - Unified registration, login, and transaction verification
  • React Hooks - Ready-to-use hooks for common compliance workflows
  • Tree-Shakeable - Import only what you need
  • Type-Safe - Full TypeScript support with detailed type definitions

Installation

npm install cgs-compliance-sdk
# or
yarn add cgs-compliance-sdk
# or
pnpm add cgs-compliance-sdk

Quick Start

Registration Flow

import { ComplianceClient } from 'cgs-compliance-sdk';

const sdk = new ComplianceClient({
  apiGatewayURL: 'https://api.yourplatform.com',
  tenantId: 'your-casino-id',
  apiKey: 'your-api-key',
  autoCreateProfiles: true
});

// Verify registration with automatic profile creation
const result = await sdk.verifyAtRegistration({
  customerId: 'CUST-12345',
  fullName: 'John Doe',
  emailAddress: '[email protected]',
  ipAddress: req.ip,
  deviceFingerprint: {
    device_id: deviceId,
    user_agent: req.headers['user-agent'],
    platform: 'web'
  }
});

if (result.allowed) {
  // Registration approved
  console.log('Customer profile created:', result.profile);
  console.log('Risk score:', result.profile.risk_score);

  if (result.requiresKYC) {
    // Redirect to KYC flow
  }
} else {
  // Registration blocked
  console.log('Blocked reasons:', result.blockReasons);
}

Login Verification

const loginResult = await sdk.verifyAtLogin({
  customerId: 'CUST-12345',
  ipAddress: req.ip,
  deviceFingerprint: getDeviceFingerprint()
});

if (loginResult.allowed) {
  // Allow login
  if (loginResult.requiresStepUp) {
    // Trigger additional verification (MFA, etc.)
  }
} else {
  // Block login
  console.log('Blocked:', loginResult.blockReasons);
}

Transaction Verification

const txResult = await sdk.verifyAtTransaction({
  customerId: 'CUST-12345',
  ipAddress: req.ip,
  amount: 5000,
  currency: 'USD',
  transactionType: 'withdrawal',
  deviceFingerprint: getDeviceFingerprint()
});

if (txResult.allowed) {
  // Process transaction
} else if (txResult.requiresApproval) {
  // Queue for manual review
} else {
  // Block transaction
  console.log('Blocked:', txResult.blockReasons);
}

Module-Specific Imports

Geolocation Only

import { GeolocationClient } from 'cgs-compliance-sdk/geolocation';

const geoClient = new GeolocationClient({
  baseURL: 'https://api.yourplatform.com',
  tenantId: 'your-casino-id',
  apiKey: 'your-api-key'
});

const verification = await geoClient.verifyIP({
  ip_address: '8.8.8.8',
  user_id: 'user-123',
  event_type: 'login'
});

Risk Profile Only

import { RiskProfileClient } from 'cgs-compliance-sdk/risk-profile';

const riskClient = new RiskProfileClient({
  baseURL: 'https://api.yourplatform.com',
  tenantId: 'your-casino-id',
  apiKey: 'your-api-key'
});

const profile = await riskClient.getProfile('CUST-12345');
console.log('Risk category:', profile.risk_category);

React Hooks

import { useRegistration, useCustomerProfile } from 'cgs-compliance-sdk';

function RegistrationForm() {
  const { verifyRegistration, loading, error } = useRegistration(sdk, {
    onSuccess: (result) => {
      console.log('Registration approved!', result.profile);
      navigate('/dashboard');
    },
    onBlocked: (result) => {
      alert(`Registration blocked: ${result.blockReasons.join(', ')}`);
    }
  });

  const handleSubmit = async (formData) => {
    await verifyRegistration({
      customerId: formData.customerId,
      fullName: formData.fullName,
      emailAddress: formData.email,
      ipAddress: await getClientIP(),
      deviceFingerprint: getDeviceFingerprint()
    });
  };

  return (
    <form onSubmit={handleSubmit}>
      {/* Your form fields */}
      <button disabled={loading}>
        {loading ? 'Verifying...' : 'Register'}
      </button>
      {error && <ErrorMessage>{error.message}</ErrorMessage>}
    </form>
  );
}

API Documentation

ComplianceClient

Main orchestration client that combines geolocation and risk profiling.

Configuration

interface CGSConfig {
  geolocationServiceURL: string;
  riskProfileServiceURL: string;
  tenantId: string;
  apiKey?: string;
  timeout?: number;
  retries?: number;
  debug?: boolean;
  autoCreateProfiles?: boolean;
}

Methods

  • verifyAtRegistration(request) - Complete registration verification with profile creation
  • verifyAtLogin(request) - Login verification with profile update
  • verifyAtTransaction(request) - Transaction verification with amount-based risk
  • verifyEvent(request) - Generic event verification

GeolocationClient

IP verification, jurisdiction checks, and device fingerprinting.

See Geolocation SDK Documentation for details.

RiskProfileClient

Customer risk profile management.

See Risk Profile SDK Documentation for details.

Migration from @cgs/geolocation-sdk

The unified SDK is fully backward compatible. See Migration Guide for details.

// Before (@cgs/geolocation-sdk v1.x)
import { GeolocationClient } from '@cgs/geolocation-sdk';

// After (cgs-compliance-sdk v2.x) - Same API
import { GeolocationClient } from 'cgs-compliance-sdk/geolocation';

Examples

Architecture Overview

API Gateway Pattern

IMPORTANT: All SDK requests go through the API Gateway. Direct access to individual services is not permitted for third parties.

Casino Platform → CGS SDK → API Gateway → Backend Services
                                ↓
                    ┌───────────┴───────────┐
                    ↓                       ↓
            Geolocation Service    Risk Profile Service
                    ↓                       ↓
                   Kafka Event Bus
                    ↓
        ┌───────────┼───────────┬───────────┐
        ↓           ↓           ↓           ↓
   KYC Service  AML Service  Fraud Service  Analytics
        ↓           ↓           ↓
   All publish events consumed by Risk Profile Service

Event-Driven Profile Updates

Customer risk profiles are automatically updated via Kafka events from all compliance services:

Geolocation Events → Updates location, compliance status, geo risk factor KYC Events → Updates KYC status, identity verification, KYC risk factor AML Events → Updates watchlist matches, PEP status, sanctions, AML risk factor Fraud Events → Updates flagged transactions, fraud risk factor

This ensures customer profiles always reflect the latest compliance data from all sources.

License

MIT

Support

For issues and questions, please visit GitHub Issues