make-mp-data 2.1.1 → 2.1.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.
|
@@ -28,22 +28,28 @@ export async function sendToMixpanel(context) {
|
|
|
28
28
|
userProfilesData,
|
|
29
29
|
groupEventData
|
|
30
30
|
} = storage;
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
token,
|
|
34
|
-
region,
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
token,
|
|
34
|
+
region,
|
|
35
35
|
writeToDisk = true,
|
|
36
36
|
format,
|
|
37
37
|
serviceAccount,
|
|
38
38
|
projectId,
|
|
39
|
-
serviceSecret
|
|
39
|
+
serviceSecret,
|
|
40
|
+
verbose = false
|
|
40
41
|
} = config;
|
|
41
|
-
|
|
42
|
+
|
|
42
43
|
const importResults = { events: {}, users: {}, groups: [] };
|
|
43
44
|
const isBATCH_MODE = context.isBatchMode();
|
|
44
45
|
const isCLI = context.isCLI();
|
|
45
46
|
const NODE_ENV = process.env.NODE_ENV || "unknown";
|
|
46
47
|
|
|
48
|
+
// Create verbose-aware log function
|
|
49
|
+
const log = (message) => {
|
|
50
|
+
if (verbose) console.log(message);
|
|
51
|
+
};
|
|
52
|
+
|
|
47
53
|
/** @type {import('mixpanel-import').Creds} */
|
|
48
54
|
const creds = { token };
|
|
49
55
|
const mpImportFormat = format === "json" ? "jsonl" : "csv";
|
|
@@ -59,13 +65,11 @@ export async function sendToMixpanel(context) {
|
|
|
59
65
|
dryRun: false,
|
|
60
66
|
abridged: false,
|
|
61
67
|
fixJson: false,
|
|
62
|
-
showProgress:
|
|
68
|
+
showProgress: verbose,
|
|
63
69
|
streamFormat: mpImportFormat,
|
|
64
|
-
|
|
70
|
+
workers: 35
|
|
65
71
|
};
|
|
66
72
|
|
|
67
|
-
if (isCLI) commonOpts.showProgress = true;
|
|
68
|
-
|
|
69
73
|
// Import events
|
|
70
74
|
if (eventData || isBATCH_MODE) {
|
|
71
75
|
log(`importing events to mixpanel...\n`);
|
|
@@ -224,10 +228,3 @@ export async function sendToMixpanel(context) {
|
|
|
224
228
|
return importResults;
|
|
225
229
|
}
|
|
226
230
|
|
|
227
|
-
/**
|
|
228
|
-
* Simple logging function
|
|
229
|
-
* @param {string} message - Message to log
|
|
230
|
-
*/
|
|
231
|
-
function log(message) {
|
|
232
|
-
console.log(message);
|
|
233
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "make-mp-data",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "builds all mixpanel primitives for a given project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"@google-cloud/functions-framework": "^3.4.2",
|
|
64
64
|
"@google-cloud/storage": "^7.14.0",
|
|
65
65
|
"ak-fetch": "^2.0.12",
|
|
66
|
-
"ak-gemini": "^1.0.
|
|
66
|
+
"ak-gemini": "^1.0.12",
|
|
67
67
|
"ak-tools": "^1.1.12",
|
|
68
68
|
"chance": "^1.1.11",
|
|
69
69
|
"dayjs": "^1.11.11",
|
|
70
70
|
"dotenv": "^16.4.5",
|
|
71
71
|
"google-auth-library": "^9.15.0",
|
|
72
72
|
"hyparquet-writer": "^0.6.1",
|
|
73
|
-
"mixpanel-import": "^3.
|
|
73
|
+
"mixpanel-import": "^3.1.43",
|
|
74
74
|
"p-limit": "^3.1.0",
|
|
75
75
|
"seedrandom": "^3.0.5",
|
|
76
76
|
"sentiment": "^5.0.2",
|