@t4h.framework/core 0.9.0 → 0.10.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 (121) hide show
  1. package/.ai/skills/framework-core/SKILL.md +9 -8
  2. package/.ai/skills/framework-workflow-creation/SKILL.md +32 -7
  3. package/.ai/skills/framework-workflow-testing/SKILL.md +9 -1
  4. package/CHANGELOG.md +117 -0
  5. package/README.md +13 -8
  6. package/dist/activities/StartWorkflowActivity.d.ts +5 -6
  7. package/dist/activities/StartWorkflowActivity.d.ts.map +1 -1
  8. package/dist/activities/StartWorkflowActivity.js +12 -11
  9. package/dist/activities/StartWorkflowActivity.js.map +1 -1
  10. package/dist/core.d.ts +1 -0
  11. package/dist/core.d.ts.map +1 -1
  12. package/dist/core.js +1 -0
  13. package/dist/core.js.map +1 -1
  14. package/dist/exceptions/TimerNotAllowedException.d.ts +5 -0
  15. package/dist/exceptions/TimerNotAllowedException.d.ts.map +1 -0
  16. package/dist/exceptions/TimerNotAllowedException.js +9 -0
  17. package/dist/exceptions/TimerNotAllowedException.js.map +1 -0
  18. package/dist/models/AsyncActivityAwaitable.d.ts +1 -1
  19. package/dist/models/AsyncActivityAwaitable.d.ts.map +1 -1
  20. package/dist/models/AsyncActivityAwaitable.js +2 -0
  21. package/dist/models/AsyncActivityAwaitable.js.map +1 -1
  22. package/dist/models/History.d.ts +17 -2
  23. package/dist/models/History.d.ts.map +1 -1
  24. package/dist/models/History.js +26 -8
  25. package/dist/models/History.js.map +1 -1
  26. package/dist/models/Logger.d.ts.map +1 -1
  27. package/dist/models/Logger.js +2 -1
  28. package/dist/models/Logger.js.map +1 -1
  29. package/dist/testing/TestClock.d.ts.map +1 -1
  30. package/dist/testing/TestClock.js +6 -35
  31. package/dist/testing/TestClock.js.map +1 -1
  32. package/dist/testing/TestWorkflowEnvironment.d.ts.map +1 -1
  33. package/dist/testing/TestWorkflowEnvironment.js +6 -4
  34. package/dist/testing/TestWorkflowEnvironment.js.map +1 -1
  35. package/dist/testing/tools/resolve-activity.d.ts.map +1 -1
  36. package/dist/testing/tools/resolve-activity.js +4 -1
  37. package/dist/testing/tools/resolve-activity.js.map +1 -1
  38. package/dist/testing/tools/resolve-async-activity.d.ts +3 -2
  39. package/dist/testing/tools/resolve-async-activity.d.ts.map +1 -1
  40. package/dist/testing/tools/resolve-async-activity.js +17 -36
  41. package/dist/testing/tools/resolve-async-activity.js.map +1 -1
  42. package/dist/testing/tools/run-workflow-ticks.d.ts.map +1 -1
  43. package/dist/testing/tools/run-workflow-ticks.js +6 -0
  44. package/dist/testing/tools/run-workflow-ticks.js.map +1 -1
  45. package/dist/testing/tools/run-workflow.d.ts +4 -0
  46. package/dist/testing/tools/run-workflow.d.ts.map +1 -1
  47. package/dist/testing/tools/run-workflow.js +17 -7
  48. package/dist/testing/tools/run-workflow.js.map +1 -1
  49. package/dist/tools/Deterministic.d.ts +7 -0
  50. package/dist/tools/Deterministic.d.ts.map +1 -0
  51. package/dist/tools/Deterministic.js +107 -0
  52. package/dist/tools/Deterministic.js.map +1 -0
  53. package/dist/tools/Internals.d.ts +2 -0
  54. package/dist/tools/Internals.d.ts.map +1 -1
  55. package/dist/tools/Internals.js +5 -1
  56. package/dist/tools/Internals.js.map +1 -1
  57. package/dist/tools/clock.d.ts +3 -0
  58. package/dist/tools/clock.d.ts.map +1 -0
  59. package/dist/tools/clock.js +11 -0
  60. package/dist/tools/clock.js.map +1 -0
  61. package/dist/tools/random.d.ts +3 -0
  62. package/dist/tools/random.d.ts.map +1 -0
  63. package/dist/tools/random.js +29 -0
  64. package/dist/tools/random.js.map +1 -0
  65. package/package.json +1 -1
  66. package/dist/models/ContinueAsNew.d.ts +0 -24
  67. package/dist/models/ContinueAsNew.d.ts.map +0 -1
  68. package/dist/models/ContinueAsNew.js +0 -28
  69. package/dist/models/ContinueAsNew.js.map +0 -1
  70. package/dist/models/ExecutionContext.d.ts +0 -8
  71. package/dist/models/ExecutionContext.d.ts.map +0 -1
  72. package/dist/models/ExecutionContext.js +0 -22
  73. package/dist/models/ExecutionContext.js.map +0 -1
  74. package/dist/testing/ActivityTesting.d.ts +0 -25
  75. package/dist/testing/ActivityTesting.d.ts.map +0 -1
  76. package/dist/testing/ActivityTesting.js +0 -74
  77. package/dist/testing/ActivityTesting.js.map +0 -1
  78. package/dist/testing/NonDeterministicWorkflowError.d.ts +0 -4
  79. package/dist/testing/NonDeterministicWorkflowError.d.ts.map +0 -1
  80. package/dist/testing/NonDeterministicWorkflowError.js +0 -7
  81. package/dist/testing/NonDeterministicWorkflowError.js.map +0 -1
  82. package/dist/testing/StrictGuard.d.ts +0 -4
  83. package/dist/testing/StrictGuard.d.ts.map +0 -1
  84. package/dist/testing/StrictGuard.js +0 -26
  85. package/dist/testing/StrictGuard.js.map +0 -1
  86. package/dist/testing/WorkflowTesting.d.ts +0 -6
  87. package/dist/testing/WorkflowTesting.d.ts.map +0 -1
  88. package/dist/testing/WorkflowTesting.js +0 -7
  89. package/dist/testing/WorkflowTesting.js.map +0 -1
  90. package/dist/testing/create-mock-claim.d.ts +0 -11
  91. package/dist/testing/create-mock-claim.d.ts.map +0 -1
  92. package/dist/testing/create-mock-claim.js +0 -26
  93. package/dist/testing/create-mock-claim.js.map +0 -1
  94. package/dist/testing/create-mock-claims.d.ts +0 -13
  95. package/dist/testing/create-mock-claims.d.ts.map +0 -1
  96. package/dist/testing/create-mock-claims.js +0 -8
  97. package/dist/testing/create-mock-claims.js.map +0 -1
  98. package/dist/testing/create-test-env.d.ts +0 -10
  99. package/dist/testing/create-test-env.d.ts.map +0 -1
  100. package/dist/testing/create-test-env.js +0 -7
  101. package/dist/testing/create-test-env.js.map +0 -1
  102. package/dist/testing/mock-async.d.ts +0 -48
  103. package/dist/testing/mock-async.d.ts.map +0 -1
  104. package/dist/testing/mock-async.js +0 -58
  105. package/dist/testing/mock-async.js.map +0 -1
  106. package/dist/testing/outcomes.d.ts +0 -12
  107. package/dist/testing/outcomes.d.ts.map +0 -1
  108. package/dist/testing/outcomes.js +0 -10
  109. package/dist/testing/outcomes.js.map +0 -1
  110. package/dist/testing/run-workflow.d.ts +0 -32
  111. package/dist/testing/run-workflow.d.ts.map +0 -1
  112. package/dist/testing/run-workflow.js +0 -160
  113. package/dist/testing/run-workflow.js.map +0 -1
  114. package/dist/testing/tools/serializable-clone.d.ts +0 -21
  115. package/dist/testing/tools/serializable-clone.d.ts.map +0 -1
  116. package/dist/testing/tools/serializable-clone.js +0 -77
  117. package/dist/testing/tools/serializable-clone.js.map +0 -1
  118. package/dist/testing/types.d.ts +0 -19
  119. package/dist/testing/types.d.ts.map +0 -1
  120. package/dist/testing/types.js +0 -2
  121. package/dist/testing/types.js.map +0 -1
