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

@wuemv/content-sdk

v0.2.0

Published

SDK for Wue Content Management System — type generation, API client, schema validation, and helpers.

Readme

@wuemv/content-sdk

TypeScript SDK for Wue CMS — API client, schema-driven validation, type generation, and helpers for building storefronts.

Install

npm install @wuemv/content-sdk

Quick Start

import { WueClient } from '@wuemv/content-sdk'

const client = new WueClient({
  url: 'https://your-cms.com/api/v1',
  token: 'your-tenant-api-token',
})

// Fetch contacts + form config
const { contacts, form } = await client.getContacts()

// Fetch booking packages + pricing
const { packages, form: bookingForm } = await client.getBookingConfig()

// Submit a contact form
const result = await client.submitContactForm({
  full_name: 'John Doe',
  email: '[email protected]',
  message: 'Hello!',
})
console.log(result.reference) // "CF-2026-0001"

API Client

Setup

import { WueClient } from '@wuemv/content-sdk'

const client = new WueClient({
  url: process.env.CMS_API_URL,   // e.g. https://cms.example.com/api/v1
  token: process.env.CMS_API_TOKEN,
})

Methods

| Method | Returns | Description | |--------|---------|-------------| | getContacts() | { contacts, form } | Display contacts + contact form schema | | submitContactForm(data) | { reference, message } | Submit a contact form entry | | getBookingConfig() | { content_type, packages, guest_fields, form } | Booking packages with pricing + guest form schema | | submitBooking(payload) | { reference, status, message } | Submit a booking request | | getEntries(typeSlug) | T[] | Published entries for a content type | | getEntry(typeSlug, entrySlug) | T | Single entry by slug | | getSchema() | ContentTypeSchema[] | All content type schemas | | getContentTypeSchema(slug) | ContentTypeSchema | Schema for one content type | | getSettings() | Record<string, any> | Tenant settings | | getGalleries() | any[] | Photo galleries |

Error Handling

The client throws WueApiError on non-2xx responses, preserving the HTTP status and response body:

import { WueApiError } from '@wuemv/content-sdk'

try {
  await client.submitContactForm(data)
} catch (err) {
  if (err instanceof WueApiError) {
    console.log(err.status)  // 422
    console.log(err.data)    // { message: "...", errors: { email: ["..."] } }
  }
}

Schema Validation

Validate form data against field definitions from the CMS — client-side, before submitting. Rules mirror the CMS backend exactly.

import { validateForm, validateField } from '@wuemv/content-sdk'

// Validate entire form — returns { fieldKey: errorMessage } (empty = valid)
const errors = validateForm(schema.fields, formData)

if (Object.keys(errors).length === 0) {
  // valid — submit
}

// Validate a single field (e.g. on blur)
const error = validateField(field, value, formData)
// null = valid, string = error message

Supported Rules

| Field Type | Validations | |------------|-------------| | text | required, max length (default 255), min length, pattern regex | | email | required, email format, max 255 | | url | required, URL format, max 255 | | number | required, numeric, min/max value | | textarea / richtext | required, min/max length | | date | required, YYYY-MM-DD format | | select | required, value must be in choices | | boolean | required, must be true/false | | tags | must be array | | image | must be string |

Hidden fields (via conditions) are automatically skipped.

Helpers

import { flattenFields, isFieldVisible } from '@wuemv/content-sdk'

// Unwrap sections into a flat list of data fields
const flat = flattenFields(schema.fields)

// Check if a field is visible given current form state
const visible = isFieldVisible(field, formData)

Type Generation (CLI)

Generate TypeScript interfaces from your CMS content type schemas:

npx wue-content generate-types --url=https://cms.example.com/api/v1 --token=abc123

Or via environment variables:

export WUE_CONTENT_API_URL=https://cms.example.com/api/v1
export WUE_CONTENT_API_TOKEN=abc123
npx wue-content generate-types

Output (default ./types/content.ts):

// Auto-generated — do not edit
export interface DivePackagesEntry {
  id: number
  slug: string
  title: string
  content: string
  nights: number
  // ...
}

CLI Options

| Flag | Default | Description | |------|---------|-------------| | --url | WUE_CONTENT_API_URL | CMS API base URL | | --token | WUE_CONTENT_API_TOKEN | Tenant API token | | --output | ./types/content.ts | Output file path |

TypeScript Types

All types are exported for use in your frontend:

import type {
  // Field system
  FieldType,
  FieldWidth,
  FieldDefinition,
  FieldOptions,
  FieldCondition,

  // Contacts
  Contact,
  ContactType,
  ContactsResponse,
  ContactFormSchema,
  ContactSubmitResponse,

  // Bookings
  BookingPackage,
  BookingPricingOption,
  BookingConfigResponse,
  BookingFormSchema,
  BookingSubmitPayload,
  BookingSubmitResponse,
  BookingContentType,

  // Content
  ContentTypeSchema,
  FieldSchema,

  // Config
  WueConfig,
} from '@wuemv/content-sdk'

Field Types (Fixed Vocabulary)

type FieldType =
  | 'text' | 'textarea' | 'richtext' | 'email'
  | 'number' | 'date' | 'select' | 'boolean'
  | 'url' | 'tags' | 'image' | 'section'

type FieldWidth = 3 | 4 | 6 | 12  // 12-column grid fractions

Usage with Nuxt

The SDK is designed for server-side usage in Nuxt — keep the tenant token out of the browser:

// server/utils/cms.ts
import { WueClient } from '@wuemv/content-sdk'

export function useCmsClient(): WueClient {
  const config = useRuntimeConfig()
  return new WueClient({
    url: config.cmsApiUrl,
    token: config.cmsApiToken,
  })
}

// server/api/cms/contacts.get.ts
export default defineEventHandler(async () => {
  const client = useCmsClient()
  const data = await client.getContacts()
  return { data }
})

Browser-side code calls local Nuxt server routes — never touches the CMS directly.

License

MIT