@walkeros/cli 3.3.0 → 3.4.0-next-1776749829492

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.
@@ -514,7 +514,8 @@
514
514
  "config": {
515
515
  "settings": {
516
516
  "url": "$var.apiUrl",
517
- "batch": 5
517
+ "batch": 5,
518
+ "transform": "$code:(data) => JSON.stringify(data)"
518
519
  },
519
520
  "data": {
520
521
  "map": {
@@ -557,9 +558,7 @@
557
558
  "push": "$code:(event, ctx) => { ctx.logger.info('[DEBUG]', event.name, event.data); }"
558
559
  },
559
560
  "config": {
560
- "consent": {
561
- "functional": true
562
- }
561
+ "consent": {}
563
562
  }
564
563
  }
565
564
  },
@@ -613,6 +612,7 @@
613
612
  "http": {
614
613
  "package": "@walkeros/server-source-express",
615
614
  "primary": true,
615
+ "next": ["filter"],
616
616
  "cache": {
617
617
  "store": "cache",
618
618
  "rules": [
@@ -643,7 +643,11 @@
643
643
  "context.ip": "ip",
644
644
  "context.userAgent": "headers.user-agent",
645
645
  "context.language": "headers.accept-language",
646
- "context.referer": "headers.referer"
646
+ "context.referer": "headers.referer",
647
+ "context.anonymizedIp": {
648
+ "key": "ip",
649
+ "fn": "$code:(ip) => ip ? ip.replace(/\\.\\d+$/, '.0') : ''"
650
+ }
647
651
  }
648
652
  },
649
653
  "examples": {
@@ -682,6 +686,9 @@
682
686
  "push": "$code:(event) => event.name.startsWith('internal_') || event.name.startsWith('debug_') ? false : event"
683
687
  },
684
688
  "next": "fingerprint",
689
+ "env": {
690
+ "store": "$store:cache"
691
+ },
685
692
  "config": {},
686
693
  "examples": {
687
694
  "passes-normal": {
@@ -746,7 +753,7 @@
746
753
  "destinations": {
747
754
  "meta": {
748
755
  "package": "@walkeros/server-destination-meta",
749
- "before": "fingerprint",
756
+ "before": ["fingerprint", "serverValidator"],
750
757
  "config": {
751
758
  "settings": {
752
759
  "pixelId": "$var.metaPixelId",
@@ -918,7 +925,8 @@
918
925
  "globals": {
919
926
  "environment": "demo",
920
927
  "version": "$var.flowVersion",
921
- "platform": "server"
928
+ "platform": "server",
929
+ "startedAt": "$code:Date.now()"
922
930
  }
923
931
  },
924
932
  "bundle": {
@@ -11,19 +11,24 @@ complete event tracking architecture.
11
11
  │ WEB FLOW │
12
12
  │ │
13
13
  │ Browser Source ─┐ │
14
- │ DataLayer Source ──▶ [Validator] ──▶ Collector ──▶ GA4 Destination
15
- │ Demo Source ────┘ └──▶ API Destination
16
-
17
- └──────────────────────────────────────────────────────────────│──────────────┘
18
-
14
+ │ DataLayer Source ──▶ [Enricher] ──▶ [Validator] ──▶ Collector ──▶ GA4
15
+ │ Demo Source ────┘ ├──▶ API
16
+ └──▶ Debug
17
+ └─────────────────────────────────────────────────────────────────────────────┘
18
+
19
19
  ┌─────────────────────────────────────────────────────────────────────────────┐
20
20
  │ SERVER FLOW │
21
21
  │ │
22
- │ HTTP Request ──▶ Express Source ──▶ Collector ──▶ [Fingerprint] ──────┐
23
- [Validator]
24
-
25
- └── ingest: IP, user-agent ────────▶ Meta Destination
26
- language, referer Demo Destination
22
+ │ HTTP Source ──▶ [Filter] ──▶ [Fingerprint] ──▶ [Validator] ──▶ Collector
23
+ │ │
24
+ ingest: │ env: before:
25
+ IP, UA, │ $store:cache [Fingerprint]+[Validator] │
26
+ │ lang, ref, │ │
27
+ │ │ anon-IP(fn) │ ▼ │
28
+ │ │ │ Meta Destination │
29
+ │ └──────────────┘ Demo Destination │
30
+ │ │
31
+ │ Store: cache (memory, 10MB, 1000 entries) │
27
32
  └─────────────────────────────────────────────────────────────────────────────┘
28
33
  ```
29
34
 
@@ -71,7 +76,7 @@ npx walkeros run packages/cli/examples/flow-complete.json --flow web
71
76
 
72
77
  ## Feature Inventory
73
78
 
74
- ### Features Used (55)
79
+ ### Features Used (68)
75
80
 
76
81
  #### Mapping - Value Extraction
77
82
 
@@ -106,67 +111,81 @@ npx walkeros run packages/cli/examples/flow-complete.json --flow web
106
111
 
107
112
  #### Definitions & Variables
108
113
 
109
- | Feature | Location | Example |
110
- | -------------------- | ------------------ | -------------------------------------------- |
111
- | Root-level variables | Root | `"currency": "EUR"` |
112
- | Flow-level variables | server.variables | `"metaPixelId": "${META_PIXEL_ID:...}"` |
113
- | Environment variable | Variables | `"${GA4_MEASUREMENT_ID:G-DEMO123456}"` |
114
- | Env with default | Variables | `"${API_URL:http://localhost:8080/collect}"` |
115
- | $variables reference | GA4 settings | `"$variables.ga4MeasurementId"` |
116
- | Definition (complex) | Root definitions | `"ga4ItemsLoop": { "loop": [...] }` |
117
- | $ref reference | GA4 purchase items | `{ "$ref": "#/definitions/ga4ItemsLoop" }` |
114
+ | Feature | Location | Example |
115
+ | -------------------- | ------------------ | ---------------------------------------------- |
116
+ | Root-level variables | Root | `"currency": "EUR"` |
117
+ | Flow-level variables | server.variables | `"metaPixelId": "$env.META_PIXEL_ID:..."` |
118
+ | Environment variable | Variables | `"$env.GA4_MEASUREMENT_ID:G-DEMO123456"` |
119
+ | Env with default | Variables | `"$env.API_URL:http://localhost:8080/collect"` |
120
+ | $var reference | GA4 settings | `"$var.ga4MeasurementId"` |
121
+ | Definition (complex) | Root definitions | `"ga4ItemsLoop": { "loop": [...] }` |
122
+ | $def reference | GA4 purchase items | `"$def.ga4ItemsLoop"` |
123
+ | $contract reference | serverValidator | `"$contract.default.events"` |
124
+ | $store reference | filter transformer | `"env": { "store": "$store:cache" }` |
118
125
 
119
126
  #### Sources
120
127
 
121
- | Feature | Location | Example |
122
- | ----------------------- | --------- | ------------------------------------- |
123
- | Primary source | browser | `"primary": true` |
124
- | Multiple sources | web flow | browser + dataLayer + demo |
125
- | Source-level mapping | dataLayer | `"mapping": { "add_to_cart": {...} }` |
126
- | Pre-collector chain | dataLayer | `"next": "dataLayerValidator"` |
127
- | Require (deferred init) | dataLayer | `"require": ["session"]` |
128
- | Demo source events | demo | Pre-configured test events |
128
+ | Feature | Location | Example |
129
+ | ----------------------- | ------------- | ------------------------------------- |
130
+ | Primary source | browser | `"primary": true` |
131
+ | Multiple sources | web flow | browser + dataLayer + demo |
132
+ | Source-level mapping | dataLayer | `"mapping": { "add_to_cart": {...} }` |
133
+ | Pre-collector chain | dataLayer | `"next": "enricher"` |
134
+ | Pre-collector array | http (server) | `"next": ["filter"]` (array form) |
135
+ | Require (deferred init) | dataLayer | `"require": ["session"]` |
136
+ | Demo source events | demo | Pre-configured test events |
129
137
 
130
138
  #### Transformers
131
139
 
132
- | Feature | Location | Example |
133
- | ----------------------- | ------------------ | ---------------------------------- |
134
- | Validator transformer | dataLayerValidator | JSON Schema validation |
135
- | Fingerprint transformer | server | Hash context fields to `user.hash` |
136
- | Transformer chaining | server | `"next": "serverValidator"` |
137
- | Post-collector chain | Meta | `"before": "fingerprint"` |
138
- | Contract validation | serverValidator | Entity/action schemas |
139
- | Format option | serverValidator | `"format": true` |
140
+ | Feature | Location | Example |
141
+ | ----------------------- | ------------------ | ---------------------------------------------- |
142
+ | Validator transformer | dataLayerValidator | JSON Schema validation |
143
+ | Fingerprint transformer | server | Hash context fields to `user.hash` |
144
+ | Transformer chaining | server | `"next": "serverValidator"` |
145
+ | Post-collector chain | Meta | `"before": ["fingerprint", "serverValidator"]` |
146
+ | Contract validation | serverValidator | Entity/action schemas |
147
+ | Format option | serverValidator | `"format": true` |
140
148
 
141
149
  #### Destinations
142
150
 
143
- | Feature | Location | Example |
144
- | ----------------------- | ---------------- | ---------------------------------- |
145
- | Require (deferred init) | GA4 | `"require": ["consent", "user"]` |
146
- | Destination consent | GA4 | `"consent": { "marketing": true }` |
147
- | Destination mapping | All destinations | Entity/action to vendor events |
148
- | Multiple destinations | Both flows | GA4 + API, Meta + Demo |
149
- | Batch option | API | `"batch": 5` |
151
+ | Feature | Location | Example |
152
+ | ----------------------- | ---------------- | --------------------------------------- |
153
+ | Require (deferred init) | GA4 | `"require": ["consent", "user"]` |
154
+ | Destination consent | GA4 | `"consent": { "marketing": true }` |
155
+ | Destination mapping | All destinations | Entity/action to vendor events |
156
+ | Multiple destinations | Both flows | GA4 + API, Meta + Demo |
157
+ | Batch option | API | `"batch": 5` |
158
+ | Transform function | API | `"transform": "$code:(data) => ..."` |
159
+ | Empty consent (always) | debug | `"consent": {}` (fires without consent) |
150
160
 
151
161
  #### Collector
152
162
 
153
- | Feature | Location | Example |
154
- | ----------------- | --------------- | --------------------------------------- |
155
- | Tagging | Both collectors | `"tagging": 1` |
156
- | Consent defaults | Both collectors | `"consent": { "functional": true }` |
157
- | Globals | Both collectors | `"environment": "demo"` |
158
- | Custom properties | web collector | `"custom": { "campaign": "flow-demo" }` |
159
- | User defaults | web collector | `"user": { "id": "anonymous" }` |
163
+ | Feature | Location | Example |
164
+ | ----------------- | ---------------- | --------------------------------------- |
165
+ | Tagging | Both collectors | `"tagging": 1` |
166
+ | Consent defaults | Both collectors | `"consent": { "functional": true }` |
167
+ | Globals | Both collectors | `"environment": "demo"` |
168
+ | Custom properties | web collector | `"custom": { "campaign": "flow-demo" }` |
169
+ | User defaults | web collector | `"user": { "id": "anonymous" }` |
170
+ | Dynamic global | server collector | `"startedAt": "$code:Date.now()"` |
160
171
 
161
172
  #### Server-Specific
162
173
 
163
- | Feature | Location | Example |
164
- | -------------------- | ----------- | ----------------------------------------------- |
165
- | Ingest metadata | http source | `"context.ip": "ip"` |
166
- | Language header | ingest | `"context.language": "headers.accept-language"` |
167
- | Policy | Meta | Pre-processing field transformation |
168
- | Policy consent-gated | Meta | `"user_data.em"` with consent |
169
- | Policy nested map | Meta | `"custom_data.request_meta": { "map": {...} }` |
174
+ | Feature | Location | Example |
175
+ | --------------------- | --------------- | ----------------------------------------------------------------------- |
176
+ | Ingest metadata | http source | `"context.ip": "ip"` |
177
+ | Language header | ingest | `"context.language": "headers.accept-language"` |
178
+ | Ingest computed field | http source | `"fn": "$code:(ip) => ip.replace(...)"` |
179
+ | Policy | Meta | Pre-processing field transformation |
180
+ | Policy consent-gated | Meta | `"user_data.em"` with consent |
181
+ | Policy nested map | Meta | `"custom_data.request_meta": { "map": {...} }` |
182
+ | Local package path | server packages | `"path": "../../core"` (resolve from filesystem) |
183
+ | Source cache | http source | `"cache": { "store": "cache", "rules": [...] }` |
184
+ | Cache match rule | http source | `"match": { "key": "ingest.method", "operator": "eq", "value": "GET" }` |
185
+ | Cache TTL | http source | `"ttl": 300` (seconds) |
186
+ | Cache response update | http source | `"update": { "headers.X-Cache": { "key": "cache.status" } }` |
187
+ | Store definition | server stores | `"cache": { "package": "@walkeros/store-memory", ... }` |
188
+ | Store settings | cache store | `"maxSize": 10485760, "maxEntries": 1000` |
170
189
 
171
190
  #### Browser Source
172
191
 
package/dist/index.d.ts CHANGED
@@ -106,9 +106,23 @@ interface BuildOptions extends CLIBuildOptions {
106
106
  /**
107
107
  * Skip platform wrapper (Step 2) and output raw ESM.
108
108
  * Used by CLI push for direct import of the bundled module.
109
+ *
110
+ * @deprecated Use `target` option instead. `skipWrapper` conflates skeleton
111
+ * emission with /dev schema inclusion. See `BundleTarget` presets
112
+ * (`cdn` | `cdn-skeleton` | `runner` | `simulate` | `push`).
113
+ * Will be removed in the next major release.
114
+ *
109
115
  * @default false
110
116
  */
111
117
  skipWrapper?: boolean;
118
+ /**
119
+ * Include `@walkeros/*\/dev` imports for schema validation / simulate / push.
120
+ * Derived from the resolved `BundleTarget` preset by `bundle()`.
121
+ * If undefined, falls back to `skipWrapper === true` for backward compatibility
122
+ * with direct `bundleCore` callers (push, simulate) and legacy callers.
123
+ * @internal
124
+ */
125
+ withDev?: boolean;
112
126
  /**
113
127
  * Folders to include in the output directory.
114
128
  * These folders are copied alongside the bundle for runtime access.
@@ -165,6 +179,16 @@ interface BundleStats {
165
179
  treeshakingEffective: boolean;
166
180
  }
167
181
 
182
+ /**
183
+ * Named bundle targets with frozen presets.
184
+ *
185
+ * A target is the ONLY input callers should pass. All internal booleans
186
+ * (skipWrapper, withDev, platform, env injection) derive from the preset.
187
+ * This prevents the class of bug where the same boolean means different
188
+ * things in different code paths (see: skipWrapper conflation, 2026-04-16).
189
+ */
190
+ type BundleTarget = 'cdn' | 'cdn-skeleton' | 'runner' | 'simulate' | 'push';
191
+
168
192
  interface BundleCommandOptions {
169
193
  config?: string;
170
194
  output?: string;
@@ -216,6 +240,11 @@ declare function bundle(configOrPath: unknown, options?: {
216
240
  stats?: boolean;
217
241
  cache?: boolean;
218
242
  flowName?: string;
243
+ /**
244
+ * Named bundle target. If omitted, falls back to
245
+ * `buildOverrides.skipWrapper` mapping (deprecated) or `'cdn'`.
246
+ */
247
+ target?: BundleTarget;
219
248
  buildOverrides?: Partial<BuildOptions>;
220
249
  }): Promise<BundleStats | void>;
221
250
  /**
@@ -5116,20 +5145,58 @@ interface ApiErrorDetail {
5116
5145
  path: string;
5117
5146
  message: string;
5118
5147
  }
5148
+ interface ApiErrorOptions {
5149
+ code?: string;
5150
+ details?: ApiErrorDetail[];
5151
+ minVersion?: string;
5152
+ clientVersion?: string;
5153
+ client?: string;
5154
+ upgrade?: string;
5155
+ docs?: string;
5156
+ }
5119
5157
  declare class ApiError extends Error {
5120
5158
  code?: string;
5121
5159
  details?: ApiErrorDetail[];
5122
- constructor(message: string, options?: {
5123
- code?: string;
5124
- details?: ApiErrorDetail[];
5125
- });
5160
+ minVersion?: string;
5161
+ clientVersion?: string;
5162
+ client?: string;
5163
+ upgrade?: string;
5164
+ docs?: string;
5165
+ constructor(message: string, options?: ApiErrorOptions);
5126
5166
  }
5127
5167
  /**
5128
5168
  * Extract structured error from an openapi-fetch error response and throw.
5129
5169
  * The error shape is: { error: { code, message, details: { errors: [] } } }
5170
+ *
5171
+ * For `code === 'CLIENT_OUTDATED'` (HTTP 426), also extracts the upgrade
5172
+ * metadata: `minVersion`, `clientVersion`, `client`, `upgrade`, `docs`.
5130
5173
  */
5131
5174
  declare function throwApiError(error: unknown, fallbackMessage: string): never;
5132
5175
 
5176
+ type ClientType = 'cli' | 'mcp' | 'runner';
5177
+ interface ClientContext {
5178
+ type: ClientType;
5179
+ version: string;
5180
+ }
5181
+ /**
5182
+ * Set the client context used to identify this process to the walkerOS app.
5183
+ *
5184
+ * The CLI binary calls this at startup, the MCP server calls it on boot, and
5185
+ * the runner Docker image overrides the resolved type via the
5186
+ * `WALKEROS_CLIENT_TYPE` env var (env wins over `input.type`).
5187
+ */
5188
+ declare function setClientContext(input: {
5189
+ type?: ClientType;
5190
+ version: string;
5191
+ }): void;
5192
+ declare function getClientContext(): ClientContext | undefined;
5193
+ declare function resetClientContext(): void;
5194
+ /**
5195
+ * Produce the outbound client-identification headers, or an empty object when
5196
+ * no context has been set yet (e.g. in tests or pre-bootstrap code paths).
5197
+ */
5198
+ declare function clientContextHeaders(): Record<string, string>;
5199
+
5133
5200
  interface WalkerOSConfig {
5134
5201
  token: string;
5135
5202
  email: string;
@@ -5291,4 +5358,4 @@ interface PreparedFlow {
5291
5358
  cleanup: () => Promise<void>;
5292
5359
  }
5293
5360
 
5294
- export { ApiError, type ApiErrorDetail, type BuildOptions, type BundleStats, type CLIBuildOptions, type DeployOptions, type ExampleLookupResult, type FeedbackOptions, type GlobalOptions, type ListDeploymentsOptions, type ListFlowsOptions, type MinifyOptions, type PrepareInput, type PreparedFlow, type PushResult, type RunCommandOptions, type RunOptions, type RunResult, type SSEEvent, type SSEParseResult, type SimulateDestinationOptions, type SimulateSourceOptions, type SimulateTransformerOptions, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, type WalkerOSConfig, type WrapSkeletonOptions, apiFetch, bundle, bundleCommand, bundleRemote, compareOutput, createApiClient, createDeployCommand, createDeployment, createDeploymentCommand, createFlow, createFlowCommand, createProject, createProjectCommand, deleteDeployment, deleteDeploymentCommand, deleteFlow, deleteFlowCommand, deleteProject, deleteProjectCommand, deploy, deployCommand, deployFetch, duplicateFlow, duplicateFlowCommand, feedback, feedbackCommand, findExample, getAuthHeaders, getDeployment, getDeploymentBySlug, getDeploymentBySlugCommand, getDeploymentCommand, getFlow, getFlowCommand, getProject, getProjectCommand, getToken, listDeployments, listDeploymentsCommand, listFlows, listFlowsCommand, listProjects, listProjectsCommand, loadConfig, loadJsonConfig, loginCommand, logoutCommand, mergeAuthHeaders, parseSSEEvents, publicFetch, push, pushCommand, readConfig, requireProjectId, run, runCommand, simulateDestination, simulateSource, simulateTransformer, throwApiError, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand, wrapSkeleton, writeConfig };
5361
+ export { ApiError, type ApiErrorDetail, type BuildOptions, type BundleStats, type CLIBuildOptions, type ClientContext, type ClientType, type DeployOptions, type ExampleLookupResult, type FeedbackOptions, type GlobalOptions, type ListDeploymentsOptions, type ListFlowsOptions, type MinifyOptions, type PrepareInput, type PreparedFlow, type PushResult, type RunCommandOptions, type RunOptions, type RunResult, type SSEEvent, type SSEParseResult, type SimulateDestinationOptions, type SimulateSourceOptions, type SimulateTransformerOptions, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, type WalkerOSConfig, type WrapSkeletonOptions, apiFetch, bundle, bundleCommand, bundleRemote, clientContextHeaders, compareOutput, createApiClient, createDeployCommand, createDeployment, createDeploymentCommand, createFlow, createFlowCommand, createProject, createProjectCommand, deleteDeployment, deleteDeploymentCommand, deleteFlow, deleteFlowCommand, deleteProject, deleteProjectCommand, deploy, deployCommand, deployFetch, duplicateFlow, duplicateFlowCommand, feedback, feedbackCommand, findExample, getAuthHeaders, getClientContext, getDeployment, getDeploymentBySlug, getDeploymentBySlugCommand, getDeploymentCommand, getFlow, getFlowCommand, getProject, getProjectCommand, getToken, listDeployments, listDeploymentsCommand, listFlows, listFlowsCommand, listProjects, listProjectsCommand, loadConfig, loadJsonConfig, loginCommand, logoutCommand, mergeAuthHeaders, parseSSEEvents, publicFetch, push, pushCommand, readConfig, requireProjectId, resetClientContext, run, runCommand, setClientContext, simulateDestination, simulateSource, simulateTransformer, throwApiError, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand, wrapSkeleton, writeConfig };