@walkeros/cli 4.0.0-next-1777463920154 → 4.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/config/validators.ts","../../examples/flow-complete.json","../../examples/flow-simple.json","../../src/examples/index.ts"],"sourcesContent":["/**\n * Configuration Type Guards and Validators\n *\n * Type checking utilities for configuration validation.\n * Uses Zod schemas from @walkeros/core for Flow.Json validation.\n */\n\nimport type { Flow } from '@walkeros/core';\nimport { isObject } from '@walkeros/core';\nimport { schemas } from '@walkeros/core/dev';\n\nconst { safeParseConfig } = schemas;\n\n/**\n * Detect platform from a single flow.\n *\n * Platform is determined by `flow.config.platform`.\n */\nexport function detectPlatform(\n flow: Record<string, unknown>,\n): 'web' | 'server' | undefined {\n const config = flow.config;\n if (!isObject(config)) return undefined;\n const platform = config.platform;\n if (platform === 'web' || platform === 'server') return platform;\n return undefined;\n}\n\n/**\n * Type guard: Check if config is a valid Flow.Json structure.\n *\n * @remarks\n * Uses Zod validation from @walkeros/core.\n * Returns false instead of throwing on invalid input.\n *\n * @example\n * ```typescript\n * if (isFlowConfig(config)) {\n * const flowSettings = getFlowSettings(config, 'production');\n * }\n * ```\n */\nexport function isFlowConfig(data: unknown): data is Flow.Json {\n const result = safeParseConfig(data);\n return result.success;\n}\n\n/**\n * Validate Flow.Json and throw descriptive error if invalid.\n *\n * @remarks\n * Uses Zod validation from @walkeros/core.\n * Provides detailed error messages from Zod.\n *\n * @param data - Raw configuration data\n * @returns Validated Flow.Json\n * @throws Error with descriptive message if validation fails\n */\nexport function validateFlowConfig(data: unknown): Flow.Json {\n // After successful Zod parse, the data conforms structurally to Flow.Json.\n // The existing `isFlowConfig` guard re-narrows `unknown` to `Flow.Json` via\n // the same schema — TS can't see through `safeParseConfig` because it\n // returns a Zod-inferred type that differs nominally (not structurally)\n // from the Flow.Json interface.\n if (isFlowConfig(data)) return data;\n\n // Not parseable — format Zod errors for CLI display.\n const result = safeParseConfig(data);\n if (result.success) {\n // Defensive: isFlowConfig and safeParseConfig disagreed (cannot happen).\n throw new Error('Invalid configuration: failed Flow.Json type guard.');\n }\n const errors = result.error.issues\n .map((issue) => {\n const path =\n issue.path.length > 0 ? issue.path.map(String).join('.') : 'root';\n return ` - ${path}: ${issue.message}`;\n })\n .join('\\n');\n throw new Error(`Invalid configuration:\\n${errors}`);\n}\n\n/**\n * Get available flow names from a Flow.Json.\n *\n * @param config - Flow.Json configuration\n * @returns Array of flow names\n */\nexport function getAvailableFlows(config: Flow.Json): string[] {\n return Object.keys(config.flows);\n}\n","{\n \"$schema\": \"https://walkeros.io/schema/flow/v4.json\",\n \"version\": 4,\n \"variables\": {\n \"currency\": \"EUR\",\n \"flowVersion\": \"1.0.0\",\n \"ga4MeasurementId\": \"$env.GA4_MEASUREMENT_ID:G-DEMO123456\",\n \"apiUrl\": \"$env.API_URL:http://localhost:8080/collect\"\n },\n \"definitions\": {\n \"ga4ItemsLoop\": {\n \"loop\": [\n \"nested\",\n {\n \"condition\": \"$code:(value, context) => value.entity === 'product'\",\n \"map\": {\n \"item_id\": \"data.id\",\n \"item_name\": \"data.name\",\n \"price\": \"data.price\",\n \"quantity\": {\n \"key\": \"data.quantity\",\n \"value\": 1\n }\n }\n }\n ]\n },\n \"metaContentsLoop\": {\n \"loop\": [\n \"nested\",\n {\n \"map\": {\n \"id\": \"data.id\",\n \"item_price\": \"data.price\",\n \"quantity\": {\n \"key\": \"data.quantity\",\n \"value\": 1\n }\n }\n }\n ]\n }\n },\n \"contract\": {\n \"default\": {\n \"description\": \"Web shop tracking contract\",\n \"globals\": {\n \"type\": \"object\",\n \"properties\": {\n \"environment\": {\n \"type\": \"string\"\n },\n \"version\": {\n \"type\": \"string\"\n }\n }\n },\n \"consent\": {\n \"type\": \"object\",\n \"required\": [\"functional\"],\n \"properties\": {\n \"functional\": {\n \"type\": \"boolean\",\n \"const\": true\n }\n }\n },\n \"events\": {\n \"product\": {\n \"*\": {\n \"description\": \"A product in the catalog\",\n \"properties\": {\n \"data\": {\n \"type\": \"object\",\n \"required\": [\"id\", \"name\"],\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"Product SKU\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Display name\"\n }\n }\n }\n }\n },\n \"add\": {\n \"description\": \"Product added to cart\",\n \"properties\": {\n \"data\": {\n \"type\": \"object\",\n \"required\": [\"quantity\"],\n \"properties\": {\n \"quantity\": {\n \"type\": \"integer\",\n \"minimum\": 1\n }\n }\n }\n }\n }\n },\n \"order\": {\n \"complete\": {\n \"description\": \"Purchase completed\",\n \"properties\": {\n \"data\": {\n \"type\": \"object\",\n \"required\": [\"id\", \"total\"],\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"total\": {\n \"type\": \"number\",\n \"minimum\": 0\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"flows\": {\n \"web\": {\n \"sources\": {\n \"browser\": {\n \"package\": \"@walkeros/web-source-browser\",\n \"primary\": true,\n \"config\": {\n \"settings\": {\n \"prefix\": \"data-elb\",\n \"pageview\": true,\n \"session\": {\n \"consent\": {\n \"marketing\": true\n }\n },\n \"elb\": \"elb\",\n \"elbLayer\": true\n }\n }\n },\n \"dataLayer\": {\n \"package\": \"@walkeros/web-source-datalayer\",\n \"next\": \"enricher\",\n \"config\": {\n \"require\": [\"session\"],\n \"settings\": {\n \"name\": \"dataLayer\",\n \"prefix\": \"gtag\"\n },\n \"mapping\": {\n \"add_to_cart\": {\n \"*\": {\n \"name\": \"product add\",\n \"data\": {\n \"map\": {\n \"id\": \"items.0.item_id\",\n \"name\": \"items.0.item_name\",\n \"price\": \"items.0.price\",\n \"currency\": \"currency\",\n \"quantity\": {\n \"key\": \"items.0.quantity\",\n \"value\": 1\n }\n }\n }\n }\n },\n \"purchase\": {\n \"*\": {\n \"name\": \"order complete\",\n \"data\": {\n \"map\": {\n \"id\": \"transaction_id\",\n \"total\": \"value\",\n \"currency\": \"currency\",\n \"tax\": \"tax\",\n \"shipping\": \"shipping\"\n }\n }\n }\n }\n }\n }\n },\n \"demo\": {\n \"package\": \"@walkeros/source-demo\",\n \"config\": {\n \"settings\": {\n \"events\": [\n {\n \"name\": \"page view\",\n \"data\": {\n \"title\": \"Home\",\n \"path\": \"/\"\n },\n \"delay\": 0\n },\n {\n \"name\": \"product view\",\n \"data\": {\n \"id\": \"SKU-001\",\n \"name\": \"Blue Shirt\",\n \"price\": 49.99,\n \"currency\": \"EUR\",\n \"category\": \"Clothing\"\n },\n \"delay\": 300\n },\n {\n \"name\": \"product add\",\n \"data\": {\n \"id\": \"SKU-001\",\n \"name\": \"Blue Shirt\",\n \"price\": 49.99,\n \"currency\": \"EUR\",\n \"quantity\": 2\n },\n \"delay\": 600\n },\n {\n \"name\": \"test debug\",\n \"data\": {\n \"message\": \"This should be ignored\"\n },\n \"delay\": 800\n },\n {\n \"name\": \"order complete\",\n \"data\": {\n \"id\": \"ORD-123\",\n \"total\": 149.97,\n \"currency\": \"EUR\",\n \"tax\": 12.5,\n \"shipping\": 5.99\n },\n \"user\": {\n \"email\": \"customer@example.com\",\n \"id\": \"U-456\",\n \"device\": \"d3v1c3\",\n \"session\": \"s3ss10n\"\n },\n \"nested\": [\n {\n \"entity\": \"product\",\n \"data\": {\n \"id\": \"SKU-001\",\n \"name\": \"Blue Shirt\",\n \"price\": 49.99,\n \"quantity\": 2\n }\n },\n {\n \"entity\": \"product\",\n \"data\": {\n \"id\": \"SKU-002\",\n \"name\": \"Red Cap\",\n \"price\": 24.99,\n \"quantity\": 1\n }\n }\n ],\n \"delay\": 1000\n }\n ]\n }\n }\n }\n },\n \"transformers\": {\n \"enricher\": {\n \"code\": {\n \"type\": \"enricher\",\n \"push\": \"$code:(event) => ({ ...event, context: { ...event.context, enrichedAt: Date.now() } })\"\n },\n \"next\": \"dataLayerValidator\",\n \"config\": {}\n },\n \"dataLayerValidator\": {\n \"package\": \"@walkeros/transformer-validator\",\n \"config\": {\n \"settings\": {\n \"events\": \"$contract.default.events\",\n \"globals\": \"$contract.default.globals\"\n }\n }\n }\n },\n \"destinations\": {\n \"ga4\": {\n \"package\": \"@walkeros/web-destination-gtag\",\n \"config\": {\n \"require\": [\"consent\", \"user\"],\n \"consent\": {\n \"marketing\": true\n },\n \"settings\": {\n \"ga4\": {\n \"measurementId\": \"$var.ga4MeasurementId\"\n }\n },\n \"mapping\": {\n \"page\": {\n \"view\": {\n \"name\": \"page_view\",\n \"data\": {\n \"map\": {\n \"page_title\": \"data.title\",\n \"page_location\": \"data.path\"\n }\n }\n }\n },\n \"product\": {\n \"view\": {\n \"name\": \"view_item\",\n \"data\": {\n \"map\": {\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"$var.currency\"\n },\n \"value\": \"data.price\",\n \"items\": {\n \"loop\": [\n \"this\",\n {\n \"map\": {\n \"item_id\": [\n {\n \"key\": \"data.sku\"\n },\n {\n \"key\": \"data.id\"\n }\n ],\n \"item_name\": \"data.name\",\n \"item_category\": \"data.category\",\n \"price\": \"data.price\"\n }\n }\n ]\n }\n }\n }\n },\n \"add\": {\n \"name\": \"add_to_cart\",\n \"data\": {\n \"map\": {\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"$var.currency\"\n },\n \"value\": \"data.price\",\n \"items\": {\n \"loop\": [\n \"this\",\n {\n \"map\": {\n \"item_id\": \"data.id\",\n \"item_name\": \"data.name\",\n \"quantity\": {\n \"key\": \"data.quantity\",\n \"value\": 1\n }\n }\n }\n ]\n }\n }\n }\n }\n },\n \"order\": {\n \"complete\": {\n \"name\": \"purchase\",\n \"data\": {\n \"map\": {\n \"transaction_id\": \"data.id\",\n \"value\": {\n \"key\": \"data.total\",\n \"fn\": \"$code:(v) => Math.round(v * 100)\"\n },\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"$var.currency\"\n },\n \"tax\": \"data.tax\",\n \"shipping\": \"data.shipping\",\n \"items\": \"$def.ga4ItemsLoop\"\n }\n }\n }\n },\n \"test\": {\n \"*\": {\n \"ignore\": true\n }\n }\n }\n },\n \"examples\": {\n \"page-view\": {\n \"in\": {\n \"name\": \"page view\",\n \"data\": {\n \"title\": \"Home\",\n \"path\": \"/\"\n },\n \"entity\": \"page\",\n \"action\": \"view\"\n },\n \"mapping\": {\n \"name\": \"page_view\",\n \"data\": {\n \"map\": {\n \"page_title\": \"data.title\",\n \"page_location\": \"data.path\"\n }\n }\n },\n \"out\": [\n \"event\",\n \"page_view\",\n {\n \"page_title\": \"Home\",\n \"page_location\": \"/\"\n }\n ]\n },\n \"product-add\": {\n \"in\": {\n \"name\": \"product add\",\n \"data\": {\n \"id\": \"SKU-001\",\n \"name\": \"Blue Shirt\",\n \"price\": 49.99,\n \"currency\": \"EUR\",\n \"quantity\": 2\n },\n \"entity\": \"product\",\n \"action\": \"add\"\n },\n \"mapping\": {\n \"name\": \"add_to_cart\",\n \"data\": {\n \"map\": {\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"EUR\"\n },\n \"value\": \"data.price\",\n \"items\": {\n \"loop\": [\n \"this\",\n {\n \"map\": {\n \"item_id\": \"data.id\",\n \"item_name\": \"data.name\",\n \"quantity\": {\n \"key\": \"data.quantity\",\n \"value\": 1\n }\n }\n }\n ]\n }\n }\n }\n },\n \"out\": [\n \"event\",\n \"add_to_cart\",\n {\n \"currency\": \"EUR\",\n \"value\": 49.99,\n \"items\": [\n {\n \"item_id\": \"SKU-001\",\n \"item_name\": \"Blue Shirt\",\n \"quantity\": 2\n }\n ]\n }\n ]\n },\n \"test-ignored\": {\n \"in\": {\n \"name\": \"test debug\",\n \"data\": {\n \"message\": \"This should be ignored\"\n },\n \"entity\": \"test\",\n \"action\": \"debug\"\n },\n \"out\": false\n }\n }\n },\n \"api\": {\n \"package\": \"@walkeros/web-destination-api\",\n \"config\": {\n \"settings\": {\n \"url\": \"$var.apiUrl\",\n \"batch\": 5,\n \"transform\": \"$code:(data) => JSON.stringify(data)\"\n },\n \"data\": {\n \"map\": {\n \"sent_at\": {\n \"fn\": \"$code:() => Date.now()\"\n },\n \"flow_version\": \"$var.flowVersion\"\n }\n },\n \"mapping\": {\n \"order\": {\n \"complete\": {\n \"data\": {\n \"map\": {\n \"transaction_id\": \"data.id\",\n \"value\": \"data.total\",\n \"currency\": \"data.currency\",\n \"user_email\": {\n \"key\": \"user.email\",\n \"consent\": {\n \"marketing\": true\n }\n },\n \"items\": \"$def.ga4ItemsLoop\"\n }\n }\n }\n },\n \"test\": {\n \"*\": {\n \"ignore\": true\n }\n }\n }\n }\n },\n \"debug\": {\n \"code\": {\n \"type\": \"debug-logger\",\n \"push\": \"$code:(event, ctx) => { ctx.logger.info('[DEBUG]', event.name, event.data); }\"\n },\n \"config\": {\n \"consent\": {}\n }\n }\n },\n \"collector\": {\n \"consent\": {\n \"functional\": true,\n \"marketing\": false\n },\n \"user\": {\n \"id\": \"anonymous\"\n },\n \"globals\": {\n \"environment\": \"demo\",\n \"version\": \"$var.flowVersion\"\n },\n \"custom\": {\n \"campaign\": \"flow-demo\"\n }\n },\n \"config\": {\n \"platform\": \"web\",\n \"settings\": {\n \"windowCollector\": \"collector\",\n \"windowElb\": \"elb\"\n },\n \"bundle\": {\n \"packages\": {\n \"@walkeros/collector\": {},\n \"@walkeros/web-source-browser\": {},\n \"@walkeros/web-source-datalayer\": {},\n \"@walkeros/source-demo\": {},\n \"@walkeros/web-destination-gtag\": {},\n \"@walkeros/web-destination-api\": {},\n \"@walkeros/transformer-validator\": {}\n }\n }\n }\n },\n \"server\": {\n \"variables\": {\n \"metaPixelId\": \"$env.META_PIXEL_ID:123456789012345\",\n \"metaAccessToken\": \"$env.META_ACCESS_TOKEN:demo_token\"\n },\n \"stores\": {\n \"cache\": {\n \"package\": \"@walkeros/store-memory\",\n \"config\": {\n \"settings\": {\n \"maxSize\": 10485760,\n \"maxEntries\": 1000\n }\n }\n }\n },\n \"sources\": {\n \"http\": {\n \"package\": \"@walkeros/server-source-express\",\n \"primary\": true,\n \"next\": [\"filter\"],\n \"cache\": {\n \"store\": \"cache\",\n \"rules\": [\n {\n \"match\": {\n \"key\": \"ingest.method\",\n \"operator\": \"eq\",\n \"value\": \"GET\"\n },\n \"key\": [\"ingest.method\", \"ingest.path\"],\n \"ttl\": 300,\n \"update\": {\n \"headers.X-Cache\": {\n \"key\": \"cache.status\"\n }\n }\n }\n ]\n },\n \"config\": {\n \"settings\": {\n \"path\": \"/collect\",\n \"port\": 8080,\n \"cors\": true,\n \"healthCheck\": true\n },\n \"ingest\": {\n \"context.ip\": \"ip\",\n \"context.userAgent\": \"headers.user-agent\",\n \"context.language\": \"headers.accept-language\",\n \"context.referer\": \"headers.referer\",\n \"context.anonymizedIp\": {\n \"key\": \"ip\",\n \"fn\": \"$code:(ip) => ip ? ip.replace(/\\\\.\\\\d+$/, '.0') : ''\"\n }\n }\n },\n \"examples\": {\n \"post-event\": {\n \"in\": {\n \"method\": \"POST\",\n \"path\": \"/collect\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"name\": \"page view\",\n \"data\": {\n \"title\": \"Home\",\n \"url\": \"https://example.com\"\n }\n }\n },\n \"out\": {\n \"name\": \"page view\",\n \"data\": {\n \"title\": \"Home\",\n \"url\": \"https://example.com\"\n },\n \"entity\": \"page\",\n \"action\": \"view\"\n }\n }\n }\n }\n },\n \"transformers\": {\n \"filter\": {\n \"code\": {\n \"type\": \"filter\",\n \"push\": \"$code:(event) => event.name.startsWith('internal_') || event.name.startsWith('debug_') ? false : event\"\n },\n \"next\": \"fingerprint\",\n \"env\": {\n \"store\": \"$store.cache\"\n },\n \"config\": {},\n \"examples\": {\n \"passes-normal\": {\n \"in\": {\n \"name\": \"page view\",\n \"data\": {\n \"title\": \"Home\"\n },\n \"entity\": \"page\",\n \"action\": \"view\"\n },\n \"out\": {\n \"name\": \"page view\",\n \"data\": {\n \"title\": \"Home\"\n },\n \"entity\": \"page\",\n \"action\": \"view\"\n }\n },\n \"filters-internal\": {\n \"in\": {\n \"name\": \"internal_heartbeat\",\n \"data\": {},\n \"entity\": \"internal\",\n \"action\": \"heartbeat\"\n },\n \"out\": false\n }\n }\n },\n \"fingerprint\": {\n \"package\": \"@walkeros/server-transformer-fingerprint\",\n \"next\": \"serverValidator\",\n \"config\": {\n \"settings\": {\n \"fields\": [\n \"context.ip\",\n \"context.userAgent\",\n \"context.language\",\n {\n \"fn\": \"$code:() => new Date().toISOString().slice(0, 10)\"\n }\n ],\n \"output\": \"user.hash\",\n \"length\": 16\n }\n }\n },\n \"serverValidator\": {\n \"package\": \"@walkeros/transformer-validator\",\n \"config\": {\n \"settings\": {\n \"format\": true,\n \"events\": \"$contract.default.events\",\n \"globals\": \"$contract.default.globals\",\n \"consent\": \"$contract.default.consent\"\n }\n }\n }\n },\n \"destinations\": {\n \"meta\": {\n \"package\": \"@walkeros/server-destination-meta\",\n \"before\": [\"fingerprint\", \"serverValidator\"],\n \"config\": {\n \"settings\": {\n \"pixelId\": \"$var.metaPixelId\",\n \"accessToken\": \"$var.metaAccessToken\",\n \"user_data\": {\n \"external_id\": {\n \"set\": [\"user.device\", \"user.session\"]\n }\n }\n },\n \"policy\": {\n \"user_data.em\": {\n \"key\": \"user.email\",\n \"consent\": {\n \"marketing\": true\n }\n },\n \"user_data.external_id\": \"user.id\",\n \"custom_data.server_processed\": {\n \"value\": true\n },\n \"custom_data.request_meta\": {\n \"map\": {\n \"ip\": \"context.ip\",\n \"ua\": \"context.userAgent\"\n }\n }\n },\n \"mapping\": {\n \"page\": {\n \"view\": {\n \"name\": \"PageView\",\n \"data\": \"data\"\n }\n },\n \"product\": {\n \"view\": {\n \"name\": \"ViewContent\",\n \"data\": {\n \"map\": {\n \"value\": \"data.price\",\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"$var.currency\"\n },\n \"content_type\": {\n \"value\": \"product\"\n },\n \"content_ids\": {\n \"set\": [\"data.id\"]\n }\n }\n }\n },\n \"add\": {\n \"name\": \"AddToCart\",\n \"data\": {\n \"map\": {\n \"value\": \"data.price\",\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"$var.currency\"\n },\n \"content_type\": {\n \"value\": \"product\"\n },\n \"contents\": {\n \"loop\": [\n \"this\",\n {\n \"map\": {\n \"id\": \"data.id\",\n \"quantity\": {\n \"key\": \"data.quantity\",\n \"value\": 1\n }\n }\n }\n ]\n }\n }\n }\n }\n },\n \"order\": {\n \"complete\": {\n \"name\": \"Purchase\",\n \"data\": {\n \"map\": {\n \"value\": \"data.total\",\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"$var.currency\"\n },\n \"order_id\": \"data.id\",\n \"contents\": \"$def.metaContentsLoop\"\n }\n }\n }\n },\n \"test\": {\n \"*\": {\n \"ignore\": true\n }\n },\n \"*\": {\n \"click\": {\n \"name\": \"CustomEvent\",\n \"data\": \"data\"\n }\n }\n }\n },\n \"examples\": {\n \"purchase\": {\n \"in\": {\n \"name\": \"order complete\",\n \"data\": {\n \"id\": \"ORD-123\",\n \"total\": 149.97,\n \"currency\": \"EUR\"\n },\n \"entity\": \"order\",\n \"action\": \"complete\"\n },\n \"mapping\": {\n \"name\": \"Purchase\",\n \"data\": {\n \"map\": {\n \"value\": \"data.total\",\n \"currency\": {\n \"key\": \"data.currency\",\n \"value\": \"EUR\"\n },\n \"order_id\": \"data.id\"\n }\n }\n },\n \"out\": {\n \"data\": [\n {\n \"event_name\": \"Purchase\",\n \"custom_data\": {\n \"value\": 149.97,\n \"currency\": \"EUR\",\n \"order_id\": \"ORD-123\"\n }\n }\n ]\n }\n }\n }\n },\n \"demo\": {\n \"package\": \"@walkeros/destination-demo\",\n \"config\": {\n \"settings\": {\n \"name\": \"Server Events\",\n \"values\": [\"name\", \"data\", \"nested\", \"user\", \"consent\", \"context\"]\n }\n }\n }\n },\n \"collector\": {\n \"consent\": {\n \"functional\": true\n },\n \"globals\": {\n \"environment\": \"demo\",\n \"version\": \"$var.flowVersion\",\n \"platform\": \"server\",\n \"startedAt\": \"$code:Date.now()\"\n }\n },\n \"config\": {\n \"platform\": \"server\",\n \"bundle\": {\n \"packages\": {\n \"@walkeros/core\": {\n \"path\": \"../../core\"\n },\n \"@walkeros/collector\": {\n \"path\": \"../../collector\"\n },\n \"@walkeros/server-source-express\": {},\n \"@walkeros/server-destination-meta\": {},\n \"@walkeros/destination-demo\": {},\n \"@walkeros/transformer-validator\": {},\n \"@walkeros/server-transformer-fingerprint\": {},\n \"@walkeros/store-memory\": {\n \"path\": \"../../stores/memory\"\n }\n }\n }\n }\n }\n }\n}\n","{\n \"version\": 4,\n \"flows\": {\n \"default\": {\n \"destinations\": {\n \"demo\": {\n \"package\": \"@walkeros/destination-demo\",\n \"config\": {\n \"settings\": {\n \"name\": \"Simple Demo\",\n \"values\": [\"name\", \"data\", \"user\", \"consent\"]\n }\n }\n }\n },\n \"config\": {\n \"platform\": \"web\",\n \"bundle\": {\n \"packages\": {\n \"@walkeros/collector\": {\n \"version\": \"latest\",\n \"imports\": [\"startFlow\"]\n },\n \"@walkeros/destination-demo\": {\n \"version\": \"latest\"\n }\n }\n }\n }\n }\n }\n}\n","/**\n * Typed re-exports of bundled example flow configurations.\n *\n * Importing JSON files via `resolveJsonModule` produces a deeply structural\n * type whose literals are widened (`version: number` instead of `4`,\n * `platform: string` instead of `'web' | 'server'`). That widened shape is\n * not assignable to `Flow.Json` and forces every consumer to cast away to\n * `Record<string, unknown>`, losing all type information about the example.\n *\n * Routing the imports through `validateFlowConfig` (a real type guard backed\n * by the canonical Zod schema in `@walkeros/core`) launders the JSON into a\n * proper `Flow.Json` value with no `as` cast at any call site:\n *\n * - The Zod parser checks the structure at module load time. If an example\n * drifts away from the schema, the package fails to load loudly instead\n * of producing a silently broken value.\n * - The return type is `Flow.Json` (the canonical interface), not the Zod\n * inferred shape, because `validateFlowConfig` uses `isFlowConfig` as a\n * `data is Flow.Json` type predicate.\n *\n * Pattern choice (`: Flow.Json` annotation via runtime validator) was picked\n * over `satisfies Flow.Json` and `as const satisfies Flow.Json` because:\n *\n * - `: Flow.Json` annotation alone fails: the JSON's widened literals do\n * not satisfy the literal constraints (`version: 4`, platform unions).\n * - `satisfies Flow.Json` fails for the same reason.\n * - `as const satisfies Flow.Json` cannot be applied to a JSON import\n * (TypeScript does not support `as const` on imported values).\n * - A wrapper-function or runtime-validator approach is the only pattern\n * that produces a `Flow.Json`-typed value without an `as` cast anywhere\n * in the chain. It also gives consumers a load-time correctness check\n * for free.\n *\n * Cost: one Zod parse per example at module init. Examples are loaded by\n * tests, MCP servers, and dev seed scripts. None are perf-critical.\n */\n\nimport { validateFlowConfig } from '../config/validators.js';\n\nimport flowCompleteImport from '../../examples/flow-complete.json';\nimport flowSimpleImport from '../../examples/flow-simple.json';\n\nexport const flowComplete = validateFlowConfig(flowCompleteImport);\nexport const flowSimple = validateFlowConfig(flowSimpleImport);\n"],"mappings":";AAQA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AAExB,IAAM,EAAE,gBAAgB,IAAI;AA+BrB,SAAS,aAAa,MAAkC;AAC7D,QAAM,SAAS,gBAAgB,IAAI;AACnC,SAAO,OAAO;AAChB;AAaO,SAAS,mBAAmB,MAA0B;AAM3D,MAAI,aAAa,IAAI,EAAG,QAAO;AAG/B,QAAM,SAAS,gBAAgB,IAAI;AACnC,MAAI,OAAO,SAAS;AAElB,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,QAAM,SAAS,OAAO,MAAM,OACzB,IAAI,CAAC,UAAU;AACd,UAAM,OACJ,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,MAAM,EAAE,KAAK,GAAG,IAAI;AAC7D,WAAO,OAAO,IAAI,KAAK,MAAM,OAAO;AAAA,EACtC,CAAC,EACA,KAAK,IAAI;AACZ,QAAM,IAAI,MAAM;AAAA,EAA2B,MAAM,EAAE;AACrD;;;AChFA;AAAA,EACE,SAAW;AAAA,EACX,SAAW;AAAA,EACX,WAAa;AAAA,IACX,UAAY;AAAA,IACZ,aAAe;AAAA,IACf,kBAAo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e;AAAA,UACf,SAAW;AAAA,UACX,UAAY;AAAA,UACZ,WAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,QAAU;AAAA,QACR,UAAY;AAAA,QACZ,QAAU;AAAA,UACR,UAAY;AAAA,YACV,kBAAkB;AAAA,cAChB,MAAQ;AAAA,YACV;AAAA,YACA,uBAAuB;AAAA,cACrB,MAAQ;AAAA,YACV;AAAA,YACA,mCAAmC,CAAC;AAAA,YACpC,qCAAqC,CAAC;AAAA,YACtC,8BAA8B,CAAC;AAAA,YAC/B,mCAAmC,CAAC;AAAA,YACpC,4CAA4C,CAAC;AAAA,YAC7C,0BAA0B;AAAA,cACxB,MAAQ;AAAA,YACV;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACz7BA;AAAA,EACE,SAAW;AAAA,EACX,OAAS;AAAA,IACP,SAAW;AAAA,MACT,cAAgB;AAAA,QACd,MAAQ;AAAA,UACN,SAAW;AAAA,UACX,QAAU;AAAA,YACR,UAAY;AAAA,cACV,MAAQ;AAAA,cACR,QAAU,CAAC,QAAQ,QAAQ,QAAQ,SAAS;AAAA,YAC9C;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,QAAU;AAAA,QACR,UAAY;AAAA,QACZ,QAAU;AAAA,UACR,UAAY;AAAA,YACV,uBAAuB;AAAA,cACrB,SAAW;AAAA,cACX,SAAW,CAAC,WAAW;AAAA,YACzB;AAAA,YACA,8BAA8B;AAAA,cAC5B,SAAW;AAAA,YACb;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACWO,IAAM,eAAe,mBAAmB,qBAAkB;AAC1D,IAAM,aAAa,mBAAmB,mBAAgB;","names":[]}
package/dist/index.d.ts CHANGED
@@ -336,6 +336,11 @@ interface PushResult {
336
336
  }>>;
337
337
  /** Network calls captured during web simulation (fetch + sendBeacon) */
338
338
  networkCalls?: NetworkCall[];
339
+ /**
340
+ * Per-destination simulation results when --simulate destination.* is
341
+ * called with multiple ids. Undefined for single-target or non-simulate runs.
342
+ */
343
+ perDestination?: Record<string, PushResult>;
339
344
  duration: number;
340
345
  error?: string;
341
346
  }
