@walkeros/server-destination-rudderstack 4.8.1 → 4.8.3-next-1793115089237

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.
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
+ minimal: () => minimal,
24
25
  step: () => step_exports
25
26
  });
26
27
  module.exports = __toCommonJS(examples_exports);
@@ -31,17 +32,16 @@ __export(env_exports, {
31
32
  push: () => push,
32
33
  simulation: () => simulation
33
34
  });
34
- var noop = () => {
35
- };
35
+ var sent = (_params, callback) => callback?.();
36
36
  var asyncNoop = () => Promise.resolve();
37
37
  function createMockAnalytics() {
38
38
  return {
39
- track: noop,
40
- identify: noop,
41
- group: noop,
42
- page: noop,
43
- screen: noop,
44
- alias: noop,
39
+ track: sent,
40
+ identify: sent,
41
+ group: sent,
42
+ page: sent,
43
+ screen: sent,
44
+ alias: sent,
45
45
  flush: asyncNoop
46
46
  };
47
47
  }
@@ -63,11 +63,20 @@ __export(step_exports, {
63
63
  aliasUser: () => aliasUser,
64
64
  anonymousOnly: () => anonymousOnly,
65
65
  companyGroup: () => companyGroup,
66
+ companyGroupWithoutData: () => companyGroupWithoutData,
66
67
  defaultTrack: () => defaultTrack,
67
68
  destinationIdentify: () => destinationIdentify,
68
69
  mappedEventName: () => mappedEventName,
70
+ noIdentityCompany: () => noIdentityCompany,
71
+ noIdentityLogin: () => noIdentityLogin,
72
+ noIdentityMerge: () => noIdentityMerge,
73
+ noIdentityOrder: () => noIdentityOrder,
74
+ noIdentityPage: () => noIdentityPage,
75
+ noIdentityProduct: () => noIdentityProduct,
76
+ noIdentityScreen: () => noIdentityScreen,
69
77
  pageView: () => pageView,
70
78
  screenView: () => screenView,
79
+ silentRule: () => silentRule,
71
80
  userLoginIdentify: () => userLoginIdentify,
72
81
  wildcardIgnored: () => wildcardIgnored
73
82
  });
