Skip to content

Commit 3364466

Browse files
updated schema
1 parent 9645260 commit 3364466

File tree

2 files changed

+135
-42
lines changed

2 files changed

+135
-42
lines changed

packages/core/src/schemas/flow.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* - JSON Schema generation for IDE support
1212
* - Type-safe parsing with Zod
1313
*
14+
* SCHEMA SYNC: When modifying these schemas, update website/static/schema/flow/v1.json
15+
* (served at https://walkeros.io/schema/flow/v1.json). For breaking changes, create v2.
16+
*
1417
* @packageDocumentation
1518
*/
1619

website/static/schema/flow/v1.json

Lines changed: 132 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,68 @@
11
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
23
"$ref": "#/definitions/FlowSetup",
34
"definitions": {
4-
"FlowConfig": {
5+
"Primitive": {
6+
"type": ["string", "number", "boolean"],
7+
"description": "Primitive value: string, number, or boolean"
8+
},
9+
"Variables": {
10+
"type": "object",
11+
"additionalProperties": {
12+
"$ref": "#/definitions/Primitive"
13+
},
14+
"description": "Variables for interpolation"
15+
},
16+
"Definitions": {
17+
"type": "object",
18+
"additionalProperties": {},
19+
"description": "Reusable configuration definitions"
20+
},
21+
"PackageConfig": {
522
"type": "object",
623
"properties": {
7-
"platform": {
24+
"version": {
825
"type": "string",
9-
"enum": ["web", "server"],
10-
"description": "Target platform: \"web\" for browser-based tracking, \"server\" for Node.js server-side collection"
26+
"description": "Package version to use"
1127
},
12-
"sources": {
13-
"type": "object",
14-
"additionalProperties": {
15-
"$ref": "#/definitions/SourceReference"
16-
},
17-
"description": "Source configurations (data capture) keyed by unique identifier"
18-
},
19-
"destinations": {
20-
"type": "object",
21-
"additionalProperties": {
22-
"$ref": "#/definitions/DestinationReference"
23-
},
24-
"description": "Destination configurations (data output) keyed by unique identifier"
28+
"imports": {
29+
"type": "array",
30+
"items": { "type": "string" },
31+
"description": "Named exports to import from the package"
2532
},
26-
"collector": {
27-
"description": "Collector configuration for event processing (uses Collector.InitConfig)"
33+
"path": {
34+
"type": "string",
35+
"description": "Local path (takes precedence over version)"
36+
}
37+
},
38+
"additionalProperties": false
39+
},
40+
"Packages": {
41+
"type": "object",
42+
"additionalProperties": {
43+
"$ref": "#/definitions/PackageConfig"
44+
},
45+
"description": "NPM packages to bundle"
46+
},
47+
"WebConfig": {
48+
"type": "object",
49+
"properties": {
50+
"windowCollector": {
51+
"type": "string",
52+
"description": "Window property name for collector instance (default: \"collector\")"
2853
},
29-
"env": {
30-
"type": "object",
31-
"additionalProperties": {
32-
"type": "string"
33-
},
34-
"description": "Environment-specific variables (override root-level variables)"
54+
"windowElb": {
55+
"type": "string",
56+
"description": "Window property name for elb function (default: \"elb\")"
3557
}
3658
},
37-
"required": ["platform"],
59+
"additionalProperties": false,
60+
"description": "Web platform configuration"
61+
},
62+
"ServerConfig": {
63+
"type": "object",
3864
"additionalProperties": true,
39-
"description": "Single flow configuration for one deployment target"
65+
"description": "Server platform configuration (reserved for future options)"
4066
},
4167
"SourceReference": {
4268
"type": "object",
@@ -46,6 +72,10 @@
4672
"minLength": 1,
4773
"description": "Package specifier with optional version (e.g., \"@walkeros/[email protected]\")"
4874
},
75+
"code": {
76+
"type": "string",
77+
"description": "Named export to use from the package (e.g., \"sourceExpress\"). If omitted, uses default export."
78+
},
4979
"config": {
5080
"description": "Source-specific configuration object"
5181
},
@@ -55,6 +85,14 @@
5585
"primary": {
5686
"type": "boolean",
5787
"description": "Mark as primary source (provides main elb). Only one source should be primary."
88+
},
89+
"variables": {
90+
"$ref": "#/definitions/Variables",
91+
"description": "Source-level variables (highest priority in cascade)"
92+
},
93+
"definitions": {
94+
"$ref": "#/definitions/Definitions",
95+
"description": "Source-level definitions (highest priority in cascade)"
5896
}
5997
},
6098
"required": ["package"],
@@ -69,26 +107,82 @@
69107
"minLength": 1,
70108
"description": "Package specifier with optional version (e.g., \"@walkeros/[email protected]\")"
71109
},
110+
"code": {
111+
"type": "string",
112+
"description": "Named export to use from the package (e.g., \"destinationAnalytics\"). If omitted, uses default export."
113+
},
72114
"config": {
73115
"description": "Destination-specific configuration object"
74116
},
75117
"env": {
76118
"description": "Destination environment configuration"
119+
},
120+
"variables": {
121+
"$ref": "#/definitions/Variables",
122+
"description": "Destination-level variables (highest priority in cascade)"
123+
},
124+
"definitions": {
125+
"$ref": "#/definitions/Definitions",
126+
"description": "Destination-level definitions (highest priority in cascade)"
77127
}
78128
},
79129
"required": ["package"],
80130
"additionalProperties": false,
81131
"description": "Destination package reference with configuration"
82132
},
83-
"Primitive": {
84-
"type": ["string", "number", "boolean"],
85-
"description": "Primitive value: string, number, or boolean"
133+
"FlowConfig": {
134+
"type": "object",
135+
"properties": {
136+
"web": {
137+
"$ref": "#/definitions/WebConfig",
138+
"description": "Web platform configuration (browser-based tracking). Mutually exclusive with server."
139+
},
140+
"server": {
141+
"$ref": "#/definitions/ServerConfig",
142+
"description": "Server platform configuration (Node.js). Mutually exclusive with web."
143+
},
144+
"sources": {
145+
"type": "object",
146+
"additionalProperties": {
147+
"$ref": "#/definitions/SourceReference"
148+
},
149+
"description": "Source configurations (data capture) keyed by unique identifier"
150+
},
151+
"destinations": {
152+
"type": "object",
153+
"additionalProperties": {
154+
"$ref": "#/definitions/DestinationReference"
155+
},
156+
"description": "Destination configurations (data output) keyed by unique identifier"
157+
},
158+
"collector": {
159+
"description": "Collector configuration for event processing (uses Collector.InitConfig)"
160+
},
161+
"packages": {
162+
"$ref": "#/definitions/Packages",
163+
"description": "NPM packages to bundle"
164+
},
165+
"variables": {
166+
"$ref": "#/definitions/Variables",
167+
"description": "Flow-level variables (override Setup.variables, overridden by source/destination variables)"
168+
},
169+
"definitions": {
170+
"$ref": "#/definitions/Definitions",
171+
"description": "Flow-level definitions (extend Setup.definitions, overridden by source/destination definitions)"
172+
}
173+
},
174+
"oneOf": [
175+
{ "required": ["web"], "not": { "required": ["server"] } },
176+
{ "required": ["server"], "not": { "required": ["web"] } }
177+
],
178+
"additionalProperties": false,
179+
"description": "Single flow configuration for one deployment target. Exactly one of 'web' or 'server' must be present."
86180
},
87181
"FlowSetup": {
88182
"type": "object",
89183
"properties": {
90184
"version": {
91-
"type": "number",
185+
"type": "integer",
92186
"const": 1,
93187
"description": "Configuration schema version (currently only 1 is supported)"
94188
},
@@ -98,29 +192,25 @@
98192
"description": "JSON Schema reference for IDE validation (e.g., \"https://walkeros.io/schema/flow/v1.json\")"
99193
},
100194
"variables": {
101-
"type": "object",
102-
"additionalProperties": {
103-
"$ref": "#/definitions/Primitive"
104-
},
105-
"description": "Shared variables for interpolation across all flows (use ${VAR_NAME:default} syntax)"
195+
"$ref": "#/definitions/Variables",
196+
"description": "Shared variables for interpolation across all flows (use ${VAR_NAME} or ${VAR_NAME:default} syntax)"
106197
},
107198
"definitions": {
108-
"type": "object",
109-
"additionalProperties": {},
110-
"description": "Reusable configuration definitions (reference with JSON Schema $ref syntax)"
199+
"$ref": "#/definitions/Definitions",
200+
"description": "Reusable configuration definitions (reference with JSON Schema $ref syntax: { \"$ref\": \"#/definitions/name\" })"
111201
},
112202
"flows": {
113203
"type": "object",
114204
"additionalProperties": {
115205
"$ref": "#/definitions/FlowConfig"
116206
},
117-
"description": "Named flow configurations (e.g., web_prod, server_stage)"
207+
"minProperties": 1,
208+
"description": "Named flow configurations (e.g., production, staging, development)"
118209
}
119210
},
120211
"required": ["version", "flows"],
121212
"additionalProperties": false,
122213
"description": "Complete multi-flow walkerOS configuration (walkeros.config.json)"
123214
}
124-
},
125-
"$schema": "http://json-schema.org/draft-07/schema#"
215+
}
126216
}

0 commit comments

Comments
 (0)