Contracts-TS Documentation
    Preparing search index...

    Interface Repository

    A repository for multiple contract promisors This is an opt-in feature to simplify the managing of many contract bindings.

    1. Optional feature to register required contracts.
    2. Optional feature to manage multiple contract bindings.
    interface Repository {
        check(): void;
        keep<T>(
            contract: Contract<T>,
            promisor: PromisorType<T>,
            bindStrategy?: BindStrategy,
        ): void;
        open(): AutoClose;
        require<T>(contract: Contract<T>): void;
        store<T>(
            contract: Contract<T>,
            promisor: PromisorType<T>,
            bindStrategy?: BindStrategy,
        ): AutoClose;
    }

    Hierarchy

    • Open
      • Repository
    Index

    Methods

    • Keep the binding for the life of the repository If the Repository is not open, the binding will be created when repository is opened. If the Repository has already been opened the binding is created immediately Note: The order of closing promisors is the reverse order they are stored

      Type Parameters

      • T

        the type of contract deliverable

      Parameters

      • contract: Contract<T>

        the contract to be bound

      • promisor: PromisorType<T>

        the promisor to be bounded

      • OptionalbindStrategy: BindStrategy

        the config for storing the binding

      Returns void

    • Added a required contract

      Type Parameters

      • T

        the type of contract deliverable

      Parameters

      • contract: Contract<T>

        the contract to be required

      Returns void

    • Store the binding. Note: Replacing a Contract already promised in this Repository is forbidden after the Repository is opened. If the Repository is not open an existing Promisor can be replaced, otherwise it is forbidden. If the Repository is not open, the binding will be applied when repository is opened. If the Repository has already been opened the binding is applied immediately Note: If never explicitly closed, the order of closing promisors is the reverse order they are stored

      Type Parameters

      • T

        the type of contract deliverable

      Parameters

      • contract: Contract<T>

        the contract to be bound

      • promisor: PromisorType<T>

        the promisor to be bounded

      • OptionalbindStrategy: BindStrategy

        the config for storing the binding

      Returns AutoClose

      AutoClose responsible for removing the binding from this Repository