@walkeros/cli 4.0.0-next-1777882869103 → 4.0.1-next-1778068549946

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,56 @@
1
1
  # @walkeros/cli
2
2
 
3
- ## 4.0.0-next-1777882869103
3
+ ## 4.0.1-next-1778068549946
4
+
5
+ ### Patch Changes
6
+
7
+ - e4b6cf4: Fix `walkeros bundle` failing on Windows when stage 2 import paths
8
+ contained backslashes that JS parsed as escape sequences.
9
+ - 381dfe7: Add an optional `setup` lifecycle to destinations, sources, and
10
+ stores.
11
+
12
+ Each package may now implement `setup?: SetupFn` to provision external
13
+ resources (BigQuery datasets and tables, Pub/Sub topics and subscriptions,
14
+ SQLite tables, webhook registrations, etc.). Setup is triggered only by the
15
+ new `walkeros setup <kind>.<name>` CLI command, never automatically by the
16
+ runtime, push, or deploy. Idempotency, ordering, and error semantics are the
17
+ package's responsibility; the framework provides the type slot, the CLI
18
+ invocation, and a `resolveSetup(value, defaults)` helper.
19
+
20
+ `LifecycleContext<C, E>` is the new shared context type used by both `setup`
21
+ and `destroy`. `DestroyContext` remains as a deprecated type alias for one
22
+ minor cycle. The `Types` bundle on `Destination`, `Source`, and `Store` gains
23
+ a 5th/6th/4th positional slot for setup options; existing aliases compile
24
+ unchanged because the slot defaults to `unknown`.
25
+ `Config<T>.setup?: boolean | SetupOptions<T>` is added across all three kinds
26
+ and validated by the corresponding Zod `ConfigSchema` plus the flow component
27
+ schemas in `@walkeros/core/schemas/flow.ts`.
28
+
29
+ CLI:
30
+ - `walkeros setup <kind>.<name>` runs a single component's `setup()` function.
31
+ - `<kind>` is `source`, `destination`, or `store` (transformers have no
32
+ provisioning).
33
+ - `--config <path>` (default `./flow.json`), `--flow <name>` for multi-flow
34
+ configs, plus standard `--json` / `--verbose` / `--silent`.
35
+ - Exit 0 on success or skip; non-zero on failure. Skip narration covers three
36
+ cases: no `setup()` on the package, `config.setup === false`, or
37
+ `config.setup` unset.
38
+ - When the package's `setup()` returns a non-undefined value, the CLI emits it
39
+ as JSON on stdout for `jq` piping.
40
+
41
+ - 03d7055: Merge `definitions` into `variables`. Single concept, single syntax
42
+ `$var.name(.deep.path)?`. Whole-string references preserve native type; inline
43
+ interpolation requires scalars. Deep paths and recursive resolution with cycle
44
+ detection now supported. `Flow.Definitions`, `Flow.Primitive`, and the `$def.`
45
+ reference syntax are removed.
46
+ - Updated dependencies [381dfe7]
47
+ - Updated dependencies [03d7055]
48
+ - @walkeros/core@4.0.1-next-1778068549946
49
+ - @walkeros/collector@4.0.1-next-1778068549946
50
+ - @walkeros/server-core@4.0.1-next-1778068549946
51
+ - @walkeros/server-destination-api@4.0.1-next-1778068549946
52
+
53
+ ## 4.0.0
4
54
 
5
55
  ### Major Changes
6
56
 
@@ -232,6 +282,31 @@
232
282
 
233
283
  ### Patch Changes
234
284
 
285
+ - ca237ef: Fix `walkeros push` deadlock for web flows whose destinations await
286
+ real timers during init.
287
+
288
+ Previously, async-drain timer interception captured every `setTimeout` into a
289
+ pending map and only fired them via a post-`fn` flush. If a destination's init
290
+ awaited one of those captured timers (e.g.,
291
+ `@walkeros/web-destination-amplitude`'s engagement plugin awaits a 10s
292
+ setTimeout to give up on a CDN script load), `init` never resolved,
293
+ `await collector.push` deadlocked, and Node exited with
294
+ `Detected unsettled top-level await` (exit 13).
295
+
296
+ A drain pump now runs alongside `fn(flowModule)` for non-`--simulate` runs:
297
+ each tick fires every captured non-cleared timer using a real `setImmediate`
298
+ reference. Timers fire in delay-ascending order, intervals re-register,
299
+ callback errors are reported via `console.warn`. Bounded by max-iterations
300
+ (1000) and wall-clock (30s) caps.
301
+
302
+ `--simulate <step>` continues to use the post-`fn` flush path so snapshot
303
+ ordering remains stable.
304
+
305
+ Behavior change (edge case): a destination using `setTimeout` for retry
306
+ backoff under `walkeros push` (real, non-simulate) now sees its timer fire
307
+ instantly. This was already the documented contract for `--simulate <step>`
308
+ snapshots; it now extends to real `push` for consistency.
309
+
235
310
  - 6422b9b: Validate device-code and token responses from the auth server with
236
311
  Zod schemas at the trust boundary in `login/index.ts`. Malformed responses now
