make-mp-data 1.2.21 → 1.3.0

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/models/complex.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This is the default configuration file for the data generator
2
+ * This is the default configuration file for the data generator in COMPLEX mode
3
3
  * notice how the config object is structured, and see it's type definition in ./types.d.ts
4
4
  * feel free to modify this file to customize the data you generate
5
5
  * see helper functions in utils.js for more ways to generate data
@@ -8,7 +8,8 @@
8
8
 
9
9
  const Chance = require('chance');
10
10
  const chance = new Chance();
11
- const { weightedRange, makeProducts, date, makeHashTags } = require('../utils.js');
11
+ const { weightedRange, date, integer } = require('../utils.js');
12
+ const u = require('ak-tools');
12
13
 
13
14
  /** @type {import('../types.js').Config} */
14
15
  const config = {
@@ -28,26 +29,24 @@ const config = {
28
29
  "weight": 2,
29
30
  "properties": {
30
31
  amount: weightedRange(5, 500, 1000, .25),
31
- currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
32
- cart: makeProducts,
32
+ currency: ["USD", "USD", "USD", "CAD", "EUR", "EUR", "BTC", "BTC", "ETH", "JPY"],
33
+ cart: makeProducts(12),
33
34
  }
34
35
  },
35
36
  {
36
37
  "event": "add to cart",
37
38
  "weight": 4,
38
39
  "properties": {
39
- isFeaturedItem: [true, false, false],
40
40
  amount: weightedRange(5, 500, 1000, .25),
41
- rating: weightedRange(1, 5),
42
- reviews: weightedRange(0, 35),
43
- product_id: weightedRange(1, 1000)
41
+ qty: integer(1, 5),
42
+ product_id: weightedRange(1, 1000, 42, 1.4)
44
43
  }
45
44
  },
46
45
  {
47
46
  "event": "page view",
48
47
  "weight": 10,
49
48
  "properties": {
50
- page: ["/", "/", "/help", "/account", "/watch", "/listen", "/product", "/people", "/peace"],
49
+ page: ["/", "/", "/", "/learn-more", "/pricing", "/contact", "/about", "/careers", "/sign-up", "/login", "/app", "/app", "/app", "/app"],
51
50
  utm_source: ["$organic", "$organic", "$organic", "$organic", "google", "google", "google", "facebook", "facebook", "twitter", "linkedin"],
52
51
  }
53
52
  },
@@ -60,7 +59,7 @@ const config = {
60
59
  watchTimeSec: weightedRange(10, 600, 1000, .25),
61
60
  quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
62
61
  format: ["mp4", "avi", "mov", "mpg"],
63
- uploader_id: chance.guid.bind(chance)
62
+ video_id: weightedRange(1, 50000, 420000, 1.4),
64
63
 
65
64
  }
66
65
  },
@@ -68,7 +67,7 @@ const config = {
68
67
  "event": "view item",
69
68
  "weight": 8,
70
69
  "properties": {
71
- product_id: weightedRange(1, 1000),
70
+ product_id: weightedRange(1, 1000, 24, 3),
72
71
  colors: ["light", "dark", "custom", "dark"]
73
72
  }
74
73
  },
@@ -76,22 +75,33 @@ const config = {
76
75
  "event": "save item",
77
76
  "weight": 5,
78
77
  "properties": {
79
- product_id: weightedRange(1, 1000),
78
+ product_id: weightedRange(1, 1000, 8, 12),
80
79
  colors: ["light", "dark", "custom", "dark"]
81
80
  }
82
81
  },
82
+ {
83
+ "event": "support ticket",
84
+ "weight": 2,
85
+ "properties": {
86
+ product_id: weightedRange(1, 1000, 420, .6),
87
+ description: chance.sentence.bind(chance),
88
+ severity: ["low", "medium", "high"],
89
+ ticket_id: chance.guid.bind(chance)
90
+ }
91
+ },
83
92
  {
84
93
  "event": "sign up",
85
94
  "isFirstEvent": true,
86
95
  "weight": 0,
87
96
  "properties": {
88
- variant: ["A", "B", "C", "Control"],
89
- experiment: ["no password", "social sign in", "new tutorial"],
97
+ plan: ["free", "free", "free", "free", "basic", "basic", "basic", "premium", "premium", "enterprise"],
98
+ dateOfRenewal: date(100, false),
99
+ codewords: u.makeName,
90
100
  }
91
101
  }
