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}.
|
* Stateful orchestration belongs in {@link TaskQueue}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { randomUUID } from 'node:crypto'
|
||||||
import type { Task, TaskStatus } from '../types.js'
|
import type { Task, TaskStatus } from '../types.js'
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
@ -33,7 +34,7 @@ export function createTask(input: {
|
||||||
}): Task {
|
}): Task {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
return {
|
return {
|
||||||
id: crypto.randomUUID(),
|
id: randomUUID(),
|
||||||
title: input.title,
|
title: input.title,
|
||||||
description: input.description,
|
description: input.description,
|
||||||
status: 'pending' as TaskStatus,
|
status: 'pending' as TaskStatus,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
* for replay and audit; read-state is tracked per recipient.
|
* for replay and audit; read-state is tracked per recipient.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { randomUUID } from 'node:crypto'
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Message type
|
// Message type
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
@ -93,7 +95,7 @@ export class MessageBus {
|
||||||
*/
|
*/
|
||||||
send(from: string, to: string, content: string): Message {
|
send(from: string, to: string, content: string): Message {
|
||||||
const message: Message = {
|
const message: Message = {
|
||||||
id: crypto.randomUUID(),
|
id: randomUUID(),
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
content,
|
content,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue