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

@panoptic-it-solutions/cloudcockpit-client

v1.0.0

Published

Type-safe API client for CloudCockpit CSP API

Readme

CloudCockpit API Client

Type-safe TypeScript client for the CloudCockpit CSP API.

Installation

npm install @panoptic-it-solutions/cloudcockpit-client

Quick Start

import { createCloudCockpitClient } from '@panoptic-it-solutions/cloudcockpit-client';

const client = createCloudCockpitClient({
  tenant: 'cloud.mwh.ie',
  auth: {
    clientId: process.env.CLOUDCOCKPIT_CLIENT_ID!,
    clientSecret: process.env.CLOUDCOCKPIT_CLIENT_SECRET!,
  },
});

// List customers
const { items, totalCount } = await client.customers.list({ pageSize: 50 });

// Get all customers with auto-pagination
const allCustomers = await client.customers.listAll();

// Iterate efficiently over large datasets
for await (const customer of client.customers.iterate()) {
  console.log(customer.company?.name);
}

Authentication

OAuth Credentials (Recommended)

The client handles token management automatically when you provide OAuth credentials:

const client = createCloudCockpitClient({
  tenant: 'cloud.mwh.ie',
  auth: {
    clientId: process.env.CLOUDCOCKPIT_CLIENT_ID!,
    clientSecret: process.env.CLOUDCOCKPIT_CLIENT_SECRET!,
  },
});

Tokens are cached and automatically refreshed 60 seconds before expiry.

Direct JWT Token

You can also provide a JWT token directly:

const client = createCloudCockpitClient({
  tenant: 'cloud.mwh.ie',
  token: 'your-jwt-token',
});

Or use a dynamic token function:

const client = createCloudCockpitClient({
  tenant: 'cloud.mwh.ie',
  token: async () => fetchTokenFromSomewhere(),
});

Resources

The client provides access to all CloudCockpit API resources:

  • client.auditLogs - Audit log queries
  • client.customers - Customer management (includes users, licenses, domains, MCA, GDAP)
  • client.invoices - Invoice retrieval with line items
  • client.offers - Available offers and pricing
  • client.orders - Order creation
  • client.providers - Provider instances
  • client.resellers - Reseller management (includes margins)
  • client.subscriptions - Subscription management (suspend, reactivate, transitions)
  • client.users - User management

Pagination

Each paginated resource supports three access patterns:

// Single page
const { items, totalCount } = await client.customers.list({ pageSize: 50 });

// All pages to array
const allCustomers = await client.customers.listAll();

// Memory-efficient streaming
for await (const customer of client.customers.iterate()) {
  console.log(customer);
}

Error Handling

import {
  isCloudCockpitError,
  isAuthError,
  isNotFoundError,
  isValidationError,
  isRateLimitError,
} from '@panoptic-it-solutions/cloudcockpit-client';

try {
  await client.customers.get('invalid-id');
} catch (error) {
  if (isNotFoundError(error)) {
    console.log('Customer not found');
  } else if (isAuthError(error)) {
    console.log('Authentication failed');
  } else if (isValidationError(error)) {
    console.log('Validation error:', error.details);
  } else if (isRateLimitError(error)) {
    console.log('Rate limited, retry after:', error.retryAfter);
  }
}

Rate Limiting

Configure rate limiting to stay within API limits:

const client = createCloudCockpitClient({
  tenant: 'cloud.mwh.ie',
  auth: { ... },
  rateLimiter: {
    maxConcurrent: 10,      // Max concurrent requests
    minTime: 100,           // Min ms between requests
    reservoir: 100,         // Max requests per interval
    reservoirRefreshInterval: 60000,  // Refresh interval (1 minute)
  },
});

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | tenant | string | required | Your CloudCockpit tenant domain | | auth | OAuthCredentials | - | OAuth client credentials | | token | string \| () => Promise<string> | - | JWT token (alternative to auth) | | baseUrl | string | https://api.cloudcockpit.com | API base URL | | defaultPageSize | number | 100 | Default page size for list operations | | correlationId | string \| () => string | - | Request correlation ID | | rateLimiter | RateLimiterConfig | - | Rate limiting configuration | | fetch | typeof fetch | - | Custom fetch implementation |

Raw Client Access

For advanced usage, access the underlying openapi-fetch client:

const response = await client.raw.GET('/v1/Customers/{customerId}', {
  params: { path: { customerId: '123' } },
});

TypeScript

Full TypeScript support with generated types from the OpenAPI spec:

import type { components } from '@panoptic-it-solutions/cloudcockpit-client/types';

type Customer = components['schemas']['CustomerCompanyViewModel'];

License

MIT