Package Exports
- fusion-tokens
- fusion-tokens/dist-browser-cjs/index.js
- fusion-tokens/dist-browser-esm/index.js
- fusion-tokens/dist-node-cjs/index.js
- fusion-tokens/dist-node-esm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fusion-tokens) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fusion-tokens
Dependency injection tokens for Fusion.js.
Fusion.js dependency injection is based on tokens rather than strings. This avoids naming collision issues. This package provides utilities to create named tokens, as well as common tokens that are used by packages maintained by the Fusion.js team.
Table of contents
Installation
yarn add fusion-tokensAPI
FetchToken
import {FetchToken} from 'fusion-tokens';A token for a fetch implementation.
Types
type Fetch = (input: string, options: Object) => Promise<Response>Typically, fetch or a polyfill such as unfetch.
LoggerToken
import {LoggerToken} from 'fusion-tokens';A token for a logger implementation.
Types
type Logger = {
log(level: string, arg: any): void,
error(arg: any): void,
warn(arg: any): void,
info(arg: any): void,
verbose(arg: any): void,
debug(arg: any): void,
silly(arg: any): void,
}Typically, console or a logger library such as Winston.
SessionToken
import {SessionToken} from 'fusion-tokens';A token for a session implementation.
Types
type Session = {
from(ctx: Context): {
get(key: string): any,
set(key: string, val: any): void,
},
}Typically, the service provided by fusion-plugin-jwt or a custom wrapper around similar key-value store APIs (such as Redis).
CacheToken
import {CacheToken} from 'fusion-tokens';A token for a caching implementation.
Types
type Cache = {
get(key: string): Promise<mixed>,
set(key: string, val: any): Promise<mixed>,
del(key: string): Promise<mixed>,
}Standard API for caching.