@walkeros/server-destination-posthog 3.4.0 → 3.4.1-next-1776790594143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},n={};i(n,{examples:()=>y,schemas:()=>r}),module.exports=(e=n,((e,i,n,r)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let p of s(i))a.call(e,p)||p===n||t(e,p,{get:()=>i[p],enumerable:!(r=o(i,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};i(r,{MappingSchema:()=>d,SettingsSchema:()=>c,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:l.z.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:l.z.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:l.z.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:l.z.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:l.z.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:l.z.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:l.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:l.z.array(l.z.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()}),u=require("@walkeros/core/dev"),d=u.z.object({identify:u.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:u.z.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),m=(0,p.zodToSchema)(c),g=(0,p.zodToSchema)(d),y={};i(y,{env:()=>h,step:()=>v});var h={};i(h,{push:()=>f,simulation:()=>b});var f={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},b=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],v={};i(v,{captureWithGroupContext:()=>z,captureWithInclude:()=>I,consentGrant:()=>O,consentRevoke:()=>j,defaultCapture:()=>w,groupIdentifyWithProperties:()=>P,identifyWithSetAndSetOnce:()=>k});var _=require("@walkeros/core"),w={in:(0,_.getEvent)("product view",{timestamp:1700000100}),out:[["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]]},I={in:(0,_.getEvent)("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]]},k={in:(0,_.getEvent)("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:[["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]]},P={in:(0,_.getEvent)("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:[["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]]},z={in:(0,_.getEvent)("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},j={command:"consent",in:{analytics:!1},settings:{},out:[["client.disable"]]},O={command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(e,o)=>{for(var i in o)t(e,i,{get:o[i],enumerable:!0})},a={};s(a,{examples:()=>y,schemas:()=>r}),module.exports=(e=a,((e,s,a,r)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let p of i(s))n.call(e,p)||p===a||t(e,p,{get:()=>s[p],enumerable:!(r=o(s,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};s(r,{MappingSchema:()=>u,SettingsSchema:()=>c,mapping:()=>m,settings:()=>g});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:l.z.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:l.z.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:l.z.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:l.z.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:l.z.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:l.z.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:l.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:l.z.array(l.z.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()}),d=require("@walkeros/core/dev"),u=d.z.object({identify:d.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:d.z.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),g=(0,p.zodToSchema)(c),m=(0,p.zodToSchema)(u),y={};s(y,{env:()=>h,step:()=>v});var h={};s(h,{push:()=>f,simulation:()=>b});var f={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},b=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],v={};s(v,{captureWithGroupContext:()=>z,captureWithInclude:()=>k,consentGrant:()=>$,consentRevoke:()=>A,defaultCapture:()=>_,groupIdentifyWithProperties:()=>I,identifyWithSetAndSetOnce:()=>P});var w=require("@walkeros/core"),_={title:"Default capture",description:"A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",in:(0,w.getEvent)("product view",{timestamp:1700000100}),out:[["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]]},k={title:"Capture with include",description:"Destination-level include flattens data and globals sections into prefixed PostHog event properties.",in:(0,w.getEvent)("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]]},P={title:"Identify with $set",description:"A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",in:(0,w.getEvent)("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:[["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]]},I={title:"Group identify",description:"A company update fires PostHog groupIdentify with group type, key, and associated group properties.",in:(0,w.getEvent)("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:[["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]]},z={title:"Capture with group",description:"A destination-level group mapping attaches the resolved group context to every PostHog capture call.",in:(0,w.getEvent)("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},A={title:"Consent revoked",description:"A walker consent command with analytics denied calls client.disable on the PostHog client.",command:"consent",in:{analytics:!1},settings:{},out:[["client.disable"]]},$={title:"Consent granted",description:"A walker consent command with analytics granted calls client.enable on the PostHog client.",command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]};//# 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 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n *\n * At push time the destination invokes methods on a `client` constructed\n * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`\n * matching the underlying SDK signature. Multiple calls (identify +\n * capture, groupIdentify + capture) are expressed as a tuple list.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.identify',\n {\n distinctId: 'new-user-123',\n properties: {\n $set: {\n email: 'user@acme.com',\n plan: 'premium',\n },\n $set_once: {\n first_login: 1700000102,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.groupIdentify',\n {\n groupType: 'company',\n groupKey: 'company_123',\n properties: {\n name: 'Acme',\n plan: 'enterprise',\n },\n },\n ],\n ],\n};\n\n/**\n * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.disable']],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.enable']],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AA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AC1B;AAKO,IAAM,eAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;","names":["import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n *\n * At push time the destination invokes methods on a `client` constructed\n * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`\n * matching the underlying SDK signature. Multiple calls (identify +\n * capture, groupIdentify + capture) are expressed as a tuple list.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n title: 'Default capture',\n description:\n 'A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n title: 'Capture with include',\n description:\n 'Destination-level include flattens data and globals sections into prefixed PostHog event properties.',\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n title: 'Identify with $set',\n description:\n 'A user login fires PostHog identify with $set and $set_once person properties and skips the capture.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.identify',\n {\n distinctId: 'new-user-123',\n properties: {\n $set: {\n email: 'user@acme.com',\n plan: 'premium',\n },\n $set_once: {\n first_login: 1700000102,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n title: 'Group identify',\n description:\n 'A company update fires PostHog groupIdentify with group type, key, and associated group properties.',\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.groupIdentify',\n {\n groupType: 'company',\n groupKey: 'company_123',\n properties: {\n name: 'Acme',\n plan: 'enterprise',\n },\n },\n ],\n ],\n};\n\n/**\n * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n title: 'Capture with group',\n description:\n 'A destination-level group mapping attaches the resolved group context to every PostHog capture call.',\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics denied calls client.disable on the PostHog client.',\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.disable']],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command with analytics granted calls client.enable on the PostHog client.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.enable']],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,MAAM,aACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP,SAAS,yDAAyD,EAClE,SAAS;AAAA,EACZ,eAAe,aACZ,OAAO,EACP,SAAS,wDAAwD,EACjE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,SAAS,+DAA+D,EACxE,SAAS;AAAA,EACZ,6BAA6B,aAC1B,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,cAAc,aACX,QAAQ,EACR,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,OAAO,aACJ,QAAQ,EACR,SAAS,mDAAmD,EAC5D,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,aACJ,QAAQ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;AACF;AAMO,IAAM,0BAA8C;AAAA,EACzD,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,SAAS,EAAE,WAAW,QAAQ,YAAY,cAAc;AAAA,EAC1D,CAAC;AAAA,EACD,UAAU;AAAA,IACR,OAAO;AAAA,MACL,KAAK;AAAA,QACH,MAAM,EAAE,OAAO,UAAU;AAAA,QACzB,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,YAAY,CAAC;AAAA,QACb,QAAQ,EAAE,SAAS,cAAc;AAAA,MACnC;AAAA,IACF;AAAA,EACF;AACF;AAKO,IAAM,gBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,gBAAgB,CAAC;AAC1B;AAKO,IAAM,eAAmC;AAAA,EAC9C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,s)=>{for(var o in s)e(t,o,{get:s[o],enumerable:!0})},s={};t(s,{MappingSchema:()=>r,SettingsSchema:()=>i,mapping:()=>l,settings:()=>p});import{zodToSchema as o}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var i=a.object({apiKey:a.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:a.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:a.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:a.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:a.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:a.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:a.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:a.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:a.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:a.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:a.array(a.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()});import{z as n}from"@walkeros/core/dev";var r=n.object({identify:n.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:n.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),p=o(i),l=o(r),c={};t(c,{env:()=>d,step:()=>g});var d={};t(d,{push:()=>u,simulation:()=>m});var u={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},m=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],g={};t(g,{captureWithGroupContext:()=>_,captureWithInclude:()=>f,consentGrant:()=>I,consentRevoke:()=>w,defaultCapture:()=>h,groupIdentifyWithProperties:()=>v,identifyWithSetAndSetOnce:()=>b});import{getEvent as y}from"@walkeros/core";var h={in:y("product view",{timestamp:1700000100}),out:[["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]]},f={in:y("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]]},b={in:y("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:[["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]]},v={in:y("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:[["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]]},_={in:y("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},w={command:"consent",in:{analytics:!1},settings:{},out:[["client.disable"]]},I={command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]};export{c as examples,s as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,i)=>{for(var o in i)e(t,o,{get:i[o],enumerable:!0})},i={};t(i,{MappingSchema:()=>r,SettingsSchema:()=>n,mapping:()=>l,settings:()=>p});import{zodToSchema as o}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var n=s.object({apiKey:s.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:s.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:s.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:s.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:s.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:s.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:s.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:s.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:s.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:s.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:s.array(s.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()});import{z as a}from"@walkeros/core/dev";var r=a.object({identify:a.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:a.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),p=o(n),l=o(r),c={};t(c,{env:()=>d,step:()=>g});var d={};t(d,{push:()=>u,simulation:()=>m});var u={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},m=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],g={};t(g,{captureWithGroupContext:()=>w,captureWithInclude:()=>f,consentGrant:()=>k,consentRevoke:()=>_,defaultCapture:()=>y,groupIdentifyWithProperties:()=>v,identifyWithSetAndSetOnce:()=>b});import{getEvent as h}from"@walkeros/core";var y={title:"Default capture",description:"A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",in:h("product view",{timestamp:1700000100}),out:[["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]]},f={title:"Capture with include",description:"Destination-level include flattens data and globals sections into prefixed PostHog event properties.",in:h("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]]},b={title:"Identify with $set",description:"A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",in:h("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:[["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]]},v={title:"Group identify",description:"A company update fires PostHog groupIdentify with group type, key, and associated group properties.",in:h("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:[["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]]},w={title:"Capture with group",description:"A destination-level group mapping attaches the resolved group context to every PostHog capture call.",in:h("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},_={title:"Consent revoked",description:"A walker consent command with analytics denied calls client.disable on the PostHog client.",command:"consent",in:{analytics:!1},settings:{},out:[["client.disable"]]},k={title:"Consent granted",description:"A walker consent command with analytics granted calls client.enable on the PostHog client.",command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]};export{c as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n *\n * At push time the destination invokes methods on a `client` constructed\n * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`\n * matching the underlying SDK signature. Multiple calls (identify +\n * capture, groupIdentify + capture) are expressed as a tuple list.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.identify',\n {\n distinctId: 'new-user-123',\n properties: {\n $set: {\n email: 'user@acme.com',\n plan: 'premium',\n },\n $set_once: {\n first_login: 1700000102,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.groupIdentify',\n {\n groupType: 'company',\n groupKey: 'company_123',\n properties: {\n name: 'Acme',\n plan: 'enterprise',\n },\n },\n ],\n ],\n};\n\n/**\n * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.disable']],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.enable']],\n};\n"],"mappings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,IAAM,eAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;","names":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n *\n * At push time the destination invokes methods on a `client` constructed\n * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`\n * matching the underlying SDK signature. Multiple calls (identify +\n * capture, groupIdentify + capture) are expressed as a tuple list.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n title: 'Default capture',\n description:\n 'A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n title: 'Capture with include',\n description:\n 'Destination-level include flattens data and globals sections into prefixed PostHog event properties.',\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n title: 'Identify with $set',\n description:\n 'A user login fires PostHog identify with $set and $set_once person properties and skips the capture.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.identify',\n {\n distinctId: 'new-user-123',\n properties: {\n $set: {\n email: 'user@acme.com',\n plan: 'premium',\n },\n $set_once: {\n first_login: 1700000102,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n title: 'Group identify',\n description:\n 'A company update fires PostHog groupIdentify with group type, key, and associated group properties.',\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.groupIdentify',\n {\n groupType: 'company',\n groupKey: 'company_123',\n properties: {\n name: 'Acme',\n plan: 'enterprise',\n },\n },\n ],\n ],\n};\n\n/**\n * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n title: 'Capture with group',\n description:\n 'A destination-level group mapping attaches the resolved group context to every PostHog capture call.',\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics denied calls client.disable on the PostHog client.',\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.disable']],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command with analytics granted calls client.enable on the PostHog client.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.enable']],\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,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP,SAAS,yDAAyD,EAClE,SAAS;AAAA,EACZ,eAAe,EACZ,OAAO,EACP,SAAS,wDAAwD,EACjE,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP,SAAS,+DAA+D,EACxE,SAAS;AAAA,EACZ,6BAA6B,EAC1B,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,cAAc,EACX,QAAQ,EACR,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,OAAO,EACJ,QAAQ,EACR,SAAS,mDAAmD,EAC5D,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,EACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,MAAM,EAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,E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AAA,IACX,SAAS,EAAE,WAAW,QAAQ,YAAY,cAAc;AAAA,EAC1D,CAAC;AAAA,EACD,UAAU;AAAA,IACR,OAAO;AAAA,MACL,KAAK;AAAA,QACH,MAAM,EAAE,OAAO,UAAU;AAAA,QACzB,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,YAAY,CAAC;AAAA,QACb,QAAQ,EAAE,SAAS,cAAc;AAAA,MACnC;AAAA,IACF;AAAA,EACF;AACF;AAKO,IAAM,gBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,gBAAgB,CAAC;AAC1B;AAKO,IAAM,eAAmC;AAAA,EAC9C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;","names":["z"]}
@@ -87,6 +87,8 @@ __export(step_exports, {
87
87
  });
88
88
  var import_core = require("@walkeros/core");
89
89
  var defaultCapture = {
90
+ title: "Default capture",
91
+ description: "A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",
90
92
  in: (0, import_core.getEvent)("product view", { timestamp: 1700000100 }),
91
93
  out: [
92
94
  [
@@ -100,6 +102,8 @@ var defaultCapture = {
100
102
  ]
101
103
  };
102
104
  var captureWithInclude = {
105
+ title: "Capture with include",
106
+ description: "Destination-level include flattens data and globals sections into prefixed PostHog event properties.",
103
107
  in: (0, import_core.getEvent)("order complete", { timestamp: 1700000101 }),
104
108
  configInclude: ["data", "globals"],
105
109
  out: [
@@ -121,6 +125,8 @@ var captureWithInclude = {
121
125
  ]
122
126
  };
123
127
  var identifyWithSetAndSetOnce = {
128
+ title: "Identify with $set",
129
+ description: "A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",
124
130
  in: (0, import_core.getEvent)("user login", {
125
131
  timestamp: 1700000102,
126
132
  data: {
@@ -169,6 +175,8 @@ var identifyWithSetAndSetOnce = {
169
175
  ]
170
176
  };
171
177
  var groupIdentifyWithProperties = {
178
+ title: "Group identify",
179
+ description: "A company update fires PostHog groupIdentify with group type, key, and associated group properties.",
172
180
  in: (0, import_core.getEvent)("company update", {
173
181
  timestamp: 1700000103,
174
182
  data: {
@@ -209,6 +217,8 @@ var groupIdentifyWithProperties = {
209
217
  ]
210
218
  };
211
219
  var captureWithGroupContext = {
220
+ title: "Capture with group",
221
+ description: "A destination-level group mapping attaches the resolved group context to every PostHog capture call.",
212
222
  in: (0, import_core.getEvent)("page view", {
213
223
  timestamp: 1700000104,
214
224
  globals: { pagegroup: "docs", company_id: "company_123" }
@@ -234,12 +244,16 @@ var captureWithGroupContext = {
234
244
  ]
235
245
  };
236
246
  var consentRevoke = {
247
+ title: "Consent revoked",
248
+ description: "A walker consent command with analytics denied calls client.disable on the PostHog client.",
237
249
  command: "consent",
238
250
  in: { analytics: false },
239
251
  settings: {},
240
252
  out: [["client.disable"]]
241
253
  };
242
254
  var consentGrant = {
255
+ title: "Consent granted",
256
+ description: "A walker consent command with analytics granted calls client.enable on the PostHog client.",
243
257
  command: "consent",
244
258
  in: { analytics: true },
245
259
  settings: {},
@@ -66,6 +66,8 @@ __export(step_exports, {
66
66
  });
67
67
  import { getEvent } from "@walkeros/core";
68
68
  var defaultCapture = {
69
+ title: "Default capture",
70
+ description: "A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",
69
71
  in: getEvent("product view", { timestamp: 1700000100 }),
70
72
  out: [
71
73
  [
@@ -79,6 +81,8 @@ var defaultCapture = {
79
81
  ]
80
82
  };
81
83
  var captureWithInclude = {
84
+ title: "Capture with include",
85
+ description: "Destination-level include flattens data and globals sections into prefixed PostHog event properties.",
82
86
  in: getEvent("order complete", { timestamp: 1700000101 }),
83
87
  configInclude: ["data", "globals"],
84
88
  out: [
@@ -100,6 +104,8 @@ var captureWithInclude = {
100
104
  ]
101
105
  };
102
106
  var identifyWithSetAndSetOnce = {
107
+ title: "Identify with $set",
108
+ description: "A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",
103
109
  in: getEvent("user login", {
104
110
  timestamp: 1700000102,
105
111
  data: {
@@ -148,6 +154,8 @@ var identifyWithSetAndSetOnce = {
148
154
  ]
149
155
  };
150
156
  var groupIdentifyWithProperties = {
157
+ title: "Group identify",
158
+ description: "A company update fires PostHog groupIdentify with group type, key, and associated group properties.",
151
159
  in: getEvent("company update", {
152
160
  timestamp: 1700000103,
153
161
  data: {
@@ -188,6 +196,8 @@ var groupIdentifyWithProperties = {
188
196
  ]
189
197
  };
190
198
  var captureWithGroupContext = {
199
+ title: "Capture with group",
200
+ description: "A destination-level group mapping attaches the resolved group context to every PostHog capture call.",
191
201
  in: getEvent("page view", {
192
202
  timestamp: 1700000104,
193
203
  globals: { pagegroup: "docs", company_id: "company_123" }
@@ -213,12 +223,16 @@ var captureWithGroupContext = {
213
223
  ]
214
224
  };
215
225
  var consentRevoke = {
226
+ title: "Consent revoked",
227
+ description: "A walker consent command with analytics denied calls client.disable on the PostHog client.",
216
228
  command: "consent",
217
229
  in: { analytics: false },
218
230
  settings: {},
219
231
  out: [["client.disable"]]
220
232
  };
221
233
  var consentGrant = {
234
+ title: "Consent granted",
235
+ description: "A walker consent command with analytics granted calls client.enable on the PostHog client.",
222
236
  command: "consent",
223
237
  in: { analytics: true },
224
238
  settings: {},
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-posthog",
4
- "version": "3.4.0",
4
+ "version": "3.4.1-next-1776790594143",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -96,6 +96,8 @@
96
96
  },
97
97
  "step": {
98
98
  "captureWithGroupContext": {
99
+ "title": "Capture with group",
100
+ "description": "A destination-level group mapping attaches the resolved group context to every PostHog capture call.",
99
101
  "in": {
100
102
  "name": "page view",
101
103
  "data": {
@@ -151,7 +153,7 @@
151
153
  "group": "gr0up",
152
154
  "count": 1,
153
155
  "version": {
154
- "source": "3.4.0",
156
+ "source": "3.4.1-next-1776790594143",
155
157
  "tagging": 1
156
158
  },
157
159
  "source": {
@@ -185,6 +187,8 @@
185
187
  ]
186
188
  },
187
189
  "captureWithInclude": {
190
+ "title": "Capture with include",
191
+ "description": "Destination-level include flattens data and globals sections into prefixed PostHog event properties.",
188
192
  "in": {
189
193
  "name": "order complete",
190
194
  "data": {
@@ -271,7 +275,7 @@
271
275
  "group": "gr0up",
272
276
  "count": 1,
273
277
  "version": {
274
- "source": "3.4.0",
278
+ "source": "3.4.1-next-1776790594143",
275
279
  "tagging": 1
276
280
  },
277
281
  "source": {
@@ -303,6 +307,8 @@
303
307
  ]
304
308
  },
305
309
  "consentGrant": {
310
+ "title": "Consent granted",
311
+ "description": "A walker consent command with analytics granted calls client.enable on the PostHog client.",
306
312
  "command": "consent",
307
313
  "in": {
308
314
  "analytics": true
@@ -315,6 +321,8 @@
315
321
  ]
316
322
  },
317
323
  "consentRevoke": {
324
+ "title": "Consent revoked",
325
+ "description": "A walker consent command with analytics denied calls client.disable on the PostHog client.",
318
326
  "command": "consent",
319
327
  "in": {
320
328
  "analytics": false
@@ -327,6 +335,8 @@
327
335
  ]
328
336
  },
329
337
  "defaultCapture": {
338
+ "title": "Default capture",
339
+ "description": "A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",
330
340
  "in": {
331
341
  "name": "product view",
332
342
  "data": {
@@ -366,7 +376,7 @@
366
376
  "group": "gr0up",
367
377
  "count": 1,
368
378
  "version": {
369
- "source": "3.4.0",
379
+ "source": "3.4.1-next-1776790594143",
370
380
  "tagging": 1
371
381
  },
372
382
  "source": {
@@ -387,6 +397,8 @@
387
397
  ]
388
398
  },
389
399
  "groupIdentifyWithProperties": {
400
+ "title": "Group identify",
401
+ "description": "A company update fires PostHog groupIdentify with group type, key, and associated group properties.",
390
402
  "in": {
391
403
  "name": "company update",
392
404
  "data": {
@@ -438,7 +450,7 @@
438
450
  "group": "gr0up",
439
451
  "count": 1,
440
452
  "version": {
441
- "source": "3.4.0",
453
+ "source": "3.4.1-next-1776790594143",
442
454
  "tagging": 1
443
455
  },
444
456
  "source": {
@@ -481,6 +493,8 @@
481
493
  ]
482
494
  },
483
495
  "identifyWithSetAndSetOnce": {
496
+ "title": "Identify with $set",
497
+ "description": "A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",
484
498
  "in": {
485
499
  "name": "user login",
486
500
  "data": {
@@ -532,7 +546,7 @@
532
546
  "group": "gr0up",
533
547
  "count": 1,
534
548
  "version": {
535
- "source": "3.4.0",
549
+ "source": "3.4.1-next-1776790594143",
536
550
  "tagging": 1
537
551
  },
538
552
  "source": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-posthog",
3
3
  "description": "PostHog server destination for walkerOS",
4
- "version": "3.4.0",
4
+ "version": "3.4.1-next-1776790594143",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -34,12 +34,12 @@
34
34
  "update": "npx npm-check-updates -u && npm update"
35
35
  },
36
36
  "dependencies": {
37
- "@walkeros/core": "3.4.0",
38
- "@walkeros/server-core": "3.4.0",
37
+ "@walkeros/core": "3.4.1-next-1776790594143",
38
+ "@walkeros/server-core": "3.4.1-next-1776790594143",
39
39
  "posthog-node": "^5.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@walkeros/collector": "3.4.0"
42
+ "@walkeros/collector": "3.4.1-next-1776790594143"
43
43
  },
44
44
  "repository": {
45
45
  "url": "git+https://github.com/elbwalker/walkerOS.git",