JSPM

@resiliojs/core

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q75997F
  • License MIT

Framework-independent typed error presentation policy engine

Package Exports

  • @resiliojs/core

Readme

@resiliojs/core

Framework-independent typed error presentation policy engine.

Install

pnpm add @resiliojs/core

What It Provides

  • Runtime-safe public error catalog and decoder
  • Exhaustive, context-aware presentation policies
  • PresentationPlan with 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