pcm-agents 0.6.86-beta.0 → 0.6.86-beta.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.
- package/dist/cjs/{app-globals-BS7h0Qoe.js → app-globals-BIO4q6tX.js} +1500 -831
- package/dist/cjs/{app-globals-BS7h0Qoe.js.map → app-globals-BIO4q6tX.js.map} +1 -1
- package/dist/cjs/components-position-selector.cjs.entry.js +183 -295
- package/dist/cjs/components-position-selector.cjs.entry.js.map +1 -1
- package/dist/cjs/components-position-selector.entry.cjs.js.map +1 -1
- package/dist/cjs/error-event-J_ZWIqWF.js +33 -0
- package/dist/cjs/{error-event-B2Fp3oSo.js.map → error-event-J_ZWIqWF.js.map} +1 -1
- package/dist/cjs/{exports-DrFTdXnx.js → exports-Dc-pQh4A.js} +700 -489
- package/dist/{esm/exports-CbwtUF7x.js.map → cjs/exports-Dc-pQh4A.js.map} +1 -1
- package/dist/cjs/index-B1A0m21n.js +1020 -0
- package/dist/cjs/{index-B64QE0Jj.js.map → index-B1A0m21n.js.map} +1 -1
- package/dist/cjs/{index-BALaxcxh.js → index-C_qhED9Z.js} +181 -130
- package/dist/{esm/index-lvKa9zRI.js.map → cjs/index-C_qhED9Z.js.map} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{message-utils-BJ2aSRtw.js → message-utils-CBcfjLxY.js} +10 -10
- package/dist/cjs/{message-utils-BJ2aSRtw.js.map → message-utils-CBcfjLxY.js.map} +1 -1
- package/dist/cjs/message.service-DGUsA-FY.js +135 -0
- package/dist/cjs/{message.service-Bv0EySlM.js.map → message.service-DGUsA-FY.js.map} +1 -1
- package/dist/cjs/oem-htws-modal.cjs.entry.js +229 -317
- package/dist/cjs/oem-htws-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-htws-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-jd-modal.cjs.entry.js +384 -565
- package/dist/cjs/oem-jd-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-jd-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-jlpp-modal.cjs.entry.js +264 -389
- package/dist/cjs/oem-jlpp-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-jlpp-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-jlsx-modal.cjs.entry.js +985 -1397
- package/dist/cjs/oem-jlsx-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-jlsx-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-jlzz-modal.cjs.entry.js +211 -316
- package/dist/cjs/oem-jlzz-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-jlzz-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-mnct-modal.cjs.entry.js +183 -322
- package/dist/cjs/oem-mnct-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-mnct-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-mnms-modal.cjs.entry.js +292 -436
- package/dist/cjs/oem-mnms-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-mnms-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-qgqjl-modal.cjs.entry.js +241 -359
- package/dist/cjs/oem-qgqjl-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/oem-qgqjl-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/oem-zygh-modal_30.cjs.entry.js +12467 -15775
- package/dist/cjs/oem-zygh-modal_30.cjs.entry.js.map +1 -1
- package/dist/cjs/pcm-agents.cjs.js +3 -3
- package/dist/cjs/pcm-agents.cjs.js.map +1 -1
- package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js +1159 -1296
- package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/pcm-hr-chat-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/sentry-reporter-XrcGgvTL.js +72 -0
- package/dist/cjs/{sentry-reporter-ezGHpb9e.js.map → sentry-reporter-XrcGgvTL.js.map} +1 -1
- package/dist/components/components-position-selector.js +1 -1
- package/dist/components/index.js +1500 -831
- package/dist/components/index.js.map +1 -1
- package/dist/components/oem-htws-modal.js +311 -403
- package/dist/components/oem-htws-modal.js.map +1 -1
- package/dist/components/oem-jd-modal.js +456 -641
- package/dist/components/oem-jd-modal.js.map +1 -1
- package/dist/components/oem-jlpp-modal.js +361 -490
- package/dist/components/oem-jlpp-modal.js.map +1 -1
- package/dist/components/oem-jlsx-modal.js +1083 -1499
- package/dist/components/oem-jlsx-modal.js.map +1 -1
- package/dist/components/oem-jlzz-modal.js +292 -401
- package/dist/components/oem-jlzz-modal.js.map +1 -1
- package/dist/components/oem-mnct-modal.js +276 -419
- package/dist/components/oem-mnct-modal.js.map +1 -1
- package/dist/components/oem-mnms-modal.js +411 -559
- package/dist/components/oem-mnms-modal.js.map +1 -1
- package/dist/components/oem-qgqjl-modal.js +336 -458
- package/dist/components/oem-qgqjl-modal.js.map +1 -1
- package/dist/components/oem-zygh-modal.js +361 -555
- package/dist/components/oem-zygh-modal.js.map +1 -1
- package/dist/components/p-0JWThH-A.js +168 -0
- package/dist/components/p-0JWThH-A.js.map +1 -0
- package/dist/components/{p-DeouNi8D.js → p-75J0r72D.js} +700 -489
- package/dist/components/p-75J0r72D.js.map +1 -0
- package/dist/components/p-B8NQWvez.js +1905 -0
- package/dist/components/p-B8NQWvez.js.map +1 -0
- package/dist/components/p-BJIcD_kz.js +330 -0
- package/dist/components/p-BJIcD_kz.js.map +1 -0
- package/dist/components/p-B_-12Bju.js +205 -0
- package/dist/components/p-B_-12Bju.js.map +1 -0
- package/dist/components/{p-ByArCPFr.js → p-B_ZKpuYC.js} +212 -328
- package/dist/components/p-B_ZKpuYC.js.map +1 -0
- package/dist/components/p-Bbm22T75.js +306 -0
- package/dist/components/p-Bbm22T75.js.map +1 -0
- package/dist/components/p-C0FYX2-Z.js +31 -0
- package/dist/components/p-C0FYX2-Z.js.map +1 -0
- package/dist/components/p-C3FY3SHt.js +746 -0
- package/dist/components/p-C3FY3SHt.js.map +1 -0
- package/dist/components/p-CJK3cNTI.js +24 -0
- package/dist/components/p-CJK3cNTI.js.map +1 -0
- package/dist/components/{p-HnRt0cWe.js → p-CR7WLzmM.js} +154 -112
- package/dist/components/p-CR7WLzmM.js.map +1 -0
- package/dist/components/{p-CATZrAYZ.js → p-CpY0xzdn.js} +183 -240
- package/dist/components/p-CpY0xzdn.js.map +1 -0
- package/dist/components/p-D-vhTSlS.js +99 -0
- package/dist/components/p-D-vhTSlS.js.map +1 -0
- package/dist/components/{p-Bt9SwMfw.js → p-D483moFs.js} +1034 -475
- package/dist/components/p-D483moFs.js.map +1 -0
- package/dist/components/p-DC-AWTHS.js +70 -0
- package/dist/components/p-DC-AWTHS.js.map +1 -0
- package/dist/components/p-DLDIBc1-.js +208 -0
- package/dist/components/p-DLDIBc1-.js.map +1 -0
- package/dist/components/p-DQckibIl.js +1456 -0
- package/dist/components/p-DQckibIl.js.map +1 -0
- package/dist/components/{p-CcNLPdAv.js → p-DUQ46MUh.js} +53 -55
- package/dist/components/p-DUQ46MUh.js.map +1 -0
- package/dist/components/p-DXVhHj6-.js +133 -0
- package/dist/components/p-DXVhHj6-.js.map +1 -0
- package/dist/components/p-DzqMh2ni.js +104 -0
- package/dist/components/{p-BWbqJ4aU.js.map → p-DzqMh2ni.js.map} +1 -1
- package/dist/components/p-GjqKp3Rm.js +2327 -0
- package/dist/components/p-GjqKp3Rm.js.map +1 -0
- package/dist/components/{p-BLoTs7ge.js → p-uR_I1CM1.js} +200 -264
- package/dist/components/p-uR_I1CM1.js.map +1 -0
- package/dist/components/pcm-1zhanshi-mnms-modal.js +222 -280
- package/dist/components/pcm-1zhanshi-mnms-modal.js.map +1 -1
- package/dist/components/pcm-app-chat-modal.js +1 -1
- package/dist/components/pcm-ats-mnms-modal.js +220 -275
- package/dist/components/pcm-ats-mnms-modal.js.map +1 -1
- package/dist/components/pcm-button.js +77 -99
- package/dist/components/pcm-button.js.map +1 -1
- package/dist/components/pcm-card.js +139 -205
- package/dist/components/pcm-card.js.map +1 -1
- package/dist/components/pcm-chat-message.js +1 -1
- package/dist/components/pcm-confirm-modal.js +1 -1
- package/dist/components/pcm-digital-human.js +1 -1
- package/dist/components/pcm-drawer.js +1 -1
- package/dist/components/pcm-export-records-modal.js +1 -1
- package/dist/components/pcm-hr-chat-modal.js +1236 -1377
- package/dist/components/pcm-hr-chat-modal.js.map +1 -1
- package/dist/components/pcm-htws-modal.js +306 -457
- package/dist/components/pcm-htws-modal.js.map +1 -1
- package/dist/components/pcm-hyzj-modal.js +320 -451
- package/dist/components/pcm-hyzj-modal.js.map +1 -1
- package/dist/components/pcm-jd-modal.js +539 -777
- package/dist/components/pcm-jd-modal.js.map +1 -1
- package/dist/components/pcm-jlpp-modal.js +302 -434
- package/dist/components/pcm-jlpp-modal.js.map +1 -1
- package/dist/components/pcm-jlsx-modal.js +1067 -1534
- package/dist/components/pcm-jlsx-modal.js.map +1 -1
- package/dist/components/pcm-jlzz-modal.js +464 -601
- package/dist/components/pcm-jlzz-modal.js.map +1 -1
- package/dist/components/pcm-message.js +1 -1
- package/dist/components/pcm-mnct-modal.js +321 -485
- package/dist/components/pcm-mnct-modal.js.map +1 -1
- package/dist/components/pcm-mnms-modal.js +294 -393
- package/dist/components/pcm-mnms-modal.js.map +1 -1
- package/dist/components/pcm-mnms-zp-modal.js +294 -393
- package/dist/components/pcm-mnms-zp-modal.js.map +1 -1
- package/dist/components/pcm-mobile-input-btn.js +1 -1
- package/dist/components/pcm-mobile-upload-btn.js +1 -1
- package/dist/components/pcm-msbg-modal.js +340 -482
- package/dist/components/pcm-msbg-modal.js.map +1 -1
- package/dist/components/pcm-qgqjl-modal.js +375 -523
- package/dist/components/pcm-qgqjl-modal.js.map +1 -1
- package/dist/components/pcm-upload.js +1 -1
- package/dist/components/pcm-virtual-chat-modal.js +1 -1
- package/dist/components/pcm-zsk-chat-modal.js +825 -998
- package/dist/components/pcm-zsk-chat-modal.js.map +1 -1
- package/dist/components/pcm-zygh-modal.js +294 -438
- package/dist/components/pcm-zygh-modal.js.map +1 -1
- package/dist/components/pcm-zygh-v2-modal.js +321 -546
- package/dist/components/pcm-zygh-v2-modal.js.map +1 -1
- package/dist/esm/{app-globals-CvQgBw1q.js → app-globals-Chti62re.js} +1500 -831
- package/dist/esm/{app-globals-CvQgBw1q.js.map → app-globals-Chti62re.js.map} +1 -1
- package/dist/esm/components-position-selector.entry.js +183 -295
- package/dist/esm/components-position-selector.entry.js.map +1 -1
- package/dist/esm/error-event-C0FYX2-Z.js +31 -0
- package/dist/esm/{error-event-Bsxbxc9E.js.map → error-event-C0FYX2-Z.js.map} +1 -1
- package/dist/esm/{exports-CbwtUF7x.js → exports-Bs-zO1WZ.js} +700 -489
- package/dist/{cjs/exports-DrFTdXnx.js.map → esm/exports-Bs-zO1WZ.js.map} +1 -1
- package/dist/esm/{index-lvKa9zRI.js → index-Bq0K-WqZ.js} +181 -130
- package/dist/{cjs/index-BALaxcxh.js.map → esm/index-Bq0K-WqZ.js.map} +1 -1
- package/dist/esm/index-iFBeCeUK.js +999 -0
- package/dist/esm/{index-BYBFz3an.js.map → index-iFBeCeUK.js.map} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{message-utils-DPUjSCZg.js → message-utils-BIp-Cjpg.js} +10 -10
- package/dist/esm/{message-utils-DPUjSCZg.js.map → message-utils-BIp-Cjpg.js.map} +1 -1
- package/dist/esm/message.service-DXVhHj6-.js +133 -0
- package/dist/esm/{message.service-DwejcEGX.js.map → message.service-DXVhHj6-.js.map} +1 -1
- package/dist/esm/oem-htws-modal.entry.js +229 -317
- package/dist/esm/oem-htws-modal.entry.js.map +1 -1
- package/dist/esm/oem-jd-modal.entry.js +384 -565
- package/dist/esm/oem-jd-modal.entry.js.map +1 -1
- package/dist/esm/oem-jlpp-modal.entry.js +264 -389
- package/dist/esm/oem-jlpp-modal.entry.js.map +1 -1
- package/dist/esm/oem-jlsx-modal.entry.js +985 -1397
- package/dist/esm/oem-jlsx-modal.entry.js.map +1 -1
- package/dist/esm/oem-jlzz-modal.entry.js +211 -316
- package/dist/esm/oem-jlzz-modal.entry.js.map +1 -1
- package/dist/esm/oem-mnct-modal.entry.js +183 -322
- package/dist/esm/oem-mnct-modal.entry.js.map +1 -1
- package/dist/esm/oem-mnms-modal.entry.js +292 -436
- package/dist/esm/oem-mnms-modal.entry.js.map +1 -1
- package/dist/esm/oem-qgqjl-modal.entry.js +241 -359
- package/dist/esm/oem-qgqjl-modal.entry.js.map +1 -1
- package/dist/esm/oem-zygh-modal_30.entry.js +12426 -15734
- package/dist/esm/oem-zygh-modal_30.entry.js.map +1 -1
- package/dist/esm/pcm-agents.js +4 -4
- package/dist/esm/pcm-agents.js.map +1 -1
- package/dist/esm/pcm-hr-chat-modal.entry.js +1159 -1296
- package/dist/esm/pcm-hr-chat-modal.entry.js.map +1 -1
- package/dist/esm/sentry-reporter-CFwRC_Cr.js +70 -0
- package/dist/esm/{sentry-reporter-CDb7zepi.js.map → sentry-reporter-CFwRC_Cr.js.map} +1 -1
- package/dist/pcm-agents/components-position-selector.entry.esm.js.map +1 -1
- package/dist/pcm-agents/index.esm.js +1 -1
- package/dist/pcm-agents/oem-htws-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-jd-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-jlpp-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-jlsx-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-jlzz-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-mnct-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-mnms-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/oem-qgqjl-modal.entry.esm.js.map +1 -1
- package/dist/pcm-agents/p-00a41136.entry.js +8 -0
- package/dist/pcm-agents/p-00a41136.entry.js.map +1 -0
- package/dist/pcm-agents/{p-92ee849b.entry.js → p-051647dc.entry.js} +2 -2
- package/dist/pcm-agents/{p-728f6334.entry.js → p-18fd3919.entry.js} +2 -2
- package/dist/pcm-agents/{p-49013fce.entry.js → p-2ca39f88.entry.js} +2 -2
- package/dist/pcm-agents/p-2ca39f88.entry.js.map +1 -0
- package/dist/pcm-agents/{p-d39e81dc.entry.js → p-41ea101a.entry.js} +2 -2
- package/dist/pcm-agents/{p-5fb96403.entry.js → p-58e23de2.entry.js} +2 -2
- package/dist/pcm-agents/p-58e23de2.entry.js.map +1 -0
- package/dist/pcm-agents/{p-258aee6e.entry.js → p-891f4bb8.entry.js} +2 -2
- package/dist/pcm-agents/p-891f4bb8.entry.js.map +1 -0
- package/dist/pcm-agents/{p-15a7f91f.entry.js → p-91611e00.entry.js} +2 -2
- package/dist/pcm-agents/{p-DPUjSCZg.js → p-BIp-Cjpg.js} +1 -1
- package/dist/pcm-agents/{p-DPUjSCZg.js.map → p-BIp-Cjpg.js.map} +1 -1
- package/dist/pcm-agents/{p-lvKa9zRI.js → p-Bq0K-WqZ.js} +1 -1
- package/dist/pcm-agents/{p-lvKa9zRI.js.map → p-Bq0K-WqZ.js.map} +1 -1
- package/dist/pcm-agents/{p-CbwtUF7x.js → p-Bs-zO1WZ.js} +1 -1
- package/dist/pcm-agents/{p-CbwtUF7x.js.map → p-Bs-zO1WZ.js.map} +1 -1
- package/dist/pcm-agents/{p-Bsxbxc9E.js → p-C0FYX2-Z.js} +1 -1
- package/dist/pcm-agents/{p-Bsxbxc9E.js.map → p-C0FYX2-Z.js.map} +1 -1
- package/dist/pcm-agents/{p-BG3AUWwv.js → p-CeRTfvY9.js} +2 -2
- package/dist/pcm-agents/{p-BG3AUWwv.js.map → p-CeRTfvY9.js.map} +1 -1
- package/dist/pcm-agents/p-DVjv2ptN.js +2 -0
- package/dist/pcm-agents/{p-B5G1BSvH.js.map → p-DVjv2ptN.js.map} +1 -1
- package/dist/pcm-agents/p-DXVhHj6-.js +2 -0
- package/dist/pcm-agents/{p-DwejcEGX.js.map → p-DXVhHj6-.js.map} +1 -1
- package/dist/pcm-agents/p-ba5bba45.entry.js +2 -0
- package/dist/pcm-agents/{p-c328bca6.entry.js.map → p-ba5bba45.entry.js.map} +1 -1
- package/dist/pcm-agents/{p-7798d6f8.entry.js → p-baa07edc.entry.js} +2 -2
- package/dist/pcm-agents/p-baa07edc.entry.js.map +1 -0
- package/dist/pcm-agents/{p-a6390011.entry.js → p-cf4f09ea.entry.js} +2 -2
- package/dist/pcm-agents/p-cf4f09ea.entry.js.map +1 -0
- package/dist/pcm-agents/{p-nWqpdPDX.js → p-sIuP9pPh.js} +2 -2
- package/dist/pcm-agents/{p-nWqpdPDX.js.map → p-sIuP9pPh.js.map} +1 -1
- package/dist/pcm-agents/pcm-agents.esm.js +1 -1
- package/dist/pcm-agents/pcm-agents.esm.js.map +1 -1
- package/dist/pcm-agents/pcm-hr-chat-modal.entry.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/error-event-B2Fp3oSo.js +0 -33
- package/dist/cjs/index-B64QE0Jj.js +0 -1016
- package/dist/cjs/message.service-Bv0EySlM.js +0 -160
- package/dist/cjs/sentry-reporter-ezGHpb9e.js +0 -77
- package/dist/components/p-4zKp0xW0.js +0 -366
- package/dist/components/p-4zKp0xW0.js.map +0 -1
- package/dist/components/p-BLoTs7ge.js.map +0 -1
- package/dist/components/p-BWbqJ4aU.js +0 -103
- package/dist/components/p-Bsxbxc9E.js +0 -31
- package/dist/components/p-Bsxbxc9E.js.map +0 -1
- package/dist/components/p-Bt9SwMfw.js.map +0 -1
- package/dist/components/p-BudEJCBh.js +0 -24
- package/dist/components/p-BudEJCBh.js.map +0 -1
- package/dist/components/p-ByArCPFr.js.map +0 -1
- package/dist/components/p-C4X5YnPH.js +0 -146
- package/dist/components/p-C4X5YnPH.js.map +0 -1
- package/dist/components/p-CATZrAYZ.js.map +0 -1
- package/dist/components/p-CcNLPdAv.js.map +0 -1
- package/dist/components/p-CdfCnc6H.js +0 -2121
- package/dist/components/p-CdfCnc6H.js.map +0 -1
- package/dist/components/p-CfpSWIxU.js +0 -327
- package/dist/components/p-CfpSWIxU.js.map +0 -1
- package/dist/components/p-CxCBLV9X.js +0 -342
- package/dist/components/p-CxCBLV9X.js.map +0 -1
- package/dist/components/p-DWc8eULR.js +0 -75
- package/dist/components/p-DWc8eULR.js.map +0 -1
- package/dist/components/p-DeouNi8D.js.map +0 -1
- package/dist/components/p-Dp5lXG_p.js +0 -217
- package/dist/components/p-Dp5lXG_p.js.map +0 -1
- package/dist/components/p-DqtzABEh.js +0 -740
- package/dist/components/p-DqtzABEh.js.map +0 -1
- package/dist/components/p-DwejcEGX.js +0 -158
- package/dist/components/p-DwejcEGX.js.map +0 -1
- package/dist/components/p-HnRt0cWe.js.map +0 -1
- package/dist/components/p-K89GNl2i.js +0 -2600
- package/dist/components/p-K89GNl2i.js.map +0 -1
- package/dist/components/p-VOWVv7ix.js +0 -1651
- package/dist/components/p-VOWVv7ix.js.map +0 -1
- package/dist/components/p-gu0EuRo-.js +0 -256
- package/dist/components/p-gu0EuRo-.js.map +0 -1
- package/dist/esm/error-event-Bsxbxc9E.js +0 -31
- package/dist/esm/index-BYBFz3an.js +0 -995
- package/dist/esm/message.service-DwejcEGX.js +0 -158
- package/dist/esm/sentry-reporter-CDb7zepi.js +0 -75
- package/dist/pcm-agents/p-258aee6e.entry.js.map +0 -1
- package/dist/pcm-agents/p-49013fce.entry.js.map +0 -1
- package/dist/pcm-agents/p-5fb96403.entry.js.map +0 -1
- package/dist/pcm-agents/p-7798d6f8.entry.js.map +0 -1
- package/dist/pcm-agents/p-B5G1BSvH.js +0 -2
- package/dist/pcm-agents/p-DwejcEGX.js +0 -2
- package/dist/pcm-agents/p-a6390011.entry.js.map +0 -1
- package/dist/pcm-agents/p-c2992157.entry.js +0 -8
- package/dist/pcm-agents/p-c2992157.entry.js.map +0 -1
- package/dist/pcm-agents/p-c328bca6.entry.js +0 -2
- /package/dist/pcm-agents/{p-92ee849b.entry.js.map → p-051647dc.entry.js.map} +0 -0
- /package/dist/pcm-agents/{p-728f6334.entry.js.map → p-18fd3919.entry.js.map} +0 -0
- /package/dist/pcm-agents/{p-d39e81dc.entry.js.map → p-41ea101a.entry.js.map} +0 -0
- /package/dist/pcm-agents/{p-15a7f91f.entry.js.map → p-91611e00.entry.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var exports$1 = require('./exports-
|
|
3
|
+
var exports$1 = require('./exports-Dc-pQh4A.js');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Parse a sample rate from a given value.
|
|
@@ -13,10 +13,12 @@ function parseSampleRate(sampleRate) {
|
|
|
13
13
|
if (typeof sampleRate === 'boolean') {
|
|
14
14
|
return Number(sampleRate);
|
|
15
15
|
}
|
|
16
|
+
|
|
16
17
|
const rate = typeof sampleRate === 'string' ? parseFloat(sampleRate) : sampleRate;
|
|
17
18
|
if (typeof rate !== 'number' || isNaN(rate) || rate < 0 || rate > 1) {
|
|
18
19
|
return undefined;
|
|
19
20
|
}
|
|
21
|
+
|
|
20
22
|
return rate;
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -27,7 +29,7 @@ const instrumented = {};
|
|
|
27
29
|
/** Add a handler function. */
|
|
28
30
|
function addHandler(type, handler) {
|
|
29
31
|
handlers[type] = handlers[type] || [];
|
|
30
|
-
handlers[type].push(handler);
|
|
32
|
+
(handlers[type] ).push(handler);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/** Maybe run an instrumentation function, unless it was already called. */
|
|
@@ -48,11 +50,16 @@ function triggerHandlers(type, data) {
|
|
|
48
50
|
if (!typeHandlers) {
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
53
|
+
|
|
51
54
|
for (const handler of typeHandlers) {
|
|
52
55
|
try {
|
|
53
56
|
handler(data);
|
|
54
57
|
} catch (e) {
|
|
55
|
-
exports$1.DEBUG_BUILD &&
|
|
58
|
+
exports$1.DEBUG_BUILD &&
|
|
59
|
+
exports$1.logger.error(
|
|
60
|
+
`Error while triggering instrumentation handler.\nType: ${type}\nName: ${exports$1.getFunctionName(handler)}\nError:`,
|
|
61
|
+
e,
|
|
62
|
+
);
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
}
|
|
@@ -70,26 +77,36 @@ function addGlobalErrorInstrumentationHandler(handler) {
|
|
|
70
77
|
addHandler(type, handler);
|
|
71
78
|
maybeInstrument(type, instrumentError);
|
|
72
79
|
}
|
|
80
|
+
|
|
73
81
|
function instrumentError() {
|
|
74
82
|
_oldOnErrorHandler = exports$1.GLOBAL_OBJ.onerror;
|
|
75
83
|
|
|
76
84
|
// Note: The reason we are doing window.onerror instead of window.addEventListener('error')
|
|
77
85
|
// is that we are using this handler in the Loader Script, to handle buffered errors consistently
|
|
78
|
-
exports$1.GLOBAL_OBJ.onerror = function (
|
|
86
|
+
exports$1.GLOBAL_OBJ.onerror = function (
|
|
87
|
+
msg,
|
|
88
|
+
url,
|
|
89
|
+
line,
|
|
90
|
+
column,
|
|
91
|
+
error,
|
|
92
|
+
) {
|
|
79
93
|
const handlerData = {
|
|
80
94
|
column,
|
|
81
95
|
error,
|
|
82
96
|
line,
|
|
83
97
|
msg,
|
|
84
|
-
url
|
|
98
|
+
url,
|
|
85
99
|
};
|
|
86
100
|
triggerHandlers('error', handlerData);
|
|
101
|
+
|
|
87
102
|
if (_oldOnErrorHandler) {
|
|
88
103
|
// eslint-disable-next-line prefer-rest-params
|
|
89
104
|
return _oldOnErrorHandler.apply(this, arguments);
|
|
90
105
|
}
|
|
106
|
+
|
|
91
107
|
return false;
|
|
92
108
|
};
|
|
109
|
+
|
|
93
110
|
exports$1.GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;
|
|
94
111
|
}
|
|
95
112
|
|
|
@@ -101,11 +118,14 @@ let _oldOnUnhandledRejectionHandler = null;
|
|
|
101
118
|
* Use at your own risk, this might break without changelog notice, only used internally.
|
|
102
119
|
* @hidden
|
|
103
120
|
*/
|
|
104
|
-
function addGlobalUnhandledRejectionInstrumentationHandler(
|
|
121
|
+
function addGlobalUnhandledRejectionInstrumentationHandler(
|
|
122
|
+
handler,
|
|
123
|
+
) {
|
|
105
124
|
const type = 'unhandledrejection';
|
|
106
125
|
addHandler(type, handler);
|
|
107
126
|
maybeInstrument(type, instrumentUnhandledRejection);
|
|
108
127
|
}
|
|
128
|
+
|
|
109
129
|
function instrumentUnhandledRejection() {
|
|
110
130
|
_oldOnUnhandledRejectionHandler = exports$1.GLOBAL_OBJ.onunhandledrejection;
|
|
111
131
|
|
|
@@ -114,12 +134,15 @@ function instrumentUnhandledRejection() {
|
|
|
114
134
|
exports$1.GLOBAL_OBJ.onunhandledrejection = function (e) {
|
|
115
135
|
const handlerData = e;
|
|
116
136
|
triggerHandlers('unhandledrejection', handlerData);
|
|
137
|
+
|
|
117
138
|
if (_oldOnUnhandledRejectionHandler) {
|
|
118
139
|
// eslint-disable-next-line prefer-rest-params
|
|
119
140
|
return _oldOnUnhandledRejectionHandler.apply(this, arguments);
|
|
120
141
|
}
|
|
142
|
+
|
|
121
143
|
return true;
|
|
122
144
|
};
|
|
145
|
+
|
|
123
146
|
exports$1.GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
|
|
124
147
|
}
|
|
125
148
|
|
|
@@ -129,7 +152,7 @@ function instrumentUnhandledRejection() {
|
|
|
129
152
|
* so that the envelope types resolve correctly.
|
|
130
153
|
*/
|
|
131
154
|
function createEnvelope(headers, items = []) {
|
|
132
|
-
return [headers, items];
|
|
155
|
+
return [headers, items] ;
|
|
133
156
|
}
|
|
134
157
|
|
|
135
158
|
/**
|
|
@@ -139,7 +162,7 @@ function createEnvelope(headers, items = []) {
|
|
|
139
162
|
*/
|
|
140
163
|
function addItemToEnvelope(envelope, newItem) {
|
|
141
164
|
const [headers, items] = envelope;
|
|
142
|
-
return [headers, [...items, newItem]];
|
|
165
|
+
return [headers, [...items, newItem]] ;
|
|
143
166
|
}
|
|
144
167
|
|
|
145
168
|
/**
|
|
@@ -148,15 +171,21 @@ function addItemToEnvelope(envelope, newItem) {
|
|
|
148
171
|
*
|
|
149
172
|
* If the callback returns true, the rest of the items will be skipped.
|
|
150
173
|
*/
|
|
151
|
-
function forEachEnvelopeItem(
|
|
174
|
+
function forEachEnvelopeItem(
|
|
175
|
+
envelope,
|
|
176
|
+
callback,
|
|
177
|
+
) {
|
|
152
178
|
const envelopeItems = envelope[1];
|
|
179
|
+
|
|
153
180
|
for (const envelopeItem of envelopeItems) {
|
|
154
181
|
const envelopeItemType = envelopeItem[0].type;
|
|
155
182
|
const result = callback(envelopeItem, envelopeItemType);
|
|
183
|
+
|
|
156
184
|
if (result) {
|
|
157
185
|
return true;
|
|
158
186
|
}
|
|
159
187
|
}
|
|
188
|
+
|
|
160
189
|
return false;
|
|
161
190
|
}
|
|
162
191
|
|
|
@@ -175,6 +204,7 @@ function serializeEnvelope(envelope) {
|
|
|
175
204
|
const [envHeaders, items] = envelope;
|
|
176
205
|
// Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data
|
|
177
206
|
let parts = JSON.stringify(envHeaders);
|
|
207
|
+
|
|
178
208
|
function append(next) {
|
|
179
209
|
if (typeof parts === 'string') {
|
|
180
210
|
parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts), next];
|
|
@@ -182,9 +212,12 @@ function serializeEnvelope(envelope) {
|
|
|
182
212
|
parts.push(typeof next === 'string' ? encodeUTF8(next) : next);
|
|
183
213
|
}
|
|
184
214
|
}
|
|
215
|
+
|
|
185
216
|
for (const item of items) {
|
|
186
217
|
const [itemHeaders, payload] = item;
|
|
218
|
+
|
|
187
219
|
append(`\n${JSON.stringify(itemHeaders)}\n`);
|
|
220
|
+
|
|
188
221
|
if (typeof payload === 'string' || payload instanceof Uint8Array) {
|
|
189
222
|
append(payload);
|
|
190
223
|
} else {
|
|
@@ -200,16 +233,20 @@ function serializeEnvelope(envelope) {
|
|
|
200
233
|
append(stringifiedPayload);
|
|
201
234
|
}
|
|
202
235
|
}
|
|
236
|
+
|
|
203
237
|
return typeof parts === 'string' ? parts : concatBuffers(parts);
|
|
204
238
|
}
|
|
239
|
+
|
|
205
240
|
function concatBuffers(buffers) {
|
|
206
241
|
const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);
|
|
242
|
+
|
|
207
243
|
const merged = new Uint8Array(totalLength);
|
|
208
244
|
let offset = 0;
|
|
209
245
|
for (const buffer of buffers) {
|
|
210
246
|
merged.set(buffer, offset);
|
|
211
247
|
offset += buffer.length;
|
|
212
248
|
}
|
|
249
|
+
|
|
213
250
|
return merged;
|
|
214
251
|
}
|
|
215
252
|
|
|
@@ -218,14 +255,19 @@ function concatBuffers(buffers) {
|
|
|
218
255
|
*/
|
|
219
256
|
function createAttachmentEnvelopeItem(attachment) {
|
|
220
257
|
const buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data) : attachment.data;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
258
|
+
|
|
259
|
+
return [
|
|
260
|
+
{
|
|
261
|
+
type: 'attachment',
|
|
262
|
+
length: buffer.length,
|
|
263
|
+
filename: attachment.filename,
|
|
264
|
+
content_type: attachment.contentType,
|
|
265
|
+
attachment_type: attachment.attachmentType,
|
|
266
|
+
},
|
|
267
|
+
buffer,
|
|
268
|
+
];
|
|
228
269
|
}
|
|
270
|
+
|
|
229
271
|
const ITEM_TYPE_TO_DATA_CATEGORY_MAP = {
|
|
230
272
|
session: 'session',
|
|
231
273
|
sessions: 'session',
|
|
@@ -242,7 +284,7 @@ const ITEM_TYPE_TO_DATA_CATEGORY_MAP = {
|
|
|
242
284
|
feedback: 'feedback',
|
|
243
285
|
span: 'span',
|
|
244
286
|
raw_security: 'security',
|
|
245
|
-
log: 'log_item'
|
|
287
|
+
log: 'log_item',
|
|
246
288
|
};
|
|
247
289
|
|
|
248
290
|
/**
|
|
@@ -257,34 +299,29 @@ function getSdkMetadataForEnvelopeHeader(metadataOrEvent) {
|
|
|
257
299
|
if (!metadataOrEvent?.sdk) {
|
|
258
300
|
return;
|
|
259
301
|
}
|
|
260
|
-
const {
|
|
261
|
-
|
|
262
|
-
version
|
|
263
|
-
} = metadataOrEvent.sdk;
|
|
264
|
-
return {
|
|
265
|
-
name,
|
|
266
|
-
version
|
|
267
|
-
};
|
|
302
|
+
const { name, version } = metadataOrEvent.sdk;
|
|
303
|
+
return { name, version };
|
|
268
304
|
}
|
|
269
305
|
|
|
270
306
|
/**
|
|
271
307
|
* Creates event envelope headers, based on event, sdk info and tunnel
|
|
272
308
|
* Note: This function was extracted from the core package to make it available in Replay
|
|
273
309
|
*/
|
|
274
|
-
function createEventEnvelopeHeaders(
|
|
310
|
+
function createEventEnvelopeHeaders(
|
|
311
|
+
event,
|
|
312
|
+
sdkInfo,
|
|
313
|
+
tunnel,
|
|
314
|
+
dsn,
|
|
315
|
+
) {
|
|
275
316
|
const dynamicSamplingContext = event.sdkProcessingMetadata?.dynamicSamplingContext;
|
|
276
317
|
return {
|
|
277
|
-
event_id: event.event_id,
|
|
318
|
+
event_id: event.event_id ,
|
|
278
319
|
sent_at: new Date().toISOString(),
|
|
279
|
-
...(sdkInfo && {
|
|
280
|
-
|
|
281
|
-
}),
|
|
282
|
-
...(!!tunnel && dsn && {
|
|
283
|
-
dsn: exports$1.dsnToString(dsn)
|
|
284
|
-
}),
|
|
320
|
+
...(sdkInfo && { sdk: sdkInfo }),
|
|
321
|
+
...(!!tunnel && dsn && { dsn: exports$1.dsnToString(dsn) }),
|
|
285
322
|
...(dynamicSamplingContext && {
|
|
286
|
-
trace: dynamicSamplingContext
|
|
287
|
-
})
|
|
323
|
+
trace: dynamicSamplingContext,
|
|
324
|
+
}),
|
|
288
325
|
};
|
|
289
326
|
}
|
|
290
327
|
|
|
@@ -305,29 +342,34 @@ function enhanceEventWithSdkInfo(event, sdkInfo) {
|
|
|
305
342
|
}
|
|
306
343
|
|
|
307
344
|
/** Creates an envelope from a Session */
|
|
308
|
-
function createSessionEnvelope(
|
|
345
|
+
function createSessionEnvelope(
|
|
346
|
+
session,
|
|
347
|
+
dsn,
|
|
348
|
+
metadata,
|
|
349
|
+
tunnel,
|
|
350
|
+
) {
|
|
309
351
|
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
|
|
310
352
|
const envelopeHeaders = {
|
|
311
353
|
sent_at: new Date().toISOString(),
|
|
312
|
-
...(sdkInfo && {
|
|
313
|
-
|
|
314
|
-
}),
|
|
315
|
-
...(!!tunnel && dsn && {
|
|
316
|
-
dsn: exports$1.dsnToString(dsn)
|
|
317
|
-
})
|
|
354
|
+
...(sdkInfo && { sdk: sdkInfo }),
|
|
355
|
+
...(!!tunnel && dsn && { dsn: exports$1.dsnToString(dsn) }),
|
|
318
356
|
};
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}, session.toJSON()];
|
|
357
|
+
|
|
358
|
+
const envelopeItem =
|
|
359
|
+
'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session.toJSON()];
|
|
360
|
+
|
|
324
361
|
return createEnvelope(envelopeHeaders, [envelopeItem]);
|
|
325
362
|
}
|
|
326
363
|
|
|
327
364
|
/**
|
|
328
365
|
* Create an Envelope from an event.
|
|
329
366
|
*/
|
|
330
|
-
function createEventEnvelope(
|
|
367
|
+
function createEventEnvelope(
|
|
368
|
+
event,
|
|
369
|
+
dsn,
|
|
370
|
+
metadata,
|
|
371
|
+
tunnel,
|
|
372
|
+
) {
|
|
331
373
|
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
|
|
332
374
|
|
|
333
375
|
/*
|
|
@@ -338,7 +380,9 @@ function createEventEnvelope(event, dsn, metadata, tunnel) {
|
|
|
338
380
|
So the safe choice is to really guard against the replay_event type here.
|
|
339
381
|
*/
|
|
340
382
|
const eventType = event.type && event.type !== 'replay_event' ? event.type : 'event';
|
|
383
|
+
|
|
341
384
|
enhanceEventWithSdkInfo(event, metadata?.sdk);
|
|
385
|
+
|
|
342
386
|
const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);
|
|
343
387
|
|
|
344
388
|
// Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
|
|
@@ -346,9 +390,8 @@ function createEventEnvelope(event, dsn, metadata, tunnel) {
|
|
|
346
390
|
// have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid
|
|
347
391
|
// of this `delete`, lest we miss putting it back in the next time the property is in use.)
|
|
348
392
|
delete event.sdkProcessingMetadata;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}, event];
|
|
393
|
+
|
|
394
|
+
const eventItem = [{ type: eventType }, event];
|
|
352
395
|
return createEnvelope(envelopeHeaders, [eventItem]);
|
|
353
396
|
}
|
|
354
397
|
|
|
@@ -369,16 +412,19 @@ function _getIngestEndpoint(dsn) {
|
|
|
369
412
|
/** Returns a URL-encoded string with auth config suitable for a query string. */
|
|
370
413
|
function _encodedAuth(dsn, sdkInfo) {
|
|
371
414
|
const params = {
|
|
372
|
-
sentry_version: SENTRY_API_VERSION
|
|
415
|
+
sentry_version: SENTRY_API_VERSION,
|
|
373
416
|
};
|
|
417
|
+
|
|
374
418
|
if (dsn.publicKey) {
|
|
375
419
|
// We send only the minimum set of required information. See
|
|
376
420
|
// https://github.com/getsentry/sentry-javascript/issues/2572.
|
|
377
421
|
params.sentry_key = dsn.publicKey;
|
|
378
422
|
}
|
|
423
|
+
|
|
379
424
|
if (sdkInfo) {
|
|
380
425
|
params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`;
|
|
381
426
|
}
|
|
427
|
+
|
|
382
428
|
return new URLSearchParams(params).toString();
|
|
383
429
|
}
|
|
384
430
|
|
|
@@ -403,10 +449,10 @@ const installedIntegrations = [];
|
|
|
403
449
|
*/
|
|
404
450
|
function filterDuplicates(integrations) {
|
|
405
451
|
const integrationsByName = {};
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
452
|
+
|
|
453
|
+
integrations.forEach((currentInstance) => {
|
|
454
|
+
const { name } = currentInstance;
|
|
455
|
+
|
|
410
456
|
const existingInstance = integrationsByName[name];
|
|
411
457
|
|
|
412
458
|
// We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a
|
|
@@ -414,8 +460,10 @@ function filterDuplicates(integrations) {
|
|
|
414
460
|
if (existingInstance && !existingInstance.isDefaultInstance && currentInstance.isDefaultInstance) {
|
|
415
461
|
return;
|
|
416
462
|
}
|
|
463
|
+
|
|
417
464
|
integrationsByName[name] = currentInstance;
|
|
418
465
|
});
|
|
466
|
+
|
|
419
467
|
return Object.values(integrationsByName);
|
|
420
468
|
}
|
|
421
469
|
|
|
@@ -425,10 +473,12 @@ function getIntegrationsToSetup(options) {
|
|
|
425
473
|
const userIntegrations = options.integrations;
|
|
426
474
|
|
|
427
475
|
// We flag default instances, so that later we can tell them apart from any user-created instances of the same class
|
|
428
|
-
defaultIntegrations.forEach(integration => {
|
|
476
|
+
defaultIntegrations.forEach((integration) => {
|
|
429
477
|
integration.isDefaultInstance = true;
|
|
430
478
|
});
|
|
479
|
+
|
|
431
480
|
let integrations;
|
|
481
|
+
|
|
432
482
|
if (Array.isArray(userIntegrations)) {
|
|
433
483
|
integrations = [...defaultIntegrations, ...userIntegrations];
|
|
434
484
|
} else if (typeof userIntegrations === 'function') {
|
|
@@ -437,6 +487,7 @@ function getIntegrationsToSetup(options) {
|
|
|
437
487
|
} else {
|
|
438
488
|
integrations = defaultIntegrations;
|
|
439
489
|
}
|
|
490
|
+
|
|
440
491
|
return filterDuplicates(integrations);
|
|
441
492
|
}
|
|
442
493
|
|
|
@@ -448,12 +499,14 @@ function getIntegrationsToSetup(options) {
|
|
|
448
499
|
*/
|
|
449
500
|
function setupIntegrations(client, integrations) {
|
|
450
501
|
const integrationIndex = {};
|
|
451
|
-
|
|
502
|
+
|
|
503
|
+
integrations.forEach((integration) => {
|
|
452
504
|
// guard against empty provided integrations
|
|
453
505
|
if (integration) {
|
|
454
506
|
setupIntegration(client, integration, integrationIndex);
|
|
455
507
|
}
|
|
456
508
|
});
|
|
509
|
+
|
|
457
510
|
return integrationIndex;
|
|
458
511
|
}
|
|
459
512
|
|
|
@@ -487,17 +540,22 @@ function setupIntegration(client, integration, integrationIndex) {
|
|
|
487
540
|
if (integration.setup && typeof integration.setup === 'function') {
|
|
488
541
|
integration.setup(client);
|
|
489
542
|
}
|
|
543
|
+
|
|
490
544
|
if (typeof integration.preprocessEvent === 'function') {
|
|
491
|
-
const callback = integration.preprocessEvent.bind(integration);
|
|
545
|
+
const callback = integration.preprocessEvent.bind(integration) ;
|
|
492
546
|
client.on('preprocessEvent', (event, hint) => callback(event, hint, client));
|
|
493
547
|
}
|
|
548
|
+
|
|
494
549
|
if (typeof integration.processEvent === 'function') {
|
|
495
|
-
const callback = integration.processEvent.bind(integration);
|
|
550
|
+
const callback = integration.processEvent.bind(integration) ;
|
|
551
|
+
|
|
496
552
|
const processor = Object.assign((event, hint) => callback(event, hint, client), {
|
|
497
|
-
id: integration.name
|
|
553
|
+
id: integration.name,
|
|
498
554
|
});
|
|
555
|
+
|
|
499
556
|
client.addEventProcessor(processor);
|
|
500
557
|
}
|
|
558
|
+
|
|
501
559
|
exports$1.DEBUG_BUILD && exports$1.logger.log(`Integration installed: ${integration.name}`);
|
|
502
560
|
}
|
|
503
561
|
|
|
@@ -514,9 +572,11 @@ function defineIntegration(fn) {
|
|
|
514
572
|
*/
|
|
515
573
|
function getPossibleEventMessages(event) {
|
|
516
574
|
const possibleMessages = [];
|
|
575
|
+
|
|
517
576
|
if (event.message) {
|
|
518
577
|
possibleMessages.push(event.message);
|
|
519
578
|
}
|
|
579
|
+
|
|
520
580
|
try {
|
|
521
581
|
// @ts-expect-error Try catching to save bundle size
|
|
522
582
|
const lastException = event.exception.values[event.exception.values.length - 1];
|
|
@@ -529,6 +589,7 @@ function getPossibleEventMessages(event) {
|
|
|
529
589
|
} catch (e) {
|
|
530
590
|
// ignore errors here
|
|
531
591
|
}
|
|
592
|
+
|
|
532
593
|
return possibleMessages;
|
|
533
594
|
}
|
|
534
595
|
|
|
@@ -536,15 +597,8 @@ function getPossibleEventMessages(event) {
|
|
|
536
597
|
* Converts a transaction event to a span JSON object.
|
|
537
598
|
*/
|
|
538
599
|
function convertTransactionEventToSpanJson(event) {
|
|
539
|
-
const {
|
|
540
|
-
|
|
541
|
-
parent_span_id,
|
|
542
|
-
span_id,
|
|
543
|
-
status,
|
|
544
|
-
origin,
|
|
545
|
-
data,
|
|
546
|
-
op
|
|
547
|
-
} = event.contexts?.trace ?? {};
|
|
600
|
+
const { trace_id, parent_span_id, span_id, status, origin, data, op } = event.contexts?.trace ?? {};
|
|
601
|
+
|
|
548
602
|
return {
|
|
549
603
|
data: data ?? {},
|
|
550
604
|
description: event.transaction,
|
|
@@ -556,10 +610,10 @@ function convertTransactionEventToSpanJson(event) {
|
|
|
556
610
|
timestamp: event.timestamp,
|
|
557
611
|
trace_id: trace_id ?? '',
|
|
558
612
|
origin,
|
|
559
|
-
profile_id: data?.[exports$1.SEMANTIC_ATTRIBUTE_PROFILE_ID],
|
|
560
|
-
exclusive_time: data?.[exports$1.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME],
|
|
613
|
+
profile_id: data?.[exports$1.SEMANTIC_ATTRIBUTE_PROFILE_ID] ,
|
|
614
|
+
exclusive_time: data?.[exports$1.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME] ,
|
|
561
615
|
measurements: event.measurements,
|
|
562
|
-
is_segment: true
|
|
616
|
+
is_segment: true,
|
|
563
617
|
};
|
|
564
618
|
}
|
|
565
619
|
|
|
@@ -582,16 +636,12 @@ function convertSpanJsonToTransactionEvent(span) {
|
|
|
582
636
|
origin: span.origin,
|
|
583
637
|
data: {
|
|
584
638
|
...span.data,
|
|
585
|
-
...(span.profile_id && {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
[exports$1.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: span.exclusive_time
|
|
590
|
-
})
|
|
591
|
-
}
|
|
592
|
-
}
|
|
639
|
+
...(span.profile_id && { [exports$1.SEMANTIC_ATTRIBUTE_PROFILE_ID]: span.profile_id }),
|
|
640
|
+
...(span.exclusive_time && { [exports$1.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: span.exclusive_time }),
|
|
641
|
+
},
|
|
642
|
+
},
|
|
593
643
|
},
|
|
594
|
-
measurements: span.measurements
|
|
644
|
+
measurements: span.measurements,
|
|
595
645
|
};
|
|
596
646
|
}
|
|
597
647
|
|
|
@@ -600,39 +650,47 @@ function convertSpanJsonToTransactionEvent(span) {
|
|
|
600
650
|
* @param discarded_events An array of discard events
|
|
601
651
|
* @param dsn A DSN that can be set on the header. Optional.
|
|
602
652
|
*/
|
|
603
|
-
function createClientReportEnvelope(
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
653
|
+
function createClientReportEnvelope(
|
|
654
|
+
discarded_events,
|
|
655
|
+
dsn,
|
|
656
|
+
timestamp,
|
|
657
|
+
) {
|
|
658
|
+
const clientReportItem = [
|
|
659
|
+
{ type: 'client_report' },
|
|
660
|
+
{
|
|
661
|
+
timestamp: exports$1.dateTimestampInSeconds(),
|
|
662
|
+
discarded_events,
|
|
663
|
+
},
|
|
664
|
+
];
|
|
665
|
+
return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);
|
|
613
666
|
}
|
|
614
667
|
|
|
615
668
|
/* eslint-disable max-lines */
|
|
616
669
|
|
|
617
670
|
const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
|
|
618
671
|
const MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release';
|
|
672
|
+
|
|
619
673
|
const INTERNAL_ERROR_SYMBOL = Symbol.for('SentryInternalError');
|
|
620
674
|
const DO_NOT_SEND_EVENT_SYMBOL = Symbol.for('SentryDoNotSendEventError');
|
|
675
|
+
|
|
621
676
|
function _makeInternalError(message) {
|
|
622
677
|
return {
|
|
623
678
|
message,
|
|
624
|
-
[INTERNAL_ERROR_SYMBOL]: true
|
|
679
|
+
[INTERNAL_ERROR_SYMBOL]: true,
|
|
625
680
|
};
|
|
626
681
|
}
|
|
682
|
+
|
|
627
683
|
function _makeDoNotSendEventError(message) {
|
|
628
684
|
return {
|
|
629
685
|
message,
|
|
630
|
-
[DO_NOT_SEND_EVENT_SYMBOL]: true
|
|
686
|
+
[DO_NOT_SEND_EVENT_SYMBOL]: true,
|
|
631
687
|
};
|
|
632
688
|
}
|
|
689
|
+
|
|
633
690
|
function _isInternalError(error) {
|
|
634
691
|
return !!error && typeof error === 'object' && INTERNAL_ERROR_SYMBOL in error;
|
|
635
692
|
}
|
|
693
|
+
|
|
636
694
|
function _isDoNotSendEventError(error) {
|
|
637
695
|
return !!error && typeof error === 'object' && DO_NOT_SEND_EVENT_SYMBOL in error;
|
|
638
696
|
}
|
|
@@ -686,25 +744,31 @@ class Client {
|
|
|
686
744
|
*
|
|
687
745
|
* @param options Options for the client.
|
|
688
746
|
*/
|
|
689
|
-
|
|
747
|
+
constructor(options) {
|
|
690
748
|
this._options = options;
|
|
691
749
|
this._integrations = {};
|
|
692
750
|
this._numProcessing = 0;
|
|
693
751
|
this._outcomes = {};
|
|
694
752
|
this._hooks = {};
|
|
695
753
|
this._eventProcessors = [];
|
|
754
|
+
|
|
696
755
|
if (options.dsn) {
|
|
697
756
|
this._dsn = exports$1.makeDsn(options.dsn);
|
|
698
757
|
} else {
|
|
699
758
|
exports$1.DEBUG_BUILD && exports$1.logger.warn('No DSN provided, client will not send events.');
|
|
700
759
|
}
|
|
760
|
+
|
|
701
761
|
if (this._dsn) {
|
|
702
|
-
const url = getEnvelopeEndpointWithUrlEncodedAuth(
|
|
762
|
+
const url = getEnvelopeEndpointWithUrlEncodedAuth(
|
|
763
|
+
this._dsn,
|
|
764
|
+
options.tunnel,
|
|
765
|
+
options._metadata ? options._metadata.sdk : undefined,
|
|
766
|
+
);
|
|
703
767
|
this._transport = options.transport({
|
|
704
768
|
tunnel: this._options.tunnel,
|
|
705
769
|
recordDroppedEvent: this.recordDroppedEvent.bind(this),
|
|
706
770
|
...options.transportOptions,
|
|
707
|
-
url
|
|
771
|
+
url,
|
|
708
772
|
});
|
|
709
773
|
}
|
|
710
774
|
}
|
|
@@ -714,7 +778,7 @@ class Client {
|
|
|
714
778
|
*
|
|
715
779
|
* Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.
|
|
716
780
|
*/
|
|
717
|
-
|
|
781
|
+
captureException(exception, hint, scope) {
|
|
718
782
|
const eventId = exports$1.uuid4();
|
|
719
783
|
|
|
720
784
|
// ensure we haven't captured this very object before
|
|
@@ -722,11 +786,18 @@ class Client {
|
|
|
722
786
|
exports$1.DEBUG_BUILD && exports$1.logger.log(ALREADY_SEEN_ERROR);
|
|
723
787
|
return eventId;
|
|
724
788
|
}
|
|
789
|
+
|
|
725
790
|
const hintWithEventId = {
|
|
726
791
|
event_id: eventId,
|
|
727
|
-
...hint
|
|
792
|
+
...hint,
|
|
728
793
|
};
|
|
729
|
-
|
|
794
|
+
|
|
795
|
+
this._process(
|
|
796
|
+
this.eventFromException(exception, hintWithEventId).then(event =>
|
|
797
|
+
this._captureEvent(event, hintWithEventId, scope),
|
|
798
|
+
),
|
|
799
|
+
);
|
|
800
|
+
|
|
730
801
|
return hintWithEventId.event_id;
|
|
731
802
|
}
|
|
732
803
|
|
|
@@ -735,14 +806,25 @@ class Client {
|
|
|
735
806
|
*
|
|
736
807
|
* Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.
|
|
737
808
|
*/
|
|
738
|
-
|
|
809
|
+
captureMessage(
|
|
810
|
+
message,
|
|
811
|
+
level,
|
|
812
|
+
hint,
|
|
813
|
+
currentScope,
|
|
814
|
+
) {
|
|
739
815
|
const hintWithEventId = {
|
|
740
816
|
event_id: exports$1.uuid4(),
|
|
741
|
-
...hint
|
|
817
|
+
...hint,
|
|
742
818
|
};
|
|
819
|
+
|
|
743
820
|
const eventMessage = exports$1.isParameterizedString(message) ? message : String(message);
|
|
744
|
-
|
|
821
|
+
|
|
822
|
+
const promisedEvent = exports$1.isPrimitive(message)
|
|
823
|
+
? this.eventFromMessage(eventMessage, level, hintWithEventId)
|
|
824
|
+
: this.eventFromException(message, hintWithEventId);
|
|
825
|
+
|
|
745
826
|
this._process(promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)));
|
|
827
|
+
|
|
746
828
|
return hintWithEventId.event_id;
|
|
747
829
|
}
|
|
748
830
|
|
|
@@ -751,7 +833,7 @@ class Client {
|
|
|
751
833
|
*
|
|
752
834
|
* Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
|
|
753
835
|
*/
|
|
754
|
-
|
|
836
|
+
captureEvent(event, hint, currentScope) {
|
|
755
837
|
const eventId = exports$1.uuid4();
|
|
756
838
|
|
|
757
839
|
// ensure we haven't captured this very object before
|
|
@@ -759,26 +841,30 @@ class Client {
|
|
|
759
841
|
exports$1.DEBUG_BUILD && exports$1.logger.log(ALREADY_SEEN_ERROR);
|
|
760
842
|
return eventId;
|
|
761
843
|
}
|
|
844
|
+
|
|
762
845
|
const hintWithEventId = {
|
|
763
846
|
event_id: eventId,
|
|
764
|
-
...hint
|
|
847
|
+
...hint,
|
|
765
848
|
};
|
|
849
|
+
|
|
766
850
|
const sdkProcessingMetadata = event.sdkProcessingMetadata || {};
|
|
767
851
|
const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;
|
|
768
852
|
const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;
|
|
769
|
-
|
|
853
|
+
|
|
854
|
+
this._process(
|
|
855
|
+
this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope),
|
|
856
|
+
);
|
|
857
|
+
|
|
770
858
|
return hintWithEventId.event_id;
|
|
771
859
|
}
|
|
772
860
|
|
|
773
861
|
/**
|
|
774
862
|
* Captures a session.
|
|
775
863
|
*/
|
|
776
|
-
|
|
864
|
+
captureSession(session) {
|
|
777
865
|
this.sendSession(session);
|
|
778
866
|
// After sending, we set init false to indicate it's not the first occurrence
|
|
779
|
-
exports$1.updateSession(session, {
|
|
780
|
-
init: false
|
|
781
|
-
});
|
|
867
|
+
exports$1.updateSession(session, { init: false });
|
|
782
868
|
}
|
|
783
869
|
|
|
784
870
|
/**
|
|
@@ -794,14 +880,14 @@ class Client {
|
|
|
794
880
|
/**
|
|
795
881
|
* Get the current Dsn.
|
|
796
882
|
*/
|
|
797
|
-
|
|
883
|
+
getDsn() {
|
|
798
884
|
return this._dsn;
|
|
799
885
|
}
|
|
800
886
|
|
|
801
887
|
/**
|
|
802
888
|
* Get the current options.
|
|
803
889
|
*/
|
|
804
|
-
|
|
890
|
+
getOptions() {
|
|
805
891
|
return this._options;
|
|
806
892
|
}
|
|
807
893
|
|
|
@@ -809,7 +895,7 @@ class Client {
|
|
|
809
895
|
* Get the SDK metadata.
|
|
810
896
|
* @see SdkMetadata
|
|
811
897
|
*/
|
|
812
|
-
|
|
898
|
+
getSdkMetadata() {
|
|
813
899
|
return this._options._metadata;
|
|
814
900
|
}
|
|
815
901
|
|
|
@@ -817,7 +903,7 @@ class Client {
|
|
|
817
903
|
* Returns the transport that is used by the client.
|
|
818
904
|
* Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.
|
|
819
905
|
*/
|
|
820
|
-
|
|
906
|
+
getTransport() {
|
|
821
907
|
return this._transport;
|
|
822
908
|
}
|
|
823
909
|
|
|
@@ -829,7 +915,7 @@ class Client {
|
|
|
829
915
|
* @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are
|
|
830
916
|
* still events in the queue when the timeout is reached.
|
|
831
917
|
*/
|
|
832
|
-
|
|
918
|
+
flush(timeout) {
|
|
833
919
|
const transport = this._transport;
|
|
834
920
|
if (transport) {
|
|
835
921
|
this.emit('flush');
|
|
@@ -849,7 +935,7 @@ class Client {
|
|
|
849
935
|
* @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if
|
|
850
936
|
* it doesn't.
|
|
851
937
|
*/
|
|
852
|
-
|
|
938
|
+
close(timeout) {
|
|
853
939
|
return this.flush(timeout).then(result => {
|
|
854
940
|
this.getOptions().enabled = false;
|
|
855
941
|
this.emit('close');
|
|
@@ -860,14 +946,14 @@ class Client {
|
|
|
860
946
|
/**
|
|
861
947
|
* Get all installed event processors.
|
|
862
948
|
*/
|
|
863
|
-
|
|
949
|
+
getEventProcessors() {
|
|
864
950
|
return this._eventProcessors;
|
|
865
951
|
}
|
|
866
952
|
|
|
867
953
|
/**
|
|
868
954
|
* Adds an event processor that applies to any event processed by this client.
|
|
869
955
|
*/
|
|
870
|
-
|
|
956
|
+
addEventProcessor(eventProcessor) {
|
|
871
957
|
this._eventProcessors.push(eventProcessor);
|
|
872
958
|
}
|
|
873
959
|
|
|
@@ -875,16 +961,16 @@ class Client {
|
|
|
875
961
|
* Initialize this client.
|
|
876
962
|
* Call this after the client was set on a scope.
|
|
877
963
|
*/
|
|
878
|
-
|
|
879
|
-
if (
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
name
|
|
887
|
-
|
|
964
|
+
init() {
|
|
965
|
+
if (
|
|
966
|
+
this._isEnabled() ||
|
|
967
|
+
// Force integrations to be setup even if no DSN was set when we have
|
|
968
|
+
// Spotlight enabled. This is particularly important for browser as we
|
|
969
|
+
// don't support the `spotlight` option there and rely on the users
|
|
970
|
+
// adding the `spotlightBrowserIntegration()` to their integrations which
|
|
971
|
+
// wouldn't get initialized with the check below when there's no DSN set.
|
|
972
|
+
this._options.integrations.some(({ name }) => name.startsWith('Spotlight'))
|
|
973
|
+
) {
|
|
888
974
|
this._setupIntegrations();
|
|
889
975
|
}
|
|
890
976
|
}
|
|
@@ -894,8 +980,8 @@ class Client {
|
|
|
894
980
|
*
|
|
895
981
|
* @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.
|
|
896
982
|
*/
|
|
897
|
-
|
|
898
|
-
return this._integrations[integrationName];
|
|
983
|
+
getIntegrationByName(integrationName) {
|
|
984
|
+
return this._integrations[integrationName] ;
|
|
899
985
|
}
|
|
900
986
|
|
|
901
987
|
/**
|
|
@@ -905,7 +991,7 @@ class Client {
|
|
|
905
991
|
* and you're better off just passing the integrations via `integrations: []` at initialization time.
|
|
906
992
|
* However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.
|
|
907
993
|
*/
|
|
908
|
-
|
|
994
|
+
addIntegration(integration) {
|
|
909
995
|
const isAlreadyInstalled = this._integrations[integration.name];
|
|
910
996
|
|
|
911
997
|
// This hook takes care of only installing if not already installed
|
|
@@ -919,12 +1005,15 @@ class Client {
|
|
|
919
1005
|
/**
|
|
920
1006
|
* Send a fully prepared event to Sentry.
|
|
921
1007
|
*/
|
|
922
|
-
|
|
1008
|
+
sendEvent(event, hint = {}) {
|
|
923
1009
|
this.emit('beforeSendEvent', event, hint);
|
|
1010
|
+
|
|
924
1011
|
let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
|
|
1012
|
+
|
|
925
1013
|
for (const attachment of hint.attachments || []) {
|
|
926
1014
|
env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));
|
|
927
1015
|
}
|
|
1016
|
+
|
|
928
1017
|
const promise = this.sendEnvelope(env);
|
|
929
1018
|
if (promise) {
|
|
930
1019
|
promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);
|
|
@@ -934,12 +1023,9 @@ class Client {
|
|
|
934
1023
|
/**
|
|
935
1024
|
* Send a session or session aggregrates to Sentry.
|
|
936
1025
|
*/
|
|
937
|
-
|
|
1026
|
+
sendSession(session) {
|
|
938
1027
|
// Backfill release and environment on session
|
|
939
|
-
const {
|
|
940
|
-
release: clientReleaseOption,
|
|
941
|
-
environment: clientEnvironmentOption = exports$1.DEFAULT_ENVIRONMENT
|
|
942
|
-
} = this._options;
|
|
1028
|
+
const { release: clientReleaseOption, environment: clientEnvironmentOption = exports$1.DEFAULT_ENVIRONMENT } = this._options;
|
|
943
1029
|
if ('aggregates' in session) {
|
|
944
1030
|
const sessionAttrs = session.attrs || {};
|
|
945
1031
|
if (!sessionAttrs.release && !clientReleaseOption) {
|
|
@@ -957,7 +1043,9 @@ class Client {
|
|
|
957
1043
|
session.release = session.release || clientReleaseOption;
|
|
958
1044
|
session.environment = session.environment || clientEnvironmentOption;
|
|
959
1045
|
}
|
|
1046
|
+
|
|
960
1047
|
this.emit('beforeSendSession', session);
|
|
1048
|
+
|
|
961
1049
|
const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
|
|
962
1050
|
|
|
963
1051
|
// sendEnvelope should not throw
|
|
@@ -968,7 +1056,7 @@ class Client {
|
|
|
968
1056
|
/**
|
|
969
1057
|
* Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).
|
|
970
1058
|
*/
|
|
971
|
-
|
|
1059
|
+
recordDroppedEvent(reason, category, count = 1) {
|
|
972
1060
|
if (this._options.sendClientReports) {
|
|
973
1061
|
// We want to track each category (error, transaction, session, replay_event) separately
|
|
974
1062
|
// but still keep the distinction between different type of outcomes.
|
|
@@ -992,8 +1080,8 @@ class Client {
|
|
|
992
1080
|
/**
|
|
993
1081
|
* Register a hook on this client.
|
|
994
1082
|
*/
|
|
995
|
-
|
|
996
|
-
const hooks = this._hooks[hook] = this._hooks[hook] || [];
|
|
1083
|
+
on(hook, callback) {
|
|
1084
|
+
const hooks = (this._hooks[hook] = this._hooks[hook] || []);
|
|
997
1085
|
|
|
998
1086
|
// @ts-expect-error We assume the types are correct
|
|
999
1087
|
hooks.push(callback);
|
|
@@ -1016,7 +1104,7 @@ class Client {
|
|
|
1016
1104
|
/**
|
|
1017
1105
|
* Emit a hook that was previously registered via `on()`.
|
|
1018
1106
|
*/
|
|
1019
|
-
|
|
1107
|
+
emit(hook, ...rest) {
|
|
1020
1108
|
const callbacks = this._hooks[hook];
|
|
1021
1109
|
if (callbacks) {
|
|
1022
1110
|
callbacks.forEach(callback => callback(...rest));
|
|
@@ -1026,36 +1114,39 @@ class Client {
|
|
|
1026
1114
|
/**
|
|
1027
1115
|
* Send an envelope to Sentry.
|
|
1028
1116
|
*/
|
|
1029
|
-
|
|
1117
|
+
sendEnvelope(envelope) {
|
|
1030
1118
|
this.emit('beforeEnvelope', envelope);
|
|
1119
|
+
|
|
1031
1120
|
if (this._isEnabled() && this._transport) {
|
|
1032
1121
|
return this._transport.send(envelope).then(null, reason => {
|
|
1033
1122
|
exports$1.DEBUG_BUILD && exports$1.logger.error('Error while sending envelope:', reason);
|
|
1034
1123
|
return reason;
|
|
1035
1124
|
});
|
|
1036
1125
|
}
|
|
1126
|
+
|
|
1037
1127
|
exports$1.DEBUG_BUILD && exports$1.logger.error('Transport disabled');
|
|
1128
|
+
|
|
1038
1129
|
return exports$1.resolvedSyncPromise({});
|
|
1039
1130
|
}
|
|
1040
1131
|
|
|
1041
1132
|
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
1042
1133
|
|
|
1043
1134
|
/** Setup integrations for this client. */
|
|
1044
|
-
|
|
1045
|
-
const {
|
|
1046
|
-
integrations
|
|
1047
|
-
} = this._options;
|
|
1135
|
+
_setupIntegrations() {
|
|
1136
|
+
const { integrations } = this._options;
|
|
1048
1137
|
this._integrations = setupIntegrations(this, integrations);
|
|
1049
1138
|
afterSetupIntegrations(this, integrations);
|
|
1050
1139
|
}
|
|
1051
1140
|
|
|
1052
1141
|
/** Updates existing session based on the provided event */
|
|
1053
|
-
|
|
1142
|
+
_updateSessionFromEvent(session, event) {
|
|
1054
1143
|
let crashed = event.level === 'fatal';
|
|
1055
1144
|
let errored = false;
|
|
1056
1145
|
const exceptions = event.exception?.values;
|
|
1146
|
+
|
|
1057
1147
|
if (exceptions) {
|
|
1058
1148
|
errored = true;
|
|
1149
|
+
|
|
1059
1150
|
for (const ex of exceptions) {
|
|
1060
1151
|
const mechanism = ex.mechanism;
|
|
1061
1152
|
if (mechanism?.handled === false) {
|
|
@@ -1069,13 +1160,12 @@ class Client {
|
|
|
1069
1160
|
// 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update
|
|
1070
1161
|
// 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update
|
|
1071
1162
|
const sessionNonTerminal = session.status === 'ok';
|
|
1072
|
-
const shouldUpdateAndSend = sessionNonTerminal && session.errors === 0 || sessionNonTerminal && crashed;
|
|
1163
|
+
const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);
|
|
1164
|
+
|
|
1073
1165
|
if (shouldUpdateAndSend) {
|
|
1074
1166
|
exports$1.updateSession(session, {
|
|
1075
|
-
...(crashed && {
|
|
1076
|
-
|
|
1077
|
-
}),
|
|
1078
|
-
errors: session.errors || Number(errored || crashed)
|
|
1167
|
+
...(crashed && { status: 'crashed' }),
|
|
1168
|
+
errors: session.errors || Number(errored || crashed),
|
|
1079
1169
|
});
|
|
1080
1170
|
this.captureSession(session);
|
|
1081
1171
|
}
|
|
@@ -1091,10 +1181,11 @@ class Client {
|
|
|
1091
1181
|
* @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
|
1092
1182
|
* `false` otherwise
|
|
1093
1183
|
*/
|
|
1094
|
-
|
|
1184
|
+
_isClientDoneProcessing(timeout) {
|
|
1095
1185
|
return new exports$1.SyncPromise(resolve => {
|
|
1096
1186
|
let ticked = 0;
|
|
1097
1187
|
const tick = 1;
|
|
1188
|
+
|
|
1098
1189
|
const interval = setInterval(() => {
|
|
1099
1190
|
if (this._numProcessing == 0) {
|
|
1100
1191
|
clearInterval(interval);
|
|
@@ -1111,7 +1202,7 @@ class Client {
|
|
|
1111
1202
|
}
|
|
1112
1203
|
|
|
1113
1204
|
/** Determines whether this SDK is enabled and a transport is present. */
|
|
1114
|
-
|
|
1205
|
+
_isEnabled() {
|
|
1115
1206
|
return this.getOptions().enabled !== false && this._transport !== undefined;
|
|
1116
1207
|
}
|
|
1117
1208
|
|
|
@@ -1129,30 +1220,43 @@ class Client {
|
|
|
1129
1220
|
* @param currentScope A scope containing event metadata.
|
|
1130
1221
|
* @returns A new event with more information.
|
|
1131
1222
|
*/
|
|
1132
|
-
|
|
1223
|
+
_prepareEvent(
|
|
1224
|
+
event,
|
|
1225
|
+
hint,
|
|
1226
|
+
currentScope,
|
|
1227
|
+
isolationScope,
|
|
1228
|
+
) {
|
|
1133
1229
|
const options = this.getOptions();
|
|
1134
1230
|
const integrations = Object.keys(this._integrations);
|
|
1135
1231
|
if (!hint.integrations && integrations?.length) {
|
|
1136
1232
|
hint.integrations = integrations;
|
|
1137
1233
|
}
|
|
1234
|
+
|
|
1138
1235
|
this.emit('preprocessEvent', event, hint);
|
|
1236
|
+
|
|
1139
1237
|
if (!event.type) {
|
|
1140
1238
|
isolationScope.setLastEventId(event.event_id || hint.event_id);
|
|
1141
1239
|
}
|
|
1240
|
+
|
|
1142
1241
|
return exports$1.prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {
|
|
1143
1242
|
if (evt === null) {
|
|
1144
1243
|
return evt;
|
|
1145
1244
|
}
|
|
1245
|
+
|
|
1146
1246
|
this.emit('postprocessEvent', evt, hint);
|
|
1247
|
+
|
|
1147
1248
|
evt.contexts = {
|
|
1148
1249
|
trace: exports$1.getTraceContextFromScope(currentScope),
|
|
1149
|
-
...evt.contexts
|
|
1250
|
+
...evt.contexts,
|
|
1150
1251
|
};
|
|
1252
|
+
|
|
1151
1253
|
const dynamicSamplingContext = exports$1.getDynamicSamplingContextFromScope(this, currentScope);
|
|
1254
|
+
|
|
1152
1255
|
evt.sdkProcessingMetadata = {
|
|
1153
1256
|
dynamicSamplingContext,
|
|
1154
|
-
...evt.sdkProcessingMetadata
|
|
1257
|
+
...evt.sdkProcessingMetadata,
|
|
1155
1258
|
};
|
|
1259
|
+
|
|
1156
1260
|
return evt;
|
|
1157
1261
|
});
|
|
1158
1262
|
}
|
|
@@ -1163,24 +1267,33 @@ class Client {
|
|
|
1163
1267
|
* @param hint
|
|
1164
1268
|
* @param scope
|
|
1165
1269
|
*/
|
|
1166
|
-
|
|
1270
|
+
_captureEvent(
|
|
1271
|
+
event,
|
|
1272
|
+
hint = {},
|
|
1273
|
+
currentScope = exports$1.getCurrentScope(),
|
|
1274
|
+
isolationScope = exports$1.getIsolationScope(),
|
|
1275
|
+
) {
|
|
1167
1276
|
if (exports$1.DEBUG_BUILD && isErrorEvent(event)) {
|
|
1168
1277
|
exports$1.logger.log(`Captured error event \`${getPossibleEventMessages(event)[0] || '<unknown>'}\``);
|
|
1169
1278
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1279
|
+
|
|
1280
|
+
return this._processEvent(event, hint, currentScope, isolationScope).then(
|
|
1281
|
+
finalEvent => {
|
|
1282
|
+
return finalEvent.event_id;
|
|
1283
|
+
},
|
|
1284
|
+
reason => {
|
|
1285
|
+
if (exports$1.DEBUG_BUILD) {
|
|
1286
|
+
if (_isDoNotSendEventError(reason)) {
|
|
1287
|
+
exports$1.logger.log(reason.message);
|
|
1288
|
+
} else if (_isInternalError(reason)) {
|
|
1289
|
+
exports$1.logger.warn(reason.message);
|
|
1290
|
+
} else {
|
|
1291
|
+
exports$1.logger.warn(reason);
|
|
1292
|
+
}
|
|
1180
1293
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1294
|
+
return undefined;
|
|
1295
|
+
},
|
|
1296
|
+
);
|
|
1184
1297
|
}
|
|
1185
1298
|
|
|
1186
1299
|
/**
|
|
@@ -1196,11 +1309,15 @@ class Client {
|
|
|
1196
1309
|
* @param currentScope A scope containing event metadata.
|
|
1197
1310
|
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
|
1198
1311
|
*/
|
|
1199
|
-
|
|
1312
|
+
_processEvent(
|
|
1313
|
+
event,
|
|
1314
|
+
hint,
|
|
1315
|
+
currentScope,
|
|
1316
|
+
isolationScope,
|
|
1317
|
+
) {
|
|
1200
1318
|
const options = this.getOptions();
|
|
1201
|
-
const {
|
|
1202
|
-
|
|
1203
|
-
} = options;
|
|
1319
|
+
const { sampleRate } = options;
|
|
1320
|
+
|
|
1204
1321
|
const isTransaction = isTransactionEvent(event);
|
|
1205
1322
|
const isError = isErrorEvent(event);
|
|
1206
1323
|
const eventType = event.type || 'error';
|
|
@@ -1212,97 +1329,118 @@ class Client {
|
|
|
1212
1329
|
const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate(sampleRate);
|
|
1213
1330
|
if (isError && typeof parsedSampleRate === 'number' && Math.random() > parsedSampleRate) {
|
|
1214
1331
|
this.recordDroppedEvent('sample_rate', 'error');
|
|
1215
|
-
return exports$1.rejectedSyncPromise(
|
|
1332
|
+
return exports$1.rejectedSyncPromise(
|
|
1333
|
+
_makeDoNotSendEventError(
|
|
1334
|
+
`Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,
|
|
1335
|
+
),
|
|
1336
|
+
);
|
|
1216
1337
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1338
|
+
|
|
1339
|
+
const dataCategory = (eventType === 'replay_event' ? 'replay' : eventType) ;
|
|
1340
|
+
|
|
1341
|
+
return this._prepareEvent(event, hint, currentScope, isolationScope)
|
|
1342
|
+
.then(prepared => {
|
|
1343
|
+
if (prepared === null) {
|
|
1344
|
+
this.recordDroppedEvent('event_processor', dataCategory);
|
|
1345
|
+
throw _makeDoNotSendEventError('An event processor returned `null`, will not send event.');
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
const isInternalException = hint.data && (hint.data ).__sentry__ === true;
|
|
1349
|
+
if (isInternalException) {
|
|
1350
|
+
return prepared;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
const result = processBeforeSend(this, options, prepared, hint);
|
|
1354
|
+
return _validateBeforeSendResult(result, beforeSendLabel);
|
|
1355
|
+
})
|
|
1356
|
+
.then(processedEvent => {
|
|
1357
|
+
if (processedEvent === null) {
|
|
1358
|
+
this.recordDroppedEvent('before_send', dataCategory);
|
|
1359
|
+
if (isTransaction) {
|
|
1360
|
+
const spans = event.spans || [];
|
|
1361
|
+
// the transaction itself counts as one span, plus all the child spans that are added
|
|
1362
|
+
const spanCount = 1 + spans.length;
|
|
1363
|
+
this.recordDroppedEvent('before_send', 'span', spanCount);
|
|
1364
|
+
}
|
|
1365
|
+
throw _makeDoNotSendEventError(`${beforeSendLabel} returned \`null\`, will not send event.`);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
const session = currentScope.getSession() || isolationScope.getSession();
|
|
1369
|
+
if (isError && session) {
|
|
1370
|
+
this._updateSessionFromEvent(session, processedEvent);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1232
1373
|
if (isTransaction) {
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1374
|
+
const spanCountBefore = processedEvent.sdkProcessingMetadata?.spanCountBeforeProcessing || 0;
|
|
1375
|
+
const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0;
|
|
1376
|
+
|
|
1377
|
+
const droppedSpanCount = spanCountBefore - spanCountAfter;
|
|
1378
|
+
if (droppedSpanCount > 0) {
|
|
1379
|
+
this.recordDroppedEvent('before_send', 'span', droppedSpanCount);
|
|
1380
|
+
}
|
|
1237
1381
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
this.recordDroppedEvent('before_send', 'span', droppedSpanCount);
|
|
1382
|
+
|
|
1383
|
+
// None of the Sentry built event processor will update transaction name,
|
|
1384
|
+
// so if the transaction name has been changed by an event processor, we know
|
|
1385
|
+
// it has to come from custom event processor added by a user
|
|
1386
|
+
const transactionInfo = processedEvent.transaction_info;
|
|
1387
|
+
if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {
|
|
1388
|
+
const source = 'custom';
|
|
1389
|
+
processedEvent.transaction_info = {
|
|
1390
|
+
...transactionInfo,
|
|
1391
|
+
source,
|
|
1392
|
+
};
|
|
1250
1393
|
}
|
|
1251
|
-
}
|
|
1252
1394
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
this.captureException(reason, {
|
|
1271
|
-
data: {
|
|
1272
|
-
__sentry__: true
|
|
1273
|
-
},
|
|
1274
|
-
originalException: reason
|
|
1395
|
+
this.sendEvent(processedEvent, hint);
|
|
1396
|
+
return processedEvent;
|
|
1397
|
+
})
|
|
1398
|
+
.then(null, reason => {
|
|
1399
|
+
if (_isDoNotSendEventError(reason) || _isInternalError(reason)) {
|
|
1400
|
+
throw reason;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
this.captureException(reason, {
|
|
1404
|
+
data: {
|
|
1405
|
+
__sentry__: true,
|
|
1406
|
+
},
|
|
1407
|
+
originalException: reason,
|
|
1408
|
+
});
|
|
1409
|
+
throw _makeInternalError(
|
|
1410
|
+
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`,
|
|
1411
|
+
);
|
|
1275
1412
|
});
|
|
1276
|
-
throw _makeInternalError(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`);
|
|
1277
|
-
});
|
|
1278
1413
|
}
|
|
1279
1414
|
|
|
1280
1415
|
/**
|
|
1281
1416
|
* Occupies the client with processing and event
|
|
1282
1417
|
*/
|
|
1283
|
-
|
|
1418
|
+
_process(promise) {
|
|
1284
1419
|
this._numProcessing++;
|
|
1285
|
-
void promise.then(
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1420
|
+
void promise.then(
|
|
1421
|
+
value => {
|
|
1422
|
+
this._numProcessing--;
|
|
1423
|
+
return value;
|
|
1424
|
+
},
|
|
1425
|
+
reason => {
|
|
1426
|
+
this._numProcessing--;
|
|
1427
|
+
return reason;
|
|
1428
|
+
},
|
|
1429
|
+
);
|
|
1292
1430
|
}
|
|
1293
1431
|
|
|
1294
1432
|
/**
|
|
1295
1433
|
* Clears outcomes on this client and returns them.
|
|
1296
1434
|
*/
|
|
1297
|
-
|
|
1435
|
+
_clearOutcomes() {
|
|
1298
1436
|
const outcomes = this._outcomes;
|
|
1299
1437
|
this._outcomes = {};
|
|
1300
1438
|
return Object.entries(outcomes).map(([key, quantity]) => {
|
|
1301
|
-
const [reason, category] = key.split(':');
|
|
1439
|
+
const [reason, category] = key.split(':') ;
|
|
1302
1440
|
return {
|
|
1303
1441
|
reason,
|
|
1304
1442
|
category,
|
|
1305
|
-
quantity
|
|
1443
|
+
quantity,
|
|
1306
1444
|
};
|
|
1307
1445
|
});
|
|
1308
1446
|
}
|
|
@@ -1310,9 +1448,11 @@ class Client {
|
|
|
1310
1448
|
/**
|
|
1311
1449
|
* Sends client reports as an envelope.
|
|
1312
1450
|
*/
|
|
1313
|
-
|
|
1451
|
+
_flushOutcomes() {
|
|
1314
1452
|
exports$1.DEBUG_BUILD && exports$1.logger.log('Flushing outcomes...');
|
|
1453
|
+
|
|
1315
1454
|
const outcomes = this._clearOutcomes();
|
|
1455
|
+
|
|
1316
1456
|
if (outcomes.length === 0) {
|
|
1317
1457
|
exports$1.DEBUG_BUILD && exports$1.logger.log('No outcomes to send');
|
|
1318
1458
|
return;
|
|
@@ -1323,7 +1463,9 @@ class Client {
|
|
|
1323
1463
|
exports$1.DEBUG_BUILD && exports$1.logger.log('No dsn provided, will not send outcomes');
|
|
1324
1464
|
return;
|
|
1325
1465
|
}
|
|
1466
|
+
|
|
1326
1467
|
exports$1.DEBUG_BUILD && exports$1.logger.log('Sending outcomes:', outcomes);
|
|
1468
|
+
|
|
1327
1469
|
const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && exports$1.dsnToString(this._dsn));
|
|
1328
1470
|
|
|
1329
1471
|
// sendEnvelope should not throw
|
|
@@ -1334,22 +1476,29 @@ class Client {
|
|
|
1334
1476
|
/**
|
|
1335
1477
|
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
1336
1478
|
*/
|
|
1479
|
+
|
|
1337
1480
|
}
|
|
1338
1481
|
|
|
1339
1482
|
/**
|
|
1340
1483
|
* Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
|
|
1341
1484
|
*/
|
|
1342
|
-
function _validateBeforeSendResult(
|
|
1485
|
+
function _validateBeforeSendResult(
|
|
1486
|
+
beforeSendResult,
|
|
1487
|
+
beforeSendLabel,
|
|
1488
|
+
) {
|
|
1343
1489
|
const invalidValueError = `${beforeSendLabel} must return \`null\` or a valid event.`;
|
|
1344
1490
|
if (exports$1.isThenable(beforeSendResult)) {
|
|
1345
|
-
return beforeSendResult.then(
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1491
|
+
return beforeSendResult.then(
|
|
1492
|
+
event => {
|
|
1493
|
+
if (!exports$1.isPlainObject(event) && event !== null) {
|
|
1494
|
+
throw _makeInternalError(invalidValueError);
|
|
1495
|
+
}
|
|
1496
|
+
return event;
|
|
1497
|
+
},
|
|
1498
|
+
e => {
|
|
1499
|
+
throw _makeInternalError(`${beforeSendLabel} rejected with ${e}`);
|
|
1500
|
+
},
|
|
1501
|
+
);
|
|
1353
1502
|
} else if (!exports$1.isPlainObject(beforeSendResult) && beforeSendResult !== null) {
|
|
1354
1503
|
throw _makeInternalError(invalidValueError);
|
|
1355
1504
|
}
|
|
@@ -1359,16 +1508,19 @@ function _validateBeforeSendResult(beforeSendResult, beforeSendLabel) {
|
|
|
1359
1508
|
/**
|
|
1360
1509
|
* Process the matching `beforeSendXXX` callback.
|
|
1361
1510
|
*/
|
|
1362
|
-
function processBeforeSend(
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1511
|
+
function processBeforeSend(
|
|
1512
|
+
client,
|
|
1513
|
+
options,
|
|
1514
|
+
event,
|
|
1515
|
+
hint,
|
|
1516
|
+
) {
|
|
1517
|
+
const { beforeSend, beforeSendTransaction, beforeSendSpan } = options;
|
|
1368
1518
|
let processedEvent = event;
|
|
1519
|
+
|
|
1369
1520
|
if (isErrorEvent(processedEvent) && beforeSend) {
|
|
1370
1521
|
return beforeSend(processedEvent, hint);
|
|
1371
1522
|
}
|
|
1523
|
+
|
|
1372
1524
|
if (isTransactionEvent(processedEvent)) {
|
|
1373
1525
|
if (beforeSendSpan) {
|
|
1374
1526
|
// process root span
|
|
@@ -1395,6 +1547,7 @@ function processBeforeSend(client, options, event, hint) {
|
|
|
1395
1547
|
processedEvent.spans = processedSpans;
|
|
1396
1548
|
}
|
|
1397
1549
|
}
|
|
1550
|
+
|
|
1398
1551
|
if (beforeSendTransaction) {
|
|
1399
1552
|
if (processedEvent.spans) {
|
|
1400
1553
|
// We store the # of spans before processing in SDK metadata,
|
|
@@ -1402,17 +1555,20 @@ function processBeforeSend(client, options, event, hint) {
|
|
|
1402
1555
|
const spanCountBefore = processedEvent.spans.length;
|
|
1403
1556
|
processedEvent.sdkProcessingMetadata = {
|
|
1404
1557
|
...event.sdkProcessingMetadata,
|
|
1405
|
-
spanCountBeforeProcessing: spanCountBefore
|
|
1558
|
+
spanCountBeforeProcessing: spanCountBefore,
|
|
1406
1559
|
};
|
|
1407
1560
|
}
|
|
1408
|
-
return beforeSendTransaction(processedEvent, hint);
|
|
1561
|
+
return beforeSendTransaction(processedEvent , hint);
|
|
1409
1562
|
}
|
|
1410
1563
|
}
|
|
1564
|
+
|
|
1411
1565
|
return processedEvent;
|
|
1412
1566
|
}
|
|
1567
|
+
|
|
1413
1568
|
function isErrorEvent(event) {
|
|
1414
1569
|
return event.type === undefined;
|
|
1415
1570
|
}
|
|
1571
|
+
|
|
1416
1572
|
function isTransactionEvent(event) {
|
|
1417
1573
|
return event.type === 'transaction';
|
|
1418
1574
|
}
|
|
@@ -1424,13 +1580,16 @@ function isTransactionEvent(event) {
|
|
|
1424
1580
|
* @returns The created log container envelope item.
|
|
1425
1581
|
*/
|
|
1426
1582
|
function createLogContainerEnvelopeItem(items) {
|
|
1427
|
-
return [
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1583
|
+
return [
|
|
1584
|
+
{
|
|
1585
|
+
type: 'log',
|
|
1586
|
+
item_count: items.length,
|
|
1587
|
+
content_type: 'application/vnd.sentry.items.log+json',
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
items,
|
|
1591
|
+
},
|
|
1592
|
+
];
|
|
1434
1593
|
}
|
|
1435
1594
|
|
|
1436
1595
|
/**
|
|
@@ -1444,17 +1603,25 @@ function createLogContainerEnvelopeItem(items) {
|
|
|
1444
1603
|
* @param dsn - The DSN to include in the envelope.
|
|
1445
1604
|
* @returns The created envelope.
|
|
1446
1605
|
*/
|
|
1447
|
-
function createLogEnvelope(
|
|
1606
|
+
function createLogEnvelope(
|
|
1607
|
+
logs,
|
|
1608
|
+
metadata,
|
|
1609
|
+
tunnel,
|
|
1610
|
+
dsn,
|
|
1611
|
+
) {
|
|
1448
1612
|
const headers = {};
|
|
1613
|
+
|
|
1449
1614
|
if (metadata?.sdk) {
|
|
1450
1615
|
headers.sdk = {
|
|
1451
1616
|
name: metadata.sdk.name,
|
|
1452
|
-
version: metadata.sdk.version
|
|
1617
|
+
version: metadata.sdk.version,
|
|
1453
1618
|
};
|
|
1454
1619
|
}
|
|
1620
|
+
|
|
1455
1621
|
if (!!tunnel && !!dsn) {
|
|
1456
1622
|
headers.dsn = exports$1.dsnToString(dsn);
|
|
1457
1623
|
}
|
|
1624
|
+
|
|
1458
1625
|
return createEnvelope(headers, [createLogContainerEnvelopeItem(logs)]);
|
|
1459
1626
|
}
|
|
1460
1627
|
|
|
@@ -1475,11 +1642,13 @@ function _INTERNAL_flushLogsBuffer(client, maybeLogBuffer) {
|
|
|
1475
1642
|
if (logBuffer.length === 0) {
|
|
1476
1643
|
return;
|
|
1477
1644
|
}
|
|
1645
|
+
|
|
1478
1646
|
const clientOptions = client.getOptions();
|
|
1479
1647
|
const envelope = createLogEnvelope(logBuffer, clientOptions._metadata, clientOptions.tunnel, client.getDsn());
|
|
1480
1648
|
|
|
1481
1649
|
// Clear the log buffer after envelopes have been constructed.
|
|
1482
1650
|
exports$1.GLOBAL_OBJ._sentryClientToLogBufferMap?.set(client, []);
|
|
1651
|
+
|
|
1483
1652
|
client.emit('flushLogs');
|
|
1484
1653
|
|
|
1485
1654
|
// sendEnvelope should not throw
|
|
@@ -1508,7 +1677,10 @@ function _INTERNAL_getLogBuffer(client) {
|
|
|
1508
1677
|
* @param clientClass The client class to instantiate.
|
|
1509
1678
|
* @param options Options to pass to the client.
|
|
1510
1679
|
*/
|
|
1511
|
-
function initAndBind(
|
|
1680
|
+
function initAndBind(
|
|
1681
|
+
clientClass,
|
|
1682
|
+
options,
|
|
1683
|
+
) {
|
|
1512
1684
|
if (options.debug === true) {
|
|
1513
1685
|
if (exports$1.DEBUG_BUILD) {
|
|
1514
1686
|
exports$1.logger.enable();
|
|
@@ -1522,6 +1694,7 @@ function initAndBind(clientClass, options) {
|
|
|
1522
1694
|
}
|
|
1523
1695
|
const scope = exports$1.getCurrentScope();
|
|
1524
1696
|
scope.update(options.initialScope);
|
|
1697
|
+
|
|
1525
1698
|
const client = new clientClass(options);
|
|
1526
1699
|
setCurrentClient(client);
|
|
1527
1700
|
client.init();
|
|
@@ -1543,6 +1716,7 @@ const SENTRY_BUFFER_FULL_ERROR = Symbol.for('SentryBufferFullError');
|
|
|
1543
1716
|
*/
|
|
1544
1717
|
function makePromiseBuffer(limit) {
|
|
1545
1718
|
const buffer = [];
|
|
1719
|
+
|
|
1546
1720
|
function isReady() {
|
|
1547
1721
|
return limit === undefined || buffer.length < limit;
|
|
1548
1722
|
}
|
|
@@ -1577,13 +1751,16 @@ function makePromiseBuffer(limit) {
|
|
|
1577
1751
|
if (buffer.indexOf(task) === -1) {
|
|
1578
1752
|
buffer.push(task);
|
|
1579
1753
|
}
|
|
1580
|
-
void task
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1754
|
+
void task
|
|
1755
|
+
.then(() => remove(task))
|
|
1756
|
+
// Use `then(null, rejectionHandler)` rather than `catch(rejectionHandler)` so that we can use `PromiseLike`
|
|
1757
|
+
// rather than `Promise`. `PromiseLike` doesn't have a `.catch` method, making its polyfill smaller. (ES5 didn't
|
|
1758
|
+
// have promises, so TS has to polyfill when down-compiling.)
|
|
1759
|
+
.then(null, () =>
|
|
1760
|
+
remove(task).then(null, () => {
|
|
1761
|
+
// We have to add another catch here because `remove()` starts a new promise chain.
|
|
1762
|
+
}),
|
|
1763
|
+
);
|
|
1587
1764
|
return task;
|
|
1588
1765
|
}
|
|
1589
1766
|
|
|
@@ -1599,6 +1776,7 @@ function makePromiseBuffer(limit) {
|
|
|
1599
1776
|
function drain(timeout) {
|
|
1600
1777
|
return new exports$1.SyncPromise((resolve, reject) => {
|
|
1601
1778
|
let counter = buffer.length;
|
|
1779
|
+
|
|
1602
1780
|
if (!counter) {
|
|
1603
1781
|
return resolve(true);
|
|
1604
1782
|
}
|
|
@@ -1613,7 +1791,7 @@ function makePromiseBuffer(limit) {
|
|
|
1613
1791
|
// if all promises resolve in time, cancel the timer and resolve to `true`
|
|
1614
1792
|
buffer.forEach(item => {
|
|
1615
1793
|
void exports$1.resolvedSyncPromise(item).then(() => {
|
|
1616
|
-
if (
|
|
1794
|
+
if (!--counter) {
|
|
1617
1795
|
clearTimeout(capturedSetTimeout);
|
|
1618
1796
|
resolve(true);
|
|
1619
1797
|
}
|
|
@@ -1621,10 +1799,11 @@ function makePromiseBuffer(limit) {
|
|
|
1621
1799
|
});
|
|
1622
1800
|
});
|
|
1623
1801
|
}
|
|
1802
|
+
|
|
1624
1803
|
return {
|
|
1625
1804
|
$: buffer,
|
|
1626
1805
|
add,
|
|
1627
|
-
drain
|
|
1806
|
+
drain,
|
|
1628
1807
|
};
|
|
1629
1808
|
}
|
|
1630
1809
|
|
|
@@ -1643,10 +1822,12 @@ function parseRetryAfterHeader(header, now = Date.now()) {
|
|
|
1643
1822
|
if (!isNaN(headerDelay)) {
|
|
1644
1823
|
return headerDelay * 1000;
|
|
1645
1824
|
}
|
|
1825
|
+
|
|
1646
1826
|
const headerDate = Date.parse(`${header}`);
|
|
1647
1827
|
if (!isNaN(headerDate)) {
|
|
1648
1828
|
return headerDate - now;
|
|
1649
1829
|
}
|
|
1830
|
+
|
|
1650
1831
|
return DEFAULT_RETRY_AFTER;
|
|
1651
1832
|
}
|
|
1652
1833
|
|
|
@@ -1673,18 +1854,20 @@ function isRateLimited(limits, dataCategory, now = Date.now()) {
|
|
|
1673
1854
|
*
|
|
1674
1855
|
* @return the updated RateLimits object.
|
|
1675
1856
|
*/
|
|
1676
|
-
function updateRateLimits(
|
|
1677
|
-
|
|
1678
|
-
headers
|
|
1679
|
-
|
|
1857
|
+
function updateRateLimits(
|
|
1858
|
+
limits,
|
|
1859
|
+
{ statusCode, headers },
|
|
1860
|
+
now = Date.now(),
|
|
1861
|
+
) {
|
|
1680
1862
|
const updatedRateLimits = {
|
|
1681
|
-
...limits
|
|
1863
|
+
...limits,
|
|
1682
1864
|
};
|
|
1683
1865
|
|
|
1684
1866
|
// "The name is case-insensitive."
|
|
1685
1867
|
// https://developer.mozilla.org/en-US/docs/Web/API/Headers/get
|
|
1686
1868
|
const rateLimitHeader = headers?.['x-sentry-rate-limits'];
|
|
1687
1869
|
const retryAfterHeader = headers?.['retry-after'];
|
|
1870
|
+
|
|
1688
1871
|
if (rateLimitHeader) {
|
|
1689
1872
|
/**
|
|
1690
1873
|
* rate limit headers are of the form
|
|
@@ -1701,7 +1884,7 @@ function updateRateLimits(limits, {
|
|
|
1701
1884
|
* Only present if rate limit applies to the metric_bucket data category.
|
|
1702
1885
|
*/
|
|
1703
1886
|
for (const limit of rateLimitHeader.trim().split(',')) {
|
|
1704
|
-
const [retryAfter, categories
|
|
1887
|
+
const [retryAfter, categories, , , namespaces] = limit.split(':', 5) ;
|
|
1705
1888
|
const headerDelay = parseInt(retryAfter, 10);
|
|
1706
1889
|
const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default
|
|
1707
1890
|
if (!categories) {
|
|
@@ -1724,6 +1907,7 @@ function updateRateLimits(limits, {
|
|
|
1724
1907
|
} else if (statusCode === 429) {
|
|
1725
1908
|
updatedRateLimits.all = now + 60 * 1000;
|
|
1726
1909
|
}
|
|
1910
|
+
|
|
1727
1911
|
return updatedRateLimits;
|
|
1728
1912
|
}
|
|
1729
1913
|
|
|
@@ -1735,9 +1919,16 @@ const DEFAULT_TRANSPORT_BUFFER_SIZE = 64;
|
|
|
1735
1919
|
* @param options
|
|
1736
1920
|
* @param makeRequest
|
|
1737
1921
|
*/
|
|
1738
|
-
function createTransport(
|
|
1922
|
+
function createTransport(
|
|
1923
|
+
options,
|
|
1924
|
+
makeRequest,
|
|
1925
|
+
buffer = makePromiseBuffer(
|
|
1926
|
+
options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE,
|
|
1927
|
+
),
|
|
1928
|
+
) {
|
|
1739
1929
|
let rateLimits = {};
|
|
1740
|
-
const flush = timeout => buffer.drain(timeout);
|
|
1930
|
+
const flush = (timeout) => buffer.drain(timeout);
|
|
1931
|
+
|
|
1741
1932
|
function send(envelope) {
|
|
1742
1933
|
const filteredEnvelopeItems = [];
|
|
1743
1934
|
|
|
@@ -1755,41 +1946,51 @@ function createTransport(options, makeRequest, buffer = makePromiseBuffer(option
|
|
|
1755
1946
|
if (filteredEnvelopeItems.length === 0) {
|
|
1756
1947
|
return exports$1.resolvedSyncPromise({});
|
|
1757
1948
|
}
|
|
1758
|
-
|
|
1949
|
+
|
|
1950
|
+
const filteredEnvelope = createEnvelope(envelope[0], filteredEnvelopeItems );
|
|
1759
1951
|
|
|
1760
1952
|
// Creates client report for each item in an envelope
|
|
1761
|
-
const recordEnvelopeLoss = reason => {
|
|
1953
|
+
const recordEnvelopeLoss = (reason) => {
|
|
1762
1954
|
forEachEnvelopeItem(filteredEnvelope, (item, type) => {
|
|
1763
1955
|
options.recordDroppedEvent(reason, envelopeItemTypeToDataCategory(type));
|
|
1764
1956
|
});
|
|
1765
1957
|
};
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1958
|
+
|
|
1959
|
+
const requestTask = () =>
|
|
1960
|
+
makeRequest({ body: serializeEnvelope(filteredEnvelope) }).then(
|
|
1961
|
+
response => {
|
|
1962
|
+
// We don't want to throw on NOK responses, but we want to at least log them
|
|
1963
|
+
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode >= 300)) {
|
|
1964
|
+
exports$1.DEBUG_BUILD && exports$1.logger.warn(`Sentry responded with status code ${response.statusCode} to sent event.`);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
rateLimits = updateRateLimits(rateLimits, response);
|
|
1968
|
+
return response;
|
|
1969
|
+
},
|
|
1970
|
+
error => {
|
|
1971
|
+
recordEnvelopeLoss('network_error');
|
|
1972
|
+
exports$1.DEBUG_BUILD && exports$1.logger.error('Encountered error running transport request:', error);
|
|
1973
|
+
throw error;
|
|
1974
|
+
},
|
|
1975
|
+
);
|
|
1976
|
+
|
|
1977
|
+
return buffer.add(requestTask).then(
|
|
1978
|
+
result => result,
|
|
1979
|
+
error => {
|
|
1980
|
+
if (error === SENTRY_BUFFER_FULL_ERROR) {
|
|
1981
|
+
exports$1.DEBUG_BUILD && exports$1.logger.error('Skipped sending event because buffer is full.');
|
|
1982
|
+
recordEnvelopeLoss('queue_overflow');
|
|
1983
|
+
return exports$1.resolvedSyncPromise({});
|
|
1984
|
+
} else {
|
|
1985
|
+
throw error;
|
|
1986
|
+
}
|
|
1987
|
+
},
|
|
1988
|
+
);
|
|
1789
1989
|
}
|
|
1990
|
+
|
|
1790
1991
|
return {
|
|
1791
1992
|
send,
|
|
1792
|
-
flush
|
|
1993
|
+
flush,
|
|
1793
1994
|
};
|
|
1794
1995
|
}
|
|
1795
1996
|
|
|
@@ -1804,7 +2005,7 @@ function addAutoIpAddressToUser(objWithMaybeUser) {
|
|
|
1804
2005
|
if (objWithMaybeUser.user?.ip_address === undefined) {
|
|
1805
2006
|
objWithMaybeUser.user = {
|
|
1806
2007
|
...objWithMaybeUser.user,
|
|
1807
|
-
ip_address: '{{auto}}'
|
|
2008
|
+
ip_address: '{{auto}}',
|
|
1808
2009
|
};
|
|
1809
2010
|
}
|
|
1810
2011
|
}
|
|
@@ -1817,7 +2018,7 @@ function addAutoIpAddressToSession(session) {
|
|
|
1817
2018
|
if (session.attrs?.['ip_address'] === undefined) {
|
|
1818
2019
|
session.attrs = {
|
|
1819
2020
|
...session.attrs,
|
|
1820
|
-
ip_address: '{{auto}}'
|
|
2021
|
+
ip_address: '{{auto}}',
|
|
1821
2022
|
};
|
|
1822
2023
|
}
|
|
1823
2024
|
} else {
|
|
@@ -1842,16 +2043,18 @@ function addAutoIpAddressToSession(session) {
|
|
|
1842
2043
|
*/
|
|
1843
2044
|
function applySdkMetadata(options, name, names = [name], source = 'npm') {
|
|
1844
2045
|
const metadata = options._metadata || {};
|
|
2046
|
+
|
|
1845
2047
|
if (!metadata.sdk) {
|
|
1846
2048
|
metadata.sdk = {
|
|
1847
2049
|
name: `sentry.javascript.${name}`,
|
|
1848
2050
|
packages: names.map(name => ({
|
|
1849
2051
|
name: `${source}:@sentry/${name}`,
|
|
1850
|
-
version: exports$1.SDK_VERSION
|
|
2052
|
+
version: exports$1.SDK_VERSION,
|
|
1851
2053
|
})),
|
|
1852
|
-
version: exports$1.SDK_VERSION
|
|
2054
|
+
version: exports$1.SDK_VERSION,
|
|
1853
2055
|
};
|
|
1854
2056
|
}
|
|
2057
|
+
|
|
1855
2058
|
options._metadata = metadata;
|
|
1856
2059
|
}
|
|
1857
2060
|
|
|
@@ -1870,29 +2073,35 @@ const DEFAULT_BREADCRUMBS = 100;
|
|
|
1870
2073
|
function addBreadcrumb(breadcrumb, hint) {
|
|
1871
2074
|
const client = exports$1.getClient();
|
|
1872
2075
|
const isolationScope = exports$1.getIsolationScope();
|
|
2076
|
+
|
|
1873
2077
|
if (!client) return;
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
} = client.getOptions();
|
|
2078
|
+
|
|
2079
|
+
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();
|
|
2080
|
+
|
|
1878
2081
|
if (maxBreadcrumbs <= 0) return;
|
|
2082
|
+
|
|
1879
2083
|
const timestamp = exports$1.dateTimestampInSeconds();
|
|
1880
|
-
const mergedBreadcrumb = {
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2084
|
+
const mergedBreadcrumb = { timestamp, ...breadcrumb };
|
|
2085
|
+
const finalBreadcrumb = beforeBreadcrumb
|
|
2086
|
+
? (exports$1.consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) )
|
|
2087
|
+
: mergedBreadcrumb;
|
|
2088
|
+
|
|
1885
2089
|
if (finalBreadcrumb === null) return;
|
|
2090
|
+
|
|
1886
2091
|
if (client.emit) {
|
|
1887
2092
|
client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);
|
|
1888
2093
|
}
|
|
2094
|
+
|
|
1889
2095
|
isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
|
|
1890
2096
|
}
|
|
1891
2097
|
|
|
1892
2098
|
let originalFunctionToString;
|
|
2099
|
+
|
|
1893
2100
|
const INTEGRATION_NAME$6 = 'FunctionToString';
|
|
2101
|
+
|
|
1894
2102
|
const SETUP_CLIENTS = new WeakMap();
|
|
1895
|
-
|
|
2103
|
+
|
|
2104
|
+
const _functionToStringIntegration = (() => {
|
|
1896
2105
|
return {
|
|
1897
2106
|
name: INTEGRATION_NAME$6,
|
|
1898
2107
|
setupOnce() {
|
|
@@ -1902,9 +2111,10 @@ const _functionToStringIntegration = () => {
|
|
|
1902
2111
|
// intrinsics (like Function.prototype) might be immutable in some environments
|
|
1903
2112
|
// e.g. Node with --frozen-intrinsics, XS (an embedded JavaScript engine) or SES (a JavaScript proposal)
|
|
1904
2113
|
try {
|
|
1905
|
-
Function.prototype.toString = function (...args) {
|
|
2114
|
+
Function.prototype.toString = function ( ...args) {
|
|
1906
2115
|
const originalFunction = exports$1.getOriginalFunction(this);
|
|
1907
|
-
const context =
|
|
2116
|
+
const context =
|
|
2117
|
+
SETUP_CLIENTS.has(exports$1.getClient() ) && originalFunction !== undefined ? originalFunction : this;
|
|
1908
2118
|
return originalFunctionToString.apply(context, args);
|
|
1909
2119
|
};
|
|
1910
2120
|
} catch {
|
|
@@ -1913,9 +2123,9 @@ const _functionToStringIntegration = () => {
|
|
|
1913
2123
|
},
|
|
1914
2124
|
setup(client) {
|
|
1915
2125
|
SETUP_CLIENTS.set(client, true);
|
|
1916
|
-
}
|
|
2126
|
+
},
|
|
1917
2127
|
};
|
|
1918
|
-
};
|
|
2128
|
+
}) ;
|
|
1919
2129
|
|
|
1920
2130
|
/**
|
|
1921
2131
|
* Patch toString calls to return proper name for wrapped functions.
|
|
@@ -1932,23 +2142,18 @@ const functionToStringIntegration = defineIntegration(_functionToStringIntegrati
|
|
|
1932
2142
|
|
|
1933
2143
|
// "Script error." is hard coded into browsers for errors that it can't read.
|
|
1934
2144
|
// this is the result of a script being pulled in from an external domain and CORS.
|
|
1935
|
-
const DEFAULT_IGNORE_ERRORS = [
|
|
1936
|
-
|
|
1937
|
-
/^
|
|
1938
|
-
//
|
|
1939
|
-
/^
|
|
1940
|
-
// Error from Google Search App https://issuetracker.google.com/issues/396043331
|
|
1941
|
-
/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,
|
|
1942
|
-
|
|
1943
|
-
'
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
"Can't find variable: _AutofillCallbackHandler",
|
|
1948
|
-
// Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/
|
|
1949
|
-
/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,
|
|
1950
|
-
// unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps
|
|
1951
|
-
/^Java exception was raised during method invocation$/ // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)
|
|
2145
|
+
const DEFAULT_IGNORE_ERRORS = [
|
|
2146
|
+
/^Script error\.?$/,
|
|
2147
|
+
/^Javascript error: Script error\.? on line 0$/,
|
|
2148
|
+
/^ResizeObserver loop completed with undelivered notifications.$/, // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.
|
|
2149
|
+
/^Cannot redefine property: googletag$/, // This is thrown when google tag manager is used in combination with an ad blocker
|
|
2150
|
+
/^Can't find variable: gmo$/, // Error from Google Search App https://issuetracker.google.com/issues/396043331
|
|
2151
|
+
/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/, // Random error that happens but not actionable or noticeable to end-users.
|
|
2152
|
+
'can\'t redefine non-configurable property "solana"', // Probably a browser extension or custom browser (Brave) throwing this error
|
|
2153
|
+
"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)", // Error thrown by GTM, seemingly not affecting end-users
|
|
2154
|
+
"Can't find variable: _AutofillCallbackHandler", // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/
|
|
2155
|
+
/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/, // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps
|
|
2156
|
+
/^Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)
|
|
1952
2157
|
];
|
|
1953
2158
|
|
|
1954
2159
|
/** Options for the EventFilters integration */
|
|
@@ -1982,7 +2187,7 @@ const eventFiltersIntegration = defineIntegration((options = {}) => {
|
|
|
1982
2187
|
mergedOptions = _mergeOptions(options, clientOptions);
|
|
1983
2188
|
}
|
|
1984
2189
|
return _shouldDropEvent$1(event, mergedOptions) ? null : event;
|
|
1985
|
-
}
|
|
2190
|
+
},
|
|
1986
2191
|
};
|
|
1987
2192
|
});
|
|
1988
2193
|
|
|
@@ -2002,62 +2207,97 @@ const eventFiltersIntegration = defineIntegration((options = {}) => {
|
|
|
2002
2207
|
* @deprecated this integration was renamed and will be removed in a future major version.
|
|
2003
2208
|
* Use `eventFiltersIntegration` instead.
|
|
2004
2209
|
*/
|
|
2005
|
-
const inboundFiltersIntegration = defineIntegration((options = {}) => {
|
|
2210
|
+
const inboundFiltersIntegration = defineIntegration(((options = {}) => {
|
|
2006
2211
|
return {
|
|
2007
2212
|
...eventFiltersIntegration(options),
|
|
2008
|
-
name: 'InboundFilters'
|
|
2213
|
+
name: 'InboundFilters',
|
|
2009
2214
|
};
|
|
2010
|
-
});
|
|
2011
|
-
|
|
2215
|
+
}) );
|
|
2216
|
+
|
|
2217
|
+
function _mergeOptions(
|
|
2218
|
+
internalOptions = {},
|
|
2219
|
+
clientOptions = {},
|
|
2220
|
+
) {
|
|
2012
2221
|
return {
|
|
2013
2222
|
allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],
|
|
2014
2223
|
denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],
|
|
2015
|
-
ignoreErrors: [
|
|
2016
|
-
|
|
2224
|
+
ignoreErrors: [
|
|
2225
|
+
...(internalOptions.ignoreErrors || []),
|
|
2226
|
+
...(clientOptions.ignoreErrors || []),
|
|
2227
|
+
...(internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS),
|
|
2228
|
+
],
|
|
2229
|
+
ignoreTransactions: [...(internalOptions.ignoreTransactions || []), ...(clientOptions.ignoreTransactions || [])],
|
|
2017
2230
|
};
|
|
2018
2231
|
}
|
|
2232
|
+
|
|
2019
2233
|
function _shouldDropEvent$1(event, options) {
|
|
2020
2234
|
if (!event.type) {
|
|
2021
2235
|
// Filter errors
|
|
2022
2236
|
if (_isIgnoredError(event, options.ignoreErrors)) {
|
|
2023
|
-
exports$1.DEBUG_BUILD &&
|
|
2237
|
+
exports$1.DEBUG_BUILD &&
|
|
2238
|
+
exports$1.logger.warn(
|
|
2239
|
+
`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${exports$1.getEventDescription(event)}`,
|
|
2240
|
+
);
|
|
2024
2241
|
return true;
|
|
2025
2242
|
}
|
|
2026
2243
|
if (_isUselessError(event)) {
|
|
2027
|
-
exports$1.DEBUG_BUILD &&
|
|
2244
|
+
exports$1.DEBUG_BUILD &&
|
|
2245
|
+
exports$1.logger.warn(
|
|
2246
|
+
`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${exports$1.getEventDescription(
|
|
2247
|
+
event,
|
|
2248
|
+
)}`,
|
|
2249
|
+
);
|
|
2028
2250
|
return true;
|
|
2029
2251
|
}
|
|
2030
2252
|
if (_isDeniedUrl(event, options.denyUrls)) {
|
|
2031
|
-
exports$1.DEBUG_BUILD &&
|
|
2253
|
+
exports$1.DEBUG_BUILD &&
|
|
2254
|
+
exports$1.logger.warn(
|
|
2255
|
+
`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${exports$1.getEventDescription(
|
|
2256
|
+
event,
|
|
2257
|
+
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
|
2258
|
+
);
|
|
2032
2259
|
return true;
|
|
2033
2260
|
}
|
|
2034
2261
|
if (!_isAllowedUrl(event, options.allowUrls)) {
|
|
2035
|
-
exports$1.DEBUG_BUILD &&
|
|
2262
|
+
exports$1.DEBUG_BUILD &&
|
|
2263
|
+
exports$1.logger.warn(
|
|
2264
|
+
`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${exports$1.getEventDescription(
|
|
2265
|
+
event,
|
|
2266
|
+
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
|
2267
|
+
);
|
|
2036
2268
|
return true;
|
|
2037
2269
|
}
|
|
2038
2270
|
} else if (event.type === 'transaction') {
|
|
2039
2271
|
// Filter transactions
|
|
2040
2272
|
|
|
2041
2273
|
if (_isIgnoredTransaction(event, options.ignoreTransactions)) {
|
|
2042
|
-
exports$1.DEBUG_BUILD &&
|
|
2274
|
+
exports$1.DEBUG_BUILD &&
|
|
2275
|
+
exports$1.logger.warn(
|
|
2276
|
+
`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${exports$1.getEventDescription(event)}`,
|
|
2277
|
+
);
|
|
2043
2278
|
return true;
|
|
2044
2279
|
}
|
|
2045
2280
|
}
|
|
2046
2281
|
return false;
|
|
2047
2282
|
}
|
|
2283
|
+
|
|
2048
2284
|
function _isIgnoredError(event, ignoreErrors) {
|
|
2049
2285
|
if (!ignoreErrors?.length) {
|
|
2050
2286
|
return false;
|
|
2051
2287
|
}
|
|
2288
|
+
|
|
2052
2289
|
return getPossibleEventMessages(event).some(message => exports$1.stringMatchesSomePattern(message, ignoreErrors));
|
|
2053
2290
|
}
|
|
2291
|
+
|
|
2054
2292
|
function _isIgnoredTransaction(event, ignoreTransactions) {
|
|
2055
2293
|
if (!ignoreTransactions?.length) {
|
|
2056
2294
|
return false;
|
|
2057
2295
|
}
|
|
2296
|
+
|
|
2058
2297
|
const name = event.transaction;
|
|
2059
2298
|
return name ? exports$1.stringMatchesSomePattern(name, ignoreTransactions) : false;
|
|
2060
2299
|
}
|
|
2300
|
+
|
|
2061
2301
|
function _isDeniedUrl(event, denyUrls) {
|
|
2062
2302
|
if (!denyUrls?.length) {
|
|
2063
2303
|
return false;
|
|
@@ -2065,6 +2305,7 @@ function _isDeniedUrl(event, denyUrls) {
|
|
|
2065
2305
|
const url = _getEventFilterUrl(event);
|
|
2066
2306
|
return !url ? false : exports$1.stringMatchesSomePattern(url, denyUrls);
|
|
2067
2307
|
}
|
|
2308
|
+
|
|
2068
2309
|
function _isAllowedUrl(event, allowUrls) {
|
|
2069
2310
|
if (!allowUrls?.length) {
|
|
2070
2311
|
return true;
|
|
@@ -2072,20 +2313,26 @@ function _isAllowedUrl(event, allowUrls) {
|
|
|
2072
2313
|
const url = _getEventFilterUrl(event);
|
|
2073
2314
|
return !url ? true : exports$1.stringMatchesSomePattern(url, allowUrls);
|
|
2074
2315
|
}
|
|
2316
|
+
|
|
2075
2317
|
function _getLastValidUrl(frames = []) {
|
|
2076
2318
|
for (let i = frames.length - 1; i >= 0; i--) {
|
|
2077
2319
|
const frame = frames[i];
|
|
2320
|
+
|
|
2078
2321
|
if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {
|
|
2079
2322
|
return frame.filename || null;
|
|
2080
2323
|
}
|
|
2081
2324
|
}
|
|
2325
|
+
|
|
2082
2326
|
return null;
|
|
2083
2327
|
}
|
|
2328
|
+
|
|
2084
2329
|
function _getEventFilterUrl(event) {
|
|
2085
2330
|
try {
|
|
2086
2331
|
// If there are linked exceptions or exception aggregates we only want to match against the top frame of the "root" (the main exception)
|
|
2087
2332
|
// The root always comes last in linked exceptions
|
|
2088
|
-
const rootException = [...(event.exception?.values ?? [])]
|
|
2333
|
+
const rootException = [...(event.exception?.values ?? [])]
|
|
2334
|
+
.reverse()
|
|
2335
|
+
.find(value => value.mechanism?.parent_id === undefined && value.stacktrace?.frames?.length);
|
|
2089
2336
|
const frames = rootException?.stacktrace?.frames;
|
|
2090
2337
|
return frames ? _getLastValidUrl(frames) : null;
|
|
2091
2338
|
} catch (oO) {
|
|
@@ -2093,39 +2340,69 @@ function _getEventFilterUrl(event) {
|
|
|
2093
2340
|
return null;
|
|
2094
2341
|
}
|
|
2095
2342
|
}
|
|
2343
|
+
|
|
2096
2344
|
function _isUselessError(event) {
|
|
2097
2345
|
// We only want to consider events for dropping that actually have recorded exception values.
|
|
2098
2346
|
if (!event.exception?.values?.length) {
|
|
2099
2347
|
return false;
|
|
2100
2348
|
}
|
|
2349
|
+
|
|
2101
2350
|
return (
|
|
2102
2351
|
// No top-level message
|
|
2103
2352
|
!event.message &&
|
|
2104
2353
|
// There are no exception values that have a stacktrace, a non-generic-Error type or value
|
|
2105
|
-
!event.exception.values.some(value => value.stacktrace || value.type && value.type !== 'Error' || value.value)
|
|
2354
|
+
!event.exception.values.some(value => value.stacktrace || (value.type && value.type !== 'Error') || value.value)
|
|
2106
2355
|
);
|
|
2107
2356
|
}
|
|
2108
2357
|
|
|
2109
2358
|
/**
|
|
2110
2359
|
* Creates exceptions inside `event.exception.values` for errors that are nested on properties based on the `key` parameter.
|
|
2111
2360
|
*/
|
|
2112
|
-
function applyAggregateErrorsToEvent(
|
|
2361
|
+
function applyAggregateErrorsToEvent(
|
|
2362
|
+
exceptionFromErrorImplementation,
|
|
2363
|
+
parser,
|
|
2364
|
+
key,
|
|
2365
|
+
limit,
|
|
2366
|
+
event,
|
|
2367
|
+
hint,
|
|
2368
|
+
) {
|
|
2113
2369
|
if (!event.exception?.values || !hint || !exports$1.isInstanceOf(hint.originalException, Error)) {
|
|
2114
2370
|
return;
|
|
2115
2371
|
}
|
|
2116
2372
|
|
|
2117
2373
|
// Generally speaking the last item in `event.exception.values` is the exception originating from the original Error
|
|
2118
|
-
const originalException =
|
|
2374
|
+
const originalException =
|
|
2375
|
+
event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : undefined;
|
|
2119
2376
|
|
|
2120
2377
|
// We only create exception grouping if there is an exception in the event.
|
|
2121
2378
|
if (originalException) {
|
|
2122
|
-
event.exception.values = aggregateExceptionsFromError(
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2379
|
+
event.exception.values = aggregateExceptionsFromError(
|
|
2380
|
+
exceptionFromErrorImplementation,
|
|
2381
|
+
parser,
|
|
2382
|
+
limit,
|
|
2383
|
+
hint.originalException ,
|
|
2384
|
+
key,
|
|
2385
|
+
event.exception.values,
|
|
2386
|
+
originalException,
|
|
2387
|
+
0,
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
function aggregateExceptionsFromError(
|
|
2393
|
+
exceptionFromErrorImplementation,
|
|
2394
|
+
parser,
|
|
2395
|
+
limit,
|
|
2396
|
+
error,
|
|
2397
|
+
key,
|
|
2398
|
+
prevExceptions,
|
|
2399
|
+
exception,
|
|
2400
|
+
exceptionId,
|
|
2401
|
+
) {
|
|
2126
2402
|
if (prevExceptions.length >= limit + 1) {
|
|
2127
2403
|
return prevExceptions;
|
|
2128
2404
|
}
|
|
2405
|
+
|
|
2129
2406
|
let newExceptions = [...prevExceptions];
|
|
2130
2407
|
|
|
2131
2408
|
// Recursively call this function in order to walk down a chain of errors
|
|
@@ -2134,7 +2411,16 @@ function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser,
|
|
|
2134
2411
|
const newException = exceptionFromErrorImplementation(parser, error[key]);
|
|
2135
2412
|
const newExceptionId = newExceptions.length;
|
|
2136
2413
|
applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId);
|
|
2137
|
-
newExceptions = aggregateExceptionsFromError(
|
|
2414
|
+
newExceptions = aggregateExceptionsFromError(
|
|
2415
|
+
exceptionFromErrorImplementation,
|
|
2416
|
+
parser,
|
|
2417
|
+
limit,
|
|
2418
|
+
error[key],
|
|
2419
|
+
key,
|
|
2420
|
+
[newException, ...newExceptions],
|
|
2421
|
+
newException,
|
|
2422
|
+
newExceptionId,
|
|
2423
|
+
);
|
|
2138
2424
|
}
|
|
2139
2425
|
|
|
2140
2426
|
// This will create exception grouping for AggregateErrors
|
|
@@ -2146,38 +2432,49 @@ function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser,
|
|
|
2146
2432
|
const newException = exceptionFromErrorImplementation(parser, childError);
|
|
2147
2433
|
const newExceptionId = newExceptions.length;
|
|
2148
2434
|
applyExceptionGroupFieldsForChildException(newException, `errors[${i}]`, newExceptionId, exceptionId);
|
|
2149
|
-
newExceptions = aggregateExceptionsFromError(
|
|
2435
|
+
newExceptions = aggregateExceptionsFromError(
|
|
2436
|
+
exceptionFromErrorImplementation,
|
|
2437
|
+
parser,
|
|
2438
|
+
limit,
|
|
2439
|
+
childError,
|
|
2440
|
+
key,
|
|
2441
|
+
[newException, ...newExceptions],
|
|
2442
|
+
newException,
|
|
2443
|
+
newExceptionId,
|
|
2444
|
+
);
|
|
2150
2445
|
}
|
|
2151
2446
|
});
|
|
2152
2447
|
}
|
|
2448
|
+
|
|
2153
2449
|
return newExceptions;
|
|
2154
2450
|
}
|
|
2451
|
+
|
|
2155
2452
|
function applyExceptionGroupFieldsForParentException(exception, exceptionId) {
|
|
2156
2453
|
// Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.
|
|
2157
|
-
exception.mechanism = exception.mechanism || {
|
|
2158
|
-
|
|
2159
|
-
handled: true
|
|
2160
|
-
};
|
|
2454
|
+
exception.mechanism = exception.mechanism || { type: 'generic', handled: true };
|
|
2455
|
+
|
|
2161
2456
|
exception.mechanism = {
|
|
2162
2457
|
...exception.mechanism,
|
|
2163
|
-
...(exception.type === 'AggregateError' && {
|
|
2164
|
-
|
|
2165
|
-
}),
|
|
2166
|
-
exception_id: exceptionId
|
|
2458
|
+
...(exception.type === 'AggregateError' && { is_exception_group: true }),
|
|
2459
|
+
exception_id: exceptionId,
|
|
2167
2460
|
};
|
|
2168
2461
|
}
|
|
2169
|
-
|
|
2462
|
+
|
|
2463
|
+
function applyExceptionGroupFieldsForChildException(
|
|
2464
|
+
exception,
|
|
2465
|
+
source,
|
|
2466
|
+
exceptionId,
|
|
2467
|
+
parentId,
|
|
2468
|
+
) {
|
|
2170
2469
|
// Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.
|
|
2171
|
-
exception.mechanism = exception.mechanism || {
|
|
2172
|
-
|
|
2173
|
-
handled: true
|
|
2174
|
-
};
|
|
2470
|
+
exception.mechanism = exception.mechanism || { type: 'generic', handled: true };
|
|
2471
|
+
|
|
2175
2472
|
exception.mechanism = {
|
|
2176
2473
|
...exception.mechanism,
|
|
2177
2474
|
type: 'chained',
|
|
2178
2475
|
source,
|
|
2179
2476
|
exception_id: exceptionId,
|
|
2180
|
-
parent_id: parentId
|
|
2477
|
+
parent_id: parentId,
|
|
2181
2478
|
};
|
|
2182
2479
|
}
|
|
2183
2480
|
|
|
@@ -2192,22 +2489,24 @@ function addConsoleInstrumentationHandler(handler) {
|
|
|
2192
2489
|
addHandler(type, handler);
|
|
2193
2490
|
maybeInstrument(type, instrumentConsole);
|
|
2194
2491
|
}
|
|
2492
|
+
|
|
2195
2493
|
function instrumentConsole() {
|
|
2196
2494
|
if (!('console' in exports$1.GLOBAL_OBJ)) {
|
|
2197
2495
|
return;
|
|
2198
2496
|
}
|
|
2497
|
+
|
|
2199
2498
|
exports$1.CONSOLE_LEVELS.forEach(function (level) {
|
|
2200
2499
|
if (!(level in exports$1.GLOBAL_OBJ.console)) {
|
|
2201
2500
|
return;
|
|
2202
2501
|
}
|
|
2502
|
+
|
|
2203
2503
|
exports$1.fill(exports$1.GLOBAL_OBJ.console, level, function (originalConsoleMethod) {
|
|
2204
2504
|
exports$1.originalConsoleMethods[level] = originalConsoleMethod;
|
|
2505
|
+
|
|
2205
2506
|
return function (...args) {
|
|
2206
|
-
const handlerData = {
|
|
2207
|
-
args,
|
|
2208
|
-
level
|
|
2209
|
-
};
|
|
2507
|
+
const handlerData = { args, level };
|
|
2210
2508
|
triggerHandlers('console', handlerData);
|
|
2509
|
+
|
|
2211
2510
|
const log = exports$1.originalConsoleMethods[level];
|
|
2212
2511
|
log?.apply(exports$1.GLOBAL_OBJ.console, args);
|
|
2213
2512
|
};
|
|
@@ -2222,12 +2521,16 @@ function instrumentConsole() {
|
|
|
2222
2521
|
* @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level.
|
|
2223
2522
|
*/
|
|
2224
2523
|
function severityLevelFromString(level) {
|
|
2225
|
-
return
|
|
2524
|
+
return (
|
|
2525
|
+
level === 'warn' ? 'warning' : ['fatal', 'error', 'warning', 'log', 'info', 'debug'].includes(level) ? level : 'log'
|
|
2526
|
+
) ;
|
|
2226
2527
|
}
|
|
2227
2528
|
|
|
2228
2529
|
const INTEGRATION_NAME$4 = 'Dedupe';
|
|
2229
|
-
|
|
2530
|
+
|
|
2531
|
+
const _dedupeIntegration = (() => {
|
|
2230
2532
|
let previousEvent;
|
|
2533
|
+
|
|
2231
2534
|
return {
|
|
2232
2535
|
name: INTEGRATION_NAME$4,
|
|
2233
2536
|
processEvent(currentEvent) {
|
|
@@ -2245,10 +2548,10 @@ const _dedupeIntegration = () => {
|
|
|
2245
2548
|
}
|
|
2246
2549
|
} catch (_oO) {} // eslint-disable-line no-empty
|
|
2247
2550
|
|
|
2248
|
-
return previousEvent = currentEvent;
|
|
2249
|
-
}
|
|
2551
|
+
return (previousEvent = currentEvent);
|
|
2552
|
+
},
|
|
2250
2553
|
};
|
|
2251
|
-
};
|
|
2554
|
+
}) ;
|
|
2252
2555
|
|
|
2253
2556
|
/**
|
|
2254
2557
|
* Deduplication filter.
|
|
@@ -2260,14 +2563,18 @@ function _shouldDropEvent(currentEvent, previousEvent) {
|
|
|
2260
2563
|
if (!previousEvent) {
|
|
2261
2564
|
return false;
|
|
2262
2565
|
}
|
|
2566
|
+
|
|
2263
2567
|
if (_isSameMessageEvent(currentEvent, previousEvent)) {
|
|
2264
2568
|
return true;
|
|
2265
2569
|
}
|
|
2570
|
+
|
|
2266
2571
|
if (_isSameExceptionEvent(currentEvent, previousEvent)) {
|
|
2267
2572
|
return true;
|
|
2268
2573
|
}
|
|
2574
|
+
|
|
2269
2575
|
return false;
|
|
2270
2576
|
}
|
|
2577
|
+
|
|
2271
2578
|
function _isSameMessageEvent(currentEvent, previousEvent) {
|
|
2272
2579
|
const currentMessage = currentEvent.message;
|
|
2273
2580
|
const previousMessage = previousEvent.message;
|
|
@@ -2278,37 +2585,48 @@ function _isSameMessageEvent(currentEvent, previousEvent) {
|
|
|
2278
2585
|
}
|
|
2279
2586
|
|
|
2280
2587
|
// If only one event has a stacktrace, but not the other one, they are not the same
|
|
2281
|
-
if (currentMessage && !previousMessage || !currentMessage && previousMessage) {
|
|
2588
|
+
if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) {
|
|
2282
2589
|
return false;
|
|
2283
2590
|
}
|
|
2591
|
+
|
|
2284
2592
|
if (currentMessage !== previousMessage) {
|
|
2285
2593
|
return false;
|
|
2286
2594
|
}
|
|
2595
|
+
|
|
2287
2596
|
if (!_isSameFingerprint(currentEvent, previousEvent)) {
|
|
2288
2597
|
return false;
|
|
2289
2598
|
}
|
|
2599
|
+
|
|
2290
2600
|
if (!_isSameStacktrace(currentEvent, previousEvent)) {
|
|
2291
2601
|
return false;
|
|
2292
2602
|
}
|
|
2603
|
+
|
|
2293
2604
|
return true;
|
|
2294
2605
|
}
|
|
2606
|
+
|
|
2295
2607
|
function _isSameExceptionEvent(currentEvent, previousEvent) {
|
|
2296
2608
|
const previousException = _getExceptionFromEvent(previousEvent);
|
|
2297
2609
|
const currentException = _getExceptionFromEvent(currentEvent);
|
|
2610
|
+
|
|
2298
2611
|
if (!previousException || !currentException) {
|
|
2299
2612
|
return false;
|
|
2300
2613
|
}
|
|
2614
|
+
|
|
2301
2615
|
if (previousException.type !== currentException.type || previousException.value !== currentException.value) {
|
|
2302
2616
|
return false;
|
|
2303
2617
|
}
|
|
2618
|
+
|
|
2304
2619
|
if (!_isSameFingerprint(currentEvent, previousEvent)) {
|
|
2305
2620
|
return false;
|
|
2306
2621
|
}
|
|
2622
|
+
|
|
2307
2623
|
if (!_isSameStacktrace(currentEvent, previousEvent)) {
|
|
2308
2624
|
return false;
|
|
2309
2625
|
}
|
|
2626
|
+
|
|
2310
2627
|
return true;
|
|
2311
2628
|
}
|
|
2629
|
+
|
|
2312
2630
|
function _isSameStacktrace(currentEvent, previousEvent) {
|
|
2313
2631
|
let currentFrames = exports$1.getFramesFromEvent(currentEvent);
|
|
2314
2632
|
let previousFrames = exports$1.getFramesFromEvent(previousEvent);
|
|
@@ -2319,11 +2637,12 @@ function _isSameStacktrace(currentEvent, previousEvent) {
|
|
|
2319
2637
|
}
|
|
2320
2638
|
|
|
2321
2639
|
// If only one event has a stacktrace, but not the other one, they are not the same
|
|
2322
|
-
if (currentFrames && !previousFrames || !currentFrames && previousFrames) {
|
|
2640
|
+
if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) {
|
|
2323
2641
|
return false;
|
|
2324
2642
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2643
|
+
|
|
2644
|
+
currentFrames = currentFrames ;
|
|
2645
|
+
previousFrames = previousFrames ;
|
|
2327
2646
|
|
|
2328
2647
|
// If number of frames differ, they are not the same
|
|
2329
2648
|
if (previousFrames.length !== currentFrames.length) {
|
|
@@ -2336,12 +2655,20 @@ function _isSameStacktrace(currentEvent, previousEvent) {
|
|
|
2336
2655
|
const frameA = previousFrames[i];
|
|
2337
2656
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2338
2657
|
const frameB = currentFrames[i];
|
|
2339
|
-
|
|
2658
|
+
|
|
2659
|
+
if (
|
|
2660
|
+
frameA.filename !== frameB.filename ||
|
|
2661
|
+
frameA.lineno !== frameB.lineno ||
|
|
2662
|
+
frameA.colno !== frameB.colno ||
|
|
2663
|
+
frameA.function !== frameB.function
|
|
2664
|
+
) {
|
|
2340
2665
|
return false;
|
|
2341
2666
|
}
|
|
2342
2667
|
}
|
|
2668
|
+
|
|
2343
2669
|
return true;
|
|
2344
2670
|
}
|
|
2671
|
+
|
|
2345
2672
|
function _isSameFingerprint(currentEvent, previousEvent) {
|
|
2346
2673
|
let currentFingerprint = currentEvent.fingerprint;
|
|
2347
2674
|
let previousFingerprint = previousEvent.fingerprint;
|
|
@@ -2352,11 +2679,12 @@ function _isSameFingerprint(currentEvent, previousEvent) {
|
|
|
2352
2679
|
}
|
|
2353
2680
|
|
|
2354
2681
|
// If only one event has a fingerprint, but not the other one, they are not the same
|
|
2355
|
-
if (currentFingerprint && !previousFingerprint || !currentFingerprint && previousFingerprint) {
|
|
2682
|
+
if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) {
|
|
2356
2683
|
return false;
|
|
2357
2684
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2685
|
+
|
|
2686
|
+
currentFingerprint = currentFingerprint ;
|
|
2687
|
+
previousFingerprint = previousFingerprint ;
|
|
2360
2688
|
|
|
2361
2689
|
// Otherwise, compare the two
|
|
2362
2690
|
try {
|
|
@@ -2365,6 +2693,7 @@ function _isSameFingerprint(currentEvent, previousEvent) {
|
|
|
2365
2693
|
return false;
|
|
2366
2694
|
}
|
|
2367
2695
|
}
|
|
2696
|
+
|
|
2368
2697
|
function _getExceptionFromEvent(event) {
|
|
2369
2698
|
return event.exception?.values && event.exception.values[0];
|
|
2370
2699
|
}
|
|
@@ -2380,7 +2709,9 @@ function parseUrl(url) {
|
|
|
2380
2709
|
if (!url) {
|
|
2381
2710
|
return {};
|
|
2382
2711
|
}
|
|
2712
|
+
|
|
2383
2713
|
const match = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
|
|
2714
|
+
|
|
2384
2715
|
if (!match) {
|
|
2385
2716
|
return {};
|
|
2386
2717
|
}
|
|
@@ -2394,7 +2725,7 @@ function parseUrl(url) {
|
|
|
2394
2725
|
protocol: match[2],
|
|
2395
2726
|
search: query,
|
|
2396
2727
|
hash: fragment,
|
|
2397
|
-
relative: match[5] + query + fragment // everything minus origin
|
|
2728
|
+
relative: match[5] + query + fragment, // everything minus origin
|
|
2398
2729
|
};
|
|
2399
2730
|
}
|
|
2400
2731
|
|
|
@@ -2414,7 +2745,7 @@ function getBreadcrumbLogLevelFromHttpStatusCode(statusCode) {
|
|
|
2414
2745
|
}
|
|
2415
2746
|
}
|
|
2416
2747
|
|
|
2417
|
-
const WINDOW$2 = exports$1.GLOBAL_OBJ;
|
|
2748
|
+
const WINDOW$2 = exports$1.GLOBAL_OBJ ;
|
|
2418
2749
|
|
|
2419
2750
|
/**
|
|
2420
2751
|
* Tells whether current environment supports History API
|
|
@@ -2425,10 +2756,12 @@ const WINDOW$2 = exports$1.GLOBAL_OBJ;
|
|
|
2425
2756
|
function supportsHistory() {
|
|
2426
2757
|
return 'history' in WINDOW$2 && !!WINDOW$2.history;
|
|
2427
2758
|
}
|
|
2759
|
+
|
|
2428
2760
|
function _isFetchSupported() {
|
|
2429
2761
|
if (!('fetch' in WINDOW$2)) {
|
|
2430
2762
|
return false;
|
|
2431
2763
|
}
|
|
2764
|
+
|
|
2432
2765
|
try {
|
|
2433
2766
|
new Headers();
|
|
2434
2767
|
new Request('http://www.example.com');
|
|
@@ -2457,6 +2790,7 @@ function supportsNativeFetch() {
|
|
|
2457
2790
|
if (typeof EdgeRuntime === 'string') {
|
|
2458
2791
|
return true;
|
|
2459
2792
|
}
|
|
2793
|
+
|
|
2460
2794
|
if (!_isFetchSupported()) {
|
|
2461
2795
|
return false;
|
|
2462
2796
|
}
|
|
@@ -2472,7 +2806,7 @@ function supportsNativeFetch() {
|
|
|
2472
2806
|
let result = false;
|
|
2473
2807
|
const doc = WINDOW$2.document;
|
|
2474
2808
|
// eslint-disable-next-line deprecation/deprecation
|
|
2475
|
-
if (doc && typeof doc.createElement === 'function') {
|
|
2809
|
+
if (doc && typeof (doc.createElement ) === 'function') {
|
|
2476
2810
|
try {
|
|
2477
2811
|
const sandbox = doc.createElement('iframe');
|
|
2478
2812
|
sandbox.hidden = true;
|
|
@@ -2483,9 +2817,11 @@ function supportsNativeFetch() {
|
|
|
2483
2817
|
}
|
|
2484
2818
|
doc.head.removeChild(sandbox);
|
|
2485
2819
|
} catch (err) {
|
|
2486
|
-
exports$1.DEBUG_BUILD &&
|
|
2820
|
+
exports$1.DEBUG_BUILD &&
|
|
2821
|
+
exports$1.logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);
|
|
2487
2822
|
}
|
|
2488
2823
|
}
|
|
2824
|
+
|
|
2489
2825
|
return result;
|
|
2490
2826
|
}
|
|
2491
2827
|
|
|
@@ -2497,15 +2833,20 @@ function supportsNativeFetch() {
|
|
|
2497
2833
|
* Use at your own risk, this might break without changelog notice, only used internally.
|
|
2498
2834
|
* @hidden
|
|
2499
2835
|
*/
|
|
2500
|
-
function addFetchInstrumentationHandler(
|
|
2836
|
+
function addFetchInstrumentationHandler(
|
|
2837
|
+
handler,
|
|
2838
|
+
skipNativeFetchCheck,
|
|
2839
|
+
) {
|
|
2501
2840
|
const type = 'fetch';
|
|
2502
2841
|
addHandler(type, handler);
|
|
2503
2842
|
maybeInstrument(type, () => instrumentFetch(undefined, skipNativeFetchCheck));
|
|
2504
2843
|
}
|
|
2844
|
+
|
|
2505
2845
|
function instrumentFetch(onFetchResolved, skipNativeFetchCheck = false) {
|
|
2506
2846
|
if (skipNativeFetchCheck && !supportsNativeFetch()) {
|
|
2507
2847
|
return;
|
|
2508
2848
|
}
|
|
2849
|
+
|
|
2509
2850
|
exports$1.fill(exports$1.GLOBAL_OBJ, 'fetch', function (originalFetch) {
|
|
2510
2851
|
return function (...args) {
|
|
2511
2852
|
// We capture the error right here and not in the Promise error callback because Safari (and probably other
|
|
@@ -2516,92 +2857,106 @@ function instrumentFetch(onFetchResolved, skipNativeFetchCheck = false) {
|
|
|
2516
2857
|
// have a stack trace, so the SDK backfilled the stack trace so
|
|
2517
2858
|
// you can see which fetch call failed.
|
|
2518
2859
|
const virtualError = new Error();
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
url
|
|
2522
|
-
} = parseFetchArgs(args);
|
|
2860
|
+
|
|
2861
|
+
const { method, url } = parseFetchArgs(args);
|
|
2523
2862
|
const handlerData = {
|
|
2524
2863
|
args,
|
|
2525
2864
|
fetchData: {
|
|
2526
2865
|
method,
|
|
2527
|
-
url
|
|
2866
|
+
url,
|
|
2528
2867
|
},
|
|
2529
2868
|
startTimestamp: exports$1.timestampInSeconds() * 1000,
|
|
2530
2869
|
// // Adding the error to be able to fingerprint the failed fetch event in HttpClient instrumentation
|
|
2531
2870
|
virtualError,
|
|
2532
|
-
headers: getHeadersFromFetchArgs(args)
|
|
2871
|
+
headers: getHeadersFromFetchArgs(args),
|
|
2533
2872
|
};
|
|
2534
2873
|
|
|
2535
2874
|
// if there is no callback, fetch is instrumented directly
|
|
2536
2875
|
{
|
|
2537
2876
|
triggerHandlers('fetch', {
|
|
2538
|
-
...handlerData
|
|
2877
|
+
...handlerData,
|
|
2539
2878
|
});
|
|
2540
2879
|
}
|
|
2541
2880
|
|
|
2542
2881
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2543
|
-
return originalFetch.apply(exports$1.GLOBAL_OBJ, args).then(
|
|
2544
|
-
{
|
|
2882
|
+
return originalFetch.apply(exports$1.GLOBAL_OBJ, args).then(
|
|
2883
|
+
async (response) => {
|
|
2884
|
+
{
|
|
2885
|
+
triggerHandlers('fetch', {
|
|
2886
|
+
...handlerData,
|
|
2887
|
+
endTimestamp: exports$1.timestampInSeconds() * 1000,
|
|
2888
|
+
response,
|
|
2889
|
+
});
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
return response;
|
|
2893
|
+
},
|
|
2894
|
+
(error) => {
|
|
2545
2895
|
triggerHandlers('fetch', {
|
|
2546
2896
|
...handlerData,
|
|
2547
2897
|
endTimestamp: exports$1.timestampInSeconds() * 1000,
|
|
2548
|
-
|
|
2898
|
+
error,
|
|
2549
2899
|
});
|
|
2550
|
-
}
|
|
2551
|
-
return response;
|
|
2552
|
-
}, error => {
|
|
2553
|
-
triggerHandlers('fetch', {
|
|
2554
|
-
...handlerData,
|
|
2555
|
-
endTimestamp: exports$1.timestampInSeconds() * 1000,
|
|
2556
|
-
error
|
|
2557
|
-
});
|
|
2558
|
-
if (exports$1.isError(error) && error.stack === undefined) {
|
|
2559
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
|
2560
|
-
// it means the error, that was caused by your fetch call did not
|
|
2561
|
-
// have a stack trace, so the SDK backfilled the stack trace so
|
|
2562
|
-
// you can see which fetch call failed.
|
|
2563
|
-
error.stack = virtualError.stack;
|
|
2564
|
-
exports$1.addNonEnumerableProperty(error, 'framesToPop', 1);
|
|
2565
|
-
}
|
|
2566
2900
|
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
const url = new URL(handlerData.fetchData.url);
|
|
2575
|
-
error.message = `${error.message} (${url.host})`;
|
|
2576
|
-
} catch {
|
|
2577
|
-
// ignore it if errors happen here
|
|
2901
|
+
if (exports$1.isError(error) && error.stack === undefined) {
|
|
2902
|
+
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
|
2903
|
+
// it means the error, that was caused by your fetch call did not
|
|
2904
|
+
// have a stack trace, so the SDK backfilled the stack trace so
|
|
2905
|
+
// you can see which fetch call failed.
|
|
2906
|
+
error.stack = virtualError.stack;
|
|
2907
|
+
exports$1.addNonEnumerableProperty(error, 'framesToPop', 1);
|
|
2578
2908
|
}
|
|
2579
|
-
}
|
|
2580
2909
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2910
|
+
// We enhance the not-so-helpful "Failed to fetch" error messages with the host
|
|
2911
|
+
// Possible messages we handle here:
|
|
2912
|
+
// * "Failed to fetch" (chromium)
|
|
2913
|
+
// * "Load failed" (webkit)
|
|
2914
|
+
// * "NetworkError when attempting to fetch resource." (firefox)
|
|
2915
|
+
if (
|
|
2916
|
+
error instanceof TypeError &&
|
|
2917
|
+
(error.message === 'Failed to fetch' ||
|
|
2918
|
+
error.message === 'Load failed' ||
|
|
2919
|
+
error.message === 'NetworkError when attempting to fetch resource.')
|
|
2920
|
+
) {
|
|
2921
|
+
try {
|
|
2922
|
+
const url = new URL(handlerData.fetchData.url);
|
|
2923
|
+
error.message = `${error.message} (${url.host})`;
|
|
2924
|
+
} catch {
|
|
2925
|
+
// ignore it if errors happen here
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
|
2930
|
+
// it means the sentry.javascript SDK caught an error invoking your application code.
|
|
2931
|
+
// This is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
2932
|
+
throw error;
|
|
2933
|
+
},
|
|
2934
|
+
);
|
|
2586
2935
|
};
|
|
2587
2936
|
});
|
|
2588
2937
|
}
|
|
2938
|
+
|
|
2589
2939
|
function hasProp(obj, prop) {
|
|
2590
|
-
return !!obj && typeof obj === 'object' && !!obj[prop];
|
|
2940
|
+
return !!obj && typeof obj === 'object' && !!(obj )[prop];
|
|
2591
2941
|
}
|
|
2942
|
+
|
|
2592
2943
|
function getUrlFromResource(resource) {
|
|
2593
2944
|
if (typeof resource === 'string') {
|
|
2594
2945
|
return resource;
|
|
2595
2946
|
}
|
|
2947
|
+
|
|
2596
2948
|
if (!resource) {
|
|
2597
2949
|
return '';
|
|
2598
2950
|
}
|
|
2951
|
+
|
|
2599
2952
|
if (hasProp(resource, 'url')) {
|
|
2600
2953
|
return resource.url;
|
|
2601
2954
|
}
|
|
2955
|
+
|
|
2602
2956
|
if (resource.toString) {
|
|
2603
2957
|
return resource.toString();
|
|
2604
2958
|
}
|
|
2959
|
+
|
|
2605
2960
|
return '';
|
|
2606
2961
|
}
|
|
2607
2962
|
|
|
@@ -2611,36 +2966,45 @@ function getUrlFromResource(resource) {
|
|
|
2611
2966
|
*/
|
|
2612
2967
|
function parseFetchArgs(fetchArgs) {
|
|
2613
2968
|
if (fetchArgs.length === 0) {
|
|
2614
|
-
return {
|
|
2615
|
-
method: 'GET',
|
|
2616
|
-
url: ''
|
|
2617
|
-
};
|
|
2969
|
+
return { method: 'GET', url: '' };
|
|
2618
2970
|
}
|
|
2971
|
+
|
|
2619
2972
|
if (fetchArgs.length === 2) {
|
|
2620
|
-
const [url, options] = fetchArgs;
|
|
2973
|
+
const [url, options] = fetchArgs ;
|
|
2974
|
+
|
|
2621
2975
|
return {
|
|
2622
2976
|
url: getUrlFromResource(url),
|
|
2623
|
-
method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET'
|
|
2977
|
+
method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET',
|
|
2624
2978
|
};
|
|
2625
2979
|
}
|
|
2980
|
+
|
|
2626
2981
|
const arg = fetchArgs[0];
|
|
2627
2982
|
return {
|
|
2628
|
-
url: getUrlFromResource(arg),
|
|
2629
|
-
method: hasProp(arg, 'method') ? String(arg.method).toUpperCase() : 'GET'
|
|
2983
|
+
url: getUrlFromResource(arg ),
|
|
2984
|
+
method: hasProp(arg, 'method') ? String(arg.method).toUpperCase() : 'GET',
|
|
2630
2985
|
};
|
|
2631
2986
|
}
|
|
2987
|
+
|
|
2632
2988
|
function getHeadersFromFetchArgs(fetchArgs) {
|
|
2633
2989
|
const [requestArgument, optionsArgument] = fetchArgs;
|
|
2990
|
+
|
|
2634
2991
|
try {
|
|
2635
|
-
if (
|
|
2636
|
-
|
|
2992
|
+
if (
|
|
2993
|
+
typeof optionsArgument === 'object' &&
|
|
2994
|
+
optionsArgument !== null &&
|
|
2995
|
+
'headers' in optionsArgument &&
|
|
2996
|
+
optionsArgument.headers
|
|
2997
|
+
) {
|
|
2998
|
+
return new Headers(optionsArgument.headers );
|
|
2637
2999
|
}
|
|
3000
|
+
|
|
2638
3001
|
if (exports$1.isRequest(requestArgument)) {
|
|
2639
3002
|
return new Headers(requestArgument.headers);
|
|
2640
3003
|
}
|
|
2641
3004
|
} catch {
|
|
2642
3005
|
// noop
|
|
2643
3006
|
}
|
|
3007
|
+
|
|
2644
3008
|
return;
|
|
2645
3009
|
}
|
|
2646
3010
|
|
|
@@ -2665,11 +3029,11 @@ function getHeadersFromFetchArgs(fetchArgs) {
|
|
|
2665
3029
|
*/
|
|
2666
3030
|
function getSDKSource() {
|
|
2667
3031
|
// This comment is used to identify this line in the CDN bundle build step and replace this with "return 'cdn';"
|
|
2668
|
-
/* __SENTRY_SDK_SOURCE__ */
|
|
2669
|
-
return 'npm';
|
|
3032
|
+
/* __SENTRY_SDK_SOURCE__ */ return 'npm';
|
|
2670
3033
|
}
|
|
2671
3034
|
|
|
2672
|
-
const WINDOW$1 = exports$1.GLOBAL_OBJ;
|
|
3035
|
+
const WINDOW$1 = exports$1.GLOBAL_OBJ ;
|
|
3036
|
+
|
|
2673
3037
|
let ignoreOnError = 0;
|
|
2674
3038
|
|
|
2675
3039
|
/**
|
|
@@ -2701,7 +3065,12 @@ function ignoreNextOnError() {
|
|
|
2701
3065
|
* @returns The wrapped function.
|
|
2702
3066
|
* @hidden
|
|
2703
3067
|
*/
|
|
2704
|
-
function wrap(
|
|
3068
|
+
function wrap(
|
|
3069
|
+
fn,
|
|
3070
|
+
options
|
|
3071
|
+
|
|
3072
|
+
= {},
|
|
3073
|
+
) {
|
|
2705
3074
|
// for future readers what this does is wrap a function and then create
|
|
2706
3075
|
// a bi-directional wrapping between them.
|
|
2707
3076
|
//
|
|
@@ -2712,13 +3081,15 @@ function wrap(fn, options = {}) {
|
|
|
2712
3081
|
function isFunction(fn) {
|
|
2713
3082
|
return typeof fn === 'function';
|
|
2714
3083
|
}
|
|
3084
|
+
|
|
2715
3085
|
if (!isFunction(fn)) {
|
|
2716
3086
|
return fn;
|
|
2717
3087
|
}
|
|
3088
|
+
|
|
2718
3089
|
try {
|
|
2719
3090
|
// if we're dealing with a function that was previously wrapped, return
|
|
2720
3091
|
// the original wrapper.
|
|
2721
|
-
const wrapper = fn.__sentry_wrapped__;
|
|
3092
|
+
const wrapper = (fn ).__sentry_wrapped__;
|
|
2722
3093
|
if (wrapper) {
|
|
2723
3094
|
if (typeof wrapper === 'function') {
|
|
2724
3095
|
return wrapper;
|
|
@@ -2742,7 +3113,7 @@ function wrap(fn, options = {}) {
|
|
|
2742
3113
|
|
|
2743
3114
|
// Wrap the function itself
|
|
2744
3115
|
// It is important that `sentryWrapped` is not an arrow function to preserve the context of `this`
|
|
2745
|
-
const sentryWrapped = function (...args) {
|
|
3116
|
+
const sentryWrapped = function ( ...args) {
|
|
2746
3117
|
try {
|
|
2747
3118
|
// Also wrap arguments that are themselves functions
|
|
2748
3119
|
const wrappedArguments = args.map(arg => wrap(arg, options));
|
|
@@ -2754,29 +3125,34 @@ function wrap(fn, options = {}) {
|
|
|
2754
3125
|
return fn.apply(this, wrappedArguments);
|
|
2755
3126
|
} catch (ex) {
|
|
2756
3127
|
ignoreNextOnError();
|
|
3128
|
+
|
|
2757
3129
|
exports$1.withScope(scope => {
|
|
2758
3130
|
scope.addEventProcessor(event => {
|
|
2759
3131
|
if (options.mechanism) {
|
|
2760
3132
|
exports$1.addExceptionTypeValue(event, undefined);
|
|
2761
3133
|
exports$1.addExceptionMechanism(event, options.mechanism);
|
|
2762
3134
|
}
|
|
3135
|
+
|
|
2763
3136
|
event.extra = {
|
|
2764
3137
|
...event.extra,
|
|
2765
|
-
arguments: args
|
|
3138
|
+
arguments: args,
|
|
2766
3139
|
};
|
|
3140
|
+
|
|
2767
3141
|
return event;
|
|
2768
3142
|
});
|
|
3143
|
+
|
|
2769
3144
|
exports$1.captureException(ex);
|
|
2770
3145
|
});
|
|
3146
|
+
|
|
2771
3147
|
throw ex;
|
|
2772
3148
|
}
|
|
2773
|
-
};
|
|
3149
|
+
} ;
|
|
2774
3150
|
|
|
2775
3151
|
// Wrap the wrapped function in a proxy, to ensure any other properties of the original function remain available
|
|
2776
3152
|
try {
|
|
2777
3153
|
for (const property in fn) {
|
|
2778
3154
|
if (Object.prototype.hasOwnProperty.call(fn, property)) {
|
|
2779
|
-
sentryWrapped[property] = fn[property];
|
|
3155
|
+
sentryWrapped[property ] = fn[property ];
|
|
2780
3156
|
}
|
|
2781
3157
|
}
|
|
2782
3158
|
} catch {
|
|
@@ -2787,6 +3163,7 @@ function wrap(fn, options = {}) {
|
|
|
2787
3163
|
// Signal that this function has been wrapped/filled already
|
|
2788
3164
|
// for both debugging and to prevent it to being wrapped/filled twice
|
|
2789
3165
|
exports$1.markFunctionWrapped(sentryWrapped, fn);
|
|
3166
|
+
|
|
2790
3167
|
exports$1.addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);
|
|
2791
3168
|
|
|
2792
3169
|
// Restore original function name (not all browsers allow that)
|
|
@@ -2797,13 +3174,14 @@ function wrap(fn, options = {}) {
|
|
|
2797
3174
|
Object.defineProperty(sentryWrapped, 'name', {
|
|
2798
3175
|
get() {
|
|
2799
3176
|
return fn.name;
|
|
2800
|
-
}
|
|
3177
|
+
},
|
|
2801
3178
|
});
|
|
2802
3179
|
}
|
|
2803
3180
|
} catch {
|
|
2804
3181
|
// This may throw if e.g. the descriptor does not exist, or a browser does not allow redefining `name`.
|
|
2805
3182
|
// to save some bytes we simply try-catch this
|
|
2806
3183
|
}
|
|
3184
|
+
|
|
2807
3185
|
return sentryWrapped;
|
|
2808
3186
|
}
|
|
2809
3187
|
|
|
@@ -2813,24 +3191,18 @@ function wrap(fn, options = {}) {
|
|
|
2813
3191
|
function getHttpRequestData() {
|
|
2814
3192
|
// grab as much info as exists and add it to the event
|
|
2815
3193
|
const url = exports$1.getLocationHref();
|
|
2816
|
-
const {
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
const {
|
|
2820
|
-
userAgent
|
|
2821
|
-
} = WINDOW$1.navigator || {};
|
|
3194
|
+
const { referrer } = WINDOW$1.document || {};
|
|
3195
|
+
const { userAgent } = WINDOW$1.navigator || {};
|
|
3196
|
+
|
|
2822
3197
|
const headers = {
|
|
2823
|
-
...(referrer && {
|
|
2824
|
-
|
|
2825
|
-
}),
|
|
2826
|
-
...(userAgent && {
|
|
2827
|
-
'User-Agent': userAgent
|
|
2828
|
-
})
|
|
3198
|
+
...(referrer && { Referer: referrer }),
|
|
3199
|
+
...(userAgent && { 'User-Agent': userAgent }),
|
|
2829
3200
|
};
|
|
2830
3201
|
const request = {
|
|
2831
3202
|
url,
|
|
2832
|
-
headers
|
|
3203
|
+
headers,
|
|
2833
3204
|
};
|
|
3205
|
+
|
|
2834
3206
|
return request;
|
|
2835
3207
|
}
|
|
2836
3208
|
|
|
@@ -2840,81 +3212,99 @@ function getHttpRequestData() {
|
|
|
2840
3212
|
function exceptionFromError(stackParser, ex) {
|
|
2841
3213
|
// Get the frames first since Opera can lose the stack if we touch anything else first
|
|
2842
3214
|
const frames = parseStackFrames(stackParser, ex);
|
|
3215
|
+
|
|
2843
3216
|
const exception = {
|
|
2844
3217
|
type: extractType(ex),
|
|
2845
|
-
value: extractMessage(ex)
|
|
3218
|
+
value: extractMessage(ex),
|
|
2846
3219
|
};
|
|
3220
|
+
|
|
2847
3221
|
if (frames.length) {
|
|
2848
|
-
exception.stacktrace = {
|
|
2849
|
-
frames
|
|
2850
|
-
};
|
|
3222
|
+
exception.stacktrace = { frames };
|
|
2851
3223
|
}
|
|
3224
|
+
|
|
2852
3225
|
if (exception.type === undefined && exception.value === '') {
|
|
2853
3226
|
exception.value = 'Unrecoverable error caught';
|
|
2854
3227
|
}
|
|
3228
|
+
|
|
2855
3229
|
return exception;
|
|
2856
3230
|
}
|
|
2857
|
-
|
|
3231
|
+
|
|
3232
|
+
function eventFromPlainObject(
|
|
3233
|
+
stackParser,
|
|
3234
|
+
exception,
|
|
3235
|
+
syntheticException,
|
|
3236
|
+
isUnhandledRejection,
|
|
3237
|
+
) {
|
|
2858
3238
|
const client = exports$1.getClient();
|
|
2859
3239
|
const normalizeDepth = client?.getOptions().normalizeDepth;
|
|
2860
3240
|
|
|
2861
3241
|
// If we can, we extract an exception from the object properties
|
|
2862
3242
|
const errorFromProp = getErrorPropertyFromObject(exception);
|
|
3243
|
+
|
|
2863
3244
|
const extra = {
|
|
2864
|
-
__serialized__: exports$1.normalizeToSize(exception, normalizeDepth)
|
|
3245
|
+
__serialized__: exports$1.normalizeToSize(exception, normalizeDepth),
|
|
2865
3246
|
};
|
|
3247
|
+
|
|
2866
3248
|
if (errorFromProp) {
|
|
2867
3249
|
return {
|
|
2868
3250
|
exception: {
|
|
2869
|
-
values: [exceptionFromError(stackParser, errorFromProp)]
|
|
3251
|
+
values: [exceptionFromError(stackParser, errorFromProp)],
|
|
2870
3252
|
},
|
|
2871
|
-
extra
|
|
3253
|
+
extra,
|
|
2872
3254
|
};
|
|
2873
3255
|
}
|
|
3256
|
+
|
|
2874
3257
|
const event = {
|
|
2875
3258
|
exception: {
|
|
2876
|
-
values: [
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
isUnhandledRejection
|
|
2880
|
-
}
|
|
2881
|
-
|
|
3259
|
+
values: [
|
|
3260
|
+
{
|
|
3261
|
+
type: exports$1.isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',
|
|
3262
|
+
value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }),
|
|
3263
|
+
} ,
|
|
3264
|
+
],
|
|
2882
3265
|
},
|
|
2883
|
-
extra
|
|
2884
|
-
};
|
|
3266
|
+
extra,
|
|
3267
|
+
} ;
|
|
3268
|
+
|
|
2885
3269
|
if (syntheticException) {
|
|
2886
3270
|
const frames = parseStackFrames(stackParser, syntheticException);
|
|
2887
3271
|
if (frames.length) {
|
|
2888
3272
|
// event.exception.values[0] has been set above
|
|
2889
3273
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2890
|
-
event.exception.values[0].stacktrace = {
|
|
2891
|
-
frames
|
|
2892
|
-
};
|
|
3274
|
+
event.exception.values[0].stacktrace = { frames };
|
|
2893
3275
|
}
|
|
2894
3276
|
}
|
|
3277
|
+
|
|
2895
3278
|
return event;
|
|
2896
3279
|
}
|
|
3280
|
+
|
|
2897
3281
|
function eventFromError(stackParser, ex) {
|
|
2898
3282
|
return {
|
|
2899
3283
|
exception: {
|
|
2900
|
-
values: [exceptionFromError(stackParser, ex)]
|
|
2901
|
-
}
|
|
3284
|
+
values: [exceptionFromError(stackParser, ex)],
|
|
3285
|
+
},
|
|
2902
3286
|
};
|
|
2903
3287
|
}
|
|
2904
3288
|
|
|
2905
3289
|
/** Parses stack frames from an error */
|
|
2906
|
-
function parseStackFrames(
|
|
3290
|
+
function parseStackFrames(
|
|
3291
|
+
stackParser,
|
|
3292
|
+
ex,
|
|
3293
|
+
) {
|
|
2907
3294
|
// Access and store the stacktrace property before doing ANYTHING
|
|
2908
3295
|
// else to it because Opera is not very good at providing it
|
|
2909
3296
|
// reliably in other circumstances.
|
|
2910
3297
|
const stacktrace = ex.stacktrace || ex.stack || '';
|
|
3298
|
+
|
|
2911
3299
|
const skipLines = getSkipFirstStackStringLines(ex);
|
|
2912
3300
|
const framesToPop = getPopFirstTopFrames(ex);
|
|
3301
|
+
|
|
2913
3302
|
try {
|
|
2914
3303
|
return stackParser(stacktrace, skipLines, framesToPop);
|
|
2915
3304
|
} catch (e) {
|
|
2916
3305
|
// no-empty
|
|
2917
3306
|
}
|
|
3307
|
+
|
|
2918
3308
|
return [];
|
|
2919
3309
|
}
|
|
2920
3310
|
|
|
@@ -2930,6 +3320,7 @@ function getSkipFirstStackStringLines(ex) {
|
|
|
2930
3320
|
if (ex && reactMinifiedRegexp.test(ex.message)) {
|
|
2931
3321
|
return 1;
|
|
2932
3322
|
}
|
|
3323
|
+
|
|
2933
3324
|
return 0;
|
|
2934
3325
|
}
|
|
2935
3326
|
|
|
@@ -2945,6 +3336,7 @@ function getPopFirstTopFrames(ex) {
|
|
|
2945
3336
|
if (typeof ex.framesToPop === 'number') {
|
|
2946
3337
|
return ex.framesToPop;
|
|
2947
3338
|
}
|
|
3339
|
+
|
|
2948
3340
|
return 0;
|
|
2949
3341
|
}
|
|
2950
3342
|
|
|
@@ -2976,6 +3368,7 @@ function extractType(ex) {
|
|
|
2976
3368
|
const hasTypeInMessage = ex.message && Array.isArray(ex.message) && ex.message.length == 2;
|
|
2977
3369
|
return hasTypeInMessage ? ex.message[0] : 'WebAssembly.Exception';
|
|
2978
3370
|
}
|
|
3371
|
+
|
|
2979
3372
|
return name;
|
|
2980
3373
|
}
|
|
2981
3374
|
|
|
@@ -2986,6 +3379,7 @@ function extractType(ex) {
|
|
|
2986
3379
|
*/
|
|
2987
3380
|
function extractMessage(ex) {
|
|
2988
3381
|
const message = ex?.message;
|
|
3382
|
+
|
|
2989
3383
|
if (isWebAssemblyException(ex)) {
|
|
2990
3384
|
// For Node 18, Emscripten sets array[type, message] to the "message" property on the WebAssembly.Exception object
|
|
2991
3385
|
if (Array.isArray(ex.message) && ex.message.length == 2) {
|
|
@@ -2993,12 +3387,15 @@ function extractMessage(ex) {
|
|
|
2993
3387
|
}
|
|
2994
3388
|
return 'wasm exception';
|
|
2995
3389
|
}
|
|
3390
|
+
|
|
2996
3391
|
if (!message) {
|
|
2997
3392
|
return 'No error message';
|
|
2998
3393
|
}
|
|
3394
|
+
|
|
2999
3395
|
if (message.error && typeof message.error.message === 'string') {
|
|
3000
3396
|
return message.error.message;
|
|
3001
3397
|
}
|
|
3398
|
+
|
|
3002
3399
|
return message;
|
|
3003
3400
|
}
|
|
3004
3401
|
|
|
@@ -3006,7 +3403,12 @@ function extractMessage(ex) {
|
|
|
3006
3403
|
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
3007
3404
|
* @hidden
|
|
3008
3405
|
*/
|
|
3009
|
-
function eventFromException(
|
|
3406
|
+
function eventFromException(
|
|
3407
|
+
stackParser,
|
|
3408
|
+
exception,
|
|
3409
|
+
hint,
|
|
3410
|
+
attachStacktrace,
|
|
3411
|
+
) {
|
|
3010
3412
|
const syntheticException = hint?.syntheticException || undefined;
|
|
3011
3413
|
const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace);
|
|
3012
3414
|
exports$1.addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
|
|
@@ -3021,7 +3423,13 @@ function eventFromException(stackParser, exception, hint, attachStacktrace) {
|
|
|
3021
3423
|
* Builds and Event from a Message
|
|
3022
3424
|
* @hidden
|
|
3023
3425
|
*/
|
|
3024
|
-
function eventFromMessage(
|
|
3426
|
+
function eventFromMessage(
|
|
3427
|
+
stackParser,
|
|
3428
|
+
message,
|
|
3429
|
+
level = 'info',
|
|
3430
|
+
hint,
|
|
3431
|
+
attachStacktrace,
|
|
3432
|
+
) {
|
|
3025
3433
|
const syntheticException = hint?.syntheticException || undefined;
|
|
3026
3434
|
const event = eventFromString(stackParser, message, syntheticException, attachStacktrace);
|
|
3027
3435
|
event.level = level;
|
|
@@ -3034,12 +3442,19 @@ function eventFromMessage(stackParser, message, level = 'info', hint, attachStac
|
|
|
3034
3442
|
/**
|
|
3035
3443
|
* @hidden
|
|
3036
3444
|
*/
|
|
3037
|
-
function eventFromUnknownInput(
|
|
3445
|
+
function eventFromUnknownInput(
|
|
3446
|
+
stackParser,
|
|
3447
|
+
exception,
|
|
3448
|
+
syntheticException,
|
|
3449
|
+
attachStacktrace,
|
|
3450
|
+
isUnhandledRejection,
|
|
3451
|
+
) {
|
|
3038
3452
|
let event;
|
|
3039
|
-
|
|
3453
|
+
|
|
3454
|
+
if (exports$1.isErrorEvent(exception ) && (exception ).error) {
|
|
3040
3455
|
// If it is an ErrorEvent with `error` property, extract it to get actual Error
|
|
3041
|
-
const errorEvent = exception;
|
|
3042
|
-
return eventFromError(stackParser, errorEvent.error);
|
|
3456
|
+
const errorEvent = exception ;
|
|
3457
|
+
return eventFromError(stackParser, errorEvent.error );
|
|
3043
3458
|
}
|
|
3044
3459
|
|
|
3045
3460
|
// If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name
|
|
@@ -3049,10 +3464,11 @@ function eventFromUnknownInput(stackParser, exception, syntheticException, attac
|
|
|
3049
3464
|
// https://developer.mozilla.org/en-US/docs/Web/API/DOMError
|
|
3050
3465
|
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
3051
3466
|
// https://webidl.spec.whatwg.org/#es-DOMException-specialness
|
|
3052
|
-
if (exports$1.isDOMError(exception) || exports$1.isDOMException(exception)) {
|
|
3053
|
-
const domException = exception;
|
|
3054
|
-
|
|
3055
|
-
|
|
3467
|
+
if (exports$1.isDOMError(exception) || exports$1.isDOMException(exception )) {
|
|
3468
|
+
const domException = exception ;
|
|
3469
|
+
|
|
3470
|
+
if ('stack' in (exception )) {
|
|
3471
|
+
event = eventFromError(stackParser, exception );
|
|
3056
3472
|
} else {
|
|
3057
3473
|
const name = domException.name || (exports$1.isDOMError(domException) ? 'DOMError' : 'DOMException');
|
|
3058
3474
|
const message = domException.message ? `${name}: ${domException.message}` : name;
|
|
@@ -3061,11 +3477,9 @@ function eventFromUnknownInput(stackParser, exception, syntheticException, attac
|
|
|
3061
3477
|
}
|
|
3062
3478
|
if ('code' in domException) {
|
|
3063
3479
|
// eslint-disable-next-line deprecation/deprecation
|
|
3064
|
-
event.tags = {
|
|
3065
|
-
...event.tags,
|
|
3066
|
-
'DOMException.code': `${domException.code}`
|
|
3067
|
-
};
|
|
3480
|
+
event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };
|
|
3068
3481
|
}
|
|
3482
|
+
|
|
3069
3483
|
return event;
|
|
3070
3484
|
}
|
|
3071
3485
|
if (exports$1.isError(exception)) {
|
|
@@ -3076,10 +3490,10 @@ function eventFromUnknownInput(stackParser, exception, syntheticException, attac
|
|
|
3076
3490
|
// If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize
|
|
3077
3491
|
// it manually. This will allow us to group events based on top-level keys which is much better than creating a new
|
|
3078
3492
|
// group on any key/value change.
|
|
3079
|
-
const objectException = exception;
|
|
3493
|
+
const objectException = exception ;
|
|
3080
3494
|
event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection);
|
|
3081
3495
|
exports$1.addExceptionMechanism(event, {
|
|
3082
|
-
synthetic: true
|
|
3496
|
+
synthetic: true,
|
|
3083
3497
|
});
|
|
3084
3498
|
return event;
|
|
3085
3499
|
}
|
|
@@ -3093,48 +3507,51 @@ function eventFromUnknownInput(stackParser, exception, syntheticException, attac
|
|
|
3093
3507
|
// - a plain Object
|
|
3094
3508
|
//
|
|
3095
3509
|
// So bail out and capture it as a simple message:
|
|
3096
|
-
event = eventFromString(stackParser, exception, syntheticException, attachStacktrace);
|
|
3510
|
+
event = eventFromString(stackParser, exception , syntheticException, attachStacktrace);
|
|
3097
3511
|
exports$1.addExceptionTypeValue(event, `${exception}`);
|
|
3098
3512
|
exports$1.addExceptionMechanism(event, {
|
|
3099
|
-
synthetic: true
|
|
3513
|
+
synthetic: true,
|
|
3100
3514
|
});
|
|
3515
|
+
|
|
3101
3516
|
return event;
|
|
3102
3517
|
}
|
|
3103
|
-
|
|
3518
|
+
|
|
3519
|
+
function eventFromString(
|
|
3520
|
+
stackParser,
|
|
3521
|
+
message,
|
|
3522
|
+
syntheticException,
|
|
3523
|
+
attachStacktrace,
|
|
3524
|
+
) {
|
|
3104
3525
|
const event = {};
|
|
3526
|
+
|
|
3105
3527
|
if (attachStacktrace && syntheticException) {
|
|
3106
3528
|
const frames = parseStackFrames(stackParser, syntheticException);
|
|
3107
3529
|
if (frames.length) {
|
|
3108
3530
|
event.exception = {
|
|
3109
|
-
values: [{
|
|
3110
|
-
value: message,
|
|
3111
|
-
stacktrace: {
|
|
3112
|
-
frames
|
|
3113
|
-
}
|
|
3114
|
-
}]
|
|
3531
|
+
values: [{ value: message, stacktrace: { frames } }],
|
|
3115
3532
|
};
|
|
3116
3533
|
}
|
|
3117
|
-
exports$1.addExceptionMechanism(event, {
|
|
3118
|
-
synthetic: true
|
|
3119
|
-
});
|
|
3534
|
+
exports$1.addExceptionMechanism(event, { synthetic: true });
|
|
3120
3535
|
}
|
|
3536
|
+
|
|
3121
3537
|
if (exports$1.isParameterizedString(message)) {
|
|
3122
|
-
const {
|
|
3123
|
-
|
|
3124
|
-
__sentry_template_values__
|
|
3125
|
-
} = message;
|
|
3538
|
+
const { __sentry_template_string__, __sentry_template_values__ } = message;
|
|
3539
|
+
|
|
3126
3540
|
event.logentry = {
|
|
3127
3541
|
message: __sentry_template_string__,
|
|
3128
|
-
params: __sentry_template_values__
|
|
3542
|
+
params: __sentry_template_values__,
|
|
3129
3543
|
};
|
|
3130
3544
|
return event;
|
|
3131
3545
|
}
|
|
3546
|
+
|
|
3132
3547
|
event.message = message;
|
|
3133
3548
|
return event;
|
|
3134
3549
|
}
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3550
|
+
|
|
3551
|
+
function getNonErrorObjectExceptionValue(
|
|
3552
|
+
exception,
|
|
3553
|
+
{ isUnhandledRejection },
|
|
3554
|
+
) {
|
|
3138
3555
|
const keys = exports$1.extractExceptionKeysForMessage(exception);
|
|
3139
3556
|
const captureType = isUnhandledRejection ? 'promise rejection' : 'exception';
|
|
3140
3557
|
|
|
@@ -3143,12 +3560,15 @@ function getNonErrorObjectExceptionValue(exception, {
|
|
|
3143
3560
|
if (exports$1.isErrorEvent(exception)) {
|
|
3144
3561
|
return `Event \`ErrorEvent\` captured as ${captureType} with message \`${exception.message}\``;
|
|
3145
3562
|
}
|
|
3563
|
+
|
|
3146
3564
|
if (exports$1.isEvent(exception)) {
|
|
3147
3565
|
const className = getObjectClassName(exception);
|
|
3148
3566
|
return `Event \`${className}\` (type=${exception.type}) captured as ${captureType}`;
|
|
3149
3567
|
}
|
|
3568
|
+
|
|
3150
3569
|
return `Object captured as ${captureType} with keys: ${keys}`;
|
|
3151
3570
|
}
|
|
3571
|
+
|
|
3152
3572
|
function getObjectClassName(obj) {
|
|
3153
3573
|
try {
|
|
3154
3574
|
const prototype = Object.getPrototypeOf(obj);
|
|
@@ -3168,6 +3588,7 @@ function getErrorPropertyFromObject(obj) {
|
|
|
3168
3588
|
}
|
|
3169
3589
|
}
|
|
3170
3590
|
}
|
|
3591
|
+
|
|
3171
3592
|
return undefined;
|
|
3172
3593
|
}
|
|
3173
3594
|
|
|
@@ -3185,28 +3606,28 @@ const DEFAULT_FLUSH_INTERVAL = 5000;
|
|
|
3185
3606
|
* @see SentryClient for usage documentation.
|
|
3186
3607
|
*/
|
|
3187
3608
|
class BrowserClient extends Client {
|
|
3609
|
+
|
|
3188
3610
|
/**
|
|
3189
3611
|
* Creates a new Browser SDK instance.
|
|
3190
3612
|
*
|
|
3191
3613
|
* @param options Configuration options for this SDK.
|
|
3192
3614
|
*/
|
|
3193
|
-
|
|
3615
|
+
constructor(options) {
|
|
3194
3616
|
const opts = {
|
|
3195
3617
|
// We default this to true, as it is the safer scenario
|
|
3196
3618
|
parentSpanIsAlwaysRootSpan: true,
|
|
3197
|
-
...options
|
|
3619
|
+
...options,
|
|
3198
3620
|
};
|
|
3199
3621
|
const sdkSource = WINDOW$1.SENTRY_SDK_SOURCE || getSDKSource();
|
|
3200
3622
|
applySdkMetadata(opts, 'browser', ['browser'], sdkSource);
|
|
3623
|
+
|
|
3201
3624
|
super(opts);
|
|
3202
3625
|
|
|
3203
3626
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3204
3627
|
const client = this;
|
|
3205
|
-
const {
|
|
3206
|
-
sendDefaultPii,
|
|
3207
|
-
_experiments
|
|
3208
|
-
} = client._options;
|
|
3628
|
+
const { sendDefaultPii, _experiments } = client._options;
|
|
3209
3629
|
const enableLogs = _experiments?.enableLogs;
|
|
3630
|
+
|
|
3210
3631
|
if (opts.sendClientReports && WINDOW$1.document) {
|
|
3211
3632
|
WINDOW$1.document.addEventListener('visibilitychange', () => {
|
|
3212
3633
|
if (WINDOW$1.document.visibilityState === 'hidden') {
|
|
@@ -3217,19 +3638,23 @@ class BrowserClient extends Client {
|
|
|
3217
3638
|
}
|
|
3218
3639
|
});
|
|
3219
3640
|
}
|
|
3641
|
+
|
|
3220
3642
|
if (enableLogs) {
|
|
3221
3643
|
client.on('flush', () => {
|
|
3222
3644
|
_INTERNAL_flushLogsBuffer(client);
|
|
3223
3645
|
});
|
|
3646
|
+
|
|
3224
3647
|
client.on('afterCaptureLog', () => {
|
|
3225
3648
|
if (client._logFlushIdleTimeout) {
|
|
3226
3649
|
clearTimeout(client._logFlushIdleTimeout);
|
|
3227
3650
|
}
|
|
3651
|
+
|
|
3228
3652
|
client._logFlushIdleTimeout = setTimeout(() => {
|
|
3229
3653
|
_INTERNAL_flushLogsBuffer(client);
|
|
3230
3654
|
}, DEFAULT_FLUSH_INTERVAL);
|
|
3231
3655
|
});
|
|
3232
3656
|
}
|
|
3657
|
+
|
|
3233
3658
|
if (sendDefaultPii) {
|
|
3234
3659
|
client.on('postprocessEvent', addAutoIpAddressToUser);
|
|
3235
3660
|
client.on('beforeSendSession', addAutoIpAddressToSession);
|
|
@@ -3239,22 +3664,32 @@ class BrowserClient extends Client {
|
|
|
3239
3664
|
/**
|
|
3240
3665
|
* @inheritDoc
|
|
3241
3666
|
*/
|
|
3242
|
-
|
|
3667
|
+
eventFromException(exception, hint) {
|
|
3243
3668
|
return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);
|
|
3244
3669
|
}
|
|
3245
3670
|
|
|
3246
3671
|
/**
|
|
3247
3672
|
* @inheritDoc
|
|
3248
3673
|
*/
|
|
3249
|
-
|
|
3674
|
+
eventFromMessage(
|
|
3675
|
+
message,
|
|
3676
|
+
level = 'info',
|
|
3677
|
+
hint,
|
|
3678
|
+
) {
|
|
3250
3679
|
return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);
|
|
3251
3680
|
}
|
|
3252
3681
|
|
|
3253
3682
|
/**
|
|
3254
3683
|
* @inheritDoc
|
|
3255
3684
|
*/
|
|
3256
|
-
|
|
3685
|
+
_prepareEvent(
|
|
3686
|
+
event,
|
|
3687
|
+
hint,
|
|
3688
|
+
currentScope,
|
|
3689
|
+
isolationScope,
|
|
3690
|
+
) {
|
|
3257
3691
|
event.platform = event.platform || 'javascript';
|
|
3692
|
+
|
|
3258
3693
|
return super._prepareEvent(event, hint, currentScope, isolationScope);
|
|
3259
3694
|
}
|
|
3260
3695
|
}
|
|
@@ -3264,11 +3699,14 @@ class BrowserClient extends Client {
|
|
|
3264
3699
|
*
|
|
3265
3700
|
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
3266
3701
|
*/
|
|
3267
|
-
const DEBUG_BUILD$1 = typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__;
|
|
3702
|
+
const DEBUG_BUILD$1 = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
3703
|
+
|
|
3704
|
+
const WINDOW = exports$1.GLOBAL_OBJ
|
|
3268
3705
|
|
|
3269
|
-
|
|
3706
|
+
;
|
|
3270
3707
|
|
|
3271
3708
|
const DEBOUNCE_DURATION = 1000;
|
|
3709
|
+
|
|
3272
3710
|
let debounceTimerID;
|
|
3273
3711
|
let lastCapturedEventType;
|
|
3274
3712
|
let lastCapturedEventTargetId;
|
|
@@ -3304,64 +3742,74 @@ function instrumentDOM() {
|
|
|
3304
3742
|
// way, whenever one of their handlers is triggered, ours will be, too. (This is needed because their handler
|
|
3305
3743
|
// could potentially prevent the event from bubbling up to our global listeners. This way, our handler are still
|
|
3306
3744
|
// guaranteed to fire at least once.)
|
|
3307
|
-
['EventTarget', 'Node'].forEach(target => {
|
|
3308
|
-
const globalObject = WINDOW;
|
|
3745
|
+
['EventTarget', 'Node'].forEach((target) => {
|
|
3746
|
+
const globalObject = WINDOW ;
|
|
3309
3747
|
const proto = globalObject[target]?.prototype;
|
|
3310
3748
|
|
|
3311
3749
|
// eslint-disable-next-line no-prototype-builtins
|
|
3312
3750
|
if (!proto?.hasOwnProperty?.('addEventListener')) {
|
|
3313
3751
|
return;
|
|
3314
3752
|
}
|
|
3753
|
+
|
|
3315
3754
|
exports$1.fill(proto, 'addEventListener', function (originalAddEventListener) {
|
|
3316
|
-
return function (type, listener, options) {
|
|
3755
|
+
return function ( type, listener, options) {
|
|
3317
3756
|
if (type === 'click' || type == 'keypress') {
|
|
3318
3757
|
try {
|
|
3319
|
-
const handlers = this.__sentry_instrumentation_handlers__ =
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3758
|
+
const handlers = (this.__sentry_instrumentation_handlers__ =
|
|
3759
|
+
this.__sentry_instrumentation_handlers__ || {});
|
|
3760
|
+
const handlerForType = (handlers[type] = handlers[type] || { refCount: 0 });
|
|
3761
|
+
|
|
3323
3762
|
if (!handlerForType.handler) {
|
|
3324
3763
|
const handler = makeDOMEventHandler(triggerDOMHandler);
|
|
3325
3764
|
handlerForType.handler = handler;
|
|
3326
3765
|
originalAddEventListener.call(this, type, handler, options);
|
|
3327
3766
|
}
|
|
3767
|
+
|
|
3328
3768
|
handlerForType.refCount++;
|
|
3329
3769
|
} catch (e) {
|
|
3330
3770
|
// Accessing dom properties is always fragile.
|
|
3331
3771
|
// Also allows us to skip `addEventListeners` calls with no proper `this` context.
|
|
3332
3772
|
}
|
|
3333
3773
|
}
|
|
3774
|
+
|
|
3334
3775
|
return originalAddEventListener.call(this, type, listener, options);
|
|
3335
3776
|
};
|
|
3336
3777
|
});
|
|
3337
|
-
exports$1.fill(proto, 'removeEventListener', function (originalRemoveEventListener) {
|
|
3338
|
-
return function (type, listener, options) {
|
|
3339
|
-
if (type === 'click' || type == 'keypress') {
|
|
3340
|
-
try {
|
|
3341
|
-
const handlers = this.__sentry_instrumentation_handlers__ || {};
|
|
3342
|
-
const handlerForType = handlers[type];
|
|
3343
|
-
if (handlerForType) {
|
|
3344
|
-
handlerForType.refCount--;
|
|
3345
|
-
// If there are no longer any custom handlers of the current type on this element, we can remove ours, too.
|
|
3346
|
-
if (handlerForType.refCount <= 0) {
|
|
3347
|
-
originalRemoveEventListener.call(this, type, handlerForType.handler, options);
|
|
3348
|
-
handlerForType.handler = undefined;
|
|
3349
|
-
delete handlers[type]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
3350
|
-
}
|
|
3351
3778
|
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3779
|
+
exports$1.fill(
|
|
3780
|
+
proto,
|
|
3781
|
+
'removeEventListener',
|
|
3782
|
+
function (originalRemoveEventListener) {
|
|
3783
|
+
return function ( type, listener, options) {
|
|
3784
|
+
if (type === 'click' || type == 'keypress') {
|
|
3785
|
+
try {
|
|
3786
|
+
const handlers = this.__sentry_instrumentation_handlers__ || {};
|
|
3787
|
+
const handlerForType = handlers[type];
|
|
3788
|
+
|
|
3789
|
+
if (handlerForType) {
|
|
3790
|
+
handlerForType.refCount--;
|
|
3791
|
+
// If there are no longer any custom handlers of the current type on this element, we can remove ours, too.
|
|
3792
|
+
if (handlerForType.refCount <= 0) {
|
|
3793
|
+
originalRemoveEventListener.call(this, type, handlerForType.handler, options);
|
|
3794
|
+
handlerForType.handler = undefined;
|
|
3795
|
+
delete handlers[type]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
3796
|
+
}
|
|
3797
|
+
|
|
3798
|
+
// If there are no longer any custom handlers of any type on this element, cleanup everything.
|
|
3799
|
+
if (Object.keys(handlers).length === 0) {
|
|
3800
|
+
delete this.__sentry_instrumentation_handlers__;
|
|
3801
|
+
}
|
|
3355
3802
|
}
|
|
3803
|
+
} catch (e) {
|
|
3804
|
+
// Accessing dom properties is always fragile.
|
|
3805
|
+
// Also allows us to skip `addEventListeners` calls with no proper `this` context.
|
|
3356
3806
|
}
|
|
3357
|
-
} catch (e) {
|
|
3358
|
-
// Accessing dom properties is always fragile.
|
|
3359
|
-
// Also allows us to skip `addEventListeners` calls with no proper `this` context.
|
|
3360
3807
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3808
|
+
|
|
3809
|
+
return originalRemoveEventListener.call(this, type, listener, options);
|
|
3810
|
+
};
|
|
3811
|
+
},
|
|
3812
|
+
);
|
|
3365
3813
|
});
|
|
3366
3814
|
}
|
|
3367
3815
|
|
|
@@ -3373,10 +3821,11 @@ function isSimilarToLastCapturedEvent(event) {
|
|
|
3373
3821
|
if (event.type !== lastCapturedEventType) {
|
|
3374
3822
|
return false;
|
|
3375
3823
|
}
|
|
3824
|
+
|
|
3376
3825
|
try {
|
|
3377
3826
|
// If both events have the same type, it's still possible that actions were performed on different targets.
|
|
3378
3827
|
// e.g. 2 clicks on different buttons.
|
|
3379
|
-
if (!event.target || event.target._sentryId !== lastCapturedEventTargetId) {
|
|
3828
|
+
if (!event.target || (event.target )._sentryId !== lastCapturedEventTargetId) {
|
|
3380
3829
|
return false;
|
|
3381
3830
|
}
|
|
3382
3831
|
} catch (e) {
|
|
@@ -3399,6 +3848,7 @@ function shouldSkipDOMEvent(eventType, target) {
|
|
|
3399
3848
|
if (eventType !== 'keypress') {
|
|
3400
3849
|
return false;
|
|
3401
3850
|
}
|
|
3851
|
+
|
|
3402
3852
|
if (!target?.tagName) {
|
|
3403
3853
|
return true;
|
|
3404
3854
|
}
|
|
@@ -3408,20 +3858,25 @@ function shouldSkipDOMEvent(eventType, target) {
|
|
|
3408
3858
|
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {
|
|
3409
3859
|
return false;
|
|
3410
3860
|
}
|
|
3861
|
+
|
|
3411
3862
|
return true;
|
|
3412
3863
|
}
|
|
3413
3864
|
|
|
3414
3865
|
/**
|
|
3415
3866
|
* Wraps addEventListener to capture UI breadcrumbs
|
|
3416
3867
|
*/
|
|
3417
|
-
function makeDOMEventHandler(
|
|
3418
|
-
|
|
3868
|
+
function makeDOMEventHandler(
|
|
3869
|
+
handler,
|
|
3870
|
+
globalListener = false,
|
|
3871
|
+
) {
|
|
3872
|
+
return (event) => {
|
|
3419
3873
|
// It's possible this handler might trigger multiple times for the same
|
|
3420
3874
|
// event (e.g. event propagation through node ancestors).
|
|
3421
3875
|
// Ignore if we've already captured that event.
|
|
3422
3876
|
if (!event || event['_sentryCaptured']) {
|
|
3423
3877
|
return;
|
|
3424
3878
|
}
|
|
3879
|
+
|
|
3425
3880
|
const target = getEventTarget(event);
|
|
3426
3881
|
|
|
3427
3882
|
// We always want to skip _some_ events.
|
|
@@ -3431,21 +3886,19 @@ function makeDOMEventHandler(handler, globalListener = false) {
|
|
|
3431
3886
|
|
|
3432
3887
|
// Mark event as "seen"
|
|
3433
3888
|
exports$1.addNonEnumerableProperty(event, '_sentryCaptured', true);
|
|
3889
|
+
|
|
3434
3890
|
if (target && !target._sentryId) {
|
|
3435
3891
|
// Add UUID to event target so we can identify if
|
|
3436
3892
|
exports$1.addNonEnumerableProperty(target, '_sentryId', exports$1.uuid4());
|
|
3437
3893
|
}
|
|
3894
|
+
|
|
3438
3895
|
const name = event.type === 'keypress' ? 'input' : event.type;
|
|
3439
3896
|
|
|
3440
3897
|
// If there is no last captured event, it means that we can safely capture the new event and store it for future comparisons.
|
|
3441
3898
|
// If there is a last captured event, see if the new event is different enough to treat it as a unique one.
|
|
3442
3899
|
// If that's the case, emit the previous event and store locally the newly-captured DOM event.
|
|
3443
3900
|
if (!isSimilarToLastCapturedEvent(event)) {
|
|
3444
|
-
const handlerData = {
|
|
3445
|
-
event,
|
|
3446
|
-
name,
|
|
3447
|
-
global: globalListener
|
|
3448
|
-
};
|
|
3901
|
+
const handlerData = { event, name, global: globalListener };
|
|
3449
3902
|
handler(handlerData);
|
|
3450
3903
|
lastCapturedEventType = event.type;
|
|
3451
3904
|
lastCapturedEventTargetId = target ? target._sentryId : undefined;
|
|
@@ -3459,9 +3912,10 @@ function makeDOMEventHandler(handler, globalListener = false) {
|
|
|
3459
3912
|
}, DEBOUNCE_DURATION);
|
|
3460
3913
|
};
|
|
3461
3914
|
}
|
|
3915
|
+
|
|
3462
3916
|
function getEventTarget(event) {
|
|
3463
3917
|
try {
|
|
3464
|
-
return event.target;
|
|
3918
|
+
return event.target ;
|
|
3465
3919
|
} catch (e) {
|
|
3466
3920
|
// just accessing `target` property can throw an exception in some rare circumstances
|
|
3467
3921
|
// see: https://github.com/getsentry/sentry-javascript/issues/838
|
|
@@ -3496,13 +3950,12 @@ function instrumentHistory() {
|
|
|
3496
3950
|
// keep track of the current URL state, as we always receive only the updated state
|
|
3497
3951
|
const from = lastHref;
|
|
3498
3952
|
lastHref = to;
|
|
3953
|
+
|
|
3499
3954
|
if (from === to) {
|
|
3500
3955
|
return;
|
|
3501
3956
|
}
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
to
|
|
3505
|
-
};
|
|
3957
|
+
|
|
3958
|
+
const handlerData = { from, to } ;
|
|
3506
3959
|
triggerHandlers('history', handlerData);
|
|
3507
3960
|
});
|
|
3508
3961
|
|
|
@@ -3510,8 +3963,9 @@ function instrumentHistory() {
|
|
|
3510
3963
|
if (!supportsHistory()) {
|
|
3511
3964
|
return;
|
|
3512
3965
|
}
|
|
3966
|
+
|
|
3513
3967
|
function historyReplacementFunction(originalHistoryFunction) {
|
|
3514
|
-
return function (...args) {
|
|
3968
|
+
return function ( ...args) {
|
|
3515
3969
|
const url = args.length > 2 ? args[2] : undefined;
|
|
3516
3970
|
if (url) {
|
|
3517
3971
|
const from = lastHref;
|
|
@@ -3525,21 +3979,22 @@ function instrumentHistory() {
|
|
|
3525
3979
|
|
|
3526
3980
|
// keep track of the current URL state, as we always receive only the updated state
|
|
3527
3981
|
lastHref = to;
|
|
3982
|
+
|
|
3528
3983
|
if (from === to) {
|
|
3529
3984
|
return originalHistoryFunction.apply(this, args);
|
|
3530
3985
|
}
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
to
|
|
3534
|
-
};
|
|
3986
|
+
|
|
3987
|
+
const handlerData = { from, to } ;
|
|
3535
3988
|
triggerHandlers('history', handlerData);
|
|
3536
3989
|
}
|
|
3537
3990
|
return originalHistoryFunction.apply(this, args);
|
|
3538
3991
|
};
|
|
3539
3992
|
}
|
|
3993
|
+
|
|
3540
3994
|
exports$1.fill(WINDOW.history, 'pushState', historyReplacementFunction);
|
|
3541
3995
|
exports$1.fill(WINDOW.history, 'replaceState', historyReplacementFunction);
|
|
3542
3996
|
}
|
|
3997
|
+
|
|
3543
3998
|
function getAbsoluteUrl(urlOrPath) {
|
|
3544
3999
|
try {
|
|
3545
4000
|
const url = new URL(urlOrPath, WINDOW.location.origin);
|
|
@@ -3567,17 +4022,21 @@ const cachedImplementations = {};
|
|
|
3567
4022
|
* - `setTimeout`: This can be wrapped by e.g. Angular, causing change detection to be triggered.
|
|
3568
4023
|
* - `fetch`: This can be wrapped by e.g. ad-blockers, causing an infinite loop when a request is blocked.
|
|
3569
4024
|
*/
|
|
3570
|
-
function getNativeImplementation(
|
|
4025
|
+
function getNativeImplementation(
|
|
4026
|
+
name,
|
|
4027
|
+
) {
|
|
3571
4028
|
const cached = cachedImplementations[name];
|
|
3572
4029
|
if (cached) {
|
|
3573
4030
|
return cached;
|
|
3574
4031
|
}
|
|
3575
|
-
|
|
4032
|
+
|
|
4033
|
+
let impl = WINDOW[name] ;
|
|
3576
4034
|
|
|
3577
4035
|
// Fast path to avoid DOM I/O
|
|
3578
4036
|
if (isNativeFunction(impl)) {
|
|
3579
|
-
return cachedImplementations[name] = impl.bind(WINDOW);
|
|
4037
|
+
return (cachedImplementations[name] = impl.bind(WINDOW) );
|
|
3580
4038
|
}
|
|
4039
|
+
|
|
3581
4040
|
const document = WINDOW.document;
|
|
3582
4041
|
// eslint-disable-next-line deprecation/deprecation
|
|
3583
4042
|
if (document && typeof document.createElement === 'function') {
|
|
@@ -3587,7 +4046,7 @@ function getNativeImplementation(name) {
|
|
|
3587
4046
|
document.head.appendChild(sandbox);
|
|
3588
4047
|
const contentWindow = sandbox.contentWindow;
|
|
3589
4048
|
if (contentWindow?.[name]) {
|
|
3590
|
-
impl = contentWindow[name];
|
|
4049
|
+
impl = contentWindow[name] ;
|
|
3591
4050
|
}
|
|
3592
4051
|
document.head.removeChild(sandbox);
|
|
3593
4052
|
} catch (e) {
|
|
@@ -3601,7 +4060,8 @@ function getNativeImplementation(name) {
|
|
|
3601
4060
|
if (!impl) {
|
|
3602
4061
|
return impl;
|
|
3603
4062
|
}
|
|
3604
|
-
|
|
4063
|
+
|
|
4064
|
+
return (cachedImplementations[name] = impl.bind(WINDOW) );
|
|
3605
4065
|
}
|
|
3606
4066
|
|
|
3607
4067
|
/** Clear a cached implementation. */
|
|
@@ -3627,45 +4087,58 @@ function addXhrInstrumentationHandler(handler) {
|
|
|
3627
4087
|
|
|
3628
4088
|
/** Exported only for tests. */
|
|
3629
4089
|
function instrumentXHR() {
|
|
3630
|
-
if (!WINDOW.XMLHttpRequest) {
|
|
4090
|
+
if (!(WINDOW ).XMLHttpRequest) {
|
|
3631
4091
|
return;
|
|
3632
4092
|
}
|
|
4093
|
+
|
|
3633
4094
|
const xhrproto = XMLHttpRequest.prototype;
|
|
3634
4095
|
|
|
3635
4096
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
3636
4097
|
xhrproto.open = new Proxy(xhrproto.open, {
|
|
3637
|
-
apply(
|
|
4098
|
+
apply(
|
|
4099
|
+
originalOpen,
|
|
4100
|
+
xhrOpenThisArg,
|
|
4101
|
+
xhrOpenArgArray
|
|
4102
|
+
|
|
4103
|
+
,
|
|
4104
|
+
) {
|
|
3638
4105
|
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
|
3639
4106
|
// it means the error, that was caused by your XHR call did not
|
|
3640
4107
|
// have a stack trace. If you are using HttpClient integration,
|
|
3641
4108
|
// this is the expected behavior, as we are using this virtual error to capture
|
|
3642
4109
|
// the location of your XHR call, and group your HttpClient events accordingly.
|
|
3643
4110
|
const virtualError = new Error();
|
|
4111
|
+
|
|
3644
4112
|
const startTimestamp = exports$1.timestampInSeconds() * 1000;
|
|
3645
4113
|
|
|
3646
4114
|
// open() should always be called with two or more arguments
|
|
3647
4115
|
// But to be on the safe side, we actually validate this and bail out if we don't have a method & url
|
|
3648
4116
|
const method = exports$1.isString(xhrOpenArgArray[0]) ? xhrOpenArgArray[0].toUpperCase() : undefined;
|
|
3649
4117
|
const url = parseXhrUrlArg(xhrOpenArgArray[1]);
|
|
4118
|
+
|
|
3650
4119
|
if (!method || !url) {
|
|
3651
4120
|
return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray);
|
|
3652
4121
|
}
|
|
4122
|
+
|
|
3653
4123
|
xhrOpenThisArg[SENTRY_XHR_DATA_KEY] = {
|
|
3654
4124
|
method,
|
|
3655
4125
|
url,
|
|
3656
|
-
request_headers: {}
|
|
4126
|
+
request_headers: {},
|
|
3657
4127
|
};
|
|
3658
4128
|
|
|
3659
4129
|
// if Sentry key appears in URL, don't capture it as a request
|
|
3660
4130
|
if (method === 'POST' && url.match(/sentry_key/)) {
|
|
3661
4131
|
xhrOpenThisArg.__sentry_own_request__ = true;
|
|
3662
4132
|
}
|
|
4133
|
+
|
|
3663
4134
|
const onreadystatechangeHandler = () => {
|
|
3664
4135
|
// For whatever reason, this is not the same instance here as from the outer method
|
|
3665
4136
|
const xhrInfo = xhrOpenThisArg[SENTRY_XHR_DATA_KEY];
|
|
4137
|
+
|
|
3666
4138
|
if (!xhrInfo) {
|
|
3667
4139
|
return;
|
|
3668
4140
|
}
|
|
4141
|
+
|
|
3669
4142
|
if (xhrOpenThisArg.readyState === 4) {
|
|
3670
4143
|
try {
|
|
3671
4144
|
// touching statusCode in some platforms throws
|
|
@@ -3674,21 +4147,23 @@ function instrumentXHR() {
|
|
|
3674
4147
|
} catch (e) {
|
|
3675
4148
|
/* do nothing */
|
|
3676
4149
|
}
|
|
4150
|
+
|
|
3677
4151
|
const handlerData = {
|
|
3678
4152
|
endTimestamp: exports$1.timestampInSeconds() * 1000,
|
|
3679
4153
|
startTimestamp,
|
|
3680
4154
|
xhr: xhrOpenThisArg,
|
|
3681
|
-
virtualError
|
|
4155
|
+
virtualError,
|
|
3682
4156
|
};
|
|
3683
4157
|
triggerHandlers('xhr', handlerData);
|
|
3684
4158
|
}
|
|
3685
4159
|
};
|
|
4160
|
+
|
|
3686
4161
|
if ('onreadystatechange' in xhrOpenThisArg && typeof xhrOpenThisArg.onreadystatechange === 'function') {
|
|
3687
4162
|
xhrOpenThisArg.onreadystatechange = new Proxy(xhrOpenThisArg.onreadystatechange, {
|
|
3688
4163
|
apply(originalOnreadystatechange, onreadystatechangeThisArg, onreadystatechangeArgArray) {
|
|
3689
4164
|
onreadystatechangeHandler();
|
|
3690
4165
|
return originalOnreadystatechange.apply(onreadystatechangeThisArg, onreadystatechangeArgArray);
|
|
3691
|
-
}
|
|
4166
|
+
},
|
|
3692
4167
|
});
|
|
3693
4168
|
} else {
|
|
3694
4169
|
xhrOpenThisArg.addEventListener('readystatechange', onreadystatechangeHandler);
|
|
@@ -3698,36 +4173,48 @@ function instrumentXHR() {
|
|
|
3698
4173
|
// This will only work for user/library defined headers, not for the default/browser-assigned headers.
|
|
3699
4174
|
// Request cookies are also unavailable for XHR, as `Cookie` header can't be defined by `setRequestHeader`.
|
|
3700
4175
|
xhrOpenThisArg.setRequestHeader = new Proxy(xhrOpenThisArg.setRequestHeader, {
|
|
3701
|
-
apply(
|
|
4176
|
+
apply(
|
|
4177
|
+
originalSetRequestHeader,
|
|
4178
|
+
setRequestHeaderThisArg,
|
|
4179
|
+
setRequestHeaderArgArray,
|
|
4180
|
+
) {
|
|
3702
4181
|
const [header, value] = setRequestHeaderArgArray;
|
|
4182
|
+
|
|
3703
4183
|
const xhrInfo = setRequestHeaderThisArg[SENTRY_XHR_DATA_KEY];
|
|
4184
|
+
|
|
3704
4185
|
if (xhrInfo && exports$1.isString(header) && exports$1.isString(value)) {
|
|
3705
4186
|
xhrInfo.request_headers[header.toLowerCase()] = value;
|
|
3706
4187
|
}
|
|
4188
|
+
|
|
3707
4189
|
return originalSetRequestHeader.apply(setRequestHeaderThisArg, setRequestHeaderArgArray);
|
|
3708
|
-
}
|
|
4190
|
+
},
|
|
3709
4191
|
});
|
|
4192
|
+
|
|
3710
4193
|
return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray);
|
|
3711
|
-
}
|
|
4194
|
+
},
|
|
3712
4195
|
});
|
|
3713
4196
|
|
|
3714
4197
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
3715
4198
|
xhrproto.send = new Proxy(xhrproto.send, {
|
|
3716
4199
|
apply(originalSend, sendThisArg, sendArgArray) {
|
|
3717
4200
|
const sentryXhrData = sendThisArg[SENTRY_XHR_DATA_KEY];
|
|
4201
|
+
|
|
3718
4202
|
if (!sentryXhrData) {
|
|
3719
4203
|
return originalSend.apply(sendThisArg, sendArgArray);
|
|
3720
4204
|
}
|
|
4205
|
+
|
|
3721
4206
|
if (sendArgArray[0] !== undefined) {
|
|
3722
4207
|
sentryXhrData.body = sendArgArray[0];
|
|
3723
4208
|
}
|
|
4209
|
+
|
|
3724
4210
|
const handlerData = {
|
|
3725
4211
|
startTimestamp: exports$1.timestampInSeconds() * 1000,
|
|
3726
|
-
xhr: sendThisArg
|
|
4212
|
+
xhr: sendThisArg,
|
|
3727
4213
|
};
|
|
3728
4214
|
triggerHandlers('xhr', handlerData);
|
|
4215
|
+
|
|
3729
4216
|
return originalSend.apply(sendThisArg, sendArgArray);
|
|
3730
|
-
}
|
|
4217
|
+
},
|
|
3731
4218
|
});
|
|
3732
4219
|
}
|
|
3733
4220
|
|
|
@@ -3744,10 +4231,11 @@ function parseXhrUrlArg(url) {
|
|
|
3744
4231
|
if (exports$1.isString(url)) {
|
|
3745
4232
|
return url;
|
|
3746
4233
|
}
|
|
4234
|
+
|
|
3747
4235
|
try {
|
|
3748
4236
|
// If the passed in argument is not a string, it should have a `toString` method as a stringifier.
|
|
3749
4237
|
// If that fails, we just return undefined (like in IE11 where URL is not available)
|
|
3750
|
-
return url.toString();
|
|
4238
|
+
return (url ).toString();
|
|
3751
4239
|
} catch {} // eslint-disable-line no-empty
|
|
3752
4240
|
|
|
3753
4241
|
return undefined;
|
|
@@ -3756,13 +4244,18 @@ function parseXhrUrlArg(url) {
|
|
|
3756
4244
|
/**
|
|
3757
4245
|
* Creates a Transport that uses the Fetch API to send events to Sentry.
|
|
3758
4246
|
*/
|
|
3759
|
-
function makeFetchTransport(
|
|
4247
|
+
function makeFetchTransport(
|
|
4248
|
+
options,
|
|
4249
|
+
nativeFetch = getNativeImplementation('fetch'),
|
|
4250
|
+
) {
|
|
3760
4251
|
let pendingBodySize = 0;
|
|
3761
4252
|
let pendingCount = 0;
|
|
4253
|
+
|
|
3762
4254
|
function makeRequest(request) {
|
|
3763
4255
|
const requestSize = request.body.length;
|
|
3764
4256
|
pendingBodySize += requestSize;
|
|
3765
4257
|
pendingCount++;
|
|
4258
|
+
|
|
3766
4259
|
const requestOptions = {
|
|
3767
4260
|
body: request.body,
|
|
3768
4261
|
method: 'POST',
|
|
@@ -3780,12 +4273,14 @@ function makeFetchTransport(options, nativeFetch = getNativeImplementation('fetc
|
|
|
3780
4273
|
// There is also a limit of requests that can be open at the same time, so we also limit this to 15
|
|
3781
4274
|
// See https://github.com/getsentry/sentry-javascript/pull/7553 for details
|
|
3782
4275
|
keepalive: pendingBodySize <= 60000 && pendingCount < 15,
|
|
3783
|
-
...options.fetchOptions
|
|
4276
|
+
...options.fetchOptions,
|
|
3784
4277
|
};
|
|
4278
|
+
|
|
3785
4279
|
if (!nativeFetch) {
|
|
3786
4280
|
clearCachedImplementation('fetch');
|
|
3787
4281
|
return exports$1.rejectedSyncPromise('No fetch implementation available');
|
|
3788
4282
|
}
|
|
4283
|
+
|
|
3789
4284
|
try {
|
|
3790
4285
|
// TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL
|
|
3791
4286
|
return nativeFetch(options.url, requestOptions).then(response => {
|
|
@@ -3795,8 +4290,8 @@ function makeFetchTransport(options, nativeFetch = getNativeImplementation('fetc
|
|
|
3795
4290
|
statusCode: response.status,
|
|
3796
4291
|
headers: {
|
|
3797
4292
|
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
|
|
3798
|
-
'retry-after': response.headers.get('Retry-After')
|
|
3799
|
-
}
|
|
4293
|
+
'retry-after': response.headers.get('Retry-After'),
|
|
4294
|
+
},
|
|
3800
4295
|
};
|
|
3801
4296
|
});
|
|
3802
4297
|
} catch (e) {
|
|
@@ -3806,23 +4301,28 @@ function makeFetchTransport(options, nativeFetch = getNativeImplementation('fetc
|
|
|
3806
4301
|
return exports$1.rejectedSyncPromise(e);
|
|
3807
4302
|
}
|
|
3808
4303
|
}
|
|
4304
|
+
|
|
3809
4305
|
return createTransport(options, makeRequest);
|
|
3810
4306
|
}
|
|
3811
4307
|
|
|
3812
4308
|
const CHROME_PRIORITY = 30;
|
|
3813
4309
|
const GECKO_PRIORITY = 50;
|
|
4310
|
+
|
|
3814
4311
|
function createFrame(filename, func, lineno, colno) {
|
|
3815
4312
|
const frame = {
|
|
3816
4313
|
filename,
|
|
3817
4314
|
function: func === '<anonymous>' ? exports$1.UNKNOWN_FUNCTION : func,
|
|
3818
|
-
in_app: true // All browser frames are considered in_app
|
|
4315
|
+
in_app: true, // All browser frames are considered in_app
|
|
3819
4316
|
};
|
|
4317
|
+
|
|
3820
4318
|
if (lineno !== undefined) {
|
|
3821
4319
|
frame.lineno = lineno;
|
|
3822
4320
|
}
|
|
4321
|
+
|
|
3823
4322
|
if (colno !== undefined) {
|
|
3824
4323
|
frame.colno = colno;
|
|
3825
4324
|
}
|
|
4325
|
+
|
|
3826
4326
|
return frame;
|
|
3827
4327
|
}
|
|
3828
4328
|
|
|
@@ -3832,7 +4332,9 @@ function createFrame(filename, func, lineno, colno) {
|
|
|
3832
4332
|
const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
3833
4333
|
|
|
3834
4334
|
// This regex matches all the frames that have a function name.
|
|
3835
|
-
const chromeRegex =
|
|
4335
|
+
const chromeRegex =
|
|
4336
|
+
/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
4337
|
+
|
|
3836
4338
|
const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
3837
4339
|
|
|
3838
4340
|
// Chromium based browsers: Chrome, Brave, new Opera, new Edge
|
|
@@ -3840,17 +4342,21 @@ const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
|
3840
4342
|
// See: https://github.com/getsentry/sentry-javascript/issues/6880
|
|
3841
4343
|
const chromeStackParserFn = line => {
|
|
3842
4344
|
// If the stack line has no function name, we need to parse it differently
|
|
3843
|
-
const noFnParts = chromeRegexNoFnName.exec(line);
|
|
4345
|
+
const noFnParts = chromeRegexNoFnName.exec(line) ;
|
|
4346
|
+
|
|
3844
4347
|
if (noFnParts) {
|
|
3845
4348
|
const [, filename, line, col] = noFnParts;
|
|
3846
4349
|
return createFrame(filename, exports$1.UNKNOWN_FUNCTION, +line, +col);
|
|
3847
4350
|
}
|
|
3848
|
-
|
|
4351
|
+
|
|
4352
|
+
const parts = chromeRegex.exec(line) ;
|
|
4353
|
+
|
|
3849
4354
|
if (parts) {
|
|
3850
4355
|
const isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
|
|
3851
4356
|
|
|
3852
4357
|
if (isEval) {
|
|
3853
|
-
const subMatch = chromeEvalRegex.exec(parts[2]);
|
|
4358
|
+
const subMatch = chromeEvalRegex.exec(parts[2]) ;
|
|
4359
|
+
|
|
3854
4360
|
if (subMatch) {
|
|
3855
4361
|
// throw out eval line/column and use top-most line/column number
|
|
3856
4362
|
parts[2] = subMatch[1]; // url
|
|
@@ -3862,23 +4368,30 @@ const chromeStackParserFn = line => {
|
|
|
3862
4368
|
// Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
|
|
3863
4369
|
// would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
|
|
3864
4370
|
const [func, filename] = extractSafariExtensionDetails(parts[1] || exports$1.UNKNOWN_FUNCTION, parts[2]);
|
|
4371
|
+
|
|
3865
4372
|
return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);
|
|
3866
4373
|
}
|
|
4374
|
+
|
|
3867
4375
|
return;
|
|
3868
4376
|
};
|
|
4377
|
+
|
|
3869
4378
|
const chromeStackLineParser = [CHROME_PRIORITY, chromeStackParserFn];
|
|
3870
4379
|
|
|
3871
4380
|
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
|
|
3872
4381
|
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
|
|
3873
4382
|
// We need this specific case for now because we want no other regex to match.
|
|
3874
|
-
const geckoREgex =
|
|
4383
|
+
const geckoREgex =
|
|
4384
|
+
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
3875
4385
|
const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
4386
|
+
|
|
3876
4387
|
const gecko = line => {
|
|
3877
|
-
const parts = geckoREgex.exec(line);
|
|
4388
|
+
const parts = geckoREgex.exec(line) ;
|
|
4389
|
+
|
|
3878
4390
|
if (parts) {
|
|
3879
4391
|
const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
|
|
3880
4392
|
if (isEval) {
|
|
3881
|
-
const subMatch = geckoEvalRegex.exec(parts[3]);
|
|
4393
|
+
const subMatch = geckoEvalRegex.exec(parts[3]) ;
|
|
4394
|
+
|
|
3882
4395
|
if (subMatch) {
|
|
3883
4396
|
// throw out eval line/column and use top-most line number
|
|
3884
4397
|
parts[1] = parts[1] || 'eval';
|
|
@@ -3887,15 +4400,21 @@ const gecko = line => {
|
|
|
3887
4400
|
parts[5] = ''; // no column when eval
|
|
3888
4401
|
}
|
|
3889
4402
|
}
|
|
4403
|
+
|
|
3890
4404
|
let filename = parts[3];
|
|
3891
4405
|
let func = parts[1] || exports$1.UNKNOWN_FUNCTION;
|
|
3892
4406
|
[func, filename] = extractSafariExtensionDetails(func, filename);
|
|
4407
|
+
|
|
3893
4408
|
return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);
|
|
3894
4409
|
}
|
|
4410
|
+
|
|
3895
4411
|
return;
|
|
3896
4412
|
};
|
|
4413
|
+
|
|
3897
4414
|
const geckoStackLineParser = [GECKO_PRIORITY, gecko];
|
|
4415
|
+
|
|
3898
4416
|
const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser];
|
|
4417
|
+
|
|
3899
4418
|
const defaultStackParser = exports$1.createStackParser(...defaultStackLineParsers);
|
|
3900
4419
|
|
|
3901
4420
|
/**
|
|
@@ -3921,7 +4440,13 @@ const defaultStackParser = exports$1.createStackParser(...defaultStackLineParser
|
|
|
3921
4440
|
const extractSafariExtensionDetails = (func, filename) => {
|
|
3922
4441
|
const isSafariExtension = func.indexOf('safari-extension') !== -1;
|
|
3923
4442
|
const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1;
|
|
3924
|
-
|
|
4443
|
+
|
|
4444
|
+
return isSafariExtension || isSafariWebExtension
|
|
4445
|
+
? [
|
|
4446
|
+
func.indexOf('@') !== -1 ? (func.split('@')[0] ) : exports$1.UNKNOWN_FUNCTION,
|
|
4447
|
+
isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,
|
|
4448
|
+
]
|
|
4449
|
+
: [func, filename];
|
|
3925
4450
|
};
|
|
3926
4451
|
|
|
3927
4452
|
/**
|
|
@@ -3929,12 +4454,14 @@ const extractSafariExtensionDetails = (func, filename) => {
|
|
|
3929
4454
|
*
|
|
3930
4455
|
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
3931
4456
|
*/
|
|
3932
|
-
const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__;
|
|
4457
|
+
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
3933
4458
|
|
|
3934
4459
|
/** maxStringLength gets capped to prevent 100 breadcrumbs exceeding 1MB event payload size */
|
|
3935
4460
|
const MAX_ALLOWED_STRING_LENGTH = 1024;
|
|
4461
|
+
|
|
3936
4462
|
const INTEGRATION_NAME$3 = 'Breadcrumbs';
|
|
3937
|
-
|
|
4463
|
+
|
|
4464
|
+
const _breadcrumbsIntegration = ((options = {}) => {
|
|
3938
4465
|
const _options = {
|
|
3939
4466
|
console: true,
|
|
3940
4467
|
dom: true,
|
|
@@ -3942,8 +4469,9 @@ const _breadcrumbsIntegration = (options = {}) => {
|
|
|
3942
4469
|
history: true,
|
|
3943
4470
|
sentry: true,
|
|
3944
4471
|
xhr: true,
|
|
3945
|
-
...options
|
|
4472
|
+
...options,
|
|
3946
4473
|
};
|
|
4474
|
+
|
|
3947
4475
|
return {
|
|
3948
4476
|
name: INTEGRATION_NAME$3,
|
|
3949
4477
|
setup(client) {
|
|
@@ -3966,9 +4494,10 @@ const _breadcrumbsIntegration = (options = {}) => {
|
|
|
3966
4494
|
if (_options.sentry) {
|
|
3967
4495
|
client.on('beforeSendEvent', _getSentryBreadcrumbHandler(client));
|
|
3968
4496
|
}
|
|
3969
|
-
}
|
|
4497
|
+
},
|
|
3970
4498
|
};
|
|
3971
|
-
};
|
|
4499
|
+
}) ;
|
|
4500
|
+
|
|
3972
4501
|
const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration);
|
|
3973
4502
|
|
|
3974
4503
|
/**
|
|
@@ -3979,14 +4508,18 @@ function _getSentryBreadcrumbHandler(client) {
|
|
|
3979
4508
|
if (exports$1.getClient() !== client) {
|
|
3980
4509
|
return;
|
|
3981
4510
|
}
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4511
|
+
|
|
4512
|
+
addBreadcrumb(
|
|
4513
|
+
{
|
|
4514
|
+
category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,
|
|
4515
|
+
event_id: event.event_id,
|
|
4516
|
+
level: event.level,
|
|
4517
|
+
message: exports$1.getEventDescription(event),
|
|
4518
|
+
},
|
|
4519
|
+
{
|
|
4520
|
+
event,
|
|
4521
|
+
},
|
|
4522
|
+
);
|
|
3990
4523
|
};
|
|
3991
4524
|
}
|
|
3992
4525
|
|
|
@@ -3994,51 +4527,61 @@ function _getSentryBreadcrumbHandler(client) {
|
|
|
3994
4527
|
* A HOC that creates a function that creates breadcrumbs from DOM API calls.
|
|
3995
4528
|
* This is a HOC so that we get access to dom options in the closure.
|
|
3996
4529
|
*/
|
|
3997
|
-
function _getDomBreadcrumbHandler(
|
|
4530
|
+
function _getDomBreadcrumbHandler(
|
|
4531
|
+
client,
|
|
4532
|
+
dom,
|
|
4533
|
+
) {
|
|
3998
4534
|
return function _innerDomBreadcrumb(handlerData) {
|
|
3999
4535
|
if (exports$1.getClient() !== client) {
|
|
4000
4536
|
return;
|
|
4001
4537
|
}
|
|
4538
|
+
|
|
4002
4539
|
let target;
|
|
4003
4540
|
let componentName;
|
|
4004
4541
|
let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;
|
|
4005
|
-
|
|
4542
|
+
|
|
4543
|
+
let maxStringLength =
|
|
4544
|
+
typeof dom === 'object' && typeof dom.maxStringLength === 'number' ? dom.maxStringLength : undefined;
|
|
4006
4545
|
if (maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH) {
|
|
4007
|
-
DEBUG_BUILD &&
|
|
4546
|
+
DEBUG_BUILD &&
|
|
4547
|
+
exports$1.logger.warn(
|
|
4548
|
+
`\`dom.maxStringLength\` cannot exceed ${MAX_ALLOWED_STRING_LENGTH}, but a value of ${maxStringLength} was configured. Sentry will use ${MAX_ALLOWED_STRING_LENGTH} instead.`,
|
|
4549
|
+
);
|
|
4008
4550
|
maxStringLength = MAX_ALLOWED_STRING_LENGTH;
|
|
4009
4551
|
}
|
|
4552
|
+
|
|
4010
4553
|
if (typeof keyAttrs === 'string') {
|
|
4011
4554
|
keyAttrs = [keyAttrs];
|
|
4012
4555
|
}
|
|
4013
4556
|
|
|
4014
4557
|
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
|
|
4015
4558
|
try {
|
|
4016
|
-
const event = handlerData.event;
|
|
4559
|
+
const event = handlerData.event ;
|
|
4017
4560
|
const element = _isEvent(event) ? event.target : event;
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
maxStringLength
|
|
4021
|
-
});
|
|
4561
|
+
|
|
4562
|
+
target = exports$1.htmlTreeAsString(element, { keyAttrs, maxStringLength });
|
|
4022
4563
|
componentName = exports$1.getComponentName(element);
|
|
4023
4564
|
} catch (e) {
|
|
4024
4565
|
target = '<unknown>';
|
|
4025
4566
|
}
|
|
4567
|
+
|
|
4026
4568
|
if (target.length === 0) {
|
|
4027
4569
|
return;
|
|
4028
4570
|
}
|
|
4571
|
+
|
|
4029
4572
|
const breadcrumb = {
|
|
4030
4573
|
category: `ui.${handlerData.name}`,
|
|
4031
|
-
message: target
|
|
4574
|
+
message: target,
|
|
4032
4575
|
};
|
|
4576
|
+
|
|
4033
4577
|
if (componentName) {
|
|
4034
|
-
breadcrumb.data = {
|
|
4035
|
-
'ui.component_name': componentName
|
|
4036
|
-
};
|
|
4578
|
+
breadcrumb.data = { 'ui.component_name': componentName };
|
|
4037
4579
|
}
|
|
4580
|
+
|
|
4038
4581
|
addBreadcrumb(breadcrumb, {
|
|
4039
4582
|
event: handlerData.event,
|
|
4040
4583
|
name: handlerData.name,
|
|
4041
|
-
global: handlerData.global
|
|
4584
|
+
global: handlerData.global,
|
|
4042
4585
|
});
|
|
4043
4586
|
};
|
|
4044
4587
|
}
|
|
@@ -4051,15 +4594,17 @@ function _getConsoleBreadcrumbHandler(client) {
|
|
|
4051
4594
|
if (exports$1.getClient() !== client) {
|
|
4052
4595
|
return;
|
|
4053
4596
|
}
|
|
4597
|
+
|
|
4054
4598
|
const breadcrumb = {
|
|
4055
4599
|
category: 'console',
|
|
4056
4600
|
data: {
|
|
4057
4601
|
arguments: handlerData.args,
|
|
4058
|
-
logger: 'console'
|
|
4602
|
+
logger: 'console',
|
|
4059
4603
|
},
|
|
4060
4604
|
level: severityLevelFromString(handlerData.level),
|
|
4061
|
-
message: exports$1.safeJoin(handlerData.args, ' ')
|
|
4605
|
+
message: exports$1.safeJoin(handlerData.args, ' '),
|
|
4062
4606
|
};
|
|
4607
|
+
|
|
4063
4608
|
if (handlerData.level === 'assert') {
|
|
4064
4609
|
if (handlerData.args[0] === false) {
|
|
4065
4610
|
breadcrumb.message = `Assertion failed: ${exports$1.safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;
|
|
@@ -4069,9 +4614,10 @@ function _getConsoleBreadcrumbHandler(client) {
|
|
|
4069
4614
|
return;
|
|
4070
4615
|
}
|
|
4071
4616
|
}
|
|
4617
|
+
|
|
4072
4618
|
addBreadcrumb(breadcrumb, {
|
|
4073
4619
|
input: handlerData.args,
|
|
4074
|
-
level: handlerData.level
|
|
4620
|
+
level: handlerData.level,
|
|
4075
4621
|
});
|
|
4076
4622
|
};
|
|
4077
4623
|
}
|
|
@@ -4084,40 +4630,40 @@ function _getXhrBreadcrumbHandler(client) {
|
|
|
4084
4630
|
if (exports$1.getClient() !== client) {
|
|
4085
4631
|
return;
|
|
4086
4632
|
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
} = handlerData;
|
|
4633
|
+
|
|
4634
|
+
const { startTimestamp, endTimestamp } = handlerData;
|
|
4635
|
+
|
|
4091
4636
|
const sentryXhrData = handlerData.xhr[SENTRY_XHR_DATA_KEY];
|
|
4092
4637
|
|
|
4093
4638
|
// We only capture complete, non-sentry requests
|
|
4094
4639
|
if (!startTimestamp || !endTimestamp || !sentryXhrData) {
|
|
4095
4640
|
return;
|
|
4096
4641
|
}
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
status_code,
|
|
4101
|
-
body
|
|
4102
|
-
} = sentryXhrData;
|
|
4642
|
+
|
|
4643
|
+
const { method, url, status_code, body } = sentryXhrData;
|
|
4644
|
+
|
|
4103
4645
|
const data = {
|
|
4104
4646
|
method,
|
|
4105
4647
|
url,
|
|
4106
|
-
status_code
|
|
4648
|
+
status_code,
|
|
4107
4649
|
};
|
|
4650
|
+
|
|
4108
4651
|
const hint = {
|
|
4109
4652
|
xhr: handlerData.xhr,
|
|
4110
4653
|
input: body,
|
|
4111
4654
|
startTimestamp,
|
|
4112
|
-
endTimestamp
|
|
4655
|
+
endTimestamp,
|
|
4113
4656
|
};
|
|
4657
|
+
|
|
4114
4658
|
const breadcrumb = {
|
|
4115
4659
|
category: 'xhr',
|
|
4116
4660
|
data,
|
|
4117
4661
|
type: 'http',
|
|
4118
|
-
level: getBreadcrumbLogLevelFromHttpStatusCode(status_code)
|
|
4662
|
+
level: getBreadcrumbLogLevelFromHttpStatusCode(status_code),
|
|
4119
4663
|
};
|
|
4120
|
-
|
|
4664
|
+
|
|
4665
|
+
client.emit('beforeOutgoingRequestBreadcrumb', breadcrumb, hint );
|
|
4666
|
+
|
|
4121
4667
|
addBreadcrumb(breadcrumb, hint);
|
|
4122
4668
|
};
|
|
4123
4669
|
}
|
|
@@ -4130,54 +4676,61 @@ function _getFetchBreadcrumbHandler(client) {
|
|
|
4130
4676
|
if (exports$1.getClient() !== client) {
|
|
4131
4677
|
return;
|
|
4132
4678
|
}
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
endTimestamp
|
|
4136
|
-
} = handlerData;
|
|
4679
|
+
|
|
4680
|
+
const { startTimestamp, endTimestamp } = handlerData;
|
|
4137
4681
|
|
|
4138
4682
|
// We only capture complete fetch requests
|
|
4139
4683
|
if (!endTimestamp) {
|
|
4140
4684
|
return;
|
|
4141
4685
|
}
|
|
4686
|
+
|
|
4142
4687
|
if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
|
|
4143
4688
|
// We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
|
|
4144
4689
|
return;
|
|
4145
4690
|
}
|
|
4691
|
+
|
|
4146
4692
|
if (handlerData.error) {
|
|
4147
4693
|
const data = handlerData.fetchData;
|
|
4148
4694
|
const hint = {
|
|
4149
4695
|
data: handlerData.error,
|
|
4150
4696
|
input: handlerData.args,
|
|
4151
4697
|
startTimestamp,
|
|
4152
|
-
endTimestamp
|
|
4698
|
+
endTimestamp,
|
|
4153
4699
|
};
|
|
4700
|
+
|
|
4154
4701
|
const breadcrumb = {
|
|
4155
4702
|
category: 'fetch',
|
|
4156
4703
|
data,
|
|
4157
4704
|
level: 'error',
|
|
4158
|
-
type: 'http'
|
|
4159
|
-
};
|
|
4160
|
-
|
|
4705
|
+
type: 'http',
|
|
4706
|
+
} ;
|
|
4707
|
+
|
|
4708
|
+
client.emit('beforeOutgoingRequestBreadcrumb', breadcrumb, hint );
|
|
4709
|
+
|
|
4161
4710
|
addBreadcrumb(breadcrumb, hint);
|
|
4162
4711
|
} else {
|
|
4163
|
-
const response = handlerData.response;
|
|
4712
|
+
const response = handlerData.response ;
|
|
4164
4713
|
const data = {
|
|
4165
4714
|
...handlerData.fetchData,
|
|
4166
|
-
status_code: response?.status
|
|
4715
|
+
status_code: response?.status,
|
|
4167
4716
|
};
|
|
4717
|
+
|
|
4168
4718
|
const hint = {
|
|
4169
4719
|
input: handlerData.args,
|
|
4170
4720
|
response,
|
|
4171
4721
|
startTimestamp,
|
|
4172
|
-
endTimestamp
|
|
4722
|
+
endTimestamp,
|
|
4173
4723
|
};
|
|
4724
|
+
|
|
4174
4725
|
const breadcrumb = {
|
|
4175
4726
|
category: 'fetch',
|
|
4176
4727
|
data,
|
|
4177
4728
|
type: 'http',
|
|
4178
|
-
level: getBreadcrumbLogLevelFromHttpStatusCode(data.status_code)
|
|
4729
|
+
level: getBreadcrumbLogLevelFromHttpStatusCode(data.status_code),
|
|
4179
4730
|
};
|
|
4180
|
-
|
|
4731
|
+
|
|
4732
|
+
client.emit('beforeOutgoingRequestBreadcrumb', breadcrumb, hint );
|
|
4733
|
+
|
|
4181
4734
|
addBreadcrumb(breadcrumb, hint);
|
|
4182
4735
|
}
|
|
4183
4736
|
};
|
|
@@ -4191,6 +4744,7 @@ function _getHistoryBreadcrumbHandler(client) {
|
|
|
4191
4744
|
if (exports$1.getClient() !== client) {
|
|
4192
4745
|
return;
|
|
4193
4746
|
}
|
|
4747
|
+
|
|
4194
4748
|
let from = handlerData.from;
|
|
4195
4749
|
let to = handlerData.to;
|
|
4196
4750
|
const parsedLoc = parseUrl(WINDOW$1.location.href);
|
|
@@ -4210,30 +4764,67 @@ function _getHistoryBreadcrumbHandler(client) {
|
|
|
4210
4764
|
if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
|
|
4211
4765
|
from = parsedFrom.relative;
|
|
4212
4766
|
}
|
|
4767
|
+
|
|
4213
4768
|
addBreadcrumb({
|
|
4214
4769
|
category: 'navigation',
|
|
4215
4770
|
data: {
|
|
4216
4771
|
from,
|
|
4217
|
-
to
|
|
4218
|
-
}
|
|
4772
|
+
to,
|
|
4773
|
+
},
|
|
4219
4774
|
});
|
|
4220
4775
|
};
|
|
4221
4776
|
}
|
|
4777
|
+
|
|
4222
4778
|
function _isEvent(event) {
|
|
4223
|
-
return !!event && !!event.target;
|
|
4224
|
-
}
|
|
4779
|
+
return !!event && !!(event ).target;
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4782
|
+
const DEFAULT_EVENT_TARGET = [
|
|
4783
|
+
'EventTarget',
|
|
4784
|
+
'Window',
|
|
4785
|
+
'Node',
|
|
4786
|
+
'ApplicationCache',
|
|
4787
|
+
'AudioTrackList',
|
|
4788
|
+
'BroadcastChannel',
|
|
4789
|
+
'ChannelMergerNode',
|
|
4790
|
+
'CryptoOperation',
|
|
4791
|
+
'EventSource',
|
|
4792
|
+
'FileReader',
|
|
4793
|
+
'HTMLUnknownElement',
|
|
4794
|
+
'IDBDatabase',
|
|
4795
|
+
'IDBRequest',
|
|
4796
|
+
'IDBTransaction',
|
|
4797
|
+
'KeyOperation',
|
|
4798
|
+
'MediaController',
|
|
4799
|
+
'MessagePort',
|
|
4800
|
+
'ModalWindow',
|
|
4801
|
+
'Notification',
|
|
4802
|
+
'SVGElementInstance',
|
|
4803
|
+
'Screen',
|
|
4804
|
+
'SharedWorker',
|
|
4805
|
+
'TextTrack',
|
|
4806
|
+
'TextTrackCue',
|
|
4807
|
+
'TextTrackList',
|
|
4808
|
+
'WebSocket',
|
|
4809
|
+
'WebSocketWorker',
|
|
4810
|
+
'Worker',
|
|
4811
|
+
'XMLHttpRequest',
|
|
4812
|
+
'XMLHttpRequestEventTarget',
|
|
4813
|
+
'XMLHttpRequestUpload',
|
|
4814
|
+
];
|
|
4225
4815
|
|
|
4226
|
-
const DEFAULT_EVENT_TARGET = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'BroadcastChannel', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'SharedWorker', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];
|
|
4227
4816
|
const INTEGRATION_NAME$2 = 'BrowserApiErrors';
|
|
4228
|
-
|
|
4817
|
+
|
|
4818
|
+
const _browserApiErrorsIntegration = ((options = {}) => {
|
|
4229
4819
|
const _options = {
|
|
4230
4820
|
XMLHttpRequest: true,
|
|
4231
4821
|
eventTarget: true,
|
|
4232
4822
|
requestAnimationFrame: true,
|
|
4233
4823
|
setInterval: true,
|
|
4234
4824
|
setTimeout: true,
|
|
4235
|
-
...options
|
|
4825
|
+
...options,
|
|
4236
4826
|
};
|
|
4827
|
+
|
|
4237
4828
|
return {
|
|
4238
4829
|
name: INTEGRATION_NAME$2,
|
|
4239
4830
|
// TODO: This currently only works for the first client this is setup
|
|
@@ -4242,62 +4833,70 @@ const _browserApiErrorsIntegration = (options = {}) => {
|
|
|
4242
4833
|
if (_options.setTimeout) {
|
|
4243
4834
|
exports$1.fill(WINDOW$1, 'setTimeout', _wrapTimeFunction);
|
|
4244
4835
|
}
|
|
4836
|
+
|
|
4245
4837
|
if (_options.setInterval) {
|
|
4246
4838
|
exports$1.fill(WINDOW$1, 'setInterval', _wrapTimeFunction);
|
|
4247
4839
|
}
|
|
4840
|
+
|
|
4248
4841
|
if (_options.requestAnimationFrame) {
|
|
4249
4842
|
exports$1.fill(WINDOW$1, 'requestAnimationFrame', _wrapRAF);
|
|
4250
4843
|
}
|
|
4844
|
+
|
|
4251
4845
|
if (_options.XMLHttpRequest && 'XMLHttpRequest' in WINDOW$1) {
|
|
4252
4846
|
exports$1.fill(XMLHttpRequest.prototype, 'send', _wrapXHR);
|
|
4253
4847
|
}
|
|
4848
|
+
|
|
4254
4849
|
const eventTargetOption = _options.eventTarget;
|
|
4255
4850
|
if (eventTargetOption) {
|
|
4256
4851
|
const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET;
|
|
4257
4852
|
eventTarget.forEach(_wrapEventTarget);
|
|
4258
4853
|
}
|
|
4259
|
-
}
|
|
4854
|
+
},
|
|
4260
4855
|
};
|
|
4261
|
-
};
|
|
4856
|
+
}) ;
|
|
4262
4857
|
|
|
4263
4858
|
/**
|
|
4264
4859
|
* Wrap timer functions and event targets to catch errors and provide better meta data.
|
|
4265
4860
|
*/
|
|
4266
4861
|
const browserApiErrorsIntegration = defineIntegration(_browserApiErrorsIntegration);
|
|
4862
|
+
|
|
4267
4863
|
function _wrapTimeFunction(original) {
|
|
4268
|
-
return function (...args) {
|
|
4864
|
+
return function ( ...args) {
|
|
4269
4865
|
const originalCallback = args[0];
|
|
4270
4866
|
args[0] = wrap(originalCallback, {
|
|
4271
4867
|
mechanism: {
|
|
4272
|
-
data: {
|
|
4273
|
-
function: exports$1.getFunctionName(original)
|
|
4274
|
-
},
|
|
4868
|
+
data: { function: exports$1.getFunctionName(original) },
|
|
4275
4869
|
handled: false,
|
|
4276
|
-
type: 'instrument'
|
|
4277
|
-
}
|
|
4870
|
+
type: 'instrument',
|
|
4871
|
+
},
|
|
4278
4872
|
});
|
|
4279
4873
|
return original.apply(this, args);
|
|
4280
4874
|
};
|
|
4281
4875
|
}
|
|
4876
|
+
|
|
4282
4877
|
function _wrapRAF(original) {
|
|
4283
|
-
return function (callback) {
|
|
4284
|
-
return original.apply(this, [
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4878
|
+
return function ( callback) {
|
|
4879
|
+
return original.apply(this, [
|
|
4880
|
+
wrap(callback, {
|
|
4881
|
+
mechanism: {
|
|
4882
|
+
data: {
|
|
4883
|
+
function: 'requestAnimationFrame',
|
|
4884
|
+
handler: exports$1.getFunctionName(original),
|
|
4885
|
+
},
|
|
4886
|
+
handled: false,
|
|
4887
|
+
type: 'instrument',
|
|
4289
4888
|
},
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
}
|
|
4293
|
-
})]);
|
|
4889
|
+
}),
|
|
4890
|
+
]);
|
|
4294
4891
|
};
|
|
4295
4892
|
}
|
|
4893
|
+
|
|
4296
4894
|
function _wrapXHR(originalSend) {
|
|
4297
|
-
return function (...args) {
|
|
4895
|
+
return function ( ...args) {
|
|
4298
4896
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4299
4897
|
const xhr = this;
|
|
4300
4898
|
const xmlHttpRequestProps = ['onload', 'onerror', 'onprogress', 'onreadystatechange'];
|
|
4899
|
+
|
|
4301
4900
|
xmlHttpRequestProps.forEach(prop => {
|
|
4302
4901
|
if (prop in xhr && typeof xhr[prop] === 'function') {
|
|
4303
4902
|
exports$1.fill(xhr, prop, function (original) {
|
|
@@ -4305,11 +4904,11 @@ function _wrapXHR(originalSend) {
|
|
|
4305
4904
|
mechanism: {
|
|
4306
4905
|
data: {
|
|
4307
4906
|
function: prop,
|
|
4308
|
-
handler: exports$1.getFunctionName(original)
|
|
4907
|
+
handler: exports$1.getFunctionName(original),
|
|
4309
4908
|
},
|
|
4310
4909
|
handled: false,
|
|
4311
|
-
type: 'instrument'
|
|
4312
|
-
}
|
|
4910
|
+
type: 'instrument',
|
|
4911
|
+
},
|
|
4313
4912
|
};
|
|
4314
4913
|
|
|
4315
4914
|
// If Instrument integration has been called before BrowserApiErrors, get the name of original function
|
|
@@ -4323,19 +4922,24 @@ function _wrapXHR(originalSend) {
|
|
|
4323
4922
|
});
|
|
4324
4923
|
}
|
|
4325
4924
|
});
|
|
4925
|
+
|
|
4326
4926
|
return originalSend.apply(this, args);
|
|
4327
4927
|
};
|
|
4328
4928
|
}
|
|
4929
|
+
|
|
4329
4930
|
function _wrapEventTarget(target) {
|
|
4330
|
-
const globalObject = WINDOW$1;
|
|
4931
|
+
const globalObject = WINDOW$1 ;
|
|
4331
4932
|
const proto = globalObject[target]?.prototype;
|
|
4332
4933
|
|
|
4333
4934
|
// eslint-disable-next-line no-prototype-builtins
|
|
4334
4935
|
if (!proto?.hasOwnProperty?.('addEventListener')) {
|
|
4335
4936
|
return;
|
|
4336
4937
|
}
|
|
4337
|
-
|
|
4338
|
-
|
|
4938
|
+
|
|
4939
|
+
exports$1.fill(proto, 'addEventListener', function (original)
|
|
4940
|
+
|
|
4941
|
+
{
|
|
4942
|
+
return function ( eventName, fn, options) {
|
|
4339
4943
|
try {
|
|
4340
4944
|
if (isEventListenerObject(fn)) {
|
|
4341
4945
|
// ESlint disable explanation:
|
|
@@ -4349,31 +4953,39 @@ function _wrapEventTarget(target) {
|
|
|
4349
4953
|
data: {
|
|
4350
4954
|
function: 'handleEvent',
|
|
4351
4955
|
handler: exports$1.getFunctionName(fn),
|
|
4352
|
-
target
|
|
4956
|
+
target,
|
|
4353
4957
|
},
|
|
4354
4958
|
handled: false,
|
|
4355
|
-
type: 'instrument'
|
|
4356
|
-
}
|
|
4959
|
+
type: 'instrument',
|
|
4960
|
+
},
|
|
4357
4961
|
});
|
|
4358
4962
|
}
|
|
4359
4963
|
} catch {
|
|
4360
4964
|
// can sometimes get 'Permission denied to access property "handle Event'
|
|
4361
4965
|
}
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4966
|
+
|
|
4967
|
+
return original.apply(this, [
|
|
4968
|
+
eventName,
|
|
4969
|
+
wrap(fn, {
|
|
4970
|
+
mechanism: {
|
|
4971
|
+
data: {
|
|
4972
|
+
function: 'addEventListener',
|
|
4973
|
+
handler: exports$1.getFunctionName(fn),
|
|
4974
|
+
target,
|
|
4975
|
+
},
|
|
4976
|
+
handled: false,
|
|
4977
|
+
type: 'instrument',
|
|
4368
4978
|
},
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
}), options]);
|
|
4979
|
+
}),
|
|
4980
|
+
options,
|
|
4981
|
+
]);
|
|
4373
4982
|
};
|
|
4374
4983
|
});
|
|
4375
|
-
|
|
4376
|
-
|
|
4984
|
+
|
|
4985
|
+
exports$1.fill(proto, 'removeEventListener', function (originalRemoveEventListener)
|
|
4986
|
+
|
|
4987
|
+
{
|
|
4988
|
+
return function ( eventName, fn, options) {
|
|
4377
4989
|
/**
|
|
4378
4990
|
* There are 2 possible scenarios here:
|
|
4379
4991
|
*
|
|
@@ -4392,7 +5004,7 @@ function _wrapEventTarget(target) {
|
|
|
4392
5004
|
* to get rid of the initial handler and it'd stick there forever.
|
|
4393
5005
|
*/
|
|
4394
5006
|
try {
|
|
4395
|
-
const originalEventHandler = fn.__sentry_wrapped__;
|
|
5007
|
+
const originalEventHandler = (fn ).__sentry_wrapped__;
|
|
4396
5008
|
if (originalEventHandler) {
|
|
4397
5009
|
originalRemoveEventListener.call(this, eventName, originalEventHandler, options);
|
|
4398
5010
|
}
|
|
@@ -4403,8 +5015,9 @@ function _wrapEventTarget(target) {
|
|
|
4403
5015
|
};
|
|
4404
5016
|
});
|
|
4405
5017
|
}
|
|
5018
|
+
|
|
4406
5019
|
function isEventListenerObject(obj) {
|
|
4407
|
-
return typeof obj.handleEvent === 'function';
|
|
5020
|
+
return typeof (obj ).handleEvent === 'function';
|
|
4408
5021
|
}
|
|
4409
5022
|
|
|
4410
5023
|
/**
|
|
@@ -4418,7 +5031,8 @@ const browserSessionIntegration = defineIntegration(() => {
|
|
|
4418
5031
|
name: 'BrowserSession',
|
|
4419
5032
|
setupOnce() {
|
|
4420
5033
|
if (typeof WINDOW$1.document === 'undefined') {
|
|
4421
|
-
DEBUG_BUILD &&
|
|
5034
|
+
DEBUG_BUILD &&
|
|
5035
|
+
exports$1.logger.warn('Using the `browserSessionIntegration` in non-browser environments is not supported.');
|
|
4422
5036
|
return;
|
|
4423
5037
|
}
|
|
4424
5038
|
|
|
@@ -4426,35 +5040,30 @@ const browserSessionIntegration = defineIntegration(() => {
|
|
|
4426
5040
|
// concept that can be used as a metric.
|
|
4427
5041
|
// Automatically captured sessions are akin to page views, and thus we
|
|
4428
5042
|
// discard their duration.
|
|
4429
|
-
exports$1.startSession({
|
|
4430
|
-
ignoreDuration: true
|
|
4431
|
-
});
|
|
5043
|
+
exports$1.startSession({ ignoreDuration: true });
|
|
4432
5044
|
exports$1.captureSession();
|
|
4433
5045
|
|
|
4434
5046
|
// We want to create a session for every navigation as well
|
|
4435
|
-
addHistoryInstrumentationHandler(({
|
|
4436
|
-
from,
|
|
4437
|
-
to
|
|
4438
|
-
}) => {
|
|
5047
|
+
addHistoryInstrumentationHandler(({ from, to }) => {
|
|
4439
5048
|
// Don't create an additional session for the initial route or if the location did not change
|
|
4440
5049
|
if (from !== undefined && from !== to) {
|
|
4441
|
-
exports$1.startSession({
|
|
4442
|
-
ignoreDuration: true
|
|
4443
|
-
});
|
|
5050
|
+
exports$1.startSession({ ignoreDuration: true });
|
|
4444
5051
|
exports$1.captureSession();
|
|
4445
5052
|
}
|
|
4446
5053
|
});
|
|
4447
|
-
}
|
|
5054
|
+
},
|
|
4448
5055
|
};
|
|
4449
5056
|
});
|
|
4450
5057
|
|
|
4451
5058
|
const INTEGRATION_NAME$1 = 'GlobalHandlers';
|
|
4452
|
-
|
|
5059
|
+
|
|
5060
|
+
const _globalHandlersIntegration = ((options = {}) => {
|
|
4453
5061
|
const _options = {
|
|
4454
5062
|
onerror: true,
|
|
4455
5063
|
onunhandledrejection: true,
|
|
4456
|
-
...options
|
|
5064
|
+
...options,
|
|
4457
5065
|
};
|
|
5066
|
+
|
|
4458
5067
|
return {
|
|
4459
5068
|
name: INTEGRATION_NAME$1,
|
|
4460
5069
|
setupOnce() {
|
|
@@ -4469,58 +5078,67 @@ const _globalHandlersIntegration = (options = {}) => {
|
|
|
4469
5078
|
_installGlobalOnUnhandledRejectionHandler(client);
|
|
4470
5079
|
globalHandlerLog('onunhandledrejection');
|
|
4471
5080
|
}
|
|
4472
|
-
}
|
|
5081
|
+
},
|
|
4473
5082
|
};
|
|
4474
|
-
};
|
|
5083
|
+
}) ;
|
|
5084
|
+
|
|
4475
5085
|
const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);
|
|
5086
|
+
|
|
4476
5087
|
function _installGlobalOnErrorHandler(client) {
|
|
4477
5088
|
addGlobalErrorInstrumentationHandler(data => {
|
|
4478
|
-
const {
|
|
4479
|
-
|
|
4480
|
-
attachStacktrace
|
|
4481
|
-
} = getOptions();
|
|
5089
|
+
const { stackParser, attachStacktrace } = getOptions();
|
|
5090
|
+
|
|
4482
5091
|
if (exports$1.getClient() !== client || shouldIgnoreOnError()) {
|
|
4483
5092
|
return;
|
|
4484
5093
|
}
|
|
4485
|
-
|
|
4486
|
-
|
|
5094
|
+
|
|
5095
|
+
const { msg, url, line, column, error } = data;
|
|
5096
|
+
|
|
5097
|
+
const event = _enhanceEventWithInitialFrame(
|
|
5098
|
+
eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),
|
|
4487
5099
|
url,
|
|
4488
5100
|
line,
|
|
4489
5101
|
column,
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
const event = _enhanceEventWithInitialFrame(eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false), url, line, column);
|
|
5102
|
+
);
|
|
5103
|
+
|
|
4493
5104
|
event.level = 'error';
|
|
5105
|
+
|
|
4494
5106
|
exports$1.captureEvent(event, {
|
|
4495
5107
|
originalException: error,
|
|
4496
5108
|
mechanism: {
|
|
4497
5109
|
handled: false,
|
|
4498
|
-
type: 'onerror'
|
|
4499
|
-
}
|
|
5110
|
+
type: 'onerror',
|
|
5111
|
+
},
|
|
4500
5112
|
});
|
|
4501
5113
|
});
|
|
4502
5114
|
}
|
|
5115
|
+
|
|
4503
5116
|
function _installGlobalOnUnhandledRejectionHandler(client) {
|
|
4504
5117
|
addGlobalUnhandledRejectionInstrumentationHandler(e => {
|
|
4505
|
-
const {
|
|
4506
|
-
|
|
4507
|
-
attachStacktrace
|
|
4508
|
-
} = getOptions();
|
|
5118
|
+
const { stackParser, attachStacktrace } = getOptions();
|
|
5119
|
+
|
|
4509
5120
|
if (exports$1.getClient() !== client || shouldIgnoreOnError()) {
|
|
4510
5121
|
return;
|
|
4511
5122
|
}
|
|
4512
|
-
|
|
4513
|
-
const
|
|
5123
|
+
|
|
5124
|
+
const error = _getUnhandledRejectionError(e );
|
|
5125
|
+
|
|
5126
|
+
const event = exports$1.isPrimitive(error)
|
|
5127
|
+
? _eventFromRejectionWithPrimitive(error)
|
|
5128
|
+
: eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);
|
|
5129
|
+
|
|
4514
5130
|
event.level = 'error';
|
|
5131
|
+
|
|
4515
5132
|
exports$1.captureEvent(event, {
|
|
4516
5133
|
originalException: error,
|
|
4517
5134
|
mechanism: {
|
|
4518
5135
|
handled: false,
|
|
4519
|
-
type: 'onunhandledrejection'
|
|
4520
|
-
}
|
|
5136
|
+
type: 'onunhandledrejection',
|
|
5137
|
+
},
|
|
4521
5138
|
});
|
|
4522
5139
|
});
|
|
4523
5140
|
}
|
|
5141
|
+
|
|
4524
5142
|
function _getUnhandledRejectionError(error) {
|
|
4525
5143
|
if (exports$1.isPrimitive(error)) {
|
|
4526
5144
|
return error;
|
|
@@ -4528,10 +5146,11 @@ function _getUnhandledRejectionError(error) {
|
|
|
4528
5146
|
|
|
4529
5147
|
// dig the object of the rejection out of known event types
|
|
4530
5148
|
try {
|
|
5149
|
+
|
|
4531
5150
|
// PromiseRejectionEvents store the object of the rejection under 'reason'
|
|
4532
5151
|
// see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
|
|
4533
|
-
if ('reason' in error) {
|
|
4534
|
-
return error.reason;
|
|
5152
|
+
if ('reason' in (error )) {
|
|
5153
|
+
return (error ).reason;
|
|
4535
5154
|
}
|
|
4536
5155
|
|
|
4537
5156
|
// something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents
|
|
@@ -4539,8 +5158,8 @@ function _getUnhandledRejectionError(error) {
|
|
|
4539
5158
|
// the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec
|
|
4540
5159
|
// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and
|
|
4541
5160
|
// https://github.com/getsentry/sentry-javascript/issues/2380
|
|
4542
|
-
if ('detail' in error && 'reason' in error.detail) {
|
|
4543
|
-
return error.detail.reason;
|
|
5161
|
+
if ('detail' in (error ) && 'reason' in (error ).detail) {
|
|
5162
|
+
return (error ).detail.reason;
|
|
4544
5163
|
}
|
|
4545
5164
|
} catch {} // eslint-disable-line no-empty
|
|
4546
5165
|
|
|
@@ -4556,25 +5175,34 @@ function _getUnhandledRejectionError(error) {
|
|
|
4556
5175
|
function _eventFromRejectionWithPrimitive(reason) {
|
|
4557
5176
|
return {
|
|
4558
5177
|
exception: {
|
|
4559
|
-
values: [
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
5178
|
+
values: [
|
|
5179
|
+
{
|
|
5180
|
+
type: 'UnhandledRejection',
|
|
5181
|
+
// String() is needed because the Primitive type includes symbols (which can't be automatically stringified)
|
|
5182
|
+
value: `Non-Error promise rejection captured with value: ${String(reason)}`,
|
|
5183
|
+
},
|
|
5184
|
+
],
|
|
5185
|
+
},
|
|
4565
5186
|
};
|
|
4566
5187
|
}
|
|
4567
|
-
|
|
5188
|
+
|
|
5189
|
+
function _enhanceEventWithInitialFrame(
|
|
5190
|
+
event,
|
|
5191
|
+
url,
|
|
5192
|
+
line,
|
|
5193
|
+
column,
|
|
5194
|
+
) {
|
|
4568
5195
|
// event.exception
|
|
4569
|
-
const e = event.exception = event.exception || {};
|
|
5196
|
+
const e = (event.exception = event.exception || {});
|
|
4570
5197
|
// event.exception.values
|
|
4571
|
-
const ev = e.values = e.values || [];
|
|
5198
|
+
const ev = (e.values = e.values || []);
|
|
4572
5199
|
// event.exception.values[0]
|
|
4573
|
-
const ev0 = ev[0] = ev[0] || {};
|
|
5200
|
+
const ev0 = (ev[0] = ev[0] || {});
|
|
4574
5201
|
// event.exception.values[0].stacktrace
|
|
4575
|
-
const ev0s = ev0.stacktrace = ev0.stacktrace || {};
|
|
5202
|
+
const ev0s = (ev0.stacktrace = ev0.stacktrace || {});
|
|
4576
5203
|
// event.exception.values[0].stacktrace.frames
|
|
4577
|
-
const ev0sf = ev0s.frames = ev0s.frames || [];
|
|
5204
|
+
const ev0sf = (ev0s.frames = ev0s.frames || []);
|
|
5205
|
+
|
|
4578
5206
|
const colno = column;
|
|
4579
5207
|
const lineno = line;
|
|
4580
5208
|
const filename = exports$1.isString(url) && url.length > 0 ? url : exports$1.getLocationHref();
|
|
@@ -4586,19 +5214,22 @@ function _enhanceEventWithInitialFrame(event, url, line, column) {
|
|
|
4586
5214
|
filename,
|
|
4587
5215
|
function: exports$1.UNKNOWN_FUNCTION,
|
|
4588
5216
|
in_app: true,
|
|
4589
|
-
lineno
|
|
5217
|
+
lineno,
|
|
4590
5218
|
});
|
|
4591
5219
|
}
|
|
5220
|
+
|
|
4592
5221
|
return event;
|
|
4593
5222
|
}
|
|
5223
|
+
|
|
4594
5224
|
function globalHandlerLog(type) {
|
|
4595
5225
|
DEBUG_BUILD && exports$1.logger.log(`Global Handler attached: ${type}`);
|
|
4596
5226
|
}
|
|
5227
|
+
|
|
4597
5228
|
function getOptions() {
|
|
4598
5229
|
const client = exports$1.getClient();
|
|
4599
5230
|
const options = client?.getOptions() || {
|
|
4600
5231
|
stackParser: () => [],
|
|
4601
|
-
attachStacktrace: false
|
|
5232
|
+
attachStacktrace: false,
|
|
4602
5233
|
};
|
|
4603
5234
|
return options;
|
|
4604
5235
|
}
|
|
@@ -4615,36 +5246,48 @@ const httpContextIntegration = defineIntegration(() => {
|
|
|
4615
5246
|
if (!WINDOW$1.navigator && !WINDOW$1.location && !WINDOW$1.document) {
|
|
4616
5247
|
return;
|
|
4617
5248
|
}
|
|
5249
|
+
|
|
4618
5250
|
const reqData = getHttpRequestData();
|
|
4619
5251
|
const headers = {
|
|
4620
5252
|
...reqData.headers,
|
|
4621
|
-
...event.request?.headers
|
|
5253
|
+
...event.request?.headers,
|
|
4622
5254
|
};
|
|
5255
|
+
|
|
4623
5256
|
event.request = {
|
|
4624
5257
|
...reqData,
|
|
4625
5258
|
...event.request,
|
|
4626
|
-
headers
|
|
5259
|
+
headers,
|
|
4627
5260
|
};
|
|
4628
|
-
}
|
|
5261
|
+
},
|
|
4629
5262
|
};
|
|
4630
5263
|
});
|
|
4631
5264
|
|
|
4632
5265
|
const DEFAULT_KEY = 'cause';
|
|
4633
5266
|
const DEFAULT_LIMIT = 5;
|
|
5267
|
+
|
|
4634
5268
|
const INTEGRATION_NAME = 'LinkedErrors';
|
|
4635
|
-
|
|
5269
|
+
|
|
5270
|
+
const _linkedErrorsIntegration = ((options = {}) => {
|
|
4636
5271
|
const limit = options.limit || DEFAULT_LIMIT;
|
|
4637
5272
|
const key = options.key || DEFAULT_KEY;
|
|
5273
|
+
|
|
4638
5274
|
return {
|
|
4639
5275
|
name: INTEGRATION_NAME,
|
|
4640
5276
|
preprocessEvent(event, hint, client) {
|
|
4641
5277
|
const options = client.getOptions();
|
|
5278
|
+
|
|
4642
5279
|
applyAggregateErrorsToEvent(
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
5280
|
+
// This differs from the LinkedErrors integration in core by using a different exceptionFromError function
|
|
5281
|
+
exceptionFromError,
|
|
5282
|
+
options.stackParser,
|
|
5283
|
+
key,
|
|
5284
|
+
limit,
|
|
5285
|
+
event,
|
|
5286
|
+
hint,
|
|
5287
|
+
);
|
|
5288
|
+
},
|
|
4646
5289
|
};
|
|
4647
|
-
};
|
|
5290
|
+
}) ;
|
|
4648
5291
|
|
|
4649
5292
|
/**
|
|
4650
5293
|
* Aggregrate linked errors in an event.
|
|
@@ -4658,23 +5301,34 @@ function getDefaultIntegrations(_options) {
|
|
|
4658
5301
|
* `getDefaultIntegrations` but with an adjusted set of integrations.
|
|
4659
5302
|
*/
|
|
4660
5303
|
return [
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
5304
|
+
// TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
|
|
5305
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
5306
|
+
inboundFiltersIntegration(),
|
|
5307
|
+
functionToStringIntegration(),
|
|
5308
|
+
browserApiErrorsIntegration(),
|
|
5309
|
+
breadcrumbsIntegration(),
|
|
5310
|
+
globalHandlersIntegration(),
|
|
5311
|
+
linkedErrorsIntegration(),
|
|
5312
|
+
dedupeIntegration(),
|
|
5313
|
+
httpContextIntegration(),
|
|
5314
|
+
browserSessionIntegration(),
|
|
5315
|
+
];
|
|
4664
5316
|
}
|
|
4665
5317
|
|
|
4666
5318
|
/** Exported only for tests. */
|
|
4667
5319
|
function applyDefaultOptions(optionsArg = {}) {
|
|
4668
5320
|
const defaultOptions = {
|
|
4669
5321
|
defaultIntegrations: getDefaultIntegrations(),
|
|
4670
|
-
release:
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
5322
|
+
release:
|
|
5323
|
+
typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value
|
|
5324
|
+
? __SENTRY_RELEASE__
|
|
5325
|
+
: WINDOW$1.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects
|
|
5326
|
+
sendClientReports: true,
|
|
4674
5327
|
};
|
|
5328
|
+
|
|
4675
5329
|
return {
|
|
4676
5330
|
...defaultOptions,
|
|
4677
|
-
...dropTopLevelUndefinedKeys(optionsArg)
|
|
5331
|
+
...dropTopLevelUndefinedKeys(optionsArg),
|
|
4678
5332
|
};
|
|
4679
5333
|
}
|
|
4680
5334
|
|
|
@@ -4684,12 +5338,14 @@ function applyDefaultOptions(optionsArg = {}) {
|
|
|
4684
5338
|
*/
|
|
4685
5339
|
function dropTopLevelUndefinedKeys(obj) {
|
|
4686
5340
|
const mutatetedObj = {};
|
|
5341
|
+
|
|
4687
5342
|
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
4688
|
-
const key = k;
|
|
5343
|
+
const key = k ;
|
|
4689
5344
|
if (obj[key] !== undefined) {
|
|
4690
5345
|
mutatetedObj[key] = obj[key];
|
|
4691
5346
|
}
|
|
4692
5347
|
}
|
|
5348
|
+
|
|
4693
5349
|
return mutatetedObj;
|
|
4694
5350
|
}
|
|
4695
5351
|
|
|
@@ -4743,76 +5399,89 @@ function init(browserOptions = {}) {
|
|
|
4743
5399
|
if (!browserOptions.skipBrowserExtensionCheck && _checkForBrowserExtension()) {
|
|
4744
5400
|
return;
|
|
4745
5401
|
}
|
|
5402
|
+
|
|
4746
5403
|
const options = applyDefaultOptions(browserOptions);
|
|
4747
5404
|
const clientOptions = {
|
|
4748
5405
|
...options,
|
|
4749
5406
|
stackParser: exports$1.stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
|
|
4750
5407
|
integrations: getIntegrationsToSetup(options),
|
|
4751
|
-
transport: options.transport || makeFetchTransport
|
|
5408
|
+
transport: options.transport || makeFetchTransport,
|
|
4752
5409
|
};
|
|
5410
|
+
|
|
4753
5411
|
return initAndBind(BrowserClient, clientOptions);
|
|
4754
5412
|
}
|
|
5413
|
+
|
|
4755
5414
|
function _isEmbeddedBrowserExtension() {
|
|
4756
5415
|
if (typeof WINDOW$1.window === 'undefined') {
|
|
4757
5416
|
// No need to show the error if we're not in a browser window environment (e.g. service workers)
|
|
4758
5417
|
return false;
|
|
4759
5418
|
}
|
|
4760
|
-
|
|
5419
|
+
|
|
5420
|
+
const _window = WINDOW$1 ;
|
|
4761
5421
|
|
|
4762
5422
|
// Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine
|
|
4763
5423
|
// see: https://github.com/getsentry/sentry-javascript/issues/12668
|
|
4764
5424
|
if (_window.nw) {
|
|
4765
5425
|
return false;
|
|
4766
5426
|
}
|
|
5427
|
+
|
|
4767
5428
|
const extensionObject = _window['chrome'] || _window['browser'];
|
|
5429
|
+
|
|
4768
5430
|
if (!extensionObject?.runtime?.id) {
|
|
4769
5431
|
return false;
|
|
4770
5432
|
}
|
|
5433
|
+
|
|
4771
5434
|
const href = exports$1.getLocationHref();
|
|
4772
5435
|
const extensionProtocols = ['chrome-extension', 'moz-extension', 'ms-browser-extension', 'safari-web-extension'];
|
|
4773
5436
|
|
|
4774
5437
|
// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
|
|
4775
|
-
const isDedicatedExtensionPage =
|
|
5438
|
+
const isDedicatedExtensionPage =
|
|
5439
|
+
WINDOW$1 === WINDOW$1.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}://`));
|
|
5440
|
+
|
|
4776
5441
|
return !isDedicatedExtensionPage;
|
|
4777
5442
|
}
|
|
5443
|
+
|
|
4778
5444
|
function _checkForBrowserExtension() {
|
|
4779
5445
|
if (_isEmbeddedBrowserExtension()) {
|
|
4780
5446
|
if (DEBUG_BUILD) {
|
|
4781
5447
|
exports$1.consoleSandbox(() => {
|
|
4782
5448
|
// eslint-disable-next-line no-console
|
|
4783
|
-
console.error(
|
|
5449
|
+
console.error(
|
|
5450
|
+
'[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',
|
|
5451
|
+
);
|
|
4784
5452
|
});
|
|
4785
5453
|
}
|
|
5454
|
+
|
|
4786
5455
|
return true;
|
|
4787
5456
|
}
|
|
4788
5457
|
}
|
|
4789
5458
|
|
|
4790
5459
|
async function appGlobalScript () {
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
5460
|
+
return await new Promise((resolve) => {
|
|
5461
|
+
init({
|
|
5462
|
+
dsn: "https://d4dd33313afbf480bb76f965a5dcc733@sentry.ylzhaopin.com/9",
|
|
5463
|
+
integrations: [],
|
|
5464
|
+
beforeSend(event) {
|
|
5465
|
+
if (event.exception && event.exception.values) {
|
|
5466
|
+
const errorValue = event.exception.values[0];
|
|
5467
|
+
if (errorValue.stacktrace && errorValue.stacktrace.frames) {
|
|
5468
|
+
const isFromSdk = errorValue.stacktrace.frames.some(frame => frame.filename && frame.filename.includes('pcm-'));
|
|
5469
|
+
if (!isFromSdk) {
|
|
5470
|
+
return null;
|
|
5471
|
+
}
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
return event;
|
|
5475
|
+
},
|
|
5476
|
+
tracesSampleRate: 0.1,
|
|
5477
|
+
});
|
|
5478
|
+
resolve({});
|
|
4808
5479
|
});
|
|
4809
|
-
resolve({});
|
|
4810
|
-
});
|
|
4811
5480
|
}
|
|
4812
5481
|
|
|
4813
5482
|
const globalScripts = appGlobalScript;
|
|
4814
5483
|
|
|
4815
5484
|
exports.globalScripts = globalScripts;
|
|
4816
|
-
//# sourceMappingURL=app-globals-
|
|
5485
|
+
//# sourceMappingURL=app-globals-BIO4q6tX.js.map
|
|
4817
5486
|
|
|
4818
|
-
//# sourceMappingURL=app-globals-
|
|
5487
|
+
//# sourceMappingURL=app-globals-BIO4q6tX.js.map
|