@@ -76,18 +85,20 @@ var defaultTrack = {
76
85
  title: "Default track",
77
86
  description: "A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.",
78
87
  in: (0, import_core.getEvent)("product view", {
79
- timestamp: 1700000100,
88
+ id: "ev1700000100",
89
+ timestamp: 17000001e5,
80
90
  user: { id: "us3r", session: "s3ss10n" }
81
91
  }),
82
92
  out: [
83
93
  [
84
94
  "analytics.track",
85
95
  {
96
+ messageId: "ev1700000100",
86
97
  userId: "us3r",
87
98
  anonymousId: "s3ss10n",
88
99
  event: "product view",
89
100
  properties: {},
90
- timestamp: /* @__PURE__ */ new Date(1700000100)
101
+ timestamp: /* @__PURE__ */ new Date(17000001e5)
91
102
  }
92
103
  ]
93
104
  ]
@@ -96,7 +107,8 @@ var mappedEventName = {
96
107
  title: "Renamed event",
97
108
  description: "A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.",
98
109
  in: (0, import_core.getEvent)("order complete", {
99
- timestamp: 1700000101,
110
+ id: "ev1700000101",
111
+ timestamp: 1700000101e3,
100
112
  user: { id: "us3r", session: "s3ss10n" }
101
113
  }),
102
114
  mapping: {
@@ -106,20 +118,22 @@ var mappedEventName = {
106
118
  [
107
119
  "analytics.track",
108
120
  {
121
+ messageId: "ev1700000101",
109
122
  userId: "us3r",
110
123
  anonymousId: "s3ss10n",
111
124
  event: "Order Completed",
112
125
  properties: {},
113
- timestamp: /* @__PURE__ */ new Date(1700000101)
126
+ timestamp: /* @__PURE__ */ new Date(1700000101e3)
114
127
  }
115
128
  ]
116
129
  ]
117
130
  };
118
131
  var destinationIdentify = {
119
132
  title: "Destination identify",
120
- description: "Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.",
133
+ description: "With settings.identify mapping the email trait to 'user.email', the first push fires analytics.identify with the traits before the track call. Later pushes repeat it only when the userId or traits differ.",
121
134
  in: (0, import_core.getEvent)("page view", {
122
- timestamp: 1700000102,
135
+ id: "ev1700000102",
136
+ timestamp: 1700000102e3,
123
137
  user: { id: "us3r", session: "s3ss10n", email: "user@example.com" }
124
138
  }),
125
139
  settings: {
@@ -137,20 +151,22 @@ var destinationIdentify = {
137
151
  [
138
152
  "analytics.identify",
139
153
  {
154
+ messageId: "ev1700000102-identify",
140
155
  userId: "us3r",
141
156
  anonymousId: "s3ss10n",
142
157
  traits: { email: "user@example.com" },
143
- timestamp: /* @__PURE__ */ new Date(1700000102)
158
+ timestamp: /* @__PURE__ */ new Date(1700000102e3)
144
159
  }
145
160
  ],
146
161
  [
147
162
  "analytics.track",
148
163
  {
164
+ messageId: "ev1700000102",
149
165
  userId: "us3r",
150
166
  anonymousId: "s3ss10n",
151
167
  event: "page view",
152
168
  properties: {},
153
- timestamp: /* @__PURE__ */ new Date(1700000102)
169
+ timestamp: /* @__PURE__ */ new Date(1700000102e3)
154
170
  }
155
171
  ]
156
172
  ]
@@ -158,8 +174,10 @@ var destinationIdentify = {
158
174
  var userLoginIdentify = {
159
175
  title: "User login identify",
160
176
  description: "A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.",
161
- in: (0, import_core.getEvent)("user login", {
162
- timestamp: 1700000103,
177
+ in: (0, import_core.createEvent)({
178
+ name: "user login",
179
+ id: "ev1700000103",
180
+ timestamp: 1700000103e3,
163
181
  user: { id: "us3r", session: "s3ss10n" },
164
182
  data: {
165
183
  user_id: "new-user-123",
@@ -189,10 +207,11 @@ var userLoginIdentify = {
189
207
  [
190
208
  "analytics.identify",
191
209
  {
210
+ messageId: "ev1700000103-identify",
192
211
  userId: "new-user-123",
193
212
  anonymousId: "s3ss10n",
194
213
  traits: { email: "user@acme.com", name: "Jane Doe", plan: "premium" },
195
- timestamp: /* @__PURE__ */ new Date(1700000103)
214
+ timestamp: /* @__PURE__ */ new Date(1700000103e3)
196
215
  }
197
216
  ]
198
217
  ]
@@ -200,8 +219,10 @@ var userLoginIdentify = {
200
219
  var companyGroup = {
201
220
  title: "Group company",
202
221
  description: "A company update fires analytics.group with the groupId and group traits for B2B account tracking.",
203
- in: (0, import_core.getEvent)("company update", {
204
- timestamp: 1700000104,
222
+ in: (0, import_core.createEvent)({
223
+ name: "company update",
224
+ id: "ev1700000104",
225
+ timestamp: 1700000104e3,
205
226
  user: { id: "us3r", session: "s3ss10n" },
206
227
  data: {
207
228
  company_id: "comp-456",
@@ -231,11 +252,12 @@ var companyGroup = {
231
252
  [
232
253
  "analytics.group",
233
254
  {
255
+ messageId: "ev1700000104-group",
234
256
  userId: "us3r",
235
257
  anonymousId: "s3ss10n",
236
258
  groupId: "comp-456",
237
259
  traits: { name: "Acme", industry: "tech", employees: 50 },
238
- timestamp: /* @__PURE__ */ new Date(1700000104)
260
+ timestamp: /* @__PURE__ */ new Date(1700000104e3)
239
261
  }
240
262
  ]
241
263
  ]
@@ -244,7 +266,8 @@ var pageView = {
244
266
  title: "Page view",
245
267
  description: "A page view fires analytics.page with a resolved page name and properties instead of a generic track.",
246
268
  in: (0, import_core.getEvent)("page view", {
247
- timestamp: 1700000105,
269
+ id: "ev1700000105",
270
+ timestamp: 1700000105e3,
248
271
  user: { id: "us3r", session: "s3ss10n" },
249
272
  data: {
250
273
  title: "Getting Started",
@@ -270,11 +293,12 @@ var pageView = {
270
293
  [
271
294
  "analytics.page",
272
295
  {
296
+ messageId: "ev1700000105-page",
273
297
  userId: "us3r",
274
298
  anonymousId: "s3ss10n",
275
299
  name: "Getting Started",
276
300
  properties: { section: "tutorials" },
277
- timestamp: /* @__PURE__ */ new Date(1700000105)
301
+ timestamp: /* @__PURE__ */ new Date(1700000105e3)
278
302
  }
279
303
  ]
280
304
  ]
@@ -282,8 +306,10 @@ var pageView = {
282
306
  var screenView = {
283
307
  title: "Screen view",
284
308
  description: "A screen view from a mobile app backend fires analytics.screen with a screen name and properties.",
285
- in: (0, import_core.getEvent)("screen view", {
286
- timestamp: 1700000106,
309
+ in: (0, import_core.createEvent)({
310
+ name: "screen view",
311
+ id: "ev1700000106",
312
+ timestamp: 1700000106e3,
287
313
  user: { id: "us3r", session: "s3ss10n" },
288
314
  data: {
289
315
  screen_name: "Welcome",
@@ -310,11 +336,12 @@ var screenView = {
310
336
  [
311
337
  "analytics.screen",
312
338
  {
339
+ messageId: "ev1700000106-screen",
313
340
  userId: "us3r",
314
341
  anonymousId: "s3ss10n",
315
342
  name: "Welcome",
316
343
  properties: { build: "1.2.3" },
317
- timestamp: /* @__PURE__ */ new Date(1700000106)
344
+ timestamp: /* @__PURE__ */ new Date(1700000106e3)
318
345
  }
319
346
  ]
320
347
  ]
@@ -322,8 +349,10 @@ var screenView = {
322
349
  var aliasUser = {
323
350
  title: "Alias user",
324
351
  description: "An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.",
325
- in: (0, import_core.getEvent)("identity merge", {
326
- timestamp: 1700000107,
352
+ in: (0, import_core.createEvent)({
353
+ name: "identity merge",
354
+ id: "ev1700000107",
355
+ timestamp: 1700000107e3,
327
356
  user: { id: "registered-456", session: "s3ss10n" },
328
357
  data: {
329
358
  anonymous_id: "anonymous-123"
@@ -343,9 +372,10 @@ var aliasUser = {
343
372
  [
344
373
  "analytics.alias",
345
374
  {
375
+ messageId: "ev1700000107-alias",
346
376
  userId: "registered-456",
347
377
  previousId: "anonymous-123",
348
- timestamp: /* @__PURE__ */ new Date(1700000107)
378
+ timestamp: /* @__PURE__ */ new Date(1700000107e3)
349
379
  }
350
380
  ]
351
381
  ]
@@ -354,7 +384,8 @@ var anonymousOnly = {
354
384
  title: "Anonymous only",
355
385
  description: "When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.",
356
386
  in: (0, import_core.getEvent)("product view", {
357
- timestamp: 1700000108,
387
+ id: "ev1700000108",
388
+ timestamp: 1700000108e3,
358
389
  user: { session: "s3ss10n" }
359
390
  }),
360
391
  settings: {
@@ -364,25 +395,77 @@ var anonymousOnly = {
364
395
  [
365
396
  "analytics.track",
366
397
  {
398
+ messageId: "ev1700000108",
367
399
  anonymousId: "s3ss10n",
368
400
  event: "product view",
369
401
  properties: {},
370
- timestamp: /* @__PURE__ */ new Date(1700000108)
402
+ timestamp: /* @__PURE__ */ new Date(1700000108e3)
371
403
  }
372
404
  ]
373
405
  ]
374
406
  };
407
+ function withoutIdentity(name, timestamp) {
408
+ const [entity, action] = name.split(" ");
409
+ return {
410
+ public: false,
411
+ description: `A ${name} event without userId or anonymousId cannot be sent to RudderStack: the push fails with missing-input instead of counting as delivered.`,
412
+ in: { name, entity, action, timestamp },
413
+ out: [],
414
+ outcome: { status: "failed", code: "missing-input", retryable: false }
415
+ };
416
+ }
417
+ var noIdentityProduct = withoutIdentity("product view", 1700000110);
418
+ var noIdentityOrder = withoutIdentity("order complete", 1700000111);
419
+ var noIdentityPage = withoutIdentity("page view", 1700000112);
420
+ var noIdentityLogin = withoutIdentity("user login", 1700000113);
421
+ var noIdentityCompany = withoutIdentity("company update", 1700000114);
422
+ var noIdentityScreen = withoutIdentity("screen view", 1700000115);
423
+ var noIdentityMerge = withoutIdentity("identity merge", 1700000116);
424
+ var silentRule = {
425
+ public: false,
426
+ description: "A rule with silent: true and no identify, group, page, screen or alias mapping sends nothing to RudderStack.",
427
+ in: (0, import_core.getEvent)("page view", {
428
+ timestamp: 1700000117e3,
429
+ user: { id: "us3r", session: "s3ss10n" }
430
+ }),
431
+ mapping: { silent: true },
432
+ out: []
433
+ };
375
434
  var wildcardIgnored = {
376
435
  public: false,
377
- in: (0, import_core.getEvent)("debug noise", {
378
- timestamp: 1700000109,
436
+ in: (0, import_core.createEvent)({
437
+ name: "debug noise",
438
+ timestamp: 1700000109e3,
379
439
  user: { id: "us3r", session: "s3ss10n" }
380
440
  }),
381
441
  mapping: { ignore: true },
382
442
  out: []
383
443
  };
444
+ var companyGroupWithoutData = {
445
+ public: false,
446
+ description: "A silent group rule whose groupId finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",
447
+ in: {
448
+ name: "company update",
449
+ entity: "company",
450
+ action: "update",
451
+ timestamp: 170000012e4,
452
+ user: { id: "us3r", session: "s3ss10n" }
453
+ },
454
+ mapping: companyGroup.mapping,
455
+ out: []
456
+ };
457
+
458
+ // src/examples/minimal.ts
459
+ var minimal = {
460
+ settings: {
461
+ writeKey: "test-write-key",
462
+ dataPlaneUrl: "https://hosted.rudderlabs.com"
463
+ },
464
+ secrets: { writeKey: "RUDDERSTACK_WRITE_KEY" }
465
+ };
384
466
  // Annotate the CommonJS export names for ESM import in node:
385
467
  0 && (module.exports = {
386
468
  env,
469
+ minimal,
387
470
  step
388
471
  });