@cfxlabsinc/b2b-services
    Preparing search index...

    Cross-namespace buster + realtime broadcaster over the customer transaction projection owned by TransactionService. Transaction-writer services (deposit, manual mint, withdrawal, swap, ledger-account transfer, card, reward, redemption, fee, escrow) construct or receive one of these and call invalidateTag after a successful write + event publish, so that — cross-process via the shared Valkey cluster + Ably — both:

    1. the two transaction caches the customer dashboard reads are busted, and
    2. the dashboard's open clients are nudged to refetch the affected rows.

    This replaces the old customer-dashboard /api/events webhook, which used to re-fetch + publish the realtime event centrally. The dashboard's Ably subscriber only reads each row's id (to invalidate its react-query caches and refetch), so the published payload is just { id } per transaction — we never need to drag db / TransactionService into the writer processes to re-serialize the full row, keeping this collaborator lightweight.

    Builds busters over the exact same namespaces (TRANSACTION_SEARCH_CACHE / TRANSACTION_METHOD_AGGREGATE_CACHE) TransactionService reads through, mirroring how OrganizationAdminService busts organization-consumer-search via ORG_CONSUMER_SEARCH_CACHE.

    Index

    Constructors

    Methods

    Constructors

    • Parameters

      • __namedParameters: { ablyRestClient: Rest | null; valkeyClient: ValkeyClient | null }
        • ablyRestClient: Rest | null

          Ably REST client used to broadcast transactionStatusUpdated. null disables realtime publishing (tests, or a process that legitimately has no Ably credentials) — the cache bust still runs. Required (not defaulted) so every construction site has to decide explicitly, rather than silently shipping a process with no realtime updates.

        • valkeyClient: ValkeyClient | null

      Returns TransactionCacheBuster

    Methods

    • Bust both transaction caches for a customer, then broadcast that the given transactions changed. customerId is the external string carried in the emitted transaction event — the same value TransactionService.search / aggregateTotalsByMethod write as their cache tag. transactionIds are the external ids of the rows that this mutation touched for that customer.

      The cache bust runs first (so the dashboard refetches fresh data) and keeps its current throwing behaviour. The realtime publish is best-effort: it never throws, so an Ably failure can never fail the mutation that triggered it.

      Parameters

      • __namedParameters: { bankId?: string; customerId: string; transactionIds: string[] }
        • OptionalbankId?: string

          The owning bank, when the mutated transaction is bank-routed (deposits, withdrawals). When present, the realtime nudge is additionally published on the bank's channel so the bank dashboard refreshes without subscribing to a network-wide firehose. Omit for bankless transactions — the customer and operator channels still fire.

        • customerId: string
        • transactionIds: string[]

      Returns Promise<void>