@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.
Files changed (66) hide show
  1. package/README.md +518 -0
  2. package/dungeons/array-of-object-lookup-schema.json +327 -0
  3. package/dungeons/array-of-object-lookup.js +220 -0
  4. package/dungeons/ecommerce-schema.json +462 -0
  5. package/dungeons/ecommerce.js +447 -0
  6. package/dungeons/education-schema.json +2409 -0
  7. package/dungeons/education.js +768 -0
  8. package/dungeons/fintech-schema.json +14034 -0
  9. package/dungeons/fintech.js +696 -0
  10. package/dungeons/foobar-schema.json +403 -0
  11. package/dungeons/foobar.js +296 -0
  12. package/dungeons/food-delivery-schema.json +192 -0
  13. package/dungeons/food-delivery.js +602 -0
  14. package/dungeons/food-schema.json +1152 -0
  15. package/dungeons/food.js +754 -0
  16. package/dungeons/gaming-schema.json +1270 -0
  17. package/dungeons/gaming.js +508 -0
  18. package/dungeons/insurance-application-schema.json +204 -0
  19. package/dungeons/insurance-application.js +605 -0
  20. package/dungeons/media-schema.json +906 -0
  21. package/dungeons/media.js +790 -0
  22. package/dungeons/retention-cadence-schema.json +78 -0
  23. package/dungeons/retention-cadence.js +244 -0
  24. package/dungeons/rpg-schema.json +4526 -0
  25. package/dungeons/rpg.js +919 -0
  26. package/dungeons/sanity-schema.json +255 -0
  27. package/dungeons/sanity.js +152 -0
  28. package/dungeons/sass-schema.json +1291 -0
  29. package/dungeons/sass.js +795 -0
  30. package/dungeons/scd-schema.json +919 -0
  31. package/dungeons/scd.js +277 -0
  32. package/dungeons/simple-schema.json +608 -0
  33. package/dungeons/simple.js +285 -0
  34. package/dungeons/simplest-schema.json +1418 -0
  35. package/dungeons/simplest.js +392 -0
  36. package/dungeons/social-schema.json +1118 -0
  37. package/dungeons/social.js +686 -0
  38. package/dungeons/text-generation-schema.json +3096 -0
  39. package/dungeons/text-generation.js +812 -0
  40. package/index.js +567 -0
  41. package/lib/core/config-validator.js +395 -0
  42. package/lib/core/context.js +204 -0
  43. package/lib/core/dungeon-loader.js +337 -0
  44. package/lib/core/storage.js +379 -0
  45. package/lib/generators/adspend.js +132 -0
  46. package/lib/generators/events.js +271 -0
  47. package/lib/generators/funnels.js +407 -0
  48. package/lib/generators/mirror.js +167 -0
  49. package/lib/generators/product-lookup.js +262 -0
  50. package/lib/generators/product-names.js +195 -0
  51. package/lib/generators/profiles.js +93 -0
  52. package/lib/generators/scd.js +124 -0
  53. package/lib/generators/text.js +1192 -0
  54. package/lib/orchestrators/mixpanel-sender.js +266 -0
  55. package/lib/orchestrators/user-loop.js +335 -0
  56. package/lib/templates/abbreviated.d.ts +169 -0
  57. package/lib/templates/defaults.js +1405 -0
  58. package/lib/templates/phrases.js +2526 -0
  59. package/lib/templates/schema.d.ts +173 -0
  60. package/lib/templates/soup-presets.js +188 -0
  61. package/lib/utils/function-registry.js +302 -0
  62. package/lib/utils/json-evaluator.js +172 -0
  63. package/lib/utils/logger.js +34 -0
  64. package/lib/utils/utils.js +1490 -0
  65. package/package.json +89 -0
  66. package/types.d.ts +865 -0
