@walkeros/cli 4.0.0 → 4.1.0-next-1778155282668
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 +103 -0
- package/README.md +119 -36
- package/dist/cli.js +1777 -1287
- package/dist/examples/README.md +3 -3
- package/dist/examples/flow-complete.json +4 -6
- package/dist/examples/flow-complete.md +8 -10
- package/dist/examples/index.js +4 -6
- package/dist/examples/index.js.map +1 -1
- package/dist/index.d.ts +14 -23
- package/dist/index.js +599 -262
- package/dist/index.js.map +1 -1
- package/examples/README.md +3 -3
- package/examples/flow-complete.json +4 -6
- package/examples/flow-complete.md +8 -10
- package/package.json +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @walkeros/cli
|
|
2
2
|
|
|
3
|
+
## 4.1.0-next-1778155282668
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- abfb0bb: @walkeros/cli: Server bundles now use @vercel/nft to trace
|
|
8
|
+
dependencies and copy only files actually used into dist/node_modules/. Pacote
|
|
9
|
+
remains the install layer (driven by flow.json's config.bundle.packages field;
|
|
10
|
+
users do not run npm install for step packages). The walkerOS.bundle.external
|
|
11
|
+
annotation field on package manifests is no longer recognized (deprecation
|
|
12
|
+
warning if seen). The flow.<name>.config.bundle.external sub-field on flow
|
|
13
|
+
configs is also no longer supported (warned and stripped during load). The
|
|
14
|
+
flow.<name>.config.bundle.traceInclude field is the escape hatch for cases nft
|
|
15
|
+
cannot statically trace. Server output is always a directory: dist/{flow.mjs,
|
|
16
|
+
package.json, node_modules/}. Default output filename changed from bundle.mjs
|
|
17
|
+
to flow.mjs. The runtime image expects /app/flow/flow.mjs. flow.json schema is
|
|
18
|
+
unchanged (still v4); only @walkeros/cli bumps. Migration: see
|
|
19
|
+
https://walkeros.io/docs/migrate/cli-4x.
|
|
20
|
+
|
|
21
|
+
@walkeros/server-destination-gcp: removed obsolete walkerOS.bundle.external
|
|
22
|
+
annotation from package manifest. nft handles externalization automatically.
|
|
23
|
+
No behavior change for consumers.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- ed304b4: Bundler honors `walkerOS.bundle.external` declared in step-package
|
|
28
|
+
package.json files. Listed packages are externalized from the ESM bundle and
|
|
29
|
+
the bundler always installs them (plus their full transitive deps) into
|
|
30
|
+
`<outputDir>/node_modules/` via pacote — no `npm install` shell-out, no manual
|
|
31
|
+
deploy step. When externals is empty, output remains a single `bundle.mjs`
|
|
32
|
+
(backward compatible). When non-empty, output is a self-contained directory:
|
|
33
|
+
`bundle.mjs`, `package.json`, `package-lock.json`, `node_modules/`.
|
|
34
|
+
|
|
35
|
+
The bundler reads npm config (registry, scope tokens) from `.npmrc`,
|
|
36
|
+
parallelizes manifest fetches with retry, atomically stages each package
|
|
37
|
+
extraction (no half-populated `node_modules/` on failure), and reuses the
|
|
38
|
+
closure resolution from the existing `collectAllSpecs` BFS so peerDependencies
|
|
39
|
+
are honored.
|
|
40
|
+
|
|
41
|
+
Hard-errors when:
|
|
42
|
+
- A package in the install closure declares a `pre/install/postinstall` script
|
|
43
|
+
(pacote.extract does not run them).
|
|
44
|
+
- A step package names an external in `walkerOS.bundle.external` but does not
|
|
45
|
+
list it in `dependencies` or `peerDependencies`.
|
|
46
|
+
- Two step packages declare the same external and the resolved version does
|
|
47
|
+
not satisfy all consumers' constraints.
|
|
48
|
+
|
|
49
|
+
Warns (not errors) when:
|
|
50
|
+
- Bundle output contains unresolved `__dirname` / `__filename` references
|
|
51
|
+
(with package attribution by hit count).
|
|
52
|
+
- A step package's `walkerOS.bundle.*` block contains unknown keys (typo
|
|
53
|
+
guard).
|
|
54
|
+
|
|
55
|
+
New sibling export `downloadPackagesWithResolution` returns both the package
|
|
56
|
+
paths and the full `ResolutionResult`. Existing `downloadPackages` keeps its
|
|
57
|
+
return shape unchanged.
|
|
58
|
+
|
|
59
|
+
- e4b6cf4: Fix `walkeros bundle` failing on Windows when stage 2 import paths
|
|
60
|
+
contained backslashes that JS parsed as escape sequences.
|
|
61
|
+
- 381dfe7: Add an optional `setup` lifecycle to destinations, sources, and
|
|
62
|
+
stores.
|
|
63
|
+
|
|
64
|
+
Each package may now implement `setup?: SetupFn` to provision external
|
|
65
|
+
resources (BigQuery datasets and tables, Pub/Sub topics and subscriptions,
|
|
66
|
+
SQLite tables, webhook registrations, etc.). Setup is triggered only by the
|
|
67
|
+
new `walkeros setup <kind>.<name>` CLI command, never automatically by the
|
|
68
|
+
runtime, push, or deploy. Idempotency, ordering, and error semantics are the
|
|
69
|
+
package's responsibility; the framework provides the type slot, the CLI
|
|
70
|
+
invocation, and a `resolveSetup(value, defaults)` helper.
|
|
71
|
+
|
|
72
|
+
`LifecycleContext<C, E>` is the new shared context type used by both `setup`
|
|
73
|
+
and `destroy`. `DestroyContext` remains as a deprecated type alias for one
|
|
74
|
+
minor cycle. The `Types` bundle on `Destination`, `Source`, and `Store` gains
|
|
75
|
+
a 5th/6th/4th positional slot for setup options; existing aliases compile
|
|
76
|
+
unchanged because the slot defaults to `unknown`.
|
|
77
|
+
`Config<T>.setup?: boolean | SetupOptions<T>` is added across all three kinds
|
|
78
|
+
and validated by the corresponding Zod `ConfigSchema` plus the flow component
|
|
79
|
+
schemas in `@walkeros/core/schemas/flow.ts`.
|
|
80
|
+
|
|
81
|
+
CLI:
|
|
82
|
+
- `walkeros setup <kind>.<name>` runs a single component's `setup()` function.
|
|
83
|
+
- `<kind>` is `source`, `destination`, or `store` (transformers have no
|
|
84
|
+
provisioning).
|
|
85
|
+
- `--config <path>` (default `./flow.json`), `--flow <name>` for multi-flow
|
|
86
|
+
configs, plus standard `--json` / `--verbose` / `--silent`.
|
|
87
|
+
- Exit 0 on success or skip; non-zero on failure. Skip narration covers three
|
|
88
|
+
cases: no `setup()` on the package, `config.setup === false`, or
|
|
89
|
+
`config.setup` unset.
|
|
90
|
+
- When the package's `setup()` returns a non-undefined value, the CLI emits it
|
|
91
|
+
as JSON on stdout for `jq` piping.
|
|
92
|
+
|
|
93
|
+
- 03d7055: Merge `definitions` into `variables`. Single concept, single syntax
|
|
94
|
+
`$var.name(.deep.path)?`. Whole-string references preserve native type; inline
|
|
95
|
+
interpolation requires scalars. Deep paths and recursive resolution with cycle
|
|
96
|
+
detection now supported. `Flow.Definitions`, `Flow.Primitive`, and the `$def.`
|
|
97
|
+
reference syntax are removed.
|
|
98
|
+
- Updated dependencies [381dfe7]
|
|
99
|
+
- Updated dependencies [1524275]
|
|
100
|
+
- Updated dependencies [03d7055]
|
|
101
|
+
- @walkeros/core@4.1.0-next-1778155282668
|
|
102
|
+
- @walkeros/collector@4.1.0-next-1778155282668
|
|
103
|
+
- @walkeros/server-core@4.1.0-next-1778155282668
|
|
104
|
+
- @walkeros/server-destination-api@4.1.0-next-1778155282668
|
|
105
|
+
|
|
3
106
|
## 4.0.0
|
|
4
107
|
|
|
5
108
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ walkeros push flow.json --event '{"name":"product view"}' --simulate destination
|
|
|
52
52
|
walkeros push flow.json --event '{"name":"product view"}'
|
|
53
53
|
|
|
54
54
|
# Run a collection server locally
|
|
55
|
-
walkeros run dist/
|
|
55
|
+
walkeros run dist/flow.mjs --port 3000
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Commands
|
|
@@ -79,7 +79,6 @@ walkeros bundle https://example.com/config.json # Remote URL
|
|
|
79
79
|
- `--stats` - Show bundle statistics
|
|
80
80
|
- `--json` - Output as JSON (implies --stats)
|
|
81
81
|
- `--no-cache` - Disable package caching
|
|
82
|
-
- `--dockerfile [file]` - Generate Dockerfile (or copy custom file) to dist/
|
|
83
82
|
- `-v, --verbose` - Verbose output
|
|
84
83
|
- `-s, --silent` - Suppress output
|
|
85
84
|
|
|
@@ -89,15 +88,31 @@ walkeros bundle https://example.com/config.json # Remote URL
|
|
|
89
88
|
# Bundle with stats
|
|
90
89
|
walkeros bundle examples/server-collect.json --stats
|
|
91
90
|
|
|
92
|
-
# Bundle
|
|
93
|
-
walkeros bundle flow.json
|
|
91
|
+
# Bundle to a custom output directory
|
|
92
|
+
walkeros bundle flow.json -o ./build/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Server bundles use nft tracing
|
|
96
|
+
|
|
97
|
+
Server flows (`platform: "server"`) are bundled with `@vercel/nft`. The CLI
|
|
98
|
+
externalizes every step package, traces the entry to discover which files are
|
|
99
|
+
actually reachable at runtime, and copies only those files into
|
|
100
|
+
`dist/node_modules/`. Step packages are installed via pacote, driven by the
|
|
101
|
+
`config.bundle.packages` field in `flow.json`. **You do not need to run
|
|
102
|
+
`npm install` for step packages**: only `@walkeros/cli` belongs in your
|
|
103
|
+
`package.json` devDependencies.
|
|
94
104
|
|
|
95
|
-
|
|
96
|
-
|
|
105
|
+
The output is always a directory:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
dist/
|
|
109
|
+
├── flow.mjs # ESM entry point
|
|
110
|
+
├── package.json # informational sidecar
|
|
111
|
+
└── node_modules/ # only the files nft traced
|
|
97
112
|
```
|
|
98
113
|
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
For web flows the output stays a single self-contained file (default
|
|
115
|
+
`dist/walker.js`).
|
|
101
116
|
|
|
102
117
|
### push
|
|
103
118
|
|
|
@@ -162,23 +177,85 @@ walkeros push flow.json -e event.json --mock destination.ga4='{"status":"ok"}'
|
|
|
162
177
|
|
|
163
178
|
```bash
|
|
164
179
|
# Push with pre-built bundle
|
|
165
|
-
walkeros push dist/
|
|
180
|
+
walkeros push dist/flow.mjs --event '{"name":"order complete"}'
|
|
166
181
|
|
|
167
182
|
# Override platform detection
|
|
168
|
-
walkeros push dist/
|
|
183
|
+
walkeros push dist/walker.js --platform web --event '{"name":"order complete"}'
|
|
169
184
|
```
|
|
170
185
|
|
|
171
186
|
**Push modes:**
|
|
172
187
|
|
|
173
|
-
| Mode
|
|
174
|
-
|
|
|
175
|
-
| Real
|
|
176
|
-
| Simulate | `--simulate` | Mocked (captured)
|
|
177
|
-
| Mock
|
|
188
|
+
| Mode | Flag | API Calls | Use Case |
|
|
189
|
+
| -------- | ------------ | ------------------ | ------------------- |
|
|
190
|
+
| Real | (none) | Real HTTP requests | Integration testing |
|
|
191
|
+
| Simulate | `--simulate` | Mocked (captured) | Safe local testing |
|
|
192
|
+
| Mock | `--mock` | Returns mock value | Controlled testing |
|
|
178
193
|
|
|
179
194
|
Use `--simulate` first to validate safely, then push without flags for real
|
|
180
195
|
integrations.
|
|
181
196
|
|
|
197
|
+
### setup
|
|
198
|
+
|
|
199
|
+
Run the optional `setup()` lifecycle on a single component to provision external
|
|
200
|
+
resources (BigQuery datasets, Pub/Sub topics, SQLite tables, webhook
|
|
201
|
+
registrations).
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
walkeros setup <target> [options]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Target format:** `<kind>.<name>` matching `walkeros push --simulate`. Valid
|
|
208
|
+
kinds: `source`, `destination`, `store`. Transformers are pure functions and
|
|
209
|
+
have no setup.
|
|
210
|
+
|
|
211
|
+
**Options:**
|
|
212
|
+
|
|
213
|
+
- `-c, --config <path>` - Flow config file (default: `./flow.json`)
|
|
214
|
+
- `-f, --flow <name>` - Flow name for multi-flow configs
|
|
215
|
+
- `--json` - Output as JSON
|
|
216
|
+
- `-v, --verbose` - Verbose output
|
|
217
|
+
- `-s, --silent` - Suppress output
|
|
218
|
+
|
|
219
|
+
**Behavior:**
|
|
220
|
+
|
|
221
|
+
- Loads the flow config, resolves the named component, imports its package, and
|
|
222
|
+
calls `setup({ id, config, env, logger })`. No collector boot, no event
|
|
223
|
+
pipeline, no destinations are pushed to.
|
|
224
|
+
- Skips with an explanatory message in three cases: the package has no `setup`
|
|
225
|
+
function, `config.setup === false`, or `config.setup` is unset.
|
|
226
|
+
- When `setup()` returns a non-undefined value, the CLI emits it as JSON on
|
|
227
|
+
stdout for `jq`-style scripting.
|
|
228
|
+
- Exit code `0` on success or skip, non-zero on failure.
|
|
229
|
+
|
|
230
|
+
**Operator-time, never automatic.** Setup is explicit only. It is never
|
|
231
|
+
triggered by `push`, `simulate`, `deploy`, or the long-running runtime.
|
|
232
|
+
Operators run it once when provisioning, and again only when external resources
|
|
233
|
+
need to be re-provisioned.
|
|
234
|
+
|
|
235
|
+
**IAM note:** Setup typically needs higher permissions than runtime push (for
|
|
236
|
+
example, "create dataset" vs "write rows"). Operators commonly run setup with a
|
|
237
|
+
separate service account or different credentials than the runtime uses.
|
|
238
|
+
|
|
239
|
+
**Examples:**
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Provision the BigQuery dataset and table for the destination named "bigquery"
|
|
243
|
+
# in the default flow file.
|
|
244
|
+
walkeros setup destination.bigquery
|
|
245
|
+
|
|
246
|
+
# Same but pointing to a specific flow in a multi-flow config.
|
|
247
|
+
walkeros setup destination.bigquery --flow analytics
|
|
248
|
+
|
|
249
|
+
# Custom config path.
|
|
250
|
+
walkeros setup destination.bigquery --config ./flows/prod.json
|
|
251
|
+
|
|
252
|
+
# Pipe the structured result to jq.
|
|
253
|
+
walkeros setup destination.bigquery --json | jq .datasetCreated
|
|
254
|
+
|
|
255
|
+
# Provision a Pub/Sub source's subscription.
|
|
256
|
+
walkeros setup source.events-in
|
|
257
|
+
```
|
|
258
|
+
|
|
182
259
|
### run
|
|
183
260
|
|
|
184
261
|
Run flows locally (no Docker daemon required).
|
|
@@ -201,8 +278,8 @@ walkeros run <config-file> [options]
|
|
|
201
278
|
# Run collection server (auto-bundles JSON)
|
|
202
279
|
walkeros run examples/server-collect.json --port 3000
|
|
203
280
|
|
|
204
|
-
# Run with pre-built bundle
|
|
205
|
-
walkeros run
|
|
281
|
+
# Run with a pre-built server bundle
|
|
282
|
+
walkeros run dist/flow.mjs --port 3000
|
|
206
283
|
```
|
|
207
284
|
|
|
208
285
|
**How it works:**
|
|
@@ -328,18 +405,22 @@ walkeros bundle flow.json --no-cache
|
|
|
328
405
|
|
|
329
406
|
## Flow Configuration
|
|
330
407
|
|
|
331
|
-
Flow configs use the `Flow.
|
|
408
|
+
Flow configs use the `Flow.Json` format with `version` and `flows`:
|
|
332
409
|
|
|
333
410
|
```json
|
|
334
411
|
{
|
|
335
|
-
"version":
|
|
412
|
+
"version": 4,
|
|
336
413
|
"flows": {
|
|
337
414
|
"default": {
|
|
338
|
-
"
|
|
339
|
-
|
|
340
|
-
"
|
|
341
|
-
|
|
342
|
-
|
|
415
|
+
"config": {
|
|
416
|
+
"platform": "server",
|
|
417
|
+
"bundle": {
|
|
418
|
+
"packages": {
|
|
419
|
+
"@walkeros/collector": { "imports": ["startFlow"] },
|
|
420
|
+
"@walkeros/server-source-express": {},
|
|
421
|
+
"@walkeros/destination-demo": {}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
343
424
|
},
|
|
344
425
|
"sources": {
|
|
345
426
|
"http": {
|
|
@@ -363,7 +444,9 @@ Flow configs use the `Flow.Config` format with `version` and `flows`:
|
|
|
363
444
|
}
|
|
364
445
|
```
|
|
365
446
|
|
|
366
|
-
Platform is
|
|
447
|
+
Platform is set via `config.platform` (`"web"` or `"server"`). The
|
|
448
|
+
`config.bundle.packages` field declares what pacote should install.
|
|
449
|
+
`config.bundle.overrides` pins transitive dependency versions when needed.
|
|
367
450
|
|
|
368
451
|
### Package Configuration Patterns
|
|
369
452
|
|
|
@@ -509,10 +592,7 @@ const result = await push(
|
|
|
509
592
|
// result.usage = API call tracking data
|
|
510
593
|
|
|
511
594
|
// Push for real
|
|
512
|
-
await push(
|
|
513
|
-
'./flow.json',
|
|
514
|
-
{ name: 'page view', data: { title: 'Test' } },
|
|
515
|
-
);
|
|
595
|
+
await push('./flow.json', { name: 'page view', data: { title: 'Test' } });
|
|
516
596
|
|
|
517
597
|
// Run
|
|
518
598
|
await runCommand({
|
|
@@ -566,7 +646,7 @@ walkeros push \
|
|
|
566
646
|
walkeros bundle my-flow.json --stats
|
|
567
647
|
|
|
568
648
|
# 4. Run locally
|
|
569
|
-
walkeros run dist/
|
|
649
|
+
walkeros run dist/flow.mjs --port 3000
|
|
570
650
|
|
|
571
651
|
# 5. In another terminal, test it
|
|
572
652
|
curl -X POST http://localhost:3000/collect \
|
|
@@ -577,13 +657,16 @@ curl -X POST http://localhost:3000/collect \
|
|
|
577
657
|
## Architecture
|
|
578
658
|
|
|
579
659
|
```
|
|
580
|
-
CLI
|
|
581
|
-
├─
|
|
582
|
-
├─
|
|
583
|
-
|
|
660
|
+
CLI
|
|
661
|
+
├─ Pacote installs flow.json packages (no user-side npm install)
|
|
662
|
+
├─ esbuild externalizes step packages, emits ESM entry
|
|
663
|
+
├─ @vercel/nft traces entry, copies only used files
|
|
664
|
+
└─ Output: dist/{flow.mjs, package.json, node_modules/} (server)
|
|
665
|
+
dist/walker.js (web)
|
|
584
666
|
```
|
|
585
667
|
|
|
586
|
-
**Key principle**: CLI handles both build-time and runtime
|
|
668
|
+
**Key principle**: CLI handles both build-time install/trace/bundle and runtime
|
|
669
|
+
execution.
|
|
587
670
|
|
|
588
671
|
## Runner (Docker)
|
|
589
672
|
|
|
@@ -625,7 +708,7 @@ Run the bundle directly with the CLI:
|
|
|
625
708
|
walkeros bundle flow.json
|
|
626
709
|
|
|
627
710
|
# Run in production
|
|
628
|
-
walkeros run dist/
|
|
711
|
+
walkeros run dist/flow.mjs --port 8080
|
|
629
712
|
```
|
|
630
713
|
|
|
631
714
|
This runs the flow in the current Node.js process, suitable for deployment on
|