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 37 | 25x 25x 25x 39x 25x | import { create as createContract } from "@jonloucks/contracts-ts/api/RatifiedContract";
import { Contract } from "@jonloucks/contracts-ts/api/Contract";
import { RequiredType, guardFunctions } from "@jonloucks/contracts-ts/api/Types";
import { Idempotent, Config } from "@jonloucks/contracts-ts/auxiliary/Idempotent";
/**
* Idempotent Factory
*/
export interface IdempotentFactory {
/**
* Create a new Idempotent using the provided configuration.
*
* @param config configuration for the idempotent; invalid or null/undefined values are not allowed
* @returns an Idempotent instance created from the given configuration
* @throws Error if the configuration is invalid or the idempotent cannot be created
*/
createIdempotent(config: Config): RequiredType<Idempotent>;
}
/**
* Determine if the given instance is a IdempotentFactory
*
* @param instance the instance to check
* @return true if the instance is a IdempotentFactory
*/
export function guard(instance: unknown): instance is RequiredType<IdempotentFactory> {
return guardFunctions(instance, 'createIdempotent');
}
/**
* Contract for IdempotentFactory
*/
export const CONTRACT: Contract<IdempotentFactory> = createContract({
name: "IdempotentFactory",
test: guard
}); |