@ak--47/dungeon-master 1.0.0 → 1.2.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 (104) hide show
  1. package/README.md +7 -7
  2. package/dungeons/technical/ad-spend-schema.json +128 -0
  3. package/dungeons/technical/ad-spend.js +116 -0
  4. package/dungeons/technical/anonymous-users-schema.json +92 -0
  5. package/dungeons/technical/anonymous-users.js +102 -0
  6. package/dungeons/technical/array-of-object-lookup-schema.json +191 -0
  7. package/dungeons/{array-of-object-lookup.js → technical/array-of-object-lookup.js} +12 -5
  8. package/dungeons/technical/experiments-schema.json +203 -0
  9. package/dungeons/technical/experiments.js +168 -0
  10. package/dungeons/technical/foobar-schema.json +362 -0
  11. package/dungeons/{foobar.js → technical/foobar.js} +3 -3
  12. package/dungeons/technical/group-analytics-schema.json +241 -0
  13. package/dungeons/technical/group-analytics.js +151 -0
  14. package/dungeons/technical/mirror-strategies-schema.json +84 -0
  15. package/dungeons/technical/mirror-strategies.js +126 -0
  16. package/dungeons/technical/nested-objects-schema.json +145 -0
  17. package/dungeons/technical/nested-objects.js +207 -0
  18. package/dungeons/technical/retention-cadence-schema.json +37 -0
  19. package/dungeons/{retention-cadence.js → technical/retention-cadence.js} +2 -3
  20. package/dungeons/technical/sanity-schema.json +185 -0
  21. package/dungeons/{sanity.js → technical/sanity.js} +4 -2
  22. package/dungeons/technical/scale-test-schema.json +70 -0
  23. package/dungeons/technical/scale-test.js +90 -0
  24. package/dungeons/technical/scd-schema.json +467 -0
  25. package/dungeons/{scd.js → technical/scd.js} +20 -10
  26. package/dungeons/technical/simple-schema.json +362 -0
  27. package/dungeons/{simple.js → technical/simple.js} +7 -7
  28. package/dungeons/technical/simplest-schema.json +724 -0
  29. package/dungeons/{simplest.js → technical/simplest.js} +7 -7
  30. package/dungeons/technical/text-generation-schema.json +1062 -0
  31. package/dungeons/{text-generation.js → technical/text-generation.js} +24 -11
  32. package/dungeons/vertical/community-schema.json +579 -0
  33. package/dungeons/vertical/community.js +794 -0
  34. package/dungeons/vertical/devtools-schema.json +601 -0
  35. package/dungeons/vertical/devtools.js +843 -0
  36. package/dungeons/vertical/ecommerce-schema.json +604 -0
  37. package/dungeons/{ecommerce.js → vertical/ecommerce.js} +43 -5
  38. package/dungeons/vertical/education-schema.json +5686 -0
  39. package/dungeons/{education.js → vertical/education.js} +70 -39
  40. package/dungeons/vertical/fintech-schema.json +630 -0
  41. package/dungeons/{fintech.js → vertical/fintech.js} +107 -56
  42. package/dungeons/vertical/fitness-schema.json +530 -0
  43. package/dungeons/vertical/fitness.js +808 -0
  44. package/dungeons/vertical/food-delivery-schema.json +36728 -0
  45. package/dungeons/{food.js → vertical/food-delivery.js} +67 -26
  46. package/dungeons/vertical/gaming-schema.json +438 -0
  47. package/dungeons/{gaming.js → vertical/gaming.js} +29 -16
  48. package/dungeons/vertical/healthcare-schema.json +549 -0
  49. package/dungeons/vertical/healthcare.js +775 -0
  50. package/dungeons/vertical/insurance-application-schema.json +485 -0
  51. package/dungeons/{insurance-application.js → vertical/insurance-application.js} +41 -31
  52. package/dungeons/vertical/logistics-schema.json +574 -0
  53. package/dungeons/vertical/logistics.js +799 -0
  54. package/dungeons/vertical/marketplace-schema.json +533 -0
  55. package/dungeons/vertical/marketplace.js +850 -0
  56. package/dungeons/vertical/media-schema.json +4749 -0
  57. package/dungeons/{media.js → vertical/media.js} +103 -19
  58. package/dungeons/vertical/rpg-schema.json +2491 -0
  59. package/dungeons/{rpg.js → vertical/rpg.js} +87 -60
  60. package/dungeons/vertical/sass-schema.json +3128 -0
  61. package/dungeons/{sass.js → vertical/sass.js} +65 -26
  62. package/dungeons/vertical/social-schema.json +620 -0
  63. package/dungeons/{social.js → vertical/social.js} +76 -17
  64. package/dungeons/vertical/travel-schema.json +580 -0
  65. package/dungeons/vertical/travel.js +742 -0
  66. package/index.js +20 -16
  67. package/lib/core/config-validator.js +286 -1
  68. package/lib/core/context.js +16 -5
  69. package/lib/core/storage.js +2 -0
  70. package/lib/generators/adspend.js +3 -3
  71. package/lib/generators/events.js +141 -14
  72. package/lib/generators/funnels.js +67 -7
  73. package/lib/generators/text.js +2 -2
  74. package/lib/orchestrators/user-loop.js +444 -22
  75. package/lib/templates/soup-presets.js +2 -2
  76. package/lib/utils/utils.js +4 -5
  77. package/package.json +4 -3
  78. package/scripts/dungeon-to-json.mjs +163 -0
  79. package/scripts/extract-dungeon-schema.mjs +343 -0
  80. package/scripts/json-to-dungeon.mjs +200 -0
  81. package/scripts/run-dungeon.mjs +76 -0
  82. package/scripts/run-many.mjs +118 -0
  83. package/scripts/verify-runner.mjs +42 -0
  84. package/types.d.ts +316 -1
  85. package/dungeons/array-of-object-lookup-schema.json +0 -327
  86. package/dungeons/ecommerce-schema.json +0 -462
  87. package/dungeons/education-schema.json +0 -2409
  88. package/dungeons/fintech-schema.json +0 -14034
  89. package/dungeons/foobar-schema.json +0 -403
  90. package/dungeons/food-delivery-schema.json +0 -192
  91. package/dungeons/food-delivery.js +0 -602
  92. package/dungeons/food-schema.json +0 -1152
  93. package/dungeons/gaming-schema.json +0 -1270
  94. package/dungeons/insurance-application-schema.json +0 -204
  95. package/dungeons/media-schema.json +0 -906
  96. package/dungeons/retention-cadence-schema.json +0 -78
  97. package/dungeons/rpg-schema.json +0 -4526
  98. package/dungeons/sanity-schema.json +0 -255
  99. package/dungeons/sass-schema.json +0 -1291
  100. package/dungeons/scd-schema.json +0 -919
  101. package/dungeons/simple-schema.json +0 -608
  102. package/dungeons/simplest-schema.json +0 -1418
  103. package/dungeons/social-schema.json +0 -1118
  104. package/dungeons/text-generation-schema.json +0 -3096
