+import type { AsyncResource } from 'node:async_hooks'
import type { EventLoopUtilization } from 'node:perf_hooks'
import type { MessagePort, TransferListItem } from 'node:worker_threads'
-import type { KillBehavior } from './worker/worker-options'
+
+import type { KillBehavior } from './worker/worker-options.js'
/**
* Worker error.
* @internal
*/
export interface Task<Data = unknown> {
- /**
- * Worker id.
- */
- readonly workerId: number
/**
* Task name.
*/
*/
export interface MessageValue<Data = unknown, ErrorData = unknown>
extends Task<Data> {
+ /**
+ * Worker id.
+ */
+ readonly workerId?: number
/**
* Kill code.
*/
/**
* Task function operation:
* - `'add'` - Add a task function.
- * - `'delete'` - Delete a task function.
+ * - `'remove'` - Remove a task function.
* - `'default'` - Set a task function as default.
*/
readonly taskFunctionOperation?: 'add' | 'remove' | 'default'
* The worker node key executing the task.
*/
readonly workerNodeKey: number
+ /**
+ * The asynchronous resource used to track the task execution.
+ */
+ readonly asyncResource?: AsyncResource
}
export type Writable<T> = { -readonly [P in keyof T]: T[P] }