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

@lms-cms/adapters

v0.2.3

Published

Adapter layer for the LMS CMS system, providing data fetching and integration capabilities.

Downloads

1,279

Readme

@lms-cms/adapters

Adapter layer for the LMS CMS system, providing data fetching and integration capabilities.

Overview

This package contains adapters that bridge the core LMS CMS functionality with external data sources and APIs. It leverages React Query for efficient data fetching, caching, and state management.

Installation

npm install @lms-cms/adapters

Dependencies

  • @lms-cms/core: Core LMS CMS functionality
  • @tanstack/react-query: Data fetching and state management
  • React (peer dependency): >=18.0.0
  • React DOM (peer dependency): >=18.0.0

Features

  • REST Adapter: HTTP-based content management
  • GraphQL Adapter: GraphQL API integration
  • Mock Adapter: In-memory adapter for development and testing
  • Seed Mock Adapter: Mock adapter with pre-populated sample data
  • Type-Safe: Full TypeScript support with proper interfaces
  • Configurable: Flexible configuration options for each adapter type

Usage

REST Adapter

import { createRestAdapter } from '@lms-cms/adapters';
import type { RestAdapterConfig } from '@lms-cms/adapters';

const config: RestAdapterConfig = {
  baseUrl: 'https://api.example.com',
  headers: {
    'Authorization': 'Bearer token',
    'Content-Type': 'application/json'
  }
};

const adapter = createRestAdapter(config);

// Use with LMSProvider
<LMSProvider adapter={adapter} tenantId="tenant-1">
  <App />
</LMSProvider>

GraphQL Adapter

import { createGraphQLAdapter } from '@lms-cms/adapters';
import type { GraphQLAdapterConfig } from '@lms-cms/adapters';

const config: GraphQLAdapterConfig = {
  endpoint: 'https://api.example.com/graphql',
  headers: {
    'Authorization': 'Bearer token'
  }
};

const adapter = createGraphQLAdapter(config);

Mock Adapter

import { createMockAdapter } from '@lms-cms/adapters';

// Basic mock adapter
const adapter = createMockAdapter({
  delay: 500, // Simulate network delay
  initialDocs: [] // Start with empty documents
});

// Mock adapter with sample data
const seededAdapter = createMockAdapter({
  delay: 300,
  initialDocs: [
    {
      id: 'doc-1',
      version: 1,
      meta: { title: 'Sample Document' },
      blocks: []
    }
  ]
});

Seed Mock Adapter

import { createSeedMockAdapter } from '@lms-cms/adapters';

// Create mock adapter with pre-populated sample content
const adapter = createSeedMockAdapter({
  delay: 200
  // Automatically includes sample documents
});

API Reference

Adapter Factory Functions

createRestAdapter(config: RestAdapterConfig): IContentAdapter

Creates a REST API adapter for HTTP-based content management.

RestAdapterConfig:

  • baseUrl: string: Base URL for the API
  • headers?: Record<string, string>: Default HTTP headers
  • timeout?: number: Request timeout in milliseconds

createGraphQLAdapter(config: GraphQLAdapterConfig): IContentAdapter

Creates a GraphQL adapter for GraphQL API integration.

GraphQLAdapterConfig:

  • endpoint: string: GraphQL endpoint URL
  • headers?: Record<string, string>: Default HTTP headers
  • timeout?: number: Request timeout in milliseconds

createMockAdapter(options?: MockAdapterOptions): IContentAdapter

Creates an in-memory mock adapter for development and testing.

MockAdapterOptions:

  • delay?: number: Simulated network delay in milliseconds
  • initialDocs?: ContentDoc[]: Initial documents to populate the adapter

createSeedMockAdapter(options?: MockAdapterOptions): IContentAdapter

Creates a mock adapter with pre-populated sample data.

MockAdapterOptions:

  • delay?: number: Simulated network delay in milliseconds

Type Definitions

  • RestAdapterConfig: Configuration interface for REST adapters
  • GraphQLAdapterConfig: Configuration interface for GraphQL adapters

Development

# Install dependencies
npm install

# Run development build
npm run dev

# Build for production
npm run build

# Run tests
npm run test

# Type checking
npm run type-check

Scripts

  • npm run build: Build the package for production
  • npm run dev: Build in watch mode for development
  • npm run test: Run tests with Vitest
  • npm run type-check: Run TypeScript type checking without emitting files