@esposter/shared
Provides shared TypeScript utilities, types and error classes for the Esposter platform.
Design notes live in the specs.
Table of Contents
- 🚀 Getting Started
- 🧩 Key Exports
- ⚖️ License
🚀 Getting Started
Install the package and zod.
pnpm i @esposter/shared zod
The package works in browser and server environments.
🧩 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";
// The first item, typed without `undefined`; an out-of-bounds index still yields `undefined` at runtime
const first = takeOne(items);
Type Utilities
import type { ToData, DeepOmit, GetPaths } from "@esposter/shared";
// ToData<T> — the plain data shape of T, with its `toJSON` method removed at every depth
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";
⚖️ License
This project is licensed under the Apache-2.0 license.