/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ import { Registry } from '@nocobase/utils'; import PluginNotificationManagerServer from './plugin'; import type { NotificationQueueMessage, NotificationChannelConstructor, RegisterServerTypeFnParams, ReceiversOptions, SendOptions, SendUserOptions, WriteLogOptions } from './types'; export declare class NotificationManager implements NotificationManager { private static readonly SLOW_SEND_THRESHOLD_MS; private plugin; channelTypes: Registry<{ Channel: NotificationChannelConstructor; useQueue: boolean; }>; constructor({ plugin }: { plugin: PluginNotificationManagerServer; }); registerType({ type, Channel, useQueue }: RegisterServerTypeFnParams): void; createSendingRecord: (options: WriteLogOptions) => Promise>; private toQueueMessage; private getQueuedResult; private getDirectResult; private getDeferredResult; private shouldUseQueue; private enqueue; private dispatchAfterCommit; findChannel(name: string): Promise; private getReceiverMeta; send(params: SendOptions): Promise<{ status: "success" | "failure"; reason: string; triggerFrom: string; channelName: string; receivers: ReceiversOptions; queued: boolean; } | { status: "success"; triggerFrom: string; channelName: string; receivers: ReceiversOptions; } | { status: "failure"; reason: string; triggerFrom: string; channelName: string; receivers: ReceiversOptions; }>; sendNow(params: NotificationQueueMessage): Promise; sendToUsers(options: SendUserOptions): Promise<({ status: "success" | "failure"; reason: string; triggerFrom: string; channelName: string; receivers: ReceiversOptions; queued: boolean; } | { status: "success"; triggerFrom: string; channelName: string; receivers: ReceiversOptions; } | { status: "failure"; reason: string; triggerFrom: string; channelName: string; receivers: ReceiversOptions; })[]>; } export default NotificationManager;