@adonis-agora/durable 0.50.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/commands/work.d.ts.map +1 -1
  3. package/dist/commands/work.js +3 -1
  4. package/dist/commands/work.js.map +1 -1
  5. package/dist/providers/durable_provider.d.ts.map +1 -1
  6. package/dist/providers/durable_provider.js +3 -1
  7. package/dist/providers/durable_provider.js.map +1 -1
  8. package/dist/src/commands/worker.d.ts +4 -2
  9. package/dist/src/commands/worker.d.ts.map +1 -1
  10. package/dist/src/commands/worker.js +8 -5
  11. package/dist/src/commands/worker.js.map +1 -1
  12. package/dist/src/dashboard/index.d.ts +1 -1
  13. package/dist/src/dashboard/index.js +1 -1
  14. package/dist/src/engine.d.ts +10 -1
  15. package/dist/src/engine.d.ts.map +1 -1
  16. package/dist/src/engine.js +55 -17
  17. package/dist/src/engine.js.map +1 -1
  18. package/dist/src/errors.d.ts +15 -5
  19. package/dist/src/errors.d.ts.map +1 -1
  20. package/dist/src/errors.js +11 -7
  21. package/dist/src/errors.js.map +1 -1
  22. package/dist/src/index.d.ts +1 -1
  23. package/dist/src/index.js +1 -1
  24. package/dist/src/on-error.d.ts +4 -1
  25. package/dist/src/on-error.d.ts.map +1 -1
  26. package/dist/src/on-error.js +15 -2
  27. package/dist/src/on-error.js.map +1 -1
  28. package/dist/src/scheduler.d.ts +44 -3
  29. package/dist/src/scheduler.d.ts.map +1 -1
  30. package/dist/src/scheduler.js +36 -1
  31. package/dist/src/scheduler.js.map +1 -1
  32. package/dist/src/standard-schema.d.ts +8 -5
  33. package/dist/src/standard-schema.d.ts.map +1 -1
  34. package/dist/src/standard-schema.js +9 -7
  35. package/dist/src/standard-schema.js.map +1 -1
  36. package/dist/src/step-discovery.js +2 -2
  37. package/dist/src/step-discovery.js.map +1 -1
  38. package/dist/src/workflow-ref.d.ts +4 -2
  39. package/dist/src/workflow-ref.d.ts.map +1 -1
  40. package/dist/src/workflow-ref.js.map +1 -1
  41. package/package.json +1 -1
  42. package/skills/durable-workflows/SKILL.md +15 -3
@@ -132,12 +132,14 @@ Schemas are **any Standard Schema** (zod 3.24+/4, valibot, arktype, effect
132
132
  schema, …) — the package depends on none of them. They fit every schema slot:
133
133
  `@Step({ input, output })` / `defineStep` (with an unannotated handler the types
134
134
  are inferred from the schema), `static workflow = { inputSchema }` (validated at
135
- `start`, nothing created on failure; the schema's output value is the run's
136
- input), and `static workflow = { searchAttributes }` (every
135
+ `start`, nothing created on failure; the run stores the input as sent and
136
+ `run` receives the schema's output, re-parsed before every turn — keep the schema
137
+ deterministic and bump `version` when it changes), and `static workflow = { searchAttributes }` (every
137
138
  `ctx.upsertSearchAttributes` is validated against the merged attributes; type
138
139
  the ctx as `WorkflowCtx<InferSearchAttributes<typeof schema>>` and read back with
139
140
  `attributesOf(WorkflowClass, run)`). A failure is a `SchemaValidationError`
140
- (`FatalError`, code `schema_validation`, issues in `details.issues`) — never
141
+ (`FatalError`, code `invalid_input` / `invalid_output` — `schema_validation` for a
142
+ `searchAttributes` write — issues in `details.issues`) — never
141
143
  retried.
142
144
 
143
145
  ```ts
@@ -291,6 +293,16 @@ export default class DailyReportWorkflow extends BaseWorkflow {
291
293
  }
292
294
  ```
293
295
 
296
+ In `config/durable.ts`, name the workflow with a lazy import, as Adonis does for
297
+ controllers — never a direct class import, which can hang the boot (a service the
298
+ workflow imports awaits `app.booted` while the config is still loading):
299
+
300
+ ```ts
301
+ schedules: [
302
+ { key: 'daily-report', workflow: () => import('#workflows/daily_report_workflow'), cron: '0 2 * * *' },
303
+ ]
304
+ ```
305
+
294
306
  Each schedule window starts exactly once across a fleet via an idempotent
295
307
  time-bucket run id.
296
308