make-mp-data 1.5.52 → 1.5.54

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/dungeons/big.js CHANGED
@@ -15,146 +15,219 @@ const chance = new Chance();
15
15
  const dayjs = require("dayjs");
16
16
  const utc = require("dayjs/plugin/utc");
17
17
  dayjs.extend(utc);
18
- const { uid, comma } = require('ak-tools');
19
- const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
18
+ const { uid, comma, makeName } = require('ak-tools');
19
+ const { pickAWinner, weighNumRange, integer, date, choose } = require('../components/utils');
20
+
21
+ const eventsPerQuarter = 5_000_000_000 // ~5 billion
22
+ const numQuarters = 8;
23
+ const totalEvents = eventsPerQuarter * numQuarters;
24
+ const eventPerUser = 500;
25
+ const totalUsers = totalEvents / eventPerUser;
26
+ const totalDays = (numQuarters * 90) + 10;
20
27
 
21
28
  /** @type {import('../types').Dungeon} */
22
29
  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
30
+ token: "64b48bc361f4477634bdfafb78ef39ad",
31
+ seed: "lets go big",
32
+ numDays: totalDays,
33
+ numEvents: totalEvents,
34
+ numUsers: totalUsers,
35
+ format: 'json', //csv or json
29
36
  region: "US",
30
- hasAnonIds: true, //if true, anonymousIds are created for each user
37
+ hasAnonIds: false, //if true, anonymousIds are created for each user
31
38
  hasSessionIds: false, //if true, hasSessionIds are created for each user
32
39
  hasLocation: true,
33
- events: [
40
+ hasAndroidDevices: false,
41
+ alsoInferFunnels: false,
42
+ batchSize: 5_000_000,
43
+ hasAvatar: true,
44
+ hasAdSpend: false,
45
+ hasBrowser: false,
46
+ hasCampaigns: false,
47
+ hasDesktopDevices: false,
48
+ hasIOSDevices: false,
49
+ writeToDisk: false,
50
+ funnels: [
34
51
  {
35
- event: "foo",
36
- weight: 10,
37
- properties: {}
52
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
53
+ weight: 1,
54
+ order: "sequential"
38
55
  },
39
56
  {
40
- event: "bar",
41
- weight: 9,
42
- properties: {}
57
+ "sequence": ["foo", "bar"],
58
+ weight: 25,
59
+ order: "sequential"
43
60
  },
44
61
  {
45
- event: "baz",
46
- weight: 8,
47
- properties: {}
62
+ "sequence": ["foo", "bar", "baz"],
63
+ weight: 20,
64
+ order: "sequential"
48
65
  },
49
66
  {
50
- event: "qux",
51
- weight: 7,
52
- properties: {}
67
+ "sequence": ["foo", "bar", "baz", "qux"],
68
+ weight: 15,
69
+ order: "sequential"
53
70
  },
54
71
  {
55
- event: "garply",
56
- weight: 6,
57
- properties: {}
72
+ "sequence": ["foo", "bar", "baz", "qux", "garply"],
73
+ weight: 10,
74
+ order: "sequential"
58
75
  },
59
76
  {
60
- event: "durtle",
61
- weight: 5,
62
- properties: {}
77
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle"],
78
+ weight: 8,
79
+ order: "sequential"
63
80
  },
64
81
  {
65
- event: "linny",
66
- weight: 4,
67
- properties: {}
82
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny"],
83
+ weight: 6,
84
+ order: "sequential"
68
85
  },
69
86
  {
70
- event: "fonk",
71
- weight: 3,
72
- properties: {}
87
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk"],
88
+ weight: 4,
89
+ order: "sequential"
73
90
  },
74
91
  {
75
- event: "crumn",
92
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn"],
76
93
  weight: 2,
77
- properties: {}
94
+ order: "sequential"
78
95
  },
79
96
  {
80
- event: "yak",
97
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
81
98
  weight: 1,
82
- properties: {}
99
+ order: "sequential"
83
100
  }
84
- ],
85
- superProps: {
86
- color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
87
- number: integer,
88
101
 
102
+ ],
103
+ events: [
104
+ { event: "foo" },
105
+ { event: "bar" },
106
+ { event: "baz" },
107
+ { event: "qux" },
108
+ { event: "garply" },
109
+ { event: "durtle" },
110
+ { event: "linny" },
111
+ { event: "fonk" },
112
+ { event: "crumn" },
113
+ { event: "yak" }
114
+ ],
115
+ //? https://docs.mixpanel.com/docs/data-structure/property-reference/data-type
116
+ superProps: {
117
+ "string": pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"]),
118
+ "number": integer,
119
+ "boolean": [true, true, false],
120
+ "date": () => date(90),
121
+ "string []": buildStringArray,
122
+ "number []": buildNumberArray,
123
+ "object {}": buildObjectProp,
124
+ "object [{}]": buildObjArrayProp
89
125
  },
90
126
  userProps: {
91
127
  title: chance.profession.bind(chance),
92
128
  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"]
129
+ 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"]),
130
+ isHappyCustomer: pickAWinner([true, true, false]),
94
131
  },
132
+ hook: function (record, type, meta) {
95
133
 
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
134
 
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),
135
+ // if (type === "event") {
136
+ // debugger;
137
+ // }
116
138
 
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
- }
139
+ // if (type === "user") {
140
+
141
+ // }
142
+
143
+ // if (type === "funnel-post") {
144
+
145
+ // }
146
+
147
+ // if (type === "funnel-pre") {
148
+
149
+ // }
150
+
151
+ // if (type === "scd") {
152
+
153
+ // }
154
+
155
+ // if (type === "everything") {
156
+ // debugger;
157
+ // }
138
158
 
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
159
  return record;
