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

    Class InternalSlackChannelAdminService

    The channel each internal Slack feed posts to, and the DEFAULT channel the rest fall back to. Every caller is CFX's own: the posting apps read through getForFeed, the admin dashboard edits the rows.

    Hierarchy

    • InternalSlackChannelCache
      • InternalSlackChannelAdminService
    Index
    • Parameters

      • __namedParameters: {
            db: B2bDatabase;
            internalEventPublisher: InternalEventPublisher | null;
            valkeyClient: ValkeyClient | null;
        }
        • db: B2bDatabase
        • internalEventPublisher: InternalEventPublisher | null

          Publishes slack.internalSlackChannel.*; null where nothing writes.

        • valkeyClient: ValkeyClient | null

      Returns InternalSlackChannelAdminService

    cache: ServiceCache<CachedSearchPage<InternalSlackChannel>>
    instance: (...args: []) => InternalSlackChannelAdminService = ...

    The process service: the shared database, Valkey and the internal bus.

    • Gives feed its own channel. One live row per feed: replace one with update.

      Parameters

      • input: {
            channelId: string;
            feed:
                | "DEFAULT"
                | "ACH_BATCH"
                | "ACH_FILE"
                | "WIRE_BATCH"
                | "WIRE_FILE"
                | "BANK_TRANSACTION"
                | "BANK_INTERNAL_TRANSFER"
                | "WIRE_EMAIL"
                | "REDEMPTION"
                | "LEDGER_ACCOUNT_WITHDRAWAL"
                | "MANUAL_MINT"
                | "FEE_TRANSFER"
                | "AIPRISE_PROFILE"
                | "UTILA_TRANSACTION"
                | "EMAIL_SENT"
                | "CUSTOMER_EVENTS"
                | "CUSTOMER_DEPOSIT"
                | "CUSTOMER_WITHDRAWAL"
                | "CUSTOMER_LEDGER_TRANSFER"
                | "CUSTOMER_SWAP"
                | "CUSTOMER_ESCROW_TRANSFER"
                | "CUSTOMER_CARD_TRANSACTION"
                | "CUSTOMER_IDENTITY"
                | "CUSTOMER_ORGANIZATION"
                | "CUSTOMER_PAYMENT_INSTRUMENT"
                | "CUSTOMER_REWARD"
                | "CUSTOMER_TERMS"
                | "CUSTOMER_VIRTUAL_ACCOUNT"
                | "TEMPLATE_TEST";
        }

      Returns Promise<
          | { ok: true; value: InternalSlackChannel }
          | { error: ServiceError; ok: false },
      >

    • Soft-deletes a feed's row, so the feed falls back to the DEFAULT channel. The DEFAULT row cannot be deleted: every feed without a row resolves to it.

      Parameters

      • __namedParameters: { id: string }

      Returns Promise<{ ok: true; value: undefined } | { error: ServiceError; ok: false }>

    • The channel feed posts to: its own live row, else its fallback feed's live row (CUSTOMER_EVENTS for a CUSTOMER_* feed, DEFAULT for the rest), whose feed then reads the fallback. Null when neither exists.

      Parameters

      • __namedParameters: {
            feed:
                | "DEFAULT"
                | "ACH_BATCH"
                | "ACH_FILE"
                | "WIRE_BATCH"
                | "WIRE_FILE"
                | "BANK_TRANSACTION"
                | "BANK_INTERNAL_TRANSFER"
                | "WIRE_EMAIL"
                | "REDEMPTION"
                | "LEDGER_ACCOUNT_WITHDRAWAL"
                | "MANUAL_MINT"
                | "FEE_TRANSFER"
                | "AIPRISE_PROFILE"
                | "UTILA_TRANSACTION"
                | "EMAIL_SENT"
                | "CUSTOMER_EVENTS"
                | "CUSTOMER_DEPOSIT"
                | "CUSTOMER_WITHDRAWAL"
                | "CUSTOMER_LEDGER_TRANSFER"
                | "CUSTOMER_SWAP"
                | "CUSTOMER_ESCROW_TRANSFER"
                | "CUSTOMER_CARD_TRANSACTION"
                | "CUSTOMER_IDENTITY"
                | "CUSTOMER_ORGANIZATION"
                | "CUSTOMER_PAYMENT_INSTRUMENT"
                | "CUSTOMER_REWARD"
                | "CUSTOMER_TERMS"
                | "CUSTOMER_VIRTUAL_ACCOUNT"
                | "TEMPLATE_TEST";
        }

      Returns Promise<InternalSlackChannel | null>

    • getForFeed for each of feeds, in order, in one cached read, beside the live DEFAULT row (fallback). A CUSTOMER_* feed inherits the CUSTOMER_EVENTS row instead, never DEFAULT.

      Parameters

      • __namedParameters: {
            feeds?: readonly (
                | "DEFAULT"
                | "ACH_BATCH"
                | "ACH_FILE"
                | "WIRE_BATCH"
                | "WIRE_FILE"
                | "BANK_TRANSACTION"
                | "BANK_INTERNAL_TRANSFER"
                | "WIRE_EMAIL"
                | "REDEMPTION"
                | "LEDGER_ACCOUNT_WITHDRAWAL"
                | "MANUAL_MINT"
                | "FEE_TRANSFER"
                | "AIPRISE_PROFILE"
                | "UTILA_TRANSACTION"
                | "EMAIL_SENT"
                | "CUSTOMER_EVENTS"
                | "CUSTOMER_DEPOSIT"
                | "CUSTOMER_WITHDRAWAL"
                | "CUSTOMER_LEDGER_TRANSFER"
                | "CUSTOMER_SWAP"
                | "CUSTOMER_ESCROW_TRANSFER"
                | "CUSTOMER_CARD_TRANSACTION"
                | "CUSTOMER_IDENTITY"
                | "CUSTOMER_ORGANIZATION"
                | "CUSTOMER_PAYMENT_INSTRUMENT"
                | "CUSTOMER_REWARD"
                | "CUSTOMER_TERMS"
                | "CUSTOMER_VIRTUAL_ACCOUNT"
                | "TEMPLATE_TEST"
            )[];
        } = {}
        • Optionalfeeds?: readonly (
              | "DEFAULT"
              | "ACH_BATCH"
              | "ACH_FILE"
              | "WIRE_BATCH"
              | "WIRE_FILE"
              | "BANK_TRANSACTION"
              | "BANK_INTERNAL_TRANSFER"
              | "WIRE_EMAIL"
              | "REDEMPTION"
              | "LEDGER_ACCOUNT_WITHDRAWAL"
              | "MANUAL_MINT"
              | "FEE_TRANSFER"
              | "AIPRISE_PROFILE"
              | "UTILA_TRANSACTION"
              | "EMAIL_SENT"
              | "CUSTOMER_EVENTS"
              | "CUSTOMER_DEPOSIT"
              | "CUSTOMER_WITHDRAWAL"
              | "CUSTOMER_LEDGER_TRANSFER"
              | "CUSTOMER_SWAP"
              | "CUSTOMER_ESCROW_TRANSFER"
              | "CUSTOMER_CARD_TRANSACTION"
              | "CUSTOMER_IDENTITY"
              | "CUSTOMER_ORGANIZATION"
              | "CUSTOMER_PAYMENT_INSTRUMENT"
              | "CUSTOMER_REWARD"
              | "CUSTOMER_TERMS"
              | "CUSTOMER_VIRTUAL_ACCOUNT"
              | "TEMPLATE_TEST"
          )[]

          Defaults to every feed, the fallback first.

      Returns Promise<
          {
              fallback: InternalSlackChannel
              | null;
              routes: {
                  channel: InternalSlackChannel | null;
                  fallbackFeed:
                      | "DEFAULT"
                      | "ACH_BATCH"
                      | "ACH_FILE"
                      | "WIRE_BATCH"
                      | "WIRE_FILE"
                      | "BANK_TRANSACTION"
                      | "BANK_INTERNAL_TRANSFER"
                      | "WIRE_EMAIL"
                      | "REDEMPTION"
                      | "LEDGER_ACCOUNT_WITHDRAWAL"
                      | "MANUAL_MINT"
                      | "FEE_TRANSFER"
                      | "AIPRISE_PROFILE"
                      | "UTILA_TRANSACTION"
                      | "EMAIL_SENT"
                      | "CUSTOMER_EVENTS"
                      | "CUSTOMER_DEPOSIT"
                      | "CUSTOMER_WITHDRAWAL"
                      | "CUSTOMER_LEDGER_TRANSFER"
                      | "CUSTOMER_SWAP"
                      | "CUSTOMER_ESCROW_TRANSFER"
                      | "CUSTOMER_CARD_TRANSACTION"
                      | "CUSTOMER_IDENTITY"
                      | "CUSTOMER_ORGANIZATION"
                      | "CUSTOMER_PAYMENT_INSTRUMENT"
                      | "CUSTOMER_REWARD"
                      | "CUSTOMER_TERMS"
                      | "CUSTOMER_VIRTUAL_ACCOUNT"
                      | "TEMPLATE_TEST"
                      | null;
                  feed: | "DEFAULT"
                  | "ACH_BATCH"
                  | "ACH_FILE"
                  | "WIRE_BATCH"
                  | "WIRE_FILE"
                  | "BANK_TRANSACTION"
                  | "BANK_INTERNAL_TRANSFER"
                  | "WIRE_EMAIL"
                  | "REDEMPTION"
                  | "LEDGER_ACCOUNT_WITHDRAWAL"
                  | "MANUAL_MINT"
                  | "FEE_TRANSFER"
                  | "AIPRISE_PROFILE"
                  | "UTILA_TRANSACTION"
                  | "EMAIL_SENT"
                  | "CUSTOMER_EVENTS"
                  | "CUSTOMER_DEPOSIT"
                  | "CUSTOMER_WITHDRAWAL"
                  | "CUSTOMER_LEDGER_TRANSFER"
                  | "CUSTOMER_SWAP"
                  | "CUSTOMER_ESCROW_TRANSFER"
                  | "CUSTOMER_CARD_TRANSACTION"
                  | "CUSTOMER_IDENTITY"
                  | "CUSTOMER_ORGANIZATION"
                  | "CUSTOMER_PAYMENT_INSTRUMENT"
                  | "CUSTOMER_REWARD"
                  | "CUSTOMER_TERMS"
                  | "CUSTOMER_VIRTUAL_ACCOUNT"
                  | "TEMPLATE_TEST";
                  inherited: boolean;
                  sameAsDefault: boolean;
              }[];
          },
      >

    • Clear each customer's membership tag and each record tag wherever cached, and always this namespace's collection tag. keys are exact deletes in this instance's key space: the only bust a null client honours.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[];
            keys?: readonly CacheKey[];
            records?: readonly string[];
        }

      Returns Promise<void>

    • Tags for a page: the scope its query searched (each customer's membership tag, else the collection tag), so an empty page is bustable too, plus the records it projects and the fields that chose or ordered its rows.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[] | undefined;
            fields?: readonly string[];
            records?: readonly string[];
        }

      Returns string[]

    • The exact key InternalSlackChannelAdminService.get reads through: the args it passes plus search's defaults. JCS drops the undefined filters. Writers delete it so read-after-write holds in memory mode.

      Parameters

      • __namedParameters: { id: string }

      Returns Record<string, unknown>