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

@perkos/schema-validation

v1.0.0

Published

Zod validation schemas for AI and payment services

Downloads

113

Readme

@perkos/schema-validation

Zod validation schemas for AI and payment services.

Installation

npm install @perkos/schema-validation

Usage

AI Validators

import {
  imageAnalyzeSchema,
  imageGenerateSchema,
  textSummarizeSchema,
  validate,
  safeValidate,
} from "@perkos/schema-validation";

// Or import specifically from ai subpath
import { codeGenerateSchema } from "@perkos/schema-validation/ai";

// Validate with parse (throws on error)
const input = validate(imageAnalyzeSchema, {
  image: "https://example.com/image.jpg",
  question: "What is in this image?",
});

// Safe validate (returns result object)
const result = safeValidate(imageGenerateSchema, requestBody);
if (result.success) {
  console.log(result.data.prompt);
} else {
  console.error(result.error.errors);
}

Payment Validators

import {
  paymentEnvelopeSchema,
  ethereumAddressSchema,
  networkSchema,
} from "@perkos/schema-validation";

// Or import from payment subpath
import { paymentConfigSchema } from "@perkos/schema-validation/payment";

// Validate Ethereum address
const address = ethereumAddressSchema.parse("0x1234...");

// Validate payment envelope
const envelope = paymentEnvelopeSchema.parse({
  payload: {
    from: "0x...",
    to: "0x...",
    value: "1000000",
    validAfter: 0,
    validBefore: Date.now() + 3600000,
    nonce: "abc123",
    network: "eip155:43114",
  },
  signature: "0x...",
});

AI Schemas

Vision & Image

  • imageAnalyzeSchema - Image analysis requests
  • imageGenerateSchema - Image generation (DALL-E, SDXL)
  • ocrExtractSchema - OCR text extraction

Audio

  • textSynthesizeSchema - Text-to-speech
  • audioTranscribeSchema - Speech-to-text

Text Processing

  • textSummarizeSchema - Text summarization
  • textTranslateSchema - Translation
  • sentimentAnalyzeSchema - Sentiment analysis
  • contentModerateSchema - Content moderation
  • textSimplifySchema - Text simplification
  • entityExtractSchema - Named entity extraction

Content Generation

  • emailGenerateSchema - Email generation
  • productDescriptionSchema - Product descriptions
  • seoOptimizeSchema - SEO optimization

Code & Technical

  • codeGenerateSchema - Code generation
  • codeReviewSchema - Code review
  • sqlQuerySchema - SQL query generation
  • regexGenerateSchema - Regex generation
  • apiDocsSchema - API documentation

Educational

  • quizGenerateSchema - Quiz generation

Payment Schemas

Network & Chain

  • networkSchema - Supported networks enum
  • caip2NetworkSchema - CAIP-2 network format
  • ethereumAddressSchema - Ethereum address validation
  • transactionHashSchema - Transaction hash validation
  • signatureSchema - Signature format validation

Payment

  • paymentEnvelopeSchema - x402 payment envelope
  • paymentConfigSchema - Payment configuration
  • paymentRequestSchema - Payment request
  • paymentVerificationSchema - Payment verification

Token

  • tokenInfoSchema - ERC20 token info
  • eip712DomainSchema - EIP-712 domain

Settlement

  • settlementRequestSchema - Settlement request
  • settlementResultSchema - Settlement result

Utility Functions

validate(schema, data)

Parse and validate data, throwing on errors.

safeValidate(schema, data)

Safely validate, returning { success, data } or { success, error }.

formatZodErrors(error)

Format Zod errors for API responses.

import { formatZodErrors } from "@perkos/schema-validation";

try {
  schema.parse(data);
} catch (error) {
  if (error instanceof z.ZodError) {
    const formatted = formatZodErrors(error);
    // [{ path: "email", message: "Invalid email", code: "invalid_string" }]
  }
}

Type Inference

All schemas export inferred TypeScript types:

import type {
  ImageAnalyzeInput,
  PaymentEnvelope,
  Network,
} from "@perkos/schema-validation";

License

MIT