Files
hatchet/frontend/snips
Gabe Ruttner 8e80faf2d6 Fe overhaul docs (#1640)
* api changes

* doc changes

* move docs

* generated

* generate

* pkg

* backmerge main

* revert to main

* revert main

* race?

* remove go tests
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-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-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:

{
  "dependencies": {
    "@hatchet/snips": "workspace:*"
  }
}

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