posthog-node 5.27.0 → 5.28.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.
@@ -0,0 +1,2 @@
1
+ export * from '../extensions/nestjs';
2
+ //# sourceMappingURL=nestjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/entrypoints/nestjs.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __webpack_modules__ = {
3
+ "../extensions/nestjs": function(module) {
4
+ module.exports = require("../extensions/nestjs.js");
5
+ }
6
+ };
7
+ var __webpack_module_cache__ = {};
8
+ function __webpack_require__(moduleId) {
9
+ var cachedModule = __webpack_module_cache__[moduleId];
10
+ if (void 0 !== cachedModule) return cachedModule.exports;
11
+ var module = __webpack_module_cache__[moduleId] = {
12
+ exports: {}
13
+ };
14
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15
+ return module.exports;
16
+ }
17
+ (()=>{
18
+ __webpack_require__.n = (module)=>{
19
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
20
+ __webpack_require__.d(getter, {
21
+ a: getter
22
+ });
23
+ return getter;
24
+ };
25
+ })();
26
+ (()=>{
27
+ __webpack_require__.d = (exports1, definition)=>{
28
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
29
+ enumerable: true,
30
+ get: definition[key]
31
+ });
32
+ };
33
+ })();
34
+ (()=>{
35
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
36
+ })();
37
+ (()=>{
38
+ __webpack_require__.r = (exports1)=>{
39
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
40
+ value: 'Module'
41
+ });
42
+ Object.defineProperty(exports1, '__esModule', {
43
+ value: true
44
+ });
45
+ };
46
+ })();
47
+ var __webpack_exports__ = {};
48
+ (()=>{
49
+ __webpack_require__.r(__webpack_exports__);
50
+ var _extensions_nestjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../extensions/nestjs");
51
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
52
+ for(var __WEBPACK_IMPORT_KEY__ in _extensions_nestjs__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
53
+ return _extensions_nestjs__WEBPACK_IMPORTED_MODULE_0__[key];
54
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
55
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
56
+ })();
57
+ for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
58
+ Object.defineProperty(exports, '__esModule', {
59
+ value: true
60
+ });
@@ -0,0 +1 @@
1
+ export * from "../extensions/nestjs.mjs";
@@ -139,6 +139,17 @@ declare class FeatureFlagsPoller {
139
139
  stopPoller(timeoutMs?: number): Promise<void>;
140
140
  }
141
141
  declare function matchProperty(property: FeatureFlagCondition['properties'][number], propertyValues: Record<string, any>, warnFunction?: (msg: string) => void): boolean;
142
+ type SemverTuple = [number, number, number];
143
+ /**
144
+ * Parse a version string into a [major, minor, patch] tuple.
145
+ * - Strips leading/trailing whitespace
146
+ * - Strips 'v' or 'V' prefix
147
+ * - Strips pre-release and build metadata (-alpha, +build)
148
+ * - Defaults missing components to 0
149
+ * - Ignores extra components beyond the third
150
+ * - Throws InconclusiveMatchError for invalid input
151
+ */
152
+ declare function parseSemver(value: string): SemverTuple;
142
153
  declare function relativeDateParseForFeatureFlagMatching(value: string): Date | null;
143
- export { FeatureFlagsPoller, matchProperty, relativeDateParseForFeatureFlagMatching, InconclusiveMatchError, RequiresServerEvaluation, ClientError, };
154
+ export { FeatureFlagsPoller, matchProperty, relativeDateParseForFeatureFlagMatching, parseSemver, InconclusiveMatchError, RequiresServerEvaluation, ClientError, };
144
155
  //# sourceMappingURL=feature-flags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/extensions/feature-flags/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmC,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACtH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAG1G,OAAO,EAAE,2BAA2B,EAA2B,MAAM,SAAS,CAAA;AAQ9E,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM;CAO5B;AAED,cAAM,sBAAuB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAS5B;AAED,cAAM,wBAAyB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAS5B;AAED,KAAK,yBAAyB,GAAG;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACpF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACzC,aAAa,CAAC,EAAE,2BAA2B,CAAA;IAC3C,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,C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AG,WAAW,CA2B/C;AAsGD,iBAAS,uCAAuC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAmC3E;AAED,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,uCAAuC,EACvC,WAAW,EACX,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,GACZ,CAAA"}
@@ -25,6 +25,7 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  matchProperty: ()=>matchProperty,
28
+ parseSemver: ()=>parseSemver,
28
29
  ClientError: ()=>ClientError,
29
30
  relativeDateParseForFeatureFlagMatching: ()=>relativeDateParseForFeatureFlagMatching,
30
31
  InconclusiveMatchError: ()=>InconclusiveMatchError,
@@ -547,6 +548,54 @@ function matchProperty(property, propertyValues, warnFunction) {
547
548
  ].includes(operator)) return overrideDate < parsedDate;
