Files
hatchet/frontend/snips
matt d81f7db5e2 Fix: TS CI (#2117)
* fix: ts ci

* chore: gen
2025-08-12 07:54:03 -04:00
..
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-08-12 07:54:03 -04:00
2025-05-05 08:17:29 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00

Snips Library

A TypeScript utility library for use within the Hatchet monorepo.

Installation

This package is intended for internal use within the Hatchet monorepo. You can add it to your project by adding it as a dependency in your package.json:

Usage

import { createClient, wrapResult } from '@hatchet/snips';

// Create a configured client
const client = createClient({
  baseUrl: 'https://api.example.com',
});

// Use the wrapResult utility to handle errors
const fetchData = async () => {
  const result = await wrapResult(fetch('https://api.example.com/data'));

  if (result.success) {
    return result.data;
  } else {
    console.error(result.error);
  }
};

Development

# Install dependencies
pnpm install

# Build the package
pnpm build

# Watch for changes during development
pnpm dev

# Lint code
pnpm lint:check

# Fix linting issues
pnpm lint:fix

Adding to the Library

When adding new functionality to this library, please follow these guidelines:

  1. Add types to src/types.ts
  2. Add utility functions to appropriate files in src/
  3. Export public API from src/index.ts
  4. Update documentation
  5. Run tests if applicable