fix: use explicit crypto import for Node 18 compatibility
crypto.randomUUID() is not globally available in Node 18. Import randomUUID from node:crypto explicitly so the framework works on all supported Node versions (>=18).
This commit is contained in:
parent
a772312a68
commit
3a46669a69
|
|
@ -6,6 +6,7 @@
|
|||
* Stateful orchestration belongs in {@link TaskQueue}.
|
||||
*/
|
||||
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import type { Task, TaskStatus } from '../types.js'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -33,7 +34,7 @@ export function createTask(input: {
|
|||
}): Task {
|
||||
const now = new Date()
|
||||
return {
|
||||
id: crypto.randomUUID(),
|
||||
id: randomUUID(),
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
status: 'pending' as TaskStatus,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
* for replay and audit; read-state is tracked per recipient.
|
||||
*/
|
||||
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Message type
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -93,7 +95,7 @@ export class MessageBus {
|
|||
*/
|
||||
send(from: string, to: string, content: string): Message {
|
||||
const message: Message = {
|
||||
id: crypto.randomUUID(),
|
||||
id: randomUUID(),
|
||||
from,
|
||||
to,
|
||||
content,
|
||||
|
|
|
|||
Loading…
Reference in New Issue