548
549
  return overrideDate > parsedDate;
549
550
  }
551
+ case 'semver_eq':
552
+ {
553
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
554
+ return 0 === cmp;
555
+ }
556
+ case 'semver_neq':
557
+ {
558
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
559
+ return 0 !== cmp;
560
+ }
561
+ case 'semver_gt':
562
+ {
563
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
564
+ return cmp > 0;
565
+ }
566
+ case 'semver_gte':
567
+ {
568
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
569
+ return cmp >= 0;
570
+ }
571
+ case 'semver_lt':
572
+ {
573
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
574
+ return cmp < 0;
575
+ }
576
+ case 'semver_lte':
577
+ {
578
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
579
+ return cmp <= 0;
580
+ }
581
+ case 'semver_tilde':
582
+ {
583
+ const overrideParsed = parseSemver(String(overrideValue));
584
+ const { lower, upper } = computeTildeBounds(String(value));
585
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0;
586
+ }
587
+ case 'semver_caret':
588
+ {
589
+ const overrideParsed = parseSemver(String(overrideValue));
590
+ const { lower, upper } = computeCaretBounds(String(value));
591
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0;
592
+ }
593
+ case 'semver_wildcard':
594
+ {
595
+ const overrideParsed = parseSemver(String(overrideValue));
596
+ const { lower, upper } = computeWildcardBounds(String(value));
597
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0;
598
+ }
550
599
  default:
551
600
  throw new InconclusiveMatchError(`Unknown operator: ${operator}`);
552
601
  }
@@ -615,6 +664,115 @@ function isValidRegex(regex) {
615
664
  return false;
616
665
  }
617
666
  }
