make-mp-data 2.0.0 → 2.0.12

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 (45) hide show
  1. package/dungeons/adspend.js +96 -0
  2. package/dungeons/anon.js +104 -0
  3. package/dungeons/big.js +224 -0
  4. package/dungeons/business.js +327 -0
  5. package/dungeons/complex.js +396 -0
  6. package/dungeons/experiments.js +124 -0
  7. package/dungeons/foobar.js +241 -0
  8. package/dungeons/funnels.js +272 -0
  9. package/dungeons/gaming.js +315 -0
  10. package/dungeons/mirror.js +129 -0
  11. package/dungeons/sanity.js +118 -0
  12. package/dungeons/scd.js +205 -0
  13. package/dungeons/simple.js +150 -0
  14. package/dungeons/userAgent.js +190 -0
  15. package/index.js +5 -1
  16. package/lib/cli/cli.js +5 -1
  17. package/package.json +10 -1
  18. package/.claude/settings.local.json +0 -20
  19. package/.gcloudignore +0 -18
  20. package/.gitattributes +0 -2
  21. package/.prettierrc +0 -0
  22. package/.vscode/launch.json +0 -80
  23. package/.vscode/settings.json +0 -69
  24. package/.vscode/tasks.json +0 -12
  25. package/dungeons/customers/.gitkeep +0 -0
  26. package/env.yaml +0 -1
  27. package/scratch.mjs +0 -62
  28. package/scripts/dana.mjs +0 -137
  29. package/scripts/deploy.sh +0 -15
  30. package/scripts/jsdoctest.js +0 -5
  31. package/scripts/new-dungeon.sh +0 -98
  32. package/scripts/new-project.mjs +0 -14
  33. package/scripts/run-index.sh +0 -2
  34. package/scripts/update-deps.sh +0 -5
  35. package/tests/benchmark/concurrency.mjs +0 -52
  36. package/tests/cli.test.js +0 -124
  37. package/tests/coverage/.gitkeep +0 -0
  38. package/tests/e2e.test.js +0 -379
  39. package/tests/int.test.js +0 -715
  40. package/tests/testCases.mjs +0 -229
  41. package/tests/testSoup.mjs +0 -28
  42. package/tests/unit.test.js +0 -910
  43. package/tmp/.gitkeep +0 -0
  44. package/tsconfig.json +0 -18
  45. package/vitest.config.js +0 -47
