@haykal/shared

v1.0.0

Published

Shared constants, types, and utilities for the Haykal platform.

Downloads

92

Readme

@haykal/shared

Shared constants, types, and utilities for the Haykal platform.

Overview

This is the foundational package that provides shared types and constants used across all Haykal packages. It has zero dependencies and can be safely imported by any package in the monorepo.

Installation

This package is available within the monorepo:

{
  "dependencies": {
    "@haykal/shared": "workspace:*"
  }
}

API Reference

Constants

HTTP_STATUS

Standard HTTP status codes.

import { HTTP_STATUS } from '@haykal/shared';
// HTTP_STATUS.OK === 200

ERROR_CODES

Machine-readable error codes for API responses.

import { ERROR_CODES } from '@haykal/shared';
// ERROR_CODES.VALIDATION_ERROR === 'VALIDATION_ERROR'

Types

ApiResponse<T>

Standard API response envelope.

ApiListResponse<T>

API response with list data and cursor pagination.

ProblemDetails

RFC 7807 Problem Details for error responses.

CursorPagination / CursorPaginationParams

Cursor-based pagination types.

Error Codes

See src/constants/error-codes.ts for the full list of error codes.

Contributing

When adding new constants or types:

  1. Never remove or rename existing error codes (backward compatibility)
  2. Add JSDoc documentation for all exports
  3. Export everything through src/index.ts