667
+ function parseSemver(value) {
668
+ const text = String(value).trim().replace(/^[vV]/, '');
669
+ const baseVersion = text.split('-')[0].split('+')[0];
670
+ if (!baseVersion || baseVersion.startsWith('.')) throw new InconclusiveMatchError(`Invalid semver: ${value}`);
671
+ const parts = baseVersion.split('.');
672
+ const parsePart = (part)=>{
673
+ if (void 0 === part || '' === part) return 0;
674
+ if (!/^\d+$/.test(part)) throw new InconclusiveMatchError(`Invalid semver: ${value}`);
675
+ return parseInt(part, 10);
676
+ };
677
+ const major = parsePart(parts[0]);
678
+ const minor = parsePart(parts[1]);
679
+ const patch = parsePart(parts[2]);
680
+ return [
681
+ major,
682
+ minor,
683
+ patch
684
+ ];
685
+ }
686
+ function compareSemverTuples(a, b) {
687
+ for(let i = 0; i < 3; i++){
688
+ if (a[i] < b[i]) return -1;
689
+ if (a[i] > b[i]) return 1;
690
+ }
691
+ return 0;
692
+ }
693
+ function computeTildeBounds(value) {
694
+ const parsed = parseSemver(value);
695
+ const lower = [
696
+ parsed[0],
697
+ parsed[1],
698
+ parsed[2]
699
+ ];
700
+ const upper = [
701
+ parsed[0],
702
+ parsed[1] + 1,
703
+ 0
704
+ ];
705
+ return {
706
+ lower,
707
+ upper
708
+ };
709
+ }
710
+ function computeCaretBounds(value) {
711
+ const parsed = parseSemver(value);
712
+ const [major, minor, patch] = parsed;
713
+ const lower = [
714
+ major,
715
+ minor,
716
+ patch
717
+ ];
718
+ let upper;
719
+ upper = major > 0 ? [
720
+ major + 1,
721
+ 0,
722
+ 0
723
+ ] : minor > 0 ? [
724
+ 0,
725
+ minor + 1,
726
+ 0
727
+ ] : [
728
+ 0,
729
+ 0,
730
+ patch + 1
731
+ ];
732
+ return {
733
+ lower,
734
+ upper
735
+ };
736
+ }
737
+ function computeWildcardBounds(value) {
738
+ const text = String(value).trim().replace(/^[vV]/, '');
739
+ const cleanedText = text.replace(/\.\*$/, '').replace(/\*$/, '');
740
+ if (!cleanedText) throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`);
741
+ const parts = cleanedText.split('.');
742
+ const major = parseInt(parts[0], 10);
743
+ if (isNaN(major)) throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`);
744
+ let lower;
745
+ let upper;
746
+ if (1 === parts.length) {
747
+ lower = [
748
+ major,
749
+ 0,
750
+ 0
751
+ ];
752
+ upper = [
753
+ major + 1,
754
+ 0,
755
+ 0
756
+ ];
757
+ } else {
758
+ const minor = parseInt(parts[1], 10);
759
+ if (isNaN(minor)) throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`);
760
+ lower = [
761
+ major,
762
+ minor,
763
+ 0
764
+ ];
765
+ upper = [
766
+ major,
767
+ minor + 1,
768
+ 0
769
+ ];
770
+ }
771
+ return {
772
+ lower,
773
+ upper
774
+ };
775
+ }
618
776
  function convertToDateTime(value) {
619
777
  if (value instanceof Date) return value;
620
778
  if ('string' == typeof value || 'number' == typeof value) {
@@ -650,6 +808,7 @@ exports.FeatureFlagsPoller = __webpack_exports__.FeatureFlagsPoller;
650
808
  exports.InconclusiveMatchError = __webpack_exports__.InconclusiveMatchError;
651
809
  exports.RequiresServerEvaluation = __webpack_exports__.RequiresServerEvaluation;
652
810
  exports.matchProperty = __webpack_exports__.matchProperty;
811
+ exports.parseSemver = __webpack_exports__.parseSemver;
653
812
  exports.relativeDateParseForFeatureFlagMatching = __webpack_exports__.relativeDateParseForFeatureFlagMatching;
654
813
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
655
814
  "ClientError",
@@ -657,6 +816,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
657
816
  "InconclusiveMatchError",
658
817
  "RequiresServerEvaluation",
659
818
  "matchProperty",
819
+ "parseSemver",
660
820
  "relativeDateParseForFeatureFlagMatching"
661
821
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
662
822
  Object.defineProperty(exports, '__esModule', {
@@ -514,6 +514,54 @@ function matchProperty(property, propertyValues, warnFunction) {
514
514
  ].includes(operator)) return overrideDate < parsedDate;
515
515
  return overrideDate > parsedDate;
516
516
  }
517
+ case 'semver_eq':
518
+ {
519
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
520
+ return 0 === cmp;
521
+ }
522
+ case 'semver_neq':
523
+ {
524
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
525
+ return 0 !== cmp;
526
+ }
527
+ case 'semver_gt':
528
+ {
529
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
530
+ return cmp > 0;
531
+ }
532
+ case 'semver_gte':
533
+ {
534
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
535
+ return cmp >= 0;
536
+ }
537
+ case 'semver_lt':
538
+ {
539
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
540
+ return cmp < 0;
541
+ }
542
+ case 'semver_lte':
543
+ {
544
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)));
545
+ return cmp <= 0;
546
+ }
547
+ case 'semver_tilde':
548
+ {
549
+ const overrideParsed = parseSemver(String(overrideValue));
550
+ const { lower, upper } = computeTildeBounds(String(value));
551
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0;
552
+ }
553
+ case 'semver_caret':
554
+ {
555
+ const overrideParsed = parseSemver(String(overrideValue));
556
+ const { lower, upper } = computeCaretBounds(String(value));
557
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0;
558
+ }
559
+ case 'semver_wildcard':
560
+ {
561
+ const overrideParsed = parseSemver(String(overrideValue));
562
+ const { lower, upper } = computeWildcardBounds(String(value));
563
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0;
564
+ }
517
565
  default:
518
566
  throw new InconclusiveMatchError(`Unknown operator: ${operator}`);
519
567
  }
@@ -582,6 +630,115 @@ function isValidRegex(regex) {
582
630
  return false;
583
631
  }
584
632
  }
633
+ function parseSemver(value) {
634
+ const text = String(value).trim().replace(/^[vV]/, '');
635
+ const baseVersion = text.split('-')[0].split('+')[0];
636
+ if (!baseVersion || baseVersion.startsWith('.')) throw new InconclusiveMatchError(`Invalid semver: ${value}`);
637
+ const parts = baseVersion.split('.');
638
+ const parsePart = (part)=>{
639
+ if (void 0 === part || '' === part) return 0;
640
+ if (!/^\d+$/.test(part)) throw new InconclusiveMatchError(`Invalid semver: ${value}`);
641
+ return parseInt(part, 10);
642
+ };
643
+ const major = parsePart(parts[0]);
644
+ const minor = parsePart(parts[1]);
645
+ const patch = parsePart(parts[2]);
646
+ return [
647
+ major,
648
+ minor,
649
+ patch
650
+ ];
651
+ }
652
+ function compareSemverTuples(a, b) {
653
+ for(let i = 0; i < 3; i++){
654
+ if (a[i] < b[i]) return -1;
655
+ if (a[i] > b[i]) return 1;
656
+ }
657
+ return 0;
658
+ }
659
+ function computeTildeBounds(value) {
660
+ const parsed = parseSemver(value);
661
+ const lower = [
662
+ parsed[0],
663
+ parsed[1],
664
+ parsed[2]
665
+ ];
666
+ const upper = [
667
+ parsed[0],
668
+ parsed[1] + 1,
669
+ 0
670
+ ];
671
+ return {
672
+ lower,
673
+ upper
674
+ };
675
+ }
676
+ function computeCaretBounds(value) {
677
+ const parsed = parseSemver(value);
678
+ const [major, minor, patch] = parsed;
679
+ const lower = [
680
+ major,
681
+ minor,
682
+ patch
683
+ ];
684
+ let upper;
685
+ upper = major > 0 ? [
686
+ major + 1,
687
+ 0,
688
+ 0
689
+ ] : minor > 0 ? [
690
+ 0,
691
+ minor + 1,
692
+ 0
693
+ ] : [
694
+ 0,
695
+ 0,
696
+ patch + 1
697
+ ];
698
+ return {
699
+ lower,
700
+ upper
701
+ };
702
+ }
703
+ function computeWildcardBounds(value) {
704
+ const text = String(value).trim().replace(/^[vV]/, '');
705
+ const cleanedText = text.replace(/\.\*$/, '').replace(/\*$/, '');
706
+ if (!cleanedText) throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`);
707
+ const parts = cleanedText.split('.');
708
+ const major = parseInt(parts[0], 10);
709
+ if (isNaN(major)) throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`);
710
+ let lower;
711
+ let upper;
712
+ if (1 === parts.length) {
713
+ lower = [
714
+ major,
715
+ 0,
716
+ 0
717
+ ];
718
+ upper = [
719
+ major + 1,
720
+ 0,
721
+ 0
722
+ ];
723
+ } else {
724
+ const minor = parseInt(parts[1], 10);
725
+ if (isNaN(minor)) throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`);
726
+ lower = [
727
+ major,
728
+ minor,
729
+ 0
730
+ ];
731
+ upper = [
732
+ major,
733
+ minor + 1,
734
+ 0
735
+ ];
736
+ }
737
+ return {
738
+ lower,
739
+ upper
740
+ };
741
+ }
585
742
  function convertToDateTime(value) {
586
743
  if (value instanceof Date) return value;
587
744
  if ('string' == typeof value || 'number' == typeof value) {
@@ -612,4 +769,4 @@ function relativeDateParseForFeatureFlagMatching(value) {
612
769
  return parsedDt;
613
770
  }
614
771
  }
615
- export { ClientError, FeatureFlagsPoller, InconclusiveMatchError, RequiresServerEvaluation, matchProperty, relativeDateParseForFeatureFlagMatching };
772
+ export { ClientError, FeatureFlagsPoller, InconclusiveMatchError, RequiresServerEvaluation, matchProperty, parseSemver, relativeDateParseForFeatureFlagMatching };
@@ -0,0 +1,32 @@
1
+ import { Observable } from 'rxjs';
2
+ import { PostHogBackendClient } from '../client';
3
+ interface HttpArgumentsHost {
4
+ getRequest<T = any>(): T;
5
+ getResponse<T = any>(): T;
6
+ }
7
+ interface ExecutionContext {
8
+ switchToHttp(): HttpArgumentsHost;
9
+ }
10
+ interface CallHandler<T = any> {
11
+ handle(): Observable<T>;
12
+ }
13
+ interface NestInterceptor<T = any, R = any> {
14
+ intercept(context: ExecutionContext, next: CallHandler<T>): Observable<R>;
15
+ }
16
+ export interface ExceptionCaptureOptions {
17
+ /** Minimum HTTP status code to capture. Exceptions with a lower status (e.g. 4xx) are skipped. @default 500 */
18
+ minStatusToCapture?: number;
19
+ }
20
+ export interface PostHogInterceptorOptions {
21
+ /** Enable exception capture. Pass `true` for defaults or an object to configure. @default false */
22
+ captureExceptions?: boolean | ExceptionCaptureOptions;
23
+ }
24
+ export declare class PostHogInterceptor implements NestInterceptor {
25
+ private posthog;
26
+ private captureExceptions;
27
+ private minStatusToCapture;
28
+ constructor(posthog: PostHogBackendClient, options?: PostHogInterceptorOptions);
29
+ intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=nestjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/extensions/nestjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAA;AAI7C,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;CAiDzE"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ PostHogInterceptor: ()=>PostHogInterceptor
37
+ });
38
+ const external_rxjs_namespaceObject = require("rxjs");
39
+ const operators_namespaceObject = require("rxjs/operators");
40
+ const index_js_namespaceObject = require("./error-tracking/index.js");
41
+ var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
42
+ function getClientIp(headers, request) {
43
+ const forwarded = headers['x-forwarded-for'];
44
+ if (forwarded) {
45
+ const ip = String(forwarded).split(',')[0].trim();
46
+ if (ip) return ip;
47
+ }
48
+ return request?.socket?.remoteAddress;
49
+ }
50
+ function getExceptionStatus(exception) {
51
+ if (exception && 'object' == typeof exception && 'getStatus' in exception && 'function' == typeof exception.getStatus) {
52
+ const status = exception.getStatus();
53
+ return 'number' == typeof status ? status : void 0;
54
+ }
55
+ }
56
+ class PostHogInterceptor {
57
+ constructor(posthog, options){
58
+ this.posthog = posthog;
59
+ const capture = options?.captureExceptions;
60
+ this.captureExceptions = !!capture;
61
+ this.minStatusToCapture = ('object' == typeof capture ? capture.minStatusToCapture : void 0) ?? 500;
62
+ }
63
+ intercept(context, next) {
64
+ const httpHost = context.switchToHttp();
65
+ const request = httpHost.getRequest();
66
+ const response = httpHost.getResponse();
67
+ const headers = request?.headers ?? {};
68
+ const sessionId = headers['x-posthog-session-id'];
69
+ const windowId = headers['x-posthog-window-id'];
70
+ const distinctId = headers['x-posthog-distinct-id'];
71
+ const contextData = {
72
+ sessionId,
73
+ distinctId,
74
+ properties: {
75
+ $current_url: request?.url,
76
+ $request_method: request?.method,
77
+ $request_path: request?.path ?? request?.url,
78
+ $window_id: windowId,
79
+ $user_agent: headers['user-agent'],
80
+ $ip: getClientIp(headers, request)
81
+ }
82
+ };
83
+ this.posthog.enterContext(contextData);
84
+ let source = next.handle();
85
+ if (this.captureExceptions) source = source.pipe((0, operators_namespaceObject.catchError)((exception)=>{
86
+ if (index_js_default().isPreviouslyCapturedError(exception)) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
87
+ const status = getExceptionStatus(exception);
88
+ if (void 0 !== status && status < this.minStatusToCapture) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
89
+ const responseStatus = status ?? response?.statusCode;
90
+ const additionalProperties = void 0 !== responseStatus ? {
91
+ $response_status_code: responseStatus
92
+ } : void 0;
93
+ this.posthog.captureException(exception, distinctId, additionalProperties);
94
+ return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
95
+ }));
96
+ return source;
97
+ }
98
+ }
99
+ exports.PostHogInterceptor = __webpack_exports__.PostHogInterceptor;
100
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
101
+ "PostHogInterceptor"
102
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
103
+ Object.defineProperty(exports, '__esModule', {
104
+ value: true
105
+ });
@@ -0,0 +1,61 @@
1
+ import { throwError } from "rxjs";
2
+ import { catchError } from "rxjs/operators";
3
+ import error_tracking from "./error-tracking/index.mjs";
4
+ function getClientIp(headers, request) {
5
+ const forwarded = headers['x-forwarded-for'];
6
+ if (forwarded) {
7
+ const ip = String(forwarded).split(',')[0].trim();
8
+ if (ip) return ip;
9
+ }
10
+ return request?.socket?.remoteAddress;
11
+ }
12
+ function getExceptionStatus(exception) {
13
+ if (exception && 'object' == typeof exception && 'getStatus' in exception && 'function' == typeof exception.getStatus) {
14
+ const status = exception.getStatus();
15
+ return 'number' == typeof status ? status : void 0;
16
+ }
17
+ }
18
+ class PostHogInterceptor {
19
+ constructor(posthog, options){
20
+ this.posthog = posthog;
21
+ const capture = options?.captureExceptions;
22
+ this.captureExceptions = !!capture;
23
+ this.minStatusToCapture = ('object' == typeof capture ? capture.minStatusToCapture : void 0) ?? 500;
24
+ }
25
+ intercept(context, next) {
26
+ const httpHost = context.switchToHttp();
27
+ const request = httpHost.getRequest();
28
+ const response = httpHost.getResponse();
29
+ const headers = request?.headers ?? {};
30
+ const sessionId = headers['x-posthog-session-id'];
31
+ const windowId = headers['x-posthog-window-id'];
32
+ const distinctId = headers['x-posthog-distinct-id'];
33
+ const contextData = {
34
+ sessionId,
35
+ distinctId,
36
+ properties: {
37
+ $current_url: request?.url,
38
+ $request_method: request?.method,
39
+ $request_path: request?.path ?? request?.url,
40
+ $window_id: windowId,
41
+ $user_agent: headers['user-agent'],
42
+ $ip: getClientIp(headers, request)
43
+ }
44
+ };
45
+ this.posthog.enterContext(contextData);
46
+ let source = next.handle();
47
+ if (this.captureExceptions) source = source.pipe(catchError((exception)=>{
48
+ if (error_tracking.isPreviouslyCapturedError(exception)) return throwError(()=>exception);
49
+ const status = getExceptionStatus(exception);
50
+ if (void 0 !== status && status < this.minStatusToCapture) return throwError(()=>exception);
51
+ const responseStatus = status ?? response?.statusCode;
52
+ const additionalProperties = void 0 !== responseStatus ? {
53
+ $response_status_code: responseStatus
54
+ } : void 0;
55
+ this.posthog.captureException(exception, distinctId, additionalProperties);
56
+ return throwError(()=>exception);
57
+ }));
58
+ return source;
59
+ }
60
+ }
61
+ export { PostHogInterceptor };
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.27.0";
1
+ export declare const version = "5.28.0";
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.27.0';
29
+ const version = '5.28.0';
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.27.0';
1
+ const version = '5.28.0';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.27.0",
3
+ "version": "5.28.0",
4
4
  "description": "PostHog Node.js integration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,8 +33,17 @@
