create-zuplo-api 1.7.0 → 1.8.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.
- package/dist/common/analytics/lib.js +35 -29
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1d34ce57-2ada-5ac8-b407-8c9d29ed4819")}catch(e){}}();
|
|
3
3
|
import { defaultIntegrations } from "@sentry/node";
|
|
4
4
|
import { PostHog } from "posthog-node";
|
|
5
5
|
import { POST_HOG_CAPTURE_KEY, ZUPLO_USER_ID_ARGV_KEY } from "../constants.js";
|
|
@@ -19,39 +19,45 @@ function init() {
|
|
|
19
19
|
return _postHog;
|
|
20
20
|
}
|
|
21
21
|
export async function captureEvent({ argv, event, properties, groups, sendFeatureFlags, timestamp, disableGeoip, }) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (_postHog) {
|
|
26
|
-
properties = properties ?? {};
|
|
27
|
-
properties.$set_once = properties.$set_once ?? {};
|
|
28
|
-
if (argv[ZUPLO_USER_ID_ARGV_KEY] &&
|
|
29
|
-
typeof argv[ZUPLO_USER_ID_ARGV_KEY] === "string") {
|
|
30
|
-
properties.$set_once["user-id"] = argv[ZUPLO_USER_ID_ARGV_KEY];
|
|
31
|
-
}
|
|
32
|
-
if (argv.account && typeof argv.account === "string") {
|
|
33
|
-
properties.$set_once["account"] = argv["account"];
|
|
22
|
+
try {
|
|
23
|
+
if (_postHog === undefined) {
|
|
24
|
+
init();
|
|
34
25
|
}
|
|
35
|
-
if (
|
|
36
|
-
properties
|
|
26
|
+
if (_postHog) {
|
|
27
|
+
properties = properties ?? {};
|
|
28
|
+
properties.$set_once = properties.$set_once ?? {};
|
|
29
|
+
if (argv[ZUPLO_USER_ID_ARGV_KEY] &&
|
|
30
|
+
typeof argv[ZUPLO_USER_ID_ARGV_KEY] === "string") {
|
|
31
|
+
properties.$set_once["user-id"] = argv[ZUPLO_USER_ID_ARGV_KEY];
|
|
32
|
+
}
|
|
33
|
+
if (argv.account && typeof argv.account === "string") {
|
|
34
|
+
properties.$set_once["account"] = argv["account"];
|
|
35
|
+
}
|
|
36
|
+
if (argv.project && typeof argv.project === "string") {
|
|
37
|
+
properties.$set_once["project"] = argv["project"];
|
|
38
|
+
}
|
|
39
|
+
if (process.env.CI) {
|
|
40
|
+
properties["ci"] = process.env.CI;
|
|
41
|
+
}
|
|
42
|
+
if (_context && _context.addContext) {
|
|
43
|
+
await _context.addContext(properties);
|
|
44
|
+
}
|
|
45
|
+
_postHog?.capture({
|
|
46
|
+
distinctId: argv[ZUPLO_USER_ID_ARGV_KEY] || machineId(),
|
|
47
|
+
event,
|
|
48
|
+
properties,
|
|
49
|
+
groups,
|
|
50
|
+
sendFeatureFlags,
|
|
51
|
+
timestamp,
|
|
52
|
+
disableGeoip,
|
|
53
|
+
});
|
|
37
54
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
await _context?.addContext(properties);
|
|
42
|
-
_postHog?.capture({
|
|
43
|
-
distinctId: argv[ZUPLO_USER_ID_ARGV_KEY] || machineId(),
|
|
44
|
-
event,
|
|
45
|
-
properties,
|
|
46
|
-
groups,
|
|
47
|
-
sendFeatureFlags,
|
|
48
|
-
timestamp,
|
|
49
|
-
disableGeoip,
|
|
50
|
-
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
export async function shutdownAnalytics() {
|
|
54
60
|
return _postHog?.shutdownAsync();
|
|
55
61
|
}
|
|
56
62
|
//# sourceMappingURL=lib.js.map
|
|
57
|
-
//# debugId=
|
|
63
|
+
//# debugId=1d34ce57-2ada-5ac8-b407-8c9d29ed4819
|