import { v4 } from "uuid";
import { getDurableRequestStore } from "./store.js";
import { getDurableRequestIdForEvent } from "./get-durable-request.js";
export async function setDurableRequest(data) {
    const createdAt = new Date().toISOString();
    const durableRequestId = data.durableRequestId || v4();
    const durableRequest = {
        ...data,
        createdAt,
        updatedAt: createdAt,
        durableRequestId,
    };
    const store = getDurableRequestStore();
    await store.set(durableRequestId, durableRequest);
    return durableRequest;
}
export function setDurableRequestForEvent(data, event) {
    return setDurableRequest({
        ...data,
        durableRequestId: getDurableRequestIdForEvent(event)
    });
}
//# sourceMappingURL=set-durable-request.js.map