33
33
  "@types/jest": "^29.5.14",
34
34
  "@types/node": "^20.0.0",
35
35
  "jest": "29.7.0",
36
+ "rxjs": "^7.8.0",
36
37
  "@posthog-tooling/tsconfig-base": "1.1.1"
37
38
  },
39
+ "peerDependencies": {
40
+ "rxjs": "^7.0.0"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "rxjs": {
44
+ "optional": true
45
+ }
46
+ },
38
47
  "keywords": [
39
48
  "posthog",
40
49
  "stats",
@@ -73,6 +82,11 @@
73
82
  "require": "./dist/entrypoints/index.edge.js",
74
83
  "default": "./dist/entrypoints/index.edge.js"
75
84
  },
85
+ "./nestjs": {
86
+ "types": "./dist/entrypoints/nestjs.d.ts",
87
+ "import": "./dist/entrypoints/nestjs.mjs",
88
+ "require": "./dist/entrypoints/nestjs.js"
89
+ },
76
90
  "./experimental": {
77
91
  "types": "./dist/experimental.d.ts"
78
92
  }
@@ -0,0 +1 @@
1
+ export * from '../extensions/nestjs'
@@ -1082,6 +1082,45 @@ function matchProperty(
1082
1082
  }
1083
1083
  return overrideDate > parsedDate
