posthog-node 4.4.1 → 4.5.1
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/CHANGELOG.md +13 -0
- package/index.ts +1 -0
- package/lib/index.cjs.js +905 -3
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +43 -3
- package/lib/index.esm.js +905 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-core/src/index.d.ts +6 -0
- package/lib/posthog-node/index.d.ts +1 -0
- package/lib/posthog-node/src/error-tracking.d.ts +12 -0
- package/lib/posthog-node/src/extensions/error-tracking/autocapture.d.ts +3 -0
- package/lib/posthog-node/src/extensions/error-tracking/context-lines.d.ts +4 -0
- package/lib/posthog-node/src/extensions/error-tracking/error-conversion.d.ts +5 -0
- package/lib/posthog-node/src/extensions/error-tracking/reduceable-cache.d.ts +12 -0
- package/lib/posthog-node/src/extensions/error-tracking/stack-trace.d.ts +15 -0
- package/lib/posthog-node/src/extensions/error-tracking/type-checking.d.ts +7 -0
- package/lib/posthog-node/src/extensions/error-tracking/types.d.ts +57 -0
- package/lib/posthog-node/src/extensions/express.d.ts +17 -0
- package/lib/posthog-node/src/extensions/sentry-integration.d.ts +1 -2
- package/lib/posthog-node/src/posthog-node.d.ts +4 -0
- package/lib/posthog-node/src/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/error-tracking.ts +67 -0
- package/src/extensions/error-tracking/autocapture.ts +62 -0
- package/src/extensions/error-tracking/context-lines.ts +389 -0
- package/src/extensions/error-tracking/error-conversion.ts +250 -0
- package/src/extensions/error-tracking/reduceable-cache.ts +36 -0
- package/src/extensions/error-tracking/stack-trace.ts +269 -0
- package/src/extensions/error-tracking/type-checking.ts +37 -0
- package/src/extensions/error-tracking/types.ts +62 -0
- package/src/extensions/express.ts +37 -0
- package/src/extensions/sentry-integration.ts +1 -3
- package/src/posthog-node.ts +9 -0
- package/src/types.ts +1 -0
- package/test/feature-flags.spec.ts +2 -40
- package/test/posthog-node.spec.ts +0 -3
|
@@ -31,7 +31,6 @@ describe('local evaluation', () => {
|
|
|
31
31
|
id: 1,
|
|
32
32
|
name: 'Beta Feature',
|
|
33
33
|
key: 'person-flag',
|
|
34
|
-
is_simple_flag: true,
|
|
35
34
|
active: true,
|
|
36
35
|
filters: {
|
|
37
36
|
groups: [
|
|
@@ -99,7 +98,6 @@ describe('local evaluation', () => {
|
|
|
99
98
|
id: 1,
|
|
100
99
|
name: 'Beta Feature',
|
|
101
100
|
key: 'person-flag',
|
|
102
|
-
is_simple_flag: true,
|
|
103
101
|
active: true,
|
|
104
102
|
filters: {
|
|
105
103
|
groups: [
|
|
@@ -143,7 +141,6 @@ describe('local evaluation', () => {
|
|
|
143
141
|
id: 1,
|
|
144
142
|
name: 'Beta Feature',
|
|
145
143
|
key: 'group-flag',
|
|
146
|
-
is_simple_flag: true,
|
|
147
144
|
active: true,
|
|
148
145
|
filters: {
|
|
149
146
|
aggregation_group_type_index: 0,
|
|
@@ -222,7 +219,6 @@ describe('local evaluation', () => {
|
|
|
222
219
|
id: 1,
|
|
223
220
|
name: 'Beta Feature',
|
|
224
221
|
key: 'group-flag',
|
|
225
|
-
is_simple_flag: true,
|
|
226
222
|
active: true,
|
|
227
223
|
filters: {
|
|
228
224
|
aggregation_group_type_index: 0,
|
|
@@ -271,7 +267,6 @@ describe('local evaluation', () => {
|
|
|
271
267
|
id: 1,
|
|
272
268
|
name: 'Beta Feature',
|
|
273
269
|
key: 'complex-flag',
|
|
274
|
-
is_simple_flag: false,
|
|
275
270
|
active: true,
|
|
276
271
|
filters: {
|
|
277
272
|
groups: [
|
|
@@ -547,7 +542,6 @@ describe('local evaluation', () => {
|
|
|
547
542
|
id: 1,
|
|
548
543
|
name: 'Beta Feature',
|
|
549
544
|
key: 'beta-feature',
|
|
550
|
-
is_simple_flag: true,
|
|
551
545
|
active: true,
|
|
552
546
|
filters: {
|
|
553
547
|
groups: [
|
|
@@ -586,7 +580,6 @@ describe('local evaluation', () => {
|
|
|
586
580
|
id: 1,
|
|
587
581
|
name: 'Beta Feature',
|
|
588
582
|
key: 'beta-feature',
|
|
589
|
-
is_simple_flag: true,
|
|
590
583
|
active: true,
|
|
591
584
|
filters: {
|
|
592
585
|
groups: [
|
|
@@ -629,7 +622,6 @@ describe('local evaluation', () => {
|
|
|
629
622
|
id: 1,
|
|
630
623
|
name: 'Beta Feature',
|
|
631
624
|
key: 'beta-feature',
|
|
632
|
-
is_simple_flag: true,
|
|
633
625
|
active: true,
|
|
634
626
|
ensure_experience_continuity: true,
|
|
635
627
|
filters: {
|
|
@@ -665,7 +657,6 @@ describe('local evaluation', () => {
|
|
|
665
657
|
id: 1,
|
|
666
658
|
name: 'Beta Feature',
|
|
667
659
|
key: 'beta-feature',
|
|
668
|
-
is_simple_flag: false,
|
|
669
660
|
active: true,
|
|
670
661
|
rollout_percentage: 100,
|
|
671
662
|
filters: {
|
|
@@ -681,7 +672,6 @@ describe('local evaluation', () => {
|
|
|
681
672
|
id: 2,
|
|
682
673
|
name: 'Beta Feature',
|
|
683
674
|
key: 'disabled-feature',
|
|
684
|
-
is_simple_flag: false,
|
|
685
675
|
active: true,
|
|
686
676
|
filters: {
|
|
687
677
|
groups: [
|
|
@@ -696,7 +686,6 @@ describe('local evaluation', () => {
|
|
|
696
686
|
id: 3,
|
|
697
687
|
name: 'Beta Feature',
|
|
698
688
|
key: 'beta-feature2',
|
|
699
|
-
is_simple_flag: false,
|
|
700
689
|
active: true,
|
|
701
690
|
filters: {
|
|
702
691
|
groups: [
|
|
@@ -739,7 +728,6 @@ describe('local evaluation', () => {
|
|
|
739
728
|
id: 1,
|
|
740
729
|
name: 'Beta Feature',
|
|
741
730
|
key: 'beta-feature',
|
|
742
|
-
is_simple_flag: false,
|
|
743
731
|
active: true,
|
|
744
732
|
rollout_percentage: 100,
|
|
745
733
|
filters: {
|
|
@@ -758,7 +746,6 @@ describe('local evaluation', () => {
|
|
|
758
746
|
id: 2,
|
|
759
747
|
name: 'Beta Feature',
|
|
760
748
|
key: 'disabled-feature',
|
|
761
|
-
is_simple_flag: false,
|
|
762
749
|
active: true,
|
|
763
750
|
filters: {
|
|
764
751
|
groups: [
|
|
@@ -776,7 +763,6 @@ describe('local evaluation', () => {
|
|
|
776
763
|
id: 3,
|
|
777
764
|
name: 'Beta Feature',
|
|
778
765
|
key: 'beta-feature2',
|
|
779
|
-
is_simple_flag: false,
|
|
780
766
|
active: true,
|
|
781
767
|
filters: {
|
|
782
768
|
groups: [
|
|
@@ -822,7 +808,6 @@ describe('local evaluation', () => {
|
|
|
822
808
|
id: 1,
|
|
823
809
|
name: 'Beta Feature',
|
|
824
810
|
key: 'beta-feature',
|
|
825
|
-
is_simple_flag: false,
|
|
826
811
|
active: true,
|
|
827
812
|
rollout_percentage: 100,
|
|
828
813
|
filters: {
|
|
@@ -838,7 +823,6 @@ describe('local evaluation', () => {
|
|
|
838
823
|
id: 2,
|
|
839
824
|
name: 'Beta Feature',
|
|
840
825
|
key: 'disabled-feature',
|
|
841
|
-
is_simple_flag: false,
|
|
842
826
|
active: true,
|
|
843
827
|
filters: {
|
|
844
828
|
groups: [
|
|
@@ -853,7 +837,6 @@ describe('local evaluation', () => {
|
|
|
853
837
|
id: 3,
|
|
854
838
|
name: 'Beta Feature',
|
|
855
839
|
key: 'beta-feature2',
|
|
856
|
-
is_simple_flag: false,
|
|
857
840
|
active: true,
|
|
858
841
|
filters: {
|
|
859
842
|
groups: [
|
|
@@ -894,7 +877,6 @@ describe('local evaluation', () => {
|
|
|
894
877
|
id: 1,
|
|
895
878
|
name: 'Beta Feature',
|
|
896
879
|
key: 'beta-feature',
|
|
897
|
-
is_simple_flag: false,
|
|
898
880
|
active: true,
|
|
899
881
|
rollout_percentage: 100,
|
|
900
882
|
filters: {
|
|
@@ -913,7 +895,6 @@ describe('local evaluation', () => {
|
|
|
913
895
|
id: 2,
|
|
914
896
|
name: 'Beta Feature',
|
|
915
897
|
key: 'disabled-feature',
|
|
916
|
-
is_simple_flag: false,
|
|
917
898
|
active: true,
|
|
918
899
|
filters: {
|
|
919
900
|
groups: [
|
|
@@ -931,7 +912,6 @@ describe('local evaluation', () => {
|
|
|
931
912
|
id: 3,
|
|
932
913
|
name: 'Beta Feature',
|
|
933
914
|
key: 'beta-feature2',
|
|
934
|
-
is_simple_flag: false,
|
|
935
915
|
active: true,
|
|
936
916
|
filters: {
|
|
937
917
|
groups: [
|
|
@@ -1027,7 +1007,6 @@ describe('local evaluation', () => {
|
|
|
1027
1007
|
id: 1,
|
|
1028
1008
|
name: 'Beta Feature',
|
|
1029
1009
|
key: 'beta-feature',
|
|
1030
|
-
is_simple_flag: false,
|
|
1031
1010
|
active: true,
|
|
1032
1011
|
rollout_percentage: 100,
|
|
1033
1012
|
filters: {
|
|
@@ -1043,7 +1022,6 @@ describe('local evaluation', () => {
|
|
|
1043
1022
|
id: 2,
|
|
1044
1023
|
name: 'Beta Feature',
|
|
1045
1024
|
key: 'disabled-feature',
|
|
1046
|
-
is_simple_flag: false,
|
|
1047
1025
|
active: true,
|
|
1048
1026
|
filters: {
|
|
1049
1027
|
groups: [
|
|
@@ -1080,7 +1058,6 @@ describe('local evaluation', () => {
|
|
|
1080
1058
|
id: 1,
|
|
1081
1059
|
name: 'Beta Feature',
|
|
1082
1060
|
key: 'beta-feature',
|
|
1083
|
-
is_simple_flag: false,
|
|
1084
1061
|
active: true,
|
|
1085
1062
|
rollout_percentage: 100,
|
|
1086
1063
|
filters: {
|
|
@@ -1099,7 +1076,6 @@ describe('local evaluation', () => {
|
|
|
1099
1076
|
id: 2,
|
|
1100
1077
|
name: 'Beta Feature',
|
|
1101
1078
|
key: 'disabled-feature',
|
|
1102
|
-
is_simple_flag: false,
|
|
1103
1079
|
active: true,
|
|
1104
1080
|
filters: {
|
|
1105
1081
|
groups: [
|
|
@@ -1139,7 +1115,6 @@ describe('local evaluation', () => {
|
|
|
1139
1115
|
id: 1,
|
|
1140
1116
|
name: 'Beta Feature',
|
|
1141
1117
|
key: 'beta-feature',
|
|
1142
|
-
is_simple_flag: false,
|
|
1143
1118
|
active: true,
|
|
1144
1119
|
rollout_percentage: 100,
|
|
1145
1120
|
filters: {
|
|
@@ -1155,7 +1130,6 @@ describe('local evaluation', () => {
|
|
|
1155
1130
|
id: 2,
|
|
1156
1131
|
name: 'Beta Feature',
|
|
1157
1132
|
key: 'disabled-feature',
|
|
1158
|
-
is_simple_flag: false,
|
|
1159
1133
|
active: true,
|
|
1160
1134
|
filters: {
|
|
1161
1135
|
groups: [
|
|
@@ -1191,7 +1165,6 @@ describe('local evaluation', () => {
|
|
|
1191
1165
|
id: 1,
|
|
1192
1166
|
name: 'Beta Feature',
|
|
1193
1167
|
key: 'beta-feature',
|
|
1194
|
-
is_simple_flag: false,
|
|
1195
1168
|
active: false,
|
|
1196
1169
|
rollout_percentage: 100,
|
|
1197
1170
|
filters: {
|
|
@@ -1207,7 +1180,6 @@ describe('local evaluation', () => {
|
|
|
1207
1180
|
id: 2,
|
|
1208
1181
|
name: 'Beta Feature',
|
|
1209
1182
|
key: 'disabled-feature',
|
|
1210
|
-
is_simple_flag: false,
|
|
1211
1183
|
active: true,
|
|
1212
1184
|
filters: {
|
|
1213
1185
|
groups: [
|
|
@@ -1236,7 +1208,6 @@ describe('local evaluation', () => {
|
|
|
1236
1208
|
id: 1,
|
|
1237
1209
|
name: 'Beta Feature',
|
|
1238
1210
|
key: 'beta-feature',
|
|
1239
|
-
is_simple_flag: false,
|
|
1240
1211
|
active: true,
|
|
1241
1212
|
rollout_percentage: 100,
|
|
1242
1213
|
filters: {
|
|
@@ -1318,7 +1289,6 @@ describe('local evaluation', () => {
|
|
|
1318
1289
|
id: 1,
|
|
1319
1290
|
name: 'Beta Feature',
|
|
1320
1291
|
key: 'beta-feature',
|
|
1321
|
-
is_simple_flag: false,
|
|
1322
1292
|
active: true,
|
|
1323
1293
|
rollout_percentage: 100,
|
|
1324
1294
|
filters: {
|
|
@@ -1409,7 +1379,6 @@ describe('local evaluation', () => {
|
|
|
1409
1379
|
id: 1,
|
|
1410
1380
|
name: 'Beta Feature',
|
|
1411
1381
|
key: 'beta-feature',
|
|
1412
|
-
is_simple_flag: true,
|
|
1413
1382
|
active: true,
|
|
1414
1383
|
filters: {
|
|
1415
1384
|
groups: [
|
|
@@ -1478,7 +1447,6 @@ describe('local evaluation', () => {
|
|
|
1478
1447
|
id: 1,
|
|
1479
1448
|
name: 'Beta Feature',
|
|
1480
1449
|
key: 'beta-feature',
|
|
1481
|
-
is_simple_flag: true,
|
|
1482
1450
|
active: true,
|
|
1483
1451
|
filters: {
|
|
1484
1452
|
groups: [
|
|
@@ -1563,7 +1531,6 @@ describe('local evaluation', () => {
|
|
|
1563
1531
|
id: 1,
|
|
1564
1532
|
name: 'Beta Feature',
|
|
1565
1533
|
key: 'beta-feature',
|
|
1566
|
-
is_simple_flag: true,
|
|
1567
1534
|
active: true,
|
|
1568
1535
|
filters: {
|
|
1569
1536
|
groups: [
|
|
@@ -1632,7 +1599,6 @@ describe('local evaluation', () => {
|
|
|
1632
1599
|
id: 1,
|
|
1633
1600
|
name: 'Beta Feature',
|
|
1634
1601
|
key: 'beta-feature',
|
|
1635
|
-
is_simple_flag: true,
|
|
1636
1602
|
active: true,
|
|
1637
1603
|
filters: {
|
|
1638
1604
|
groups: [
|
|
@@ -1706,7 +1672,6 @@ describe('local evaluation', () => {
|
|
|
1706
1672
|
id: 1,
|
|
1707
1673
|
name: 'Beta Feature',
|
|
1708
1674
|
key: 'person-flag',
|
|
1709
|
-
is_simple_flag: true,
|
|
1710
1675
|
active: true,
|
|
1711
1676
|
filters: {
|
|
1712
1677
|
groups: [
|
|
@@ -1765,7 +1730,6 @@ describe('local evaluation', () => {
|
|
|
1765
1730
|
id: 1,
|
|
1766
1731
|
name: 'Beta Feature',
|
|
1767
1732
|
key: 'beta-feature',
|
|
1768
|
-
is_simple_flag: true,
|
|
1769
1733
|
active: true,
|
|
1770
1734
|
filters: {
|
|
1771
1735
|
groups: [
|
|
@@ -2073,8 +2037,8 @@ describe('match properties', () => {
|
|
|
2073
2037
|
['is_date_after', '1h', new Date('2022-05-30'), true],
|
|
2074
2038
|
['is_date_after', '1h', '2022-04-30', false],
|
|
2075
2039
|
// # Try all possible relative dates
|
|
2076
|
-
['is_date_before', '1h', '2022-05-01 00:00:00', false],
|
|
2077
|
-
['is_date_before', '1h', '2022-04-30 22:00:00', true],
|
|
2040
|
+
['is_date_before', '1h', '2022-05-01 00:00:00 GMT', false],
|
|
2041
|
+
['is_date_before', '1h', '2022-04-30 22:00:00 GMT', true],
|
|
2078
2042
|
['is_date_before', '-1d', '2022-04-29 23:59:00 GMT', true],
|
|
2079
2043
|
['is_date_before', '-1d', '2022-04-30 00:00:01 GMT', false],
|
|
2080
2044
|
['is_date_before', '1w', '2022-04-23 00:00:00 GMT', true],
|
|
@@ -2357,7 +2321,6 @@ describe('consistency tests', () => {
|
|
|
2357
2321
|
name: '',
|
|
2358
2322
|
key: 'simple-flag',
|
|
2359
2323
|
active: true,
|
|
2360
|
-
is_simple_flag: false,
|
|
2361
2324
|
filters: {
|
|
2362
2325
|
groups: [{ properties: [], rollout_percentage: 45 }],
|
|
2363
2326
|
},
|
|
@@ -3390,7 +3353,6 @@ describe('consistency tests', () => {
|
|
|
3390
3353
|
id: 1,
|
|
3391
3354
|
name: 'Beta Feature',
|
|
3392
3355
|
key: 'multivariate-flag',
|
|
3393
|
-
is_simple_flag: false,
|
|
3394
3356
|
active: true,
|
|
3395
3357
|
filters: {
|
|
3396
3358
|
groups: [{ properties: [], rollout_percentage: 55 }],
|
|
@@ -506,7 +506,6 @@ describe('PostHog Node.js', () => {
|
|
|
506
506
|
id: 1,
|
|
507
507
|
name: 'Beta Feature',
|
|
508
508
|
key: 'beta-feature-local',
|
|
509
|
-
is_simple_flag: false,
|
|
510
509
|
active: true,
|
|
511
510
|
rollout_percentage: 100,
|
|
512
511
|
filters: {
|
|
@@ -533,7 +532,6 @@ describe('PostHog Node.js', () => {
|
|
|
533
532
|
id: 1,
|
|
534
533
|
name: 'Beta Feature',
|
|
535
534
|
key: 'person-flag',
|
|
536
|
-
is_simple_flag: true,
|
|
537
535
|
active: true,
|
|
538
536
|
filters: {
|
|
539
537
|
groups: [
|
|
@@ -556,7 +554,6 @@ describe('PostHog Node.js', () => {
|
|
|
556
554
|
id: 1,
|
|
557
555
|
name: 'Beta Feature',
|
|
558
556
|
key: 'false-flag',
|
|
559
|
-
is_simple_flag: true,
|
|
560
557
|
active: true,
|
|
561
558
|
filters: {
|
|
562
559
|
groups: [
|