@walkeros/server-destination-posthog 4.8.2 → 4.8.3-next-1793115089237

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 CHANGED
@@ -1,5 +1,38 @@
1
1
  # @walkeros/server-destination-posthog
2
2
 
3
+ ## 4.8.3-next-1793115089237
4
+
5
+ ### Patch Changes
6
+
7
+ - 5313635: The sample events from `getEvent` now use the standard event names:
8
+ `checkout start` replaces `checkout view`, an order carries `tax` and `total`,
9
+ a promotion names its placement `slot`, and product events carry `currency`.
10
+ Order `value` is now the merchandise value: the `order complete` sample goes
11
+ from 555 to 462, and the gross amount charged is `total` (467.22). The
12
+ destination examples read `data.tax`, `data.slot` and the search keys
13
+ `data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
14
+ read `data.total` first, then `data.value`. The CLI ships default event
15
+ contracts for common site types in `examples/contracts/`.
16
+ - 5313635: The package publishes a minimal example: the project API key, read as
17
+ the `POSTHOG_API_KEY` secret. The docs page renders the install line, the
18
+ integrated code and the flow from it, and the package test runs the same
19
+ settings.
20
+ - 5313635: The `flushAt` and `flushInterval` descriptions now say that every
21
+ push and batch flushes the SDK, `personalApiKey` and
22
+ `featureFlagsPollingInterval` say that the destination evaluates no feature
23
+ flags, and `disableGeoip` states its default of `true`. Step examples that
24
+ depend on destination config name it, with timestamps in milliseconds.
25
+ - Updated dependencies [34fd225]
26
+ - Updated dependencies [5313635]
27
+ - Updated dependencies [5313635]
28
+ - Updated dependencies [5313635]
29
+ - Updated dependencies [5313635]
30
+ - Updated dependencies [5313635]
31
+ - Updated dependencies [34fd225]
32
+ - Updated dependencies [5313635]
33
+ - @walkeros/core@4.8.3-next-1793115089237
34
+ - @walkeros/server-core@4.8.3-next-1793115089237
35
+
3
36
  ## 4.8.2
4
37
 
5
38
  ### Patch Changes
@@ -276,9 +309,6 @@
276
309
  and `event.context` remain required.
277
310
  - Each source self-registers via TypeScript module augmentation of `SourceMap`
278
311
  in `@walkeros/core`.
279
- - App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
280
- part of this release. Telemetry from v4 CLI/MCP will not validate against
281
- the existing app schema until that follow-up ships.
282
312
  - `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
283
313
  configs using `skip: true` in mapping rules must rename to `silent: true`.
284
314
  Hard cut: no legacy alias, the field is gone.
package/README.md CHANGED
@@ -7,8 +7,7 @@
7
7
  # @walkeros/server-destination-posthog
8
8
 
9
9
  Server-side event delivery to PostHog for product analytics, identity
10
- resolution, group analytics, and feature flags via the official posthog-node
11
- SDK.
10
+ resolution, and group analytics via the official posthog-node SDK.
12
11
 
