@walkeros/server-destination-amplitude 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +59 -49
- package/dist/examples/index.mjs +59 -49
- package/dist/walkerOS.json +79 -63
- package/package.json +4 -4
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};a(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,a,s,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of i(a))r.call(e,p)||p===s||t(e,p,{get:()=>a[p],enumerable:!(o=n(a,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>v,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:u.z.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:u.z.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:u.z.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:u.z.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:u.z.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:u.z.array(u.z.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()}),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:l.z.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:l.z.array(l.z.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),m=(0,p.zodToSchema)(d),v=(0,p.zodToSchema)(c),y={};a(y,{env:()=>g,step:()=>I});var g={};a(g,{init:()=>O,push:()=>w,simulation:()=>k});var f=()=>{},h=()=>({promise:Promise.resolve()}),_=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},b=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},O={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},w={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},k=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],I={};a(I,{consentGrantOptIn:()=>D,consentRevokeOptOut:()=>G,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>P,eventOptionsTimeInsertId:()=>T,groupAssignmentWithProperties:()=>j,orderCompleteMultiProduct:()=>q,subscriptionRenewRevenue:()=>U,userLoginIdentify:()=>S,wildcardIgnored:()=>E});var z=require("@walkeros/core"),R={in:(0,z.getEvent)("product view",{timestamp:1700000100}),out:["amplitude.track","product view",{}]},E={in:(0,z.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},P={in:(0,z.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]},A={in:(0,z.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]},S={in:(0,z.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]},U={in:(0,z.getEvent)("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]},q={in:(0,z.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},j={in:(0,z.getEvent)("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},T={in:(0,z.getEvent)("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]},G={command:"consent",in:{analytics:!1},settings:{},out:["amplitude.setOptOut",!0]},D={command:"consent",in:{analytics:!0},settings:{},out:["amplitude.setOptOut",!1]};//# sourceMappingURL=dev.js.map
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};a(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,a,s,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of i(a))r.call(e,p)||p===s||t(e,p,{get:()=>a[p],enumerable:!(o=n(a,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>v,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:u.z.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:u.z.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:u.z.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:u.z.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:u.z.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:u.z.array(u.z.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()}),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:l.z.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:l.z.array(l.z.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),m=(0,p.zodToSchema)(d),v=(0,p.zodToSchema)(c),y={};a(y,{env:()=>g,step:()=>I});var g={};a(g,{init:()=>O,push:()=>w,simulation:()=>k});var f=()=>{},h=()=>({promise:Promise.resolve()}),_=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},b=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},O={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},w={amplitude:{init:h,track:f,identify:f,revenue:f,setOptOut:f,setGroup:f,groupIdentify:f,flush:h,Identify:_,Revenue:b}},k=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],I={};a(I,{consentGrantOptIn:()=>D,consentRevokeOptOut:()=>G,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>P,eventOptionsTimeInsertId:()=>T,groupAssignmentWithProperties:()=>j,orderCompleteMultiProduct:()=>q,subscriptionRenewRevenue:()=>U,userLoginIdentify:()=>S,wildcardIgnored:()=>E});var z=require("@walkeros/core"),R={in:(0,z.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},E={in:(0,z.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},P={in:(0,z.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},A={in:(0,z.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:[["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]]},S={in:(0,z.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]]},U={in:(0,z.getEvent)("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},q={in:(0,z.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},j={in:(0,z.getEvent)("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},T={in:(0,z.getEvent)("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]]},G={command:"consent",in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!0]]},D={command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" -> \"API Keys\".',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe(\n 'Amplitude data residency zone. Use EU for European data residency. Default: US.',\n )\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 10000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 200.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 12.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.',\n )\n .optional(),\n minIdLength: z\n .number()\n .int()\n .positive()\n .describe('Minimum length for user_id and device_id fields.')\n .optional(),\n serverUrl: z\n .string()\n .url()\n .describe('Custom server URL for proxies or self-hosted endpoints.')\n .optional(),\n optOut: z\n .boolean()\n .describe(\n 'Initial opt-out state. When true, no events are sent. Default: false.',\n )\n .optional(),\n enableRequestBodyCompression: z\n .boolean()\n .describe('Enable gzip compression for request payloads. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n \"walkerOS event sections to include as event_properties (like ['data', 'globals']).\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Per-rule include override. Replaces destination-level include for this rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\nclass MockIdentify implements IdentifyInstance {\n set() {\n return this;\n }\n setOnce() {\n return this;\n }\n add() {\n return this;\n }\n append() {\n return this;\n }\n prepend() {\n return this;\n }\n preInsert() {\n return this;\n }\n postInsert() {\n return this;\n }\n remove() {\n return this;\n }\n unset() {\n return this;\n }\n clearAll() {\n return this;\n }\n}\n\nclass MockRevenue implements RevenueInstance {\n setProductId() {\n return this;\n }\n setPrice() {\n return this;\n }\n setQuantity() {\n return this;\n }\n setRevenueType() {\n return this;\n }\n setCurrency() {\n return this;\n }\n setRevenue() {\n return this;\n }\n setReceipt() {\n return this;\n }\n setReceiptSig() {\n return this;\n }\n setEventProperties() {\n return this;\n }\n}\n\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example type for Amplitude server destination.\n * Settings and configInclude are read by the test runner and merged\n * into the base destination configuration.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding -- every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: ['amplitude.track', 'product view', {}],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n '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 * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n '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 * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n '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 * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['amplitude.setOptOut', true],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['amplitude.setOptOut', false],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,aACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,aAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,iBAAiB,aACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,kDAAkD,EAC3D,SAAS;AAAA,EACZ,WAAW,aACR,OAAO,EACP,IAAI,EACJ,SAAS,yDAAyD,EAClE,SAAS;AAAA,EACZ,QAAQ,aACL,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,8BAA8B,a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R;AAAA,MACF;AAAA,MACA,eAAe;AAAA,QACb,KAAK;AAAA,UACH,MAAM,EAAE,OAAO,UAAU;AAAA,UACzB,MAAM;AAAA,UACN,KAAK;AAAA,YACH,KAAK;AAAA,cACH,UAAU;AAAA,cACV,MAAM;AAAA,YACR;AAAA,UACF;AAAA,UACA,SAAS;AAAA,YACP,KAAK;AAAA,cACH,SAAS;AAAA,YACX;AAAA,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,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,IACA;AAAA,IACA,CAAC;AAAA,IACD;AAAA,MACE,MAAM;AAAA,MACN,WAAW;AAAA,IACb;AAAA,EACF;AACF;AAWO,IAAM,sBAA4C;AAAA,EACvD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,uBAAuB,IAAI;AACnC;AAKO,IAAM,oBAA0C;AAAA,EACrD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,uBAAuB,KAAK;AACpC;","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 in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n user_id: 'us3r',\n device_id: 'c00k13',\n session_id: 394324160,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105,\n },\n add: {\n login_count: 1,\n },\n },\n {\n user_id: 'new-user-123',\n },\n ],\n ],\n};\n\n/**\n * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', true]],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,aACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,aAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,iBAAiB,aACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,OAAO,EACP,IAAI,EAC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,EACvD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,IAAI,CAAC;AACrC;AAKO,IAAM,oBAA0C;AAAA,EACrD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,i)=>{for(var n in i)e(t,n,{get:i[n],enumerable:!0})},i={};t(i,{MappingSchema:()=>o,SettingsSchema:()=>a,mapping:()=>u,settings:()=>p});import{zodToSchema as n}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";var a=r.object({apiKey:r.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:r.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:r.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:r.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:r.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:r.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:r.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:r.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:r.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:r.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:r.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:r.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:r.array(r.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()});import{z as s}from"@walkeros/core/dev";var o=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:s.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:s.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:s.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:s.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:s.array(s.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),p=n(a),u=n(o),d={};t(d,{env:()=>l,step:()=>_});var l={};t(l,{init:()=>g,push:()=>f,simulation:()=>h});var c=()=>{},m=()=>({promise:Promise.resolve()}),v=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},y=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},g={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},f={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},h=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],_={};t(_,{consentGrantOptIn:()=>q,consentRevokeOptOut:()=>S,defaultEventForwarding:()=>O,destinationLevelIdentify:()=>w,destinationLevelInclude:()=>I,eventOptionsTimeInsertId:()=>P,groupAssignmentWithProperties:()=>U,orderCompleteMultiProduct:()=>E,subscriptionRenewRevenue:()=>A,userLoginIdentify:()=>R,wildcardIgnored:()=>k});import{getEvent as b}from"@walkeros/core";var O={in:b("product view",{timestamp:1700000100}),out:["amplitude.track","product view",{}]},k={in:b("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},I={in:b("product view",{timestamp:1700000102}),configInclude:["data"],out:["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]},w={in:b("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]},R={in:b("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]},A={in:b("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]},E={in:b("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},U={in:b("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},P={in:b("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]},S={command:"consent",in:{analytics:!1},settings:{},out:["amplitude.setOptOut",!0]},q={command:"consent",in:{analytics:!0},settings:{},out:["amplitude.setOptOut",!1]};export{d as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
|
|
1
|
+
var e=Object.defineProperty,t=(t,i)=>{for(var n in i)e(t,n,{get:i[n],enumerable:!0})},i={};t(i,{MappingSchema:()=>o,SettingsSchema:()=>a,mapping:()=>u,settings:()=>p});import{zodToSchema as n}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";var a=r.object({apiKey:r.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" -> "API Keys".'),serverZone:r.enum(["US","EU"]).describe("Amplitude data residency zone. Use EU for European data residency. Default: US.").optional(),flushIntervalMillis:r.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 10000.").optional(),flushQueueSize:r.number().int().positive().describe("Max queued events before a flush. Default: 200.").optional(),flushMaxRetries:r.number().int().nonnegative().describe("Max retries on failed flush. Default: 12.").optional(),useBatch:r.boolean().describe("Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.").optional(),minIdLength:r.number().int().positive().describe("Minimum length for user_id and device_id fields.").optional(),serverUrl:r.string().url().describe("Custom server URL for proxies or self-hosted endpoints.").optional(),optOut:r.boolean().describe("Initial opt-out state. When true, no events are sent. Default: false.").optional(),enableRequestBodyCompression:r.boolean().describe("Enable gzip compression for request payloads. Default: false.").optional(),identify:r.unknown().describe("walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),eventOptions:r.unknown().describe("walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.").optional(),include:r.array(r.string()).describe("walkerOS event sections to include as event_properties (like ['data', 'globals']).").optional()});import{z as s}from"@walkeros/core/dev";var o=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:s.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:s.unknown().describe("Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).").optional(),groupIdentify:s.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).").optional(),eventOptions:s.unknown().describe("Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.").optional(),include:s.array(s.string()).describe("Per-rule include override. Replaces destination-level include for this rule.").optional()}),p=n(a),u=n(o),d={};t(d,{env:()=>l,step:()=>_});var l={};t(l,{init:()=>g,push:()=>f,simulation:()=>h});var c=()=>{},m=()=>({promise:Promise.resolve()}),v=class{set(){return this}setOnce(){return this}add(){return this}append(){return this}prepend(){return this}preInsert(){return this}postInsert(){return this}remove(){return this}unset(){return this}clearAll(){return this}},y=class{setProductId(){return this}setPrice(){return this}setQuantity(){return this}setRevenueType(){return this}setCurrency(){return this}setRevenue(){return this}setReceipt(){return this}setReceiptSig(){return this}setEventProperties(){return this}},g={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},f={amplitude:{init:m,track:c,identify:c,revenue:c,setOptOut:c,setGroup:c,groupIdentify:c,flush:m,Identify:v,Revenue:y}},h=["call:amplitude.init","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.setOptOut","call:amplitude.setGroup","call:amplitude.groupIdentify"],_={};t(_,{consentGrantOptIn:()=>q,consentRevokeOptOut:()=>S,defaultEventForwarding:()=>O,destinationLevelIdentify:()=>w,destinationLevelInclude:()=>I,eventOptionsTimeInsertId:()=>P,groupAssignmentWithProperties:()=>U,orderCompleteMultiProduct:()=>E,subscriptionRenewRevenue:()=>A,userLoginIdentify:()=>R,wildcardIgnored:()=>k});import{getEvent as b}from"@walkeros/core";var O={in:b("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},k={in:b("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},I={in:b("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},w={in:b("page view",{timestamp:1700000104}),settings:{identify:{map:{user_id:"user.id",device_id:"user.device",session_id:"user.session"}}},out:[["amplitude.track","page view",{},{user_id:"us3r",device_id:"c00k13",session_id:394324160}]]},R={in:b("user login",{timestamp:1700000105,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{skip:!0,settings:{identify:{map:{user_id:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105},add:{login_count:1}},{user_id:"new-user-123"}]]},A={in:b("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{skip:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},E={in:b("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},U={in:b("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},P={in:b("page view",{timestamp:1700000110}),settings:{eventOptions:{map:{time:"timestamp",insert_id:"id"}}},out:[["amplitude.track","page view",{},{time:1700000110,insert_id:"1700000110-gr0up-1"}]]},S={command:"consent",in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!0]]},q={command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};export{d as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" -> \"API Keys\".',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe(\n 'Amplitude data residency zone. Use EU for European data residency. Default: US.',\n )\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 10000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 200.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 12.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint for higher rate limits. Recommended for high-volume server flows. Default: false.',\n )\n .optional(),\n minIdLength: z\n .number()\n .int()\n .positive()\n .describe('Minimum length for user_id and device_id fields.')\n .optional(),\n serverUrl: z\n .string()\n .url()\n .describe('Custom server URL for proxies or self-hosted endpoints.')\n .optional(),\n optOut: z\n .boolean()\n .describe(\n 'Initial opt-out state. When true, no events are sent. Default: false.',\n )\n .optional(),\n enableRequestBodyCompression: z\n .boolean()\n .describe('Enable gzip compression for request payloads. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event identity. Keys: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to per-event EventOptions. Keys: time, insert_id, ip, city, country, region, language, platform, os_name, os_version, device_brand, device_model, app_version, user_agent.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n \"walkerOS event sections to include as event_properties (like ['data', 'globals']).\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: user_id, device_id, session_id, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } -> amplitude.setGroup(type, name, eventOptions).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } -> amplitude.groupIdentify(type, name, identify, eventOptions).',\n )\n .optional(),\n eventOptions: z\n .unknown()\n .describe(\n 'Per-rule EventOptions override. Resolves to { time?, insert_id?, ip?, ... }. Overrides destination-level eventOptions for this rule.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Per-rule include override. Replaces destination-level include for this rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\nclass MockIdentify implements IdentifyInstance {\n set() {\n return this;\n }\n setOnce() {\n return this;\n }\n add() {\n return this;\n }\n append() {\n return this;\n }\n prepend() {\n return this;\n }\n preInsert() {\n return this;\n }\n postInsert() {\n return this;\n }\n remove() {\n return this;\n }\n unset() {\n return this;\n }\n clearAll() {\n return this;\n }\n}\n\nclass MockRevenue implements RevenueInstance {\n setProductId() {\n return this;\n }\n setPrice() {\n return this;\n }\n setQuantity() {\n return this;\n }\n setRevenueType() {\n return this;\n }\n setCurrency() {\n return this;\n }\n setRevenue() {\n return this;\n }\n setReceipt() {\n return this;\n }\n setReceiptSig() {\n return this;\n }\n setEventProperties() {\n return this;\n }\n}\n\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n setOptOut: noop,\n setGroup: noop,\n groupIdentify: noop,\n flush: noopPromise,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example type for Amplitude server destination.\n * Settings and configInclude are read by the test runner and merged\n * into the base destination configuration.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding -- every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: ['amplitude.track', 'product view', {}],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n '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 * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n '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 * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n '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 * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['amplitude.setOptOut', true],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['amplitude.setOptOut', false],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,EACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,EAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,iBAAiB,EACd,OAAO,EACP,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;AAAA,EACF;AACF;AAWO,IAAM,sBAA4C;AAAA,EACvD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,uBAAuB,IAAI;AACnC;AAKO,IAAM,oBAA0C;AAAA,EACrD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,uBAAuB,KAAK;AACpC;","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 in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore -- walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: AmplitudeStepExample = {\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify resolves per-event identity.\n * Unlike the web destination (which uses setUserId/setDeviceId/setSessionId),\n * server-side identity goes into EventOptions passed to every SDK call.\n *\n * user.session is 's3ss10n' (string). The destination deterministically\n * hashes non-numeric session strings via djb2.\n * djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user_id: 'user.id',\n device_id: 'user.device',\n session_id: 'user.session',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n user_id: 'us3r',\n device_id: 'c00k13',\n session_id: 394324160,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary -- this is the\n * \"user login\" pattern: set user_id, enrich user properties. `skip: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n *\n * Server-side, user_id is passed via EventOptions on identify().\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n user_id: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105,\n },\n add: {\n login_count: 1,\n },\n },\n {\n user_id: 'new-user-123',\n },\n ],\n ],\n};\n\n/**\n * Single-product revenue -- resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The custom event has no data.currency, so the fallback fires.\n * `skip: true` suppresses the default track().\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n in: getEvent('subscription renew', {\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order -- the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * EventOptions mapping -- `settings.eventOptions` maps walkerOS fields\n * to Amplitude per-event metadata. Here `time` maps from the event\n * timestamp and `insert_id` maps from the event id for deduplication.\n */\nexport const eventOptionsTimeInsertId: AmplitudeStepExample = {\n in: getEvent('page view', { timestamp: 1700000110 }),\n settings: {\n eventOptions: {\n map: {\n time: 'timestamp',\n insert_id: 'id',\n },\n },\n },\n out: [\n [\n 'amplitude.track',\n 'page view',\n {},\n {\n time: 1700000110,\n insert_id: '1700000110-gr0up-1',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked -> amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', true]],\n};\n\n/**\n * Consent granted -> amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,EACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,qBAAqB,EAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,gBAAg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,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,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,IAAI,CAAC;AACrC;AAKO,IAAM,oBAA0C;AAAA,EACrD,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;","names":["z"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -152,7 +152,7 @@ __export(step_exports, {
|
|
|
152
152
|
var import_core = require("@walkeros/core");
|
|
153
153
|
var defaultEventForwarding = {
|
|
154
154
|
in: (0, import_core.getEvent)("product view", { timestamp: 1700000100 }),
|
|
155
|
-
out: ["amplitude.track", "product view", {}]
|
|
155
|
+
out: [["amplitude.track", "product view", {}]]
|
|
156
156
|
};
|
|
157
157
|
var wildcardIgnored = {
|
|
158
158
|
in: (0, import_core.getEvent)("debug noise", { timestamp: 1700000101 }),
|
|
@@ -163,15 +163,17 @@ var destinationLevelInclude = {
|
|
|
163
163
|
in: (0, import_core.getEvent)("product view", { timestamp: 1700000102 }),
|
|
164
164
|
configInclude: ["data"],
|
|
165
165
|
out: [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
[
|
|
167
|
+
"amplitude.track",
|
|
168
|
+
"product view",
|
|
169
|
+
{
|
|
170
|
+
data_id: "ers",
|
|
171
|
+
data_name: "Everyday Ruck Snack",
|
|
172
|
+
data_color: "black",
|
|
173
|
+
data_size: "l",
|
|
174
|
+
data_price: 420
|
|
175
|
+
}
|
|
176
|
+
]
|
|
175
177
|
]
|
|
176
178
|
};
|
|
177
179
|
var destinationLevelIdentify = {
|
|
@@ -186,14 +188,16 @@ var destinationLevelIdentify = {
|
|
|
186
188
|
}
|
|
187
189
|
},
|
|
188
190
|
out: [
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
[
|
|
192
|
+
"amplitude.track",
|
|
193
|
+
"page view",
|
|
194
|
+
{},
|
|
195
|
+
{
|
|
196
|
+
user_id: "us3r",
|
|
197
|
+
device_id: "c00k13",
|
|
198
|
+
session_id: 394324160
|
|
199
|
+
}
|
|
200
|
+
]
|
|
197
201
|
]
|
|
198
202
|
};
|
|
199
203
|
var userLoginIdentify = {
|
|
@@ -234,23 +238,25 @@ var userLoginIdentify = {
|
|
|
234
238
|
}
|
|
235
239
|
},
|
|
236
240
|
out: [
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
[
|
|
242
|
+
"amplitude.identify",
|
|
243
|
+
{
|
|
244
|
+
set: {
|
|
245
|
+
plan: "premium",
|
|
246
|
+
company: "Acme",
|
|
247
|
+
email: "user@acme.com"
|
|
248
|
+
},
|
|
249
|
+
setOnce: {
|
|
250
|
+
first_login: 1700000105
|
|
251
|
+
},
|
|
252
|
+
add: {
|
|
253
|
+
login_count: 1
|
|
254
|
+
}
|
|
246
255
|
},
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
{
|
|
257
|
+
user_id: "new-user-123"
|
|
249
258
|
}
|
|
250
|
-
|
|
251
|
-
{
|
|
252
|
-
user_id: "new-user-123"
|
|
253
|
-
}
|
|
259
|
+
]
|
|
254
260
|
]
|
|
255
261
|
};
|
|
256
262
|
var subscriptionRenewRevenue = {
|
|
@@ -275,13 +281,15 @@ var subscriptionRenewRevenue = {
|
|
|
275
281
|
}
|
|
276
282
|
},
|
|
277
283
|
out: [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
[
|
|
285
|
+
"amplitude.revenue",
|
|
286
|
+
{
|
|
287
|
+
productId: "plan-pro",
|
|
288
|
+
price: 9.99,
|
|
289
|
+
revenueType: "renewal",
|
|
290
|
+
currency: "EUR"
|
|
291
|
+
}
|
|
292
|
+
]
|
|
285
293
|
]
|
|
286
294
|
};
|
|
287
295
|
var orderCompleteMultiProduct = {
|
|
@@ -412,26 +420,28 @@ var eventOptionsTimeInsertId = {
|
|
|
412
420
|
}
|
|
413
421
|
},
|
|
414
422
|
out: [
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
423
|
+
[
|
|
424
|
+
"amplitude.track",
|
|
425
|
+
"page view",
|
|
426
|
+
{},
|
|
427
|
+
{
|
|
428
|
+
time: 1700000110,
|
|
429
|
+
insert_id: "1700000110-gr0up-1"
|
|
430
|
+
}
|
|
431
|
+
]
|
|
422
432
|
]
|
|
423
433
|
};
|
|
424
434
|
var consentRevokeOptOut = {
|
|
425
435
|
command: "consent",
|
|
426
436
|
in: { analytics: false },
|
|
427
437
|
settings: {},
|
|
428
|
-
out: ["amplitude.setOptOut", true]
|
|
438
|
+
out: [["amplitude.setOptOut", true]]
|
|
429
439
|
};
|
|
430
440
|
var consentGrantOptIn = {
|
|
431
441
|
command: "consent",
|
|
432
442
|
in: { analytics: true },
|
|
433
443
|
settings: {},
|
|
434
|
-
out: ["amplitude.setOptOut", false]
|
|
444
|
+
out: [["amplitude.setOptOut", false]]
|
|
435
445
|
};
|
|
436
446
|
// Annotate the CommonJS export names for ESM import in node:
|
|
437
447
|
0 && (module.exports = {
|
package/dist/examples/index.mjs
CHANGED
|
@@ -131,7 +131,7 @@ __export(step_exports, {
|
|
|
131
131
|
import { getEvent } from "@walkeros/core";
|
|
132
132
|
var defaultEventForwarding = {
|
|
133
133
|
in: getEvent("product view", { timestamp: 1700000100 }),
|
|
134
|
-
out: ["amplitude.track", "product view", {}]
|
|
134
|
+
out: [["amplitude.track", "product view", {}]]
|
|
135
135
|
};
|
|
136
136
|
var wildcardIgnored = {
|
|
137
137
|
in: getEvent("debug noise", { timestamp: 1700000101 }),
|
|
@@ -142,15 +142,17 @@ var destinationLevelInclude = {
|
|
|
142
142
|
in: getEvent("product view", { timestamp: 1700000102 }),
|
|
143
143
|
configInclude: ["data"],
|
|
144
144
|
out: [
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
[
|
|
146
|
+
"amplitude.track",
|
|
147
|
+
"product view",
|
|
148
|
+
{
|
|
149
|
+
data_id: "ers",
|
|
150
|
+
data_name: "Everyday Ruck Snack",
|
|
151
|
+
data_color: "black",
|
|
152
|
+
data_size: "l",
|
|
153
|
+
data_price: 420
|
|
154
|
+
}
|
|
155
|
+
]
|
|
154
156
|
]
|
|
155
157
|
};
|
|
156
158
|
var destinationLevelIdentify = {
|
|
@@ -165,14 +167,16 @@ var destinationLevelIdentify = {
|
|
|
165
167
|
}
|
|
166
168
|
},
|
|
167
169
|
out: [
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
[
|
|
171
|
+
"amplitude.track",
|
|
172
|
+
"page view",
|
|
173
|
+
{},
|
|
174
|
+
{
|
|
175
|
+
user_id: "us3r",
|
|
176
|
+
device_id: "c00k13",
|
|
177
|
+
session_id: 394324160
|
|
178
|
+
}
|
|
179
|
+
]
|
|
176
180
|
]
|
|
177
181
|
};
|
|
178
182
|
var userLoginIdentify = {
|
|
@@ -213,23 +217,25 @@ var userLoginIdentify = {
|
|
|
213
217
|
}
|
|
214
218
|
},
|
|
215
219
|
out: [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
[
|
|
221
|
+
"amplitude.identify",
|
|
222
|
+
{
|
|
223
|
+
set: {
|
|
224
|
+
plan: "premium",
|
|
225
|
+
company: "Acme",
|
|
226
|
+
email: "user@acme.com"
|
|
227
|
+
},
|
|
228
|
+
setOnce: {
|
|
229
|
+
first_login: 1700000105
|
|
230
|
+
},
|
|
231
|
+
add: {
|
|
232
|
+
login_count: 1
|
|
233
|
+
}
|
|
225
234
|
},
|
|
226
|
-
|
|
227
|
-
|
|
235
|
+
{
|
|
236
|
+
user_id: "new-user-123"
|
|
228
237
|
}
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
user_id: "new-user-123"
|
|
232
|
-
}
|
|
238
|
+
]
|
|
233
239
|
]
|
|
234
240
|
};
|
|
235
241
|
var subscriptionRenewRevenue = {
|
|
@@ -254,13 +260,15 @@ var subscriptionRenewRevenue = {
|
|
|
254
260
|
}
|
|
255
261
|
},
|
|
256
262
|
out: [
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
[
|
|
264
|
+
"amplitude.revenue",
|
|
265
|
+
{
|
|
266
|
+
productId: "plan-pro",
|
|
267
|
+
price: 9.99,
|
|
268
|
+
revenueType: "renewal",
|
|
269
|
+
currency: "EUR"
|
|
270
|
+
}
|
|
271
|
+
]
|
|
264
272
|
]
|
|
265
273
|
};
|
|
266
274
|
var orderCompleteMultiProduct = {
|
|
@@ -391,26 +399,28 @@ var eventOptionsTimeInsertId = {
|
|
|
391
399
|
}
|
|
392
400
|
},
|
|
393
401
|
out: [
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
402
|
+
[
|
|
403
|
+
"amplitude.track",
|
|
404
|
+
"page view",
|
|
405
|
+
{},
|
|
406
|
+
{
|
|
407
|
+
time: 1700000110,
|
|
408
|
+
insert_id: "1700000110-gr0up-1"
|
|
409
|
+
}
|
|
410
|
+
]
|
|
401
411
|
]
|
|
402
412
|
};
|
|
403
413
|
var consentRevokeOptOut = {
|
|
404
414
|
command: "consent",
|
|
405
415
|
in: { analytics: false },
|
|
406
416
|
settings: {},
|
|
407
|
-
out: ["amplitude.setOptOut", true]
|
|
417
|
+
out: [["amplitude.setOptOut", true]]
|
|
408
418
|
};
|
|
409
419
|
var consentGrantOptIn = {
|
|
410
420
|
command: "consent",
|
|
411
421
|
in: { analytics: true },
|
|
412
422
|
settings: {},
|
|
413
|
-
out: ["amplitude.setOptOut", false]
|
|
423
|
+
out: [["amplitude.setOptOut", false]]
|
|
414
424
|
};
|
|
415
425
|
export {
|
|
416
426
|
env_exports as env,
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-amplitude",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -205,8 +205,10 @@
|
|
|
205
205
|
},
|
|
206
206
|
"settings": {},
|
|
207
207
|
"out": [
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
[
|
|
209
|
+
"amplitude.setOptOut",
|
|
210
|
+
false
|
|
211
|
+
]
|
|
210
212
|
]
|
|
211
213
|
},
|
|
212
214
|
"consentRevokeOptOut": {
|
|
@@ -216,8 +218,10 @@
|
|
|
216
218
|
},
|
|
217
219
|
"settings": {},
|
|
218
220
|
"out": [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
[
|
|
222
|
+
"amplitude.setOptOut",
|
|
223
|
+
true
|
|
224
|
+
]
|
|
221
225
|
]
|
|
222
226
|
},
|
|
223
227
|
"defaultEventForwarding": {
|
|
@@ -260,7 +264,7 @@
|
|
|
260
264
|
"group": "gr0up",
|
|
261
265
|
"count": 1,
|
|
262
266
|
"version": {
|
|
263
|
-
"source": "3.
|
|
267
|
+
"source": "3.4.0",
|
|
264
268
|
"tagging": 1
|
|
265
269
|
},
|
|
266
270
|
"source": {
|
|
@@ -270,9 +274,11 @@
|
|
|
270
274
|
}
|
|
271
275
|
},
|
|
272
276
|
"out": [
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
277
|
+
[
|
|
278
|
+
"amplitude.track",
|
|
279
|
+
"product view",
|
|
280
|
+
{}
|
|
281
|
+
]
|
|
276
282
|
]
|
|
277
283
|
},
|
|
278
284
|
"destinationLevelIdentify": {
|
|
@@ -330,7 +336,7 @@
|
|
|
330
336
|
"group": "gr0up",
|
|
331
337
|
"count": 1,
|
|
332
338
|
"version": {
|
|
333
|
-
"source": "3.
|
|
339
|
+
"source": "3.4.0",
|
|
334
340
|
"tagging": 1
|
|
335
341
|
},
|
|
336
342
|
"source": {
|
|
@@ -349,14 +355,16 @@
|
|
|
349
355
|
}
|
|
350
356
|
},
|
|
351
357
|
"out": [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
[
|
|
359
|
+
"amplitude.track",
|
|
360
|
+
"page view",
|
|
361
|
+
{},
|
|
362
|
+
{
|
|
363
|
+
"user_id": "us3r",
|
|
364
|
+
"device_id": "c00k13",
|
|
365
|
+
"session_id": 394324160
|
|
366
|
+
}
|
|
367
|
+
]
|
|
360
368
|
]
|
|
361
369
|
},
|
|
362
370
|
"destinationLevelInclude": {
|
|
@@ -399,7 +407,7 @@
|
|
|
399
407
|
"group": "gr0up",
|
|
400
408
|
"count": 1,
|
|
401
409
|
"version": {
|
|
402
|
-
"source": "3.
|
|
410
|
+
"source": "3.4.0",
|
|
403
411
|
"tagging": 1
|
|
404
412
|
},
|
|
405
413
|
"source": {
|
|
@@ -412,15 +420,17 @@
|
|
|
412
420
|
"data"
|
|
413
421
|
],
|
|
414
422
|
"out": [
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
423
|
+
[
|
|
424
|
+
"amplitude.track",
|
|
425
|
+
"product view",
|
|
426
|
+
{
|
|
427
|
+
"data_id": "ers",
|
|
428
|
+
"data_name": "Everyday Ruck Snack",
|
|
429
|
+
"data_color": "black",
|
|
430
|
+
"data_size": "l",
|
|
431
|
+
"data_price": 420
|
|
432
|
+
}
|
|
433
|
+
]
|
|
424
434
|
]
|
|
425
435
|
},
|
|
426
436
|
"eventOptionsTimeInsertId": {
|
|
@@ -478,7 +488,7 @@
|
|
|
478
488
|
"group": "gr0up",
|
|
479
489
|
"count": 1,
|
|
480
490
|
"version": {
|
|
481
|
-
"source": "3.
|
|
491
|
+
"source": "3.4.0",
|
|
482
492
|
"tagging": 1
|
|
483
493
|
},
|
|
484
494
|
"source": {
|
|
@@ -496,13 +506,15 @@
|
|
|
496
506
|
}
|
|
497
507
|
},
|
|
498
508
|
"out": [
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
509
|
+
[
|
|
510
|
+
"amplitude.track",
|
|
511
|
+
"page view",
|
|
512
|
+
{},
|
|
513
|
+
{
|
|
514
|
+
"time": 1700000110,
|
|
515
|
+
"insert_id": "1700000110-gr0up-1"
|
|
516
|
+
}
|
|
517
|
+
]
|
|
506
518
|
]
|
|
507
519
|
},
|
|
508
520
|
"groupAssignmentWithProperties": {
|
|
@@ -558,7 +570,7 @@
|
|
|
558
570
|
"group": "gr0up",
|
|
559
571
|
"count": 1,
|
|
560
572
|
"version": {
|
|
561
|
-
"source": "3.
|
|
573
|
+
"source": "3.4.0",
|
|
562
574
|
"tagging": 1
|
|
563
575
|
},
|
|
564
576
|
"source": {
|
|
@@ -708,7 +720,7 @@
|
|
|
708
720
|
"group": "gr0up",
|
|
709
721
|
"count": 1,
|
|
710
722
|
"version": {
|
|
711
|
-
"source": "3.
|
|
723
|
+
"source": "3.4.0",
|
|
712
724
|
"tagging": 1
|
|
713
725
|
},
|
|
714
726
|
"source": {
|
|
@@ -836,7 +848,7 @@
|
|
|
836
848
|
"group": "gr0up",
|
|
837
849
|
"count": 1,
|
|
838
850
|
"version": {
|
|
839
|
-
"source": "3.
|
|
851
|
+
"source": "3.4.0",
|
|
840
852
|
"tagging": 1
|
|
841
853
|
},
|
|
842
854
|
"source": {
|
|
@@ -864,13 +876,15 @@
|
|
|
864
876
|
}
|
|
865
877
|
},
|
|
866
878
|
"out": [
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
879
|
+
[
|
|
880
|
+
"amplitude.revenue",
|
|
881
|
+
{
|
|
882
|
+
"productId": "plan-pro",
|
|
883
|
+
"price": 9.99,
|
|
884
|
+
"revenueType": "renewal",
|
|
885
|
+
"currency": "EUR"
|
|
886
|
+
}
|
|
887
|
+
]
|
|
874
888
|
]
|
|
875
889
|
},
|
|
876
890
|
"userLoginIdentify": {
|
|
@@ -926,7 +940,7 @@
|
|
|
926
940
|
"group": "gr0up",
|
|
927
941
|
"count": 1,
|
|
928
942
|
"version": {
|
|
929
|
-
"source": "3.
|
|
943
|
+
"source": "3.4.0",
|
|
930
944
|
"tagging": 1
|
|
931
945
|
},
|
|
932
946
|
"source": {
|
|
@@ -965,23 +979,25 @@
|
|
|
965
979
|
}
|
|
966
980
|
},
|
|
967
981
|
"out": [
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
"
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
"
|
|
982
|
+
[
|
|
983
|
+
"amplitude.identify",
|
|
984
|
+
{
|
|
985
|
+
"set": {
|
|
986
|
+
"plan": "premium",
|
|
987
|
+
"company": "Acme",
|
|
988
|
+
"email": "user@acme.com"
|
|
989
|
+
},
|
|
990
|
+
"setOnce": {
|
|
991
|
+
"first_login": 1700000105
|
|
992
|
+
},
|
|
993
|
+
"add": {
|
|
994
|
+
"login_count": 1
|
|
995
|
+
}
|
|
977
996
|
},
|
|
978
|
-
|
|
979
|
-
"
|
|
997
|
+
{
|
|
998
|
+
"user_id": "new-user-123"
|
|
980
999
|
}
|
|
981
|
-
|
|
982
|
-
{
|
|
983
|
-
"user_id": "new-user-123"
|
|
984
|
-
}
|
|
1000
|
+
]
|
|
985
1001
|
]
|
|
986
1002
|
},
|
|
987
1003
|
"wildcardIgnored": {
|
|
@@ -1041,7 +1057,7 @@
|
|
|
1041
1057
|
"group": "gr0up",
|
|
1042
1058
|
"count": 1,
|
|
1043
1059
|
"version": {
|
|
1044
|
-
"source": "3.
|
|
1060
|
+
"source": "3.4.0",
|
|
1045
1061
|
"tagging": 1
|
|
1046
1062
|
},
|
|
1047
1063
|
"source": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-amplitude",
|
|
3
3
|
"description": "Amplitude server destination for walkerOS",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@amplitude/analytics-node": "^1.5.53",
|
|
38
|
-
"@walkeros/core": "3.
|
|
39
|
-
"@walkeros/server-core": "3.
|
|
38
|
+
"@walkeros/core": "3.4.0",
|
|
39
|
+
"@walkeros/server-core": "3.4.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@walkeros/collector": "3.
|
|
42
|
+
"@walkeros/collector": "3.4.0"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|