@walkeros/server-destination-datamanager 2.0.0 → 2.1.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.
@@ -4,294 +4,75 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
- // src/examples/auth.ts
8
- var auth_exports = {};
9
- __export(auth_exports, {
10
- awsLambda: () => awsLambda,
11
- customScopes: () => customScopes,
12
- dockerKubernetes: () => dockerKubernetes,
13
- gcpCloudFunctions: () => gcpCloudFunctions,
14
- localDevelopment: () => localDevelopment
7
+ // src/examples/step.ts
8
+ var step_exports = {};
9
+ __export(step_exports, {
10
+ lead: () => lead,
11
+ purchase: () => purchase
15
12
  });
16
- var awsLambda = {
17
- settings: {
18
- credentials: {
19
- client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
20
- private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
21
- },
22
- destinations: [
23
- {
24
- operatingAccount: {
25
- accountId: "123-456-7890",
26
- accountType: "GOOGLE_ADS"
27
- },
28
- productDestinationId: "AW-CONVERSION-123"
29
- }
30
- ]
31
- }
32
- };
33
- var gcpCloudFunctions = {
34
- settings: {
35
- // No auth config needed - ADC works automatically on GCP!
36
- destinations: [
37
- {
38
- operatingAccount: {
39
- accountId: "123-456-7890",
40
- accountType: "GOOGLE_ADS"
41
- },
42
- productDestinationId: "AW-CONVERSION-123"
43
- }
44
- ]
45
- }
46
- };
47
- var localDevelopment = {
48
- settings: {
49
- keyFilename: "./service-account.json",
50
- destinations: [
51
- {
52
- operatingAccount: {
53
- accountId: "123-456-7890",
54
- accountType: "GOOGLE_ADS"
55
- },
56
- productDestinationId: "AW-CONVERSION-123"
57
- }
58
- ]
59
- }
60
- };
61
- var dockerKubernetes = {
62
- settings: {
63
- // No explicit config - ADC uses GOOGLE_APPLICATION_CREDENTIALS env var
64
- destinations: [
65
- {
66
- operatingAccount: {
67
- accountId: "123-456-7890",
68
- accountType: "GOOGLE_ADS"
69
- },
70
- productDestinationId: "AW-CONVERSION-123"
71
- }
72
- ]
73
- }
74
- };
75
- var customScopes = {
76
- settings: {
77
- credentials: {
78
- client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
79
- private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
80
- },
81
- scopes: ["https://www.googleapis.com/auth/datamanager"],
82
- destinations: [
83
- {
84
- operatingAccount: {
85
- accountId: "123-456-7890",
86
- accountType: "GOOGLE_ADS"
87
- },
88
- productDestinationId: "AW-CONVERSION-123"
89
- }
90
- ]
91
- }
92
- };
93
-
94
- // src/examples/basic.ts
95
- var basic_exports = {};
96
- __export(basic_exports, {
97
- complete: () => complete,
98
- debug: () => debug,
99
- ga4: () => ga4,
100
- minimal: () => minimal
101
- });
102
- var minimal = {
103
- settings: {
104
- credentials: {
105
- client_email: "service-account@project.iam.gserviceaccount.com",
106
- private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
107
- },
108
- destinations: [
109
- {
110
- operatingAccount: {
111
- accountId: "123-456-7890",
112
- accountType: "GOOGLE_ADS"
113
- },
114
- productDestinationId: "AW-CONVERSION-123"
115
- }
116
- ]
117
- }
118
- };
119
- var complete = {
120
- settings: {
121
- credentials: {
122
- client_email: "service-account@project.iam.gserviceaccount.com",
123
- private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
124
- },
125
- destinations: [
126
- {
127
- operatingAccount: {
128
- accountId: "123-456-7890",
129
- accountType: "GOOGLE_ADS"
130
- },
131
- productDestinationId: "AW-CONVERSION-123"
132
- },
133
- {
134
- operatingAccount: {
135
- accountId: "987654321",
136
- accountType: "GOOGLE_ANALYTICS_PROPERTY"
137
- },
138
- productDestinationId: "G-XXXXXXXXXX"
139
- }
140
- ],
141
- batchSize: 100,
142
- batchInterval: 5e3,
143
- validateOnly: false,
144
- consent: {
145
- adUserData: "CONSENT_GRANTED",
146
- adPersonalization: "CONSENT_GRANTED"
147
- },
148
- // Guided helpers (apply to all events)
149
- userData: {
150
- email: "user.id",
151
- phone: "data.phone",
152
- firstName: "data.firstName",
153
- lastName: "data.lastName"
154
- },
155
- userId: "user.id",
156
- clientId: "user.device",
157
- sessionAttributes: "context.sessionAttributes"
158
- }
159
- };
160
- var ga4 = {
161
- settings: {
162
- destinations: [
163
- {
164
- operatingAccount: {
165
- accountId: "123456789",
166
- accountType: "GOOGLE_ANALYTICS_PROPERTY"
167
- },
168
- productDestinationId: "G-XXXXXXXXXX"
13
+ import { getEvent } from "@walkeros/core";
14
+ var purchase = {
15
+ in: getEvent("order complete", {
16
+ timestamp: 1700001200,
17
+ data: { id: "ORD-600", total: 149.99, currency: "EUR" },
18
+ user: { id: "user-abc", email: "buyer@example.com" },
19
+ source: { type: "server", id: "", previous_id: "" }
20
+ }),
21
+ mapping: {
22
+ name: "purchase",
23
+ data: {
24
+ map: {
25
+ transactionId: "data.id",
26
+ conversionValue: "data.total",
27
+ currency: { key: "data.currency", value: "USD" },
28
+ eventName: { value: "purchase" },
29
+ userId: "user.id",
30
+ email: "user.id"
169
31
  }
170
- ]
171
- }
172
- };
173
- var debug = {
174
- settings: {
175
- keyFilename: "./service-account.json",
176
- destinations: [
32
+ }
33
+ },
34
+ out: {
35
+ events: [
177
36
  {
178
- operatingAccount: {
179
- accountId: "123-456-7890",
180
- accountType: "GOOGLE_ADS"
181
- },
182
- productDestinationId: "AW-CONVERSION-123"
37
+ transactionId: "ORD-600",
38
+ eventName: "purchase",
39
+ eventSource: "WEB",
40
+ conversionValue: 149.99,
41
+ currency: "EUR",
42
+ userId: "user-abc",
43
+ email: "buyer@example.com"
183
44
  }
184
45
  ]
185
46
  }
186
47
  };
187
-
188
- // src/examples/mapping.ts
189
- var mapping_exports = {};
190
- __export(mapping_exports, {
191
- Lead: () => Lead,
192
- PageView: () => PageView,
193
- Purchase: () => Purchase,
194
- mapping: () => mapping,
195
- userDataMapping: () => userDataMapping
196
- });
197
- import { isObject } from "@walkeros/core";
198
- var Purchase = {
199
- name: "purchase",
200
- data: {
201
- map: {
202
- // Required fields
203
- transactionId: "data.id",
204
- conversionValue: "data.total",
205
- currency: { key: "data.currency", value: "USD" },
206
- eventName: { value: "purchase" },
207
- // User identification
208
- userId: "user.id",
209
- email: "user.id",
210
- // Will be hashed automatically
211
- // Attribution identifiers (captured by browser source from URL)
212
- gclid: "context.gclid",
213
- // Google Click ID
214
- gbraid: "context.gbraid",
215
- // iOS attribution
216
- wbraid: "context.wbraid",
217
- // Web-to-app
218
- // Shopping cart data
219
- cartData: {
220
- map: {
221
- items: {
222
- loop: [
223
- "nested",
224
- {
225
- condition: (entity) => isObject(entity) && entity.entity === "product",
226
- map: {
227
- merchantProductId: "data.id",
228
- price: "data.price",
229
- quantity: { key: "data.quantity", value: 1 }
230
- }
231
- }
232
- ]
233
- }
234
- }
48
+ var lead = {
49
+ in: getEvent("form submit", {
50
+ timestamp: 1700001201,
51
+ data: { type: "demo-request" },
52
+ user: { email: "prospect@example.com" },
53
+ source: { type: "server", id: "", previous_id: "" }
54
+ }),
55
+ mapping: {
56
+ name: "generate_lead",
57
+ data: {
58
+ map: {
59
+ eventName: { value: "generate_lead" },
60
+ conversionValue: { value: 10 },
61
+ currency: { value: "USD" }
235
62
  }
236
63
  }
237
- }
238
- };
239
- var Lead = {
240
- name: "generate_lead",
241
- data: {
242
- map: {
243
- eventName: { value: "generate_lead" },
244
- conversionValue: { value: 10 },
245
- currency: { value: "USD" }
246
- }
247
- }
248
- };
249
- var PageView = {
250
- name: "page_view",
251
- data: {
252
- map: {
253
- eventName: { value: "page_view" }
254
- }
255
- }
256
- };
257
- var mapping = {
258
- order: {
259
- complete: Purchase
260
64
  },
261
- lead: {
262
- submit: Lead
263
- },
264
- page: {
265
- view: PageView
266
- }
267
- };
268
- var userDataMapping = {
269
- settings: {
270
- keyFilename: "./service-account.json",
271
- destinations: [
65
+ out: {
66
+ events: [
272
67
  {
273
- operatingAccount: {
274
- accountId: "123-456-7890",
275
- accountType: "GOOGLE_ADS"
276
- },
277
- productDestinationId: "AW-CONVERSION-123"
68
+ transactionId: "1700001201-gr0up-1",
69
+ eventName: "generate_lead",
70
+ eventSource: "WEB",
71
+ email: "prospect@example.com"
278
72
  }
279
73
  ]
280
- },
281
- data: {
282
- map: {
283
- email: "user.id",
284
- phone: "data.phone",
285
- firstName: "data.firstName",
286
- lastName: "data.lastName",
287
- regionCode: "data.country",
288
- postalCode: "data.zip"
289
- }
290
- },
291
- mapping
74
+ }
292
75
  };
293
76
  export {
294
- auth_exports as auth,
295
- basic_exports as basic,
296
- mapping_exports as mapping
77
+ step_exports as step
297
78
  };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { Mapping as Mapping$1, Destination as Destination$1 } from '@walkeros/core';
2
2
  import { DestinationServer } from '@walkeros/server-core';
3
3
  import { OAuth2Client } from 'google-auth-library';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { Mapping as Mapping$1, Destination as Destination$1 } from '@walkeros/core';
2
2
  import { DestinationServer } from '@walkeros/server-core';
3
3
  import { OAuth2Client } from 'google-auth-library';
4
4