92
102
  ],
93
103
  superProps: {
94
- platform: ["web", "mobile", "web", "mobile", "web", "kiosk", "smartTV"],
104
+ device: deviceAttributes()
95
105
  // emotions: generateEmoji(),
96
106
 
97
107
  },
@@ -102,16 +112,30 @@ const config = {
102
112
  userProps: {
103
113
  title: chance.profession.bind(chance),
104
114
  luckyNumber: weightedRange(42, 420),
105
- // vibe: generateEmoji(),
106
- spiritAnimal: chance.animal.bind(chance)
115
+ experiment: designExperiment(),
116
+ spiritAnimal: ["unicorn", "dragon", "phoenix", "sasquatch", "yeti", "kraken", "jackalope", "thunderbird", "mothman", "nessie", "chupacabra", "jersey devil", "bigfoot", "weindgo", "bunyip", "mokele-mbembe", "tatzelwurm", "megalodon"],
117
+ timezone: chance.timezone.bind(chance), // ["America/New_York", "America/Los_Angeles", "America/Chicago", "America/Denver", "America/Phoenix", "America/Anchorage", "Pacific/Honolulu"]
118
+ ip: chance.ip.bind(chance),
119
+ lastCart: makeProducts(5),
120
+
107
121
  },
108
122
 
123
+ /** each generates it's own table */
109
124
  scdProps: {
110
125
  plan: ["free", "free", "free", "free", "basic", "basic", "basic", "premium", "premium", "enterprise"],
111
126
  MRR: weightedRange(0, 10000, 1000, .15),
112
127
  NPS: weightedRange(0, 10, 150, 2),
113
- marketingOptIn: [true, true, false],
114
- dateOfRenewal: date(100, false),
128
+ subscribed: [true, true, true, true, true, true, false, false, false, false, "it's complicated"],
129
+ renewalDate: date(100, false),
130
+ },
131
+
132
+ mirrorProps: {
133
+ isBot: { events: "*", values: [false, false, false, false, true] },
134
+ profit: { events: ["checkout"], values: [4, 2, 42, 420] },
135
+ watchTimeSec: {
136
+ events: ["watch video"],
137
+ values: weightedRange(50, 1200, 247, 6)
138
+ }
115
139
  },
116
140
 
117
141
  /*
@@ -119,7 +143,8 @@ const config = {
119
143
  each pair represents a group_key and the number of profiles for that key
120
144
  */
121
145
  groupKeys: [
122
- ['company_id', 350],
146
+ ['company_id', 500],
147
+ ['room_id', 10000],
123
148
 
124
149
  ],
125
150
  groupProps: {
@@ -127,8 +152,18 @@ const config = {
127
152
  $name: () => { return chance.company(); },
128
153
  $email: () => { return `CSM: ${chance.pickone(["AK", "Jessica", "Michelle", "Dana", "Brian", "Dave"])}`; },
129
154
  "# of employees": weightedRange(3, 10000),
130
- "sector": ["tech", "finance", "healthcare", "education", "government", "non-profit"],
155
+ "industry": ["tech", "finance", "healthcare", "education", "government", "non-profit"],
131
156
  "segment": ["enterprise", "SMB", "mid-market"],
157
+ "products": [["core"], ["core"], ["core", "add-ons"], ["core", "pro-serve"], ["core", "add-ons", "pro-serve"], ["core", "BAA", "enterprise"], ["free"], ["free"], ["free", "addons"]],
158
+ },
159
+ room_id: {
160
+ $name: () => { return `#${chance.word({ length: integer(4, 24), capitalize: true })}`; },
161
+ $email: ["public", "private"],
162
+ "room provider": ["partner", "core", "core", "core"],
163
+ "room capacity": weightedRange(3, 1000000),
164
+ "isPublic": [true, false, false, false, false],
165
+ "country": chance.country.bind(chance),
166
+ "isVerified": [true, true, false, false, false],
132
167
  }
133
168
  },
134
169
 
@@ -138,29 +173,7 @@ const config = {
138
173
  entries: 1000,
139
174
  attributes: {
140
175
  category: [
141
- "Books",
142
- "Movies",
143
- "Music",
144
- "Games",
145
- "Electronics",
146
- "Computers",
147
- "Smart Home",
148
- "Home",
149
- "Garden & Tools",
150
- "Pet Supplies",
151
- "Food & Grocery",
152
- "Beauty",
153
- "Health",
154
- "Toys",
155
- "Kids",
156
- "Baby",
157
- "Handmade",
158
- "Sports",
159
- "Outdoors",
160
- "Automotive",
161
- "Industrial",
162
- "Entertainment",
163
- "Art"
176
+ "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"
164
177
  ],
165
178
  "demand": ["high", "medium", "medium", "low"],
166
179
  "supply": ["high", "medium", "medium", "low"],
@@ -170,8 +183,134 @@ const config = {
170
183
  "reviews": weightedRange(0, 35)
171
184
  }
172
185
 
186
+ },
187
+ {
188
+ key: "video_id",
189
+ entries: 50000,
190
+ attributes: {
191
+ isFlagged: [true, false, false, false, false],
192
+ copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
193
+ uploader_id: chance.guid.bind(chance),
194
+ "uploader influence": ["low", "low", "low", "medium", "medium", "high"],
195
+ rating: weightedRange(1, 5),
196
+ thumbs: weightedRange(0, 35),
197
+ rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
198
+ }
199
+
173
200
  }
174
201
  ],
202
+
203
+ hook: function (record, type, meta) {
204
+ return record;
205
+ }
206
+ };
207
+
208
+
209
+
210
+ function makeHashTags() {
211
+ const possibleHashtags = [];
212
+ for (let i = 0; i < 20; i++) {
213
+ possibleHashtags.push('#' + u.makeName(2, ''));
214
+ }
215
+
216
+ const numHashtags = integer(integer(1, 5), integer(5, 10));
217
+ const hashtags = [];
218
+ for (let i = 0; i < numHashtags; i++) {
219
+ hashtags.push(chance.pickone(possibleHashtags));
220
+ }
221
+ return [hashtags];
175
222
  };
