@aopslabs/xf-core
v0.2.1
Published
Shared result types, retry and timeout helpers, typed errors, and data-sanitizing utilities for TypeScript services and libraries.
Readme
@aopslabs/xf-core
Shared result types, retry and timeout helpers, typed errors, and data-sanitizing utilities for TypeScript services and libraries.
Installation
npm install @aopslabs/xf-coreUsage
import {
executeWithRetry,
executeWithTimeout,
failure,
success
} from '@aopslabs/xf-core';
const result = await executeWithRetry(
() => fetch('/health').then((response) => response.json()),
{ maxRetries: 3, retryDelayMs: 250 }
);
const value = await executeWithTimeout(Promise.resolve('ready'), 1_000);
const outcome = value === 'ready' ? success(value) : failure('not_ready');Main surfaces
- Result helpers for success, failure, chaining, and error inspection
- Retry helpers with fixed or exponential backoff
- Promise timeouts with operation-aware errors
- Typed error classes and Effect integration
- URL and structured-data sanitizers
- Date, identifier, and TypeScript utility types
The optional logger parameters use @aopslabs/xf-logger.
Entrypoints
| Import | Purpose |
| --- | --- |
| @aopslabs/xf-core | Runtime helpers and public types |
| @aopslabs/xf-core/test | Test-state helper types |
License
Copyright (c) 2026 Mehmet Zeki Sönmez.
Licensed under the PolyForm Strict License 1.0.0. The license permits noncommercial use and does not grant permission to modify or redistribute the package.
