@walkeros/server-destination-amplitude 3.4.2 → 4.0.0-next-1777463920154

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/README.md CHANGED
@@ -76,7 +76,7 @@ Use per-rule mapping to set, increment, or clear user properties:
76
76
  "mapping": {
77
77
  "user": {
78
78
  "login": {
79
- "skip": true,
79
+ "silent": true,
80
80
  "settings": {
81
81
  "identify": {
82
82
  "map": {
@@ -114,7 +114,7 @@ Supported identify operations: `set`, `setOnce`, `add`, `append`, `prepend`,
114
114
  "mapping": {
115
115
  "subscription": {
116
116
  "renew": {
117
- "skip": true,
117
+ "silent": true,
118
118
  "settings": {
119
119
  "revenue": {
120
120
  "map": {
package/dist/dev.d.mts CHANGED
@@ -207,7 +207,7 @@ declare const destinationLevelInclude: AmplitudeStepExample;
207
207
  declare const destinationLevelIdentify: AmplitudeStepExample;
208
208
  /**
209
209
  * Per-event identify with the full operation vocabulary -- this is the
210
- * "user login" pattern: set user_id, enrich user properties. `skip: true`
210
+ * "user login" pattern: set user_id, enrich user properties. `silent: true`
211
211
  * suppresses the default amplitude.track() call because we're running
212
212
  * identity side effects only.
213
213
  *
@@ -220,7 +220,7 @@ declare const userLoginIdentify: AmplitudeStepExample;
220
220
  * value: "EUR" }` fallback syntax: try data.currency, default to "EUR".
221
221
  *
222
222
  * The custom event has no data.currency, so the fallback fires.
223
- * `skip: true` suppresses the default track().
223
+ * `silent: true` suppresses the default track().
224
224
  */
225
225
  declare const subscriptionRenewRevenue: AmplitudeStepExample;
226
226
  /**
package/dist/dev.d.ts CHANGED
@@ -207,7 +207,7 @@ declare const destinationLevelInclude: AmplitudeStepExample;
207
207
  declare const destinationLevelIdentify: AmplitudeStepExample;
208
208
  /**
209
209
  * Per-event identify with the full operation vocabulary -- this is the
210
- * "user login" pattern: set user_id, enrich user properties. `skip: true`
210
+ * "user login" pattern: set user_id, enrich user properties. `silent: true`
211
211
  * suppresses the default amplitude.track() call because we're running
212
212
  * identity side effects only.
213
213
  *
@@ -220,7 +220,7 @@ declare const userLoginIdentify: AmplitudeStepExample;
220
220
  * value: "EUR" }` fallback syntax: try data.currency, default to "EUR".
221
221
  *
222
222
  * The custom event has no data.currency, so the fallback fires.
223
- * `skip: true` suppresses the default track().
223
+ * `silent: true` suppresses the default track().
224
224
  */
225
225
  declare const subscriptionRenewRevenue: AmplitudeStepExample;
226
226
  /**
package/dist/dev.js CHANGED
@@ -1 +1 @@
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
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:()=>u,mapping:()=>v,settings:()=>m});var p=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),u=d.z.object({apiKey:d.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:d.z.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:d.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:d.z.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:d.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:d.z.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:d.z.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:d.z.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:d.z.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:d.z.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:d.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:d.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:d.z.array(d.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)(u),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()}),b=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}},_=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:b,Revenue:_}},w={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:b,Revenue:_}},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:{silent:!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:{silent:!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=>{const t=e;return"number"==typeof t?.data?.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:{silent:!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,id:"1700000110abcdef"}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110abcdef"}]]},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 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,SAA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ACxC;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,QACA,SAAS;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,2BAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,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"]}
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. `silent: 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 silent: 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 * `silent: 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 silent: 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 silent: 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', {\n timestamp: 1700000110,\n id: '1700000110abcdef',\n }),\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: '1700000110abcdef',\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,aAC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,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,sBAAsB,WAAW,MAAM;AAAA,IACxC;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,QACA,SAAS;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,2BAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,IAAI;AAAA,EACN,CAAC;AAAA,EACD,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,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:()=>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
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:()=>f,push:()=>g,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}},f={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},g={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:()=>w,destinationLevelIdentify:()=>I,destinationLevelInclude:()=>O,eventOptionsTimeInsertId:()=>S,groupAssignmentWithProperties:()=>U,orderCompleteMultiProduct:()=>E,subscriptionRenewRevenue:()=>R,userLoginIdentify:()=>A,wildcardIgnored:()=>k});import{getEvent as b}from"@walkeros/core";var w={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",{}]]},k={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:{silent:!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:{silent:!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=>{const t=e;return"number"==typeof t?.data?.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:{silent:!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,id:"1700000110abcdef"}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110abcdef"}]]},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 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;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,gBA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MACA;AAAA,QACE,KAAK;AAAA,UACH,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,QACA,SAAS;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,2BAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,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":["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. `silent: 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 silent: 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 * `silent: 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 silent: 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 silent: 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', {\n timestamp: 1700000110,\n id: '1700000110abcdef',\n }),\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: '1700000110abcdef',\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;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,EACt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MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,QACA,SAAS;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,2BAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,IAAI;AAAA,EACN,CAAC;AAAA,EACD,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,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":["z"]}
@@ -163,7 +163,7 @@ declare const destinationLevelInclude: AmplitudeStepExample;
163
163
  declare const destinationLevelIdentify: AmplitudeStepExample;
164
164
  /**
165
165
  * Per-event identify with the full operation vocabulary -- this is the
166
- * "user login" pattern: set user_id, enrich user properties. `skip: true`
166
+ * "user login" pattern: set user_id, enrich user properties. `silent: true`
167
167
  * suppresses the default amplitude.track() call because we're running
168
168
  * identity side effects only.
169
169
  *
@@ -176,7 +176,7 @@ declare const userLoginIdentify: AmplitudeStepExample;
176
176
  * value: "EUR" }` fallback syntax: try data.currency, default to "EUR".
177
177
  *
178
178
  * The custom event has no data.currency, so the fallback fires.
179
- * `skip: true` suppresses the default track().
179
+ * `silent: true` suppresses the default track().
180
180
  */
181
181
  declare const subscriptionRenewRevenue: AmplitudeStepExample;
182
182
  /**
@@ -163,7 +163,7 @@ declare const destinationLevelInclude: AmplitudeStepExample;
163
163
  declare const destinationLevelIdentify: AmplitudeStepExample;
164
164
  /**
165
165
  * Per-event identify with the full operation vocabulary -- this is the
166
- * "user login" pattern: set user_id, enrich user properties. `skip: true`
166
+ * "user login" pattern: set user_id, enrich user properties. `silent: true`
167
167
  * suppresses the default amplitude.track() call because we're running
168
168
  * identity side effects only.
169
169
  *
@@ -176,7 +176,7 @@ declare const userLoginIdentify: AmplitudeStepExample;
176
176
  * value: "EUR" }` fallback syntax: try data.currency, default to "EUR".
177
177
  *
178
178
  * The custom event has no data.currency, so the fallback fires.
179
- * `skip: true` suppresses the default track().
179
+ * `silent: true` suppresses the default track().
180
180
  */
181
181
  declare const subscriptionRenewRevenue: AmplitudeStepExample;
182
182
  /**
@@ -220,7 +220,7 @@ var userLoginIdentify = {
220
220
  }
221
221
  }),
222
222
  mapping: {
223
- skip: true,
223
+ silent: true,
224
224
  settings: {
225
225
  identify: {
226
226
  map: {
@@ -279,7 +279,7 @@ var subscriptionRenewRevenue = {
279
279
  }
280
280
  }),
281
281
  mapping: {
282
- skip: true,
282
+ silent: true,
283
283
  settings: {
284
284
  revenue: {
285
285
  map: {
@@ -315,9 +315,8 @@ var orderCompleteMultiProduct = {
315
315
  "nested",
316
316
  {
317
317
  condition: (value) => {
318
- var _a;
319
318
  const v = value;
320
- return typeof ((_a = v == null ? void 0 : v.data) == null ? void 0 : _a.price) === "number";
319
+ return typeof v?.data?.price === "number";
321
320
  },
322
321
  map: {
323
322
  productId: "data.id",
@@ -379,7 +378,7 @@ var groupAssignmentWithProperties = {
379
378
  }
380
379
  }),
381
380
  mapping: {
382
- skip: true,
381
+ silent: true,
383
382
  settings: {
384
383
  group: {
385
384
  map: {
@@ -427,7 +426,10 @@ var groupAssignmentWithProperties = {
427
426
  var eventOptionsTimeInsertId = {
428
427
  title: "Event options",
429
428
  description: "Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",
430
- in: (0, import_core.getEvent)("page view", { timestamp: 1700000110 }),
429
+ in: (0, import_core.getEvent)("page view", {
430
+ timestamp: 1700000110,
431
+ id: "1700000110abcdef"
432
+ }),
431
433
  settings: {
432
434
  eventOptions: {
433
435
  map: {
@@ -443,7 +445,7 @@ var eventOptionsTimeInsertId = {
443
445
  {},
444
446
  {
445
447
  time: 1700000110,
446
- insert_id: "1700000110-gr0up-1"
448
+ insert_id: "1700000110abcdef"
447
449
  }
448
450
  ]
449
451
  ]
@@ -199,7 +199,7 @@ var userLoginIdentify = {
199
199
  }
200
200
  }),
201
201
  mapping: {
202
- skip: true,
202
+ silent: true,
203
203
  settings: {
204
204
  identify: {
205
205
  map: {
@@ -258,7 +258,7 @@ var subscriptionRenewRevenue = {
258
258
  }
259
259
  }),
260
260
  mapping: {
261
- skip: true,
261
+ silent: true,
262
262
  settings: {
263
263
  revenue: {
264
264
  map: {
@@ -294,9 +294,8 @@ var orderCompleteMultiProduct = {
294
294
  "nested",
295
295
  {
296
296
  condition: (value) => {
297
- var _a;
298
297
  const v = value;
299
- return typeof ((_a = v == null ? void 0 : v.data) == null ? void 0 : _a.price) === "number";
298
+ return typeof v?.data?.price === "number";
300
299
  },
301
300
  map: {
302
301
  productId: "data.id",
@@ -358,7 +357,7 @@ var groupAssignmentWithProperties = {
358
357
  }
359
358
  }),
360
359
  mapping: {
361
- skip: true,
360
+ silent: true,
362
361
  settings: {
363
362
  group: {
364
363
  map: {
@@ -406,7 +405,10 @@ var groupAssignmentWithProperties = {
406
405
  var eventOptionsTimeInsertId = {
407
406
  title: "Event options",
408
407
  description: "Destination-level eventOptions map walker fields into Amplitude per-event metadata such as time and insert_id.",
409
- in: getEvent("page view", { timestamp: 1700000110 }),
408
+ in: getEvent("page view", {
409
+ timestamp: 1700000110,
410
+ id: "1700000110abcdef"
411
+ }),
410
412
  settings: {
411
413
  eventOptions: {
412
414
  map: {
@@ -422,7 +424,7 @@ var eventOptionsTimeInsertId = {
422
424
  {},
423
425
  {
424
426
  time: 1700000110,
425
- insert_id: "1700000110-gr0up-1"
427
+ insert_id: "1700000110abcdef"
426
428
  }
427
429
  ]
428
430
  ]