make-mp-data 1.5.53 → 1.5.54

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/components/ai.js CHANGED
@@ -70,7 +70,7 @@ function validator(schema) {
70
70
  if (!schema) valid = false;
71
71
 
72
72
  //must have 3 or more events
73
- if (schema.events.length < 3) valid = false;
73
+ if (schema?.events?.length < 3) valid = false;
74
74
 
75
75
  //must have 2 or more superProps
76
76
  if (Object.keys(schema.superProps).length < 2) valid = false;
@@ -83,7 +83,21 @@ function validator(schema) {
83
83
 
84
84
 
85
85
  if (require.main === module) {
86
- generateSchema(`a dungeons and dragons inspired game where players can create characters, join parties, and go on quests and fight bosses!`)
86
+ generateSchema(` a payments platform called popPay PopPay platform, enables facial recognition-based transactions for contact-free payments, entry, and verification. Users sign up with a selfie, and their image becomes a secure digital key stored in PopID’s cloud, allowing for streamlined interactions at participating businesses. This system aims to replace IDs, passwords, and loyalty cards, focusing on security and user control.
87
+
88
+ Customers choose
89
+ to be recognized
90
+ Guests opt-in by standing directly in front of camera or notifying cashier. PopID never identifies guests without their permission.
91
+
92
+ Personalized ordering experience
93
+ Personalized
94
+ ordering experience
95
+ Guests can be automatically signed in to loyalty programs, shown past orders, and offered customized recommendations.
96
+
97
+ Contact-free payment
98
+ Contact-free
99
+ payment
100
+ PopPay’s eWallet links to guest’s payment card or checking account and offers lower processing fees than credit and debit cards.`)
87
101
  .then((result) => {
88
102
  if (NODE_ENV === "dev") debugger;
89
103
  })
package/components/cli.js CHANGED
@@ -47,8 +47,7 @@ DATA MODEL: https://github.com/ak--47/make-mp-data/blob/main/default.js
47
47
  type: 'string'
48
48
  })
49
49
  .option("format", {
50
- demandOption: false,
51
- default: 'json',
50
+ demandOption: false,
52
51
  alias: 'f',
53
52
  describe: 'csv or json',
54
53
  type: 'string'
@@ -604,6 +604,306 @@ const locations = [
604
604
  "region": "Oklahoma",
605
605
  "city": "Oklahoma City"
606
606
  },
607
+ {
608
+ "country": "United States",
609
+ "country_code": "US",
610
+ "region": "Alabama",
611
+ "city": "Birmingham"
612
+ },
613
+ {
614
+ "country": "United States",
615
+ "country_code": "US",
616
+ "region": "Alaska",
617
+ "city": "Anchorage"
618
+ },
619
+ {
620
+ "country": "United States",
621
+ "country_code": "US",
622
+ "region": "Arizona",
623
+ "city": "Tucson"
624
+ },
625
+ {
626
+ "country": "United States",
627
+ "country_code": "US",
628
+ "region": "Arkansas",
629
+ "city": "Little Rock"
630
+ },
631
+ {
632
+ "country": "United States",
633
+ "country_code": "US",
634
+ "region": "California",
635
+ "city": "Long Beach"
636
+ },
637
+ {
638
+ "country": "United States",
639
+ "country_code": "US",
640
+ "region": "Colorado",
641
+ "city": "Colorado Springs"
642
+ },
643
+ {
644
+ "country": "United States",
645
+ "country_code": "US",
646
+ "region": "Connecticut",
647
+ "city": "Hartford"
648
+ },
649
+ {
650
+ "country": "United States",
651
+ "country_code": "US",
652
+ "region": "Delaware",
653
+ "city": "Wilmington"
654
+ },
655
+ {
656
+ "country": "United States",
657
+ "country_code": "US",
658
+ "region": "Florida",
659
+ "city": "Miami"
660
+ },
661
+ {
662
+ "country": "United States",
663
+ "country_code": "US",
664
+ "region": "Georgia",
665
+ "city": "Atlanta"
666
+ },
667
+ {
668
+ "country": "United States",
669
+ "country_code": "US",
670
+ "region": "Hawaii",
671
+ "city": "Honolulu"
672
+ },
673
+ {
674
+ "country": "United States",
675
+ "country_code": "US",
676
+ "region": "Idaho",
677
+ "city": "Boise"
678
+ },
679
+ {
680
+ "country": "United States",
681
+ "country_code": "US",
682
+ "region": "Illinois",
683
+ "city": "Naperville"
684
+ },
685
+ {
686
+ "country": "United States",
687
+ "country_code": "US",
688
+ "region": "Indiana",
689
+ "city": "Fort Wayne"
690
+ },
691
+ {
692
+ "country": "United States",
693
+ "country_code": "US",
694
+ "region": "Iowa",
695
+ "city": "Des Moines"
696
+ },
697
+ {
698
+ "country": "United States",
699
+ "country_code": "US",
700
+ "region": "Kansas",
701
+ "city": "Wichita"
702
+ },
703
+ {
704
+ "country": "United States",
705
+ "country_code": "US",
706
+ "region": "Kentucky",
707
+ "city": "Louisville"
708
+ },
709
+ {
710
+ "country": "United States",
711
+ "country_code": "US",
712
+ "region": "Louisiana",
713
+ "city": "New Orleans"
714
+ },
715
+ {
716
+ "country": "United States",
717
+ "country_code": "US",
718
+ "region": "Maine",
719
+ "city": "Portland"
720
+ },
721
+ {
722
+ "country": "United States",
723
+ "country_code": "US",
724
+ "region": "Maryland",
725
+ "city": "Baltimore"
726
+ },
727
+ {
728
+ "country": "United States",
729
+ "country_code": "US",
730
+ "region": "Massachusetts",
731
+ "city": "Boston"
732
+ },
733
+ {
734
+ "country": "United States",
735
+ "country_code": "US",
736
+ "region": "Michigan",
737
+ "city": "Detroit"
738
+ },
739
+ {
740
+ "country": "United States",
741
+ "country_code": "US",
742
+ "region": "Minnesota",
743
+ "city": "Minneapolis"
744
+ },
745
+ {
746
+ "country": "United States",
747
+ "country_code": "US",
748
+ "region": "Mississippi",
749
+ "city": "Jackson"
750
+ },
751
+ {
752
+ "country": "United States",
753
+ "country_code": "US",
754
+ "region": "Missouri",
755
+ "city": "Kansas City"
756
+ },
757
+ {
758
+ "country": "United States",
759
+ "country_code": "US",
760
+ "region": "Montana",
761
+ "city": "Billings"
762
+ },
763
+ {
764
+ "country": "United States",
765
+ "country_code": "US",
766
+ "region": "Nebraska",
767
+ "city": "Omaha"
768
+ },
769
+ {
770
+ "country": "United States",
771
+ "country_code": "US",
772
+ "region": "Nevada",
773
+ "city": "Reno"
774
+ },
775
+ {
776
+ "country": "United States",
777
+ "country_code": "US",
778
+ "region": "New Hampshire",
779
+ "city": "Manchester"
780
+ },
781
+ {
782
+ "country": "United States",
783
+ "country_code": "US",
784
+ "region": "New Jersey",
785
+ "city": "Newark"
786
+ },
787
+ {
788
+ "country": "United States",
789
+ "country_code": "US",
790
+ "region": "New Mexico",
791
+ "city": "Albuquerque"
792
+ },
793
+ {
794
+ "country": "United States",
795
+ "country_code": "US",
796
+ "region": "New York",
797
+ "city": "Buffalo"
798
+ },
799
+ {
800
+ "country": "United States",
801
+ "country_code": "US",
802
+ "region": "North Carolina",
803
+ "city": "Charlotte"
804
+ },
805
+ {
806
+ "country": "United States",
807
+ "country_code": "US",
808
+ "region": "North Dakota",
809
+ "city": "Fargo"
810
+ },
811
+ {
812
+ "country": "United States",
813
+ "country_code": "US",
814
+ "region": "Ohio",
815
+ "city": "Cleveland"
816
+ },
817
+ {
818
+ "country": "United States",
819
+ "country_code": "US",
820
+ "region": "Oklahoma",
821
+ "city": "Tulsa"
822
+ },
823
+ {
824
+ "country": "United States",
825
+ "country_code": "US",
826
+ "region": "Oregon",
827
+ "city": "Salem"
828
+ },
829
+ {
830
+ "country": "United States",
831
+ "country_code": "US",
832
+ "region": "Pennsylvania",
833
+ "city": "Pittsburgh"
834
+ },
835
+ {
836
+ "country": "United States",
837
+ "country_code": "US",
838
+ "region": "Rhode Island",
839
+ "city": "Providence"
840
+ },
841
+ {
842
+ "country": "United States",
843
+ "country_code": "US",
844
+ "region": "South Carolina",
845
+ "city": "Columbia"
846
+ },
847
+ {
848
+ "country": "United States",
849
+ "country_code": "US",
850
+ "region": "South Dakota",
851
+ "city": "Sioux Falls"
852
+ },
853
+ {
854
+ "country": "United States",
855
+ "country_code": "US",
856
+ "region": "Tennessee",
857
+ "city": "Knoxville"
858
+ },
859
+ {
860
+ "country": "United States",
861
+ "country_code": "US",
862
+ "region": "Texas",
863
+ "city": "El Paso"
864
+ },
865
+ {
866
+ "country": "United States",
867
+ "country_code": "US",
868
+ "region": "Utah",
869
+ "city": "Salt Lake City"
870
+ },
871
+ {
872
+ "country": "United States",
873
+ "country_code": "US",
874
+ "region": "Vermont",
875
+ "city": "Burlington"
876
+ },
877
+ {
878
+ "country": "United States",
879
+ "country_code": "US",
880
+ "region": "Virginia",
881
+ "city": "Virginia Beach"
882
+ },
883
+ {
884
+ "country": "United States",
885
+ "country_code": "US",
886
+ "region": "Washington",
887
+ "city": "Tacoma"
888
+ },
889
+ {
890
+ "country": "United States",
891
+ "country_code": "US",
892
+ "region": "West Virginia",
893
+ "city": "Charleston"
894
+ },
895
+ {
896
+ "country": "United States",
897
+ "country_code": "US",
898
+ "region": "Wisconsin",
899
+ "city": "Milwaukee"
900
+ },
901
+ {
902
+ "country": "United States",
903
+ "country_code": "US",
904
+ "region": "Wyoming",
905
+ "city": "Cheyenne"
906
+ },
607
907
  {
608
908
  "country": "China",
609
909
  "country_code": "CN",
package/dungeons/big.js CHANGED
@@ -15,146 +15,219 @@ const chance = new Chance();
15
15
  const dayjs = require("dayjs");
16
16
  const utc = require("dayjs/plugin/utc");
17
17
  dayjs.extend(utc);
18
- const { uid, comma } = require('ak-tools');
19
- const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
18
+ const { uid, comma, makeName } = require('ak-tools');
19
+ const { pickAWinner, weighNumRange, integer, date, choose } = require('../components/utils');
20
+
21
+ const eventsPerQuarter = 5_000_000_000 // ~5 billion
22
+ const numQuarters = 8;
23
+ const totalEvents = eventsPerQuarter * numQuarters;
24
+ const eventPerUser = 500;
25
+ const totalUsers = totalEvents / eventPerUser;
26
+ const totalDays = (numQuarters * 90) + 10;
20
27
 
21
28
  /** @type {import('../types').Dungeon} */
22
29
  const config = {
23
- token: "",
24
- seed: "lets go",
25
- numDays: 90, //how many days worth of data
26
- numEvents: 100_000, //how many events
27
- numUsers: 10_000, //how many users
28
- format: 'csv', //csv or json
30
+ token: "64b48bc361f4477634bdfafb78ef39ad",
31
+ seed: "lets go big",
32
+ numDays: totalDays,
33
+ numEvents: totalEvents,
34
+ numUsers: totalUsers,
35
+ format: 'json', //csv or json
29
36
  region: "US",
30
- hasAnonIds: true, //if true, anonymousIds are created for each user
37
+ hasAnonIds: false, //if true, anonymousIds are created for each user
31
38
  hasSessionIds: false, //if true, hasSessionIds are created for each user
32
39
  hasLocation: true,
33
- events: [
40
+ hasAndroidDevices: false,
41
+ alsoInferFunnels: false,
42
+ batchSize: 5_000_000,
43
+ hasAvatar: true,
44
+ hasAdSpend: false,
45
+ hasBrowser: false,
46
+ hasCampaigns: false,
47
+ hasDesktopDevices: false,
48
+ hasIOSDevices: false,
49
+ writeToDisk: false,
50
+ funnels: [
34
51
  {
35
- event: "foo",
36
- weight: 10,
37
- properties: {}
52
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
53
+ weight: 1,
54
+ order: "sequential"
38
55
  },
39
56
  {
40
- event: "bar",
41
- weight: 9,
42
- properties: {}
57
+ "sequence": ["foo", "bar"],
58
+ weight: 25,
59
+ order: "sequential"
43
60
  },
44
61
  {
45
- event: "baz",
46
- weight: 8,
47
- properties: {}
62
+ "sequence": ["foo", "bar", "baz"],
63
+ weight: 20,
64
+ order: "sequential"
48
65
  },
49
66
  {
50
- event: "qux",
51
- weight: 7,
52
- properties: {}
67
+ "sequence": ["foo", "bar", "baz", "qux"],
68
+ weight: 15,
69
+ order: "sequential"
53
70
  },
54
71
  {
55
- event: "garply",
56
- weight: 6,
57
- properties: {}
72
+ "sequence": ["foo", "bar", "baz", "qux", "garply"],
73
+ weight: 10,
74
+ order: "sequential"
58
75
  },
59
76
  {
60
- event: "durtle",
61
- weight: 5,
62
- properties: {}
77
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle"],
78
+ weight: 8,
79
+ order: "sequential"
63
80
  },
64
81
  {
65
- event: "linny",
66
- weight: 4,
67
- properties: {}
82
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny"],
83
+ weight: 6,
84
+ order: "sequential"
68
85
  },
69
86
  {
70
- event: "fonk",
71
- weight: 3,
72
- properties: {}
87
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk"],
88
+ weight: 4,
89
+ order: "sequential"
73
90
  },
74
91
  {
75
- event: "crumn",
92
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn"],
76
93
  weight: 2,
77
- properties: {}
94
+ order: "sequential"
78
95
  },
79
96
  {
80
- event: "yak",
97
+ "sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
81
98
  weight: 1,
82
- properties: {}
99
+ order: "sequential"
83
100
  }
84
- ],
85
- superProps: {
86
- color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
87
- number: integer,
88
101
 
102
+ ],
103
+ events: [
104
+ { event: "foo" },
105
+ { event: "bar" },
106
+ { event: "baz" },
107
+ { event: "qux" },
108
+ { event: "garply" },
109
+ { event: "durtle" },
110
+ { event: "linny" },
111
+ { event: "fonk" },
112
+ { event: "crumn" },
113
+ { event: "yak" }
114
+ ],
115
+ //? https://docs.mixpanel.com/docs/data-structure/property-reference/data-type
116
+ superProps: {
117
+ "string": pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"]),
118
+ "number": integer,
119
+ "boolean": [true, true, false],
120
+ "date": () => date(90),
121
+ "string []": buildStringArray,
122
+ "number []": buildNumberArray,
123
+ "object {}": buildObjectProp,
124
+ "object [{}]": buildObjArrayProp
89
125
  },
90
126
  userProps: {
91
127
  title: chance.profession.bind(chance),
92
128
  luckyNumber: weighNumRange(42, 420),
93
- 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"]
129
+ spiritAnimal: pickAWinner(["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"]),
130
+ isHappyCustomer: pickAWinner([true, true, false]),
94
131
  },
132
+ hook: function (record, type, meta) {
95
133
 
96
- scdProps: {
97
- "donk": ["dude", "man", "brok"],
98
- "pronk": ["monk", "lonk", "aonk"],
99
- },
100
- mirrorProps: {},
101
- groupKeys: [
102
- ["companies", 100_000],
103
- ["servers", 3_000_000],
104
- ["crews", 1000],
105
134
 
106
- ],
107
- groupProps: {
108
- companies: {
109
- name: chance.company.bind(chance),
110
- industry: ["tech", "finance", "healthcare", "education", "retail", "manufacturing", "entertainment", "government", "non-profit", "other"],
111
- },
112
- servers: {
113
- name: chance.word.bind(chance),
114
- ram: weighNumRange(4, 64, .25),
115
- cpu: weighNumRange(1, 16, .25),
135
+ // if (type === "event") {
136
+ // debugger;
137
+ // }
116
138
 
117
- },
118
- crews: {
119
- name: chance.word.bind(chance),
120
- department: ["engineering", "design", "marketing", "sales", "finance", "hr", "legal", "operations", "support", "other"],
121
- size: weighNumRange(5, 50, .25)
122
- }
123
- },
124
- lookupTables: [{
125
- key: "product_id",
126
- entries: 2_000_000,
127
- attributes: {
128
- category: [
129
- "Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden & Tools", "Pet Supplies", "Food & Grocery", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art"
130
- ],
131
- "demand": ["high", "medium", "medium", "low"],
132
- "supply": ["high", "medium", "medium", "low"],
133
- "manufacturer": chance.company.bind(chance),
134
- "price": weighNumRange(5, 500, .25),
135
- "rating": weighNumRange(1, 5),
136
- "reviews": weighNumRange(0, 35)
137
- }
139
+ // if (type === "user") {
140
+
141
+ // }
142
+
143
+ // if (type === "funnel-post") {
144
+
145
+ // }
146
+
147
+ // if (type === "funnel-pre") {
148
+
149
+ // }
150
+
151
+ // if (type === "scd") {
152
+
153
+ // }
154
+
155
+ // if (type === "everything") {
156
+ // debugger;
157
+ // }
138
158
 
139
- },
140
- {
141
- key: "video_id",
142
- entries: 10_000_000,
143
- attributes: {
144
- isFlagged: [true, false, false, false, false],
145
- copyright: ["all rights reserved", "creative commons", "creative commons", "public domain", "fair use"],
146
- uploader_id: chance.guid.bind(chance),
147
- "uploader influence": ["low", "low", "low", "medium", "medium", "high"],
148
- thumbs: weighNumRange(0, 35),
149
- rating: ["G", "PG", "PG-13", "R", "NC-17", "PG-13", "R", "NC-17", "R", "PG", "PG"]
150
- }
151
-
152
- }],
153
- hook: function (record, type, meta) {
154
159
  return record;
155
160
  }
156
161
  };
157
162
 
158
163
 
164
+ function buildObjectProp() {
165
+ return function () {
166
+ return {
167
+ "foo key": choose(pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"])()),
168
+ "bar key": integer(1, 100),
169
+ "baz key": choose(pickAWinner([true, true, false])()),
170
+ };
171
+ };
172
+ }
173
+
174
+
175
+ function buildNumberArray() {
176
+ return function () {
177
+ const arr = [];
178
+ const times = integer(1, 10);
179
+ for (let i = 0; i < times; i++) {
180
+ arr.push(integer(1, 100));
181
+ }
182
+ return [arr];
183
+ };
184
+ }
185
+
186
+ function buildStringArray() {
187
+ return function () {
188
+ const arr = [];
189
+ const times = integer(1, 10);
190
+ for (let i = 0; i < times; i++) {
191
+ arr.push(makeName(integer(1, 3), " "));
192
+ }
193
+ return [arr];
194
+ };
195
+ }
196
+
197
+
198
+ function buildObjArrayProp(maxItems = 5) {
199
+
200
+ return function () {
201
+ const categories = ["Device Accessories", "eBooks", "Automotive", "Baby Products", "Beauty", "Books", "Camera & Photo", "Cell Phones & Accessories", "Collectible Coins", "Consumer Electronics", "Entertainment Collectibles", "Fine Art", "Grocery & Gourmet Food", "Health & Personal Care", "Home & Garden", "Independent Design", "Industrial & Scientific", "Accessories", "Major Appliances", "Music", "Musical Instruments", "Office Products", "Outdoors", "Personal Computers", "Pet Supplies", "Software", "Sports", "Sports Collectibles", "Tools & Home Improvement", "Toys & Games", "Video, DVD & Blu-ray", "Video Games", "Watches"];
202
+ const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
203
+ const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
204
+ const data = [];
205
+ const numOfItems = integer(1, maxItems);
206
+
207
+ for (var i = 0; i < numOfItems; i++) {
208
+ const category = chance.pickone(categories);
209
+ const slug = chance.pickone(slugs);
210
+ const asset = chance.pickone(assetExtension);
211
+ const price = integer(1, 300);
212
+ const quantity = integer(1, 5);
213
+
214
+ const item = {
215
+ sku: integer(11111, 99999),
216
+ amount: price,
217
+ quantity: quantity,
218
+ total: price * quantity,
219
+ featured: chance.pickone([true, false]),
220
+ category: category,
221
+ urlSlug: slug + category,
222
+ asset: `${category}-${integer(1, 20)}${asset}`
223
+ };
224
+
225
+ data.push(item);
226
+ }
227
+
228
+ return () => [data];
229
+ };
230
+ };
231
+
159
232
 
160
233
  module.exports = config;
@@ -0,0 +1,323 @@
1
+
2
+ const SEED = "my-seed";
3
+ const dayjs = require("dayjs");
4
+ const utc = require("dayjs/plugin/utc");
5
+ dayjs.extend(utc);
6
+ require("dotenv").config();
7
+ const u = require("../components/utils.js");
8
+ const v = require("ak-tools");
9
+ const chance = u.initChance(SEED);
10
+ const num_users = 10_000;
11
+ const days = 108;
12
+
13
+ /** @typedef {import("../types.js").Dungeon} Config */
14
+
15
+ /** @type {Config} */
16
+ const config = {
17
+ token: "",
18
+ seed: "twerk",
19
+ numDays: days,
20
+ numEvents: num_users * 100,
21
+ numUsers: num_users,
22
+ hasAnonIds: false,
23
+ hasSessionIds: false,
24
+ format: "json",
25
+ alsoInferFunnels: false,
26
+ hasLocation: true,
27
+ hasAndroidDevices: true,
28
+ hasIOSDevices: true,
29
+ hasDesktopDevices: true,
30
+ hasBrowser: false,
31
+ hasCampaigns: false,
32
+ isAnonymous: false,
33
+ hasAdSpend: false,
34
+ percentUsersBornInDataset: 35,
35
+
36
+ hasAvatar: true,
37
+ makeChart: false,
38
+
39
+ batchSize: 1_500_000,
40
+ concurrency: 1,
41
+ writeToDisk: false,
42
+ funnels: [
43
+ {
44
+ "sequence": ["app install", "character creation", "join party"],
45
+ "isFirstFunnel": true,
46
+ "conversionRate": 0.8,
47
+ "timeToConvert": .25,
48
+ },
49
+ {
50
+ "sequence": ["start quest", "gameplay summary", "complete quest"],
51
+ conversionRate: 0.99,
52
+ timeToConvert: 1,
53
+ props: {
54
+ "quest type": u.pickAWinner([
55
+ "Rescue",
56
+ "Retrieve",
57
+ "Explore",
58
+ "Destroy",
59
+ "Investigate",
60
+ ]),
61
+ "quest difficulty": u.pickAWinner([
62
+ "Easy",
63
+ "Medium",
64
+ "Hard",
65
+ "Legendary",
66
+ ]),
67
+ "quest location": u.pickAWinner([
68
+ "Forest",
69
+ "Dungeon",
70
+ "Mountain",
71
+ "City",
72
+ "Desert",
73
+ ])
74
+ }
75
+ },
76
+ ],
77
+ events: [
78
+ { event: "app install", weight: 10, isFirstEvent: true },
79
+ {
80
+ event: "character creation",
81
+ weight: 2,
82
+ properties: {
83
+ mode: u.pickAWinner(["fast", "slow", "template"]),
84
+ },
85
+ },
86
+ {
87
+ event: "join party",
88
+ weight: 8,
89
+ properties: {
90
+ "party size": u.weighNumRange(1, 6),
91
+ "party leader": u.pickAWinner([
92
+ "Bard",
93
+ "Cleric",
94
+ "Fighter",
95
+ "Rogue",
96
+ "Wizard",
97
+ "Paladin",
98
+ "Ranger",
99
+ "Sorcerer",
100
+ "Warlock",
101
+ ]),
102
+ },
103
+ },
104
+ {
105
+ event: "start quest",
106
+ weight: 12,
107
+ properties: {},
108
+ },
109
+ {
110
+ event: "complete quest",
111
+ weight: 12,
112
+ properties: {},
113
+ },
114
+ {
115
+ "event": "gameplay summary",
116
+ "weight": 14,
117
+ "properties": {
118
+ "# enemies defeated": u.weighNumRange(0, 100),
119
+ "# respawns": u.weighNumRange(0, 10, 5),
120
+ "# attacks": u.weighNumRange(0, 100, 6, 12),
121
+ "# gold found": u.weighNumRange(0, 1000),
122
+ }
123
+ },
124
+ {
125
+ "event": "in-game purchase",
126
+ "weight": 2,
127
+ "properties": {
128
+ "purchase type": u.pickAWinner([
129
+ "Gold",
130
+ "Gems",
131
+ "Items: Weapons",
132
+ "Items: Armor",
133
+ "Items: Potions",
134
+ "Items: Scrolls",
135
+ "Boosts",
136
+ "Currency",
137
+ ]),
138
+ "purchase amount": u.weighNumRange(1, 50, 1, 20),
139
+ }
140
+ },
141
+ {
142
+ event: "fight boss",
143
+ weight: 3,
144
+ properties: {
145
+ "boss type": u.pickAWinner([
146
+ "Dragon",
147
+ "Demon",
148
+ "Lich",
149
+ "Vampire",
150
+ "Beholder",
151
+ ]),
152
+ "boss level": u.weighNumRange(10, 20),
153
+ "boss difficulty": u.pickAWinner([
154
+ "Hard",
155
+ "Legendary",
156
+ "Impossible",
157
+ ]),
158
+ "fight duration (mins)": u.weighNumRange(1, 60),
159
+
160
+ },
161
+ },
162
+ {
163
+ event: "level up",
164
+ weight: 1,
165
+ properties: {
166
+ "new abilities": u.pickAWinner([
167
+ "Attack",
168
+ "Spell",
169
+ "Feat",
170
+ "Skill",
171
+ ]),
172
+ },
173
+ },
174
+ // {
175
+ // event: "generic event (common)",
176
+ // weight: 5,
177
+ // properties: {
178
+ // generic_prop: u.pickAWinner(["foo", "bar", "baz", "qux"]),
179
+ // }
180
+ // },
181
+ {
182
+ event: "$experiment_started",
183
+ weight: 3,
184
+ properties: {
185
+ "Experiment name": u.pickAWinner([
186
+ "fast leveling",
187
+ "tension economy",
188
+ "free trial",
189
+ ]),
190
+ "Variant": ["A", "B", "C", "Control"],
191
+ }
192
+ },
193
+ ],
194
+ superProps: {
195
+ platform: u.pickAWinner([
196
+ "Mobile",
197
+ "Xbox",
198
+ "Playstation",
199
+ "Switch",
200
+ "Web"
201
+ ]),
202
+ "game mode": u.pickAWinner([
203
+ "Single Player",
204
+ "Multiplayer",
205
+ ], 1),
206
+ language: u.pickAWinner([
207
+ "English",
208
+ "Spanish",
209
+ "French",
210
+ "German",
211
+ "Japanese",
212
+ "Korean",
213
+ "Chinese",
214
+ ], 0),
215
+
216
+ },
217
+ scdProps: {
218
+ // "subscription MRR" : {
219
+ // "frequency": "week",
220
+ // "type": "number",
221
+ // values: u.weighNumRange(0, 250, 1, 200),
222
+ // timing: "fixed",
223
+ // max: 250,
224
+ // }
225
+ },
226
+ userProps: {
227
+
228
+ race: u.pickAWinner([
229
+ "Human",
230
+ "Elf",
231
+ "Dwarf",
232
+ "Halfling",
233
+ "Dragonborn",
234
+ "Gnome",
235
+ "Half-Elf",
236
+ "Half-Orc",
237
+ "Tiefling",
238
+ ]),
239
+ class: u.pickAWinner([
240
+ "Barbarian",
241
+ "Bard",
242
+ "Cleric",
243
+ "Druid",
244
+ "Fighter",
245
+ "Monk",
246
+ "Paladin",
247
+ "Ranger",
248
+ "Rogue",
249
+ "Sorcerer",
250
+ "Warlock",
251
+ "Wizard",
252
+ ]),
253
+ alignment: u.pickAWinner([
254
+ "Lawful Good",
255
+ "Neutral Good",
256
+ "Chaotic Good",
257
+ "Lawful Neutral",
258
+ "True Neutral",
259
+ "Chaotic Neutral",
260
+ "Lawful Evil",
261
+ "Neutral Evil",
262
+ "Chaotic Evil",
263
+ ]),
264
+ level: u.weighNumRange(1, 20),
265
+ background: u.pickAWinner([
266
+ "Acolyte",
267
+ "Charlatan",
268
+ "Criminal",
269
+ "Entertainer",
270
+ "Folk Hero",
271
+ "Guild Artisan",
272
+ "Hermit",
273
+ "Noble",
274
+ "Outlander",
275
+ "Sage",
276
+ "Sailor",
277
+ "Soldier",
278
+ "Urchin",
279
+ ]),
280
+ "subscription MRR": u.weighNumRange(0, 250, 1, 200)
281
+ },
282
+ hook: function (record, type, meta) {
283
+ // const NOW = dayjs();
284
+
285
+ if (type === "event") {
286
+ // const EVENT_TIME = dayjs(record.time);
287
+ }
288
+
289
+ if (type === "user") {
290
+
291
+ }
292
+
293
+ if (type === "funnel-post") {
294
+
295
+ }
296
+
297
+ if (type === "funnel-pre") {
298
+ const sequence = v.clone(record.sequence);
299
+ if (sequence.includes("$experiment_started")) {
300
+ //ensure there's only one experiment per user flow
301
+ const newSequence = sequence.filter((event) => event !== "$experiment_started");
302
+
303
+ newSequence.unshift("$experiment_started");
304
+
305
+
306
+ record.sequence = newSequence;
307
+ }
308
+
309
+ }
310
+
311
+ if (type === "scd") {
312
+
313
+ }
314
+
315
+ if (type === "everything") {
316
+
317
+ }
318
+
319
+ return record;
320
+ }
321
+ };
322
+
323
+ module.exports = config;
package/index.js CHANGED
@@ -23,7 +23,7 @@ global.FIXED_NOW = FIXED_NOW;
23
23
  // ^ this creates a FIXED POINT in time; we will shift it later
24
24
  let FIXED_BEGIN = dayjs.unix(FIXED_NOW).subtract(90, 'd').unix();
25
25
  global.FIXED_BEGIN = FIXED_BEGIN;
26
- const actualNow = dayjs();
26
+ const actualNow = dayjs().add(2, "day");
27
27
  const timeShift = actualNow.diff(dayjs.unix(FIXED_NOW), "seconds");
28
28
  const daysShift = actualNow.diff(dayjs.unix(FIXED_NOW), "days");
29
29
 
@@ -104,6 +104,16 @@ async function main(config) {
104
104
  campaigns: u.pickAWinner(campaigns, 0),
105
105
  };
106
106
 
107
+ if (config.singleCountry) {
108
+ DEFAULTS.locationsEvents = u.pickAWinner(clone(locations)
109
+ .filter(l => l.country === config.singleCountry)
110
+ .map(l => { delete l.country; return l; }), 0);
111
+
112
+ DEFAULTS.locationsUsers = u.pickAWinner(clone(locations)
113
+ .filter(l => l.country === config.singleCountry)
114
+ .map(l => { delete l.country_code; return l; }), 0);
115
+ }
116
+
107
117
 
108
118
  //TRACKING
109
119
  const runId = uid(42);
@@ -512,7 +522,7 @@ async function makeEvent(distinct_id, earliestTime, chosenEvent, anonymousIds, s
512
522
  else if (typeof (defaultProps[key]) === "object") {
513
523
  const obj = defaultProps[key];
514
524
  for (const subKey in obj) {
515
- if (Array.isArray(obj[subKey])) {
525
+ if (Array.isArray(obj[subKey])) {
516
526
  const subChoice = u.choose(obj[subKey]);
517
527
  if (Array.isArray(subChoice)) {
518
528
  for (const subSubChoice of subChoice) {
@@ -525,7 +535,7 @@ async function makeEvent(distinct_id, earliestTime, chosenEvent, anonymousIds, s
525
535
  }
526
536
  }
527
537
  else {
528
- if (!eventTemplate[subKey]) eventTemplate[subKey] = subChoice;
538
+ if (!eventTemplate[subKey]) eventTemplate[subKey] = subChoice;
529
539
  }
530
540
  }
531
541
  else {
@@ -1156,7 +1166,8 @@ async function sendToMixpanel(config, storage) {
1156
1166
  fixData: true,
1157
1167
  verbose: false,
1158
1168
  forceStream: true,
1159
- strict: false,
1169
+ strict: true, //false,
1170
+ epochEnd: dayjs().unix(), //is this chill?
1160
1171
  dryRun: false,
1161
1172
  abridged: false,
1162
1173
  fixJson: true,
@@ -1703,8 +1714,8 @@ if (NODE_ENV !== "prod") {
1703
1714
  };
1704
1715
  if (bytes > 0) console.table(stats);
1705
1716
  if (Object.keys(data?.importResults || {}).length) {
1706
- log(`\nlog written to log.json\n`);
1707
- writeFileSync(path.resolve(folder, "log.json"), JSON.stringify(data?.importResults, null, 2));
1717
+ log(`\nlog written to log.json\n`);
1718
+ writeFileSync(path.resolve(folder, "log.json"), JSON.stringify(data?.importResults, null, 2));
1708
1719
  }
1709
1720
  // log(" " + files?.flat().join("\n "));
1710
1721
  log(`\n----------------SUMMARY-----------------\n\n\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "1.5.053",
3
+ "version": "1.5.054",
4
4
  "description": "builds all mixpanel primitives for a given project",
5
5
  "main": "index.js",
6
6
  "types": "types.d.ts",
package/types.d.ts CHANGED
@@ -50,6 +50,7 @@ declare namespace main {
50
50
  hasSessionIds?: boolean;
51
51
  alsoInferFunnels?: boolean;
52
52
  makeChart?: boolean | string;
53
+ singleCountry?: string;
53
54
 
54
55
  //models
55
56
  events?: EventConfig[]; //| string[]; //can also be a array of strings