@walkeros/server-destination-mparticle 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(e,r)=>{for(var i in r)t(e,i,{get:r[i],enumerable:!0})},s={};o(s,{examples:()=>f,schemas:()=>a}),module.exports=(e=s,((e,o,s,a)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of i(o))n.call(e,c)||c===s||t(e,c,{get:()=>o[c],enumerable:!(a=r(o,c))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={};o(a,{CustomEventTypeSchema:()=>l,EnvironmentSchema:()=>d,EventTypeSchema:()=>v,MappingSchema:()=>h,PodSchema:()=>m,SettingsSchema:()=>_,mapping:()=>b,settings:()=>y});var c=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),m=p.z.enum(["us1","us2","eu1","au1"]),d=p.z.enum(["production","development"]),v=p.z.enum(["custom_event","screen_view","commerce_event"]),l=p.z.enum(["navigation","location","search","transaction","user_content","user_preference","social","media","attribution","other"]),_=u.z.object({apiKey:u.z.string().min(1).describe("mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds)."),apiSecret:u.z.string().min(1).describe("mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth."),pod:m.describe("mParticle data pod selecting the regional endpoint. Default: 'us1'.").optional(),environment:d.describe("Environment the batch targets. Default: 'production'.").optional(),userIdentities:u.z.record(u.z.string(),u.z.unknown()).describe("Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.").optional(),userAttributes:u.z.unknown().describe("Mapping value that resolves to the user_attributes object placed on the batch.").optional(),consent:u.z.record(u.z.string(),u.z.unknown()).describe("Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.").optional(),ip:u.z.unknown().describe("Mapping value resolving to the client IP for the batch.").optional(),sourceRequestId:u.z.unknown().describe("Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.").optional()}),g=require("@walkeros/core/dev"),h=g.z.object({eventType:v.describe("Per-event mParticle event type. Default: 'custom_event'.").optional(),customEventType:l.describe("Custom event type category for 'custom_event'. Default: 'other'.").optional(),commerce:g.z.unknown().describe("Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.").optional(),userIdentities:g.z.record(g.z.string(),g.z.unknown()).describe("Per-event override mapping for user_identities. Merged over settings.userIdentities.").optional(),userAttributes:g.z.unknown().describe("Per-event override mapping for user_attributes.").optional()}),y=(0,c.zodToSchema)(_),b=(0,c.zodToSchema)(h),f={};o(f,{env:()=>w,step:()=>k});var w={};o(w,{push:()=>S,simulation:()=>z});var S={sendServer:async()=>({ok:!0,data:{}})},z=["sendServer"],k={};o(k,{commercePurchase:()=>T,customEvent:()=>E,identityAndAttributes:()=>j,screenView:()=>q});var P=require("@walkeros/core"),O="https://s2s.mparticle.com/v2/events",x={headers:{Authorization:"Basic a2V5OnNlY3JldA==","Content-Type":"application/json"}},E={in:(0,P.getEvent)("product view",{timestamp:17000001e5,data:{id:"SKU-A1",name:"Shoe",price:129.99},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",O,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"product view",custom_event_type:"other",timestamp_unixtime_ms:17000001e5,source_message_id:"1700000100000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000100000-gr0up-1"}),x]]},q={in:(0,P.getEvent)("page view",{timestamp:17000002e5,data:{title:"Checkout",path:"/checkout"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"screen_view"}},out:[["sendServer",O,JSON.stringify({events:[{event_type:"screen_view",data:{screen_name:"page view",timestamp_unixtime_ms:17000002e5,source_message_id:"1700000200000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000200000-gr0up-1"}),x]]},T={in:(0,P.getEvent)("order complete",{timestamp:17000003e5,data:{id:"ORD-300",total:249.99,currency:"EUR"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"commerce_event",commerce:{map:{currency_code:"data.currency",product_action:{map:{action:{value:"purchase"},transaction_id:"data.id",total_amount:"data.total"}}}}}},out:[["sendServer",O,JSON.stringify({events:[{event_type:"commerce_event",data:{currency_code:"EUR",product_action:{action:"purchase",transaction_id:"ORD-300",total_amount:249.99},timestamp_unixtime_ms:17000003e5,source_message_id:"1700000300000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000300000-gr0up-1"}),x]]},j={in:(0,P.getEvent)("form submit",{timestamp:17000004e5,data:{type:"newsletter"},user:{id:"user-123",email:"user@example.com"},source:{type:"server",id:"https://example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",O,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"form submit",custom_event_type:"other",timestamp_unixtime_ms:17000004e5,source_message_id:"1700000400000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123",email:"user@example.com"},source_request_id:"1700000400000-gr0up-1"}),x]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(e,r)=>{for(var i in r)t(e,i,{get:r[i],enumerable:!0})},o={};s(o,{examples:()=>w,schemas:()=>a}),module.exports=(e=o,((e,s,o,a)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let c of i(s))n.call(e,c)||c===o||t(e,c,{get:()=>s[c],enumerable:!(a=r(s,c))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={};s(a,{CustomEventTypeSchema:()=>l,EnvironmentSchema:()=>d,EventTypeSchema:()=>v,MappingSchema:()=>g,PodSchema:()=>m,SettingsSchema:()=>_,mapping:()=>y,settings:()=>b});var c=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),m=p.z.enum(["us1","us2","eu1","au1"]),d=p.z.enum(["production","development"]),v=p.z.enum(["custom_event","screen_view","commerce_event"]),l=p.z.enum(["navigation","location","search","transaction","user_content","user_preference","social","media","attribution","other"]),_=u.z.object({apiKey:u.z.string().min(1).describe("mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds)."),apiSecret:u.z.string().min(1).describe("mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth."),pod:m.describe("mParticle data pod selecting the regional endpoint. Default: 'us1'.").optional(),environment:d.describe("Environment the batch targets. Default: 'production'.").optional(),userIdentities:u.z.record(u.z.string(),u.z.unknown()).describe("Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.").optional(),userAttributes:u.z.unknown().describe("Mapping value that resolves to the user_attributes object placed on the batch.").optional(),consent:u.z.record(u.z.string(),u.z.unknown()).describe("Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.").optional(),ip:u.z.unknown().describe("Mapping value resolving to the client IP for the batch.").optional(),sourceRequestId:u.z.unknown().describe("Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.").optional()}),h=require("@walkeros/core/dev"),g=h.z.object({eventType:v.describe("Per-event mParticle event type. Default: 'custom_event'.").optional(),customEventType:l.describe("Custom event type category for 'custom_event'. Default: 'other'.").optional(),commerce:h.z.unknown().describe("Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.").optional(),userIdentities:h.z.record(h.z.string(),h.z.unknown()).describe("Per-event override mapping for user_identities. Merged over settings.userIdentities.").optional(),userAttributes:h.z.unknown().describe("Per-event override mapping for user_attributes.").optional()}),b=(0,c.zodToSchema)(_),y=(0,c.zodToSchema)(g),w={};s(w,{env:()=>f,step:()=>P});var f={};s(f,{push:()=>S,simulation:()=>z});var S={sendServer:async()=>({ok:!0,data:{}})},z=["sendServer"],P={};s(P,{commercePurchase:()=>q,customEvent:()=>x,identityAndAttributes:()=>T,screenView:()=>E});var k=require("@walkeros/core"),O="https://s2s.mparticle.com/v2/events",A={headers:{Authorization:"Basic a2V5OnNlY3JldA==","Content-Type":"application/json"}},x={title:"Custom event",description:"A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.",in:(0,k.getEvent)("product view",{timestamp:17000001e5,data:{id:"SKU-A1",name:"Shoe",price:129.99},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",O,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"product view",custom_event_type:"other",timestamp_unixtime_ms:17000001e5,source_message_id:"1700000100000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000100000-gr0up-1"}),A]]},E={title:"Screen view",description:"A page view is mapped to an mParticle screen_view event with the event name as the screen name.",in:(0,k.getEvent)("page view",{timestamp:17000002e5,data:{title:"Checkout",path:"/checkout"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"screen_view"}},out:[["sendServer",O,JSON.stringify({events:[{event_type:"screen_view",data:{screen_name:"page view",timestamp_unixtime_ms:17000002e5,source_message_id:"1700000200000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000200000-gr0up-1"}),A]]},q={title:"Commerce purchase",description:"A completed order becomes an mParticle commerce_event with a purchase product_action block.",in:(0,k.getEvent)("order complete",{timestamp:17000003e5,data:{id:"ORD-300",total:249.99,currency:"EUR"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"commerce_event",commerce:{map:{currency_code:"data.currency",product_action:{map:{action:{value:"purchase"},transaction_id:"data.id",total_amount:"data.total"}}}}}},out:[["sendServer",O,JSON.stringify({events:[{event_type:"commerce_event",data:{currency_code:"EUR",product_action:{action:"purchase",transaction_id:"ORD-300",total_amount:249.99},timestamp_unixtime_ms:17000003e5,source_message_id:"1700000300000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000300000-gr0up-1"}),A]]},T={title:"User identities",description:"A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.",in:(0,k.getEvent)("form submit",{timestamp:17000004e5,data:{type:"newsletter"},user:{id:"user-123",email:"user@example.com"},source:{type:"server",id:"https://example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",O,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"form submit",custom_event_type:"other",timestamp_unixtime_ms:17000004e5,source_message_id:"1700000400000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123",email:"user@example.com"},source_request_id:"1700000400000-gr0up-1"}),A]]};//# 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/primitives.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 * from './primitives';\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';\nimport { EnvironmentSchema, PodSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds).',\n ),\n apiSecret: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth.',\n ),\n pod: PodSchema.describe(\n \"mParticle data pod selecting the regional endpoint. Default: 'us1'.\",\n ).optional(),\n environment: EnvironmentSchema.describe(\n \"Environment the batch targets. Default: 'production'.\",\n ).optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe(\n 'Mapping value that resolves to the user_attributes object placed on the batch.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.unknown())\n .describe(\n 'Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.',\n )\n .optional(),\n ip: z\n .unknown()\n .describe('Mapping value resolving to the client IP for the batch.')\n .optional(),\n sourceRequestId: z\n .unknown()\n .describe(\n 'Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/** mParticle data pod (regional endpoint selector). */\nexport const PodSchema = z.enum(['us1', 'us2', 'eu1', 'au1']);\n\n/** Target environment for the batch. */\nexport const EnvironmentSchema = z.enum(['production', 'development']);\n\n/** Supported mParticle event types emitted by this destination. */\nexport const EventTypeSchema = z.enum([\n 'custom_event',\n 'screen_view',\n 'commerce_event',\n]);\n\n/** mParticle custom event category for `custom_event`. */\nexport const CustomEventTypeSchema = z.enum([\n 'navigation',\n 'location',\n 'search',\n 'transaction',\n 'user_content',\n 'user_preference',\n 'social',\n 'media',\n 'attribution',\n 'other',\n]);\n","import { z } from '@walkeros/core/dev';\nimport { CustomEventTypeSchema, EventTypeSchema } from './primitives';\n\nexport const MappingSchema = z.object({\n eventType: EventTypeSchema.describe(\n \"Per-event mParticle event type. Default: 'custom_event'.\",\n ).optional(),\n customEventType: CustomEventTypeSchema.describe(\n \"Custom event type category for 'custom_event'. Default: 'other'.\",\n ).optional(),\n commerce: z\n .unknown()\n .describe(\n 'Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.',\n )\n .optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Per-event override mapping for user_identities. Merged over settings.userIdentities.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe('Per-event override mapping for user_attributes.')\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 { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for mParticle Events API destination.\n *\n * Provides a standardized mock `sendServer` so tests and simulations can\n * run without making real HTTP calls to mParticle.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => {\n // Simulates mParticle's typical 202 Accepted response for the Events API.\n return {\n ok: true,\n data: {},\n };\n};\n\n/**\n * Standard mock environment for push operations.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * mParticle Events API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(batch), options)` where\n * endpoint = `buildEndpoint(pod)` (default pod `us1` → `https://s2s.mparticle.com/v2/events`)\n * batch = the mParticle v2 batch envelope\n *\n * Test fixture pins `apiKey = 'key'`, `apiSecret = 'secret'`, pod `us1`, so\n * every call targets that endpoint with `Authorization: Basic a2V5OnNlY3JldA==`.\n *\n * The batch keys appear in the order the destination constructs them:\n * 1. events (always a single-element array)\n * 2. environment ('production' by default)\n * 3. user_identities (only when resolved)\n * 4. user_attributes (only when resolved)\n * 5. ip (only when mapped)\n * 6. source_request_id (falls back to `event.id`)\n * 7. consent_state, context (unused here)\n *\n * `options` carries Authorization + Content-Type headers.\n */\nconst ENDPOINT = 'https://s2s.mparticle.com/v2/events';\nconst OPTIONS = {\n headers: {\n // Basic base64('key:secret')\n Authorization: 'Basic a2V5OnNlY3JldA==',\n 'Content-Type': 'application/json',\n },\n};\n\n/**\n * Default custom_event — a walkerOS event with no `eventType` mapping.\n * mParticle wraps it as a `custom_event` with the default `other` category.\n * user_identities are resolved at the batch level from\n * `settings.userIdentities`.\n */\nexport const customEvent: Flow.StepExample = {\n in: getEvent('product view', {\n timestamp: 1700000100000,\n data: { id: 'SKU-A1', name: 'Shoe', price: 129.99 },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'product view',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000100000,\n source_message_id: '1700000100000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000100000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * screen_view event — mapping.settings.eventType switches the mParticle\n * event shape. Uses event name as the `screen_name`.\n */\nexport const screenView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000200000,\n data: { title: 'Checkout', path: '/checkout' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: { eventType: 'screen_view' },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'screen_view',\n data: {\n screen_name: 'page view',\n timestamp_unixtime_ms: 1700000200000,\n source_message_id: '1700000200000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000200000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * commerce_event — mapping.settings.eventType: 'commerce_event' plus a\n * `commerce` mapping resolves a ProductAction block. Products, currency,\n * and transaction metadata are all driven by the commerce mapping value.\n */\nexport const commercePurchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000300000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: {\n eventType: 'commerce_event',\n commerce: {\n map: {\n currency_code: 'data.currency',\n product_action: {\n map: {\n action: { value: 'purchase' },\n transaction_id: 'data.id',\n total_amount: 'data.total',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'commerce_event',\n data: {\n currency_code: 'EUR',\n product_action: {\n action: 'purchase',\n transaction_id: 'ORD-300',\n total_amount: 249.99,\n },\n timestamp_unixtime_ms: 1700000300000,\n source_message_id: '1700000300000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000300000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * Identity + attributes — verifies `user_identities` and `user_attributes`\n * come from the batch-level settings mappings, not the event payload.\n */\nexport const identityAndAttributes: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000400000,\n data: { type: 'newsletter' },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'form submit',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000400000,\n source_message_id: '1700000400000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n email: 'user@example.com',\n },\n source_request_id: '1700000400000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAA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AAA,QACb,iBAAiB;AAAA,UACf,aAAa;AAAA,UACb,OAAO;AAAA,QACT;AAAA,QACA,mBAAmB;AAAA,MACrB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.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 * from './primitives';\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';\nimport { EnvironmentSchema, PodSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds).',\n ),\n apiSecret: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth.',\n ),\n pod: PodSchema.describe(\n \"mParticle data pod selecting the regional endpoint. Default: 'us1'.\",\n ).optional(),\n environment: EnvironmentSchema.describe(\n \"Environment the batch targets. Default: 'production'.\",\n ).optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe(\n 'Mapping value that resolves to the user_attributes object placed on the batch.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.unknown())\n .describe(\n 'Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.',\n )\n .optional(),\n ip: z\n .unknown()\n .describe('Mapping value resolving to the client IP for the batch.')\n .optional(),\n sourceRequestId: z\n .unknown()\n .describe(\n 'Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/** mParticle data pod (regional endpoint selector). */\nexport const PodSchema = z.enum(['us1', 'us2', 'eu1', 'au1']);\n\n/** Target environment for the batch. */\nexport const EnvironmentSchema = z.enum(['production', 'development']);\n\n/** Supported mParticle event types emitted by this destination. */\nexport const EventTypeSchema = z.enum([\n 'custom_event',\n 'screen_view',\n 'commerce_event',\n]);\n\n/** mParticle custom event category for `custom_event`. */\nexport const CustomEventTypeSchema = z.enum([\n 'navigation',\n 'location',\n 'search',\n 'transaction',\n 'user_content',\n 'user_preference',\n 'social',\n 'media',\n 'attribution',\n 'other',\n]);\n","import { z } from '@walkeros/core/dev';\nimport { CustomEventTypeSchema, EventTypeSchema } from './primitives';\n\nexport const MappingSchema = z.object({\n eventType: EventTypeSchema.describe(\n \"Per-event mParticle event type. Default: 'custom_event'.\",\n ).optional(),\n customEventType: CustomEventTypeSchema.describe(\n \"Custom event type category for 'custom_event'. Default: 'other'.\",\n ).optional(),\n commerce: z\n .unknown()\n .describe(\n 'Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.',\n )\n .optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Per-event override mapping for user_identities. Merged over settings.userIdentities.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe('Per-event override mapping for user_attributes.')\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 { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for mParticle Events API destination.\n *\n * Provides a standardized mock `sendServer` so tests and simulations can\n * run without making real HTTP calls to mParticle.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => {\n // Simulates mParticle's typical 202 Accepted response for the Events API.\n return {\n ok: true,\n data: {},\n };\n};\n\n/**\n * Standard mock environment for push operations.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * mParticle Events API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(batch), options)` where\n * endpoint = `buildEndpoint(pod)` (default pod `us1` → `https://s2s.mparticle.com/v2/events`)\n * batch = the mParticle v2 batch envelope\n *\n * Test fixture pins `apiKey = 'key'`, `apiSecret = 'secret'`, pod `us1`, so\n * every call targets that endpoint with `Authorization: Basic a2V5OnNlY3JldA==`.\n *\n * The batch keys appear in the order the destination constructs them:\n * 1. events (always a single-element array)\n * 2. environment ('production' by default)\n * 3. user_identities (only when resolved)\n * 4. user_attributes (only when resolved)\n * 5. ip (only when mapped)\n * 6. source_request_id (falls back to `event.id`)\n * 7. consent_state, context (unused here)\n *\n * `options` carries Authorization + Content-Type headers.\n */\nconst ENDPOINT = 'https://s2s.mparticle.com/v2/events';\nconst OPTIONS = {\n headers: {\n // Basic base64('key:secret')\n Authorization: 'Basic a2V5OnNlY3JldA==',\n 'Content-Type': 'application/json',\n },\n};\n\n/**\n * Default custom_event — a walkerOS event with no `eventType` mapping.\n * mParticle wraps it as a `custom_event` with the default `other` category.\n * user_identities are resolved at the batch level from\n * `settings.userIdentities`.\n */\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.',\n in: getEvent('product view', {\n timestamp: 1700000100000,\n data: { id: 'SKU-A1', name: 'Shoe', price: 129.99 },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'product view',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000100000,\n source_message_id: '1700000100000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000100000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * screen_view event — mapping.settings.eventType switches the mParticle\n * event shape. Uses event name as the `screen_name`.\n */\nexport const screenView: Flow.StepExample = {\n title: 'Screen view',\n description:\n 'A page view is mapped to an mParticle screen_view event with the event name as the screen name.',\n in: getEvent('page view', {\n timestamp: 1700000200000,\n data: { title: 'Checkout', path: '/checkout' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: { eventType: 'screen_view' },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'screen_view',\n data: {\n screen_name: 'page view',\n timestamp_unixtime_ms: 1700000200000,\n source_message_id: '1700000200000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000200000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * commerce_event — mapping.settings.eventType: 'commerce_event' plus a\n * `commerce` mapping resolves a ProductAction block. Products, currency,\n * and transaction metadata are all driven by the commerce mapping value.\n */\nexport const commercePurchase: Flow.StepExample = {\n title: 'Commerce purchase',\n description:\n 'A completed order becomes an mParticle commerce_event with a purchase product_action block.',\n in: getEvent('order complete', {\n timestamp: 1700000300000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: {\n eventType: 'commerce_event',\n commerce: {\n map: {\n currency_code: 'data.currency',\n product_action: {\n map: {\n action: { value: 'purchase' },\n transaction_id: 'data.id',\n total_amount: 'data.total',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'commerce_event',\n data: {\n currency_code: 'EUR',\n product_action: {\n action: 'purchase',\n transaction_id: 'ORD-300',\n total_amount: 249.99,\n },\n timestamp_unixtime_ms: 1700000300000,\n source_message_id: '1700000300000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000300000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * Identity + attributes — verifies `user_identities` and `user_attributes`\n * come from the batch-level settings mappings, not the event payload.\n */\nexport const identityAndAttributes: Flow.StepExample = {\n title: 'User identities',\n description:\n 'A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.',\n in: getEvent('form submit', {\n timestamp: 1700000400000,\n data: { type: 'newsletter' },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'form submit',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000400000,\n source_message_id: '1700000400000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n email: 'user@example.com',\n },\n source_request_id: '1700000400000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAGX,IAAM,YAAY,aAAE,KAAK,CAAC,OAAO,OAAO,OAAO,KAAK,CAAC;AAGrD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AA,UACb,OAAO;AAAA,QACT;AAAA,QACA,mBAAmB;AAAA,MACrB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0})},r={};t(r,{CustomEventTypeSchema:()=>u,EnvironmentSchema:()=>a,EventTypeSchema:()=>c,MappingSchema:()=>d,PodSchema:()=>o,SettingsSchema:()=>p,mapping:()=>_,settings:()=>v});import{zodToSchema as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var o=s.enum(["us1","us2","eu1","au1"]),a=s.enum(["production","development"]),c=s.enum(["custom_event","screen_view","commerce_event"]),u=s.enum(["navigation","location","search","transaction","user_content","user_preference","social","media","attribution","other"]),p=n.object({apiKey:n.string().min(1).describe("mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds)."),apiSecret:n.string().min(1).describe("mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth."),pod:o.describe("mParticle data pod selecting the regional endpoint. Default: 'us1'.").optional(),environment:a.describe("Environment the batch targets. Default: 'production'.").optional(),userIdentities:n.record(n.string(),n.unknown()).describe("Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.").optional(),userAttributes:n.unknown().describe("Mapping value that resolves to the user_attributes object placed on the batch.").optional(),consent:n.record(n.string(),n.unknown()).describe("Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.").optional(),ip:n.unknown().describe("Mapping value resolving to the client IP for the batch.").optional(),sourceRequestId:n.unknown().describe("Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.").optional()});import{z as m}from"@walkeros/core/dev";var d=m.object({eventType:c.describe("Per-event mParticle event type. Default: 'custom_event'.").optional(),customEventType:u.describe("Custom event type category for 'custom_event'. Default: 'other'.").optional(),commerce:m.unknown().describe("Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.").optional(),userIdentities:m.record(m.string(),m.unknown()).describe("Per-event override mapping for user_identities. Merged over settings.userIdentities.").optional(),userAttributes:m.unknown().describe("Per-event override mapping for user_attributes.").optional()}),v=i(p),_=i(d),l={};t(l,{env:()=>h,step:()=>b});var h={};t(h,{push:()=>g,simulation:()=>y});var g={sendServer:async()=>({ok:!0,data:{}})},y=["sendServer"],b={};t(b,{commercePurchase:()=>x,customEvent:()=>k,identityAndAttributes:()=>A,screenView:()=>P});import{getEvent as f}from"@walkeros/core";var w="https://s2s.mparticle.com/v2/events",S={headers:{Authorization:"Basic a2V5OnNlY3JldA==","Content-Type":"application/json"}},k={in:f("product view",{timestamp:17000001e5,data:{id:"SKU-A1",name:"Shoe",price:129.99},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",w,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"product view",custom_event_type:"other",timestamp_unixtime_ms:17000001e5,source_message_id:"1700000100000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000100000-gr0up-1"}),S]]},P={in:f("page view",{timestamp:17000002e5,data:{title:"Checkout",path:"/checkout"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"screen_view"}},out:[["sendServer",w,JSON.stringify({events:[{event_type:"screen_view",data:{screen_name:"page view",timestamp_unixtime_ms:17000002e5,source_message_id:"1700000200000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000200000-gr0up-1"}),S]]},x={in:f("order complete",{timestamp:17000003e5,data:{id:"ORD-300",total:249.99,currency:"EUR"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"commerce_event",commerce:{map:{currency_code:"data.currency",product_action:{map:{action:{value:"purchase"},transaction_id:"data.id",total_amount:"data.total"}}}}}},out:[["sendServer",w,JSON.stringify({events:[{event_type:"commerce_event",data:{currency_code:"EUR",product_action:{action:"purchase",transaction_id:"ORD-300",total_amount:249.99},timestamp_unixtime_ms:17000003e5,source_message_id:"1700000300000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000300000-gr0up-1"}),S]]},A={in:f("form submit",{timestamp:17000004e5,data:{type:"newsletter"},user:{id:"user-123",email:"user@example.com"},source:{type:"server",id:"https://example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",w,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"form submit",custom_event_type:"other",timestamp_unixtime_ms:17000004e5,source_message_id:"1700000400000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123",email:"user@example.com"},source_request_id:"1700000400000-gr0up-1"}),S]]};export{l as examples,r as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0})},r={};t(r,{CustomEventTypeSchema:()=>u,EnvironmentSchema:()=>a,EventTypeSchema:()=>c,MappingSchema:()=>d,PodSchema:()=>o,SettingsSchema:()=>m,mapping:()=>l,settings:()=>v});import{zodToSchema as i}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var o=n.enum(["us1","us2","eu1","au1"]),a=n.enum(["production","development"]),c=n.enum(["custom_event","screen_view","commerce_event"]),u=n.enum(["navigation","location","search","transaction","user_content","user_preference","social","media","attribution","other"]),m=s.object({apiKey:s.string().min(1).describe("mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds)."),apiSecret:s.string().min(1).describe("mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth."),pod:o.describe("mParticle data pod selecting the regional endpoint. Default: 'us1'.").optional(),environment:a.describe("Environment the batch targets. Default: 'production'.").optional(),userIdentities:s.record(s.string(),s.unknown()).describe("Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.").optional(),userAttributes:s.unknown().describe("Mapping value that resolves to the user_attributes object placed on the batch.").optional(),consent:s.record(s.string(),s.unknown()).describe("Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.").optional(),ip:s.unknown().describe("Mapping value resolving to the client IP for the batch.").optional(),sourceRequestId:s.unknown().describe("Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.").optional()});import{z as p}from"@walkeros/core/dev";var d=p.object({eventType:c.describe("Per-event mParticle event type. Default: 'custom_event'.").optional(),customEventType:u.describe("Custom event type category for 'custom_event'. Default: 'other'.").optional(),commerce:p.unknown().describe("Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.").optional(),userIdentities:p.record(p.string(),p.unknown()).describe("Per-event override mapping for user_identities. Merged over settings.userIdentities.").optional(),userAttributes:p.unknown().describe("Per-event override mapping for user_attributes.").optional()}),v=i(m),l=i(d),_={};t(_,{env:()=>h,step:()=>y});var h={};t(h,{push:()=>g,simulation:()=>b});var g={sendServer:async()=>({ok:!0,data:{}})},b=["sendServer"],y={};t(y,{commercePurchase:()=>A,customEvent:()=>k,identityAndAttributes:()=>x,screenView:()=>P});import{getEvent as w}from"@walkeros/core";var f="https://s2s.mparticle.com/v2/events",S={headers:{Authorization:"Basic a2V5OnNlY3JldA==","Content-Type":"application/json"}},k={title:"Custom event",description:"A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.",in:w("product view",{timestamp:17000001e5,data:{id:"SKU-A1",name:"Shoe",price:129.99},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",f,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"product view",custom_event_type:"other",timestamp_unixtime_ms:17000001e5,source_message_id:"1700000100000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000100000-gr0up-1"}),S]]},P={title:"Screen view",description:"A page view is mapped to an mParticle screen_view event with the event name as the screen name.",in:w("page view",{timestamp:17000002e5,data:{title:"Checkout",path:"/checkout"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"screen_view"}},out:[["sendServer",f,JSON.stringify({events:[{event_type:"screen_view",data:{screen_name:"page view",timestamp_unixtime_ms:17000002e5,source_message_id:"1700000200000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000200000-gr0up-1"}),S]]},A={title:"Commerce purchase",description:"A completed order becomes an mParticle commerce_event with a purchase product_action block.",in:w("order complete",{timestamp:17000003e5,data:{id:"ORD-300",total:249.99,currency:"EUR"},user:{id:"user-123"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{settings:{eventType:"commerce_event",commerce:{map:{currency_code:"data.currency",product_action:{map:{action:{value:"purchase"},transaction_id:"data.id",total_amount:"data.total"}}}}}},out:[["sendServer",f,JSON.stringify({events:[{event_type:"commerce_event",data:{currency_code:"EUR",product_action:{action:"purchase",transaction_id:"ORD-300",total_amount:249.99},timestamp_unixtime_ms:17000003e5,source_message_id:"1700000300000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123"},source_request_id:"1700000300000-gr0up-1"}),S]]},x={title:"User identities",description:"A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.",in:w("form submit",{timestamp:17000004e5,data:{type:"newsletter"},user:{id:"user-123",email:"user@example.com"},source:{type:"server",id:"https://example.com",previous_id:""}}),mapping:void 0,out:[["sendServer",f,JSON.stringify({events:[{event_type:"custom_event",data:{event_name:"form submit",custom_event_type:"other",timestamp_unixtime_ms:17000004e5,source_message_id:"1700000400000-gr0up-1"}}],environment:"production",user_identities:{customer_id:"user-123",email:"user@example.com"},source_request_id:"1700000400000-gr0up-1"}),S]]};export{_ as examples,r 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/primitives.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 * from './primitives';\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';\nimport { EnvironmentSchema, PodSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds).',\n ),\n apiSecret: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth.',\n ),\n pod: PodSchema.describe(\n \"mParticle data pod selecting the regional endpoint. Default: 'us1'.\",\n ).optional(),\n environment: EnvironmentSchema.describe(\n \"Environment the batch targets. Default: 'production'.\",\n ).optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe(\n 'Mapping value that resolves to the user_attributes object placed on the batch.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.unknown())\n .describe(\n 'Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.',\n )\n .optional(),\n ip: z\n .unknown()\n .describe('Mapping value resolving to the client IP for the batch.')\n .optional(),\n sourceRequestId: z\n .unknown()\n .describe(\n 'Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/** mParticle data pod (regional endpoint selector). */\nexport const PodSchema = z.enum(['us1', 'us2', 'eu1', 'au1']);\n\n/** Target environment for the batch. */\nexport const EnvironmentSchema = z.enum(['production', 'development']);\n\n/** Supported mParticle event types emitted by this destination. */\nexport const EventTypeSchema = z.enum([\n 'custom_event',\n 'screen_view',\n 'commerce_event',\n]);\n\n/** mParticle custom event category for `custom_event`. */\nexport const CustomEventTypeSchema = z.enum([\n 'navigation',\n 'location',\n 'search',\n 'transaction',\n 'user_content',\n 'user_preference',\n 'social',\n 'media',\n 'attribution',\n 'other',\n]);\n","import { z } from '@walkeros/core/dev';\nimport { CustomEventTypeSchema, EventTypeSchema } from './primitives';\n\nexport const MappingSchema = z.object({\n eventType: EventTypeSchema.describe(\n \"Per-event mParticle event type. Default: 'custom_event'.\",\n ).optional(),\n customEventType: CustomEventTypeSchema.describe(\n \"Custom event type category for 'custom_event'. Default: 'other'.\",\n ).optional(),\n commerce: z\n .unknown()\n .describe(\n 'Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.',\n )\n .optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Per-event override mapping for user_identities. Merged over settings.userIdentities.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe('Per-event override mapping for user_attributes.')\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 { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for mParticle Events API destination.\n *\n * Provides a standardized mock `sendServer` so tests and simulations can\n * run without making real HTTP calls to mParticle.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => {\n // Simulates mParticle's typical 202 Accepted response for the Events API.\n return {\n ok: true,\n data: {},\n };\n};\n\n/**\n * Standard mock environment for push operations.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * mParticle Events API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(batch), options)` where\n * endpoint = `buildEndpoint(pod)` (default pod `us1` → `https://s2s.mparticle.com/v2/events`)\n * batch = the mParticle v2 batch envelope\n *\n * Test fixture pins `apiKey = 'key'`, `apiSecret = 'secret'`, pod `us1`, so\n * every call targets that endpoint with `Authorization: Basic a2V5OnNlY3JldA==`.\n *\n * The batch keys appear in the order the destination constructs them:\n * 1. events (always a single-element array)\n * 2. environment ('production' by default)\n * 3. user_identities (only when resolved)\n * 4. user_attributes (only when resolved)\n * 5. ip (only when mapped)\n * 6. source_request_id (falls back to `event.id`)\n * 7. consent_state, context (unused here)\n *\n * `options` carries Authorization + Content-Type headers.\n */\nconst ENDPOINT = 'https://s2s.mparticle.com/v2/events';\nconst OPTIONS = {\n headers: {\n // Basic base64('key:secret')\n Authorization: 'Basic a2V5OnNlY3JldA==',\n 'Content-Type': 'application/json',\n },\n};\n\n/**\n * Default custom_event — a walkerOS event with no `eventType` mapping.\n * mParticle wraps it as a `custom_event` with the default `other` category.\n * user_identities are resolved at the batch level from\n * `settings.userIdentities`.\n */\nexport const customEvent: Flow.StepExample = {\n in: getEvent('product view', {\n timestamp: 1700000100000,\n data: { id: 'SKU-A1', name: 'Shoe', price: 129.99 },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'product view',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000100000,\n source_message_id: '1700000100000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000100000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * screen_view event — mapping.settings.eventType switches the mParticle\n * event shape. Uses event name as the `screen_name`.\n */\nexport const screenView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000200000,\n data: { title: 'Checkout', path: '/checkout' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: { eventType: 'screen_view' },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'screen_view',\n data: {\n screen_name: 'page view',\n timestamp_unixtime_ms: 1700000200000,\n source_message_id: '1700000200000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000200000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * commerce_event — mapping.settings.eventType: 'commerce_event' plus a\n * `commerce` mapping resolves a ProductAction block. Products, currency,\n * and transaction metadata are all driven by the commerce mapping value.\n */\nexport const commercePurchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000300000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: {\n eventType: 'commerce_event',\n commerce: {\n map: {\n currency_code: 'data.currency',\n product_action: {\n map: {\n action: { value: 'purchase' },\n transaction_id: 'data.id',\n total_amount: 'data.total',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'commerce_event',\n data: {\n currency_code: 'EUR',\n product_action: {\n action: 'purchase',\n transaction_id: 'ORD-300',\n total_amount: 249.99,\n },\n timestamp_unixtime_ms: 1700000300000,\n source_message_id: '1700000300000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000300000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * Identity + attributes — verifies `user_identities` and `user_attributes`\n * come from the batch-level settings mappings, not the event payload.\n */\nexport const identityAndAttributes: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000400000,\n data: { type: 'newsletter' },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'form submit',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000400000,\n source_message_id: '1700000400000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n email: 'user@example.com',\n },\n source_request_id: '1700000400000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAGX,IAAM,YAAY,EAAE,KAAK,CAAC,OAAO,OAAO,OAAO,KAAK,CAAC;AAGrD,IAAM,oBAAoB,EAAE,KAAK,CAAC,cAAc,aAAa,CAAC;AAG9D,IAAM,kBAAkB,EAAE,KAAK;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,wBAAwB,EAAE,KAAK;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADxBM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,QAAQA,GACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAWA,GACR,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,KAAK,UAAU;AAAA,IACb;AAAA,EACF,EAAE,SAAS;AAAA,EACX,aAAa,kBAAkB;AAAA,IAC7B;AAAA,EACF,EAAE,SA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rD,IAAI,SAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,aAAa;AAAA,IAC3B,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,EAAE,MAAM,UAAU,IAAI,uBAAuB,aAAa,GAAG;AAAA,EACvE,CAAC;AAAA,EACD,SAAS;AAAA,EACT,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,QAAQ;AAAA,UACN;AAAA,YACE,YAAY;AAAA,YACZ,MAAM;AAAA,cACJ,YAAY;AAAA,cACZ,mBAAmB;AAAA,cACnB,uBAAuB;AAAA,cACvB,mBAAmB;AAAA,YACrB;AAAA,UACF;AAAA,QACF;AAAA,QACA,aAAa;AAAA,QACb,iBAAiB;AAAA,UACf,aAAa;AAAA,UACb,OAAO;AAAA,QACT;AAAA,QACA,mBAAmB;AAAA,MACrB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z","z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.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 * from './primitives';\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';\nimport { EnvironmentSchema, PodSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API key from the mParticle dashboard (Setup > Inputs > Feeds).',\n ),\n apiSecret: z\n .string()\n .min(1)\n .describe(\n 'mParticle input feed API secret paired with apiKey. Used for HTTP Basic auth.',\n ),\n pod: PodSchema.describe(\n \"mParticle data pod selecting the regional endpoint. Default: 'us1'.\",\n ).optional(),\n environment: EnvironmentSchema.describe(\n \"Environment the batch targets. Default: 'production'.\",\n ).optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Mapping that resolves to user_identities per batch. Keys are mParticle identity types (like customer_id, email); values are walkerOS mapping values.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe(\n 'Mapping value that resolves to the user_attributes object placed on the batch.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.unknown())\n .describe(\n 'Static consent_state envelope forwarded verbatim on the batch. See mParticle consent_state docs.',\n )\n .optional(),\n ip: z\n .unknown()\n .describe('Mapping value resolving to the client IP for the batch.')\n .optional(),\n sourceRequestId: z\n .unknown()\n .describe(\n 'Mapping value resolving to the source_request_id for the batch. Falls back to event.id when unset.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/** mParticle data pod (regional endpoint selector). */\nexport const PodSchema = z.enum(['us1', 'us2', 'eu1', 'au1']);\n\n/** Target environment for the batch. */\nexport const EnvironmentSchema = z.enum(['production', 'development']);\n\n/** Supported mParticle event types emitted by this destination. */\nexport const EventTypeSchema = z.enum([\n 'custom_event',\n 'screen_view',\n 'commerce_event',\n]);\n\n/** mParticle custom event category for `custom_event`. */\nexport const CustomEventTypeSchema = z.enum([\n 'navigation',\n 'location',\n 'search',\n 'transaction',\n 'user_content',\n 'user_preference',\n 'social',\n 'media',\n 'attribution',\n 'other',\n]);\n","import { z } from '@walkeros/core/dev';\nimport { CustomEventTypeSchema, EventTypeSchema } from './primitives';\n\nexport const MappingSchema = z.object({\n eventType: EventTypeSchema.describe(\n \"Per-event mParticle event type. Default: 'custom_event'.\",\n ).optional(),\n customEventType: CustomEventTypeSchema.describe(\n \"Custom event type category for 'custom_event'. Default: 'other'.\",\n ).optional(),\n commerce: z\n .unknown()\n .describe(\n 'Mapping value resolving to the commerce fields (product_action, currency_code, products, ...) for a commerce_event.',\n )\n .optional(),\n userIdentities: z\n .record(z.string(), z.unknown())\n .describe(\n 'Per-event override mapping for user_identities. Merged over settings.userIdentities.',\n )\n .optional(),\n userAttributes: z\n .unknown()\n .describe('Per-event override mapping for user_attributes.')\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 { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for mParticle Events API destination.\n *\n * Provides a standardized mock `sendServer` so tests and simulations can\n * run without making real HTTP calls to mParticle.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => {\n // Simulates mParticle's typical 202 Accepted response for the Events API.\n return {\n ok: true,\n data: {},\n };\n};\n\n/**\n * Standard mock environment for push operations.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * mParticle Events API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(batch), options)` where\n * endpoint = `buildEndpoint(pod)` (default pod `us1` → `https://s2s.mparticle.com/v2/events`)\n * batch = the mParticle v2 batch envelope\n *\n * Test fixture pins `apiKey = 'key'`, `apiSecret = 'secret'`, pod `us1`, so\n * every call targets that endpoint with `Authorization: Basic a2V5OnNlY3JldA==`.\n *\n * The batch keys appear in the order the destination constructs them:\n * 1. events (always a single-element array)\n * 2. environment ('production' by default)\n * 3. user_identities (only when resolved)\n * 4. user_attributes (only when resolved)\n * 5. ip (only when mapped)\n * 6. source_request_id (falls back to `event.id`)\n * 7. consent_state, context (unused here)\n *\n * `options` carries Authorization + Content-Type headers.\n */\nconst ENDPOINT = 'https://s2s.mparticle.com/v2/events';\nconst OPTIONS = {\n headers: {\n // Basic base64('key:secret')\n Authorization: 'Basic a2V5OnNlY3JldA==',\n 'Content-Type': 'application/json',\n },\n};\n\n/**\n * Default custom_event — a walkerOS event with no `eventType` mapping.\n * mParticle wraps it as a `custom_event` with the default `other` category.\n * user_identities are resolved at the batch level from\n * `settings.userIdentities`.\n */\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.',\n in: getEvent('product view', {\n timestamp: 1700000100000,\n data: { id: 'SKU-A1', name: 'Shoe', price: 129.99 },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'product view',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000100000,\n source_message_id: '1700000100000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000100000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * screen_view event — mapping.settings.eventType switches the mParticle\n * event shape. Uses event name as the `screen_name`.\n */\nexport const screenView: Flow.StepExample = {\n title: 'Screen view',\n description:\n 'A page view is mapped to an mParticle screen_view event with the event name as the screen name.',\n in: getEvent('page view', {\n timestamp: 1700000200000,\n data: { title: 'Checkout', path: '/checkout' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: { eventType: 'screen_view' },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'screen_view',\n data: {\n screen_name: 'page view',\n timestamp_unixtime_ms: 1700000200000,\n source_message_id: '1700000200000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000200000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * commerce_event — mapping.settings.eventType: 'commerce_event' plus a\n * `commerce` mapping resolves a ProductAction block. Products, currency,\n * and transaction metadata are all driven by the commerce mapping value.\n */\nexport const commercePurchase: Flow.StepExample = {\n title: 'Commerce purchase',\n description:\n 'A completed order becomes an mParticle commerce_event with a purchase product_action block.',\n in: getEvent('order complete', {\n timestamp: 1700000300000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n user: { id: 'user-123' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n settings: {\n eventType: 'commerce_event',\n commerce: {\n map: {\n currency_code: 'data.currency',\n product_action: {\n map: {\n action: { value: 'purchase' },\n transaction_id: 'data.id',\n total_amount: 'data.total',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'commerce_event',\n data: {\n currency_code: 'EUR',\n product_action: {\n action: 'purchase',\n transaction_id: 'ORD-300',\n total_amount: 249.99,\n },\n timestamp_unixtime_ms: 1700000300000,\n source_message_id: '1700000300000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n },\n source_request_id: '1700000300000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n\n/**\n * Identity + attributes — verifies `user_identities` and `user_attributes`\n * come from the batch-level settings mappings, not the event payload.\n */\nexport const identityAndAttributes: Flow.StepExample = {\n title: 'User identities',\n description:\n 'A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.',\n in: getEvent('form submit', {\n timestamp: 1700000400000,\n data: { type: 'newsletter' },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n events: [\n {\n event_type: 'custom_event',\n data: {\n event_name: 'form submit',\n custom_event_type: 'other',\n timestamp_unixtime_ms: 1700000400000,\n source_message_id: '1700000400000-gr0up-1',\n },\n },\n ],\n environment: 'production',\n user_identities: {\n customer_id: 'user-123',\n email: 'user@example.com',\n },\n source_request_id: '1700000400000-gr0up-1',\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAGX,IAAM,YAAY,EAAE,KAAK,CAAC,OAAO,OAAO,OAAO,KAAK,CAAC;AAGrD,IAAM,oBAAoB,EAAE,KAAK,CAAC,cAAc,aAAa,CAAC;AAG9D,IAAM,kBAAkB,EAAE,KAAK;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,wBAAwB,EAAE,KAAK;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADxBM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,QAAQA,GACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAWA,GACR,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,KAAK,UAAU;AAAA,IACb;AAAA,EACF,EAAE,SAAS;AAAA,EACX,aAAa,kBAAkB;AAAA,IAC7B;AAAA,EACF,EAAE,SAAS;AAAA,EACX,gBAAgBA,GACb,OAAOA,GAAE,OAAO,GAAGA,GAAE,QAAQ,CAAC,EAC9B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgBA,GACb,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAASA,GACN,OAAOA,GAAE,OAAO,GAAGA,GAAE,QA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AAAA,MACJ,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,EAAE,MAAM,UAAU,IAAI,uBAAuB,aAAa,GAAG;AAAA,EACvE,CAAC;AAAA,EACD,SAAS;AAAA,EACT,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,QAAQ;AAAA,UACN;AAAA,YACE,YAAY;AAAA,YACZ,MAAM;AAAA,cACJ,YAAY;AAAA,cACZ,mBAAmB;AAAA,cACnB,uBAAuB;AAAA,cACvB,mBAAmB;AAAA,YACrB;AAAA,UACF;AAAA,QACF;AAAA,QACA,aAAa;AAAA,QACb,iBAAiB;AAAA,UACf,aAAa;AAAA,UACb,OAAO;AAAA,QACT;AAAA,QACA,mBAAmB;AAAA,MACrB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z","z"]}
@@ -60,6 +60,8 @@ var OPTIONS = {
60
60
  }
61
61
  };
62
62
  var customEvent = {
63
+ title: "Custom event",
64
+ description: "A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.",
63
65
  in: (0, import_core.getEvent)("product view", {
64
66
  timestamp: 17000001e5,
65
67
  data: { id: "SKU-A1", name: "Shoe", price: 129.99 },
@@ -94,6 +96,8 @@ var customEvent = {
94
96
  ]
95
97
  };
96
98
  var screenView = {
99
+ title: "Screen view",
100
+ description: "A page view is mapped to an mParticle screen_view event with the event name as the screen name.",
97
101
  in: (0, import_core.getEvent)("page view", {
98
102
  timestamp: 17000002e5,
99
103
  data: { title: "Checkout", path: "/checkout" },
@@ -129,6 +133,8 @@ var screenView = {
129
133
  ]
130
134
  };
131
135
  var commercePurchase = {
136
+ title: "Commerce purchase",
137
+ description: "A completed order becomes an mParticle commerce_event with a purchase product_action block.",
132
138
  in: (0, import_core.getEvent)("order complete", {
133
139
  timestamp: 17000003e5,
134
140
  data: { id: "ORD-300", total: 249.99, currency: "EUR" },
@@ -183,6 +189,8 @@ var commercePurchase = {
183
189
  ]
184
190
  };
185
191
  var identityAndAttributes = {
192
+ title: "User identities",
193
+ description: "A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.",
186
194
  in: (0, import_core.getEvent)("form submit", {
187
195
  timestamp: 17000004e5,
188
196
  data: { type: "newsletter" },
@@ -39,6 +39,8 @@ var OPTIONS = {
39
39
  }
40
40
  };
41
41
  var customEvent = {
42
+ title: "Custom event",
43
+ description: "A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.",
42
44
  in: getEvent("product view", {
43
45
  timestamp: 17000001e5,
44
46
  data: { id: "SKU-A1", name: "Shoe", price: 129.99 },
@@ -73,6 +75,8 @@ var customEvent = {
73
75
  ]
74
76
  };
75
77
  var screenView = {
78
+ title: "Screen view",
79
+ description: "A page view is mapped to an mParticle screen_view event with the event name as the screen name.",
76
80
  in: getEvent("page view", {
77
81
  timestamp: 17000002e5,
78
82
  data: { title: "Checkout", path: "/checkout" },
@@ -108,6 +112,8 @@ var screenView = {
108
112
  ]
109
113
  };
110
114
  var commercePurchase = {
115
+ title: "Commerce purchase",
116
+ description: "A completed order becomes an mParticle commerce_event with a purchase product_action block.",
111
117
  in: getEvent("order complete", {
112
118
  timestamp: 17000003e5,
113
119
  data: { id: "ORD-300", total: 249.99, currency: "EUR" },
@@ -162,6 +168,8 @@ var commercePurchase = {
162
168
  ]
163
169
  };
164
170
  var identityAndAttributes = {
171
+ title: "User identities",
172
+ description: "A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.",
165
173
  in: getEvent("form submit", {
166
174
  timestamp: 17000004e5,
167
175
  data: { type: "newsletter" },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-mparticle",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -134,6 +134,8 @@
134
134
  },
135
135
  "step": {
136
136
  "commercePurchase": {
137
+ "title": "Commerce purchase",
138
+ "description": "A completed order becomes an mParticle commerce_event with a purchase product_action block.",
137
139
  "in": {
138
140
  "name": "order complete",
139
141
  "data": {
@@ -216,7 +218,7 @@
216
218
  "group": "gr0up",
217
219
  "count": 1,
218
220
  "version": {
219
- "source": "3.4.0",
221
+ "source": "3.4.1",
220
222
  "tagging": 1
221
223
  },
222
224
  "source": {
@@ -259,6 +261,8 @@
259
261
  ]
260
262
  },
261
263
  "customEvent": {
264
+ "title": "Custom event",
265
+ "description": "A walker event is sent to mParticle as a custom_event with user identities resolved from destination settings.",
262
266
  "in": {
263
267
  "name": "product view",
264
268
  "data": {
@@ -294,7 +298,7 @@
294
298
  "group": "gr0up",
295
299
  "count": 1,
296
300
  "version": {
297
- "source": "3.4.0",
301
+ "source": "3.4.1",
298
302
  "tagging": 1
299
303
  },
300
304
  "source": {
@@ -318,6 +322,8 @@
318
322
  ]
319
323
  },
320
324
  "identityAndAttributes": {
325
+ "title": "User identities",
326
+ "description": "A form submission sends a custom_event whose batch carries user_identities resolved from destination settings.",
321
327
  "in": {
322
328
  "name": "form submit",
323
329
  "data": {
@@ -366,7 +372,7 @@
366
372
  "group": "gr0up",
367
373
  "count": 1,
368
374
  "version": {
369
- "source": "3.4.0",
375
+ "source": "3.4.1",
370
376
  "tagging": 1
371
377
  },
372
378
  "source": {
@@ -390,6 +396,8 @@
390
396
  ]
391
397
  },
392
398
  "screenView": {
399
+ "title": "Screen view",
400
+ "description": "A page view is mapped to an mParticle screen_view event with the event name as the screen name.",
393
401
  "in": {
394
402
  "name": "page view",
395
403
  "data": {
@@ -438,7 +446,7 @@
438
446
  "group": "gr0up",
439
447
  "count": 1,
440
448
  "version": {
441
- "source": "3.4.0",
449
+ "source": "3.4.1",
442
450
  "tagging": 1
443
451
  },
444
452
  "source": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-mparticle",
3
3
  "description": "mParticle server destination for walkerOS",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -34,11 +34,11 @@
34
34
  "update": "npx npm-check-updates -u && npm update"
35
35
  },
36
36
  "dependencies": {
37
- "@walkeros/core": "3.4.0",
38
- "@walkeros/server-core": "3.4.0"
37
+ "@walkeros/core": "3.4.1",
38
+ "@walkeros/server-core": "3.4.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@walkeros/collector": "3.4.0"
41
+ "@walkeros/collector": "3.4.1"
42
42
  },
43
43
  "repository": {
44
44
  "url": "git+https://github.com/elbwalker/walkerOS.git",