@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,169 @@
1
+ /**
2
+ * A "validValue" can be a primitive, an array of primitives,
3
+ * a function that returns a primitive or an array of primitives,
4
+ * or a text generator object (from createGenerator).
5
+ * This is the building block for all property values in the dungeon.
6
+ */
7
+ type Primitives = string | number | boolean | Date;
8
+ type ValueValid = Primitives | Primitives[] | (() => Primitives | Primitives[]) | TextGenerator;
9
+
10
+ /**
11
+ * Text generator for creating realistic, contextual text content.
12
+ * Created using createGenerator() with various style, tone, and keyword options.
13
+ */
14
+ interface TextGenerator {
15
+ generateOne(): string;
16
+ next(): string;
17
+ }
18
+
19
+
20
+ /**
21
+ * The main configuration object for the entire data generation spec, known as a "Dungeon".
22
+ * This is the high-level object you will be constructing.
23
+ */
24
+ export interface Dungeon {
25
+ /** A list of all possible events that can occur in the simulation. */
26
+ events?: EventConfig[];
27
+
28
+ /** A list of event sequences that represent user journeys (e.g., sign-up, purchase). */
29
+ funnels?: Funnel[];
30
+
31
+ /** Properties that are attached to every event for all users. */
32
+ superProps?: Record<string, ValueValid>;
33
+
34
+ /** Properties that define the characteristics of individual users. */
35
+ userProps?: Record<string, ValueValid>;
36
+
37
+ /** Properties that change for users or groups over time (Slowly Changing Dimensions). */
38
+ scdProps?: Record<string, SCDProp>;
39
+
40
+ /** Defines group entities, like companies or teams, and how many of each to create. */
41
+ groupKeys?: [string, number, string[]?][]; // [key, numGroups, optional_events_for_group]
42
+
43
+ /** Properties that define the characteristics of the groups defined in groupKeys. */
44
+ groupProps?: Record<string, Record<string, ValueValid>>;
45
+
46
+ /** Events that are attributed to a group entity rather than an individual user. */
47
+ groupEvents?: GroupEventConfig[];
48
+
49
+ /** Static data tables (e.g., product catalogs) that can be referenced in events. */
50
+ lookupTables?: LookupTableSchema[];
51
+
52
+ }
53
+
54
+
55
+ /**
56
+ * Defines a single event, its properties, and its likelihood of occurring.
57
+ */
58
+ interface EventConfig {
59
+ /** The name of the event (e.g., "Page View", "Add to Cart"). */
60
+ event?: string;
61
+
62
+ /** The relative frequency of this event compared to others. Higher numbers are more frequent. */
63
+ weight?: number;
64
+
65
+ /** A dictionary of properties associated with this event. */
66
+ properties?: Record<string, ValueValid>;
67
+
68
+ /** If true, this event will be the first event for a new user. */
69
+ isFirstEvent?: boolean;
70
+
71
+ /** If true, this event signifies that a user has churned. */
72
+ isChurnEvent?: boolean;
73
+ }
74
+
75
+
76
+ /**
77
+ * Defines a sequence of events that represents a meaningful user journey or workflow.
78
+ */
79
+ interface Funnel {
80
+ /** The name of the funnel (e.g., "Purchase Funnel"). */
81
+ name?: string;
82
+
83
+ /** A list of event names that make up the sequence of this funnel. */
84
+ sequence: string[];
85
+
86
+ /** The likelihood that a user will attempt this funnel. */
87
+ weight?: number;
88
+
89
+ /** If true, this funnel is part of the initial user experience (e.g., onboarding). */
90
+ isFirstFunnel?: boolean;
91
+
92
+ /** The probability (0-100) that a user who starts the funnel will complete it. */
93
+ conversionRate?: number;
94
+
95
+ /** The average time (in hours) it takes a user to complete the funnel. */
96
+ timeToConvert?: number;
97
+
98
+ /** * Defines the ordering of events within the funnel for a user.
99
+ * "sequential": Events must happen in the exact order defined in `sequence`.
100
+ * "random": Events can happen in any order.
101
+ * "first-and-last-fixed": The first and last events are fixed, but the middle ones are random.
102
+ */
103
+ order?: "sequential" | "random" | "first-and-last-fixed" | "first-fixed" | "last-fixed" | "interrupted";
104
+
105
+ /** Properties that will be attached to every event generated within this funnel journey. */
106
+ props?: Record<string, ValueValid>;
107
+
108
+ /** User property conditions that determine which users are eligible for this funnel. Only users whose properties match these conditions will be considered for this funnel. */
109
+ conditions?: Record<string, ValueValid>;
110
+ }
111
+
112
+
113
+ /**
114
+ * Defines a "Slowly Changing Dimension" — a property of a user or group
115
+ * that changes periodically over time (e.g., subscription plan, user role).
116
+ */
117
+ interface SCDProp {
118
+ /** The entity this property belongs to ('user' or a group key like 'company_id'). */
119
+ type?: string;
120
+
121
+ /** How often the value of this property can change. */
122
+ frequency: "day" | "week" | "month" | "year";
123
+
124
+ /** A list or function defining the possible values for this property. */
125
+ values: ValueValid;
126
+
127
+ /** * 'fixed': Changes occur exactly on the frequency interval.
128
+ * 'fuzzy': Changes occur randomly around the frequency interval.
129
+ */
130
+ timing: "fixed" | "fuzzy";
131
+
132
+ /** The maximum number of times this property can change for a single entity. */
133
+ max?: number;
134
+ }
135
+
136
+
137
+ /**
138
+ * Defines an event that is attributed to a group and occurs on a regular schedule.
139
+ * (e.g., a monthly subscription charge for a company).
140
+ */
141
+ interface GroupEventConfig extends EventConfig {
142
+ /** How often the event occurs (in days). */
143
+ frequency: number;
144
+
145
+ /** The group key this event is associated with (e.g., "company_id"). */
146
+ group_key: string;
147
+
148
+ /** If true, a random user within the group is also associated with the event. */
149
+ attribute_to_user: boolean;
150
+
151
+ /** The number of entities in this group. */
152
+ group_size: number;
153
+ }
154
+
155
+
156
+ /**
157
+ * Defines the schema for a static lookup table, which can be used to enrich event data.
158
+ * For example, a "products" table could hold details about product IDs.
159
+ */
160
+ interface LookupTableSchema {
161
+ /** The name of the key that will be used to join this table in an event (e.g., "product_id"). */
162
+ key: string;
163
+
164
+ /** The number of unique rows to generate for this table. */
165
+ entries: number;
166
+
167
+ /** A dictionary of attributes (columns) for the table and their possible values. */
168
+ attributes: Record<string, ValueValid>;
169
+ }