All files / src index.ts

100% Statements 37/37
100% Branches 0/0
100% Functions 19/19
100% Lines 20/20

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 38 39 40 41 42 43 44 45 46 47 48  25x   28x 28x   26x   26x     27x 28x   27x 49x 29x     25x 92x 29x   165x                       25x 25x       25x 25x 25x 25x        
import { Contracts, Config as ContractsConfig } from "@jonloucks/contracts-ts/api/Contracts";
import { validateContracts } from "@jonloucks/contracts-ts/auxiliary/Validate";
 
export { AutoClose, AutoCloseMany, AutoCloseOne, AutoCloseType, typeToAutoClose } from "@jonloucks/contracts-ts/api/AutoClose";
export { CONTRACT as AUTO_CLOSE_FACTORY, AutoCloseFactory } from "@jonloucks/contracts-ts/api/AutoCloseFactory";
export { AutoOpen } from "@jonloucks/contracts-ts/api/AutoOpen";
export { BindStrategy, DEFAULT_BIND_STRATEGY } from "@jonloucks/contracts-ts/api/BindStrategy";
export { Contract, Config as ContractConfig } from "@jonloucks/contracts-ts/api/Contract";
export { ContractException } from "@jonloucks/contracts-ts/api/ContractException";
export { Contracts, Config as ContractsConfig } from "@jonloucks/contracts-ts/api/Contracts";
export { ContractsFactory } from "@jonloucks/contracts-ts/api/ContractsFactory";
export { Promisor, typeToPromisor } from "@jonloucks/contracts-ts/api/Promisor";
export { CONTRACT as PROMISOR_FACTORY, PromisorFactory } from "@jonloucks/contracts-ts/api/PromisorFactory";
export { Repository } from "@jonloucks/contracts-ts/api/Repository";
export { CONTRACT as REPOSITORY_FACTORY, RepositoryFactory } from "@jonloucks/contracts-ts/api/RepositoryFactory";
export { guardFunctions as hasFunctions, isNotPresent, isNumber, isPresent, isString, OptionalType, RequiredType } from "@jonloucks/contracts-ts/api/Types";
export { validateContracts } from "@jonloucks/contracts-ts/auxiliary/Validate";
 
//  no qualified paths for things not exposed publicly
import { createContracts, create as createContractsFactory } from "./impl/ContractsFactory.impl";
export { createContract, create as createContractFactory } from "./impl/ContractFactory.impl";
export { VERSION } from "./version";
 
export { createContracts, createContractsFactory };
 
 
/**
 * A shared global Contracts instance.
 * 
 * All Contract references are hidden and not exposed outside of this instance.
 * Bound Contract promisors are also hidden and not exposed outside of this instance.
 * By default, A Contract (replaceable = false) can NOT be replaced once bound.
 * 
 * Note: accepts only ratified contracts and closes on process exit.
 */
export const CONTRACTS : Contracts = (() : Contracts => {
    const globalConfig : ContractsConfig = { 
      ratified: true,
      shutdownEvents: ['exit']
    };
    const contracts = createContracts(globalConfig);
    contracts.open(); // closed on exit
    validateContracts(contracts);
    return contracts;
})();