make-mp-data 1.4.5 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +25 -13
- package/{core → components}/cli.js +10 -3
- package/components/project.js +155 -0
- package/{core → components}/utils.js +81 -163
- package/index.js +1427 -0
- package/package.json +16 -10
- package/schemas/adspend.js +96 -0
- package/schemas/anon.js +3 -3
- package/schemas/big.js +160 -0
- package/schemas/business.js +327 -0
- package/schemas/complex.js +13 -6
- package/schemas/foobar.js +21 -6
- package/schemas/funnels.js +3 -3
- package/schemas/mirror.js +129 -0
- package/schemas/sanity.js +118 -0
- package/schemas/session-replay.js +136 -0
- package/schemas/simple.js +4 -4
- package/scratch.mjs +34 -9
- package/scripts/jsdoctest.js +1 -1
- package/scripts/{new.sh → new-dungeon.sh} +52 -13
- package/scripts/new-project.mjs +14 -0
- package/scripts/update-deps.sh +4 -0
- package/tests/benchmark/concurrency.mjs +52 -0
- package/tests/e2e.test.js +245 -40
- package/tests/int.test.js +619 -0
- package/tests/jest.config.js +8 -0
- package/tests/testCases.mjs +1 -1
- package/tests/testSoup.mjs +5 -4
- package/tests/unit.test.js +56 -51
- package/tsconfig.json +1 -1
- package/types.d.ts +83 -39
- package/core/index.js +0 -1013
- package/data/.gitkeep +0 -0
- package/scripts/deps.sh +0 -3
- /package/{core → components}/chart.js +0 -0
- /package/{core → components}/defaults.js +0 -0
- /package/scripts/{go.sh → run-index.sh} +0 -0
package/schemas/complex.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
const Chance = require('chance');
|
|
10
10
|
const chance = new Chance();
|
|
11
|
-
const { weighNumRange, date, integer } = require('../
|
|
11
|
+
const { weighNumRange, date, integer } = require('../components/utils.js');
|
|
12
12
|
const u = require('ak-tools');
|
|
13
13
|
|
|
14
14
|
/** @type {import('../types.js').Config} */
|
|
@@ -20,8 +20,8 @@ const config = {
|
|
|
20
20
|
numUsers: 1000, //how many users
|
|
21
21
|
format: 'csv', //csv or json
|
|
22
22
|
region: "US",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
24
|
+
hasSessionIds: true, //if true, hasSessionIds are created for each user
|
|
25
25
|
|
|
26
26
|
hasLocation: true,
|
|
27
27
|
hasAndroidDevices: true,
|
|
@@ -31,7 +31,14 @@ const config = {
|
|
|
31
31
|
hasCampaigns: true,
|
|
32
32
|
isAnonymous: false,
|
|
33
33
|
hasAdSpend: true,
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
hasAvatar: true,
|
|
36
|
+
makeChart: false,
|
|
37
|
+
|
|
38
|
+
batchSize: 500_000,
|
|
39
|
+
concurrency: 500,
|
|
40
|
+
|
|
41
|
+
funnels: [],
|
|
35
42
|
events: [
|
|
36
43
|
{
|
|
37
44
|
"event": "checkout",
|
|
@@ -164,7 +171,7 @@ const config = {
|
|
|
164
171
|
profit: { events: ["checkout"], values: [4, 2, 42, 420] },
|
|
165
172
|
watchTimeSec: {
|
|
166
173
|
events: ["watch video"],
|
|
167
|
-
values: weighNumRange(50, 1200,
|
|
174
|
+
values: weighNumRange(50, 1200, 2)
|
|
168
175
|
}
|
|
169
176
|
},
|
|
170
177
|
|
|
@@ -208,7 +215,7 @@ const config = {
|
|
|
208
215
|
"demand": ["high", "medium", "medium", "low"],
|
|
209
216
|
"supply": ["high", "medium", "medium", "low"],
|
|
210
217
|
"manufacturer": chance.company.bind(chance),
|
|
211
|
-
"price": weighNumRange(5, 500,
|
|
218
|
+
"price": weighNumRange(5, 500, .25),
|
|
212
219
|
"rating": weighNumRange(1, 5),
|
|
213
220
|
"reviews": weighNumRange(0, 35)
|
|
214
221
|
}
|
package/schemas/foobar.js
CHANGED
|
@@ -14,7 +14,7 @@ const dayjs = require("dayjs");
|
|
|
14
14
|
const utc = require("dayjs/plugin/utc");
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
const { uid, comma } = require('ak-tools');
|
|
17
|
-
const { pickAWinner, weighNumRange, date, integer } = require('../
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
|
|
18
18
|
|
|
19
19
|
const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden", "Pet", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art", "Food", "Appliances", "Office", "Wedding", "Software"];
|
|
20
20
|
|
|
@@ -29,9 +29,9 @@ const config = {
|
|
|
29
29
|
numUsers: 25000, //how many users
|
|
30
30
|
format: 'json', //csv or json
|
|
31
31
|
region: "US",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
33
|
+
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
34
|
+
|
|
35
35
|
events: [
|
|
36
36
|
{
|
|
37
37
|
event: "foo",
|
|
@@ -97,9 +97,24 @@ const config = {
|
|
|
97
97
|
|
|
98
98
|
scdProps: {},
|
|
99
99
|
mirrorProps: {},
|
|
100
|
-
groupKeys: [],
|
|
101
|
-
groupProps: {},
|
|
102
100
|
lookupTables: [],
|
|
101
|
+
groupKeys: [
|
|
102
|
+
["company_id", 1000],
|
|
103
|
+
["product_id", 10000]
|
|
104
|
+
],
|
|
105
|
+
groupProps: {
|
|
106
|
+
company_id: {
|
|
107
|
+
name: chance.company.bind(chance),
|
|
108
|
+
industry: chance.pickone.bind(chance, ["tech", "retail", "finance", "healthcare", "manufacturing", "media", "entertainment", "education", "government", "nonprofit", "other"])
|
|
109
|
+
},
|
|
110
|
+
product_id: {
|
|
111
|
+
name: chance.sentence.bind(chance, { words: 3 }),
|
|
112
|
+
category: chance.pickone.bind(chance, itemCategories),
|
|
113
|
+
price: chance.floating.bind(chance, { min: 0, max: 1000, fixed: 2 }),
|
|
114
|
+
quantity: integer
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
|
|
103
118
|
hook: function (record, type, meta) {
|
|
104
119
|
return record;
|
|
105
120
|
}
|
package/schemas/funnels.js
CHANGED
|
@@ -14,7 +14,7 @@ const dayjs = require("dayjs");
|
|
|
14
14
|
const utc = require("dayjs/plugin/utc");
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
const { uid, comma } = require('ak-tools');
|
|
17
|
-
const { pickAWinner, weighNumRange, date, integer } = require('../
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
|
|
18
18
|
|
|
19
19
|
const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden", "Pet", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art", "Food", "Appliances", "Office", "Wedding", "Software"];
|
|
20
20
|
|
|
@@ -29,8 +29,8 @@ const config = {
|
|
|
29
29
|
numUsers: 500, //how many users
|
|
30
30
|
format: 'csv', //csv or json
|
|
31
31
|
region: "US",
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
hasAnonIds: false, //if true, anonymousIds are created for each user
|
|
33
|
+
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
34
34
|
|
|
35
35
|
events: [
|
|
36
36
|
{
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the default configuration file for the data generator in SIMPLE mode
|
|
3
|
+
* notice how the config object is structured, and see it's type definition in ./types.d.ts
|
|
4
|
+
* feel free to modify this file to customize the data you generate
|
|
5
|
+
* see helper functions in utils.js for more ways to generate data
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const Chance = require('chance');
|
|
12
|
+
const chance = new Chance();
|
|
13
|
+
const dayjs = require("dayjs");
|
|
14
|
+
const utc = require("dayjs/plugin/utc");
|
|
15
|
+
dayjs.extend(utc);
|
|
16
|
+
const { uid, comma } = require('ak-tools');
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/** @type {import('../types').Config} */
|
|
21
|
+
const config = {
|
|
22
|
+
token: "",
|
|
23
|
+
seed: "mirror me",
|
|
24
|
+
numDays: 30, //how many days worth of data
|
|
25
|
+
numEvents: 10000, //how many events
|
|
26
|
+
numUsers: 1000, //how many users
|
|
27
|
+
format: 'json', //csv or json
|
|
28
|
+
region: "US",
|
|
29
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
30
|
+
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
31
|
+
|
|
32
|
+
events: [
|
|
33
|
+
{
|
|
34
|
+
event: "foo",
|
|
35
|
+
weight: 10,
|
|
36
|
+
properties: {}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
event: "bar",
|
|
40
|
+
weight: 9,
|
|
41
|
+
properties: {}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
event: "baz",
|
|
45
|
+
weight: 8,
|
|
46
|
+
properties: {}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
event: "qux",
|
|
50
|
+
weight: 7,
|
|
51
|
+
properties: {}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
event: "garply",
|
|
55
|
+
weight: 6,
|
|
56
|
+
properties: {}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
event: "durtle",
|
|
60
|
+
weight: 5,
|
|
61
|
+
properties: {}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
event: "linny",
|
|
65
|
+
weight: 4,
|
|
66
|
+
properties: {}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
event: "fonk",
|
|
70
|
+
weight: 3,
|
|
71
|
+
properties: {}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
event: "crumn",
|
|
75
|
+
weight: 2,
|
|
76
|
+
properties: {}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
event: "yak",
|
|
80
|
+
weight: 1,
|
|
81
|
+
properties: {}
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
superProps: {
|
|
85
|
+
color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
|
|
86
|
+
deleteMe: ["hello", "world", "i", "should", "be", "deleted"],
|
|
87
|
+
updateMe: weighNumRange(1, 10)
|
|
88
|
+
},
|
|
89
|
+
userProps: {
|
|
90
|
+
title: chance.profession.bind(chance),
|
|
91
|
+
luckyNumber: weighNumRange(42, 420),
|
|
92
|
+
spiritAnimal: ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
scdProps: {},
|
|
96
|
+
mirrorProps: {
|
|
97
|
+
"newlyCreated": {
|
|
98
|
+
events: "*",
|
|
99
|
+
strategy: "create",
|
|
100
|
+
values: ["fickle", "buckle", "tickle", "mackle"]
|
|
101
|
+
|
|
102
|
+
},
|
|
103
|
+
"deleteMe": {
|
|
104
|
+
events: "*",
|
|
105
|
+
strategy: "delete",
|
|
106
|
+
values: ["ignored"]
|
|
107
|
+
},
|
|
108
|
+
"fillMe": {
|
|
109
|
+
events: "*",
|
|
110
|
+
strategy: "fill",
|
|
111
|
+
values: ["deal", "with", "it"]
|
|
112
|
+
},
|
|
113
|
+
"updateMe": {
|
|
114
|
+
events: "*",
|
|
115
|
+
strategy: "update",
|
|
116
|
+
values: weighNumRange(11, 20)
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
groupKeys: [],
|
|
120
|
+
groupProps: {},
|
|
121
|
+
lookupTables: [],
|
|
122
|
+
hook: function (record, type, meta) {
|
|
123
|
+
return record;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
module.exports = config;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the default configuration file for the data generator in SIMPLE mode
|
|
3
|
+
* notice how the config object is structured, and see it's type definition in ./types.d.ts
|
|
4
|
+
* feel free to modify this file to customize the data you generate
|
|
5
|
+
* see helper functions in utils.js for more ways to generate data
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const Chance = require('chance');
|
|
12
|
+
const chance = new Chance();
|
|
13
|
+
const dayjs = require("dayjs");
|
|
14
|
+
const utc = require("dayjs/plugin/utc");
|
|
15
|
+
dayjs.extend(utc);
|
|
16
|
+
const { weighNumRange, integer } = require('../components/utils');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/** @type {import('../types').Config} */
|
|
20
|
+
const config = {
|
|
21
|
+
token: "",
|
|
22
|
+
seed: "foo bar",
|
|
23
|
+
numDays: 90, //how many days worth of data
|
|
24
|
+
numEvents: 50_000, //how many events
|
|
25
|
+
numUsers: 500, //how many users
|
|
26
|
+
format: 'json', //csv or json
|
|
27
|
+
region: "US",
|
|
28
|
+
hasAnonIds: false, //if true, anonymousIds are created for each user
|
|
29
|
+
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
30
|
+
alsoInferFunnels: true, //if true, infer funnels from events
|
|
31
|
+
makeChart: true,
|
|
32
|
+
funnels: [
|
|
33
|
+
{
|
|
34
|
+
sequence: ["qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
sequence: ["foo", "bar", "baz"],
|
|
38
|
+
isFirstFunnel: true,
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
events: [
|
|
42
|
+
{
|
|
43
|
+
event: "foo",
|
|
44
|
+
weight: 10,
|
|
45
|
+
properties: {}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
event: "bar",
|
|
49
|
+
weight: 9,
|
|
50
|
+
isFirstEvent: true,
|
|
51
|
+
properties: {}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
event: "baz",
|
|
55
|
+
weight: 8,
|
|
56
|
+
properties: {}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
event: "qux",
|
|
60
|
+
weight: 7,
|
|
61
|
+
properties: {}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
event: "garply",
|
|
65
|
+
weight: 6,
|
|
66
|
+
properties: {}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
event: "durtle",
|
|
70
|
+
weight: 5,
|
|
71
|
+
properties: {}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
event: "linny",
|
|
75
|
+
weight: 4,
|
|
76
|
+
properties: {}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
event: "fonk",
|
|
80
|
+
weight: 3,
|
|
81
|
+
properties: {}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
event: "crumn",
|
|
85
|
+
weight: 2,
|
|
86
|
+
properties: {}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
event: "yak",
|
|
90
|
+
weight: 1,
|
|
91
|
+
properties: {}
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
superProps: {
|
|
95
|
+
color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
|
|
96
|
+
number: integer,
|
|
97
|
+
|
|
98
|
+
},
|
|
99
|
+
userProps: {
|
|
100
|
+
title: chance.profession.bind(chance),
|
|
101
|
+
luckyNumber: weighNumRange(42, 420),
|
|
102
|
+
spiritAnimal: ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
scdProps: {},
|
|
106
|
+
mirrorProps: {},
|
|
107
|
+
lookupTables: [],
|
|
108
|
+
groupKeys: [],
|
|
109
|
+
groupProps: {},
|
|
110
|
+
|
|
111
|
+
hook: function (record, type, meta) {
|
|
112
|
+
return record;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
module.exports = config;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
|
|
2
|
+
const SEED = "my-seed";
|
|
3
|
+
const dayjs = require("dayjs");
|
|
4
|
+
const utc = require("dayjs/plugin/utc");
|
|
5
|
+
dayjs.extend(utc);
|
|
6
|
+
require("dotenv").config();
|
|
7
|
+
const u = require("../components/utils");
|
|
8
|
+
const v = require("ak-tools");
|
|
9
|
+
const chance = u.initChance(SEED);
|
|
10
|
+
const num_users = 1000;
|
|
11
|
+
const days = 90;
|
|
12
|
+
|
|
13
|
+
/** @type {import("../types").Config} */
|
|
14
|
+
const config = {
|
|
15
|
+
token: "0135b13525b21294e9e599a483eb35b2",
|
|
16
|
+
seed: SEED,
|
|
17
|
+
numDays: days,
|
|
18
|
+
numEvents: num_users * 100,
|
|
19
|
+
numUsers: num_users,
|
|
20
|
+
hasAnonIds: false,
|
|
21
|
+
hasSessionIds: false,
|
|
22
|
+
format: "json",
|
|
23
|
+
alsoInferFunnels: false,
|
|
24
|
+
hasLocation: true,
|
|
25
|
+
hasAndroidDevices: false,
|
|
26
|
+
hasIOSDevices: false,
|
|
27
|
+
hasDesktopDevices: true,
|
|
28
|
+
hasBrowser: true,
|
|
29
|
+
hasCampaigns: true,
|
|
30
|
+
isAnonymous: false,
|
|
31
|
+
hasAdSpend: true,
|
|
32
|
+
|
|
33
|
+
hasAvatar: true,
|
|
34
|
+
makeChart: true,
|
|
35
|
+
|
|
36
|
+
batchSize: 500_000,
|
|
37
|
+
concurrency: 500,
|
|
38
|
+
writeToDisk: false,
|
|
39
|
+
|
|
40
|
+
funnels: [
|
|
41
|
+
{
|
|
42
|
+
sequence: ["view page", "watch video", "like video"],
|
|
43
|
+
conversionRate: 25,
|
|
44
|
+
timeToConvert: 1
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
sequence: ["view page", "watch video", "dislike video"],
|
|
48
|
+
conversionRate: 20,
|
|
49
|
+
timeToConvert: 1
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
sequence: ["view page", "watch video", "comment on video"],
|
|
53
|
+
conversionRate: 15,
|
|
54
|
+
timeToConvert: 1
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
sequence: ["view page", "sign up"],
|
|
58
|
+
conversionRate: 70,
|
|
59
|
+
isFirstFunnel: true,
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
events: [
|
|
64
|
+
{
|
|
65
|
+
"event": "view page",
|
|
66
|
+
weight: 100,
|
|
67
|
+
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"event": "watch video",
|
|
71
|
+
weight: 150,
|
|
72
|
+
"properties": {
|
|
73
|
+
"watch time (mins)": u.weighNumRange(1, 60, .34)
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"event": "like video",
|
|
78
|
+
weight: 50
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"event": "dislike video",
|
|
82
|
+
weight: 40
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"event": "comment on video",
|
|
86
|
+
weight: 30
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"event": "new feature: AI Filters",
|
|
90
|
+
weight: 10
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"event": "sign up",
|
|
94
|
+
weight: 10,
|
|
95
|
+
"isFirstEvent": true,
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
superProps: {},
|
|
99
|
+
userProps: {},
|
|
100
|
+
scdProps: {},
|
|
101
|
+
mirrorProps: {},
|
|
102
|
+
groupKeys: [],
|
|
103
|
+
groupProps: {},
|
|
104
|
+
lookupTables: [],
|
|
105
|
+
hook: function (record, type, meta) {
|
|
106
|
+
const NOW = dayjs();
|
|
107
|
+
const bugStartDate = NOW.subtract(14, 'days');
|
|
108
|
+
const bugFixedDate = NOW.subtract(3, 'days');
|
|
109
|
+
const featureReleaseData = NOW.subtract(7, 'days');
|
|
110
|
+
|
|
111
|
+
if (type === "event") {
|
|
112
|
+
const EVENT_TIME = dayjs(record.time);
|
|
113
|
+
if (record.event === "new feature: AI Filters" && EVENT_TIME.isBefore(featureReleaseData)) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (type === "funnel-post") {
|
|
119
|
+
// there's a bug in Chrome where users can't complete the funnel
|
|
120
|
+
if (dayjs(record[0].time).isAfter(bugStartDate) && dayjs(record[0].time).isBefore(bugFixedDate)) {
|
|
121
|
+
if (record[0].browser === "Chrome") {
|
|
122
|
+
if (record.length > 2) {
|
|
123
|
+
record.pop(); // remove the last event
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return record;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
module.exports = config;
|
package/schemas/simple.js
CHANGED
|
@@ -14,7 +14,7 @@ const dayjs = require("dayjs");
|
|
|
14
14
|
const utc = require("dayjs/plugin/utc");
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
const { uid, comma } = require('ak-tools');
|
|
17
|
-
const { pickAWinner, weighNumRange, date, integer, weighChoices } = require('../
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer, weighChoices } = require('../components/utils');
|
|
18
18
|
|
|
19
19
|
const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden", "Pet", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art", "Food", "Appliances", "Office", "Wedding", "Software"];
|
|
20
20
|
|
|
@@ -29,10 +29,10 @@ const config = {
|
|
|
29
29
|
numUsers: 500, //how many users
|
|
30
30
|
format: 'csv', //csv or json
|
|
31
31
|
region: "US",
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
hasAnonIds: false, //if true, anonymousIds are created for each user
|
|
33
|
+
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
34
34
|
hasAdSpend: false,
|
|
35
|
-
|
|
35
|
+
makeChart: true,
|
|
36
36
|
hasLocation: true,
|
|
37
37
|
hasAndroidDevices: true,
|
|
38
38
|
hasIOSDevices: true,
|
package/scratch.mjs
CHANGED
|
@@ -1,26 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
----
|
|
3
|
+
TO DOs
|
|
4
|
+
----
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
//!feature: fixedTimeFunnel? if set this funnel will occur for all users at the same time ['cards charged', 'charge complete']
|
|
8
|
+
//!feature: churn ... is churnFunnel, possible to return, etc
|
|
9
|
+
//!feature: send SCD data to mixpanel (blocked on dev)
|
|
10
|
+
//!feature: send and map lookup tables to mixpanel (also blocked on dev)
|
|
11
|
+
//!bug: using --mc flag reverts to --complex for some reason
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import main from "./index.js";
|
|
15
|
+
|
|
3
16
|
import simple from './schemas/simple.js';
|
|
4
17
|
import funnels from './schemas/funnels.js';
|
|
5
18
|
import foobar from './schemas/foobar.js';
|
|
6
19
|
import complex from './schemas/complex.js';
|
|
7
|
-
import
|
|
20
|
+
import adspend from './schemas/adspend.js'
|
|
21
|
+
|
|
8
22
|
import anon from './schemas/anon.js';
|
|
9
23
|
import execSync from 'child_process';
|
|
10
|
-
import
|
|
24
|
+
import mirror from './schemas/mirror.js'
|
|
25
|
+
// import mds from './dungeons/modern-data-stack.js'
|
|
26
|
+
import big from './schemas/big.js'
|
|
11
27
|
|
|
28
|
+
const numEvents = 1000;
|
|
12
29
|
|
|
13
30
|
/** @type {main.Config} */
|
|
14
31
|
const spec = {
|
|
15
|
-
...
|
|
16
|
-
writeToDisk:
|
|
32
|
+
...big,
|
|
33
|
+
writeToDisk: true,
|
|
17
34
|
verbose: true,
|
|
18
|
-
makeChart: false,
|
|
35
|
+
makeChart: false,
|
|
36
|
+
// format: "csv",
|
|
37
|
+
// numEvents,
|
|
38
|
+
// numUsers: numEvents / 100,
|
|
39
|
+
|
|
19
40
|
};
|
|
20
41
|
|
|
21
42
|
|
|
22
43
|
execSync.execSync('npm run prune');
|
|
23
|
-
const
|
|
44
|
+
const RESULT = await main(spec);
|
|
45
|
+
const {
|
|
46
|
+
eventData,
|
|
24
47
|
groupProfilesData,
|
|
25
48
|
lookupTableData,
|
|
26
49
|
mirrorEventData,
|
|
@@ -29,5 +52,7 @@ const { eventData,
|
|
|
29
52
|
importResults,
|
|
30
53
|
files,
|
|
31
54
|
adSpendData
|
|
32
|
-
} =
|
|
55
|
+
} = RESULT;
|
|
56
|
+
|
|
57
|
+
|
|
33
58
|
debugger;
|
package/scripts/jsdoctest.js
CHANGED
|
@@ -13,23 +13,40 @@ const dayjs = require("dayjs");
|
|
|
13
13
|
const utc = require("dayjs/plugin/utc");
|
|
14
14
|
dayjs.extend(utc);
|
|
15
15
|
require("dotenv").config();
|
|
16
|
-
const u = require("../
|
|
16
|
+
const u = require("../components/utils");
|
|
17
17
|
const v = require("ak-tools");
|
|
18
18
|
const chance = u.initChance(SEED);
|
|
19
|
+
const num_users = 25_000
|
|
20
|
+
const days = 100
|
|
19
21
|
|
|
20
22
|
/** @type {import("../types").Config} */
|
|
21
23
|
const config = {
|
|
22
24
|
token: "",
|
|
23
25
|
seed: SEED,
|
|
24
|
-
numDays:
|
|
25
|
-
numEvents:
|
|
26
|
-
numUsers:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
numDays: days,
|
|
27
|
+
numEvents: num_users * 100,
|
|
28
|
+
numUsers: num_users,
|
|
29
|
+
hasAnonIds: false,
|
|
30
|
+
hasSessionIds: false,
|
|
31
|
+
format: "json",
|
|
32
|
+
alsoInferFunnels: true,
|
|
33
|
+
hasLocation: true,
|
|
34
|
+
hasAndroidDevices: true,
|
|
35
|
+
hasIOSDevices: true,
|
|
36
|
+
hasDesktopDevices: true,
|
|
37
|
+
hasBrowser: true,
|
|
38
|
+
hasCampaigns: true,
|
|
39
|
+
isAnonymous: false,
|
|
40
|
+
hasAdSpend: true,
|
|
41
|
+
|
|
42
|
+
hasAvatar: true,
|
|
43
|
+
makeChart: false,
|
|
44
|
+
|
|
45
|
+
batchSize: 500_000,
|
|
46
|
+
concurrency: 500,
|
|
47
|
+
writeToDisk: false,
|
|
48
|
+
|
|
49
|
+
funnels: [],
|
|
33
50
|
events: [],
|
|
34
51
|
superProps: {},
|
|
35
52
|
userProps: {},
|
|
@@ -38,9 +55,31 @@ const config = {
|
|
|
38
55
|
groupKeys: [],
|
|
39
56
|
groupProps: {},
|
|
40
57
|
lookupTables: [],
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
hook: function (record, type, meta) {
|
|
59
|
+
const NOW = dayjs.unix(global.NOW);
|
|
60
|
+
|
|
61
|
+
if (type === "event") {
|
|
62
|
+
const EVENT_TIME = dayjs(record.time);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (type === "user") {
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (type === "funnel-post") {
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (type === "funnel-pre") {
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (type === "scd") {
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return record;
|
|
82
|
+
}
|
|
44
83
|
};
|
|
45
84
|
|
|
46
85
|
module.exports = config;'
|