@@ -36,7 +36,8 @@ Node `>=22`. Schemas use TypeBox (`typebox`). See [README.md](../../../README.md
36
36
 
37
37
  - **Workflow** — an orchestration entrypoint: a plain async function wrapped in `new Workflow(...)`. It coordinates steps; it does not implement the steps.
38
38
  - **App** — registers workflows so the runtime can discover and run them.
39
- - **Replay & determinism** — the runtime may re-run a workflow from its recorded history. Keep the body deterministic: branch on inputs and on the results of the steps you call, never on `Date.now()`, `Math.random()`, or ambient state. Use framework primitives (e.g. `sleep`) when you need time to pass.
39
+ - **Replay & determinism** — the runtime re-runs a workflow from its recorded history on every tick, so the body must reach the same state every time. Branch on inputs, on the results of the steps you call, and on the values the framework makes deterministic (see below); never on other ambient state (`process.env`, module-level mutable variables).
40
+ - **Time & randomness** — inside a workflow, `Date.now()`, `new Date()`, `Math.random()` and `crypto.randomUUID()` are deterministic and safe to use. The clock follows the history: it starts when the run was created and only moves forward as steps are recorded (a step's request time, or the moment an awaited step settled), so it stands still between two steps. Randomness is seeded by the run id. `setTimeout`/`setInterval` throw `TimerNotAllowedException` — use `sleep` to wait.
40
41
  - **env** — configuration values supplied by the runtime; the single source for URLs, tokens, and tenants.
41
42
  - **Composition** — external work is performed by calling primitives from the other framework packages inside the workflow body.
42
43
 
@@ -51,12 +52,12 @@ import { Workflow } from '@t4h.framework/core'
51
52
  const bare = new Workflow(async () => ({ ok: true }))
52
53
 
53
54
  const withMeta = new Workflow(
54
- { id: 'cashback/v1', description: 'Process cashback' },
55
+ { id: 'cashback', description: 'Process cashback' },
55
56
  async input => ({ value: input.amount * 0.05 }),
56
57
  )
57
58
 
58
59
  const schema = Type.Object({ userId: Type.String(), amount: Type.Number() })
59
- const validated = new Workflow({ id: 'cashback/v1', schema }, async input => ({
60
+ const validated = new Workflow({ id: 'cashback', schema }, async input => ({
60
61
  value: input.amount * 0.05,
61
62
  }))
62
63
  ```
@@ -92,9 +93,8 @@ import { App, Workflow } from '@t4h.framework/core'
92
93
  const app = new App({
93
94
  id: 'my-automation',
94
95
  description: 'Cashback automation',
95
- workflows: [myWorkflow],
96
+ workflows: [myWorkflow, anotherWorkflow], // throws on duplicate workflow.id
96
97
  })
97
- app.addWorkflow(anotherWorkflow) // throws on duplicate workflow.id
98
98
  ```
99
99
 
100
100
  `toManifest()` includes the registered workflows plus any `EnvDesign` entries.
@@ -168,7 +168,7 @@ const output = await env.execute(workflow, input, {
168
168
 
169
169
  | Option | Default | Purpose |
170
170
  |--------|---------|---------|
171
- | `now` | `0` | Pins `Date.now()` to this value at run start |
171
+ | `now` | `0` | Virtual host time at run start. It becomes the run's start time and stamps every recorded step; `Date.now()` inside the workflow reads those stamps |
172
172
  | `resolveActivityTimeouts` | `true` | Auto-advances the clock through time-based steps (e.g. `sleep`) and resolves them |
173
173
 
174
174
  `execute()` options:
@@ -202,7 +202,8 @@ Do **not** import `@t4h.framework/core/testing` in production app code.
202
202
  - Reading `process.env` directly, or reading the raw `env` proxy when the project should declare an `EnvDesign` in `constants/environments.ts`.
203
203
  - Inlining URLs/secrets/tenants in workflow code instead of pulling them from the shared `EnvDesign`.
204
204
  - Accessing an `EnvDesign` key at module top level (throws — no env storage outside a run); read keys inside the workflow body/functions.
205
- - Non-deterministic workflow bodies (`Date.now()`, `Math.random()`, ambient state) — they break replay.
205
+ - `setTimeout` / `setInterval` inside a workflow body — throws `TimerNotAllowedException`; wait with `sleep`.
206
+ - Branching on ambient state (`process.env`, module-level mutable variables) or measuring elapsed time between steps — the workflow clock stands still between steps, so such measurements are always `0`.
206
207
  - Non-`Serializable` workflow input, output, or step values.
207
208
  - Duplicate `workflow.id` within an `App`.
208
209
  - Importing `@t4h.framework/core/testing` from production code.
@@ -212,7 +213,7 @@ Do **not** import `@t4h.framework/core/testing` in production app code.
212
213
 
213
214
  ## Exports
214
215
 
215
- **Main (`@t4h.framework/core`):** `Workflow`, `App`, `startWorkflow`, `WorkflowRef`, `env`, `EnvDesign`, `Authorization`, `Binary`, `Serializable`.
216
+ **Main (`@t4h.framework/core`):** `Workflow`, `App`, `startWorkflow`, `WorkflowRef`, `env`, `EnvDesign`, `Authorization`, `Binary`, `Serializable`, `TimerNotAllowedException`.
216
217
 
217
218
  **Testing (`@t4h.framework/core/testing`):** `TestWorkflowEnvironment`, `TestClock`, `createTestEnv`, `createTestEnvEntries`, `NonDeterministicWorkflowError`.
218
219
 
@@ -7,7 +7,10 @@ description: >-
7
7
  read configuration from a shared EnvDesign in constants/environments.ts.
8
8
  Register it in an App. Use whenever the user asks to create a new workflow,
9
9
  wire it into an App, or refactor workflow code to remove hardcoded
10
- URLs/secrets/client values and move configuration to an EnvDesign.
10
+ URLs/secrets/client values and move configuration to an EnvDesign. A workflow
11
+ never implements infrastructure types itself — file content becomes a Binary
12
+ through `write` from @t4h.framework/fs (see framework-fs-write), never
13
+ through a custom Binary subclass.
11
14
  ---
12
15
 
13
16
  # Create workflows with `@t4h.framework/core`
@@ -32,10 +35,11 @@ Create workflows that:
32
35
  | External HTTP call | `http.get/post/put/...` | `@t4h.framework/http` (see **framework-http**) |
33
36
  | Delay / wait | `sleep('30 seconds')` | `@t4h.framework/sleep` (see **framework-sleep**) |
34
37
  | Nested workflow | `startWorkflow(child, input)` | `@t4h.framework/core` |
38
+ | Content into a file (`Binary`) | `write(content, { contentType })` | `@t4h.framework/fs` (see **framework-fs-write**) |
35
39
  | Configuration | `environments.MY_KEY` from a shared `EnvDesign` | `@t4h.framework/core` |
36
40
  | Branching / mapping | plain TypeScript | — |
37
41
 
38
- Keep the body **deterministic** so it replays safely: branch on inputs and step results, never on `Date.now()`, `Math.random()`, or ambient state. Use `sleep` when you need time to pass.
42
+ Keep the body **deterministic** so it replays safely: branch on inputs and step results, never on ambient state (`process.env`, module-level mutable variables). `Date.now()`, `new Date()`, `Math.random()` and `crypto.randomUUID()` are made deterministic by the framework and are safe to use — the clock follows the recorded history and stands still between steps, randomness is seeded by the run. `setTimeout`/`setInterval` throw `TimerNotAllowedException`; use `sleep` when you need time to pass.
39
43
 
40
44
  ## Expected project shape
41
45
 
@@ -102,14 +106,28 @@ One `environments` object is the single source of configuration for the whole pr
102
106
  3. Define workflow metadata with a stable `id`.
103
107
  4. Add a `schema` when input validation is needed.
104
108
  5. Import all configuration from the shared `EnvDesign` in `constants/environments.ts` — never raw `env` or `process.env`.
105
- 6. Keep the body deterministic so replay produces the same result.
109
+ 6. Keep the body deterministic so replay produces the same result. `Date.now()` / `Math.random()` are safe; timers are not — use `sleep`.
110
+ 7. Obtain a `Binary` from the framework — an HTTP response body, `sftp.get`, `write`, `join` — never by implementing one.
106
111
 
107
112
  ## Hard constraints
108
113
 
109
114
  - Do not hardcode URLs, client IDs, client secrets, API keys, tenants, or tokens.
110
115
  - Do not initialize third-party clients with inline credentials inside workflow files.
111
116
  - Do not read `process.env` or the raw `env` proxy directly — declare configuration in the shared `EnvDesign` (`constants/environments.ts`).
112
- - Do not call `fetch`/`axios` or other non-framework I/O directly — that breaks replay safety.
117
+ - Do not call `fetch`/`axios` or other non-framework I/O directly — that breaks replay safety, and their internal timers throw `TimerNotAllowedException`.
118
+ - Do not call `setTimeout` / `setInterval` inside a workflow — it throws `TimerNotAllowedException`. Wait with `sleep` from `@t4h.framework/sleep`.
119
+ - Do not measure elapsed time between steps with `Date.now()` — the workflow clock only moves when a step is recorded, so the difference is always `0`.
120
+ - **Do not declare a class that extends `Binary`** (`BufferBinary`, `StringBinary`, `stringToBinary` helpers, …). To hand content to a primitive that takes a `Binary` — `sftp.put`, `sftp.append`, an HTTP body — build it with `write` from `@t4h.framework/fs`:
121
+
122
+ ```ts
123
+ import { write } from '@t4h.framework/fs'
124
+
125
+ const file = await write(JSON.stringify(data), { contentType: 'application/json' })
126
+
127
+ await sftp.put('/out/data.json', file)
128
+ ```
129
+
130
+ A value handed to a primitive becomes the input of a durable activity and is serialized to storage before the activity runs; a `Binary` holding bytes in memory has nothing to serialize into, and the activity may run in another process after a replay. Such a class can pass locally — the dev server keeps values in memory — and break once deployed. See the **framework-fs-write** skill.
113
131
 
114
132
  Required keys declared in the `EnvDesign` fail fast automatically: accessing an unset required key throws `Environment variable X is not set`. Use `isOptional`/`defaultValue` when a key may be absent.
115
133
 
@@ -135,7 +153,7 @@ Required keys declared in the `EnvDesign` fail fast automatically: accessing an
135
153
 
136
154
  ### Step 4: make it test-friendly
137
155
 
138
- - Keep outputs deterministic.
156
+ - Keep outputs deterministic (`Date.now()` and `Math.random()` are fine; they replay identically).
139
157
  - Avoid hidden global state.
140
158
  - Drive external effects through package primitives so tests can supply their providers (see **framework-core** testing and each package's skill).
141
159
 
@@ -192,8 +210,13 @@ import { Workflow, startWorkflow } from '@t4h.framework/core'
192
210
  import { childWorkflow } from './child-workflow.js'
193
211
 
194
212
  export const parentWorkflow = new Workflow({ id: 'parent-workflow' }, async input => {
195
- const ref = await startWorkflow(childWorkflow, input)
196
- return ref.output
213
+ const started = await startWorkflow(childWorkflow, input)
214
+
215
+ // `startWorkflow` resolves as soon as the child is started; `wait()` is what
216
+ // suspends the parent until the child is terminal.
217
+ const ref = await started.wait()
218
+
219
+ return ref.output // ref: WorkflowRef — { status, output }
197
220
  })
198
221
  ```
199
222
 
@@ -205,6 +228,8 @@ export const parentWorkflow = new Workflow({ id: 'parent-workflow' }, async inpu
205
228
  - Creating SDK/API clients with literal credentials inside the workflow function.
206
229
  - Calling `fetch`/`axios` or other raw I/O instead of the framework's `http` primitive.
207
230
  - Building custom low-level infrastructure inside a consuming app to make a workflow work — use the framework packages that already provide it.
231
+ - Declaring a `Binary` subclass to pass generated content to `sftp.put` or any other file primitive — use `write` from `@t4h.framework/fs` (**framework-fs-write**).
232
+ - Reading `.output` straight off the value `startWorkflow` returns — it resolves to an awaitable; call `wait()` to get the `WorkflowRef`.
208
233
  - Large workflow functions doing plumbing instead of orchestration.
209
234
  - Registering workflows in scattered places instead of the centralized `App` declaration.
210
235
 
@@ -66,7 +66,7 @@ env.clock.set(now) // set pinned clock to a Date | number
66
66
 
67
67
  | Option | Default | Purpose |
68
68
  |--------|---------|---------|
69
- | `now` | `0` | Pins `Date.now()` to this value at start |
69
+ | `now` | `0` | Virtual host time at start. It becomes the run's start time and stamps every recorded step; `Date.now()` inside the workflow reads those stamps |
70
70
  | `resolveActivityTimeouts` | `true` | Auto-advances clock to each activity's `timeoutAt` and resolves it via `onTimeout` |
71
71
 
72
72
  `execute()` options:
@@ -80,6 +80,14 @@ env.clock.set(now) // set pinned clock to a Date | number
80
80
  After `execute()` returns, the clock is advanced to wherever the run left it.
81
81
  Subsequent `env.clock.advance()` calls build on that value between tests.
82
82
 
83
+ Inside the workflow, `Date.now()` is the history clock, not the virtual clock
84
+ directly: it equals `now` until the first step is recorded, then moves to each
85
+ step's stamp (request time, or settle time for an awaited async step). It never
86
+ moves backwards and stands still between steps. `Math.random()` and
87
+ `crypto.randomUUID()` are seeded by the run and replay identically, so asserting
88
+ on them is safe. A workflow that calls `setTimeout` / `setInterval` rejects with
89
+ `TimerNotAllowedException`.
90
+
83
91
  Async activities are resolved in tests through `mockAsyncActivity` (which returns
84
92
  a final outcome directly). Workflow tests never drive an activity's internal
85
93
  `advance` method — you only assert the workflow's observable output and effects.
package/CHANGELOG.md ADDED
@@ -0,0 +1,117 @@
1
+ # @t4h.framework/core
2
+
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#155](https://github.com/tech4humans-brasil/framework/pull/155) [`8098041`](https://github.com/tech4humans-brasil/framework/commit/80980419d59a987378b7c94372ee2f7b7dcc00f5) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Deterministic workflow replay: time, randomness and timers.
8
+ - `Date.now()`, `new Date()`, `Math.random()` and `crypto.randomUUID()` are
9
+ deterministic inside workflow code. The clock follows the history
10
+ (`createdAt` of the run, then `createdAt`/`settledAt` of each item) and
11
+ randomness derives from the run id, so nothing new is stored.
12
+ - `setTimeout`/`setInterval` inside a workflow throw
13
+ `TimerNotAllowedException`. Use an activity (`@t4h.framework/sleep`) to wait.
14
+ - New export: `TimerNotAllowedException`.
15
+ - **Breaking for hosts:** `Internals.runWorkflow` now requires `id` and
16
+ `createdAt`, `HistoryItem` requires `createdAt`, and async items accept
17
+ `settledAt`.
18
+ - Testing: `runWorkflow` accepts and returns `seed`/`createdAt`; `TestClock`
19
+ feeds the host clock instead of patching `Date` itself.
20
+
21
+ ## 0.9.1
22
+
23
+ ### Patch Changes
24
+
25
+ - [#135](https://github.com/tech4humans-brasil/framework/pull/135) [`c238dbe`](https://github.com/tech4humans-brasil/framework/commit/c238dbea4199169c935c714442d9e316abd74e20) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Fix start workflow activity
26
+
27
+ ## 0.9.0
28
+
29
+ ### Minor Changes
30
+
31
+ - Adds support to undefined or null output in workflow ref ([#106](https://github.com/tech4humans-brasil/framework/pull/106))
32
+ - Adds startMany on WorkflowClaim ([#108](https://github.com/tech4humans-brasil/framework/pull/108))
33
+
34
+ ### Patch Changes
35
+
36
+ - Support optional input when schema is not provided in workflow ([#104](https://github.com/tech4humans-brasil/framework/pull/104))
37
+ - Forward parallel flag through startWorkflow to the reconciler ([#105](https://github.com/tech4humans-brasil/framework/pull/105))
38
+ - Structured clone in testing suite ([#107](https://github.com/tech4humans-brasil/framework/pull/107))
39
+
40
+ ## 0.8.0
41
+
42
+ ### Patch Changes
43
+
44
+ - Testing utils ([`7856707`](https://github.com/tech4humans-brasil/framework/commit/78567072109b876391d9a74146ea16ef4acbddea))
45
+ - Update ai skills ([`1029361`](https://github.com/tech4humans-brasil/framework/commit/1029361788725eedaabe23e2131007d82da93380))
46
+ - Update skills ([`6d7e7bc`](https://github.com/tech4humans-brasil/framework/commit/6d7e7bca0c780a9c53a0c9e5aa0a865c5af67959))
47
+
48
+ ## 0.7.0
49
+
50
+ ### Minor Changes
51
+
52
+ - Add stable uuidv7 identifiers to activities and history items ([`e3451c8`](https://github.com/tech4humans-brasil/framework/commit/e3451c8ea3572457a8a6568e7fbe0291cc8e9a1f))
53
+
54
+ ## 0.6.1
55
+
56
+ ### Patch Changes
57
+
58
+ - Use history is replaying to supress logs during replay ([`9635e9f`](https://github.com/tech4humans-brasil/framework/commit/9635e9f79d51ec67b119cf1812c06d852f50a344))
59
+ - Propagate timeout at on push wait async activity ([`c5b3f17`](https://github.com/tech4humans-brasil/framework/commit/c5b3f17f778c5b6cc9eb7d4f4c06d69fe4a19c4e))
60
+
61
+ ## 0.6.0
62
+
63
+ ### Patch Changes
64
+
65
+ - Internal dependency updates
66
+
67
+ ## 0.5.0
68
+
69
+ ### Patch Changes
70
+
71
+ - Internal dependency updates
72
+
73
+ ## 0.3.0
74
+
75
+ ### Minor Changes
76
+
77
+ - Adds support to return promise in activity input and output ([`42af924`](https://github.com/tech4humans-brasil/framework/commit/42af92450888949badad4717897c6384e3480ad7))
78
+ - Build app manifest in core package ([`58c8a63`](https://github.com/tech4humans-brasil/framework/commit/58c8a63fd0475c09d67f3283bb18719b89497f13))
79
+ - Adds support to serializable class ([`ed0ddbb`](https://github.com/tech4humans-brasil/framework/commit/ed0ddbb7c07e2d1d8810e3079c9aa6dd10f4479f))
80
+ - Adds start workflow activity ([`e82952c`](https://github.com/tech4humans-brasil/framework/commit/e82952c963759ccc716237bae2f350b823d1eba0))
81
+ - Adds claim exceptions ([`0c1b6fa`](https://github.com/tech4humans-brasil/framework/commit/0c1b6fac5ecdea8a08f5922911bdd24a1223d657))
82
+ - Adds env design ([`37b89bb`](https://github.com/tech4humans-brasil/framework/commit/37b89bb477a85aa8b7a5b55653d5e67020348f63))
83
+ - Adds env in app manifest ([`9647c10`](https://github.com/tech4humans-brasil/framework/commit/9647c1043d1fd6f0d580130b537d39bde9a5981c))
84
+ - Adds async support for serialization ([#10](https://github.com/tech4humans-brasil/framework/pull/10))
85
+ - Introduce async activity advance and bootstrap ([#19](https://github.com/tech4humans-brasil/framework/pull/19))
86
+ - Adds identifier requireds claims ([#20](https://github.com/tech4humans-brasil/framework/pull/20))
87
+ - Adds support for awaitable async activity ([#32](https://github.com/tech4humans-brasil/framework/pull/32))
88
+ - Adds type to history item ([#47](https://github.com/tech4humans-brasil/framework/pull/47))
89
+ - Adds support to authorization ([#51](https://github.com/tech4humans-brasil/framework/pull/51))
90
+ - Adds on timeout in async activity ([#48](https://github.com/tech4humans-brasil/framework/pull/48))
91
+ - Implements start workflow activity ([#64](https://github.com/tech4humans-brasil/framework/pull/64))
92
+ - Implements logger ([#82](https://github.com/tech4humans-brasil/framework/pull/82))
93
+ - Adds testing utilities ([#84](https://github.com/tech4humans-brasil/framework/pull/84))
94
+ - Adds .ai/skills in packages ([#88](https://github.com/tech4humans-brasil/framework/pull/88))
95
+ - Adds skills to create and test workflow ([#90](https://github.com/tech4humans-brasil/framework/pull/90))
96
+
97
+ ### Patch Changes
98
+
99
+ - Adds vitest ([`1fd42f1`](https://github.com/tech4humans-brasil/framework/commit/1fd42f19ebf103ee474503251ec3ebce60d6f1cf))
100
+ - Core package ([`63d23a5`](https://github.com/tech4humans-brasil/framework/commit/63d23a531da5ebe241751c2e52bb1115a89a3737))
101
+ - Remove activity claim context dependency ([`c7c1ac1`](https://github.com/tech4humans-brasil/framework/commit/c7c1ac1fbe4d3eb0d87a7909408c75ebd26b139f))
102
+ - Fix manifest test with env schema ([`a876b6a`](https://github.com/tech4humans-brasil/framework/commit/a876b6a379db1837b511a08353f73f1d1b8dfc3c))
103
+ - Dont user Object.entries for Map instance ([`da47e8c`](https://github.com/tech4humans-brasil/framework/commit/da47e8cecd5b5b90e9620ed982471dff394e6338))
104
+ - Rename activity claim to claim ([`281d700`](https://github.com/tech4humans-brasil/framework/commit/281d7008bd5539ab0b701e755f053d031b332aa8))
105
+ - Rename activity history to history ([`4eaad08`](https://github.com/tech4humans-brasil/framework/commit/4eaad08468815bcdea14c36468c7904655715406))
106
+ - Move run activity and workflow to internal tool ([`e061349`](https://github.com/tech4humans-brasil/framework/commit/e061349de925074f838e82149f7566ddcffc4870))
107
+ - Fix all tests ([`0270832`](https://github.com/tech4humans-brasil/framework/commit/02708320bd39ffef87f6b46c2e57a1ccccb4ceb0))
108
+ - Adds github workflow to run, build, tests and lint ([#18](https://github.com/tech4humans-brasil/framework/pull/18))
109
+ - Adds readme ([`e346f39`](https://github.com/tech4humans-brasil/framework/commit/e346f398ad2a7bdd319b7176e251d3538e72cb2d))
110
+ - Use correct activity output generic argument ([`fbd6e11`](https://github.com/tech4humans-brasil/framework/commit/fbd6e115b72a25125eb0a6f263006a3163fb0f51))
111
+ - Update package metadata and author information across multiple packages ([`2ca73df`](https://github.com/tech4humans-brasil/framework/commit/2ca73df42dc63c86ed44717b50d5402fca45b4e7))
112
+ - Improve repository info ([`1fad92d`](https://github.com/tech4humans-brasil/framework/commit/1fad92d959b804189fd1486d047115995ac81eb0))
113
+ - Check types ([`a975a38`](https://github.com/tech4humans-brasil/framework/commit/a975a38a09b81c35205e55170efbed12b54f683a))
114
+ - Up repo coverage ([`24c057c`](https://github.com/tech4humans-brasil/framework/commit/24c057c470d0829ea9a1e1f71011b6eff408180c))
115
+ - Fix check types and lint errors ([`00ca0df`](https://github.com/tech4humans-brasil/framework/commit/00ca0dfe6c2fddbc4e0dbeefb1556d172c752c55))
116
+ - Update package dependencies across multiple packages ([`8b4fc1d`](https://github.com/tech4humans-brasil/framework/commit/8b4fc1d0e92d6bd880ddf4c8119fb68c49c53760))
117
+ - Rename output async activity pending to payload ([#46](https://github.com/tech4humans-brasil/framework/pull/46))
package/README.md CHANGED
@@ -38,7 +38,7 @@ const myWorkflow = new Workflow(async () => {
38
38
 
39
39
  ```javascript
40
40
  const myWorkflow = new Workflow(
41
- { id: 'cashback/v1', description: 'Process cashback' },
41
+ { id: 'cashback', description: 'Process cashback' },
42
42
  async input => {
43
43
  return { value: input.amount * 0.05 }
44
44
  },
@@ -52,7 +52,7 @@ The `schema` field accepts any valid JSON Schema.
52
52
  ```javascript
53
53
  const myWorkflow = new Workflow(
54
54
  {
55
- id: 'cashback/v1',
55
+ id: 'cashback',
56
56
  schema: {
57
57
  type: 'object',
58
58
  properties: {
@@ -79,7 +79,7 @@ const schema = Type.Object({
79
79
  amount: Type.Number(),
80
80
  })
81
81
 
82
- const myWorkflow = new Workflow({ id: 'cashback/v1', schema }, async input => {
82
+ const myWorkflow = new Workflow({ id: 'cashback', schema }, async input => {
83
83
  return { value: input.amount * 0.05 }
84
84
  })
85
85
  ```
@@ -89,7 +89,7 @@ const myWorkflow = new Workflow({ id: 'cashback/v1', schema }, async input => {
89
89
  ```javascript
90
90
  import { Workflow, env } from '@t4h.framework/core'
91
91
 
92
- const myWorkflow = new Workflow({ id: 'notify/v1' }, async () => {
92
+ const myWorkflow = new Workflow({ id: 'notify' }, async () => {
93
93
  console.log(env.API_URL)
94
94
  console.log(env.API_SECRET)
95
95
  })
@@ -103,11 +103,8 @@ import { App, Workflow } from '@t4h.framework/core'
103
103
  const app = new App({
104
104
  id: 'my-automation',
105
105
  description: 'Cashback automation',
106
- workflows: [myWorkflow],
106
+ workflows: [myWorkflow, anotherWorkflow],
107
107
  })
108
-
109
- // or add later
110
- app.addWorkflow(anotherWorkflow)
111
108
  ```
112
109
 
113
110
  ---
@@ -305,6 +302,8 @@ The runtime is responsible for executing workflows and activities by providing t
305
302
  import { Internals } from '@t4h.framework/core'
306
303
 
307
304
  Internals.runWorkflow(myWorkflow, {
305
+ id: run.id, // seeds Math.random / randomUUID inside the workflow
306
+ createdAt: run.createdAt.getTime(), // where the workflow clock starts
308
307
  input: { userId: '123', amount: 100 },
309
308
  env: { API_URL: 'https://api.example.com' },
310
309
  claims: [
@@ -347,6 +346,8 @@ Env.run → Claim.run → fn(activity)
347
346
 
348
347
  **History** handles reconciliation: when an activity has been executed before, the previous result is returned directly (deterministic replay). When there is no history, the activity runs and the result is stored.
349
348
 
349
+ **History** also owns the workflow clock. Each `HistoryItem` carries `createdAt` (when the activity was requested) and async items `settledAt` (when they settled); `Date.now()` inside the workflow reads the last of those the replay walked past, starting from the run's `createdAt`. `History.run` also patches `Date`, `Math.random` and `randomUUID` for workflow code and forbids `setTimeout` / `setInterval` there (`TimerNotAllowedException`). Hosts must stamp those fields when building the history.
350
+
350
351
  ---
351
352
 
352
353
  ## Testing
@@ -481,6 +482,10 @@ await TestClock.run({ now: 0 }, async () => {
481
482
  })
482
483
  ```
483
484
 
485
+ `TestClock` acts as the host clock: activities are stamped with it and the
486
+ workflow reads those stamps back through `Date.now()`, exactly as in
487
+ production.
488
+
484
489
  ### Activity-level tests
485
490
 
486
491
  The real `advance` logic is intentionally **not** exercised by `execute()`.
@@ -16,11 +16,11 @@ export declare const workflowBatchSchema: Type.TObject<{
16
16
  }>;
17
17
  type StartManyWorkflowsResult = Type.Static<typeof workflowBatchSchema>;
18
18
  export declare abstract class WorkflowClaim {
19
- abstract start<TWorkflow extends Workflow<any, any>>(workflow: TWorkflow, parallel?: boolean): Serializable | Promise<Serializable>;
20
- abstract start<TWorkflow extends Workflow<any, any>>(workflow: TWorkflow, input: WorkflowInput<TWorkflow>, parallel?: boolean): Serializable | Promise<Serializable>;
19
+ abstract start<TWorkflow extends Workflow<any, any>>(workflow: TWorkflow | string, input?: WorkflowInput<TWorkflow>, parallel?: boolean): Serializable | Promise<Serializable>;
21
20
  abstract startMany<TWorkflow extends Workflow<any, any>>(workflow: TWorkflow | string, inputs: WorkflowInput<TWorkflow>[] | Binary[], parallel?: boolean): Promise<WorkflowBatchRef>;
22
21
  }
23
22
  type StartWorkflowActivityInput = {
23
+ workflow: string;
24
24
  input?: Serializable;
25
25
  parallel?: boolean;
26
26
  };
@@ -38,15 +38,14 @@ export declare class StartWorkflowActivity extends AsyncActivity<[
38
38
  output: Type.TAny;
39
39
  }>> | import("../core.js").AsyncActivityResultFulfilled<Serializable>>;
40
40
  advance(payload: Type.Static<typeof schema>): import("../core.js").AsyncActivityResultRejected<void | Serializable> | import("../core.js").AsyncActivityResultFulfilled<Serializable>;
41
- toInput(workflow: Workflow<any, any>, inputOrParallel?: Serializable | boolean, maybeParallel?: boolean): Promise<StartWorkflowActivityInput>;
41
+ toInput(workflow: Workflow<any, any>, inputOrParallel?: Serializable | boolean, maybeParallel?: boolean): StartWorkflowActivityInput;
42
42
  toOutput(payload: Type.Static<typeof schema>): WorkflowRef;
43
43
  }
44
44
  export declare function startWorkflow<TWorkflow extends Workflow<any, any>>(workflow: TWorkflow, ...args: StartWorkflowArgs<TWorkflow>): Promise<import("../core.js").AsyncActivityAwaitable<StartWorkflowActivity>>;
45
45
  type StartManyWorkflowsActivityInput = {
46
+ workflow: string;
46
47
  inputs: Serializable[];
47
48
  parallel?: boolean;
48
- batch: string;
49
- count: number;
50
49
  };
51
50
  type StartWorkflowManyArgs<TWorkflow extends Workflow<any, any>> = [
52
51
  inputs: WorkflowInput<TWorkflow>[],
@@ -71,7 +70,7 @@ export declare class StartManyWorkflowsActivity extends AsyncActivity<[
71
70
  batch: string;
72
71
  count: number;
73
72
  } | undefined>;
74
- toInput(workflow: Workflow<any, any>, inputs: Serializable[], parallel?: boolean): Promise<StartManyWorkflowsActivityInput>;
73
+ toInput(workflow: Workflow<any, any>, inputs: Serializable[], parallel?: boolean): StartManyWorkflowsActivityInput;
75
74
  toOutput(payload: StartManyWorkflowsResult): WorkflowBatchRef;
76
75
  }
77
76
  export declare function startWorkflowMany<TWorkflow extends Workflow<any, any>>(workflow: TWorkflow, ...args: StartWorkflowManyArgs<TWorkflow>): Promise<import("../core.js").AsyncActivityAwaitable<StartManyWorkflowsActivity>>;
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AAG,CAAC,IAAI;IACjE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE;IAClC,QAAQ,CAAC,EAAE,OAAO;CACnB,CAAA;AAED,qBAAa,0BAA2B,SAAQ,aAAa,CAC3D;IAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO;CAAC,EAC1E,+BAA+B,EAC/B,wBAAwB,EACxB,gBAAgB,EAChB,+BAA+B,EAC/B,OAAO,mBAAmB,CAC3B;IACC,SAAgB,MAAM;;OAEpB;IAEW,SAAS,CAAC,KAAK,EAAE,+BAA+B;;;;;;;IAetD,OAAO,CAAC,OAAO,EAAE,wBAAwB;;;;IAIzC,OAAO,CACZ,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAC5B,MAAM,EAAE,YAAY,EAAE,EACtB,QAAQ,CAAC,EAAE,OAAO,GACjB,+BAA+B;IAO3B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB;CAGrE;AAED,wBAAgB,iBAAiB,CAAC,SAAS,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EACpE,QAAQ,EAAE,SAAS,EACnB,GAAG,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,oFAO1C"}
@@ -19,6 +19,7 @@ export class StartWorkflowActivity extends AsyncActivity {
19
19
  workflow: WorkflowClaim,
20
20
  });
21
21
  async bootstrap(input) {
22
+ await this.claims.workflow.start(input.workflow, input.input, input.parallel);
22
23
  if (input.parallel)
23
24
  return this.done({ status: 'fulfilled', output: null });
24
25
  return this.pending({
@@ -30,7 +31,9 @@ export class StartWorkflowActivity extends AsyncActivity {
30
31
  return this.done(payload);
31
32
  return this.rejected(payload);
32
33
  }
33
- async toInput(workflow, inputOrParallel, maybeParallel) {
34
+ toInput(workflow, inputOrParallel, maybeParallel) {
35
+ if (!workflow.id)
36
+ throw new TypeError('Could not start workflow without an id');
34
37
  const hasSchema = workflow.schema !== null;
35
38
  const input = hasSchema
36
39
  ? inputOrParallel
@@ -38,11 +41,7 @@ export class StartWorkflowActivity extends AsyncActivity {
38
41
  const parallel = hasSchema
39
42
  ? maybeParallel
40
43
  : inputOrParallel;
41
- if (hasSchema)
42
- await this.claims.workflow.start(workflow, input, parallel);
43
- else
44
- await this.claims.workflow.start(workflow, parallel);
45
- return { input, parallel };
44
+ return { workflow: workflow.id, input, parallel };
46
45
  }
47
46
  toOutput(payload) {
48
47
  return new WorkflowRef(payload.status, payload.output);
@@ -56,8 +55,9 @@ export class StartManyWorkflowsActivity extends AsyncActivity {
56
55
  workflow: WorkflowClaim,
57
56
  });
58
57
  async bootstrap(input) {
59
- if (input.count <= 0 || input.parallel)
60
- return this.done({ batch: input.batch, count: input.count });
58
+ const batch = await this.claims.workflow.startMany(input.workflow, input.inputs, input.parallel);
59
+ if (batch.count <= 0 || input.parallel)
60
+ return this.done({ batch: batch.id, count: batch.count });
61
61
  return this.pending({
62
62
  schema: workflowBatchSchema,
63
63
  });
@@ -65,9 +65,10 @@ export class StartManyWorkflowsActivity extends AsyncActivity {
65
65
  advance(payload) {
66
66
  return this.done(payload);
67
67
  }
68
- async toInput(workflow, inputs, parallel) {
69
- const batch = await this.claims.workflow.startMany(workflow, inputs, parallel);
70
- return { inputs, parallel, batch: batch.id, count: batch.count };
68
+ toInput(workflow, inputs, parallel) {
69
+ if (!workflow.id)
70
+ throw new TypeError('Could not start workflow without an id');
71
+ return { workflow: workflow.id, inputs, parallel };
71
72
  }
72
73
  toOutput(payload) {
73
74
  return new WorkflowBatchRef(payload.batch, payload.count);
@@ -1 +1 @@
1
- {"version":3,"file":"StartWorkflowActivity.js","sourceRoot":"","sources":["../../src/activities/StartWorkflowActivity.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAA;AAG1B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,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B,IAAI,CAAC,QAAQ,CAAC,EAAE;YACd,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAA;QAE/D,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;IACpD,CAAC;IAEM,QAAQ,CAAC,OAAiC;QAC/C,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3D,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAC/B,QAAmB,EACnB,GAAG,IAAsC;IAEzC,OAAO,OAAO,CAAC,UAAU,CACvB,0BAA0B,EAC1B,QAAQ,EACR,GAAI,IAAqD,CAC1D,CAAA;AACH,CAAC"}
package/dist/core.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './activities/StartWorkflowActivity.js';
2
2
  export * from './exceptions/ActivityException.js';
3
3
  export * from './exceptions/ClaimException.js';
4
+ export * from './exceptions/TimerNotAllowedException.js';
4
5
  export * from './models/Activity.js';
5
6
  export * from './models/Authorization.js';
6
7
  export * from './models/App.js';
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AAErD,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAE9C,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,wCAAwC,CAAA;AACtD,cAAc,oCAAoC,CAAA;AAClD,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AAEvC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AAErD,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AAExD,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,wCAAwC,CAAA;AACtD,cAAc,oCAAoC,CAAA;AAClD,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AAEvC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA"}
package/dist/core.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './activities/StartWorkflowActivity.js';
2
2
  export * from './exceptions/ActivityException.js';
3
3
  export * from './exceptions/ClaimException.js';
4
+ export * from './exceptions/TimerNotAllowedException.js';
4
5
  export * from './models/Activity.js';
5
6
  export * from './models/Authorization.js';
6
7
  export * from './models/App.js';
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AAErD,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAE9C,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,wCAAwC,CAAA;AACtD,cAAc,oCAAoC,CAAA;AAClD,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AAEvC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AAErD,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AAExD,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,wCAAwC,CAAA;AACtD,cAAc,oCAAoC,CAAA;AAClD,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AAEvC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare class TimerNotAllowedException extends Error {
2
+ readonly timer: string;
3
+ constructor(timer: string);
4
+ }
5
+ //# sourceMappingURL=TimerNotAllowedException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimerNotAllowedException.d.ts","sourceRoot":"","sources":["../../src/exceptions/TimerNotAllowedException.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAyB,SAAQ,KAAK;aACd,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAKjD"}
@@ -0,0 +1,9 @@
1
+ export class TimerNotAllowedException extends Error {
2
+ timer;
3
+ constructor(timer) {
4
+ super(`${timer}() cannot be used inside a workflow.`);
5
+ this.timer = timer;
6
+ this.name = 'TimerNotAllowedException';
7
+ }
8
+ }
9
+ //# sourceMappingURL=TimerNotAllowedException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimerNotAllowedException.js","sourceRoot":"","sources":["../../src/exceptions/TimerNotAllowedException.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACd;IAAnC,YAAmC,KAAa;QAC9C,KAAK,CAAC,GAAG,KAAK,sCAAsC,CAAC,CAAA;QADpB,UAAK,GAAL,KAAK,CAAQ;QAG9C,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
1
  import { type Activity } from './Activity.js';
2
2
  import type { AnyAsyncActivity } from './AsyncActivity.js';
3
- import type { IHistoryItemAsync } from './History.js';
3
+ import { type IHistoryItemAsync } from './History.js';
4
4
  export declare class AsyncActivityAwaitable<T extends AnyAsyncActivity> {
5
5
  private readonly activity;
6
6
  private readonly item;
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncActivityAwaitable.d.ts","sourceRoot":"","sources":["../../src/models/AsyncActivityAwaitable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,qBAAa,sBAAsB,CAAC,CAAC,SAAS,gBAAgB;IAE1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,SAAS,GAAG,EAAE;IAG1B,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAMjD"}
1
+ {"version":3,"file":"AsyncActivityAwaitable.d.ts","sourceRoot":"","sources":["../../src/models/AsyncActivityAwaitable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAG9D,qBAAa,sBAAsB,CAAC,CAAC,SAAS,gBAAgB;IAE1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,SAAS,GAAG,EAAE;IAG1B,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAQjD"}
@@ -1,4 +1,5 @@
1
1
  import {} from './Activity.js';
2
+ import { History } from './History.js';
2
3
  import { PushWaitAsyncActivity } from './PushWaitAsyncActivity.js';
3
4
  export class AsyncActivityAwaitable {
4
5
  activity;
@@ -12,6 +13,7 @@ export class AsyncActivityAwaitable {
12
13
  async wait() {
13
14
  if (this.item.status === 'pending')
14
15
  throw new PushWaitAsyncActivity(this.activity, this.item.timeoutAt);
16
+ History.advanceClock(this.item.settledAt);
15
17
  return this.activity.toOutput(this.item.output, ...this.args);
16
18
  }
17
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncActivityAwaitable.js","sourceRoot":"","sources":["../../src/models/AsyncActivityAwaitable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,eAAe,CAAA;AAG7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,OAAO,sBAAsB;IAEd;IACA;IACA;IAHnB,YACmB,QAAW,EACX,IAAuB,EACvB,IAAoB;QAFpB,aAAQ,GAAR,QAAQ,CAAG;QACX,SAAI,GAAJ,IAAI,CAAmB;QACvB,SAAI,GAAJ,IAAI,CAAgB;IACpC,CAAC;IAEG,KAAK,CAAC,IAAI;QACf,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS;YAChC,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAErE,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,C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