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

    Hierarchy (View Summary)

    Index
    db: B2bDatabase
    searchCache: ServiceCache<CachedBankTransactionSearch>
    timeseriesCache: ServiceCache<CachedBankBalanceTimeseries>
    instance: (...args: []) => BankTransactionQueryService = ...

    The process service: the shared database and the search cache.

    • Self-bust the read caches after a write on the writer subclass. Three independent busts:

      1. The folded-get entry for this row, by exact key (all-mode correct — works in memory mode, where tag invalidation no-ops). The key must match what search computes for get({ id }): includeHidden true, all other filters undefined (dropped by serviceCacheKey), page 1, pageSize 1.
      2. The collection bust for every other cached search — a create/update can reshape any list.
      3. The implied-balance timeseries for the row's correlation key. Takes the written ROW rather than its id because the timeseries cache has no per-key handle to drop — its keys carry the window bounds and timezone, which a write path cannot know — so the correlation tag is the only way in, and building it needs the row's routing / account / ffcMemo.

      A reconciliation-only update (a BANK_INTERNAL_TRANSFER stamp) does not move the gross implied balance, so bust 3 is sometimes redundant. Busting on every write anyway is correct and cheap; discriminating would be a way to be wrong.

      Settled, not sequenced, and never rethrown. These used to be three bare awaits, which coupled them twice over: a rejection in the first skipped the other two, and then escaped into the caller. create publishes backoffice.bankTransaction.created BEFORE it busts (see the if (created) block), so a cache failure rejected a write that had already committed and already alerted — the operator got a Slack notification for a row the dashboards would not show until the L2 entry aged out (BANK_TX_SEARCH_L2_TTL_MS, 24h). Neither the commit nor the publish can be undone here, which makes throwing strictly worse than serving stale.

      Parameters

      Returns Promise<void>

    • Parameters

      • __namedParameters: {
            accountNumber?: string;
            accountTypes?: BankAccountType[];
            amount?: string;
            bankIds?: string[];
            bankTransactionIds?: string[];
            createdAt?: DbTimestampCriteria;
            id?: string[];
            includeHidden?: boolean;
            methodDataKeys?: (
                | "method"
                | "victorTransactionId"
                | "ffcMemo"
                | "victorReferenceId"
                | "routeFusionTransferId"
                | "routeFusionReference"
                | "targetAccountName"
                | "targetAccountNumber"
                | (keyof AchEntryData)
                | "imad"
                | "omad"
                | "exchangeRate"
                | "tradeDate"
                | "foreignExchangeContract"
                | (keyof WireDetailData)
                | "sourceAccountNumber"
                | "tchInstitutionId"
                | "institutionId"
            )[];
            methods?: (
                | "SWIFT"
                | "FEDWIRE"
                | "ACH"
                | "ACH_DEBIT"
                | "RTP"
                | "FEDNOW"
                | "BOOK_TRANSFER"
                | "GREENDOT_SETTLEMENT"
            )[];
            missingMethodDataKeys?: (
                | "method"
                | "victorTransactionId"
                | "ffcMemo"
                | "victorReferenceId"
                | "routeFusionTransferId"
                | "routeFusionReference"
                | "targetAccountName"
                | "targetAccountNumber"
                | (keyof AchEntryData)
                | "imad"
                | "omad"
                | "exchangeRate"
                | "tradeDate"
                | "foreignExchangeContract"
                | (keyof WireDetailData)
                | "sourceAccountNumber"
                | "tchInstitutionId"
                | "institutionId"
            )[];
            orderBy?: DbOrderByCriterion<
                Omit<
                    PgTableWithColumns<
                        {
                            columns: {
                                accountNumber: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                amount: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgNumericBuilder>,
                                    {
                                        data: string;
                                        dataType: "string numeric";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                bankId: PgBuildColumn<
                                    "bank_transaction",
                                    Set$Type<SetNotNull<(...)>, string>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                bankStatus: PgBuildColumn<
                                    "bank_transaction",
                                    Set$Type<SetNotNull<(...)>, "POSTED">,
                                    {
                                        data: "POSTED";
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                bankTransactionId: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                createdAt: PgBuildColumn<
                                    "bank_transaction",
                                    SetHasDefault<SetNotNull<(...)>>,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                data: PgBuildColumn<
                                    "bank_transaction",
                                    Set$Type<
                                        SetHasDefault<(...)>,
                                        { isManual?: ...; methodData: ...; reconciliation: ... },
                                    >,
                                    {
                                        data: { isManual?: ...; methodData: ...; reconciliation: ... };
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                description: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                externalId: PgBuildColumn<
                                    "bank_transaction",
                                    SetHasRuntimeDefault<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                hiddenAt: PgBuildColumn<
                                    "bank_transaction",
                                    PgTimestampBuilder,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                hiddenBy: PgBuildColumn<
                                    "bank_transaction",
                                    PgTextBuilder<[(...), ...(...)[]]>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                hiddenReason: PgBuildColumn<
                                    "bank_transaction",
                                    PgTextBuilder<[(...), ...(...)[]]>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                id: PgBuildColumn<
                                    "bank_transaction",
                                    HasIdentity<SetIsPrimaryKey<(...)>, "byDefault">,
                                    {
                                        data: number;
                                        dataType: "number int32";
                                        driverParam: (...) | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: "byDefault";
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                postedAt: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgTimestampBuilder>,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                raw: PgBuildColumn<
                                    "bank_transaction",
                                    Set$Type<PgJsonbBuilder, BankTransactionRaw>,
                                    {
                                        data: BankTransactionRaw;
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                routingNumber: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                searchDocument: PgBuildColumn<
                                    "bank_transaction",
                                    SetHasGenerated<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: true;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                searchDocumentAdmin: PgBuildColumn<
                                    "bank_transaction",
                                    SetHasGenerated<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: true;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                statementDescription: PgBuildColumn<
                                    "bank_transaction",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                type: PgBuildColumn<
                                    "bank_transaction",
                                    Set$Type<SetNotNull<(...)>, (...) | (...)>,
                                    {
                                        data: (...) | (...);
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                                updatedAt: PgBuildColumn<
                                    "bank_transaction",
                                    SetHasDefault<SetHasDefault<(...)>>,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "bank_transaction";
                                    },
                                >;
                            };
                            dialect: "pg";
                            isAlias: false;
                            name: "bank_transaction";
                            schema: "b2b";
                        },
                    >,
                    "enableRLS",
                >,
                "createdAt"
                | "updatedAt"
                | "amount"
                | "postedAt",
            >[];
            page?: number;
            pageSize?: number;
            postedAt?: DbTimestampCriteria;
            q?: string;
            reconciliationKeys?: (
                | "DEPOSIT"
                | "WITHDRAWAL"
                | "REDEMPTION"
                | "ACH_BATCH"
                | "MANUAL_MINT"
                | "DEPOSIT_RETURN"
                | "BANK_INTERNAL_TRANSFER"
                | "GREENDOT_BATCH"
                | "OPERATING_ENTRY"
                | "WITHDRAWAL_IDS"
                | "DEPOSIT_IDS"
                | "REDEMPTION_IDS"
            )[];
            routingNumber?: string;
            sources?: BankTransactionRawSource[];
            status?: "POSTED"
            | "RECONCILED";
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
            types?: ("CREDIT" | "DEBIT")[];
            updatedAt?: DbTimestampCriteria;
        }
        • OptionalaccountNumber?: string
        • OptionalaccountTypes?: BankAccountType[]

          Rows whose account the bank_account register types as one of these.

        • Optionalamount?: string
        • OptionalbankIds?: string[]
        • OptionalbankTransactionIds?: string[]
        • OptionalcreatedAt?: DbTimestampCriteria
        • Optionalid?: string[]
        • OptionalincludeHidden?: boolean

          Hidden rows are left out unless this is true.

        • OptionalmethodDataKeys?: (
              | "method"
              | "victorTransactionId"
              | "ffcMemo"
              | "victorReferenceId"
              | "routeFusionTransferId"
              | "routeFusionReference"
              | "targetAccountName"
              | "targetAccountNumber"
              | (keyof AchEntryData)
              | "imad"
              | "omad"
              | "exchangeRate"
              | "tradeDate"
              | "foreignExchangeContract"
              | (keyof WireDetailData)
              | "sourceAccountNumber"
              | "tchInstitutionId"
              | "institutionId"
          )[]

          Rows whose methodData holds a non-empty value under every one of these keys.

        • Optionalmethods?: (
              | "SWIFT"
              | "FEDWIRE"
              | "ACH"
              | "ACH_DEBIT"
              | "RTP"
              | "FEDNOW"
              | "BOOK_TRANSFER"
              | "GREENDOT_SETTLEMENT"
          )[]

          Filter on methodData.method — e.g. only the ACH debit postings.

        • OptionalmissingMethodDataKeys?: (
              | "method"
              | "victorTransactionId"
              | "ffcMemo"
              | "victorReferenceId"
              | "routeFusionTransferId"
              | "routeFusionReference"
              | "targetAccountName"
              | "targetAccountNumber"
              | (keyof AchEntryData)
              | "imad"
              | "omad"
              | "exchangeRate"
              | "tradeDate"
              | "foreignExchangeContract"
              | (keyof WireDetailData)
              | "sourceAccountNumber"
              | "tchInstitutionId"
              | "institutionId"
          )[]

          Rows whose methodData holds no value under any of these keys; "" counts as none.

        • OptionalorderBy?: DbOrderByCriterion<
              Omit<
                  PgTableWithColumns<
                      {
                          columns: {
                              accountNumber: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              amount: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgNumericBuilder>,
                                  {
                                      data: string;
                                      dataType: "string numeric";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              bankId: PgBuildColumn<
                                  "bank_transaction",
                                  Set$Type<SetNotNull<(...)>, string>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              bankStatus: PgBuildColumn<
                                  "bank_transaction",
                                  Set$Type<SetNotNull<(...)>, "POSTED">,
                                  {
                                      data: "POSTED";
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              bankTransactionId: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              createdAt: PgBuildColumn<
                                  "bank_transaction",
                                  SetHasDefault<SetNotNull<(...)>>,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              data: PgBuildColumn<
                                  "bank_transaction",
                                  Set$Type<
                                      SetHasDefault<(...)>,
                                      { isManual?: ...; methodData: ...; reconciliation: ... },
                                  >,
                                  {
                                      data: { isManual?: ...; methodData: ...; reconciliation: ... };
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              description: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              externalId: PgBuildColumn<
                                  "bank_transaction",
                                  SetHasRuntimeDefault<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              hiddenAt: PgBuildColumn<
                                  "bank_transaction",
                                  PgTimestampBuilder,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              hiddenBy: PgBuildColumn<
                                  "bank_transaction",
                                  PgTextBuilder<[(...), ...(...)[]]>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              hiddenReason: PgBuildColumn<
                                  "bank_transaction",
                                  PgTextBuilder<[(...), ...(...)[]]>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              id: PgBuildColumn<
                                  "bank_transaction",
                                  HasIdentity<SetIsPrimaryKey<(...)>, "byDefault">,
                                  {
                                      data: number;
                                      dataType: "number int32";
                                      driverParam: (...) | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: "byDefault";
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              postedAt: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgTimestampBuilder>,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              raw: PgBuildColumn<
                                  "bank_transaction",
                                  Set$Type<PgJsonbBuilder, BankTransactionRaw>,
                                  {
                                      data: BankTransactionRaw;
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              routingNumber: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              searchDocument: PgBuildColumn<
                                  "bank_transaction",
                                  SetHasGenerated<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: true;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              searchDocumentAdmin: PgBuildColumn<
                                  "bank_transaction",
                                  SetHasGenerated<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: true;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              statementDescription: PgBuildColumn<
                                  "bank_transaction",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              type: PgBuildColumn<
                                  "bank_transaction",
                                  Set$Type<SetNotNull<(...)>, (...) | (...)>,
                                  {
                                      data: (...) | (...);
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                              updatedAt: PgBuildColumn<
                                  "bank_transaction",
                                  SetHasDefault<SetHasDefault<(...)>>,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "bank_transaction";
                                  },
                              >;
                          };
                          dialect: "pg";
                          isAlias: false;
                          name: "bank_transaction";
                          schema: "b2b";
                      },
                  >,
                  "enableRLS",
              >,
              "createdAt"
              | "updatedAt"
              | "amount"
              | "postedAt",
          >[]
        • Optionalpage?: number

          Defaults to 1

        • OptionalpageSize?: number

          Defaults to 10

        • OptionalpostedAt?: DbTimestampCriteria

          When the BANK posted the transaction — the only one of the three timestamps that is the bank's fact rather than ours. Correlating an external record (a wire notification, a statement line) against this table has to window on it: createdAt is when CFX happened to write the row, which for a hand-keyed row can be days off the money movement.

        • Optionalq?: string

          Free-text filter: case-insensitive substring match on bankTransactionId, description, and statementDescription; when it parses as a positive decimal it also matches the exact amount.

        • OptionalreconciliationKeys?: (
              | "DEPOSIT"
              | "WITHDRAWAL"
              | "REDEMPTION"
              | "ACH_BATCH"
              | "MANUAL_MINT"
              | "DEPOSIT_RETURN"
              | "BANK_INTERNAL_TRANSFER"
              | "GREENDOT_BATCH"
              | "OPERATING_ENTRY"
              | "WITHDRAWAL_IDS"
              | "DEPOSIT_IDS"
              | "REDEMPTION_IDS"
          )[]

          Rows whose reconciliation carries any of these keys.

        • OptionalroutingNumber?: string
        • Optionalsources?: BankTransactionRawSource[]

          Filter on raw.source — which producer wrote the row.

          A feed that resumes from its own high-water mark MUST scope by this. The mark answers "how far has THIS feed got", and every producer writes to the same table: an unscoped mark can be set by a row the feed will never deliver, and since the feeds page forward from it, whatever it skipped is skipped permanently. See getRouteFusionOutboundHighWaterMark.

          raw is nullable (rows predating the column, and any producer with no payload), so a filtered search never returns those — which is correct for the high-water-mark use, since a row with no recorded producer cannot be evidence of one's progress.

        • Optionalstatus?: "POSTED" | "RECONCILED"
        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>
        • Optionaltypes?: ("CREDIT" | "DEBIT")[]
        • OptionalupdatedAt?: DbTimestampCriteria

      Returns Promise<
          {
              ok: true;
              value: { hasNext: boolean; items: BankTransaction[]; total: number };
          },
      >

    • The account's IMPLIED balance (credits − debits over its whole bank_transaction history) sampled at the CLOSE of every day in the window — the series behind the balance-over-time chart on the admin bank-account detail panel.

      Correlated on the same key as the bank_account_view balance lateral (bankAccountBalanceLateralSql), and leaves out a virtual account's sweeps to its pool as the view does, so the last point equals the panel's "Implied balance" figure exactly. A drift between the two would mislead an operator reconciling the account, which is why the correlation predicate is shared verbatim rather than re-derived.

      Windows and buckets on posted_at — the bank's fact. created_at is when CFX happened to write the row, which for a hand-keyed transaction can be days off the money movement.

      items is empty (rather than a flat zero line) when the key has NO matching transactions at all: § 6 of the bank_account_view design distinguishes "cannot be measured / nothing observed" from "measured as zero", and the chart must carry that distinction too.

      Parameters

      • __namedParameters: {
            accountNumber: string;
            blockTime: Exclude<Required<DbTimestampCriteria>, undefined>;
            memo?: string;
            routingNumber: string;
            timeZone?: string;
        }
        • accountNumber: string
        • blockTime: Exclude<Required<DbTimestampCriteria>, undefined>
        • Optionalmemo?: string

          FFC memo of a shared-FBO (deposit-memo) account. Narrows the correlation key to that memo's flow through the shared account.

        • routingNumber: string
        • OptionaltimeZone?: string

          IANA timezone (e.g. "America/Chicago"). Aligns day boundaries and localDate output to this timezone. Defaults to "UTC".

      Returns Promise<
          {
              ok: true;
              value: { items: BankBalanceTimeseriesItem[]; opening: BigNumber };
          },
      >

    • Parameters

      • args: {
            accountNumber: string;
            includeHidden?: boolean;
            includeManual?: boolean;
            routingNumber: string;
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }
        • accountNumber: string
        • OptionalincludeHidden?: boolean

          Hidden rows are left out unless this is true.

        • OptionalincludeManual?: boolean
        • routingNumber: string
        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>

      Returns Promise<{ ok: true; value: { txCount: number } }>