From 34d9fb21dbf3c2005f5a886da3a2b7d19b027d0f Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 20 Feb 2025 13:41:12 +0000 Subject: [PATCH 1/2] fix: Add `id` to `scheduleTask` docs --- packages/partywhen/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/partywhen/README.md b/packages/partywhen/README.md index 1a7e9a5b..d6b058f0 100644 --- a/packages/partywhen/README.md +++ b/packages/partywhen/README.md @@ -36,6 +36,7 @@ export default { A task has a few parts: +- **id**: a unique identifier for the task - **description**: which is a string that you can use to identify the task - **payload**: which is a JSON object that is passed to the task - **type**: which is one of "delayed", "cron", or "scheduled" @@ -54,6 +55,7 @@ Here are some examples: ```ts scheduler.scheduleTask({ + id: "my-task", description: "my-task", type: "delayed", delayInSeconds: 60, @@ -71,6 +73,7 @@ Here are some examples: ```ts scheduler.scheduleTask({ + id: "my-task", description: "my-task", type: "cron", cron: "0 18 * * 5", @@ -90,6 +93,7 @@ Here are some examples: ```ts scheduler.scheduleTask({ + id: "my-task", description: "my-task", type: "scheduled", time: new Date("2024-01-01T12:00:00Z"), From 25fd1d2ae04272690726e99908ac1a09bb43f372 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 20 Feb 2025 13:44:52 +0000 Subject: [PATCH 2/2] feat(partywhen): Add webhook headers --- packages/partywhen/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/partywhen/src/index.ts b/packages/partywhen/src/index.ts index cf47a8b0..b7800264 100644 --- a/packages/partywhen/src/index.ts +++ b/packages/partywhen/src/index.ts @@ -63,6 +63,7 @@ type Callback = | { type: "webhook"; url: string; + headers?: Record; } | { type: "durable-object"; @@ -359,6 +360,7 @@ export class Scheduler extends Server { method: "POST", body: JSON.stringify(task), headers: { + ...(task.callback.headers || {}), "Content-Type": "application/json" } });