@walkeros/server-destination-amplitude 3.4.0 → 3.4.1

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/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};a(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,a,s,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of i(a))r.call(e,p)||p===s||t(e,p,{get:()=>a[p],enumerable:!(o=n(a,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>v,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:u.z.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:u.z.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:u.z.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:u.z.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:u.z.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:u.z.array(u.z.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()}),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:l.z.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:l.z.array(l.z.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),m=(0,p.zodToSchema)(d),v=(0,p.zodToSchema)(c),y={};a(y,{env:()=>g,step:()=>I});var g={};a(g,{init:()=>O,push:()=>w,simulation:()=>k});var f=()=>{},h=()=>({promise:Promise.resolve()}),_=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},b=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},O={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},w={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},k=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],I={};a(I,{consentGrantOptIn:()=>D,consentRevokeOptOut:()=>G,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>P,eventOptionsTimeInsertId:()=>T,groupAssignmentWithProperties:()=>j,orderCompleteMultiProduct:()=>q,subscriptionRenewRevenue:()=>U,userLoginIdentify:()=>S,wildcardIgnored:()=>E});var z=require("@walkeros/core"),R={in:(0,z.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},E={in:(0,z.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},P={in:(0,z.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},A={in:(0,z.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:[["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]]},S={in:(0,z.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]]},U={in:(0,z.getEvent)("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},q={in:(0,z.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},j={in:(0,z.getEvent)("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},T={in:(0,z.getEvent)("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]]},G={command:"consent",in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!0]]},D={command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(e,i)=>{for(var n in i)t(e,n,{get:i[n],enumerable:!0})},s={};a(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,a,s,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of n(a))r.call(e,p)||p===s||t(e,p,{get:()=>a[p],enumerable:!(o=i(a,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>v,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:u.z.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:u.z.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:u.z.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:u.z.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:u.z.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:u.z.array(u.z.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()}),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:l.z.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:l.z.array(l.z.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),m=(0,p.zodToSchema)(d),v=(0,p.zodToSchema)(c),y={};a(y,{env:()=>g,step:()=>I});var g={};a(g,{init:()=>O,push:()=>w,simulation:()=>k});var f=()=>{},h=()=>({promise:Promise.resolve()}),_=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},b=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},O={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},w={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},k=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],I={};a(I,{consentGrantOptIn:()=>T,consentRevokeOptOut:()=>G,defaultEventForwarding:()=>A,destinationLevelIdentify:()=>P,destinationLevelInclude:()=>E,eventOptionsTimeInsertId:()=>j,groupAssignmentWithProperties:()=>D,orderCompleteMultiProduct:()=>q,subscriptionRenewRevenue:()=>U,userLoginIdentify:()=>S,wildcardIgnored:()=>R});var z=require("@walkeros/core"),A={title:"Default event",description:"A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",in:(0,z.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},R={public:!1,in:(0,z.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},E={title:"Include data section",description:"Destination-level include flattens the event data section into prefixed event_properties on every track call.",in:(0,z.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},P={title:"Identify per event",description:"Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",in:(0,z.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:[["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]]},S={title:"User login identify",description:"A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",in:(0,z.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]]},U={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",in:(0,z.getEvent)("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},q={title:"Multi-product order",description:"An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",in:(0,z.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},D={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",in:(0,z.getEvent)("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},j={title:"Event options",description:"Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",in:(0,z.getEvent)("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]]},G={title:"Consent revoked",description:"A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).",command:"consent",in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!0]]},T={title:"Consent granted",description:"A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" -> \"API Keys\".',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe(\n 'Amplitude data residency zone. Use EU for European data residency. Default: US.',\n )\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 10000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 200.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 12.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.',\n )\n .optional(),\n minIdLength: z\n .number()\n .int()\n .positive()\n .describe('Minimum length for user_id and device_id fields.')\n .optional(),\n serverUrl: z\n .string()\n .url()\n .describe('Custom server URL for proxies or self-hosted endpoints.')\n .optional(),\n optOut: z\n .boolean()\n .describe(\n 'Initial opt-out state. When true, no events are sent. Default: false.',\n )\n .optional(),\n enableRequestBodyCompression: z\n .boolean()\n .describe('Enable gzip compression for request payloads. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n \"walkerOS event sections to include as event_properties (like ['data', 'globals']).\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Per-rule include override. Replaces destination-level include for this rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\nclass MockIdentify implements IdentifyInstance {\n set() {\n return this;\n }\n setOnce() {\n return this;\n }\n add() {\n return this;\n }\n append() {\n return this;\n }\n prepend() {\n return this;\n }\n preInsert() {\n return this;\n }\n postInsert() {\n return this;\n }\n remove() {\n return this;\n }\n unset() {\n return this;\n }\n clearAll() {\n return this;\n }\n}\n\nclass MockRevenue implements RevenueInstance {\n setProductId() {\n return this;\n }\n setPrice() {\n return this;\n }\n setQuantity() {\n return this;\n }\n setRevenueType() {\n return this;\n }\n setCurrency() {\n return this;\n }\n setRevenue() {\n return this;\n }\n setReceipt() {\n return this;\n }\n setReceiptSig() {\n return this;\n }\n setEventProperties() {\n return this;\n }\n}\n\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example type for Amplitude server destination.\n * Settings and configInclude are read by the test runner and merged\n * into the base destination configuration.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding -- every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n user_id: 'us3r',\n device_id: 'c00k13',\n session_id: 394324160,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105,\n },\n add: {\n login_count: 1,\n },\n },\n {\n user_id: 'new-user-123',\n },\n ],\n ],\n};\n\n/**\n * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', true]],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,aACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,aAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,iDAAiD,EA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;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC;AAAA,MACD;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACF;AAWO,IAAM,sBAA4C;AAAA,EACvD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,IAAI,CAAC;AACrC;AAKO,IAAM,oBAA0C;AAAA,EACrD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;","names":["import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" -> \"API Keys\".',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe(\n 'Amplitude data residency zone. Use EU for European data residency. Default: US.',\n )\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 10000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 200.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 12.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.',\n )\n .optional(),\n minIdLength: z\n .number()\n .int()\n .positive()\n .describe('Minimum length for user_id and device_id fields.')\n .optional(),\n serverUrl: z\n .string()\n .url()\n .describe('Custom server URL for proxies or self-hosted endpoints.')\n .optional(),\n optOut: z\n .boolean()\n .describe(\n 'Initial opt-out state. When true, no events are sent. Default: false.',\n )\n .optional(),\n enableRequestBodyCompression: z\n .boolean()\n .describe('Enable gzip compression for request payloads. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n \"walkerOS event sections to include as event_properties (like ['data', 'globals']).\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Per-rule include override. Replaces destination-level include for this rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\nclass MockIdentify implements IdentifyInstance {\n set() {\n return this;\n }\n setOnce() {\n return this;\n }\n add() {\n return this;\n }\n append() {\n return this;\n }\n prepend() {\n return this;\n }\n preInsert() {\n return this;\n }\n postInsert() {\n return this;\n }\n remove() {\n return this;\n }\n unset() {\n return this;\n }\n clearAll() {\n return this;\n }\n}\n\nclass MockRevenue implements RevenueInstance {\n setProductId() {\n return this;\n }\n setPrice() {\n return this;\n }\n setQuantity() {\n return this;\n }\n setRevenueType() {\n return this;\n }\n setCurrency() {\n return this;\n }\n setRevenue() {\n return this;\n }\n setReceipt() {\n return this;\n }\n setReceiptSig() {\n return this;\n }\n setEventProperties() {\n return this;\n }\n}\n\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example type for Amplitude server destination.\n * Settings and configInclude are read by the test runner and merged\n * into the base destination configuration.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding -- every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n title: 'Default event',\n description:\n 'A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n title: 'Include data section',\n description:\n 'Destination-level include flattens the event data section into prefixed event_properties on every track call.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n title: 'Identify per event',\n description:\n 'Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n user_id: 'us3r',\n device_id: 'c00k13',\n session_id: 394324160,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n title: 'User login identify',\n description:\n 'A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105,\n },\n add: {\n login_count: 1,\n },\n },\n {\n user_id: 'new-user-123',\n },\n ],\n ],\n};\n\n/**\n * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n title: 'Subscription revenue',\n description:\n 'A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.',\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n title: 'Multi-product order',\n description:\n 'An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.',\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n title: 'Event options',\n description:\n 'Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).',\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', true]],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,aACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,aAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,iBAAiB,aACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,kDAAkD,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,KAAK;AAAA,QACH,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC;AAAA,MACD;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACF;AAWO,IAAM,sBAA4C;AAAA,EACvD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,IAAI,CAAC;AACrC;AAKO,IAAM,oBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,i)=>{for(var n in i)e(t,n,{get:i[n],enumerable:!0})},i={};t(i,{MappingSchema:()=>o,SettingsSchema:()=>a,mapping:()=>u,settings:()=>p});import{zodToSchema as n}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";var a=r.object({apiKey:r.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:r.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:r.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:r.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:r.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:r.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:r.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:r.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:r.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:r.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:r.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:r.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:r.array(r.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()});import{z as s}from"@walkeros/core/dev";var o=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:s.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:s.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:s.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:s.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:s.array(s.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),p=n(a),u=n(o),d={};t(d,{env:()=>l,step:()=>_});var l={};t(l,{init:()=>g,push:()=>f,simulation:()=>h});var c=()=>{},m=()=>({promise:Promise.resolve()}),v=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},y=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},g={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},f={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},h=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],_={};t(_,{consentGrantOptIn:()=>q,consentRevokeOptOut:()=>S,defaultEventForwarding:()=>O,destinationLevelIdentify:()=>w,destinationLevelInclude:()=>I,eventOptionsTimeInsertId:()=>P,groupAssignmentWithProperties:()=>U,orderCompleteMultiProduct:()=>E,subscriptionRenewRevenue:()=>A,userLoginIdentify:()=>R,wildcardIgnored:()=>k});import{getEvent as b}from"@walkeros/core";var O={in:b("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},k={in:b("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},I={in:b("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},w={in:b("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:[["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]]},R={in:b("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]]},A={in:b("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},E={in:b("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},U={in:b("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},P={in:b("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]]},S={command:"consent",in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!0]]},q={command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};export{d as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,i)=>{for(var n in i)e(t,n,{get:i[n],enumerable:!0})},i={};t(i,{MappingSchema:()=>o,SettingsSchema:()=>a,mapping:()=>d,settings:()=>p});import{zodToSchema as n}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";var a=r.object({apiKey:r.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:r.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:r.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:r.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:r.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:r.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:r.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:r.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:r.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:r.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:r.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:r.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:r.array(r.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()});import{z as s}from"@walkeros/core/dev";var o=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:s.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:s.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:s.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:s.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:s.array(s.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),p=n(a),d=n(o),u={};t(u,{env:()=>l,step:()=>_});var l={};t(l,{init:()=>g,push:()=>f,simulation:()=>h});var c=()=>{},m=()=>({promise:Promise.resolve()}),v=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},y=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},g={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},f={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},h=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],_={};t(_,{consentGrantOptIn:()=>D,consentRevokeOptOut:()=>P,defaultEventForwarding:()=>k,destinationLevelIdentify:()=>I,destinationLevelInclude:()=>O,eventOptionsTimeInsertId:()=>S,groupAssignmentWithProperties:()=>U,orderCompleteMultiProduct:()=>E,subscriptionRenewRevenue:()=>R,userLoginIdentify:()=>A,wildcardIgnored:()=>w});import{getEvent as b}from"@walkeros/core";var k={title:"Default event",description:"A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",in:b("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},w={public:!1,in:b("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},O={title:"Include data section",description:"Destination-level include flattens the event data section into prefixed event_properties on every track call.",in:b("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},I={title:"Identify per event",description:"Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",in:b("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:[["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]]},A={title:"User login identify",description:"A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",in:b("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]]},R={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",in:b("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},E={title:"Multi-product order",description:"An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",in:b("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},U={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",in:b("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},S={title:"Event options",description:"Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",in:b("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]]},P={title:"Consent revoked",description:"A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).",command:"consent",in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!0]]},D={title:"Consent granted",description:"A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};export{u as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" -> \"API Keys\".',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe(\n 'Amplitude data residency zone. Use EU for European data residency. Default: US.',\n )\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 10000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 200.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 12.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.',\n )\n .optional(),\n minIdLength: z\n .number()\n .int()\n .positive()\n .describe('Minimum length for user_id and device_id fields.')\n .optional(),\n serverUrl: z\n .string()\n .url()\n .describe('Custom server URL for proxies or self-hosted endpoints.')\n .optional(),\n optOut: z\n .boolean()\n .describe(\n 'Initial opt-out state. When true, no events are sent. Default: false.',\n )\n .optional(),\n enableRequestBodyCompression: z\n .boolean()\n .describe('Enable gzip compression for request payloads. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n \"walkerOS event sections to include as event_properties (like ['data', 'globals']).\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Per-rule include override. Replaces destination-level include for this rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\nclass MockIdentify implements IdentifyInstance {\n set() {\n return this;\n }\n setOnce() {\n return this;\n }\n add() {\n return this;\n }\n append() {\n return this;\n }\n prepend() {\n return this;\n }\n preInsert() {\n return this;\n }\n postInsert() {\n return this;\n }\n remove() {\n return this;\n }\n unset() {\n return this;\n }\n clearAll() {\n return this;\n }\n}\n\nclass MockRevenue implements RevenueInstance {\n setProductId() {\n return this;\n }\n setPrice() {\n return this;\n }\n setQuantity() {\n return this;\n }\n setRevenueType() {\n return this;\n }\n setCurrency() {\n return this;\n }\n setRevenue() {\n return this;\n }\n setReceipt() {\n return this;\n }\n setReceiptSig() {\n return this;\n }\n setEventProperties() {\n return this;\n }\n}\n\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example type for Amplitude server destination.\n * Settings and configInclude are read by the test runner and merged\n * into the base destination configuration.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding -- every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n user_id: 'us3r',\n device_id: 'c00k13',\n session_id: 394324160,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105,\n },\n add: {\n login_count: 1,\n },\n },\n {\n user_id: 'new-user-123',\n },\n ],\n ],\n};\n\n/**\n * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', true]],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,EACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,EAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,iBAAiB,EACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,EACV,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,kDAAkD,EAC3D,SAAS;AAAA,EACZ,WAAW,EACR,OAAO,EACP,IAAI,EACJ,SAAS,yDAAyD,EAClE,SAAS;AAAA,EACZ,QAAQ,EACL,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAA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,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;","names":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" -> \"API Keys\".',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe(\n 'Amplitude data residency zone. Use EU for European data residency. Default: US.',\n )\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 10000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 200.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 12.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.',\n )\n .optional(),\n minIdLength: z\n .number()\n .int()\n .positive()\n .describe('Minimum length for user_id and device_id fields.')\n .optional(),\n serverUrl: z\n .string()\n .url()\n .describe('Custom server URL for proxies or self-hosted endpoints.')\n .optional(),\n optOut: z\n .boolean()\n .describe(\n 'Initial opt-out state. When true, no events are sent. Default: false.',\n )\n .optional(),\n enableRequestBodyCompression: z\n .boolean()\n .describe('Enable gzip compression for request payloads. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n \"walkerOS event sections to include as event_properties (like ['data', 'globals']).\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Per-rule include override. Replaces destination-level include for this rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\nclass MockIdentify implements IdentifyInstance {\n set() {\n return this;\n }\n setOnce() {\n return this;\n }\n add() {\n return this;\n }\n append() {\n return this;\n }\n prepend() {\n return this;\n }\n preInsert() {\n return this;\n }\n postInsert() {\n return this;\n }\n remove() {\n return this;\n }\n unset() {\n return this;\n }\n clearAll() {\n return this;\n }\n}\n\nclass MockRevenue implements RevenueInstance {\n setProductId() {\n return this;\n }\n setPrice() {\n return this;\n }\n setQuantity() {\n return this;\n }\n setRevenueType() {\n return this;\n }\n setCurrency() {\n return this;\n }\n setRevenue() {\n return this;\n }\n setReceipt() {\n return this;\n }\n setReceiptSig() {\n return this;\n }\n setEventProperties() {\n return this;\n }\n}\n\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example type for Amplitude server destination.\n * Settings and configInclude are read by the test runner and merged\n * into the base destination configuration.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding -- every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n title: 'Default event',\n description:\n 'A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n title: 'Include data section',\n description:\n 'Destination-level include flattens the event data section into prefixed event_properties on every track call.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n title: 'Identify per event',\n description:\n 'Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n user_id: 'us3r',\n device_id: 'c00k13',\n session_id: 394324160,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n title: 'User login identify',\n description:\n 'A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105,\n },\n add: {\n login_count: 1,\n },\n },\n {\n user_id: 'new-user-123',\n },\n ],\n ],\n};\n\n/**\n * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n title: 'Subscription revenue',\n description:\n 'A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.',\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n title: 'Multi-product order',\n description:\n 'An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.',\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n title: 'Event options',\n description:\n 'Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).',\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', true]],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\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A,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;","names":["z"]}
@@ -151,15 +151,20 @@ __export(step_exports, {
151
151
  });
152
152
  var import_core = require("@walkeros/core");
153
153
  var defaultEventForwarding = {
154
+ title: "Default event",
155
+ description: "A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",
154
156
  in: (0, import_core.getEvent)("product view", { timestamp: 1700000100 }),
155
157
  out: [["amplitude.track", "product view", {}]]
156
158
  };
157
159
  var wildcardIgnored = {
160
+ public: false,
158
161
  in: (0, import_core.getEvent)("debug noise", { timestamp: 1700000101 }),
159
162
  mapping: { ignore: true },
160
163
  out: []
161
164
  };
162
165
  var destinationLevelInclude = {
166
+ title: "Include data section",
167
+ description: "Destination-level include flattens the event data section into prefixed event_properties on every track call.",
163
168
  in: (0, import_core.getEvent)("product view", { timestamp: 1700000102 }),
164
169
  configInclude: ["data"],
165
170
  out: [
@@ -177,6 +182,8 @@ var destinationLevelInclude = {
177
182
  ]
178
183
  };
179
184
  var destinationLevelIdentify = {
185
+ title: "Identify per event",
186
+ description: "Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",
180
187
  in: (0, import_core.getEvent)("page view", { timestamp: 1700000104 }),
181
188
  settings: {
182
189
  identify: {
@@ -201,6 +208,8 @@ var destinationLevelIdentify = {
201
208
  ]
202
209
  };
203
210
  var userLoginIdentify = {
211
+ title: "User login identify",
212
+ description: "A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",
204
213
  in: (0, import_core.getEvent)("user login", {
205
214
  timestamp: 1700000105,
206
215
  data: {
@@ -260,6 +269,8 @@ var userLoginIdentify = {
260
269
  ]
261
270
  };
262
271
  var subscriptionRenewRevenue = {
272
+ title: "Subscription revenue",
273
+ description: "A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",
263
274
  in: (0, import_core.getEvent)("subscription renew", {
264
275
  timestamp: 1700000107,
265
276
  data: {
@@ -293,6 +304,8 @@ var subscriptionRenewRevenue = {
293
304
  ]
294
305
  };
295
306
  var orderCompleteMultiProduct = {
307
+ title: "Multi-product order",
308
+ description: "An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",
296
309
  in: (0, import_core.getEvent)("order complete", { timestamp: 1700000108 }),
297
310
  mapping: {
298
311
  include: ["data", "globals"],
@@ -354,6 +367,8 @@ var orderCompleteMultiProduct = {
354
367
  ]
355
368
  };
356
369
  var groupAssignmentWithProperties = {
370
+ title: "Group assignment",
371
+ description: "A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",
357
372
  in: (0, import_core.getEvent)("company update", {
358
373
  timestamp: 1700000109,
359
374
  data: {
@@ -410,6 +425,8 @@ var groupAssignmentWithProperties = {
410
425
  ]
411
426
  };
412
427
  var eventOptionsTimeInsertId = {
428
+ title: "Event options",
429
+ description: "Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",
413
430
  in: (0, import_core.getEvent)("page view", { timestamp: 1700000110 }),
414
431
  settings: {
415
432
  eventOptions: {
@@ -432,12 +449,16 @@ var eventOptionsTimeInsertId = {
432
449
  ]
433
450
  };
434
451
  var consentRevokeOptOut = {
452
+ title: "Consent revoked",
453
+ description: "A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).",
435
454
  command: "consent",
436
455
  in: { analytics: false },
437
456
  settings: {},
438
457
  out: [["amplitude.setOptOut", true]]
439
458
  };
440
459
  var consentGrantOptIn = {
460
+ title: "Consent granted",
461
+ description: "A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",
441
462
  command: "consent",
442
463
  in: { analytics: true },
443
464
  settings: {},
@@ -130,15 +130,20 @@ __export(step_exports, {
130
130
  });
131
131
  import { getEvent } from "@walkeros/core";
132
132
  var defaultEventForwarding = {
133
+ title: "Default event",
134
+ description: "A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",
133
135
  in: getEvent("product view", { timestamp: 1700000100 }),
134
136
  out: [["amplitude.track", "product view", {}]]
135
137
  };
136
138
  var wildcardIgnored = {
139
+ public: false,
137
140
  in: getEvent("debug noise", { timestamp: 1700000101 }),
138
141
  mapping: { ignore: true },
139
142
  out: []
140
143
  };
141
144
  var destinationLevelInclude = {
145
+ title: "Include data section",
146
+ description: "Destination-level include flattens the event data section into prefixed event_properties on every track call.",
142
147
  in: getEvent("product view", { timestamp: 1700000102 }),
143
148
  configInclude: ["data"],
144
149
  out: [
@@ -156,6 +161,8 @@ var destinationLevelInclude = {
156
161
  ]
157
162
  };
158
163
  var destinationLevelIdentify = {
164
+ title: "Identify per event",
165
+ description: "Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",
159
166
  in: getEvent("page view", { timestamp: 1700000104 }),
160
167
  settings: {
161
168
  identify: {
@@ -180,6 +187,8 @@ var destinationLevelIdentify = {
180
187
  ]
181
188
  };
182
189
  var userLoginIdentify = {
190
+ title: "User login identify",
191
+ description: "A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",
183
192
  in: getEvent("user login", {
184
193
  timestamp: 1700000105,
185
194
  data: {
@@ -239,6 +248,8 @@ var userLoginIdentify = {
239
248
  ]
240
249
  };
241
250
  var subscriptionRenewRevenue = {
251
+ title: "Subscription revenue",
252
+ description: "A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",
242
253
  in: getEvent("subscription renew", {
243
254
  timestamp: 1700000107,
244
255
  data: {
@@ -272,6 +283,8 @@ var subscriptionRenewRevenue = {
272
283
  ]
273
284
  };
274
285
  var orderCompleteMultiProduct = {
286
+ title: "Multi-product order",
287
+ description: "An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",
275
288
  in: getEvent("order complete", { timestamp: 1700000108 }),
276
289
  mapping: {
277
290
  include: ["data", "globals"],
@@ -333,6 +346,8 @@ var orderCompleteMultiProduct = {
333
346
  ]
334
347
  };
335
348
  var groupAssignmentWithProperties = {
349
+ title: "Group assignment",
350
+ description: "A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",
336
351
  in: getEvent("company update", {
337
352
  timestamp: 1700000109,
338
353
  data: {
@@ -389,6 +404,8 @@ var groupAssignmentWithProperties = {
389
404
  ]
390
405
  };
391
406
  var eventOptionsTimeInsertId = {
407
+ title: "Event options",
408
+ description: "Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",
392
409
  in: getEvent("page view", { timestamp: 1700000110 }),
393
410
  settings: {
394
411
  eventOptions: {
@@ -411,12 +428,16 @@ var eventOptionsTimeInsertId = {
411
428
  ]
412
429
  };
413
430
  var consentRevokeOptOut = {
431
+ title: "Consent revoked",
432
+ description: "A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).",
414
433
  command: "consent",
415
434
  in: { analytics: false },
416
435
  settings: {},
417
436
  out: [["amplitude.setOptOut", true]]
418
437
  };
419
438
  var consentGrantOptIn = {
439
+ title: "Consent granted",
440
+ description: "A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",
420
441
  command: "consent",
421
442
  in: { analytics: true },
422
443
  settings: {},
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-amplitude",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -199,6 +199,8 @@
199
199
  },
200
200
  "step": {
201
201
  "consentGrantOptIn": {
202
+ "title": "Consent granted",
203
+ "description": "A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",
202
204
  "command": "consent",
203
205
  "in": {
204
206
  "analytics": true
@@ -212,6 +214,8 @@
212
214
  ]
213
215
  },
214
216
  "consentRevokeOptOut": {
217
+ "title": "Consent revoked",
218
+ "description": "A walker consent command with analytics denied opts out of Amplitude tracking via setOptOut(true).",
215
219
  "command": "consent",
216
220
  "in": {
217
221
  "analytics": false
@@ -225,6 +229,8 @@
225
229
  ]
226
230
  },
227
231
  "defaultEventForwarding": {
232
+ "title": "Default event",
233
+ "description": "A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",
228
234
  "in": {
229
235
  "name": "product view",
230
236
  "data": {
@@ -264,7 +270,7 @@
264
270
  "group": "gr0up",
265
271
  "count": 1,
266
272
  "version": {
267
- "source": "3.4.0",
273
+ "source": "3.4.1",
268
274
  "tagging": 1
269
275
  },
270
276
  "source": {
@@ -282,6 +288,8 @@
282
288
  ]
283
289
  },
284
290
  "destinationLevelIdentify": {
291
+ "title": "Identify per event",
292
+ "description": "Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",
285
293
  "in": {
286
294
  "name": "page view",
287
295
  "data": {
@@ -336,7 +344,7 @@
336
344
  "group": "gr0up",
337
345
  "count": 1,
338
346
  "version": {
339
- "source": "3.4.0",
347
+ "source": "3.4.1",
340
348
  "tagging": 1
341
349
  },
342
350
  "source": {
@@ -368,6 +376,8 @@
368
376
  ]
369
377
  },
370
378
  "destinationLevelInclude": {
379
+ "title": "Include data section",
380
+ "description": "Destination-level include flattens the event data section into prefixed event_properties on every track call.",
371
381
  "in": {
372
382
  "name": "product view",
373
383
  "data": {
@@ -407,7 +417,7 @@
407
417
  "group": "gr0up",
408
418
  "count": 1,
409
419
  "version": {
410
- "source": "3.4.0",
420
+ "source": "3.4.1",
411
421
  "tagging": 1
412
422
  },
413
423
  "source": {
@@ -434,6 +444,8 @@
434
444
  ]
435
445
  },
436
446
  "eventOptionsTimeInsertId": {
447
+ "title": "Event options",
448
+ "description": "Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",
437
449
  "in": {
438
450
  "name": "page view",
439
451
  "data": {
@@ -488,7 +500,7 @@
488
500
  "group": "gr0up",
489
501
  "count": 1,
490
502
  "version": {
491
- "source": "3.4.0",
503
+ "source": "3.4.1",
492
504
  "tagging": 1
493
505
  },
494
506
  "source": {
@@ -518,6 +530,8 @@
518
530
  ]
519
531
  },
520
532
  "groupAssignmentWithProperties": {
533
+ "title": "Group assignment",
534
+ "description": "A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",
521
535
  "in": {
522
536
  "name": "company update",
523
537
  "data": {
@@ -570,7 +584,7 @@
570
584
  "group": "gr0up",
571
585
  "count": 1,
572
586
  "version": {
573
- "source": "3.4.0",
587
+ "source": "3.4.1",
574
588
  "tagging": 1
575
589
  },
576
590
  "source": {
@@ -634,6 +648,8 @@
634
648
  ]
635
649
  },
636
650
  "orderCompleteMultiProduct": {
651
+ "title": "Multi-product order",
652
+ "description": "An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",
637
653
  "in": {
638
654
  "name": "order complete",
639
655
  "data": {
@@ -720,7 +736,7 @@
720
736
  "group": "gr0up",
721
737
  "count": 1,
722
738
  "version": {
723
- "source": "3.4.0",
739
+ "source": "3.4.1",
724
740
  "tagging": 1
725
741
  },
726
742
  "source": {
@@ -798,6 +814,8 @@
798
814
  ]
799
815
  },
800
816
  "subscriptionRenewRevenue": {
817
+ "title": "Subscription revenue",
818
+ "description": "A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",
801
819
  "in": {
802
820
  "name": "subscription renew",
803
821
  "data": {
@@ -848,7 +866,7 @@
848
866
  "group": "gr0up",
849
867
  "count": 1,
850
868
  "version": {
851
- "source": "3.4.0",
869
+ "source": "3.4.1",
852
870
  "tagging": 1
853
871
  },
854
872
  "source": {
@@ -888,6 +906,8 @@
888
906
  ]
889
907
  },
890
908
  "userLoginIdentify": {
909
+ "title": "User login identify",
910
+ "description": "A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",
891
911
  "in": {
892
912
  "name": "user login",
893
913
  "data": {
@@ -940,7 +960,7 @@
940
960
  "group": "gr0up",
941
961
  "count": 1,
942
962
  "version": {
943
- "source": "3.4.0",
963
+ "source": "3.4.1",
944
964
  "tagging": 1
945
965
  },
946
966
  "source": {
@@ -1001,6 +1021,7 @@
1001
1021
  ]
1002
1022
  },
1003
1023
  "wildcardIgnored": {
1024
+ "public": false,
1004
1025
  "in": {
1005
1026
  "name": "debug noise",
1006
1027
  "data": {
@@ -1057,7 +1078,7 @@
1057
1078
  "group": "gr0up",
1058
1079
  "count": 1,
1059
1080
  "version": {
1060
- "source": "3.4.0",
1081
+ "source": "3.4.1",
1061
1082
  "tagging": 1
1062
1083
  },
1063
1084
  "source": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-amplitude",
3
3
  "description": "Amplitude server destination for walkerOS",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@amplitude/analytics-node": "^1.5.53",
38
- "@walkeros/core": "3.4.0",
39
- "@walkeros/server-core": "3.4.0"
38
+ "@walkeros/core": "3.4.1",
39
+ "@walkeros/server-core": "3.4.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@walkeros/collector": "3.4.0"
42
+ "@walkeros/collector": "3.4.1"
43
43
  },
44
44
  "repository": {
45
45
  "url": "git+https://github.com/elbwalker/walkerOS.git",