make-mp-data 3.0.4 → 3.0.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.
Files changed (70) hide show
  1. package/README.md +46 -0
  2. package/dungeons/array-of-object-lookup-schema.json +327 -0
  3. package/dungeons/array-of-object-lookup.js +28 -8
  4. package/dungeons/capstone/capstone-ic3.js +291 -0
  5. package/dungeons/capstone/capstone-ic4.js +598 -0
  6. package/dungeons/capstone/capstone-ic5.js +668 -0
  7. package/dungeons/capstone/generate-product-lookup.js +309 -0
  8. package/dungeons/ecommerce-schema.json +462 -0
  9. package/dungeons/{copilot.js → ecommerce.js} +77 -15
  10. package/dungeons/education-schema.json +2409 -0
  11. package/dungeons/education.js +206 -442
  12. package/dungeons/fintech-schema.json +14034 -0
  13. package/dungeons/fintech.js +110 -389
  14. package/dungeons/foobar-schema.json +403 -0
  15. package/dungeons/foobar.js +27 -4
  16. package/dungeons/food-delivery-schema.json +192 -0
  17. package/dungeons/food-delivery.js +602 -0
  18. package/dungeons/food-schema.json +1152 -0
  19. package/dungeons/food.js +150 -383
  20. package/dungeons/gaming-schema.json +1270 -0
  21. package/dungeons/gaming.js +143 -3
  22. package/dungeons/insurance-application-schema.json +204 -0
  23. package/dungeons/insurance-application.js +605 -0
  24. package/dungeons/media-schema.json +906 -0
  25. package/dungeons/media.js +221 -391
  26. package/dungeons/retention-cadence-schema.json +78 -0
  27. package/dungeons/retention-cadence.js +35 -1
  28. package/dungeons/rpg-schema.json +4526 -0
  29. package/dungeons/rpg.js +130 -388
  30. package/dungeons/sanity-schema.json +255 -0
  31. package/dungeons/sanity.js +21 -10
  32. package/dungeons/sass-schema.json +1291 -0
  33. package/dungeons/sass.js +210 -337
  34. package/dungeons/scd-schema.json +919 -0
  35. package/dungeons/scd.js +38 -10
  36. package/dungeons/simple-schema.json +608 -0
  37. package/dungeons/simple.js +48 -11
  38. package/dungeons/simplest-schema.json +1418 -0
  39. package/dungeons/simplest.js +392 -0
  40. package/dungeons/social-schema.json +1118 -0
  41. package/dungeons/social.js +124 -365
  42. package/dungeons/text-generation-schema.json +3096 -0
  43. package/dungeons/text-generation.js +71 -0
  44. package/index.js +6 -3
  45. package/lib/core/config-validator.js +18 -0
  46. package/lib/core/storage.js +5 -5
  47. package/lib/generators/events.js +4 -4
  48. package/lib/orchestrators/mixpanel-sender.js +12 -7
  49. package/lib/orchestrators/user-loop.js +14 -6
  50. package/lib/templates/soup-presets.js +188 -0
  51. package/lib/utils/utils.js +52 -6
  52. package/package.json +1 -1
  53. package/types.d.ts +20 -3
  54. package/dungeons/adspend.js +0 -117
  55. package/dungeons/anon.js +0 -128
  56. package/dungeons/benchmark-heavy.js +0 -240
  57. package/dungeons/benchmark-light.js +0 -126
  58. package/dungeons/big.js +0 -226
  59. package/dungeons/business.js +0 -391
  60. package/dungeons/complex.js +0 -428
  61. package/dungeons/experiments.js +0 -137
  62. package/dungeons/funnels.js +0 -309
  63. package/dungeons/mil.js +0 -323
  64. package/dungeons/mirror.js +0 -160
  65. package/dungeons/soup-test.js +0 -52
  66. package/dungeons/streaming.js +0 -372
  67. package/dungeons/strict-event-test.js +0 -30
  68. package/dungeons/student-teacher.js +0 -438
  69. package/dungeons/too-big-events.js +0 -203
  70. package/dungeons/user-agent.js +0 -209
