make-mp-data 2.1.11 → 3.0.2
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 +31 -0
- package/dungeons/adspend.js +35 -1
- package/dungeons/anon.js +25 -1
- package/dungeons/array-of-object-lookup.js +201 -0
- package/dungeons/benchmark-heavy.js +241 -0
- package/dungeons/benchmark-light.js +141 -0
- package/dungeons/big.js +10 -9
- package/dungeons/business.js +60 -12
- package/dungeons/complex.js +35 -1
- package/dungeons/copilot.js +383 -0
- package/dungeons/education.js +1005 -0
- package/dungeons/experiments.js +18 -4
- package/dungeons/fintech.js +976 -0
- package/dungeons/foobar.js +32 -0
- package/dungeons/food.js +988 -0
- package/dungeons/funnels.js +38 -1
- package/dungeons/gaming.js +26 -5
- package/dungeons/media.js +861 -270
- package/dungeons/mil.js +31 -3
- package/dungeons/mirror.js +33 -1
- package/dungeons/retention-cadence.js +211 -0
- package/dungeons/rpg.js +1178 -0
- package/dungeons/sanity.js +32 -2
- package/dungeons/sass.js +923 -0
- package/dungeons/scd.js +47 -1
- package/dungeons/simple.js +29 -14
- package/dungeons/social.js +928 -0
- package/dungeons/streaming.js +373 -0
- package/dungeons/strict-event-test.js +30 -0
- package/dungeons/student-teacher.js +19 -5
- package/dungeons/text-generation.js +120 -84
- package/dungeons/too-big-events.js +203 -0
- package/dungeons/{userAgent.js → user-agent.js} +23 -2
- package/entry.js +5 -4
- package/index.js +41 -54
- package/lib/core/config-validator.js +122 -7
- package/lib/core/context.js +7 -14
- package/lib/core/storage.js +57 -25
- package/lib/generators/adspend.js +12 -12
- package/lib/generators/events.js +6 -5
- package/lib/generators/funnels.js +32 -10
- package/lib/generators/product-lookup.js +262 -0
- package/lib/generators/product-names.js +195 -0
- package/lib/generators/profiles.js +3 -3
- package/lib/generators/scd.js +13 -3
- package/lib/generators/text.js +17 -4
- package/lib/orchestrators/mixpanel-sender.js +244 -204
- package/lib/orchestrators/user-loop.js +54 -16
- package/lib/templates/phrases.js +473 -16
- package/lib/templates/schema.d.ts +173 -0
- package/lib/templates/verbose-schema.js +140 -206
- package/lib/utils/chart.js +210 -0
- package/lib/utils/function-registry.js +285 -0
- package/lib/utils/json-evaluator.js +172 -0
- package/lib/utils/logger.js +34 -0
- package/lib/utils/utils.js +41 -4
- package/package.json +12 -21
- package/types.d.ts +15 -5
- package/dungeons/ai-chat-analytics-ed.js +0 -274
- package/dungeons/money2020-ed-also.js +0 -277
- package/dungeons/money2020-ed.js +0 -579
- package/lib/generators/text-bak-old.js +0 -1121
- package/lib/orchestrators/worker-manager.js +0 -203
- package/lib/templates/hooks-instructions.txt +0 -434
- package/lib/templates/phrases-bak.js +0 -925
- package/lib/templates/prompt (old).txt +0 -98
- package/lib/templates/schema-instructions.txt +0 -155
- package/lib/templates/scratch-dungeon-template.js +0 -116
- package/lib/templates/textQuickTest.js +0 -172
- package/lib/utils/ai.js +0 -120
- package/lib/utils/project.js +0 -166
package/dungeons/scd.js
CHANGED
|
@@ -14,7 +14,7 @@ import dayjs from "dayjs";
|
|
|
14
14
|
import utc from "dayjs/plugin/utc.js";
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
import { uid, comma } from 'ak-tools';
|
|
17
|
-
import { pickAWinner, weighNumRange, date, integer, weighChoices } from
|
|
17
|
+
import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
|
|
18
18
|
|
|
19
19
|
const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden", "Pet", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art", "Food", "Appliances", "Office", "Wedding", "Software"];
|
|
20
20
|
|
|
@@ -32,6 +32,7 @@ const config = {
|
|
|
32
32
|
hasAnonIds: false, //if true, anonymousIds are created for each user
|
|
33
33
|
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
34
34
|
hasAdSpend: false,
|
|
35
|
+
makeChart: false,
|
|
35
36
|
hasLocation: true,
|
|
36
37
|
hasAndroidDevices: true,
|
|
37
38
|
hasIOSDevices: true,
|
|
@@ -195,6 +196,51 @@ const config = {
|
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
198
|
hook: function (record, type, meta) {
|
|
199
|
+
// --- user hook: classify users into spending tiers ---
|
|
200
|
+
if (type === "user") {
|
|
201
|
+
record.spendTier = record.luckyNumber > 250 ? "high_spender" : "budget";
|
|
202
|
+
return record;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// --- event hook: coupon users get discounted checkout amounts ---
|
|
206
|
+
if (type === "event") {
|
|
207
|
+
if (record.event === "checkout" && record.coupon && record.coupon !== "none") {
|
|
208
|
+
const discountPct = parseInt(record.coupon) || 10;
|
|
209
|
+
record.amount = Math.round(record.amount * (1 - discountPct / 100));
|
|
210
|
+
record.discount_applied = true;
|
|
211
|
+
}
|
|
212
|
+
// weekend watchers get longer watch times
|
|
213
|
+
if (record.event === "watch video" && record.time) {
|
|
214
|
+
const day = dayjs(record.time).day();
|
|
215
|
+
if (day === 0 || day === 6) {
|
|
216
|
+
record.watchTimeSec = Math.round((record.watchTimeSec || 60) * 1.5);
|
|
217
|
+
record.is_weekend = true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return record;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// --- everything hook: simulate cart abandonment ---
|
|
224
|
+
if (type === "everything") {
|
|
225
|
+
const hasAddToCart = record.some(e => e.event === "add to cart");
|
|
226
|
+
const hasCheckout = record.some(e => e.event === "checkout");
|
|
227
|
+
// users who added to cart but never checked out: remove checkout events (if any slipped through)
|
|
228
|
+
// and mark them as abandoned
|
|
229
|
+
if (hasAddToCart && !hasCheckout && record.length > 2) {
|
|
230
|
+
const lastAdd = record.filter(e => e.event === "add to cart").pop();
|
|
231
|
+
if (lastAdd) {
|
|
232
|
+
record.push({
|
|
233
|
+
event: "cart_abandoned",
|
|
234
|
+
time: dayjs(lastAdd.time).add(30, "minute").toISOString(),
|
|
235
|
+
user_id: lastAdd.user_id,
|
|
236
|
+
platform: lastAdd.platform,
|
|
237
|
+
amount: lastAdd.amount
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return record;
|
|
242
|
+
}
|
|
243
|
+
|
|
198
244
|
return record;
|
|
199
245
|
}
|
|
200
246
|
};
|
package/dungeons/simple.js
CHANGED
|
@@ -14,7 +14,7 @@ import dayjs from "dayjs";
|
|
|
14
14
|
import utc from "dayjs/plugin/utc.js";
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
import { uid, comma } from 'ak-tools';
|
|
17
|
-
import { pickAWinner, weighNumRange, date, integer, weighChoices } from
|
|
17
|
+
import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
|
|
18
18
|
|
|
19
19
|
const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden", "Pet", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art", "Food", "Appliances", "Office", "Wedding", "Software"];
|
|
20
20
|
|
|
@@ -23,28 +23,43 @@ const videoCategories = ["funny", "educational", "inspirational", "music", "news
|
|
|
23
23
|
/** @type {import('../types').Dungeon} */
|
|
24
24
|
const config = {
|
|
25
25
|
token: "",
|
|
26
|
-
seed: "simple is best
|
|
26
|
+
seed: "simple is best",
|
|
27
27
|
numDays: 100, //how many days worth1 of data
|
|
28
|
-
numEvents:
|
|
29
|
-
numUsers:
|
|
30
|
-
format: '
|
|
28
|
+
numEvents: 1_000_000, //how many events
|
|
29
|
+
numUsers: 10_000, //how many users
|
|
30
|
+
format: 'json', //csv or json
|
|
31
31
|
region: "US",
|
|
32
|
-
hasAnonIds:
|
|
33
|
-
hasSessionIds:
|
|
34
|
-
hasAdSpend:
|
|
32
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
33
|
+
hasSessionIds: true, //if true, hasSessionIds are created for each user
|
|
34
|
+
hasAdSpend: true,
|
|
35
|
+
makeChart: false,
|
|
35
36
|
hasLocation: true,
|
|
36
|
-
hasAndroidDevices:
|
|
37
|
-
hasIOSDevices:
|
|
38
|
-
hasDesktopDevices:
|
|
39
|
-
hasBrowser:
|
|
37
|
+
hasAndroidDevices: true,
|
|
38
|
+
hasIOSDevices: true,
|
|
39
|
+
hasDesktopDevices: true,
|
|
40
|
+
hasBrowser: true,
|
|
40
41
|
hasCampaigns: true,
|
|
41
42
|
isAnonymous: false,
|
|
42
43
|
alsoInferFunnels: true,
|
|
43
|
-
concurrency:
|
|
44
|
+
concurrency: 10,
|
|
44
45
|
batchSize: 2_500_000,
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
events: [
|
|
49
|
+
{
|
|
50
|
+
event: "ad impression",
|
|
51
|
+
weight: 15,
|
|
52
|
+
properties: {
|
|
53
|
+
partner: pickAWinner(["google", "facebook", "twitter", "linkedin", "bing", "taboola", "outbrain", "quora", "pinterest"]),
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
event: "ad click",
|
|
58
|
+
weight: 10,
|
|
59
|
+
properties: {
|
|
60
|
+
partner: pickAWinner(["google", "facebook", "twitter", "linkedin", "bing", "taboola", "outbrain", "quora", "pinterest"]),
|
|
61
|
+
}
|
|
62
|
+
},
|
|
48
63
|
{
|
|
49
64
|
event: "checkout",
|
|
50
65
|
weight: 2,
|
|
@@ -184,7 +199,7 @@ const config = {
|
|
|
184
199
|
|
|
185
200
|
if (type === "everything") {
|
|
186
201
|
|
|
187
|
-
//custom
|
|
202
|
+
//custom themes purchase more:
|
|
188
203
|
const numCustomMode = record.filter(a => a.theme === 'custom').length;
|
|
189
204
|
const numLightMode = record.filter(a => a.theme === 'light').length;
|
|
190
205
|
const numDarkMode = record.filter(a => a.theme === 'dark').length;
|