Function configure

  • Configure a batch process to query and/or mutate resources.

    Batch processes take structured inputs, split those up and extract a list of entries that can be passed to some process. Given the results of that process, each result is then converted back to some output form and arranged into the same given structure as outputs.

    This abstraction makes it easier to build bulk iteractions with @truffle/db, rather than, say, submitting multiple separate add mutations.

    For instance, Truffle artifacts each contain two bytecodes - to minimize the number of bytecodesAdd queries, one might want to convert each input artifact to a flat list of bytecodes, execute a single mutation request to @truffle/db, and then automatically pair the resulting bytecode IDs with the respective artifact bytecodes.

    The process is roughly as follows:

    ,--------. iterate() ,----------. extract() ,---------. | Inputs | --> | Input... | --> | Entry[] | --------' ----------' `---------'

      |                                            |
    | initialize() | process()
    V V

    ,---------. merge() ,----------. convert() ,----------. | Outputs | <-- | Output[] | <-- | Result[] | ---------' ----------' `----------'

    Type Parameters

    Parameters

    Returns (<I, O>(inputs) => Generator<GraphQlRequest | Web3Request, Meta.Batch.Outputs<B, O>, any>)

      • <I, O>(inputs): Generator<GraphQlRequest | Web3Request, Meta.Batch.Outputs<B, O>, any>
      • Type Parameters

        • I extends any

        • O extends any

        Parameters

        Returns Generator<GraphQlRequest | Web3Request, Meta.Batch.Outputs<B, O>, any>

Generated using TypeDoc