237
312
  surface as structured errors instead of being trusted into config writes or
@@ -271,10 +346,10 @@
271
346
  - Updated dependencies [8e06b1f]
272
347
  - Updated dependencies [3d50dd6]
273
348
  - Updated dependencies [1ef33d9]
274
- - @walkeros/core@4.0.0-next-1777882869103
275
- - @walkeros/collector@4.0.0-next-1777882869103
276
- - @walkeros/server-destination-api@4.0.0-next-1777882869103
277
- - @walkeros/server-core@4.0.0-next-1777882869103
349
+ - @walkeros/core@4.0.0
350
+ - @walkeros/collector@4.0.0
351
+ - @walkeros/server-destination-api@4.0.0
352
+ - @walkeros/server-core@4.0.0
278
353
 
279
354
  ## 3.4.2
280
355
 
package/README.md CHANGED
@@ -170,15 +170,77 @@ walkeros push dist/bundle.js --platform server --event '{"name":"order complete"
170
170
 
171
171
  **Push modes:**
172
172
 
173
- | Mode | Flag | API Calls | Use Case |
174
- | ---- | ---- | --------- | -------- |
175
- | Real | (none) | Real HTTP requests | Integration testing |
176
- | Simulate | `--simulate` | Mocked (captured) | Safe local testing |
177
- | Mock | `--mock` | Returns mock value | Controlled testing |
173
+ | Mode | Flag | API Calls | Use Case |
174
+ | -------- | ------------ | ------------------ | ------------------- |
175
+ | Real | (none) | Real HTTP requests | Integration testing |
176
+ | Simulate | `--simulate` | Mocked (captured) | Safe local testing |
177
+ | Mock | `--mock` | Returns mock value | Controlled testing |
178
178
 
179
179
  Use `--simulate` first to validate safely, then push without flags for real
180
180
  integrations.
181
181
 
182
+ ### setup
183
+
184
+ Run the optional `setup()` lifecycle on a single component to provision external
185
+ resources (BigQuery datasets, Pub/Sub topics, SQLite tables, webhook
186
+ registrations).
187
+
188
+ ```bash
189
+ walkeros setup <target> [options]
190
+ ```
191
+
192
+ **Target format:** `<kind>.<name>` matching `walkeros push --simulate`. Valid
193
+ kinds: `source`, `destination`, `store`. Transformers are pure functions and
194
+ have no setup.
195
+
196
+ **Options:**
197
+
198
+ - `-c, --config <path>` - Flow config file (default: `./flow.json`)
199
+ - `-f, --flow <name>` - Flow name for multi-flow configs
200
+ - `--json` - Output as JSON
201
+ - `-v, --verbose` - Verbose output
202
+ - `-s, --silent` - Suppress output
203
+
204
+ **Behavior:**
205
+
206
+ - Loads the flow config, resolves the named component, imports its package, and
207
+ calls `setup({ id, config, env, logger })`. No collector boot, no event
208
+ pipeline, no destinations are pushed to.
209
+ - Skips with an explanatory message in three cases: the package has no `setup`
210
+ function, `config.setup === false`, or `config.setup` is unset.
211
+ - When `setup()` returns a non-undefined value, the CLI emits it as JSON on
212
+ stdout for `jq`-style scripting.
213
+ - Exit code `0` on success or skip, non-zero on failure.
214
+
215
+ **Operator-time, never automatic.** Setup is explicit only. It is never
216
+ triggered by `push`, `simulate`, `deploy`, or the long-running runtime.
217
+ Operators run it once when provisioning, and again only when external resources
218
+ need to be re-provisioned.
219
+
220
+ **IAM note:** Setup typically needs higher permissions than runtime push (for
221
+ example, "create dataset" vs "write rows"). Operators commonly run setup with a
222
+ separate service account or different credentials than the runtime uses.
223
+
224
+ **Examples:**
225
+
226
+ ```bash
227
+ # Provision the BigQuery dataset and table for the destination named "bigquery"
228
+ # in the default flow file.
229
+ walkeros setup destination.bigquery
230
+
231
+ # Same but pointing to a specific flow in a multi-flow config.
232
+ walkeros setup destination.bigquery --flow analytics
233
+
234
+ # Custom config path.
235
+ walkeros setup destination.bigquery --config ./flows/prod.json
236
+
237
+ # Pipe the structured result to jq.
238
+ walkeros setup destination.bigquery --json | jq .datasetCreated
239
+
240
+ # Provision a Pub/Sub source's subscription.
241
+ walkeros setup source.events-in
242
+ ```
243
+
182
244
  ### run
183
245
 
184
246
  Run flows locally (no Docker daemon required).
@@ -509,10 +571,7 @@ const result = await push(
509
571
  // result.usage = API call tracking data
510
572
 
511
573
  // Push for real
512
- await push(
513
- './flow.json',
514
- { name: 'page view', data: { title: 'Test' } },
515
- );
574
+ await push('./flow.json', { name: 'page view', data: { title: 'Test' } });
516
575
 
517
576
  // Run
518
577
  await runCommand({