1084
1084
  }
1085
+ case 'semver_eq': {
1086
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)))
1087
+ return cmp === 0
1088
+ }
1089
+ case 'semver_neq': {
1090
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)))
1091
+ return cmp !== 0
1092
+ }
1093
+ case 'semver_gt': {
1094
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)))
1095
+ return cmp > 0
1096
+ }
1097
+ case 'semver_gte': {
1098
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)))
1099
+ return cmp >= 0
1100
+ }
1101
+ case 'semver_lt': {
1102
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)))
1103
+ return cmp < 0
1104
+ }
1105
+ case 'semver_lte': {
1106
+ const cmp = compareSemverTuples(parseSemver(String(overrideValue)), parseSemver(String(value)))
1107
+ return cmp <= 0
1108
+ }
1109
+ case 'semver_tilde': {
1110
+ const overrideParsed = parseSemver(String(overrideValue))
1111
+ const { lower, upper } = computeTildeBounds(String(value))
1112
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0
1113
+ }
1114
+ case 'semver_caret': {
1115
+ const overrideParsed = parseSemver(String(overrideValue))
1116
+ const { lower, upper } = computeCaretBounds(String(value))
1117
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0
1118
+ }
1119
+ case 'semver_wildcard': {
1120
+ const overrideParsed = parseSemver(String(overrideValue))
1121
+ const { lower, upper } = computeWildcardBounds(String(value))
1122
+ return compareSemverTuples(overrideParsed, lower) >= 0 && compareSemverTuples(overrideParsed, upper) < 0
1123
+ }
1085
1124
  default:
