@resiliojs/core
v0.1.1
Published
Framework-independent typed error presentation policy engine
Maintainers
Readme
@resiliojs/core
Framework-independent typed error presentation policy engine.
Install
pnpm add @resiliojs/coreWhat It Provides
- Runtime-safe public error catalog and decoder
- Exhaustive, context-aware presentation policies
PresentationPlanwith primary and supplemental decisions- Per-decision deduplication
- Optional decision and invalid-payload observation events
import {
createPresentationEvaluator,
defineErrorCatalog,
definePresentationPolicy,
} from '@resiliojs/core';
const policy = definePresentationPolicy(catalog, {
SESSION_EXPIRED: [{
decide: () => ({
channel: 'modal',
severity: 'error',
messageKey: 'errors.sessionExpired',
}),
}],
});
const evaluator = createPresentationEvaluator({ catalog, policy, fallback });
const result = await evaluator.evaluateUnknown(input, { source: 'manual' });See the full documentation.
MIT