@@ -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
+ import Chance from 'chance';
12
+ const chance = new Chance();
13
+ import dayjs from "dayjs";
14
+ import utc from "dayjs/plugin/utc.js";
15
+ dayjs.extend(utc);
16
+ import { uid, comma } from 'ak-tools';
17
+ import { pickAWinner, weighNumRange, date, integer } from '../lib/utils/utils.js';
18
+
19
+ /** @type {import('../types').Dungeon} */
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
+ export default config;
@@ -0,0 +1,104 @@
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
+ import Chance from 'chance';
12
+ const chance = new Chance();
13
+ import dayjs from "dayjs";
14
+ import utc from "dayjs/plugin/utc.js";
15
+ dayjs.extend(utc);
16
+ import { uid, comma } from 'ak-tools';
17
+ import { pickAWinner, weighNumRange, date, integer } from '../lib/utils/utils.js';
18
+
19
+
20
+
21
+ /** @type {import('../types').Dungeon} */
22
+ const config = {
23
+ token: "",
24
+ seed: "foo bar",
25
+ numDays: 365, //how many days worth of data
26
+ numEvents: 100000, //how many events
27
+ numUsers: 10000, //how many users
28
+ format: 'json', //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
+ isAnonymous: true,
33
+ hasLocation: true,
34
+ events: [
35
+ {
36
+ event: "foo",
37
+ weight: 10,
38
+ properties: {}
39
+ },
40
+ {
41
+ event: "bar",
42
+ weight: 9,
43
+ properties: {}
44
+ },
45
+ {
46
+ event: "baz",
47
+ weight: 8,
48
+ properties: {}
49
+ },
50
+ {
51
+ event: "qux",
52
+ weight: 7,
53
+ properties: {}
54
+ },
55
+ {
56
+ event: "garply",
57
+ weight: 6,
58
+ properties: {}
59
+ },
60
+ {
61
+ event: "durtle",
62
+ weight: 5,
63
+ properties: {}
64
+ },
65
+ {
66
+ event: "linny",
67
+ weight: 4,
68
+ properties: {}
69
+ },
70
+ {
71
+ event: "fonk",
72
+ weight: 3,
73
+ properties: {}
74
+ },
75
+ {
76
+ event: "crumn",
77
+ weight: 2,
78
+ properties: {}
79
+ },
80
+ {
81
+ event: "yak",
82
+ weight: 1,
83
+ properties: {}
84
+ }
85
+ ],
86
+ superProps: {},
87
+ userProps: {
88
+ title: chance.profession.bind(chance),
89
+ luckyNumber: weighNumRange(42, 420),
90
+ 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"]
91
+ },
92
+ scdProps: {},
93
+ mirrorProps: {},
94
+ groupKeys: [],
95
+ groupProps: {},
96
+ lookupTables: [],
97
+ hook: function (record, type, meta) {
98
+ return record;
99
+ }
100
+ };
101
+
102
+
103
+
104
+ export default config;
@@ -0,0 +1,224 @@
1
+ const seed = "lets go big";
2
+ const Chance = require('chance');
3
+ const chance = new Chance();
4
+ const dayjs = require("dayjs");
5
+ const utc = require("dayjs/plugin/utc");
6
+ dayjs.extend(utc);
7
+ const { uid, comma, makeName } = require('ak-tools');
8
+ const { pickAWinner, weighNumRange, integer, date, choose } = require('../components/utils');
9
+
10
+
11
+ const eventsPerQuarter = 5_000_000_000 // ~5 billion
12
+ const numQuarters = 8; // 24 months
13
+ const parallelism = 5000;
14
+ const totalEvents = Math.floor((eventsPerQuarter * numQuarters) / parallelism);
15
+ const eventPerUser = 500;
16
+ const totalUsers = Math.floor(totalEvents / eventPerUser);
17
+ const totalDays = (numQuarters * 90) + 10;
18
+
19
+ /** @type {import('../types').Dungeon} */
20
+ const config = {
21
+ token: "",
22
+ seed: seed,
23
+ numDays: totalDays,
24
+ numEvents: totalEvents,
25
+ numUsers: totalUsers,
26
+ format: 'json', //csv or json
27
+ region: "US",
28
+ hasAnonIds: false, //if true, anonymousIds are created for each user
29
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
30
+ hasLocation: true,
31
+ hasAndroidDevices: false,
32
+ alsoInferFunnels: false,
33
+ batchSize: 2_000_000,
34
+ hasAvatar: false,
35
+ hasAdSpend: false,
36
+ hasBrowser: false,
37
+ hasCampaigns: false,
38
+ hasDesktopDevices: false,
39
+ hasIOSDevices: false,
40
+ writeToDisk: "gs://dungeon_master_4/big_data",
41
+ funnels: [
42
+ {
43
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
44
+ weight: 1,
45
+ order: "sequential"
46
+ },
47
+ {
48
+ "sequence": ["foo", "bar"],
49
+ weight: 25,
50
+ order: "sequential"
51
+ },
52
+ {
53
+ "sequence": ["foo", "bar", "baz"],
54
+ weight: 20,
55
+ order: "sequential"
56
+ },
57
+ {
58
+ "sequence": ["foo", "bar", "baz", "qux"],
59
+ weight: 15,
60
+ order: "sequential"
61
+ },
62
+ {
63
+ "sequence": ["foo", "bar", "baz", "qux", "garply"],
64
+ weight: 10,
65
+ order: "sequential"
66
+ },
67
+ {
68
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle"],
69
+ weight: 8,
70
+ order: "sequential"
71
+ },
72
+ {
73
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny"],
74
+ weight: 6,
75
+ order: "sequential"
76
+ },
77
+ {
78
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk"],
79
+ weight: 4,
80
+ order: "sequential"
81
+ },
82
+ {
83
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn"],
84
+ weight: 2,
85
+ order: "sequential"
86
+ },
87
+ {
88
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
89
+ weight: 1,
90
+ order: "sequential"
91
+ }
92
+
93
+ ],
94
+ events: [
95
+ { event: "foo" },
96
+ { event: "bar" },
97
+ { event: "baz" },
98
+ { event: "qux" },
99
+ { event: "garply" },
100
+ { event: "durtle" },
101
+ { event: "linny" },
102
+ { event: "fonk" },
103
+ { event: "crumn" },
104
+ { event: "yak" }
105
+ ],
106
+ //? https://docs.mixpanel.com/docs/data-structure/property-reference/data-type
107
+ superProps: {
108
+ "string": pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"]),
109
+ "number": integer,
110
+ "boolean": [true, true, false],
111
+ "date": () => date(90),
112
+ "string []": buildStringArray,
113
+ "number []": buildNumberArray,
114
+ "object {}": buildObjectProp,
115
+ "object [{}]": buildObjArrayProp
116
+ },
117
+ userProps: {
118
+ title: chance.profession.bind(chance),
119
+ luckyNumber: weighNumRange(42, 420),
120
+ 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"]),
121
+ isHappyCustomer: pickAWinner([true, true, false]),
122
+ },
123
+ hook: function (record, type, meta) {
124
+
125
+
126
+ // if (type === "event") {
127
+ // debugger;
128
+ // }
129
+
130
+ // if (type === "user") {
131
+
132
+ // }
133
+
134
+ // if (type === "funnel-post") {
135
+
136
+ // }
137
+
138
+ // if (type === "funnel-pre") {
139
+
140
+ // }
141
+
142
+ // if (type === "scd") {
143
+
144
+ // }
145
+
146
+ // if (type === "everything") {
147
+ // debugger;
148
+ // }
149
+
150
+ return record;
151
+ }
152
+ };
153
+
154
+
155
+ function buildObjectProp() {
156
+ return function () {
157
+ return {
158
+ "foo key": choose(pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"])()),
159
+ "bar key": integer(1, 100),
160
+ "baz key": choose(pickAWinner([true, true, false])()),
161
+ };
162
+ };
163
+ }
164
+
165
+
166
+ function buildNumberArray() {
167
+ return function () {
168
+ const arr = [];
169
+ const times = integer(1, 10);
170
+ for (let i = 0; i < times; i++) {
171
+ arr.push(integer(1, 100));
172
+ }
173
+ return [arr];
174
+ };
175
+ }
176
+
177
+ function buildStringArray() {
178
+ return function () {
179
+ const arr = [];
180
+ const times = integer(1, 10);
181
+ for (let i = 0; i < times; i++) {
182
+ arr.push(makeName(integer(1, 3), " "));
183
+ }
184
+ return [arr];
185
+ };
186
+ }
187
+
188
+
189
+ function buildObjArrayProp(maxItems = 5) {
190
+
191
+ return function () {
192
+ 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"];
193
+ const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
194
+ const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
195
+ const data = [];
196
+ const numOfItems = integer(1, maxItems);
197
+
198
+ for (var i = 0; i < numOfItems; i++) {
199
+ const category = chance.pickone(categories);
200
+ const slug = chance.pickone(slugs);
201
+ const asset = chance.pickone(assetExtension);
202
+ const price = integer(1, 300);
203
+ const quantity = integer(1, 5);
204
+
205
+ const item = {
206
+ sku: integer(11111, 99999),
207
+ amount: price,
208
+ quantity: quantity,
209
+ total: price * quantity,
210
+ featured: chance.pickone([true, false]),
211
+ category: category,
212
+ urlSlug: slug + category,
213
+ asset: `${category}-${integer(1, 20)}${asset}`
214
+ };
215
+
216
+ data.push(item);
217
+ }
218
+
219
+ return () => [data];
220
+ };
221
+ };
222
+
223
+
224
+ module.exports = config;