make-mp-data 1.4.3 → 1.4.5
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/settings.json +1 -0
- package/core/chart.js +11 -4
- package/core/cli.js +83 -5
- package/core/index.js +24 -19
- package/core/utils.js +134 -77
- package/dungeons/.gitkeep +0 -0
- package/package.json +5 -5
- package/schemas/anon.js +2 -2
- package/schemas/complex.js +22 -22
- package/schemas/foobar.js +2 -2
- package/schemas/funnels.js +10 -10
- package/schemas/simple.js +16 -30
- package/scratch.mjs +4 -7
- package/scripts/new.sh +52 -0
- package/tests/coverage/.gitkeep +0 -0
- package/tests/e2e.test.js +4 -22
- package/tests/jest.config.js +3 -2
- package/tests/unit.test.js +327 -207
- package/types.d.ts +157 -80
- package/schemas/deepNest.js +0 -106
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 {
|
|
11
|
+
const { weighNumRange, date, integer } = require('../core/utils.js');
|
|
12
12
|
const u = require('ak-tools');
|
|
13
13
|
|
|
14
14
|
/** @type {import('../types.js').Config} */
|
|
@@ -37,7 +37,7 @@ const config = {
|
|
|
37
37
|
"event": "checkout",
|
|
38
38
|
"weight": 2,
|
|
39
39
|
"properties": {
|
|
40
|
-
amount:
|
|
40
|
+
amount: weighNumRange(5, 500, .25),
|
|
41
41
|
currency: ["USD", "USD", "USD", "CAD", "EUR", "EUR", "BTC", "BTC", "ETH", "JPY"],
|
|
42
42
|
cart: makeProducts(12),
|
|
43
43
|
}
|
|
@@ -46,9 +46,9 @@ const config = {
|
|
|
46
46
|
"event": "add to cart",
|
|
47
47
|
"weight": 4,
|
|
48
48
|
"properties": {
|
|
49
|
-
amount:
|
|
49
|
+
amount: weighNumRange(5, 500, .25),
|
|
50
50
|
qty: integer(1, 5),
|
|
51
|
-
product_id:
|
|
51
|
+
product_id: weighNumRange(1, 1000, 1.4)
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
{
|
|
@@ -65,10 +65,10 @@ const config = {
|
|
|
65
65
|
"properties": {
|
|
66
66
|
category: ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"],
|
|
67
67
|
hashTags: makeHashTags,
|
|
68
|
-
watchTimeSec:
|
|
68
|
+
watchTimeSec: weighNumRange(10, 600, .25,),
|
|
69
69
|
quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
|
|
70
70
|
format: ["mp4", "avi", "mov", "mpg"],
|
|
71
|
-
video_id:
|
|
71
|
+
video_id: weighNumRange(1, 50000, 1.4),
|
|
72
72
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
@@ -76,8 +76,8 @@ const config = {
|
|
|
76
76
|
"event": "comment",
|
|
77
77
|
"weight": 2,
|
|
78
78
|
"properties": {
|
|
79
|
-
length:
|
|
80
|
-
video_id:
|
|
79
|
+
length: weighNumRange(1, 500, .25),
|
|
80
|
+
video_id: weighNumRange(1, 50000, 1.4),
|
|
81
81
|
has_replies: [true, false, false, false, false],
|
|
82
82
|
has_photo: [true, false, false, false, false],
|
|
83
83
|
|
|
@@ -87,7 +87,7 @@ const config = {
|
|
|
87
87
|
"event": "save video",
|
|
88
88
|
"weight": 4,
|
|
89
89
|
"properties": {
|
|
90
|
-
video_id:
|
|
90
|
+
video_id: weighNumRange(1, 50000, 1.4),
|
|
91
91
|
ui_control: ["toolbar", "menu", "keyboard"]
|
|
92
92
|
|
|
93
93
|
|
|
@@ -97,7 +97,7 @@ const config = {
|
|
|
97
97
|
"event": "view item",
|
|
98
98
|
"weight": 8,
|
|
99
99
|
"properties": {
|
|
100
|
-
product_id:
|
|
100
|
+
product_id: weighNumRange(1, 24, 3),
|
|
101
101
|
colors: ["light", "dark", "custom", "dark"]
|
|
102
102
|
}
|
|
103
103
|
},
|
|
@@ -105,7 +105,7 @@ const config = {
|
|
|
105
105
|
"event": "save item",
|
|
106
106
|
"weight": 5,
|
|
107
107
|
"properties": {
|
|
108
|
-
product_id:
|
|
108
|
+
product_id: weighNumRange(1, 1000, 12),
|
|
109
109
|
colors: ["light", "dark", "custom", "dark"]
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -113,7 +113,7 @@ const config = {
|
|
|
113
113
|
"event": "support ticket",
|
|
114
114
|
"weight": 2,
|
|
115
115
|
"properties": {
|
|
116
|
-
product_id:
|
|
116
|
+
product_id: weighNumRange(1, 1000, .6),
|
|
117
117
|
description: chance.sentence.bind(chance),
|
|
118
118
|
severity: ["low", "medium", "high"],
|
|
119
119
|
ticket_id: chance.guid.bind(chance)
|
|
@@ -141,7 +141,7 @@ const config = {
|
|
|
141
141
|
*/
|
|
142
142
|
userProps: {
|
|
143
143
|
title: chance.profession.bind(chance),
|
|
144
|
-
luckyNumber:
|
|
144
|
+
luckyNumber: weighNumRange(42, 420),
|
|
145
145
|
experiment: designExperiment(),
|
|
146
146
|
spiritAnimal: ["unicorn", "dragon", "phoenix", "sasquatch", "yeti", "kraken", "jackalope", "thunderbird", "mothman", "nessie", "chupacabra", "jersey devil", "bigfoot", "weindgo", "bunyip", "mokele-mbembe", "tatzelwurm", "megalodon"],
|
|
147
147
|
timezone: chance.timezone.bind(chance), // ["America/New_York", "America/Los_Angeles", "America/Chicago", "America/Denver", "America/Phoenix", "America/Anchorage", "Pacific/Honolulu"]
|
|
@@ -153,8 +153,8 @@ const config = {
|
|
|
153
153
|
/** each generates it's own table */
|
|
154
154
|
scdProps: {
|
|
155
155
|
plan: ["free", "free", "free", "free", "basic", "basic", "basic", "premium", "premium", "enterprise"],
|
|
156
|
-
MRR:
|
|
157
|
-
NPS:
|
|
156
|
+
MRR: weighNumRange(0, 10000, .15),
|
|
157
|
+
NPS: weighNumRange(0, 10, 2, 150),
|
|
158
158
|
subscribed: [true, true, true, true, true, true, false, false, false, false, "it's complicated"],
|
|
159
159
|
renewalDate: date(100, false),
|
|
160
160
|
},
|
|
@@ -164,7 +164,7 @@ const config = {
|
|
|
164
164
|
profit: { events: ["checkout"], values: [4, 2, 42, 420] },
|
|
165
165
|
watchTimeSec: {
|
|
166
166
|
events: ["watch video"],
|
|
167
|
-
values:
|
|
167
|
+
values: weighNumRange(50, 1200, 6)
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
|
|
@@ -181,7 +181,7 @@ const config = {
|
|
|
181
181
|
company_id: {
|
|
182
182
|
name: () => { return chance.company(); },
|
|
183
183
|
email: () => { return `CSM: ${chance.pickone(["AK", "Jessica", "Michelle", "Dana", "Brian", "Dave"])}`; },
|
|
184
|
-
"# of employees":
|
|
184
|
+
"# of employees": weighNumRange(3, 10000),
|
|
185
185
|
"industry": ["tech", "finance", "healthcare", "education", "government", "non-profit"],
|
|
186
186
|
"segment": ["enterprise", "SMB", "mid-market"],
|
|
187
187
|
"products": [["core"], ["core"], ["core", "add-ons"], ["core", "pro-serve"], ["core", "add-ons", "pro-serve"], ["core", "BAA", "enterprise"], ["free"], ["free"], ["free", "addons"]],
|
|
@@ -190,7 +190,7 @@ const config = {
|
|
|
190
190
|
name: () => { return `#${chance.word({ length: integer(4, 24), capitalize: true })}`; },
|
|
191
191
|
email: ["public", "private"],
|
|
192
192
|
"room provider": ["partner", "core", "core", "core"],
|
|
193
|
-
"room capacity":
|
|
193
|
+
"room capacity": weighNumRange(3, 1000000),
|
|
194
194
|
"isPublic": [true, false, false, false, false],
|
|
195
195
|
"country": chance.country.bind(chance),
|
|
196
196
|
"isVerified": [true, true, false, false, false],
|
|
@@ -208,9 +208,9 @@ const config = {
|
|
|
208
208
|
"demand": ["high", "medium", "medium", "low"],
|
|
209
209
|
"supply": ["high", "medium", "medium", "low"],
|
|
210
210
|
"manufacturer": chance.company.bind(chance),
|
|
211
|
-
"price":
|
|
212
|
-
"rating":
|
|
213
|
-
"reviews":
|
|
211
|
+
"price": weighNumRange(5, 500, 1000, .25),
|
|
212
|
+
"rating": weighNumRange(1, 5),
|
|
213
|
+
"reviews": weighNumRange(0, 35)
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
},
|
|
@@ -222,7 +222,7 @@ const config = {
|
|
|
222
222
|
copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
|
|
223
223
|
uploader_id: chance.guid.bind(chance),
|
|
224
224
|
"uploader influence": ["low", "low", "low", "medium", "medium", "high"],
|
|
225
|
-
thumbs:
|
|
225
|
+
thumbs: weighNumRange(0, 35),
|
|
226
226
|
rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
|
|
227
227
|
}
|
|
228
228
|
|
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,
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer } = require('../core/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
|
|
|
@@ -91,7 +91,7 @@ const config = {
|
|
|
91
91
|
},
|
|
92
92
|
userProps: {
|
|
93
93
|
title: chance.profession.bind(chance),
|
|
94
|
-
luckyNumber:
|
|
94
|
+
luckyNumber: weighNumRange(42, 420),
|
|
95
95
|
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"]
|
|
96
96
|
},
|
|
97
97
|
|
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,
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer } = require('../core/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
|
|
|
@@ -37,10 +37,10 @@ const config = {
|
|
|
37
37
|
event: "checkout",
|
|
38
38
|
weight: 2,
|
|
39
39
|
properties: {
|
|
40
|
-
amount:
|
|
40
|
+
amount: weighNumRange(5, 500, .25),
|
|
41
41
|
currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
|
|
42
42
|
coupon: ["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"],
|
|
43
|
-
numItems:
|
|
43
|
+
numItems: weighNumRange(1, 10),
|
|
44
44
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
@@ -48,9 +48,9 @@ const config = {
|
|
|
48
48
|
event: "add to cart",
|
|
49
49
|
weight: 4,
|
|
50
50
|
properties: {
|
|
51
|
-
amount:
|
|
52
|
-
rating:
|
|
53
|
-
reviews:
|
|
51
|
+
amount: weighNumRange(5, 500, .25),
|
|
52
|
+
rating: weighNumRange(1, 5),
|
|
53
|
+
reviews: weighNumRange(0, 35),
|
|
54
54
|
isFeaturedItem: [true, false, false],
|
|
55
55
|
itemCategory: pickAWinner(itemCategories, integer(0, 27)),
|
|
56
56
|
dateItemListed: date(30, true, 'YYYY-MM-DD'),
|
|
@@ -71,7 +71,7 @@ const config = {
|
|
|
71
71
|
properties: {
|
|
72
72
|
videoCategory: pickAWinner(videoCategories, integer(0, 9)),
|
|
73
73
|
isFeaturedItem: [true, false, false],
|
|
74
|
-
watchTimeSec:
|
|
74
|
+
watchTimeSec: weighNumRange(10, 600, .25),
|
|
75
75
|
quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
|
|
76
76
|
format: ["mp4", "avi", "mov", "mpg"],
|
|
77
77
|
uploader_id: chance.guid.bind(chance)
|
|
@@ -182,20 +182,20 @@ const config = {
|
|
|
182
182
|
*/
|
|
183
183
|
userProps: {
|
|
184
184
|
title: chance.profession.bind(chance),
|
|
185
|
-
luckyNumber:
|
|
185
|
+
luckyNumber: weighNumRange(42, 420),
|
|
186
186
|
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"]
|
|
187
187
|
},
|
|
188
188
|
|
|
189
189
|
scdProps: {
|
|
190
190
|
nps: [1, 1, 1, 4, 4, 4, 5, 5, 6, 7, 8, 9],
|
|
191
|
-
mrr: () => {
|
|
191
|
+
mrr: () => { weighNumRange(10, 1000, .25); },
|
|
192
192
|
},
|
|
193
193
|
mirrorProps: {
|
|
194
194
|
isBot: { events: "*", values: [false, false, false, false, true] },
|
|
195
195
|
profit: { events: ["checkout"], values: [4, 2, 42] },
|
|
196
196
|
watchTimeSec: {
|
|
197
197
|
events: ["watch video"],
|
|
198
|
-
values:
|
|
198
|
+
values: weighNumRange(50, 1200, 6)
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
},
|
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,
|
|
17
|
+
const { pickAWinner, weighNumRange, date, integer, weighChoices } = require('../core/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
|
|
|
@@ -40,17 +40,17 @@ const config = {
|
|
|
40
40
|
hasBrowser: true,
|
|
41
41
|
hasCampaigns: true,
|
|
42
42
|
isAnonymous: false,
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
|
|
45
45
|
events: [
|
|
46
46
|
{
|
|
47
47
|
event: "checkout",
|
|
48
48
|
weight: 2,
|
|
49
49
|
properties: {
|
|
50
|
-
amount:
|
|
51
|
-
currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
|
|
52
|
-
coupon: ["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"],
|
|
53
|
-
numItems:
|
|
50
|
+
amount: weighNumRange(5, 500, .25),
|
|
51
|
+
currency: pickAWinner(["USD", "CAD", "EUR", "BTC", "ETH", "JPY"], 0),
|
|
52
|
+
coupon: weighChoices(["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"]),
|
|
53
|
+
numItems: weighNumRange(1, 10),
|
|
54
54
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
@@ -58,21 +58,20 @@ const config = {
|
|
|
58
58
|
event: "add to cart",
|
|
59
59
|
weight: 4,
|
|
60
60
|
properties: {
|
|
61
|
-
amount:
|
|
62
|
-
rating:
|
|
63
|
-
reviews:
|
|
61
|
+
amount: weighNumRange(5, 500, .25),
|
|
62
|
+
rating: weighNumRange(1, 5),
|
|
63
|
+
reviews: weighNumRange(0, 35),
|
|
64
64
|
isFeaturedItem: [true, false, false],
|
|
65
65
|
itemCategory: pickAWinner(itemCategories, integer(0, 27)),
|
|
66
66
|
dateItemListed: date(30, true, 'YYYY-MM-DD'),
|
|
67
|
-
itemId: integer(1000, 9999),
|
|
68
67
|
}
|
|
69
68
|
},
|
|
70
69
|
{
|
|
71
70
|
event: "page view",
|
|
72
71
|
weight: 10,
|
|
73
72
|
properties: {
|
|
74
|
-
page: ["/", "/", "/help", "/account", "/watch", "/listen", "/product", "/people", "/peace"],
|
|
75
|
-
utm_source: ["$organic", "$organic", "$organic", "$organic", "google", "google", "google", "facebook", "facebook", "twitter", "linkedin"],
|
|
73
|
+
page: pickAWinner(["/", "/", "/help", "/account", "/watch", "/listen", "/product", "/people", "/peace"]),
|
|
74
|
+
utm_source: pickAWinner(["$organic", "$organic", "$organic", "$organic", "google", "google", "google", "facebook", "facebook", "twitter", "linkedin"]),
|
|
76
75
|
}
|
|
77
76
|
},
|
|
78
77
|
{
|
|
@@ -81,7 +80,7 @@ const config = {
|
|
|
81
80
|
properties: {
|
|
82
81
|
videoCategory: pickAWinner(videoCategories, integer(0, 9)),
|
|
83
82
|
isFeaturedItem: [true, false, false],
|
|
84
|
-
watchTimeSec:
|
|
83
|
+
watchTimeSec: weighNumRange(10, 600, .25),
|
|
85
84
|
quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
|
|
86
85
|
format: ["mp4", "avi", "mov", "mpg"],
|
|
87
86
|
uploader_id: chance.guid.bind(chance)
|
|
@@ -95,7 +94,6 @@ const config = {
|
|
|
95
94
|
isFeaturedItem: [true, false, false],
|
|
96
95
|
itemCategory: pickAWinner(itemCategories, integer(0, 27)),
|
|
97
96
|
dateItemListed: date(30, true, 'YYYY-MM-DD'),
|
|
98
|
-
itemId: integer(1000, 9999),
|
|
99
97
|
}
|
|
100
98
|
},
|
|
101
99
|
{
|
|
@@ -105,7 +103,6 @@ const config = {
|
|
|
105
103
|
isFeaturedItem: [true, false, false],
|
|
106
104
|
itemCategory: pickAWinner(itemCategories, integer(0, 27)),
|
|
107
105
|
dateItemListed: date(30, true, 'YYYY-MM-DD'),
|
|
108
|
-
itemId: integer(1000, 9999),
|
|
109
106
|
}
|
|
110
107
|
},
|
|
111
108
|
{
|
|
@@ -123,9 +120,7 @@ const config = {
|
|
|
123
120
|
],
|
|
124
121
|
superProps: {
|
|
125
122
|
platform: ["web", "mobile", "web", "mobile", "web", "web", "kiosk", "smartTV"],
|
|
126
|
-
currentTheme: ["light", "dark", "custom", "light", "dark"],
|
|
127
|
-
// emotions: generateEmoji(),
|
|
128
|
-
|
|
123
|
+
currentTheme: weighChoices(["light", "dark", "custom", "light", "dark"]),
|
|
129
124
|
},
|
|
130
125
|
/*
|
|
131
126
|
user properties work the same as event properties
|
|
@@ -133,20 +128,11 @@ const config = {
|
|
|
133
128
|
*/
|
|
134
129
|
userProps: {
|
|
135
130
|
title: chance.profession.bind(chance),
|
|
136
|
-
luckyNumber:
|
|
137
|
-
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"]
|
|
131
|
+
luckyNumber: weighNumRange(42, 420, .3),
|
|
132
|
+
spiritAnimal: pickAWinner(["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"])
|
|
138
133
|
},
|
|
139
|
-
|
|
140
134
|
scdProps: {},
|
|
141
|
-
mirrorProps: {
|
|
142
|
-
isBot: { events: "*", values: [false, false, false, false, true] },
|
|
143
|
-
profit: { events: ["checkout"], values: [4, 2, 42, 420] },
|
|
144
|
-
watchTimeSec: {
|
|
145
|
-
events: ["watch video"],
|
|
146
|
-
values: weightedRange(50, 1200, 6)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
},
|
|
135
|
+
mirrorProps: {},
|
|
150
136
|
|
|
151
137
|
/*
|
|
152
138
|
for group analytics keys, we need an array of arrays [[],[],[]]
|
package/scratch.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import main from "./core/index.js";
|
|
2
|
-
import amir from './
|
|
2
|
+
import amir from './dungeons/amir.js';
|
|
3
3
|
import simple from './schemas/simple.js';
|
|
4
4
|
import funnels from './schemas/funnels.js';
|
|
5
5
|
import foobar from './schemas/foobar.js';
|
|
@@ -7,18 +7,15 @@ import complex from './schemas/complex.js';
|
|
|
7
7
|
import deepNest from './schemas/deepNest.js';
|
|
8
8
|
import anon from './schemas/anon.js';
|
|
9
9
|
import execSync from 'child_process';
|
|
10
|
+
import gio from './dungeons/gio-apt-list.js';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
/** @type {main.Config} */
|
|
13
14
|
const spec = {
|
|
14
|
-
...
|
|
15
|
+
...gio,
|
|
15
16
|
writeToDisk: false,
|
|
16
17
|
verbose: true,
|
|
17
|
-
makeChart: false,
|
|
18
|
-
numUsers: 100,
|
|
19
|
-
numEvents: 10000,
|
|
20
|
-
numDays: 90,
|
|
21
|
-
token: ""
|
|
18
|
+
makeChart: false,
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
|
package/scripts/new.sh
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Ensure the ./path directory exists
|
|
4
|
+
mkdir -p ./dungeons
|
|
5
|
+
|
|
6
|
+
# Generate a random file name with .js extension
|
|
7
|
+
random_file_name=$(mktemp ./dungeons/my-file-XXXXXXXX.js)
|
|
8
|
+
|
|
9
|
+
# Initial text to write to the file
|
|
10
|
+
initial_text='
|
|
11
|
+
const SEED = "my-seed";
|
|
12
|
+
const dayjs = require("dayjs");
|
|
13
|
+
const utc = require("dayjs/plugin/utc");
|
|
14
|
+
dayjs.extend(utc);
|
|
15
|
+
require("dotenv").config();
|
|
16
|
+
const u = require("../core/utils");
|
|
17
|
+
const v = require("ak-tools");
|
|
18
|
+
const chance = u.initChance(SEED);
|
|
19
|
+
|
|
20
|
+
/** @type {import("../types").Config} */
|
|
21
|
+
const config = {
|
|
22
|
+
token: "",
|
|
23
|
+
seed: SEED,
|
|
24
|
+
numDays: 100, //how many days worth of data
|
|
25
|
+
numEvents: 100000, //how many events
|
|
26
|
+
numUsers: 1000, //how many users
|
|
27
|
+
format: "csv", //csv or json
|
|
28
|
+
region: "US",
|
|
29
|
+
makeChart: false,
|
|
30
|
+
anonIds: false,
|
|
31
|
+
sessionIds: false,
|
|
32
|
+
writeToDisk: false,
|
|
33
|
+
events: [],
|
|
34
|
+
superProps: {},
|
|
35
|
+
userProps: {},
|
|
36
|
+
scdProps: {},
|
|
37
|
+
mirrorProps: {},
|
|
38
|
+
groupKeys: [],
|
|
39
|
+
groupProps: {},
|
|
40
|
+
lookupTables: [],
|
|
41
|
+
hook: function(record, type, meta) {
|
|
42
|
+
return record;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
module.exports = config;'
|
|
47
|
+
|
|
48
|
+
# Write the initial text to the new file
|
|
49
|
+
echo "$initial_text" > "$random_file_name"
|
|
50
|
+
|
|
51
|
+
# Output the name of the created file
|
|
52
|
+
echo "File created: $random_file_name"
|
|
File without changes
|
package/tests/e2e.test.js
CHANGED
|
@@ -10,8 +10,9 @@ const u = require('ak-tools');
|
|
|
10
10
|
|
|
11
11
|
const simple = require('../schemas/simple.js');
|
|
12
12
|
const complex = require('../schemas/complex.js');
|
|
13
|
-
const deep = require('../schemas/deepNest.js');
|
|
14
13
|
const anon = require('../schemas/anon.js');
|
|
14
|
+
const funnels = require('../schemas/funnels.js');
|
|
15
|
+
const foobar = require('../schemas/foobar.js');
|
|
15
16
|
|
|
16
17
|
const timeout = 60000;
|
|
17
18
|
const testToken = process.env.TEST_TOKEN;
|
|
@@ -55,17 +56,6 @@ describe('module', () => {
|
|
|
55
56
|
|
|
56
57
|
}, timeout);
|
|
57
58
|
|
|
58
|
-
test('works as module (deep nest)', async () => {
|
|
59
|
-
console.log('MODULE TEST: DEEP NEST');
|
|
60
|
-
const results = await generate({ ...deep, verbose: true, writeToDisk: false, numEvents: 1100, numUsers: 100, seed: "deal with it" });
|
|
61
|
-
const { eventData, groupProfilesData, lookupTableData, scdTableData, userProfilesData } = results;
|
|
62
|
-
expect(eventData.length).toBeGreaterThan(980);
|
|
63
|
-
expect(groupProfilesData.length).toBe(0);
|
|
64
|
-
expect(lookupTableData.length).toBe(0);
|
|
65
|
-
expect(scdTableData.length).toBe(0);
|
|
66
|
-
expect(userProfilesData.length).toBe(100);
|
|
67
|
-
|
|
68
|
-
}, timeout);
|
|
69
59
|
|
|
70
60
|
test('fails with invalid configuration', async () => {
|
|
71
61
|
try {
|
|
@@ -92,7 +82,7 @@ describe('cli', () => {
|
|
|
92
82
|
const run = execSync(`node ./core/index.js --numEvents 1000 --numUsers 100`, { stdio: 'ignore' });
|
|
93
83
|
// expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
|
|
94
84
|
const csvs = (await u.ls('./data')).filter(a => a.includes('.csv'));
|
|
95
|
-
expect(csvs.length).toBe(
|
|
85
|
+
expect(csvs.length).toBe(2);
|
|
96
86
|
clearData();
|
|
97
87
|
}, timeout);
|
|
98
88
|
|
|
@@ -110,18 +100,10 @@ describe('cli', () => {
|
|
|
110
100
|
const run = execSync(`node ./core/index.js --numEvents 1000 --numUsers 100 --seed "deal with it" --simple`);
|
|
111
101
|
expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
|
|
112
102
|
const csvs = (await u.ls('./data')).filter(a => a.includes('.csv'));
|
|
113
|
-
expect(csvs.length).toBe(
|
|
103
|
+
expect(csvs.length).toBe(2);
|
|
114
104
|
clearData();
|
|
115
105
|
}, timeout);
|
|
116
106
|
|
|
117
|
-
test('works as CLI (custom)', async () => {
|
|
118
|
-
console.log('custom CLI TEST');
|
|
119
|
-
const run = execSync(`node ./core/index.js ./schemas/deepNest.js`);
|
|
120
|
-
expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
|
|
121
|
-
const csvs = (await u.ls('./data')).filter(a => a.includes('.csv'));
|
|
122
|
-
expect(csvs.length).toBe(3);
|
|
123
|
-
clearData();
|
|
124
|
-
}, timeout);
|
|
125
107
|
|
|
126
108
|
});
|
|
127
109
|
|