@walkeros/server-destination-mixpanel 3.4.2 → 4.0.0-next-1777463920154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/dev.d.mts +12 -12
- package/dist/dev.d.ts +12 -12
- 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.d.mts +12 -12
- package/dist/examples/index.d.ts +12 -12
- package/dist/examples/index.js +3 -3
- package/dist/examples/index.mjs +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +34 -153
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ By default, events are sent via `/track` (real-time, last 5 days only). Set
|
|
|
79
79
|
"mapping": {
|
|
80
80
|
"user": {
|
|
81
81
|
"login": {
|
|
82
|
-
"
|
|
82
|
+
"silent": true,
|
|
83
83
|
"settings": {
|
|
84
84
|
"identify": { "map": { "distinctId": "data.user_id" } },
|
|
85
85
|
"people": {
|
|
@@ -123,7 +123,7 @@ Update group profiles:
|
|
|
123
123
|
"mapping": {
|
|
124
124
|
"company": {
|
|
125
125
|
"update": {
|
|
126
|
-
"
|
|
126
|
+
"silent": true,
|
|
127
127
|
"settings": {
|
|
128
128
|
"groupProfile": {
|
|
129
129
|
"map": {
|
package/dist/dev.d.mts
CHANGED
|
@@ -135,8 +135,8 @@ declare namespace env {
|
|
|
135
135
|
* one-time `Mixpanel.init` call (fired during destination init) so only
|
|
136
136
|
* per-event SDK calls are compared.
|
|
137
137
|
*
|
|
138
|
-
* For events marked `
|
|
139
|
-
* fire
|
|
138
|
+
* For events marked `silent: true` or `ignore: true`, `track()` does not
|
|
139
|
+
* fire - only the side-effect calls (people/groups/alias) appear.
|
|
140
140
|
*/
|
|
141
141
|
/**
|
|
142
142
|
* Step examples may carry destination-level settings and configInclude.
|
|
@@ -147,50 +147,50 @@ type MixpanelStepExample = Flow.StepExample & {
|
|
|
147
147
|
configInclude?: string[];
|
|
148
148
|
};
|
|
149
149
|
/**
|
|
150
|
-
* Default event forwarding
|
|
150
|
+
* Default event forwarding - every walkerOS event becomes
|
|
151
151
|
* mp.track(event.name, { distinct_id, ...properties }).
|
|
152
152
|
* With default settings.identify resolving user.id.
|
|
153
153
|
*/
|
|
154
154
|
declare const defaultEventForwarding: MixpanelStepExample;
|
|
155
155
|
/**
|
|
156
|
-
* Track with include
|
|
156
|
+
* Track with include - flattens walkerOS `data` section into
|
|
157
157
|
* prefixed track() properties.
|
|
158
158
|
*/
|
|
159
159
|
declare const trackWithInclude: MixpanelStepExample;
|
|
160
160
|
/**
|
|
161
|
-
* Per-event identify
|
|
161
|
+
* Per-event identify - mapping-level settings.identify overrides
|
|
162
162
|
* destination-level default.
|
|
163
163
|
*/
|
|
164
164
|
declare const perEventIdentify: MixpanelStepExample;
|
|
165
165
|
/**
|
|
166
|
-
* Track with group
|
|
166
|
+
* Track with group - group key/id attached as track property.
|
|
167
167
|
*/
|
|
168
168
|
declare const trackWithGroup: MixpanelStepExample;
|
|
169
169
|
/**
|
|
170
|
-
* User login with people operations
|
|
170
|
+
* User login with people operations - silent: true suppresses track,
|
|
171
171
|
* only identity + people side effects fire.
|
|
172
172
|
*/
|
|
173
173
|
declare const userLoginPeopleSet: MixpanelStepExample;
|
|
174
174
|
/**
|
|
175
|
-
* Common people operation vocabulary
|
|
175
|
+
* Common people operation vocabulary - exercises set, set_once, increment,
|
|
176
176
|
* append, union, remove, unset. (delete_user is intentionally not covered
|
|
177
177
|
* by this example.)
|
|
178
178
|
*/
|
|
179
179
|
declare const allPeopleOperations: MixpanelStepExample;
|
|
180
180
|
/**
|
|
181
|
-
* Group profile operations
|
|
181
|
+
* Group profile operations - settings.groupProfile with set and set_once.
|
|
182
182
|
*/
|
|
183
183
|
declare const companyGroupProfile: MixpanelStepExample;
|
|
184
184
|
/**
|
|
185
|
-
* Historical import
|
|
185
|
+
* Historical import - useImport: true uses mp.import() instead of mp.track().
|
|
186
186
|
*/
|
|
187
187
|
declare const historicalImport: MixpanelStepExample;
|
|
188
188
|
/**
|
|
189
|
-
* Alias
|
|
189
|
+
* Alias - legacy identity merge. Fires mp.alias before track.
|
|
190
190
|
*/
|
|
191
191
|
declare const aliasBeforeTrack: MixpanelStepExample;
|
|
192
192
|
/**
|
|
193
|
-
* Wildcard ignore
|
|
193
|
+
* Wildcard ignore - the rule matches but does nothing.
|
|
194
194
|
*/
|
|
195
195
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
196
196
|
|
package/dist/dev.d.ts
CHANGED
|
@@ -135,8 +135,8 @@ declare namespace env {
|
|
|
135
135
|
* one-time `Mixpanel.init` call (fired during destination init) so only
|
|
136
136
|
* per-event SDK calls are compared.
|
|
137
137
|
*
|
|
138
|
-
* For events marked `
|
|
139
|
-
* fire
|
|
138
|
+
* For events marked `silent: true` or `ignore: true`, `track()` does not
|
|
139
|
+
* fire - only the side-effect calls (people/groups/alias) appear.
|
|
140
140
|
*/
|
|
141
141
|
/**
|
|
142
142
|
* Step examples may carry destination-level settings and configInclude.
|
|
@@ -147,50 +147,50 @@ type MixpanelStepExample = Flow.StepExample & {
|
|
|
147
147
|
configInclude?: string[];
|
|
148
148
|
};
|
|
149
149
|
/**
|
|
150
|
-
* Default event forwarding
|
|
150
|
+
* Default event forwarding - every walkerOS event becomes
|
|
151
151
|
* mp.track(event.name, { distinct_id, ...properties }).
|
|
152
152
|
* With default settings.identify resolving user.id.
|
|
153
153
|
*/
|
|
154
154
|
declare const defaultEventForwarding: MixpanelStepExample;
|
|
155
155
|
/**
|
|
156
|
-
* Track with include
|
|
156
|
+
* Track with include - flattens walkerOS `data` section into
|
|
157
157
|
* prefixed track() properties.
|
|
158
158
|
*/
|
|
159
159
|
declare const trackWithInclude: MixpanelStepExample;
|
|
160
160
|
/**
|
|
161
|
-
* Per-event identify
|
|
161
|
+
* Per-event identify - mapping-level settings.identify overrides
|
|
162
162
|
* destination-level default.
|
|
163
163
|
*/
|
|
164
164
|
declare const perEventIdentify: MixpanelStepExample;
|
|
165
165
|
/**
|
|
166
|
-
* Track with group
|
|
166
|
+
* Track with group - group key/id attached as track property.
|
|
167
167
|
*/
|
|
168
168
|
declare const trackWithGroup: MixpanelStepExample;
|
|
169
169
|
/**
|
|
170
|
-
* User login with people operations
|
|
170
|
+
* User login with people operations - silent: true suppresses track,
|
|
171
171
|
* only identity + people side effects fire.
|
|
172
172
|
*/
|
|
173
173
|
declare const userLoginPeopleSet: MixpanelStepExample;
|
|
174
174
|
/**
|
|
175
|
-
* Common people operation vocabulary
|
|
175
|
+
* Common people operation vocabulary - exercises set, set_once, increment,
|
|
176
176
|
* append, union, remove, unset. (delete_user is intentionally not covered
|
|
177
177
|
* by this example.)
|
|
178
178
|
*/
|
|
179
179
|
declare const allPeopleOperations: MixpanelStepExample;
|
|
180
180
|
/**
|
|
181
|
-
* Group profile operations
|
|
181
|
+
* Group profile operations - settings.groupProfile with set and set_once.
|
|
182
182
|
*/
|
|
183
183
|
declare const companyGroupProfile: MixpanelStepExample;
|
|
184
184
|
/**
|
|
185
|
-
* Historical import
|
|
185
|
+
* Historical import - useImport: true uses mp.import() instead of mp.track().
|
|
186
186
|
*/
|
|
187
187
|
declare const historicalImport: MixpanelStepExample;
|
|
188
188
|
/**
|
|
189
|
-
* Alias
|
|
189
|
+
* Alias - legacy identity merge. Fires mp.alias before track.
|
|
190
190
|
*/
|
|
191
191
|
declare const aliasBeforeTrack: MixpanelStepExample;
|
|
192
192
|
/**
|
|
193
|
-
* Wildcard ignore
|
|
193
|
+
* Wildcard ignore - the rule matches but does nothing.
|
|
194
194
|
*/
|
|
195
195
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
196
196
|
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(e,i)=>{for(var a in i)t(e,a,{get:i[a],enumerable:!0})},p={};o(p,{examples:()=>v,schemas:()=>s}),module.exports=(e=p,((e,o,p,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let r of a(o))n.call(e,r)||r===p||t(e,r,{get:()=>o[r],enumerable:!(s=i(o,r))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>m,SettingsSchema:()=>d,mapping:()=>g,settings:()=>u});var r=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),d=l.z.object({apiKey:l.z.string().min(1).describe("Your Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init()."),secret:l.z.string().describe("API secret for the /import endpoint (historical data). Required when useImport is true.").optional(),host:l.z.string().describe("Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).").optional(),protocol:l.z.string().describe("Protocol for API requests. Default: 'https'.").optional(),keepAlive:l.z.boolean().describe("Reuse HTTP connections. Default: true.").optional(),geolocate:l.z.boolean().describe("Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.").optional(),debug:l.z.boolean().describe("Enable SDK debug logging. Default: false.").optional(),verbose:l.z.boolean().describe("Enable verbose request logging. Default: false.").optional(),test:l.z.boolean().describe("Enable dry-run mode. Default: false.").optional(),useImport:l.z.boolean().describe("Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.").optional(),include:l.z.unknown().describe("Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).").optional()}),c=require("@walkeros/core/dev"),m=c.z.object({identify:c.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.").optional(),people:c.z.unknown().describe("Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.").optional(),group:c.z.unknown().describe("Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.").optional(),groupProfile:c.z.unknown().describe("Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.").optional(),useImport:c.z.unknown().describe("Per-event import flag. When truthy, uses mp.import() instead of mp.track() for this rule.").optional()}),u=(0,r.zodToSchema)(d),g=(0,r.zodToSchema)(m),v={};o(v,{env:()=>_,step:()=>w});var _={};o(_,{push:()=>
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(e,i)=>{for(var a in i)t(e,a,{get:i[a],enumerable:!0})},p={};o(p,{examples:()=>v,schemas:()=>s}),module.exports=(e=p,((e,o,p,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let r of a(o))n.call(e,r)||r===p||t(e,r,{get:()=>o[r],enumerable:!(s=i(o,r))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>m,SettingsSchema:()=>d,mapping:()=>g,settings:()=>u});var r=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),d=l.z.object({apiKey:l.z.string().min(1).describe("Your Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init()."),secret:l.z.string().describe("API secret for the /import endpoint (historical data). Required when useImport is true.").optional(),host:l.z.string().describe("Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).").optional(),protocol:l.z.string().describe("Protocol for API requests. Default: 'https'.").optional(),keepAlive:l.z.boolean().describe("Reuse HTTP connections. Default: true.").optional(),geolocate:l.z.boolean().describe("Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.").optional(),debug:l.z.boolean().describe("Enable SDK debug logging. Default: false.").optional(),verbose:l.z.boolean().describe("Enable verbose request logging. Default: false.").optional(),test:l.z.boolean().describe("Enable dry-run mode. Default: false.").optional(),useImport:l.z.boolean().describe("Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.").optional(),include:l.z.unknown().describe("Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).").optional()}),c=require("@walkeros/core/dev"),m=c.z.object({identify:c.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.").optional(),people:c.z.unknown().describe("Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.").optional(),group:c.z.unknown().describe("Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.").optional(),groupProfile:c.z.unknown().describe("Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.").optional(),useImport:c.z.unknown().describe("Per-event import flag. When truthy, uses mp.import() instead of mp.track() for this rule.").optional()}),u=(0,r.zodToSchema)(d),g=(0,r.zodToSchema)(m),v={};o(v,{env:()=>_,step:()=>w});var _={};o(_,{push:()=>k,simulation:()=>h});var f=()=>{},y={set:f,set_once:f,increment:f,append:f,union:f,remove:f,unset:f,delete_user:f},b={set:f,set_once:f,union:f,remove:f,unset:f,delete_group:f};var k={Mixpanel:{init:function(){return{track:f,import:f,alias:f,people:{...y},groups:{...b}}}}},h=["call:Mixpanel.init","call:mp.track","call:mp.import","call:mp.alias","call:mp.people.set","call:mp.people.set_once","call:mp.people.increment","call:mp.people.append","call:mp.people.union","call:mp.people.remove","call:mp.people.unset","call:mp.people.delete_user","call:mp.groups.set","call:mp.groups.set_once","call:mp.groups.union","call:mp.groups.remove","call:mp.groups.unset","call:mp.groups.delete_group"],w={};o(w,{aliasBeforeTrack:()=>j,allPeopleOperations:()=>S,companyGroupProfile:()=>D,defaultEventForwarding:()=>P,historicalImport:()=>M,perEventIdentify:()=>z,trackWithGroup:()=>E,trackWithInclude:()=>x,userLoginPeopleSet:()=>A,wildcardIgnored:()=>q});var I=require("@walkeros/core"),P={title:"Default track",description:"A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.",in:(0,I.getEvent)("product view",{timestamp:1700000100}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["mp.track","product view",{distinct_id:"us3r"}]]},x={title:"Track with include",description:"A destination-level include flattens the event data section into prefixed Mixpanel track properties.",in:(0,I.getEvent)("product view",{timestamp:1700000101}),settings:{identify:{map:{distinctId:"user.id"}}},configInclude:["data"],out:[["mp.track","product view",{distinct_id:"us3r",data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},z={title:"Per-event identify",description:"A mapping-level identify overrides the destination default to resolve the distinct_id from event data.",in:(0,I.getEvent)("user login",{timestamp:1700000102,data:{user_id:"resolved-id",plan:"premium"}}),mapping:{settings:{identify:{map:{distinctId:"data.user_id"}}}},out:[["mp.track","user login",{distinct_id:"resolved-id"}]]},E={title:"Track with group",description:"A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.",in:(0,I.getEvent)("page view",{timestamp:1700000103,data:{company_id:"acme"}}),settings:{identify:{map:{distinctId:"user.id"}}},mapping:{settings:{group:{map:{key:{value:"company_id"},id:"data.company_id"}}}},out:[["mp.track","page view",{distinct_id:"us3r",company_id:"acme"}]]},A={title:"User login people",description:"A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.",in:(0,I.getEvent)("user login",{timestamp:1700000104,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{distinctId:"data.user_id"}},people:{map:{set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},set_once:{map:{first_login:"timestamp"}},increment:{map:{login_count:{value:1}}}}}}},out:[["mp.people.set","new-user-123",{plan:"premium",company:"Acme",email:"user@acme.com"}],["mp.people.set_once","new-user-123",{first_login:1700000104}],["mp.people.increment","new-user-123",{login_count:1}]]},S={title:"Common people operations",description:"A profile update exercises the common Mixpanel people vocabulary: set, set_once, increment, append, union, remove, and unset. delete_user is not covered by this example.",in:(0,I.getEvent)("profile update",{timestamp:1700000105,data:{name:"Jane Doe",email:"jane@acme.com",page:"/docs/getting-started",removed_tag:"trial",source:"referral"}}),mapping:{silent:!0,settings:{identify:{map:{distinctId:"user.id"}},people:{map:{set:{map:{name:"data.name",email:"data.email"}},set_once:{map:{signup_source:"data.source"}},increment:{map:{page_views:{value:1}}},append:{map:{visited_pages:"data.page"}},union:{map:{unique_tags:{value:["active"]}}},remove:{map:{tags:"data.removed_tag"}},unset:{value:["old_plan"]}}}}},out:[["mp.people.set","us3r",{name:"Jane Doe",email:"jane@acme.com"}],["mp.people.set_once","us3r",{signup_source:"referral"}],["mp.people.increment","us3r",{page_views:1}],["mp.people.append","us3r",{visited_pages:"/docs/getting-started"}],["mp.people.union","us3r",{unique_tags:["active"]}],["mp.people.remove","us3r",{tags:"trial"}],["mp.people.unset","us3r",["old_plan"]]]},D={title:"Group profile",description:"A company update sets Mixpanel group profile properties via groups.set and groups.set_once.",in:(0,I.getEvent)("company update",{timestamp:1700000106,data:{company_id:"acme-inc",company_name:"Acme, Inc.",plan:"enterprise",employee_count:250,founded_year:2010}}),mapping:{silent:!0,settings:{groupProfile:{map:{key:{value:"company_id"},id:"data.company_id",set:{map:{name:"data.company_name",plan:"data.plan",employee_count:"data.employee_count"}},set_once:{map:{founded:"data.founded_year"}}}}}},out:[["mp.groups.set","company_id","acme-inc",{name:"Acme, Inc.",plan:"enterprise",employee_count:250}],["mp.groups.set_once","company_id","acme-inc",{founded:2010}]]},M={title:"Historical import",description:"Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.",in:(0,I.getEvent)("order complete",{timestamp:1700000107,data:{total:99.99}}),settings:{useImport:!0,identify:{map:{distinctId:"user.id"}}},out:[["mp.import","order complete",1700000107,{distinct_id:"us3r"}]]},j={title:"Alias before track",description:"A user login merges a prior anonymous id into the new user id via mp.alias before sending the track event.",in:(0,I.getEvent)("user login",{timestamp:1700000108,data:{user_id:"new-user-456",anon_id:"anon-789"}}),mapping:{settings:{identify:{map:{distinctId:"data.user_id",alias:"data.anon_id"}}}},out:[["mp.alias","new-user-456","anon-789"],["mp.track","user login",{distinct_id:"new-user-456"}]]},q={public:!1,in:(0,I.getEvent)("debug noise",{timestamp:1700000109}),mapping:{ignore:!0},out:[]};//# 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\n// JSON Schema\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 Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init().',\n ),\n secret: z\n .string()\n .describe(\n 'API secret for the /import endpoint (historical data). Required when useImport is true.',\n )\n .optional(),\n host: z\n .string()\n .describe(\n \"Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).\",\n )\n .optional(),\n protocol: z\n .string()\n .describe(\"Protocol for API requests. Default: 'https'.\")\n .optional(),\n keepAlive: z\n .boolean()\n .describe('Reuse HTTP connections. Default: true.')\n .optional(),\n geolocate: z\n .boolean()\n .describe(\n 'Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable SDK debug logging. Default: false.')\n .optional(),\n verbose: z\n .boolean()\n .describe('Enable verbose request logging. Default: false.')\n .optional(),\n test: z.boolean().describe('Enable dry-run mode. Default: false.').optional(),\n useImport: z\n .boolean()\n .describe(\n 'Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.',\n )\n .optional(),\n include: z\n .unknown()\n .describe(\n \"Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).\",\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 { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.',\n )\n .optional(),\n people: z\n .unknown()\n .describe(\n 'Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.',\n )\n .optional(),\n groupProfile: z\n .unknown()\n .describe(\n 'Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.',\n )\n .optional(),\n useImport: z\n .unknown()\n .describe(\n 'Per-event import flag. When truthy, uses mp.import() instead of mp.track() 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 {\n Env,\n MixpanelClient,\n MixpanelPeople,\n MixpanelGroups,\n} from '../types';\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nconst noopPeople: MixpanelPeople = {\n set: noop,\n set_once: noop,\n increment: noop,\n append: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_user: noop,\n};\n\nconst noopGroups: MixpanelGroups = {\n set: noop,\n set_once: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_group: noop,\n};\n\n/**\n * Mock Mixpanel factory that returns a no-op client instance.\n * Tests replace individual methods with spies.\n */\nfunction mockInit(): MixpanelClient {\n return {\n track: noop,\n import: noop,\n alias: noop,\n people: { ...noopPeople },\n groups: { ...noopGroups },\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * The test runner clones this and replaces methods with spies.\n */\nexport const push: Env = {\n Mixpanel: { init: mockInit as (...args: unknown[]) => MixpanelClient },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:Mixpanel.init',\n 'call:mp.track',\n 'call:mp.import',\n 'call:mp.alias',\n 'call:mp.people.set',\n 'call:mp.people.set_once',\n 'call:mp.people.increment',\n 'call:mp.people.append',\n 'call:mp.people.union',\n 'call:mp.people.remove',\n 'call:mp.people.unset',\n 'call:mp.people.delete_user',\n 'call:mp.groups.set',\n 'call:mp.groups.set_once',\n 'call:mp.groups.union',\n 'call:mp.groups.remove',\n 'call:mp.groups.unset',\n 'call:mp.groups.delete_group',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Mixpanel server SDK step examples.\n *\n * At push time, the destination calls the `mixpanel` Node SDK via the\n * client returned from `Mixpanel.init(...)`. Public method paths users\n * see on the client are:\n *\n * - `mp.track(eventName, properties)`\n * - `mp.import(eventName, time, properties)` (when `useImport: true`)\n * - `mp.alias(distinctId, alias)` (fires before track)\n * - `mp.people.{set,set_once,increment,append,union,remove,unset,delete_user}(...)`\n * - `mp.groups.{set,set_once,union,remove,unset,delete_group}(...)`\n *\n * Each `out` is `[[callable, ...args], ...]`. The test filters out the\n * one-time `Mixpanel.init` call (fired during destination init) so only\n * per-event SDK calls are compared.\n *\n * For events marked `skip: true` or `ignore: true`, `track()` does not\n * fire — only the side-effect calls (people/groups/alias) appear.\n */\n\n/**\n * Step examples may carry destination-level settings and configInclude.\n * The test runner reads these to configure the destination.\n */\nexport type MixpanelStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * mp.track(event.name, { distinct_id, ...properties }).\n * With default settings.identify resolving user.id.\n */\nexport const defaultEventForwarding: MixpanelStepExample = {\n title: 'Default track',\n description:\n 'A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.track', 'product view', { distinct_id: 'us3r' }]],\n};\n\n/**\n * Track with include — flattens walkerOS `data` section into\n * prefixed track() properties.\n */\nexport const trackWithInclude: MixpanelStepExample = {\n title: 'Track with include',\n description:\n 'A destination-level include flattens the event data section into prefixed Mixpanel track properties.',\n in: getEvent('product view', { timestamp: 1700000101 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n configInclude: ['data'],\n out: [\n [\n 'mp.track',\n 'product view',\n {\n distinct_id: 'us3r',\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 * Per-event identify — mapping-level settings.identify overrides\n * destination-level default.\n */\nexport const perEventIdentify: MixpanelStepExample = {\n title: 'Per-event identify',\n description:\n 'A mapping-level identify overrides the destination default to resolve the distinct_id from event data.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'resolved-id',\n plan: 'premium',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'user login',\n {\n distinct_id: 'resolved-id',\n },\n ],\n ],\n};\n\n/**\n * Track with group — group key/id attached as track property.\n */\nexport const trackWithGroup: MixpanelStepExample = {\n title: 'Track with group',\n description:\n 'A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.',\n in: getEvent('page view', {\n timestamp: 1700000103,\n data: {\n company_id: 'acme',\n },\n }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n mapping: {\n settings: {\n group: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'page view',\n {\n distinct_id: 'us3r',\n company_id: 'acme',\n },\n ],\n ],\n};\n\n/**\n * User login with people operations — skip: true suppresses track,\n * only identity + people side effects fire.\n */\nexport const userLoginPeopleSet: MixpanelStepExample = {\n title: 'User login people',\n description:\n 'A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.',\n in: getEvent('user login', {\n timestamp: 1700000104,\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 distinctId: 'data.user_id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n increment: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.people.set',\n 'new-user-123',\n { plan: 'premium', company: 'Acme', email: 'user@acme.com' },\n ],\n ['mp.people.set_once', 'new-user-123', { first_login: 1700000104 }],\n ['mp.people.increment', 'new-user-123', { login_count: 1 }],\n ],\n};\n\n/**\n * Common people operation vocabulary — exercises set, set_once, increment,\n * append, union, remove, unset. (delete_user is intentionally not covered\n * by this example.)\n */\nexport const allPeopleOperations: MixpanelStepExample = {\n title: 'Common people operations',\n description:\n 'A profile update exercises the common Mixpanel people vocabulary: set, set_once, increment, append, union, remove, and unset. delete_user is not covered by this example.',\n in: getEvent('profile update', {\n timestamp: 1700000105,\n data: {\n name: 'Jane Doe',\n email: 'jane@acme.com',\n page: '/docs/getting-started',\n removed_tag: 'trial',\n source: 'referral',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n name: 'data.name',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n signup_source: 'data.source',\n },\n },\n increment: {\n map: {\n page_views: { value: 1 },\n },\n },\n append: {\n map: {\n visited_pages: 'data.page',\n },\n },\n union: {\n map: {\n unique_tags: { value: ['active'] },\n },\n },\n remove: {\n map: {\n tags: 'data.removed_tag',\n },\n },\n unset: { value: ['old_plan'] },\n },\n },\n },\n },\n out: [\n ['mp.people.set', 'us3r', { name: 'Jane Doe', email: 'jane@acme.com' }],\n ['mp.people.set_once', 'us3r', { signup_source: 'referral' }],\n ['mp.people.increment', 'us3r', { page_views: 1 }],\n ['mp.people.append', 'us3r', { visited_pages: '/docs/getting-started' }],\n ['mp.people.union', 'us3r', { unique_tags: ['active'] }],\n ['mp.people.remove', 'us3r', { tags: 'trial' }],\n ['mp.people.unset', 'us3r', ['old_plan']],\n ],\n};\n\n/**\n * Group profile operations — settings.groupProfile with set and set_once.\n */\nexport const companyGroupProfile: MixpanelStepExample = {\n title: 'Group profile',\n description:\n 'A company update sets Mixpanel group profile properties via groups.set and groups.set_once.',\n in: getEvent('company update', {\n timestamp: 1700000106,\n data: {\n company_id: 'acme-inc',\n company_name: 'Acme, Inc.',\n plan: 'enterprise',\n employee_count: 250,\n founded_year: 2010,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n groupProfile: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n set: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.employee_count',\n },\n },\n set_once: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.groups.set',\n 'company_id',\n 'acme-inc',\n { name: 'Acme, Inc.', plan: 'enterprise', employee_count: 250 },\n ],\n ['mp.groups.set_once', 'company_id', 'acme-inc', { founded: 2010 }],\n ],\n};\n\n/**\n * Historical import — useImport: true uses mp.import() instead of mp.track().\n */\nexport const historicalImport: MixpanelStepExample = {\n title: 'Historical import',\n description:\n 'Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.',\n in: getEvent('order complete', {\n timestamp: 1700000107,\n data: {\n total: 99.99,\n },\n }),\n settings: {\n useImport: true,\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.import', 'order complete', 1700000107, { distinct_id: 'us3r' }]],\n};\n\n/**\n * Alias — legacy identity merge. Fires mp.alias before track.\n */\nexport const aliasBeforeTrack: MixpanelStepExample = {\n title: 'Alias before track',\n description:\n 'A user login merges a prior anonymous id into the new user id via mp.alias before sending the track event.',\n in: getEvent('user login', {\n timestamp: 1700000108,\n data: {\n user_id: 'new-user-456',\n anon_id: 'anon-789',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n alias: 'data.anon_id',\n },\n },\n },\n },\n out: [\n ['mp.alias', 'new-user-456', 'anon-789'],\n ['mp.track', 'user login', { distinct_id: 'new-user-456' }],\n ],\n};\n\n/**\n * Wildcard ignore — the rule matches but does nothing.\n */\nexport const wildcardIgnored: MixpanelStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000109 }),\n mapping: { ignore: true },\n out: [],\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,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CAAC,aAAa,kBAAkB,YAAY,EAAE,aAAa,OAAO,CAAC,CAAC;AAC5E;AAKO,IAAM,mBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,cAAc;AAAA,IACzB,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU;AAAA,MACR,UAAU;AAAA,QACR,KAAK;AAAA,UACH,YAAY;AAAA,UACZ,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,YAAY,gBAAgB,UAAU;AAAA,IACvC,CAAC,YAAY,cAAc,EAAE,aAAa,eAAe,CAAC;AAAA,EAC5D;AACF;AAKO,IAAM,kBAAuC;AAAA,EAClD,QAAQ;AAAA,EACR,QAAI,sBAAS,eAAe,EAAE,WAAW,WAAW,CAAC;AAAA,EACrD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","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\n// JSON Schema\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 Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init().',\n ),\n secret: z\n .string()\n .describe(\n 'API secret for the /import endpoint (historical data). Required when useImport is true.',\n )\n .optional(),\n host: z\n .string()\n .describe(\n \"Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).\",\n )\n .optional(),\n protocol: z\n .string()\n .describe(\"Protocol for API requests. Default: 'https'.\")\n .optional(),\n keepAlive: z\n .boolean()\n .describe('Reuse HTTP connections. Default: true.')\n .optional(),\n geolocate: z\n .boolean()\n .describe(\n 'Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable SDK debug logging. Default: false.')\n .optional(),\n verbose: z\n .boolean()\n .describe('Enable verbose request logging. Default: false.')\n .optional(),\n test: z.boolean().describe('Enable dry-run mode. Default: false.').optional(),\n useImport: z\n .boolean()\n .describe(\n 'Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.',\n )\n .optional(),\n include: z\n .unknown()\n .describe(\n \"Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).\",\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 { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.',\n )\n .optional(),\n people: z\n .unknown()\n .describe(\n 'Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.',\n )\n .optional(),\n groupProfile: z\n .unknown()\n .describe(\n 'Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.',\n )\n .optional(),\n useImport: z\n .unknown()\n .describe(\n 'Per-event import flag. When truthy, uses mp.import() instead of mp.track() 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 {\n Env,\n MixpanelClient,\n MixpanelPeople,\n MixpanelGroups,\n} from '../types';\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nconst noopPeople: MixpanelPeople = {\n set: noop,\n set_once: noop,\n increment: noop,\n append: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_user: noop,\n};\n\nconst noopGroups: MixpanelGroups = {\n set: noop,\n set_once: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_group: noop,\n};\n\n/**\n * Mock Mixpanel factory that returns a no-op client instance.\n * Tests replace individual methods with spies.\n */\nfunction mockInit(): MixpanelClient {\n return {\n track: noop,\n import: noop,\n alias: noop,\n people: { ...noopPeople },\n groups: { ...noopGroups },\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * The test runner clones this and replaces methods with spies.\n */\nexport const push: Env = {\n Mixpanel: { init: mockInit as (...args: unknown[]) => MixpanelClient },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:Mixpanel.init',\n 'call:mp.track',\n 'call:mp.import',\n 'call:mp.alias',\n 'call:mp.people.set',\n 'call:mp.people.set_once',\n 'call:mp.people.increment',\n 'call:mp.people.append',\n 'call:mp.people.union',\n 'call:mp.people.remove',\n 'call:mp.people.unset',\n 'call:mp.people.delete_user',\n 'call:mp.groups.set',\n 'call:mp.groups.set_once',\n 'call:mp.groups.union',\n 'call:mp.groups.remove',\n 'call:mp.groups.unset',\n 'call:mp.groups.delete_group',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Mixpanel server SDK step examples.\n *\n * At push time, the destination calls the `mixpanel` Node SDK via the\n * client returned from `Mixpanel.init(...)`. Public method paths users\n * see on the client are:\n *\n * - `mp.track(eventName, properties)`\n * - `mp.import(eventName, time, properties)` (when `useImport: true`)\n * - `mp.alias(distinctId, alias)` (fires before track)\n * - `mp.people.{set,set_once,increment,append,union,remove,unset,delete_user}(...)`\n * - `mp.groups.{set,set_once,union,remove,unset,delete_group}(...)`\n *\n * Each `out` is `[[callable, ...args], ...]`. The test filters out the\n * one-time `Mixpanel.init` call (fired during destination init) so only\n * per-event SDK calls are compared.\n *\n * For events marked `silent: true` or `ignore: true`, `track()` does not\n * fire - only the side-effect calls (people/groups/alias) appear.\n */\n\n/**\n * Step examples may carry destination-level settings and configInclude.\n * The test runner reads these to configure the destination.\n */\nexport type MixpanelStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * mp.track(event.name, { distinct_id, ...properties }).\n * With default settings.identify resolving user.id.\n */\nexport const defaultEventForwarding: MixpanelStepExample = {\n title: 'Default track',\n description:\n 'A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.track', 'product view', { distinct_id: 'us3r' }]],\n};\n\n/**\n * Track with include - flattens walkerOS `data` section into\n * prefixed track() properties.\n */\nexport const trackWithInclude: MixpanelStepExample = {\n title: 'Track with include',\n description:\n 'A destination-level include flattens the event data section into prefixed Mixpanel track properties.',\n in: getEvent('product view', { timestamp: 1700000101 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n configInclude: ['data'],\n out: [\n [\n 'mp.track',\n 'product view',\n {\n distinct_id: 'us3r',\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 * Per-event identify - mapping-level settings.identify overrides\n * destination-level default.\n */\nexport const perEventIdentify: MixpanelStepExample = {\n title: 'Per-event identify',\n description:\n 'A mapping-level identify overrides the destination default to resolve the distinct_id from event data.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'resolved-id',\n plan: 'premium',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'user login',\n {\n distinct_id: 'resolved-id',\n },\n ],\n ],\n};\n\n/**\n * Track with group - group key/id attached as track property.\n */\nexport const trackWithGroup: MixpanelStepExample = {\n title: 'Track with group',\n description:\n 'A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.',\n in: getEvent('page view', {\n timestamp: 1700000103,\n data: {\n company_id: 'acme',\n },\n }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n mapping: {\n settings: {\n group: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'page view',\n {\n distinct_id: 'us3r',\n company_id: 'acme',\n },\n ],\n ],\n};\n\n/**\n * User login with people operations - silent: true suppresses track,\n * only identity + people side effects fire.\n */\nexport const userLoginPeopleSet: MixpanelStepExample = {\n title: 'User login people',\n description:\n 'A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.',\n in: getEvent('user login', {\n timestamp: 1700000104,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n increment: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.people.set',\n 'new-user-123',\n { plan: 'premium', company: 'Acme', email: 'user@acme.com' },\n ],\n ['mp.people.set_once', 'new-user-123', { first_login: 1700000104 }],\n ['mp.people.increment', 'new-user-123', { login_count: 1 }],\n ],\n};\n\n/**\n * Common people operation vocabulary - exercises set, set_once, increment,\n * append, union, remove, unset. (delete_user is intentionally not covered\n * by this example.)\n */\nexport const allPeopleOperations: MixpanelStepExample = {\n title: 'Common people operations',\n description:\n 'A profile update exercises the common Mixpanel people vocabulary: set, set_once, increment, append, union, remove, and unset. delete_user is not covered by this example.',\n in: getEvent('profile update', {\n timestamp: 1700000105,\n data: {\n name: 'Jane Doe',\n email: 'jane@acme.com',\n page: '/docs/getting-started',\n removed_tag: 'trial',\n source: 'referral',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n name: 'data.name',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n signup_source: 'data.source',\n },\n },\n increment: {\n map: {\n page_views: { value: 1 },\n },\n },\n append: {\n map: {\n visited_pages: 'data.page',\n },\n },\n union: {\n map: {\n unique_tags: { value: ['active'] },\n },\n },\n remove: {\n map: {\n tags: 'data.removed_tag',\n },\n },\n unset: { value: ['old_plan'] },\n },\n },\n },\n },\n out: [\n ['mp.people.set', 'us3r', { name: 'Jane Doe', email: 'jane@acme.com' }],\n ['mp.people.set_once', 'us3r', { signup_source: 'referral' }],\n ['mp.people.increment', 'us3r', { page_views: 1 }],\n ['mp.people.append', 'us3r', { visited_pages: '/docs/getting-started' }],\n ['mp.people.union', 'us3r', { unique_tags: ['active'] }],\n ['mp.people.remove', 'us3r', { tags: 'trial' }],\n ['mp.people.unset', 'us3r', ['old_plan']],\n ],\n};\n\n/**\n * Group profile operations - settings.groupProfile with set and set_once.\n */\nexport const companyGroupProfile: MixpanelStepExample = {\n title: 'Group profile',\n description:\n 'A company update sets Mixpanel group profile properties via groups.set and groups.set_once.',\n in: getEvent('company update', {\n timestamp: 1700000106,\n data: {\n company_id: 'acme-inc',\n company_name: 'Acme, Inc.',\n plan: 'enterprise',\n employee_count: 250,\n founded_year: 2010,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n groupProfile: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n set: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.employee_count',\n },\n },\n set_once: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.groups.set',\n 'company_id',\n 'acme-inc',\n { name: 'Acme, Inc.', plan: 'enterprise', employee_count: 250 },\n ],\n ['mp.groups.set_once', 'company_id', 'acme-inc', { founded: 2010 }],\n ],\n};\n\n/**\n * Historical import - useImport: true uses mp.import() instead of mp.track().\n */\nexport const historicalImport: MixpanelStepExample = {\n title: 'Historical import',\n description:\n 'Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.',\n in: getEvent('order complete', {\n timestamp: 1700000107,\n data: {\n total: 99.99,\n },\n }),\n settings: {\n useImport: true,\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.import', 'order complete', 1700000107, { distinct_id: 'us3r' }]],\n};\n\n/**\n * Alias - legacy identity merge. Fires mp.alias before track.\n */\nexport const aliasBeforeTrack: MixpanelStepExample = {\n title: 'Alias before track',\n description:\n 'A user login merges a prior anonymous id into the new user id via mp.alias before sending the track event.',\n in: getEvent('user login', {\n timestamp: 1700000108,\n data: {\n user_id: 'new-user-456',\n anon_id: 'anon-789',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n alias: 'data.anon_id',\n },\n },\n },\n },\n out: [\n ['mp.alias', 'new-user-456', 'anon-789'],\n ['mp.track', 'user login', { distinct_id: 'new-user-456' }],\n ],\n};\n\n/**\n * Wildcard ignore - the rule matches but does nothing.\n */\nexport const wildcardIgnored: MixpanelStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000109 }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAA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,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AAAA,EACD,UAAU;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,MACR,KAAK;AAAA,QACH,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,aAAa,kBAAkB,YAAY,EAAE,aAAa,OAAO,CAAC,CAAC;AAC5E;AAKO,IAAM,mBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,cAAc;AAAA,IACzB,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU;AAAA,MACR,UAAU;AAAA,QACR,KAAK;AAAA,UACH,YAAY;AAAA,UACZ,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,YAAY,gBAAgB,UAAU;AAAA,IACvC,CAAC,YAAY,cAAc,EAAE,aAAa,eAAe,CAAC;AAAA,EAC5D;AACF;AAKO,IAAM,kBAAuC;AAAA,EAClD,QAAQ;AAAA,EACR,QAAI,sBAAS,eAAe,EAAE,WAAW,WAAW,CAAC;AAAA,EACrD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,i)=>{for(var a in i)e(t,a,{get:i[a],enumerable:!0})},i={};t(i,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>l,settings:()=>r});import{zodToSchema as a}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var o=n.object({apiKey:n.string().min(1).describe("Your Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init()."),secret:n.string().describe("API secret for the /import endpoint (historical data). Required when useImport is true.").optional(),host:n.string().describe("Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).").optional(),protocol:n.string().describe("Protocol for API requests. Default: 'https'.").optional(),keepAlive:n.boolean().describe("Reuse HTTP connections. Default: true.").optional(),geolocate:n.boolean().describe("Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.").optional(),debug:n.boolean().describe("Enable SDK debug logging. Default: false.").optional(),verbose:n.boolean().describe("Enable verbose request logging. Default: false.").optional(),test:n.boolean().describe("Enable dry-run mode. Default: false.").optional(),useImport:n.boolean().describe("Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.").optional(),identify:n.unknown().describe("walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.").optional(),include:n.unknown().describe("Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).").optional()});import{z as p}from"@walkeros/core/dev";var s=p.object({identify:p.unknown().describe("Per-event identity mapping. Resolves to { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.").optional(),people:p.unknown().describe("Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.").optional(),group:p.unknown().describe("Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.").optional(),groupProfile:p.unknown().describe("Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.").optional(),useImport:p.unknown().describe("Per-event import flag. When truthy, uses mp.import() instead of mp.track() for this rule.").optional()}),r=a(o),l=a(s),d={};t(d,{env:()=>c,step:()=>f});var c={};t(c,{push:()=>v,simulation:()=>_});var m=()=>{},u={set:m,set_once:m,increment:m,append:m,union:m,remove:m,unset:m,delete_user:m},g={set:m,set_once:m,union:m,remove:m,unset:m,delete_group:m};var v={Mixpanel:{init:function(){return{track:m,import:m,alias:m,people:{...u},groups:{...g}}}}},_=["call:Mixpanel.init","call:mp.track","call:mp.import","call:mp.alias","call:mp.people.set","call:mp.people.set_once","call:mp.people.increment","call:mp.people.append","call:mp.people.union","call:mp.people.remove","call:mp.people.unset","call:mp.people.delete_user","call:mp.groups.set","call:mp.groups.set_once","call:mp.groups.union","call:mp.groups.remove","call:mp.groups.unset","call:mp.groups.delete_group"],f={};t(f,{aliasBeforeTrack:()=>S,allPeopleOperations:()=>x,companyGroupProfile:()=>P,defaultEventForwarding:()=>k,historicalImport:()=>A,perEventIdentify:()=>h,trackWithGroup:()=>w,trackWithInclude:()=>b,userLoginPeopleSet:()=>I,wildcardIgnored:()=>D});import{getEvent as y}from"@walkeros/core";var k={title:"Default track",description:"A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.",in:y("product view",{timestamp:1700000100}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["mp.track","product view",{distinct_id:"us3r"}]]},b={title:"Track with include",description:"A destination-level include flattens the event data section into prefixed Mixpanel track properties.",in:y("product view",{timestamp:1700000101}),settings:{identify:{map:{distinctId:"user.id"}}},configInclude:["data"],out:[["mp.track","product view",{distinct_id:"us3r",data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},h={title:"Per-event identify",description:"A mapping-level identify overrides the destination default to resolve the distinct_id from event data.",in:y("user login",{timestamp:1700000102,data:{user_id:"resolved-id",plan:"premium"}}),mapping:{settings:{identify:{map:{distinctId:"data.user_id"}}}},out:[["mp.track","user login",{distinct_id:"resolved-id"}]]},w={title:"Track with group",description:"A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.",in:y("page view",{timestamp:1700000103,data:{company_id:"acme"}}),settings:{identify:{map:{distinctId:"user.id"}}},mapping:{settings:{group:{map:{key:{value:"company_id"},id:"data.company_id"}}}},out:[["mp.track","page view",{distinct_id:"us3r",company_id:"acme"}]]},I={title:"User login people",description:"A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.",in:y("user login",{timestamp:1700000104,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{
|
|
1
|
+
var e=Object.defineProperty,t=(t,i)=>{for(var a in i)e(t,a,{get:i[a],enumerable:!0})},i={};t(i,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>l,settings:()=>r});import{zodToSchema as a}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var o=n.object({apiKey:n.string().min(1).describe("Your Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init()."),secret:n.string().describe("API secret for the /import endpoint (historical data). Required when useImport is true.").optional(),host:n.string().describe("Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).").optional(),protocol:n.string().describe("Protocol for API requests. Default: 'https'.").optional(),keepAlive:n.boolean().describe("Reuse HTTP connections. Default: true.").optional(),geolocate:n.boolean().describe("Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.").optional(),debug:n.boolean().describe("Enable SDK debug logging. Default: false.").optional(),verbose:n.boolean().describe("Enable verbose request logging. Default: false.").optional(),test:n.boolean().describe("Enable dry-run mode. Default: false.").optional(),useImport:n.boolean().describe("Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.").optional(),identify:n.unknown().describe("walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.").optional(),include:n.unknown().describe("Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).").optional()});import{z as p}from"@walkeros/core/dev";var s=p.object({identify:p.unknown().describe("Per-event identity mapping. Resolves to { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.").optional(),people:p.unknown().describe("Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.").optional(),group:p.unknown().describe("Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.").optional(),groupProfile:p.unknown().describe("Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.").optional(),useImport:p.unknown().describe("Per-event import flag. When truthy, uses mp.import() instead of mp.track() for this rule.").optional()}),r=a(o),l=a(s),d={};t(d,{env:()=>c,step:()=>f});var c={};t(c,{push:()=>v,simulation:()=>_});var m=()=>{},u={set:m,set_once:m,increment:m,append:m,union:m,remove:m,unset:m,delete_user:m},g={set:m,set_once:m,union:m,remove:m,unset:m,delete_group:m};var v={Mixpanel:{init:function(){return{track:m,import:m,alias:m,people:{...u},groups:{...g}}}}},_=["call:Mixpanel.init","call:mp.track","call:mp.import","call:mp.alias","call:mp.people.set","call:mp.people.set_once","call:mp.people.increment","call:mp.people.append","call:mp.people.union","call:mp.people.remove","call:mp.people.unset","call:mp.people.delete_user","call:mp.groups.set","call:mp.groups.set_once","call:mp.groups.union","call:mp.groups.remove","call:mp.groups.unset","call:mp.groups.delete_group"],f={};t(f,{aliasBeforeTrack:()=>S,allPeopleOperations:()=>x,companyGroupProfile:()=>P,defaultEventForwarding:()=>k,historicalImport:()=>A,perEventIdentify:()=>h,trackWithGroup:()=>w,trackWithInclude:()=>b,userLoginPeopleSet:()=>I,wildcardIgnored:()=>D});import{getEvent as y}from"@walkeros/core";var k={title:"Default track",description:"A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.",in:y("product view",{timestamp:1700000100}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["mp.track","product view",{distinct_id:"us3r"}]]},b={title:"Track with include",description:"A destination-level include flattens the event data section into prefixed Mixpanel track properties.",in:y("product view",{timestamp:1700000101}),settings:{identify:{map:{distinctId:"user.id"}}},configInclude:["data"],out:[["mp.track","product view",{distinct_id:"us3r",data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},h={title:"Per-event identify",description:"A mapping-level identify overrides the destination default to resolve the distinct_id from event data.",in:y("user login",{timestamp:1700000102,data:{user_id:"resolved-id",plan:"premium"}}),mapping:{settings:{identify:{map:{distinctId:"data.user_id"}}}},out:[["mp.track","user login",{distinct_id:"resolved-id"}]]},w={title:"Track with group",description:"A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.",in:y("page view",{timestamp:1700000103,data:{company_id:"acme"}}),settings:{identify:{map:{distinctId:"user.id"}}},mapping:{settings:{group:{map:{key:{value:"company_id"},id:"data.company_id"}}}},out:[["mp.track","page view",{distinct_id:"us3r",company_id:"acme"}]]},I={title:"User login people",description:"A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.",in:y("user login",{timestamp:1700000104,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{distinctId:"data.user_id"}},people:{map:{set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},set_once:{map:{first_login:"timestamp"}},increment:{map:{login_count:{value:1}}}}}}},out:[["mp.people.set","new-user-123",{plan:"premium",company:"Acme",email:"user@acme.com"}],["mp.people.set_once","new-user-123",{first_login:1700000104}],["mp.people.increment","new-user-123",{login_count:1}]]},x={title:"Common people operations",description:"A profile update exercises the common Mixpanel people vocabulary: set, set_once, increment, append, union, remove, and unset. delete_user is not covered by this example.",in:y("profile update",{timestamp:1700000105,data:{name:"Jane Doe",email:"jane@acme.com",page:"/docs/getting-started",removed_tag:"trial",source:"referral"}}),mapping:{silent:!0,settings:{identify:{map:{distinctId:"user.id"}},people:{map:{set:{map:{name:"data.name",email:"data.email"}},set_once:{map:{signup_source:"data.source"}},increment:{map:{page_views:{value:1}}},append:{map:{visited_pages:"data.page"}},union:{map:{unique_tags:{value:["active"]}}},remove:{map:{tags:"data.removed_tag"}},unset:{value:["old_plan"]}}}}},out:[["mp.people.set","us3r",{name:"Jane Doe",email:"jane@acme.com"}],["mp.people.set_once","us3r",{signup_source:"referral"}],["mp.people.increment","us3r",{page_views:1}],["mp.people.append","us3r",{visited_pages:"/docs/getting-started"}],["mp.people.union","us3r",{unique_tags:["active"]}],["mp.people.remove","us3r",{tags:"trial"}],["mp.people.unset","us3r",["old_plan"]]]},P={title:"Group profile",description:"A company update sets Mixpanel group profile properties via groups.set and groups.set_once.",in:y("company update",{timestamp:1700000106,data:{company_id:"acme-inc",company_name:"Acme, Inc.",plan:"enterprise",employee_count:250,founded_year:2010}}),mapping:{silent:!0,settings:{groupProfile:{map:{key:{value:"company_id"},id:"data.company_id",set:{map:{name:"data.company_name",plan:"data.plan",employee_count:"data.employee_count"}},set_once:{map:{founded:"data.founded_year"}}}}}},out:[["mp.groups.set","company_id","acme-inc",{name:"Acme, Inc.",plan:"enterprise",employee_count:250}],["mp.groups.set_once","company_id","acme-inc",{founded:2010}]]},A={title:"Historical import",description:"Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.",in:y("order complete",{timestamp:1700000107,data:{total:99.99}}),settings:{useImport:!0,identify:{map:{distinctId:"user.id"}}},out:[["mp.import","order complete",1700000107,{distinct_id:"us3r"}]]},S={title:"Alias before track",description:"A user login merges a prior anonymous id into the new user id via mp.alias before sending the track event.",in:y("user login",{timestamp:1700000108,data:{user_id:"new-user-456",anon_id:"anon-789"}}),mapping:{settings:{identify:{map:{distinctId:"data.user_id",alias:"data.anon_id"}}}},out:[["mp.alias","new-user-456","anon-789"],["mp.track","user login",{distinct_id:"new-user-456"}]]},D={public:!1,in:y("debug noise",{timestamp:1700000109}),mapping:{ignore:!0},out:[]};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\n// JSON Schema\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 Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init().',\n ),\n secret: z\n .string()\n .describe(\n 'API secret for the /import endpoint (historical data). Required when useImport is true.',\n )\n .optional(),\n host: z\n .string()\n .describe(\n \"Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).\",\n )\n .optional(),\n protocol: z\n .string()\n .describe(\"Protocol for API requests. Default: 'https'.\")\n .optional(),\n keepAlive: z\n .boolean()\n .describe('Reuse HTTP connections. Default: true.')\n .optional(),\n geolocate: z\n .boolean()\n .describe(\n 'Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable SDK debug logging. Default: false.')\n .optional(),\n verbose: z\n .boolean()\n .describe('Enable verbose request logging. Default: false.')\n .optional(),\n test: z.boolean().describe('Enable dry-run mode. Default: false.').optional(),\n useImport: z\n .boolean()\n .describe(\n 'Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.',\n )\n .optional(),\n include: z\n .unknown()\n .describe(\n \"Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).\",\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 { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.',\n )\n .optional(),\n people: z\n .unknown()\n .describe(\n 'Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.',\n )\n .optional(),\n groupProfile: z\n .unknown()\n .describe(\n 'Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.',\n )\n .optional(),\n useImport: z\n .unknown()\n .describe(\n 'Per-event import flag. When truthy, uses mp.import() instead of mp.track() 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 {\n Env,\n MixpanelClient,\n MixpanelPeople,\n MixpanelGroups,\n} from '../types';\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nconst noopPeople: MixpanelPeople = {\n set: noop,\n set_once: noop,\n increment: noop,\n append: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_user: noop,\n};\n\nconst noopGroups: MixpanelGroups = {\n set: noop,\n set_once: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_group: noop,\n};\n\n/**\n * Mock Mixpanel factory that returns a no-op client instance.\n * Tests replace individual methods with spies.\n */\nfunction mockInit(): MixpanelClient {\n return {\n track: noop,\n import: noop,\n alias: noop,\n people: { ...noopPeople },\n groups: { ...noopGroups },\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * The test runner clones this and replaces methods with spies.\n */\nexport const push: Env = {\n Mixpanel: { init: mockInit as (...args: unknown[]) => MixpanelClient },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:Mixpanel.init',\n 'call:mp.track',\n 'call:mp.import',\n 'call:mp.alias',\n 'call:mp.people.set',\n 'call:mp.people.set_once',\n 'call:mp.people.increment',\n 'call:mp.people.append',\n 'call:mp.people.union',\n 'call:mp.people.remove',\n 'call:mp.people.unset',\n 'call:mp.people.delete_user',\n 'call:mp.groups.set',\n 'call:mp.groups.set_once',\n 'call:mp.groups.union',\n 'call:mp.groups.remove',\n 'call:mp.groups.unset',\n 'call:mp.groups.delete_group',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Mixpanel server SDK step examples.\n *\n * At push time, the destination calls the `mixpanel` Node SDK via the\n * client returned from `Mixpanel.init(...)`. Public method paths users\n * see on the client are:\n *\n * - `mp.track(eventName, properties)`\n * - `mp.import(eventName, time, properties)` (when `useImport: true`)\n * - `mp.alias(distinctId, alias)` (fires before track)\n * - `mp.people.{set,set_once,increment,append,union,remove,unset,delete_user}(...)`\n * - `mp.groups.{set,set_once,union,remove,unset,delete_group}(...)`\n *\n * Each `out` is `[[callable, ...args], ...]`. The test filters out the\n * one-time `Mixpanel.init` call (fired during destination init) so only\n * per-event SDK calls are compared.\n *\n * For events marked `skip: true` or `ignore: true`, `track()` does not\n * fire — only the side-effect calls (people/groups/alias) appear.\n */\n\n/**\n * Step examples may carry destination-level settings and configInclude.\n * The test runner reads these to configure the destination.\n */\nexport type MixpanelStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * mp.track(event.name, { distinct_id, ...properties }).\n * With default settings.identify resolving user.id.\n */\nexport const defaultEventForwarding: MixpanelStepExample = {\n title: 'Default track',\n description:\n 'A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.track', 'product view', { distinct_id: 'us3r' }]],\n};\n\n/**\n * Track with include — flattens walkerOS `data` section into\n * prefixed track() properties.\n */\nexport const trackWithInclude: MixpanelStepExample = {\n title: 'Track with include',\n description:\n 'A destination-level include flattens the event data section into prefixed Mixpanel track properties.',\n in: getEvent('product view', { timestamp: 1700000101 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n configInclude: ['data'],\n out: [\n [\n 'mp.track',\n 'product view',\n {\n distinct_id: 'us3r',\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 * Per-event identify — mapping-level settings.identify overrides\n * destination-level default.\n */\nexport const perEventIdentify: MixpanelStepExample = {\n title: 'Per-event identify',\n description:\n 'A mapping-level identify overrides the destination default to resolve the distinct_id from event data.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'resolved-id',\n plan: 'premium',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'user login',\n {\n distinct_id: 'resolved-id',\n },\n ],\n ],\n};\n\n/**\n * Track with group — group key/id attached as track property.\n */\nexport const trackWithGroup: MixpanelStepExample = {\n title: 'Track with group',\n description:\n 'A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.',\n in: getEvent('page view', {\n timestamp: 1700000103,\n data: {\n company_id: 'acme',\n },\n }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n mapping: {\n settings: {\n group: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'page view',\n {\n distinct_id: 'us3r',\n company_id: 'acme',\n },\n ],\n ],\n};\n\n/**\n * User login with people operations — skip: true suppresses track,\n * only identity + people side effects fire.\n */\nexport const userLoginPeopleSet: MixpanelStepExample = {\n title: 'User login people',\n description:\n 'A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.',\n in: getEvent('user login', {\n timestamp: 1700000104,\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 distinctId: 'data.user_id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n increment: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.people.set',\n 'new-user-123',\n { plan: 'premium', company: 'Acme', email: 'user@acme.com' },\n ],\n ['mp.people.set_once', 'new-user-123', { first_login: 1700000104 }],\n ['mp.people.increment', 'new-user-123', { login_count: 1 }],\n ],\n};\n\n/**\n * Common people operation vocabulary — exercises set, set_once, increment,\n * append, union, remove, unset. (delete_user is intentionally not covered\n * by this example.)\n */\nexport const allPeopleOperations: MixpanelStepExample = {\n title: 'Common people operations',\n description:\n 'A profile update exercises the common Mixpanel people vocabulary: set, set_once, increment, append, union, remove, and unset. delete_user is not covered by this example.',\n in: getEvent('profile update', {\n timestamp: 1700000105,\n data: {\n name: 'Jane Doe',\n email: 'jane@acme.com',\n page: '/docs/getting-started',\n removed_tag: 'trial',\n source: 'referral',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n name: 'data.name',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n signup_source: 'data.source',\n },\n },\n increment: {\n map: {\n page_views: { value: 1 },\n },\n },\n append: {\n map: {\n visited_pages: 'data.page',\n },\n },\n union: {\n map: {\n unique_tags: { value: ['active'] },\n },\n },\n remove: {\n map: {\n tags: 'data.removed_tag',\n },\n },\n unset: { value: ['old_plan'] },\n },\n },\n },\n },\n out: [\n ['mp.people.set', 'us3r', { name: 'Jane Doe', email: 'jane@acme.com' }],\n ['mp.people.set_once', 'us3r', { signup_source: 'referral' }],\n ['mp.people.increment', 'us3r', { page_views: 1 }],\n ['mp.people.append', 'us3r', { visited_pages: '/docs/getting-started' }],\n ['mp.people.union', 'us3r', { unique_tags: ['active'] }],\n ['mp.people.remove', 'us3r', { tags: 'trial' }],\n ['mp.people.unset', 'us3r', ['old_plan']],\n ],\n};\n\n/**\n * Group profile operations — settings.groupProfile with set and set_once.\n */\nexport const companyGroupProfile: MixpanelStepExample = {\n title: 'Group profile',\n description:\n 'A company update sets Mixpanel group profile properties via groups.set and groups.set_once.',\n in: getEvent('company update', {\n timestamp: 1700000106,\n data: {\n company_id: 'acme-inc',\n company_name: 'Acme, Inc.',\n plan: 'enterprise',\n employee_count: 250,\n founded_year: 2010,\n },\n }),\n mapping: {\n skip: true,\n settings: {\n groupProfile: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n set: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.employee_count',\n },\n },\n set_once: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.groups.set',\n 'company_id',\n 'acme-inc',\n { name: 'Acme, Inc.', plan: 'enterprise', employee_count: 250 },\n ],\n ['mp.groups.set_once', 'company_id', 'acme-inc', { founded: 2010 }],\n ],\n};\n\n/**\n * Historical import — useImport: true uses mp.import() instead of mp.track().\n */\nexport const historicalImport: MixpanelStepExample = {\n title: 'Historical import',\n description:\n 'Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.',\n in: getEvent('order complete', {\n timestamp: 1700000107,\n data: {\n total: 99.99,\n },\n }),\n settings: {\n useImport: true,\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.import', 'order complete', 1700000107, { distinct_id: 'us3r' }]],\n};\n\n/**\n * Alias — legacy identity merge. Fires mp.alias before track.\n */\nexport const aliasBeforeTrack: MixpanelStepExample = {\n title: 'Alias before track',\n description:\n 'A user login merges a prior anonymous id into the new user id via mp.alias before sending the track event.',\n in: getEvent('user login', {\n timestamp: 1700000108,\n data: {\n user_id: 'new-user-456',\n anon_id: 'anon-789',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n alias: 'data.anon_id',\n },\n },\n },\n },\n out: [\n ['mp.alias', 'new-user-456', 'anon-789'],\n ['mp.track', 'user login', { distinct_id: 'new-user-456' }],\n ],\n};\n\n/**\n * Wildcard ignore — the rule matches but does nothing.\n */\nexport const wildcardIgnored: MixpanelStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000109 }),\n mapping: { ignore: true },\n out: [],\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,QAAQ,EACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,OAAO,EACP,SAAS,8CAA8C,EACvD,SAAS;AAAA,EACZ,WAAW,EACR,QAAQ,EACR,SAAS,wCAAwC,EACjD,SAAS;AAAA,EACZ,WAAW,EACR,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,EACJ,QAAQ,EACR,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,SAAS,EACN,QAAQ,EACR,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,MAAM,EAAE,QAAQ,EAAE,SAAS,sCAAsC,EAAE,SAAS;AAAA,EAC5E,WAAW,EACR,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AC9DD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,U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AM,cAAc,gBAAgB,IAAI;AAAA,IAChE;AAAA,IACA,CAAC,sBAAsB,cAAc,YAAY,EAAE,SAAS,KAAK,CAAC;AAAA,EACpE;AACF;AAKO,IAAM,mBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AAAA,EACD,UAAU;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,MACR,KAAK;AAAA,QACH,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,aAAa,kBAAkB,YAAY,EAAE,aAAa,OAAO,CAAC,CAAC;AAC5E;AAKO,IAAM,mBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,cAAc;AAAA,IACzB,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU;AAAA,MACR,UAAU;AAAA,QACR,KAAK;AAAA,UACH,YAAY;AAAA,UACZ,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,YAAY,gBAAgB,UAAU;AAAA,IACvC,CAAC,YAAY,cAAc,EAAE,aAAa,eAAe,CAAC;AAAA,EAC5D;AACF;AAKO,IAAM,kBAAuC;AAAA,EAClD,QAAQ;AAAA,EACR,IAAI,SAAS,eAAe,EAAE,WAAW,WAAW,CAAC;AAAA,EACrD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","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\n// JSON Schema\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 Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init().',\n ),\n secret: z\n .string()\n .describe(\n 'API secret for the /import endpoint (historical data). Required when useImport is true.',\n )\n .optional(),\n host: z\n .string()\n .describe(\n \"Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).\",\n )\n .optional(),\n protocol: z\n .string()\n .describe(\"Protocol for API requests. Default: 'https'.\")\n .optional(),\n keepAlive: z\n .boolean()\n .describe('Reuse HTTP connections. Default: true.')\n .optional(),\n geolocate: z\n .boolean()\n .describe(\n 'Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable SDK debug logging. Default: false.')\n .optional(),\n verbose: z\n .boolean()\n .describe('Enable verbose request logging. Default: false.')\n .optional(),\n test: z.boolean().describe('Enable dry-run mode. Default: false.').optional(),\n useImport: z\n .boolean()\n .describe(\n 'Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.',\n )\n .optional(),\n include: z\n .unknown()\n .describe(\n \"Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).\",\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 { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.',\n )\n .optional(),\n people: z\n .unknown()\n .describe(\n 'Per-event people operations. Resolves to an object with any of: set, set_once, increment, append, union, remove, unset, delete_user. Each key fires a separate mp.people.* call with distinct_id as first arg.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.',\n )\n .optional(),\n groupProfile: z\n .unknown()\n .describe(\n 'Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.',\n )\n .optional(),\n useImport: z\n .unknown()\n .describe(\n 'Per-event import flag. When truthy, uses mp.import() instead of mp.track() 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 {\n Env,\n MixpanelClient,\n MixpanelPeople,\n MixpanelGroups,\n} from '../types';\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nconst noopPeople: MixpanelPeople = {\n set: noop,\n set_once: noop,\n increment: noop,\n append: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_user: noop,\n};\n\nconst noopGroups: MixpanelGroups = {\n set: noop,\n set_once: noop,\n union: noop,\n remove: noop,\n unset: noop,\n delete_group: noop,\n};\n\n/**\n * Mock Mixpanel factory that returns a no-op client instance.\n * Tests replace individual methods with spies.\n */\nfunction mockInit(): MixpanelClient {\n return {\n track: noop,\n import: noop,\n alias: noop,\n people: { ...noopPeople },\n groups: { ...noopGroups },\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * The test runner clones this and replaces methods with spies.\n */\nexport const push: Env = {\n Mixpanel: { init: mockInit as (...args: unknown[]) => MixpanelClient },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:Mixpanel.init',\n 'call:mp.track',\n 'call:mp.import',\n 'call:mp.alias',\n 'call:mp.people.set',\n 'call:mp.people.set_once',\n 'call:mp.people.increment',\n 'call:mp.people.append',\n 'call:mp.people.union',\n 'call:mp.people.remove',\n 'call:mp.people.unset',\n 'call:mp.people.delete_user',\n 'call:mp.groups.set',\n 'call:mp.groups.set_once',\n 'call:mp.groups.union',\n 'call:mp.groups.remove',\n 'call:mp.groups.unset',\n 'call:mp.groups.delete_group',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Mixpanel server SDK step examples.\n *\n * At push time, the destination calls the `mixpanel` Node SDK via the\n * client returned from `Mixpanel.init(...)`. Public method paths users\n * see on the client are:\n *\n * - `mp.track(eventName, properties)`\n * - `mp.import(eventName, time, properties)` (when `useImport: true`)\n * - `mp.alias(distinctId, alias)` (fires before track)\n * - `mp.people.{set,set_once,increment,append,union,remove,unset,delete_user}(...)`\n * - `mp.groups.{set,set_once,union,remove,unset,delete_group}(...)`\n *\n * Each `out` is `[[callable, ...args], ...]`. The test filters out the\n * one-time `Mixpanel.init` call (fired during destination init) so only\n * per-event SDK calls are compared.\n *\n * For events marked `silent: true` or `ignore: true`, `track()` does not\n * fire - only the side-effect calls (people/groups/alias) appear.\n */\n\n/**\n * Step examples may carry destination-level settings and configInclude.\n * The test runner reads these to configure the destination.\n */\nexport type MixpanelStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * mp.track(event.name, { distinct_id, ...properties }).\n * With default settings.identify resolving user.id.\n */\nexport const defaultEventForwarding: MixpanelStepExample = {\n title: 'Default track',\n description:\n 'A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.track', 'product view', { distinct_id: 'us3r' }]],\n};\n\n/**\n * Track with include - flattens walkerOS `data` section into\n * prefixed track() properties.\n */\nexport const trackWithInclude: MixpanelStepExample = {\n title: 'Track with include',\n description:\n 'A destination-level include flattens the event data section into prefixed Mixpanel track properties.',\n in: getEvent('product view', { timestamp: 1700000101 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n configInclude: ['data'],\n out: [\n [\n 'mp.track',\n 'product view',\n {\n distinct_id: 'us3r',\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 * Per-event identify - mapping-level settings.identify overrides\n * destination-level default.\n */\nexport const perEventIdentify: MixpanelStepExample = {\n title: 'Per-event identify',\n description:\n 'A mapping-level identify overrides the destination default to resolve the distinct_id from event data.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'resolved-id',\n plan: 'premium',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'user login',\n {\n distinct_id: 'resolved-id',\n },\n ],\n ],\n};\n\n/**\n * Track with group - group key/id attached as track property.\n */\nexport const trackWithGroup: MixpanelStepExample = {\n title: 'Track with group',\n description:\n 'A group key and id are attached as a Mixpanel track property so the event is associated with a company or account.',\n in: getEvent('page view', {\n timestamp: 1700000103,\n data: {\n company_id: 'acme',\n },\n }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n mapping: {\n settings: {\n group: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n },\n },\n },\n },\n out: [\n [\n 'mp.track',\n 'page view',\n {\n distinct_id: 'us3r',\n company_id: 'acme',\n },\n ],\n ],\n};\n\n/**\n * User login with people operations - silent: true suppresses track,\n * only identity + people side effects fire.\n */\nexport const userLoginPeopleSet: MixpanelStepExample = {\n title: 'User login people',\n description:\n 'A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.',\n in: getEvent('user login', {\n timestamp: 1700000104,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n increment: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.people.set',\n 'new-user-123',\n { plan: 'premium', company: 'Acme', email: 'user@acme.com' },\n ],\n ['mp.people.set_once', 'new-user-123', { first_login: 1700000104 }],\n ['mp.people.increment', 'new-user-123', { login_count: 1 }],\n ],\n};\n\n/**\n * Common people operation vocabulary - exercises set, set_once, increment,\n * append, union, remove, unset. (delete_user is intentionally not covered\n * by this example.)\n */\nexport const allPeopleOperations: MixpanelStepExample = {\n title: 'Common people operations',\n description:\n 'A profile update exercises the common Mixpanel people vocabulary: set, set_once, increment, append, union, remove, and unset. delete_user is not covered by this example.',\n in: getEvent('profile update', {\n timestamp: 1700000105,\n data: {\n name: 'Jane Doe',\n email: 'jane@acme.com',\n page: '/docs/getting-started',\n removed_tag: 'trial',\n source: 'referral',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n people: {\n map: {\n set: {\n map: {\n name: 'data.name',\n email: 'data.email',\n },\n },\n set_once: {\n map: {\n signup_source: 'data.source',\n },\n },\n increment: {\n map: {\n page_views: { value: 1 },\n },\n },\n append: {\n map: {\n visited_pages: 'data.page',\n },\n },\n union: {\n map: {\n unique_tags: { value: ['active'] },\n },\n },\n remove: {\n map: {\n tags: 'data.removed_tag',\n },\n },\n unset: { value: ['old_plan'] },\n },\n },\n },\n },\n out: [\n ['mp.people.set', 'us3r', { name: 'Jane Doe', email: 'jane@acme.com' }],\n ['mp.people.set_once', 'us3r', { signup_source: 'referral' }],\n ['mp.people.increment', 'us3r', { page_views: 1 }],\n ['mp.people.append', 'us3r', { visited_pages: '/docs/getting-started' }],\n ['mp.people.union', 'us3r', { unique_tags: ['active'] }],\n ['mp.people.remove', 'us3r', { tags: 'trial' }],\n ['mp.people.unset', 'us3r', ['old_plan']],\n ],\n};\n\n/**\n * Group profile operations - settings.groupProfile with set and set_once.\n */\nexport const companyGroupProfile: MixpanelStepExample = {\n title: 'Group profile',\n description:\n 'A company update sets Mixpanel group profile properties via groups.set and groups.set_once.',\n in: getEvent('company update', {\n timestamp: 1700000106,\n data: {\n company_id: 'acme-inc',\n company_name: 'Acme, Inc.',\n plan: 'enterprise',\n employee_count: 250,\n founded_year: 2010,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n groupProfile: {\n map: {\n key: { value: 'company_id' },\n id: 'data.company_id',\n set: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.employee_count',\n },\n },\n set_once: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'mp.groups.set',\n 'company_id',\n 'acme-inc',\n { name: 'Acme, Inc.', plan: 'enterprise', employee_count: 250 },\n ],\n ['mp.groups.set_once', 'company_id', 'acme-inc', { founded: 2010 }],\n ],\n};\n\n/**\n * Historical import - useImport: true uses mp.import() instead of mp.track().\n */\nexport const historicalImport: MixpanelStepExample = {\n title: 'Historical import',\n description:\n 'Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.',\n in: getEvent('order complete', {\n timestamp: 1700000107,\n data: {\n total: 99.99,\n },\n }),\n settings: {\n useImport: true,\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [['mp.import', 'order complete', 1700000107, { distinct_id: 'us3r' }]],\n};\n\n/**\n * Alias - legacy identity merge. Fires mp.alias before track.\n */\nexport const aliasBeforeTrack: MixpanelStepExample = {\n title: 'Alias before track',\n description:\n 'A user login merges a prior anonymous id into the new user id via mp.alias before sending the track event.',\n in: getEvent('user login', {\n timestamp: 1700000108,\n data: {\n user_id: 'new-user-456',\n anon_id: 'anon-789',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n alias: 'data.anon_id',\n },\n },\n },\n },\n out: [\n ['mp.alias', 'new-user-456', 'anon-789'],\n ['mp.track', 'user login', { distinct_id: 'new-user-456' }],\n ],\n};\n\n/**\n * Wildcard ignore - the rule matches but does nothing.\n */\nexport const wildcardIgnored: MixpanelStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000109 }),\n mapping: { ignore: true },\n out: [],\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,QAAQ,EACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,OAAO,EACP,SAAS,8CAA8C,EACvD,SAAS;AAAA,EACZ,WAAW,EACR,QAAQ,EACR,SAAS,wCAAwC,EACjD,SAAS;AAAA,EACZ,WAAW,EACR,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,EACJ,QAAQ,EACR,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,SAAS,EACN,QAAQ,EACR,SAAS,iDAAiD,EAC1D,SAAS;AAAA,EACZ,MAAM,EAAE,QAAQ,EAAE,SAAS,sCAAsC,EAAE,SAAS;AAAA,EAC5E,WAAW,EACR,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,QAAQ,EACR;AAAA,IACC;AAAA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8 @@ declare namespace env {
|
|
|
96
96
|
* one-time `Mixpanel.init` call (fired during destination init) so only
|
|
97
97
|
* per-event SDK calls are compared.
|
|
98
98
|
*
|
|
99
|
-
* For events marked `
|
|
100
|
-
* fire
|
|
99
|
+
* For events marked `silent: true` or `ignore: true`, `track()` does not
|
|
100
|
+
* fire - only the side-effect calls (people/groups/alias) appear.
|
|
101
101
|
*/
|
|
102
102
|
/**
|
|
103
103
|
* Step examples may carry destination-level settings and configInclude.
|
|
@@ -108,50 +108,50 @@ type MixpanelStepExample = Flow.StepExample & {
|
|
|
108
108
|
configInclude?: string[];
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
|
-
* Default event forwarding
|
|
111
|
+
* Default event forwarding - every walkerOS event becomes
|
|
112
112
|
* mp.track(event.name, { distinct_id, ...properties }).
|
|
113
113
|
* With default settings.identify resolving user.id.
|
|
114
114
|
*/
|
|
115
115
|
declare const defaultEventForwarding: MixpanelStepExample;
|
|
116
116
|
/**
|
|
117
|
-
* Track with include
|
|
117
|
+
* Track with include - flattens walkerOS `data` section into
|
|
118
118
|
* prefixed track() properties.
|
|
119
119
|
*/
|
|
120
120
|
declare const trackWithInclude: MixpanelStepExample;
|
|
121
121
|
/**
|
|
122
|
-
* Per-event identify
|
|
122
|
+
* Per-event identify - mapping-level settings.identify overrides
|
|
123
123
|
* destination-level default.
|
|
124
124
|
*/
|
|
125
125
|
declare const perEventIdentify: MixpanelStepExample;
|
|
126
126
|
/**
|
|
127
|
-
* Track with group
|
|
127
|
+
* Track with group - group key/id attached as track property.
|
|
128
128
|
*/
|
|
129
129
|
declare const trackWithGroup: MixpanelStepExample;
|
|
130
130
|
/**
|
|
131
|
-
* User login with people operations
|
|
131
|
+
* User login with people operations - silent: true suppresses track,
|
|
132
132
|
* only identity + people side effects fire.
|
|
133
133
|
*/
|
|
134
134
|
declare const userLoginPeopleSet: MixpanelStepExample;
|
|
135
135
|
/**
|
|
136
|
-
* Common people operation vocabulary
|
|
136
|
+
* Common people operation vocabulary - exercises set, set_once, increment,
|
|
137
137
|
* append, union, remove, unset. (delete_user is intentionally not covered
|
|
138
138
|
* by this example.)
|
|
139
139
|
*/
|
|
140
140
|
declare const allPeopleOperations: MixpanelStepExample;
|
|
141
141
|
/**
|
|
142
|
-
* Group profile operations
|
|
142
|
+
* Group profile operations - settings.groupProfile with set and set_once.
|
|
143
143
|
*/
|
|
144
144
|
declare const companyGroupProfile: MixpanelStepExample;
|
|
145
145
|
/**
|
|
146
|
-
* Historical import
|
|
146
|
+
* Historical import - useImport: true uses mp.import() instead of mp.track().
|
|
147
147
|
*/
|
|
148
148
|
declare const historicalImport: MixpanelStepExample;
|
|
149
149
|
/**
|
|
150
|
-
* Alias
|
|
150
|
+
* Alias - legacy identity merge. Fires mp.alias before track.
|
|
151
151
|
*/
|
|
152
152
|
declare const aliasBeforeTrack: MixpanelStepExample;
|
|
153
153
|
/**
|
|
154
|
-
* Wildcard ignore
|
|
154
|
+
* Wildcard ignore - the rule matches but does nothing.
|
|
155
155
|
*/
|
|
156
156
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
157
157
|
|