@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,255 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": {
|
|
3
|
+
"token": "",
|
|
4
|
+
"seed": "foo bar",
|
|
5
|
+
"numDays": 90,
|
|
6
|
+
"numEvents": 50000,
|
|
7
|
+
"numUsers": 500,
|
|
8
|
+
"format": "json",
|
|
9
|
+
"region": "US",
|
|
10
|
+
"hasAnonIds": false,
|
|
11
|
+
"hasSessionIds": false,
|
|
12
|
+
"alsoInferFunnels": true,
|
|
13
|
+
"writeToDisk": false,
|
|
14
|
+
"concurrency": 1,
|
|
15
|
+
"funnels": [
|
|
16
|
+
{
|
|
17
|
+
"sequence": [
|
|
18
|
+
"qux",
|
|
19
|
+
"garply",
|
|
20
|
+
"durtle",
|
|
21
|
+
"linny",
|
|
22
|
+
"fonk",
|
|
23
|
+
"crumn",
|
|
24
|
+
"yak"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"sequence": [
|
|
29
|
+
"foo",
|
|
30
|
+
"bar",
|
|
31
|
+
"baz"
|
|
32
|
+
],
|
|
33
|
+
"isFirstFunnel": true
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"events": [
|
|
37
|
+
{
|
|
38
|
+
"event": "foo",
|
|
39
|
+
"weight": 10,
|
|
40
|
+
"properties": {}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"event": "bar",
|
|
44
|
+
"weight": 9,
|
|
45
|
+
"isFirstEvent": true,
|
|
46
|
+
"properties": {}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"event": "baz",
|
|
50
|
+
"weight": 8,
|
|
51
|
+
"properties": {}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"event": "qux",
|
|
55
|
+
"weight": 7,
|
|
56
|
+
"properties": {}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"event": "garply",
|
|
60
|
+
"weight": 6,
|
|
61
|
+
"properties": {}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"event": "durtle",
|
|
65
|
+
"weight": 5,
|
|
66
|
+
"properties": {}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"event": "linny",
|
|
70
|
+
"weight": 4,
|
|
71
|
+
"properties": {}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"event": "fonk",
|
|
75
|
+
"weight": 3,
|
|
76
|
+
"properties": {}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"event": "crumn",
|
|
80
|
+
"weight": 2,
|
|
81
|
+
"properties": {}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"event": "yak",
|
|
85
|
+
"weight": 1,
|
|
86
|
+
"properties": {}
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"superProps": {
|
|
90
|
+
"color": [
|
|
91
|
+
"red",
|
|
92
|
+
"orange",
|
|
93
|
+
"yellow",
|
|
94
|
+
"green",
|
|
95
|
+
"blue",
|
|
96
|
+
"indigo",
|
|
97
|
+
"violet"
|
|
98
|
+
],
|
|
99
|
+
"number": {
|
|
100
|
+
"functionName": "integer",
|
|
101
|
+
"args": []
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"userProps": {
|
|
105
|
+
"title": {
|
|
106
|
+
"functionName": "arrow",
|
|
107
|
+
"body": "function () { [native code] }"
|
|
108
|
+
},
|
|
109
|
+
"luckyNumber": [
|
|
110
|
+
65,
|
|
111
|
+
191,
|
|
112
|
+
230,
|
|
113
|
+
411,
|
|
114
|
+
104,
|
|
115
|
+
142,
|
|
116
|
+
202,
|
|
117
|
+
220,
|
|
118
|
+
389,
|
|
119
|
+
289,
|
|
120
|
+
74,
|
|
121
|
+
233,
|
|
122
|
+
267,
|
|
123
|
+
158,
|
|
124
|
+
307,
|
|
125
|
+
144,
|
|
126
|
+
172,
|
|
127
|
+
132,
|
|
128
|
+
188,
|
|
129
|
+
356,
|
|
130
|
+
254,
|
|
131
|
+
289,
|
|
132
|
+
70,
|
|
133
|
+
183,
|
|
134
|
+
251,
|
|
135
|
+
199,
|
|
136
|
+
224,
|
|
137
|
+
201,
|
|
138
|
+
103,
|
|
139
|
+
255,
|
|
140
|
+
306,
|
|
141
|
+
133,
|
|
142
|
+
125,
|
|
143
|
+
335,
|
|
144
|
+
209,
|
|
145
|
+
138,
|
|
146
|
+
374,
|
|
147
|
+
127,
|
|
148
|
+
194,
|
|
149
|
+
122,
|
|
150
|
+
261,
|
|
151
|
+
227,
|
|
152
|
+
201,
|
|
153
|
+
144,
|
|
154
|
+
231,
|
|
155
|
+
184,
|
|
156
|
+
194,
|
|
157
|
+
202,
|
|
158
|
+
184,
|
|
159
|
+
248
|
|
160
|
+
],
|
|
161
|
+
"spiritAnimal": [
|
|
162
|
+
"duck",
|
|
163
|
+
"dog",
|
|
164
|
+
"otter",
|
|
165
|
+
"penguin",
|
|
166
|
+
"cat",
|
|
167
|
+
"elephant",
|
|
168
|
+
"lion",
|
|
169
|
+
"cheetah",
|
|
170
|
+
"giraffe",
|
|
171
|
+
"zebra",
|
|
172
|
+
"rhino",
|
|
173
|
+
"hippo",
|
|
174
|
+
"whale",
|
|
175
|
+
"dolphin",
|
|
176
|
+
"shark",
|
|
177
|
+
"octopus",
|
|
178
|
+
"squid",
|
|
179
|
+
"jellyfish",
|
|
180
|
+
"starfish",
|
|
181
|
+
"seahorse",
|
|
182
|
+
"crab",
|
|
183
|
+
"lobster",
|
|
184
|
+
"shrimp",
|
|
185
|
+
"clam",
|
|
186
|
+
"snail",
|
|
187
|
+
"slug",
|
|
188
|
+
"butterfly",
|
|
189
|
+
"moth",
|
|
190
|
+
"bee",
|
|
191
|
+
"wasp",
|
|
192
|
+
"ant",
|
|
193
|
+
"beetle",
|
|
194
|
+
"ladybug",
|
|
195
|
+
"caterpillar",
|
|
196
|
+
"centipede",
|
|
197
|
+
"millipede",
|
|
198
|
+
"scorpion",
|
|
199
|
+
"spider",
|
|
200
|
+
"tarantula",
|
|
201
|
+
"tick",
|
|
202
|
+
"mite",
|
|
203
|
+
"mosquito",
|
|
204
|
+
"fly",
|
|
205
|
+
"dragonfly",
|
|
206
|
+
"damselfly",
|
|
207
|
+
"grasshopper",
|
|
208
|
+
"cricket",
|
|
209
|
+
"locust",
|
|
210
|
+
"mantis",
|
|
211
|
+
"cockroach",
|
|
212
|
+
"termite",
|
|
213
|
+
"praying mantis",
|
|
214
|
+
"walking stick",
|
|
215
|
+
"stick bug",
|
|
216
|
+
"leaf insect",
|
|
217
|
+
"lacewing",
|
|
218
|
+
"aphid",
|
|
219
|
+
"cicada",
|
|
220
|
+
"thrips",
|
|
221
|
+
"psyllid",
|
|
222
|
+
"scale insect",
|
|
223
|
+
"whitefly",
|
|
224
|
+
"mealybug",
|
|
225
|
+
"planthopper",
|
|
226
|
+
"leafhopper",
|
|
227
|
+
"treehopper",
|
|
228
|
+
"flea",
|
|
229
|
+
"louse",
|
|
230
|
+
"bedbug",
|
|
231
|
+
"flea beetle",
|
|
232
|
+
"weevil",
|
|
233
|
+
"longhorn beetle",
|
|
234
|
+
"leaf beetle",
|
|
235
|
+
"tiger beetle",
|
|
236
|
+
"ground beetle",
|
|
237
|
+
"lady beetle",
|
|
238
|
+
"firefly",
|
|
239
|
+
"click beetle",
|
|
240
|
+
"rove beetle",
|
|
241
|
+
"scarab beetle",
|
|
242
|
+
"dung beetle",
|
|
243
|
+
"stag beetle",
|
|
244
|
+
"rhinoceros beetle",
|
|
245
|
+
"hercules beetle",
|
|
246
|
+
"goliath beetle",
|
|
247
|
+
"jewel beetle",
|
|
248
|
+
"tortoise beetle"
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"hooks": "function (record, type, meta) {\n\t\t// --- user hook: tag power users based on luckyNumber ---\n\t\tif (type === \"user\") {\n\t\t\trecord.userTier = record.luckyNumber > 300 ? \"power\" : \"regular\";\n\t\t\treturn record;\n\t\t}\n\n\t\t// --- event hook: add an engagement score based on event type ---\n\t\tif (type === \"event\") {\n\t\t\tconst highEngagement = [\"fonk\", \"crumn\", \"yak\"];\n\t\t\tconst midEngagement = [\"garply\", \"durtle\", \"linny\"];\n\t\t\tif (highEngagement.includes(record.event)) {\n\t\t\t\trecord.engagement_score = chance.integer({ min: 70, max: 100 });\n\t\t\t} else if (midEngagement.includes(record.event)) {\n\t\t\t\trecord.engagement_score = chance.integer({ min: 30, max: 69 });\n\t\t\t} else {\n\t\t\t\trecord.engagement_score = chance.integer({ min: 1, max: 29 });\n\t\t\t}\n\t\t\treturn record;\n\t\t}\n\n\t\t// --- everything hook: low-activity users lose their last few events (churn simulation) ---\n\t\tif (type === \"everything\") {\n\t\t\tif (record.length > 3 && record.length < 8) {\n\t\t\t\t// users with few events lose the tail end — simulates churn\n\t\t\t\treturn record.slice(0, Math.ceil(record.length * 0.6));\n\t\t\t}\n\t\t\treturn record;\n\t\t}\n\n\t\treturn record;\n\t}",
|
|
253
|
+
"timestamp": "2026-04-10T01:38:56.166Z",
|
|
254
|
+
"version": "4.0"
|
|
255
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import Chance from 'chance';
|
|
2
|
+
const chance = new Chance();
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import utc from 'dayjs/plugin/utc.js';
|
|
5
|
+
dayjs.extend(utc);
|
|
6
|
+
import { weighNumRange, integer } from "../lib/utils/utils.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ═══════════════════════════════════════════════════════════════
|
|
10
|
+
* DATASET OVERVIEW
|
|
11
|
+
* ═══════════════════════════════════════════════════════════════
|
|
12
|
+
*
|
|
13
|
+
* Sanity Test — lightweight dungeon for module integration testing.
|
|
14
|
+
* - 500 users over 30 days, ~50K events
|
|
15
|
+
* - 10 abstract events (foo-yak) with no properties
|
|
16
|
+
* - Super props: color, number — for quick breakdown testing
|
|
17
|
+
* - Groups, SCDs, inferred funnels all disabled
|
|
18
|
+
*
|
|
19
|
+
* ═══════════════════════════════════════════════════════════════
|
|
20
|
+
* ANALYTICS HOOKS (2 patterns)
|
|
21
|
+
* ═══════════════════════════════════════════════════════════════
|
|
22
|
+
*
|
|
23
|
+
* 1. TEMPERATURE TAGGING (event hook)
|
|
24
|
+
* foo/bar/baz = "hot", crumn/yak = "cold", everything else = "warm".
|
|
25
|
+
*
|
|
26
|
+
* 2. HASH-BASED POWER USERS (everything hook)
|
|
27
|
+
* ~10% of users (by distinct_id hash) get 3 extra duplicate events.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** @type {import('../types.js').Dungeon} */
|
|
31
|
+
const config = {
|
|
32
|
+
token: "",
|
|
33
|
+
seed: "foo bar",
|
|
34
|
+
numDays: 90, //how many days worth of data
|
|
35
|
+
numEvents: 50_000, //how many events
|
|
36
|
+
numUsers: 500, //how many users
|
|
37
|
+
format: 'json', //csv or json
|
|
38
|
+
region: "US",
|
|
39
|
+
hasAnonIds: false, //if true, anonymousIds are created for each user
|
|
40
|
+
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
41
|
+
alsoInferFunnels: true, //if true, infer funnels from events
|
|
42
|
+
writeToDisk: false,
|
|
43
|
+
concurrency: 1,
|
|
44
|
+
funnels: [
|
|
45
|
+
{
|
|
46
|
+
sequence: ["qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
sequence: ["foo", "bar", "baz"],
|
|
50
|
+
isFirstFunnel: true,
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
events: [
|
|
54
|
+
{
|
|
55
|
+
event: "foo",
|
|
56
|
+
weight: 10,
|
|
57
|
+
properties: {}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
event: "bar",
|
|
61
|
+
weight: 9,
|
|
62
|
+
isFirstEvent: true,
|
|
63
|
+
properties: {}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
event: "baz",
|
|
67
|
+
weight: 8,
|
|
68
|
+
properties: {}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
event: "qux",
|
|
72
|
+
weight: 7,
|
|
73
|
+
properties: {}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
event: "garply",
|
|
77
|
+
weight: 6,
|
|
78
|
+
properties: {}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
event: "durtle",
|
|
82
|
+
weight: 5,
|
|
83
|
+
properties: {}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
event: "linny",
|
|
87
|
+
weight: 4,
|
|
88
|
+
properties: {}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
event: "fonk",
|
|
92
|
+
weight: 3,
|
|
93
|
+
properties: {}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
event: "crumn",
|
|
97
|
+
weight: 2,
|
|
98
|
+
properties: {}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
event: "yak",
|
|
102
|
+
weight: 1,
|
|
103
|
+
properties: {}
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
superProps: {
|
|
107
|
+
color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
|
|
108
|
+
number: integer,
|
|
109
|
+
|
|
110
|
+
},
|
|
111
|
+
userProps: {
|
|
112
|
+
title: chance.profession.bind(chance),
|
|
113
|
+
luckyNumber: weighNumRange(42, 420),
|
|
114
|
+
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"]
|
|
115
|
+
},
|
|
116
|
+
hook: function (record, type, meta) {
|
|
117
|
+
// --- user hook: tag power users based on luckyNumber ---
|
|
118
|
+
if (type === "user") {
|
|
119
|
+
record.userTier = record.luckyNumber > 300 ? "power" : "regular";
|
|
120
|
+
return record;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// --- event hook: add an engagement score based on event type ---
|
|
124
|
+
if (type === "event") {
|
|
125
|
+
const highEngagement = ["fonk", "crumn", "yak"];
|
|
126
|
+
const midEngagement = ["garply", "durtle", "linny"];
|
|
127
|
+
if (highEngagement.includes(record.event)) {
|
|
128
|
+
record.engagement_score = chance.integer({ min: 70, max: 100 });
|
|
129
|
+
} else if (midEngagement.includes(record.event)) {
|
|
130
|
+
record.engagement_score = chance.integer({ min: 30, max: 69 });
|
|
131
|
+
} else {
|
|
132
|
+
record.engagement_score = chance.integer({ min: 1, max: 29 });
|
|
133
|
+
}
|
|
134
|
+
return record;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// --- everything hook: low-activity users lose their last few events (churn simulation) ---
|
|
138
|
+
if (type === "everything") {
|
|
139
|
+
if (record.length > 3 && record.length < 8) {
|
|
140
|
+
// users with few events lose the tail end — simulates churn
|
|
141
|
+
return record.slice(0, Math.ceil(record.length * 0.6));
|
|
142
|
+
}
|
|
143
|
+
return record;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return record;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
export default config;
|