@@ -1,428 +0,0 @@
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
- import Chance from 'chance';
10
- const chance = new Chance();
11
- import dayjs from "dayjs";
12
- import utc from "dayjs/plugin/utc.js";
13
- dayjs.extend(utc);
14
- import { weighNumRange, date, integer } from "../lib/utils/utils.js";
15
- import * as u from 'ak-tools';
16
-
17
- /** @type {import('../types.js').Dungeon} */
18
- const config = {
19
- token: "",
20
- seed: "quite complexus",
21
- numDays: 30, //how many days worth of data
22
- numEvents: 100_000, //how many events
23
- numUsers: 1000, //how many users
24
- format: 'json', //csv or json
25
- region: "US",
26
- hasAnonIds: true, //if true, anonymousIds are created for each user
27
- hasSessionIds: true, //if true, hasSessionIds are created for each user
28
-
29
- hasLocation: true,
30
- hasAndroidDevices: true,
31
- hasIOSDevices: true,
32
- hasDesktopDevices: true,
33
- hasBrowser: true,
34
- hasCampaigns: true,
35
- isAnonymous: false,
36
- hasAdSpend: true,
37
-
38
- hasAvatar: true,
39
-
40
- batchSize: 500_000,
41
- concurrency: 1,
42
-
43
- funnels: [],
44
- events: [
45
- {
46
- "event": "checkout",
47
- "weight": 2,
48
- "properties": {
49
- amount: weighNumRange(5, 500, .25),
50
- currency: ["USD", "USD", "USD", "CAD", "EUR", "EUR", "BTC", "BTC", "ETH", "JPY"],
51
- cart: makeProducts(12),
52
- }
53
- },
54
- {
55
- "event": "add to cart",
56
- "weight": 4,
57
- "properties": {
58
- amount: weighNumRange(5, 500, .25),
59
- qty: integer(1, 5),
60
- product_id: weighNumRange(1, 1000, 1.4)
61
- }
62
- },
63
- {
64
- "event": "page view",
65
- "weight": 10,
66
- "properties": {
67
- page: ["/", "/", "/", "/learn-more", "/pricing", "/contact", "/about", "/careers", "/sign-up", "/login", "/app", "/app", "/app", "/app"],
68
- utm_source: ["$organic", "$organic", "$organic", "$organic", "google", "google", "google", "facebook", "facebook", "twitter", "linkedin"],
69
- }
70
- },
71
- {
72
- "event": "watch video",
73
- "weight": 8,
74
- "properties": {
75
- category: ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"],
76
- hashTags: makeHashTags,
77
- watchTimeSec: weighNumRange(10, 600, .25,),
78
- quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
79
- format: ["mp4", "avi", "mov", "mpg"],
80
- video_id: weighNumRange(1, 50000, 1.4),
81
-
82
- }
83
- },
84
- {
85
- "event": "comment",
86
- "weight": 2,
87
- "properties": {
88
- length: weighNumRange(1, 500, .25),
89
- video_id: weighNumRange(1, 50000, 1.4),
90
- has_replies: [true, false, false, false, false],
91
- has_photo: [true, false, false, false, false],
92
-
93
- }
94
- },
95
- {
96
- "event": "save video",
97
- "weight": 4,
98
- "properties": {
99
- video_id: weighNumRange(1, 50000, 1.4),
100
- ui_control: ["toolbar", "menu", "keyboard"]
101
-
102
-
103
- }
104
- },
105
- {
106
- "event": "view item",
107
- "weight": 8,
108
- "properties": {
109
- product_id: weighNumRange(1, 24, 3),
110
- colors: ["light", "dark", "custom", "dark"]
111
- }
112
- },
113
- {
114
- "event": "save item",
115
- "weight": 5,
116
- "properties": {
117
- product_id: weighNumRange(1, 1000, 12),
118
- colors: ["light", "dark", "custom", "dark"]
119
- }
120
- },
121
- {
122
- "event": "support ticket",
123
- "weight": 2,
124
- "properties": {
125
- product_id: weighNumRange(1, 1000, .6),
126
- description: chance.sentence.bind(chance),
127
- severity: ["low", "medium", "high"],
128
- ticket_id: chance.guid.bind(chance)
129
- }
130
- },
131
- {
132
- "event": "sign up",
133
- "isFirstEvent": true,
134
- "weight": 0,
135
- "properties": {
136
- plan: ["free", "free", "free", "free", "basic", "basic", "basic", "premium", "premium", "enterprise"],
137
- dateOfRenewal: date(100, false),
138
- codewords: u.makeName,
139
- }
140
- }
141
- ],
142
- superProps: {
143
- linked_device: deviceAttributes()
144
- // emotions: generateEmoji(),
145
-
146
- },
147
- /*
148
- user properties work the same as event properties
149
- each key should be an array or function reference
150
- */
151
- userProps: {
152
- title: chance.profession.bind(chance),
153
- luckyNumber: weighNumRange(42, 420),
154
- experiment: designExperiment(),
155
- spiritAnimal: ["unicorn", "dragon", "phoenix", "sasquatch", "yeti", "kraken", "jackalope", "thunderbird", "mothman", "nessie", "chupacabra", "jersey devil", "bigfoot", "weindgo", "bunyip", "mokele-mbembe", "tatzelwurm", "megalodon"],
156
- timezone: chance.timezone.bind(chance), // ["America/New_York", "America/Los_Angeles", "America/Chicago", "America/Denver", "America/Phoenix", "America/Anchorage", "Pacific/Honolulu"]
157
- ip: chance.ip.bind(chance),
158
- lastCart: makeProducts(5),
159
-
160
- },
161
-
162
- /** each generates it's own table */
163
- scdProps: {
164
- role: {
165
- type: "user",
166
- frequency: "week",
167
- values: ["admin", "collaborator", "user", "view only", "no access"],
168
- timing: 'fuzzy',
169
- max: 10
170
- },
171
- NPS: {
172
- type: "user",
173
- frequency: "day",
174
- values: weighNumRange(1, 10, 2, 150),
175
- timing: 'fuzzy',
176
- max: 10
177
- },
178
- MRR: {
179
- type: "company_id",
180
- frequency: "month",
181
- values: weighNumRange(0, 10000, .15),
182
- timing: 'fixed',
183
- max: 10
184
- },
185
- AccountHealthScore: {
186
- type: "company_id",
187
- frequency: "week",
188
- values: weighNumRange(1, 10, .15),
189
- timing: 'fixed',
190
- max: 40
191
- },
192
- plan: {
193
- type: "company_id",
194
- frequency: "month",
195
- values: ["free", "basic", "premium", "enterprise"],
196
- timing: 'fixed',
197
- max: 10
198
- }
199
- },
200
-
201
- mirrorProps: {
202
- isBot: { events: "*", values: [false, false, false, false, true] },
203
- profit: { events: ["checkout"], values: [4, 2, 42, 420] },
204
- watchTimeSec: {
205
- events: ["watch video"],
206
- values: weighNumRange(50, 1200, 2)
207
- }
208
- },
209
-
210
- /*
211
- for group analytics keys, we need an array of arrays [[],[],[]]
212
- each pair represents a group_key and the number of profiles for that key
213
- */
214
- groupKeys: [
215
- ['company_id', 500, []],
216
- ['room_id', 10000, ["save video", "comment", "watch video"]],
217
-
218
- ],
219
- groupProps: {
220
- company_id: {
221
- name: () => { return chance.company(); },
222
- email: () => { return `CSM: ${chance.pickone(["AK", "Jessica", "Michelle", "Dana", "Brian", "Dave"])}`; },
223
- "# of employees": weighNumRange(3, 10000),
224
- "industry": ["tech", "finance", "healthcare", "education", "government", "non-profit"],
225
- "segment": ["enterprise", "SMB", "mid-market"],
226
- "products": [["core"], ["core"], ["core", "add-ons"], ["core", "pro-serve"], ["core", "add-ons", "pro-serve"], ["core", "BAA", "enterprise"], ["free"], ["free"], ["free", "addons"]],
227
- },
228
- room_id: {
229
- name: () => { return `#${chance.word({ length: integer(4, 24), capitalize: true })}`; },
230
- email: ["public", "private"],
231
- "room provider": ["partner", "core", "core", "core"],
232
- "room capacity": weighNumRange(3, 1000000),
233
- "isPublic": [true, false, false, false, false],
234
- "country": chance.country.bind(chance),
235
- "isVerified": [true, true, false, false, false],
236
- }
237
- },
238
- groupEvents: [{
239
- attribute_to_user: false,
240
- event: "card charged",
241
- weight: 1,
242
- frequency: 30,
243
- group_key: "company_id",
244
- group_size: 500,
245
- properties: {
246
- amount: weighNumRange(5, 500, .25),
247
- currency: ["USD", "USD", "USD", "CAD", "EUR", "EUR", "BTC", "BTC", "ETH", "JPY"],
248
- plan: ["basic", "premium", "enterprise"],
249
- "payment method": []
250
- }
251
- }],
252
-
253
- lookupTables: [
254
- {
255
- key: "product_id",
256
- entries: 1000,
257
- attributes: {
258
- category: [
259
- "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"
260
- ],
261
- "demand": ["high", "medium", "medium", "low"],
262
- "supply": ["high", "medium", "medium", "low"],
263
- "manufacturer": chance.company.bind(chance),
264
- "price": weighNumRange(5, 500, .25),
265
- "rating": weighNumRange(1, 5),
266
- "reviews": weighNumRange(0, 35)
267
- }
268
-
269
- },
270
- {
271
- key: "video_id",
272
- entries: 50000,
273
- attributes: {
274
- isFlagged: [true, false, false, false, false],
275
- copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
276
- uploader_id: chance.guid.bind(chance),
277
- "uploader influence": ["low", "low", "low", "medium", "medium", "high"],
278
- thumbs: weighNumRange(0, 35),
279
- rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
280
- }
281
-
282
- }
283
- ],
284
-
285
- hook: function (record, type, meta) {
286
- // event hook: weekend watch time boost — videos watched on weekends get 1.5x duration
287
- if (type === "event") {
288
- if (record.event === "watch video" && record.time) {
289
- const day = dayjs(record.time).day();
290
- if (day === 0 || day === 6) {
291
- record.watchTimeSec = Math.round((record.watchTimeSec || 60) * 1.5);
292
- record.is_weekend = true;
293
- }
294
- }
295
- // support tickets on high-severity get escalated flag
296
- if (record.event === "support ticket" && record.severity === "high") {
297
- record.escalated = true;
298
- }
299
- }
300
-
301
- // everything hook: simulate cart abandonment — users who "add to cart" but never "checkout" lose their last add-to-cart
302
- if (type === "everything") {
303
- const hasCheckout = record.some(e => e.event === "checkout");
304
- const hasAddToCart = record.some(e => e.event === "add to cart");
305
- if (hasAddToCart && !hasCheckout) {
306
- // mark all their add-to-cart events as abandoned
307
- for (const e of record) {
308
- if (e.event === "add to cart") {
309
- e.abandoned = true;
310
- }
311
- }
312
- }
313
- return record;
314
- }
315
-
316
- return record;
317
- }
318
- };
319
-
320
-
321
-
322
- function makeHashTags() {
323
- const possibleHashtags = [];
324
- for (let i = 0; i < 20; i++) {
325
- possibleHashtags.push('#' + u.makeName(2, ''));
326
- }
327
-
328
- const numHashtags = integer(integer(1, 5), integer(5, 10));
329
- const hashtags = [];
330
- for (let i = 0; i < numHashtags; i++) {
331
- hashtags.push(chance.pickone(possibleHashtags));
332
- }
333
- return [hashtags];
334
- };
335
-
336
- function makeProducts(maxItems = 10) {
337
-
338
- return function () {
339
- 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"];
340
- const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
341
- const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
342
- const data = [];
343
- const numOfItems = integer(1, 12);
344
-
345
- for (var i = 0; i < numOfItems; i++) {
346
- const category = chance.pickone(categories);
347
- const slug = chance.pickone(slugs);
348
- const asset = chance.pickone(assetExtension);
349
- const product_id = chance.guid();
350
- const price = integer(1, 300);
351
- const quantity = integer(1, 5);
352
-
353
- const item = {
354
- product_id: product_id,
355
- sku: integer(11111, 99999),
356
- amount: price,
357
- quantity: quantity,
358
- value: price * quantity,
359
- featured: chance.pickone([true, false]),
360
- category: category,
361
- urlSlug: slug + category,
362
- asset: `${category}-${integer(1, 20)}${asset}`
363
- };
364
-
365
- data.push(item);
366
- }
367
-
368
- return () => [data];
369
- };
370
- };
371
-
372
-
373
- function designExperiment() {
374
- return function () {
375
- const variants = ["A", "B", "C", "Control"];
376
- const variant = chance.pickone(variants);
377
- const experiments = ["no password", "social sign in", "new tutorial", "new search"];
378
- const experiment = chance.pickone(experiments);
379
- const multi_variates = ["A/B", "A/B/C", "A/B/C/D", "Control"];
380
- const multi_variate = chance.pickone(multi_variates);
381
- const impression_id = chance.guid();
382
-
383
-
384
-
385
- const chosen = {
386
- variant,
387
- experiment,
388
- multi_variate,
389
- impression_id
390
- };
391
-
392
- return [chosen];
393
- };
394
- }
395
-
396
- function deviceAttributes(isMobile = false) {
397
- return function () {
398
- let devices = ["desktop", "laptop", "desktop", "laptop", "desktop", "laptop", "other"];
399
- if (isMobile) devices = [...devices, "mobile", "mobile", "mobile", "tablet"];
400
- const device = chance.pickone(devices);
401
- let oses = ["Windows", "macOS", "Windows", "macOS", "macOS", "Linux", "Windows", "macOS", "Windows", "macOS", "macOS", "TempleOS"];
402
- if (isMobile) oses = [...oses, "iOS", "Android", "iOS", "Android"];
403
- const os = chance.pickone(oses);
404
- const browser = chance.pickone(["Chrome", "Firefox", "Safari", "Edge", "Opera", "IE", "Brave", "Vivaldi"]);
405
- const version = chance.integer({ min: 1, max: 15 });
406
- const resolution = chance.pickone(["1920x1080", "1280x720", "1024x768", "800x600", "640x480"]);
407
- const language = chance.pickone(["en-US", "en-US", "en-US", "en-GB", "es", "es", "fr", "de", "it", "ja", "zh", "ru"]);
408
-
409
- const chosen = {
410
- platform: device,
411
- os,
412
- browser,
413
- version,
414
- resolution,
415
- language
416
- };
417
-
418
- return chosen;
419
-
420
- };
421
- }
422
-
423
-
424
-
425
-
426
-
427
-
428
- export default config;
@@ -1,137 +0,0 @@
1
-
2
- import dayjs from 'dayjs';
3
- import utc from 'dayjs/plugin/utc.js';
4
- import 'dotenv/config';
5
- import * as u from "../lib/utils/utils.js";
6
- import * as v from 'ak-tools';
7
-
8
- const SEED = "my-seed";
9
- dayjs.extend(utc);
10
- const chance = u.initChance(SEED);
11
- const num_users = 5_000;
12
- const days = 100;
13
-
14
- /** @typedef {import("../types.js").Dungeon} Config */
15
-
16
- /** @type {Config} */
17
- const config = {
18
- token: "",
19
- seed: SEED,
20
- numDays: days,
21
- numEvents: num_users * 100,
22
- numUsers: num_users,
23
- hasAnonIds: false,
24
- hasSessionIds: false,
25
- format: "json",
26
- alsoInferFunnels: true,
27
- hasLocation: true,
28
- hasAndroidDevices: true,
29
- hasIOSDevices: true,
30
- hasDesktopDevices: true,
31
- hasBrowser: true,
32
- hasCampaigns: true,
33
- isAnonymous: false,
34
- hasAdSpend: false,
35
-
36
- hasAvatar: true,
37
-
38
-
39
- batchSize: 2_500_000,
40
- concurrency: 1,
41
- writeToDisk: false,
42
-
43
- funnels: [],
44
- events: [
45
- {
46
- event: "$experiment_started",
47
- weight: 5,
48
- isSessionStartEvent: true,
49
- properties: {
50
- "$experiment_type": "all_my_own",
51
- "Experiment name": "name of experiment",
52
- "Variant name": ["variant 1", "variant 2", "variant 3", "control"],
53
- }
54
- },
55
- {
56
- event: "super common event",
57
- weight: 50,
58
- properties: {
59
- "foo": ["bar", "baz", "qux"],
60
- }
61
- },
62
- {
63
- event: "less common event",
64
- weight: 20,
65
- properties: {
66
- "hello": ["world", "universe", "galaxy"],
67
- }
68
- },
69
- {
70
- event: "rare event",
71
- weight: 5,
72
- properties: {
73
- "goodbye": ["cruel world", "universe", "galaxy"],
74
- }
75
- },
76
- {
77
- event: "money event",
78
- weight: 10,
79
- properties: {
80
- "amount": u.weighNumRange(5, 500, .25),
81
- "currency": ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
82
- "numItems": u.weighNumRange(1, 10),
83
- }
84
- }
85
- ],
86
- superProps: {},
87
- userProps: {},
88
- scdProps: {},
89
- mirrorProps: {},
90
- groupKeys: [],
91
- groupProps: {},
92
- lookupTables: [],
93
- hook: function (record, type, meta) {
94
- const NOW = dayjs();
95
-
96
- if (type === "event") {
97
- const EVENT_TIME = dayjs(record.time);
98
- // Pattern 1: "variant 1" users spend more money (winning variant)
99
- if (record.event === "money event" && record["Variant name"] === "variant 1") {
100
- record.amount = Math.round((record.amount || 50) * 1.5);
101
- }
102
- // Pattern 2: "control" users see fewer rare events (simulating lower engagement)
103
- // handled in "everything" below
104
- }
105
-
106
- if (type === "user") {
107
-
108
- }
109
-
110
- if (type === "funnel-post") {
111
-
112
- }
113
-
114
- if (type === "funnel-pre") {
115
-
116
- }
117
-
118
- if (type === "scd") {
119
-
120
- }
121
-
122
- if (type === "everything") {
123
- // Pattern 3: Control variant users have 30% of their "rare event" events removed
124
- // to simulate lower engagement in control group
125
- return record.filter(e => {
126
- if (e.event === "rare event" && e["Variant name"] === "control" && Math.random() < 0.3) {
127
- return false;
128
- }
129
- return true;
130
- });
131
- }
132
-
133
- return record;
134
- }
135
- };
136
-
137
- export default config;