13
12
  [Documentation](https://www.walkeros.io/docs/destinations/server/posthog) •
14
13
  [NPM Package](https://www.npmjs.com/package/@walkeros/server-destination-posthog)
package/dist/dev.d.mts CHANGED
@@ -175,10 +175,17 @@ declare namespace step {
175
175
  export { type step_PostHogStepExample as PostHogStepExample, step_captureWithGroupContext as captureWithGroupContext, step_captureWithInclude as captureWithInclude, step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultCapture as defaultCapture, step_groupIdentifyWithProperties as groupIdentifyWithProperties, step_groupIdentifyWithoutData as groupIdentifyWithoutData, step_identifyWithSetAndSetOnce as identifyWithSetAndSetOnce, step_silentRule as silentRule };
176
176
  }
177
177
 
178
+ /**
179
+ * The setting PostHog needs to deliver: the project API key, read from the
180
+ * environment.
181
+ */
182
+ declare const minimal: Flow.MinimalExample;
183
+
178
184
  declare const index_env: typeof env;
185
+ declare const index_minimal: typeof minimal;
179
186
  declare const index_step: typeof step;
180
187
  declare namespace index {
181
- export { index_env as env, index_step as step };
188
+ export { index_env as env, index_minimal as minimal, index_step as step };
182
189
  }
183
190
 
184
191
  export { index as examples, index$1 as schemas };
package/dist/dev.d.ts CHANGED
@@ -175,10 +175,17 @@ declare namespace step {
175
175
  export { type step_PostHogStepExample as PostHogStepExample, step_captureWithGroupContext as captureWithGroupContext, step_captureWithInclude as captureWithInclude, step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultCapture as defaultCapture, step_groupIdentifyWithProperties as groupIdentifyWithProperties, step_groupIdentifyWithoutData as groupIdentifyWithoutData, step_identifyWithSetAndSetOnce as identifyWithSetAndSetOnce, step_silentRule as silentRule };
176
176
  }
177
177
 
178
+ /**
179
+ * The setting PostHog needs to deliver: the project API key, read from the
180
+ * environment.
181
+ */
182
+ declare const minimal: Flow.MinimalExample;
183
+
178
184
  declare const index_env: typeof env;
185
+ declare const index_minimal: typeof minimal;
179
186
  declare const index_step: typeof step;
180
187
  declare namespace index {
181
- export { index_env as env, index_step as step };
188
+ export { index_env as env, index_minimal as minimal, index_step as step };
182
189
  }
183
190
 
184
191
  export { index as examples, index$1 as schemas };
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,a=(e,i)=>{for(var o in i)t(e,o,{get:i[o],enumerable:!0})},s={};a(s,{examples:()=>f,schemas:()=>r}),module.exports=(e=s,((e,a,s,r)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of o(a))n.call(e,p)||p===s||t(e,p,{get:()=>a[p],enumerable:!(r=i(a,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};a(r,{MappingSchema:()=>d,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 queued group identifies before auto-flush. Captures and identifies are sent at once, each push awaiting its own call. Default: 20.").optional(),flushInterval:l.z.number().describe("Milliseconds between periodic flushes of queued group identifies. 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(),disableCompression:l.z.boolean().describe("Send requests uncompressed (no gzip). Default: false.").optional(),requestTimeout:l.z.number().describe("Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.").optional(),fetchRetryCount:l.z.number().describe("Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.").optional(),fetchRetryDelay:l.z.number().describe("Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.").optional(),debug:l.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),disabled:l.z.boolean().describe("Disable the PostHog client: nothing is sent. 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()}).strict(),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()}),g=(0,p.zodToSchema)(c),m=(0,p.zodToSchema)(d),f={};a(f,{env:()=>h,step:()=>v});var h={};a(h,{push:()=>y,simulation:()=>b});var y={get PostHog(){return class{apiKey;options;calls;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:PostHog.capture","call:PostHog.identify","call:PostHog.groupIdentify","call:PostHog.shutdown"],v={};a(v,{captureWithGroupContext:()=>z,captureWithInclude:()=>_,consentGrant:()=>A,consentRevoke:()=>H,defaultCapture:()=>P,groupIdentifyWithProperties:()=>I,groupIdentifyWithoutData:()=>$,identifyWithSetAndSetOnce:()=>k,silentRule:()=>D});var w=require("@walkeros/core"),P={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",{id:"ev1700000100",timestamp:1700000100}),out:[["client.capture",{uuid:"b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c",distinctId:"us3r",event:"product view",properties:{}}]]},_={title:"Capture with include",description:"Destination-level include flattens data and globals sections into prefixed PostHog event properties.",in:(0,w.getEvent)("order complete",{id:"ev1700000101",timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{uuid:"a5a5ede9-4f3b-85f4-b30f-3da8773fabfa",distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_value:555,globals_pagegroup:"shop"}}]]},k={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.createEvent)({name:"user login",timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{silent:!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.createEvent)({name:"company update",timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{silent:!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",{id:"ev1700000104",timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{uuid:"c6a47305-44fc-8835-b15f-3f494c1f9e20",distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},H={title:"Consent revoked",description:"A walker consent command with analytics denied calls client.disable on the PostHog client.",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["client.enable"],["client.disable"]]},A={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"]]},D={public:!1,description:"A rule with silent: true and no identify or group mapping sends nothing to PostHog.",in:(0,w.getEvent)("page view",{timestamp:1700000105}),mapping:{silent:!0},out:[]},$={public:!1,description:"A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update",timestamp:1700000106},mapping:I.mapping,out:[]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(e,i)=>{for(var a in i)t(e,a,{get:i[a],enumerable:!0})},o={};s(o,{examples:()=>m,schemas:()=>r}),module.exports=(e=o,((e,s,o,r)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let l of a(s))n.call(e,l)||l===o||t(e,l,{get:()=>s[l],enumerable:!(r=i(s,l))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};s(r,{MappingSchema:()=>d,SettingsSchema:()=>c,mapping:()=>h,settings:()=>g});var l=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),c=p.z.object({apiKey:p.z.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:p.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:p.z.number().describe("Calls the SDK queues before it starts a send on its own. Each push and each config.batch batch flushes the SDK and waits for the answer either way. Default: 20.").optional(),flushInterval:p.z.number().describe("Milliseconds after which the SDK sends calls still queued on its own. Each push and each config.batch batch flushes the SDK either way. Default: 10000.").optional(),personalApiKey:p.z.string().describe("Personal API key (phx_...). With it the SDK polls feature flag definitions; this destination evaluates no flags and attaches none to its events.").optional(),featureFlagsPollingInterval:p.z.number().describe("Milliseconds between feature flag definition polls, with personalApiKey set. This destination evaluates no flags. Default: 30000.").optional(),disableGeoip:p.z.boolean().describe("Disable GeoIP lookups for every event. Default: true, the SDK default.").optional(),disableCompression:p.z.boolean().describe("Send requests uncompressed (no gzip). Default: false.").optional(),requestTimeout:p.z.number().describe("Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.").optional(),fetchRetryCount:p.z.number().describe("Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.").optional(),fetchRetryDelay:p.z.number().describe("Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.").optional(),debug:p.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),disabled:p.z.boolean().describe("Disable the PostHog client: nothing is sent. Default: false.").optional(),identify:p.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:p.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional()}).strict(),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()}),g=(0,l.zodToSchema)(c),h=(0,l.zodToSchema)(d),m={};s(m,{env:()=>f,minimal:()=>S,step:()=>v});var f={};s(f,{push:()=>y,simulation:()=>b});var y={get PostHog(){return class{apiKey;options;calls;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:PostHog.capture","call:PostHog.identify","call:PostHog.groupIdentify","call:PostHog.shutdown"],v={};s(v,{captureWithGroupContext:()=>D,captureWithInclude:()=>_,consentGrant:()=>H,consentRevoke:()=>z,defaultCapture:()=>P,groupIdentifyWithProperties:()=>I,groupIdentifyWithoutData:()=>K,identifyWithSetAndSetOnce:()=>k,silentRule:()=>A});var w=require("@walkeros/core"),P={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",{id:"ev1700000100",timestamp:1700000100}),out:[["client.capture",{uuid:"b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c",distinctId:"us3r",event:"product view",properties:{}}]]},_={title:"Capture with include",description:"With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.",in:(0,w.getEvent)("order complete",{id:"ev1700000101",timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{uuid:"a5a5ede9-4f3b-85f4-b30f-3da8773fabfa",distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_value:462,data_tax:73.76,data_shipping:5.22,data_total:467.22,globals_pagegroup:"shop"}}]]},k={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.createEvent)({name:"user login",timestamp:1700000102e3,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{silent:!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:1700000102e3}}}]]},I={title:"Group identify",description:"A company update fires PostHog groupIdentify with group type, key, and associated group properties.",in:(0,w.createEvent)({name:"company update",timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{silent:!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"}}]]},D={title:"Capture with group",description:"With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.",in:(0,w.getEvent)("page view",{id:"ev1700000104",timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{uuid:"c6a47305-44fc-8835-b15f-3f494c1f9e20",distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},z={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["client.enable"],["client.disable"]]},H={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.",command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]},A={public:!1,description:"A rule with silent: true and no identify or group mapping sends nothing to PostHog.",in:(0,w.getEvent)("page view",{timestamp:1700000105}),mapping:{silent:!0},out:[]},K={public:!1,description:"A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update",timestamp:1700000106},mapping:I.mapping,out:[]},S={settings:{apiKey:"phc_test"},secrets:{apiKey:"POSTHOG_API_KEY"}};//# 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\n .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(\n 'Number of queued group identifies before auto-flush. Captures and identifies are sent at once, each push awaiting its own call. Default: 20.',\n )\n .optional(),\n flushInterval: z\n .number()\n .describe(\n 'Milliseconds between periodic flushes of queued group identifies. Default: 10000.',\n )\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 disableCompression: z\n .boolean()\n .describe('Send requests uncompressed (no gzip). Default: false.')\n .optional(),\n requestTimeout: z\n .number()\n .describe(\n 'Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.',\n )\n .optional(),\n fetchRetryCount: z\n .number()\n .describe(\n 'Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.',\n )\n .optional(),\n fetchRetryDelay: z\n .number()\n .describe(\n 'Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n disabled: z\n .boolean()\n .describe('Disable the PostHog client: nothing is sent. 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 })\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, $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();\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:PostHog.capture',\n 'call:PostHog.identify',\n 'call:PostHog.groupIdentify',\n 'call:PostHog.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, 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 /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\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', { id: 'ev1700000100', timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n uuid: 'b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c',\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', { id: 'ev1700000101', timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n uuid: 'a5a5ede9-4f3b-85f4-b30f-3da8773fabfa',\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_value: 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. silent: 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: createEvent({\n name: '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 silent: 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. silent: 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: createEvent({\n name: 'company update',\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: 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 id: 'ev1700000104',\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 uuid: 'c6a47305-44fc-8835-b15f-3f494c1f9e20',\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\nconst analyticsDenied: WalkerOS.Consent = { analytics: false };\nconst analyticsGranted: WalkerOS.Consent = { analytics: true };\n\n/**\n * Consent revoked - after analytics consent is granted (PostHog loads and is\n * enabled), revoking it calls client.disable() via the on('consent') handler.\n * The destination is never loaded under denied consent, so the disable is a\n * real revocation of an already-granted destination.\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 before: { analytics: true },\n in: analyticsDenied,\n settings: {},\n out: [['client.enable'], ['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: analyticsGranted,\n settings: {},\n out: [['client.enable']],\n};\n\n/** A silent rule without identify or group mappings calls nothing. */\nexport const silentRule: PostHogStepExample = {\n public: false,\n description:\n 'A rule with silent: true and no identify or group mapping sends nothing to PostHog.',\n in: getEvent('page view', { timestamp: 1700000105 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group identify rule of groupIdentifyWithProperties on an event\n * without data: no group key resolves and the rule suppresses the capture,\n * so nothing is sent.\n */\nexport const groupIdentifyWithoutData: PostHogStepExample = {\n public: false,\n description:\n 'A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: {\n name: 'company update',\n entity: 'company',\n action: 'update',\n timestamp: 1700000106,\n },\n mapping: groupIdentifyWithProperties.mapping,\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,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;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,aACZ,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,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,oBAAoB,aACjB,QAAQ,EACR,SAAS,uDAAuD,EAChE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS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;AAC7C;AAKO,IAAM,eAAmC;AAAA,EAC9C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;AAGO,IAAM,aAAiC;AAAA,EAC5C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,2BAA+C;AAAA,EAC1D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAAA,EACA,SAAS,4BAA4B;AAAA,EACrC,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","../src/examples/minimal.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 '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(\n 'Calls the SDK queues before it starts a send on its own. Each push and each config.batch batch flushes the SDK and waits for the answer either way. Default: 20.',\n )\n .optional(),\n flushInterval: z\n .number()\n .describe(\n 'Milliseconds after which the SDK sends calls still queued on its own. Each push and each config.batch batch flushes the SDK either way. Default: 10000.',\n )\n .optional(),\n personalApiKey: z\n .string()\n .describe(\n 'Personal API key (phx_...). With it the SDK polls feature flag definitions; this destination evaluates no flags and attaches none to its events.',\n )\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls, with personalApiKey set. This destination evaluates no flags. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe(\n 'Disable GeoIP lookups for every event. Default: true, the SDK default.',\n )\n .optional(),\n disableCompression: z\n .boolean()\n .describe('Send requests uncompressed (no gzip). Default: false.')\n .optional(),\n requestTimeout: z\n .number()\n .describe(\n 'Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.',\n )\n .optional(),\n fetchRetryCount: z\n .number()\n .describe(\n 'Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.',\n )\n .optional(),\n fetchRetryDelay: z\n .number()\n .describe(\n 'Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n disabled: z\n .boolean()\n .describe('Disable the PostHog client: nothing is sent. 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 })\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, $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';\nexport { minimal } from './minimal';\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();\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:PostHog.capture',\n 'call:PostHog.identify',\n 'call:PostHog.groupIdentify',\n 'call:PostHog.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, 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 /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\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', { id: 'ev1700000100', timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n uuid: 'b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c',\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 \"With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.\",\n in: getEvent('order complete', { id: 'ev1700000101', timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n uuid: 'a5a5ede9-4f3b-85f4-b30f-3da8773fabfa',\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_value: 462,\n data_tax: 73.76,\n data_shipping: 5.22,\n data_total: 467.22,\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. silent: 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: createEvent({\n name: 'user login',\n timestamp: 1700000102000,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n silent: 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: 1700000102000,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties - per-event mapping fires\n * client.groupIdentify() with group properties. silent: 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: createEvent({\n name: 'company update',\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: 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 \"With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.\",\n in: getEvent('page view', {\n id: 'ev1700000104',\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 uuid: 'c6a47305-44fc-8835-b15f-3f494c1f9e20',\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\nconst analyticsDenied: WalkerOS.Consent = { analytics: false };\nconst analyticsGranted: WalkerOS.Consent = { analytics: true };\n\n/**\n * Consent revoked - after analytics consent is granted (PostHog loads and is\n * enabled), revoking it calls client.disable() via the on('consent') handler.\n * The destination is never loaded under denied consent, so the disable is a\n * real revocation of an already-granted destination.\n */\nexport const consentRevoke: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.',\n command: 'consent',\n before: { analytics: true },\n in: analyticsDenied,\n settings: {},\n out: [['client.enable'], ['client.disable']],\n};\n\n/**\n * Consent granted - client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.',\n command: 'consent',\n in: analyticsGranted,\n settings: {},\n out: [['client.enable']],\n};\n\n/** A silent rule without identify or group mappings calls nothing. */\nexport const silentRule: PostHogStepExample = {\n public: false,\n description:\n 'A rule with silent: true and no identify or group mapping sends nothing to PostHog.',\n in: getEvent('page view', { timestamp: 1700000105 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group identify rule of groupIdentifyWithProperties on an event\n * without data: no group key resolves and the rule suppresses the capture,\n * so nothing is sent.\n */\nexport const groupIdentifyWithoutData: PostHogStepExample = {\n public: false,\n description:\n 'A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: {\n name: 'company update',\n entity: 'company',\n action: 'update',\n timestamp: 1700000106,\n },\n mapping: groupIdentifyWithProperties.mapping,\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting PostHog needs to deliver: the project API key, read from the\n * environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: 'phc_test' },\n secrets: { apiKey: 'POSTHOG_API_KEY' },\n};\n"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;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAAA,EACA,SAAS,4BAA4B;AAAA,EACrC,KAAK,CAAC;AACR;;;AC7QO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,WAAW;AAAA,EAC/B,SAAS,EAAE,QAAQ,kBAAkB;AACvC;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,i=(e,i)=>{for(var o in i)t(e,o,{get:i[o],enumerable:!0})},o={};i(o,{MappingSchema:()=>p,SettingsSchema:()=>n,mapping:()=>c,settings:()=>l});import{zodToSchema as s}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var n=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 queued group identifies before auto-flush. Captures and identifies are sent at once, each push awaiting its own call. Default: 20.").optional(),flushInterval:a.number().describe("Milliseconds between periodic flushes of queued group identifies. 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(),disableCompression:a.boolean().describe("Send requests uncompressed (no gzip). Default: false.").optional(),requestTimeout:a.number().describe("Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.").optional(),fetchRetryCount:a.number().describe("Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.").optional(),fetchRetryDelay:a.number().describe("Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.").optional(),debug:a.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),disabled:a.boolean().describe("Disable the PostHog client: nothing is sent. 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()}).strict();import{z as r}from"@walkeros/core/dev";var p=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:r.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),l=s(n),c=s(p),d={};i(d,{env:()=>u,step:()=>f});var u={};i(u,{push:()=>m,simulation:()=>g});var m={get PostHog(){return class{apiKey;options;calls;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:[]})}}}},g=["call:PostHog.capture","call:PostHog.identify","call:PostHog.groupIdentify","call:PostHog.shutdown"],f={};i(f,{captureWithGroupContext:()=>_,captureWithInclude:()=>v,consentGrant:()=>I,consentRevoke:()=>k,defaultCapture:()=>b,groupIdentifyWithProperties:()=>P,groupIdentifyWithoutData:()=>A,identifyWithSetAndSetOnce:()=>w,silentRule:()=>H});import{createEvent as h,getEvent as y}from"@walkeros/core";var b={title:"Default capture",description:"A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",in:y("product view",{id:"ev1700000100",timestamp:1700000100}),out:[["client.capture",{uuid:"b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c",distinctId:"us3r",event:"product view",properties:{}}]]},v={title:"Capture with include",description:"Destination-level include flattens data and globals sections into prefixed PostHog event properties.",in:y("order complete",{id:"ev1700000101",timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{uuid:"a5a5ede9-4f3b-85f4-b30f-3da8773fabfa",distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_value:555,globals_pagegroup:"shop"}}]]},w={title:"Identify with $set",description:"A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",in:h({name:"user login",timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{silent:!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={title:"Group identify",description:"A company update fires PostHog groupIdentify with group type, key, and associated group properties.",in:h({name:"company update",timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{silent:!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"}}]]},_={title:"Capture with group",description:"A destination-level group mapping attaches the resolved group context to every PostHog capture call.",in:y("page view",{id:"ev1700000104",timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{uuid:"c6a47305-44fc-8835-b15f-3f494c1f9e20",distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},k={title:"Consent revoked",description:"A walker consent command with analytics denied calls client.disable on the PostHog client.",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["client.enable"],["client.disable"]]},I={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"]]},H={public:!1,description:"A rule with silent: true and no identify or group mapping sends nothing to PostHog.",in:y("page view",{timestamp:1700000105}),mapping:{silent:!0},out:[]},A={public:!1,description:"A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update",timestamp:1700000106},mapping:P.mapping,out:[]};export{d as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
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:()=>p,SettingsSchema:()=>o,mapping:()=>c,settings:()=>l});import{zodToSchema as s}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var o=n.object({apiKey:n.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:n.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:n.number().describe("Calls the SDK queues before it starts a send on its own. Each push and each config.batch batch flushes the SDK and waits for the answer either way. Default: 20.").optional(),flushInterval:n.number().describe("Milliseconds after which the SDK sends calls still queued on its own. Each push and each config.batch batch flushes the SDK either way. Default: 10000.").optional(),personalApiKey:n.string().describe("Personal API key (phx_...). With it the SDK polls feature flag definitions; this destination evaluates no flags and attaches none to its events.").optional(),featureFlagsPollingInterval:n.number().describe("Milliseconds between feature flag definition polls, with personalApiKey set. This destination evaluates no flags. Default: 30000.").optional(),disableGeoip:n.boolean().describe("Disable GeoIP lookups for every event. Default: true, the SDK default.").optional(),disableCompression:n.boolean().describe("Send requests uncompressed (no gzip). Default: false.").optional(),requestTimeout:n.number().describe("Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.").optional(),fetchRetryCount:n.number().describe("Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.").optional(),fetchRetryDelay:n.number().describe("Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.").optional(),debug:n.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),disabled:n.boolean().describe("Disable the PostHog client: nothing is sent. Default: false.").optional(),identify:n.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:n.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional()}).strict();import{z as r}from"@walkeros/core/dev";var p=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:r.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),l=s(o),c=s(p),d={};i(d,{env:()=>u,minimal:()=>A,step:()=>h});var u={};i(u,{push:()=>m,simulation:()=>g});var m={get PostHog(){return class{apiKey;options;calls;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:[]})}}}},g=["call:PostHog.capture","call:PostHog.identify","call:PostHog.groupIdentify","call:PostHog.shutdown"],h={};i(h,{captureWithGroupContext:()=>P,captureWithInclude:()=>v,consentGrant:()=>I,consentRevoke:()=>k,defaultCapture:()=>b,groupIdentifyWithProperties:()=>_,groupIdentifyWithoutData:()=>H,identifyWithSetAndSetOnce:()=>w,silentRule:()=>D});import{createEvent as f,getEvent as y}from"@walkeros/core";var b={title:"Default capture",description:"A walker event becomes a PostHog capture call with the user id as distinctId and no extra properties.",in:y("product view",{id:"ev1700000100",timestamp:1700000100}),out:[["client.capture",{uuid:"b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c",distinctId:"us3r",event:"product view",properties:{}}]]},v={title:"Capture with include",description:"With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.",in:y("order complete",{id:"ev1700000101",timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{uuid:"a5a5ede9-4f3b-85f4-b30f-3da8773fabfa",distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_value:462,data_tax:73.76,data_shipping:5.22,data_total:467.22,globals_pagegroup:"shop"}}]]},w={title:"Identify with $set",description:"A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",in:f({name:"user login",timestamp:1700000102e3,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{silent:!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:1700000102e3}}}]]},_={title:"Group identify",description:"A company update fires PostHog groupIdentify with group type, key, and associated group properties.",in:f({name:"company update",timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{silent:!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"}}]]},P={title:"Capture with group",description:"With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.",in:y("page view",{id:"ev1700000104",timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{uuid:"c6a47305-44fc-8835-b15f-3f494c1f9e20",distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},k={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["client.enable"],["client.disable"]]},I={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.",command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]},D={public:!1,description:"A rule with silent: true and no identify or group mapping sends nothing to PostHog.",in:y("page view",{timestamp:1700000105}),mapping:{silent:!0},out:[]},H={public:!1,description:"A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update",timestamp:1700000106},mapping:_.mapping,out:[]},A={settings:{apiKey:"phc_test"},secrets:{apiKey:"POSTHOG_API_KEY"}};export{d 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\n .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(\n 'Number of queued group identifies before auto-flush. Captures and identifies are sent at once, each push awaiting its own call. Default: 20.',\n )\n .optional(),\n flushInterval: z\n .number()\n .describe(\n 'Milliseconds between periodic flushes of queued group identifies. Default: 10000.',\n )\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 disableCompression: z\n .boolean()\n .describe('Send requests uncompressed (no gzip). Default: false.')\n .optional(),\n requestTimeout: z\n .number()\n .describe(\n 'Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.',\n )\n .optional(),\n fetchRetryCount: z\n .number()\n .describe(\n 'Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.',\n )\n .optional(),\n fetchRetryDelay: z\n .number()\n .describe(\n 'Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n disabled: z\n .boolean()\n .describe('Disable the PostHog client: nothing is sent. 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 })\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, $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();\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:PostHog.capture',\n 'call:PostHog.identify',\n 'call:PostHog.groupIdentify',\n 'call:PostHog.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, 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 /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\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', { id: 'ev1700000100', timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n uuid: 'b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c',\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', { id: 'ev1700000101', timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n uuid: 'a5a5ede9-4f3b-85f4-b30f-3da8773fabfa',\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_value: 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. silent: 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: createEvent({\n name: '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 silent: 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. silent: 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: createEvent({\n name: 'company update',\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: 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 id: 'ev1700000104',\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 uuid: 'c6a47305-44fc-8835-b15f-3f494c1f9e20',\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\nconst analyticsDenied: WalkerOS.Consent = { analytics: false };\nconst analyticsGranted: WalkerOS.Consent = { analytics: true };\n\n/**\n * Consent revoked - after analytics consent is granted (PostHog loads and is\n * enabled), revoking it calls client.disable() via the on('consent') handler.\n * The destination is never loaded under denied consent, so the disable is a\n * real revocation of an already-granted destination.\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 before: { analytics: true },\n in: analyticsDenied,\n settings: {},\n out: [['client.enable'], ['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: analyticsGranted,\n settings: {},\n out: [['client.enable']],\n};\n\n/** A silent rule without identify or group mappings calls nothing. */\nexport const silentRule: PostHogStepExample = {\n public: false,\n description:\n 'A rule with silent: true and no identify or group mapping sends nothing to PostHog.',\n in: getEvent('page view', { timestamp: 1700000105 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group identify rule of groupIdentifyWithProperties on an event\n * without data: no group key resolves and the rule suppresses the capture,\n * so nothing is sent.\n */\nexport const groupIdentifyWithoutData: PostHogStepExample = {\n public: false,\n description:\n 'A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: {\n name: 'company update',\n entity: 'company',\n action: 'update',\n timestamp: 1700000106,\n },\n mapping: groupIdentifyWithProperties.mapping,\n out: [],\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,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,EACZ,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP,SA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EACF;AACF;AAEA,IAAM,kBAAoC,EAAE,WAAW,MAAM;AAC7D,IAAM,mBAAqC,EAAE,WAAW,KAAK;AAQtD,IAAM,gBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI;AAAA,EACJ,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,GAAG,CAAC,gBAAgB,CAAC;AAC7C;AAKO,IAAM,eAAmC;AAAA,EAC9C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;AAGO,IAAM,aAAiC;AAAA,EAC5C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,2BAA+C;AAAA,EAC1D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAAA,EACA,SAAS,4BAA4B;AAAA,EACrC,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","../src/examples/minimal.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 '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(\n 'Calls the SDK queues before it starts a send on its own. Each push and each config.batch batch flushes the SDK and waits for the answer either way. Default: 20.',\n )\n .optional(),\n flushInterval: z\n .number()\n .describe(\n 'Milliseconds after which the SDK sends calls still queued on its own. Each push and each config.batch batch flushes the SDK either way. Default: 10000.',\n )\n .optional(),\n personalApiKey: z\n .string()\n .describe(\n 'Personal API key (phx_...). With it the SDK polls feature flag definitions; this destination evaluates no flags and attaches none to its events.',\n )\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls, with personalApiKey set. This destination evaluates no flags. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe(\n 'Disable GeoIP lookups for every event. Default: true, the SDK default.',\n )\n .optional(),\n disableCompression: z\n .boolean()\n .describe('Send requests uncompressed (no gzip). Default: false.')\n .optional(),\n requestTimeout: z\n .number()\n .describe(\n 'Milliseconds before a request to PostHog times out. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.',\n )\n .optional(),\n fetchRetryCount: z\n .number()\n .describe(\n 'Retries of a failed request to PostHog. Default: 2, which with the default timeout and delay ends within config.timeout. A value set here wins.',\n )\n .optional(),\n fetchRetryDelay: z\n .number()\n .describe(\n 'Milliseconds between retries of a failed request. Default: a tenth of config.timeout (1000 at the 10 s default). A value set here wins.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n disabled: z\n .boolean()\n .describe('Disable the PostHog client: nothing is sent. 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 })\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, $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';\nexport { minimal } from './minimal';\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();\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:PostHog.capture',\n 'call:PostHog.identify',\n 'call:PostHog.groupIdentify',\n 'call:PostHog.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, 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 /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\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', { id: 'ev1700000100', timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n uuid: 'b8a7f21f-1a9f-8aa7-8480-8d16fb64c44c',\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 \"With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.\",\n in: getEvent('order complete', { id: 'ev1700000101', timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n uuid: 'a5a5ede9-4f3b-85f4-b30f-3da8773fabfa',\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_value: 462,\n data_tax: 73.76,\n data_shipping: 5.22,\n data_total: 467.22,\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. silent: 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: createEvent({\n name: 'user login',\n timestamp: 1700000102000,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n silent: 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: 1700000102000,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties - per-event mapping fires\n * client.groupIdentify() with group properties. silent: 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: createEvent({\n name: 'company update',\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: 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 \"With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.\",\n in: getEvent('page view', {\n id: 'ev1700000104',\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 uuid: 'c6a47305-44fc-8835-b15f-3f494c1f9e20',\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\nconst analyticsDenied: WalkerOS.Consent = { analytics: false };\nconst analyticsGranted: WalkerOS.Consent = { analytics: true };\n\n/**\n * Consent revoked - after analytics consent is granted (PostHog loads and is\n * enabled), revoking it calls client.disable() via the on('consent') handler.\n * The destination is never loaded under denied consent, so the disable is a\n * real revocation of an already-granted destination.\n */\nexport const consentRevoke: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.',\n command: 'consent',\n before: { analytics: true },\n in: analyticsDenied,\n settings: {},\n out: [['client.enable'], ['client.disable']],\n};\n\n/**\n * Consent granted - client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.',\n command: 'consent',\n in: analyticsGranted,\n settings: {},\n out: [['client.enable']],\n};\n\n/** A silent rule without identify or group mappings calls nothing. */\nexport const silentRule: PostHogStepExample = {\n public: false,\n description:\n 'A rule with silent: true and no identify or group mapping sends nothing to PostHog.',\n in: getEvent('page view', { timestamp: 1700000105 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group identify rule of groupIdentifyWithProperties on an event\n * without data: no group key resolves and the rule suppresses the capture,\n * so nothing is sent.\n */\nexport const groupIdentifyWithoutData: PostHogStepExample = {\n public: false,\n description:\n 'A silent group rule whose key finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: {\n name: 'company update',\n entity: 'company',\n action: 'update',\n timestamp: 1700000106,\n },\n mapping: groupIdentifyWithProperties.mapping,\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting PostHog needs to deliver: the project API key, read from the\n * environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: 'phc_test' },\n secrets: { apiKey: 'POSTHOG_API_KEY' },\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,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,EACZ,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,6BAA6B,EAC1B,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,cAAc,EACX,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,oBAAoB,EACjB,QAAQ,EACR,SAAS,uDAAuD,EAChE,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,EACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,EACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,EACJ,QAAQ,EACR,SAAS,mDAAmD,EAC5D,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR,SAAS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AAAA,EACR,aACE;AAAA,EACF,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,2BAA+C;AAAA,EAC1D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAAA,EACA,SAAS,4BAA4B;AAAA,EACrC,KAAK,CAAC;AACR;;;AC7QO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,WAAW;AAAA,EAC/B,SAAS,EAAE,QAAQ,kBAAkB;AACvC;","names":["z"]}
@@ -136,4 +136,10 @@ declare namespace step {
136
136
  export { type step_PostHogStepExample as PostHogStepExample, step_captureWithGroupContext as captureWithGroupContext, step_captureWithInclude as captureWithInclude, step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultCapture as defaultCapture, step_groupIdentifyWithProperties as groupIdentifyWithProperties, step_groupIdentifyWithoutData as groupIdentifyWithoutData, step_identifyWithSetAndSetOnce as identifyWithSetAndSetOnce, step_silentRule as silentRule };
137
137
  }
138
138
 
139
- export { env, step };
139
+ /**
140
+ * The setting PostHog needs to deliver: the project API key, read from the
141
+ * environment.
142
+ */
143
+ declare const minimal: Flow.MinimalExample;
144
+
145
+ export { env, minimal, step };
@@ -136,4 +136,10 @@ declare namespace step {
136
136
  export { type step_PostHogStepExample as PostHogStepExample, step_captureWithGroupContext as captureWithGroupContext, step_captureWithInclude as captureWithInclude, step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultCapture as defaultCapture, step_groupIdentifyWithProperties as groupIdentifyWithProperties, step_groupIdentifyWithoutData as groupIdentifyWithoutData, step_identifyWithSetAndSetOnce as identifyWithSetAndSetOnce, step_silentRule as silentRule };
137
137
  }
138
138
 
139
- export { env, step };
139
+ /**
140
+ * The setting PostHog needs to deliver: the project API key, read from the
141
+ * environment.
142
+ */
143
+ declare const minimal: Flow.MinimalExample;
144
+
145
+ export { env, minimal, step };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
+ minimal: () => minimal,
24
25
  step: () => step_exports
25
26
  });
26
27
  module.exports = __toCommonJS(examples_exports);
@@ -109,7 +110,7 @@ var defaultCapture = {
109
110
  };
110
111
  var captureWithInclude = {
111
112
  title: "Capture with include",
112
- description: "Destination-level include flattens data and globals sections into prefixed PostHog event properties.",
113
+ description: "With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.",
113
114
  in: (0, import_core.getEvent)("order complete", { id: "ev1700000101", timestamp: 1700000101 }),
114
115
  configInclude: ["data", "globals"],
115
116
  out: [
@@ -122,9 +123,10 @@ var captureWithInclude = {
122
123
  properties: {
123
124
  data_id: "0rd3r1d",
124
125
  data_currency: "EUR",
126
+ data_value: 462,
127
+ data_tax: 73.76,
125
128
  data_shipping: 5.22,
126
- data_taxes: 73.76,
127
- data_value: 555,
129
+ data_total: 467.22,
128
130
  globals_pagegroup: "shop"
129
131
  }
130
132
  }
@@ -136,7 +138,7 @@ var identifyWithSetAndSetOnce = {
136
138
  description: "A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",
137
139
  in: (0, import_core.createEvent)({
138
140
  name: "user login",
139
- timestamp: 1700000102,
141
+ timestamp: 1700000102e3,
140
142
  data: {
141
143
  user_id: "new-user-123",
142
144
  email: "user@acme.com",
@@ -175,7 +177,7 @@ var identifyWithSetAndSetOnce = {
175
177
  plan: "premium"
176
178
  },
177
179
  $set_once: {
178
- first_login: 1700000102
180
+ first_login: 1700000102e3
179
181
  }
180
182
  }
181
183
  }
@@ -227,7 +229,7 @@ var groupIdentifyWithProperties = {
227
229
  };
228
230
  var captureWithGroupContext = {
229
231
  title: "Capture with group",
230
- description: "A destination-level group mapping attaches the resolved group context to every PostHog capture call.",
232
+ description: "With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.",
231
233
  in: (0, import_core.getEvent)("page view", {
232
234
  id: "ev1700000104",
233
235
  timestamp: 1700000104,
@@ -258,7 +260,7 @@ var analyticsDenied = { analytics: false };
258
260
  var analyticsGranted = { analytics: true };
259
261
  var consentRevoke = {
260
262
  title: "Consent revoked",
261
- description: "A walker consent command with analytics denied calls client.disable on the PostHog client.",
263
+ description: "With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.",
262
264
  command: "consent",
263
265
  before: { analytics: true },
264
266
  in: analyticsDenied,
@@ -267,7 +269,7 @@ var consentRevoke = {
267
269
  };
268
270
  var consentGrant = {
269
271
  title: "Consent granted",
270
- description: "A walker consent command with analytics granted calls client.enable on the PostHog client.",
272
+ description: "With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.",
271
273
  command: "consent",
272
274
  in: analyticsGranted,
273
275
  settings: {},
@@ -292,8 +294,15 @@ var groupIdentifyWithoutData = {
292
294
  mapping: groupIdentifyWithProperties.mapping,
293
295
  out: []
294
296
  };
297
+
298
+ // src/examples/minimal.ts
299
+ var minimal = {
300
+ settings: { apiKey: "phc_test" },
301
+ secrets: { apiKey: "POSTHOG_API_KEY" }
302
+ };
295
303
  // Annotate the CommonJS export names for ESM import in node:
296
304
  0 && (module.exports = {
297
305
  env,
306
+ minimal,
298
307
  step
299
308
  });
@@ -88,7 +88,7 @@ var defaultCapture = {
88
88
  };
89
89
  var captureWithInclude = {
90
90
  title: "Capture with include",
91
- description: "Destination-level include flattens data and globals sections into prefixed PostHog event properties.",
91
+ description: "With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.",
92
92
  in: getEvent("order complete", { id: "ev1700000101", timestamp: 1700000101 }),
93
93
  configInclude: ["data", "globals"],
94
94
  out: [
@@ -101,9 +101,10 @@ var captureWithInclude = {
101
101
  properties: {
102
102
  data_id: "0rd3r1d",
103
103
  data_currency: "EUR",
104
+ data_value: 462,
105
+ data_tax: 73.76,
104
106
  data_shipping: 5.22,
105
- data_taxes: 73.76,
106
- data_value: 555,
107
+ data_total: 467.22,
107
108
  globals_pagegroup: "shop"
108
109
  }
109
110
  }
@@ -115,7 +116,7 @@ var identifyWithSetAndSetOnce = {
115
116
  description: "A user login fires PostHog identify with $set and $set_once person properties and skips the capture.",
116
117
  in: createEvent({
117
118
  name: "user login",
118
- timestamp: 1700000102,
119
+ timestamp: 1700000102e3,
119
120
  data: {
120
121
  user_id: "new-user-123",
121
122
  email: "user@acme.com",
@@ -154,7 +155,7 @@ var identifyWithSetAndSetOnce = {
154
155
  plan: "premium"
155
156
  },
156
157
  $set_once: {
157
- first_login: 1700000102
158
+ first_login: 1700000102e3
158
159
  }
159
160
  }
160
161
  }
@@ -206,7 +207,7 @@ var groupIdentifyWithProperties = {
206
207
  };
207
208
  var captureWithGroupContext = {
208
209
  title: "Capture with group",
209
- description: "A destination-level group mapping attaches the resolved group context to every PostHog capture call.",
210
+ description: "With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.",
210
211
  in: getEvent("page view", {
211
212
  id: "ev1700000104",
212
213
  timestamp: 1700000104,
@@ -237,7 +238,7 @@ var analyticsDenied = { analytics: false };
237
238
  var analyticsGranted = { analytics: true };
238
239
  var consentRevoke = {
239
240
  title: "Consent revoked",
240
- description: "A walker consent command with analytics denied calls client.disable on the PostHog client.",
241
+ description: "With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.",
241
242
  command: "consent",
242
243
  before: { analytics: true },
243
244
  in: analyticsDenied,
@@ -246,7 +247,7 @@ var consentRevoke = {
246
247
  };
247
248
  var consentGrant = {
248
249
  title: "Consent granted",
249
- description: "A walker consent command with analytics granted calls client.enable on the PostHog client.",
250
+ description: "With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.",
250
251
  command: "consent",
251
252
  in: analyticsGranted,
252
253
  settings: {},
@@ -271,7 +272,14 @@ var groupIdentifyWithoutData = {
271
272
  mapping: groupIdentifyWithProperties.mapping,
272
273
  out: []
273
274
  };
275
+
276
+ // src/examples/minimal.ts
277
+ var minimal = {
278
+ settings: { apiKey: "phc_test" },
279
+ secrets: { apiKey: "POSTHOG_API_KEY" }
280
+ };
274
281
  export {
275
282
  env_exports as env,
283
+ minimal,
276
284
  step_exports as step
277
285
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-posthog",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -39,23 +39,23 @@
39
39
  },
40
40
  "flushAt": {
41
41
  "type": "number",
42
- "description": "Number of queued group identifies before auto-flush. Captures and identifies are sent at once, each push awaiting its own call. Default: 20."
42
+ "description": "Calls the SDK queues before it starts a send on its own. Each push and each config.batch batch flushes the SDK and waits for the answer either way. Default: 20."
43
43
  },
44
44
  "flushInterval": {
45
45
  "type": "number",
46
- "description": "Milliseconds between periodic flushes of queued group identifies. Default: 10000."
46
+ "description": "Milliseconds after which the SDK sends calls still queued on its own. Each push and each config.batch batch flushes the SDK either way. Default: 10000."
47
47
  },
48
48
  "personalApiKey": {
49
49
  "type": "string",
50
- "description": "Personal API key (phx_...) for local feature flag evaluation."
50
+ "description": "Personal API key (phx_...). With it the SDK polls feature flag definitions; this destination evaluates no flags and attaches none to its events."
51
51
  },
52
52
  "featureFlagsPollingInterval": {
53
53
  "type": "number",
54
- "description": "Milliseconds between feature flag definition polls. Default: 30000."
54
+ "description": "Milliseconds between feature flag definition polls, with personalApiKey set. This destination evaluates no flags. Default: 30000."
55
55
  },
56
56
  "disableGeoip": {
57
57
  "type": "boolean",
58
- "description": "Disable GeoIP lookups globally. Useful for GDPR compliance."
58
+ "description": "Disable GeoIP lookups for every event. Default: true, the SDK default."
59
59
  },
60
60
  "disableCompression": {
61
61
  "type": "boolean",
@@ -108,10 +108,18 @@
108
108
  "call:PostHog.shutdown"
109
109
  ]
110
110
  },
111
+ "minimal": {
112
+ "settings": {
113
+ "apiKey": "phc_test"
114
+ },
115
+ "secrets": {
116
+ "apiKey": "POSTHOG_API_KEY"
117
+ }
118
+ },
111
119
  "step": {
112
120
  "captureWithGroupContext": {
113
121
  "title": "Capture with group",
114
- "description": "A destination-level group mapping attaches the resolved group context to every PostHog capture call.",
122
+ "description": "With settings.group mapping type to 'company' and key to 'globals.company_id', every PostHog capture call carries the resolved group.",
115
123
  "in": {
116
124
  "name": "page view",
117
125
  "data": {
@@ -191,15 +199,16 @@
191
199
  },
192
200
  "captureWithInclude": {
193
201
  "title": "Capture with include",
194
- "description": "Destination-level include flattens data and globals sections into prefixed PostHog event properties.",
202
+ "description": "With include: ['data', 'globals'] in the destination config, the data and globals sections are flattened into prefixed PostHog event properties.",
195
203
  "in": {
196
204
  "name": "order complete",
197
205
  "data": {
198
206
  "id": "0rd3r1d",
199
207
  "currency": "EUR",
208
+ "value": 462,
209
+ "tax": 73.76,
200
210
  "shipping": 5.22,
201
- "taxes": 73.76,
202
- "value": 555
211
+ "total": 467.22
203
212
  },
204
213
  "context": {
205
214
  "shopping": [
@@ -296,9 +305,10 @@
296
305
  "properties": {
297
306
  "data_id": "0rd3r1d",
298
307
  "data_currency": "EUR",
308
+ "data_value": 462,
309
+ "data_tax": 73.76,
299
310
  "data_shipping": 5.22,
300
- "data_taxes": 73.76,
301
- "data_value": 555,
311
+ "data_total": 467.22,
302
312
  "globals_pagegroup": "shop"
303
313
  }
304
314
  }
@@ -307,7 +317,7 @@
307
317
  },
308
318
  "consentGrant": {
309
319
  "title": "Consent granted",
310
- "description": "A walker consent command with analytics granted calls client.enable on the PostHog client.",
320
+ "description": "With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls client.enable on the PostHog client.",
311
321
  "command": "consent",
312
322
  "in": {
313
323
  "analytics": true
@@ -321,7 +331,7 @@
321
331
  },
322
332
  "consentRevoke": {
323
333
  "title": "Consent revoked",
324
- "description": "A walker consent command with analytics denied calls client.disable on the PostHog client.",
334
+ "description": "With consent: { analytics: true } in the destination config, revoking analytics consent after a grant calls client.disable on the PostHog client.",
325
335
  "command": "consent",
326
336
  "before": {
327
337
  "analytics": true
@@ -349,7 +359,8 @@
349
359
  "name": "Everyday Ruck Snack",
350
360
  "color": "black",
351
361
  "size": "l",
352
- "price": 420
362
+ "price": 420,
363
+ "currency": "EUR"
353
364
  },
354
365
  "context": {
355
366
  "shopping": [
@@ -435,7 +446,7 @@
435
446
  "consent": {
436
447
  "functional": true
437
448
  },
438
- "id": "898bd98fba0f9795",
449
+ "id": "5c84e91c1240ebcc",
439
450
  "trigger": "test",
440
451
  "entity": "company",
441
452
  "action": "update",
@@ -549,11 +560,11 @@
549
560
  "consent": {
550
561
  "functional": true
551
562
  },
552
- "id": "bc6d4af5367fa63c",
563
+ "id": "bd6d22ce162a32e8",
553
564
  "trigger": "test",
554
565
  "entity": "user",
555
566
  "action": "login",
556
- "timestamp": 1700000102,
567
+ "timestamp": 1700000102000,
557
568
  "timing": 3.14,
558
569
  "source": {
559
570
  "count": 1,
@@ -594,7 +605,7 @@
594
605
  "plan": "premium"
595
606
  },
596
607
  "$set_once": {
597
- "first_login": 1700000102
608
+ "first_login": 1700000102000
598
609
  }
599
610
  }
600
611
  }
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": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -35,12 +35,12 @@
35
35
  "update": "npx npm-check-updates -u && npm update"
36
36
  },
37
37
  "dependencies": {
38
- "@walkeros/core": "4.8.2",
39
- "@walkeros/server-core": "4.8.2",
38
+ "@walkeros/core": "4.8.3-next-1793115089237",
39
+ "@walkeros/server-core": "4.8.3-next-1793115089237",
40
40
  "posthog-node": "^5.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@walkeros/collector": "4.8.2"
43
+ "@walkeros/collector": "4.8.3-next-1793115089237"
44
44
  },
45
45
  "repository": {
46
46
  "url": "git+https://github.com/elbwalker/walkerOS.git",