@@ -0,0 +1,608 @@
1
+ {
2
+ "schema": {
3
+ "token": "",
4
+ "seed": "simple is best",
5
+ "numDays": 100,
6
+ "numEvents": 500000,
7
+ "numUsers": 5000,
8
+ "format": "json",
9
+ "region": "US",
10
+ "hasAnonIds": true,
11
+ "hasSessionIds": true,
12
+ "hasAdSpend": false,
13
+ "hasLocation": true,
14
+ "hasAndroidDevices": true,
15
+ "hasIOSDevices": true,
16
+ "hasDesktopDevices": true,
17
+ "hasBrowser": true,
18
+ "hasCampaigns": true,
19
+ "isAnonymous": false,
20
+ "alsoInferFunnels": true,
21
+ "concurrency": 1,
22
+ "batchSize": 2500000,
23
+ "events": [
24
+ {
25
+ "event": "ad impression",
26
+ "weight": 15,
27
+ "properties": {
28
+ "partner": [
29
+ "google",
30
+ "facebook",
31
+ "twitter",
32
+ "linkedin",
33
+ "bing",
34
+ "taboola",
35
+ "outbrain",
36
+ "quora",
37
+ "pinterest"
38
+ ]
39
+ }
40
+ },
41
+ {
42
+ "event": "ad click",
43
+ "weight": 10,
44
+ "properties": {
45
+ "partner": [
46
+ "google",
47
+ "facebook",
48
+ "twitter",
49
+ "linkedin",
50
+ "bing",
51
+ "taboola",
52
+ "outbrain",
53
+ "quora",
54
+ "pinterest"
55
+ ]
56
+ }
57
+ },
58
+ {
59
+ "event": "checkout",
60
+ "weight": 2,
61
+ "properties": {
62
+ "amount": [
63
+ 110,
64
+ 153,
65
+ 209,
66
+ 398,
67
+ 119,
68
+ 131,
69
+ 160,
70
+ 180,
71
+ 393,
72
+ 362,
73
+ 112,
74
+ 298,
75
+ 349,
76
+ 136,
77
+ 370,
78
+ 131,
79
+ 142,
80
+ 127,
81
+ 151,
82
+ 385,
83
+ 339,
84
+ 362,
85
+ 111,
86
+ 148,
87
+ 336,
88
+ 158,
89
+ 188,
90
+ 159,
91
+ 119,
92
+ 340,
93
+ 369,
94
+ 127,
95
+ 125,
96
+ 379,
97
+ 166,
98
+ 129,
99
+ 390,
100
+ 126,
101
+ 155,
102
+ 124,
103
+ 345,
104
+ 196,
105
+ 159,
106
+ 131,
107
+ 253,
108
+ 149,
109
+ 155,
110
+ 161,
111
+ 149,
112
+ 333
113
+ ],
114
+ "currency": [
115
+ "USD",
116
+ "CAD",
117
+ "EUR",
118
+ "BTC",
119
+ "ETH",
120
+ "JPY"
121
+ ],
122
+ "coupon": {
123
+ "functionName": "arrow",
124
+ "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}"
125
+ },
126
+ "numItems": [
127
+ 5,
128
+ 5,
129
+ 4,
130
+ 3,
131
+ 5,
132
+ 5,
133
+ 6,
134
+ 3,
135
+ 5,
136
+ 4,
137
+ 9,
138
+ 3,
139
+ 8,
140
+ 8,
141
+ 7,
142
+ 3,
143
+ 8,
144
+ 4,
145
+ 6,
146
+ 9,
147
+ 7,
148
+ 5,
149
+ 8,
150
+ 4,
151
+ 4,
152
+ 5,
153
+ 5,
154
+ 3,
155
+ 5,
156
+ 5,
157
+ 4,
158
+ 4,
159
+ 3,
160
+ 6,
161
+ 1,
162
+ 1,
163
+ 5,
164
+ 5,
165
+ 6,
166
+ 5,
167
+ 6,
168
+ 7,
169
+ 4,
170
+ 4,
171
+ 2,
172
+ 3,
173
+ 2,
174
+ 5,
175
+ 8,
176
+ 3
177
+ ]
178
+ }
179
+ },
180
+ {
181
+ "event": "add to cart",
182
+ "weight": 4,
183
+ "properties": {
184
+ "amount": [
185
+ 131,
186
+ 112,
187
+ 138,
188
+ 145,
189
+ 160,
190
+ 371,
191
+ 146,
192
+ 163,
193
+ 386,
194
+ 160,
195
+ 128,
196
+ 141,
197
+ 137,
198
+ 116,
199
+ 139,
200
+ 383,
201
+ 186,
202
+ 201,
203
+ 349,
204
+ 136,
205
+ 125,
206
+ 136,
207
+ 363,
208
+ 129,
209
+ 151,
210
+ 130,
211
+ 148,
212
+ 158,
213
+ 375,
214
+ 383,
215
+ 137,
216
+ 117,
217
+ 326,
218
+ 337,
219
+ 191,
220
+ 127,
221
+ 127,
222
+ 167,
223
+ 129,
224
+ 253,
225
+ 371,
226
+ 169,
227
+ 123,
228
+ 392,
229
+ 171,
230
+ 123,
231
+ 346,
232
+ 362,
233
+ 223,
234
+ 360
235
+ ],
236
+ "rating": [
237
+ 2,
238
+ 2,
239
+ 2,
240
+ 3,
241
+ 3,
242
+ 3,
243
+ 2,
244
+ 1,
245
+ 2,
246
+ 5,
247
+ 2,
248
+ 2,
249
+ 2,
250
+ 2,
251
+ 2,
252
+ 2,
253
+ 3,
254
+ 2,
255
+ 4,
256
+ 3,
257
+ 2,
258
+ 2,
259
+ 3,
260
+ 3,
261
+ 2,
262
+ 4,
263
+ 3,
264
+ 4,
265
+ 2,
266
+ 2,
267
+ 3,
268
+ 5,
269
+ 5,
270
+ 2,
271
+ 2,
272
+ 2,
273
+ 2,
274
+ 4,
275
+ 2,
276
+ 2,
277
+ 3,
278
+ 4,
279
+ 3,
280
+ 1,
281
+ 2,
282
+ 3,
283
+ 3,
284
+ 2,
285
+ 5,
286
+ 4
287
+ ],
288
+ "reviews": [
289
+ 9,
290
+ 27,
291
+ 20,
292
+ 16,
293
+ 16,
294
+ 4,
295
+ 23,
296
+ 9,
297
+ 17,
298
+ 22,
299
+ 15,
300
+ 8,
301
+ 12,
302
+ 13,
303
+ 9,
304
+ 15,
305
+ 18,
306
+ 10,
307
+ 14,
308
+ 16,
309
+ 10,
310
+ 9,
311
+ 6,
312
+ 9,
313
+ 15,
314
+ 18,
315
+ 28,
316
+ 14,
317
+ 6,
318
+ 20,
319
+ 23,
320
+ 26,
321
+ 9,
322
+ 20,
323
+ 3,
324
+ 14,
325
+ 26,
326
+ 13,
327
+ 19,
328
+ 14,
329
+ 10,
330
+ 18,
331
+ 20,
332
+ 29,
333
+ 8,
334
+ 8,
335
+ 12,
336
+ 8,
337
+ 8,
338
+ 19
339
+ ],
340
+ "isFeaturedItem": [
341
+ true,
342
+ false,
343
+ false
344
+ ],
345
+ "itemCategory": {
346
+ "functionName": "arrow",
347
+ "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}"
348
+ },
349
+ "dateItemListed": {
350
+ "functionName": "integer",
351
+ "args": []
352
+ }
353
+ }
354
+ },
355
+ {
356
+ "event": "page view",
357
+ "weight": 10,
358
+ "properties": {
359
+ "page": {
360
+ "functionName": "arrow",
361
+ "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}"
362
+ },
363
+ "utm_source": {
364
+ "functionName": "arrow",
365
+ "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}"
366
+ }
367
+ }
368
+ },
369
+ {
370
+ "event": "watch video",
371
+ "weight": 8,
372
+ "properties": {
373
+ "videoCategory": {
374
+ "functionName": "arrow",
375
+ "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}"
376
+ },
377
+ "isFeaturedItem": [
378
+ true,
379
+ false,
380
+ false
381
+ ],
382
+ "watchTimeSec": [
383
+ 433,
384
+ 466,
385
+ 143,
386
+ 178,
387
+ 159,
388
+ 449,
389
+ 170,
390
+ 145,
391
+ 170,
392
+ 168,
393
+ 159,
394
+ 161,
395
+ 173,
396
+ 240,
397
+ 131,
398
+ 424,
399
+ 180,
400
+ 431,
401
+ 197,
402
+ 305,
403
+ 156,
404
+ 183,
405
+ 466,
406
+ 149,
407
+ 453,
408
+ 440,
409
+ 207,
410
+ 161,
411
+ 158,
412
+ 159,
413
+ 437,
414
+ 159,
415
+ 156,
416
+ 180,
417
+ 384,
418
+ 404,
419
+ 149,
420
+ 458,
421
+ 136,
422
+ 168,
423
+ 453,
424
+ 415,
425
+ 148,
426
+ 187,
427
+ 155,
428
+ 305,
429
+ 161,
430
+ 175,
431
+ 161,
432
+ 195
433
+ ],
434
+ "quality": [
435
+ "2160p",
436
+ "1440p",
437
+ "1080p",
438
+ "720p",
439
+ "480p",
440
+ "360p",
441
+ "240p"
442
+ ],
443
+ "format": [
444
+ "mp4",
445
+ "avi",
446
+ "mov",
447
+ "mpg"
448
+ ],
449
+ "uploader_id": {
450
+ "functionName": "arrow",
451
+ "body": "function () { [native code] }"
452
+ }
453
+ }
454
+ },
455
+ {
456
+ "event": "view item",
457
+ "weight": 8,
458
+ "properties": {
459
+ "isFeaturedItem": [
460
+ true,
461
+ false,
462
+ false
463
+ ],
464
+ "itemCategory": {
465
+ "functionName": "arrow",
466
+ "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}"
467
+ },
468
+ "dateItemListed": {
469
+ "functionName": "integer",
470
+ "args": []
471
+ }
472
+ }
473
+ },
474
+ {
475
+ "event": "save item",
476
+ "weight": 5,
477
+ "properties": {
478
+ "isFeaturedItem": [
479
+ true,
480
+ false,
481
+ false
482
+ ],
483
+ "itemCategory": {
484
+ "functionName": "arrow",
485
+ "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}"
486
+ },
487
+ "dateItemListed": {
488
+ "functionName": "integer",
489
+ "args": []
490
+ }
491
+ }
492
+ },
493
+ {
494
+ "event": "sign up",
495
+ "weight": 1,
496
+ "isFirstEvent": true,
497
+ "properties": {
498
+ "signupMethod": [
499
+ "email",
500
+ "google",
501
+ "facebook",
502
+ "twitter",
503
+ "linkedin",
504
+ "github"
505
+ ],
506
+ "referral": {
507
+ "functionName": "arrow",
508
+ "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}"
509
+ }
510
+ }
511
+ }
512
+ ],
513
+ "funnels": [
514
+ {
515
+ "sequence": [
516
+ "page view",
517
+ "view item",
518
+ "save item",
519
+ "page view",
520
+ "sign up"
521
+ ],
522
+ "conversionRate": 50,
523
+ "order": "first-and-last-fixed",
524
+ "weight": 1,
525
+ "isFirstFunnel": true,
526
+ "timeToConvert": 2,
527
+ "experiment": true,
528
+ "name": "Signup Flow"
529
+ }
530
+ ],
531
+ "superProps": {
532
+ "theme": {
533
+ "functionName": "arrow",
534
+ "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}"
535
+ }
536
+ },
537
+ "userProps": {
538
+ "title": {
539
+ "functionName": "arrow",
540
+ "body": "function () { [native code] }"
541
+ },
542
+ "luckyNumber": [
543
+ 311,
544
+ 314,
545
+ 126,
546
+ 120,
547
+ 140,
548
+ 337,
549
+ 148,
550
+ 138,
551
+ 160,
552
+ 138,
553
+ 127,
554
+ 151,
555
+ 132,
556
+ 296,
557
+ 135,
558
+ 140,
559
+ 152,
560
+ 165,
561
+ 147,
562
+ 314,
563
+ 305,
564
+ 127,
565
+ 122,
566
+ 144,
567
+ 335,
568
+ 314,
569
+ 148,
570
+ 154,
571
+ 311,
572
+ 158,
573
+ 144,
574
+ 309,
575
+ 152,
576
+ 311,
577
+ 136,
578
+ 145,
579
+ 231,
580
+ 162,
581
+ 145,
582
+ 331,
583
+ 331,
584
+ 136,
585
+ 162,
586
+ 144,
587
+ 138,
588
+ 142,
589
+ 117,
590
+ 319,
591
+ 141,
592
+ 140
593
+ ],
594
+ "spiritAnimal": {
595
+ "functionName": "arrow",
596
+ "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}"
597
+ }
598
+ },
599
+ "scdProps": {},
600
+ "mirrorProps": {},
601
+ "groupKeys": [],
602
+ "groupProps": {},
603
+ "lookupTables": []
604
+ },
605
+ "hooks": "function (record, type, meta) {\n\n\t\tconst NOW = dayjs();\n\t\t// const DATE_HOMEGROWN_LAUNCH = NOW.subtract(25, 'day');\n\t\t// const DATE_HOMEGROWN_IMPROVEMENT = NOW.subtract(10, 'day');\n\t\tconst OVER_THINGS_GET_BETTER = NOW.subtract(15, 'day');\n\n\t\tif (type === \"event\") {\n\t\t\tconst EVENT_TIME = dayjs(record.time);\n\n\t\t\tif (EVENT_TIME.isAfter(OVER_THINGS_GET_BETTER)) {\n\t\t\t\t// checkouts are bigger\n\t\t\t\tif (record.event === \"checkout\") {\n\t\t\t\t\trecord.amount = Math.round(record.amount * 1.5);\n\t\t\t\t}\n\n\t\t\t\t// videos are longer\n\t\t\t\tif (record.event === \"watch video\") {\n\t\t\t\t\trecord.watchTimeSec = Math.round(record.watchTimeSec * 1.5);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (EVENT_TIME.isBefore(OVER_THINGS_GET_BETTER)) {\n\t\t\t\t// tag 33% for removal (filtered in \"everything\" hook)\n\t\t\t\tif (chance.bool({ likelihood: 33 })) record._drop = true;\n\t\t\t}\n\t\t}\n\n\t\tif (type === \"everything\") {\n\n\t\t\t//custom themes purchase more:\n\t\t\tconst numCustomMode = record.filter(a => a.theme === 'custom').length;\n\t\t\tconst numLightMode = record.filter(a => a.theme === 'light').length;\n\t\t\tconst numDarkMode = record.filter(a => a.theme === 'dark').length;\n\t\t\tif (numCustomMode > numLightMode || numCustomMode > numDarkMode) {\n\t\t\t\t//triple their checkout events\n\t\t\t\tconst checkoutEvents = record.filter(a => a.event === 'checkout');\n\t\t\t\tconst newCheckouts = checkoutEvents.map(a => {\n\t\t\t\t\tconst randomInt = integer(-48, 48);\n\t\t\t\t\tconst newCheckout = {\n\t\t\t\t\t\t...a,\n\t\t\t\t\t\ttime: dayjs(a.time).add(randomInt, 'hour').toISOString(),\n\t\t\t\t\t\tevent: \"checkout\",\n\t\t\t\t\t\tamount: a.amount * 2,\n\t\t\t\t\t\tcoupon: \"50%OFF\"\n\t\t\t\t\t};\n\t\t\t\t\treturn newCheckout;\n\t\t\t\t});\n\t\t\t\trecord.push(...newCheckouts);\n\t\t\t}\n\n\t\t\t//users who watch low quality videos churn more:\n\t\t\tconst loQuality = [\"480p\", \"360p\", \"240p\"];\n\t\t\tconst lowQualityWatches = record.filter(a => a.event === 'watch video' && loQuality.includes(a.quality));\n\t\t\tconst highQualityWatches = record.filter(a => a.event === 'watch video' && !loQuality.includes(a.quality));\n\t\t\tif (lowQualityWatches.length > highQualityWatches.length) {\n\t\t\t\tif (flip()) {\n\t\t\t\t\t// find midpoint of records\n\t\t\t\t\tconst midpoint = Math.floor(record.length / 2);\n\t\t\t\t\trecord = record.slice(0, midpoint);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Filter out events tagged for removal in the event hook\n\t\t\trecord = record.filter(e => !e._drop);\n\t\t}\n\n\t\treturn record;\n\t}",
606
+ "timestamp": "2026-04-10T01:39:07.585Z",
607
+ "version": "4.0"
608
+ }