Member Junction
    Preparing search index...

    TransactionGroup is a class that handles the bundling of multiple transactions into a single request. The provider handles the implementation details. If a transaction group is provided to the baseEntity object before either Save() or Delete() is called instead of just immediately executing its SQL or GQL, it provides the instructions to the TransactionGroup object instead.

    Then, whenever the TransactionGroup object instance has its Submit() method called, all of the requests will be bundled into a single request and handled. For example in the case of the GraphQLDataProvider, we queue up all of the GQL statements for all of the mutations and send them across as a single GraphQL request. The GraphQL server handles the actual DB transaction stuff.

    TransactionGroup will call a callback function, if provided, after the transaction has either completed succesfully or failed. If it is succesful, for Save() method calls, the latest data for that record will be provided back. For Delete() method calls, the callback will be called with no data.

    This class is the base class for managing a group of transactions and submitting it to the provider so it can be handled as an ATOMic transaction

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get BatchedSubmit(): boolean

      Opt-in: when true, a provider implementation MAY execute the group's items as a single multi-statement round trip to the database instead of one round trip per item — the same statements, in the same order, inside the same transaction, with per-item results still returned. Semantics are identical to the sequential submit; only the wire shape changes.

      Default false, so existing callers are byte-for-byte unaffected. Callers that enrol large numbers of independent items (e.g. a sync engine's write batches) set this to collapse N round trips into one. Providers that do not implement a batched path ignore the flag.

      Note: groups that use Variables have cross-item dependencies (a later item reads a value produced by an earlier one) and are always executed sequentially regardless of this flag — a single round trip cannot feed one statement's output into the next statement's client-side rendering.

      Returns boolean

    • set BatchedSubmit(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get PendingTransactions(): TransactionItem[]

      Returns TransactionItem[]

    • get Status(): "Failed" | "Pending" | "In Progress" | "Complete"

      Returns "Failed" | "Pending" | "In Progress" | "Complete"

    • get TransactionNotifications$(): Observable<
          { error?: any; results?: TransactionResult[]; success: boolean },
      >

      Returns Observable<{ error?: any; results?: TransactionResult[]; success: boolean }>

    • get Variables(): TransactionVariable[]

      The array of variables that are to be used within the transaction group. These are used to pass data from one transaction item to another. See documentation on TransactionVariable

      Returns TransactionVariable[]

    Methods

    • This is used by the BaseEntity/Provider objects to manage transactions on your behalf. WARNING: Do NOT directly call this method. Instead set the TransactionGroup property on the

      Parameters

      Returns void

      class to make an entity object part of a transaction group.

    • Indicates whether all of the entities that have registered with this transaction group have completed their preprocessing

      Returns boolean

    • If an entity object needs to conduct any type of asynchronous preprocessing before a transaction is submitted, it must notify its transaction group that it is doing so with this method. This causes the TransactionGroup to wait for all preprocessing to be completed before submitting the transaction. This method checks to see if an the entity has already been registered for preprocessing and if so, does nothing.

      Parameters

      Returns void

    • This utility method is to be used by sub-classes to set the values of the variables on the BaseEntity objects before the transaction is executed for variables that are defined as 'Use' type. This is used to pass values from one transaction item to another.

      Parameters

      Returns number

      the number of values set on the entity object

    • This utility method is to be used by sub-classes to set the values of the variables on the BaseEntity objects after the transaction is executed for variables

      Parameters

      Returns number

      the number of variables that had their processed values set from the provided entity object

    • Submits the transaction group to the provider for handling. The provider will handle the actual transaction and call the callback functions

      Parameters

      • OptionalallowRetryOfFailedTransaction: boolean

        If true, the transaction group will be resubmitted even if it has failed. If false, the transaction group will not be resubmitted if it has failed.

      Returns Promise<boolean>

      true if the transaction was successful, false if it failed. If the method fails, check each of the individual BaseEntity objects within the TransactionGroup for their result histories using BaseEntity.ResultHistory and BaseEntity.LatestResult

    • Waits for all preprocessing to be complete.

      Returns Promise<void>