make-mp-data 1.4.4 → 1.5.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/package.json CHANGED
@@ -1,25 +1,26 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "1.4.04",
3
+ "version": "1.5.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
- "start": "node ./core/index.js",
9
- "dev": "nodemon scratch.mjs --ignore /data",
10
- "complex": "nodemon ./core/index.js --complex --e 10000 --u 100",
11
- "simple": "nodemon ./core/index.js --simple --e 10000 --u 100",
12
- "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-*",
13
11
  "post": "npm publish",
14
12
  "test": "NODE_ENV=test jest --runInBand",
15
- "deps": "sh ./scripts/deps.sh"
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",
16
+ "benchmark": "node --no-warnings --experimental-vm-modules ./tests/benchmark/concurrency.mjs"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
19
20
  "url": "git+https://github.com/ak--47/make-mp-data.git"
20
21
  },
21
22
  "bin": {
22
- "make-mp-data": "./core/index.js"
23
+ "make-mp-data": "./index.js"
23
24
  },
24
25
  "keywords": [
25
26
  "mixpanel",
@@ -47,11 +48,13 @@
47
48
  "dayjs": "^1.11.11",
48
49
  "dotenv": "^16.4.5",
49
50
  "mixpanel-import": "^2.5.552",
51
+ "p-limit": "^3.1.0",
50
52
  "yargs": "^17.7.2"
51
53
  },
52
54
  "devDependencies": {
53
55
  "@types/jest": "^29.5.12",
54
- "jest": "^29.7.0"
56
+ "jest": "^29.7.0",
57
+ "nodemon": "^3.1.3"
55
58
  },