176
223
 
224
+ function makeProducts(maxItems = 10) {
225
+
226
+ return function () {
227
+ 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"];
228
+ const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
229
+ const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
230
+ const data = [];
231
+ const numOfItems = integer(1, 12);
232
+
233
+ for (var i = 0; i < numOfItems; i++) {
234
+ const category = chance.pickone(categories);
235
+ const slug = chance.pickone(slugs);
236
+ const asset = chance.pickone(assetExtension);
237
+ const product_id = chance.guid();
238
+ const price = integer(1, 300);
239
+ const quantity = integer(1, 5);
240
+
241
+ const item = {
242
+ product_id: product_id,
243
+ sku: integer(11111, 99999),
244
+ amount: price,
245
+ quantity: quantity,
246
+ value: price * quantity,
247
+ featured: chance.pickone([true, false]),
248
+ category: category,
249
+ urlSlug: slug + category,
250
+ asset: `${category}-${integer(1, 20)}${asset}`
251
+ };
252
+
253
+ data.push(item);
254
+ }
255
+
256
+ return [data];
257
+ };
258
+ };
259
+
260
+
261
+ function designExperiment() {
262
+ return function () {
263
+ const variants = ["A", "B", "C", "Control"];
264
+ const variant = chance.pickone(variants);
265
+ const experiments = ["no password", "social sign in", "new tutorial", "new search"];
266
+ const experiment = chance.pickone(experiments);
267
+ const multi_variates = ["A/B", "A/B/C", "A/B/C/D", "Control"];
268
+ const multi_variate = chance.pickone(multi_variates);
269
+ const impression_id = chance.guid();
270
+
271
+
272
+
273
+ const chosen = {
274
+ variant,
275
+ experiment,
276
+ multi_variate,
277
+ impression_id
278
+ };
279
+
280
+ return [chosen];
281
+ };
282
+ }
283
+
284
+ function deviceAttributes(isMobile = false) {
285
+ return function () {
286
+ let devices = ["desktop", "laptop", "desktop", "laptop", "desktop", "laptop", "other"];
287
+ if (isMobile) devices = [...devices, "mobile", "mobile", "mobile", "tablet"];
288
+ const device = chance.pickone(devices);
289
+ const oses = ["Windows", "macOS", "Windows", "macOS", "macOS", "Linux", "Windows", "macOS", "Windows", "macOS", "macOS", "TempleOS"];
290
+ if (isMobile) oses = [...oses, "iOS", "Android", "iOS", "Android"];
291
+ const os = chance.pickone(oses);
292
+ const browser = chance.pickone(["Chrome", "Firefox", "Safari", "Edge", "Opera", "IE", "Brave", "Vivaldi"]);
293
+ const version = chance.integer({ min: 1, max: 15 });
294
+ const resolution = chance.pickone(["1920x1080", "1280x720", "1024x768", "800x600", "640x480"]);
295
+ const language = chance.pickone(["en-US", "en-US", "en-US", "en-GB", "es", "es", "fr", "de", "it", "ja", "zh", "ru"]);
296
+
297
+ const chosen = {
298
+ platform: device,
299
+ os,
300
+ browser,
301
+ version,
302
+ resolution,
303
+ language
304
+ };
305
+
306
+ return [chosen];
307
+
308
+ };
309
+ }
310
+
311
+
312
+
313
+
314
+
315
+
177
316
  module.exports = config;
