import { Subscription } from '@essential-projects/event_aggregator_contracts'; import { IIdentity } from '@essential-projects/iam_contracts'; import { Messages } from '../messages/index'; /** * The INotificationConsumerApi is used to manage subscriptions for async notifications. */ export interface INotificationConsumerApi { /** * Removes the given notification subscription. * * @async * @param identity The requesting users identity. * @param subscription The subscription to remove. */ removeSubscription(identity: IIdentity, subscription: Subscription): Promise; /** * Executes the provided callback when a ProcessInstance is started. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a new * ProcessInstance was started. * The message passed to the callback contains * further information about the ProcessInstance. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onProcessStarted(identity: IIdentity, callback: Messages.CallbackTypes.OnProcessStartedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a new ProcessInstance for a given ProcessModelId * was started. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a new * ProcessInstance was started. * The message passed to the callback contains * further information about the ProcessInstance. * @param processModelId The ID of the ProcessModel to listen for. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onProcessWithProcessModelIdStarted(identity: IIdentity, callback: Messages.CallbackTypes.OnProcessStartedCallback, processModelId: string, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ProcessInstance ends. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * ProcessInstance was finished. * The message passed to the callback contains * further information about the ProcessInstance. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onProcessEnded(identity: IIdentity, callback: Messages.CallbackTypes.OnProcessEndedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ProcessInstance is terminated. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * ProcessInstance was terminated. * The message passed to the callback contains * further information about the ProcessInstance. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onProcessTerminated(identity: IIdentity, callback: Messages.CallbackTypes.OnProcessTerminatedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ProcessInstance runs into an error. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * ProcessInstance was aborted by an error. * The message passed to the callback contains * further information about the ProcessInstance. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onProcessError(identity: IIdentity, callback: Messages.CallbackTypes.OnProcessErrorCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an Activity is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * Activity is reached. * The message passed to the callback contains * further information about the Activity. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onActivityReached(identity: IIdentity, callback: Messages.CallbackTypes.OnActivityReachedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an Activity is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * Activity is finished. * The message passed to the callback contains * further information about the Activity. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onActivityFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnActivityFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an EmptyActivity is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * new EmptyActivity is waiting. * The message passed to the callback contains * further information about the EmptyActivity. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onEmptyActivityWaiting(identity: IIdentity, callback: Messages.CallbackTypes.OnEmptyActivityWaitingCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an EmptyActivity is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * EmptyActivity is finished. * The message passed to the callback contains * further information about the EmptyActivity. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onEmptyActivityFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnEmptyActivityFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an EmptyActivity for the given identity is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a new * EmptyActivity for the identity is waiting. * The message passed to the callback contains * further information about the EmptyActivity. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onEmptyActivityForIdentityWaiting(identity: IIdentity, callback: Messages.CallbackTypes.OnEmptyActivityWaitingCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an EmptyActivity for the given identity is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * EmptyActivity for the identity is finished. * The message passed to the callback contains * further information about the EmptyActivity. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onEmptyActivityForIdentityFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnEmptyActivityFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ManualTask is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * new ManualTask is waiting. * The message passed to the callback contains * further information about the ManualTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onManualTaskWaiting(identity: IIdentity, callback: Messages.CallbackTypes.OnManualTaskWaitingCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ManualTask is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * ManualTask is finished. * The message passed to the callback contains * further information about the ManualTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onManualTaskFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnManualTaskFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ManualTask for the given identity is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a new * ManualTask for the identity is waiting. * The message passed to the callback contains * further information about the ManualTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onManualTaskForIdentityWaiting(identity: IIdentity, callback: Messages.CallbackTypes.OnManualTaskWaitingCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a ManualTask for the given identity is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * ManualTask for the identity is finished. * The message passed to the callback contains * further information about the ManualTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onManualTaskForIdentityFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnManualTaskFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a UserTask is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * new UserTask is waiting. * The message passed to the callback contains * further information about the UserTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onUserTaskWaiting(identity: IIdentity, callback: Messages.CallbackTypes.OnUserTaskWaitingCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a UserTask is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * UserTask is finished. * The message passed to the callback contains * further information about the UserTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onUserTaskFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnUserTaskFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a UserTask for the given identity is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a new * UserTask for the identity is waiting. * The message passed to the callback contains * further information about the UserTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onUserTaskForIdentityWaiting(identity: IIdentity, callback: Messages.CallbackTypes.OnUserTaskWaitingCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a UserTask for the given identity is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * UserTask for the identity is finished. * The message passed to the callback contains * further information about the UserTask. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onUserTaskForIdentityFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnUserTaskFinishedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when a BoundaryEvent is triggered. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * new BoundaryEvent is triggered. * The message passed to the callback contains * further information about the BoundaryEvent. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onBoundaryEventTriggered(identity: IIdentity, callback: Messages.CallbackTypes.OnBoundaryEventTriggeredCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an IntermediateThrowEvent is triggered. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when a * new IntermediateThrowEvent is triggered. * The message passed to the callback contains * further information about the IntermediateThrowEvent. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onIntermediateThrowEventTriggered(identity: IIdentity, callback: Messages.CallbackTypes.OnIntermediateThrowEventTriggeredCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an IntermediateCatchEvent is reached. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * IntermediateCatchEvent is reached. * The message passed to the callback contains * further information about the IntermediateCatchEvent. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onIntermediateCatchEventReached(identity: IIdentity, callback: Messages.CallbackTypes.OnIntermediateCatchEventReachedCallback, subscribeOnce?: boolean): Promise; /** * Executes the provided callback when an IntermediateCatchEvent is finished. * * @async * @param identity The requesting users identity. * @param callback The callback that will be executed when an * IntermediateCatchEvent is finished. * The message passed to the callback contains * further information about the IntermediateCatchEvent. * @param subscribeOnce Optional: If set to true, the subscription will * be automatically disposed, after the notification * was received once. * @returns The subscription created by the EventAggregator. * * @throws {UnauthorizedError} If the given identity does not contain a * valid auth token. * @throws {ForbiddenError} If the user is not allowed to create * event subscriptions. */ onIntermediateCatchEventFinished(identity: IIdentity, callback: Messages.CallbackTypes.OnIntermediateCatchEventFinishedCallback, subscribeOnce?: boolean): Promise; }