make-mp-data 1.5.55 → 1.5.56

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.
@@ -13,11 +13,25 @@
13
13
  {
14
14
  "type": "node",
15
15
  "request": "launch",
16
- "name": "run dungeon",
16
+ "name": "run dungeon (debug)",
17
17
  "runtimeExecutable": "nodemon",
18
18
  "runtimeArgs": ["--inspect", "--ignore", "./data"],
19
19
  "program": "${workspaceFolder}/index.js",
20
- "args": ["--ignore", "./data/*", "${file}"],
20
+ "args": ["${file}"],
21
+ "restart": true,
22
+ "console": "integratedTerminal",
23
+ "internalConsoleOptions": "neverOpen",
24
+ "skipFiles": ["<node_internals>/**"],
25
+ "preLaunchTask": "npm: prune",
26
+
27
+ },
28
+ {
29
+ "type": "node",
30
+ "request": "launch",
31
+ "name": "run dungeon (one shot)",
32
+ "runtimeExecutable": "node",
33
+ "program": "${workspaceFolder}/index.js",
34
+ "args": ["${file}"],
21
35
  "restart": true,
22
36
  "console": "integratedTerminal",
23
37
  "internalConsoleOptions": "neverOpen",
package/index.js CHANGED
@@ -346,7 +346,7 @@ async function main(config) {
346
346
  jobTimer.stop(false);
347
347
  const { start, end, delta, human } = jobTimer.report(false);
348
348
 
349
- if (process.env.NODE_ENV === 'dev') debugger;
349
+ // if (process.env.NODE_ENV === 'dev')debugger;
350
350
  return {
351
351
  ...STORAGE,
352
352
  importResults,
@@ -700,6 +700,8 @@ async function makeFunnel(funnel, user, firstEventTime, profile, scd, config) {
700
700
  if (!user) throw new Error("no user");
701
701
  if (!profile) profile = {};
702
702
  if (!scd) scd = {};
703
+ const sessionStartEvents = config?.events?.filter(a => a.isSessionStartEvent) || [];
704
+
703
705
 
704
706
  const chance = u.getChance();
705
707
  const { hook = async (a) => a } = config;
@@ -839,6 +841,15 @@ async function makeFunnel(funnel, user, firstEventTime, profile, scd, config) {
839
841
 
840
842
  const earliestTime = firstEventTime || dayjs(created).unix();
841
843
  let funnelStartTime;
844
+
845
+
846
+ if (sessionStartEvents.length) {
847
+ const sessionStartEvent = chance.pickone(sessionStartEvents);
848
+ sessionStartEvent.relativeTimeMs = -15000;
849
+ funnelActualEventsWithOffset.push(sessionStartEvent);
850
+ }
851
+
852
+
842
853
  let finalEvents = await Promise.all(funnelActualEventsWithOffset
843
854
  .map(async (event, index) => {
844
855
  const newEvent = await makeEvent(distinct_id, earliestTime, event, anonymousIds, sessionIds, {}, groupKeys);
@@ -858,7 +869,6 @@ async function makeFunnel(funnel, user, firstEventTime, profile, scd, config) {
858
869
  }
859
870
  }));
860
871
 
861
-
862
872
  await hook(finalEvents, "funnel-post", { user, profile, scd, funnel, config });
863
873
  return [finalEvents, doesUserConvert];
864
874
  }