@@ -360,7 +365,11 @@ declare const PushOptionsSchema: z.ZodObject<{
360
365
  type PushOptions = z.infer<typeof PushOptionsSchema>;
361
366
 
362
367
  /**
363
- * CLI command handler for push command
368
+ * CLI command handler for push command.
369
+ *
370
+ * Thin wrapper around `runPushCommand`: delegates result production to the
371
+ * pure helper, then formats output and decides the exit code. Tests target
372
+ * `runPushCommand` directly to avoid `process.exit` killing Jest workers.
364
373
  */
365
374
  declare function pushCommand(options: PushCommandOptions): Promise<void>;
366
375
  /**
package/dist/index.js CHANGED
@@ -3401,7 +3401,51 @@ function installTimerInterception(options = {}) {
3401
3401
  }
3402
3402
  pending.clear();
3403
3403
  }
3404
- return { flush, countPending, restore };
3404
+ return { flush, countPending, restore, pending };
3405
+ }
3406
+
3407
+ // src/commands/push/async-drain-pump.ts
3408
+ var realSetImmediate = setImmediate;
3409
+ var DEFAULT_MAX_ITERATIONS = 1e3;
3410
+ var DEFAULT_MAX_WALL_MS = 3e4;
3411
+ var intervalRequeueCounter = -1;
3412
+ function startDrainPump(pending, options = {}) {
3413
+ const maxIterations = options.maxIterations ?? DEFAULT_MAX_ITERATIONS;
3414
+ const maxWallMs = options.maxWallMs ?? DEFAULT_MAX_WALL_MS;
3415
+ const start = Date.now();
3416
+ let running = true;
3417
+ let iterations = 0;
3418
+ const tick = () => {
3419
+ if (!running) return;
3420
+ if (iterations >= maxIterations) return;
3421
+ if (Date.now() - start > maxWallMs) return;
3422
+ if (pending.size === 0) {
3423
+ realSetImmediate(tick);
3424
+ return;
3425
+ }
3426
+ iterations += 1;
3427
+ const snapshot = [...pending.values()].filter((t) => !t.cleared).sort((a, b) => a.delay - b.delay);
3428
+ for (const timer of snapshot) {
3429
+ pending.delete(timer.id);
3430
+ try {
3431
+ timer.callback(...timer.args);
3432
+ } catch (err) {
3433
+ console.warn(`[async-drain] timer ${timer.id} threw during pump:`, err);
3434
+ }
3435
+ if (timer.type === "interval" && !timer.cleared) {
3436
+ const requeued = {
3437
+ ...timer,
3438
+ id: intervalRequeueCounter--
3439
+ };
3440
+ pending.set(requeued.id, requeued);
3441
+ }
3442
+ }
3443
+ realSetImmediate(tick);
3444
+ };
3445
+ realSetImmediate(tick);
3446
+ return () => {
3447
+ running = false;
3448
+ };
3405
3449
  }
3406
3450
 
3407
3451
  // src/commands/push/flow-context.ts
@@ -3413,7 +3457,8 @@ async function withFlowContext(options, fn) {
3413
3457
  snapshotCode,
3414
3458
  timeout,
3415
3459
  networkCalls,
3416
- asyncDrain
3460
+ asyncDrain,
3461
+ drainPump
3417
3462
  } = options;
3418
3463
  const startTime = Date.now();
3419
3464
  const g = global;
@@ -3476,7 +3521,13 @@ async function withFlowContext(options, fn) {
3476
3521
  __devExports: module.__devExports
3477
3522
  };
3478
3523
  if (timerControl) {
3479
- const result = await fn(flowModule);
3524
+ const stopPump = drainPump ? startDrainPump(timerControl.pending) : null;
3525
+ let result;
3526
+ try {
3527
+ result = await fn(flowModule);
3528
+ } finally {
3529
+ if (stopPump) stopPump();
3530
+ }
3480
3531
  await timerControl.flush(asyncDrain?.timeout ?? 5e3);
3481
3532
  return result;
3482
3533
  } else if (timeout) {
@@ -3620,6 +3671,145 @@ async function prepareFlow(input) {
3620
3671
 
3621
3672
  // src/commands/push/index.ts
3622
3673
  import { schemas as schemas3 } from "@walkeros/core/dev";
3674
+
3675
+ // src/commands/push/plan-simulate.ts
3676
+ function planSimulate(flags) {
3677
+ if (flags.length === 0) return { kind: "none", ids: [] };
3678
+ const parsed = flags.map((flag) => {
3679
+ const step = parseStep(flag);
3680
+ if (step.chainType) {
3681
+ throw new Error(
3682
+ `--simulate "${flag}": chain syntax (${step.type}.${step.name}.${step.chainType}.\u2026) is not supported for --simulate. Use --mock for path-specific overrides.`
3683
+ );
3684
+ }
3685
+ return step;
3686
+ });
3687
+ const types = new Set(parsed.map((p) => p.type));
3688
+ if (types.size > 1) {
3689
+ const sorted = [...types].sort();
3690
+ throw new Error(
3691
+ `Cannot --simulate ${sorted.join(" and ")} in the same invocation. Run separate commands for each step type.`
3692
+ );
3693
+ }
3694
+ const [type] = types;
3695
+ const ids = [...new Set(parsed.map((p) => p.name))];
3696
+ if ((type === "source" || type === "transformer") && ids.length > 1) {
3697
+ throw new Error(
3698
+ `--simulate ${type}.* expects a single target; got ${ids.length}. Run one --simulate ${type}.NAME per invocation.`
3699
+ );
3700
+ }
3701
+ return { kind: type, ids };
3702
+ }
3703
+
3704
+ // src/commands/push/dispatch-simulate.ts
3705
+ function dispatchSimulate(flags) {
3706
+ const plan = planSimulate(flags);
3707
+ return { route: plan.kind, ids: plan.ids };
3708
+ }
3709
+
3710
+ // src/commands/push/run.ts
3711
+ init_core();
3712
+ init_config();
3713
+ async function runPushCommand(options) {
3714
+ const startTime = Date.now();
3715
+ try {
3716
+ const plan = dispatchSimulate(options.simulate ?? []);
3717
+ let config;
3718
+ if (isStdinPiped() && !options.config) {
3719
+ config = await readStdinToTempFile("push");
3720
+ } else {
3721
+ config = options.config || "bundle.config.json";
3722
+ }
3723
+ let resolvedEvent = options.event;
3724
+ if (typeof options.event === "string") {
3725
+ resolvedEvent = await loadJsonFromSource(options.event, {
3726
+ name: "event"
3727
+ });
3728
+ }
3729
+ let result;
3730
+ switch (plan.route) {
3731
+ case "none":
3732
+ result = await push(config, resolvedEvent, {
3733
+ flow: options.flow,
3734
+ json: options.json,
3735
+ verbose: options.verbose,
3736
+ silent: options.silent,
3737
+ platform: options.platform,
3738
+ mock: options.mock,
3739
+ snapshot: options.snapshot
3740
+ });
3741
+ break;
3742
+ case "source":
3743
+ result = await simulateSource(config, resolvedEvent, {
3744
+ sourceId: plan.ids[0],
3745
+ flow: options.flow,
3746
+ silent: options.silent,
3747
+ verbose: options.verbose,
3748
+ snapshot: options.snapshot
3749
+ });
3750
+ break;
3751
+ case "transformer":
3752
+ result = await simulateTransformer(
3753
+ config,
3754
+ resolvedEvent,
3755
+ {
3756
+ transformerId: plan.ids[0],
3757
+ flow: options.flow,
3758
+ mock: options.mock,
3759
+ silent: options.silent,
3760
+ verbose: options.verbose,
3761
+ snapshot: options.snapshot
3762
+ }
3763
+ );
3764
+ break;
3765
+ case "destination":
3766
+ result = await runDestinationSimulationLoop(
3767
+ config,
3768
+ resolvedEvent,
3769
+ plan.ids,
3770
+ options
3771
+ );
3772
+ break;
3773
+ }
3774
+ return result;
3775
+ } catch (error) {
3776
+ return {
3777
+ success: false,
3778
+ duration: Date.now() - startTime,
3779
+ error: getErrorMessage(error)
3780
+ };
3781
+ }
3782
+ }
3783
+ async function runDestinationSimulationLoop(config, event, destinationIds, options) {
3784
+ const startTime = Date.now();
3785
+ const perDestination = {};
3786
+ for (const destinationId of destinationIds) {
3787
+ const r = await simulateDestination(config, event, {
3788
+ destinationId,
3789
+ flow: options.flow,
3790
+ mock: options.mock,
3791
+ silent: options.silent,
3792
+ verbose: options.verbose,
3793
+ snapshot: options.snapshot
3794
+ });
3795
+ perDestination[destinationId] = r;
3796
+ if (!r.success) {
3797
+ return {
3798
+ success: false,
3799
+ duration: Date.now() - startTime,
3800
+ error: `simulate destination.${destinationId}: ${r.error ?? "unknown error"}`,
3801
+ perDestination
3802
+ };
3803
+ }
3804
+ }
3805
+ return {
3806
+ success: true,
3807
+ duration: Date.now() - startTime,
3808
+ perDestination
3809
+ };
3810
+ }
3811
+
3812
+ // src/commands/push/index.ts
3623
3813
  function resolveBeforeChain(before, transformers, ingest, event) {
3624
3814
  if (!before) return [];
3625
3815
  const next = before;
@@ -3698,108 +3888,32 @@ async function pushCore(inputPath, event, options = {}) {
3698
3888
  }
3699
3889
  }
3700
3890
  async function pushCommand(options) {
3701
- const logger = createCLILogger({ ...options, stderr: true });
3702
- const startTime = Date.now();
3703
- try {
3704
- let config;
3705
- if (isStdinPiped() && !options.config) {
3706
- config = await readStdinToTempFile("push");
3707
- } else {
3708
- config = options.config || "bundle.config.json";
3709
- }
3710
- let resolvedEvent = options.event;
3711
- if (typeof options.event === "string") {
3712
- resolvedEvent = await loadJsonFromSource(options.event, {
3713
- name: "event"
3714
- });
3715
- }
3716
- const simulateFlag = options.simulate?.[0];
3717
- let result;
3718
- if (simulateFlag?.startsWith("source.")) {
3719
- result = await simulateSource(config, resolvedEvent, {
3720
- sourceId: simulateFlag.replace("source.", ""),
3721
- flow: options.flow,
3722
- silent: options.silent,
3723
- verbose: options.verbose,
3724
- snapshot: options.snapshot
3725
- });
3726
- } else if (simulateFlag?.startsWith("transformer.")) {
3727
- result = await simulateTransformer(
3728
- config,
3729
- resolvedEvent,
3730
- {
3731
- transformerId: simulateFlag.replace("transformer.", ""),
3732
- flow: options.flow,
3733
- mock: options.mock,
3734
- silent: options.silent,
3735
- verbose: options.verbose,
3736
- snapshot: options.snapshot
3737
- }
3738
- );
3739
- } else if (simulateFlag?.startsWith("destination.")) {
3740
- result = await simulateDestination(
3741
- config,
3742
- resolvedEvent,
3743
- {
3744
- destinationId: simulateFlag.replace("destination.", ""),
3745
- flow: options.flow,
3746
- mock: options.mock,
3747
- silent: options.silent,
3748
- verbose: options.verbose,
3749
- snapshot: options.snapshot
3750
- }
3751
- );
3752
- } else {
3753
- result = await push(config, resolvedEvent, {
3754
- flow: options.flow,
3755
- json: options.json,
3756
- verbose: options.verbose,
3757
- silent: options.silent,
3758
- platform: options.platform,
3759
- mock: options.mock,
3760
- snapshot: options.snapshot
3761
- });
3762
- }
3763
- const duration = Date.now() - startTime;
3764
- let output;
3765
- if (options.json) {
3766
- output = JSON.stringify({ ...result, duration }, null, 2);
3767
- } else {
3768
- const lines = [];
3769
- if (result.success) {
3770
- lines.push("Event pushed successfully");
3771
- if (result.elbResult && typeof result.elbResult === "object") {
3772
- const pushResult = result.elbResult;
3773
- if ("id" in pushResult && pushResult.id)
3774
- lines.push(` Event ID: ${pushResult.id}`);
3775
- if ("entity" in pushResult && pushResult.entity)
3776
- lines.push(` Entity: ${pushResult.entity}`);
3777
- if ("action" in pushResult && pushResult.action)
3778
- lines.push(` Action: ${pushResult.action}`);
3779
- }
3780
- lines.push(` Duration: ${duration}ms`);
3781
- } else {
3782
- lines.push(`Error: ${result.error}`);
3891
+ const result = await runPushCommand(options);
3892
+ const duration = result.duration;
3893
+ let output;
3894
+ if (options.json) {
3895
+ output = JSON.stringify({ ...result, duration }, null, 2);
3896
+ } else {
3897
+ const lines = [];
3898
+ if (result.success) {
3899
+ lines.push("Event pushed successfully");
3900
+ if (result.elbResult && typeof result.elbResult === "object") {
3901
+ const pushResult = result.elbResult;
3902
+ if ("id" in pushResult && pushResult.id)
3903
+ lines.push(` Event ID: ${pushResult.id}`);
3904
+ if ("entity" in pushResult && pushResult.entity)
3905
+ lines.push(` Entity: ${pushResult.entity}`);
3906
+ if ("action" in pushResult && pushResult.action)
3907
+ lines.push(` Action: ${pushResult.action}`);
3783
3908
  }
3784
- output = lines.join("\n");
3785
- }
3786
- await writeResult(output + "\n", { output: options.output });
3787
- process.exit(result.success ? 0 : 1);
3788
- } catch (error) {
3789
- const duration = Date.now() - startTime;
3790
- const errorMessage = getErrorMessage(error);
3791
- if (options.json) {
3792
- const errorOutput = JSON.stringify(
3793
- { success: false, error: errorMessage, duration },
3794
- null,
3795
- 2
3796
- );
3797
- await writeResult(errorOutput + "\n", { output: options.output });
3909
+ lines.push(` Duration: ${duration}ms`);
3798
3910
  } else {
3799
- logger.error(`Error: ${errorMessage}`);
3911
+ lines.push(`Error: ${result.error}`);
3800
3912
  }
3801
- process.exit(1);
3913
+ output = lines.join("\n");
3802
3914
  }
3915
+ await writeResult(output + "\n", { output: options.output });
3916
+ process.exit(result.success ? 0 : 1);
3803
3917
  }
3804
3918
  async function push(configOrPath, event, options = {}) {
3805
3919
  if (typeof configOrPath !== "string") {
@@ -3898,7 +4012,12 @@ async function executeDestinationPush(esmPath, event, logger, platform, override
3898
4012
  snapshotCode,
3899
4013
  timeout,
3900
4014
  networkCalls,
3901
- asyncDrain: { timeout: 5e3 }
4015
+ asyncDrain: { timeout: 5e3 },
4016
+ // Real push (non-simulate) needs the pump so destinations whose init
4017
+ // awaits a captured setTimeout (e.g., amplitude engagement plugin)
4018
+ // don't deadlock. Simulate routes use their own withFlowContext call
4019
+ // sites without `drainPump`, preserving snapshot ordering.
4020
+ drainPump: true
3902
4021
  },
3903
4022
  async (module) => {
3904
4023
  const config = module.wireConfig(module.__configData ?? void 0);
@@ -5752,7 +5871,7 @@ function validateMapping(input) {
5752
5871
  // src/commands/validate/validators/entry.ts
5753
5872
  import Ajv from "ajv";
5754
5873
  import { fetchPackageSchema } from "@walkeros/core";
5755
- var CLIENT_HEADER = "walkeros-cli/4.0.0-next-1777463920154";
5874
+ var CLIENT_HEADER = "walkeros-cli/4.0.0";
5756
5875
  var SECTIONS = ["destinations", "sources", "transformers"];
5757
5876
  function resolveEntry(path19, flowConfig) {
5758
5877
  const flows = flowConfig.flows;
@@ -7525,9 +7644,6 @@ __export(telemetry_exports, {
7525
7644
  });
7526
7645
 
7527
7646
  // src/telemetry/emitter.ts
7528
- import { readFileSync as readFileSync4 } from "fs";
7529
- import { join as join6, dirname as dirname5 } from "path";
7530
- import { fileURLToPath as fileURLToPath2 } from "url";
7531
7647
  import { startFlow } from "@walkeros/collector";
7532
7648
  import { destinationAPI } from "@walkeros/server-destination-api";
7533
7649
 
@@ -7591,6 +7707,7 @@ function maybePrintFirstRunNotice() {
7591
7707
  }
7592
7708
 
7593
7709
  // src/telemetry/emitter.ts
7710
+ init_config_file();
7594
7711
  var SEND_TIMEOUT_MS = 1e3;
7595
7712
  async function createEmitter(opts) {
7596
7713
  if (!isTelemetryEnabled()) {
@@ -7608,7 +7725,7 @@ async function createEmitter(opts) {
7608
7725
  }
7609
7726
  const device = maybeDevice;
7610
7727
  const debug = isDebugMode();
7611
- const endpoint = process.env.TELEMETRY_ENDPOINT || loadFlowJsonEndpoint();
7728
+ const endpoint = resolveTelemetryEndpoint();
7612
7729
  if (!endpoint && !debug) {
7613
7730
  return {
7614
7731
  async send() {
@@ -7683,15 +7800,10 @@ async function createEmitter(opts) {
7683
7800
  }
7684
7801
  };
7685
7802
  }
7686
- function loadFlowJsonEndpoint() {
7687
- try {
7688
- const here = dirname5(fileURLToPath2(import.meta.url));
7689
- const raw = JSON.parse(readFileSync4(join6(here, "flow.json"), "utf-8"));
7690
- const url = raw.flows?.default?.destinations?.api?.config?.url;
7691
- if (url && !url.startsWith("$")) return url;
7692
- } catch {
7693
- }
7694
- return void 0;
7803
+ function resolveTelemetryEndpoint() {
7804
+ const appUrl = resolveAppUrl();
7805
+ if (!appUrl) return void 0;
7806
+ return `${appUrl.replace(/\/$/, "")}/api/telemetry`;
7695
7807
  }
7696
7808
  async function withTimeout2(p, ms) {
7697
7809
  return Promise.race([