import { EventStream } from 'event-stream-pubsub'; import type { QueueOrder } from '../../domain.objects/constants'; export interface Queue { /** * add one or more items into the queue */ push: (item: T | T[]) => void; /** * view the top items from the queue, without removing them * * note * - `.peek() === .peek(1) === .peek(0, 1)` -> view the top item * - `.peek(2) === .peek(0, 2)` -> view the top 2 items * - `.peek(2, 3)` -> view the top 2nd and 3rd items */ peek: (start?: number, end?: number) => T[]; /** * remove the top items from the queue * * note * - `.pop() === .pop(1) === .pop(0, 1)` -> remove the top item * - `.pop(2) === .pop(0, 2)` -> remove the top 2 items * - `.pop(2, 3)` -> remove the top 2nd and 3rd items */ pop: (start?: number, end?: number) => T[]; /** * the current number of items in the queue */ length: number; /** * event streams that can be subscribed to */ on: { push: Omit, 'publish'>; peek: EventStream<{ items: T[]; }>; pop: EventStream<{ items: T[]; }>; }; } export declare const createQueue: ({ order }: { order: QueueOrder; }) => Queue;