@@ -4,8 +4,9 @@ import dayjs from "dayjs";
4
4
  import utc from "dayjs/plugin/utc.js";
5
5
  dayjs.extend(utc);
6
6
  import { uid, comma } from 'ak-tools';
7
- import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
7
+ import { weighNumRange, date, integer, weighChoices } from "../../lib/utils/utils.js";
8
8
 
9
+ /** @typedef {import("../../types").Dungeon} Config */
9
10
  const videoCategories = ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"];
10
11
  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
 
@@ -59,7 +60,6 @@ const config = {
59
60
  isAnonymous: false,
60
61
  alsoInferFunnels: true,
61
62
  concurrency: 1,
62
- batchSize: 250_000,
63
63
  writeToDisk: false,
64
64
  events: [
65
65
  {
@@ -68,7 +68,10 @@ const config = {
68
68
  properties: {
69
69
  currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
70
70
  coupon: weighChoices(["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"]),
71
- cart: makeProducts()
71
+ cart: makeProducts(),
72
+ discount_applied: [false],
73
+ discount_percent: [0],
74
+ user_segment: ["regular"],
72
75
  }
73
76
  },
74
77
  {
@@ -76,13 +79,15 @@ const config = {
76
79
  weight: 4,
77
80
  properties: {
78
81
  item: makeProducts(1),
82
+ user_segment: ["regular"],
79
83
  }
80
84
  },
81
85
  {
82
86
  event: "view item",
83
87
  weight: 8,
84
88
  properties: {
85
- item: makeProducts(1)
89
+ item: makeProducts(1),
90
+ user_segment: ["regular"],
86
91
  }
87
92
  },
88
93
  {
@@ -90,12 +95,14 @@ const config = {
90
95
  weight: 5,
91
96
  properties: {
92
97
  item: makeProducts(1),
98
+ save_context: ["weekday_intent"],
99
+ user_segment: ["regular"],
93
100
  }
94
101
  }
95
102
  ],
96
103
  funnels: [ ],
97
104
  superProps: {
98
- theme: pickAWinner(["light", "dark", "custom", "light", "dark"]),
105
+ theme: ["light", "dark", "custom", "light", "dark"],
99
106
  },
100
107
  /*
101
108
  user properties work the same as event properties
@@ -0,0 +1,203 @@
1
+ {
2
+ "events": [
3
+ {
4
+ "event": "page view",
5
+ "weight": 10,
6
+ "properties": {
7
+ "page": [
8
+ "/",
9
+ "/features",
10
+ "/pricing",
11
+ "/docs",
12
+ "/about"
13
+ ]
14
+ }
15
+ },
16
+ {
17
+ "event": "signup",
18
+ "isFirstEvent": true,
19
+ "properties": {
20
+ "method": [
21
+ "email",
22
+ "google",
23
+ "github"
24
+ ],
25
+ "referral": [
26
+ "organic",
27
+ "ad",
28
+ "friend"
29
+ ]
30
+ }
31
+ },
32
+ {
33
+ "event": "feature viewed",
34
+ "weight": 7,
35
+ "properties": {
36
+ "feature": [
37
+ "analytics",
38
+ "funnels",
39
+ "retention",
40
+ "flows",
41
+ "reports"
42
+ ],
43
+ "source": [
44
+ "nav",
45
+ "search",
46
+ "recommendation",
47
+ "link"
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "event": "action taken",
53
+ "weight": 5,
54
+ "properties": {
55
+ "action": [
56
+ "create",
57
+ "edit",
58
+ "delete",
59
+ "share",
60
+ "export"
61
+ ],
62
+ "target": [
63
+ "report",
64
+ "dashboard",
65
+ "chart",
66
+ "segment"
67
+ ]
68
+ }
69
+ },
70
+ {
71
+ "event": "checkout",
72
+ "weight": 2,
73
+ "properties": {
74
+ "amount": {
75
+ "$range": [
76
+ 123,
77
+ 389
78
+ ]
79
+ },
80
+ "plan": [
81
+ "starter",
82
+ "growth",
83
+ "enterprise"
84
+ ],
85
+ "billing": [
86
+ "monthly",
87
+ "annual"
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "event": "button click",
93
+ "weight": 8,
94
+ "properties": {
95
+ "button": [
96
+ "cta",
97
+ "upgrade",
98
+ "try-free",
99
+ "learn-more",
100
+ "contact-sales"
101
+ ],
102
+ "location": [
103
+ "hero",
104
+ "header",
105
+ "pricing-card",
106
+ "feature-section"
107
+ ]
108
+ }
109
+ },
110
+ {
111
+ "event": "help viewed",
112
+ "weight": 4,
113
+ "properties": {
114
+ "article": [
115
+ "getting-started",
116
+ "billing-faq",
117
+ "api-docs",
118
+ "integrations",
119
+ "data-export"
120
+ ]
121
+ }
122
+ }
123
+ ],
124
+ "funnels": [
125
+ {
126
+ "sequence": [
127
+ "page view",
128
+ "signup",
129
+ "feature viewed",
130
+ "action taken"
131
+ ],
132
+ "name": "Onboarding Flow",
133
+ "isFirstFunnel": true,
134
+ "conversionRate": 45,
135
+ "timeToConvert": 3,
136
+ "weight": 5,
137
+ "experiment": true
138
+ },
139
+ {
140
+ "sequence": [
141
+ "page view",
142
+ "feature viewed",
143
+ "button click",
144
+ "checkout"
145
+ ],
146
+ "name": "Purchase Funnel",
147
+ "conversionRate": 30,
148
+ "timeToConvert": 5,
149
+ "order": "first-and-last-fixed",
150
+ "weight": 8,
151
+ "experiment": true
152
+ },
153
+ {
154
+ "sequence": [
155
+ "feature viewed",
156
+ "action taken",
157
+ "help viewed",
158
+ "action taken"
159
+ ],
160
+ "name": "Feature Adoption",
161
+ "conversionRate": 50,
162
+ "timeToConvert": 2,
163
+ "order": "random",
164
+ "weight": 4,
165
+ "requireRepeats": true,
166
+ "experiment": true,
167
+ "bindPropsIndex": 2,
168
+ "props": {
169
+ "experiment_cohort": [
170
+ "new_ui",
171
+ "classic_ui"
172
+ ]
173
+ }
174
+ },
175
+ {
176
+ "sequence": [
177
+ "page view",
178
+ "button click",
179
+ "signup"
180
+ ],
181
+ "name": "Quick Signup",
182
+ "isFirstFunnel": true,
183
+ "conversionRate": 40,
184
+ "timeToConvert": 1,
185
+ "weight": 6
186
+ }
187
+ ],
188
+ "superProps": {
189
+ "platform": [
190
+ "web",
191
+ "ios",
192
+ "android"
193
+ ]
194
+ },
195
+ "userProps": {
196
+ "plan": [
197
+ "free",
198
+ "starter",
199
+ "growth",
200
+ "enterprise"
201
+ ]
202
+ }
203
+ }
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Experiments — tests funnel experiments with A/B/C variants.
3
+ *
4
+ * Exercises: experiment: true for variant generation, bindPropsIndex
5
+ * for property binding, and multiple funnel ordering modes
6
+ * (sequential, random, first-and-last-fixed).
7
+ *
8
+ * - 2000 users, 100K events, 60 days
9
+ * - 7 events, 4 funnels with different experiment/order configs
10
+ * - No hooks
11
+ */
12
+
13
+ import Chance from 'chance';
14
+ let chance = new Chance();
15
+ import { weighNumRange, weighChoices } from "../../lib/utils/utils.js";
16
+
17
+ /** @typedef {import("../../types").Dungeon} Config */
18
+ /** @type {import('../../types').Dungeon} */
19
+ const config = {
20
+ token: "",
21
+ seed: "experiments",
22
+ numDays: 60,
23
+ numEvents: 100_000,
24
+ numUsers: 2_000,
25
+ format: "json",
26
+ region: "US",
27
+ hasAnonIds: false,
28
+ hasSessionIds: true,
29
+ hasAdSpend: false,
30
+ hasLocation: false,
31
+ hasAndroidDevices: true,
32
+ hasIOSDevices: true,
33
+ hasDesktopDevices: true,
34
+ hasBrowser: true,
35
+ hasCampaigns: false,
36
+ isAnonymous: false,
37
+ alsoInferFunnels: false,
38
+ concurrency: 1,
39
+ writeToDisk: false,
40
+
41
+ events: [
42
+ {
43
+ event: "page view",
44
+ weight: 10,
45
+ properties: {
46
+ page: ["/", "/features", "/pricing", "/docs", "/about"],
47
+ }
48
+ },
49
+ {
50
+ event: "signup",
51
+ weight: 1,
52
+ isFirstEvent: true,
53
+ properties: {
54
+ method: ["email", "google", "github"],
55
+ referral: weighChoices(["organic", "organic", "organic", "ad", "friend", "friend"]),
56
+ }
57
+ },
58
+ {
59
+ event: "feature viewed",
60
+ weight: 7,
61
+ properties: {
62
+ feature: ["analytics", "funnels", "retention", "flows", "reports"],
63
+ source: ["nav", "search", "recommendation", "link"],
64
+ }
65
+ },
66
+ {
67
+ event: "action taken",
68
+ weight: 5,
69
+ properties: {
70
+ action: ["create", "edit", "delete", "share", "export"],
71
+ target: ["report", "dashboard", "chart", "segment"],
72
+ }
73
+ },
74
+ {
75
+ event: "checkout",
76
+ weight: 2,
77
+ properties: {
78
+ amount: weighNumRange(29, 499, .25),
79
+ plan: ["starter", "growth", "enterprise"],
80
+ billing: ["monthly", "annual"],
81
+ }
82
+ },
83
+ {
84
+ event: "button click",
85
+ weight: 8,
86
+ properties: {
87
+ button: ["cta", "upgrade", "try-free", "learn-more", "contact-sales"],
88
+ location: ["hero", "header", "pricing-card", "feature-section"],
89
+ }
90
+ },
91
+ {
92
+ event: "help viewed",
93
+ weight: 4,
94
+ properties: {
95
+ article: ["getting-started", "billing-faq", "api-docs", "integrations", "data-export"],
96
+ }
97
+ },
98
+ ],
99
+
100
+ funnels: [
101
+ {
102
+ // A/B/C experiment with sequential order
103
+ sequence: ["page view", "signup", "feature viewed", "action taken"],
104
+ conversionRate: 45,
105
+ order: "sequential",
106
+ weight: 5,
107
+ isFirstFunnel: true,
108
+ timeToConvert: 3,
109
+ experiment: true,
110
+ name: "Onboarding Flow",
111
+ },
112
+ {
113
+ // A/B/C experiment with first-and-last-fixed order
114
+ sequence: ["page view", "feature viewed", "button click", "checkout"],
115
+ conversionRate: 30,
116
+ order: "first-and-last-fixed",
117
+ weight: 8,
118
+ timeToConvert: 5,
119
+ experiment: true,
120
+ name: "Purchase Funnel",
121
+ },
122
+ {
123
+ // A/B/C experiment with random order + bindPropsIndex
124
+ sequence: ["feature viewed", "action taken", "help viewed", "action taken"],
125
+ conversionRate: 50,
126
+ order: "random",
127
+ weight: 4,
128
+ timeToConvert: 2,
129
+ experiment: true,
130
+ requireRepeats: true,
131
+ bindPropsIndex: 2,
132
+ name: "Feature Adoption",
133
+ props: {
134
+ experiment_cohort: ["new_ui", "classic_ui"],
135
+ },
136
+ },
137
+ {
138
+ // Non-experiment control funnel (sequential, no variants)
139
+ sequence: ["page view", "button click", "signup"],
140
+ conversionRate: 40,
141
+ order: "sequential",
142
+ weight: 6,
143
+ isFirstFunnel: true,
144
+ timeToConvert: 1,
145
+ name: "Quick Signup",
146
+ },
147
+ ],
148
+
149
+ superProps: {
150
+ platform: ["web", "web", "ios", "android"],
151
+ },
152
+
153
+ userProps: {
154
+ plan: weighChoices(["free", "free", "free", "starter", "growth", "enterprise"]),
155
+ },
156
+
157
+ scdProps: {},
158
+ mirrorProps: {},
159
+ groupKeys: [],
160
+ groupProps: {},
161
+ lookupTables: [],
162
+
163
+ hook: function (record, type, meta) {
164
+ return record;
165
+ }
166
+ };
167
+
168
+ export default config;