UNPKG

@sidequest/engine

Version:

@sidequest/engine is the core engine of SideQuest, a distributed background job processing system for Node.js and TypeScript.

35 lines (32 loc) 1.72 kB
import { NewQueueData, Backend } from '@sidequest/backend'; import { QueueConfig } from '@sidequest/core'; /** * Represents the default configuration data for creating a new queue. * This type excludes the 'id' field from NewQueueData, as IDs are typically * generated automatically when creating new queue instances. */ type QueueDefaults = Omit<NewQueueData, "id" | "name">; /** * Determines if a new queue configuration differs from the existing queue configuration. * * Compares the provided queue data against the current queue configuration to detect * any changes in concurrency, state, or priority properties. Only checks properties * that are defined (truthy) in the new queue data. * * @param queue - The new queue data to compare against the existing configuration * @param queueConfig - The current queue configuration to compare against * @returns `true` if any of the defined properties in the new queue data differ from * the corresponding properties in the existing configuration, `false` otherwise */ declare function differentQueueConfig(queue: NewQueueData, queueConfig: QueueConfig): boolean; /** * Ensures a queue configuration exists, creating it if necessary. * @param queue The name of the queue. * @param config Optional configuration for the new queue. * @param defaults Optional default values for the queue. * @param forceUpdate If true, updates the queue configuration even if it already exists. * @returns The queue configuration. */ declare function grantQueueConfig(backend: Backend, queue: NewQueueData, defaults?: QueueDefaults, forceUpdate?: boolean): Promise<QueueConfig>; export { differentQueueConfig, grantQueueConfig }; export type { QueueDefaults };