@walkeros/server-destination-posthog 3.3.0 → 3.4.0-next-1776749829492

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.d.mts CHANGED
@@ -82,6 +82,11 @@ declare namespace env {
82
82
  /**
83
83
  * PostHog server step examples carry destination-level settings and
84
84
  * optional configInclude for the test runner to wire up.
85
+ *
86
+ * At push time the destination invokes methods on a `client` constructed
87
+ * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`
88
+ * matching the underlying SDK signature. Multiple calls (identify +
89
+ * capture, groupIdentify + capture) are expressed as a tuple list.
85
90
  */
86
91
  type PostHogStepExample = Flow.StepExample & {
87
92
  settings?: Partial<Settings>;
package/dist/dev.d.ts CHANGED
@@ -82,6 +82,11 @@ declare namespace env {
82
82
  /**
83
83
  * PostHog server step examples carry destination-level settings and
84
84
  * optional configInclude for the test runner to wire up.
85
+ *
86
+ * At push time the destination invokes methods on a `client` constructed
87
+ * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`
88
+ * matching the underlying SDK signature. Multiple calls (identify +
89
+ * capture, groupIdentify + capture) are expressed as a tuple list.
85
90
  */
86
91
  type PostHogStepExample = Flow.StepExample & {
87
92
  settings?: Partial<Settings>;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},n={};i(n,{examples:()=>y,schemas:()=>r}),module.exports=(e=n,((e,i,n,r)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let p of s(i))a.call(e,p)||p===n||t(e,p,{get:()=>i[p],enumerable:!(r=o(i,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};i(r,{MappingSchema:()=>d,SettingsSchema:()=>c,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:l.z.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:l.z.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:l.z.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:l.z.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:l.z.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:l.z.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:l.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:l.z.array(l.z.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()}),u=require("@walkeros/core/dev"),d=u.z.object({identify:u.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:u.z.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),m=(0,p.zodToSchema)(c),g=(0,p.zodToSchema)(d),y={};i(y,{env:()=>h,step:()=>v});var h={};i(h,{push:()=>f,simulation:()=>b});var f={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},b=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],v={};i(v,{captureWithGroupContext:()=>z,captureWithInclude:()=>I,consentGrant:()=>O,consentRevoke:()=>j,defaultCapture:()=>w,groupIdentifyWithProperties:()=>P,identifyWithSetAndSetOnce:()=>k});var _=require("@walkeros/core"),w={in:(0,_.getEvent)("product view",{timestamp:1700000100}),out:["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]},I={in:(0,_.getEvent)("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]},k={in:(0,_.getEvent)("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]},P={in:(0,_.getEvent)("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]},z={in:(0,_.getEvent)("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]},j={command:"consent",in:{analytics:!1},settings:{},out:["client.disable"]},O={command:"consent",in:{analytics:!0},settings:{},out:["client.enable"]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},n={};i(n,{examples:()=>y,schemas:()=>r}),module.exports=(e=n,((e,i,n,r)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let p of s(i))a.call(e,p)||p===n||t(e,p,{get:()=>i[p],enumerable:!(r=o(i,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};i(r,{MappingSchema:()=>d,SettingsSchema:()=>c,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:l.z.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:l.z.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:l.z.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:l.z.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:l.z.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:l.z.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:l.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:l.z.array(l.z.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()}),u=require("@walkeros/core/dev"),d=u.z.object({identify:u.z.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:u.z.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),m=(0,p.zodToSchema)(c),g=(0,p.zodToSchema)(d),y={};i(y,{env:()=>h,step:()=>v});var h={};i(h,{push:()=>f,simulation:()=>b});var f={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},b=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],v={};i(v,{captureWithGroupContext:()=>z,captureWithInclude:()=>I,consentGrant:()=>O,consentRevoke:()=>j,defaultCapture:()=>w,groupIdentifyWithProperties:()=>P,identifyWithSetAndSetOnce:()=>k});var _=require("@walkeros/core"),w={in:(0,_.getEvent)("product view",{timestamp:1700000100}),out:[["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]]},I={in:(0,_.getEvent)("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]]},k={in:(0,_.getEvent)("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:[["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]]},P={in:(0,_.getEvent)("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:[["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]]},z={in:(0,_.getEvent)("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},j={command:"consent",in:{analytics:!1},settings:{},out:[["client.disable"]]},O={command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n '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 * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n '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 * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['client.disable'],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['client.enable'],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,MAAM,aACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP,SAAS,yDAAyD,EAClE,SAAS;AAAA,EACZ,eAAe,aACZ,OAAO,EACP,SAAS,wDAAwD,EACjE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,SAAS,+DAA+D,EACxE,SAAS;AAAA,EACZ,6BAA6B,aAC1B,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,cAAc,aACX,QAAQ,EACR,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,OAAO,aACJ,QAAQ,EACR,SAAS,mDAAmD,EAC5D,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,aACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,MAAM,aAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AC3DD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,UAAU,cACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,cACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFPM,I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gB;AACxB;AAKO,IAAM,eAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,eAAe;AACvB;","names":["import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n *\n * At push time the destination invokes methods on a `client` constructed\n * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`\n * matching the underlying SDK signature. Multiple calls (identify +\n * capture, groupIdentify + capture) are expressed as a tuple list.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.identify',\n {\n distinctId: 'new-user-123',\n properties: {\n $set: {\n email: 'user@acme.com',\n plan: 'premium',\n },\n $set_once: {\n first_login: 1700000102,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.groupIdentify',\n {\n groupType: 'company',\n groupKey: 'company_123',\n properties: {\n name: 'Acme',\n plan: 'enterprise',\n },\n },\n ],\n ],\n};\n\n/**\n * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.disable']],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client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U,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,gBAAgB,CAAC;AAC1B;AAKO,IAAM,eAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,eAAe,CAAC;AACzB;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,s)=>{for(var o in s)e(t,o,{get:s[o],enumerable:!0})},s={};t(s,{MappingSchema:()=>r,SettingsSchema:()=>i,mapping:()=>l,settings:()=>p});import{zodToSchema as o}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var i=a.object({apiKey:a.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:a.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:a.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:a.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:a.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:a.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:a.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:a.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:a.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:a.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:a.array(a.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()});import{z as n}from"@walkeros/core/dev";var r=n.object({identify:n.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:n.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),p=o(i),l=o(r),c={};t(c,{env:()=>d,step:()=>g});var d={};t(d,{push:()=>u,simulation:()=>m});var u={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},m=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],g={};t(g,{captureWithGroupContext:()=>_,captureWithInclude:()=>f,consentGrant:()=>I,consentRevoke:()=>w,defaultCapture:()=>h,groupIdentifyWithProperties:()=>v,identifyWithSetAndSetOnce:()=>b});import{getEvent as y}from"@walkeros/core";var h={in:y("product view",{timestamp:1700000100}),out:["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]},f={in:y("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]},b={in:y("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]},v={in:y("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]},_={in:y("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]},w={command:"consent",in:{analytics:!1},settings:{},out:["client.disable"]},I={command:"consent",in:{analytics:!0},settings:{},out:["client.enable"]};export{c as examples,s as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,s)=>{for(var o in s)e(t,o,{get:s[o],enumerable:!0})},s={};t(s,{MappingSchema:()=>r,SettingsSchema:()=>i,mapping:()=>l,settings:()=>p});import{zodToSchema as o}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var i=a.object({apiKey:a.string().min(1).describe('PostHog project API key (starts with "phc_"). Find it in PostHog project settings.'),host:a.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.").optional(),flushAt:a.number().describe("Number of events queued before auto-flush. Default: 20.").optional(),flushInterval:a.number().describe("Milliseconds between periodic flushes. Default: 10000.").optional(),personalApiKey:a.string().describe("Personal API key (phx_...) for local feature flag evaluation.").optional(),featureFlagsPollingInterval:a.number().describe("Milliseconds between feature flag definition polls. Default: 30000.").optional(),disableGeoip:a.boolean().describe("Disable GeoIP lookups globally. Useful for GDPR compliance.").optional(),debug:a.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),identify:a.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).").optional(),group:a.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.").optional(),include:a.array(a.string()).describe('Event sections to flatten into capture() properties (e.g. ["data", "globals"]).').optional()});import{z as n}from"@walkeros/core/dev";var r=n.object({identify:n.unknown().describe("Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.").optional(),group:n.unknown().describe("Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().").optional()}),p=o(i),l=o(r),c={};t(c,{env:()=>d,step:()=>g});var d={};t(d,{push:()=>u,simulation:()=>m});var u={get PostHog(){return class{constructor(e,t){this.apiKey=e,this.options=t||{},this.calls=[]}capture(e){this.calls.push({method:"capture",args:[e]})}identify(e){this.calls.push({method:"identify",args:[e]})}groupIdentify(e){this.calls.push({method:"groupIdentify",args:[e]})}flush(){return this.calls.push({method:"flush",args:[]}),Promise.resolve()}async shutdown(){this.calls.push({method:"shutdown",args:[]})}enable(){this.calls.push({method:"enable",args:[]})}disable(){this.calls.push({method:"disable",args:[]})}}}},m=["call:client.capture","call:client.identify","call:client.groupIdentify","call:client.shutdown"],g={};t(g,{captureWithGroupContext:()=>_,captureWithInclude:()=>f,consentGrant:()=>I,consentRevoke:()=>w,defaultCapture:()=>h,groupIdentifyWithProperties:()=>v,identifyWithSetAndSetOnce:()=>b});import{getEvent as y}from"@walkeros/core";var h={in:y("product view",{timestamp:1700000100}),out:[["client.capture",{distinctId:"us3r",event:"product view",properties:{}}]]},f={in:y("order complete",{timestamp:1700000101}),configInclude:["data","globals"],out:[["client.capture",{distinctId:"us3r",event:"order complete",properties:{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}}]]},b={in:y("user login",{timestamp:1700000102,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan"}},$set_once:{map:{first_login:"timestamp"}}}}}},out:[["client.identify",{distinctId:"new-user-123",properties:{$set:{email:"user@acme.com",plan:"premium"},$set_once:{first_login:1700000102}}}]]},v={in:y("company update",{timestamp:1700000103,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise"}}),mapping:{skip:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan"}}}}}},out:[["client.groupIdentify",{groupType:"company",groupKey:"company_123",properties:{name:"Acme",plan:"enterprise"}}]]},_={in:y("page view",{timestamp:1700000104,globals:{pagegroup:"docs",company_id:"company_123"}}),settings:{group:{map:{type:{value:"company"},key:"globals.company_id"}}},out:[["client.capture",{distinctId:"us3r",event:"page view",properties:{},groups:{company:"company_123"}}]]},w={command:"consent",in:{analytics:!1},settings:{},out:[["client.disable"]]},I={command:"consent",in:{analytics:!0},settings:{},out:[["client.enable"]]};export{c as examples,s as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n '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 * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n '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 * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: ['client.disable'],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n sett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tB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,eAAe;AACvB;","names":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'PostHog project API key (starts with \"phc_\"). Find it in PostHog project settings.',\n ),\n host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for EU or your self-hosted URL.',\n )\n .optional(),\n flushAt: z\n .number()\n .describe('Number of events queued before auto-flush. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .describe('Milliseconds between periodic flushes. Default: 10000.')\n .optional(),\n personalApiKey: z\n .string()\n .describe('Personal API key (phx_...) for local feature flag evaluation.')\n .optional(),\n featureFlagsPollingInterval: z\n .number()\n .describe(\n 'Milliseconds between feature flag definition polls. Default: 30000.',\n )\n .optional(),\n disableGeoip: z\n .boolean()\n .describe('Disable GeoIP lookups globally. Useful for GDPR compliance.')\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push (server is stateless).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push.',\n )\n .optional(),\n include: z\n .array(z.string())\n .describe(\n 'Event sections to flatten into capture() properties (e.g. [\"data\", \"globals\"]).',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { distinctId, $set?, $set_once? }. Fires client.identify() when $set/$set_once present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? }. Fires client.groupIdentify() when properties present, adds groups to capture().',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Mock PostHog class that records method calls for testing.\n * Follows the BigQuery env.BigQuery constructor injection pattern.\n */\nfunction createMockPostHog() {\n return class MockPostHog {\n apiKey: string;\n options: Record<string, unknown>;\n calls: Array<{ method: string; args: unknown[] }>;\n\n constructor(apiKey: string, options?: Record<string, unknown>) {\n this.apiKey = apiKey;\n this.options = options || {};\n this.calls = [];\n }\n\n capture(params: Record<string, unknown>) {\n this.calls.push({ method: 'capture', args: [params] });\n }\n\n identify(params: Record<string, unknown>) {\n this.calls.push({ method: 'identify', args: [params] });\n }\n\n groupIdentify(params: Record<string, unknown>) {\n this.calls.push({ method: 'groupIdentify', args: [params] });\n }\n\n flush() {\n this.calls.push({ method: 'flush', args: [] });\n return Promise.resolve();\n }\n\n async shutdown() {\n this.calls.push({ method: 'shutdown', args: [] });\n }\n\n enable() {\n this.calls.push({ method: 'enable', args: [] });\n }\n\n disable() {\n this.calls.push({ method: 'disable', args: [] });\n }\n };\n}\n\n/**\n * Standard mock environment for push operations.\n * Injects a mock PostHog class constructor via env.PostHog.\n */\nexport const push: Env = {\n get PostHog() {\n return createMockPostHog() as unknown as Env['PostHog'];\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:client.capture',\n 'call:client.identify',\n 'call:client.groupIdentify',\n 'call:client.shutdown',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * PostHog server step examples carry destination-level settings and\n * optional configInclude for the test runner to wire up.\n *\n * At push time the destination invokes methods on a `client` constructed\n * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`\n * matching the underlying SDK signature. Multiple calls (identify +\n * capture, groupIdentify + capture) are expressed as a tuple list.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding — every walkerOS event becomes\n * client.capture({ distinctId, event, properties }). With no mapping\n * and no include, properties is {}. distinctId falls back to event.user.id.\n */\nexport const defaultCapture: PostHogStepExample = {\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'product view',\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Capture with include — destination-level include flattens data and\n * globals sections into prefixed properties.\n */\nexport const captureWithInclude: PostHogStepExample = {\n in: getEvent('order complete', { timestamp: 1700000101 }),\n configInclude: ['data', 'globals'],\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'order complete',\n properties: {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n },\n ],\n ],\n};\n\n/**\n * Identify with $set and $set_once — per-event mapping fires\n * client.identify() with person properties. skip: true suppresses capture.\n */\nexport const identifyWithSetAndSetOnce: PostHogStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.identify',\n {\n distinctId: 'new-user-123',\n properties: {\n $set: {\n email: 'user@acme.com',\n plan: 'premium',\n },\n $set_once: {\n first_login: 1700000102,\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Group identify with properties — per-event mapping fires\n * client.groupIdentify() with group properties. skip: true suppresses capture.\n */\nexport const groupIdentifyWithProperties: PostHogStepExample = {\n in: getEvent('company update', {\n timestamp: 1700000103,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'client.groupIdentify',\n {\n groupType: 'company',\n groupKey: 'company_123',\n properties: {\n name: 'Acme',\n plan: 'enterprise',\n },\n },\n ],\n ],\n};\n\n/**\n * Capture with group context — destination-level settings.group resolves\n * type + key (no properties). The capture call includes groups.\n */\nexport const captureWithGroupContext: PostHogStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n globals: { pagegroup: 'docs', company_id: 'company_123' },\n }),\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'globals.company_id',\n },\n },\n },\n out: [\n [\n 'client.capture',\n {\n distinctId: 'us3r',\n event: 'page view',\n properties: {},\n groups: { company: 'company_123' },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked — client.disable() is called.\n */\nexport const consentRevoke: PostHogStepExample = {\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.disable']],\n};\n\n/**\n * Consent granted — client.enable() is called.\n */\nexport const consentGrant: PostHogStepExample = {\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['client.enable']],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;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,CAAC;AACzB;","names":["z"]}
@@ -47,6 +47,11 @@ declare namespace env {
47
47
  /**
48
48
  * PostHog server step examples carry destination-level settings and
49
49
  * optional configInclude for the test runner to wire up.
50
+ *
51
+ * At push time the destination invokes methods on a `client` constructed
52
+ * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`
53
+ * matching the underlying SDK signature. Multiple calls (identify +
54
+ * capture, groupIdentify + capture) are expressed as a tuple list.
50
55
  */
51
56
  type PostHogStepExample = Flow.StepExample & {
52
57
  settings?: Partial<Settings>;
@@ -47,6 +47,11 @@ declare namespace env {
47
47
  /**
48
48
  * PostHog server step examples carry destination-level settings and
49
49
  * optional configInclude for the test runner to wire up.
50
+ *
51
+ * At push time the destination invokes methods on a `client` constructed
52
+ * via `env.PostHog`. Each `out` tuple is `['client.<method>', ...args]`
53
+ * matching the underlying SDK signature. Multiple calls (identify +
54
+ * capture, groupIdentify + capture) are expressed as a tuple list.
50
55
  */
51
56
  type PostHogStepExample = Flow.StepExample & {
52
57
  settings?: Partial<Settings>;
@@ -89,31 +89,35 @@ var import_core = require("@walkeros/core");
89
89
  var defaultCapture = {
90
90
  in: (0, import_core.getEvent)("product view", { timestamp: 1700000100 }),
91
91
  out: [
92
- "client.capture",
93
- {
94
- distinctId: "us3r",
95
- event: "product view",
96
- properties: {}
97
- }
92
+ [
93
+ "client.capture",
94
+ {
95
+ distinctId: "us3r",
96
+ event: "product view",
97
+ properties: {}
98
+ }
99
+ ]
98
100
  ]
99
101
  };
100
102
  var captureWithInclude = {
101
103
  in: (0, import_core.getEvent)("order complete", { timestamp: 1700000101 }),
102
104
  configInclude: ["data", "globals"],
103
105
  out: [
104
- "client.capture",
105
- {
106
- distinctId: "us3r",
107
- event: "order complete",
108
- properties: {
109
- data_id: "0rd3r1d",
110
- data_currency: "EUR",
111
- data_shipping: 5.22,
112
- data_taxes: 73.76,
113
- data_total: 555,
114
- globals_pagegroup: "shop"
106
+ [
107
+ "client.capture",
108
+ {
109
+ distinctId: "us3r",
110
+ event: "order complete",
111
+ properties: {
112
+ data_id: "0rd3r1d",
113
+ data_currency: "EUR",
114
+ data_shipping: 5.22,
115
+ data_taxes: 73.76,
116
+ data_total: 555,
117
+ globals_pagegroup: "shop"
118
+ }
115
119
  }
116
- }
120
+ ]
117
121
  ]
118
122
  };
119
123
  var identifyWithSetAndSetOnce = {
@@ -147,19 +151,21 @@ var identifyWithSetAndSetOnce = {
147
151
  }
148
152
  },
149
153
  out: [
150
- "client.identify",
151
- {
152
- distinctId: "new-user-123",
153
- properties: {
154
- $set: {
155
- email: "user@acme.com",
156
- plan: "premium"
157
- },
158
- $set_once: {
159
- first_login: 1700000102
154
+ [
155
+ "client.identify",
156
+ {
157
+ distinctId: "new-user-123",
158
+ properties: {
159
+ $set: {
160
+ email: "user@acme.com",
161
+ plan: "premium"
162
+ },
163
+ $set_once: {
164
+ first_login: 1700000102
165
+ }
160
166
  }
161
167
  }
162
- }
168
+ ]
163
169
  ]
164
170
  };
165
171
  var groupIdentifyWithProperties = {
@@ -189,15 +195,17 @@ var groupIdentifyWithProperties = {
189
195
  }
190
196
  },
191
197
  out: [
192
- "client.groupIdentify",
193
- {
194
- groupType: "company",
195
- groupKey: "company_123",
196
- properties: {
197
- name: "Acme",
198
- plan: "enterprise"
198
+ [
199
+ "client.groupIdentify",
200
+ {
201
+ groupType: "company",
202
+ groupKey: "company_123",
203
+ properties: {
204
+ name: "Acme",
205
+ plan: "enterprise"
206
+ }
199
207
  }
200
- }
208
+ ]
201
209
  ]
202
210
  };
203
211
  var captureWithGroupContext = {
@@ -214,26 +222,28 @@ var captureWithGroupContext = {
214
222
  }
215
223
  },
216
224
  out: [
217
- "client.capture",
218
- {
219
- distinctId: "us3r",
220
- event: "page view",
221
- properties: {},
222
- groups: { company: "company_123" }
223
- }
225
+ [
226
+ "client.capture",
227
+ {
228
+ distinctId: "us3r",
229
+ event: "page view",
230
+ properties: {},
231
+ groups: { company: "company_123" }
232
+ }
233
+ ]
224
234
  ]
225
235
  };
226
236
  var consentRevoke = {
227
237
  command: "consent",
228
238
  in: { analytics: false },
229
239
  settings: {},
230
- out: ["client.disable"]
240
+ out: [["client.disable"]]
231
241
  };
232
242
  var consentGrant = {
233
243
  command: "consent",
234
244
  in: { analytics: true },
235
245
  settings: {},
236
- out: ["client.enable"]
246
+ out: [["client.enable"]]
237
247
  };
238
248
  // Annotate the CommonJS export names for ESM import in node:
239
249
  0 && (module.exports = {
@@ -68,31 +68,35 @@ import { getEvent } from "@walkeros/core";
68
68
  var defaultCapture = {
69
69
  in: getEvent("product view", { timestamp: 1700000100 }),
70
70
  out: [
71
- "client.capture",
72
- {
73
- distinctId: "us3r",
74
- event: "product view",
75
- properties: {}
76
- }
71
+ [
72
+ "client.capture",
73
+ {
74
+ distinctId: "us3r",
75
+ event: "product view",
76
+ properties: {}
77
+ }
78
+ ]
77
79
  ]
78
80
  };
79
81
  var captureWithInclude = {
80
82
  in: getEvent("order complete", { timestamp: 1700000101 }),
81
83
  configInclude: ["data", "globals"],
82
84
  out: [
83
- "client.capture",
84
- {
85
- distinctId: "us3r",
86
- event: "order complete",
87
- properties: {
88
- data_id: "0rd3r1d",
89
- data_currency: "EUR",
90
- data_shipping: 5.22,
91
- data_taxes: 73.76,
92
- data_total: 555,
93
- globals_pagegroup: "shop"
85
+ [
86
+ "client.capture",
87
+ {
88
+ distinctId: "us3r",
89
+ event: "order complete",
90
+ properties: {
91
+ data_id: "0rd3r1d",
92
+ data_currency: "EUR",
93
+ data_shipping: 5.22,
94
+ data_taxes: 73.76,
95
+ data_total: 555,
96
+ globals_pagegroup: "shop"
97
+ }
94
98
  }
95
- }
99
+ ]
96
100
  ]
97
101
  };
98
102
  var identifyWithSetAndSetOnce = {
@@ -126,19 +130,21 @@ var identifyWithSetAndSetOnce = {
126
130
  }
127
131
  },
128
132
  out: [
129
- "client.identify",
130
- {
131
- distinctId: "new-user-123",
132
- properties: {
133
- $set: {
134
- email: "user@acme.com",
135
- plan: "premium"
136
- },
137
- $set_once: {
138
- first_login: 1700000102
133
+ [
134
+ "client.identify",
135
+ {
136
+ distinctId: "new-user-123",
137
+ properties: {
138
+ $set: {
139
+ email: "user@acme.com",
140
+ plan: "premium"
141
+ },
142
+ $set_once: {
143
+ first_login: 1700000102
144
+ }
139
145
  }
140
146
  }
141
- }
147
+ ]
142
148
  ]
143
149
  };
144
150
  var groupIdentifyWithProperties = {
@@ -168,15 +174,17 @@ var groupIdentifyWithProperties = {
168
174
  }
169
175
  },
170
176
  out: [
171
- "client.groupIdentify",
172
- {
173
- groupType: "company",
174
- groupKey: "company_123",
175
- properties: {
176
- name: "Acme",
177
- plan: "enterprise"
177
+ [
178
+ "client.groupIdentify",
179
+ {
180
+ groupType: "company",
181
+ groupKey: "company_123",
182
+ properties: {
183
+ name: "Acme",
184
+ plan: "enterprise"
185
+ }
178
186
  }
179
- }
187
+ ]
180
188
  ]
181
189
  };
182
190
  var captureWithGroupContext = {
@@ -193,26 +201,28 @@ var captureWithGroupContext = {
193
201
  }
194
202
  },
195
203
  out: [
196
- "client.capture",
197
- {
198
- distinctId: "us3r",
199
- event: "page view",
200
- properties: {},
201
- groups: { company: "company_123" }
202
- }
204
+ [
205
+ "client.capture",
206
+ {
207
+ distinctId: "us3r",
208
+ event: "page view",
209
+ properties: {},
210
+ groups: { company: "company_123" }
211
+ }
212
+ ]
203
213
  ]
204
214
  };
205
215
  var consentRevoke = {
206
216
  command: "consent",
207
217
  in: { analytics: false },
208
218
  settings: {},
209
- out: ["client.disable"]
219
+ out: [["client.disable"]]
210
220
  };
211
221
  var consentGrant = {
212
222
  command: "consent",
213
223
  in: { analytics: true },
214
224
  settings: {},
215
- out: ["client.enable"]
225
+ out: [["client.enable"]]
216
226
  };
217
227
  export {
218
228
  env_exports as env,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-posthog",
4
- "version": "3.2.0",
4
+ "version": "3.4.0-next-1776749829492",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -151,7 +151,7 @@
151
151
  "group": "gr0up",
152
152
  "count": 1,
153
153
  "version": {
154
- "source": "3.2.0",
154
+ "source": "3.4.0-next-1776749829492",
155
155
  "tagging": 1
156
156
  },
157
157
  "source": {
@@ -171,15 +171,17 @@
171
171
  }
172
172
  },
173
173
  "out": [
174
- "client.capture",
175
- {
176
- "distinctId": "us3r",
177
- "event": "page view",
178
- "properties": {},
179
- "groups": {
180
- "company": "company_123"
174
+ [
175
+ "client.capture",
176
+ {
177
+ "distinctId": "us3r",
178
+ "event": "page view",
179
+ "properties": {},
180
+ "groups": {
181
+ "company": "company_123"
182
+ }
181
183
  }
182
- }
184
+ ]
183
185
  ]
184
186
  },
185
187
  "captureWithInclude": {
@@ -269,7 +271,7 @@
269
271
  "group": "gr0up",
270
272
  "count": 1,
271
273
  "version": {
272
- "source": "3.2.0",
274
+ "source": "3.4.0-next-1776749829492",
273
275
  "tagging": 1
274
276
  },
275
277
  "source": {
@@ -283,19 +285,21 @@
283
285
  "globals"
284
286
  ],
285
287
  "out": [
286
- "client.capture",
287
- {
288
- "distinctId": "us3r",
289
- "event": "order complete",
290
- "properties": {
291
- "data_id": "0rd3r1d",
292
- "data_currency": "EUR",
293
- "data_shipping": 5.22,
294
- "data_taxes": 73.76,
295
- "data_total": 555,
296
- "globals_pagegroup": "shop"
288
+ [
289
+ "client.capture",
290
+ {
291
+ "distinctId": "us3r",
292
+ "event": "order complete",
293
+ "properties": {
294
+ "data_id": "0rd3r1d",
295
+ "data_currency": "EUR",
296
+ "data_shipping": 5.22,
297
+ "data_taxes": 73.76,
298
+ "data_total": 555,
299
+ "globals_pagegroup": "shop"
300
+ }
297
301
  }
298
- }
302
+ ]
299
303
  ]
300
304
  },
301
305
  "consentGrant": {
@@ -305,7 +309,9 @@
305
309
  },
306
310
  "settings": {},
307
311
  "out": [
308
- "client.enable"
312
+ [
313
+ "client.enable"
314
+ ]
309
315
  ]
310
316
  },
311
317
  "consentRevoke": {
@@ -315,7 +321,9 @@
315
321
  },
316
322
  "settings": {},
317
323
  "out": [
318
- "client.disable"
324
+ [
325
+ "client.disable"
326
+ ]
319
327
  ]
320
328
  },
321
329
  "defaultCapture": {
@@ -358,7 +366,7 @@
358
366
  "group": "gr0up",
359
367
  "count": 1,
360
368
  "version": {
361
- "source": "3.2.0",
369
+ "source": "3.4.0-next-1776749829492",
362
370
  "tagging": 1
363
371
  },
364
372
  "source": {
@@ -368,12 +376,14 @@
368
376
  }
369
377
  },
370
378
  "out": [
371
- "client.capture",
372
- {
373
- "distinctId": "us3r",
374
- "event": "product view",
375
- "properties": {}
376
- }
379
+ [
380
+ "client.capture",
381
+ {
382
+ "distinctId": "us3r",
383
+ "event": "product view",
384
+ "properties": {}
385
+ }
386
+ ]
377
387
  ]
378
388
  },
379
389
  "groupIdentifyWithProperties": {
@@ -428,7 +438,7 @@
428
438
  "group": "gr0up",
429
439
  "count": 1,
430
440
  "version": {
431
- "source": "3.2.0",
441
+ "source": "3.4.0-next-1776749829492",
432
442
  "tagging": 1
433
443
  },
434
444
  "source": {
@@ -457,15 +467,17 @@
457
467
  }
458
468
  },
459
469
  "out": [
460
- "client.groupIdentify",
461
- {
462
- "groupType": "company",
463
- "groupKey": "company_123",
464
- "properties": {
465
- "name": "Acme",
466
- "plan": "enterprise"
470
+ [
471
+ "client.groupIdentify",
472
+ {
473
+ "groupType": "company",
474
+ "groupKey": "company_123",
475
+ "properties": {
476
+ "name": "Acme",
477
+ "plan": "enterprise"
478
+ }
467
479
  }
468
- }
480
+ ]
469
481
  ]
470
482
  },
471
483
  "identifyWithSetAndSetOnce": {
@@ -520,7 +532,7 @@
520
532
  "group": "gr0up",
521
533
  "count": 1,
522
534
  "version": {
523
- "source": "3.2.0",
535
+ "source": "3.4.0-next-1776749829492",
524
536
  "tagging": 1
525
537
  },
526
538
  "source": {
@@ -551,19 +563,21 @@
551
563
  }
552
564
  },
553
565
  "out": [
554
- "client.identify",
555
- {
556
- "distinctId": "new-user-123",
557
- "properties": {
558
- "$set": {
559
- "email": "user@acme.com",
560
- "plan": "premium"
561
- },
562
- "$set_once": {
563
- "first_login": 1700000102
566
+ [
567
+ "client.identify",
568
+ {
569
+ "distinctId": "new-user-123",
570
+ "properties": {
571
+ "$set": {
572
+ "email": "user@acme.com",
573
+ "plan": "premium"
574
+ },
575
+ "$set_once": {
576
+ "first_login": 1700000102
577
+ }
564
578
  }
565
579
  }
566
- }
580
+ ]
567
581
  ]
568
582
  }
569
583
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-posthog",
3
3
  "description": "PostHog server destination for walkerOS",
4
- "version": "3.3.0",
4
+ "version": "3.4.0-next-1776749829492",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -34,12 +34,12 @@
34
34
  "update": "npx npm-check-updates -u && npm update"
35
35
  },
36
36
  "dependencies": {
37
- "@walkeros/core": "3.3.0",
38
- "@walkeros/server-core": "3.3.0",
37
+ "@walkeros/core": "3.4.0-next-1776749829492",
38
+ "@walkeros/server-core": "3.4.0-next-1776749829492",
39
39
  "posthog-node": "^5.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@walkeros/collector": "3.3.0"
42
+ "@walkeros/collector": "3.4.0-next-1776749829492"
43
43
  },
44
44
  "repository": {
45
45
  "url": "git+https://github.com/elbwalker/walkerOS.git",