155
160
  }
156
161
  };
157
162
 
158
163
 
164
+ function buildObjectProp() {
165
+ return function () {
166
+ return {
167
+ "foo key": choose(pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"])()),
168
+ "bar key": integer(1, 100),
169
+ "baz key": choose(pickAWinner([true, true, false])()),
170
+ };
171
+ };
172
+ }
173
+
174
+
175
+ function buildNumberArray() {
176
+ return function () {
177
+ const arr = [];
178
+ const times = integer(1, 10);
179
+ for (let i = 0; i < times; i++) {
180
+ arr.push(integer(1, 100));
181
+ }
182
+ return [arr];
183
+ };
184
+ }
185
+
186
+ function buildStringArray() {
187
+ return function () {
188
+ const arr = [];
189
+ const times = integer(1, 10);
190
+ for (let i = 0; i < times; i++) {
191
+ arr.push(makeName(integer(1, 3), " "));
192
+ }
193
+ return [arr];
194
+ };
195
+ }
196
+
197
+
198
+ function buildObjArrayProp(maxItems = 5) {
199
+
200
+ return function () {
201
+ 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"];
202
+ const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
203
+ const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
204
+ const data = [];
205
+ const numOfItems = integer(1, maxItems);
206
+
207
+ for (var i = 0; i < numOfItems; i++) {
208
+ const category = chance.pickone(categories);
209
+ const slug = chance.pickone(slugs);
210
+ const asset = chance.pickone(assetExtension);
211
+ const price = integer(1, 300);
212
+ const quantity = integer(1, 5);
213
+
214
+ const item = {
215
+ sku: integer(11111, 99999),
216
+ amount: price,
217
+ quantity: quantity,
218
+ total: price * quantity,
219
+ featured: chance.pickone([true, false]),
220
+ category: category,
221
+ urlSlug: slug + category,
222
+ asset: `${category}-${integer(1, 20)}${asset}`
223
+ };
224
+
225
+ data.push(item);
226
+ }
227
+
228
+ return () => [data];
229
+ };
230
+ };
231
+
159
232
 
160
233
  module.exports = config;
File without changes
@@ -0,0 +1,323 @@
1
+
2
+ const SEED = "my-seed";
3
+ const dayjs = require("dayjs");
4
+ const utc = require("dayjs/plugin/utc");
5
+ dayjs.extend(utc);
6
+ require("dotenv").config();
7
+ const u = require("../components/utils.js");
8
+ const v = require("ak-tools");
9
+ const chance = u.initChance(SEED);
10
+ const num_users = 10_000;
11
+ const days = 108;
12
+
13
+ /** @typedef {import("../types.js").Dungeon} Config */
14
+
15
+ /** @type {Config} */
16
+ const config = {
17
+ token: "",
18
+ seed: "twerk",
19
+ numDays: days,
20
+ numEvents: num_users * 100,
21
+ numUsers: num_users,
22
+ hasAnonIds: false,
23
+ hasSessionIds: false,
24
+ format: "json",
25
+ alsoInferFunnels: false,
26
+ hasLocation: true,
27
+ hasAndroidDevices: true,
28
+ hasIOSDevices: true,
29
+ hasDesktopDevices: true,
30
+ hasBrowser: false,
31
+ hasCampaigns: false,
32
+ isAnonymous: false,
33
+ hasAdSpend: false,
34
+ percentUsersBornInDataset: 35,
35
+
36
+ hasAvatar: true,
37
+ makeChart: false,
38
+
39
+ batchSize: 1_500_000,
40
+ concurrency: 1,
41
+ writeToDisk: false,
42
+ funnels: [
43
+ {
44
+ "sequence": ["app install", "character creation", "join party"],
45
+ "isFirstFunnel": true,
46
+ "conversionRate": 0.8,
47
+ "timeToConvert": .25,
48
+ },
49
+ {
50
+ "sequence": ["start quest", "gameplay summary", "complete quest"],
51
+ conversionRate: 0.99,
52
+ timeToConvert: 1,
53
+ props: {
54
+ "quest type": u.pickAWinner([
55
+ "Rescue",
56
+ "Retrieve",
57
+ "Explore",
58
+ "Destroy",
59
+ "Investigate",
60
+ ]),
61
+ "quest difficulty": u.pickAWinner([
62
+ "Easy",
63
+ "Medium",
64
+ "Hard",
65
+ "Legendary",
66
+ ]),
67
+ "quest location": u.pickAWinner([
68
+ "Forest",
69
+ "Dungeon",
70
+ "Mountain",
71
+ "City",
72
+ "Desert",
73
+ ])
74
+ }
75
+ },
76
+ ],
77
+ events: [
78
+ { event: "app install", weight: 10, isFirstEvent: true },
79
+ {
80
+ event: "character creation",
81
+ weight: 2,
82
+ properties: {
83
+ mode: u.pickAWinner(["fast", "slow", "template"]),
84
+ },
85
+ },
86
+ {
87
+ event: "join party",
88
+ weight: 8,
89
+ properties: {
90
+ "party size": u.weighNumRange(1, 6),
91
+ "party leader": u.pickAWinner([
92
+ "Bard",
93
+ "Cleric",
94
+ "Fighter",
95
+ "Rogue",
96
+ "Wizard",
97
+ "Paladin",
98
+ "Ranger",
99
+ "Sorcerer",
100
+ "Warlock",
101
+ ]),
102
+ },
103
+ },
104
+ {
105
+ event: "start quest",
106
+ weight: 12,
107
+ properties: {},
108
+ },
109
+ {
110
+ event: "complete quest",
111
+ weight: 12,
112
+ properties: {},
113
+ },
114
+ {
115
+ "event": "gameplay summary",
116
+ "weight": 14,
117
+ "properties": {
118
+ "# enemies defeated": u.weighNumRange(0, 100),
119
+ "# respawns": u.weighNumRange(0, 10, 5),
120
+ "# attacks": u.weighNumRange(0, 100, 6, 12),
121
+ "# gold found": u.weighNumRange(0, 1000),
122
+ }
123
+ },
124
+ {
125
+ "event": "in-game purchase",
126
+ "weight": 2,
127
+ "properties": {
128
+ "purchase type": u.pickAWinner([
129
+ "Gold",
130
+ "Gems",
131
+ "Items: Weapons",
132
+ "Items: Armor",
133
+ "Items: Potions",
134
+ "Items: Scrolls",
135
+ "Boosts",
136
+ "Currency",
137
+ ]),
138
+ "purchase amount": u.weighNumRange(1, 50, 1, 20),
139
+ }
140
+ },
141
+ {
142
+ event: "fight boss",
143
+ weight: 3,
144
+ properties: {
145
+ "boss type": u.pickAWinner([
146
+ "Dragon",
147
+ "Demon",
148
+ "Lich",
149
+ "Vampire",
150
+ "Beholder",
151
+ ]),
152
+ "boss level": u.weighNumRange(10, 20),
153
+ "boss difficulty": u.pickAWinner([
154
+ "Hard",
155
+ "Legendary",
156
+ "Impossible",
157
+ ]),
158
+ "fight duration (mins)": u.weighNumRange(1, 60),
159
+
160
+ },
161
+ },
162
+ {
163
+ event: "level up",
164
+ weight: 1,
165
+ properties: {
166
+ "new abilities": u.pickAWinner([
167
+ "Attack",
168
+ "Spell",
169
+ "Feat",
170
+ "Skill",
171
+ ]),
172
+ },
173
+ },
174
+ // {
175
+ // event: "generic event (common)",
176
+ // weight: 5,
177
+ // properties: {
178
+ // generic_prop: u.pickAWinner(["foo", "bar", "baz", "qux"]),
179
+ // }
180
+ // },
181
+ {
182
+ event: "$experiment_started",
183
+ weight: 3,
184
+ properties: {
185
+ "Experiment name": u.pickAWinner([
186
+ "fast leveling",
187
+ "tension economy",
188
+ "free trial",
189
+ ]),
190
+ "Variant": ["A", "B", "C", "Control"],
191
+ }
192
+ },
193
+ ],
194
+ superProps: {
195
+ platform: u.pickAWinner([
196
+ "Mobile",
197
+ "Xbox",
198
+ "Playstation",
199
+ "Switch",
200
+ "Web"
201
+ ]),
202
+ "game mode": u.pickAWinner([
203
+ "Single Player",
204
+ "Multiplayer",
205
+ ], 1),
206
+ language: u.pickAWinner([
207
+ "English",
208
+ "Spanish",
209
+ "French",
210
+ "German",
211
+ "Japanese",
212
+ "Korean",
213
+ "Chinese",
214
+ ], 0),
215
+
216
+ },
217
+ scdProps: {
218
+ // "subscription MRR" : {
219
+ // "frequency": "week",
220
+ // "type": "number",
221
+ // values: u.weighNumRange(0, 250, 1, 200),
222
+ // timing: "fixed",
223
+ // max: 250,
224
+ // }
225
+ },
226
+ userProps: {
227
+
228
+ race: u.pickAWinner([
229
+ "Human",
230
+ "Elf",
231
+ "Dwarf",
232
+ "Halfling",
233
+ "Dragonborn",
234
+ "Gnome",
235
+ "Half-Elf",
236
+ "Half-Orc",
237
+ "Tiefling",
238
+ ]),
239
+ class: u.pickAWinner([
240
+ "Barbarian",
241
+ "Bard",
242
+ "Cleric",
243
+ "Druid",
244
+ "Fighter",
245
+ "Monk",
246
+ "Paladin",
247
+ "Ranger",
248
+ "Rogue",
249
+ "Sorcerer",
250
+ "Warlock",
251
+ "Wizard",
252
+ ]),
253
+ alignment: u.pickAWinner([
254
+ "Lawful Good",
255
+ "Neutral Good",
256
+ "Chaotic Good",
257
+ "Lawful Neutral",
258
+ "True Neutral",
259
+ "Chaotic Neutral",
260
+ "Lawful Evil",
261
+ "Neutral Evil",
262
+ "Chaotic Evil",
263
+ ]),
264
+ level: u.weighNumRange(1, 20),
265
+ background: u.pickAWinner([
266
+ "Acolyte",
267
+ "Charlatan",
268
+ "Criminal",
269
+ "Entertainer",
270
+ "Folk Hero",
271
+ "Guild Artisan",
272
+ "Hermit",
273
+ "Noble",
274
+ "Outlander",
275
+ "Sage",
276
+ "Sailor",
277
+ "Soldier",
278
+ "Urchin",
279
+ ]),
280
+ "subscription MRR": u.weighNumRange(0, 250, 1, 200)
281
+ },
282
+ hook: function (record, type, meta) {
283
+ // const NOW = dayjs();
284
+
285
+ if (type === "event") {
286
+ // const EVENT_TIME = dayjs(record.time);
287
+ }
288
+
289
+ if (type === "user") {
290
+
291
+ }
292
+
293
+ if (type === "funnel-post") {
294
+
295
+ }
296
+
297
+ if (type === "funnel-pre") {
298
+ const sequence = v.clone(record.sequence);
299
+ if (sequence.includes("$experiment_started")) {
300
+ //ensure there's only one experiment per user flow
301
+ const newSequence = sequence.filter((event) => event !== "$experiment_started");
302
+
303
+ newSequence.unshift("$experiment_started");
304
+
305
+
306
+ record.sequence = newSequence;
307
+ }
308
+
309
+ }
310
+
311
+ if (type === "scd") {
312
+
313
+ }
314
+
315
+ if (type === "everything") {
316
+
317
+ }
318
+
319
+ return record;
320
+ }
321
+ };
322
+
323
+ module.exports = config;