@@ -18,17 +18,17 @@ const config = {
18
18
  groupProperties: {}
19
19
  };
20
20
 
21
- let formats = ['2160p', '1440p', '1080p', '720p', '480p', '360p', '240p'];
22
- let ratios = ['4:3', '16:10', '16:9'];
23
- let containers = ["WEBM", ["MPG", "MP2", "MPEG"], ["MP4", "M4P", "M4V"], ["AVI", "WMV"], ["MOV", "QT"], ["FLV", "SWF"], "AVCHD"];
24
- let hashtags = ["#AK", "#bitcoin", "#cureForMiley", "#faceValue", "#blm", "#fwiw", "#inappropriateFuneralSongs", "#jurassicPork", "#lolCats", "#wheatForSheep", "#momTexts", "#myWeirdGymStory", "#poppy", "#resist", "#tbt", "#wilson", "#worstGiftEver", "#yolo", "#phish", "#crypto", "#memes", "#wrongMovie", "#careerEndingTwitterTypos", "#twoThingsThatDontMix"];
25
- let platforms = ["Web", "Mobile Web", "Native (Android)", "Native (iOS)", "Native (Desktop)", "IoT"];
26
- let plans = ['free', 'premium', 'casual', 'influencer'];
27
- let categories = ["Product reviews video", "How-to videos", "Vlogs", "Gaming videos", "Comedy/skit videos", "Haul videos", "Memes/tags", "Favorites/best of", "Educational videos", "Unboxing videos", "Q&A videos", "Collection", "Prank videos"];
28
- let marketingChannels = ["Organic", "Organic", "Organic", "Organic", "Instagram Ads", "Facebook Ads", "Google Ads", "Youtube Ads", "Instagram Post", "Instagram Post", "Facebook Post"];
29
-
30
21
 
