An immutable key-value mapped context that can be passed to any (@link IAction}. All actors that receive a context must forward this context to any actor, mediator or bus that it calls. This context may be transformed before forwarding.

For type-safety, the keys of this context can only be instances of IActionContextKey, where each key supplies acceptable the value type.

Each bus should describe in its action interface which context entries are possible (non-restrictive) and corresponding context keys should be exposed in '@comunica/context-entries' for easy reuse. If actors support any specific context entries next to those inherited by the bus action interface, then this should be described in its README file.

This context can contain any information that might be relevant for certain actors. For instance, this context can contain a list of datasources over which operators should query.

interface IActionContext {
    delete: <V>(key: IActionContextKey<V>) => IActionContext;
    get: <V>(key: IActionContextKey<V>) => undefined | V;
    getSafe: <V>(key: IActionContextKey<V>) => V;
    has: <V>(key: IActionContextKey<V>) => boolean;
    keys: () => IActionContextKey<any>[];
    merge: (...contexts: IActionContext[]) => IActionContext;
    set: <V>(key: IActionContextKey<V>, value: V) => IActionContext;
    setDefault: <V>(key: IActionContextKey<V>, value: V) => IActionContext;
    toJS: () => any;
}

Implemented by

Properties

delete: <V>(key: IActionContextKey<V>) => IActionContext
get: <V>(key: IActionContextKey<V>) => undefined | V
getSafe: <V>(key: IActionContextKey<V>) => V
has: <V>(key: IActionContextKey<V>) => boolean
keys: () => IActionContextKey<any>[]
merge: (...contexts: IActionContext[]) => IActionContext
set: <V>(key: IActionContextKey<V>, value: V) => IActionContext
setDefault: <V>(key: IActionContextKey<V>, value: V) => IActionContext

Will only set the value if the key is not already set.

toJS: () => any