@walkeros/server-destination-datamanager 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,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},o={};r(o,{examples:()=>h,schemas:()=>s}),module.exports=(e=o,((e,r,o,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of n(r))i.call(e,c)||c===o||t(e,c,{get:()=>r[c],enumerable:!(s=a(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};r(s,{mapping:()=>I,settings:()=>E});var c=require("@walkeros/core/dev"),d=c.z.enum(["GOOGLE_ADS","DISPLAY_VIDEO_ADVERTISER","DISPLAY_VIDEO_PARTNER","GOOGLE_ANALYTICS_PROPERTY"]),l=c.z.enum(["WEB","APP","IN_STORE","PHONE","OTHER"]),u=c.z.enum(["CONSENT_GRANTED","CONSENT_DENIED"]),p=c.z.object({adUserData:u.describe("Consent for data collection and use").optional(),adPersonalization:u.describe("Consent for ad personalization").optional()}),m=c.z.object({accountId:c.z.string().min(1).describe('Account ID (e.g., "123-456-7890" for Google Ads)'),accountType:d.describe("Type of account")}),v=c.z.object({operatingAccount:m.describe("Operating account details"),productDestinationId:c.z.string().min(1).describe("Product-specific destination ID (conversion action or user list)")}),g=require("@walkeros/core/dev"),b=g.z.object({client_email:g.z.string().email().describe("Service account email"),private_key:g.z.string().min(1).describe("Service account private key (PEM format)")}),f=g.z.object({credentials:b.optional().describe("Service account credentials (client_email + private_key). Recommended for serverless environments."),keyFilename:g.z.string().optional().describe("Path to service account JSON file. For local development or environments with filesystem access."),scopes:g.z.array(g.z.string()).optional().describe("OAuth scopes for Data Manager API. Defaults to datamanager scope."),destinations:g.z.array(v).min(1).max(10).describe("Array of destination accounts and conversion actions/user lists (max 10)"),eventSource:l.optional().default("WEB").describe("Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER"),batchSize:g.z.number().int().min(1).max(2e3).describe("Maximum number of events to batch before sending (max 2000, like 100)").optional(),batchInterval:g.z.number().int().min(0).describe("Time in milliseconds to wait before auto-flushing batch (like 5000)").optional(),validateOnly:g.z.boolean().describe("If true, validate request without ingestion (testing mode)").optional(),url:g.z.string().url().describe("Override API endpoint for testing (like https://datamanager.googleapis.com/v1)").optional(),consent:p.describe("Request-level consent for all events").optional(),testEventCode:g.z.string().describe("Test event code for debugging (like TEST12345)").optional(),logLevel:g.z.enum(["debug","info","warn","error","none"]).describe("Log level for debugging (debug shows all API calls)").optional(),userData:g.z.record(g.z.string(),g.z.unknown()).describe("Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })").optional(),userId:g.z.any().describe("Guided helper: First-party user ID for all events (like 'user.id')").optional(),clientId:g.z.any().describe("Guided helper: GA4 client ID for all events (like 'user.device')").optional(),sessionAttributes:g.z.any().describe("Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')").optional(),consentAdUserData:g.z.union([g.z.string(),g.z.boolean()]).describe("Consent mapping: Field name from event.consent (like 'marketing') or static boolean value").optional(),consentAdPersonalization:g.z.union([g.z.string(),g.z.boolean()]).describe("Consent mapping: Field name from event.consent (like 'targeting') or static boolean value").optional()}),y=require("@walkeros/core/dev").z.object({}),z=require("@walkeros/core/dev"),E=(0,z.zodToSchema)(f),I=(0,z.zodToSchema)(y),h={};r(h,{env:()=>O,step:()=>S});var O={};r(O,{push:()=>A,simulation:()=>D});var A={fetch:async function(){return{ok:!0,status:200,json:async()=>({requestId:"mock-request-id",validationErrors:[]}),text:async()=>""}},authClient:{getAccessToken:async()=>({token:"ya29.c.test_token"})}},D=["fetch"],S={};r(S,{ga4PageView:()=>R,lead:()=>w,purchase:()=>N});var T=require("@walkeros/core"),_="https://datamanager.googleapis.com/v1/events:ingest",k=[{operatingAccount:{accountId:"123-456-7890",accountType:"GOOGLE_ADS"},productDestinationId:"AW-CONVERSION-123"}],P=e=>({method:"POST",headers:{Authorization:"Bearer ya29.c.test_token","Content-Type":"application/json"},body:e}),N={in:(0,T.getEvent)("order complete",{timestamp:17000009e5,data:{id:"ORD-600",total:149.99,currency:"EUR"},user:{id:"user-abc",email:"buyer@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"purchase",data:{map:{transactionId:"data.id",conversionValue:"data.total",currency:{key:"data.currency",value:"USD"},eventName:{value:"purchase"},userId:"user.id",email:"user.email"}}},out:[["fetch",_,P(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:20.000Z",transactionId:"ORD-600",userId:"user-abc",userData:{userIdentifiers:[{emailAddress:"6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd"}]},conversionValue:149.99,currency:"EUR",eventName:"purchase",eventSource:"WEB"}],destinations:k}))]]},w={in:(0,T.getEvent)("form submit",{timestamp:1700000901e3,data:{type:"demo-request"},user:{email:"prospect@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"generate_lead",data:{map:{transactionId:"id",eventName:{value:"generate_lead"},conversionValue:{value:10},currency:{value:"USD"},email:"user.email"}}},out:[["fetch",_,P(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:21.000Z",transactionId:"1700000901000-gr0up-1",userData:{userIdentifiers:[{emailAddress:"395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642"}]},conversionValue:10,currency:"USD",eventName:"generate_lead",eventSource:"WEB"}],destinations:k}))]]},R={in:(0,T.getEvent)("page view",{timestamp:1700000902e3,data:{title:"Pricing",url:"https://example.com/pricing"},user:{id:"visitor-55"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"page_view",data:{map:{transactionId:"id",eventName:{value:"page_view"},userId:"user.id"}}},out:[["fetch",_,P(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:22.000Z",transactionId:"1700000902000-gr0up-1",userId:"visitor-55",eventName:"page_view",eventSource:"WEB"}],destinations:k}))]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},o={};r(o,{examples:()=>I,schemas:()=>s}),module.exports=(e=o,((e,r,o,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of n(r))i.call(e,c)||c===o||t(e,c,{get:()=>r[c],enumerable:!(s=a(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};r(s,{mapping:()=>E,settings:()=>z});var c=require("@walkeros/core/dev"),d=c.z.enum(["GOOGLE_ADS","DISPLAY_VIDEO_ADVERTISER","DISPLAY_VIDEO_PARTNER","GOOGLE_ANALYTICS_PROPERTY"]),l=c.z.enum(["WEB","APP","IN_STORE","PHONE","OTHER"]),u=c.z.enum(["CONSENT_GRANTED","CONSENT_DENIED"]),p=c.z.object({adUserData:u.describe("Consent for data collection and use").optional(),adPersonalization:u.describe("Consent for ad personalization").optional()}),m=c.z.object({accountId:c.z.string().min(1).describe('Account ID (e.g., "123-456-7890" for Google Ads)'),accountType:d.describe("Type of account")}),v=c.z.object({operatingAccount:m.describe("Operating account details"),productDestinationId:c.z.string().min(1).describe("Product-specific destination ID (conversion action or user list)")}),g=require("@walkeros/core/dev"),b=g.z.object({client_email:g.z.string().email().describe("Service account email"),private_key:g.z.string().min(1).describe("Service account private key (PEM format)")}),f=g.z.object({credentials:b.optional().describe("Service account credentials (client_email + private_key). Recommended for serverless environments."),keyFilename:g.z.string().optional().describe("Path to service account JSON file. For local development or environments with filesystem access."),scopes:g.z.array(g.z.string()).optional().describe("OAuth scopes for Data Manager API. Defaults to datamanager scope."),destinations:g.z.array(v).min(1).max(10).describe("Array of destination accounts and conversion actions/user lists (max 10)"),eventSource:l.optional().default("WEB").describe("Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER"),batchSize:g.z.number().int().min(1).max(2e3).describe("Maximum number of events to batch before sending (max 2000, like 100)").optional(),batchInterval:g.z.number().int().min(0).describe("Time in milliseconds to wait before auto-flushing batch (like 5000)").optional(),validateOnly:g.z.boolean().describe("If true, validate request without ingestion (testing mode)").optional(),url:g.z.string().url().describe("Override API endpoint for testing (like https://datamanager.googleapis.com/v1)").optional(),consent:p.describe("Request-level consent for all events").optional(),testEventCode:g.z.string().describe("Test event code for debugging (like TEST12345)").optional(),logLevel:g.z.enum(["debug","info","warn","error","none"]).describe("Log level for debugging (debug shows all API calls)").optional(),userData:g.z.record(g.z.string(),g.z.unknown()).describe("Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })").optional(),userId:g.z.any().describe("Guided helper: First-party user ID for all events (like 'user.id')").optional(),clientId:g.z.any().describe("Guided helper: GA4 client ID for all events (like 'user.device')").optional(),sessionAttributes:g.z.any().describe("Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')").optional(),consentAdUserData:g.z.union([g.z.string(),g.z.boolean()]).describe("Consent mapping: Field name from event.consent (like 'marketing') or static boolean value").optional(),consentAdPersonalization:g.z.union([g.z.string(),g.z.boolean()]).describe("Consent mapping: Field name from event.consent (like 'targeting') or static boolean value").optional()}),y=require("@walkeros/core/dev").z.object({}),h=require("@walkeros/core/dev"),z=(0,h.zodToSchema)(f),E=(0,h.zodToSchema)(y),I={};r(I,{env:()=>O,step:()=>_});var O={};r(O,{push:()=>A,simulation:()=>D});var A={fetch:async function(){return{ok:!0,status:200,json:async()=>({requestId:"mock-request-id",validationErrors:[]}),text:async()=>""}},authClient:{getAccessToken:async()=>({token:"ya29.c.test_token"})}},D=["fetch"],_={};r(_,{ga4PageView:()=>R,lead:()=>N,purchase:()=>w});var S=require("@walkeros/core"),k="https://datamanager.googleapis.com/v1/events:ingest",P=[{operatingAccount:{accountId:"123-456-7890",accountType:"GOOGLE_ADS"},productDestinationId:"AW-CONVERSION-123"}],T=e=>({method:"POST",headers:{Authorization:"Bearer ya29.c.test_token","Content-Type":"application/json"},body:e}),w={title:"Purchase",description:"A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.",in:(0,S.getEvent)("order complete",{timestamp:17000009e5,data:{id:"ORD-600",total:149.99,currency:"EUR"},user:{id:"user-abc",email:"buyer@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"purchase",data:{map:{transactionId:"data.id",conversionValue:"data.total",currency:{key:"data.currency",value:"USD"},eventName:{value:"purchase"},userId:"user.id",email:"user.email"}}},out:[["fetch",k,T(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:20.000Z",transactionId:"ORD-600",userId:"user-abc",userData:{userIdentifiers:[{emailAddress:"6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd"}]},conversionValue:149.99,currency:"EUR",eventName:"purchase",eventSource:"WEB"}],destinations:P}))]]},N={title:"Lead",description:"A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.",in:(0,S.getEvent)("form submit",{timestamp:1700000901e3,data:{type:"demo-request"},user:{email:"prospect@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"generate_lead",data:{map:{transactionId:"id",eventName:{value:"generate_lead"},conversionValue:{value:10},currency:{value:"USD"},email:"user.email"}}},out:[["fetch",k,T(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:21.000Z",transactionId:"1700000901000-gr0up-1",userData:{userIdentifiers:[{emailAddress:"395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642"}]},conversionValue:10,currency:"USD",eventName:"generate_lead",eventSource:"WEB"}],destinations:P}))]]},R={title:"Page view",description:"A page view is sent to Data Manager as a page_view event tied to the walker user id.",in:(0,S.getEvent)("page view",{timestamp:1700000902e3,data:{title:"Pricing",url:"https://example.com/pricing"},user:{id:"visitor-55"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"page_view",data:{map:{transactionId:"id",eventName:{value:"page_view"},userId:"user.id"}}},out:[["fetch",k,T(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:22.000Z",transactionId:"1700000902000-gr0up-1",userId:"visitor-55",eventName:"page_view",eventSource:"WEB"}],destinations:P}))]]};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas.ts","../src/schemas/primitives.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/index.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","// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './schemas/index';\n","import { z } from '@walkeros/core/dev';\n\nexport const AccountTypeSchema = z.enum([\n 'GOOGLE_ADS',\n 'DISPLAY_VIDEO_ADVERTISER',\n 'DISPLAY_VIDEO_PARTNER',\n 'GOOGLE_ANALYTICS_PROPERTY',\n]);\n\nexport const EventSourceSchema = z.enum([\n 'WEB',\n 'APP',\n 'IN_STORE',\n 'PHONE',\n 'OTHER',\n]);\n\nexport const ConsentStatusSchema = z.enum([\n 'CONSENT_GRANTED',\n 'CONSENT_DENIED',\n]);\n\nexport const ConsentSchema = z.object({\n adUserData: ConsentStatusSchema.describe(\n 'Consent for data collection and use',\n ).optional(),\n adPersonalization: ConsentStatusSchema.describe(\n 'Consent for ad personalization',\n ).optional(),\n});\n\nexport const OperatingAccountSchema = z.object({\n accountId: z\n .string()\n .min(1)\n .describe('Account ID (e.g., \"123-456-7890\" for Google Ads)'),\n accountType: AccountTypeSchema.describe('Type of account'),\n});\n\nexport const DestinationSchema = z.object({\n operatingAccount: OperatingAccountSchema.describe(\n 'Operating account details',\n ),\n productDestinationId: z\n .string()\n .min(1)\n .describe(\n 'Product-specific destination ID (conversion action or user list)',\n ),\n});\n","import { z } from '@walkeros/core/dev';\nimport {\n DestinationSchema,\n EventSourceSchema,\n ConsentSchema,\n} from './primitives';\n\n/**\n * Service account credentials schema\n */\nconst CredentialsSchema = z.object({\n client_email: z.string().email().describe('Service account email'),\n private_key: z\n .string()\n .min(1)\n .describe('Service account private key (PEM format)'),\n});\n\nexport const SettingsSchema = z.object({\n credentials: CredentialsSchema.optional().describe(\n 'Service account credentials (client_email + private_key). Recommended for serverless environments.',\n ),\n keyFilename: z\n .string()\n .optional()\n .describe(\n 'Path to service account JSON file. For local development or environments with filesystem access.',\n ),\n scopes: z\n .array(z.string())\n .optional()\n .describe(\n 'OAuth scopes for Data Manager API. Defaults to datamanager scope.',\n ),\n destinations: z\n .array(DestinationSchema)\n .min(1)\n .max(10)\n .describe(\n 'Array of destination accounts and conversion actions/user lists (max 10)',\n ),\n eventSource: EventSourceSchema.optional()\n .default('WEB')\n .describe(\n 'Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER',\n ),\n batchSize: z\n .number()\n .int()\n .min(1)\n .max(2000)\n .describe(\n 'Maximum number of events to batch before sending (max 2000, like 100)',\n )\n .optional(),\n batchInterval: z\n .number()\n .int()\n .min(0)\n .describe(\n 'Time in milliseconds to wait before auto-flushing batch (like 5000)',\n )\n .optional(),\n validateOnly: z\n .boolean()\n .describe('If true, validate request without ingestion (testing mode)')\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Override API endpoint for testing (like https://datamanager.googleapis.com/v1)',\n )\n .optional(),\n consent: ConsentSchema.describe(\n 'Request-level consent for all events',\n ).optional(),\n testEventCode: z\n .string()\n .describe('Test event code for debugging (like TEST12345)')\n .optional(),\n logLevel: z\n .enum(['debug', 'info', 'warn', 'error', 'none'])\n .describe('Log level for debugging (debug shows all API calls)')\n .optional(),\n userData: z\n .record(z.string(), z.unknown())\n .describe(\n \"Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })\",\n )\n .optional(),\n userId: z\n .any()\n .describe(\n \"Guided helper: First-party user ID for all events (like 'user.id')\",\n )\n .optional(),\n clientId: z\n .any()\n .describe(\n \"Guided helper: GA4 client ID for all events (like 'user.device')\",\n )\n .optional(),\n sessionAttributes: z\n .any()\n .describe(\n \"Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')\",\n )\n .optional(),\n consentAdUserData: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'marketing') or static boolean value\",\n )\n .optional(),\n consentAdPersonalization: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'targeting') or static boolean value\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n// Data Manager uses flexible mapping via walkerOS mapping system\n// No event-specific mapping schema needed (similar to Meta CAPI pattern)\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * from './primitives';\nexport * from './settings';\nexport * from './mapping';\n\nimport { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","export * as env from './env';\nexport * as step from './step';\n","import type { OAuth2Client } from 'google-auth-library';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Google Data Manager destination.\n *\n * The destination invokes `env.fetch(url, { method, headers, body })` once\n * per push, with `Authorization: Bearer <accessToken>` obtained from\n * `env.authClient` via `getAccessToken`.\n *\n * For tests we use a stub `authClient` (jest mocks the `getAccessToken`\n * helper at module level) and a mock `fetch` returning a successful ingest\n * response.\n */\n\nasync function mockFetch(): Promise<Response> {\n return {\n ok: true,\n status: 200,\n json: async () => ({ requestId: 'mock-request-id', validationErrors: [] }),\n text: async () => '',\n } as unknown as Response;\n}\n\nconst mockAuthClient = {\n getAccessToken: async () => ({ token: 'ya29.c.test_token' }),\n} as unknown as OAuth2Client;\n\nexport const push: Env = {\n fetch: mockFetch,\n authClient: mockAuthClient,\n};\n\nexport const simulation = ['fetch'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Google Data Manager step examples.\n *\n * At push time, the destination calls\n * `env.fetch(url, { method, headers, body })` where:\n * - `url` is `${settings.url}/events:ingest` (default\n * `https://datamanager.googleapis.com/v1`)\n * - `method` is `'POST'`\n * - `headers` is `{ Authorization: 'Bearer <accessToken>', 'Content-Type': 'application/json' }`\n * - `body` is the JSON-stringified `{ events: [dataManagerEvent], destinations }` payload\n *\n * The access token is obtained from `env.authClient` via `getAccessToken`.\n * The test fixture mocks both so the captured Authorization header is stable\n * (`Bearer ya29.c.test_token`).\n *\n * Event fields are emitted in the order the destination constructs them\n * (insertion order matters for `JSON.stringify` string equality):\n * eventTimestamp, transactionId?, clientId?, userId?, userData?,\n * adIdentifiers?, conversionValue?, currency?, cartData?, eventName?,\n * [eventSource is appended last by push.ts when not already present].\n *\n * Emails are normalized (trim, lowercase, strip dots for Gmail) and hashed\n * with SHA-256.\n */\nconst ENDPOINT = 'https://datamanager.googleapis.com/v1/events:ingest';\nconst DESTINATIONS = [\n {\n operatingAccount: {\n accountId: '123-456-7890',\n accountType: 'GOOGLE_ADS',\n },\n productDestinationId: 'AW-CONVERSION-123',\n },\n];\nconst INIT_OPTIONS = (body: string) => ({\n method: 'POST',\n headers: {\n Authorization: 'Bearer ya29.c.test_token',\n 'Content-Type': 'application/json',\n },\n body,\n});\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-600', total: 149.99, currency: 'EUR' },\n user: { id: 'user-abc', email: 'buyer@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n transactionId: 'data.id',\n conversionValue: 'data.total',\n currency: { key: 'data.currency', value: 'USD' },\n eventName: { value: 'purchase' },\n userId: 'user.id',\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:20.000Z',\n transactionId: 'ORD-600',\n userId: 'user-abc',\n userData: {\n userIdentifiers: [\n {\n // sha256('buyer@example.com')\n emailAddress:\n '6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd',\n },\n ],\n },\n conversionValue: 149.99,\n currency: 'EUR',\n eventName: 'purchase',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000901000,\n data: { type: 'demo-request' },\n user: { email: 'prospect@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'generate_lead',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'generate_lead' },\n conversionValue: { value: 10 },\n currency: { value: 'USD' },\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:21.000Z',\n transactionId: '1700000901000-gr0up-1',\n userData: {\n userIdentifiers: [\n {\n // sha256('prospect@example.com')\n emailAddress:\n '395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642',\n },\n ],\n },\n conversionValue: 10,\n currency: 'USD',\n eventName: 'generate_lead',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const ga4PageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902000,\n data: { title: 'Pricing', url: 'https://example.com/pricing' },\n user: { id: 'visitor-55' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'page_view',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'page_view' },\n userId: 'user.id',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:22.000Z',\n transactionId: '1700000902000-gr0up-1',\n userId: 'visitor-55',\n eventName: 'page_view',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,oBAAoB,aAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,oBAAoB,aAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,sBAAsB,aAAE,KAAK;AAAA,EACxC;AAAA,EACA;AACF,CAAC;AAEM,IAAM,gBAAgB,aAAE,OAAO;AAAA,EACpC,YAAY,oBAAoB;AAAA,IAC9B;AAAA,EACF,EAAE,SAAS;AAAA,EACX,mBAAmB,oBAAoB;AAAA,IACrC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;AAEM,IAAM,yBAAyB,aAAE,OAAO;AAAA,EAC7C,WAAW,aACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,kDAAkD;AAAA,EAC9D,aAAa,kBAAkB,SAAS,iBAAiB;AAC3D,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,kBAAkB,uBAAuB;AAAA,IACvC;AAAA,EACF;AAAA,EACA,sBAAsB,aACnB,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;ACjDD,IAAAA,cAAkB;AAUlB,IAAM,oBAAoB,cAAE,OAAO;AAAA,EACjC,cAAc,cAAE,OAAO,EAAE,MAAM,EAAE,SAAS,uBAAuB;AAAA,EACjE,aAAa,cACV,OAAO,EACP,IAAI,CAAC,EACL,SAAS,0CAA0C;AACx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Aa;AAAA,YACf;AAAA,UACF;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas.ts","../src/schemas/primitives.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/index.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","// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './schemas/index';\n","import { z } from '@walkeros/core/dev';\n\nexport const AccountTypeSchema = z.enum([\n 'GOOGLE_ADS',\n 'DISPLAY_VIDEO_ADVERTISER',\n 'DISPLAY_VIDEO_PARTNER',\n 'GOOGLE_ANALYTICS_PROPERTY',\n]);\n\nexport const EventSourceSchema = z.enum([\n 'WEB',\n 'APP',\n 'IN_STORE',\n 'PHONE',\n 'OTHER',\n]);\n\nexport const ConsentStatusSchema = z.enum([\n 'CONSENT_GRANTED',\n 'CONSENT_DENIED',\n]);\n\nexport const ConsentSchema = z.object({\n adUserData: ConsentStatusSchema.describe(\n 'Consent for data collection and use',\n ).optional(),\n adPersonalization: ConsentStatusSchema.describe(\n 'Consent for ad personalization',\n ).optional(),\n});\n\nexport const OperatingAccountSchema = z.object({\n accountId: z\n .string()\n .min(1)\n .describe('Account ID (e.g., \"123-456-7890\" for Google Ads)'),\n accountType: AccountTypeSchema.describe('Type of account'),\n});\n\nexport const DestinationSchema = z.object({\n operatingAccount: OperatingAccountSchema.describe(\n 'Operating account details',\n ),\n productDestinationId: z\n .string()\n .min(1)\n .describe(\n 'Product-specific destination ID (conversion action or user list)',\n ),\n});\n","import { z } from '@walkeros/core/dev';\nimport {\n DestinationSchema,\n EventSourceSchema,\n ConsentSchema,\n} from './primitives';\n\n/**\n * Service account credentials schema\n */\nconst CredentialsSchema = z.object({\n client_email: z.string().email().describe('Service account email'),\n private_key: z\n .string()\n .min(1)\n .describe('Service account private key (PEM format)'),\n});\n\nexport const SettingsSchema = z.object({\n credentials: CredentialsSchema.optional().describe(\n 'Service account credentials (client_email + private_key). Recommended for serverless environments.',\n ),\n keyFilename: z\n .string()\n .optional()\n .describe(\n 'Path to service account JSON file. For local development or environments with filesystem access.',\n ),\n scopes: z\n .array(z.string())\n .optional()\n .describe(\n 'OAuth scopes for Data Manager API. Defaults to datamanager scope.',\n ),\n destinations: z\n .array(DestinationSchema)\n .min(1)\n .max(10)\n .describe(\n 'Array of destination accounts and conversion actions/user lists (max 10)',\n ),\n eventSource: EventSourceSchema.optional()\n .default('WEB')\n .describe(\n 'Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER',\n ),\n batchSize: z\n .number()\n .int()\n .min(1)\n .max(2000)\n .describe(\n 'Maximum number of events to batch before sending (max 2000, like 100)',\n )\n .optional(),\n batchInterval: z\n .number()\n .int()\n .min(0)\n .describe(\n 'Time in milliseconds to wait before auto-flushing batch (like 5000)',\n )\n .optional(),\n validateOnly: z\n .boolean()\n .describe('If true, validate request without ingestion (testing mode)')\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Override API endpoint for testing (like https://datamanager.googleapis.com/v1)',\n )\n .optional(),\n consent: ConsentSchema.describe(\n 'Request-level consent for all events',\n ).optional(),\n testEventCode: z\n .string()\n .describe('Test event code for debugging (like TEST12345)')\n .optional(),\n logLevel: z\n .enum(['debug', 'info', 'warn', 'error', 'none'])\n .describe('Log level for debugging (debug shows all API calls)')\n .optional(),\n userData: z\n .record(z.string(), z.unknown())\n .describe(\n \"Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })\",\n )\n .optional(),\n userId: z\n .any()\n .describe(\n \"Guided helper: First-party user ID for all events (like 'user.id')\",\n )\n .optional(),\n clientId: z\n .any()\n .describe(\n \"Guided helper: GA4 client ID for all events (like 'user.device')\",\n )\n .optional(),\n sessionAttributes: z\n .any()\n .describe(\n \"Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')\",\n )\n .optional(),\n consentAdUserData: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'marketing') or static boolean value\",\n )\n .optional(),\n consentAdPersonalization: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'targeting') or static boolean value\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n// Data Manager uses flexible mapping via walkerOS mapping system\n// No event-specific mapping schema needed (similar to Meta CAPI pattern)\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * from './primitives';\nexport * from './settings';\nexport * from './mapping';\n\nimport { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","export * as env from './env';\nexport * as step from './step';\n","import type { OAuth2Client } from 'google-auth-library';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Google Data Manager destination.\n *\n * The destination invokes `env.fetch(url, { method, headers, body })` once\n * per push, with `Authorization: Bearer <accessToken>` obtained from\n * `env.authClient` via `getAccessToken`.\n *\n * For tests we use a stub `authClient` (jest mocks the `getAccessToken`\n * helper at module level) and a mock `fetch` returning a successful ingest\n * response.\n */\n\nasync function mockFetch(): Promise<Response> {\n return {\n ok: true,\n status: 200,\n json: async () => ({ requestId: 'mock-request-id', validationErrors: [] }),\n text: async () => '',\n } as unknown as Response;\n}\n\nconst mockAuthClient = {\n getAccessToken: async () => ({ token: 'ya29.c.test_token' }),\n} as unknown as OAuth2Client;\n\nexport const push: Env = {\n fetch: mockFetch,\n authClient: mockAuthClient,\n};\n\nexport const simulation = ['fetch'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Google Data Manager step examples.\n *\n * At push time, the destination calls\n * `env.fetch(url, { method, headers, body })` where:\n * - `url` is `${settings.url}/events:ingest` (default\n * `https://datamanager.googleapis.com/v1`)\n * - `method` is `'POST'`\n * - `headers` is `{ Authorization: 'Bearer <accessToken>', 'Content-Type': 'application/json' }`\n * - `body` is the JSON-stringified `{ events: [dataManagerEvent], destinations }` payload\n *\n * The access token is obtained from `env.authClient` via `getAccessToken`.\n * The test fixture mocks both so the captured Authorization header is stable\n * (`Bearer ya29.c.test_token`).\n *\n * Event fields are emitted in the order the destination constructs them\n * (insertion order matters for `JSON.stringify` string equality):\n * eventTimestamp, transactionId?, clientId?, userId?, userData?,\n * adIdentifiers?, conversionValue?, currency?, cartData?, eventName?,\n * [eventSource is appended last by push.ts when not already present].\n *\n * Emails are normalized (trim, lowercase, strip dots for Gmail) and hashed\n * with SHA-256.\n */\nconst ENDPOINT = 'https://datamanager.googleapis.com/v1/events:ingest';\nconst DESTINATIONS = [\n {\n operatingAccount: {\n accountId: '123-456-7890',\n accountType: 'GOOGLE_ADS',\n },\n productDestinationId: 'AW-CONVERSION-123',\n },\n];\nconst INIT_OPTIONS = (body: string) => ({\n method: 'POST',\n headers: {\n Authorization: 'Bearer ya29.c.test_token',\n 'Content-Type': 'application/json',\n },\n body,\n});\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.',\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-600', total: 149.99, currency: 'EUR' },\n user: { id: 'user-abc', email: 'buyer@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n transactionId: 'data.id',\n conversionValue: 'data.total',\n currency: { key: 'data.currency', value: 'USD' },\n eventName: { value: 'purchase' },\n userId: 'user.id',\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:20.000Z',\n transactionId: 'ORD-600',\n userId: 'user-abc',\n userData: {\n userIdentifiers: [\n {\n // sha256('buyer@example.com')\n emailAddress:\n '6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd',\n },\n ],\n },\n conversionValue: 149.99,\n currency: 'EUR',\n eventName: 'purchase',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const lead: Flow.StepExample = {\n title: 'Lead',\n description:\n 'A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.',\n in: getEvent('form submit', {\n timestamp: 1700000901000,\n data: { type: 'demo-request' },\n user: { email: 'prospect@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'generate_lead',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'generate_lead' },\n conversionValue: { value: 10 },\n currency: { value: 'USD' },\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:21.000Z',\n transactionId: '1700000901000-gr0up-1',\n userData: {\n userIdentifiers: [\n {\n // sha256('prospect@example.com')\n emailAddress:\n '395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642',\n },\n ],\n },\n conversionValue: 10,\n currency: 'USD',\n eventName: 'generate_lead',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const ga4PageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is sent to Data Manager as a page_view event tied to the walker user id.',\n in: getEvent('page view', {\n timestamp: 1700000902000,\n data: { title: 'Pricing', url: 'https://example.com/pricing' },\n user: { id: 'visitor-55' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'page_view',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'page_view' },\n userId: 'user.id',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:22.000Z',\n transactionId: '1700000902000-gr0up-1',\n userId: 'visitor-55',\n eventName: 'page_view',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,oBAAoB,aAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,oBAAoB,aAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,sBAAsB,aAAE,KAAK;AAAA,EACxC;AAAA,EACA;AACF,CAAC;AAEM,IAAM,gBAAgB,aAAE,OAAO;AAAA,EACpC,YAAY,oBAAoB;AAAA,IAC9B;AAAA,EACF,EAAE,SAAS;AAAA,EACX,mBAAmB,oBAAoB;AAAA,IACrC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;AAEM,IAAM,yBAAyB,aAAE,OAAO;AAAA,EAC7C,WAAW,aACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,kDAAkD;AAAA,EAC9D,aAAa,kBAAkB,SAAS,iBAAiB;AAC3D,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,kBAAkB,uBAAuB;AAAA,IACvC;AAAA,EACF;AAAA,EACA,sBAAsB,aACnB,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;ACjDD,IAAAA,cAAkB;AAUlB,IAAM,oBAAoB,cAAE,OAAO;AAAA,EACjC,cAAc,cAAE,OAAO,EAAE,MAAM,EAAE,SAAS,uBAAuB;A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,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK,UAAU;AAAA,UACb,QAAQ;AAAA,YACN;AAAA,cACE,gBAAgB;AAAA,cAChB,eAAe;AAAA,cACf,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,MACH;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,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})},a={};t(a,{mapping:()=>f,settings:()=>b});import{z as n}from"@walkeros/core/dev";var i=n.enum(["GOOGLE_ADS","DISPLAY_VIDEO_ADVERTISER","DISPLAY_VIDEO_PARTNER","GOOGLE_ANALYTICS_PROPERTY"]),r=n.enum(["WEB","APP","IN_STORE","PHONE","OTHER"]),o=n.enum(["CONSENT_GRANTED","CONSENT_DENIED"]),s=n.object({adUserData:o.describe("Consent for data collection and use").optional(),adPersonalization:o.describe("Consent for ad personalization").optional()}),c=n.object({accountId:n.string().min(1).describe('Account ID (e.g., "123-456-7890" for Google Ads)'),accountType:i.describe("Type of account")}),d=n.object({operatingAccount:c.describe("Operating account details"),productDestinationId:n.string().min(1).describe("Product-specific destination ID (conversion action or user list)")});import{z as l}from"@walkeros/core/dev";var u=l.object({client_email:l.string().email().describe("Service account email"),private_key:l.string().min(1).describe("Service account private key (PEM format)")}),m=l.object({credentials:u.optional().describe("Service account credentials (client_email + private_key). Recommended for serverless environments."),keyFilename:l.string().optional().describe("Path to service account JSON file. For local development or environments with filesystem access."),scopes:l.array(l.string()).optional().describe("OAuth scopes for Data Manager API. Defaults to datamanager scope."),destinations:l.array(d).min(1).max(10).describe("Array of destination accounts and conversion actions/user lists (max 10)"),eventSource:r.optional().default("WEB").describe("Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER"),batchSize:l.number().int().min(1).max(2e3).describe("Maximum number of events to batch before sending (max 2000, like 100)").optional(),batchInterval:l.number().int().min(0).describe("Time in milliseconds to wait before auto-flushing batch (like 5000)").optional(),validateOnly:l.boolean().describe("If true, validate request without ingestion (testing mode)").optional(),url:l.string().url().describe("Override API endpoint for testing (like https://datamanager.googleapis.com/v1)").optional(),consent:s.describe("Request-level consent for all events").optional(),testEventCode:l.string().describe("Test event code for debugging (like TEST12345)").optional(),logLevel:l.enum(["debug","info","warn","error","none"]).describe("Log level for debugging (debug shows all API calls)").optional(),userData:l.record(l.string(),l.unknown()).describe("Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })").optional(),userId:l.any().describe("Guided helper: First-party user ID for all events (like 'user.id')").optional(),clientId:l.any().describe("Guided helper: GA4 client ID for all events (like 'user.device')").optional(),sessionAttributes:l.any().describe("Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')").optional(),consentAdUserData:l.union([l.string(),l.boolean()]).describe("Consent mapping: Field name from event.consent (like 'marketing') or static boolean value").optional(),consentAdPersonalization:l.union([l.string(),l.boolean()]).describe("Consent mapping: Field name from event.consent (like 'targeting') or static boolean value").optional()});import{z as p}from"@walkeros/core/dev";var v=p.object({});import{zodToSchema as g}from"@walkeros/core/dev";var b=g(m),f=g(v),y={};t(y,{env:()=>I,step:()=>O});var I={};t(I,{push:()=>E,simulation:()=>h});var E={fetch:async function(){return{ok:!0,status:200,json:async()=>({requestId:"mock-request-id",validationErrors:[]}),text:async()=>""}},authClient:{getAccessToken:async()=>({token:"ya29.c.test_token"})}},h=["fetch"],O={};t(O,{ga4PageView:()=>N,lead:()=>_,purchase:()=>T});import{getEvent as A}from"@walkeros/core";var D="https://datamanager.googleapis.com/v1/events:ingest",k=[{operatingAccount:{accountId:"123-456-7890",accountType:"GOOGLE_ADS"},productDestinationId:"AW-CONVERSION-123"}],S=e=>({method:"POST",headers:{Authorization:"Bearer ya29.c.test_token","Content-Type":"application/json"},body:e}),T={in:A("order complete",{timestamp:17000009e5,data:{id:"ORD-600",total:149.99,currency:"EUR"},user:{id:"user-abc",email:"buyer@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"purchase",data:{map:{transactionId:"data.id",conversionValue:"data.total",currency:{key:"data.currency",value:"USD"},eventName:{value:"purchase"},userId:"user.id",email:"user.email"}}},out:[["fetch",D,S(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:20.000Z",transactionId:"ORD-600",userId:"user-abc",userData:{userIdentifiers:[{emailAddress:"6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd"}]},conversionValue:149.99,currency:"EUR",eventName:"purchase",eventSource:"WEB"}],destinations:k}))]]},_={in:A("form submit",{timestamp:1700000901e3,data:{type:"demo-request"},user:{email:"prospect@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"generate_lead",data:{map:{transactionId:"id",eventName:{value:"generate_lead"},conversionValue:{value:10},currency:{value:"USD"},email:"user.email"}}},out:[["fetch",D,S(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:21.000Z",transactionId:"1700000901000-gr0up-1",userData:{userIdentifiers:[{emailAddress:"395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642"}]},conversionValue:10,currency:"USD",eventName:"generate_lead",eventSource:"WEB"}],destinations:k}))]]},N={in:A("page view",{timestamp:1700000902e3,data:{title:"Pricing",url:"https://example.com/pricing"},user:{id:"visitor-55"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"page_view",data:{map:{transactionId:"id",eventName:{value:"page_view"},userId:"user.id"}}},out:[["fetch",D,S(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:22.000Z",transactionId:"1700000902000-gr0up-1",userId:"visitor-55",eventName:"page_view",eventSource:"WEB"}],destinations:k}))]]};export{y as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{mapping:()=>f,settings:()=>b});import{z as i}from"@walkeros/core/dev";var n=i.enum(["GOOGLE_ADS","DISPLAY_VIDEO_ADVERTISER","DISPLAY_VIDEO_PARTNER","GOOGLE_ANALYTICS_PROPERTY"]),r=i.enum(["WEB","APP","IN_STORE","PHONE","OTHER"]),o=i.enum(["CONSENT_GRANTED","CONSENT_DENIED"]),s=i.object({adUserData:o.describe("Consent for data collection and use").optional(),adPersonalization:o.describe("Consent for ad personalization").optional()}),c=i.object({accountId:i.string().min(1).describe('Account ID (e.g., "123-456-7890" for Google Ads)'),accountType:n.describe("Type of account")}),d=i.object({operatingAccount:c.describe("Operating account details"),productDestinationId:i.string().min(1).describe("Product-specific destination ID (conversion action or user list)")});import{z as l}from"@walkeros/core/dev";var u=l.object({client_email:l.string().email().describe("Service account email"),private_key:l.string().min(1).describe("Service account private key (PEM format)")}),p=l.object({credentials:u.optional().describe("Service account credentials (client_email + private_key). Recommended for serverless environments."),keyFilename:l.string().optional().describe("Path to service account JSON file. For local development or environments with filesystem access."),scopes:l.array(l.string()).optional().describe("OAuth scopes for Data Manager API. Defaults to datamanager scope."),destinations:l.array(d).min(1).max(10).describe("Array of destination accounts and conversion actions/user lists (max 10)"),eventSource:r.optional().default("WEB").describe("Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER"),batchSize:l.number().int().min(1).max(2e3).describe("Maximum number of events to batch before sending (max 2000, like 100)").optional(),batchInterval:l.number().int().min(0).describe("Time in milliseconds to wait before auto-flushing batch (like 5000)").optional(),validateOnly:l.boolean().describe("If true, validate request without ingestion (testing mode)").optional(),url:l.string().url().describe("Override API endpoint for testing (like https://datamanager.googleapis.com/v1)").optional(),consent:s.describe("Request-level consent for all events").optional(),testEventCode:l.string().describe("Test event code for debugging (like TEST12345)").optional(),logLevel:l.enum(["debug","info","warn","error","none"]).describe("Log level for debugging (debug shows all API calls)").optional(),userData:l.record(l.string(),l.unknown()).describe("Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })").optional(),userId:l.any().describe("Guided helper: First-party user ID for all events (like 'user.id')").optional(),clientId:l.any().describe("Guided helper: GA4 client ID for all events (like 'user.device')").optional(),sessionAttributes:l.any().describe("Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')").optional(),consentAdUserData:l.union([l.string(),l.boolean()]).describe("Consent mapping: Field name from event.consent (like 'marketing') or static boolean value").optional(),consentAdPersonalization:l.union([l.string(),l.boolean()]).describe("Consent mapping: Field name from event.consent (like 'targeting') or static boolean value").optional()});import{z as m}from"@walkeros/core/dev";var v=m.object({});import{zodToSchema as g}from"@walkeros/core/dev";var b=g(p),f=g(v),h={};t(h,{env:()=>y,step:()=>A});var y={};t(y,{push:()=>I,simulation:()=>E});var I={fetch:async function(){return{ok:!0,status:200,json:async()=>({requestId:"mock-request-id",validationErrors:[]}),text:async()=>""}},authClient:{getAccessToken:async()=>({token:"ya29.c.test_token"})}},E=["fetch"],A={};t(A,{ga4PageView:()=>P,lead:()=>T,purchase:()=>S});import{getEvent as D}from"@walkeros/core";var O="https://datamanager.googleapis.com/v1/events:ingest",k=[{operatingAccount:{accountId:"123-456-7890",accountType:"GOOGLE_ADS"},productDestinationId:"AW-CONVERSION-123"}],_=e=>({method:"POST",headers:{Authorization:"Bearer ya29.c.test_token","Content-Type":"application/json"},body:e}),S={title:"Purchase",description:"A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.",in:D("order complete",{timestamp:17000009e5,data:{id:"ORD-600",total:149.99,currency:"EUR"},user:{id:"user-abc",email:"buyer@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"purchase",data:{map:{transactionId:"data.id",conversionValue:"data.total",currency:{key:"data.currency",value:"USD"},eventName:{value:"purchase"},userId:"user.id",email:"user.email"}}},out:[["fetch",O,_(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:20.000Z",transactionId:"ORD-600",userId:"user-abc",userData:{userIdentifiers:[{emailAddress:"6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd"}]},conversionValue:149.99,currency:"EUR",eventName:"purchase",eventSource:"WEB"}],destinations:k}))]]},T={title:"Lead",description:"A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.",in:D("form submit",{timestamp:1700000901e3,data:{type:"demo-request"},user:{email:"prospect@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"generate_lead",data:{map:{transactionId:"id",eventName:{value:"generate_lead"},conversionValue:{value:10},currency:{value:"USD"},email:"user.email"}}},out:[["fetch",O,_(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:21.000Z",transactionId:"1700000901000-gr0up-1",userData:{userIdentifiers:[{emailAddress:"395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642"}]},conversionValue:10,currency:"USD",eventName:"generate_lead",eventSource:"WEB"}],destinations:k}))]]},P={title:"Page view",description:"A page view is sent to Data Manager as a page_view event tied to the walker user id.",in:D("page view",{timestamp:1700000902e3,data:{title:"Pricing",url:"https://example.com/pricing"},user:{id:"visitor-55"},source:{type:"server",id:"",previous_id:""}}),mapping:{name:"page_view",data:{map:{transactionId:"id",eventName:{value:"page_view"},userId:"user.id"}}},out:[["fetch",O,_(JSON.stringify({events:[{eventTimestamp:"2023-11-14T22:28:22.000Z",transactionId:"1700000902000-gr0up-1",userId:"visitor-55",eventName:"page_view",eventSource:"WEB"}],destinations:k}))]]};export{h as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas.ts","../src/schemas/primitives.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './schemas/index';\n","import { z } from '@walkeros/core/dev';\n\nexport const AccountTypeSchema = z.enum([\n 'GOOGLE_ADS',\n 'DISPLAY_VIDEO_ADVERTISER',\n 'DISPLAY_VIDEO_PARTNER',\n 'GOOGLE_ANALYTICS_PROPERTY',\n]);\n\nexport const EventSourceSchema = z.enum([\n 'WEB',\n 'APP',\n 'IN_STORE',\n 'PHONE',\n 'OTHER',\n]);\n\nexport const ConsentStatusSchema = z.enum([\n 'CONSENT_GRANTED',\n 'CONSENT_DENIED',\n]);\n\nexport const ConsentSchema = z.object({\n adUserData: ConsentStatusSchema.describe(\n 'Consent for data collection and use',\n ).optional(),\n adPersonalization: ConsentStatusSchema.describe(\n 'Consent for ad personalization',\n ).optional(),\n});\n\nexport const OperatingAccountSchema = z.object({\n accountId: z\n .string()\n .min(1)\n .describe('Account ID (e.g., \"123-456-7890\" for Google Ads)'),\n accountType: AccountTypeSchema.describe('Type of account'),\n});\n\nexport const DestinationSchema = z.object({\n operatingAccount: OperatingAccountSchema.describe(\n 'Operating account details',\n ),\n productDestinationId: z\n .string()\n .min(1)\n .describe(\n 'Product-specific destination ID (conversion action or user list)',\n ),\n});\n","import { z } from '@walkeros/core/dev';\nimport {\n DestinationSchema,\n EventSourceSchema,\n ConsentSchema,\n} from './primitives';\n\n/**\n * Service account credentials schema\n */\nconst CredentialsSchema = z.object({\n client_email: z.string().email().describe('Service account email'),\n private_key: z\n .string()\n .min(1)\n .describe('Service account private key (PEM format)'),\n});\n\nexport const SettingsSchema = z.object({\n credentials: CredentialsSchema.optional().describe(\n 'Service account credentials (client_email + private_key). Recommended for serverless environments.',\n ),\n keyFilename: z\n .string()\n .optional()\n .describe(\n 'Path to service account JSON file. For local development or environments with filesystem access.',\n ),\n scopes: z\n .array(z.string())\n .optional()\n .describe(\n 'OAuth scopes for Data Manager API. Defaults to datamanager scope.',\n ),\n destinations: z\n .array(DestinationSchema)\n .min(1)\n .max(10)\n .describe(\n 'Array of destination accounts and conversion actions/user lists (max 10)',\n ),\n eventSource: EventSourceSchema.optional()\n .default('WEB')\n .describe(\n 'Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER',\n ),\n batchSize: z\n .number()\n .int()\n .min(1)\n .max(2000)\n .describe(\n 'Maximum number of events to batch before sending (max 2000, like 100)',\n )\n .optional(),\n batchInterval: z\n .number()\n .int()\n .min(0)\n .describe(\n 'Time in milliseconds to wait before auto-flushing batch (like 5000)',\n )\n .optional(),\n validateOnly: z\n .boolean()\n .describe('If true, validate request without ingestion (testing mode)')\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Override API endpoint for testing (like https://datamanager.googleapis.com/v1)',\n )\n .optional(),\n consent: ConsentSchema.describe(\n 'Request-level consent for all events',\n ).optional(),\n testEventCode: z\n .string()\n .describe('Test event code for debugging (like TEST12345)')\n .optional(),\n logLevel: z\n .enum(['debug', 'info', 'warn', 'error', 'none'])\n .describe('Log level for debugging (debug shows all API calls)')\n .optional(),\n userData: z\n .record(z.string(), z.unknown())\n .describe(\n \"Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })\",\n )\n .optional(),\n userId: z\n .any()\n .describe(\n \"Guided helper: First-party user ID for all events (like 'user.id')\",\n )\n .optional(),\n clientId: z\n .any()\n .describe(\n \"Guided helper: GA4 client ID for all events (like 'user.device')\",\n )\n .optional(),\n sessionAttributes: z\n .any()\n .describe(\n \"Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')\",\n )\n .optional(),\n consentAdUserData: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'marketing') or static boolean value\",\n )\n .optional(),\n consentAdPersonalization: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'targeting') or static boolean value\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n// Data Manager uses flexible mapping via walkerOS mapping system\n// No event-specific mapping schema needed (similar to Meta CAPI pattern)\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * from './primitives';\nexport * from './settings';\nexport * from './mapping';\n\nimport { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","export * as env from './env';\nexport * as step from './step';\n","import type { OAuth2Client } from 'google-auth-library';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Google Data Manager destination.\n *\n * The destination invokes `env.fetch(url, { method, headers, body })` once\n * per push, with `Authorization: Bearer <accessToken>` obtained from\n * `env.authClient` via `getAccessToken`.\n *\n * For tests we use a stub `authClient` (jest mocks the `getAccessToken`\n * helper at module level) and a mock `fetch` returning a successful ingest\n * response.\n */\n\nasync function mockFetch(): Promise<Response> {\n return {\n ok: true,\n status: 200,\n json: async () => ({ requestId: 'mock-request-id', validationErrors: [] }),\n text: async () => '',\n } as unknown as Response;\n}\n\nconst mockAuthClient = {\n getAccessToken: async () => ({ token: 'ya29.c.test_token' }),\n} as unknown as OAuth2Client;\n\nexport const push: Env = {\n fetch: mockFetch,\n authClient: mockAuthClient,\n};\n\nexport const simulation = ['fetch'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Google Data Manager step examples.\n *\n * At push time, the destination calls\n * `env.fetch(url, { method, headers, body })` where:\n * - `url` is `${settings.url}/events:ingest` (default\n * `https://datamanager.googleapis.com/v1`)\n * - `method` is `'POST'`\n * - `headers` is `{ Authorization: 'Bearer <accessToken>', 'Content-Type': 'application/json' }`\n * - `body` is the JSON-stringified `{ events: [dataManagerEvent], destinations }` payload\n *\n * The access token is obtained from `env.authClient` via `getAccessToken`.\n * The test fixture mocks both so the captured Authorization header is stable\n * (`Bearer ya29.c.test_token`).\n *\n * Event fields are emitted in the order the destination constructs them\n * (insertion order matters for `JSON.stringify` string equality):\n * eventTimestamp, transactionId?, clientId?, userId?, userData?,\n * adIdentifiers?, conversionValue?, currency?, cartData?, eventName?,\n * [eventSource is appended last by push.ts when not already present].\n *\n * Emails are normalized (trim, lowercase, strip dots for Gmail) and hashed\n * with SHA-256.\n */\nconst ENDPOINT = 'https://datamanager.googleapis.com/v1/events:ingest';\nconst DESTINATIONS = [\n {\n operatingAccount: {\n accountId: '123-456-7890',\n accountType: 'GOOGLE_ADS',\n },\n productDestinationId: 'AW-CONVERSION-123',\n },\n];\nconst INIT_OPTIONS = (body: string) => ({\n method: 'POST',\n headers: {\n Authorization: 'Bearer ya29.c.test_token',\n 'Content-Type': 'application/json',\n },\n body,\n});\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-600', total: 149.99, currency: 'EUR' },\n user: { id: 'user-abc', email: 'buyer@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n transactionId: 'data.id',\n conversionValue: 'data.total',\n currency: { key: 'data.currency', value: 'USD' },\n eventName: { value: 'purchase' },\n userId: 'user.id',\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:20.000Z',\n transactionId: 'ORD-600',\n userId: 'user-abc',\n userData: {\n userIdentifiers: [\n {\n // sha256('buyer@example.com')\n emailAddress:\n '6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd',\n },\n ],\n },\n conversionValue: 149.99,\n currency: 'EUR',\n eventName: 'purchase',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000901000,\n data: { type: 'demo-request' },\n user: { email: 'prospect@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'generate_lead',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'generate_lead' },\n conversionValue: { value: 10 },\n currency: { value: 'USD' },\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:21.000Z',\n transactionId: '1700000901000-gr0up-1',\n userData: {\n userIdentifiers: [\n {\n // sha256('prospect@example.com')\n emailAddress:\n '395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642',\n },\n ],\n },\n conversionValue: 10,\n currency: 'USD',\n eventName: 'generate_lead',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const ga4PageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902000,\n data: { title: 'Pricing', url: 'https://example.com/pricing' },\n user: { id: 'visitor-55' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'page_view',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'page_view' },\n userId: 'user.id',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:22.000Z',\n transactionId: '1700000902000-gr0up-1',\n userId: 'visitor-55',\n eventName: 'page_view',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,SAAS;AAEX,IAAM,oBAAoB,EAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,oBAAoB,EAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,sBAAsB,EAAE,KAAK;AAAA,EACxC;AAAA,EACA;AACF,CAAC;AAEM,IAAM,gBAAgB,EAAE,OAAO;AAAA,EACpC,YAAY,oBAAoB;AAAA,IAC9B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,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,cAAgC;AAAA,EAC3C,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,WAAW,KAAK,8BAA8B;AAAA,IAC7D,MAAM,EAAE,IAAI,aAAa;AAAA,IACzB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,eAAe;AAAA,QACf,WAAW,EAAE,OAAO,YAAY;AAAA,QAChC,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK,UAAU;AAAA,UACb,QAAQ;AAAA,YACN;AAAA,cACE,gBAAgB;AAAA,cAChB,eAAe;AAAA,cACf,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
1
+ {"version":3,"sources":["../src/schemas.ts","../src/schemas/primitives.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './schemas/index';\n","import { z } from '@walkeros/core/dev';\n\nexport const AccountTypeSchema = z.enum([\n 'GOOGLE_ADS',\n 'DISPLAY_VIDEO_ADVERTISER',\n 'DISPLAY_VIDEO_PARTNER',\n 'GOOGLE_ANALYTICS_PROPERTY',\n]);\n\nexport const EventSourceSchema = z.enum([\n 'WEB',\n 'APP',\n 'IN_STORE',\n 'PHONE',\n 'OTHER',\n]);\n\nexport const ConsentStatusSchema = z.enum([\n 'CONSENT_GRANTED',\n 'CONSENT_DENIED',\n]);\n\nexport const ConsentSchema = z.object({\n adUserData: ConsentStatusSchema.describe(\n 'Consent for data collection and use',\n ).optional(),\n adPersonalization: ConsentStatusSchema.describe(\n 'Consent for ad personalization',\n ).optional(),\n});\n\nexport const OperatingAccountSchema = z.object({\n accountId: z\n .string()\n .min(1)\n .describe('Account ID (e.g., \"123-456-7890\" for Google Ads)'),\n accountType: AccountTypeSchema.describe('Type of account'),\n});\n\nexport const DestinationSchema = z.object({\n operatingAccount: OperatingAccountSchema.describe(\n 'Operating account details',\n ),\n productDestinationId: z\n .string()\n .min(1)\n .describe(\n 'Product-specific destination ID (conversion action or user list)',\n ),\n});\n","import { z } from '@walkeros/core/dev';\nimport {\n DestinationSchema,\n EventSourceSchema,\n ConsentSchema,\n} from './primitives';\n\n/**\n * Service account credentials schema\n */\nconst CredentialsSchema = z.object({\n client_email: z.string().email().describe('Service account email'),\n private_key: z\n .string()\n .min(1)\n .describe('Service account private key (PEM format)'),\n});\n\nexport const SettingsSchema = z.object({\n credentials: CredentialsSchema.optional().describe(\n 'Service account credentials (client_email + private_key). Recommended for serverless environments.',\n ),\n keyFilename: z\n .string()\n .optional()\n .describe(\n 'Path to service account JSON file. For local development or environments with filesystem access.',\n ),\n scopes: z\n .array(z.string())\n .optional()\n .describe(\n 'OAuth scopes for Data Manager API. Defaults to datamanager scope.',\n ),\n destinations: z\n .array(DestinationSchema)\n .min(1)\n .max(10)\n .describe(\n 'Array of destination accounts and conversion actions/user lists (max 10)',\n ),\n eventSource: EventSourceSchema.optional()\n .default('WEB')\n .describe(\n 'Event source for all events. Defaults to WEB. Values: WEB, APP, IN_STORE, PHONE, OTHER',\n ),\n batchSize: z\n .number()\n .int()\n .min(1)\n .max(2000)\n .describe(\n 'Maximum number of events to batch before sending (max 2000, like 100)',\n )\n .optional(),\n batchInterval: z\n .number()\n .int()\n .min(0)\n .describe(\n 'Time in milliseconds to wait before auto-flushing batch (like 5000)',\n )\n .optional(),\n validateOnly: z\n .boolean()\n .describe('If true, validate request without ingestion (testing mode)')\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Override API endpoint for testing (like https://datamanager.googleapis.com/v1)',\n )\n .optional(),\n consent: ConsentSchema.describe(\n 'Request-level consent for all events',\n ).optional(),\n testEventCode: z\n .string()\n .describe('Test event code for debugging (like TEST12345)')\n .optional(),\n logLevel: z\n .enum(['debug', 'info', 'warn', 'error', 'none'])\n .describe('Log level for debugging (debug shows all API calls)')\n .optional(),\n userData: z\n .record(z.string(), z.unknown())\n .describe(\n \"Guided helper: User data mapping for all events (like { email: 'user.id', phone: 'data.phone' })\",\n )\n .optional(),\n userId: z\n .any()\n .describe(\n \"Guided helper: First-party user ID for all events (like 'user.id')\",\n )\n .optional(),\n clientId: z\n .any()\n .describe(\n \"Guided helper: GA4 client ID for all events (like 'user.device')\",\n )\n .optional(),\n sessionAttributes: z\n .any()\n .describe(\n \"Guided helper: Privacy-safe attribution for all events (like 'context.sessionAttributes')\",\n )\n .optional(),\n consentAdUserData: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'marketing') or static boolean value\",\n )\n .optional(),\n consentAdPersonalization: z\n .union([z.string(), z.boolean()])\n .describe(\n \"Consent mapping: Field name from event.consent (like 'targeting') or static boolean value\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n// Data Manager uses flexible mapping via walkerOS mapping system\n// No event-specific mapping schema needed (similar to Meta CAPI pattern)\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * from './primitives';\nexport * from './settings';\nexport * from './mapping';\n\nimport { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","export * as env from './env';\nexport * as step from './step';\n","import type { OAuth2Client } from 'google-auth-library';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Google Data Manager destination.\n *\n * The destination invokes `env.fetch(url, { method, headers, body })` once\n * per push, with `Authorization: Bearer <accessToken>` obtained from\n * `env.authClient` via `getAccessToken`.\n *\n * For tests we use a stub `authClient` (jest mocks the `getAccessToken`\n * helper at module level) and a mock `fetch` returning a successful ingest\n * response.\n */\n\nasync function mockFetch(): Promise<Response> {\n return {\n ok: true,\n status: 200,\n json: async () => ({ requestId: 'mock-request-id', validationErrors: [] }),\n text: async () => '',\n } as unknown as Response;\n}\n\nconst mockAuthClient = {\n getAccessToken: async () => ({ token: 'ya29.c.test_token' }),\n} as unknown as OAuth2Client;\n\nexport const push: Env = {\n fetch: mockFetch,\n authClient: mockAuthClient,\n};\n\nexport const simulation = ['fetch'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Google Data Manager step examples.\n *\n * At push time, the destination calls\n * `env.fetch(url, { method, headers, body })` where:\n * - `url` is `${settings.url}/events:ingest` (default\n * `https://datamanager.googleapis.com/v1`)\n * - `method` is `'POST'`\n * - `headers` is `{ Authorization: 'Bearer <accessToken>', 'Content-Type': 'application/json' }`\n * - `body` is the JSON-stringified `{ events: [dataManagerEvent], destinations }` payload\n *\n * The access token is obtained from `env.authClient` via `getAccessToken`.\n * The test fixture mocks both so the captured Authorization header is stable\n * (`Bearer ya29.c.test_token`).\n *\n * Event fields are emitted in the order the destination constructs them\n * (insertion order matters for `JSON.stringify` string equality):\n * eventTimestamp, transactionId?, clientId?, userId?, userData?,\n * adIdentifiers?, conversionValue?, currency?, cartData?, eventName?,\n * [eventSource is appended last by push.ts when not already present].\n *\n * Emails are normalized (trim, lowercase, strip dots for Gmail) and hashed\n * with SHA-256.\n */\nconst ENDPOINT = 'https://datamanager.googleapis.com/v1/events:ingest';\nconst DESTINATIONS = [\n {\n operatingAccount: {\n accountId: '123-456-7890',\n accountType: 'GOOGLE_ADS',\n },\n productDestinationId: 'AW-CONVERSION-123',\n },\n];\nconst INIT_OPTIONS = (body: string) => ({\n method: 'POST',\n headers: {\n Authorization: 'Bearer ya29.c.test_token',\n 'Content-Type': 'application/json',\n },\n body,\n});\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.',\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-600', total: 149.99, currency: 'EUR' },\n user: { id: 'user-abc', email: 'buyer@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n transactionId: 'data.id',\n conversionValue: 'data.total',\n currency: { key: 'data.currency', value: 'USD' },\n eventName: { value: 'purchase' },\n userId: 'user.id',\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:20.000Z',\n transactionId: 'ORD-600',\n userId: 'user-abc',\n userData: {\n userIdentifiers: [\n {\n // sha256('buyer@example.com')\n emailAddress:\n '6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd',\n },\n ],\n },\n conversionValue: 149.99,\n currency: 'EUR',\n eventName: 'purchase',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const lead: Flow.StepExample = {\n title: 'Lead',\n description:\n 'A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.',\n in: getEvent('form submit', {\n timestamp: 1700000901000,\n data: { type: 'demo-request' },\n user: { email: 'prospect@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'generate_lead',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'generate_lead' },\n conversionValue: { value: 10 },\n currency: { value: 'USD' },\n email: 'user.email',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:21.000Z',\n transactionId: '1700000901000-gr0up-1',\n userData: {\n userIdentifiers: [\n {\n // sha256('prospect@example.com')\n emailAddress:\n '395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642',\n },\n ],\n },\n conversionValue: 10,\n currency: 'USD',\n eventName: 'generate_lead',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n\nexport const ga4PageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is sent to Data Manager as a page_view event tied to the walker user id.',\n in: getEvent('page view', {\n timestamp: 1700000902000,\n data: { title: 'Pricing', url: 'https://example.com/pricing' },\n user: { id: 'visitor-55' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n name: 'page_view',\n data: {\n map: {\n transactionId: 'id',\n eventName: { value: 'page_view' },\n userId: 'user.id',\n },\n },\n },\n out: [\n [\n 'fetch',\n ENDPOINT,\n INIT_OPTIONS(\n JSON.stringify({\n events: [\n {\n eventTimestamp: '2023-11-14T22:28:22.000Z',\n transactionId: '1700000902000-gr0up-1',\n userId: 'visitor-55',\n eventName: 'page_view',\n eventSource: 'WEB',\n },\n ],\n destinations: DESTINATIONS,\n }),\n ),\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,SAAS;AAEX,IAAM,oBAAoB,EAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,oBAAoB,EAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,sBAAsB,EAAE,KAAK;AAAA,EACxC;AAAA,EACA;AACF,CAAC;AAEM,IAAM,gBAAgB,EAAE,OAAO;AAAA,EACpC,YAAY,oBAAoB;AAAA,IAC9B;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AA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,cAAgC;AAAA,EAC3C,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,WAAW,KAAK,8BAA8B;AAAA,IAC7D,MAAM,EAAE,IAAI,aAAa;AAAA,IACzB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,eAAe;AAAA,QACf,WAAW,EAAE,OAAO,YAAY;AAAA,QAChC,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK,UAAU;AAAA,UACb,QAAQ;AAAA,YACN;AAAA,cACE,gBAAgB;AAAA,cAChB,eAAe;AAAA,cACf,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
@@ -75,6 +75,8 @@ var INIT_OPTIONS = (body) => ({
75
75
  body
76
76
  });
77
77
  var purchase = {
78
+ title: "Purchase",
79
+ description: "A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.",
78
80
  in: (0, import_core.getEvent)("order complete", {
79
81
  timestamp: 17000009e5,
80
82
  data: { id: "ORD-600", total: 149.99, currency: "EUR" },
@@ -126,6 +128,8 @@ var purchase = {
126
128
  ]
127
129
  };
128
130
  var lead = {
131
+ title: "Lead",
132
+ description: "A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.",
129
133
  in: (0, import_core.getEvent)("form submit", {
130
134
  timestamp: 1700000901e3,
131
135
  data: { type: "demo-request" },
@@ -175,6 +179,8 @@ var lead = {
175
179
  ]
176
180
  };
177
181
  var ga4PageView = {
182
+ title: "Page view",
183
+ description: "A page view is sent to Data Manager as a page_view event tied to the walker user id.",
178
184
  in: (0, import_core.getEvent)("page view", {
179
185
  timestamp: 1700000902e3,
180
186
  data: { title: "Pricing", url: "https://example.com/pricing" },
@@ -54,6 +54,8 @@ var INIT_OPTIONS = (body) => ({
54
54
  body
55
55
  });
56
56
  var purchase = {
57
+ title: "Purchase",
58
+ description: "A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.",
57
59
  in: getEvent("order complete", {
58
60
  timestamp: 17000009e5,
59
61
  data: { id: "ORD-600", total: 149.99, currency: "EUR" },
@@ -105,6 +107,8 @@ var purchase = {
105
107
  ]
106
108
  };
107
109
  var lead = {
110
+ title: "Lead",
111
+ description: "A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.",
108
112
  in: getEvent("form submit", {
109
113
  timestamp: 1700000901e3,
110
114
  data: { type: "demo-request" },
@@ -154,6 +158,8 @@ var lead = {
154
158
  ]
155
159
  };
156
160
  var ga4PageView = {
161
+ title: "Page view",
162
+ description: "A page view is sent to Data Manager as a page_view event tied to the walker user id.",
157
163
  in: getEvent("page view", {
158
164
  timestamp: 1700000902e3,
159
165
  data: { title: "Pricing", url: "https://example.com/pricing" },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-datamanager",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -236,6 +236,8 @@
236
236
  },
237
237
  "step": {
238
238
  "ga4PageView": {
239
+ "title": "Page view",
240
+ "description": "A page view is sent to Data Manager as a page_view event tied to the walker user id.",
239
241
  "in": {
240
242
  "name": "page view",
241
243
  "data": {
@@ -284,7 +286,7 @@
284
286
  "group": "gr0up",
285
287
  "count": 1,
286
288
  "version": {
287
- "source": "3.4.0",
289
+ "source": "3.4.1",
288
290
  "tagging": 1
289
291
  },
290
292
  "source": {
@@ -321,6 +323,8 @@
321
323
  ]
322
324
  },
323
325
  "lead": {
326
+ "title": "Lead",
327
+ "description": "A demo request form submission is sent to Data Manager as a generate_lead conversion with a hashed email.",
324
328
  "in": {
325
329
  "name": "form submit",
326
330
  "data": {
@@ -368,7 +372,7 @@
368
372
  "group": "gr0up",
369
373
  "count": 1,
370
374
  "version": {
371
- "source": "3.4.0",
375
+ "source": "3.4.1",
372
376
  "tagging": 1
373
377
  },
374
378
  "source": {
@@ -411,6 +415,8 @@
411
415
  ]
412
416
  },
413
417
  "purchase": {
418
+ "title": "Purchase",
419
+ "description": "A completed order is posted to Google Data Manager as a purchase conversion with hashed user identifiers.",
414
420
  "in": {
415
421
  "name": "order complete",
416
422
  "data": {
@@ -494,7 +500,7 @@
494
500
  "group": "gr0up",
495
501
  "count": 1,
496
502
  "version": {
497
- "source": "3.4.0",
503
+ "source": "3.4.1",
498
504
  "tagging": 1
499
505
  },
500
506
  "source": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-datamanager",
3
3
  "description": "Google Data Manager server destination for walkerOS",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -34,12 +34,12 @@
34
34
  "update": "npx npm-check-updates -u && npm update"
35
35
  },
36
36
  "dependencies": {
37
- "@walkeros/core": "3.4.0",
38
- "@walkeros/server-core": "3.4.0",
37
+ "@walkeros/core": "3.4.1",
38
+ "@walkeros/server-core": "3.4.1",
39
39
  "google-auth-library": "^10.5.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@walkeros/collector": "3.4.0"
42
+ "@walkeros/collector": "3.4.1"
43
43
  },
44
44
  "repository": {
45
45
  "url": "git+https://github.com/elbwalker/walkerOS.git",