Skip to content

Commit 8dc697d

Browse files
Version Packages (#183)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent af787ff commit 8dc697d

File tree

16 files changed

+293
-94
lines changed

16 files changed

+293
-94
lines changed

.changeset/hot-chairs-juggle.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

pkgs/cli/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# pgflow
22

3+
## 0.5.3
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [af787ff]
8+
- @pgflow/core@0.5.3
9+
310
## 0.5.2
411

512
### Patch Changes

pkgs/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pgflow",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"type": "module",
55
"main": "./dist/index.js",
66
"typings": "./dist/index.d.ts",

pkgs/client/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @pgflow/client
22

3+
## 0.5.3
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [af787ff]
8+
- @pgflow/core@0.5.3
9+
- @pgflow/dsl@0.5.3
10+
311
## 0.5.2
412

513
### Patch Changes

pkgs/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pgflow/client",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"type": "module",
55
"scripts": {
66
"verify-exports": "node scripts/verify-exports.js"

pkgs/core/CHANGELOG.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,91 @@
11
# @pgflow/core
22

3+
## 0.5.3
4+
5+
### Patch Changes
6+
7+
- af787ff: Add `startDelay` option for workflow steps
8+
9+
Introduces the ability to delay a step's **initial execution** by a specified number of seconds, enabling multi-day workflows and scheduled tasks within pgflow.
10+
11+
**Important**: `startDelay` only applies to the first execution attempt. Retries use the standard exponential backoff mechanism based on `baseDelay`, not `startDelay`.
12+
13+
### Core Changes (@pgflow/core)
14+
15+
- Added `opt_start_delay` column (integer, nullable, CHECK >= 0) to `pgflow.steps` table
16+
- Updated `add_step` function to accept and validate the new `start_delay` parameter
17+
- Modified `start_ready_steps` to schedule initial task execution with delay via `pgmq.send(queue, message, delay)`
18+
- Requires pgmq >= 0.40 for delay support
19+
- Migration: `20250707210212_pgflow_add_opt_start_delay.sql`
20+
- Added comprehensive PgTAP tests for validation and scheduling behavior
21+
22+
### DSL Changes (@pgflow/dsl)
23+
24+
- Extended `StepOptions` and `StepRuntimeOptions` interfaces with optional `startDelay` (in seconds)
25+
- Updated `compileFlow()` to emit `start_delay => value` in generated SQL
26+
- Added validation: `startDelay` is only allowed at step level, not flow level (prevents cascading delays)
27+
- Valid range: 0 to 2,147,483,647 seconds (~68 years)
28+
- Added unit tests for compilation and validation
29+
30+
### Documentation Updates (@pgflow/website)
31+
32+
- Added `startDelay` section in configuration guide with detailed explanation
33+
- Created multi-day workflow example (onboarding email sequence)
34+
- Updated "Update Flow Options" to include `opt_start_delay`
35+
- Enhanced VS comparison pages to mention "Native step delays" capability
36+
- Documented why `startDelay` is step-level only
37+
38+
### Example Usage
39+
40+
```typescript
41+
new Flow({
42+
slug: 'user_onboarding',
43+
maxAttempts: 3,
44+
baseDelay: 5, // Retry delay (not initial delay)
45+
timeout: 60,
46+
})
47+
.step(
48+
{
49+
slug: 'send_welcome_email',
50+
// Executes immediately when step becomes ready
51+
},
52+
sendWelcomeHandler
53+
)
54+
.step(
55+
{
56+
slug: 'send_day_3_tips',
57+
startDelay: 259200, // Wait 3 days before first execution
58+
timeout: 120,
59+
},
60+
sendTipsHandler
61+
)
62+
.step(
63+
{
64+
slug: 'send_week_review',
65+
startDelay: 604800, // Wait 7 days after dependencies complete
66+
timeout: 120,
67+
},
68+
sendReviewHandler
69+
);
70+
```
71+
72+
### Use Cases
73+
74+
- **Multi-day workflows**: Onboarding sequences, follow-up reminders
75+
- **Scheduled notifications**: Send reports or alerts at specific intervals
76+
- **Rate limiting**: Enforce minimum time between API calls
77+
- **Compliance delays**: Cooling-off periods before actions
78+
79+
### Technical Notes
80+
81+
- Non-breaking, additive change (hence minor version bump)
82+
- No changes required in `@pgflow/edge-worker` - delays handled by pgmq
83+
- `startDelay` does not affect retry timing - only the initial execution
84+
- Delays are reliable even across worker restarts (persisted in queue)
85+
86+
- Updated dependencies [af787ff]
87+
- @pgflow/dsl@0.5.3
88+
389
## 0.5.2
490

591
### Patch Changes

pkgs/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pgflow/core",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"license": "AGPL-3.0",
55
"type": "module",
66
"main": "./dist/index.js",

pkgs/dsl/CHANGELOG.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,88 @@
11
# @pgflow/dsl
22

3+
## 0.5.3
4+
5+
### Patch Changes
6+
7+
- af787ff: Add `startDelay` option for workflow steps
8+
9+
Introduces the ability to delay a step's **initial execution** by a specified number of seconds, enabling multi-day workflows and scheduled tasks within pgflow.
10+
11+
**Important**: `startDelay` only applies to the first execution attempt. Retries use the standard exponential backoff mechanism based on `baseDelay`, not `startDelay`.
12+
13+
### Core Changes (@pgflow/core)
14+
15+
- Added `opt_start_delay` column (integer, nullable, CHECK >= 0) to `pgflow.steps` table
16+
- Updated `add_step` function to accept and validate the new `start_delay` parameter
17+
- Modified `start_ready_steps` to schedule initial task execution with delay via `pgmq.send(queue, message, delay)`
18+
- Requires pgmq >= 0.40 for delay support
19+
- Migration: `20250707210212_pgflow_add_opt_start_delay.sql`
20+
- Added comprehensive PgTAP tests for validation and scheduling behavior
21+
22+
### DSL Changes (@pgflow/dsl)
23+
24+
- Extended `StepOptions` and `StepRuntimeOptions` interfaces with optional `startDelay` (in seconds)
25+
- Updated `compileFlow()` to emit `start_delay => value` in generated SQL
26+
- Added validation: `startDelay` is only allowed at step level, not flow level (prevents cascading delays)
27+
- Valid range: 0 to 2,147,483,647 seconds (~68 years)
28+
- Added unit tests for compilation and validation
29+
30+
### Documentation Updates (@pgflow/website)
31+
32+
- Added `startDelay` section in configuration guide with detailed explanation
33+
- Created multi-day workflow example (onboarding email sequence)
34+
- Updated "Update Flow Options" to include `opt_start_delay`
35+
- Enhanced VS comparison pages to mention "Native step delays" capability
36+
- Documented why `startDelay` is step-level only
37+
38+
### Example Usage
39+
40+
```typescript
41+
new Flow({
42+
slug: 'user_onboarding',
43+
maxAttempts: 3,
44+
baseDelay: 5, // Retry delay (not initial delay)
45+
timeout: 60,
46+
})
47+
.step(
48+
{
49+
slug: 'send_welcome_email',
50+
// Executes immediately when step becomes ready
51+
},
52+
sendWelcomeHandler
53+
)
54+
.step(
55+
{
56+
slug: 'send_day_3_tips',
57+
startDelay: 259200, // Wait 3 days before first execution
58+
timeout: 120,
59+
},
60+
sendTipsHandler
61+
)
62+
.step(
63+
{
64+
slug: 'send_week_review',
65+
startDelay: 604800, // Wait 7 days after dependencies complete
66+
timeout: 120,
67+
},
68+
sendReviewHandler
69+
);
70+
```
71+
72+
### Use Cases
73+
74+
- **Multi-day workflows**: Onboarding sequences, follow-up reminders
75+
- **Scheduled notifications**: Send reports or alerts at specific intervals
76+
- **Rate limiting**: Enforce minimum time between API calls
77+
- **Compliance delays**: Cooling-off periods before actions
78+
79+
### Technical Notes
80+
81+
- Non-breaking, additive change (hence minor version bump)
82+
- No changes required in `@pgflow/edge-worker` - delays handled by pgmq
83+
- `startDelay` does not affect retry timing - only the initial execution
84+
- Delays are reliable even across worker restarts (persisted in queue)
85+
386
## 0.5.2
487

588
## 0.5.1

pkgs/dsl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pgflow/dsl",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"type": "module",
55
"main": "./dist/index.js",
66
"module": "./dist/index.js",

pkgs/edge-worker/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @pgflow/edge-worker
22

3+
## 0.5.3
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [af787ff]
8+
- @pgflow/core@0.5.3
9+
- @pgflow/dsl@0.5.3
10+
311
## 0.5.2
412

513
### Patch Changes

0 commit comments

Comments
 (0)