1086
1125
  throw new InconclusiveMatchError(`Unknown operator: ${operator}`)
1087
1126
  }
@@ -1233,6 +1272,132 @@ function isValidRegex(regex: string): boolean {
1233
1272
  }
1234
1273
  }
1235
1274
 
1275
+ type SemverTuple = [number, number, number]
1276
+
1277
+ /**
1278
+ * Parse a version string into a [major, minor, patch] tuple.
1279
+ * - Strips leading/trailing whitespace
1280
+ * - Strips 'v' or 'V' prefix
1281
+ * - Strips pre-release and build metadata (-alpha, +build)
1282
+ * - Defaults missing components to 0
1283
+ * - Ignores extra components beyond the third
1284
+ * - Throws InconclusiveMatchError for invalid input
1285
+ */
1286
+ function parseSemver(value: string): SemverTuple {
1287
+ const text = String(value).trim().replace(/^[vV]/, '')
1288
+
1289
+ // Strip pre-release and build metadata
1290
+ const baseVersion = text.split('-')[0].split('+')[0]
1291
+
1292
+ if (!baseVersion || baseVersion.startsWith('.')) {
1293
+ throw new InconclusiveMatchError(`Invalid semver: ${value}`)
1294
+ }
1295
+
1296
+ const parts = baseVersion.split('.')
1297
+
1298
+ const parsePart = (part: string | undefined): number => {
1299
+ if (part === undefined || part === '') {
1300
+ return 0
1301
+ }
1302
+ if (!/^\d+$/.test(part)) {
1303
+ throw new InconclusiveMatchError(`Invalid semver: ${value}`)
1304
+ }
1305
+ return parseInt(part, 10)
1306
+ }
1307
+
1308
+ const major = parsePart(parts[0])
1309
+ const minor = parsePart(parts[1])
1310
+ const patch = parsePart(parts[2])
1311
+
1312
+ return [major, minor, patch]
1313
+ }
1314
+
1315
+ /**
1316
+ * Compare two semver tuples.
1317
+ * Returns -1 if a < b, 0 if a == b, 1 if a > b
1318
+ */
1319
+ function compareSemverTuples(a: SemverTuple, b: SemverTuple): number {
1320
+ for (let i = 0; i < 3; i++) {
1321
+ if (a[i] < b[i]) return -1
1322
+ if (a[i] > b[i]) return 1
1323
+ }
1324
+ return 0
1325
+ }
1326
+
1327
+ /**
1328
+ * Compute bounds for tilde operator: ~X.Y.Z means >=X.Y.Z and <X.(Y+1).0
1329
+ */
1330
+ function computeTildeBounds(value: string): { lower: SemverTuple; upper: SemverTuple } {
1331
+ const parsed = parseSemver(value)
1332
+ const lower: SemverTuple = [parsed[0], parsed[1], parsed[2]]
1333
+ const upper: SemverTuple = [parsed[0], parsed[1] + 1, 0]
1334
+ return { lower, upper }
1335
+ }
1336
+
1337
+ /**
1338
+ * Compute bounds for caret operator:
1339
+ * - ^X.Y.Z where X > 0: >=X.Y.Z <(X+1).0.0
1340
+ * - ^0.Y.Z where Y > 0: >=0.Y.Z <0.(Y+1).0
1341
+ * - ^0.0.Z: >=0.0.Z <0.0.(Z+1)
1342
+ */
1343
+ function computeCaretBounds(value: string): { lower: SemverTuple; upper: SemverTuple } {
1344
+ const parsed = parseSemver(value)
1345
+ const [major, minor, patch] = parsed
1346
+ const lower: SemverTuple = [major, minor, patch]
1347
+
1348
+ let upper: SemverTuple
1349
+ if (major > 0) {
1350
+ upper = [major + 1, 0, 0]
1351
+ } else if (minor > 0) {
1352
+ upper = [0, minor + 1, 0]
1353
+ } else {
1354
+ upper = [0, 0, patch + 1]
1355
+ }
1356
+
1357
+ return { lower, upper }
1358
+ }
1359
+
1360
+ /**
1361
+ * Compute bounds for wildcard operator:
1362
+ * - "X.*" or "X" with wildcard: >=X.0.0 <(X+1).0.0
1363
+ * - "X.Y.*": >=X.Y.0 <X.(Y+1).0
1364
+ */
1365
+ function computeWildcardBounds(value: string): { lower: SemverTuple; upper: SemverTuple } {
1366
+ const text = String(value).trim().replace(/^[vV]/, '')
1367
+
1368
+ // Remove trailing .* or *
1369
+ const cleanedText = text.replace(/\.\*$/, '').replace(/\*$/, '')
1370
+
1371
+ if (!cleanedText) {
1372
+ throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`)
1373
+ }
1374
+
1375
+ const parts = cleanedText.split('.')
1376
+ const major = parseInt(parts[0], 10)
1377
+ if (isNaN(major)) {
1378
+ throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`)
1379
+ }
1380
+
1381
+ let lower: SemverTuple
1382
+ let upper: SemverTuple
1383
+
1384
+ if (parts.length === 1) {
1385
+ // X.* pattern
1386
+ lower = [major, 0, 0]
1387
+ upper = [major + 1, 0, 0]
1388
+ } else {
1389
+ // X.Y.* pattern
1390
+ const minor = parseInt(parts[1], 10)
1391
+ if (isNaN(minor)) {
1392
+ throw new InconclusiveMatchError(`Invalid wildcard semver: ${value}`)
1393
+ }
1394
+ lower = [major, minor, 0]
1395
+ upper = [major, minor + 1, 0]
1396
+ }
1397
+
1398
+ return { lower, upper }
1399
+ }
1400
+
1236
1401
  function convertToDateTime(value: FlagPropertyValue | Date): Date {
1237
1402
  if (value instanceof Date) {
1238
1403
  return value
@@ -1288,6 +1453,7 @@ export {
1288
1453
  FeatureFlagsPoller,
1289
1454
  matchProperty,
1290
1455
  relativeDateParseForFeatureFlagMatching,
1456
+ parseSemver,
1291
1457
  InconclusiveMatchError,
1292
1458
  RequiresServerEvaluation,
1293
1459
  ClientError,
@@ -0,0 +1,118 @@
1
+ import { Observable, throwError } from 'rxjs'
2
+ import { catchError } from 'rxjs/operators'
3
+
4
+ import ErrorTracking from './error-tracking'
5
+ import { PostHogBackendClient } from '../client'
6
+
7
+ // Local interfaces to avoid runtime dependency on @nestjs/common
8
+ interface HttpArgumentsHost {
9
+ getRequest<T = any>(): T
10
+ getResponse<T = any>(): T
11
+ }
12
+
13
+ interface ExecutionContext {
14
+ switchToHttp(): HttpArgumentsHost
15
+ }
16
+
17
+ interface CallHandler<T = any> {
18
+ handle(): Observable<T>
19
+ }
20
+
21
+ interface NestInterceptor<T = any, R = any> {
22
+ intercept(context: ExecutionContext, next: CallHandler<T>): Observable<R>
23
+ }
24
+
25
+ export interface ExceptionCaptureOptions {
26
+ /** Minimum HTTP status code to capture. Exceptions with a lower status (e.g. 4xx) are skipped. @default 500 */
27
+ minStatusToCapture?: number
28
+ }
29
+
30
+ export interface PostHogInterceptorOptions {
31
+ /** Enable exception capture. Pass `true` for defaults or an object to configure. @default false */
32
+ captureExceptions?: boolean | ExceptionCaptureOptions
33
+ }
34
+
35
+ function getClientIp(headers: Record<string, any>, request: any): string | undefined {
36
+ const forwarded = headers['x-forwarded-for']
37
+ if (forwarded) {
38
+ const ip = String(forwarded).split(',')[0].trim()
39
+ if (ip) return ip
40
+ }
41
+ return request?.socket?.remoteAddress
42
+ }
43
+
44
+ function getExceptionStatus(exception: unknown): number | undefined {
45
+ if (
46
+ exception &&
47
+ typeof exception === 'object' &&
48
+ 'getStatus' in exception &&
49
+ typeof (exception as any).getStatus === 'function'
50
+ ) {
51
+ const status = (exception as any).getStatus()
52
+ return typeof status === 'number' ? status : undefined
53
+ }
54
+ return undefined
55
+ }
56
+
57
+ export class PostHogInterceptor implements NestInterceptor {
58
+ private posthog: PostHogBackendClient
59
+ private captureExceptions: boolean
60
+ private minStatusToCapture: number
61
+
62
+ constructor(posthog: PostHogBackendClient, options?: PostHogInterceptorOptions) {
63
+ this.posthog = posthog
64
+ const capture = options?.captureExceptions
65
+ this.captureExceptions = !!capture
66
+ this.minStatusToCapture = (typeof capture === 'object' ? capture.minStatusToCapture : undefined) ?? 500
67
+ }
68
+
69
+ intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
70
+ const httpHost = context.switchToHttp()
71
+ const request = httpHost.getRequest()
72
+ const response = httpHost.getResponse()
73
+
74
+ const headers = request?.headers ?? {}
75
+ const sessionId: string | undefined = headers['x-posthog-session-id']
76
+ const windowId: string | undefined = headers['x-posthog-window-id']
77
+ const distinctId: string | undefined = headers['x-posthog-distinct-id']
78
+
79
+ const contextData = {
80
+ sessionId,
81
+ distinctId,
82
+ properties: {
83
+ $current_url: request?.url,
84
+ $request_method: request?.method,
85
+ $request_path: request?.path ?? request?.url,
86
+ $window_id: windowId,
87
+ $user_agent: headers['user-agent'],
88
+ $ip: getClientIp(headers, request),
89
+ },
90
+ }
91
+
92
+ // Use enterContext so the context propagates through RxJS Observable
93
+ // subscription and catchError handlers, not just the synchronous callback.
94
+ this.posthog.enterContext(contextData)
95
+
96
+ let source = next.handle()
97
+
98
+ if (this.captureExceptions) {
99
+ source = source.pipe(
100
+ catchError((exception: unknown) => {
101
+ if (ErrorTracking.isPreviouslyCapturedError(exception)) {
102
+ return throwError(() => exception)
103
+ }
104
+ const status = getExceptionStatus(exception)
105
+ if (status !== undefined && status < this.minStatusToCapture) {
106
+ return throwError(() => exception)
107
+ }
108
+ const responseStatus = status ?? response?.statusCode
109
+ const additionalProperties: Record<string, any> | undefined =
110
+ responseStatus !== undefined ? { $response_status_code: responseStatus } : undefined
111
+ this.posthog.captureException(exception, distinctId, additionalProperties)
112
+ return throwError(() => exception)
113
+ })
114
+ )
115
+ }
116
+ return source
117
+ }
118
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.27.0'
1
+ export const version = '5.28.0'