@walkeros/server-destination-datamanager 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +18 -1
- package/dist/dev.d.ts +18 -1
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +17 -1
- package/dist/examples/index.d.ts +17 -1
- package/dist/examples/index.js +127 -35
- package/dist/examples/index.mjs +126 -35
- package/dist/walkerOS.json +63 -36
- package/package.json +4 -4
package/dist/dev.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { DestinationServer } from '@walkeros/server-core';
|
|
3
|
+
import { OAuth2Client } from 'google-auth-library';
|
|
2
4
|
import { Flow } from '@walkeros/core';
|
|
3
5
|
|
|
4
6
|
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
@@ -10,6 +12,20 @@ declare namespace schemas {
|
|
|
10
12
|
export { schemas_mapping as mapping, schemas_settings as settings };
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
interface Env extends DestinationServer.Env {
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
authClient?: OAuth2Client | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare const push: Env;
|
|
21
|
+
declare const simulation: string[];
|
|
22
|
+
|
|
23
|
+
declare const env_push: typeof push;
|
|
24
|
+
declare const env_simulation: typeof simulation;
|
|
25
|
+
declare namespace env {
|
|
26
|
+
export { env_push as push, env_simulation as simulation };
|
|
27
|
+
}
|
|
28
|
+
|
|
13
29
|
declare const purchase: Flow.StepExample;
|
|
14
30
|
declare const lead: Flow.StepExample;
|
|
15
31
|
declare const ga4PageView: Flow.StepExample;
|
|
@@ -21,9 +37,10 @@ declare namespace step {
|
|
|
21
37
|
export { step_ga4PageView as ga4PageView, step_lead as lead, step_purchase as purchase };
|
|
22
38
|
}
|
|
23
39
|
|
|
40
|
+
declare const index_env: typeof env;
|
|
24
41
|
declare const index_step: typeof step;
|
|
25
42
|
declare namespace index {
|
|
26
|
-
export { index_step as step };
|
|
43
|
+
export { index_env as env, index_step as step };
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
export { index as examples, schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { DestinationServer } from '@walkeros/server-core';
|
|
3
|
+
import { OAuth2Client } from 'google-auth-library';
|
|
2
4
|
import { Flow } from '@walkeros/core';
|
|
3
5
|
|
|
4
6
|
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
@@ -10,6 +12,20 @@ declare namespace schemas {
|
|
|
10
12
|
export { schemas_mapping as mapping, schemas_settings as settings };
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
interface Env extends DestinationServer.Env {
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
authClient?: OAuth2Client | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare const push: Env;
|
|
21
|
+
declare const simulation: string[];
|
|
22
|
+
|
|
23
|
+
declare const env_push: typeof push;
|
|
24
|
+
declare const env_simulation: typeof simulation;
|
|
25
|
+
declare namespace env {
|
|
26
|
+
export { env_push as push, env_simulation as simulation };
|
|
27
|
+
}
|
|
28
|
+
|
|
13
29
|
declare const purchase: Flow.StepExample;
|
|
14
30
|
declare const lead: Flow.StepExample;
|
|
15
31
|
declare const ga4PageView: Flow.StepExample;
|
|
@@ -21,9 +37,10 @@ declare namespace step {
|
|
|
21
37
|
export { step_ga4PageView as ga4PageView, step_lead as lead, step_purchase as purchase };
|
|
22
38
|
}
|
|
23
39
|
|
|
40
|
+
declare const index_env: typeof env;
|
|
24
41
|
declare const index_step: typeof step;
|
|
25
42
|
declare namespace index {
|
|
26
|
-
export { index_step as step };
|
|
43
|
+
export { index_env as env, index_step as step };
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
export { index as examples, schemas };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,
|
|
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
|
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/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 step from './step';\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700001200,\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.id',\n },\n },\n },\n out: {\n events: [\n {\n transactionId: 'ORD-600',\n eventName: 'purchase',\n eventSource: 'WEB',\n conversionValue: 149.99,\n currency: 'EUR',\n userId: 'user-abc',\n email: 'buyer@example.com',\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700001201,\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 eventName: { value: 'generate_lead' },\n conversionValue: { value: 10 },\n currency: { value: 'USD' },\n },\n },\n },\n out: {\n events: [\n {\n transactionId: '1700001201-gr0up-1',\n eventName: 'generate_lead',\n eventSource: 'WEB',\n email: 'prospect@example.com',\n },\n ],\n },\n};\n\nexport const ga4PageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700001202,\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 eventName: { value: 'page_view' },\n userId: 'user.id',\n },\n },\n },\n out: {\n events: [\n {\n transactionId: '1700001202-gr0up-1',\n eventName: 'page_view',\n eventSource: 'WEB',\n userId: 'visitor-55',\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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7D,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,WAAW,EAAE,OAAO,YAAY;AAAA,QAChC,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,QAAQ;AAAA,MACN;AAAA,QACE,eAAe;AAAA,QACf,WAAW;AAAA,QACX,aAAa;AAAA,QACb,QAAQ;AAAA,MACV;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 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;AA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;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":["import_dev","import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,
|
|
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
|
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/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 step from './step';\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700001200,\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.id',\n },\n },\n },\n out: {\n events: [\n {\n transactionId: 'ORD-600',\n eventName: 'purchase',\n eventSource: 'WEB',\n conversionValue: 149.99,\n currency: 'EUR',\n userId: 'user-abc',\n email: 'buyer@example.com',\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700001201,\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 eventName: { value: 'generate_lead' },\n conversionValue: { value: 10 },\n currency: { value: 'USD' },\n },\n },\n },\n out: {\n events: [\n {\n transactionId: '1700001201-gr0up-1',\n eventName: 'generate_lead',\n eventSource: 'WEB',\n email: 'prospect@example.com',\n },\n ],\n },\n};\n\nexport const ga4PageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700001202,\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 eventName: { value: 'page_view' },\n userId: 'user.id',\n },\n },\n },\n out: {\n events: [\n {\n transactionId: '1700001202-gr0up-1',\n eventName: 'page_view',\n eventSource: 'WEB',\n userId: 'visitor-55',\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;AAAA,EACF,EAAE,SAAS;AAAA,EACX,mBAAmB,oBAAoB;AAAA,IACrC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;AAEM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,WAAW,EACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,kDAAkD;AAAA,EAC9D,aAAa,kBAAkB,SAAS,iBAAiB;AAC3D,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,kBAAkB,uBAAuB;AAAA,IACvC;AAAA,EACF;AAAA,EACA,sBAAsB,EACnB,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;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EAAE,OAAO,YAAY;AAAA,QAChC,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,QAAQ;AAAA,MACN;AAAA,QACE,eAAe;AAAA,QACf,WAAW;AAAA,QACX,aAAa;AAAA,QACb,QAAQ;AAAA,MACV;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 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;AAAA,EACF,EAAE,SAAS;AAAA,EACX,mBAAmB,oBAAoB;AAAA,IACrC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;AAEM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,WAAW,EACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,kDAAkD;AAAA,EAC9D,aAAa,kBAAkB,SAAS,iBAAiB;AAC3D,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,kBAAkB,uBAAuB;AAAA,IACvC;AAAA,EACF;AAAA,EACA,sBAAsB,EACnB,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;ACjDD,SAAS,KAAAA,UAAS;AAUlB,IAAM,oBAAoBC,GAAE,OAAO;AAAA,EACjC,cAAcA,GAAE,OAAO,EAAE,MAAM,EAAE,SAAS,uBAAuB;AAAA,EACjE,aAAaA,GACV,OAAO,EACP,IAAI,CAAC,EACL,SAAS,0CAA0C;AACxD,CAAC;AAEM,IAAM,iBAAiBA,GAAE,OAAO;AAAA,EACrC,aAAa,kBAAkB,SAAS,EAAE;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B,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import { DestinationServer } from '@walkeros/server-core';
|
|
2
|
+
import { OAuth2Client } from 'google-auth-library';
|
|
1
3
|
import { Flow } from '@walkeros/core';
|
|
2
4
|
|
|
5
|
+
interface Env extends DestinationServer.Env {
|
|
6
|
+
fetch?: typeof fetch;
|
|
7
|
+
authClient?: OAuth2Client | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const push: Env;
|
|
11
|
+
declare const simulation: string[];
|
|
12
|
+
|
|
13
|
+
declare const env_push: typeof push;
|
|
14
|
+
declare const env_simulation: typeof simulation;
|
|
15
|
+
declare namespace env {
|
|
16
|
+
export { env_push as push, env_simulation as simulation };
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
declare const purchase: Flow.StepExample;
|
|
4
20
|
declare const lead: Flow.StepExample;
|
|
5
21
|
declare const ga4PageView: Flow.StepExample;
|
|
@@ -11,4 +27,4 @@ declare namespace step {
|
|
|
11
27
|
export { step_ga4PageView as ga4PageView, step_lead as lead, step_purchase as purchase };
|
|
12
28
|
}
|
|
13
29
|
|
|
14
|
-
export { step };
|
|
30
|
+
export { env, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import { DestinationServer } from '@walkeros/server-core';
|
|
2
|
+
import { OAuth2Client } from 'google-auth-library';
|
|
1
3
|
import { Flow } from '@walkeros/core';
|
|
2
4
|
|
|
5
|
+
interface Env extends DestinationServer.Env {
|
|
6
|
+
fetch?: typeof fetch;
|
|
7
|
+
authClient?: OAuth2Client | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const push: Env;
|
|
11
|
+
declare const simulation: string[];
|
|
12
|
+
|
|
13
|
+
declare const env_push: typeof push;
|
|
14
|
+
declare const env_simulation: typeof simulation;
|
|
15
|
+
declare namespace env {
|
|
16
|
+
export { env_push as push, env_simulation as simulation };
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
declare const purchase: Flow.StepExample;
|
|
4
20
|
declare const lead: Flow.StepExample;
|
|
5
21
|
declare const ga4PageView: Flow.StepExample;
|
|
@@ -11,4 +27,4 @@ declare namespace step {
|
|
|
11
27
|
export { step_ga4PageView as ga4PageView, step_lead as lead, step_purchase as purchase };
|
|
12
28
|
}
|
|
13
29
|
|
|
14
|
-
export { step };
|
|
30
|
+
export { env, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -20,10 +20,34 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/examples/index.ts
|
|
21
21
|
var examples_exports = {};
|
|
22
22
|
__export(examples_exports, {
|
|
23
|
+
env: () => env_exports,
|
|
23
24
|
step: () => step_exports
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(examples_exports);
|
|
26
27
|
|
|
28
|
+
// src/examples/env.ts
|
|
29
|
+
var env_exports = {};
|
|
30
|
+
__export(env_exports, {
|
|
31
|
+
push: () => push,
|
|
32
|
+
simulation: () => simulation
|
|
33
|
+
});
|
|
34
|
+
async function mockFetch() {
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
status: 200,
|
|
38
|
+
json: async () => ({ requestId: "mock-request-id", validationErrors: [] }),
|
|
39
|
+
text: async () => ""
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var mockAuthClient = {
|
|
43
|
+
getAccessToken: async () => ({ token: "ya29.c.test_token" })
|
|
44
|
+
};
|
|
45
|
+
var push = {
|
|
46
|
+
fetch: mockFetch,
|
|
47
|
+
authClient: mockAuthClient
|
|
48
|
+
};
|
|
49
|
+
var simulation = ["fetch"];
|
|
50
|
+
|
|
27
51
|
// src/examples/step.ts
|
|
28
52
|
var step_exports = {};
|
|
29
53
|
__export(step_exports, {
|
|
@@ -32,9 +56,27 @@ __export(step_exports, {
|
|
|
32
56
|
purchase: () => purchase
|
|
33
57
|
});
|
|
34
58
|
var import_core = require("@walkeros/core");
|
|
59
|
+
var ENDPOINT = "https://datamanager.googleapis.com/v1/events:ingest";
|
|
60
|
+
var DESTINATIONS = [
|
|
61
|
+
{
|
|
62
|
+
operatingAccount: {
|
|
63
|
+
accountId: "123-456-7890",
|
|
64
|
+
accountType: "GOOGLE_ADS"
|
|
65
|
+
},
|
|
66
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
var INIT_OPTIONS = (body) => ({
|
|
70
|
+
method: "POST",
|
|
71
|
+
headers: {
|
|
72
|
+
Authorization: "Bearer ya29.c.test_token",
|
|
73
|
+
"Content-Type": "application/json"
|
|
74
|
+
},
|
|
75
|
+
body
|
|
76
|
+
});
|
|
35
77
|
var purchase = {
|
|
36
78
|
in: (0, import_core.getEvent)("order complete", {
|
|
37
|
-
timestamp:
|
|
79
|
+
timestamp: 17000009e5,
|
|
38
80
|
data: { id: "ORD-600", total: 149.99, currency: "EUR" },
|
|
39
81
|
user: { id: "user-abc", email: "buyer@example.com" },
|
|
40
82
|
source: { type: "server", id: "", previous_id: "" }
|
|
@@ -48,27 +90,44 @@ var purchase = {
|
|
|
48
90
|
currency: { key: "data.currency", value: "USD" },
|
|
49
91
|
eventName: { value: "purchase" },
|
|
50
92
|
userId: "user.id",
|
|
51
|
-
email: "user.
|
|
93
|
+
email: "user.email"
|
|
52
94
|
}
|
|
53
95
|
}
|
|
54
96
|
},
|
|
55
|
-
out:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
97
|
+
out: [
|
|
98
|
+
[
|
|
99
|
+
"fetch",
|
|
100
|
+
ENDPOINT,
|
|
101
|
+
INIT_OPTIONS(
|
|
102
|
+
JSON.stringify({
|
|
103
|
+
events: [
|
|
104
|
+
{
|
|
105
|
+
eventTimestamp: "2023-11-14T22:28:20.000Z",
|
|
106
|
+
transactionId: "ORD-600",
|
|
107
|
+
userId: "user-abc",
|
|
108
|
+
userData: {
|
|
109
|
+
userIdentifiers: [
|
|
110
|
+
{
|
|
111
|
+
// sha256('buyer@example.com')
|
|
112
|
+
emailAddress: "6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
conversionValue: 149.99,
|
|
117
|
+
currency: "EUR",
|
|
118
|
+
eventName: "purchase",
|
|
119
|
+
eventSource: "WEB"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
destinations: DESTINATIONS
|
|
123
|
+
})
|
|
124
|
+
)
|
|
66
125
|
]
|
|
67
|
-
|
|
126
|
+
]
|
|
68
127
|
};
|
|
69
128
|
var lead = {
|
|
70
129
|
in: (0, import_core.getEvent)("form submit", {
|
|
71
|
-
timestamp:
|
|
130
|
+
timestamp: 1700000901e3,
|
|
72
131
|
data: { type: "demo-request" },
|
|
73
132
|
user: { email: "prospect@example.com" },
|
|
74
133
|
source: { type: "server", id: "", previous_id: "" }
|
|
@@ -77,26 +136,47 @@ var lead = {
|
|
|
77
136
|
name: "generate_lead",
|
|
78
137
|
data: {
|
|
79
138
|
map: {
|
|
139
|
+
transactionId: "id",
|
|
80
140
|
eventName: { value: "generate_lead" },
|
|
81
141
|
conversionValue: { value: 10 },
|
|
82
|
-
currency: { value: "USD" }
|
|
142
|
+
currency: { value: "USD" },
|
|
143
|
+
email: "user.email"
|
|
83
144
|
}
|
|
84
145
|
}
|
|
85
146
|
},
|
|
86
|
-
out:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
147
|
+
out: [
|
|
148
|
+
[
|
|
149
|
+
"fetch",
|
|
150
|
+
ENDPOINT,
|
|
151
|
+
INIT_OPTIONS(
|
|
152
|
+
JSON.stringify({
|
|
153
|
+
events: [
|
|
154
|
+
{
|
|
155
|
+
eventTimestamp: "2023-11-14T22:28:21.000Z",
|
|
156
|
+
transactionId: "1700000901000-gr0up-1",
|
|
157
|
+
userData: {
|
|
158
|
+
userIdentifiers: [
|
|
159
|
+
{
|
|
160
|
+
// sha256('prospect@example.com')
|
|
161
|
+
emailAddress: "395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
conversionValue: 10,
|
|
166
|
+
currency: "USD",
|
|
167
|
+
eventName: "generate_lead",
|
|
168
|
+
eventSource: "WEB"
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
destinations: DESTINATIONS
|
|
172
|
+
})
|
|
173
|
+
)
|
|
94
174
|
]
|
|
95
|
-
|
|
175
|
+
]
|
|
96
176
|
};
|
|
97
177
|
var ga4PageView = {
|
|
98
178
|
in: (0, import_core.getEvent)("page view", {
|
|
99
|
-
timestamp:
|
|
179
|
+
timestamp: 1700000902e3,
|
|
100
180
|
data: { title: "Pricing", url: "https://example.com/pricing" },
|
|
101
181
|
user: { id: "visitor-55" },
|
|
102
182
|
source: { type: "server", id: "", previous_id: "" }
|
|
@@ -105,23 +185,35 @@ var ga4PageView = {
|
|
|
105
185
|
name: "page_view",
|
|
106
186
|
data: {
|
|
107
187
|
map: {
|
|
188
|
+
transactionId: "id",
|
|
108
189
|
eventName: { value: "page_view" },
|
|
109
190
|
userId: "user.id"
|
|
110
191
|
}
|
|
111
192
|
}
|
|
112
193
|
},
|
|
113
|
-
out:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
194
|
+
out: [
|
|
195
|
+
[
|
|
196
|
+
"fetch",
|
|
197
|
+
ENDPOINT,
|
|
198
|
+
INIT_OPTIONS(
|
|
199
|
+
JSON.stringify({
|
|
200
|
+
events: [
|
|
201
|
+
{
|
|
202
|
+
eventTimestamp: "2023-11-14T22:28:22.000Z",
|
|
203
|
+
transactionId: "1700000902000-gr0up-1",
|
|
204
|
+
userId: "visitor-55",
|
|
205
|
+
eventName: "page_view",
|
|
206
|
+
eventSource: "WEB"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
destinations: DESTINATIONS
|
|
210
|
+
})
|
|
211
|
+
)
|
|
121
212
|
]
|
|
122
|
-
|
|
213
|
+
]
|
|
123
214
|
};
|
|
124
215
|
// Annotate the CommonJS export names for ESM import in node:
|
|
125
216
|
0 && (module.exports = {
|
|
217
|
+
env,
|
|
126
218
|
step
|
|
127
219
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -4,6 +4,29 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// src/examples/env.ts
|
|
8
|
+
var env_exports = {};
|
|
9
|
+
__export(env_exports, {
|
|
10
|
+
push: () => push,
|
|
11
|
+
simulation: () => simulation
|
|
12
|
+
});
|
|
13
|
+
async function mockFetch() {
|
|
14
|
+
return {
|
|
15
|
+
ok: true,
|
|
16
|
+
status: 200,
|
|
17
|
+
json: async () => ({ requestId: "mock-request-id", validationErrors: [] }),
|
|
18
|
+
text: async () => ""
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var mockAuthClient = {
|
|
22
|
+
getAccessToken: async () => ({ token: "ya29.c.test_token" })
|
|
23
|
+
};
|
|
24
|
+
var push = {
|
|
25
|
+
fetch: mockFetch,
|
|
26
|
+
authClient: mockAuthClient
|
|
27
|
+
};
|
|
28
|
+
var simulation = ["fetch"];
|
|
29
|
+
|
|
7
30
|
// src/examples/step.ts
|
|
8
31
|
var step_exports = {};
|
|
9
32
|
__export(step_exports, {
|
|
@@ -12,9 +35,27 @@ __export(step_exports, {
|
|
|
12
35
|
purchase: () => purchase
|
|
13
36
|
});
|
|
14
37
|
import { getEvent } from "@walkeros/core";
|
|
38
|
+
var ENDPOINT = "https://datamanager.googleapis.com/v1/events:ingest";
|
|
39
|
+
var DESTINATIONS = [
|
|
40
|
+
{
|
|
41
|
+
operatingAccount: {
|
|
42
|
+
accountId: "123-456-7890",
|
|
43
|
+
accountType: "GOOGLE_ADS"
|
|
44
|
+
},
|
|
45
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
var INIT_OPTIONS = (body) => ({
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: {
|
|
51
|
+
Authorization: "Bearer ya29.c.test_token",
|
|
52
|
+
"Content-Type": "application/json"
|
|
53
|
+
},
|
|
54
|
+
body
|
|
55
|
+
});
|
|
15
56
|
var purchase = {
|
|
16
57
|
in: getEvent("order complete", {
|
|
17
|
-
timestamp:
|
|
58
|
+
timestamp: 17000009e5,
|
|
18
59
|
data: { id: "ORD-600", total: 149.99, currency: "EUR" },
|
|
19
60
|
user: { id: "user-abc", email: "buyer@example.com" },
|
|
20
61
|
source: { type: "server", id: "", previous_id: "" }
|
|
@@ -28,27 +69,44 @@ var purchase = {
|
|
|
28
69
|
currency: { key: "data.currency", value: "USD" },
|
|
29
70
|
eventName: { value: "purchase" },
|
|
30
71
|
userId: "user.id",
|
|
31
|
-
email: "user.
|
|
72
|
+
email: "user.email"
|
|
32
73
|
}
|
|
33
74
|
}
|
|
34
75
|
},
|
|
35
|
-
out:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
76
|
+
out: [
|
|
77
|
+
[
|
|
78
|
+
"fetch",
|
|
79
|
+
ENDPOINT,
|
|
80
|
+
INIT_OPTIONS(
|
|
81
|
+
JSON.stringify({
|
|
82
|
+
events: [
|
|
83
|
+
{
|
|
84
|
+
eventTimestamp: "2023-11-14T22:28:20.000Z",
|
|
85
|
+
transactionId: "ORD-600",
|
|
86
|
+
userId: "user-abc",
|
|
87
|
+
userData: {
|
|
88
|
+
userIdentifiers: [
|
|
89
|
+
{
|
|
90
|
+
// sha256('buyer@example.com')
|
|
91
|
+
emailAddress: "6a6c26195c3682faa816966af789717c3bfa834eee6c599d667d2b3429c27cfd"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
conversionValue: 149.99,
|
|
96
|
+
currency: "EUR",
|
|
97
|
+
eventName: "purchase",
|
|
98
|
+
eventSource: "WEB"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
destinations: DESTINATIONS
|
|
102
|
+
})
|
|
103
|
+
)
|
|
46
104
|
]
|
|
47
|
-
|
|
105
|
+
]
|
|
48
106
|
};
|
|
49
107
|
var lead = {
|
|
50
108
|
in: getEvent("form submit", {
|
|
51
|
-
timestamp:
|
|
109
|
+
timestamp: 1700000901e3,
|
|
52
110
|
data: { type: "demo-request" },
|
|
53
111
|
user: { email: "prospect@example.com" },
|
|
54
112
|
source: { type: "server", id: "", previous_id: "" }
|
|
@@ -57,26 +115,47 @@ var lead = {
|
|
|
57
115
|
name: "generate_lead",
|
|
58
116
|
data: {
|
|
59
117
|
map: {
|
|
118
|
+
transactionId: "id",
|
|
60
119
|
eventName: { value: "generate_lead" },
|
|
61
120
|
conversionValue: { value: 10 },
|
|
62
|
-
currency: { value: "USD" }
|
|
121
|
+
currency: { value: "USD" },
|
|
122
|
+
email: "user.email"
|
|
63
123
|
}
|
|
64
124
|
}
|
|
65
125
|
},
|
|
66
|
-
out:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
126
|
+
out: [
|
|
127
|
+
[
|
|
128
|
+
"fetch",
|
|
129
|
+
ENDPOINT,
|
|
130
|
+
INIT_OPTIONS(
|
|
131
|
+
JSON.stringify({
|
|
132
|
+
events: [
|
|
133
|
+
{
|
|
134
|
+
eventTimestamp: "2023-11-14T22:28:21.000Z",
|
|
135
|
+
transactionId: "1700000901000-gr0up-1",
|
|
136
|
+
userData: {
|
|
137
|
+
userIdentifiers: [
|
|
138
|
+
{
|
|
139
|
+
// sha256('prospect@example.com')
|
|
140
|
+
emailAddress: "395ec5f334be0ab5b28568a1e7f6ed5ea80e443fb1ce3d803340586a3df46642"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
conversionValue: 10,
|
|
145
|
+
currency: "USD",
|
|
146
|
+
eventName: "generate_lead",
|
|
147
|
+
eventSource: "WEB"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
destinations: DESTINATIONS
|
|
151
|
+
})
|
|
152
|
+
)
|
|
74
153
|
]
|
|
75
|
-
|
|
154
|
+
]
|
|
76
155
|
};
|
|
77
156
|
var ga4PageView = {
|
|
78
157
|
in: getEvent("page view", {
|
|
79
|
-
timestamp:
|
|
158
|
+
timestamp: 1700000902e3,
|
|
80
159
|
data: { title: "Pricing", url: "https://example.com/pricing" },
|
|
81
160
|
user: { id: "visitor-55" },
|
|
82
161
|
source: { type: "server", id: "", previous_id: "" }
|
|
@@ -85,22 +164,34 @@ var ga4PageView = {
|
|
|
85
164
|
name: "page_view",
|
|
86
165
|
data: {
|
|
87
166
|
map: {
|
|
167
|
+
transactionId: "id",
|
|
88
168
|
eventName: { value: "page_view" },
|
|
89
169
|
userId: "user.id"
|
|
90
170
|
}
|
|
91
171
|
}
|
|
92
172
|
},
|
|
93
|
-
out:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
173
|
+
out: [
|
|
174
|
+
[
|
|
175
|
+
"fetch",
|
|
176
|
+
ENDPOINT,
|
|
177
|
+
INIT_OPTIONS(
|
|
178
|
+
JSON.stringify({
|
|
179
|
+
events: [
|
|
180
|
+
{
|
|
181
|
+
eventTimestamp: "2023-11-14T22:28:22.000Z",
|
|
182
|
+
transactionId: "1700000902000-gr0up-1",
|
|
183
|
+
userId: "visitor-55",
|
|
184
|
+
eventName: "page_view",
|
|
185
|
+
eventSource: "WEB"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
destinations: DESTINATIONS
|
|
189
|
+
})
|
|
190
|
+
)
|
|
101
191
|
]
|
|
102
|
-
|
|
192
|
+
]
|
|
103
193
|
};
|
|
104
194
|
export {
|
|
195
|
+
env_exports as env,
|
|
105
196
|
step_exports as step
|
|
106
197
|
};
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-datamanager",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -219,6 +219,21 @@
|
|
|
219
219
|
}
|
|
220
220
|
},
|
|
221
221
|
"examples": {
|
|
222
|
+
"env": {
|
|
223
|
+
"push": {
|
|
224
|
+
"fetch": {
|
|
225
|
+
"$code": "async function(){return{ok:!0,status:200,json:async()=>({requestId:\"mock-request-id\",validationErrors:[]}),text:async()=>\"\"}}"
|
|
226
|
+
},
|
|
227
|
+
"authClient": {
|
|
228
|
+
"getAccessToken": {
|
|
229
|
+
"$code": "async()=>({token:\"ya29.c.test_token\"})"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"simulation": [
|
|
234
|
+
"fetch"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
222
237
|
"step": {
|
|
223
238
|
"ga4PageView": {
|
|
224
239
|
"in": {
|
|
@@ -260,16 +275,16 @@
|
|
|
260
275
|
"consent": {
|
|
261
276
|
"functional": true
|
|
262
277
|
},
|
|
263
|
-
"id": "
|
|
278
|
+
"id": "1700000902000-gr0up-1",
|
|
264
279
|
"trigger": "load",
|
|
265
280
|
"entity": "page",
|
|
266
281
|
"action": "view",
|
|
267
|
-
"timestamp":
|
|
282
|
+
"timestamp": 1700000902000,
|
|
268
283
|
"timing": 3.14,
|
|
269
284
|
"group": "gr0up",
|
|
270
285
|
"count": 1,
|
|
271
286
|
"version": {
|
|
272
|
-
"source": "3.
|
|
287
|
+
"source": "3.4.0",
|
|
273
288
|
"tagging": 1
|
|
274
289
|
},
|
|
275
290
|
"source": {
|
|
@@ -282,6 +297,7 @@
|
|
|
282
297
|
"name": "page_view",
|
|
283
298
|
"data": {
|
|
284
299
|
"map": {
|
|
300
|
+
"transactionId": "id",
|
|
285
301
|
"eventName": {
|
|
286
302
|
"value": "page_view"
|
|
287
303
|
},
|
|
@@ -289,16 +305,20 @@
|
|
|
289
305
|
}
|
|
290
306
|
}
|
|
291
307
|
},
|
|
292
|
-
"out":
|
|
293
|
-
|
|
308
|
+
"out": [
|
|
309
|
+
[
|
|
310
|
+
"fetch",
|
|
311
|
+
"https://datamanager.googleapis.com/v1/events:ingest",
|
|
294
312
|
{
|
|
295
|
-
"
|
|
296
|
-
"
|
|
297
|
-
|
|
298
|
-
|
|
313
|
+
"method": "POST",
|
|
314
|
+
"headers": {
|
|
315
|
+
"Authorization": "Bearer ya29.c.test_token",
|
|
316
|
+
"Content-Type": "application/json"
|
|
317
|
+
},
|
|
318
|
+
"body": "{\"events\":[{\"eventTimestamp\":\"2023-11-14T22:28:22.000Z\",\"transactionId\":\"1700000902000-gr0up-1\",\"userId\":\"visitor-55\",\"eventName\":\"page_view\",\"eventSource\":\"WEB\"}],\"destinations\":[{\"operatingAccount\":{\"accountId\":\"123-456-7890\",\"accountType\":\"GOOGLE_ADS\"},\"productDestinationId\":\"AW-CONVERSION-123\"}]}"
|
|
299
319
|
}
|
|
300
320
|
]
|
|
301
|
-
|
|
321
|
+
]
|
|
302
322
|
},
|
|
303
323
|
"lead": {
|
|
304
324
|
"in": {
|
|
@@ -339,16 +359,16 @@
|
|
|
339
359
|
"consent": {
|
|
340
360
|
"functional": true
|
|
341
361
|
},
|
|
342
|
-
"id": "
|
|
362
|
+
"id": "1700000901000-gr0up-1",
|
|
343
363
|
"trigger": "test",
|
|
344
364
|
"entity": "form",
|
|
345
365
|
"action": "submit",
|
|
346
|
-
"timestamp":
|
|
366
|
+
"timestamp": 1700000901000,
|
|
347
367
|
"timing": 3.14,
|
|
348
368
|
"group": "gr0up",
|
|
349
369
|
"count": 1,
|
|
350
370
|
"version": {
|
|
351
|
-
"source": "3.
|
|
371
|
+
"source": "3.4.0",
|
|
352
372
|
"tagging": 1
|
|
353
373
|
},
|
|
354
374
|
"source": {
|
|
@@ -361,6 +381,7 @@
|
|
|
361
381
|
"name": "generate_lead",
|
|
362
382
|
"data": {
|
|
363
383
|
"map": {
|
|
384
|
+
"transactionId": "id",
|
|
364
385
|
"eventName": {
|
|
365
386
|
"value": "generate_lead"
|
|
366
387
|
},
|
|
@@ -369,20 +390,25 @@
|
|
|
369
390
|
},
|
|
370
391
|
"currency": {
|
|
371
392
|
"value": "USD"
|
|
372
|
-
}
|
|
393
|
+
},
|
|
394
|
+
"email": "user.email"
|
|
373
395
|
}
|
|
374
396
|
}
|
|
375
397
|
},
|
|
376
|
-
"out":
|
|
377
|
-
|
|
398
|
+
"out": [
|
|
399
|
+
[
|
|
400
|
+
"fetch",
|
|
401
|
+
"https://datamanager.googleapis.com/v1/events:ingest",
|
|
378
402
|
{
|
|
379
|
-
"
|
|
380
|
-
"
|
|
381
|
-
|
|
382
|
-
|
|
403
|
+
"method": "POST",
|
|
404
|
+
"headers": {
|
|
405
|
+
"Authorization": "Bearer ya29.c.test_token",
|
|
406
|
+
"Content-Type": "application/json"
|
|
407
|
+
},
|
|
408
|
+
"body": "{\"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\":[{\"operatingAccount\":{\"accountId\":\"123-456-7890\",\"accountType\":\"GOOGLE_ADS\"},\"productDestinationId\":\"AW-CONVERSION-123\"}]}"
|
|
383
409
|
}
|
|
384
410
|
]
|
|
385
|
-
|
|
411
|
+
]
|
|
386
412
|
},
|
|
387
413
|
"purchase": {
|
|
388
414
|
"in": {
|
|
@@ -459,16 +485,16 @@
|
|
|
459
485
|
"consent": {
|
|
460
486
|
"functional": true
|
|
461
487
|
},
|
|
462
|
-
"id": "
|
|
488
|
+
"id": "1700000900000-gr0up-1",
|
|
463
489
|
"trigger": "load",
|
|
464
490
|
"entity": "order",
|
|
465
491
|
"action": "complete",
|
|
466
|
-
"timestamp":
|
|
492
|
+
"timestamp": 1700000900000,
|
|
467
493
|
"timing": 3.14,
|
|
468
494
|
"group": "gr0up",
|
|
469
495
|
"count": 1,
|
|
470
496
|
"version": {
|
|
471
|
-
"source": "3.
|
|
497
|
+
"source": "3.4.0",
|
|
472
498
|
"tagging": 1
|
|
473
499
|
},
|
|
474
500
|
"source": {
|
|
@@ -491,23 +517,24 @@
|
|
|
491
517
|
"value": "purchase"
|
|
492
518
|
},
|
|
493
519
|
"userId": "user.id",
|
|
494
|
-
"email": "user.
|
|
520
|
+
"email": "user.email"
|
|
495
521
|
}
|
|
496
522
|
}
|
|
497
523
|
},
|
|
498
|
-
"out":
|
|
499
|
-
|
|
524
|
+
"out": [
|
|
525
|
+
[
|
|
526
|
+
"fetch",
|
|
527
|
+
"https://datamanager.googleapis.com/v1/events:ingest",
|
|
500
528
|
{
|
|
501
|
-
"
|
|
502
|
-
"
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
"
|
|
507
|
-
"email": "buyer@example.com"
|
|
529
|
+
"method": "POST",
|
|
530
|
+
"headers": {
|
|
531
|
+
"Authorization": "Bearer ya29.c.test_token",
|
|
532
|
+
"Content-Type": "application/json"
|
|
533
|
+
},
|
|
534
|
+
"body": "{\"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\":[{\"operatingAccount\":{\"accountId\":\"123-456-7890\",\"accountType\":\"GOOGLE_ADS\"},\"productDestinationId\":\"AW-CONVERSION-123\"}]}"
|
|
508
535
|
}
|
|
509
536
|
]
|
|
510
|
-
|
|
537
|
+
]
|
|
511
538
|
}
|
|
512
539
|
}
|
|
513
540
|
}
|
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
|
+
"version": "3.4.0",
|
|
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.
|
|
38
|
-
"@walkeros/server-core": "3.
|
|
37
|
+
"@walkeros/core": "3.4.0",
|
|
38
|
+
"@walkeros/server-core": "3.4.0",
|
|
39
39
|
"google-auth-library": "^10.5.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@walkeros/collector": "3.
|
|
42
|
+
"@walkeros/collector": "3.4.0"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|