56
59
  "jest": {
57
60
  "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('../src/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, weightedRange, date, integer } = require('../core/utils');
17
+ const { pickAWinner, weighNumRange, date, integer } = require('../src/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: [
@@ -86,7 +86,7 @@ const config = {
86
86
  superProps: {},
87
87
  userProps: {
88
88
  title: chance.profession.bind(chance),
89
- luckyNumber: weightedRange(42, 420),
89
+ luckyNumber: weighNumRange(42, 420),
90
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
91
  },
92
92
  scdProps: {},
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('../src/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;
@@ -8,7 +8,7 @@
8
8
 
9
9
  const Chance = require('chance');
10
10
  const chance = new Chance();
11
- const { weightedRange, date, integer } = require('../core/utils.js');
11
+ const { weighNumRange, date, integer } = require('../src/utils.js');
12
12
  const u = require('ak-tools');
13
13
 
14
14
  /** @type {import('../types.js').Config} */
@@ -20,8 +20,8 @@ const config = {
20
20
  numUsers: 1000, //how many users
21
21
  format: 'csv', //csv or json
22
22
  region: "US",
23
- anonIds: true, //if true, anonymousIds are created for each user
24
- sessionIds: true, //if true, sessionIds are created for each user
23
+ hasAnonIds: true, //if true, anonymousIds are created for each user
24
+ hasSessionIds: true, //if true, hasSessionIds are created for each user
25
25
 
26
26
  hasLocation: true,
27
27
  hasAndroidDevices: true,
@@ -31,13 +31,20 @@ const config = {
31
31
  hasCampaigns: true,
32
32
  isAnonymous: false,
33
33
  hasAdSpend: true,
34
-
34
+
35
+ hasAvatar: true,
36
+ makeChart: false,
37
+
38
+ batchSize: 500_000,
39
+ concurrency: 500,
40
+
41
+ funnels: [],
35
42
  events: [
36
43
  {
37
44
  "event": "checkout",
38
45
  "weight": 2,
39
46
  "properties": {
40
- amount: weightedRange(5, 500, .25),
47
+ amount: weighNumRange(5, 500, .25),
41
48
  currency: ["USD", "USD", "USD", "CAD", "EUR", "EUR", "BTC", "BTC", "ETH", "JPY"],
42
49
  cart: makeProducts(12),
43
50
  }
@@ -46,9 +53,9 @@ const config = {
46
53
  "event": "add to cart",
47
54
  "weight": 4,
48
55
  "properties": {
49
- amount: weightedRange(5, 500, .25),
56
+ amount: weighNumRange(5, 500, .25),
50
57
  qty: integer(1, 5),
51
- product_id: weightedRange(1, 1000, 1.4)
58
+ product_id: weighNumRange(1, 1000, 1.4)
52
59
  }
53
60
  },
54
61
  {
@@ -65,10 +72,10 @@ const config = {
65
72
  "properties": {
66
73
  category: ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"],
67
74
  hashTags: makeHashTags,
68
- watchTimeSec: weightedRange(10, 600, .25,),
75
+ watchTimeSec: weighNumRange(10, 600, .25,),
69
76
  quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
70
77
  format: ["mp4", "avi", "mov", "mpg"],
71
- video_id: weightedRange(1, 50000, 1.4),
78
+ video_id: weighNumRange(1, 50000, 1.4),
72
79
 
73
80
  }
74
81
  },
@@ -76,8 +83,8 @@ const config = {
76
83
  "event": "comment",
77
84
  "weight": 2,
78
85
  "properties": {
79
- length: weightedRange(1, 500, .25),
80
- video_id: weightedRange(1, 50000, 1.4),
86
+ length: weighNumRange(1, 500, .25),
87
+ video_id: weighNumRange(1, 50000, 1.4),
81
88
  has_replies: [true, false, false, false, false],
82
89
  has_photo: [true, false, false, false, false],
83
90
 
@@ -87,7 +94,7 @@ const config = {
87
94
  "event": "save video",
88
95
  "weight": 4,
89
96
  "properties": {
90
- video_id: weightedRange(1, 50000, 1.4),
97
+ video_id: weighNumRange(1, 50000, 1.4),
91
98
  ui_control: ["toolbar", "menu", "keyboard"]
92
99
 
93
100
 
@@ -97,7 +104,7 @@ const config = {
97
104
  "event": "view item",
98
105
  "weight": 8,
99
106
  "properties": {
100
- product_id: weightedRange(1, 24, 3),
107
+ product_id: weighNumRange(1, 24, 3),
101
108
  colors: ["light", "dark", "custom", "dark"]
102
109
  }
103
110
  },
@@ -105,7 +112,7 @@ const config = {
105
112
  "event": "save item",
106
113
  "weight": 5,
107
114
  "properties": {
108
- product_id: weightedRange(1, 1000, 12),
115
+ product_id: weighNumRange(1, 1000, 12),
109
116
  colors: ["light", "dark", "custom", "dark"]
110
117
  }
111
118
  },
@@ -113,7 +120,7 @@ const config = {
113
120
  "event": "support ticket",
114
121
  "weight": 2,
115
122
  "properties": {
116
- product_id: weightedRange(1, 1000, .6),
123
+ product_id: weighNumRange(1, 1000, .6),
117
124
  description: chance.sentence.bind(chance),
118
125
  severity: ["low", "medium", "high"],
119
126
  ticket_id: chance.guid.bind(chance)
@@ -141,7 +148,7 @@ const config = {
141
148
  */
142
149
  userProps: {
143
150
  title: chance.profession.bind(chance),
144
- luckyNumber: weightedRange(42, 420),
151
+ luckyNumber: weighNumRange(42, 420),
145
152
  experiment: designExperiment(),
146
153
  spiritAnimal: ["unicorn", "dragon", "phoenix", "sasquatch", "yeti", "kraken", "jackalope", "thunderbird", "mothman", "nessie", "chupacabra", "jersey devil", "bigfoot", "weindgo", "bunyip", "mokele-mbembe", "tatzelwurm", "megalodon"],
147
154
  timezone: chance.timezone.bind(chance), // ["America/New_York", "America/Los_Angeles", "America/Chicago", "America/Denver", "America/Phoenix", "America/Anchorage", "Pacific/Honolulu"]
@@ -153,8 +160,8 @@ const config = {
153
160
  /** each generates it's own table */
154
161
  scdProps: {
155
162
  plan: ["free", "free", "free", "free", "basic", "basic", "basic", "premium", "premium", "enterprise"],
156
- MRR: weightedRange(0, 10000, .15),
157
- NPS: weightedRange(0, 10, 2, 150),
163
+ MRR: weighNumRange(0, 10000, .15),
164
+ NPS: weighNumRange(0, 10, 2, 150),
158
165
  subscribed: [true, true, true, true, true, true, false, false, false, false, "it's complicated"],
159
166
  renewalDate: date(100, false),
160
167
  },
@@ -164,7 +171,7 @@ const config = {
164
171
  profit: { events: ["checkout"], values: [4, 2, 42, 420] },
165
172
  watchTimeSec: {
166
173
  events: ["watch video"],
167
- values: weightedRange(50, 1200, 6, 247)
174
+ values: weighNumRange(50, 1200, 2)
168
175
  }
169
176
  },
170
177
 
@@ -181,7 +188,7 @@ const config = {
181
188
  company_id: {
182
189
  name: () => { return chance.company(); },
183
190
  email: () => { return `CSM: ${chance.pickone(["AK", "Jessica", "Michelle", "Dana", "Brian", "Dave"])}`; },
184
- "# of employees": weightedRange(3, 10000),
191
+ "# of employees": weighNumRange(3, 10000),
185
192
  "industry": ["tech", "finance", "healthcare", "education", "government", "non-profit"],
186
193
  "segment": ["enterprise", "SMB", "mid-market"],
187
194
  "products": [["core"], ["core"], ["core", "add-ons"], ["core", "pro-serve"], ["core", "add-ons", "pro-serve"], ["core", "BAA", "enterprise"], ["free"], ["free"], ["free", "addons"]],
@@ -190,7 +197,7 @@ const config = {
190
197
  name: () => { return `#${chance.word({ length: integer(4, 24), capitalize: true })}`; },
191
198
  email: ["public", "private"],
192
199
  "room provider": ["partner", "core", "core", "core"],
193
- "room capacity": weightedRange(3, 1000000),
200
+ "room capacity": weighNumRange(3, 1000000),
194
201
  "isPublic": [true, false, false, false, false],
195
202
  "country": chance.country.bind(chance),
196
203
  "isVerified": [true, true, false, false, false],
@@ -208,9 +215,9 @@ const config = {
208
215
  "demand": ["high", "medium", "medium", "low"],
209
216
  "supply": ["high", "medium", "medium", "low"],
210
217
  "manufacturer": chance.company.bind(chance),
211
- "price": weightedRange(5, 500, 1000, .25),
212
- "rating": weightedRange(1, 5),
213
- "reviews": weightedRange(0, 35)
218
+ "price": weighNumRange(5, 500, .25),
219
+ "rating": weighNumRange(1, 5),
220
+ "reviews": weighNumRange(0, 35)
214
221
  }
215
222
 
216
223
  },
@@ -222,7 +229,7 @@ const config = {
222
229
  copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
223
230
  uploader_id: chance.guid.bind(chance),
224
231
  "uploader influence": ["low", "low", "low", "medium", "medium", "high"],
225
- thumbs: weightedRange(0, 35),
232
+ thumbs: weighNumRange(0, 35),
226
233
  rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
227
234
  }
228
235
 
package/schemas/foobar.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, weightedRange, date, integer } = require('../core/utils');
17
+ const { pickAWinner, weighNumRange, date, integer } = require('../src/utils');
18
18
 
19
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"];
20
20
 
@@ -29,9 +29,9 @@ const config = {
29
29
  numUsers: 25000, //how many users
30
30
  format: 'json', //csv or json
31
31
  region: "US",
32
- anonIds: true, //if true, anonymousIds are created for each user
33
- sessionIds: false, //if true, sessionIds are created for each user
34
-
32
+ hasAnonIds: true, //if true, anonymousIds are created for each user
33
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
34
+
35
35
  events: [
36
36
  {
37
37
  event: "foo",
@@ -91,15 +91,30 @@ const config = {
91
91
  },
92
92
  userProps: {
93
93
  title: chance.profession.bind(chance),
94
- luckyNumber: weightedRange(42, 420),
94
+ luckyNumber: weighNumRange(42, 420),
95
95
  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"]
96
96
  },
97
97
 
98
98
  scdProps: {},
99
99
  mirrorProps: {},
100
- groupKeys: [],
101
- groupProps: {},
102
100
  lookupTables: [],
101
+ groupKeys: [
102
+ ["company_id", 1000],
103
+ ["product_id", 10000]
104
+ ],
105
+ groupProps: {
106
+ company_id: {
107
+ name: chance.company.bind(chance),
108
+ industry: chance.pickone.bind(chance, ["tech", "retail", "finance", "healthcare", "manufacturing", "media", "entertainment", "education", "government", "nonprofit", "other"])
109
+ },
110
+ product_id: {
111
+ name: chance.sentence.bind(chance, { words: 3 }),
112
+ category: chance.pickone.bind(chance, itemCategories),
113
+ price: chance.floating.bind(chance, { min: 0, max: 1000, fixed: 2 }),
114
+ quantity: integer
115
+ }
116
+ },
117
+
103
118
  hook: function (record, type, meta) {
104
119
  return record;
105
120
  }
@@ -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, weightedRange, date, integer } = require('../core/utils');
17
+ const { pickAWinner, weighNumRange, date, integer } = require('../src/utils');
18
18
 
19
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"];
20
20
 
@@ -29,18 +29,18 @@ const config = {
29
29
  numUsers: 500, //how many users
30
30
  format: 'csv', //csv or json
31
31
  region: "US",
32
- anonIds: false, //if true, anonymousIds are created for each user
33
- sessionIds: false, //if true, sessionIds are created for each user
32
+ hasAnonIds: false, //if true, anonymousIds are created for each user
33
+ hasSessionIds: false, //if true, hasSessionIds are created for each user
34
34
 
35
35
  events: [
36
36
  {
37
37
  event: "checkout",
38
38
  weight: 2,
39
39
  properties: {
40
- amount: weightedRange(5, 500, .25),
40
+ amount: weighNumRange(5, 500, .25),
41
41
  currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
42
42
  coupon: ["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"],
43
- numItems: weightedRange(1, 10),
43
+ numItems: weighNumRange(1, 10),
44
44
 
45
45
  }
46
46
  },
@@ -48,9 +48,9 @@ const config = {
48
48
  event: "add to cart",
49
49
  weight: 4,
50
50
  properties: {
51
- amount: weightedRange(5, 500, .25),
52
- rating: weightedRange(1, 5),
53
- reviews: weightedRange(0, 35),
51
+ amount: weighNumRange(5, 500, .25),
52
+ rating: weighNumRange(1, 5),
53
+ reviews: weighNumRange(0, 35),
54
54
  isFeaturedItem: [true, false, false],
55
55
  itemCategory: pickAWinner(itemCategories, integer(0, 27)),
56
56
  dateItemListed: date(30, true, 'YYYY-MM-DD'),
@@ -71,7 +71,7 @@ const config = {
71
71
  properties: {
72
72
  videoCategory: pickAWinner(videoCategories, integer(0, 9)),
73
73
  isFeaturedItem: [true, false, false],
74
- watchTimeSec: weightedRange(10, 600, .25),
74
+ watchTimeSec: weighNumRange(10, 600, .25),
75
75
  quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
76
76
  format: ["mp4", "avi", "mov", "mpg"],
77
77
  uploader_id: chance.guid.bind(chance)
@@ -182,20 +182,20 @@ const config = {
182
182
  */
183
183
  userProps: {
184
184
  title: chance.profession.bind(chance),
185
- luckyNumber: weightedRange(42, 420),
185
+ luckyNumber: weighNumRange(42, 420),
186
186
  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"]
187
187
  },
188
188
 
189
189
  scdProps: {
190
190
  nps: [1, 1, 1, 4, 4, 4, 5, 5, 6, 7, 8, 9],
191
- mrr: () => { weightedRange(10, 1000, .25); },
191
+ mrr: () => { weighNumRange(10, 1000, .25); },
192
192
  },
193
193
  mirrorProps: {
194
194
  isBot: { events: "*", values: [false, false, false, false, true] },
195
195
  profit: { events: ["checkout"], values: [4, 2, 42] },
196
196
  watchTimeSec: {
197
197
  events: ["watch video"],
198
- values: weightedRange(50, 1200, 6)
198
+ values: weighNumRange(50, 1200, 6)
199
199
  }
200
200
 
201
201
  },