@ak--47/dungeon-master 1.0.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/README.md +518 -0
- package/dungeons/array-of-object-lookup-schema.json +327 -0
- package/dungeons/array-of-object-lookup.js +220 -0
- package/dungeons/ecommerce-schema.json +462 -0
- package/dungeons/ecommerce.js +447 -0
- package/dungeons/education-schema.json +2409 -0
- package/dungeons/education.js +768 -0
- package/dungeons/fintech-schema.json +14034 -0
- package/dungeons/fintech.js +696 -0
- package/dungeons/foobar-schema.json +403 -0
- package/dungeons/foobar.js +296 -0
- package/dungeons/food-delivery-schema.json +192 -0
- package/dungeons/food-delivery.js +602 -0
- package/dungeons/food-schema.json +1152 -0
- package/dungeons/food.js +754 -0
- package/dungeons/gaming-schema.json +1270 -0
- package/dungeons/gaming.js +508 -0
- package/dungeons/insurance-application-schema.json +204 -0
- package/dungeons/insurance-application.js +605 -0
- package/dungeons/media-schema.json +906 -0
- package/dungeons/media.js +790 -0
- package/dungeons/retention-cadence-schema.json +78 -0
- package/dungeons/retention-cadence.js +244 -0
- package/dungeons/rpg-schema.json +4526 -0
- package/dungeons/rpg.js +919 -0
- package/dungeons/sanity-schema.json +255 -0
- package/dungeons/sanity.js +152 -0
- package/dungeons/sass-schema.json +1291 -0
- package/dungeons/sass.js +795 -0
- package/dungeons/scd-schema.json +919 -0
- package/dungeons/scd.js +277 -0
- package/dungeons/simple-schema.json +608 -0
- package/dungeons/simple.js +285 -0
- package/dungeons/simplest-schema.json +1418 -0
- package/dungeons/simplest.js +392 -0
- package/dungeons/social-schema.json +1118 -0
- package/dungeons/social.js +686 -0
- package/dungeons/text-generation-schema.json +3096 -0
- package/dungeons/text-generation.js +812 -0
- package/index.js +567 -0
- package/lib/core/config-validator.js +395 -0
- package/lib/core/context.js +204 -0
- package/lib/core/dungeon-loader.js +337 -0
- package/lib/core/storage.js +379 -0
- package/lib/generators/adspend.js +132 -0
- package/lib/generators/events.js +271 -0
- package/lib/generators/funnels.js +407 -0
- package/lib/generators/mirror.js +167 -0
- package/lib/generators/product-lookup.js +262 -0
- package/lib/generators/product-names.js +195 -0
- package/lib/generators/profiles.js +93 -0
- package/lib/generators/scd.js +124 -0
- package/lib/generators/text.js +1192 -0
- package/lib/orchestrators/mixpanel-sender.js +266 -0
- package/lib/orchestrators/user-loop.js +335 -0
- package/lib/templates/abbreviated.d.ts +169 -0
- package/lib/templates/defaults.js +1405 -0
- package/lib/templates/phrases.js +2526 -0
- package/lib/templates/schema.d.ts +173 -0
- package/lib/templates/soup-presets.js +188 -0
- package/lib/utils/function-registry.js +302 -0
- package/lib/utils/json-evaluator.js +172 -0
- package/lib/utils/logger.js +34 -0
- package/lib/utils/utils.js +1490 -0
- package/package.json +89 -0
- package/types.d.ts +865 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": {
|
|
3
|
+
"seed": "test array of objects lookup",
|
|
4
|
+
"name": "array-of-object-lookup",
|
|
5
|
+
"numDays": 60,
|
|
6
|
+
"numEvents": 100000,
|
|
7
|
+
"numUsers": 1000,
|
|
8
|
+
"format": "json",
|
|
9
|
+
"region": "US",
|
|
10
|
+
"hasAnonIds": true,
|
|
11
|
+
"hasSessionIds": true,
|
|
12
|
+
"hasAdSpend": false,
|
|
13
|
+
"hasLocation": true,
|
|
14
|
+
"hasAndroidDevices": false,
|
|
15
|
+
"hasIOSDevices": false,
|
|
16
|
+
"hasDesktopDevices": true,
|
|
17
|
+
"hasBrowser": true,
|
|
18
|
+
"hasCampaigns": false,
|
|
19
|
+
"isAnonymous": false,
|
|
20
|
+
"alsoInferFunnels": true,
|
|
21
|
+
"concurrency": 1,
|
|
22
|
+
"batchSize": 250000,
|
|
23
|
+
"writeToDisk": false,
|
|
24
|
+
"events": [
|
|
25
|
+
{
|
|
26
|
+
"event": "checkout",
|
|
27
|
+
"weight": 2,
|
|
28
|
+
"properties": {
|
|
29
|
+
"currency": [
|
|
30
|
+
"USD",
|
|
31
|
+
"CAD",
|
|
32
|
+
"EUR",
|
|
33
|
+
"BTC",
|
|
34
|
+
"ETH",
|
|
35
|
+
"JPY"
|
|
36
|
+
],
|
|
37
|
+
"coupon": {
|
|
38
|
+
"functionName": "arrow",
|
|
39
|
+
"body": "function generateWeightedArray() {\n\t\tconst weightedArray = [];\n\n\t\t// Add each value to the array the number of times specified by its weight\n\t\tweightedItems.forEach(({ value, weight }) => {\n\t\t\tif (!weight) weight = 1;\n\t\t\tfor (let i = 0; i < weight; i++) {\n\t\t\t\tweightedArray.push(value);\n\t\t\t}\n\t\t});\n\n\t\treturn weightedArray;\n\t}"
|
|
40
|
+
},
|
|
41
|
+
"cart": {
|
|
42
|
+
"functionName": "arrow",
|
|
43
|
+
"body": "function () {\n\t\tconst categories = [\"electronics\", \"books\", \"clothing\", \"home\", \"garden\", \"toys\", \"sports\", \"automotive\", \"beauty\", \"health\", \"grocery\", \"jewelry\", \"shoes\", \"tools\", \"office supplies\"];\n\t\tconst descriptors = [\"brand new\", \"open box\", \"refurbished\", \"used\", \"like new\", \"vintage\", \"antique\", \"collectible\"];\n\t\tconst suffix = [\"item\", \"product\", \"good\", \"merchandise\", \"thing\", \"object\", \"widget\", \"gadget\", \"device\", \"apparatus\", \"contraption\", \"instrument\", \"tool\", \"implement\", \"utensil\", \"appliance\", \"machine\", \"equipment\", \"gear\", \"kit\", \"set\", \"package\"];\n\t\tconst assetPreview = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];\n\t\tconst data = [];\n\t\tconst numOfItems = integer(1, maxItems);\n\n\t\tfor (var i = 0; i < numOfItems; i++) {\n\t\t\tconst category = chance.pickone(categories);\n\t\t\tconst descriptor = chance.pickone(descriptors);\n\t\t\tconst suffixWord = chance.pickone(suffix);\n\t\t\tconst slug = `${descriptor.replace(/\\s+/g, '-').toLowerCase()}-${suffixWord.replace(/\\s+/g, '-').toLowerCase()}`;\n\t\t\tconst asset = chance.pickone(assetPreview);\n\n\t\t\t// const product_id = chance.guid();\n\t\t\tconst price = integer(1, 100);\n\t\t\tconst quantity = integer(1, 5);\n\t\t\tconst product_id = integer(1, 1_000);\n\n\t\t\tconst item = {\n\t\t\t\tproduct_id: product_id,\n\t\t\t\tproduct_url: `https://example.com/assets/${product_id}`,\n\t\t\t\t// sku: integer(11111, 99999),\n\t\t\t\t// amount: price,\n\t\t\t\t// quantity: quantity,\n\t\t\t\t// total_value: price * quantity,\n\t\t\t\t// featured: chance.pickone([true, false, false]),\n\t\t\t\t// category: category,\n\t\t\t\t// descriptor: descriptor,\n\t\t\t\t// slug: slug,\n\t\t\t\t\n\t\t\t\t// assetType: asset\n\n\t\t\t};\n\n\t\t\tdata.push(item);\n\t\t}\n\n\t\treturn () => [data];\n\t}"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"event": "add to cart",
|
|
49
|
+
"weight": 4,
|
|
50
|
+
"properties": {
|
|
51
|
+
"item": {
|
|
52
|
+
"functionName": "arrow",
|
|
53
|
+
"body": "function () {\n\t\tconst categories = [\"electronics\", \"books\", \"clothing\", \"home\", \"garden\", \"toys\", \"sports\", \"automotive\", \"beauty\", \"health\", \"grocery\", \"jewelry\", \"shoes\", \"tools\", \"office supplies\"];\n\t\tconst descriptors = [\"brand new\", \"open box\", \"refurbished\", \"used\", \"like new\", \"vintage\", \"antique\", \"collectible\"];\n\t\tconst suffix = [\"item\", \"product\", \"good\", \"merchandise\", \"thing\", \"object\", \"widget\", \"gadget\", \"device\", \"apparatus\", \"contraption\", \"instrument\", \"tool\", \"implement\", \"utensil\", \"appliance\", \"machine\", \"equipment\", \"gear\", \"kit\", \"set\", \"package\"];\n\t\tconst assetPreview = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];\n\t\tconst data = [];\n\t\tconst numOfItems = integer(1, maxItems);\n\n\t\tfor (var i = 0; i < numOfItems; i++) {\n\t\t\tconst category = chance.pickone(categories);\n\t\t\tconst descriptor = chance.pickone(descriptors);\n\t\t\tconst suffixWord = chance.pickone(suffix);\n\t\t\tconst slug = `${descriptor.replace(/\\s+/g, '-').toLowerCase()}-${suffixWord.replace(/\\s+/g, '-').toLowerCase()}`;\n\t\t\tconst asset = chance.pickone(assetPreview);\n\n\t\t\t// const product_id = chance.guid();\n\t\t\tconst price = integer(1, 100);\n\t\t\tconst quantity = integer(1, 5);\n\t\t\tconst product_id = integer(1, 1_000);\n\n\t\t\tconst item = {\n\t\t\t\tproduct_id: product_id,\n\t\t\t\tproduct_url: `https://example.com/assets/${product_id}`,\n\t\t\t\t// sku: integer(11111, 99999),\n\t\t\t\t// amount: price,\n\t\t\t\t// quantity: quantity,\n\t\t\t\t// total_value: price * quantity,\n\t\t\t\t// featured: chance.pickone([true, false, false]),\n\t\t\t\t// category: category,\n\t\t\t\t// descriptor: descriptor,\n\t\t\t\t// slug: slug,\n\t\t\t\t\n\t\t\t\t// assetType: asset\n\n\t\t\t};\n\n\t\t\tdata.push(item);\n\t\t}\n\n\t\treturn () => [data];\n\t}"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"event": "view item",
|
|
59
|
+
"weight": 8,
|
|
60
|
+
"properties": {
|
|
61
|
+
"item": {
|
|
62
|
+
"functionName": "arrow",
|
|
63
|
+
"body": "function () {\n\t\tconst categories = [\"electronics\", \"books\", \"clothing\", \"home\", \"garden\", \"toys\", \"sports\", \"automotive\", \"beauty\", \"health\", \"grocery\", \"jewelry\", \"shoes\", \"tools\", \"office supplies\"];\n\t\tconst descriptors = [\"brand new\", \"open box\", \"refurbished\", \"used\", \"like new\", \"vintage\", \"antique\", \"collectible\"];\n\t\tconst suffix = [\"item\", \"product\", \"good\", \"merchandise\", \"thing\", \"object\", \"widget\", \"gadget\", \"device\", \"apparatus\", \"contraption\", \"instrument\", \"tool\", \"implement\", \"utensil\", \"appliance\", \"machine\", \"equipment\", \"gear\", \"kit\", \"set\", \"package\"];\n\t\tconst assetPreview = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];\n\t\tconst data = [];\n\t\tconst numOfItems = integer(1, maxItems);\n\n\t\tfor (var i = 0; i < numOfItems; i++) {\n\t\t\tconst category = chance.pickone(categories);\n\t\t\tconst descriptor = chance.pickone(descriptors);\n\t\t\tconst suffixWord = chance.pickone(suffix);\n\t\t\tconst slug = `${descriptor.replace(/\\s+/g, '-').toLowerCase()}-${suffixWord.replace(/\\s+/g, '-').toLowerCase()}`;\n\t\t\tconst asset = chance.pickone(assetPreview);\n\n\t\t\t// const product_id = chance.guid();\n\t\t\tconst price = integer(1, 100);\n\t\t\tconst quantity = integer(1, 5);\n\t\t\tconst product_id = integer(1, 1_000);\n\n\t\t\tconst item = {\n\t\t\t\tproduct_id: product_id,\n\t\t\t\tproduct_url: `https://example.com/assets/${product_id}`,\n\t\t\t\t// sku: integer(11111, 99999),\n\t\t\t\t// amount: price,\n\t\t\t\t// quantity: quantity,\n\t\t\t\t// total_value: price * quantity,\n\t\t\t\t// featured: chance.pickone([true, false, false]),\n\t\t\t\t// category: category,\n\t\t\t\t// descriptor: descriptor,\n\t\t\t\t// slug: slug,\n\t\t\t\t\n\t\t\t\t// assetType: asset\n\n\t\t\t};\n\n\t\t\tdata.push(item);\n\t\t}\n\n\t\treturn () => [data];\n\t}"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"event": "save item",
|
|
69
|
+
"weight": 5,
|
|
70
|
+
"properties": {
|
|
71
|
+
"item": {
|
|
72
|
+
"functionName": "arrow",
|
|
73
|
+
"body": "function () {\n\t\tconst categories = [\"electronics\", \"books\", \"clothing\", \"home\", \"garden\", \"toys\", \"sports\", \"automotive\", \"beauty\", \"health\", \"grocery\", \"jewelry\", \"shoes\", \"tools\", \"office supplies\"];\n\t\tconst descriptors = [\"brand new\", \"open box\", \"refurbished\", \"used\", \"like new\", \"vintage\", \"antique\", \"collectible\"];\n\t\tconst suffix = [\"item\", \"product\", \"good\", \"merchandise\", \"thing\", \"object\", \"widget\", \"gadget\", \"device\", \"apparatus\", \"contraption\", \"instrument\", \"tool\", \"implement\", \"utensil\", \"appliance\", \"machine\", \"equipment\", \"gear\", \"kit\", \"set\", \"package\"];\n\t\tconst assetPreview = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];\n\t\tconst data = [];\n\t\tconst numOfItems = integer(1, maxItems);\n\n\t\tfor (var i = 0; i < numOfItems; i++) {\n\t\t\tconst category = chance.pickone(categories);\n\t\t\tconst descriptor = chance.pickone(descriptors);\n\t\t\tconst suffixWord = chance.pickone(suffix);\n\t\t\tconst slug = `${descriptor.replace(/\\s+/g, '-').toLowerCase()}-${suffixWord.replace(/\\s+/g, '-').toLowerCase()}`;\n\t\t\tconst asset = chance.pickone(assetPreview);\n\n\t\t\t// const product_id = chance.guid();\n\t\t\tconst price = integer(1, 100);\n\t\t\tconst quantity = integer(1, 5);\n\t\t\tconst product_id = integer(1, 1_000);\n\n\t\t\tconst item = {\n\t\t\t\tproduct_id: product_id,\n\t\t\t\tproduct_url: `https://example.com/assets/${product_id}`,\n\t\t\t\t// sku: integer(11111, 99999),\n\t\t\t\t// amount: price,\n\t\t\t\t// quantity: quantity,\n\t\t\t\t// total_value: price * quantity,\n\t\t\t\t// featured: chance.pickone([true, false, false]),\n\t\t\t\t// category: category,\n\t\t\t\t// descriptor: descriptor,\n\t\t\t\t// slug: slug,\n\t\t\t\t\n\t\t\t\t// assetType: asset\n\n\t\t\t};\n\n\t\t\tdata.push(item);\n\t\t}\n\n\t\treturn () => [data];\n\t}"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"funnels": [],
|
|
79
|
+
"superProps": {
|
|
80
|
+
"theme": {
|
|
81
|
+
"functionName": "arrow",
|
|
82
|
+
"body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"userProps": {
|
|
86
|
+
"spiritAnimal": [
|
|
87
|
+
"duck",
|
|
88
|
+
"dog",
|
|
89
|
+
"otter",
|
|
90
|
+
"penguin",
|
|
91
|
+
"cat",
|
|
92
|
+
"elephant",
|
|
93
|
+
"lion",
|
|
94
|
+
"cheetah",
|
|
95
|
+
"giraffe",
|
|
96
|
+
"zebra",
|
|
97
|
+
"rhino",
|
|
98
|
+
"hippo",
|
|
99
|
+
"whale",
|
|
100
|
+
"dolphin",
|
|
101
|
+
"shark",
|
|
102
|
+
"octopus",
|
|
103
|
+
"squid",
|
|
104
|
+
"jellyfish",
|
|
105
|
+
"starfish",
|
|
106
|
+
"seahorse",
|
|
107
|
+
"crab",
|
|
108
|
+
"lobster",
|
|
109
|
+
"shrimp",
|
|
110
|
+
"clam",
|
|
111
|
+
"snail",
|
|
112
|
+
"slug",
|
|
113
|
+
"butterfly",
|
|
114
|
+
"moth",
|
|
115
|
+
"bee",
|
|
116
|
+
"wasp",
|
|
117
|
+
"ant",
|
|
118
|
+
"beetle",
|
|
119
|
+
"ladybug",
|
|
120
|
+
"caterpillar",
|
|
121
|
+
"centipede",
|
|
122
|
+
"millipede",
|
|
123
|
+
"scorpion",
|
|
124
|
+
"spider",
|
|
125
|
+
"tarantula",
|
|
126
|
+
"tick",
|
|
127
|
+
"mite",
|
|
128
|
+
"mosquito",
|
|
129
|
+
"fly",
|
|
130
|
+
"dragonfly",
|
|
131
|
+
"damselfly",
|
|
132
|
+
"grasshopper",
|
|
133
|
+
"cricket",
|
|
134
|
+
"locust",
|
|
135
|
+
"mantis",
|
|
136
|
+
"cockroach",
|
|
137
|
+
"termite",
|
|
138
|
+
"praying mantis",
|
|
139
|
+
"walking stick",
|
|
140
|
+
"stick bug",
|
|
141
|
+
"leaf insect",
|
|
142
|
+
"lacewing",
|
|
143
|
+
"aphid",
|
|
144
|
+
"cicada",
|
|
145
|
+
"thrips",
|
|
146
|
+
"psyllid",
|
|
147
|
+
"scale insect",
|
|
148
|
+
"whitefly",
|
|
149
|
+
"mealybug",
|
|
150
|
+
"planthopper",
|
|
151
|
+
"leafhopper",
|
|
152
|
+
"treehopper",
|
|
153
|
+
"flea",
|
|
154
|
+
"louse",
|
|
155
|
+
"bedbug",
|
|
156
|
+
"flea beetle",
|
|
157
|
+
"weevil",
|
|
158
|
+
"longhorn beetle",
|
|
159
|
+
"leaf beetle",
|
|
160
|
+
"tiger beetle",
|
|
161
|
+
"ground beetle",
|
|
162
|
+
"lady beetle",
|
|
163
|
+
"firefly",
|
|
164
|
+
"click beetle",
|
|
165
|
+
"rove beetle",
|
|
166
|
+
"scarab beetle",
|
|
167
|
+
"dung beetle",
|
|
168
|
+
"stag beetle",
|
|
169
|
+
"rhinoceros beetle",
|
|
170
|
+
"hercules beetle",
|
|
171
|
+
"goliath beetle",
|
|
172
|
+
"jewel beetle",
|
|
173
|
+
"tortoise beetle"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"scdProps": {},
|
|
177
|
+
"mirrorProps": {},
|
|
178
|
+
"groupKeys": [],
|
|
179
|
+
"groupProps": {},
|
|
180
|
+
"lookupTables": [
|
|
181
|
+
{
|
|
182
|
+
"key": "product_id",
|
|
183
|
+
"entries": 1000,
|
|
184
|
+
"attributes": {
|
|
185
|
+
"amount": [
|
|
186
|
+
259,
|
|
187
|
+
247,
|
|
188
|
+
271,
|
|
189
|
+
269,
|
|
190
|
+
209,
|
|
191
|
+
305,
|
|
192
|
+
706,
|
|
193
|
+
344,
|
|
194
|
+
350,
|
|
195
|
+
327,
|
|
196
|
+
259,
|
|
197
|
+
225,
|
|
198
|
+
269,
|
|
199
|
+
267,
|
|
200
|
+
256,
|
|
201
|
+
705,
|
|
202
|
+
196,
|
|
203
|
+
588,
|
|
204
|
+
775,
|
|
205
|
+
235,
|
|
206
|
+
737,
|
|
207
|
+
341,
|
|
208
|
+
268,
|
|
209
|
+
409,
|
|
210
|
+
233,
|
|
211
|
+
246,
|
|
212
|
+
239,
|
|
213
|
+
737,
|
|
214
|
+
701,
|
|
215
|
+
741,
|
|
216
|
+
227,
|
|
217
|
+
230,
|
|
218
|
+
693,
|
|
219
|
+
719,
|
|
220
|
+
277,
|
|
221
|
+
706,
|
|
222
|
+
292,
|
|
223
|
+
274,
|
|
224
|
+
596,
|
|
225
|
+
263,
|
|
226
|
+
250,
|
|
227
|
+
279,
|
|
228
|
+
275,
|
|
229
|
+
799,
|
|
230
|
+
236,
|
|
231
|
+
267,
|
|
232
|
+
221,
|
|
233
|
+
230,
|
|
234
|
+
730,
|
|
235
|
+
789
|
|
236
|
+
],
|
|
237
|
+
"quantity": [
|
|
238
|
+
4,
|
|
239
|
+
5,
|
|
240
|
+
7,
|
|
241
|
+
4,
|
|
242
|
+
8,
|
|
243
|
+
6,
|
|
244
|
+
3,
|
|
245
|
+
3,
|
|
246
|
+
4,
|
|
247
|
+
6,
|
|
248
|
+
3,
|
|
249
|
+
3,
|
|
250
|
+
8,
|
|
251
|
+
3,
|
|
252
|
+
3,
|
|
253
|
+
8,
|
|
254
|
+
3,
|
|
255
|
+
8,
|
|
256
|
+
7,
|
|
257
|
+
4,
|
|
258
|
+
8,
|
|
259
|
+
4,
|
|
260
|
+
4,
|
|
261
|
+
4,
|
|
262
|
+
4,
|
|
263
|
+
3,
|
|
264
|
+
5,
|
|
265
|
+
4,
|
|
266
|
+
3,
|
|
267
|
+
3,
|
|
268
|
+
3,
|
|
269
|
+
7,
|
|
270
|
+
3,
|
|
271
|
+
3,
|
|
272
|
+
4,
|
|
273
|
+
4,
|
|
274
|
+
6,
|
|
275
|
+
4,
|
|
276
|
+
7,
|
|
277
|
+
7,
|
|
278
|
+
4,
|
|
279
|
+
3,
|
|
280
|
+
3,
|
|
281
|
+
3,
|
|
282
|
+
3,
|
|
283
|
+
4,
|
|
284
|
+
8,
|
|
285
|
+
3,
|
|
286
|
+
3,
|
|
287
|
+
3
|
|
288
|
+
],
|
|
289
|
+
"featured": {
|
|
290
|
+
"functionName": "arrow",
|
|
291
|
+
"body": "function flip(likelihood = 50) {\n\treturn chance.bool({ likelihood });\n}"
|
|
292
|
+
},
|
|
293
|
+
"category": [
|
|
294
|
+
"electronics",
|
|
295
|
+
"books",
|
|
296
|
+
"clothing",
|
|
297
|
+
"home",
|
|
298
|
+
"garden",
|
|
299
|
+
"toys",
|
|
300
|
+
"sports",
|
|
301
|
+
"automotive",
|
|
302
|
+
"beauty",
|
|
303
|
+
"health",
|
|
304
|
+
"grocery",
|
|
305
|
+
"jewelry",
|
|
306
|
+
"shoes",
|
|
307
|
+
"tools",
|
|
308
|
+
"office supplies"
|
|
309
|
+
],
|
|
310
|
+
"descriptor": [
|
|
311
|
+
"brand new",
|
|
312
|
+
"open box",
|
|
313
|
+
"refurbished",
|
|
314
|
+
"used",
|
|
315
|
+
"like new",
|
|
316
|
+
"vintage",
|
|
317
|
+
"antique",
|
|
318
|
+
"collectible"
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
"hooks": "function (record, type, meta) {\n\n\t\tconst NOW = dayjs();\n\n\t\tif (type === \"event\") {\n\t\t\t// Pattern 1: Checkouts with coupons get a discount_applied flag and adjusted total\n\t\t\tif (record.event === \"checkout\" && record.coupon && record.coupon !== \"none\") {\n\t\t\t\trecord.discount_applied = true;\n\t\t\t\tconst pctMatch = record.coupon.match(/(\\d+)%/);\n\t\t\t\tif (pctMatch) {\n\t\t\t\t\trecord.discount_percent = parseInt(pctMatch[1]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Pattern 2: \"save item\" events on weekends are tagged as wishlist behavior\n\t\t\tif (record.event === \"save item\") {\n\t\t\t\tconst dow = dayjs(record.time).day();\n\t\t\t\tif (dow === 0 || dow === 6) {\n\t\t\t\t\trecord.save_context = \"weekend_browse\";\n\t\t\t\t} else {\n\t\t\t\t\trecord.save_context = \"weekday_intent\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (type === \"everything\") {\n\t\t\t// Pattern 3: Users who view 5+ items but never checkout are tagged as window shoppers\n\t\t\tconst views = record.filter(e => e.event === \"view item\").length;\n\t\t\tconst checkouts = record.filter(e => e.event === \"checkout\").length;\n\t\t\tif (views >= 5 && checkouts === 0) {\n\t\t\t\tfor (const e of record) {\n\t\t\t\t\te.user_segment = \"window_shopper\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn record;\n\t}",
|
|
325
|
+
"timestamp": "2026-04-10T01:39:06.554Z",
|
|
326
|
+
"version": "4.0"
|
|
327
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import Chance from 'chance';
|
|
2
|
+
let chance = new Chance();
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import utc from "dayjs/plugin/utc.js";
|
|
5
|
+
dayjs.extend(utc);
|
|
6
|
+
import { uid, comma } from 'ak-tools';
|
|
7
|
+
import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
|
|
8
|
+
|
|
9
|
+
const videoCategories = ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"];
|
|
10
|
+
const spiritAnimals = ["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"];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* ═══════════════════════════════════════════════════════════════
|
|
14
|
+
* DATASET OVERVIEW
|
|
15
|
+
* ═══════════════════════════════════════════════════════════════
|
|
16
|
+
*
|
|
17
|
+
* Array-of-Object Lookup Test — tests nested product arrays in events.
|
|
18
|
+
* - 1,000 users over 60 days, ~100K events
|
|
19
|
+
* - Events: checkout (cart array), add to cart, view/save item (single item)
|
|
20
|
+
* - Lookup table: 1,000 products with price, category, descriptor
|
|
21
|
+
* - Tests Mixpanel's array-of-objects property handling
|
|
22
|
+
*
|
|
23
|
+
* ═══════════════════════════════════════════════════════════════
|
|
24
|
+
* ANALYTICS HOOKS (3 patterns)
|
|
25
|
+
* ═══════════════════════════════════════════════════════════════
|
|
26
|
+
*
|
|
27
|
+
* 1. COUPON DISCOUNT TAGGING (event hook)
|
|
28
|
+
* Checkout events with coupons get discount_applied: true and
|
|
29
|
+
* discount_percent extracted from the coupon string.
|
|
30
|
+
*
|
|
31
|
+
* 2. WEEKEND BROWSE vs WEEKDAY INTENT (event hook)
|
|
32
|
+
* Save item events on weekends tagged save_context: "weekend_browse",
|
|
33
|
+
* weekdays tagged "weekday_intent".
|
|
34
|
+
*
|
|
35
|
+
* 3. WINDOW SHOPPERS (everything hook)
|
|
36
|
+
* Users with 5+ view item events but 0 checkouts get all their
|
|
37
|
+
* events tagged user_segment: "window_shopper".
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** @type {import('../types.js').Dungeon} */
|
|
41
|
+
const config = {
|
|
42
|
+
// token: "",
|
|
43
|
+
seed: "test array of objects lookup",
|
|
44
|
+
name: "array-of-object-lookup",
|
|
45
|
+
numDays: 60, //how many days worth1 of data
|
|
46
|
+
numEvents: 100_000, //how many events
|
|
47
|
+
numUsers: 1_000, //how many users
|
|
48
|
+
format: 'json', //csv or json
|
|
49
|
+
region: "US",
|
|
50
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
51
|
+
hasSessionIds: true, //if true, hasSessionIds are created for each user
|
|
52
|
+
hasAdSpend: false,
|
|
53
|
+
hasLocation: true,
|
|
54
|
+
hasAndroidDevices: false,
|
|
55
|
+
hasIOSDevices: false,
|
|
56
|
+
hasDesktopDevices: true,
|
|
57
|
+
hasBrowser: true,
|
|
58
|
+
hasCampaigns: false,
|
|
59
|
+
isAnonymous: false,
|
|
60
|
+
alsoInferFunnels: true,
|
|
61
|
+
concurrency: 1,
|
|
62
|
+
batchSize: 250_000,
|
|
63
|
+
writeToDisk: false,
|
|
64
|
+
events: [
|
|
65
|
+
{
|
|
66
|
+
event: "checkout",
|
|
67
|
+
weight: 2,
|
|
68
|
+
properties: {
|
|
69
|
+
currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
|
|
70
|
+
coupon: weighChoices(["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"]),
|
|
71
|
+
cart: makeProducts()
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
event: "add to cart",
|
|
76
|
+
weight: 4,
|
|
77
|
+
properties: {
|
|
78
|
+
item: makeProducts(1),
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
event: "view item",
|
|
83
|
+
weight: 8,
|
|
84
|
+
properties: {
|
|
85
|
+
item: makeProducts(1)
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
event: "save item",
|
|
90
|
+
weight: 5,
|
|
91
|
+
properties: {
|
|
92
|
+
item: makeProducts(1),
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
funnels: [ ],
|
|
97
|
+
superProps: {
|
|
98
|
+
theme: pickAWinner(["light", "dark", "custom", "light", "dark"]),
|
|
99
|
+
},
|
|
100
|
+
/*
|
|
101
|
+
user properties work the same as event properties
|
|
102
|
+
each key should be an array or function reference
|
|
103
|
+
*/
|
|
104
|
+
userProps: {
|
|
105
|
+
// title: chance.profession.bind(chance),
|
|
106
|
+
// luckyNumber: weighNumRange(1, 500, .3),
|
|
107
|
+
spiritAnimal: spiritAnimals
|
|
108
|
+
},
|
|
109
|
+
scdProps: {},
|
|
110
|
+
mirrorProps: {},
|
|
111
|
+
/*
|
|
112
|
+
for group analytics keys, we need an array of arrays [[],[],[]]
|
|
113
|
+
each pair represents a group_key and the number of profiles for that key
|
|
114
|
+
*/
|
|
115
|
+
groupKeys: [],
|
|
116
|
+
groupProps: {},
|
|
117
|
+
lookupTables: [{
|
|
118
|
+
key: "product_id",
|
|
119
|
+
entries: 1000,
|
|
120
|
+
attributes: {
|
|
121
|
+
amount: weighNumRange(1, 1000, .3),
|
|
122
|
+
quantity: weighNumRange(1, 10, .3),
|
|
123
|
+
featured: flip,
|
|
124
|
+
category: ["electronics", "books", "clothing", "home", "garden", "toys", "sports", "automotive", "beauty", "health", "grocery", "jewelry", "shoes", "tools", "office supplies"],
|
|
125
|
+
descriptor: ["brand new", "open box", "refurbished", "used", "like new", "vintage", "antique", "collectible"]
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}],
|
|
130
|
+
hook: function (record, type, meta) {
|
|
131
|
+
|
|
132
|
+
const NOW = dayjs();
|
|
133
|
+
|
|
134
|
+
if (type === "event") {
|
|
135
|
+
// Pattern 1: Checkouts with coupons get a discount_applied flag and adjusted total
|
|
136
|
+
if (record.event === "checkout" && record.coupon && record.coupon !== "none") {
|
|
137
|
+
record.discount_applied = true;
|
|
138
|
+
const pctMatch = record.coupon.match(/(\d+)%/);
|
|
139
|
+
if (pctMatch) {
|
|
140
|
+
record.discount_percent = parseInt(pctMatch[1]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Pattern 2: "save item" events on weekends are tagged as wishlist behavior
|
|
145
|
+
if (record.event === "save item") {
|
|
146
|
+
const dow = dayjs(record.time).day();
|
|
147
|
+
if (dow === 0 || dow === 6) {
|
|
148
|
+
record.save_context = "weekend_browse";
|
|
149
|
+
} else {
|
|
150
|
+
record.save_context = "weekday_intent";
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (type === "everything") {
|
|
156
|
+
// Pattern 3: Users who view 5+ items but never checkout are tagged as window shoppers
|
|
157
|
+
const views = record.filter(e => e.event === "view item").length;
|
|
158
|
+
const checkouts = record.filter(e => e.event === "checkout").length;
|
|
159
|
+
if (views >= 5 && checkouts === 0) {
|
|
160
|
+
for (const e of record) {
|
|
161
|
+
e.user_segment = "window_shopper";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return record;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
function makeProducts(maxItems = 5) {
|
|
171
|
+
return function () {
|
|
172
|
+
const categories = ["electronics", "books", "clothing", "home", "garden", "toys", "sports", "automotive", "beauty", "health", "grocery", "jewelry", "shoes", "tools", "office supplies"];
|
|
173
|
+
const descriptors = ["brand new", "open box", "refurbished", "used", "like new", "vintage", "antique", "collectible"];
|
|
174
|
+
const suffix = ["item", "product", "good", "merchandise", "thing", "object", "widget", "gadget", "device", "apparatus", "contraption", "instrument", "tool", "implement", "utensil", "appliance", "machine", "equipment", "gear", "kit", "set", "package"];
|
|
175
|
+
const assetPreview = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
|
|
176
|
+
const data = [];
|
|
177
|
+
const numOfItems = integer(1, maxItems);
|
|
178
|
+
|
|
179
|
+
for (var i = 0; i < numOfItems; i++) {
|
|
180
|
+
const category = chance.pickone(categories);
|
|
181
|
+
const descriptor = chance.pickone(descriptors);
|
|
182
|
+
const suffixWord = chance.pickone(suffix);
|
|
183
|
+
const slug = `${descriptor.replace(/\s+/g, '-').toLowerCase()}-${suffixWord.replace(/\s+/g, '-').toLowerCase()}`;
|
|
184
|
+
const asset = chance.pickone(assetPreview);
|
|
185
|
+
|
|
186
|
+
// const product_id = chance.guid();
|
|
187
|
+
const price = integer(1, 100);
|
|
188
|
+
const quantity = integer(1, 5);
|
|
189
|
+
const product_id = integer(1, 1_000);
|
|
190
|
+
|
|
191
|
+
const item = {
|
|
192
|
+
product_id: product_id,
|
|
193
|
+
product_url: `https://example.com/assets/${product_id}`,
|
|
194
|
+
// sku: integer(11111, 99999),
|
|
195
|
+
// amount: price,
|
|
196
|
+
// quantity: quantity,
|
|
197
|
+
// total_value: price * quantity,
|
|
198
|
+
// featured: chance.pickone([true, false, false]),
|
|
199
|
+
// category: category,
|
|
200
|
+
// descriptor: descriptor,
|
|
201
|
+
// slug: slug,
|
|
202
|
+
|
|
203
|
+
// assetType: asset
|
|
204
|
+
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
data.push(item);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return () => [data];
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
function flip(likelihood = 50) {
|
|
216
|
+
return chance.bool({ likelihood });
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
export default config;
|