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/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "1.4.05",
3
+ "version": "1.5.01",
4
4
  "description": "builds all mixpanel primitives for a given project",
5
5
  "main": "index.js",
6
6
  "types": "types.d.ts",
7
7
  "scripts": {
8
- "start": "node ./core/index.js",
9
- "dev": "nodemon scratch.mjs --ignore /data",
10
- "prune": "rm -f ./data/* && rm -f ./tmp/*",
8
+ "start": "node ./index.js",
9
+ "dev": "nodemon scratch.mjs --ignore ./data/*",
10
+ "prune": "rm -f ./data/* && rm -f ./tmp/* && rm -f vscode-profile-*",
11
11
  "post": "npm publish",
12
12
  "test": "NODE_ENV=test jest --runInBand",
13
13
  "coverage": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js --coverage && open ./tests/coverage/lcov-report/index.html",
14
- "deps": "sh ./scripts/deps.sh",
15
- "new": "sh ./scripts/new.sh"
14
+ "update:deps": "./scripts/update-deps.sh",
15
+ "new:dungeon": "./scripts/new-dungeon.sh",
16
+ "new:project": "node ./scripts/new-project.mjs",
17
+ "exp:benchmark": "node --no-warnings --experimental-vm-modules ./tests/benchmark/concurrency.mjs",
18
+ "exp:soup": "node ./tests/testSoup.mjs"
16
19
  },
17
20
  "repository": {
18
21
  "type": "git",
19
22
  "url": "git+https://github.com/ak--47/make-mp-data.git"
20
23
  },
21
24
  "bin": {
22
- "make-mp-data": "./core/index.js"
25
+ "make-mp-data": "./index.js"
23
26
  },
24
27
  "keywords": [
25
28
  "mixpanel",
@@ -40,18 +43,21 @@
40
43
  },
41
44
  "homepage": "https://github.com/ak--47/make-mp-data#readme",
42
45
  "dependencies": {
43
- "ak-tools": "^1.0.58",
46
+ "ak-fetch": "^1.0.21",
47
+ "ak-tools": "^1.0.64",
44
48
  "chance": "^1.1.11",
45
49
  "chart.js": "^3.9.1",
46
50
  "chartjs-node-canvas": "^4.1.6",
47
51
  "dayjs": "^1.11.11",
48
52
  "dotenv": "^16.4.5",
49
- "mixpanel-import": "^2.5.552",
53
+ "mixpanel-import": "^2.5.554",
54
+ "p-limit": "^3.1.0",
50
55
  "yargs": "^17.7.2"
51
56
  },
52
57
  "devDependencies": {
53
58
  "@types/jest": "^29.5.12",
54
- "jest": "^29.7.0"
59
+ "jest": "^29.7.0",
60
+ "nodemon": "^3.1.3"
55
61
  },
