/**
* Worker error.
- *
* @typeParam Data - Type of data sent to the worker triggering an error. This can only be structured-cloneable data.
*/
export interface WorkerError<Data = unknown> {
/**
* Task performance.
- *
* @internal
*/
export interface TaskPerformance {
/**
* Worker task performance statistics computation settings.
- *
* @internal
*/
export interface WorkerStatistics {
/**
* Task function properties.
- *
- * @internal
*/
export interface TaskFunctionProperties {
/**
* Task function name.
*/
- name: string
+ readonly name: string
/**
* Task function priority. Lower values have higher priority.
*/
- priority?: number
+ readonly priority?: number
/**
* Task function worker choice strategy.
*/
- strategy?: WorkerChoiceStrategy
+ readonly strategy?: WorkerChoiceStrategy
}
/**
* Message object that is passed as a task between main worker and worker.
- *
* @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
* @internal
*/
* Task input data that will be passed to the worker.
*/
readonly data?: Data
+ /**
+ * Task priority. Lower values have higher priority.
+ * @defaultValue 0
+ */
+ readonly priority?: number
+ /**
+ * Task worker choice strategy.
+ */
+ readonly strategy?: WorkerChoiceStrategy
/**
* Array of transferable objects.
*/
/**
* Task UUID.
*/
- readonly taskId?: string
+ readonly taskId?: `${string}-${string}-${string}-${string}-${string}`
}
/**
* Message object that is passed between main worker and worker.
- *
* @typeParam Data - Type of data sent to the worker or execution response. This can only be structured-cloneable data.
* @typeParam ErrorData - Type of data sent to the worker triggering an error. This can only be structured-cloneable data.
* @internal
/**
* An object holding the task execution response promise resolve/reject callbacks.
- *
* @typeParam Response - Type of execution response. This can only be structured-cloneable data.
* @internal
*/