@esposter/shared
v2.31.1
Published
A library that contains shared typescript code.
Maintainers
Readme
@esposter/shared
Shared TypeScript utilities, types, and error classes for the Esposter platform. Works in both browser and server environments.
Table of Contents
🚀 Getting Started
pnpm i @esposter/shared @vueuse/core vue zod📖 Documentation
We highly recommend you take a look at the documentation to level up.
Key Exports
Error Classes
import { InvalidOperationError, NotFoundError, ForbiddenError, NotInitializedError } from "@esposter/shared";
throw new InvalidOperationError(Operation.Read, file.name, zodError.message);Array Utilities
import { takeOne } from "@esposter/shared";
// Safe index access — throws on out-of-bounds instead of returning undefined
const first = takeOne(items, 0);Type Utilities
import type { ToData, DeepOmit, GetPaths } from "@esposter/shared";
// ToData<T> — strips class methods, returns plain data shape
type RawColumn = ToData<Column>;Reactivity
import { toRawDeep, getRawData } from "@esposter/shared";
// Recursively unwrap Vue reactive proxies
const raw = toRawDeep(reactiveObject);Text / String
import { capitalize, truncate, toKebabCase } from "@esposter/shared";Error Handling (Result Pattern)
import { getResult, getResultAsync, withFinalizer } from "@esposter/shared";Commands
Run from packages/shared/:
pnpm build # compile to dist/
pnpm test # vitest watch mode (coverage is run from the repo root)
pnpm lint:fix # auto-fix lint
pnpm typecheck # type check⚖️ License
This project is licensed under the Apache-2.0 license.