|
1 | | -import { schemas as coreSchemas, type JSONSchema } from '@walkeros/core/dev'; |
| 1 | +import { |
| 2 | + schemas as coreSchemas, |
| 3 | + z, |
| 4 | + zodToSchema, |
| 5 | + type JSONSchema, |
| 6 | +} from '@walkeros/core/dev'; |
| 7 | +import { schemas as browserSchemas } from '@walkeros/web-source-browser/dev'; |
| 8 | +import { schemas as dataLayerSchemas } from '@walkeros/web-source-datalayer/dev'; |
2 | 9 |
|
3 | | -export const schemas: { settings: JSONSchema } = { |
4 | | - settings: coreSchemas.FlowSchemas.configJsonSchema, |
5 | | -}; |
| 10 | +/** |
| 11 | + * Walker.js Config schema |
| 12 | + * |
| 13 | + * Matches the Config interface in types/index.ts |
| 14 | + */ |
| 15 | +const ConfigSchema = z.object({ |
| 16 | + collector: z |
| 17 | + .any() |
| 18 | + .optional() |
| 19 | + .describe('Collector configuration (Collector.InitConfig)'), |
| 20 | + browser: z |
| 21 | + .any() |
| 22 | + .optional() |
| 23 | + .describe('Browser source configuration (Partial<SourceBrowser.Settings>)'), |
| 24 | + dataLayer: z |
| 25 | + .union([z.boolean(), z.any()]) |
| 26 | + .optional() |
| 27 | + .describe( |
| 28 | + 'DataLayer configuration (boolean | Partial<SourceDataLayer.Settings>)', |
| 29 | + ), |
| 30 | + elb: z |
| 31 | + .string() |
| 32 | + .optional() |
| 33 | + .describe('Name for the global elb function (default: "elb")'), |
| 34 | + name: z.string().optional().describe('Name for the global instance'), |
| 35 | + run: z |
| 36 | + .boolean() |
| 37 | + .optional() |
| 38 | + .describe('Auto-run on initialization (default: true)'), |
| 39 | +}); |
| 40 | + |
| 41 | +// Named exports for MDX PropertyTable usage |
| 42 | +export const settings: JSONSchema = zodToSchema(ConfigSchema); |
| 43 | +export const browserConfig: JSONSchema = browserSchemas.settings; |
| 44 | +export const dataLayerConfig: JSONSchema = dataLayerSchemas.settings; |
| 45 | +export const collectorConfig: JSONSchema = |
| 46 | + coreSchemas.CollectorSchemas.initConfigJsonSchema; |
0 commit comments