56
62
  "jest": {
57
63
  "preset": "./tests/jest.config.js"
@@ -0,0 +1,96 @@
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
+ /** @type {import('../types').Config} */
20
+ const config = {
21
+ token: "",
22
+ seed: "foo bar",
23
+ numDays: 365, //how many days worth of data
24
+ numEvents: 10000000, //how many events
25
+ numUsers: 25000, //how many users
26
+ format: 'json', //csv or json
27
+ region: "US",
28
+ hasAnonIds: true, //if true, anonymousIds are created for each user
29
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
30
+ hasAdSpend: true,
31
+ events: [
32
+ {
33
+ event: "foo",
34
+ weight: 10,
35
+ },
36
+ {
37
+ event: "bar",
38
+ weight: 9,
39
+ },
40
+ {
41
+ event: "baz",
42
+ weight: 8,
43
+ },
44
+ {
45
+ event: "qux",
46
+ weight: 7,
47
+ },
48
+ {
49
+ event: "garply",
50
+ weight: 6,
51
+ },
52
+ {
53
+ event: "durtle",
54
+ weight: 5,
55
+ },
56
+ {
57
+ event: "linny",
58
+ weight: 4,
59
+ },
60
+ {
61
+ event: "fonk",
62
+ weight: 3,
63
+ },
64
+ {
65
+ event: "crumn",
66
+ weight: 2,
67
+ },
68
+ {
69
+ event: "yak",
70
+ weight: 1,
71
+ }
72
+ ],
73
+ superProps: {
74
+ color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
75
+ number: integer,
76
+
77
+ },
78
+ userProps: {
79
+ title: chance.profession.bind(chance),
80
+ luckyNumber: weighNumRange(42, 420),
81
+ 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"]
82
+ },
83
+
84
+ scdProps: {},
85
+ mirrorProps: {},
86
+ groupKeys: [],
87
+ groupProps: {},
88
+ lookupTables: [],
89
+ hook: function (record, type, meta) {
90
+ return record;
91
+ }
92
+ };
93
+
94
+
95
+
96
+ module.exports = config;
package/schemas/anon.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('../core/utils');
17
+ const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
18
18
 
19
19
 
20
20
 
@@ -27,8 +27,8 @@ const config = {
27
27
  numUsers: 10000, //how many users
28
28
  format: 'json', //csv or json
29
29
  region: "US",
30
- anonIds: true, //if true, anonymousIds are created for each user
31
- sessionIds: false, //if true, sessionIds are created for each user
30
+ hasAnonIds: true, //if true, anonymousIds are created for each user
31
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
32
32
  isAnonymous: true,
33
33
  hasLocation: true,
34
34
  events: [
package/schemas/big.js ADDED
@@ -0,0 +1,160 @@
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
+ /* cSpell:disable */
10
+
11
+
12
+
13
+ const Chance = require('chance');
14
+ const chance = new Chance();
15
+ const dayjs = require("dayjs");
16
+ const utc = require("dayjs/plugin/utc");
17
+ dayjs.extend(utc);
18
+ const { uid, comma } = require('ak-tools');
19
+ const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
20
+
21
+ /** @type {import('../types').Config} */
22
+ const config = {
23
+ token: "",
24
+ seed: "lets go",
25
+ numDays: 90, //how many days worth of data
26
+ numEvents: 100_000, //how many events
27
+ numUsers: 10_000, //how many users
28
+ format: 'csv', //csv or json
29
+ region: "US",
30
+ hasAnonIds: true, //if true, anonymousIds are created for each user
31
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
32
+ hasLocation: true,
33
+ events: [
34
+ {
35
+ event: "foo",
36
+ weight: 10,
37
+ properties: {}
38
+ },
39
+ {
40
+ event: "bar",
41
+ weight: 9,
42
+ properties: {}
43
+ },
44
+ {
45
+ event: "baz",
46
+ weight: 8,
47
+ properties: {}
48
+ },
49
+ {
50
+ event: "qux",
51
+ weight: 7,
52
+ properties: {}
53
+ },
54
+ {
55
+ event: "garply",
56
+ weight: 6,
57
+ properties: {}
58
+ },
59
+ {
60
+ event: "durtle",
61
+ weight: 5,
62
+ properties: {}
63
+ },
64
+ {
65
+ event: "linny",
66
+ weight: 4,
67
+ properties: {}
68
+ },
69
+ {
70
+ event: "fonk",
71
+ weight: 3,
72
+ properties: {}
73
+ },
74
+ {
75
+ event: "crumn",
76
+ weight: 2,
77
+ properties: {}
78
+ },
79
+ {
80
+ event: "yak",
81
+ weight: 1,
82
+ properties: {}
83
+ }
84
+ ],
85
+ superProps: {
86
+ color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
87
+ number: integer,
88
+
89
+ },
90
+ userProps: {
91
+ title: chance.profession.bind(chance),
92
+ luckyNumber: weighNumRange(42, 420),
93
+ 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"]
94
+ },
95
+
96
+ scdProps: {
97
+ "donk": ["dude", "man", "brok"],
98
+ "pronk": ["monk", "lonk", "aonk"],
99
+ },
100
+ mirrorProps: {},
101
+ groupKeys: [
102
+ ["companies", 100_000],
103
+ ["servers", 3_000_000],
104
+ ["crews", 1000],
105
+
106
+ ],
107
+ groupProps: {
108
+ companies: {
109
+ name: chance.company.bind(chance),
110
+ industry: ["tech", "finance", "healthcare", "education", "retail", "manufacturing", "entertainment", "government", "non-profit", "other"],
111
+ },
112
+ servers: {
113
+ name: chance.word.bind(chance),
114
+ ram: weighNumRange(4, 64, .25),
115
+ cpu: weighNumRange(1, 16, .25),
116
+
117
+ },
118
+ crews: {
119
+ name: chance.word.bind(chance),
120
+ department: ["engineering", "design", "marketing", "sales", "finance", "hr", "legal", "operations", "support", "other"],
121
+ size: weighNumRange(5, 50, .25)
122
+ }
123
+ },
124
+ lookupTables: [{
125
+ key: "product_id",
126
+ entries: 2_000_000,
127
+ attributes: {
128
+ category: [
129
+ "Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden & Tools", "Pet Supplies", "Food & Grocery", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art"
130
+ ],
131
+ "demand": ["high", "medium", "medium", "low"],
132
+ "supply": ["high", "medium", "medium", "low"],
133
+ "manufacturer": chance.company.bind(chance),
134
+ "price": weighNumRange(5, 500, .25),
135
+ "rating": weighNumRange(1, 5),
136
+ "reviews": weighNumRange(0, 35)
137
+ }
138
+
139
+ },
140
+ {
141
+ key: "video_id",
142
+ entries: 10_000_000,
143
+ attributes: {
144
+ isFlagged: [true, false, false, false, false],
145
+ copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
146
+ uploader_id: chance.guid.bind(chance),
147
+ "uploader influence": ["low", "low", "low", "medium", "medium", "high"],
148
+ thumbs: weighNumRange(0, 35),
149
+ rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
150
+ }
151
+
152
+ }],
153
+ hook: function (record, type, meta) {
154
+ return record;
155
+ }
156
+ };
157
+
158
+
159
+
160
+ module.exports = config;
@@ -0,0 +1,327 @@
1
+ /**
2
+ * This is the default configuration file for the data generator in COMPLEX 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
+ const Chance = require('chance');
10
+ const chance = new Chance();
11
+ const { weighNumRange, date, integer, pickAWinner, exhaust } = require('../components/utils.js');
12
+ const u = require('ak-tools');
13
+
14
+ const channel_ids = [...Array(1234).keys()].map(i => i + 1).map(n => `channel_id_${n}`);
15
+ const channel_names = chance.n(u.makeName, 1234);
16
+ const video_ids = [...Array(50000).keys()].map(i => i + 1).map(n => n.toString());
17
+ const video_names = chance.n(u.makeName, 50000);
18
+
19
+ const EVENTS = 50_000
20
+ const USERS = EVENTS / 100
21
+
22
+
23
+ /** @type {import('../types.js').Config} */
24
+ const config = {
25
+ token: "",
26
+ seed: "it's business time...",
27
+ numDays: 90, //how many days worth of data
28
+ numEvents: EVENTS, //how many events
29
+ numUsers: USERS, //how many users
30
+ format: 'json', //csv or json
31
+ region: "US",
32
+ hasAnonIds: false, //if true, anonymousIds are created for each user
33
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
34
+ hasLocation: true,
35
+ hasAndroidDevices: true,
36
+ hasIOSDevices: true,
37
+ hasDesktopDevices: true,
38
+ hasBrowser: true,
39
+ hasCampaigns: true,
40
+ isAnonymous: false,
41
+ hasAdSpend: true,
42
+
43
+ hasAvatar: false,
44
+ makeChart: true,
45
+
46
+ batchSize: 500_000,
47
+ concurrency: 500,
48
+
49
+ funnels: [
50
+ {
51
+ sequence: ["watch video", "like video", "subscribe", "purchase video"],
52
+ conversionRate: 35,
53
+ props: {
54
+ channel_id: pickAWinner(channel_ids),
55
+ video_id: weighNumRange(1, 50000, 1.4),
56
+ category: pickAWinner(["funny", "educational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"]),
57
+ isFeatured: () => { chance.bool({ likelihood: 25 }); },
58
+ }
59
+ },
60
+ {
61
+ sequence: ["watch video", "dislike video"],
62
+ conversionRate: 10,
63
+ order: "sequential",
64
+ props: {
65
+ channel_id: pickAWinner(channel_ids),
66
+ video_id: weighNumRange(1, 50000, .67),
67
+ category: pickAWinner(["funny", "educational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"]),
68
+ isFeatured: () => { chance.bool({ likelihood: 25 }); },
69
+ }
70
+ },
71
+ ],
72
+ events: [
73
+ {
74
+ "event": "watch video",
75
+ "weight": 75,
76
+ "properties": {
77
+ "#hashtags": makeHashTags,
78
+ "watch time (sec)": weighNumRange(10, 600, .25),
79
+ "quality": pickAWinner(["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"], 1)
80
+ }
81
+ },
82
+ {
83
+ "event": "like video",
84
+ "weight": 30,
85
+ "properties": {
86
+
87
+ }
88
+ },
89
+ {
90
+ "event": "dislike video",
91
+ "weight": 15,
92
+ "properties": {
93
+
94
+ }
95
+ },
96
+ {
97
+ "event": "subscribe",
98
+ "weight": 10,
99
+ "properties": {
100
+ "UI": pickAWinner(["button", "link", "modal", "menu"]),
101
+ }
102
+ },
103
+ {
104
+ "event": "search",
105
+ "weight": 10,
106
+ "properties": {
107
+ term: () => { return chance.word(); },
108
+ "# results": weighNumRange(1, 100, .25),
109
+ "UI": pickAWinner(["button", "link", "modal", "menu"]),
110
+ }
111
+ },
112
+ {
113
+ "event": "comment",
114
+ "weight": 6,
115
+ "properties": {
116
+ length: weighNumRange(1, 500, .25),
117
+ video_id: weighNumRange(1, 50000, .72),
118
+ "has replies": [true, false, false, false, false],
119
+ "has photos": [true, false, false, false, false],
120
+
121
+ }
122
+ },
123
+ {
124
+ "event": "save video",
125
+ "weight": 17,
126
+ "properties": {
127
+ video_id: weighNumRange(1, 50000, 1.4),
128
+ UI: pickAWinner(["toolbar", "menu", "keyboard"])
129
+
130
+ }
131
+ },
132
+ {
133
+ "event": "create playlist",
134
+ "weight": 5,
135
+ "properties": {
136
+ "# of videos": weighNumRange(1, 100, .25),
137
+ "UI": pickAWinner(["toolbar", "menu", "keyboard"]),
138
+ "visibility": pickAWinner(["public", "private", "unlisted"]),
139
+ }
140
+ },
141
+ {
142
+ "event": "purchase video",
143
+ "weight": 12,
144
+ "properties": {
145
+ video_id: weighNumRange(1, 50000, 1.4),
146
+ basket: makeProducts(5),
147
+
148
+
149
+ }
150
+ },
151
+ {
152
+ "event": "support ticket",
153
+ "weight": 10,
154
+ "properties": {
155
+ description: chance.sentence.bind(chance),
156
+ severity: ["low", "medium", "high"],
157
+ ticket_id: chance.guid.bind(chance)
158
+ }
159
+ },
160
+ {
161
+ "event": "app error",
162
+ "weight": 15,
163
+ "properties": {
164
+ code: pickAWinner(["404", "500", "403", "401", "400", "503", "504", "429"]),
165
+ error: chance.sentence.bind(chance),
166
+ component: pickAWinner(["video player", "search", "comment", "profile", "settings", "billing", "support"]),
167
+ }
168
+ },
169
+ {
170
+ "event": "sign up",
171
+ "isFirstEvent": true,
172
+ "weight": 0,
173
+ "properties": {
174
+
175
+ }
176
+ }
177
+ ],
178
+ superProps: {
179
+
180
+
181
+ },
182
+ /*
183
+ user properties work the same as event properties
184
+ each key should be an array or function reference
185
+ */
186
+ userProps: {
187
+ title: chance.profession.bind(chance),
188
+ luckyNumber: weighNumRange(42, 420),
189
+ experiment: designExperiment(),
190
+ spiritAnimal: ["unicorn", "dragon", "phoenix", "sasquatch", "yeti", "kraken", "jackalope", "thunderbird", "mothman", "nessie", "chupacabra", "jersey devil", "bigfoot", "weindgo", "bunyip", "mokele-mbembe", "tatzelwurm", "megalodon"],
191
+
192
+ ip: chance.ip.bind(chance),
193
+
194
+ },
195
+
196
+ /** each generates it's own table */
197
+ scdProps: {
198
+ plan: ["free", "free", "free", "free", "basic", "basic", "basic", "premium", "premium", "enterprise"],
199
+ MRR: weighNumRange(0, 10000, .15),
200
+ NPS: weighNumRange(0, 10, 2, 150),
201
+ },
202
+
203
+ mirrorProps: {
204
+
205
+ },
206
+
207
+ /*
208
+ for group analytics keys, we need an array of arrays [[],[],[]]
209
+ each pair represents a group_key and the number of profiles for that key
210
+ */
211
+ groupKeys: [
212
+ ['channel_id', 1234, ["save video", "comment", "watch video", "purchase video", "like video", "dislike video", "subscribe"]],
213
+
214
+ ],
215
+ groupProps: {
216
+ channel_id: {
217
+ "name": exhaust(channel_names),
218
+ "viewers": weighNumRange(5, 500, .25),
219
+ "rating": weighNumRange(1, 5),
220
+ "reviews": weighNumRange(0, 35)
221
+ }
222
+
223
+ },
224
+
225
+ lookupTables: [
226
+ {
227
+ key: "video_id",
228
+ entries: 50000,
229
+ attributes: {
230
+ isFlagged: [true, false, false, false, false],
231
+ copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
232
+ uploader_id: chance.guid.bind(chance),
233
+ "uploader influence": ["low", "low", "low", "medium", "medium", "high"],
234
+ thumbs: weighNumRange(0, 4000, .25),
235
+ video_name: exhaust(video_names),
236
+ rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
237
+ }
238
+
239
+ }
240
+ ],
241
+
242
+ hook: function (record, type, meta) {
243
+ return record;
244
+ }
245
+ };
246
+
247
+
248
+
249
+ function makeHashTags() {
250
+ const possibleHashtags = [];
251
+ for (let i = 0; i < 20; i++) {
252
+ possibleHashtags.push('#' + u.makeName(2, ''));
253
+ }
254
+
255
+ const numHashtags = integer(integer(1, 5), integer(5, 10));
256
+ const hashtags = [];
257
+ for (let i = 0; i < numHashtags; i++) {
258
+ hashtags.push(chance.pickone(possibleHashtags));
259
+ }
260
+ return [hashtags];
261
+ };
262
+
263
+ function makeProducts(maxItems = 10) {
264
+ return function () {
265
+ const categories = ["Device Accessories", "eBooks", "Automotive", "Baby Products", "Beauty", "Books", "Camera & Photo", "Cell Phones & Accessories", "Collectible Coins", "Consumer Electronics", "Entertainment Collectibles", "Fine Art", "Grocery & Gourmet Food", "Health & Personal Care", "Home & Garden", "Independent Design", "Industrial & Scientific", "Accessories", "Major Appliances", "Music", "Musical Instruments", "Office Products", "Outdoors", "Personal Computers", "Pet Supplies", "Software", "Sports", "Sports Collectibles", "Tools & Home Improvement", "Toys & Games", "Video, DVD & Blu-ray", "Video Games", "Watches"];
266
+ const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
267
+ const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
268
+ const data = [];
269
+ const numOfItems = integer(1, 12);
270
+
271
+ for (var i = 0; i < numOfItems; i++) {
272
+ const category = chance.pickone(categories);
273
+ const slug = chance.pickone(slugs);
274
+ const asset = chance.pickone(assetExtension);
275
+ const product_id = chance.guid();
276
+ const price = integer(1, 300);
277
+ const quantity = integer(1, 5);
278
+
279
+ const item = {
280
+ product_id: product_id,
281
+ sku: integer(11111, 99999),
282
+ amount: price,
283
+ quantity: quantity,
284
+ value: price * quantity,
285
+ featured: chance.pickone([true, false]),
286
+ category: category,
287
+ urlSlug: slug + category,
288
+ asset: `${category}-${integer(1, 20)}${asset}`
289
+ };
290
+
291
+ data.push(item);
292
+ }
293
+
294
+ return [data];
295
+ };
296
+ };
297
+
298
+
299
+ function designExperiment() {
300
+ return function () {
301
+ const variants = ["A", "B", "C", "Control"];
302
+ const variant = chance.pickone(variants);
303
+ const experiments = ["no password", "social sign in", "new tutorial", "new search"];
304
+ const experiment = chance.pickone(experiments);
305
+ const multi_variates = ["A/B", "A/B/C", "A/B/C/D", "Control"];
306
+ const multi_variate = chance.pickone(multi_variates);
307
+ const impression_id = chance.guid();
308
+
309
+
310
+
311
+ const chosen = {
312
+ variant,
313
+ experiment,
314
+ multi_variate,
315
+ impression_id
316
+ };
317
+
318
+ return [chosen];
319
+ };
320
+ }
321
+
322
+
323
+
324
+
325
+
326
+
327
+ module.exports = config;