@walkeros/cli 4.0.0 → 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,5 +1,55 @@
1
1
  # @walkeros/cli
2
2
 
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
+
3
53
  ## 4.0.0
4
54
 
5
55
  ### Major Changes
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({