posthog-node 5.38.3 → 5.38.5
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/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.mjs +1 -0
- package/dist/extensions/express.d.ts.map +1 -1
- package/dist/extensions/express.js +7 -5
- package/dist/extensions/express.mjs +7 -5
- package/dist/extensions/nestjs.d.ts.map +1 -1
- package/dist/extensions/nestjs.js +4 -2
- package/dist/extensions/nestjs.mjs +4 -2
- package/dist/extensions/url-utils.d.ts +3 -0
- package/dist/extensions/url-utils.d.ts.map +1 -0
- package/dist/extensions/url-utils.js +53 -0
- package/dist/extensions/url-utils.mjs +16 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +2 -2
- package/src/client.ts +1 -0
- package/src/extensions/express.ts +11 -5
- package/src/extensions/nestjs.ts +8 -2
- package/src/extensions/url-utils.ts +27 -0
- package/src/version.ts +1 -1
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAGhB,QAAQ,EACR,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAE/B,wBAAwB,EACzB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EAIZ,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,cAAc,EAEd,qBAAqB,EACrB,eAAe,EAChB,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAOnC,OAAO,aAAa,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAkB,sBAAsB,EAAE,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EAAE,OAAO,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnD,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,EAC3B,KAAK,CAAC,EAAE,sBAAsB,GAC7B,IAAI;IAeP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,yBAAyB,CAC7B,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnD,KAAK,CAAC,EAAE,sBAAsB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAeH,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;QAC7D,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,sBAAsB,CAAA;QAClC,OAAO,EAAE,qBAAqB,CAAA;KAC/B,CAAC;IA8HF,OAAO,CAAC,cAAc;CAuBvB"}
|
package/dist/client.js
CHANGED
package/dist/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/extensions/express.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/extensions/express.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAIhD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGhD,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAEhF,KAAK,sBAAsB,GAAG,CAC5B,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,KACnC,IAAI,CAAA;AAET,UAAU,eAAgB,SAAQ,KAAK;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAC7B,CAAA;CACF;AAiCD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,EAAE;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAA;CAChD,GACA,IAAI,CAEN;AAQD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,EAAE;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,GAAG,sBAAsB,KAAK,OAAO,CAAA;CACzE,GACA,IAAI,CAEN"}
|
|
@@ -39,6 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
const index_js_namespaceObject = require("./error-tracking/index.js");
|
|
40
40
|
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
41
41
|
const external_tracing_headers_js_namespaceObject = require("./tracing-headers.js");
|
|
42
|
+
const external_url_utils_js_namespaceObject = require("./url-utils.js");
|
|
42
43
|
function getClientIp(req) {
|
|
43
44
|
const forwarded = (0, external_tracing_headers_js_namespaceObject.getFirstHeaderValue)(req.headers['x-forwarded-for']);
|
|
44
45
|
if (forwarded) {
|
|
@@ -47,12 +48,13 @@ function getClientIp(req) {
|
|
|
47
48
|
}
|
|
48
49
|
return req.socket?.remoteAddress;
|
|
49
50
|
}
|
|
50
|
-
function buildRequestContextData(req) {
|
|
51
|
+
function buildRequestContextData(posthog, req) {
|
|
51
52
|
const { sessionId, distinctId } = (0, external_tracing_headers_js_namespaceObject.getPostHogTracingHeaderValues)(req.headers);
|
|
52
53
|
const properties = {};
|
|
53
|
-
|
|
54
|
+
const disableCaptureUrlHashes = true === posthog.options.disable_capture_url_hashes;
|
|
55
|
+
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$current_url', (0, external_url_utils_js_namespaceObject.normalizeRequestCurrentUrl)(req.originalUrl || req.url, disableCaptureUrlHashes));
|
|
54
56
|
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$request_method', req.method);
|
|
55
|
-
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$request_path', req.path);
|
|
57
|
+
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$request_path', (0, external_url_utils_js_namespaceObject.normalizeRequestPath)(req.path, disableCaptureUrlHashes));
|
|
56
58
|
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$user_agent', (0, external_tracing_headers_js_namespaceObject.getFirstHeaderValue)(req.headers['user-agent']));
|
|
57
59
|
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$ip', getClientIp(req));
|
|
58
60
|
return {
|
|
@@ -70,7 +72,7 @@ function setupExpressRequestContext(_posthog, app) {
|
|
|
70
72
|
}
|
|
71
73
|
function posthogRequestContext(posthog) {
|
|
72
74
|
return (req, _res, next)=>{
|
|
73
|
-
posthog.withContext(buildRequestContextData(req), ()=>next());
|
|
75
|
+
posthog.withContext(buildRequestContextData(posthog, req), ()=>next());
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
78
|
function setupExpressErrorHandler(_posthog, app) {
|
|
@@ -79,7 +81,7 @@ function setupExpressErrorHandler(_posthog, app) {
|
|
|
79
81
|
function posthogErrorHandler(posthog) {
|
|
80
82
|
return (error, req, res, next)=>{
|
|
81
83
|
if (index_js_default().isPreviouslyCapturedError(error)) return void next(error);
|
|
82
|
-
const contextData = buildRequestContextData(req);
|
|
84
|
+
const contextData = buildRequestContextData(posthog, req);
|
|
83
85
|
const syntheticException = new Error('Synthetic exception');
|
|
84
86
|
const hint = {
|
|
85
87
|
mechanism: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import error_tracking from "./error-tracking/index.mjs";
|
|
2
2
|
import { addProperty, getFirstHeaderValue, getPostHogTracingHeaderValues } from "./tracing-headers.mjs";
|
|
3
|
+
import { normalizeRequestCurrentUrl, normalizeRequestPath } from "./url-utils.mjs";
|
|
3
4
|
function getClientIp(req) {
|
|
4
5
|
const forwarded = getFirstHeaderValue(req.headers['x-forwarded-for']);
|
|
5
6
|
if (forwarded) {
|
|
@@ -8,12 +9,13 @@ function getClientIp(req) {
|
|
|
8
9
|
}
|
|
9
10
|
return req.socket?.remoteAddress;
|
|
10
11
|
}
|
|
11
|
-
function buildRequestContextData(req) {
|
|
12
|
+
function buildRequestContextData(posthog, req) {
|
|
12
13
|
const { sessionId, distinctId } = getPostHogTracingHeaderValues(req.headers);
|
|
13
14
|
const properties = {};
|
|
14
|
-
|
|
15
|
+
const disableCaptureUrlHashes = true === posthog.options.disable_capture_url_hashes;
|
|
16
|
+
addProperty(properties, '$current_url', normalizeRequestCurrentUrl(req.originalUrl || req.url, disableCaptureUrlHashes));
|
|
15
17
|
addProperty(properties, '$request_method', req.method);
|
|
16
|
-
addProperty(properties, '$request_path', req.path);
|
|
18
|
+
addProperty(properties, '$request_path', normalizeRequestPath(req.path, disableCaptureUrlHashes));
|
|
17
19
|
addProperty(properties, '$user_agent', getFirstHeaderValue(req.headers['user-agent']));
|
|
18
20
|
addProperty(properties, '$ip', getClientIp(req));
|
|
19
21
|
return {
|
|
@@ -31,7 +33,7 @@ function setupExpressRequestContext(_posthog, app) {
|
|
|
31
33
|
}
|
|
32
34
|
function posthogRequestContext(posthog) {
|
|
33
35
|
return (req, _res, next)=>{
|
|
34
|
-
posthog.withContext(buildRequestContextData(req), ()=>next());
|
|
36
|
+
posthog.withContext(buildRequestContextData(posthog, req), ()=>next());
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
function setupExpressErrorHandler(_posthog, app) {
|
|
@@ -40,7 +42,7 @@ function setupExpressErrorHandler(_posthog, app) {
|
|
|
40
42
|
function posthogErrorHandler(posthog) {
|
|
41
43
|
return (error, req, res, next)=>{
|
|
42
44
|
if (error_tracking.isPreviouslyCapturedError(error)) return void next(error);
|
|
43
|
-
const contextData = buildRequestContextData(req);
|
|
45
|
+
const contextData = buildRequestContextData(posthog, req);
|
|
44
46
|
const syntheticException = new Error('Synthetic exception');
|
|
45
47
|
const hint = {
|
|
46
48
|
mechanism: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/extensions/nestjs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/extensions/nestjs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAA;AAM7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,UAAU,iBAAiB;IACzB,UAAU,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;IACxB,WAAW,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;CAC1B;AAED,UAAU,gBAAgB;IACxB,YAAY,IAAI,iBAAiB,CAAA;CAClC;AAED,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG;IAC3B,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;CACxB;AAED,UAAU,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACxC,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;CAC1E;AAED,MAAM,WAAW,uBAAuB;IACtC,+GAA+G;IAC/G,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC,mGAAmG;IACnG,iBAAiB,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAA;CACtD;AAwBD,qBAAa,kBAAmB,YAAW,eAAe;IACxD,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,kBAAkB,CAAQ;gBAEtB,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAO9E,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;CAoDzE"}
|
|
@@ -40,6 +40,7 @@ const operators_namespaceObject = require("rxjs/operators");
|
|
|
40
40
|
const index_js_namespaceObject = require("./error-tracking/index.js");
|
|
41
41
|
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
42
42
|
const external_tracing_headers_js_namespaceObject = require("./tracing-headers.js");
|
|
43
|
+
const external_url_utils_js_namespaceObject = require("./url-utils.js");
|
|
43
44
|
function getClientIp(headers, request) {
|
|
44
45
|
const forwarded = (0, external_tracing_headers_js_namespaceObject.getFirstHeaderValue)(headers['x-forwarded-for']);
|
|
45
46
|
if (forwarded) {
|
|
@@ -68,9 +69,10 @@ class PostHogInterceptor {
|
|
|
68
69
|
const headers = request?.headers ?? {};
|
|
69
70
|
const { sessionId, distinctId } = (0, external_tracing_headers_js_namespaceObject.getPostHogTracingHeaderValues)(headers);
|
|
70
71
|
const properties = {};
|
|
71
|
-
|
|
72
|
+
const disableCaptureUrlHashes = true === this.posthog.options.disable_capture_url_hashes;
|
|
73
|
+
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$current_url', (0, external_url_utils_js_namespaceObject.normalizeRequestCurrentUrl)(request?.url, disableCaptureUrlHashes));
|
|
72
74
|
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$request_method', request?.method);
|
|
73
|
-
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$request_path', request?.path ?? request?.url);
|
|
75
|
+
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$request_path', (0, external_url_utils_js_namespaceObject.normalizeRequestPath)(request?.path ?? request?.url, disableCaptureUrlHashes));
|
|
74
76
|
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$user_agent', (0, external_tracing_headers_js_namespaceObject.getFirstHeaderValue)(headers['user-agent']));
|
|
75
77
|
(0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$ip', getClientIp(headers, request));
|
|
76
78
|
const contextData = {
|
|
@@ -2,6 +2,7 @@ import { throwError } from "rxjs";
|
|
|
2
2
|
import { catchError } from "rxjs/operators";
|
|
3
3
|
import error_tracking from "./error-tracking/index.mjs";
|
|
4
4
|
import { addProperty, getFirstHeaderValue, getPostHogTracingHeaderValues } from "./tracing-headers.mjs";
|
|
5
|
+
import { normalizeRequestCurrentUrl, normalizeRequestPath } from "./url-utils.mjs";
|
|
5
6
|
function getClientIp(headers, request) {
|
|
6
7
|
const forwarded = getFirstHeaderValue(headers['x-forwarded-for']);
|
|
7
8
|
if (forwarded) {
|
|
@@ -30,9 +31,10 @@ class PostHogInterceptor {
|
|
|
30
31
|
const headers = request?.headers ?? {};
|
|
31
32
|
const { sessionId, distinctId } = getPostHogTracingHeaderValues(headers);
|
|
32
33
|
const properties = {};
|
|
33
|
-
|
|
34
|
+
const disableCaptureUrlHashes = true === this.posthog.options.disable_capture_url_hashes;
|
|
35
|
+
addProperty(properties, '$current_url', normalizeRequestCurrentUrl(request?.url, disableCaptureUrlHashes));
|
|
34
36
|
addProperty(properties, '$request_method', request?.method);
|
|
35
|
-
addProperty(properties, '$request_path', request?.path ?? request?.url);
|
|
37
|
+
addProperty(properties, '$request_path', normalizeRequestPath(request?.path ?? request?.url, disableCaptureUrlHashes));
|
|
36
38
|
addProperty(properties, '$user_agent', getFirstHeaderValue(headers['user-agent']));
|
|
37
39
|
addProperty(properties, '$ip', getClientIp(headers, request));
|
|
38
40
|
const contextData = {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function normalizeRequestCurrentUrl(currentUrl: string | undefined, disableCaptureUrlHashes: boolean): string | undefined;
|
|
2
|
+
export declare function normalizeRequestPath(path: string | undefined, disableCaptureUrlHashes: boolean): string | undefined;
|
|
3
|
+
//# sourceMappingURL=url-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-utils.d.ts","sourceRoot":"","sources":["../../src/extensions/url-utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,uBAAuB,EAAE,OAAO,GAC/B,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,uBAAuB,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGnH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
normalizeRequestPath: ()=>normalizeRequestPath,
|
|
28
|
+
normalizeRequestCurrentUrl: ()=>normalizeRequestCurrentUrl
|
|
29
|
+
});
|
|
30
|
+
const core_namespaceObject = require("@posthog/core");
|
|
31
|
+
function normalizeRequestCurrentUrl(currentUrl, disableCaptureUrlHashes) {
|
|
32
|
+
return disableCaptureUrlHashes ? (0, core_namespaceObject.stripUrlHash)(currentUrl) : currentUrl;
|
|
33
|
+
}
|
|
34
|
+
function normalizeRequestPath(path, disableCaptureUrlHashes) {
|
|
35
|
+
const pathWithoutSearch = stripUrlSearch(path);
|
|
36
|
+
return disableCaptureUrlHashes ? (0, core_namespaceObject.stripUrlHash)(pathWithoutSearch) : pathWithoutSearch;
|
|
37
|
+
}
|
|
38
|
+
function stripUrlSearch(url) {
|
|
39
|
+
if (!url) return url;
|
|
40
|
+
const searchIndex = url.indexOf('?');
|
|
41
|
+
const hashIndex = url.indexOf('#');
|
|
42
|
+
if (-1 === searchIndex || -1 !== hashIndex && hashIndex < searchIndex) return url;
|
|
43
|
+
return `${url.slice(0, searchIndex)}${-1 === hashIndex ? '' : url.slice(hashIndex)}`;
|
|
44
|
+
}
|
|
45
|
+
exports.normalizeRequestCurrentUrl = __webpack_exports__.normalizeRequestCurrentUrl;
|
|
46
|
+
exports.normalizeRequestPath = __webpack_exports__.normalizeRequestPath;
|
|
47
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
48
|
+
"normalizeRequestCurrentUrl",
|
|
49
|
+
"normalizeRequestPath"
|
|
50
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { stripUrlHash } from "@posthog/core";
|
|
2
|
+
function normalizeRequestCurrentUrl(currentUrl, disableCaptureUrlHashes) {
|
|
3
|
+
return disableCaptureUrlHashes ? stripUrlHash(currentUrl) : currentUrl;
|
|
4
|
+
}
|
|
5
|
+
function normalizeRequestPath(path, disableCaptureUrlHashes) {
|
|
6
|
+
const pathWithoutSearch = stripUrlSearch(path);
|
|
7
|
+
return disableCaptureUrlHashes ? stripUrlHash(pathWithoutSearch) : pathWithoutSearch;
|
|
8
|
+
}
|
|
9
|
+
function stripUrlSearch(url) {
|
|
10
|
+
if (!url) return url;
|
|
11
|
+
const searchIndex = url.indexOf('?');
|
|
12
|
+
const hashIndex = url.indexOf('#');
|
|
13
|
+
if (-1 === searchIndex || -1 !== hashIndex && hashIndex < searchIndex) return url;
|
|
14
|
+
return `${url.slice(0, searchIndex)}${-1 === hashIndex ? '' : url.slice(hashIndex)}`;
|
|
15
|
+
}
|
|
16
|
+
export { normalizeRequestCurrentUrl, normalizeRequestPath };
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.38.
|
|
1
|
+
export declare const version = "5.38.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
version: ()=>version
|
|
28
28
|
});
|
|
29
|
-
const version = '5.38.
|
|
29
|
+
const version = '5.38.5';
|
|
30
30
|
exports.version = __webpack_exports__.version;
|
|
31
31
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
32
32
|
"version"
|
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = '5.38.
|
|
1
|
+
const version = '5.38.5';
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-node",
|
|
3
|
-
"version": "5.38.
|
|
3
|
+
"version": "5.38.5",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"module": "dist/entrypoints/index.node.mjs",
|
|
29
29
|
"types": "dist/entrypoints/index.node.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@posthog/core": "^1.37.
|
|
31
|
+
"@posthog/core": "^1.37.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@edge-runtime/jest-environment": "^4.0.0",
|
package/src/client.ts
CHANGED
|
@@ -2,6 +2,7 @@ import ErrorTracking from './error-tracking'
|
|
|
2
2
|
import { PostHogBackendClient } from '../client'
|
|
3
3
|
import { ErrorTracking as CoreErrorTracking } from '@posthog/core'
|
|
4
4
|
import { addProperty, getFirstHeaderValue, getPostHogTracingHeaderValues } from './tracing-headers'
|
|
5
|
+
import { normalizeRequestCurrentUrl, normalizeRequestPath } from './url-utils'
|
|
5
6
|
import type { Request, Response } from 'express'
|
|
6
7
|
import type { ContextData } from './context/types'
|
|
7
8
|
|
|
@@ -32,13 +33,18 @@ function getClientIp(req: Request): string | undefined {
|
|
|
32
33
|
return req.socket?.remoteAddress
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
function buildRequestContextData(req: Request): Partial<ContextData> {
|
|
36
|
+
function buildRequestContextData(posthog: PostHogBackendClient, req: Request): Partial<ContextData> {
|
|
36
37
|
const { sessionId, distinctId } = getPostHogTracingHeaderValues(req.headers)
|
|
37
38
|
const properties: Record<string, any> = {}
|
|
39
|
+
const disableCaptureUrlHashes = posthog.options.disable_capture_url_hashes === true
|
|
38
40
|
|
|
39
|
-
addProperty(
|
|
41
|
+
addProperty(
|
|
42
|
+
properties,
|
|
43
|
+
'$current_url',
|
|
44
|
+
normalizeRequestCurrentUrl(req.originalUrl || req.url, disableCaptureUrlHashes)
|
|
45
|
+
)
|
|
40
46
|
addProperty(properties, '$request_method', req.method)
|
|
41
|
-
addProperty(properties, '$request_path', req.path)
|
|
47
|
+
addProperty(properties, '$request_path', normalizeRequestPath(req.path, disableCaptureUrlHashes))
|
|
42
48
|
addProperty(properties, '$user_agent', getFirstHeaderValue(req.headers['user-agent']))
|
|
43
49
|
addProperty(properties, '$ip', getClientIp(req))
|
|
44
50
|
|
|
@@ -60,7 +66,7 @@ export function setupExpressRequestContext(
|
|
|
60
66
|
|
|
61
67
|
function posthogRequestContext(posthog: PostHogBackendClient): ExpressMiddleware {
|
|
62
68
|
return (req, _res, next): void => {
|
|
63
|
-
posthog.withContext(buildRequestContextData(req), () => next())
|
|
69
|
+
posthog.withContext(buildRequestContextData(posthog, req), () => next())
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
|
|
@@ -80,7 +86,7 @@ function posthogErrorHandler(posthog: PostHogBackendClient): ExpressErrorMiddlew
|
|
|
80
86
|
return
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
const contextData = buildRequestContextData(req)
|
|
89
|
+
const contextData = buildRequestContextData(posthog, req)
|
|
84
90
|
const syntheticException = new Error('Synthetic exception')
|
|
85
91
|
const hint: CoreErrorTracking.EventHint = { mechanism: { type: 'middleware', handled: false }, syntheticException }
|
|
86
92
|
const additionalProperties: Record<string, any> = {
|
package/src/extensions/nestjs.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { catchError } from 'rxjs/operators'
|
|
|
4
4
|
|
|
5
5
|
import ErrorTracking from './error-tracking'
|
|
6
6
|
import { addProperty, getFirstHeaderValue, getPostHogTracingHeaderValues } from './tracing-headers'
|
|
7
|
+
import { normalizeRequestCurrentUrl, normalizeRequestPath } from './url-utils'
|
|
7
8
|
import { PostHogBackendClient } from '../client'
|
|
8
9
|
|
|
9
10
|
// Local interfaces to avoid runtime dependency on @nestjs/common
|
|
@@ -77,9 +78,14 @@ export class PostHogInterceptor implements NestInterceptor {
|
|
|
77
78
|
const { sessionId, distinctId } = getPostHogTracingHeaderValues(headers)
|
|
78
79
|
|
|
79
80
|
const properties: Record<string, any> = {}
|
|
80
|
-
|
|
81
|
+
const disableCaptureUrlHashes = this.posthog.options.disable_capture_url_hashes === true
|
|
82
|
+
addProperty(properties, '$current_url', normalizeRequestCurrentUrl(request?.url, disableCaptureUrlHashes))
|
|
81
83
|
addProperty(properties, '$request_method', request?.method)
|
|
82
|
-
addProperty(
|
|
84
|
+
addProperty(
|
|
85
|
+
properties,
|
|
86
|
+
'$request_path',
|
|
87
|
+
normalizeRequestPath(request?.path ?? request?.url, disableCaptureUrlHashes)
|
|
88
|
+
)
|
|
83
89
|
addProperty(properties, '$user_agent', getFirstHeaderValue(headers['user-agent']))
|
|
84
90
|
addProperty(properties, '$ip', getClientIp(headers, request))
|
|
85
91
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { stripUrlHash } from '@posthog/core'
|
|
2
|
+
|
|
3
|
+
export function normalizeRequestCurrentUrl(
|
|
4
|
+
currentUrl: string | undefined,
|
|
5
|
+
disableCaptureUrlHashes: boolean
|
|
6
|
+
): string | undefined {
|
|
7
|
+
return disableCaptureUrlHashes ? stripUrlHash(currentUrl) : currentUrl
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function normalizeRequestPath(path: string | undefined, disableCaptureUrlHashes: boolean): string | undefined {
|
|
11
|
+
const pathWithoutSearch = stripUrlSearch(path)
|
|
12
|
+
return disableCaptureUrlHashes ? stripUrlHash(pathWithoutSearch) : pathWithoutSearch
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function stripUrlSearch<T extends string | undefined>(url: T): T extends string ? string : undefined {
|
|
16
|
+
if (!url) {
|
|
17
|
+
return url as any
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const searchIndex = url.indexOf('?')
|
|
21
|
+
const hashIndex = url.indexOf('#')
|
|
22
|
+
if (searchIndex === -1 || (hashIndex !== -1 && hashIndex < searchIndex)) {
|
|
23
|
+
return url as any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return `${url.slice(0, searchIndex)}${hashIndex === -1 ? '' : url.slice(hashIndex)}` as any
|
|
27
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.38.
|
|
1
|
+
export const version = '5.38.5'
|