Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 12x 12x 12x 10x 12x | import { Contract, createContract} from "@jonloucks/contracts-ts";
import { RequiredType, guardFunctions } from "@jonloucks/concurrency-ts/api/Types";
import { Config, StateMachine } from "@jonloucks/concurrency-ts/api/StateMachine";
/**
* Rule machine, containing a set of sets that can be transitioned to by events/actions
*/
export interface StateMachineFactory {
/**
* Create a new StateMachine by configuration
*
* @param config the configuration
* @return the new StateMachine
* @param <T> the type of each state
* @throws IllegalArgumentException if config is null or configuration is invalid
*/
createStateMachine<T>(config: Config<T>): RequiredType<StateMachine<T>>;
}
/**
* Determine if the given instance is a StateMachineFactory
*
* @param instance the instance to check
* @return true if the instance is a StateMachineFactory
*/
export function guard(instance: unknown): instance is RequiredType<StateMachineFactory> {
return guardFunctions(instance, 'createStateMachine');
}
/**
* Contract for StateMachineFactory
*/
export const CONTRACT: Contract<StateMachineFactory> = createContract({
name: "StateMachineFactory",
test: guard
}); |