31
22
  function generateVideoMeta() {
23
+ let formats = ['2160p', '1440p', '1080p', '720p', '480p', '360p', '240p'];
24
+ let ratios = ['4:3', '16:10', '16:9'];
25
+ let containers = ["WEBM", ["MPG", "MP2", "MPEG"], ["MP4", "M4P", "M4V"], ["AVI", "WMV"], ["MOV", "QT"], ["FLV", "SWF"], "AVCHD"];
26
+ let hashtags = ["#AK", "#bitcoin", "#cureForMiley", "#faceValue", "#blm", "#fwiw", "#inappropriateFuneralSongs", "#jurassicPork", "#lolCats", "#wheatForSheep", "#momTexts", "#myWeirdGymStory", "#poppy", "#resist", "#tbt", "#wilson", "#worstGiftEver", "#yolo", "#phish", "#crypto", "#memes", "#wrongMovie", "#careerEndingTwitterTypos", "#twoThingsThatDontMix"];
27
+ let platforms = ["Web", "Mobile Web", "Native (Android)", "Native (iOS)", "Native (Desktop)", "IoT"];
28
+ let plans = ['free', 'premium', 'casual', 'influencer'];
29
+ let categories = ["Product reviews video", "How-to videos", "Vlogs", "Gaming videos", "Comedy/skit videos", "Haul videos", "Memes/tags", "Favorites/best of", "Educational videos", "Unboxing videos", "Q&A videos", "Collection", "Prank videos"];
30
+ let marketingChannels = ["Organic", "Organic", "Organic", "Organic", "Instagram Ads", "Facebook Ads", "Google Ads", "Youtube Ads", "Instagram Post", "Instagram Post", "Facebook Post"];
31
+
32
32
 
33
33
  let videoTemplate = {
34
34
  videoFormatInfo: {
@@ -38,8 +38,8 @@ function generateVideoMeta() {
38
38
  observedLatencyTimestamps: chance.pickset([].range(1, 300000), int(1, 40))
39
39
  },
40
40
  videoStats: {
41
- numerOfPlays: int(10, 10000000),
42
- isReccommendedVideo: chance.bool(),
41
+ numberOfPlays: int(10, 10000000),
42
+ isRecommendedVideo: chance.bool(),
43
43
  inPlaylists: chance.pickset(hashtags, int(1, hashtags.length)),
44
44
  likers: chance.n(chance.guid, int(3, 100)),
45
45
  dislikers: chance.n(chance.guid, int(3, 100)),
@@ -49,12 +49,12 @@ function generateVideoMeta() {
49
49
  hashtags: chance.pickset(hashtags, int(1, 10)),
50
50
  category: chance.pickone(categories),
51
51
  },
52
- availibility: {
52
+ availability: {
53
53
  hasAdvertisements: chance.bool(),
54
54
  canBeSeenOnPlans: chance.pickset(plans, int(1, plans.length)),
55
55
  releaseInfo: {
56
56
  isReleased: chance.bool({ likelihood: 90 }),
57
- relaseDate: chance.date({ year: 2021 })
57
+ releaseDate: chance.date({ year: 2021 })
58
58
  }
59
59
  }
60
60
 
package/models/simple.js CHANGED
@@ -1,10 +1,20 @@
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
+
1
11
  const Chance = require('chance');
2
12
  const chance = new Chance();
3
13
  const dayjs = require("dayjs");
4
14
  const utc = require("dayjs/plugin/utc");
5
15
  dayjs.extend(utc);
6
16
  const { uid, comma } = require('ak-tools');
7
- const { weighList, weightedRange, date, integer } = require('../utils')
17
+ const { weighList, weightedRange, date, integer } = require('../utils');
8
18
 
9
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"];
10
20
 
@@ -24,9 +34,9 @@ const config = {
24
34
 
25
35
  events: [
26
36
  {
27
- "event": "checkout",
28
- "weight": 2,
29
- "properties": {
37
+ event: "checkout",
38
+ weight: 2,
39
+ properties: {
30
40
  amount: weightedRange(5, 500, 1000, .25),
31
41
  currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
32
42
  coupon: ["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"],
@@ -35,9 +45,9 @@ const config = {
35
45
  }
36
46
  },
37
47
  {
38
- "event": "add to cart",
39
- "weight": 4,
40
- "properties": {
48
+ event: "add to cart",
49
+ weight: 4,
50
+ properties: {
41
51
  amount: weightedRange(5, 500, 1000, .25),
42
52
  rating: weightedRange(1, 5),
43
53
  reviews: weightedRange(0, 35),
@@ -48,17 +58,17 @@ const config = {
48
58
  }
49
59
  },
50
60
  {
51
- "event": "page view",
52
- "weight": 10,
53
- "properties": {
61
+ event: "page view",
62
+ weight: 10,
63
+ properties: {
54
64
  page: ["/", "/", "/help", "/account", "/watch", "/listen", "/product", "/people", "/peace"],
55
65
  utm_source: ["$organic", "$organic", "$organic", "$organic", "google", "google", "google", "facebook", "facebook", "twitter", "linkedin"],
56
66
  }
57
67
  },
58
68
  {
59
- "event": "watch video",
60
- "weight": 8,
61
- "properties": {
69
+ event: "watch video",
70
+ weight: 8,
71
+ properties: {
62
72
  videoCategory: weighList(videoCategories, integer(0, 9)),
63
73
  isFeaturedItem: [true, false, false],
64
74
  watchTimeSec: weightedRange(10, 600, 1000, .25),
@@ -69,9 +79,9 @@ const config = {
69
79
  }
70
80
  },
71
81
  {
72
- "event": "view item",
73
- "weight": 8,
74
- "properties": {
82
+ event: "view item",
83
+ weight: 8,
84
+ properties: {
75
85
  isFeaturedItem: [true, false, false],
76
86
  itemCategory: weighList(itemCategories, integer(0, 27)),
77
87
  dateItemListed: date(30, true, 'YYYY-MM-DD'),
@@ -79,9 +89,9 @@ const config = {
79
89
  }
80
90
  },
81
91
  {
82
- "event": "save item",
83
- "weight": 5,
84
- "properties": {
92
+ event: "save item",
93
+ weight: 5,
94
+ properties: {
85
95
  isFeaturedItem: [true, false, false],
86
96
  itemCategory: weighList(itemCategories, integer(0, 27)),
87
97
  dateItemListed: date(30, true, 'YYYY-MM-DD'),
@@ -89,10 +99,10 @@ const config = {
89
99
  }
90
100
  },
91
101
  {
92
- "event": "sign up",
93
- "isFirstEvent": true,
94
- "weight": 0,
95
- "properties": {
102
+ event: "sign up",
103
+ isFirstEvent: true,
104
+ weight: 0,
105
+ properties: {
96
106
  variants: ["A", "B", "C", "Control"],
97
107
  flows: ["new", "existing", "loyal", "churned"],
98
108
  flags: ["on", "off"],
@@ -114,10 +124,19 @@ const config = {
114
124
  userProps: {
115
125
  title: chance.profession.bind(chance),
116
126
  luckyNumber: weightedRange(42, 420),
117
- spiritAnimal: chance.animal.bind(chance)
127
+ 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"]
118
128
  },
119
129
 
120
- scdProps: { },
130
+ scdProps: {},
131
+ mirrorProps: {
132
+ isBot: { events: "*", values: [false, false, false, false, true] },
133
+ profit: { events: ["checkout"], values: [4, 2, 42, 420] },
134
+ watchTimeSec: {
135
+ events: ["watch video"],
136
+ values: weightedRange(50, 1200, 247, 6)
137
+ }
138
+
139
+ },
121
140
 
122
141
  /*
123
142
  for group analytics keys, we need an array of arrays [[],[],[]]
@@ -126,6 +145,9 @@ const config = {
126
145
  groupKeys: [],
127
146
  groupProps: {},
128
147
  lookupTables: [],
148
+ hook: function (record, type, meta) {
149
+ return record;
150
+ }
129
151
  };
130
152
 
131
153
 
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "1.2.21",
3
+ "version": "1.3.0",
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
8
  "start": "node index.js",
9
- "dev": "./scripts/go.sh",
10
- "prune": "rm ./data/*",
9
+ "dev": "./scripts/go.sh",
10
+ "complex": "nodemon index.js --complex --e 10000 --u 100",
11
+ "simple": "nodemon index.js --simple --e 10000 --u 100",
12
+ "prune": "rm ./data/*",
11
13
  "post": "npm publish",
12
- "test": "jest --runInBand",
14
+ "test": "NODE_ENV=test jest --runInBand",
13
15
  "deps": "sh ./scripts/deps.sh"
14
16
  },
15
17
  "repository": {
@@ -38,7 +40,7 @@
38
40
  },
39
41
  "homepage": "https://github.com/ak--47/make-mp-data#readme",
40
42
  "dependencies": {
41
- "ak-tools": "^1.0.55",
43
+ "ak-tools": "^1.0.58",
42
44
  "chance": "^1.1.11",
43
45
  "dayjs": "^1.11.11",
44
46
  "mixpanel-import": "^2.5.51",
package/tests/e2e.test.js CHANGED
@@ -24,7 +24,7 @@ describe('module', () => {
24
24
  expect(eventData.length).toBeGreaterThan(980);
25
25
  expect(groupProfilesData.length).toBe(0);
26
26
  expect(lookupTableData.length).toBe(0);
27
- expect(scdTableData.length).toBeGreaterThan(200);
27
+ expect(scdTableData.length).toBe(0);
28
28
  expect(userProfilesData.length).toBe(100);
29
29
 
30
30
  }, timeout);
@@ -46,10 +46,10 @@ describe('module', () => {
46
46
  const results = await generate({ ...complex, verbose: true, writeToDisk: false, numEvents: 1100, numUsers: 100, seed: "deal with it" });
47
47
  const { eventData, groupProfilesData, lookupTableData, scdTableData, userProfilesData } = results;
48
48
  expect(eventData.length).toBeGreaterThan(980);
49
- expect(groupProfilesData[0]?.data?.length).toBe(350);
50
- expect(lookupTableData.length).toBe(1);
49
+ expect(groupProfilesData[0]?.data?.length).toBe(500);
50
+ expect(lookupTableData.length).toBe(2);
51
51
  expect(lookupTableData[0].data.length).toBe(1000);
52
- expect(scdTableData.length).toBeGreaterThan(200);
52
+ expect(scdTableData.length).toBe(5);
53
53
  expect(userProfilesData.length).toBe(100);
54
54
 
55
55
  }, timeout);
@@ -61,21 +61,30 @@ describe('module', () => {
61
61
  expect(eventData.length).toBeGreaterThan(980);
62
62
  expect(groupProfilesData.length).toBe(0);
63
63
  expect(lookupTableData.length).toBe(0);
64
- expect(scdTableData.length).toBeGreaterThan(200);
64
+ expect(scdTableData.length).toBe(0);
65
65
  expect(userProfilesData.length).toBe(100);
66
66
 
67
67
  }, timeout);
68
68
 
69
+ test('fails with invalid configuration', async () => {
70
+ try {
71
+ await generate({ numUsers: -10 });
72
+ } catch (e) {
73
+ expect(e).toBeDefined();
74
+ }
75
+ }, timeout);
76
+
77
+
69
78
 
70
79
  });
71
80
 
72
81
  describe('cli', () => {
73
82
  test('works as CLI (complex)', async () => {
74
83
  console.log('COMPLEX CLI TEST');
75
- const run = execSync(`node ./index.js --numEvents 1000 --numUsers 100 --seed "deal with it" --complex`);
76
- expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
84
+ const run = execSync(`node ./index.js --numEvents 1000 --numUsers 100 --seed "deal with it" --complex`, { stdio: 'ignore' });
85
+ // expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
77
86
  const csvs = (await u.ls('./data')).filter(a => a.includes('.csv'));
78
- expect(csvs.length).toBe(5);
87
+ expect(csvs.length).toBe(12);
79
88
  clearData();
80
89
  }, timeout);
81
90
 
@@ -84,7 +93,7 @@ describe('cli', () => {
84
93
  const run = execSync(`node ./index.js --numEvents 1000 --numUsers 100 --seed "deal with it"`);
85
94
  expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
86
95
  const csvs = (await u.ls('./data')).filter(a => a.includes('.csv'));
87
- expect(csvs.length).toBe(2);
96
+ expect(csvs.length).toBe(3);
88
97
  clearData();
89
98
  }, timeout);
90
99
 
@@ -93,12 +102,13 @@ describe('cli', () => {
93
102
  const run = execSync(`node ./index.js ./models/deepNest.js`);
94
103
  expect(run.toString().trim().includes('have a wonderful day :)')).toBe(true);
95
104
  const csvs = (await u.ls('./data')).filter(a => a.includes('.csv'));
96
- expect(csvs.length).toBe(3);
105
+ expect(csvs.length).toBe(2);
97
106
  clearData();
98
107
  }, timeout);
99
108
 
100
109
  });
101
110
 
111
+
102
112
  describe('options + tweaks', () => {
103
113
  test('creates sessionIds', async () => {
104
114
  const results = await generate({ writeToDisk: false, numEvents: 1000, numUsers: 100, sessionIds: true });