@walkeros/server-destination-mixpanel 4.8.1 → 4.8.2
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/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/dist/dev.d.mts +11 -2
- package/dist/dev.d.ts +11 -2
- 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 +10 -1
- package/dist/examples/index.d.ts +10 -1
- package/dist/examples/index.js +48 -7
- package/dist/examples/index.mjs +49 -8
- 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 +219 -13
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @walkeros/server-destination-mixpanel
|
|
2
2
|
|
|
3
|
+
## 4.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- acf757d: A silent rule whose identify, group or similar mapping resolves to
|
|
8
|
+
nothing sends nothing, counts as delivered and writes one DEBUG line naming
|
|
9
|
+
the call and mapping key, never the value. HubSpot's warning and Mixpanel's
|
|
10
|
+
error for this case are now DEBUG, because nothing was lost.
|
|
11
|
+
- 2374f54: A failed request is reported as a failed push (dead-letter queue, one
|
|
12
|
+
ERROR line with the status) instead of counting as delivered or being logged
|
|
13
|
+
at debug. Events a destination cannot send, such as a missing user identifier,
|
|
14
|
+
fail with `missing-input`. Rules with `silent: true` send no event of their
|
|
15
|
+
own.
|
|
16
|
+
- Updated dependencies [2374f54]
|
|
17
|
+
- Updated dependencies [7e5fc27]
|
|
18
|
+
- Updated dependencies [2374f54]
|
|
19
|
+
- Updated dependencies [964590a]
|
|
20
|
+
- Updated dependencies [4100ede]
|
|
21
|
+
- Updated dependencies [2374f54]
|
|
22
|
+
- Updated dependencies [2374f54]
|
|
23
|
+
- Updated dependencies [15eb7b2]
|
|
24
|
+
- Updated dependencies [33a2779]
|
|
25
|
+
- Updated dependencies [33a2779]
|
|
26
|
+
- Updated dependencies [2374f54]
|
|
27
|
+
- @walkeros/core@4.8.2
|
|
28
|
+
- @walkeros/server-core@4.8.2
|
|
29
|
+
|
|
3
30
|
## 4.8.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/README.md
CHANGED
package/dist/dev.d.mts
CHANGED
|
@@ -16,7 +16,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
16
16
|
useImport: z.ZodOptional<z.ZodBoolean>;
|
|
17
17
|
identify: z.ZodOptional<z.ZodUnknown>;
|
|
18
18
|
include: z.ZodOptional<z.ZodUnknown>;
|
|
19
|
-
}, z.core.$
|
|
19
|
+
}, z.core.$strict>;
|
|
20
20
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
21
21
|
|
|
22
22
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -196,20 +196,29 @@ declare const aliasBeforeTrack: MixpanelStepExample;
|
|
|
196
196
|
* Wildcard ignore - the rule matches but does nothing.
|
|
197
197
|
*/
|
|
198
198
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
199
|
+
/** A silent rule sends nothing to Mixpanel. */
|
|
200
|
+
declare const silentRule: Flow.StepExample;
|
|
201
|
+
declare const userLoginPeopleSetSkip: MixpanelStepExample;
|
|
202
|
+
declare const allPeopleOperationsSkip: MixpanelStepExample;
|
|
203
|
+
declare const companyGroupProfileSkip: MixpanelStepExample;
|
|
199
204
|
|
|
200
205
|
type step_MixpanelStepExample = MixpanelStepExample;
|
|
201
206
|
declare const step_aliasBeforeTrack: typeof aliasBeforeTrack;
|
|
202
207
|
declare const step_allPeopleOperations: typeof allPeopleOperations;
|
|
208
|
+
declare const step_allPeopleOperationsSkip: typeof allPeopleOperationsSkip;
|
|
203
209
|
declare const step_companyGroupProfile: typeof companyGroupProfile;
|
|
210
|
+
declare const step_companyGroupProfileSkip: typeof companyGroupProfileSkip;
|
|
204
211
|
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
205
212
|
declare const step_historicalImport: typeof historicalImport;
|
|
206
213
|
declare const step_perEventIdentify: typeof perEventIdentify;
|
|
214
|
+
declare const step_silentRule: typeof silentRule;
|
|
207
215
|
declare const step_trackWithGroup: typeof trackWithGroup;
|
|
208
216
|
declare const step_trackWithInclude: typeof trackWithInclude;
|
|
209
217
|
declare const step_userLoginPeopleSet: typeof userLoginPeopleSet;
|
|
218
|
+
declare const step_userLoginPeopleSetSkip: typeof userLoginPeopleSetSkip;
|
|
210
219
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
211
220
|
declare namespace step {
|
|
212
|
-
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_companyGroupProfile as companyGroupProfile, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_wildcardIgnored as wildcardIgnored };
|
|
221
|
+
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_allPeopleOperationsSkip as allPeopleOperationsSkip, step_companyGroupProfile as companyGroupProfile, step_companyGroupProfileSkip as companyGroupProfileSkip, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_silentRule as silentRule, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_userLoginPeopleSetSkip as userLoginPeopleSetSkip, step_wildcardIgnored as wildcardIgnored };
|
|
213
222
|
}
|
|
214
223
|
|
|
215
224
|
declare const index_env: typeof env;
|
package/dist/dev.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
16
16
|
useImport: z.ZodOptional<z.ZodBoolean>;
|
|
17
17
|
identify: z.ZodOptional<z.ZodUnknown>;
|
|
18
18
|
include: z.ZodOptional<z.ZodUnknown>;
|
|
19
|
-
}, z.core.$
|
|
19
|
+
}, z.core.$strict>;
|
|
20
20
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
21
21
|
|
|
22
22
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -196,20 +196,29 @@ declare const aliasBeforeTrack: MixpanelStepExample;
|
|
|
196
196
|
* Wildcard ignore - the rule matches but does nothing.
|
|
197
197
|
*/
|
|
198
198
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
199
|
+
/** A silent rule sends nothing to Mixpanel. */
|
|
200
|
+
declare const silentRule: Flow.StepExample;
|
|
201
|
+
declare const userLoginPeopleSetSkip: MixpanelStepExample;
|
|
202
|
+
declare const allPeopleOperationsSkip: MixpanelStepExample;
|
|
203
|
+
declare const companyGroupProfileSkip: MixpanelStepExample;
|
|
199
204
|
|
|
200
205
|
type step_MixpanelStepExample = MixpanelStepExample;
|
|
201
206
|
declare const step_aliasBeforeTrack: typeof aliasBeforeTrack;
|
|
202
207
|
declare const step_allPeopleOperations: typeof allPeopleOperations;
|
|
208
|
+
declare const step_allPeopleOperationsSkip: typeof allPeopleOperationsSkip;
|
|
203
209
|
declare const step_companyGroupProfile: typeof companyGroupProfile;
|
|
210
|
+
declare const step_companyGroupProfileSkip: typeof companyGroupProfileSkip;
|
|
204
211
|
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
205
212
|
declare const step_historicalImport: typeof historicalImport;
|
|
206
213
|
declare const step_perEventIdentify: typeof perEventIdentify;
|
|
214
|
+
declare const step_silentRule: typeof silentRule;
|
|
207
215
|
declare const step_trackWithGroup: typeof trackWithGroup;
|
|
208
216
|
declare const step_trackWithInclude: typeof trackWithInclude;
|
|
209
217
|
declare const step_userLoginPeopleSet: typeof userLoginPeopleSet;
|
|
218
|
+
declare const step_userLoginPeopleSetSkip: typeof userLoginPeopleSetSkip;
|
|
210
219
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
211
220
|
declare namespace step {
|
|
212
|
-
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_companyGroupProfile as companyGroupProfile, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_wildcardIgnored as wildcardIgnored };
|
|
221
|
+
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_allPeopleOperationsSkip as allPeopleOperationsSkip, step_companyGroupProfile as companyGroupProfile, step_companyGroupProfileSkip as companyGroupProfileSkip, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_silentRule as silentRule, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_userLoginPeopleSetSkip as userLoginPeopleSetSkip, step_wildcardIgnored as wildcardIgnored };
|
|
213
222
|
}
|
|
214
223
|
|
|
215
224
|
declare const index_env: typeof env;
|
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:()=>k,simulation:()=>h});var f=(...e)=>{const t=e[e.length-1];"function"==typeof t&&t()},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.track","call:Mixpanel.init.import","call:Mixpanel.init.alias","call:Mixpanel.init.people.set","call:Mixpanel.init.people.set_once","call:Mixpanel.init.people.increment","call:Mixpanel.init.people.append","call:Mixpanel.init.people.union","call:Mixpanel.init.people.remove","call:Mixpanel.init.people.unset","call:Mixpanel.init.people.delete_user","call:Mixpanel.init.groups.set","call:Mixpanel.init.groups.set_once","call:Mixpanel.init.groups.union","call:Mixpanel.init.groups.remove","call:Mixpanel.init.groups.unset","call:Mixpanel.init.groups.delete_group"],w={};o(w,{aliasBeforeTrack:()=>j,allPeopleOperations:()=>A,companyGroupProfile:()=>S,defaultEventForwarding:()=>I,historicalImport:()=>D,perEventIdentify:()=>P,trackWithGroup:()=>z,trackWithInclude:()=>M,userLoginPeopleSet:()=>E,wildcardIgnored:()=>q});var x=require("@walkeros/core"),I={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,x.getEvent)("product view",{timestamp:1700000100}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["mp.track","product view",{distinct_id:"us3r"}]]},M={title:"Track with include",description:"A destination-level include flattens the event data section into prefixed Mixpanel track properties.",in:(0,x.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}]]},P={title:"Per-event identify",description:"A mapping-level identify overrides the destination default to resolve the distinct_id from event data.",in:(0,x.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"}]]},z={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,x.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"}]]},E={title:"User login people",description:"A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.",in:(0,x.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}]]},A={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,x.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"]]]},S={title:"Group profile",description:"A company update sets Mixpanel group profile properties via groups.set and groups.set_once.",in:(0,x.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}]]},D={title:"Historical import",description:"Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.",in:(0,x.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,x.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,x.getEvent)("debug noise",{timestamp:1700000109}),mapping:{ignore:!0},out:[]};//# sourceMappingURL=dev.js.map
|
|
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:()=>u,SettingsSchema:()=>c,mapping:()=>g,settings:()=>m});var r=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=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()}).strict(),d=require("@walkeros/core/dev"),u=d.z.object({identify:d.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.").optional(),people:d.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:d.z.unknown().describe("Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.").optional(),groupProfile:d.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:d.z.unknown().describe("Per-event import flag. When truthy, uses mp.import() instead of mp.track() for this rule.").optional()}),m=(0,r.zodToSchema)(c),g=(0,r.zodToSchema)(u),v={};o(v,{env:()=>f,step:()=>w});var f={};o(f,{push:()=>h,simulation:()=>k});var _=(...e)=>{const t=e[e.length-1];"function"==typeof t&&t()},y={set:_,set_once:_,increment:_,append:_,union:_,remove:_,unset:_,delete_user:_},b={set:_,set_once:_,union:_,remove:_,unset:_,delete_group:_};var h={Mixpanel:{init:function(){return{track:_,import:_,alias:_,people:{...y},groups:{...b}}}}},k=["call:Mixpanel.init.track","call:Mixpanel.init.import","call:Mixpanel.init.alias","call:Mixpanel.init.people.set","call:Mixpanel.init.people.set_once","call:Mixpanel.init.people.increment","call:Mixpanel.init.people.append","call:Mixpanel.init.people.union","call:Mixpanel.init.people.remove","call:Mixpanel.init.people.unset","call:Mixpanel.init.people.delete_user","call:Mixpanel.init.groups.set","call:Mixpanel.init.groups.set_once","call:Mixpanel.init.groups.union","call:Mixpanel.init.groups.remove","call:Mixpanel.init.groups.unset","call:Mixpanel.init.groups.delete_group"],w={};o(w,{aliasBeforeTrack:()=>j,allPeopleOperations:()=>E,allPeopleOperationsSkip:()=>K,companyGroupProfile:()=>S,companyGroupProfileSkip:()=>U,defaultEventForwarding:()=>M,historicalImport:()=>D,perEventIdentify:()=>P,silentRule:()=>q,trackWithGroup:()=>z,trackWithInclude:()=>I,userLoginPeopleSet:()=>A,userLoginPeopleSetSkip:()=>T,wildcardIgnored:()=>O});var x=require("@walkeros/core"),M={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,x.getEvent)("product view",{timestamp:1700000100}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["mp.track","product view",{distinct_id:"us3r"}]]},I={title:"Track with include",description:"A destination-level include flattens the event data section into prefixed Mixpanel track properties.",in:(0,x.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}]]},P={title:"Per-event identify",description:"A mapping-level identify overrides the destination default to resolve the distinct_id from event data.",in:(0,x.createEvent)({name:"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"}]]},z={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,x.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,x.createEvent)({name:"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}]]},E={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,x.createEvent)({name:"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"]]]},S={title:"Group profile",description:"A company update sets Mixpanel group profile properties via groups.set and groups.set_once.",in:(0,x.createEvent)({name:"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}]]},D={title:"Historical import",description:"Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.",in:(0,x.getEvent)("order complete",{timestamp:1700000107,data:{value: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,x.createEvent)({name:"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"}]]},O={public:!1,in:(0,x.createEvent)({name:"debug noise",timestamp:1700000109}),mapping:{ignore:!0},out:[]},q={public:!1,description:"A rule with silent: true sends nothing to Mixpanel.",in:(0,x.getEvent)("page view",{timestamp:170000099e4}),mapping:{silent:!0},out:[]};function R(e,t,i){const[a,n]=t.split(" ");return{public:!1,description:`A ${t} event without the data its rule reads has no profile or group to address: nothing is sent, and that is not a failure.`,in:{name:t,entity:a,action:n,timestamp:i},mapping:e.mapping,out:[]}}var T=R(A,"user login",1700000991e3),K=R(E,"profile update",1700000992e3),U=R(S,"company update",1700000993e3);//# 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\n/**\n * The SDK reports completion through an optional trailing callback, which the\n * destination awaits; call it so a simulated push completes.\n */\nconst noop = (...args: unknown[]): void => {\n const callback = args[args.length - 1];\n if (typeof callback === 'function') callback();\n};\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 },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate. `init` carries the token and is\n * not recorded; the paths walk through its result to the request calls.\n */\nexport const simulation = [\n 'call:Mixpanel.init.track',\n 'call:Mixpanel.init.import',\n 'call:Mixpanel.init.alias',\n 'call:Mixpanel.init.people.set',\n 'call:Mixpanel.init.people.set_once',\n 'call:Mixpanel.init.people.increment',\n 'call:Mixpanel.init.people.append',\n 'call:Mixpanel.init.people.union',\n 'call:Mixpanel.init.people.remove',\n 'call:Mixpanel.init.people.unset',\n 'call:Mixpanel.init.people.delete_user',\n 'call:Mixpanel.init.groups.set',\n 'call:Mixpanel.init.groups.set_once',\n 'call:Mixpanel.init.groups.union',\n 'call:Mixpanel.init.groups.remove',\n 'call:Mixpanel.init.groups.unset',\n 'call:Mixpanel.init.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;;;ACAA;AAAA;A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AAS,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,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\n .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\n .boolean()\n .describe('Enable dry-run mode. Default: false.')\n .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 .strict();\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\n/**\n * The SDK reports completion through an optional trailing callback, which the\n * destination awaits; call it so a simulated push completes.\n */\nconst noop = (...args: unknown[]): void => {\n const callback = args[args.length - 1];\n if (typeof callback === 'function') callback();\n};\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 },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate. `init` carries the token and is\n * not recorded; the paths walk through its result to the request calls.\n */\nexport const simulation = [\n 'call:Mixpanel.init.track',\n 'call:Mixpanel.init.import',\n 'call:Mixpanel.init.alias',\n 'call:Mixpanel.init.people.set',\n 'call:Mixpanel.init.people.set_once',\n 'call:Mixpanel.init.people.increment',\n 'call:Mixpanel.init.people.append',\n 'call:Mixpanel.init.people.union',\n 'call:Mixpanel.init.people.remove',\n 'call:Mixpanel.init.people.unset',\n 'call:Mixpanel.init.people.delete_user',\n 'call:Mixpanel.init.groups.set',\n 'call:Mixpanel.init.groups.set_once',\n 'call:Mixpanel.init.groups.union',\n 'call:Mixpanel.init.groups.remove',\n 'call:Mixpanel.init.groups.unset',\n 'call:Mixpanel.init.groups.delete_group',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, 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: createEvent({\n name: '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: createEvent({\n name: '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: createEvent({\n name: '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: createEvent({\n name: '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 value: 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: createEvent({\n name: '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: createEvent({ name: 'debug noise', timestamp: 1700000109 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/** A silent rule sends nothing to Mixpanel. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends nothing to Mixpanel.',\n in: getEvent('page view', { timestamp: 1700000990000 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The event of a people or group profile example without the data its rule\n * reads: no distinct id and no group key resolve, so there is nothing to\n * address. A rule that only addresses profiles has nothing else to send, so\n * it returns normally; that is a declared skip, not a failure.\n */\nfunction skipWithoutInput(\n target: MixpanelStepExample,\n name: string,\n timestamp: number,\n): MixpanelStepExample {\n const [entity, action] = name.split(' ');\n return {\n public: false,\n description: `A ${name} event without the data its rule reads has no profile or group to address: nothing is sent, and that is not a failure.`,\n in: { name, entity, action, timestamp },\n mapping: target.mapping,\n out: [],\n };\n}\n\nexport const userLoginPeopleSetSkip = skipWithoutInput(\n userLoginPeopleSet,\n 'user login',\n 1700000991000,\n);\nexport const allPeopleOperationsSkip = skipWithoutInput(\n allPeopleOperations,\n 'profile update',\n 1700000992000,\n);\nexport const companyGroupProfileSkip = skipWithoutInput(\n companyGroupProfile,\n 'company update',\n 1700000993000,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AM,CAAC,QAAQ,MAAM,IAAI,KAAK,MAAM,GAAG;AACvC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,aAAa,KAAK,IAAI;AAAA,IACtB,IAAI,EAAE,MAAM,QAAQ,QAAQ,UAAU;AAAA,IACtC,SAAS,OAAO;AAAA,IAChB,KAAK,CAAC;AAAA,EACR;AACF;AAEO,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACF;AACO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF;AACO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,i=(e,i)=>{for(var a in i)t(e,a,{get:i[a],enumerable:!0})},a={};i(a,{MappingSchema:()=>r,SettingsSchema:()=>p,mapping:()=>d,settings:()=>l});import{zodToSchema as n}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var p=o.object({apiKey:o.string().min(1).describe("Your Mixpanel project token. Find it in Project Settings > Access Keys. Passed as the first argument to Mixpanel.init()."),secret:o.string().describe("API secret for the /import endpoint (historical data). Required when useImport is true.").optional(),host:o.string().describe("Mixpanel API host. Default: 'api.mixpanel.com' (US). Use 'api-eu.mixpanel.com' (EU) or 'api-in.mixpanel.com' (India).").optional(),protocol:o.string().describe("Protocol for API requests. Default: 'https'.").optional(),keepAlive:o.boolean().describe("Reuse HTTP connections. Default: true.").optional(),geolocate:o.boolean().describe("Parse IP for geolocation. Default: false. Server IP caveat: all users map to server location unless $ip is overridden.").optional(),debug:o.boolean().describe("Enable SDK debug logging. Default: false.").optional(),verbose:o.boolean().describe("Enable verbose request logging. Default: false.").optional(),test:o.boolean().describe("Enable dry-run mode. Default: false.").optional(),useImport:o.boolean().describe("Use /import endpoint instead of /track. Accepts events of any age (no 5-day limit). Requires secret for authentication.").optional(),identify:o.unknown().describe("walkerOS mapping value resolving to { distinctId, alias? }. distinctId is passed as distinct_id on every SDK call.").optional(),include:o.unknown().describe("Event data sections to flatten into track() properties. Example: ['data', 'globals']. Sections are prefixed (data_, globals_, etc.).").optional()}).strict();import{z as s}from"@walkeros/core/dev";var r=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to { distinctId, alias? }. distinctId is passed as distinct_id to all SDK calls.").optional(),people:s.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:s.unknown().describe("Per-event group association. Resolves to { key, id }. The group key/id is added as a track() property.").optional(),groupProfile:s.unknown().describe("Per-event group profile operations. Resolves to { key, id, set?, set_once?, union?, remove?, unset?, delete? }. Fires mp.groups.* calls.").optional(),useImport:s.unknown().describe("Per-event import flag. When truthy, uses mp.import() instead of mp.track() for this rule.").optional()}),l=n(p),d=n(r),c={};i(c,{env:()=>m,step:()=>y});var m={};i(m,{push:()=>f,simulation:()=>_});var u=(...e)=>{const t=e[e.length-1];"function"==typeof t&&t()},g={set:u,set_once:u,increment:u,append:u,union:u,remove:u,unset:u,delete_user:u},v={set:u,set_once:u,union:u,remove:u,unset:u,delete_group:u};var f={Mixpanel:{init:function(){return{track:u,import:u,alias:u,people:{...g},groups:{...v}}}}},_=["call:Mixpanel.init.track","call:Mixpanel.init.import","call:Mixpanel.init.alias","call:Mixpanel.init.people.set","call:Mixpanel.init.people.set_once","call:Mixpanel.init.people.increment","call:Mixpanel.init.people.append","call:Mixpanel.init.people.union","call:Mixpanel.init.people.remove","call:Mixpanel.init.people.unset","call:Mixpanel.init.people.delete_user","call:Mixpanel.init.groups.set","call:Mixpanel.init.groups.set_once","call:Mixpanel.init.groups.union","call:Mixpanel.init.groups.remove","call:Mixpanel.init.groups.unset","call:Mixpanel.init.groups.delete_group"],y={};i(y,{aliasBeforeTrack:()=>D,allPeopleOperations:()=>P,allPeopleOperationsSkip:()=>T,companyGroupProfile:()=>A,companyGroupProfileSkip:()=>K,defaultEventForwarding:()=>b,historicalImport:()=>S,perEventIdentify:()=>x,silentRule:()=>R,trackWithGroup:()=>I,trackWithInclude:()=>w,userLoginPeopleSet:()=>M,userLoginPeopleSetSkip:()=>q,wildcardIgnored:()=>E});import{createEvent as k,getEvent as h}from"@walkeros/core";var b={title:"Default track",description:"A walkerOS event is forwarded to Mixpanel as a track call with the user id as the distinct_id.",in:h("product view",{timestamp:1700000100}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["mp.track","product view",{distinct_id:"us3r"}]]},w={title:"Track with include",description:"A destination-level include flattens the event data section into prefixed Mixpanel track properties.",in:h("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}]]},x={title:"Per-event identify",description:"A mapping-level identify overrides the destination default to resolve the distinct_id from event data.",in:k({name:"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"}]]},I={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:h("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"}]]},M={title:"User login people",description:"A user login fires Mixpanel people.set, set_once, and increment operations without sending a track event.",in:k({name:"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}]]},P={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:k({name:"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"]]]},A={title:"Group profile",description:"A company update sets Mixpanel group profile properties via groups.set and groups.set_once.",in:k({name:"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}]]},S={title:"Historical import",description:"Setting useImport routes the event through mp.import for backfilling historical Mixpanel data.",in:h("order complete",{timestamp:1700000107,data:{value:99.99}}),settings:{useImport:!0,identify:{map:{distinctId:"user.id"}}},out:[["mp.import","order complete",1700000107,{distinct_id:"us3r"}]]},D={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:k({name:"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"}]]},E={public:!1,in:k({name:"debug noise",timestamp:1700000109}),mapping:{ignore:!0},out:[]},R={public:!1,description:"A rule with silent: true sends nothing to Mixpanel.",in:h("page view",{timestamp:170000099e4}),mapping:{silent:!0},out:[]};function j(e,t,i){const[a,n]=t.split(" ");return{public:!1,description:`A ${t} event without the data its rule reads has no profile or group to address: nothing is sent, and that is not a failure.`,in:{name:t,entity:a,action:n,timestamp:i},mapping:e.mapping,out:[]}}var q=j(M,"user login",1700000991e3),T=j(P,"profile update",1700000992e3),K=j(A,"company update",1700000993e3);export{c as examples,a 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\n/**\n * The SDK reports completion through an optional trailing callback, which the\n * destination awaits; call it so a simulated push completes.\n */\nconst noop = (...args: unknown[]): void => {\n const callback = args[args.length - 1];\n if (typeof callback === 'function') callback();\n};\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 },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate. `init` carries the token and is\n * not recorded; the paths walk through its result to the request calls.\n */\nexport const simulation = [\n 'call:Mixpanel.init.track',\n 'call:Mixpanel.init.import',\n 'call:Mixpanel.init.alias',\n 'call:Mixpanel.init.people.set',\n 'call:Mixpanel.init.people.set_once',\n 'call:Mixpanel.init.people.increment',\n 'call:Mixpanel.init.people.append',\n 'call:Mixpanel.init.people.union',\n 'call:Mixpanel.init.people.remove',\n 'call:Mixpanel.init.people.unset',\n 'call:Mixpanel.init.people.delete_user',\n 'call:Mixpanel.init.groups.set',\n 'call:Mixpanel.init.groups.set_once',\n 'call:Mixpanel.init.groups.union',\n 'call:Mixpanel.init.groups.remove',\n 'call:Mixpanel.init.groups.unset',\n 'call:Mixpanel.init.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,EACF,EACC,SAAS;AACd,CAAC;;;AC9DD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQA,GACL,QAAQ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,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\n .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\n .boolean()\n .describe('Enable dry-run mode. Default: false.')\n .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 .strict();\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\n/**\n * The SDK reports completion through an optional trailing callback, which the\n * destination awaits; call it so a simulated push completes.\n */\nconst noop = (...args: unknown[]): void => {\n const callback = args[args.length - 1];\n if (typeof callback === 'function') callback();\n};\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 },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate. `init` carries the token and is\n * not recorded; the paths walk through its result to the request calls.\n */\nexport const simulation = [\n 'call:Mixpanel.init.track',\n 'call:Mixpanel.init.import',\n 'call:Mixpanel.init.alias',\n 'call:Mixpanel.init.people.set',\n 'call:Mixpanel.init.people.set_once',\n 'call:Mixpanel.init.people.increment',\n 'call:Mixpanel.init.people.append',\n 'call:Mixpanel.init.people.union',\n 'call:Mixpanel.init.people.remove',\n 'call:Mixpanel.init.people.unset',\n 'call:Mixpanel.init.people.delete_user',\n 'call:Mixpanel.init.groups.set',\n 'call:Mixpanel.init.groups.set_once',\n 'call:Mixpanel.init.groups.union',\n 'call:Mixpanel.init.groups.remove',\n 'call:Mixpanel.init.groups.unset',\n 'call:Mixpanel.init.groups.delete_group',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, 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: createEvent({\n name: '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: createEvent({\n name: '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: createEvent({\n name: '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: createEvent({\n name: '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 value: 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: createEvent({\n name: '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: createEvent({ name: 'debug noise', timestamp: 1700000109 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/** A silent rule sends nothing to Mixpanel. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends nothing to Mixpanel.',\n in: getEvent('page view', { timestamp: 1700000990000 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The event of a people or group profile example without the data its rule\n * reads: no distinct id and no group key resolve, so there is nothing to\n * address. A rule that only addresses profiles has nothing else to send, so\n * it returns normally; that is a declared skip, not a failure.\n */\nfunction skipWithoutInput(\n target: MixpanelStepExample,\n name: string,\n timestamp: number,\n): MixpanelStepExample {\n const [entity, action] = name.split(' ');\n return {\n public: false,\n description: `A ${name} event without the data its rule reads has no profile or group to address: nothing is sent, and that is not a failure.`,\n in: { name, entity, action, timestamp },\n mapping: target.mapping,\n out: [],\n };\n}\n\nexport const userLoginPeopleSetSkip = skipWithoutInput(\n userLoginPeopleSet,\n 'user login',\n 1700000991000,\n);\nexport const allPeopleOperationsSkip = skipWithoutInput(\n allPeopleOperations,\n 'profile update',\n 1700000992000,\n);\nexport const companyGroupProfileSkip = skipWithoutInput(\n companyGroupProfile,\n 'company update',\n 1700000993000,\n);\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,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,EACH,QAAQ,EACR,SAAS,sCAAsC,EAC/C,SAAS;AAAA,EACZ,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,EACA,OAAO;;;ACnEV,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQA,GACL,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAOA,GACJ,QAAQ,EAC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,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAQA,SAAS,iBACP,QACA,MACA,WACqB;AACrB,QAAM,CAAC,QAAQ,MAAM,IAAI,KAAK,MAAM,GAAG;AACvC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,aAAa,KAAK,IAAI;AAAA,IACtB,IAAI,EAAE,MAAM,QAAQ,QAAQ,UAAU;AAAA,IACtC,SAAS,OAAO;AAAA,IAChB,KAAK,CAAC;AAAA,EACR;AACF;AAEO,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACF;AACO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF;AACO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF;","names":["z"]}
|
|
@@ -157,20 +157,29 @@ declare const aliasBeforeTrack: MixpanelStepExample;
|
|
|
157
157
|
* Wildcard ignore - the rule matches but does nothing.
|
|
158
158
|
*/
|
|
159
159
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
160
|
+
/** A silent rule sends nothing to Mixpanel. */
|
|
161
|
+
declare const silentRule: Flow.StepExample;
|
|
162
|
+
declare const userLoginPeopleSetSkip: MixpanelStepExample;
|
|
163
|
+
declare const allPeopleOperationsSkip: MixpanelStepExample;
|
|
164
|
+
declare const companyGroupProfileSkip: MixpanelStepExample;
|
|
160
165
|
|
|
161
166
|
type step_MixpanelStepExample = MixpanelStepExample;
|
|
162
167
|
declare const step_aliasBeforeTrack: typeof aliasBeforeTrack;
|
|
163
168
|
declare const step_allPeopleOperations: typeof allPeopleOperations;
|
|
169
|
+
declare const step_allPeopleOperationsSkip: typeof allPeopleOperationsSkip;
|
|
164
170
|
declare const step_companyGroupProfile: typeof companyGroupProfile;
|
|
171
|
+
declare const step_companyGroupProfileSkip: typeof companyGroupProfileSkip;
|
|
165
172
|
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
166
173
|
declare const step_historicalImport: typeof historicalImport;
|
|
167
174
|
declare const step_perEventIdentify: typeof perEventIdentify;
|
|
175
|
+
declare const step_silentRule: typeof silentRule;
|
|
168
176
|
declare const step_trackWithGroup: typeof trackWithGroup;
|
|
169
177
|
declare const step_trackWithInclude: typeof trackWithInclude;
|
|
170
178
|
declare const step_userLoginPeopleSet: typeof userLoginPeopleSet;
|
|
179
|
+
declare const step_userLoginPeopleSetSkip: typeof userLoginPeopleSetSkip;
|
|
171
180
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
172
181
|
declare namespace step {
|
|
173
|
-
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_companyGroupProfile as companyGroupProfile, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_wildcardIgnored as wildcardIgnored };
|
|
182
|
+
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_allPeopleOperationsSkip as allPeopleOperationsSkip, step_companyGroupProfile as companyGroupProfile, step_companyGroupProfileSkip as companyGroupProfileSkip, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_silentRule as silentRule, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_userLoginPeopleSetSkip as userLoginPeopleSetSkip, step_wildcardIgnored as wildcardIgnored };
|
|
174
183
|
}
|
|
175
184
|
|
|
176
185
|
export { env, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -157,20 +157,29 @@ declare const aliasBeforeTrack: MixpanelStepExample;
|
|
|
157
157
|
* Wildcard ignore - the rule matches but does nothing.
|
|
158
158
|
*/
|
|
159
159
|
declare const wildcardIgnored: MixpanelStepExample;
|
|
160
|
+
/** A silent rule sends nothing to Mixpanel. */
|
|
161
|
+
declare const silentRule: Flow.StepExample;
|
|
162
|
+
declare const userLoginPeopleSetSkip: MixpanelStepExample;
|
|
163
|
+
declare const allPeopleOperationsSkip: MixpanelStepExample;
|
|
164
|
+
declare const companyGroupProfileSkip: MixpanelStepExample;
|
|
160
165
|
|
|
161
166
|
type step_MixpanelStepExample = MixpanelStepExample;
|
|
162
167
|
declare const step_aliasBeforeTrack: typeof aliasBeforeTrack;
|
|
163
168
|
declare const step_allPeopleOperations: typeof allPeopleOperations;
|
|
169
|
+
declare const step_allPeopleOperationsSkip: typeof allPeopleOperationsSkip;
|
|
164
170
|
declare const step_companyGroupProfile: typeof companyGroupProfile;
|
|
171
|
+
declare const step_companyGroupProfileSkip: typeof companyGroupProfileSkip;
|
|
165
172
|
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
166
173
|
declare const step_historicalImport: typeof historicalImport;
|
|
167
174
|
declare const step_perEventIdentify: typeof perEventIdentify;
|
|
175
|
+
declare const step_silentRule: typeof silentRule;
|
|
168
176
|
declare const step_trackWithGroup: typeof trackWithGroup;
|
|
169
177
|
declare const step_trackWithInclude: typeof trackWithInclude;
|
|
170
178
|
declare const step_userLoginPeopleSet: typeof userLoginPeopleSet;
|
|
179
|
+
declare const step_userLoginPeopleSetSkip: typeof userLoginPeopleSetSkip;
|
|
171
180
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
172
181
|
declare namespace step {
|
|
173
|
-
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_companyGroupProfile as companyGroupProfile, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_wildcardIgnored as wildcardIgnored };
|
|
182
|
+
export { type step_MixpanelStepExample as MixpanelStepExample, step_aliasBeforeTrack as aliasBeforeTrack, step_allPeopleOperations as allPeopleOperations, step_allPeopleOperationsSkip as allPeopleOperationsSkip, step_companyGroupProfile as companyGroupProfile, step_companyGroupProfileSkip as companyGroupProfileSkip, step_defaultEventForwarding as defaultEventForwarding, step_historicalImport as historicalImport, step_perEventIdentify as perEventIdentify, step_silentRule as silentRule, step_trackWithGroup as trackWithGroup, step_trackWithInclude as trackWithInclude, step_userLoginPeopleSet as userLoginPeopleSet, step_userLoginPeopleSetSkip as userLoginPeopleSetSkip, step_wildcardIgnored as wildcardIgnored };
|
|
174
183
|
}
|
|
175
184
|
|
|
176
185
|
export { env, step };
|